About
The class GeListNode is based on C4DAtom and is a base class for many entities of the classic Cinema 4D API. It mostly provides the functionality to organize elements in linked lists and trees.
GeListNode objects are an instance of Tgelistnode
.
Access
NodeData::Get() is rarely needed, as a pointer to a GeListNode is typically handed over to virtual functions of NodeData and derived classes:
{
{
{
break;
}
Represents a C4DAtom that resides in a 4D list.
Definition: c4d_baselist.h:1831
maxon::Bool Bool
Definition: ge_sys_math.h:55
maxon::Int32 Int32
Definition: ge_sys_math.h:60
#define MSG_UPDATE
Must be sent if the bounding box has to be recalculated. (Otherwise use MSG_CHANGE....
Definition: c4d_baselist.h:358
PyObject ** type
Definition: pycore_pyerrors.h:34
GeListNode is also used in the context of object hierarchies with GeListHead elements.
Allocation/Deallocation
It is possible to create a GeListNode instance of a RegisterNodePlugin() registered node with
- Note
- These functions are typically not used with third party plugins. They are only useful to handle custom NodeData plugins.
python += "print(\"this is python\")";
Definition: c4d_basecontainer.h:47
void SetString(Int32 id, const maxon::String &s)
Definition: c4d_basecontainer.h:569
Definition: c4d_baselist.h:2208
Definition: c4d_string.h:39
#define ID_PYTHONSCRIPT
Definition: ge_prepass.h:5062
#define MSG_SCRIPT_EXECUTE
Execute the script. (No arguments.)
Definition: ge_prepass.h:5112
#define PYTHONSCRIPT_TEXT
String Script.
Definition: ge_prepass.h:5123
#define MAXON_SOURCE_LOCATION
Definition: memoryallocationbase.h:67
#define blDelete(v)
Destructs objects derived from BaseList2D. It is basically the same as BaseList2D::Free().
Definition: c4d_baselist.h:2892
GeListNode * AllocListNode(Int32 id)
PyObject * op
Definition: object.h:520
Lists and Trees
Navigation in Lists and Trees
GeListNode based elements can be organized in lists and trees. A GeListNode based entity can reference the accompanying elements in that hierarchy. If no element is referenced, nullptr
is returned.
- Note
- Derived classes often provide overwritten versions of these functions for convenience.
The typical Cinema 4D workflow would be:
for (
BaseTag* tag =
object->GetFirstTag(); tag; tag = tag->GetNext())
{
}
Definition: c4d_basetag.h:48
#define ApplicationOutput(formatString,...)
Definition: debugdiagnostics.h:210
and
{
{
{
}
WalkTreeRec(
node->GetDown());
}
}
String GetName() const
Definition: c4d_baselist.h:2381
#define Tbaselist2d
2D list.
Definition: ge_prepass.h:986
- Note
- Avoid unnecessary recursion to prevent a stack overflow.
Edit Lists and Trees
A given GeListNode can be inserted into a list or tree or it can be removed from that list or tree:
- Note
- If a GeListNode is supposed to be deleted it must be removed from its list before.
-
At any given time a GeListNode can only be inserted into one single list or tree. Before inserting a node into a new list, make sure to remove it from the old one.
if (parentObject == nullptr)
doc->InsertObject(selectedObject, parentParent,
nullptr);
Definition: c4d_baseobject.h:225
BaseObject * GetUp()
Definition: c4d_baseobject.h:268
void Remove()
Definition: c4d_baselist.h:1917
void InsertUnder(GeListNode *bl)
Definition: c4d_baselist.h:1898
const char * doc
Definition: pyerrors.h:226
Heads and Branches
A GeListHead element is used as the root of a list or tree:
See GeListHead Manual.
A given GeListNode can host multiple internal lists and trees by storing multiple GeListHead objects, called branches. For example the list of tags is a branch of BaseObject. These branches can be accessed with this function:
Valid flags are:
The used BranchInfo struct has the following members:
The branch flags are:
{
if (branchHead != nullptr)
{
{
}
}
}
Py_ssize_t i
Definition: abstract.h:645
Bool IsInstanceOf(Int32 id) const
Definition: c4d_baselist.h:1436
Definition: c4d_baselist.h:2044
GeListNode * GetFirst()
Definition: c4d_baselist.h:2100
static String IntToString(Int32 v)
Definition: c4d_string.h:495
_Py_clock_info_t * info
Definition: pytime.h:197
Definition: c4d_baselist.h:1216
NodeData
The base class for most classic plugins is NodeData. NodeData based plugin classes build the "core" of any plugin based entity of the classic Cinema 4D API. This "core" class can be obtained with:
See also Basic Classes and Plugin Classes.
if (selectedObject->GetType() == g_exampleGeneratorID)
{
ExampleGenerator* const exampleGenerator = selectedObject->GetNodeData<ExampleGenerator>();
if (exampleGenerator)
{
exampleGenerator->MemberFunction();
}
}
- Warning
- It is only possible to cast the retrieved object into a specific class in the module where this class is defined.
-
Some components of Cinema 4D are not implemented as a plugin so there is no NodeData instance to access.
Document
GeListNode based objects can also be part of a BaseDocument:
- Warning
- Always check the returned document pointer for
nullptr
, as the element might not be part of any document.
{
{
{
}
}
}
Definition: c4d_basedocument.h:498
Definition: c4d_baselist.h:1395
Definition: c4d_gedata.h:83
C4DAtomGoal * GetLinkAtom(const BaseDocument *doc, Int32 instanceof=0) const
#define atom
Definition: graminit.h:72
Infos
Additional information can be accessed:
if (spline != nullptr)
#define ToSpline(op)
Casts a BaseObject* to a SplineObject*.
Definition: c4d_baseobject.h:2210
SplineObject * GetRealSpline()
Represents a spline object.
Definition: c4d_baseobject.h:2043
#define OBJECT_ISSPLINE
Spline object.
Definition: ge_prepass.h:943
#define Ospline
Spline - SplineObject.
Definition: ge_prepass.h:1033
NBits
Various settings of an element can be configured by changing a corresponding bit. A list of available bits is defined in NBIT.
The change operations are:
Further Reading