Filter 'SelectionChanged' callback?

Filter 'SelectionChanged' callback?

icapathos
Advocate Advocate
2,367 Views
2 Replies
Message 1 of 3

Filter 'SelectionChanged' callback?

icapathos
Advocate
Advocate

If something is selected in maya, I can catch that event using "SelectionChanged" in scriptJob command or MEventMessage. right?

But I hope to filter it if object is selected or not. I mean that when I select a vertex of polygon or a key in Graph Editor, I don't want to catch a callback or execute a function that is linked to callback at least.

How can I archieve it?

0 Likes
2,368 Views
2 Replies
Replies (2)
Message 2 of 3

Anonymous
Not applicable

Probably in your callback you can get current slection list using MGlobal::getActiveSelectionList(selection) and then you can specify filter in iterator by API type like MItSelectionList iterator( iterator , MFn::kMeshComponent);

 

or you can check the API type for each selected component after you pull it from the iterator

MDagPath path;
MObject component;

iterator.getDagPath( paht, component );

if(component.apiType() == MFn:kWhatEverYouNeed)
{
// handle it here
}

0 Likes
Message 3 of 3

icapathos
Advocate
Advocate

Actually, I meant that I want to get ONLY selection changed on objects.

 

For instance,

When I select a polygon cube -> Get selection chagned callback

Then I select a vertex in cube -> Don't get selection changed callback.

 

If I use scriptJob, I can't determine the selected source.

0 Likes