How do you guys move the pivot to the bottom of the object? I tried to make new shelf button by modifying the python script for (Move pivot to center) shelf icon:
import toolutils
scene_viewer = None activepane = toolutils.activePane(kwargs) parent = activepane.pwd() if activepane.type() != hou.paneTabType.SceneViewer: # Use the last selected object if parent.childTypeCategory() != hou.objNodeTypeCategory(): raise hou.Error("This tool cannot be executed in this context") selected = [child for child in parent.children() if child.isSelected()] else: scene_viewer = toolutils.sceneViewer() selected = scene_viewer.selectObjects( prompt = toolutils.selectionPrompt(hou.objNodeTypeCategory()), allow_multisel = True, allowed_types = ("geo",))
if len(selected) == 0: raise hou.Error("Nothing was selected")
for center_obj in selected: display = center_obj.displayNode() if display is None: pivot = hou.Vector3(0, 0, 0) # Use 0,0,0 by convention else: geo = display.geometry() pivot = geo.boundingBox().center() center_obj.parmTuple("p").set(pivot)
if scene_viewer is not None: scene_viewer.setCurrentState("pose")
Tried “pivot = geo.boundingBox().center()” to “pivot = geo.boundingBox().bottom()” but it's not working with me.
Thank you so much Ryu Ku, My question actually was about moving the pivot to the center of the bottom but thank you that will keep me trying to understand the python more and more