備忘錄_20160105(定位)
修改
回首頁
程式 2022-06-20 14:40:05 1655707205 100
用 blender 3.1 的 python ,在 video editing (sequence_editor) 中,讀取圖片,加入轉場效果,新增文字。
用 blender 3.1 的 python ,在 video editing (sequence_editor) 中,讀取圖片,加入轉場效果,新增文字。
可以製作出外遊玩影片。可以製作上字幕的影片。
import bpy
oSE=None
print("go")
# 對了,您可能要先自己新增一個 video editing 喔!否則程式找不到!
for i in range(len(bpy.data.scenes)):
if bpy.data.scenes[i].sequence_editor is not None:
oSE=bpy.data.scenes[i].sequence_editor
break
if oSE is not None:
oIA=oSE.sequences.new_image(name="imgA", filepath="I:\\temp\\20210214_02.png", channel=2, frame_start=1, fit_method='FIT')
oIA.frame_still_start=0
oIA.frame_still_end=23
oIB=oSE.sequences.new_image(name="imgB", filepath="I:\\temp\\20210214_02_3.png", channel=2, frame_start=30, fit_method='FIT')
oIB.frame_still_start=0
oIB.frame_still_end=23
oIC=oSE.sequences.new_image(name="imgC", filepath="I:\\temp\\20210214_02_4.png", channel=2, frame_start=60, fit_method='FIT')
oIC.frame_still_start=0
oIC.frame_still_end=23
oSE.sequences.new_effect(name="effect1", type="CROSS", channel=2, frame_start=25, frame_end=29, seq1=oIA, seq2=oIB)
oSE.sequences.new_effect(name="effect2", type="CROSS", channel=2, frame_start=54, frame_end=59, seq1=oIB, seq2=oIC)
oText=oSE.sequences.new_effect(name="effect3", type="TEXT", channel=3, frame_start=1, frame_end=60)
oText.text="中文字也可以"
oText.font_size=48
oText.color=[1,1,0,1] # r,g,b,a
oText.use_shadow=True
oText.shadow_color=[0,0,0,1] # r,g,b,a
oText.location.x=0.5
oText.location.y=0.1
oaStrips=oSE.sequences_all
for j in range(len(oaStrips)):
print(oaStrips[j])