Maya - Local rP and sP offsets and the world matrix

I am making an addition to a pose tool that allows for saving/reloading of ‘global’ poses. I was doing this by dumping the ws matrix for each control. However, the ws matrix seems invalid when querying an item with these offsets.

Or rather, a constraint factors in the local pivot offsets, if you use a constraint to snap an object to another with these offsets, it works, but if you use xform and ask for the final ws matrix, it does not give you a matrix that expresses the pivot location (which is what constraints and everything else seems to use)

Sorry if this is confusing, should I just apply the offsets to the ws matrix I am storing?

Or can I query a ws matrix for the final pivot location with the xform command? The -rp command seems to just return the point in space of the pivot.

If you want to match the parent constraint’s behaviour then yes just query the rotate pivot and use that to replace the translation in the transform matrix that xform gives you.
So:


piv = cmds.xform(q=True, ws=True, rp=True)
tm = cmds.xform(q=True, ws=True, matrix=True)
tm[12], tm[13], tm[14] = piv

I tried this, but sometimes there is a translation and a pivot offset, you don’t want to just overwrite. Second is the local scale stuff.

In the end, I just make a spaceLocator snap it to the pivot, record it’s ws mx and delete it :tear: