The nuke.Panel class is basically a thin wrapper for the old-school TCL panels.
As such, if you quote your list items in TCL syntax (using braces), things will
work as you expect:
# Verbose code for demonstration
w = nuke.nodes.Write(file_type='exr')
comps = w['compression'].values()
quoted = ['{%s}' % c for c in comps]
p = nuke.Panel('Compression')
p.addEnumerationPulldown('compression', ' '.join(quoted))
p.show()
-Nathan
From: Howard Jones
Sent: Monday, September 03, 2012 1:26 PM
To: [email protected]
Subject: Re: [Nuke-python] Re: Listing the EXR compression type in a
dropdownmenu panel
In the meantime... ;) if you quote your list correctly you wont get the spaces
affecting the pulldown
If you look at bookmarker on nukepedia, this snippet sorts out the names so
that they can have spaces but list on a pull down correctly.
Took me a while to suss it ( translate: work it out) and I'm not a programmer
so there no doubt easier methods but works. In short it surrounds the list with
double quotes
so
' this will list on several lines'
whereas
"this should list on one"
snippet:
#find bookmark nodes
for n in nuke.allNodes():
n['selected'].setValue( False )
if n['icon'].value() == 'bookmark.png':
n['selected'].setValue( True ) #select nodes for clarity
bmLabel=nuke.selectedNode()['label'].value()
if bmLabel:
bm_name='"'+bmLabel+'"' # '"'<-lets it list correctly
else:
bm_name='"'+n.name()+'"' # '"'<-allows it to be sorted
correctly with above
bm.append(bm_name)
if 0==len(bm):
nuke.message('no bookmarks found')
hth
Howard
------------------------------------------------------------------------------
From: Mohamed Selim <[email protected]>
To: [email protected]
Sent: Monday, 3 September 2012, 20:40
Subject: [Nuke-python] Re: Listing the EXR compression type in a dropdown
menu panel
A little out of my league, but i will look in to it.
Thanks for the suggestion
jimmyGhost wrote:
Or make the Panel using PySide and gain alot more control over your
interface.
Best Regards
Jimmy Christensen
Developer
Ghost A/S
------------------------------------------------------------------------------
Mohamed Selim
Nuke Compositor
Cairo, Egypt
www.mselim.com
_______________________________________________
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