Feedback

What's your question?

By: [ Editor ] Asked from United States of America

How to get inputGeom from MPxDeformerNode?

There's an example in the yTwistNode.py of how to get "outputGeom". But when I try the same thing to get "inputGeom", it doesn't work. The "outputGeom" is in the initializer while I'm trying to get the "inputGeom" in the definition.

Thanks

Add comment viewed 128 times Latest activity 11 months ago

or Cancel

1 answer

  • 1

michalf [ Editor ]

Hi, this is ripped off straight from one of my plugins, so I'm not 100% sure it is correct (I always copy-paste this kind of stuff between different plugins, this is too hard to remember:) ). One thing to note is that was inside compute() method instead deform() method.

MStatus stat;

MObject thisNode(this->thisMObject());

unsigned int index = plug.logicalIndex(); //this is needed when inside compute() method instead deform() method

MPlug inPlug(thisNode,input);

inPlug.selectAncestorLogicalIndex(index,input);

MDataHandle hInput = block.inputValue(inPlug, &stat);

MDataHandle inputData = hInput.child(inputGeom);

if (inputData.type() != MFnData::kMesh) {

cout<<"Incorrect input geometry type\n";

return MStatus::kFailure;

}

MFnMesh mesh_fn(inputData.asMesh());

NN comments
manny
-

That’s what I’m disliking so far with a deformer. You either use deform() with it’s limitations. Or use compute() with it’s limitations. Why isn’t all the data available at any time? Maybe it is and I just haven’t learned how to get to it. But why must learning this stuff be so hard? Mel was so easy. Anyways, maybe I should just give up on the deform method and try it with the compute method. Thanks.

manny
-

Actually, I’d still like to know if it’s possible in the example I gave originally. Using the yTwistNode as a starting base, can anyone tell me how to get the inputGeom so I can convert it into a MFnMesh?

or Cancel