This repository has been archived by the owner on Sep 20, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 127
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5039 from ynput/enhancement/OP-6020_Nuke-custom-s…
…etFrameRange-script
- Loading branch information
Showing
3 changed files
with
54 additions
and
0 deletions.
There are no files selected for viewing
Empty file.
47 changes: 47 additions & 0 deletions
47
openpype/hosts/nuke/startup/frame_setting_for_read_nodes.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
""" OpenPype custom script for resetting read nodes start frame values """ | ||
|
||
import nuke | ||
import nukescripts | ||
|
||
|
||
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)) | ||
|
||
|
||
def main(): | ||
p_ = FrameSettingsPanel() | ||
if p_.showModalDialog(): | ||
print(p_.process()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters