一般插件信息手册

内容表

关于

Custom plugin classes are added to Cinema 4D using plugin hooks. A plugin class is derived from a base class and implements its virtual functions.

警告
MAXON API plugin classes are based on interfaces. See 接口基础 .

插件类

This is how a typical plugin class looks like:

// A simple example generator object plugin class.
class ExampleGenerator : public ObjectData { INSTANCEOF (ExampleGenerator, ObjectData )
public : static NodeData * Alloc( void ) { return NewObjClear(ExampleGenerator); } virtual Bool Init ( GeListNode *node) { return true ; } virtual BaseObject * GetVirtualObjects ( BaseObject * op, HierarchyHelp * hh) { return BaseObject::Alloc ( Onull ); } virtual Bool 消息 ( GeListNode * node, Int32 type, void * data) { return SUPER::Message(node, type, data); } };

配准

Cinema 4D has to be informed about the new plugin class. This is typically done using a "Register" function. Examples are:

Such "Register" functions are typically used in a plugin's PluginStart() 函数。见 PluginStart .

RegisterObjectPlugin (123456, "Example Generator" , OBJECT_GENERATOR , ExampleGenerator::Alloc, "Oexamplegenerator" , nullptr , 0);

The arguments of a "Register" function vary from type to type but usually are:

These flags can be used in the "Register" function of all NodeData based plugin classes:

ShaderData plugins can be placed in the "Effects" or "Surfaces" submenu, MaterialData plugins can be placed in the "Shaders" menu. To place them there the category name has to be added to the plugin name that is used with the "Register" function.

基本类和插件类

Many plugin classes are based on NodeData . But typical Cinema 4D classes are based on C4DAtom , GeListNode and BaseList2D NodeData based plugin class is used as the "core" of such C4DAtom based class and implements its functionality.

The NodeData "core" can be obtained from objects and within a NodeData based plugin class it is possible to get the corresponding GeListNode .

For convenience the corresponding GeListNode is also handed over in the virtual functions of NodeData .

The corresponding functions are:

NodeData C4DAtom / GeListNode / BaseList2D
NodeData::Message() C4DAtom::Message()
NodeData::GetDEnabling() C4DAtom::GetEnabling()
NodeData::GetDDescription() C4DAtom::GetDescription()
NodeData::SetDParameter() C4DAtom::SetParameter()
NodeData::GetDParameter() C4DAtom::GetParameter()
NodeData::Read() C4DAtom::Read()
NodeData::Write() C4DAtom::Write()
NodeData::CopyTo() C4DAtom::CopyTo()
NodeData::IsInstanceOf() C4DAtom::IsInstanceOf()
NodeData::TranslateDescID() C4DAtom::TranslateDescID()
NodeData::GetDocument() GeListNode::GetDocument()
NodeData::GetBranchInfo() GeListNode::GetBranchInfo()
NodeData::IsDocumentRelated() GeListNode::IsDocumentRelated()
NodeData::GetBubbleHelp() BaseList2D::GetBubbleHelp()
注意
While most elements of the classic Cinema 4D API are build with the API and return a NodeData based class, some elements are not based on NodeData (like GUI elements).

延伸阅读

HierarchyHelp
定义: c4d_baseobject.h:179
NodeData::Init
virtual Bool Init(GeListNode *node)
NodeData::Message
virtual Bool Message(GeListNode *node, Int32 type, void *data)
BaseObject
定义: c4d_baseobject.h:224
ObjectData
定义: c4d_objectdata.h:168
Onull
#define Onull
Null.
定义: ge_prepass.h:1009
NodeData
定义: c4d_nodedata.h:38
GeListNode
Represents a C4DAtom that resides in a 4D list.
定义: c4d_baselist.h:1767
INSTANCEOF
#define INSTANCEOF(X, Y)
定义: c4d_baselist.h:38
Int32
maxon::Int32 Int32
定义: ge_sys_math.h:58
RegisterObjectPlugin
Bool RegisterObjectPlugin(Int32 id, const maxon::String &str, Int32 info, DataAllocator *g, const maxon::String &description, BaseBitmap *icon, Int32 disklevel)
ObjectData::GetVirtualObjects
virtual BaseObject * GetVirtualObjects(BaseObject *op, HierarchyHelp *hh)
BaseObject::Alloc
static BaseObject * Alloc(Int32 type)
Bool
maxon::Bool Bool
定义: ge_sys_math.h:53
OBJECT_GENERATOR
#define OBJECT_GENERATOR
Generator object. Produces a polygonal or spline representation on its own. (e.g. primitive cube)
定义: ge_prepass.h:893

Copyright  © 2014-2025 乐数软件    

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