THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 07/03/2012 at 11:20, xxxxxxxx wrote:
User Information:
Cinema 4D Version: 12
Platform: Windows ;
Language(s) : C++ ;
---------
Hey guys,
I'm having some trouble setting up my loop to create multiple sliders on my Tag Plugin.
What I'm trying to do it use the value of an EDITTEXT gizmo to determine how many new slider gizmos to create in the tag's AM.
I'm having problems getting the for loop (i) syntax thing to work with the description code.
I hope you understand what I mean.
Example : BaseContainer *bc(i) will create a new container for every loop iteration.
That one is easy. But I'm having trouble getting the other things to work in my loop.
Here's the code in my GetDDescription() method that creates a single slider.
I need to figure out how to convert this code using the (i) syntax on the various lines of code so it creates multiple sliders:
LONG index = data->GetReal(MYNUMERIC); //Get the numeric value from this GUI item to determin how many sliders to create
GePrint(LongToString(index));
Bool initNewBc = FALSE; //A switching variable to be used later on
BaseContainer newBc; //Create a new container to hold the new slider's data
for (int i=0; i<index; i++)
{
DescID newCid = DescLevel(index,DTYPE_REAL,0);
if (!singleid || cid.IsPartOf(*singleid,NULL)) //important to check for speedup c4d!
{
if (!initNewBc)
{
initNewBc = TRUE;
newBc = GetCustomDataTypeDefault(DTYPE_REAL);
newBc.SetLong(DESC_CUSTOMGUI,CUSTOMGUI_REALSLIDER);
newBc.SetReal(DESC_MIN,0.0);
newBc.SetReal(DESC_MAX,1.0);
newBc.SetReal(DESC_STEP,0.01);
newBc.SetLong(DESC_UNIT,DESC_UNIT_PERCENT);
newBc.SetLong(DESC_ANIMATE,DESC_ANIMATE_ON);
newBc.SetBool(DESC_REMOVEABLE,TRUE);
}
newBc.SetString(DESC_NAME,"New Slider");
newBc.SetString(DESC_SHORT_NAME,"New Slider");
if (!description->SetParameter(newCid,newBc,DescLevel(ID_OBJECTPROPERTIES))) return FALSE; //Update the changes made to the container
}
}
flags |= DESCFLAGS_DESC_LOADED;
return TRUE;
-ScottA