Le mardi 9 août 2016 22:18:00 UTC+1, risto....@framestore.com a écrit : > On Tuesday, 9 August 2016 13:00:44 UTC+1, fruity wrote: > > Hi there, > > > > I'm prototyping a new deformer in python, and i'm stuck with a super stupid > > problem. So essentially, i need to get the dagPath of an object, and to do > > that, i have only an outMesh plug connected to my deformer. I have > > something that looks like that : > > > > > > > > # this is what i get from my deformer > > oSrcMesh = dataBlock.inputValue(A.aSrcMesh).asMesh() > > # get the dagPath - test 1 > > xxx = OpenMaya.MDagPath() > > OpenMaya.MDagPath.getAPathTo(oSrcMesh, xxx) > > # get the dagPath - test 2 > > fnDag = OpenMaya.MFnDagNode(oSrcMesh) > > > > > > > > I won't go through everything i tried, but you get the idea ! I found NO > > way to get the dagPath of my mesh, starting from this oSrcMesh which is of > > type kMesh. > > I think that my oSrcMesh is not aware of its hierarchy. > > > > So what is the clean way of getting a MDagPath out of this oSrcMesh ? > > > > This stupid pure maya api problem took me more time than everything else in > > this deformer, which is kind of a shame, so any help would be more than > > appreciated ! > > Many thanks =] > > > Hi there. > > You almost got it right :-) > > First create a MfnDagNode from the mesh's MObject. > > Something like: > > MFnDagnode from om.Mobject ( oSrcMesh.node() ) > > Then you can pull MDagPath from MFnDagNode.getPath() > > Hope this helps :-) > > /risto
hehe, unfortunately that doesn't work ^^ This is what i tried, but the MObject is of type kMeshData, and not of type kMesh. Hence i can't initialize a MDagPath, that returns me an error saying that my MObject is of an incompatible type. -- 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/136e509c-f976-4584-bff6-7524ec52fa30%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.