Thank you for the answer Ean.

In fact "nuke.frame(nuke.frame() + 1)"  was an example to force the
autolabel callback, but this line will change the current frame in the
viewer and I don´t want it.

The problem seems to be solved doing this:


def knobChangedCallback():
    if nuke.thisKnob().name() == 'inputChange':

         nuke.thisNode()['autolabel'].setValue(None)   # this seems to
properly trigger the autolabel callback

nuke.addKnobChanged(knobChangedCallback)


def autolabelCallback():

    input = nuke.thisNode().input(0)

    if input.Class() == 'Read':

         return 'XXXX'

    else:

         return 'YYYY'

nuke.addAutolabel(autolabelCallback)


Thanks again Ean.

J



2011/9/16 Ean Carr <[email protected]>

> Hey Javier,
>
> They way I'd set up something like that is with two callbacks: a
> knobChanged, and an autolabel:
>
> def onInputChangeCallback():
>     if nuke.thisKnob().name() == 'inputChange':
>
>         nuke.frame(nuke.frame() + 1)
> nuke.addKnobChanged(onInputChangeCallback)
>
> def autolabelCallback():
>     if nuke.thisKnob().name() == 'inputChange':
>
>         if node_input == XX:
>             return 'XXXX'
>         else:
>             return 'YYYY'
> nuke.addAutolabel(autolabelCallback)
>
> So, one's not triggering the other, but they're both triggered by
> 'inputChange'. I guess you could do your frame advance in the autolabel
> callback, but I read somewhere that autolabel functions are triggered as low
> priority, hence the knobChanged callback.
>
> Hope this helps.
>
> -Ean
>
>
> On Wed, Sep 14, 2011 at 10:34 PM, Javier Garcia <[email protected]> wrote:
>
>> Hi,
>>
>> I need to trigger the autolabel callback from other callback, for example:
>>
>>
>> def onInputChangeCallback():
>>
>> nuke.frame( nuke.frame() + 1 )
>>
>> # this line will trigger the autolabel callback but also will change the
>> current frame, nuke.frame( nuke.frame() ) doesn´t work.
>>
>>
>>
>> def autolabelCallback():
>>
>> if node_input == XX:
>>
>> return 'XXXX'
>>
>> else:
>>
>> return 'YYYY'
>>
>>
>>
>>
>> thanks.
>>
>> J
>>
>>
>>
>> _______________________________________________
>> 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