Hi Cyril_Romain, and others who are interested,
I have similar problem and tried the method you mentioned but when I try
to create a function set FnDependency on the kMeshData MObject, the constructor of the function
set fails saying that the object is incompatiable...
I'm crazy now, like the original poster of this problem...
There must be some "magic" behind the function set
APIs...
Thank you for your advice in advance,
Swimwdolphin.
p.s. Please see the code below for details.
initialize()
{
aInMesh = fnTyped.create( "inMesh", "inm", MFnMeshData::kMesh );
addAttribute( aInMesh );
}
compute()
{
//...
// inMesh
MDataHandle hMesh = block.inputValue( aInMesh );
//
MObject moMesh = hMesh.asMesh();
m\_pFnMesh = new MyMayaFnMesh( moMesh, &status );
if ( !moMesh.hasFn(MFn::kMesh) ) //ok
::MayaPrint(">>> hasFn(MFn::kMesh) fails at .n");
if ( !moMesh.hasFn(MFn::kMeshData) ) //ok
::MayaPrint(">>> hasFn(MFn::kMeshData) fails at .n");
MFnMesh* fnMesh = new MFnMesh(moMesh, &status);
if ( status != MS::kSuccess ) //ok
{
::MayaPrint(">>> FnMesh::FnMesh(aInMesh) fails: %s n", status.errorString().asChar() ) ;
}
delete fnMesh;
MFnDependencyNode * fnMesh2 = new MFnDependencyNode (moMesh, &status);
if ( status != MS::kSuccess ) //**ERROR**
{
::MayaPrint(">>> FnD::FnDaInMesh) fails: %s n", status.errorString().asChar() ) ;
}
//
MPlug plug = fnNode.findPlug( "inMesh", &status );
// ...
delete fnMesh2;
}