Last active
August 5, 2018 20:49
-
-
Save marvolo3d/4850fa1543a9e3a53a84905bbc434e7a to your computer and use it in GitHub Desktop.
snap selected houdini nodes to cursor position
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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