Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Unread
    • Recent
    • Tags
    • Users
    • Login

    Drag-n-drop

    Cinema 4D SDK
    r19 c++
    2
    3
    752
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • C4DSC
      C4DS
      last edited by

      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" ?

      1 Reply Last reply Reply Quote 0
      • S
        s_bach
        last edited by

        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

        MAXON SDK Specialist

        Development Blog, MAXON Registered Developer

        C4DSC 1 Reply Last reply Reply Quote 1
        • C4DSC
          C4DS @s_bach
          last edited by

          @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"

          1 Reply Last reply Reply Quote 0
          • First post
            Last post