Hello!

I'm trying to programmatically set gizmo knob defaults upon interactive
node creation.  I have a gizmo called 'contrivedExample', which has some
knobs, "filePattern", "startFrame", "endFrame".

This is the code which is executed when this node is created currently:

toolbar = nuke.menu( 'Nodes' )
toolbar.addCommand( "Other/contrivedExample",
"nuke.createNode('contrivedExample')", icon="contrivedExample.png" )

I have a python function which is able to infer good initial values for
"filePattern", "startFrame", "endFrame", based on extracting some metadata
from the first input node:

def contrivedExampleGoodInitialValues( inputNode ):
    regularFileName = inputNode.metadata()['input/filename']
    companionFilePattern = getCompanionFilePattern( regularFileName )
    companionStartFrame = getCompanionStartFrame( regularFileName )
    companionEndFrame = getCompanionEndFrame( regularFileName )
    return ( companionFilePattern, companionStartFrame, companionEndFrame )

I'd like to be able to do something like, "when creating a contrivedExample
node, if the first input is connected, call this function and set the gizmo
knob values accordingly".

What's the right way to do this? The documentation shows examples for how
to set knobs using 'nuke.nodes.contrivedExample( ... )', but not for
'nuke.createNode( "contrivedExample" )'.

Sorry if this is a dumb question...

Chris

-- 
I think this situation absolutely requires that a really futile and stupid
gesture be done on somebody's part. And we're just the guys to do it.
_______________________________________________
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