hello, not sure my approach is the right one, but I usually try to avoid working with full dag paths in a deformer, as I prefer to keep every node independent from the others (beside inputs connections ofc). If you want to get the dag path, you can use the static method MDagPath::getAPathTo(). But instead of doing that, couldn't you use the localToWorldMatrix provided to you by Maya in the deform() method? It will require a little bit more math, but give a more robust result to get your world position
Le lundi 14 septembre 2020 à 08:49:52 UTC-4, [email protected] a écrit : > Hi, i'm trying to write a collision deformer and when i try to ray cast > with MFnMesh.closestIntersection() i'm getting the error below because i > need the points in worldSpace: > > "Must have a DAG path to do world space transforms #" > inputGet = ommpx.cvar.MPxGeometryFilter_input > inputHandle = dataBlock.outputArrayValue(inputGet) > inputHandle.jumpToElement(geoIndex) > inputElement = inputHandle.outputValue() > inputGeomGet = ommpx.cvar.MPxGeometryFilter_inputGeom > inputGeom = inputElement.child(inputGeomGet).asMesh() > defMeshFN = om.MFnMesh(inputGeom) > > I'm not getting any error with this, i can attach a function set to > inputGeom but i can't use the dagPath or getPath methods. Those methods > giving me the "Object does not exist" or 'not being compatible' error. > > I can get the collider dagPath using MPlug because it's a custom attribute > on the node. I tried the same with outputGeom plug and some GeometryFilter > methods but they result in cycle. It's frustrating, any help is highly > appreciated! > -- 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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/3dac597a-8a7f-49a5-badd-a5663e466865n%40googlegroups.com.
