Hi Ean,

Out of curiosity, do you need the input labels to figure out what kind of
nodes you can connect to them, or for any other reason?

This won't get you the input labels, but you can test for the kind of nodes
that can be connected to a certain input using <node>.canSetInput(i, node)

Depending on what you need to do, this may give you enough information, and
it will be more generic and safer than just testing for already connected
inputs, since certain inputs may accept more than one parent class (like
Reconcile3D may take both a camera and an Axis into its "axis" input), or
you may come across connected inputs that don't give you enough information
(a NoOp can be connected to any input).

You could, for example, create a temp node of each relevant parent class,
and use those to test "canSetInput()" for each input in your node. Here's an
example in case it's of any help:

########################
n = nuke.selectedNode()

 nodeTypes = [ ('Axis', nuke.nodes.Axis2()) , ('Camera',
nuke.nodes.Camera2()), ('Geo', nuke.nodes.Card2()), ('Transform',
nuke.nodes.Transform()), ('Iop' , nuke.nodes.Blur())]


 for input in range(n.optionalInput()):

    print "input %s accepts %s nodes" % (input, ' and '.join([name for
(name, node) in nodeTypes if n.canSetInput(input, node)]))


 for (name,tempnode) in nodeTypes:

    nuke.delete(tempnode)

 ########################


Cheers,
Ivan

On Sun, May 22, 2011 at 8:30 AM, Ean Carr <[email protected]> wrote:

> Hey Lucien,
>
> Not a bad idea, but I can't rely on the inputs being connected already. Was
> hoping there was a method for getting the pipe names in any situation. Might
> do a feature request for that.
>
> Thanks,
> Ean
>
>
> On Fri, May 20, 2011 at 2:18 PM, Lucien FOSTIER 
> <[email protected]>wrote:
>
>> Hi Ean,
>>
>> If i understand you correctly, you could do/
>>
>> recon=nuke.toNode("Reconcile3D1")
>>
>> for n in range(recon.inputs() ):
>>    print recon.input(n).Class()
>>
>>
>> having the class of the input node should help you determining the
>> corresponding input name.
>>
>> hope that helps
>>
>> --
>> lucien FOSTIER
>> 75012 PARIS
>> 0625423061
>> http://lucienfostier.com
>> _______________________________________________
>> 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
>
>
_______________________________________________
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