mirrorNodes v2.1


 
This location is for Registered Users Only.
Perhaps you need to login or register.
Contributor: Frank Rueter
Website: www.ohufx.com
mirror the selected nodes in the DAG
Requirements:
13.1, 12.2, 12.1, 12.0, 11.3, 11.2, 11.1, 11.0, 10 or later
Linux, Mac, Windows
23 Mar 2021
726

2.1 - Nuke 13 compatible


2.0 - added optional argumebt to use last or first selected node as the axis for mirroring

     - mirror is animated to keep track of nodes
     - the required menu entries are included in teh module now so the local menu.py only needs this line: import mirrorNodes


1.1 - corrected resulting positions and made undo work


Mirrors the nodes in the node graph to quickly rearrange portions of the DAG.

example menu.py entry (included in v2.0):

1
2
3
menuBar = nuke.menu('Nuke')
menuBar.addCommand('Edit/Node/Mirror/horizontally', 'mirrorNodes.mirrorNodes( nuke.selectedNodes(), direction='x' )', 'alt+ctrl+x')
menuBar.addCommand('Edit/Node/Mirror/vertically', 'mirrorNodes.mirrorNodes( nuke.selectedNodes(), direction='y' )', 'alt+ctrl+y')

for v2.0+ simply put this in your menu.py:
    import mirrorNodes

 

before: 
mirrorNodes_01

I map things like this to hotkeys and hide them in that ridiculously deep sub menu:mirrorNodes_02

after:
mirrorNodes_03

 

Please login in order to download these files.

Comments   

 
0 # Frank Rueter 2010-10-18 15:31
just subscribing to this feedback thread
 
 
0 # Deke Kincaid 2011-05-18 21:23
nice
only issue is the undo doesn't work on it.
 
 
0 # Frank Rueter 2011-05-18 21:55
oops, indeed. it's fixed now. v1.1 also calculates the proper node centres, before it was using their positions which went very wrong when backdrops were involved. thanks for letting me know.
 
 
+1 # Prabhamrit Singh 2017-07-06 09:45
This script flip all the node from right to left, top to bottom,
what if we want the last node select to be the axis of this flip.
Thanks
 
 
0 # Frank Rueter 2017-07-06 21:42
That could be done. Currently it uses the average position to determine the axis.
I'm pretty busy at the moment but will try and look into it.
 
 
0 # Prabhamrit Singh 2017-07-07 05:35
Thanks for speedy response.
 
 
0 # Frank Rueter 2017-07-07 05:46
np. I assume by "last node" you mean the bottom most node, not the node that was selected last?
 
 
0 # Prabhamrit Singh 2017-07-07 06:08
The node that was selected last.
 
 
0 # Prabhamrit Singh 2017-07-07 06:20
The node that was selected last
 
 
+1 # Prabhamrit Singh 2017-07-07 06:22
https://drive.google.com/open?id=0B4aTHAem-rmMX1A0cGlDRkxocDNaMDJfUnM1WXJiR0RwVDFB
 
 
0 # Frank Rueter 2017-07-07 06:24
makes sense, will have a look
 
 
+2 # Frank Rueter 2017-07-07 06:55
Done. try v2.0
 
 
0 # Prabhamrit Singh 2017-07-07 06:58
Thanks
 
 
0 # Prabhamrit Singh 2017-07-07 07:20
Thanks for help, Its working the right way.
 
 
0 # Stephen T.Y. Wong 2021-03-22 01:30
Just curious if there's any tools out there to convert old python script like this one to python 3 for Nuke 13.
 
 
+1 # Frank Rueter 2021-03-23 02:13
I have just updated this for Nuke 13 now.
In case you want to update things yourself there are lots of helpful docs out there and most of the time it's trivial. This is a good little helper:
http://python-future.org/compatible_idioms.html#catching-exceptions
 
 
0 # Stephen T.Y. Wong 2021-03-23 03:17
Hey Frank,

It's been a long time, hope you're doing well.
Thank you so much for updating this for Nuke 13, and sharing the python 3.0 cheat sheet.
 
 
0 # Stephen T.Y. Wong 2021-04-04 03:18
Thanks again for the Nuke 13 update.
The updated version is taking multiple steps ( as if its animating across ) the node graph, where the older version that I had would mirror the nodegraph in one step.
Just curious if this is due to python 3?
Would be nice if there's an alt version that would mirror in one step like the older version.
 
 
0 # Alex snookes 2022-03-28 13:50
figured out! was in menu.py
 
 
0 # Rod Tom 2022-05-12 16:23
Is it possible to avoid "the animation", I mean just mirror it... commenting some lines easily? I'm not python expert.
 
 
0 # Frank Rueter 2022-05-16 01:07
I haven't touched this code for ages but you coud try setting the "incs" attribute to 1 instead of 10 in line 62
 

You have no rights to post comments

We have 2711 guests and 139 members online