在Blender2.74下的Video Sequence Editor
中添加、整理和整理了我的家庭录像。我的下一个目标是自动淡入淡出,使用脚本,每个音频和视频序列。在
目前,我的脚本遍历所有序列并检查类型。如果序列类型为“电影”或“图像”,则不透明度将被设置关键帧;如果序列是声音,则将对体积设置关键帧。目前,我的脚本还能够找到每个序列的开始帧和结束帧,以及计算并跳到衰落应该开始/结束的帧。但是,要使用脚本为Graph Editor
内的不透明度和体积设置关键帧,似乎是不可能的。在
根据Blender 2.73.8api,似乎可以使用bpy.ops.graph.keyframe_insert(type='ALL')
编写关键帧脚本,但似乎没有任何能力使用脚本为不透明度或体积设置关键帧。在
有人能告诉我如何使用脚本设置不透明度和体积的关键帧吗?在
import bpy
# ----------------------------------------
# main
# ----------------------------------------
scene = bpy.context.scene
scene.frame_current = 0
queue = scene.sequence_editor.sequences
print("Frames Per Second [ ", scene.render.fps, " ].")
bpy.ops.sequencer.select_all(0)
for i in queue:
itemLead = i.frame_start
itemBack = itemLead + i.frame_final_duration
print("Lead [ ", itemLead, " ] Tail [ ", itemBack, " ].")
itemType = i.type
if itemType == "MOVIE":
i.select = 1
scene.frame_current = itemLead
i.blend_alpha = 0.0
##bpy.ops.graph.keyframe_insert(type="blend_alpha")
print("Movie mode.")
i.select = 0
continue
if itemType == "SOUND":
i.select = 1
print("Sound mode.")
i.select = 0
continue
if itemType == "IMAGE":
i.select = 1
print("Image mode.")
i.select = 0
continue
print("Skipped [ ", itemType, " ].")
要使用python添加一个关键帧,请告诉属性(strip)的所有者将其属性之一的insert a keyframe设置为insert a keyframe
您可能还注意到,可以为关键点指定帧,这样就不需要调整当前帧。如果确实要更改当前帧,最好使用^{} 。在
有关我的代码的最终版本,请参见以下内容:
相关问题 更多 >
编程相关推荐