Thanks for this! It’s the other way around, pCube3 goes into pCube2, but it
still works.

Looking closlier, I found that it does something sneaky. It *changes* the
rotate pivot on the destination. Or rather, the rotatePivotTranslate. So
rather than just affecting translate and rotate - which is what I want - it
most likely takes that worldmatrix and decomposes it into its components,
including pivots, and overwrites everything on the destination node. That’s
cool, but that’s cheating. :)

The only thing I want out of the worldmatrix is a rotate/translate for the
destination. That translates and orients the destination to match the
source.

And yes, sadly this needs to happen without cmds.xform, as it’s happening
inside the MPxNode::compute of a C++ plugin.

(Code formatting with “Markdown Here”, sent from my mailbox)

On Wed, 9 Sep 2020 at 11:08, Roy Nieterau <royniete...@gmail.com> wrote:

> Without taking the math in account for now. Are you required to do this
> with the API? :)
>
> Because maya.cmds.xform does take into account pivots, etc. For example
> this works for your setup:
>
> m = cmds.xform("pCube2", query=True, matrix=True,  worldSpace=True)
> cmds.xform("pCube3", matrix=m, worldSpace=True)
>
> (What's with the new Google Groups look/layout? How can I get the code
> formatting in here?)
>
> Regarding the actual matrix math. Do note that the xform command
> documentation
> <https://help.autodesk.com/cloudhelp/2020/ENU/Maya-Tech-Docs/CommandsPython/xform.html>at
> the top states the order of transformation that Maya applies. It's quite
> involved but could help you reproduce it exactly.
>
>> --
> You received this message because you are subscribed to the Google Groups
> "Python Programming for Autodesk Maya" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to python_inside_maya+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/python_inside_maya/d50a8632-3c7c-4ed4-ae88-2cf10dec034bn%40googlegroups.com
> <https://groups.google.com/d/msgid/python_inside_maya/d50a8632-3c7c-4ed4-ae88-2cf10dec034bn%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to python_inside_maya+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/CAFRtmOA579dO%3Dy%2B4dbyc%2BfY5mkAX5krgG9hbdt%3DfppiUzHuVeg%40mail.gmail.com.

Reply via email to