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

Reply via email to