JoshM
04-02-2009, 10:52 PM
Hi Guys,
I'm writing a deformer using the Maya C++ API and everything for the deformer is essentially working. For this deformer I have my own custom locator node (derived from MPxLocatorNode) to display falloff for the deformer. The problem that I am having is in the accessoryNodeSetup(MDagModifier &dagMod) function of the MPxDeformer class. I create my custom locator using the dagMod.createNode() within the node setup function and the node is created properly. I know that when creating an object such as a locator that Maya will automatically create a parent transform for the locator and return the MObject from the createNode function. However, for the life of me I can't get the locator shape beneath this transform so I can access the attributes that I created for the locator. Here's a code snippet:
MStatus myDeformNode::accessoryNodeSetup(MDagModifier &dagMod){
MStatus stat;
//create the locator for the deformer
MObject locatorObj = dagMod.createNode("myDeformNodeHandle", MObject::kNullObject, &stat);
if(!stat) return stat;
MFnDagNode locatorFn(locatorObj);
//find the matrix of the transform
MObject attrMat = locatorFn.attribute("matrix");
//connect the matrix to the deformerMatrix attribute
stat = dagMod.connect(locatorObj, attrMat, thisMObject(), deformerTransformation);
if(!stat) return stat;
//no matter what I do after this point I can't access the locator shape node
//even using the function locatorFn.name() returns an empty string
//yet some how it is able to access the 'matrix' attribute of the transform properly???
return MS::kSuccess;
}
So I'm just curious on how I should go about retrieving the locator shapes MFnDagNode.
Thanks in advance,
Josh
I'm writing a deformer using the Maya C++ API and everything for the deformer is essentially working. For this deformer I have my own custom locator node (derived from MPxLocatorNode) to display falloff for the deformer. The problem that I am having is in the accessoryNodeSetup(MDagModifier &dagMod) function of the MPxDeformer class. I create my custom locator using the dagMod.createNode() within the node setup function and the node is created properly. I know that when creating an object such as a locator that Maya will automatically create a parent transform for the locator and return the MObject from the createNode function. However, for the life of me I can't get the locator shape beneath this transform so I can access the attributes that I created for the locator. Here's a code snippet:
MStatus myDeformNode::accessoryNodeSetup(MDagModifier &dagMod){
MStatus stat;
//create the locator for the deformer
MObject locatorObj = dagMod.createNode("myDeformNodeHandle", MObject::kNullObject, &stat);
if(!stat) return stat;
MFnDagNode locatorFn(locatorObj);
//find the matrix of the transform
MObject attrMat = locatorFn.attribute("matrix");
//connect the matrix to the deformerMatrix attribute
stat = dagMod.connect(locatorObj, attrMat, thisMObject(), deformerTransformation);
if(!stat) return stat;
//no matter what I do after this point I can't access the locator shape node
//even using the function locatorFn.name() returns an empty string
//yet some how it is able to access the 'matrix' attribute of the transform properly???
return MS::kSuccess;
}
So I'm just curious on how I should go about retrieving the locator shapes MFnDagNode.
Thanks in advance,
Josh
