It still doesn't work, keep getting the
/usr/local/Nuke6.3v7/plugins/menu.py : error interpreting this plugin
are you sure you have the right formatting (indent/whitespace)
in the setLabel.py file?
I dont really understand what the def setLabel(): does?
m.addCommand("Set Read Label", "setLabel.setLabel()")
well, i'm far from a python expert myself, but my understanding
is that you're calling the function setLabel() from the file setLabel.py
therefore the call to setLabel.setLabel()
you could have a second function called setLabel12() in the same
file setting the label to the 12th segment, so the setLabel.py
file would like this:
import nuke
def setLabel():
for n in nuke.selectedNodes():
n.knob('label').setValue( n['file'].value().split('/')[13])
def setLabel12():
for n in nuke.selectedNodes():
n.knob('label').setValue( n['file'].value().split('/')[12])
... then add another entry to menu.py calling that:
m.addCommand("Set Read Label 12", "setLabel.setLabel12()")
Using it in the script editor makes the script do nothing, no
errors, just no function
that's probably because you're just defining the function, not
calling it. this should work from the script editor:
def setLabel():
for n in nuke.selectedNodes():
n.knob('label').setValue( n['file'].value().split('/')[13])
setLabel()
i suggest digging around a bit in the manual about the basics of
python and watch the tutorials by frank on the foundry site. he
explains it much better then me (and more accurate too)
++ chris
On 7/20/12 at 3:48 PM, [email protected] (RP) wrote:
It still doesn't work,
keep getting the /usr/local/Nuke6.3v7/plugins/menu.py : error
interpreting this plugin
I dont really understand what the def setLabel(): does?
Using it in the script editor makes the script do nothing, no
errors, just no function
chris wrote:
have you defined is as a function?
your setLabel.py should look something like this and be in
your
nuke plugin path:
import nuke
def setLabel():
for n in nuke.selectedNodes():
n.knob('label').setValue(
n['file'].value().split('/')[13])
On 7/20/12 at 3:03 PM, [email protected]
(RP) wrote:
I found the solution to my own problem
I've changed it to
for n in nuke.selectedNodes():
n.knob('label').setValue(
n['file'].value().split('/')[13])
this seems to work, but now I have new problem
I want to have this script has a tool from a drop down
menu,
I've saved it as setlLabel.py in my plugins folder, and
edited
my menu.py with
import setLabel
m.addCommand("Set Read Label", "setLabel.setLabel()")
But now nuke wont start
RP
-----
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