Lost Adventurer, Aleks Kirilenko (3D)
LC #42 Pipers Alley

View Full Version : MItSelectionList component apiType is always kInvalid

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

// Get current selection
MSelectionList 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
// 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

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?


08-19-2010, 10: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)

08-23-2010, 11:08 AM
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, 11:08 AM
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.