Expressions are evaluated a lot, Python or otherwise, but Python expressions 
are (logically) the only ones that get echoed to the script editor. You can 
either add error handling to your Python expression (which won’t suppress it 
being echoed) or switch to TCL.

If it’s on a numeric knob:

[exists input0] ? [metadata "input/width"] : 0

If it’s on a knob that doesn’t evaluate Nuke expressions:

[if [exists input0] {return [metadata "input/width"]}]


-Nathan



From: Mark Nettleton 
Sent: Thursday, February 07, 2013 11:08 AM
To: Nuke user discussion 
Subject: [Nuke-users] Python expression evaluates all the time?

This expression:


  nuke.thisNode().metadata("input/width")


errors when there is nothing connected to the node. 

But it also seems to evaluate all the time, whenever I touch anything in the 
GUI.

I have "echo python commands to output window" turned on, and in the script 
editor, I constantly get lines like this: 


  nuke.thisNode().metadata("input/width")
  nuke.thisNode().metadata("input/width")
  nuke.thisNode().metadata("input/width")
  nuke.thisNode().metadata("input/width")
  nuke.thisNode().metadata("input/width")
  nuke.thisNode().metadata("input/width")
  nuke.thisNode().metadata("input/width")
  nuke.thisNode().metadata("input/width")
  nuke.thisNode().metadata("input/width")
  nuke.thisNode().metadata("input/width")
  nuke.thisNode().metadata("input/width")
  nuke.thisNode().metadata("input/width")


whenever I touch anything. How can I stop that happening?

Thanks

Mark






--------------------------------------------------------------------------------
_______________________________________________
Nuke-users mailing list
[email protected], http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-users
_______________________________________________
Nuke-users mailing list
[email protected], http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-users

Reply via email to