alignNodes v1.3
This location is for Registered Users Only.
Perhaps you need to login or register.
13.1, 12.2, 12.1, 12.0, 11.3, 11.2, 11.1, 11.0, 10 or later
Linux, Mac, Windows
v1.3 - Nuke 13 compatible
v1.2 - using node centre now instead of upper left corner, which makes Dots work as well as nodes with non-default height due to labels
v1.1 - undo now works
Here is an example menu.py entries with hotkeys (note that this will overwrite alt+x as the shortcut cut for 'File/TCL File...'). It pus the entries into rather deep sub menus, but I always use the hotkeys anyway:
import nuke
import alignNodes
menuBar = nuke.menu('Nuke')
menuBar.addCommand('Edit/Node/Align/horizontally', 'alignNodes.alignNodes(nuke.selectedNodes(), direction=\'x\')' , 'alt+x')
menuBar.addCommand('Edit/Node/Align/vertically', 'alignNodes.alignNodes(nuke.selectedNodes(), direction=\'y\')' , 'alt+y')
before:
after:
Comments
--------------- ------------
Nuke
--------------- ------------
name 'alignNodes' is not defined
--------------- ------------
OK Hide Details...
--------------- ------------
sorry fot the basic question - but what to import? and how???
br mayanic
ImportError: No module named alignNodes
has the name of the module changed?
1) Most people seem to think of 'align horizontally' as all nodes aligned along the same y value (the x axis), and 'align vertically' as all nodes aligned along the same x value (y axis) ... the menu example would appear to do the opposite, unless I'm reading something incorrectly.
2) By using knob.setValue instead of node.setXYpos you make it so the user can't undo correctly.
That's a pretty amasing script here ! : ) I was lookin' for this ! Thanks a lot !
@Michael, if you feel like making an update to get a proper undo, please do so I'd like to have a proper undo as well : ) I'm not good enough yet to make this patch
Cheer everybody ^^
Michael, thanks for the heads up, I've fixed this and undo now works with this (v1.1). I think this was written before the setPos methods were available in the API.
As for the confusion between horizontal and vertical, I will leave that up to the people how they label their menu items (assigning good icons might be the best way to do this)), as from experience there are different opinions on how it should be interpreted.
thanks again for int input guys!
I put the alignNodes.py into my ...Nuke8.0v6\pl ugins\nukescrip ts folder.
Added the following to the top of menu.py
import nukescripts.alignNodes
Adn pasted the following at the bottom, adding "nukescripts." to link to the correct folder
menuBar = nuke.menu("Nuke")
menuBar.addCommand('Edit/Node/Align/horizontally', 'nukescripts.al ignNodes.alignN odes( nuke.selectedNo des(), direction="x" )', 'alt+x')
menuBar.addCommand('Edit/Node/Align/vertically', 'nukescripts.al ignNodes.alignN odes( nuke.selectedNo des(), direction="y" )', 'alt+y')
I switched the x and y around, as i more frequently arange horizontally, so better to have that key closer to hand
Great script by the way!
i use v.11.1 but it doesn't work. I already follow your method. Any chance to solve mine ?
Messing with the install folder is usually not a good idea.
Thank you for brighten up my brain. I put inside nukescripts folder and put my menu.py into users/.nuke folder.
It's work like a champ now !
Thanks a lot Frank..g8t gizmo..help me a tons.
regards
Kito
Do you want to almost align nodes but not quite? :)
http://www.nukepedia.com/python/nodegraph/scalenodes
That would make more sense and would indeed be a cool feature.
because when you use it now with dots it places the dot alligned to the right site of the other nodes
For those having trouble installing:
1. Download alignNodes.py
2. Put alignNodes.py into /nukescripts folder on your drive (for me it is C:\Program Files\Nuke12.1v1\plugins\nukescripts)
3. In this (C:\Program Files\Nuke12.1v 1\plugins\nuke) directory find a file menu.py
4. Add the following code to it:
import nukescripts.alignNodes
menuBar = nuke.menu("Nuke")
menuBar.addCommand('Edit/Node/Align/horizontally', 'nukescripts.al ignNodes.alignN odes( nuke.selectedNo des(), direction="x" )', 'alt+x')
menuBar.addCommand('Edit/Node/Align/vertically', 'nukescripts.al ignNodes.alignN odes( nuke.selectedNo des(), direction="y" )', 'alt+y')
5. Save this updated menu file in here: C:\Users\(YOURNAME)\.nuke
Worked for me in 12.1
menuBar.addCommand('Edit/Node/Align/horizontally', 'alignNodes.ali gnNodes( nuke.selectedNo des(), direction='x')' , 'alt+x')
menuBar.addCommand('Edit/Node/Align/vertically', 'alignNodes.ali gnNodes( nuke.selectedNo des(), direction='y')' , 'alt+y')
keeps on coming up with 'error interpreting this plugin. I am using nuke 12.0v5 and 12.2v4
import nuke
import alignNodes
menuBar = nuke.menu('Nuke')
menuBar.addCommand('Edit/Node/Align/horizontally', 'alignNodes.ali gnNodes( nuke.selectedNo des(), direction='x')' , 'alt+x')
menuBar.addCommand('Edit/Node/Align/vertically', 'alignNodes.ali gnNodes( nuke.selectedNo des(), direction='y')' , 'alt+y')
into my menu.py and have the alighnnodes.py in my .nuke folder
Try again now
The error is this:
File "", line 1
nukescripts.al ignNodes.alignN odes( nuke.selectedNo des(), direction="y" )
SyntaxError: invalid syntax
RSS feed for comments to this post