copy a mesh with transforms baked in

47 views
Skip to first unread message

justin hidair

unread,
Apr 4, 2017, 3:27:02 AM4/4/17
to Python Programming for Autodesk Maya
    writing a node here *see joint file*

def compute(self,plug,datablock):
        pass
        if(plug != myclass.outputmesh):
            pass
            return om.kUnknownParameter
        pass
        inputmesh=datablock.inputValue(myclass.inmesh)
        outmeshdata=datablock.outputValue(myclass.outputmesh)
        outmeshdata.copy(inputmesh)

datablock.setClean(plug)

This will copy the mesh BUT will put it at origin right after!
it doesn't even care about the transforms !!! (on the image , rotations...)

What I want : I don't want to link the transforms, I want them to be baked in the output(copied mesh) (so technically it's like the transforms have been frozen on the copied mesh)


whatswrong.PNG

Leonardo Bruni

unread,
Apr 4, 2017, 6:18:45 AM4/4/17
to python_in...@googlegroups.com
I had the same issues years ago, and if i remember correctly, the reason of that it's because you using outputMesh, and not worldMesh,


--
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+unsub...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/33c1e50d-cfca-4c27-8c09-5fe0d9b3fbe0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

justin hidair

unread,
Apr 4, 2017, 2:12:25 PM4/4/17
to Python Programming for Autodesk Maya
It didn't change anything apparently, I'm suppose to play with matrices right ? ?

Rémi Deletrain

unread,
Apr 5, 2017, 6:32:29 AM4/5/17
to Python Programming for Autodesk Maya
If I am not mistaken the copy of the MFnMesh only copies in ObjectSpace.
It is therefore necessary either to move the transform or to multiply all the points by the WorldMatrix of your transform

justin hidair

unread,
Apr 5, 2017, 8:02:40 PM4/5/17
to Python Programming for Autodesk Maya
Hi all I fixed it, thanks to you , the solution : instead of using outmesh, I use worldMesh , then I use MFnMesh.copy() with the inputmesh : MFnMesh(inputmesh.asMeshTransformed(), om.MFnMeshData().create()) ..
Reply all
Reply to author
Forward
0 new messages