error getting the inputMesh from datablock

24 views
Skip to first unread message

Rishis3D

unread,
Feb 12, 2014, 11:23:38 AM2/12/14
to python_in...@googlegroups.com
Hi,

I am new to maya API , im trying to create a simple DGNode in C++ .. but i am not able to get the inputMesh from datablock

here is my code.. it compiled and loaded in maya succesfully .. after connecting  pSphereShape1.worldMesh to myNode.inMesh[0] attr to myNode.inMesh[0]...
i am getting feeback form first 3 print command .my im trying to debug it using MGlobal::executeCommand command.to print stuffs from maya. in my  code third if condition fails.. ofcourse my 1st and 2nd if condition is ture
im using VS2010 ultimate, cMake 2.8.10 and maya 2013

here is mycode

MStatus myNode::compute(const MPlug& plug, MDataBlock& data)
{
    MStatus status;

    if ((plug.parent() == aArray) || (plug == aArray))

    {
        MGlobal::executeCommand( "print \"\\nConnected to plug.\"" );

        MObject thisNode = this->thisMObject();

        //getting InMesh
        MDataHandle inMeshHld = data.inputValue(aInMesh, &status);
        CHECK_MSTATUS_AND_RETURN_IT(status);
        MObject inMesh = inMeshHld.asMesh();
        
        // condition 1
        if (inMeshHld.type() != MFnData::kMesh) 
        {   
            MGlobal::executeCommand( "print \"\\nBad Geomentry type.\""  );
        }

        // condition 2
        if ( inMesh.isNull() )
        {
            MGlobal::executeCommand( "print \"\\ninMesh is null.\"" );
        }

        // condition 3
        if ((inMesh != MObject::kNullObj))
        {
            MGlobal::executeCommand( "print \"\\got inMeshGeo.\"" );
        }
    }
        else
        return MS::kUnknownParameter;
    
    data.setClean( plug );
    return MS::kSuccess;
}


what did i miss in this code..? can anyone help me to fix this code
Reply all
Reply to author
Forward
0 new messages