About
The class BaseList2D is based on C4DAtom and GeListNode. It is a base class for many entities of the Cinema API API and adds additional functionality.
BaseList2D objects are an instance of Tbaselist2d
.
Allocation/Deallocation
BaseList2D elements can be created with the usual tools:
- BaseList2D::Alloc(): Creates a new BaseList2D object with the given type ID.
- BaseList2D::Free(): Destroys the given BaseList2D object.
- Note
- For most BaseList2D based classes dedicated "Alloc" and "Free" functions exist.
MultipassObject*
const multipass =
static_cast<MultipassObject*
>(BaseList2D::Alloc(
Zmultipass));
if (multipass == nullptr)
BaseContainer& data = multipass->GetDataInstanceRef();
renderData->InsertMultipass(multipass);
#define MAXON_SOURCE_LOCATION
Definition: memoryallocationbase.h:69
#define VPBUFFER_OBJECTBUFFER
Object buffer multipass channel.
Definition: c4d_videopostdata.h:140
#define Zmultipass
Definition: ge_prepass.h:1302
@ MULTIPASSOBJECT_TYPE
Definition: zmultipass.h:6
@ MULTIPASSOBJECT_OBJECTBUFFER
Definition: zmultipass.h:8
Read-Only Properties
The following properties can be accessed:
BaseObject*
const object =
doc->GetActiveObject();
if (object == nullptr)
#define ApplicationOutput(formatString,...)
Definition: debugdiagnostics.h:204
const char * doc
Definition: pyerrors.h:226
Properties
Data
BaseList2D based objects store an internal BaseContainer. This BaseContainer can store various information, like for example (but not restricted to) the values of parameters of an object or tag.
- BaseList2D::GetData(): Returns a copy of the internal BaseContainer.
- BaseList2D::SetData(): The internal data is merged or replaced with the given BaseContainer.
- BaseList2D::GetDataInstance(): Returns a pointer to the internal BaseContainer.
- BaseList2D::GetDataInstanceRef(): Returns a reference to the internal BaseContainer.
See BaseContainer Manual.
{
if (
node ==
nullptr || !SUPER::Init(
node, isCloneInit))
return false;
BaseObject*
const obj =
static_cast<BaseObject*
>(
node);
BaseContainer& data =
obj->GetDataInstanceRef();
data.SetBool(EXAMPLE_GENERATOR_PARAMETER_BOOL, true);
data.SetInt32(EXAMPLE_GENERATOR_PARAMETER_VALUE, 123);
PyObject * obj
Definition: complexobject.h:60
maxon::Bool Bool
Definition: ge_sys_math.h:46
- Note
- Typically one should use C4DAtom::SetParameter() and C4DAtom::GetParameter() to access parameters, instead of accessing the BaseContainer directly. See C4DAtom Parameters.
Bits
Various properties are not stored in parameters but are set using bits. See BIT.
- BaseList2D::SetBit(): Sets the given bit.
- BaseList2D::GetBit(): Returns true if the given bit is set.
- BaseList2D::DelBit(): Deletes the given bit.
- BaseList2D::ToggleBit(): Toggles the given bit.
- BaseList2D::GetAllBits(): Returns all bits of the element.
- BaseList2D::SetAllBits(): Sets all bits of the element.
RenderData*
const rd =
doc->GetActiveRenderData();
if (rd == nullptr)
BaseVideoPost* const vp = rd->GetFirstVideoPost();
if (vp != nullptr)
#define BIT_VPDISABLED
Videopost is disabled.
Definition: ge_prepass.h:926
See also GeListNode NBits.
Name
A BaseList2D based element can have a name. Often this name is used in Cinema 4D's UI, like names of objects in the Object Manager:
- BaseList2D::GetName(): Returns the element's name.
- BaseList2D::SetName(): Sets the element's name.
BaseObject*
const object =
doc->GetActiveObject();
if (object == nullptr)
object->SetName("This is the selected object"_s);
- Note
- While BaseDocument is as well derived from BaseList2D, the "name" of a document is a Filename set with BaseDocument::SetDocumentName(). See BaseDocument Document Name and Path.
Node
BaseList2D contain function to deal with NimbusRef.
- BaseList2D::GetNimbusRef() Get the NimbusRef from the object
- Note
- The returned result should be assign to a NimbusBaseRef.
- BaseList2D::RemoveNimbusRef() Remove NimbusRef from the object
- BaseList2D::GetAllNimbusRefs() Retrieve all the NimbusRef assigned to the object.
- BaseList2D::IsNodeBased() Checks whether the object contains nodes.
Shader
By default a BaseList2D based element can host a list of shaders. If a new shader is created and used by the element, it must be inserted into the element's shader list.
- BaseList2D::GetFirstShader(): Returns the first shader of the shader list.
- BaseList2D::InsertShader(): Inserts the given shader into the shader list.
BaseShader*
const shader = BaseShader::Alloc(
Xbrick);
if (shader == nullptr)
material->InsertShader(shader);
NONE
Definition: asset_browser.h:1
#define Xbrick
Brick.
Definition: ge_prepass.h:1332
#define ConstDescID(...)
Definition: lib_description.h:592
@ MATERIAL_COLOR_SHADER
Definition: mmaterial.h:294
See also GeListNode Lists and Trees.
Marker
A BaseList2D based element owns a GeMarker object.
- BaseList2D::GetMarker(): Returns the element's marker.
- BaseList2D::SetMarker(): Sets the element's marker.
See GeMarker Manual for more information.
const String objectName = object->GetName();
const GeMarker& marker = object->GetMarker();
const BaseObject*
const foundObject =
doc->SearchObject(objectName);
if (foundObject != nullptr)
{
const GeMarker& foundObjectMarker = foundObject->GetMarker();
if (foundObjectMarker.Compare(marker) == 0)
else
}
Unique ID
BaseList2D based elements can store an array of unique IDs. These IDs are typically used to identify scenes and elements written by external applications using the Melange library.
- BaseList2D::AddUniqueID(): Adds a new unique ID.
- BaseList2D::FindUniqueID(): Returns true if a unique ID for the given application ID was found.
- BaseList2D::GetUniqueIDCount(): Returns the number of stored IDs.
- BaseList2D::GetUniqueIDIndex(): Gets the data of the given application ID.
- MAXON_CREATOR_ID: The application ID that accesses the internally stored GeMarker.
const Int32 ID = 1111111;
const Char* memory =
nullptr;
for (
Int32 i = 0;
i <
object->GetUniqueIDCount(); ++
i)
{
{
{
}
}
}
Py_ssize_t i
Definition: abstract.h:645
PyObject * value
Definition: abstract.h:715
void const void * bytes
Definition: bytesobject.h:117
maxon::Char Char
Definition: ge_sys_math.h:47
maxon::Int32 Int32
Definition: ge_sys_math.h:51
maxon::Int Int
Definition: ge_sys_math.h:55
Animation Tracks
BaseList2D based elements store a list of CTrack objects (see also Heads and Branches). A CTrack stores the animation data for a given parameter.
- BaseList2D::GetCTrackRoot(): Returns the GeListHead that stores the element's tracks.
- BaseList2D::GetFirstCTrack(): Returns the first CTrack in the list.
- BaseList2D::FindCTrack(): Returns the CTrack for the given parameter ID.
- BaseList2D::InsertTrackSorted(): Adds the given CTrack to the object. The object takes ownership.
CTrack* track = sphere->FindCTrack(paramID);
if (track != nullptr)
track = CTrack::Alloc(sphere, paramID);
if (track == nullptr)
sphere->InsertTrackSorted(track);
return OK
Definition: apibase.h:2740
@ DTYPE_REAL
Float
Definition: lib_description.h:67
@ PRIM_SPHERE_RAD
Definition: osphere.h:6
See Animation Overview.
Keyframe Selection
Parameters can be part of a so called keyframe selection:
- BaseList2D::ClearKeyframeSelection(): Clears the keyframe selection.
- BaseList2D::FindKeyframeSelection(): Returns true if the given parameter ID is part of the keyframe selection.
- BaseList2D::SetKeyframeSelection(): Sets the keyframe selection status of the given parameter ID.
- BaseList2D::KeyframeSelectionContent(): Returns true if there are any parameters in the current keyframe selection.
AutoAlloc<Description> description;
if (description == nullptr)
if (
object->KeyframeSelectionContent())
{
void* handle = description->BrowseInit();
const BaseContainer* bc = nullptr;
DescID id, gid;
while (description->GetNext(handle, &bc, id, gid))
{
if (
object->FindKeyframeSelection(
id) && bc)
{
}
}
}
@ DESC_NAME
String Name for standalone use.
Definition: lib_description.h:90
See also C4DAtom Parameter Properties and Animate.
Layer
A BaseList2D based element can be part of a layer:
- BaseList2D::GetLayerObject(): Returns the LayerObject representing the element's layer or
nullptr
.
- BaseList2D::SetLayerObject(): Sets the layer of the element.
- BaseList2D::GetLayerData(): Returns the layer data of the object's layer.
- BaseList2D::SetLayerData(): Sets the layer data of the object's layer.
LayerObject*
const layer =
object->GetLayerObject(
doc);
if (layer != nullptr)
{
const LayerData*
const ld =
object->GetLayerData(
doc);
if (ld != nullptr)
{
if (ld->view)
else
}
}
See also Layer Manual.
DescID State
For each parameter ID a certain state can be defined. This is typically managed by the Xref or Take system.
- BaseList2D::SetDescIDState(): Sets the state of the given parameter ID.
- BaseList2D::GetDescIDState(): Returns the state of the given parameter ID.
The flags are:
else
LOCKED
Locked description property.
Definition: customgui_descproperty.h:11
DESCIDSTATE
Definition: ge_prepass.h:5552
Functionality
BaseList2D based elements can be edited with these functions:
- BaseList2D::TransferGoal(): Changes all BaseLink objects pointing to this element to point to the given BaseList2D.
- BaseList2D::Scale(): Scales all parameters with length units with the given factor.
- BaseList2D::Edit(): Triggers the edit action for the object by sending the MSG_EDIT message (see Interaction).
BaseObject* const clone = static_cast<BaseObject*>(atomClone);
if (clone == nullptr)
doc->InsertObject(clone,
nullptr,
nullptr);
clone->Scale(2.0);
object->TransferGoal(clone, false);
clone->Edit();
Further Reading