Announcements

Between mid-October and November, the content on AREA will be relocated to the Autodesk Community M&E Hub and the Autodesk Community Gallery. Learn more HERE.

MFnMesh error creating UVSet

MFnMesh error creating UVSet

Anonymous
Not applicable
515 Views
2 Replies
Message 1 of 3

MFnMesh error creating UVSet

Anonymous
Not applicable

So I have used MFnMesh class to create a mesh, -- but I am having difficulties setting UVs.

 

First -- when creating a mesh -- I have realized that the current UV set name is empty.

 

MObject meshMObj = fnMeshCreator.create(uniquePositionsList->Count, mesh->Triangles->Count, mPointArray, polygonCounts, polygonConnects, meshTransformObj);

MFnMesh fnMesh(meshMObj);

MString setName
fnMesh.getCurrentUVSetName(setName);

//This always is empty
cerr << setName << endl;

I have tried doing the following: 

 

MObject meshMObj = fnMeshCreator.create(uniquePositionsList->Count, mesh->Triangles->Count, mPointArray, polygonCounts, polygonConnects, meshTransformObj);

MFnMesh fnMesh(meshMObj);

MString setName = "UVSet";

fnMesh.createUVSet(setName);
fnMesh.setCurrentUVSetName(setName);

fnMesh.getCurrentUVSetName(setName);

//The following still returns an empty string
cerr << "Current setName: " << setName << endl;

Looking at the Maya Documents  "If there is no current uv set, then a empty string will be returned on the string argument passed on."

 

So I am thoroughly confused

 

0 Likes
516 Views
2 Replies
Replies (2)
Message 2 of 3

Anonymous
Not applicable

Hi,

 

Please check if create() maybe already failed, because your input values contain errors?

My tip is to always check the status for each function, then you maybe see it failed already earlier than you expected.

0 Likes
Message 3 of 3

Anonymous
Not applicable

I just checked it -- create function did not have any errors.

 

 

MObject meshMObj = fnMeshCreator.create(uniquePositionsList->Count, mesh->Triangles->Count, mPointArray, polygonCounts, polygonConnects, meshTransformObj, &status);

if (status == MStatus::kFailure)
{
   cerr << "Never reached" << endl;
}

MFnMesh fnMesh(meshMObj);
MString setName = "UVSet";
fnMesh.createUVSet(setName);
fnMesh.setCurrentUVSetName(setName);
fnMesh.getCurrentUVSetName(setName);
cerr << "Current setName: " << setName << endl;

 

0 Likes