-
-
Save fredrikaverpil/9760964 to your computer and use it in GitHub Desktop.
# Get all nodes of type Read | |
readnodes = nuke.allNodes('Read') | |
for readnode in readnodes: | |
print readnode | |
# List all knobs for selected node | |
print( nuke.toNode('Read1') ) | |
# List all knobs for specific node | |
print( nuke.selectedNode() ) | |
# Get value from specific node | |
value = nuke.toNode('Read1').knob('file').getValue() | |
# Get value from selected node | |
value = nuke.selectedNode().knob('file').getValue() | |
# Get value from this node | |
value = nuke.thisNode().knob('file').getValue() | |
# Get value from specific node and evaluate it (good for expressions) | |
value = nuke.toNode('Read1').knob('file').evaluate() | |
# Set specific node's value | |
nuke.toNode('Read1').knob('file').setValue('c:/hello.tif') | |
# Set selected node's value | |
nuke.selectedNode().knob('file').setValue('c:/hello.tif') | |
# Set this node's value | |
nuke.thisNode().knob('file').setValue('c:/hello.tif') | |
# Set specific node's knob to default value | |
nuke.toNode('Grade1').knob('gamma').setValue( nuke.toNode('Grade1').knob('gamma').defaultValue() ) |
For some reason nuke has the node class of Camera nodes set as "Camera2". Super odd. because I don't think any other node classes are this way. Here is the code that will yield your desired output:
##Create List
myCameras=[]
##For loop to grab all nodes in the class
for i in nuke.allNodes():
if i.Class() == ('Camera2'):
myCameras.append(i.knob('name').getValue())
##Print statement to give list in result
print myCameras
hi i'd like to make auto path finder for my render footages and trust me there is allot of sequence.
there is the code:
folder = '//animasyon-suley/Animasyon_Arsiv/Season-2/EP 12/cut_034/RGB_color/' #my folder path
autoFR = nuke.toNode("Read_RGB") #selecting my node
#getting sequence frame range for read node
for seq in nuke.getFileNameList(folder):
autoFR["file"].fromUserText(folder + seq)
so this code is working but i want to be like this:
folder = '[value Sticky_Paths.Main_Path]EP [value Sticky_Paths.pulldown]/cut_[file rootname [file tail [value root.name]]]/[value Sticky_Paths.N1]/'
autoFR = nuke.toNode("Read_RGB")
for seq in nuke.getFileNameList(folder):
autoFR["file"].fromUserText(folder + seq)
so the problem is its not working when i set #folder by expression link it giving error like this:
# Result: Traceback (most recent call last):
File "<string>", line 4, in <module>
TypeError: 'bool' object is not iterable
- so i tried to print folder value as string to an other variable but it didnt work
so when I do the first snippet of code
Get all nodes of type Read
readnodes = nuke.allNodes('Read')
for readnode in readnodes:
print readnode
im altering it like this
Get all nodes of type Camera
myCameras= nuke.allNodes('Camera')
for myCamera in myCameras:
print myCamera
this returns a blank
#Result
and really prints nothing, no list.
Additionally I looked at the script echo when I create a camera and saw that the node it creates is a Camera2?
so I tried replacing the node class with that and still the same result
How do I get this to work?