Drag-n-drop



  • Hi,

    I am trying out some things related to drag and drop (in a GeUserArea for testing purposes), using the asynctest.cpp sample SDK code.

    if (type == DRAGTYPE_ATOMARRAY && ((AtomArray*)object)->GetCount() == 1 && ((AtomArray*)object)->GetIndex(0))
    {
    	bl = (C4DAtomGoal*)((AtomArray*)object)->GetIndex(0);
    	if (bl)
    	{
    		if (bl->IsInstanceOf(Tbaselist2d))
    			string = prefix + str + " " + ((BaseList2D*)bl)->GetName() + " (" + String::IntToString(bl->GetType()) + ")";
    

    Say, I select the Live Selection tool and drag-n-drop its icon from the Attribute Manager into the userarea, I (obviously) get "Live Selection" returned from GetName(), but also get value 9 returned from GetType(). When I do the same with the move tool i.e. I still get a 9 returned from the type. I have tried to find my way through the documentation, but wasn't able to locate anything related to a "type 9". I know of type Obase, Tbase, Mbase, even Tbaselist2d ... but haven't got a clue what type 9 represents.
    When I perform a GetClassification() I get value 0 returned, which isn't really helpful.
    So, what is this mysterious "Number nine" ?


  • Global Moderator

    Hello,

    it looks like the "object" that is dragged is the BasePlugin representing the tool plugin. GetType() returns the plugin type which is PLUGINTYPE::TOOL (9).

    You should be able to get the actual tool ID from the BasePlugin object:

    const PLUGINTYPE type = (PLUGINTYPE)baselistObject->GetType();
    
    if (type == PLUGINTYPE::TOOL)
    {
      BasePlugin* const plug = (BasePlugin*)(baselistObject);
      const int toolID = plug->GetID();
      ApplicationOutput("Tool ID: " + String::IntToString(toolID));
    }
    

    best wishes,
    Sebastian



  • @s_bach
    Yes the BasePlugin I already obtained and got its ID, as well as its name. Was just wondering what the 9 represented, in order to use the appropriate defined keyword instead of the value. Thanks for the "PLUGINTYPE::TOOL"