Skip to content

Instantly share code, notes, and snippets.

@marvolo3d
Last active August 5, 2018 20:49
Show Gist options
  • Save marvolo3d/4850fa1543a9e3a53a84905bbc434e7a to your computer and use it in GitHub Desktop.
Save marvolo3d/4850fa1543a9e3a53a84905bbc434e7a to your computer and use it in GitHub Desktop.
snap selected houdini nodes to cursor position
# move all selected network items to cursor position
# currently breaking when backdrop containers are selected along with their children nodes (double transform)
net_editor = hou.ui.paneTabOfType(hou.paneTabType.NetworkEditor)
# get avg pos of selection
items = hou.selectedItems()
avg = hou.Vector2()
for i in items:
avg += i.position()
avg /= len(items)
# apply offset
offset = net_editor.cursorPosition() - avg
for i in items:
i.move(offset)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment