Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python 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

    DESC_PARENT_COLLAPSE Twirl Down

    Cinema 4D SDK
    r20 sdk c++
    3
    5
    647
    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.
    • D
      d_schmidt
      last edited by

      Hello!
      I have a pretty simple question about how to create a twirl down group in the Attribute Manager such as this alt text

      I managed to track down that it uses DESC_PARENT_COLLAPSE, but I'm having trouble setting it up in GetDDescription(). The SDK doesn't really help with it and the forums didn't turn up any results so I'm a bit lost. Thanks for any help.

      Dan

      1 Reply Last reply Reply Quote 0
      • ManuelM
        Manuel
        last edited by Manuel

        hello,

        You have to set the DESC_PARENT_COLLAPSE of the "parent" to -1 so it act as a parent. For the children, just set the ID to the parent's ID.

        virtual Bool GetDDescription(GeListNode* node, Description* description, DESCFLAGS_DESC& flags)
        	{
        		if (!description->LoadDescription(node->GetType()))
        			return false;
        
        		const DescID* singleid = description->GetSingleDescID();
        
        
        		DescID cid = DescLevel(firstID, DTYPE_REAL, 0);
        		// check if this parameter ID is requested (NOTE: this check is important for speed)
        		if (!singleid || cid.IsPartOf(*singleid, nullptr))
        		{
        			// define the new parameter description
        			BaseContainer settings = GetCustomDataTypeDefault(DTYPE_REAL);
        			settings.SetString(DESC_NAME, "A float"_s);
        			settings.SetInt32(DESC_PARENT_COLLAPSE, -1);
        
        			// set the new parameter
        			if (!description->SetParameter(cid, settings, ID_OBJECTPROPERTIES))
        				return false;
        		}
        
        		cid = DescLevel(secondID, DTYPE_REAL, 0);
        		if (!singleid || cid.IsPartOf(*singleid, nullptr))
        		{
        			// define the new parameter description
        			BaseContainer settings = GetCustomDataTypeDefault(DTYPE_REAL);
        			settings.SetString(DESC_NAME, "Another float"_s);
        			settings.SetInt32(DESC_PARENT_COLLAPSE, firstID);
        
        			// set the new parameter
        			if (!description->SetParameter(cid, settings, ID_OBJECTPROPERTIES))
        				return false;
        		}
        
        		cid = DescLevel(thirdID, DTYPE_BOOL, 0);
        		if (!singleid || cid.IsPartOf(*singleid, nullptr))
        		{
        			// define the new parameter description
        			BaseContainer settings = GetCustomDataTypeDefault(DTYPE_BOOL);
        			settings.SetString(DESC_NAME, "A Bool"_s);
        			settings.SetInt32(DESC_PARENT_COLLAPSE, firstID);
        
        			// set the new parameter
        			if (!description->SetParameter(cid, settings, ID_OBJECTPROPERTIES))
        				return false;
        		}
        
        		flags |= DESCFLAGS_DESC::LOADED;
        		return SUPER::GetDDescription(node, description, flags);
        		
        	}
        

        Cheers
        Manuel

        MAXON SDK Specialist

        MAXON Registered Developer

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

          Hello,

          just FYI: there is also a short description and an example snippet about DESC_PARENT_COLLAPSE in the Description Settings Manual.

          best wishes,
          Sebastian

          MAXON SDK Specialist

          Development Blog, MAXON Registered Developer

          1 Reply Last reply Reply Quote 1
          • D
            d_schmidt
            last edited by

            Thank you both for the answers!

            Sorry about not finding that, Sebastian, it wasn't popping up when I searched the SDK.

            Dan

            1 Reply Last reply Reply Quote 0
            • ManuelM
              Manuel
              last edited by

              hello,

              this thread will be considered as Solved tomorrow is you have nothing to add.

              Cheers
              Manuel

              MAXON SDK Specialist

              MAXON Registered Developer

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