【发布时间】:2016-01-05 04:06:51
【问题描述】:
我知道我们可以使用 -t 标志在终端模式下打开 nuke。
有没有办法批量打开nuke脚本并列出所有存在的读取节点。
【问题讨论】:
标签: nuke
我知道我们可以使用 -t 标志在终端模式下打开 nuke。
有没有办法批量打开nuke脚本并列出所有存在的读取节点。
【问题讨论】:
标签: nuke
是的,您可以像在脚本编辑器或 Python 解释器中一样在终端模式下运行 Python 代码。例如:
nuke.scriptOpen('/path/to/your/nukeScript.nk')
for node in nuke.allNodes(recurseGroups=True):
if node.Class() == 'Read':
print node.fullName(), ':', node['file'].value()
如果您想让 Nuke 执行 Python 脚本的内容,您可以使用以下命令运行它:
Nuke -t /path/to/pythonScript.py
【讨论】:
.pyc 文件可以很容易地反汇编成原始 Python 脚本,因此您不会保护任何东西。
import nuke
import re
#read nuke script
nuke.scriptOpen("test.nk")
readnodes = [if re.match('Read', node['name'].value()) for node in nuke.allNodes()]
print readnodes
#this will list all the read nodes present in nuke script
nuke.quit()
【讨论】: