为什么Read()在CLI模式下不读取帧范围?

2024-09-28 17:25:42 发布

您现在位置:Python中文网/ 问答频道 /正文

这是我的剧本:

# confirming the project dimension resolution
projset = nuke.Root()
projset["format"].setValue("HD_1080")

# load video
foot = nuke.nodes.Read(file="C:/Users/Santosh/Desktop/MVI_8411.MOV", name="Nuke_Class1")

# select read node and attach write node to it
nuke.toNode("Nuke_Class1").setSelected(True)
wr = nuke.createNode("Write")

# specify the sequence path
wr["file"].setValue("C:/Users/Santosh/Desktop/nukke/nuke_API_###.jpg")

# connect to the first viewer, if many
nukescripts.connect_selected_to_viewer(0)

# perform the render, 50th to 140th frame
nuke.render(wr, 50, 140, 1)

我基本上是看一段视频然后写出一个图像序列。在

问题是,这个脚本渲染1帧91次,它应该渲染91个不同的帧。在

当我试图调查时,我发现问题出在Read节点上。我发现帧范围被设置为1-1。我必须手动设置帧范围吗?因为当我读同一个视频文件时,在GUI上,帧范围设置正确。这表明GUI依赖于元数据,而我的脚本不是,也许?在

我如何摆脱手动设置帧范围?在


Tags: thetonodereadconnectwrusersfile
1条回答
网友
1楼 · 发布于 2024-09-28 17:25:42

问题就在你的Read节点中。应手动指定帧范围:

第一种方法

nuke.nodes.Read(file="C:/Users/Santosh/Desktop/MVI_8411.MOV", first="1", last="91")

或者没有第一个理由:

^{pr2}$

第二种方法

如果您不知道帧范围,可以使用TCL样式自动读入QT文件:

^{3}$

另外,我想它可能与sys模块的功能有关,但绝对不能使用ViewMetaData节点(在第一种方法中),因为当您在GUI模式或CLI模式下使用它时,它只读取可见帧范围。metadata()方法返回一个python字典,其中包含Nuke_Class1节点的元数据,例如:

node = nuke.toNode("Nuke_Class1")
print node.metadata()

相关问题 更多 >