Get original mesh before any deformer

379 views
Skip to first unread message

Miguel González Viñé

unread,
Mar 2, 2015, 7:18:32 AM3/2/15
to python_inside_.
Hi all,

I'm doing a c++ deformer node and a MPxCommand to create some info inside the deformer.

I'm trying to get the MFnMesh of the object before any deformations through a MPlug because as I'm in the MPxCommand class I don't know how to get the datablock.

The problem is that when I get the connected node to my deformer.input[0].inputGeometry, I get a node of type "groupParts" and inside this "groupParts" node I see an attribute called "input geometry" with a tweak node connected to.

So, what's the best way to get the orig geometry outside the MPxDeformerNode class?

Thank you.
Cheers,
Miguel.

f.michal

unread,
Mar 2, 2015, 7:44:38 AM3/2/15
to python_in...@googlegroups.com
W dniu 2015-03-02 o 13:18, Miguel González Viñé pisze:
What you wan't to do breaks basics of maya API fundamentals, namely:
node is defined only by it's attributes and it's illegal to try to get
data outside of node (or said differently: compute() methed should
operate based on node plugs ONLY).
That being said ... we often have to workaround different things :)
ie I'd like to get transfrom node from withing deform() method if anyone
has idea...

Here's how I get OUTPUT mesh from a deformer, you should be able to
adapt it to your needs.
Remember, this is forbidden in maya API ;)

MStatus xxx::deform( MDataBlock& block, MItGeometry &iter, const MMatrix
&localToWorld, unsigned int geomIndex)
{
MObject thisNode(thisMObject());
MFnDependencyNode this_dn(thisNode);
// -- OUTPUT GEOM
MPlug outputPlug(thisNode, outputGeom);
outputPlug.selectAncestorLogicalIndex(geomIndex);
MPlugArray outputs_plugArr;
outputPlug.connectedTo(outputs_plugArr, false, true);
if(!outputs_plugArr.length()) {
return MS::kSuccess;
}
outputPlug = outputs_plugArr[0];
MFnDependencyNode mesh_dn(outputPlug.node());

...

Miguel González Viñé

unread,
Mar 2, 2015, 11:25:02 AM3/2/15
to python_inside_.
Hi,
thanks for the reply.

After more testing, it was working the way I did, but my debug messages with MGlobal::displayInfo didn't display anything...

I'm testing with the bulgeMesh deformer of Chad Vernon from CGCircuit, and if I try to display the name of the inputGeom like this:
MGlobal::displayInfo(fnMesh.name());

it doesn't display anything. I've tried with different attributes without luck. Then I tried with the normal values that Chad use in his plugin. Now I see the values with displayInfo.

And after try the same thing in my MPxCommand, I see the normals values too.

Anyone knows why I can't display the fnMesh name taken from a MDataHandle?

Thanks.



--
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/54F45B23.4010702%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages