About
Parameters of C4DAtom based elements are identified using a DescID object. Such a DescID object is composed of several levels of DescLevel objects. In this way DescIDs can reflect the structure of complex data types. For example a ::Vector consists of three ::Float values. With the first DescLevel the ::Vector is accessed as a whole, with the second DescLevel the three ::Float components can be accessed individually.
GeData data;
const Float scale = data.GetFloat();
const DescID sizeXID =
CreateDescID(fractalLenLevel, vectorXLevel);
const Float sizeX = data.GetFloat();
NONE
Definition: asset_browser.h:1
@ VECTOR_X
Definition: dvector.h:6
@ DTYPE_VECTOR
Vector
Definition: lib_description.h:69
@ DTYPE_REAL
Float
Definition: lib_description.h:67
#define MAXON_SOURCE_LOCATION
Definition: memoryallocationbase.h:69
#define ApplicationOutput(formatString,...)
Definition: debugdiagnostics.h:204
#define ConstDescID(...)
Definition: lib_description.h:592
#define CreateDescID(...)
Definition: lib_description.h:593
maxon::Float Float
Definition: ge_sys_math.h:57
@ PRIM_FRACTAL_SCALE
Definition: ofractal.h:12
@ PRIM_FRACTAL_LEN
Definition: ofractal.h:7
User data parameters are stored in a sub-container with the ID ID_USERDATA.
GeData data;
const DescID floatParameterID =
CreateDescID(userDataLevel, firstParameter);
{
const String floatStr = String::FloatToString(data.GetFloat());
}
const DescID vectorSubParameterID =
CreateDescID(userDataLevel, secondParameter, vectorXLevel);
{
const String floatStr = String::FloatToString(data.GetFloat());
}
@ DTYPE_SUBCONTAINER
Sub-container.
Definition: lib_description.h:57
#define ID_USERDATA
User data ID.
Definition: lib_description.h:24
DescID
A DescID object identifies a parameter.
- Note
- A DescID can be stored in a GeData or BaseContainer using the custom data type CUSTOMDATATYPE_DESCID.
Create
DescID objects can be created with different constructors:
GeData data;
{
const Float radius = data.GetFloat();
}
{
const Float radius = data.GetFloat();
}
#define MAXON_SCOPE
Definition: apibase.h:2891
@ PRIM_SPHERE_RAD
Definition: osphere.h:6
- Note
- Typically a DescID constructed by using only the parameter ID is sufficient. For specialized uses like animation tracks or takes the fully constructed DescID might be needed.
Functionality
A complex DescID object with several levels can be constructed with these tools:
- DescID::SetId(): Sets the highest stored level to the given DescLevel.
- DescID::PushId(): Adds the given DescLevel to the stack.
- DescID::PopId(): Removes the last DescLevel from the stack.
GeData data;
DescID sizeXID;
const Float sizeX = data.GetFloat();
The levels of a DescID object can also be edited with these operators:
- DescID::operator[](): Accesses the level at the given index. The index "-1" can be used to access the last DescLevel on the stack.
- DescID::operator=(): Assigns the DescID to the given DescID.
- DescID::operator==(): Returns true if the DescID objects are the same.
- DescID::operator!=(): Returns true if the DescID objects are not the same.
- DescID::operator<<(): Returns the resulting DescID after popping levels from the bottom of the stack.
- DescID::operator+=(): Merges the DescID with the given DescID.
- DescID::operator+(): Merges two DescID objects.
GeData data;
DescID sizeXID;
#if API_VERSION < 2023900
#else
#endif
const Float sizeX = data.GetFloat();
- Note
- The + operator does not work like an integer addition. Important, when constructing parameter IDs dynamically.
Further functions are:
- DescID::GetDepth(): Returns the number of levels.
- DescID::IsPartOf(): Returns true if the DescID is part of the given DescID.
- DescID::GetHashCode(): Returns a hash code for the DescID.
const Int32 depth = descID.GetDepth();
{
const DescLevel
level = descID[
i];
}
Py_ssize_t i
Definition: abstract.h:645
PyObject PyObject PyObject int level
Definition: import.h:58
maxon::Int32 Int32
Definition: ge_sys_math.h:51
Disc I/O
DescID objects can be stored in a HyperFile.
- DescID::Read(): Reads the DescID from the given HyperFile.
- DescID::Write(): Stores the DescID to the given HyperFile.
DescLevel
A DescLevel represents a level of a DescID parameter ID.
Create
DescLevel objects can be created with different constructors:
GeData data;
{
const Float radius = data.GetFloat();
}
{
const Float radius = data.GetFloat();
}
Attributes
The public attributes of a DescLevel are:
- DescLevel::id: The parameter ID.
- DescLevel::dtype: The parameter type.
- DescLevel::creator: The creator ID. This is the ID of the plugin class that created that parameter.
const DescLevel
level = descID[0];
const String levelIdStr = String::IntToString(
level.id);
const String levelDtypeStr = String::IntToString(
level.dtype);
const String levelCreatorStr = String::IntToString(
level.creator);
String GetObjectName(Int32 type)
Compare
Two DescLevel objects can be compared with:
Further Reading