Reload read nodes
Set label to nodes
Shuffle between channels
- # Reload all Read nodes
- def reloadRead():
- if nuke.selectedNodes('Read'):
- for i in nuke.selectedNodes('Read'):
- i['reload'].execute()
- else:
- for i in nuke.allNodes('Read'):
- i['reload'].execute()
- nuke.menu('Nuke').addCommand('Sanjeev/Reload all', 'reloadRead()', 'ctrl+r')
Set label to nodes
- def setLabel():
- # Panel Creation
- panel = nuke.Panel("Set Label ...by Sanjeev", 150)
- # Knobs Creation
- panel.addSingleLineInput('New Label', '')
- # Buttons
- panel.addButton('Cancel')
- panel.addButton('Ok')
- result = panel.show()
- print result
- # Action after getting result
- if result == 1:
- newLabel= panel.value("New Label")
- for i in nuke.selectedNodes():
- i['label'].setValue(newLabel)
- setLabel()
Shuffle between channels
- try:
- for i in nuke.selectedNodes():
- bol= next((True for k in i.allKnobs() if k.name()=='channels'), False)
- if bol:
- ### Channel change happen here###
- if i.knob('channels').value() == 'alpha':
- i.knob('channels').setValue('rgba')
- elif i.knob('channels').value() == 'rgba':
- i.knob('channels').setValue('all')
- else:
- i.knob('channels').setValue('alpha')
- if not bol:
- raise error
- except:
- nuke.message( "Some of the node doesn't have Channels!")
No comments:
Post a Comment