On 20/02/2013 at 05:48, xxxxxxxx wrote:
Originally posted by xxxxxxxx
oh target is the destination object
I need more control about a tag plugin, on which object I can assign it or move it by drag and drop from one object (e.g. sphere) to another object (e.g. cube). I like to forbit it to move my tag plugin to this object type. How can I do this ?
Thanks for the explanation, I understand it better now ;).
To get the object or tag you're on you can get the BaseList2D you're hovering while mouse dragging with this code:
DragAndDrop *dd = (DragAndDrop* )data;
BaseList2D *bl = NULL;
if (dd->flags & DRAGANDDROP_FLAG_SOURCE && dd->data!=NULL)
C4DAtom *atom = (C4DAtom* )dd->data;
if (atom != NULL)
bl = (BaseList2D * )atom;
This code will print to the console the name of the tag or object you're over with the mouse.
If you're hovering an object (IsInstanceOf()) you can simply convert it to a BaseObject*. And if it's a tag, convert it to a BaseTag then get the object it's attached to with BaseTag::GetObject().