Network View: Layout Nodes Left Alphabetically?

   524   2   1
User Avatar
Member
1184 posts
Joined: April 2017
Offline
Hi!

I just found out about the Layout -> Layout Nodes Left. Alternatively, you can press and hold "A" + left-click and drag in the direction you want them to stack.

Wonderfull, but!! It's not in alphabetical order. Any way to change the behavior?

-Olivier
Edited by olivierth - April 29, 2025 13:07:39

Attachments:
Houdini_Layout_Nodes_Left_01.JPG (51.3 KB)

User Avatar
Member
654 posts
Joined: Aug. 2014
Offline
I don't think so.
But for this particular case, where all nodes are disconnected, you can lay them out alphabetically with a tiny bit of Python:

import hou
selection = hou.selectedNodes()
node_paths = []
for node in selection:
    node_paths.append(node.path())
node_paths = sorted(node_paths)
for node_path in node_paths:
    # Either create your own layout rules here, using position(),
    # setPosition() and shiftPosition() methods of hou.Node class,
    # or use:
    hou.node(node_path).moveToGoodPosition()
User Avatar
Member
1184 posts
Joined: April 2017
Offline
Thanks, ajz3d !
  • Quick Links