BaseOverride Manual

内容表

关于

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

注意
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 );

const DescID matColID { DescLevel { MATERIAL_COLOR_COLOR , DTYPE_COLOR , 0 } };

// new color const 向量 hsv { Float (i) * 0.1, 1.0, 1.0 }; const 向量 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); }

Access

Existing BaseOverride objects can be accessed from the BaseTake 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 );

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 { 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);

注意
To delete a specific parameter from an override BaseTake::DeleteOverride() must be used.

导航

BaseOverride instances are organized in a BaseList2D list:

注意
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 const DescID ID { DescLevel { PRIM_SPHERE_RAD , DTYPE_REAL , 0 } };

// 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); }

延伸阅读

BaseOverride::IsOverriddenParam
Bool IsOverriddenParam(const DescID &descID)
BaseObject
定义: c4d_baseobject.h:224
DescID
定义: lib_description.h:327
BaseTake
定义: lib_takesystem.h:319
VECTOR_X
@ VECTOR_X
X component.
定义: lib_description.h:267
Float
maxon::Float Float
定义: ge_sys_math.h:64
BaseOverride
定义: lib_takesystem.h:78
BaseDocument::GetActiveMaterial
BaseMaterial * GetActiveMaterial(void)
maxon::OK
return OK
定义: apibase.h:2532
TakeData::AddTake
BaseTake * AddTake(const String &name, BaseTake *parent, BaseTake *cloneFrom)
MAXON_SOURCE_LOCATION
#define MAXON_SOURCE_LOCATION
定义: memoryallocationbase.h:66
HSVToRGB
Vector HSVToRGB(const Vector &col)
DESCFLAGS_SET::NONE
@ NONE
None.
PRIM_SPHERE_RAD
@ PRIM_SPHERE_RAD
定义: osphere.h:6
Osphere
#define Osphere
Sphere.
定义: ge_prepass.h:1041
String
定义: c4d_string.h:38
String::IntToString
static String IntToString(Int32 v)
定义: c4d_string.h:495
C4DAtom::SetParameter
Bool SetParameter(const DescID &id, const GeData &t_data, DESCFLAGS_SET flags)
maxon::Vec3< maxon::Float64, 1 >
TakeData::GetCurrentTake
BaseTake * GetCurrentTake()
DTYPE_VECTOR
@ DTYPE_VECTOR
向量
定义: lib_description.h:70
DescLevel
Represents a level within a DescID.
定义: lib_description.h:286
PRIM_CUBE_LEN
@ PRIM_CUBE_LEN
定义: ocube.h:6
BaseOverride::UpdateSceneNode
void UpdateSceneNode(TakeData *takeData, const DescID &descID)
GeData
定义: c4d_gedata.h:82
Int32
maxon::Int32 Int32
定义: ge_sys_math.h:58
Mmaterial
#define Mmaterial
Standard material.
定义: ge_prepass.h:950
DESCFLAGS_GET::NONE
@ NONE
None.
MATERIAL_COLOR_COLOR
@ MATERIAL_COLOR_COLOR
定义: mmaterial.h:56
BaseDocument::GetActiveObject
BaseObject * GetActiveObject(void)
BaseTake::FindOrAddOverrideParam
BaseOverride * FindOrAddOverrideParam(TakeData *takeData, BaseList2D *node, const DescID &descID, const GeData &overrideValue, const GeData &backupValue=GeData(), Bool deleteAnim=false)
DTYPE_REAL
@ DTYPE_REAL
Float
定义: lib_description.h:68
BaseTake::FindOverride
BaseOverride * FindOverride(TakeData *takeData, BaseList2D *node)
C4DAtom::GetType
Int32 GetType() const
定义: c4d_baselist.h:1348
BaseMaterial
定义: c4d_basematerial.h:27
DTYPE_COLOR
@ DTYPE_COLOR
Color.
定义: lib_description.h:57
C4DAtom::GetParameter
Bool GetParameter(const DescID &id, GeData &t_data, DESCFLAGS_GET flags)
GeData::GetFloat
Float GetFloat(void) const
定义: c4d_gedata.h:439

Copyright  © 2014-2025 乐数软件    

工业和信息化部: 粤ICP备14079481号-1