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

    DRAGANDDROP_FLAG_FORBID

    Cinema 4D SDK
    c++ r21
    2
    2
    405
    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.
    • A
      AiMiDi
      last edited by AiMiDi

      I want to create a MyRoot object under an object that is not allowed to be dragged by the user (like the Root under the CA object), I set DRAGANDDROP_FLAG_FORBID to the flag in the DragAndDrop struct of MSG_DRAGANDDROP, but I can still drag it out of the parent.
      QQ录屏20210723224856_1.gif

      This is the code in Message().

      Bool MyRoot::Message(GeListNode* node, Int32 type, void* data) {
      	if (type == MSG_DRAGANDDROP)
      	{
      		DragAndDrop* dnd = static_cast<DragAndDrop*>(data);
      		if (dnd == nullptr)
      			return false;
      		if (dnd->flags & DRAGANDDROP_FLAG_SOURCE)
      			dnd->flags |= DRAGANDDROP_FLAG_FORBID;
      	}
      	return true;
      }
      
      1 Reply Last reply Reply Quote 0
      • M
        m_adam
        last edited by

        Hi @AiMiDi, MSG_DRAGANDROP will be received when the host receive a drag, I didn't tried but I guess only dialog can react to this message. In you case you will need to set the NBIT NBIT_NO_DD like so op.ChangeNBit(c4d.NBIT_NO_DD, c4d.NBITCONTROL_SET).

        Cheers,
        Maxime.

        MAXON SDK Specialist

        Development Blog, MAXON Registered Developer

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