Hi Ivan,

I have a simple panel that lets a user set a node's inputs by name, just
like you could do in Shake. Right now, my panel presents the inputs by
integer (0, 1 etc.) along with "Mask" by figuring out if there's a
difference between inputs and optional inputs.

It's all working fine, I'd just like to present the user with the labels of
the actual pipes. A Switch node matches my labels, but a Merge node doesn't
(0 = A, 1 = B). Neither does my example, of course, a Reconcile3D.

Your idea could work, but I would love to have a method that worked in all
cases, even getting gizmos' input names.

Thanks,
-E

On Sun, May 22, 2011 at 8:58 PM, Ivan Busquets <ivanbusqu...@gmail.com>wrote:

> 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 <eanc...@gmail.com> 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 
>> <lucienfost...@gmail.com>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
>>> Nuke-python@support.thefoundry.co.uk, http://forums.thefoundry.co.uk/
>>> http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python
>>>
>>
>>
>> _______________________________________________
>> Nuke-python mailing list
>> Nuke-python@support.thefoundry.co.uk, http://forums.thefoundry.co.uk/
>> http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python
>>
>>
>
> _______________________________________________
> Nuke-python mailing list
> Nuke-python@support.thefoundry.co.uk, http://forums.thefoundry.co.uk/
> http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python
>
>
_______________________________________________
Nuke-python mailing list
Nuke-python@support.thefoundry.co.uk, http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python

Reply via email to