46 lines
1.3 KiB
Python
46 lines
1.3 KiB
Python
#!/usr/bin/env python3
|
|
import pathlib
|
|
import sys
|
|
|
|
import bpy
|
|
|
|
|
|
STRIP_NAME = "WebGapAnimKeyframeDeleteVSEStrip"
|
|
ACTION_NAME = "WebGapAnimKeyframeDeleteVSEAction"
|
|
|
|
|
|
def main():
|
|
arguments = sys.argv[sys.argv.index("--") + 1 :]
|
|
if len(arguments) != 1:
|
|
raise SystemExit("usage: blender -b --factory-startup --python M16-GAP-00185.py -- OUTPUT")
|
|
|
|
bpy.ops.wm.read_factory_settings(use_empty=True)
|
|
scene = bpy.context.scene
|
|
sequence_editor = scene.sequence_editor_create()
|
|
source = pathlib.Path(__file__).resolve().parents[3] / "tests/files/web/media/sequencer-frame.png"
|
|
strip = sequence_editor.strips.new_image(
|
|
name=STRIP_NAME,
|
|
filepath=str(source),
|
|
channel=1,
|
|
frame_start=1,
|
|
)
|
|
strip.directory = "//../media/"
|
|
strip.frame_final_duration = 6
|
|
strip.select = True
|
|
sequence_editor.active_strip = strip
|
|
for frame, value in ((1, 0.25), (3, 0.5), (5, 0.75)):
|
|
scene.frame_set(frame)
|
|
strip.blend_alpha = value
|
|
strip.keyframe_insert(data_path="blend_alpha", frame=frame)
|
|
scene.animation_data.action.name = ACTION_NAME
|
|
scene.frame_start = 1
|
|
scene.frame_end = 6
|
|
scene.frame_set(3)
|
|
bpy.ops.wm.save_as_mainfile(
|
|
filepath=str(pathlib.Path(arguments[0]).resolve()), check_existing=False, compress=True
|
|
)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|