Good day everyone,

I have stumbled upon a problem that I was not expecting: when I use the with
statement on a hierarchy of nodes (e.g. Group1.Group2.Group3), once I leave
it, instead of falling back to the root level of the comp (or wherever I
would be), I find myself in the node immediately above the last one (Group2
in this case)

I am ready to believe that I misunderstand the with statement, but for some
reason, I assumed that if I am using it at root level of the DAG, the next
statement outside the with would be run at that root level, not an
intermediary level.  It feels as if doing a with on a chain of nodes is
like doing three with's in a row (nested) so that when I leave the lowest
node, I fall back into the node right above.

Can anyone confirm that's normal behavior or a problem?  I can work around
it, but with was just so practical at first...

#In case formatting does not hold, the first print is indented, the second
one is outside the with.
with nuke.toNode('Group1.Group2.Group3'):

    print nuke.allNodes() # Group3 nodes

print nuke.thisNode().name(), nuke.allNodes() # this will print Group2
instead of root.

Setup:

set cut_paste_input [stack 0]
version 7.0 v9
push $cut_paste_input
Group {
 name Group1
 selected true
 xpos -419
 ypos -147
}
 Input {
  inputs 0
  name Input1
  xpos -419
  ypos -187
 }
 NoOp {
  name NoOp1
  xpos -419
  ypos -147
 }
 Output {
  name Output1
  xpos -419
  ypos -47
 }
 Group {
  inputs 0
  name Group2
  selected true
  xpos -244
  ypos -122
 }
  Input {
   inputs 0
   name Input2
   xpos -419
   ypos -187
  }
  NoOp {
   name NoOp2
   xpos -419
   ypos -147
  }
  Output {
   name Output2
   xpos -419
   ypos -47
  }
  Group {
   inputs 0
   name Group3
   selected true
   xpos -72
   ypos -139
  }
   Input {
    inputs 0
    name Input3
    xpos -419
    ypos -187
   }
   NoOp {
    name NoOp3
    xpos -419
    ypos -147
   }
   Output {
    name Output3
    xpos -419
    ypos -47
   }
  end_group
 end_group
end_group


-- 
"Attention, attention. Here and now, boys," the mynah repeated. "Here and
now, boys."
_______________________________________________
Nuke-python mailing list
Nuke-python@support.thefoundry.co.uk, http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python

Reply via email to