英文:
In Blender how I can get an ImageSequence source filename in video editor (VSE)?
问题
在Blender中,当您使用视频编辑器(VSE)时,可以像这样使用Python解析项目:
import bpy
import os
for seq in bpy.context.sequences:
sFull_filename = ""
if seq.type == "MOVIE":
sFull_filename = seq.filepath
if seq.type == "SOUND":
sFull_filename = seq.sound.filepath
if seq.type == "IMAGE":
sFull_filename = "??"
sName = seq.name # /!\ It is not the file name !
sPath = seq.directory
# Finally
sAbsolute_name = bpy.path.abspath( sFull_filename )
正如您所看到的,我可以获取电影和声音的文件名,但如何获取图像的文件名呢?
在Blender API文档网站上,我找不到如何执行此操作的说明...
我尝试获取VSE图像条带的文件名...
英文:
In Blender, when you use Video Editor (VSE), you can parse items using Python like this :
import bpy
import os
for seq in bpy.context.sequences:
sFull_filename = ""
if seq.type == "MOVIE":
sFull_filename = seq.filepath
if seq.type == "SOUND":
sFull_filename = seq.sound.filepath
if seq.type == "IMAGE":
sFull_filename = "??" # How to get it for images ?
sName = seq.name # /!\ It is not the file name !
sPath = seq.directory
# Finally
sAbsolute_name = bpy.path.abspath( sFull_filename )
As you can see, I get the filename for movies and sound, but how can I get it for images ?
On Blender api documentation website I don't found how to do it...
I try to get VSE images strip file names...
答案1
得分: 1
你可以从seq
的elements
列表中获取名称:
...
elif seq.type == "IMAGE":
# 获取第一个图像文件名
sFull_filename = os.path.join(seq.directory, seq.elements[0].filename)
sAbsolute_name = bpy.path.abspath(sFull_filename)
print(sAbsolute_name)
或者如果你想获取它们所有,可以迭代seq.elements
。
英文:
You can get the names from elements
list of seq
:
...
elif seq.type == "IMAGE":
# Get the first image filename
sFull_filename = os.path.join(seq.directory, seq.elements[0].filename)
sAbsolute_name = bpy.path.abspath(sFull_filename)
print(sAbsolute_name)
or if you want them all, iterate over seq.elements
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论