Search - User list
Full Version: How to quickly move pivot to object center in LOP?
Root » Solaris and Karma » How to quickly move pivot to object center in LOP?
ysysimon

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?
ysysimon
Didn't find useful information in the documentation, does LOP currently not support this kind of operation?
CV
Hi, I would love to know more about this too!

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
ysysimon
CV
Hi, I would love to know more about this too!

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.
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)
ysysimon
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.
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.
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
ysysimon
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.
cushwa
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.
colorbleed
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.)
LIL01
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.
EJaworenko
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.
from pxr import UsdGeom
node = hou.pwd()
# Get the stage of the input node to avoid recursion
stage = node.input(0).stage()
if stage is not None:
        # Other nodes might need "primpath", but you could functionally add any prim path you want here
        focusprim = stage.GetPrimAtPath(node.evalParm("primpattern"))
        if focusprim is not None:
                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])
                return bounds[0]
Hamilton Meathouse
In a pinch you can hit the 'insert' key on your keyboard and move the pivot manually. It's not procedural, I know but may help someone.
wanglifu
we should have the quick option just like the sop transform.
mzigaib
Did anyone found a quick way to have that? Maybe Solaris could provide this information to be accessed easily from inside LOPs?
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Powered by DjangoBB