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

    Align Group Parameters (Resource Files)

    Cinema 4D SDK
    r21 c++ sdk
    2
    4
    579
    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.
    • O
      Ogers
      last edited by Ogers

      Hello,
      I have a resource file where I define the UI of materials attributes.

      GROUP COATING_LAYER
      {
           GROUP THICKNESS_GROUP
           {
      	COLUMNS 2;
      	REAL COATING_LAYER_THICKNESS{SCALE_H; MIN 0; MAX 1; MINSLIDER 0; 
              MAXSLIDER 1; STEP 0.001; CUSTOMGUI REALSLIDER;}
      	SHADERLINK COATING_LAYER_THICKNESS_SHADER{ANIM ON; SCALE_H; HIDDEN;}
           }
      
           GROUP COLOR_GROUP
           {
      	COLUMNS 2;
      	COLOR COATING_LAYER_COLOR{SCALE_H;}
      	SHADERLINK COATING_LAYER_COLOR_SHADER{ANIM ON; HIDDEN;}
           }
      //...Continues with other groups
      }
      

      One parameter of the group I specify on the res file as above (The hidden one is not used at all in the UI) and the second parameter I specify using Description object as below.

      const DescID* singleid = dc->GetSingleDescID();
      
      	if (!singleid || ((DescID)id).IsPartOf(*singleid, NULL))
      	{
      		BaseContainer bc = GetCustomDataTypeDefault(DTYPE_POPUP);
      
      		//  Set CycleButton properties
      		bc.SetBool(DESC_ANIMATE, false);
      		bc.SetInt32(DESC_CUSTOMGUI, CUSTOMGUI_POPUP);
      		bc.SetBool(DESC_GROUPSCALEV, TRUE);
      		//  Create CycleButton
      		return dc->SetParameter(DescLevel(id, DTYPE_POPUP, 0), bc, groupid);
      	}
      
      	return TRUE;
      

      The view that I get is the picture below but as you can see the paramters (Thickness, Color, Roughness etc) are not aligned as they normally do when using description resource.
      How would the code or res file look like so I can have them aligned.
      00071653-cd8e-4496-b5eb-d2e57c20caad-image.png

      1 Reply Last reply Reply Quote 0
      • ferdinandF
        ferdinand
        last edited by ferdinand

        Hi,

        unless I am missing something here, I would say that this behaviour has nothing to do with modifying your description via GetDDescription() but the structure of your res file. The alignment of description elements always works per GROUP. So when you encapsulate every row in a GROUP you will have no alignment at all.

        There are several ways you can tackle this. Here is a recent posting that dealt with a similar problem.

        Cheers
        zipit

        MAXON SDK Specialist
        developers.maxon.net

        1 Reply Last reply Reply Quote 2
        • O
          Ogers
          last edited by

          @zipit the reason why I have to use GROUP for every row is because at every row I am adding a popup button. And I can not add it using res file. So I can't do this without a group which tells me where to add the popup button.

          1 Reply Last reply Reply Quote 0
          • O
            Ogers
            last edited by Ogers

            Thanks @zipit,
            Managed to solve it thanks to you.

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