About
Layers are used to organize a Cinema 4D scene. A layer is represented by a LayerObject, its settings are stored in a LayerData object.
if (root == nullptr)
{
if (newLayer == nullptr)
}
Py_ssize_t i
Definition: abstract.h:645
Bool SetLayerData(BaseDocument *doc, const LayerData &data)
void SetName(const maxon::String &name, Bool setDirty=true)
Definition: c4d_baselist.h:2550
Definition: c4d_baselist.h:2209
void InsertLast(GeListNode *bn)
Definition: c4d_baselist.h:2296
Definition: c4d_basedocument.h:252
static LayerObject * Alloc()
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
#define MAXON_SOURCE_LOCATION
Definition: memoryallocationbase.h:67
const char * doc
Definition: pyerrors.h:226
Definition: c4d_basedocument.h:318
Vector color
Layer color.
Definition: c4d_basedocument.h:361
Bool solo
Definition: c4d_basedocument.h:350
LayerObject
A LayerObject represents a layer of a Cinema 4D scene. It is used to assign an element to this layer and to edit the layer.
LayerObject objects are an instance of Olayer
.
Access
The LayerObject assigned to an element can be accessed and set with these BaseList2D functions:
Layers are organized in a tree. The root element of that tree is stored in the BaseDocument:
if (layers == nullptr)
if (layer != nullptr)
String GetName() const
Definition: c4d_baselist.h:2544
GeListNode * GetFirst()
Definition: c4d_baselist.h:2266
#define ApplicationOutput(formatString,...)
Definition: debugdiagnostics.h:204
- Note
- To check if a given LayerObject is currently selected in the Layer Manager, read the bit BIT_ACTIVE.
Allocation/Deallocation
LayerObject objects are created with the usual tools:
if (root == nullptr)
if (newLayer == nullptr)
newLayer->
SetName(
"This is a new layer"_s);
object->SetLayerObject(newLayer);
Navigation
LayerObject objects are based on GeListNode and are organized in a tree. This tree can be navigated with:
if (object == nullptr)
if (layer != nullptr)
{
while (parentLayer->
GetUp())
{
parentLayer = parentLayer->
GetUp();
}
}
Bool SetLayerObject(const LayerObject *layer)
LayerObject * GetLayerObject(const BaseDocument *doc)
Definition: c4d_baselist.h:2823
Definition: c4d_baseobject.h:248
LayerObject * GetUp()
Definition: c4d_basedocument.h:295
- Note
- If a layer is folded in the Layer Manager is controlled with the bit BIT_OFOLD.
LayerData
A LayerData object represents the settings of a layer.
Access
The applied layer settings of an element are accessed with these BaseList2D functions:
These functions can be used on the given element or on a LayerObject object.
const LayerData*
const layerData =
object->GetLayerData(
doc,
true);
if (layerData != nullptr)
{
}
static String VectorToString(const Vector32 &v, Int32 nnk=-1)
Definition: c4d_string.h:573
Properties
These are the properties of a layer stored in a LayerData object. These properties define how a layer changes the behavior of an element that is assigned to that layer:
if (root == nullptr)
if (newLayer == nullptr)
if (objects == nullptr)
for (
Int32 i = 0;
i < objects->GetCount(); ++
i)
{
if (object == nullptr)
object->SetLayerObject(newLayer);
}
Definition: ge_autoptr.h:37
Bool locked
Not selectable and no modification possible, grayed out in Object Manager.
Definition: c4d_basedocument.h:355
- Note
- When one edits the solo bit it is also necessary to change the NBIT::SOLO_LAYER of the BaseDocument with GeListNode::ChangeNBit() either using NBITCONTROL::SET or NBITCONTROL:: CLEAR.
Utility
- IsObjectEnabled(): Checks if the given object should be visible in the viewport, including checking the layers.
Further Reading