Open Search
    ObjectData Class Reference

    #include <c4d_objectdata.h>

    Inheritance diagram for ObjectData:

    Detailed Description

    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.

    Use RegisterObjectPlugin() to register an object plugin.

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

    Public Member Functions

    virtual void CheckDirty (BaseObject *op, BaseDocument *doc)
     
    - Public Member Functions inherited from NodeData
     NodeData ()
     
    GeListNodeGet (void) const
     
    virtual Bool Message (GeListNode *node, Int32 type, void *data)
     
    virtual void GetBubbleHelp (GeListNode *node, maxon::String &str)
     
    virtual BaseDocumentGetDocument (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 Read (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 *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)
     

    Dimension

    virtual void GetDimension (BaseObject *op, Vector *mp, Vector *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 Vector &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, Matrix &axis)
     

    Generator

    virtual BaseObjectGetVirtualObjects (BaseObject *op, HierarchyHelp *hh)
     

    Modifier

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

    Spline

    virtual SplineObjectGetContour (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, Vector p, const HandleInfo &info)
     

    Additional Inherited Members

    - Protected Attributes inherited from NodeData
    GeListNodeprivate_link
     

    Member Function Documentation

    ◆ GetDimension()

    virtual void GetDimension ( BaseObject op,
    Vector mp,
    Vector rad 
    )
    virtual

    Called to get the boundaries of the object.

    Note
    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.
    Parameters
    [in]opThe BaseObject connected with the ObjectData instance. Equal to static_cast<BaseObject*>Get(). Provided for speed and convenience. Cinema 4D owns the pointed object.
    [out]mpAssign the center point of the bounding box.
    [out]radAssign 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);
    PyObject * op
    Definition: object.h:520
    Note
    Generator objects are automatically drawn as GetVirtualObjects() returns the polygonal data already.
    Warning
    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.
    Parameters
    [in]opThe BaseObject connected with the ObjectData instance. Equal to static_cast<BaseObject*>Get(). Provided for speed and convenience. Cinema 4D owns the pointed object.
    [in]drawpassThe draw pass: DRAWPASS
    [in]bdThe editor's view. The caller owns the pointed view.
    [in]bhThe helper for the editor's view. The caller owns the pointed view helper.
    Returns
    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() method.

    Parameters
    [in]opThe BaseObject connected with the ObjectData instance. Equal to static_cast<BaseObject*>Get(). Provided for speed and convenience. Cinema 4D owns the pointed object.
    [in]bdThe editor's view. The caller owns the pointed view.
    [in]bhThe helper for the editor's view. The caller owns the pointed view helper.
    Returns
    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.

    Note
    It is only needed to override DetectHandle if GetHandleCount/ GetHandle/SetHandle automated handle interface functions are not overridden.
    Parameters
    [in]opThe BaseObject connected with the ObjectData instance. Equal to static_cast<BaseObject*>Get(). Provided for speed and convenience. Cinema 4D owns the pointed object.
    [in]bdThe editor's view. The caller owns the pointed view.
    [in]xThe mouse X coordinate.
    [in]yThe mouse Y coordinate.
    [in]qualifierThe qualifier keys that were pressed: QUALIFIER
    Returns
    The handle ID that is to be passed to MoveHandle.

    ◆ MoveHandle()

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

    Called to move a handle manually.

    Note
    It is only needed to override MoveHandle if GetHandleCount/ GetHandle/SetHandle automated handle interface functions are not overridden.
    Parameters
    [in]opThe BaseObject connected with the ObjectData instance. Equal to static_cast<BaseObject*>Get(). Provided for speed and convenience. Cinema 4D owns the pointed object.
    [in]undoThis is a copy of the object that should not be modified during the move handle. Cinema 4D owns the pointed object.
    [in]mouse_posThe mouse position.
    [in]hit_idThe handle ID returned from DetectHandle().
    [in]qualifierThe qualifier keys that were pressed: QUALIFIER
    [in]bdThe editor's view. The caller owns the pointed view.
    Returns
    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:

    #define EXECUTIONPRIORITY_ANIMATION
    Animation.
    Definition: ge_prepass.h:3877
    #define EXECUTIONPRIORITY_GENERATOR
    Generators.
    Definition: ge_prepass.h:3881
    PyWideStringList * list
    Definition: initconfig.h:447

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

    Parameters
    [in]opThe BaseObject connected with the ObjectData instance. Equal to static_cast<BaseObject*>Get(). Provided for speed and convenience. Cinema 4D owns the pointed object.
    [in]listThe priority list to add execution points to. Cinema 4D owns the pointed priority list.
    Returns
    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.

    Note
    This function is called in a thread context. See the important information about threading.
    Parameters
    [in]opThe BaseObject connected with the ObjectData instance. Equal to static_cast<BaseObject*>Get(). Provided for speed and convenience. Cinema 4D owns the pointed object.
    [in]docThe host document of the object. Cinema 4D owns the pointed document.
    [in]btThe calling thread. Can be nullptr. Cinema 4D owns the pointed thread.
    [in]priorityThe priority of the call to Execute() in the pipeline: EXECUTIONPRIORITY
    [in]flagsThe execution flags: EXECUTIONFLAGS
    Returns
    The execution result: EXECUTIONRESULT

    Reimplemented in EffectorData.

    ◆ GetModelingAxis()

    virtual void GetModelingAxis ( BaseObject op,
    BaseDocument doc,
    Matrix 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.

    Parameters
    [in]opThe BaseObject connected with the ObjectData instance. Equal to static_cast<BaseObject*>Get(). Provided for speed and convenience. Cinema 4D owns the pointed object.
    [in]docThe host document of the object. Cinema 4D owns the pointed document.
    [out]axisAssign the modeling axis.

    ◆ GetVirtualObjects()

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

    Called to get an object chain for a generator object.

    Note
    This function is called in a thread context. See the important information about threading.
    Warning
    Must not be overridden for non-generator objects.
    Parameters
    [in]opThe BaseObject connected with the ObjectData instance. Equal to static_cast<BaseObject*>Get(). Provided for speed and convenience. Cinema 4D owns the pointed object.
    [in]hhA hierarchy helper for the operation. The caller owns the pointed hierarchy helper.
    Returns
    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 Matrix op_mg,
    const Matrix mod_mg,
    Float  lod,
    Int32  flags,
    BaseThread thread 
    )
    virtual

    Called to modify the passed object.

    Note
    This function is called in a thread context. See the important information about threading.
    Warning
    Must not be overridden for non-modifier objects.
    Parameters
    [in]modThe BaseObject connected with the ObjectData instance. Equal to static_cast<BaseObject*>Get(). Provided for speed and convenience. Cinema 4D owns the pointed object.
    [in]docThe document containing the object to modify. Cinema 4D owns the pointed document.
    [in,out]opThe object to modify. Cinema 4D owns the pointed object.
    [in]op_mgThe object's world matrix.
    [in]mod_mgThe modifier object's world matrix.
    [in]lodThe level of detail.
    [in]flagsCurrently unused.
    [in]threadThe calling thread. Can be nullptr. Cinema 4D owns the pointed thread.
    Returns
    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 manually.
    For example this will update every frame:

    {
    if (doc->GetTime()!=cached_time)
    {
    cached_time = doc->GetTime();
    op->SetDirty(DIRTYFLAGS::DATA);
    }
    }
    Definition: c4d_basedocument.h:498
    Definition: c4d_baseobject.h:225
    virtual void CheckDirty(BaseObject *op, BaseDocument *doc)
    @ DATA
    Container changed.
    const char * doc
    Definition: pyerrors.h:226
    Note
    This function is called in a thread context. See the important information about threading.
    Parameters
    [in]opThe BaseObject connected with the ObjectData instance. Equal to static_cast<BaseObject*>Get(). Provided for speed and convenience. Cinema 4D owns the pointed object.
    [in]docThe 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.

    Note
    This function is called in a thread context. See the important information about threading.
    Warning
    Must not be overridden for non-spline objects.
    Parameters
    [in]opThe BaseObject connected with the ObjectData instance. Equal to static_cast<BaseObject*>Get(). Provided for speed and convenience. Cinema 4D owns the pointed object.
    [in]docThe document containing the object to modify. Cinema 4D owns the pointed document.
    [in]lodThe level of detail.
    [in]btThe calling thread. Can be nullptr. Cinema 4D owns the pointed thread.
    Returns
    The spline contour.
    Note
    If the generator does not produce any output (e.g. when the user chose wrong settings) it must at least return an (empty) Ospline 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.

    Note
    This function is called in a thread context. See the important information about threading.
    Parameters
    [in]opThe BaseObject connected with the ObjectData instance. Equal to static_cast<BaseObject*>Get(). Provided for speed and convenience. Cinema 4D owns the pointed object.
    [in]ppThe 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]ssThe 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]pcntThe number of particles in the pp and ss arrays.
    [in]diffThe 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.

    See also
    HandleInfo.
    Parameters
    [in]opThe BaseObject connected with the ObjectData instance. Equal to static_cast<BaseObject*>Get(). Provided for speed and convenience. Cinema 4D owns the pointed object.
    Returns
    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.

    See also
    HandleInfo.
    Parameters
    [in]opThe BaseObject connected with the ObjectData instance. Equal to static_cast<BaseObject*>Get(). Provided for speed and convenience. Cinema 4D owns the pointed object.
    [in]iThe handle index.
    [in,out]infoFill with the handle information.

    Reimplemented in EffectorData.

    ◆ SetHandle()

    virtual void SetHandle ( BaseObject op,
    Int32  i,
    Vector  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.

    See also
    HandleInfo.
    Parameters
    [in]opThe BaseObject connected with the ObjectData instance. Equal to static_cast<BaseObject*>Get(). Provided for speed and convenience. Cinema 4D owns the pointed object.
    [in]iThe handle index.
    [in]pThe handle's position.
    [in]infoThe handle information.

    Reimplemented in EffectorData.