APEX extract a static xform from a generated live xform ?

   673   6   2
User Avatar
Member
15 posts
Joined: Aug. 2022
Offline
Hello,

Is there a way to extract a static xform from creation time out of a live xform in the APEX graph? Or can it only be done via APEX script graph or APEX script to drop the pre-populated static xform in the APEX graph?

Maybe do it 2 edit graphs? the first one would be evaluated in the 2nd one in which case I could read the values of my xform and manually transfer them onto another one?

Cheers,
Edited by Goffer - Nov. 1, 2024 19:05:37
User Avatar
Member
76 posts
Joined: Oct. 2018
Online
Interesting question - what are you trying to do with the extracted xform? Typically you'd do this by grabbing the restlocal of a transform object, and not the xform - this gives you it's initial "static" position.
User Avatar
Member
15 posts
Joined: Aug. 2022
Offline
Yeah ideally I need the restlocal.

But in the case of the rig::primConstraint, all I get is the resulting xform.
So you're saying I could create an extra transform and connect it to my primConstraint xform, this would capture the initial static position at connection time?
EDIT:
Creating and connecting a new xform didn't capture the restlocal unfortunately


The idea here is to be able to attach an existing transform (ctrl) to a new transform (primConstraint) with different position and orientation while maintaining the offset.
I'm trying to do this with matrix operations (and I need to calculate my initial offset from static xforms) as I haven't found a node that allowed me to do this simply.
The localTransformConstraint looked like the solution but I didn't get it to behave and the doc doesn't seem available for this node.
Edited by Goffer - Nov. 4, 2024 19:06:58
User Avatar
Staff
66 posts
Joined: Oct. 2023
Offline
Hi.

Here is an example of how to parent and constrain controls, either using the nodes directly or using the guides.

Attachments:
parent_and_constrain_controls.hip (504.1 KB)

User Avatar
Member
15 posts
Joined: Aug. 2022
Offline
Thx for the example file William!

I was somewhat on the right track conceptually but not at all in terms of execution. My idea was to invoke the graph to evaluate my xform via the SOPInvokeGraph node instead of a graph::Compile

I've had a go at implementing something based on your example but the xform post compile seems incorrect and I also have this error:

I have removed the offset calculation just so I can debug my 2 xforms. All nodes are present but for some reason it doesn't seem to take into account the compiled static xform

Am I missing something?

Image Not Found
Edited by Goffer - Nov. 5, 2024 20:17:45

Attachments:
error.png (21.7 KB)
compiled_xform.hip (442.5 KB)
offset.png (51.2 KB)

User Avatar
Staff
82 posts
Joined: May 2021
Offline
ah we actually have an example of exactly that setup in the addGroom autorig component.

Theoretically the most generic answer would be an invokation of the graph itself. But in most cases you can avoid that. It can also have a performance impact if you constantly need to run you whole rig just to get an xform value out. Luckily we usually all the data needed to get that rest info directly at your disposal when you build your component.

And in your cases its very convenient you can simply use a prim constraint IN you component script on your rest shape to quickly generate the rest for you. Its a very easy trick to get rests for those kinds of setups.
I added a small snippet to your example where exactly that is happening. And i marked the important section. The rest is nothing but a small apex script version of what you where doing in the graphs


In the picture you can also see the important bits as nodes: You get your rest shape. You generate a prim constraint in the component script and then you multiply the inverted primconstraint_xform with the the xform from your guide.

Attachments:
compiled_xform_restFix.hip (500.3 KB)
constraintInComponent.PNG (34.9 KB)

User Avatar
Member
15 posts
Joined: Aug. 2022
Offline
Thx for the update!

I think I get it now, I thought about doing this way but my worry was to have a duplicated setup simply to get static values but it's not actually duplicated since one is in the APEX script so it's not actually creating the final rig nodes, it's just doing a static set of operations during the 'component build'.

Because I currently do it via nodes, I keep on forgetting that it is still nodes scripting and not actually the final graph.
  • Quick Links