1.更改选定的节点值
for i in nuke.selectedNodes() :
i['size'].setValue(20)
在nuke脚本编辑器中i循环时发生了什么?
大部分合成师都会遇到问题,这里能给出答案,当在nuke脚本编辑器中运行代码会出现无限循环。例如,如果选择十个模糊节点并运行它,它会将i的名称分配给10个模糊节点,并且它开始逐个将“size”更改为0-20。
2.隐藏所有节点输入
for i in nuke.allNodes() :
i['hide_input'].setValue(1)
(用于在setValue上主动返回0)
3.隐藏选择的节点输入
for i in nuke.selectedNodes() :
i['hide_input'].setValue(1)
4.锁定所有连接
nuke.Root().knob('lock_connections').setValue(1)
5. 将所有读取节点开始设置为自定义帧
for a in nuke.allNodes():
if a.Class() == 'Read':
a['frame_mode'].setValue('1')
a['frame'].setValue('1')
6.所有阅读节点丢失的帧为'checkerboard'。
for s in nuke.allNodes('Read'):
s['on_error'].setValue('checkerboard')
7.将所有roto节点输出设置为仅alpha
for s in nuke.allNodes('Roto'):
s['output'].setValue('alpha')
如果想输出为'rgba'
for s in nuke.allNodes('Roto'):
s['output'].setValue('rgba')
8.对于roto节点,仅默认输出alpha
nuke.knobDefault('Roto.output', 'alpha')
(将此行添加到menu.py中)
9.暂时禁用像Defocus,VectorBlur,Convolve,oflow,TVIscale这样重的节点。
for s in nuke.allNodes():
classTypes = ['Defocus' , 'VectorBlur', 'Convolve', 'oflow', 'TVIscale', ]
for n in classTypes:
if n in s.Class():
s['disable'].setValue(1)
(同时使用更大的镜头来处理层数。合成树变得非常大而且很重。在这种情况下我们需要禁用一些重处理节点以便更快地预览。在nuke里面使用此脚本自动找到这些节点并禁用这些节点)
10.展开选定的组
for a in nuke.selectedNodes():
a.expand()
用于展开节点图中的所有组节点
for s in nuke.allNodes('Group'):
s.expand()
领取专属 10元无门槛券
私享最新 技术干货