Columns with GetDDescription()

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 07/08/2005 at 00:17, xxxxxxxx wrote:

User Information:
Cinema 4D Version:   8.503 
Platform:   Windows  ; Mac  ;  Mac OSX  ; 
Language(s) :     C++  ;

---------
My plugin tag is creating a stack of CUSTOMGUI_REALSLIDERs which are dynamically added using GetDDescription(). I would like to add an "Edit" button (CUSTOMGUI_BUTTON) to the end of each slider.

Okay, so I first create a CUSTOMGUI_GROUP, uniquely indexed, with DESC_COLUMNS = 2. That puts the slider and button on the same line, but now the slider no longer has the nice grouping that it had without the button.

Here's the method called from GetDDescription() that recursively traverses children for a particular tag to add to the 'list' of sliders. Note: yes, the sliders are divided into foldable groups by object.

  
// Add Dial to DialGroup list - recursive  
BOOL IPPDialGroup::AddDial(BaseDocument* baseDoc, BaseObject* obj, BaseObject* orig, BaseContainer* opBC, Description* description)  
{  
     LONG nr;  
     PluginTag* pt;  
     BaseContainer* pbc;  
     BaseContainer grpBC, subgrpBC, sliderBC, editBC;  
  
     // Initialize  
     grpBC =          GetCustomDataTypeDefault(DTYPE_GROUP);  
     subgrpBC =     GetCustomDataTypeDefault(DTYPE_GROUP);  
     subgrpBC.SetLong(DESC_COLUMNS, 2);  
     sliderBC =     GetCustomDataTypeDefault(DTYPE_REAL);  
     sliderBC.SetLong(DESC_CUSTOMGUI, CUSTOMGUI_REALSLIDER);  
     sliderBC.SetLong(DESC_UNIT, DESC_UNIT_REAL);  
     sliderBC.SetLong(DESC_ANIMATE, DESC_ANIMATE_ON);  
     sliderBC.SetBool(DESC_REMOVEABLE, FALSE);  
     editBC =     GetCustomDataTypeDefault(DTYPE_BUTTON);  
     editBC.SetString(DESC_SHORT_NAME, "Edit");  
     editBC.SetLong(DESC_CUSTOMGUI, CUSTOMGUI_BUTTON);  
     editBC.SetLong(DESC_ANIMATE, DESC_ANIMATE_OFF);  
     editBC.SetBool(DESC_REMOVEABLE, FALSE);  
  
     for (obj; obj; obj = obj->GetNext())  
     {  
          // Add a foldable group - only if there are dial tags  
          if (obj->GetTag(ID_IPPDIALTAG))  
          {  
               grpBC.SetString(DESC_NAME, obj->GetName());  
               if(!description->SetParameter(DescLevel(group,DTYPE_GROUP,0), grpBC, DescLevel(GROUP_DIALS))) return FALSE;  
  
               // Add related Dials to DialGroup list  
               for (nr = 0; pt = (PluginTag* )obj->GetTag(ID_IPPDIALTAG, nr); nr++)  
               {  
                    // Verify dial object  
                    if (!(pbc = pt->GetDataInstance())) return FALSE;  
                    if (pbc->GetObjectLink(IPPDIAL_OPOLYGON_LINK, baseDoc) != orig) continue;  
  
                    // Create 2 Column Group for Slider and Button  
                    if (!description->SetParameter(DescLevel(subgroup,DTYPE_GROUP,0), subgrpBC, DescLevel(group))) return FALSE;  
  
                    // Create slider  
                    sliderBC.SetString(DESC_NAME, pbc->GetString(IPPDIAL_FULLNAME));  
                    sliderBC.SetString(DESC_SHORT_NAME, pt->GetName());  
                    sliderBC.SetLong(DESC_PARENTID, group);  
                    sliderBC.SetReal(DESC_MIN, pbc->GetReal(IPPDIAL_MIN));  
                    sliderBC.SetReal(DESC_MAX, pbc->GetReal(IPPDIAL_MAX));  
                    sliderBC.SetReal(DESC_STEP, pbc->GetReal(IPPDIAL_STEP));  
                    if (!description->SetParameter(DescLevel(index,DTYPE_REAL,0), sliderBC, DescLevel(subgroup))) return FALSE;  
  
                    // Create button  
                    editBC.SetString(DESC_NAME, pbc->GetString(IPPDIAL_FULLNAME));  
                    editBC.SetLong(DESC_PARENTID, group);  
                    if (!description->SetParameter(DescLevel(button,DTYPE_BUTTON,0), editBC, DescLevel(subgroup))) return FALSE;  
  
                    opBC->SetLink(dtag, pt);  
                    opBC->SetReal(index, pbc->GetReal(IPPDIAL_CURRENTVALUE));  
  
                    button++;  
                    index++;  
                    subgroup++;  
                    dtag++;  
               }  
               group++;  
          }  
          // Handle children  
          if (!AddDial(baseDoc, obj->GetDown(), orig, opBC, description)) return FALSE;  
     }  
     return TRUE;  
}  

Thanks,

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 07/08/2005 at 14:47, xxxxxxxx wrote:

Nothing that I tried resolved this, not even adding the Button to the group with just rows (even with the button on its own row, the slider was all scrunched together). I imagine that it may be resolvable using DESC_LAYOUTGROUP, but this requires groups (one for the slider and one for the button), which requires ids for each of them, which means overt complexity to perform what would be simple in a Description Resource (if that works?).

Oh well... 🙂