That autolabel with the Blur was just for the sake of demonstrating the issue I was having with the node name being overwritten.
I've used the callback on an empty group exported as a gizmo that will convert the exr metadata compression key/value pair from an integer value into the actual compression name. So although autolabel is a lot more convoluted than I initially thought (thanks for your additional comments), in this case it may be minimally intrusive. It is clunky having to refresh the node by toggling the "d" key though, but at least it allows you to see the value at a glance in the DAG...the best way. If you're OCD then you can just toggle d again. More elegant approaches are welcome! Michael On 2 May 2013 23:50, Ben Dickson <ben.dick...@rsp.com.au> wrote: > A much simpler way is to set a default label for the Blur, like this: > > nuke.knobDefault("Blur.label", "[value size]") > > It's a bit untidy, but for simple expressions like that, I think it's fine. > > If you do want to use the autolabel callback, be aware the autolabel has > more subtly than just nodename+new text.. E.g it should: > > * append the value of the 'label' knob > * set the animated/expression/clone/**splitview indicator icons > * respect the preferences.autolabel setting > * show things like the selected layer and mask channels > > Also a bunch of node-specific stuff - it's kind of convoluted.. Check > nuke_directory/plugins/**autolabel.py > > At the very least, you don't want to lose the indicators or the existing > label: > > def _set_icons(node): > ind = nuke.runIn(node.fullName(), 'nuke.expression("(keys?1:0)+(** > has_expression?2:0)+(clones?8:**0)+(viewsplit?32:0)")') > > maskinput_act = int(nuke.runIn(node.fullName()**, > 'nuke.numvalue("**maskChannelInput", > 0)')) > if maskinput_act: > ind += 4 > > mix_act = nuke.runIn(node.fullName(), 'int(nuke.numvalue("this.mix", > 1)) < 1') > if mix_act: > ind += 16 > > node['indicators'].setValue(**ind) > > def AL(): > n=nuke.thisNode() > _set_icons(n) > > label= '%s\n %s' %(n.name(), n['size'].value()) > > userlabel = n['label'].evaluate(): > if len(userlabel) > 0: > label += "\n%s" % userlabel > > > return label > > nuke.addAutolabel(AL, nodeClass='Blur') > > > On 03/05/13 07:05, Michael Garrett wrote: > >> Ah, thanks Nathan - I thought addAutoLabel() would only change the >> 'autolabel' hidden knob. >> >> Googling some examples, this works better: >> >> def AL(): >> n=nuke.thisNode() >> label= '%s\n %s' %(n.name <http://n.name>(), n['size'].value()) >> >> return label >> >> nuke.addAutolabel(AL, nodeClass='Blur') >> >> >> >> On 2 May 2013 16:44, Nathan Rusch <nathan_ru...@hotmail.com >> <mailto:nathan_rusch@hotmail.**com <nathan_ru...@hotmail.com>>> wrote: >> >> The behavior you’re seeing sounds like it’s in line with the >> intended callback behavior: >> "...If all of [the registered callbacks] return None, then >> nuke.thisNode().name() is used" >> -Nathan >> >> *From:* Michael Garrett <mailto:michaeld...@gmail.com> >> *Sent:* Thursday, May 02, 2013 1:38 PM >> *To:* Nuke Python discussion >> >> <mailto:nuke-python@support.**thefoundry.co.uk<nuke-python@support.thefoundry.co.uk> >> > >> *Subject:* [Nuke-python] autoLabel is replacing name in dag >> >> >> I'm finding that an autoLabel is replacing the node name in the dag, >> for example: >> >> def AL(): >> >> blurSize=nuke.thisNode()['**size'].value() >> >> return blurSize >> >> >> nuke.addAutolabel(AL, nodeClass='Blur') >> >> ...then create a Blur node. >> >> I'm on Windows 7, Nuke 7.0v5. >> >> Thanks, >> >> Michael >> >> ------------------------------**------------------------------** >> ------------ >> ______________________________**_________________ >> Nuke-python mailing list >> >> Nuke-python@support.**thefoundry.co.uk<Nuke-python@support.thefoundry.co.uk> >> >> <mailto:Nuke-python@support.**thefoundry.co.uk<Nuke-python@support.thefoundry.co.uk> >> >, >> >> http://forums.thefoundry.co.**uk/ <http://forums.thefoundry.co.uk/> >> http://support.thefoundry.co.**uk/cgi-bin/mailman/listinfo/** >> nuke-python<http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python> >> >> >> ______________________________**_________________ >> Nuke-python mailing list >> >> Nuke-python@support.**thefoundry.co.uk<Nuke-python@support.thefoundry.co.uk> >> >> <mailto:Nuke-python@support.**thefoundry.co.uk<Nuke-python@support.thefoundry.co.uk> >> >, >> >> http://forums.thefoundry.co.**uk/ <http://forums.thefoundry.co.uk/> >> http://support.thefoundry.co.**uk/cgi-bin/mailman/listinfo/** >> nuke-python<http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python> >> >> >> >> >> ______________________________**_________________ >> Nuke-python mailing list >> Nuke-python@support.**thefoundry.co.uk<Nuke-python@support.thefoundry.co.uk>, >> http://forums.thefoundry.co.**uk/ <http://forums.thefoundry.co.uk/> >> http://support.thefoundry.co.**uk/cgi-bin/mailman/listinfo/**nuke-python<http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python> >> > > -- > ben dickson > 2D TD | ben.dick...@rsp.com.au > rising sun pictures | www.rsp.com.au > > ______________________________**_________________ > Nuke-python mailing list > Nuke-python@support.**thefoundry.co.uk<Nuke-python@support.thefoundry.co.uk>, > http://forums.thefoundry.co.**uk/ <http://forums.thefoundry.co.uk/> > http://support.thefoundry.co.**uk/cgi-bin/mailman/listinfo/**nuke-python<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