Hi,

To do autolabels, define a function that returns a string, then add it using
nuke.addAutolabel. For example:

###
def myAutolabel():
    return 'myLabel'

nuke.addAutolabel(myAutolabel)
###

You can specify a nodeClass kwarg, too:

nuke.addAutolabel(myAutolabel, nodeClass='Blur') # Blur nodes only

If you want to keep indicators on custom autolabels, you can put this in
your autolabel function:

###
ind =
nuke.expression("(keys?1:0)+(has_expression?2:0)+(clones?8:0)+(viewsplit?32:0)")
if int(nuke.numvalue("maskChannelInput", 0)) :
    ind += 4
if int(nuke.numvalue("this.mix", 1)) < 1:
    ind += 16
nuke.knob("this.indicators", str(ind))
###

Oh, and finally, you have to also return the user's label or it won't show
up, i.e. nuke.thisNode()['label'].value().

It's useful to build a list where each index is a line of your node's label,
join it up with '\n'.join(mylist), then return that string.

Hope this helps.

Cheers,
Ean






On Thu, Oct 27, 2011 at 7:47 PM, woei lee <[email protected]> wrote:

>
>
> Hello all,
>
>
> If I def a method ( def autolabelCallback() ) and assign a custom value to
> a node's ['autolabel'], ie: 'myLabel'
>
>
> But now when I print from ['autolabel'], it's printing "autolabelCallback()",
> how do I get "myLabel" instead?
>
>
> Thanks!
>
>
>
> _______________________________________________
> 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