PDA

View Full Version : MItSelectionList component apiType is always kInvalid


nuttynut
08-19-2010, 07:25 PM
So i'm getting the current selection and querying the apiType of the component:

// Get current selection
MSelectionList currentSelection;
MGlobal::getActiveSelectionList(currentSelection);

// Make a selectionList iterator from the current selection and filter out only the kMeshes
MItSelectionList objSelectionItr(currentSelection);

// Iterate over selection until the iterator is done
while(!objSelectionItr.isDone())
{
// Get the actual object we're dealing with (we cant do much with the iterator itself)
MDagPath dagPath;
MObject component;
objSelectionItr.getDagPath(dagPath, component);

MFn::Type apiType = component.apiType(); // ALWAYS kInvalid!

// Don't forget to go to next object
objSelectionItr.next();
}
}

But the problem is that the apiType is always kInvalid while i'm expecting them to be meshpolygons, vertices, edges, ...

Can anyone test this out?

Thanks!

safakoner
08-19-2010, 11:03 PM
I did not try the code you have written however following one works perfectly for me, not querying the compnent type though, just doing things if it is kMeshVertComponent


if(oComponent.apiType() == MFn::kMeshVertComponent)

nuttynut
08-23-2010, 12:08 PM
ehm yeah nevermind. I was selecting objects but expecting components to be selected. Only if I select verts or edges is the apiType correct.

Thanks anyway.

CGTalk Moderation
08-23-2010, 12:08 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.