How to quickly move pivot to object center in LOP? $CEX $CEY $CEZ and centroid() don't work, do I need to use the usd python api to access the current object bbx to calculate?
I got a component that is part of a product. (please see image attached) I would love to rotate it around a very specific pivot location, preferably without the use of sop_modify.
Isn’t There a way to define a pivot attribute before importing into lops?
I got a component that is part of a product. (please see image attached) I would love to rotate it around a very specific pivot location, preferably without the use of sop_modify.
Isn’t There a way to define a pivot attribute before importing into lops?
Thanks in advance! Best Chris
I have an idea: calculate the position of the center point by querying the bbx of the current prim through USD's python API, but this seems extremely cumbersome and troublesome.
Yeah, I think the only way is python api (or vex, but you still need to pull somehow values to parameter).
I have a little example for Transform LOP. Something similar to pivot tool in omniverse. It's just setting pivot relative to bounding box with exposed controls.
(It's just an example, would be better to package it to little hda to avoid complicated expressions)
elovikov Yeah, I think the only way is python api (or vex, but you still need to pull somehow values to parameter).
I have a little example for Transform LOP. Something similar to pivot tool in omniverse. It's just setting pivot relative to bounding box with exposed controls.
(It's just an example, would be better to package it to little hda to avoid complicated expressions)
That's why I love community!Talented people communicate with each other. Thank you so much for sharing, I was diving for the API in the USD documentation, you saved me a lot.
With your object selected in the Scenegraph, if your cursor is over the Scene Viewer when you drop down the Transform LOP, it will auto-set this pivot to center on the object.
Thanks a lot from me as well! These informations are very useful!
But how would you center the pivot inside the circular opening of the strap model I posted above?
Neither center pivot or bbox will work in this case :-) In the image, I positioned the pivot in Sops with the help of selections and the construction plane. But how do I get the pivot into lops?
CV Thanks a lot from me as well! These informations are very useful!
But how would you center the pivot inside the circular opening of the strap model I posted above?
Neither center pivot or bbox will work in this case :-) In the image, I positioned the pivot in Sops with the help of selections and the construction plane. But how do I get the pivot into lops?
Or is this a sop_modify thing?
All the best Christian
use the ch function reference them from SOP to move the pivot inside the LOP transform.
This is the way I can think of, because USD seems to store 4*4 transformation matrices directly, and does not store pivot information separately, of course you can author a pivot attribute and use USD pyhton API to access them.
Tim Crowson With your object selected in the Scenegraph, if your cursor is over the Scene Viewer when you drop down the Transform LOP, it will auto-set this pivot to center on the object.
I have not been able to get this technique to work in H20.
For me - whenever I use a Transform LOP whenever you customize the `primpattern` parm (Primitive Pattern) at the top then it automatically adjusts the pivot point to the center of the selected primitives.
Note that this occurs when you CTRL+CLICK on the right hand side arrow next to the Prim Pattern field and then select objects in there, and click apply.
I've reported that as a bug since it's really annoying that if you've already done transformations and just want to include an extra primitive that suddenly the pivot changes. However, it does mean that for now that's an easy 'hack' to force the pivot point to bounding box center.
In my bug I've basically requested to implement something like the LOP transforms, so that there are explicit buttons in the UI to "Set the Pivot Point to center" (instead of dynamic evals, etc.)
I'd really like to see a procedural way of addressing this, e.g. "$CEX $CEY $CEZ".
For me, I have a use case where I use PDG to create a collection of USD's that will be referenced into another USD. Within each, the primpath and transforms vary. Requiring manual clicks by the user or hardcoding anything isn't an option.
This definitely seems a bit cumbersome, but for the example of a transform node pivot specifically, the following python function placed in the "px" parm will set the pivot to the center of a selected primitive (py and pz too). Note that I haven't tested it with multiple prims selected, but it at least fits a few use cases. I may add a variation of it to a right-click menu just for easy setting vs worrying about adding a python script directly to a parm expression.
frompxrimportUsdGeomnode=hou.pwd()# Get the stage of the input node to avoid recursionstage=node.input(0).stage()ifstageisnotNone:# Other nodes might need "primpath", but you could functionally add any prim path you want herefocusprim=stage.GetPrimAtPath(node.evalParm("primpattern"))iffocusprimisnotNone:cache=UsdGeom.BBoxCache(1.0,['default','proxy','render','guide'])bounds=cache.ComputeLocalBound(focusprim).ComputeCentroid()# node.parmTuple("p").set(bounds) crashed Houdini via recursion, but this seems to work.node.parm("py").set(bounds[1])node.parm("pz").set(bounds[2])returnbounds[0]
Edited by EJaworenko - April 26, 2024 17:33:02
Houdini TD, I focus on tools for procedural asset creation.