W dniu 2015-03-02 o 13:18, Miguel González Viñé pisze:
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?


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());

    ...

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

Reply via email to