You can pass nuke.allNodes a node to use as an execution context. If you know 
you always want to look at the top-level of your comp, just use:

nuke.allNodes(group=nuke.root())

If you want to look at the container context of the new gizmo regardless of 
whether it’s the root node or not, use:

nuke.allNodes(group=nuke.thisParent())

Obviously if the given 'parent' gizmo you’re looking for could be anywhere, 
you’ll need to walk from nuke.root() into every Group node.

-Nathan



From: Brogan Ross 
Sent: Tuesday, September 20, 2011 6:34 PM
To: Nuke Python discussion 
Subject: [Nuke-python] Gizmo onCreate callback going inside gizmo

So I found this interesting little tidbit that I didn't want to happen. 

Basically, I have an onUserCreate callback to expression the values of a given 
"parent" gizmo to the newly created gizmo.  But when I'm doing a search for the 
"parent" gizmo with nuke.allNodes() the callback is looking at the innards of 
the newly created gizmo.


def gizmoCallback():
    newgizmo = nuke.thisNode()
    for node in nuke.allNodes():
        if node.Class() in ["list", "of", "possible", "matches"]:
            if node.name().split()[0].lower() == "searchTag":
                newgizmo.setExpressions()

nuke.onUserCreate(gizmoCallback, nodeClass='NewGizmo')

That's basically what I'm running, but if I have it print out the nodes in 
nuke.allNodes() it prints the names of the nodes inside the gizmo.

Anyone else run it this before?  Any work arounds?



Thanks,
    Brogan


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

Reply via email to