This one will be quick post about nodeEditor in maya.
Lately I am in rigging a bit- learning, organizing etc ... so I worked in hypergraph/nodeEditor more than ever. Align nodes is what I need!
So during working with nodes, connecting and moving them back and forth I said "no way, i don't like it at all". But then I remembered that I've seen one day great stuff that deals with that on lesterbanks. Yeap ... and it was "NodeAlignDeez" by Character Rigger at Blur Studio so called by lesterbanks editor :) Check here
So my first thought was - maybe it is easily accesible by mel/python. I spent few hours trying to
get/set node positions using nodeEditor command. I even asked a question on autodeskArea - no replies unfortunately.
After that ... I decided to use script that I mentioned above (alignDeez)- why not, it's already there.
Lets get it and start working with pleasure. So I went to github and to my surprise script wasn't there.
Because alignDeez post is one yearl old .... I wonder if source was ever there?
Ok... so how the hell would i know how to acces positions if nodeEditor doesn't give you such interface ... and it struck me- "hey what about bookmarks, if maya keeps it between session it must be somewhere". And that was it.
- create tempBookmark - "nodeEditor -e -createInfo"
Be carefull- it does't return any node name, so we're forced here to read all scene nodes in search for "nodeGraphEditorBookmarkInfo type before and after "nodeEditor -e -createInfo" to know which one has been added
- read positions for selected nodes
- calculate average,min,max etc
- set positions attributes in tempBookmark
- load node editor bookmark - "nodeEditor -e -restoreInfo"
- remove tempBookmark
- additionaly I "inject" small ui into nodeEditor and that's it
I know ... kind of clunky, but works. I don't really know how alignDeez is made. If it also based on bookmarks sorry for doubling If not maybe someone could give me a clue how char.Rigger at Blur approached this... ?? I just want to satisfy curiosity. I think he accesing ui in qt because it ui looks super responsive... but ... just would be cool to know.
Script is here btw ... highend3d
All you need to do is load in script editor and execute it.
It is worth to mention that most UIControls names are hardcoded so sometimes it may not work.
Additionaly what I found out is that in maya 2017 lsUI -window don't work supposedly because in 2017 autodesk introduced QT5. So that's why I don't bother for proper UI code.
Script definietly needs more work, but I don't want "waste" to much time. Autodesk will add it for sure ;)