AYON custom script for resetting read nodes start frame values
FrameSettingsPanel
Bases: PythonPanel
Frame Settings Panel
Source code in client/ayon_nuke/startup/frame_setting_for_read_nodes.py
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41 | class FrameSettingsPanel(nukescripts.PythonPanel):
""" Frame Settings Panel """
def __init__(self):
nukescripts.PythonPanel.__init__(self, "Set Frame Start (Read Node)")
# create knobs
self.frame = nuke.Int_Knob(
'frame', 'Frame Number')
self.selected = nuke.Boolean_Knob("selection")
# add knobs to panel
self.addKnob(self.selected)
self.addKnob(self.frame)
# set values
self.selected.setValue(False)
self.frame.setValue(nuke.root().firstFrame())
def process(self):
""" Process the panel values. """
# get values
frame = self.frame.value()
if self.selected.value():
# selected nodes processing
if not nuke.selectedNodes():
return
for rn_ in nuke.selectedNodes():
if rn_.Class() != "Read":
continue
rn_["frame_mode"].setValue("start_at")
rn_["frame"].setValue(str(frame))
else:
# all nodes processing
for rn_ in nuke.allNodes(filter="Read"):
rn_["frame_mode"].setValue("start_at")
rn_["frame"].setValue(str(frame))
|
process()
Process the panel values.
Source code in client/ayon_nuke/startup/frame_setting_for_read_nodes.py
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41 | def process(self):
""" Process the panel values. """
# get values
frame = self.frame.value()
if self.selected.value():
# selected nodes processing
if not nuke.selectedNodes():
return
for rn_ in nuke.selectedNodes():
if rn_.Class() != "Read":
continue
rn_["frame_mode"].setValue("start_at")
rn_["frame"].setValue(str(frame))
else:
# all nodes processing
for rn_ in nuke.allNodes(filter="Read"):
rn_["frame_mode"].setValue("start_at")
rn_["frame"].setValue(str(frame))
|