Nah, I know PySide is a big hill to climb, but something like this is pretty
approachable and quick to bang out, so I imagine it may save you some pain
somewhere.
-Nathan
From: Richard Bobo
Sent: Wednesday, May 08, 2013 6:14 PM
To: Nuke user discussion
Subject: Re: [Nuke-users] Looking for drag and drop reordering knob...
Hahaha! Thanks, Nathan!
You either are taking pity on me or you don't want to see any more lame-ass
code from me posted on this group. ...And, you don't need to tell me which (or
both) it is!! ;^) LOL
Rich
On May 8, 2013, at 8:16 PM, Nathan Rusch <[email protected]> wrote:
Please Rich... do yourself a favor :P
from PySide import QtGui
class Embedder(object):
def makeUI(self):
self.widget = QtGui.QListWidget(QtGui.qApp.activeWindow())
self.widget.setDragDropMode(QtGui.QListWidget.InternalMove)
return self.widget
class ListPanel(nukescripts.PythonPanel):
def __init__(self):
super(ListPanel, self).__init__()
self.listKnob = nuke.PyCustom_Knob('list', '', 'Embedder()')
self.addKnob(self.listKnob)
def setListItems(self, items):
self.listKnob.getObject().widget.addItems(items)
def getListItems(self):
widget = self.listKnob.getObject().widget
return [widget.item(i).text() for i in range(widget.count())]
-Nathan
From: Richard Bobo
Sent: Wednesday, May 08, 2013 7:28 AM
To: Nuke user discussion
Subject: Re: [Nuke-users] Looking for drag and drop reordering knob...
Nathan,
In case this might give you a laugh and brighten your day, here's my example
hack for using the RotoPaint node to reorder a list. My plan was to use it with
a callback to update some merge layers. Essentially being able to drag-reorder
layers a la Photoshop! (Why not?) ;^)
I didn't end up using it on this project (yet), but I may find a use for it
in the future. Maybe I'll have some time to learn more about PySide, though,
and code a more elegant solution. 8^)
Rich
-----------------------------------------------------------------------------------------------------------------
import nuke.rotopaint as rp
#### Start with your list go items to be sorted...
list_o_layers = ['one', 'two', 'three', 'four', 'five']
#### Create a named RotoPaint node and get it by name (which might be
different)...
rpNode = nuke.toNode('RotoPaint1')
#### Get the curves knob in the node...
cKnob= rpNode['curves']
#### Make a dummy paint stroke to hold each name, so we can reorder them with
the GUI...
#### Iterate through the list of names and create a stroke for each.
for s in list_o_layers:
stroke = rp.Stroke(cKnob)
stroke.name = s
print s
cKnob.rootLayer.append(stroke)
###############################################
###############################################
#### DO YOUR MANUAL REORDERING, then run the rest...
###############################################
###############################################
###############################################
#### PART 2 -- Run this after reordering the list.
###############################################
#### Get the list of items in the (manually reordered) list...
root = cKnob.rootLayer
for shape in root:
print shape.name
-----------------------------------------------------------------------------------------------------------------
On May 2, 2013, at 2:01 PM, Nathan Rusch <[email protected]> wrote:
This is a job for PySide.
-Nathan
From: Richard Bobo
Sent: Thursday, May 02, 2013 10:43 AM
To: Nuke-Users Mailing List List Postings ; Nuke Python discussion
Subject: [Nuke-users] Looking for drag and drop reordering knob...
Hi,
Besides the RotoPaint node, are there any user accessible knob types that
allow drag and drop reordering?
I'm looking to cobble together a small tool panel that would allow me to
stuff a list of items into it, reorder it via drag and drop, then get the
reordered list back. I'm thinking I could hijack the RotoPaint control panel to
do that, since paint shape layers can be reordered. However, I'm not eager to
dive into the complexities of getting access to those knobs… Any ideas for a
simpler knob/tool I could use…?
Thanks,
Rich
Rich Bobo
Senior VFX Compositor
Armstrong-White
http://armstrong-white.com/
Email: [email protected]
Mobile: (248) 840-2665
Web: http://richbobo.com/
"The greatest achievement of the human spirit is to live up to one's
opportunities, and to make the most of one's resources."
- Vauvenargues
------------------------------------------------------------------------------
_______________________________________________
Nuke-users mailing list
[email protected], http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-users
_______________________________________________
Nuke-users mailing list
[email protected], http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-users
------------------------------------------------------------------------------
_______________________________________________
Nuke-users mailing list
[email protected], http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-users
_______________________________________________
Nuke-users mailing list
[email protected], http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-users
--------------------------------------------------------------------------------
_______________________________________________
Nuke-users mailing list
[email protected], http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-users_______________________________________________
Nuke-users mailing list
[email protected], http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-users