Open Search
    C4DObjectList Class Reference

    #include <lib_editortools.h>

    Detailed Description

    A class representing a set of objects in the editor.
    Most often allocate a copy of this object and then let SelectionListCreate() fill it.

    Note
    Has to be created with Alloc() and destroyed with Free(). Use AutoAlloc to automate the allocation and destruction based on scope.

    Private Member Functions

     C4DObjectList ()
     
     ~C4DObjectList ()
     

    Alloc/Free

    static C4DObjectListAlloc ()
     
    static void Free (C4DObjectList *&ptr)
     

    Object List

    Int32 GetCount ()
     
    BaseObjectGetObject (Int32 num)
     
    Float GetZ (Int32 num)
     
    Int32 GetPolyIdx (Int32 num)
     
    Bool AddObject (BaseObject *op, Float z, Int32 polynum)
     
    void Flush ()
     

    Constructor & Destructor Documentation

    ◆ C4DObjectList()

    C4DObjectList ( )
    private

    ◆ ~C4DObjectList()

    ~C4DObjectList ( )
    private

    Member Function Documentation

    ◆ Alloc()

    static C4DObjectList* Alloc ( )
    static

    Allocates an object list. Destroy the allocated object list with Free(). Use AutoAlloc to automate the allocation and destruction based on scope.

    Returns
    The allocated object list, or nullptr if the allocation failed.

    ◆ Free()

    static void Free ( C4DObjectList *&  ptr)
    static

    Destructs object lists allocated with Alloc(). Use AutoAlloc to automate the allocation and destruction based on scope.

    Parameters
    [in,out]ptrThe object list to destruct. If the pointer is nullptr nothing happens. The pointer is assigned nullptr afterwards.

    ◆ GetCount()

    Int32 GetCount ( )

    Get the number of objects stored in the list.

    Returns
    The number of objects.

    ◆ GetObject()

    BaseObject* GetObject ( Int32  num)

    Gets a stored object pointer by index.

    Parameters
    [in]numAn object index: 0 <= num < GetCount()
    Returns
    The object at index num. Cinema 4D owns the pointed object.

    ◆ GetZ()

    Float GetZ ( Int32  num)

    Gets the Z distance to a stored object by index.

    Parameters
    [in]numAn object index: 0 <= num < GetCount()
    Returns
    The Z distance to the object at index num.

    ◆ GetPolyIdx()

    Int32 GetPolyIdx ( Int32  num)

    Gets the polygon index of a stored object by index.

    Parameters
    [in]numAn object index: 0 <= num < GetCount()
    Returns
    The polygon index.

    ◆ AddObject()

    Bool AddObject ( BaseObject op,
    Float  z,
    Int32  polynum 
    )

    Adds an object to the list at a certain Z distance.

    Parameters
    [in]opThe object to add. The caller owns the pointed object.
    [in]zThe Z distance to op.
    [in]polynumThe number of polygons.
    Returns
    true if successful, otherwise false.

    ◆ Flush()

    void Flush ( )

    Clears the object list.