On 02/06/2016 at 15:07, xxxxxxxx wrote:
User Information:
Cinema 4D Version: 13.061
Platform: Windows ;
Language(s) : C++ ;
---------
Hello!
I am working in a plugin where I need to know the order of selected elements. Now clicking with cmd, I am able to track order of selected elements. The problem is that if instead of Ctrl I use shift it selects always from element nearest to root despite I select first the item nearest to the bottom of my list.
What approach do you think should be better to track selected elements in order?
Now after press shift an select other element it enters to SELECTION_NEW again with nearest element to root and then it uses SELECTION_ADD. Then i get inverted order that I am aiming to get when shift comes from bottom to top.
Thanks.
Code used (something like) :
AtomArray *pAASelectMat;
void TreeF::Select(void * root, void * userdata, void * obj, LONG mode)
{
if (!GetActiveDocument())
return;
BaseMaterial *bmat = __GETBASEMATERIAL__(obj);
switch (mode)
{
case SELECTION_NEW:
AAmaterial->Flush(); // clear the atomarray
AAmaterial->Append( bmat );
break;
case SELECTION_ADD:
if(AAmaterial->Find(bmat) == NOTOK)
AAmaterial->Append( bmat );
break;
case SELECTION_SUB:
AAmaterial->Remove( bmat );
break;
}
}