RangeData Manual


The RangeData stores data on ranges and on the current value within these ranges. It is typically used with the LodObject. The RangeData class is defined in the customgui_range.h header file. The ID is CUSTOMDATATYPE_RANGE.


RangeData data is typically accessed from a LodObject. See LodObject Manual.

// This example reads the range data from the given LOD object.
GeData rangeData;
if (lodObject->GetParameter(LOD_BAR, rangeData, DESCFLAGS_GET_0))
RangeData* rangeCustomData = static_cast<RangeData*>(customData);
if (rangeCustomData)
const Float currentValue = rangeCustomData->GetCurrentValue();
GePrint("Value: " + String::FloatToString(currentValue));


RangeData objects are created with the usual tools, see Entity Creation and Destruction Manual.

A RangeData object must be initialized:

// This example configures the given LOD object and defines the
// number of manual groups using the RangeData data.
// create custom data
AutoAlloc<RangeData> rangeCustomData;
if (rangeCustomData)
// configure LodObject
// configure range data
// store to LodObject
GeData rangeGeData;
rangeGeData.SetCustomDataType(CUSTOMDATATYPE_RANGE, rangeCustomData);
lodObject->SetParameter(LOD_BAR, rangeGeData, DESCFLAGS_SET_0);


A RangeData stores a value between 0.0 and 1.0:

// This example sets the current, user defined value of the range slider.
// get range data
GeData rangeData;
lodObject->GetParameter(LOD_BAR, rangeData, DESCFLAGS_GET_0);
RangeData* rangeCustomData = static_cast<RangeData*>(customData);
if (!rangeCustomData)
return false;
// User LOD Value
// set value
lodObject->SetParameter(LOD_BAR, rangeData, DESCFLAGS_SET_0);


Multiple knots can be added to a RangeData object. These knots define the borders of the ranges.

// This example clears the given RangeData and
// adds two new knots.
// clear
// add knots
// set selection

A single knot can be selected:

// This example deletes the currently selected knot.
const Int knotIndex = rangeCustomData->GetSelectedKnot();


Value ranges are defined as the space confined by knots:

// This example sets the color of the range containing the current value.
// get current range
const Float currentValue = rangeCustomData->GetCurrentValue();
const Int currentRange = rangeCustomData->GetRangeIndex(currentValue);
// set color
const Vector color(1.0, 0.0, 0.0);
rangeCustomData->SetRangeColor(currentRange, color);

Color Modes

The ranges between knots can be colored in different ways:

// This example assigns a new color to each range.
// set mode
// get number of ranges
const Int rangeCount = rangeCustomData->GetRangesCount();
const Float colorStep = 1.0 / Float(rangeCount);
// set color of each range
for (Int i = 0; i < rangeCount; ++i)
const Vector hsv = Vector(Float(i) * colorStep, 1.0, 1.0);
const Vector rgb = HSVToRGB(hsv);
rangeCustomData->SetRangeColor(i, rgb);


The dimensions of a range are stored with a RangePair object:

The RangePair class includes:

// This example sets the current value to the center
// of the current range.
// get current value and range
const Float currentValue = rangeCustomData->GetCurrentValue();
const Int currentRange = rangeCustomData->GetRangeIndex(currentValue);
// get range center
RangePair rData = rangeCustomData->GetRange(currentRange);
const Float centerValue = rData.GetCenter();
// set value

Further Reading