About
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.
Access
RangeData data is typically accessed from a LodObject. See LodObject Manual.
  
 
  GeData rangeData;
 
  const RangeData* const rangeCustomData = rangeData.GetCustomDataType<RangeData>();
  if (rangeCustomData == nullptr)
 
  const Float currentValue = rangeCustomData->GetCurrentValue();
 
NONE
Definition: asset_browser.h:1
 
#define MAXON_SOURCE_LOCATION
Definition: memoryallocationbase.h:69
 
#define ApplicationOutput(formatString,...)
Definition: debugdiagnostics.h:204
 
#define ConstDescID(...)
Definition: lib_description.h:592
 
maxon::Float Float
Definition: ge_sys_math.h:57
 
@ LOD_BAR
Definition: olod.h:8
 
  
Allocation/Deallocation
RangeData objects are created with the usual tools, see Entity Creation and Destruction Manual (Cinema API).
- RangeData::Alloc(): Creates a new RangeData object.
 
- RangeData::Free(): Deletes the given RangeData object.
 
A RangeData object must be initialized:
- RangeData::Init(): Initializes the object with the passed range number.
 
- RangeData::Reset(): Resets the object to the initial state.
 
  
  
 
  
  AutoAlloc<RangeData> rangeCustomData;
  if (rangeCustomData == nullptr)
 
  
 
 
  
  if (!rangeCustomData->Init(10))
 
  
 
  GeData rangeGeData;
  rangeGeData.SetCustomDataType<RangeData>(rangeCustomData);
@ LOD_MODE
Definition: olod.h:6
 
@ LOD_CRITERIA
Definition: olod.h:7
 
@ LOD_CRITERIA_SCREEN_H
Definition: olod.h:30
 
@ LOD_MODE_MANUAL_GROUPS
Definition: olod.h:25
 
  
Value
A RangeData stores a value between 0.0 and 1.0:
- RangeData::GetCurrentValue(): Returns the current value.
 
- RangeData::SetCurrentValue(): Sets the current value.
 
  
 
  
 
  GeData rangeData;
 
  RangeData* const rangeCustomData = rangeData.GetCustomDataTypeWritable<RangeData>();
  if (rangeCustomData == nullptr)
 
  
 
  
  rangeCustomData->SetCurrentValue(0.5);
@ LOD_CRITERIA_MANUAL_SLIDER
Definition: olod.h:29
 
  
Knots
Multiple knots can be added to a RangeData object. These knots define the borders of the ranges.
- RangeData::AddValue(): Adds a new knot at the given value. The existing range is split.
 
- RangeData::GetKnotsCount(): Returns the number of knots.
 
- RangeData::DeleteKnot(): Deletes the knot with the given index.
 
- RangeData::GetKnotValue(): Returns the value of the knot with the given index.
 
- RangeData::SetKnotValue(): Sets the value of the knot with the given index.
 
- RangeData::GetKnotIndexByValue(): Returns the index of the knot which value is equal to the given value.
 
  
  
 
  
  rangeCustomData->Reset();
 
  
  rangeCustomData->AddValue(0.33);
  rangeCustomData->AddValue(0.66);
 
  
  rangeCustomData->SetSelectedKnot(0);
 
 A single knot can be selected:
- RangeData::GetSelectedKnot(): Returns the index of the selected knot or NOTOK.
 
- RangeData::SetSelectedKnot(): Selects the knot with the given index.
 
  
 
  const Int knotIndex = rangeCustomData->GetSelectedKnot();
 
 
  rangeCustomData->DeleteKnot(knotIndex);
maxon::Int Int
Definition: ge_sys_math.h:55
 
  
Ranges
Value ranges are defined as the space confined by knots:
- RangeData::GetRangesCount(): Returns the number of ranges.
 
- RangeData::GetRangeIndex(): Returns the range index for the given value.
 
- RangeData::GetSelectedRange(): Returns the index of the selected range or NOTOK.
 
- RangeData::SetSelectedRange(): Selects the range with the given index.
 
  
 
  
 
  const Float currentValue = rangeCustomData->GetCurrentValue();
 
  const Int   currentRange = rangeCustomData->GetRangeIndex(currentValue);
 
 
  
 
  const Vector color { 1.0, 0.0, 0.0 };
 
  rangeCustomData->SetRangeColor(currentRange, color);
maxon::Vec3< maxon::Float64, 1 > Vector
Definition: ge_math.h:140
 
  
Color Modes
The ranges between knots can be colored in different ways:
- RangeData::IsPerRangeColorMode(): Returns true if a color is stored for each range.
 
- RangeData::SetColorMode(): Sets the color mode.
 
- RangeData::GetRangeColor(): Returns the color of the range with the given index.
 
- RangeData::SetRangeColor(): Sets the color of the range with the given index.
 
- RangeData::IsRandomColorMode(): Returns true if the assigned colors are random.
 
- RangeData::SetRandomColorMode(): Sets the random color mode.
 
  
 
  
  rangeCustomData->SetRandomColorMode(false);
  rangeCustomData->SetColorMode(true);
 
  
 
  const Int   rangeCount = rangeCustomData->GetRangesCount();
 
 
  
  for (
Int i = 0; 
i < rangeCount; ++
i)
 
  {
 
    rangeCustomData->SetRangeColor(
i, rgb);
 
  }
Py_ssize_t i
Definition: abstract.h:645
 
Vector HSVToRGB(const Vector &col)
 
  
RangePair
The dimensions of a range are stored with a RangePair object:
- RangeData::GetRange(): Returns the RangePair for the range with the given index.
 
The RangePair class includes:
- RangePair::Contains(): Returns true if the given value is within the range.
 
- RangePair::GetMin(): Return the minimal value of the range.
 
- RangePair::GetMax(): Returns the maximal value of the range.
 
- RangePair::GetCenter(): Returns the center of the range.
 
  
  
 
  
 
  const Float currentValue = rangeCustomData->GetCurrentValue();
 
  const Int   currentRange = rangeCustomData->GetRangeIndex(currentValue);
 
 
  
 
  const RangePair rData = rangeCustomData->GetRange(currentRange);
  const Float     centerValue = rData.GetCenter();
 
 
  
  rangeCustomData->SetCurrentValue(centerValue);
  
Further Reading