BaseOverride Manual

About

A BaseOverride defines the settings for a specific BaseList2D object in a certain take.

Note
BaseOverride objects are stored with the changed object. One should not access them directly, only through BaseTake.
// This example creates ten takes with different overrides of the material color.
// get the active material
BaseMaterial* const material = doc->GetActiveMaterial();
// check if the active material is the Cinema 4D standard material
if (material == nullptr || material->GetType() != Mmaterial)
return maxon::OK;
// create 10 takes with variations
for (Int32 i = 0; i < 10; ++i)
{
const String takeName = "Variation " + String::IntToString(i);
BaseTake* const materialVariation = takeData->AddTake(takeName, nullptr, nullptr);
if (materialVariation == nullptr)
return maxon::OutOfMemoryError(MAXON_SOURCE_LOCATION);
// new color
const Vector hsv { Float(i) * 0.1, 1.0, 1.0 };
const Vector rgb = HSVToRGB(hsv);
const GeData newValue { rgb };
// create override
BaseOverride* const overrideNode = materialVariation->FindOrAddOverrideParam(takeData, material, matColID, newValue);
if (overrideNode == nullptr)
return maxon::OutOfMemoryError(MAXON_SOURCE_LOCATION);
overrideNode->UpdateSceneNode(takeData, matColID);
}
Py_ssize_t i
Definition: abstract.h:645
Vector HSVToRGB(const Vector &col)
Definition: c4d_basematerial.h:28
Definition: lib_takesystem.h:79
void UpdateSceneNode(TakeData *takeData, const DescID &descID)
Definition: lib_takesystem.h:335
BaseOverride * FindOrAddOverrideParam(TakeData *takeData, BaseList2D *node, const DescID &descID, const GeData &overrideValue, const GeData &backupValue=GeData(), Bool deleteAnim=false)
Int32 GetType() const
Definition: c4d_baselist.h:1537
Definition: lib_description.h:355
Definition: c4d_gedata.h:83
Definition: c4d_string.h:41
static String IntToString(Int32 v)
Definition: c4d_string.h:497
maxon::Int32 Int32
Definition: ge_sys_math.h:56
maxon::Float Float
Definition: ge_sys_math.h:62
return OK
Definition: apibase.h:2735
@ DTYPE_COLOR
Color.
Definition: lib_description.h:57
#define Mmaterial
Standard material.
Definition: ge_prepass.h:1008
#define MAXON_SOURCE_LOCATION
Definition: memoryallocationbase.h:67
#define ConstDescID(...)
Definition: lib_description.h:594
@ MATERIAL_COLOR_COLOR
Definition: mmaterial.h:56
const char * doc
Definition: pyerrors.h:226
Represents a level within a DescID.
Definition: lib_description.h:298

Access

Existing BaseOverride objects can be accessed from the BaseTake or the TakeData object:

// This example searches for an override of the active object in the current take.
BaseObject* const object = doc->GetActiveObject();
if (object == nullptr)
return maxon::IllegalArgumentError(MAXON_SOURCE_LOCATION);
BaseTake* const take = takeData->GetCurrentTake();
if (take == nullptr)
return maxon::UnexpectedError(MAXON_SOURCE_LOCATION);
BaseOverride* const baseOverride = take->FindOverride(takeData, object);
if (baseOverride == nullptr)
return maxon::OutOfMemoryError(MAXON_SOURCE_LOCATION);
Definition: c4d_baseobject.h:248
BaseOverride * FindOverride(TakeData *takeData, BaseList2D *node)

Allocation/Deallocation

Overrides are created using the host BaseTake:

// This example adds an override to the current take for the given cube object
// and changes the "Size" parameter.
// prepare parameter ID and new value
const DescLevel cubeSizeLevel { PRIM_CUBE_LEN, DTYPE_VECTOR, 0 };
const DescLevel vectorXLevel { VECTOR_X, DTYPE_REAL, 0 };
const DescID ID = CreateDescID(cubeSizeLevel, vectorXLevel);
const GeData newValue { 300.0 };
// create override
BaseOverride* const overrideNode = take->FindOrAddOverrideParam(takeData, cube, ID, newValue);
if (overrideNode == nullptr)
return maxon::UnexpectedError(MAXON_SOURCE_LOCATION);
// update the object
overrideNode->UpdateSceneNode(takeData, ID);
@ DTYPE_VECTOR
Vector
Definition: lib_description.h:70
@ DTYPE_REAL
Float
Definition: lib_description.h:68
@ VECTOR_X
X component.
Definition: lib_description.h:279
#define CreateDescID(...)
Definition: lib_description.h:595
@ PRIM_CUBE_LEN
Definition: ocube.h:6
Note
To delete a specific parameter from an override BaseTake::DeleteOverride() must be used.

Navigation

BaseOverride instances are organized in a BaseList2D list:

Note
Functions like BaseOverride::GetUp() etc. are reserved for future use.

Read-Only Properties

The following properties can be accessed:

Override

A BaseOverride stores the values of different parameters. These parameters can be accessed in different ways:

// This example checks if the given take contains an override for the given sphere object.
// If so, it is checked if the "Radius" parameter is overridden.
// In this case, the value is increased and the node updated.
// check if the given object is a "Sphere" object
if (object->GetType() != Osphere)
return maxon::IllegalArgumentError(MAXON_SOURCE_LOCATION);
BaseOverride* const baseOverride = take->FindOverride(takeData, object);
if (baseOverride == nullptr)
return maxon::IllegalArgumentError(MAXON_SOURCE_LOCATION);
// the "Radius" parameter of a sphere
// check if the "Radius" parameter is overridden
if (baseOverride->IsOverriddenParam(ID))
{
GeData data;
baseOverride->GetParameter(ID, data, DESCFLAGS_GET::NONE);
// change parameter
data = data.GetFloat() + 10.0;
// update override
baseOverride->SetParameter(ID, data, DESCFLAGS_SET::NONE);
// update node
baseOverride->UpdateSceneNode(takeData, ID);
}
Bool IsOverriddenParam(const DescID &descID) const
Bool SetParameter(const DescID &id, const GeData &t_data, DESCFLAGS_SET flags)
Bool GetParameter(const DescID &id, GeData &t_data, DESCFLAGS_GET flags) const
Float GetFloat() const
Definition: c4d_gedata.h:468
#define Osphere
Sphere.
Definition: ge_prepass.h:1120
@ PRIM_SPHERE_RAD
Definition: osphere.h:6
Definition: object.h:105

Further Reading