ObjectData Class Reference

#include <c4d_objectdata.h>

Inheritance diagram for ObjectData:

详细描述

A data class for creating object plugins.
An object plugin can either be a generator, a modifier, a spline generator or a particle modifier. This is set when the object is registered and affects which functions are called.

使用 RegisterObjectPlugin() to register an object plugin.

注意
Be sure to read the new information about BaseObject::GetUniqueIP if a generator is created.

Dimension

virtual void  GetDimension ( BaseObject *op, 向量 *mp, 向量 *rad)

Draw

virtual DRAWRESULT   Draw ( BaseObject *op, DRAWPASS drawpass, BaseDraw *bd, BaseDrawHelp *bh)
virtual DRAWRESULT   DrawShadow ( BaseObject *op, BaseDraw *bd, BaseDrawHelp *bh)

Handle

virtual Int32   DetectHandle ( BaseObject *op, BaseDraw *bd, Int32 x, Int32 y, QUALIFIER qualifier)
virtual Bool   MoveHandle ( BaseObject *op, BaseObject *undo, const 向量 &mouse_pos, Int32 hit_id, QUALIFIER qualifier, BaseDraw *bd)

Execution

virtual Bool   AddToExecution ( BaseObject *op, PriorityList *list)
virtual EXECUTIONRESULT   Execute ( BaseObject *op, BaseDocument *doc, BaseThread *bt, Int32 priority, EXECUTIONFLAGS flags)

Modeling Axis

virtual void  GetModelingAxis ( BaseObject *op, BaseDocument *doc, 矩阵 &axis)

生成器

virtual BaseObject GetVirtualObjects ( BaseObject *op, HierarchyHelp *hh)

Modifier

virtual Bool   ModifyObject ( BaseObject *mod, BaseDocument *doc, BaseObject *op, const 矩阵 &op_mg, const 矩阵 &mod_mg, Float lod, Int32 flags, BaseThread *thread)
virtual void  CheckDirty ( BaseObject *op, BaseDocument *doc)

样条线

virtual SplineObject GetContour ( BaseObject *op, BaseDocument *doc, Float lod, BaseThread *bt)

Particle

virtual void  ModifyParticles ( BaseObject *op, Particle *pp, BaseParticle *ss, Int32 pcnt, Float diff)

Automated Handle Interface

virtual Int32   GetHandleCount ( BaseObject *op)
virtual void  GetHandle ( BaseObject *op, Int32 i, HandleInfo &info)
virtual void  SetHandle ( BaseObject *op, Int32 i, 向量 p, const HandleInfo &info)

Additional Inherited Members

-  Public Member Functions inherited from NodeData
  NodeData ()
GeListNode Get (void) const
virtual Bool   消息 ( GeListNode *node, Int32 type, void *data)
virtual void  GetBubbleHelp ( GeListNode *node, maxon::String &str)
virtual BaseDocument GetDocument ( GeListNode *node)
virtual Int32   GetBranchInfo ( GeListNode *node, BranchInfo *info, Int32 max, GETBRANCHINFO flags)
virtual Bool   IsInstanceOf (const GeListNode *node, Int32 type) const
virtual Bool   IsDocumentRelated (const GeListNode *node, Bool &docrelated) const
virtual Bool   Init ( GeListNode *node)
virtual void  Free ( GeListNode *node)
virtual Bool   读取 ( GeListNode *node, HyperFile *hf, Int32 level)
virtual Bool   Write ( GeListNode *node, HyperFile *hf)
virtual Bool   CopyTo ( NodeData *dest, GeListNode *snode, GeListNode *dnode, COPYFLAGS flags, AliasTrans *trn)
virtual Bool   GetDDescription ( GeListNode *node, 描述 *description, DESCFLAGS_DESC &flags)
virtual Bool   GetDParameter ( GeListNode *node, const DescID &id, GeData &t_data, DESCFLAGS_GET &flags)
virtual Bool   SetDParameter ( GeListNode *node, const DescID &id, const GeData &t_data, DESCFLAGS_SET &flags)
virtual Bool   GetDEnabling ( GeListNode *node, const DescID &id, const GeData &t_data, DESCFLAGS_ENABLE flags, const BaseContainer *itemdesc)
virtual Bool   TranslateDescID ( GeListNode *node, const DescID &id, DescID &res_id, C4DAtom *&res_at)
-  Public Member Functions inherited from BaseData
  BaseData ()
virtual  ~BaseData (void)
void  Destructor (void)
-  Protected Attributes inherited from NodeData
GeListNode private_link

成员函数文档编制

◆  GetDimension()

virtual void GetDimension ( BaseObject op ,
向量 mp ,
向量 rad  
)
virtual

Called to get the boundaries of the object.

注意
GetDimension() should be implemented for objects of types Opolygon , Opoint , Oline and Ospline . Furthermore it may be implemented to override Cinema 4D 's default handling of bounding boxes.
参数
[in] op The BaseObject connected with the ObjectData instance. Equal to static_cast < BaseObject *> Get() . Provided for speed and convenience. Cinema 4D owns the pointed object.
[out] mp Assign the center point of the bounding box.
[out] rad Assign the XYZ bounding box radius.

Reimplemented in EffectorData .

◆  Draw()

virtual DRAWRESULT Draw ( BaseObject op ,
DRAWPASS   drawpass ,
BaseDraw bd ,
BaseDrawHelp bh  
)
virtual

Called to draw additional information for the object in the editor view.
Be sure to call the parent version as last return:

return SUPER::Draw(op, drawpass, bd, bh);
注意
Generator objects are automatically drawn as GetVirtualObjects() returns the polygonal data already.
警告
Only draw in DRAWPASS::HIGHLIGHTS if you really know what you are doing. Otherwise always check the drawpass and then do not draw if it is DRAWPASS::HIGHLIGHTS.
Only draw the object in DRAWPASS::OBJECT . The object's appearance may change if the same object is drawn in multiple passes.
参数
[in] op The BaseObject connected with the ObjectData instance. Equal to static_cast < BaseObject *> Get() . Provided for speed and convenience. Cinema 4D owns the pointed object.
[in] drawpass The draw pass: DRAWPASS
[in] bd The editor's view. The caller owns the pointed view.
[in] bh The helper for the editor's view. The caller owns the pointed view helper.
返回
The result of drawing into the editor view: DRAWRESULT

Reimplemented in EffectorData .

◆  DrawShadow()

virtual DRAWRESULT DrawShadow ( BaseObject op ,
BaseDraw bd ,
BaseDrawHelp bh  
)
virtual

Called during the shadow pass instead of the Draw() 方法。

参数
[in] op The BaseObject connected with the ObjectData instance. Equal to static_cast < BaseObject *> Get() . Provided for speed and convenience. Cinema 4D owns the pointed object.
[in] bd The editor's view. The caller owns the pointed view.
[in] bh The helper for the editor's view. The caller owns the pointed view helper.
返回
The result of drawing into the editor view: DRAWRESULT

◆  DetectHandle()

virtual Int32 DetectHandle ( BaseObject op ,
BaseDraw bd ,
Int32   x ,
Int32   y ,
QUALIFIER   qualifier  
)
virtual

Called to manually detect a click on a handle.

注意
It is only needed to override DetectHandle if GetHandleCount / GetHandle / SetHandle automated handle interface functions are not overridden.
参数
[in] op The BaseObject connected with the ObjectData instance. Equal to static_cast < BaseObject *> Get() . Provided for speed and convenience. Cinema 4D owns the pointed object.
[in] bd The editor's view. The caller owns the pointed view.
[in] x The mouse X coordinate.
[in] y The mouse Y coordinate.
[in] qualifier The qualifier keys that were pressed: QUALIFIER
返回
The handle ID that is to be passed to MoveHandle .

◆  MoveHandle()

virtual Bool MoveHandle ( BaseObject op ,
BaseObject undo ,
const 向量 mouse_pos ,
Int32   hit_id ,
QUALIFIER   qualifier ,
BaseDraw bd  
)
virtual

Called to move a handle manually.

注意
It is only needed to override MoveHandle if GetHandleCount / GetHandle / SetHandle automated handle interface functions are not overridden.
参数
[in] op The BaseObject connected with the ObjectData instance. Equal to static_cast < BaseObject *> Get() . Provided for speed and convenience. Cinema 4D owns the pointed object.
[in] undo This is a copy of the object that should not be modified during the move handle. Cinema 4D owns the pointed object.
[in] mouse_pos The mouse position.
[in] hit_id The handle ID returned from DetectHandle() .
[in] qualifier The qualifier keys that were pressed: QUALIFIER
[in] bd The editor's view. The caller owns the pointed view.
返回
true if the handle was moved, otherwise false .

◆  AddToExecution()

virtual Bool AddToExecution ( BaseObject op ,
PriorityList list  
)
virtual

Called to add execution priorities.
By default returns false . In that case Cinema 4D will call Execute() at the priority specified by the user in the EXPRESSION_PRIORITY parameter of the container.
If overridden then insert points of execution in the list and return true . Heres is an example:

list->Add(op, EXECUTIONPRIORITY_ANIMATION , EXECUTIONFLAGS::NONE ); list->Add(op, EXECUTIONPRIORITY_GENERATOR , EXECUTIONFLAGS::NONE );

Cinema 4D will then call Execute() 2 times.

参数
[in] op The BaseObject connected with the ObjectData instance. Equal to static_cast < BaseObject *> Get() . Provided for speed and convenience. Cinema 4D owns the pointed object.
[in] list The priority list to add execution points to. Cinema 4D owns the pointed priority list.
返回
true if priority was added to the execution list, otherwise false .

Reimplemented in EffectorData .

◆  Execute()

virtual EXECUTIONRESULT Execute ( BaseObject op ,
BaseDocument doc ,
BaseThread bt ,
Int32   priority ,
EXECUTIONFLAGS   flags  
)
virtual

Called at the point in the priority pipeline specified by AddToExecution , or the lack thereof.

注意
This function is called in a thread context. See the important information about threading.
参数
[in] op The BaseObject connected with the ObjectData instance. Equal to static_cast < BaseObject *> Get() . Provided for speed and convenience. Cinema 4D owns the pointed object.
[in] doc The host document of the object. Cinema 4D owns the pointed document.
[in] bt The calling thread. Can be nullptr . Cinema 4D owns the pointed thread.
[in] priority The priority of the call to Execute() in the pipeline: EXECUTIONPRIORITY
[in] flags The execution flags: EXECUTIONFLAGS
返回
The execution result: EXECUTIONRESULT

Reimplemented in EffectorData .

◆  GetModelingAxis()

virtual void GetModelingAxis ( BaseObject op ,
BaseDocument doc ,
矩阵 axis  
)
virtual

Called to return the modeling axis for the object.
The value given here will be returned by BaseObject::GetModelingAxis . No built-in tools currently use this, as plugin objects are not editable. Only the camera will use it when in an editing mode.

参数
[in] op The BaseObject connected with the ObjectData instance. Equal to static_cast < BaseObject *> Get() . Provided for speed and convenience. Cinema 4D owns the pointed object.
[in] doc The host document of the object. Cinema 4D owns the pointed document.
[out] axis Assign the modeling axis.

◆  GetVirtualObjects()

virtual BaseObject * GetVirtualObjects ( BaseObject op ,
HierarchyHelp hh  
)
virtual

Called to get an object chain for a generator object.

注意
This function is called in a thread context. See the important information about threading.
警告
Must not be overridden for non-generator objects.
参数
[in] op The BaseObject connected with the ObjectData instance. Equal to static_cast < BaseObject *> Get() . Provided for speed and convenience. Cinema 4D owns the pointed object.
[in] hh A hierarchy helper for the operation. The caller owns the pointed hierarchy helper.
返回
The newly allocated object chain, or nullptr if a memory error occurred.
If the generator does not produce any output (e.g. when the user chose wrong settings) it must at least return an (empty) Onull object, otherwise Cinema 4D will try to rebuild the cache again and again.
Only return nullptr in the case of a memory error.
An exception to this rule are generators with OBJECT flag OBJECT_INPUT set. If there is no input object, then such generators need to return nullptr as well.

◆  ModifyObject()

virtual Bool ModifyObject ( BaseObject mod ,
BaseDocument doc ,
BaseObject op ,
const 矩阵 op_mg ,
const 矩阵 mod_mg ,
Float   lod ,
Int32   flags ,
BaseThread thread  
)
virtual

Called to modify the passed object.

注意
This function is called in a thread context. See the important information about threading.
警告
Must not be overridden for non-modifier objects.
参数
[in] mod The BaseObject connected with the ObjectData instance. Equal to static_cast < BaseObject *> Get() . Provided for speed and convenience. Cinema 4D owns the pointed object.
[in] doc The document containing the object to modify. Cinema 4D owns the pointed document.
[in,out] op The object to modify. Cinema 4D owns the pointed object.
[in] op_mg The object's world matrix.
[in] mod_mg The modifier object's world matrix.
[in] lod The level of detail.
[in] flags Currently unused.
[in] thread The calling thread. Can be nullptr . Cinema 4D owns the pointed thread.
返回
true if the object was modified, otherwise false .

Reimplemented in EffectorData .

◆  CheckDirty()

virtual void CheckDirty ( BaseObject op ,
BaseDocument doc  
)
virtual

Called to check for a change in a deformer object manually.
For example this will make a deformer update every frame:

void CheckDirty ( BaseObject *op, BaseDocument *doc) { if (doc-> GetTime ()!=cached_time) { cached_time = doc-> GetTime (); op-> SetDirty ( DIRTYFLAGS::DATA ); } }
注意
This function is called in a thread context. See the important information about threading.
参数
[in] op The BaseObject connected with the ObjectData instance. Equal to static_cast < BaseObject *> Get() . Provided for speed and convenience. Cinema 4D owns the pointed object.
[in] doc The document containing the object to modify. Cinema 4D owns the pointed document.

◆  GetContour()

virtual SplineObject * GetContour ( BaseObject op ,
BaseDocument doc ,
Float   lod ,
BaseThread bt  
)
virtual

Called to return a spline contour.

注意
This function is called in a thread context. See the important information about threading.
警告
Must not be overridden for non-spline objects.
参数
[in] op The BaseObject connected with the ObjectData instance. Equal to static_cast < BaseObject *> Get() . Provided for speed and convenience. Cinema 4D owns the pointed object.
[in] doc The document containing the object to modify. Cinema 4D owns the pointed document.
[in] lod The level of detail.
[in] bt The calling thread. Can be nullptr . Cinema 4D owns the pointed thread.
返回
The spline contour.
If the generator does not produce any output (e.g. when the user chose wrong settings) it must at least return an (empty) Onull object, otherwise Cinema 4D will try to rebuild the cache again and again.
Only return nullptr in the case of a memory error.

◆  ModifyParticles()

virtual void ModifyParticles ( BaseObject op ,
Particle pp ,
BaseParticle ss ,
Int32   pcnt ,
Float   diff  
)
virtual

Called to modify particles.

注意
This function is called in a thread context. See the important information about threading.
参数
[in] op The BaseObject connected with the ObjectData instance. Equal to static_cast < BaseObject *> Get() . Provided for speed and convenience. Cinema 4D owns the pointed object.
[in] pp The initial element of the Particle array. The caller owns the pointed array.
This array is used to read the particles information and should not be modified.
[out] ss The initial element of the BaseParticle array.
Modify the elements in this array to change the velocity of the particles. The caller owns the pointed array.
[in] pcnt The number of particles in the pp and ss arrays.
[in] diff The time delta for the particles movement in seconds. Usually the difference in time between two frames, but this can be different for such functions as motion blur.

◆  GetHandleCount()

virtual Int32 GetHandleCount ( BaseObject op )
virtual

Called to get the number of handles the object has.
Part of the automated handle interface.

另请参阅
HandleInfo .
参数
[in] op The BaseObject connected with the ObjectData instance. Equal to static_cast < BaseObject *> Get() . Provided for speed and convenience. Cinema 4D owns the pointed object.
返回
The number of handles for the object.

Reimplemented in EffectorData .

◆  GetHandle()

virtual void GetHandle ( BaseObject op ,
Int32   i ,
HandleInfo info  
)
virtual

Called to get the information for handle i .
Part of the automated handle interface.

另请参阅
HandleInfo .
参数
[in] op The BaseObject connected with the ObjectData instance. Equal to static_cast < BaseObject *> Get() . Provided for speed and convenience. Cinema 4D owns the pointed object.
[in] i The handle index.
[in,out] info Fill with the handle information.

Reimplemented in EffectorData .

◆  SetHandle()

virtual void SetHandle ( BaseObject op ,
Int32   i ,
向量   p ,
const HandleInfo info  
)
virtual

Called to set the information for handle i .
Called when the user has moved handle i to position p . Update the object's internal data accordingly (e.g. parameter values etc.).
Part of the automated handle interface.

另请参阅
HandleInfo .
参数
[in] op The BaseObject connected with the ObjectData instance. Equal to static_cast < BaseObject *> Get() . Provided for speed and convenience. Cinema 4D owns the pointed object.
[in] i The handle index.
[in] p The handle's position.
[in] info The handle information.

Reimplemented in EffectorData .

EXECUTIONFLAGS::NONE
@ NONE
None.
DIRTYFLAGS::DATA
@ DATA
Container changed.
BaseObject
定义: c4d_baseobject.h:224
EXECUTIONPRIORITY_ANIMATION
#define EXECUTIONPRIORITY_ANIMATION
Animation.
定义: ge_prepass.h:3623
EXECUTIONPRIORITY_GENERATOR
#define EXECUTIONPRIORITY_GENERATOR
Generators.
定义: ge_prepass.h:3627
BaseDocument::GetTime
BaseTime GetTime(void) const
ObjectData::CheckDirty
virtual void CheckDirty(BaseObject *op, BaseDocument *doc)
BaseDocument
定义: c4d_basedocument.h:490
BaseObject::SetDirty
void SetDirty(DIRTYFLAGS flags)
定义: c4d_baseobject.h:897