I was doing a dummy command for debugging and testing certain funcs , and what I usually do is use
now it became redundant af , so I came up with a way to get the actual selected mesh and shiet :
MObjectArray mesh_list;
MSelectionList sel;
MGlobal::getActiveSelectionList(sel);
if( sel.length() == 0)
{
MGlobal::displayError("no selection");
return MS::kFailure;
}
MItSelectionList mitsel(sel);
MObject cur_obj;
do
{
mitsel.getDependNode(cur_obj);
if (cur_obj.hasFn(MFn::kMesh) )
mesh_list.append( cur_obj );
else if ( cur_obj.hasFn(MFn::kTransform) )
{
MFnTransform fntransform( cur_obj );
for (int i=0 ;i < fntransform.childCount() ;++i )
{
if (fntransform.child(i).hasFn(MFn::kMesh))
mesh_list.append(fntransform.child(i));
}
}
mitsel.next();
}while(!mitsel.isDone());