Weird GUI behavior, possibly a bug?

I am using a python function in an expression, something like this:

Code:

def printEval():
    print 'evaluating expression'
    return 1

n = nuke.nodes.Constant()
n['color'].setExpression('[python printEval()]')


it seems to work fine, however there is an issue with the GUI. When I first create the node, then assign my expression and then double click that node to open the properties. It appears that it calls my expression thousands of times. ‘evaluating expression’ got printed 7,652 times — insane. Echo python calls is off. It only happens on the first time I double click the node. So if I create the node, double click it, get the properties, then assign my expression and then click the node, it only gets called once, like it should. Is this a bug? It seems really weird that it would evaluate the expression thousands of times… weird behavior?. I was able to replicate this on a coworkers machine and in Nuke5.2 as well. If this is not a bug and I’m just misusing nuke is some way, is there a way to turn this off? or a proper way to call a python function as an expression?

I’m trying to do a gizmo so by default I want the expression there. Also my gizmo is getting the values of a number of pixels using node.sample(). This means that if my function gets called 7,652 times im never going to see the result…

I was trying to see if anyone had similar issues and I found this post:

http://www.vfxtalk.com/forum/python-…080&highlight=[python+expression

seems exactly the same problem.

No Responses to “Weird GUI behavior, possibly a bug?”

Post a Comment