APEX extract a static xform from a generated live xform ?
681 6 2- Goffer
- Member
- 15 posts
- Joined: 8月 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,
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 - 2024年11月1日 19:05:37
- Max Rose
- Member
- 76 posts
- Joined: 10月 2018
- Offline
- Goffer
- Member
- 15 posts
- Joined: 8月 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.
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 - 2024年11月4日 19:06:58
- william_harley
- スタッフ
- 66 posts
- Joined: 10月 2023
- Offline
- Goffer
- Member
- 15 posts
- Joined: 8月 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?
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 - 2024年11月5日 20:17:45
- esttri
- スタッフ
- 82 posts
- Joined: 5月 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.
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.
- Goffer
- Member
- 15 posts
- Joined: 8月 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.
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