Whit python,在搅拌机中,在VIDEO SEQUENCE EDITOR中将效果条作为WIPE插入 - python

在使用VIDEO SEQUENCE EDITOR的Blender中,您可以将静止图像(.jpg或png)作为图像带插入并创建转盘。

Whit python,在搅拌机中,在VIDEO SEQUENCE EDITOR中将效果条作为WIPE插入 - python

在每个图像/图像带之间,您可以插入一个效果带作为擦拭,以在图像/图像带之间创建过渡。

Whit python,在搅拌机中,在VIDEO SEQUENCE EDITOR中将效果条作为WIPE插入 - python

结果:

Whit python,在搅拌机中,在VIDEO SEQUENCE EDITOR中将效果条作为WIPE插入 - python

我可以使用python将图像AS IMAGE STRIP插入到VIDEO SEQUENCE EDITOR中。

例:

我使用以下代码将图像AS IMAGE STRIP插入VIDEO SEQUENCE EDITOR:

import bpy, os

def importar():
    bpy.context.area.type = 'SEQUENCE_EDITOR'
    bpy.ops.sequencer.image_strip_add(directory="D:\\_webpages\\", files=[{"name": "000.jpg","name":"000.jpg" }], relative_path=True, show_multiview=False, frame_start=1, frame_end=289, channel=1);
    bpy.ops.sequencer.image_strip_add(directory="D:\\_webpages\\", files=[{"name": "001.jpg","name":"001.jpg" }], relative_path=True, show_multiview=False, frame_start=241, frame_end=529, channel=2);
    bpy.ops.sequencer.image_strip_add(directory="D:\\_webpages\\", files=[{"name": "002.jpg","name":"002.jpg" }], relative_path=True, show_multiview=False, frame_start=481, frame_end=770, channel=1);
    bpy.ops.sequencer.image_strip_add(directory="D:\\_webpages\\", files=[{"name": "003.jpg","name":"003.jpg" }], relative_path=True, show_multiview=False, frame_start=722, frame_end=1012, channel=2);
    bpy.ops.sequencer.image_strip_add(directory="D:\\_webpages\\", files=[{"name": "004.jpg","name":"004.jpg" }], relative_path=True, show_multiview=False, frame_start=964, frame_end=1255, channel=1);
    bpy.ops.sequencer.image_strip_add(directory="D:\\_webpages\\", files=[{"name": "005.jpg","name":"005.jpg" }], relative_path=True, show_multiview=False, frame_start=1207, frame_end=1499, channel=2);

importar()

结果是:我在交替的频道和自己的图像带中插入了几张图像。

图像/图像带之间有重叠部分,可以进行过渡。

如今,我想使用python将效果条创建为WIPE。

手动创建抹效果效果带,您必须:

a)用鼠标选择一张图像/图像带

b)按Shift键并用鼠标选择其他图像/图像带

c)单击选项“添加”>“效果条带”>“擦除”来添加擦除效果

选择拳头图像/图像带时,在信息窗口中将显示以下代码:

bpy.ops.sequencer.select(extend=False, linked_handle=False, left_right='NONE', linked_time=False)

当选择第二张图像/图像带时,在信息窗口中将显示以下代码:

bpy.ops.sequencer.select(extend=True, linked_handle=False, left_right='NONE', linked_time=False)

添加擦除效果时,单击选项“添加”>“效果条带”>“擦除”,在信息窗口中将显示以下代码:

bpy.ops.sequencer.effect_strip_add(frame_start=71, frame_end=96, type='WIPE')

Whit python,在搅拌机中,在VIDEO SEQUENCE EDITOR中将效果条作为WIPE插入 - python

我试图用python创建效果带,但是我不知道如何选择图像/图像带A,然后选择图像/图像带B,然后创建效果带。

如何选择带有代码的图像/图像带A,然后选择带有代码的图像/图像带B?

是否可以命名图像带并按名称选择它?

如今,我已经手动创建了效果条

每个效果条都有其名称

使用python我可以更改EFFECT STRIP属性,例如设置效果模糊:

bpy.context.scene.sequence_editor.sequences_all["Wipe"].blur_width = 0.5
bpy.context.scene.sequence_editor.sequences_all["Wipe.001"].blur_width = 0.5
bpy.context.scene.sequence_editor.sequences_all["Wipe.002"].blur_width = 0.5
bpy.context.scene.sequence_editor.sequences_all["Wipe.003"].blur_width = 0.5
bpy.context.scene.sequence_editor.sequences_all["Wipe.004"].blur_width = 0.5
bpy.context.scene.sequence_editor.sequences_all["Wipe.005"].blur_width = 0.5
bpy.context.scene.sequence_editor.sequences_all["Wipe.006"].blur_width = 0.5
bpy.context.scene.sequence_editor.sequences_all["Wipe.007"].blur_width = 0.5
bpy.context.scene.sequence_editor.sequences_all["Wipe.008"].blur_width = 0.5
bpy.context.scene.sequence_editor.sequences_all["Wipe.009"].blur_width = 0.5
bpy.context.scene.sequence_editor.sequences_all["Wipe.010"].blur_width = 0.5

使用python,我可以更改EFFECT STRIP属性,例如过渡类型,方向,

bpy.context.scene.sequence_editor.sequences_all["Wipe.001"].transition_type = 'IRIS';

bpy.context.scene.sequence_editor.sequences_all["Wipe.002"].transition_type = 'IRIS';
bpy.context.scene.sequence_editor.sequences_all["Wipe.002"].direction = 'IN';

bpy.context.scene.sequence_editor.sequences_all["Wipe.003"].transition_type = 'SINGLE';

bpy.context.scene.sequence_editor.sequences_all["Wipe.004"].transition_type = 'SINGLE';
bpy.context.scene.sequence_editor.sequences_all["Wipe.004"].direction = 'IN';

bpy.context.scene.sequence_editor.sequences_all["Wipe.005"].transition_type = 'SINGLE';
bpy.context.scene.sequence_editor.sequences_all["Wipe.005"].angle = 0.785398;

bpy.context.scene.sequence_editor.sequences_all["Wipe.006"].transition_type = 'SINGLE';
bpy.context.scene.sequence_editor.sequences_all["Wipe.006"].direction = 'IN';
bpy.context.scene.sequence_editor.sequences_all["Wipe.006"].angle = 0.785398;

bpy.context.scene.sequence_editor.sequences_all["Wipe.007"].transition_type = 'SINGLE';
bpy.context.scene.sequence_editor.sequences_all["Wipe.007"].angle = 1.5708;

bpy.context.scene.sequence_editor.sequences_all["Wipe.008"].transition_type = 'SINGLE';
bpy.context.scene.sequence_editor.sequences_all["Wipe.008"].direction = 'IN';
bpy.context.scene.sequence_editor.sequences_all["Wipe.008"].angle = 1.5708;

bpy.context.scene.sequence_editor.sequences_all["Wipe.009"].transition_type = 'DOUBLE';

bpy.context.scene.sequence_editor.sequences_all["Wipe.010"].transition_type = 'DOUBLE';
bpy.context.scene.sequence_editor.sequences_all["Wipe.010"].direction = 'IN';

python参考方案

除了使用performance considerations之外,建议直接使用脚本访问数据,而不是使用Blender的运算符,它通常更容易,更清晰地处理数据。

您可以在场景属性中找到VSE的序列列表

import bpy
seqs = bpy.context.scene.sequence_editor.sequences

然后,您可以将new sequence strips添加到该列表并调整任何strip properties-

s1 = seqs.new_image('img001', '//renders/img001.jpg', 1, 1)
s1.frame_final_duration = 288
s2 = seqs.new_image('img002', '//renders/img002.jpg', 2, 241)
s2.frame_final_duration = 288

然后使用对两个条的引用,创建划像效果

w = seqs.new_effect('wipe01', 'WIPE', 3,
            s2.frame_start, s1.frame_final_end, seq1=s1, seq2=s2)
w.transition_type = 'IRIS'

然后从第二个条带开始,在它们之间添加另一个条带和抹布

s1 = s2
s2 = seqs.new_image('img003', '//renders/img003.jpg', 1, 481)
s2.frame_final_duration = 288
w = seqs.new_effect('wipe02', 'WIPE', 3,
            s2.frame_start, s1.frame_final_end, seq1=s1, seq2=s2)
w.transition_type = 'SINGLE'

s1 = s2
s2 = seqs.new_image('img004', '//renders/img004.jpg', 2, 722)
s2.frame_final_duration = 288
w = seqs.new_effect('wipe03', 'WIPE', 3,
            s2.frame_start, s1.frame_final_end, seq1=s1, seq2=s2)
w.transition_type = 'DOUBLE'

用大写字母拆分字符串,但忽略AAA Python Regex - python

我的正则表达式:vendor = "MyNameIsJoe. I'mWorkerInAAAinc." ven = re.split(r'(?<=[a-z])[A-Z]|[A-Z](?=[a-z])', vendor) 以大写字母分割字符串,例如:'我的名字是乔。 I'mWorkerInAAAinc”变成…

查找字符串中的行数 - python

我正在创建一个python电影播放器​​/制作器,我想在多行字符串中找到行数。我想知道是否有任何内置函数或可以编写代码的函数来做到这一点:x = """ line1 line2 """ getLines(x) python大神给出的解决方案 如果换行符是'\n',则nlines …

字符串文字中的正斜杠表现异常 - python

为什么S1和S2在撇号位置方面表现不同?S1="1/282/03/10" S2="4/107/03/10" R1="".join({"N\'" ,S1,"\'" }) R2="".join({"N\'…

如何获得Python中动态定义函数的源代码? - python

在Python中动态定义代码时(例如,通过exec或从import以外的其他媒体加载代码),我无法获取已定义函数的源代码。inspect.getsource似乎从加载位置查找已加载的模块。import inspect code = """ def my_function(): print("Hello dears�…

如何从模拟实例的方法引发异常? - python

我要测试的演示功能非常简单。def is_email_deliverable(email): try: return external.verify(email) except Exception: logger.error("External failed failed") return False 此函数使用我要模拟的external…