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]

No Responses to “stashing node name for later use”

Post a Comment