Last active
June 18, 2017 15:05
-
-
Save kickbase/9b34e9a7ba4baff357dd5490e4fda2a3 to your computer and use it in GitHub Desktop.
[Houdini] [Python] Create transform node what moves object's pivot to the bounding box center.
This file contains hidden or 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
| selectedNode = hou.selectedNodes() | |
| if len(selectedNode) is not 0: | |
| for node in selectedNode: | |
| transformNode = node.parent().createNode('xform', 'tf_pivot2center') | |
| hou.node(transformNode.path()).setInput(0, hou.node(node.path())) | |
| transformNode.moveToGoodPosition() | |
| transformNode.parm('px').setExpression( | |
| '$CEX', language=hou.exprLanguage.Hscript) | |
| transformNode.parm('py').setExpression( | |
| '$CEY', language=hou.exprLanguage.Hscript) | |
| transformNode.parm('pz').setExpression( | |
| '$CEZ', language=hou.exprLanguage.Hscript) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment