mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-25 05:14:40 +01:00
Merge pull request #5039 from ynput/enhancement/OP-6020_Nuke-custom-setFrameRange-script
This commit is contained in:
commit
bea6cd2071
3 changed files with 54 additions and 0 deletions
0
openpype/hosts/nuke/startup/__init__.py
Normal file
0
openpype/hosts/nuke/startup/__init__.py
Normal file
47
openpype/hosts/nuke/startup/frame_setting_for_read_nodes.py
Normal file
47
openpype/hosts/nuke/startup/frame_setting_for_read_nodes.py
Normal file
|
|
@ -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())
|
||||
|
|
@ -222,6 +222,13 @@
|
|||
"title": "OpenPype Docs",
|
||||
"command": "import webbrowser;webbrowser.open(url='https://openpype.io/docs/artist_hosts_nuke_tut')",
|
||||
"tooltip": "Open the OpenPype Nuke user doc page"
|
||||
},
|
||||
{
|
||||
"type": "action",
|
||||
"sourcetype": "python",
|
||||
"title": "Set Frame Start (Read Node)",
|
||||
"command": "from openpype.hosts.nuke.startup.frame_setting_for_read_nodes import main;main();",
|
||||
"tooltip": "Set frame start for read node(s)"
|
||||
}
|
||||
]
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue