Hey Thanks Nathan I'll have a look at it tomorrow!

Cheers,
J

2015-08-11 20:11 GMT+01:00 Nathan Rusch <nathan_ru...@hotmail.com>:

> A knobChanged callback might look like this:
>
> def groupKnobChanged():
>     if nuke.thisKnob().name() == 'inputChange':
>         n = nuke.thisNode()
>         maxIndex = n.maximumInputs() - 1
>         if n.input(maxIndex) is not None:
>             # Last input is connected to something. Add a new one.
>             with n:
>                 nuke.nodes.Input()
>         else:
>             # Find disconnected inputs at the end to remove
>             lastIndex = n.inputs()
>             if lastIndex < maxIndex:
>                 for inputNode in nuke.allNodes('Input', group=n):
>                     if inputNode['number'].value() > lastIndex:
>                         nuke.delete(inputNode)
>
>
> Disclaimer: I wrote this directly into the email, so it's completely
> untested, but hopefully it helps.
>
>
> -Nathan
>
>
> *From:* Justin GD <j.grosde...@gmail.com>
> *Sent:* Tuesday, August 11, 2015 9:52 AM
> *To:* Nuke Python discussion <nuke-python@support.thefoundry.co.uk>
> *Subject:* Re: [Nuke-python] Dynamic Group inputs creation
>
> Hi Erwan,
>
> Thanks for your reply.
> Actually, this is what I'm doing so far. Having an add and delete buttons
> in the panel.
> Since it's not the first time I need to do this, I was wondering if there
> was a better way...
>
> Cheers,
> Justin
>
> 2015-08-11 17:21 GMT+01:00 Erwan Leroy <er...@erwanleroy.com>:
>
>> Wild wild guess, you could probably add a knobchanged that checks if
>> every input is connected, and if so create a new one.
>> Things get more tricky internationally to have everything connecting
>> properly, and not sure how you would delete the extra inputs when not
>> needed anymore.
>> Last time I had to do a gizmo with variable number of inputs, I added a
>> step on the user to specify the number of needed inputs, then click
>> "build".
>> It wasn't the most classy way to do it but it was safe and did the job.
>> I'm sure some more experimented guys in here could give you a better
>> answer.
>> On 11 Aug 2015 23:56, "Justin GD" <j.grosde...@gmail.com> wrote:
>>
>>> Hi all,
>>>
>>> Is there a specific method to dynamically create an input node inside of
>>> a group ?
>>>
>>> Just like on a merge node, where we can drag pipes from the left side as
>>> many as we want.
>>>
>>> Is it even possible to do it in python? Related to callbacks ?
>>>
>>> Cheers,
>>> Justin
>>>
>>> _______________________________________________
>>> 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
>
>
_______________________________________________
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