scaleNodes v1.3


 
This location is for Registered Users Only.
Perhaps you need to login or register.
Contributor: Frank Rueter
Website: www.ohufx.com
contract and expand node connections
Requirements:
6.3 or later
Linux, Mac, Windows
06 Feb 2012
641

v1.3: added support for scaling X and Y independently. If only one argument is given, the nodes are scaled equally in both directions, otherwise the first argument defines the horizontal scale and the second the vertical one.

 

Example for horizontal scale
scaleNodes.scaleNodes( .5, 1 )

 

 

 

Example for vertical scale
scaleNodes.scaleNodes( 1, .5 )

 

 

 


v1.2: fixed bug with backdrop nodes not behaving as expected.

 


v1.1: auto-adjusts backdrop nodes to fit the new node positions after scaling (doesn't matter if they are selected)

 

 


scaleNodes increases and decreases the lengths of the selected nodes' connections to either make parts of the node tree more compact or give you more space.

 

menu.py example (note that these lines overwrite the default zoom hotkeys which I personally never use ayway):

1
2
3
4
5
import scaleNodes
 
menuBar = nuke.menu("Nuke")
menuBar.addCommand('Edit/Node/Scale/up', 'scaleNodes.scaleNodes( 1.1 )', '=')
menuBar.addCommand('Edit/Node/Scale/down', 'scaleNodes.scaleNodes( 0.9 )', '-')

 

 

 

original selection:
scaleNodes_01

after scaling down:
scaleNodes_02

after scaling up:
scaleNodes_03 

Please login in order to download these files.

Comments   

 
0 # Frank Rueter 2010-10-18 16:05
just subscribing to this feedback thread
 
 
0 # J Bills 2012-01-11 10:36
this has turned out to be one of the most valuable scripts I've come across, frank! thanks. use it daily.

the one question I have concerns backdrops. I wonder if there'd be any way to accurately scale them up prior to doing the spacing so that they maintain their relationship through the scale? It's been on my list to look into it for a while, but haven't had the time. just putting it out there in case anyone else can get to it first, would be a smooth addition!
 
 
0 # Frank Rueter 2012-01-11 12:47
Hi J,

that's a great idea, and o obvious once pointed out :-D. Will have a look
 
 
0 # Frank Rueter 2012-01-22 22:12
Hi J,

try v1.1 and let me know if it does what you are after.
 
 
0 # Ahad Mohebbi 2012-01-23 04:48
Thanks for your grate idea. but please fix it for backdop node
 
 
0 # Gary Couto 2012-01-23 08:54
Doesn't work with a script that has backdrops in v1.1 on Linux.

Works great if there are no backdrops, so thanks for that.
Look forward to using it more when the backdrop issue is resolved.

Much appreciated, Frank.
 
 
0 # Frank Rueter 2012-01-23 14:50
interesting. I did have some weird results when I tested it half way through, but in the end it seemed to work for me (on osx). Can you guys send an example of a nuke script to me that doesn't work properly with the backdrop nodes (frank[at]ohufx .com)? I hope this is just me and not a python bug.
 
 
0 # Howard Jones 2012-01-23 15:09
Hi Frank

Been a great and useful tool - would it be possible to scale in x or y as well as both? Often I might want to just widen or lengthen a selection.

Howard
 
 
0 # Frank Rueter 2012-01-23 15:17
@Howard: that's easy enough, will do for the next version when I try to fix the backdrop nodes (again)
 
 
0 # Isa Alsup 2012-01-27 12:06
I am getting this error message in NUKE 6.3v4 :


Traceback (most recent call last):
File "", line 1, in
File "/Users/ME/.nuk e/scaleNodes.py ", line 33, in scaleNodes
backdrops[bd] = getSideNodes( bd )
File "/Users/ME/.nuk e/scaleNodes.py ", line 9, in getSideNodes
bd.selectNodes()
AttributeError: 'Node' object has no attribute 'selectNodes'
 
 
0 # frank rueter 2012-01-27 18:23
@Ian: sounds like you didn't have any nodes selected? I should catch this case again. Will be away for a while but once back will get onto fixing this version.
 
 
0 # Michael Clemens 2012-01-27 18:30
I too am getting that same error (but in 6.2v5). ..
Traceback (most recent call last):
File "", line 1, in
File "/Users/ME/.nuk e/scaleNodes.py ", line 33, in scaleNodes
backdrops[bd] = getSideNodes( bd )
File "/Users/ME/.nuk e/scaleNodes.py ", line 9, in getSideNodes
bd.selectNodes()
AttributeError: 'Node' object has no attribute 'selectNodes'
 
 
+1 # Frank Rueter 2012-02-06 21:07
Hi guys, v1.3 should make the backdrop nodes behave now. Also, there is support for non uniform scaling, see release notes above.
Isa, are you still seeing this error message? If so, can you let me know how it can be reproduced?

This still doesn't work inside of group nodes as there is no support yet for figuring out which node graph is the "active" one. Pining for that one...
 
 
0 # Isa Alsup 2012-02-06 22:14
YES, if a backdrop is in the script, even if not selected.


scaleNodesV13.scaleNodesV13(1, 1.7)
# Result:
Traceback (most recent call last):
File "", line 1, in
File "/Users/XXX/.nu ke/python/scale NodesV13.py", line 37, in scaleNodesV13
backdrops[bd] = getSideNodes( bd )
File "/Users/XXX/.nu ke/python/scale NodesV13.py", line 11, in getSideNodes
bd.selectNodes()
AttributeError: 'Node' object has no attribute 'selectNodes'
 
 
0 # Frank Rueter 2012-02-06 22:15
Oh wait, you're on 6.2. I'm using a command that was only added for 6.3, sorry.
 
 
0 # J Bills 2012-02-07 12:37
thanks frank - this is awesome!
 
 
0 # Michael Clemens 2012-02-07 13:05
Backdrops, anywhere in the script, still give the traceback error as before (in 6.2v5 at least)
 
 
0 # Michael Clemens 2012-02-07 13:15
Here is the error again. Doesn't seem to work for me in 6.2 or 6.3.
Traceback (most recent call last):
File "", line 1, in
File "/home/me/.nuke /scaleNodes.py" , line 35, in scaleNodes
backdrops[bd] = getSideNodes( bd )
File "/home/me/.nuke /scaleNodes.py" , line 9, in getSideNodes
bd.selectNodes()
AttributeError: 'Node' object has no attribute 'selectNodes'
 
 
0 # Frank Rueter 2012-02-07 14:28
are you sure this error occurs in 6.3? I'm not sure when the "selectNodes()" method was made available but it's fairly recent. The latest version should definitely work
 
 
0 # J Bills 2012-02-08 19:30
hmmm, in 6.3v6 I do get an error when invoking. anyone else?

-----------
File "", line 69, in
File "", line 57, in scaleNodes
TypeError: list indices must be integers, not str
 
 
0 # J Bills 2012-02-08 19:53
has to be a certain node class or something that is tripping it up, because it works on some scripts but not on others. I'll see if I can narrow it down
 
 
0 # J Bills 2012-02-08 19:59
ok, ignore. I think it's something to do with the current script I'm working on just being buggy. seems to work with all of the others I've tested, so just going to assume it's nothing. move along, nothing to see here...
 
 
0 # Frank Rueter 2012-02-08 20:14
well, if you find a script that doesn't work just send it my way and I will try and figure out what's going on.
 
 
0 # max chan 2014-03-17 07:54
i usually don't comment on nukepedia but...
i love this script
 
 
0 # Gaston Marcotti 2015-01-13 12:05
Thank you Frank, i want to be like you .
 
 
0 # Alexey Kuchinski 2015-08-14 12:42
Hi Frank,
can i add your code to my "Massive Panel" please?, it is a tool for manipulation of many nodes in the same time
i am posting here as well, and i did implement some new features, one of them is based on your code.
thank you
 
 
0 # Frank Rueter 2015-08-14 12:53
Sure. Just leave a reference to the original code please
 
 
0 # Alexey Kuchinski 2015-08-14 12:57
thanks a lot!
 
 
0 # Falk Hofmann 2017-03-13 00:23
i catched the idea to involve some sliders to use it interactively in another comment section. so i gave it a try to wrap those around your script. uploaded and linked to this one:

http://www.nukepedia.com/python/ui/scalebox
 

You have no rights to post comments

We have 4166 guests and 37 members online