|
I’m having some problems with MFileIO::getReferenceFileByNode(MObject& referenceNode, MStatus *returnStatus) whereby passed parameter ‘returnStatus’ is being set to MStatus::kInvalidParameter.
I presume this is supposed to happen when ‘referenceNode’ is not actually from a referenced file however I’m calling MFnDependencyNode::isFromReferencedFile() on the same node and it is returning true.
Here is an excerpt:
MDagPath dagPath;
if (itDag.getPath(dagPath) != MStatus::kSuccess)
return (false);
MFnMesh mesh(dagPath, &status);
if (status != MStatus::kSuccess)
return (false);
if (mesh.isFromReferencedFile(&status) && status == MStatus::kSuccess) {
MObject node = mesh.object(&status);
if (status != MStatus::kSuccess)
return (false);
MString filename = MFileIO::getReferenceFileByNode(node, &status);
if (status != MStatus::kSuccess)
return (false); // <--- Reaching here. }
I tried the following just for testing purposes and it worked as expected. i.e. The filename expected above was found.
MStringArray referencedFilenames; MFileIO::getReferences(referencedFilenames);
for (int i = 0; i < referencedFilenames.length(); i++) {
const char *referencedFilename = referencedFilenames[i].asChar(); }
Is there some circumstance whereby mesh.isFromReferencedFile() would return true and MFileIO::getReferenceFileByNode() not work. Do I have to do something first to make MFileIO::getReferenceFileByNode() work?
Any help would be very much appreciated.
Thanks
|