Read Node file path python changed in 6.3

Code:

robotRead=nuke.Read("file {/Users/inhousecc/Documents/robot_multipass.0001.exr}")


The above code worked for my before in 6.2 now it’s not working in 6.3. I’m wondering how do I script in a read node and it’s file path now?

Thanks

Cross platform file path problem.. PCs & Mac

Hi,

I don’t normally delve into the world of networks but in the place I am at I’ve been asked to set nuke up so that you could say open a script on the PC and on the Mac and both files would point to the same directory and show up in the nuke script without having to relink any nodes.

….ok so I’ve come halfway, I can open scripts I’ve saved on the mac onto the PC and they link up fine… on the other hand when I open up a nuke script on the mac it can’t find PC link and I have to end up relinking all the files. I’ve followed the nuke documents closely so I am wondering if there could be something missing *scratches head*…

This is what I have in my init.py:

import platform
def filenameFix(filename):
if platform.system() in ("Windows", "Microsoft"):
return filename.replace( "/Volumes/Aurora20TB/Projects/", "z:/" )
else:
return filename.replace( "z:/", "/Volumes/Aurora20TB/Projects/" )
return filename

Any help would be appreciated!

Thanks!
-Nic 🙂

A little help with a basic TCL script

Hi all. I am a quite new to scripting in any form and was just looking for a bit of a hand. I am attempting to set up a projection camera gizmo that sets itself by frame (based on the camera tracker) as well as sets up a Project3d node and associated Card.

I am running into a bit of trouble in that the node does what I want it to until I have multiple instances, then the variables I am setting are over riding the previously set variables.

So what I am asking in sort is there any way to set unique variable names automatically based on the node name (or some other method) then call those names later in expression links?

Additionally is there any way to create a floating point slider with a range that can be controlled via expression? For example if I wanted to set the limits to Read1.first and Read1.last?

Anyway, here is the code so far. Cheers!!

Code:


set cut_paste_input [stack 0]
version 6.3 v1
push $cut_paste_input
Camera {
 display textured
 translate {{CameraTracker1.camTranslate(proFrame)} {CameraTracker1.camTranslate(proFrame)} {CameraTracker1.camTranslate(proFrame)}}
 rotate {{CameraTracker1.camRotate(proFrame)} {CameraTracker1.camRotate(proFrame)} {CameraTracker1.camRotate(proFrame)}}
 focal {{CameraTracker1.focalLength(proFrame)}}
 haperture {{CameraTracker1.aperture.x(proFrame)}}
 vaperture {{CameraTracker1.aperture.y(proFrame)}}
 win_translate {{CameraTracker1.windowTranslate(proFrame)} {CameraTracker1.windowTranslate(proFrame)}}
 win_scale {{CameraTracker1.windowScale(proFrame)} {CameraTracker1.windowScale(proFrame)}}
 name Projector
 label "\[value proFrame]"

 addUserKnob {20 ProjectionSetup l "Projection Setup" t "Auto Setup Project3d and ProjCard Nodes "}
 addUserKnob {32 ProjHere l "Select This Frame" T "set projCurFrame \[value this.frame]" +STARTLINE}
 addUserKnob {3 proFrame l "Projection Frame" t "Select Projection Frame by Value or Set Here Button"}
 proFrame {{"\$projCurFrame"}}
 addUserKnob {32 setProj l "Projection Setup" T "set projNode \[value this.name]\n\nset cut_paste_input \[stack 0]\nversion 6.3 v1\npush \$cut_paste_input\npush 0\nProject3D \{\n inputs 2\n name Project3D\n selected true\n\n\}\n\nset cut_paste_input \[stack 0]\nversion 6.3 v1\npush \$cut_paste_input\nCard2 \{\n translate \{0 0 0\}\n rotate \{\{parent.\$projNode.rotate i\} \{parent.\$projNode.rotate i\} \{parent.\$projNode.rotate i\}\}\n\n\n name ProjCard\n\}\n" +STARTLINE}
}


stashing node name for later use

thinking out loud here. i’ve got an example where I’m using a text field to link a "master" node to a "slave" node. i needed to be able to quickly/easily link up the two nodes and expresssion a bunch of stuff together… so I just rigged it up to when you type the name of the master node into the slave it links everything up.

Code:

set cut_paste_input [stack 0]
version 6.3 v1
push $cut_paste_input
RotoPaint {
 output alpha
 curves {AnimTree: "" {
 Version: 1.2
 Flag: 0
 RootNode: 1
 Node: {
  NodeName: "Root" {
  Flag: 512
  NodeType: 1
  Transform: 0 0 S 0 0 S 0 0 S 0 0 S 0 1 S 0 1 S 0 0 S 0 1174 S 0 576
  NumOfAttributes: 10
  "vis" S 0 1 "opc" S 0 1 "mbo" S 0 1 "mb" S 0 1 "mbs" S 0 0.5 "fo" S 0 1 "fx" S 0 0 "fy" S 0 0 "ff" S 0 1 "ft" S 0 0
  }
  NumOfChildren: 1
  Node: {
  NodeName: "Paint1" {
    Flag: 512
    NodeType: 5
    CubicCurve: "" {
    Transform: 0 0 S 0 0 S 0 0 S 0 0 S 0 1 S 0 1 S 0 0 S 0 1061 S 0 684
    Type: 3 Flag: 2080 Dim: 3
    NumOfPoints: 3
    0 S 0 658 S 0 542 S 0 1 0 0 S 0 1058.57 S 0 683.144 S 0 1 0 0 S 0 1464 S 0 826 S 0 1 0
    NumOfAttributes: 47
    "vis" S 0 1 "r" S 0 1 "g" S 0 1 "b" S 0 1 "a" S 0 1 "ro" S 0 0 "go" S 0 0 "bo" S 0 0 "ao" S 0 0 "opc" S 0 1 "bs" S 0 32 "bsp" S 0 0.05 "h" S 0 1 "src" S 0 0 "bm" S 0 0 "dt" S 0 1 "ds" S 0 0 "dh" S 0 0 "bt" S 0 0 "bu" S 0 1 "inv" S 0 0 "stx" S 0 0 "sty" S 0 0 "str" S 0 0 "sr" S 0 0 "ssx" S 0 1 "ssy" S 0 1 "ss" S 0 0 "spx" S 0 1174 "spy" S 0 576 "stot" S 0 0 "sto" S 0 0 "sv" S 0 0 "sf" S 0 1 "sb" S 0 1 "ltn" S 0 1 "ltm" S 0 1 "ltt" S 0 0 "ws" S 0 0 "we" S 0 1 "ep1" S 0 0 "ep2" S 0 0 "ep3" S 0 0 "tt" S 0 14 "nv" S 0 2 "view1" S 0 1 "view2" S 0 2
    }
  }
  NumOfChildren: 0
  }
 }
}
}
 toolbox {selectAll {
  { selectAll ssx 1 ssy 1 sf 1 }
  { createBezier ssx 1 ssy 1 sf 1 sb 1 tt 4 }
  { createBSpline ssx 1 ssy 1 sf 1 sb 1 }
  { createEllipse ssx 1 ssy 1 sf 1 sb 1 }
  { createRectangle ssx 1 ssy 1 sf 1 sb 1 }
  { addPoints ssx 1 ssy 1 sf 1 tt 8 }
  { removePoints ssx 1 ssy 1 sf 1 tt 9 }
  { cuspPoints ssx 1 ssy 1 sf 1 tt 10 }
  { curvePoints ssx 1 ssy 1 sf 1 tt 11 }
  { removeFeather ssx 1 ssy 1 sf 1 tt 12 }
  { closeCurve ssx 1 ssy 1 sf 1 tt 13 }
  { brush h 0 ssx 1 ssy 1 sf 1 sb 1 ltt 0 tt 14 }
  { eraser src 2 ssx 1 ssy 1 sf 1 sb 1 }
  { clone src 1 ssx 1 ssy 1 sf 1 sb 1 }
  { reveal src 3 ssx 1 ssy 1 sf 1 sb 1 }
  { dodge src 1 ssx 1 ssy 1 sf 1 sb 1 }
  { burn src 1 ssx 1 ssy 1 sf 1 sb 1 }
  { blur src 1 ssx 1 ssy 1 sf 1 sb 1 }
  { sharpen src 1 ssx 1 ssy 1 sf 1 sb 1 }
  { smear src 1 ssx 1 ssy 1 sf 1 sb 1 }
} }
 toolbar_show_paint_selection true
 toolbar_brush_hardness 0.200000003
 toolbar_lifetime_type all
 toolbar_source_transform_scale {1 1}
 toolbar_source_transform_center {320 240}
 colorOverlay 0
 lifetime_type "all frames"
 view {}
 motionblur_on true
 brush_size 32
 brush_spacing 0.05000000075
 brush_hardness 1
 source_black_outside true
 createNewTrack {{-1} "-1\t(none)\t-1" "1000\tNew Track Layer\t1000"}
 name three_pt_mask7
 label "left seam controller\nscratch width \[value curves.Paint1.brush_size]"
 selected true
 xpos 4878
 ypos 2967
}
OFXuk.co.thefoundry.furnace.f_scratchrepair_v402 {
 inputs 0
 output "Repair And Alpha Mask"
 scratchType "Curve Segment"
 start {(default {{"(\[value shape_name].curves.Paint\[if \{\[string equal \[value stereo] true]\} \{return 2\} else \{return 1\}].curve.0.left.x) + \[if \{\[string equal \[value stereo] true]\} \{return \[value shape_name].curves.Paint2.translate.x\} else \{return 0\}] + offset"} {"(\[value shape_name].curves.Paint\[if \{\[string equal \[value stereo] true]\} \{return 2\} else \{return 1\}].curve.0.left.y) "}} L {{"\[value shape_name].curves.Paint1.curve.0.left.x"} {"\[value shape_name].curves.Paint1.curve.0.left.y"}})}
 startInner {254.1875308 705.6874924}
 centre {(default {{"(\[value shape_name].curves.Paint\[if \{\[string equal \[value stereo] true]\} \{return 2\} else \{return 1\}].curve.1.left.x) + \[if \{\[string equal \[value stereo] true]\} \{return \[value shape_name].curves.Paint2.translate.x\} else \{return 0\}] + offset"} {"(\[value shape_name].curves.Paint\[if \{\[string equal \[value stereo] true]\} \{return 2\} else \{return 1\}].curve.1.left.y) "}} L {{"\[value shape_name].curves.Paint1.curve.1.left.x"} {"\[value shape_name].curves.Paint1.curve.1.left.y"}})}
 endInner {277.8374973 711.5375061}
 end {(default {{"(\[value shape_name].curves.Paint\[if \{\[string equal \[value stereo] true]\} \{return 2\} else \{return 1\}].curve.2.left.x) + \[if \{\[string equal \[value stereo] true]\} \{return \[value shape_name].curves.Paint2.translate.x\} else \{return 0\}] + offset"} {"(\[value shape_name].curves.Paint\[if \{\[string equal \[value stereo] true]\} \{return 2\} else \{return 1\}].curve.2.left.y) "}} L {{"\[value shape_name].curves.Paint1.curve.2.left.x"} {"\[value shape_name].curves.Paint1.curve.2.left.y"}})}
 scratchWidth {{"\[value shape_name].curves.Paint1.brush_size"}}
 "Spatial Repair" 1
 numPoints 10
 gradientFactor 6
 medianWidth 6
 scratchWidthSecret 0
 filtering Extreme
 cacheBreaker false
 name F_ScratchRepair12
 label "3 pt - left seam"
 selected true
 xpos 4878
 ypos 3121
 addUserKnob {20 Stereo}
 addUserKnob {1 shape_name l "Line Seg Name"}
 shape_name three_pt_mask7
 addUserKnob {26 slug l "" +STARTLINE T "*type line segment name here"}
 addUserKnob {6 stereo l "Is line stereo?" +STARTLINE}
 addUserKnob {7 offset l "Right Eye Offset" R -20 20}
}


the problem is, i can’t seem to dynamically grab the name of the master when the two are created, and plug that into the text field so that it catches any namespace number that nuke adds. so like if "3 pt line1" is already in the script, when adding this node it will come in as "3 pt line2" but the text field will still be linked to 3 pt line1 instead of 2 like I’m wanting.

you’ll see what I mean if you just copy/paste the above nodes a couple of times and watch the expression links misfire.

I could create the nodes using python but it wouldn’t be trivial; there’s a ton of values I’m having to rig up.

i thought a quick band-aid might be to grab the name of the first node as it’s created and then plug it into the 2nd? but how to go about that… ?

maybe create some variable that captures the node name and then a little python that evaluates the name into my text field further down the chain? anyone ever done something like that?

node1 is created
grab name — node1.name = nodename1

node2 is created
text field — [value nodename1]

New Layers

Hey Guys,

I am trying to create a script that make new channel layers .. I am using the nuke.Layer() function to do this. The layers are getting created (I can see them in the viewer drop down) but I cant see them in my ‘copy’ nodes … here is a snippet. Any thoughts would be great.

#add new channel for each read node
nuke.Layer( read_node, [‘red’, ‘green’, ‘blue’] ) # new channel layer

print (read_node)+’ ‘+str(item_count)
if item_count > 0 : # if the read node is not the first in the collection … make a copy node

prev_copy_node = nuke.selectedNode() # get the current copy node
rn_copy = nuke.createNode("Copy") # make a new copy node
rn_copy.setName(‘cp_’+read_node) # name it to match the read node
x = nuke.toNode(read_node) # assign the read node to x
nuke.toNode(rn_copy.name())
rn_copy.setInput(0, prev_copy_node) # set the input from the previous copy node
rn_copy.setInput(1, nuke.toNode(read_node)) # set the input from teh read node
nuke.toNode(rn_copy.name())
rn_copy.knob("from0") .setValue(‘rgba.red’)
rn_copy.knob("to0") .setValue(read_node+’.red’)
rn_copy.knob("from1") .setValue(‘rgba.green’)
rn_copy.knob("to1") .setValue(read_node+’.green’)
rn_copy.knob("from2") .setValue(‘rgba.blue’)
rn_copy.knob("to2") .setValue(read_node+’.blue’)

Merge Achannels setValue help please

Hi,

I’m totally stumped.

The code directly below works as expected. It sets the value of operation (blend mode) to screen and the result in the script editor is True. Great stuff.

newMerge1. knob("operation").setValue(10)

The code below here should change the Achannels to rgb shouldn’t it? All I get in the script editor is False..
newMerge1. knob("Achannels").setValue(2)

Please if someone could explain why "Achannels" doesn’t get changed the same way "operation" or "fringe" or any other knob in the Merge2 node?

Is setValue the wrong command for "Achannels" ?

How are we support to change the "Achannels" knob if not by the setValue command?

nuke 5.0v1

Thanks

flag for hiding animation path in viewer?

howdy – does anyone know of a way to hide the animation path of some points that are drawing in the viewer? I’m hoping I can find a way to turn these animation paths off for the entire node, it’s drawing up a storm.

I thought it might be accessible through the hidden flags? would I have to disable them on a per knob basis or is there an overall way to kill those paths?

big thanks if anyone can help, would save me lots of "o" clicks, toggling off the anim path overlay.

Need Help to make

hi guys,

i am trying to make gradient tool in nuke but i don’t know much abt scripting part so i need help to make gradient tool but problem is i need gradient same like a "eyeon fusion" so anybody can help me to make same gradient like fusion? thxs

i try this

{
Tools = ordered() {
Gradient1 = TexGradient {
CtrlWZoom = false,
Inputs = {
Gradient = Input {
Value = Gradient {
Colors = {
[0] = { 0, 0, 0, 1, },
[1] = { 1, 1, 1, 1, },
},
},
},
MaterialID = Input {
Value = 1,
},
},
ViewInfo = OperatorInfo {
Pos = { 671, 210, },
},
},
},
ActiveTool = "Gradient1",
}

but when i enter in nuke i got this thing error

{
Tools = ordered() {
Gradient1 = TexGradient {
CtrlWZoom = false,
Inputs = {
Gradient = Input {
Value = Gradient {
Colors = {
[0] = { 0, 0, 0, 1, },
[1] = { 1, 1, 1, 1, },
},
},
},
MaterialID = Input {
Value = 1,
},
},
ViewInfo = OperatorInfo {
Pos = { 671, 210, },
},
},
},
ActiveTool = "Gradient1",
}
# Result: File "<string>", line 2
Tools = ordered() {
^
SyntaxError: invalid syntax

create new channel on nuke start

hi
I’d like to create automatically 4 new channels on nuke start. every channel with a different name and properties..rgba, vectors …in these way I can create some gizmo reffering to these channels. does you guys knows how or where I can find some info?
any idea? I tryed scriting the user menu.py with no result
thanks in advice

Nuke “playblast”, 3d viewer to image sequence ?

Hello,

I’m doing a camera mapping in Nuke and would like to know if there is a way to "playblast", or render directly what i see in the 3d viewer within a image sequence ?

Thanks

-seb