BaseDocument Class Reference

#include <c4d_basedocument.h>

Inheritance diagram for BaseDocument:

Detailed Description

This class contains the complete description of a scene.

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

 BaseDocument ()
 
 ~BaseDocument ()
 

Alloc/Free/Flush

static BaseDocumentAlloc (void)
 
static void Free (BaseDocument *&bl)
 
void Flush (void)
 

Navigation

BaseDocumentGetNext (void)
 
BaseDocumentGetPred (void)
 

Data/Settings

BaseContainer GetData (DOCUMENTSETTINGS type)
 
void SetData (DOCUMENTSETTINGS type, const BaseContainer &bc)
 
BaseContainerGetSettingsInstance (Int32 type)
 
NetRenderDocumentContextGetNetRenderDocumentContext () const
 
void SetNetRenderDocumentContext (NetRenderDocumentContext *context)
 

Object/Material/Tag/Render Data

BaseObjectGetFirstObject (void)
 
BaseMaterialGetFirstMaterial (void)
 
RenderDataGetFirstRenderData (void)
 
void InsertObject (BaseObject *op, BaseObject *parent, BaseObject *pred, Bool checknames=false)
 
void InsertMaterial (BaseMaterial *mat, BaseMaterial *pred=nullptr, Bool checknames=false)
 
void InsertRenderData (RenderData *rd, RenderData *parent, RenderData *pred)
 
void InsertRenderDataLast (RenderData *rd)
 
BaseObjectGetActiveObject (void)
 
BaseMaterialGetActiveMaterial (void)
 
BaseTagGetActiveTag (void)
 
RenderDataGetActiveRenderData (void)
 
BaseObjectGetRealActiveObject (AtomArray *help, Bool *multi)
 
void GetActiveObjects (AtomArray &selection, GETACTIVEOBJECTFLAGS flags) const
 
void GetActivePolygonObjects (AtomArray &selection, Bool children) const
 
void GetActiveObjectsFilter (AtomArray &selection, Bool children, Int32 type, Int32 instanceof) const
 
void GetActiveMaterials (AtomArray &selection) const
 
void GetActiveTags (AtomArray &selection) const
 
void GetSelection (AtomArray &selection) const
 
void SetActiveObject (BaseObject *op, Int32 mode=0)
 
void SetActiveMaterial (BaseMaterial *mat, Int32 mode=0)
 
void SetActiveTag (BaseTag *tag, Int32 mode=0)
 
void SetActiveRenderData (RenderData *rd)
 
void SetSelection (BaseList2D *bl, Int32 mode=0)
 

Search Object/Material

BaseObjectSearchObject (const String &str)
 
BaseObjectSearchObjectInc (const String &str)
 
BaseMaterialSearchMaterial (const String &str)
 
BaseMaterialSearchMaterialInc (const String &str)
 

Changed State

Bool GetChanged (void)
 
void SetChanged (void)
 

Name/Path

Filename GetDocumentName (void)
 
Filename GetDocumentPath (void)
 
void SetDocumentName (const Filename &fn)
 
void SetDocumentPath (const Filename &path)
 

LOD

Float GetLOD (void)
 
void SetLOD (Float lod)
 
Bool GetRenderLod (void)
 
void SetRenderLod (Bool lod)
 

Time

BaseTime GetTime (void)
 
void SetTime (const BaseTime &t)
 
Int32 GetFps (void) const
 
void SetFps (Int32 fps)
 
BaseTime GetMinTime (void)
 
void SetMinTime (const BaseTime &t)
 
BaseTime GetMaxTime (void)
 
void SetMaxTime (const BaseTime &t)
 
BaseTime GetUsedMinTime (BaseList2D *check)
 
BaseTime GetUsedMaxTime (BaseList2D *check)
 
BaseTime GetLoopMinTime (void)
 
void SetLoopMinTime (const BaseTime &t)
 
BaseTime GetLoopMaxTime (void)
 
void SetLoopMaxTime (const BaseTime &t)
 

Mode/Action

Int32 GetMode (void)
 
void SetMode (Int32 m)
 
Bool IsEditMode (void)
 
Int32 GetAction (void)
 
void SetAction (Int32 a)
 

Undo

Bool StartUndo (void)
 
Bool EndUndo (void)
 
Bool AddUndo (UNDOTYPE type, void *data, Bool allowFromThread=false)
 
Bool AddUndo (BaseDraw *bd)
 
Bool DoUndo (Bool multiple=false)
 
Bool DoRedo (void)
 
void FlushUndoBuffer (void)
 
BaseList2DGetUndoPtr ()
 
BaseList2DFindUndoPtr (BaseList2D *bl, UNDOTYPE type)
 

Key

void AutoKey (BaseList2D *undo, BaseList2D *op, Bool recursive, Bool pos, Bool scale, Bool rot, Bool param, Bool pla)
 
Bool RecordKey (BaseList2D *op, const BaseTime &time, const DescID &id, BaseList2D *undo, Bool eval_attribmanager, Bool autokeying, Bool allow_linking)
 
void Record (void)
 

BaseDraw

BaseDrawGetActiveBaseDraw (void)
 
BaseDrawGetRenderBaseDraw (void)
 
BaseDrawGetBaseDraw (Int32 num)
 
Int32 GetBaseDrawCount ()
 
void ForceCreateBaseDraw (void)
 
Int32 GetDrawTime ()
 

Pick Session

const PickSessionDataStructGetPickSession () const
 
void StartPickSession (PickSessionDataStruct *psd)
 
void StopPickSession (Bool cancel)
 

Miscellaneous

void AnimateObject (BaseList2D *op, const BaseTime &time, ANIMATEFLAGS flags)
 
Bool ExecutePasses (BaseThread *bt, Bool animation, Bool expressions, Bool caches, BUILDFLAGS flags)
 
BaseDocumentPolygonize (Bool keepanimation=false)
 
Bool CollectSounds (BaseSound *snd, const BaseTime &from, const BaseTime &to)
 
BaseSceneHookFindSceneHook (Int32 id) const
 
Int32 GetSplinePlane (void)
 
GeListHeadGetLayerObjectRoot (void)
 
BaseContainer GetAllTextures (const AtomArray *ar)
 
BaseContainer GetAllTextures (Bool isNet, const AtomArray *ar)
 
BaseObjectGetHighest (Int32 type, Bool editor)
 
BaseBitmapGetDocPreviewBitmap ()
 
void GetHighlightedObjects (AtomArray &selection) const
 
void SetHighlightedObject (BaseObject *op, Int32 mode=0)
 
void SetHighlightedObjects (AtomArray &selection, Int32 mode=0)
 
Bool GetDefaultKey (CKey *pKey, Bool &bOverdub) const
 
void SetDefaultKey (CKey *pKey, Bool bOverdub)
 
Bool IsCacheBuilt (Bool force=false)
 
Bool IsAxisEnabled (void)
 
BaseObjectGetHelperAxis (void)
 
Bool HandleSelectedTextureFilename (BaseChannel *bc, const Filename &fn, Filename *resfilename, Bool undo, GEMB_R *already_answered)
 
Bool ReceiveMaterials (BaseObject *op, AtomArray *mat, Bool clearfirst)
 
Bool ReceiveNewTexture (BaseObject *op, const Filename &filename, Bool sdown, GEMB_R *already_answered)
 
void SendInfo (Int32 type, Int32 format, const Filename &fn, BaseList2D *bl, Bool hooks_only)
 
void RecordZero (void)
 
void RecordNoEvent (void)
 
void SetRewind (Int32 flags=0)
 

Take Data

TakeDataGetTakeData ()
 

Target Object

BaseObjectGetTargetObject () const
 
void SetTargetObject (BaseObject *op)
 

Additional Inherited Members

- Public Member Functions inherited from BaseList2D
BaseList2DGetNext (void)
 
BaseList2DGetPred (void)
 
void SetBit (Int32 mask)
 
Bool GetBit (Int32 mask) const
 
void DelBit (Int32 mask)
 
void ToggleBit (Int32 mask)
 
Int32 GetAllBits (void) const
 
void SetAllBits (Int32 bits)
 
BaseContainer GetData (void)
 
void SetData (const BaseContainer &bc, Bool add=true)
 
const BaseContainerGetDataInstance (void) const
 
BaseContainerGetDataInstance (void)
 
const BaseContainerGetDataInstanceRef (void) const
 
BaseContainerGetDataInstanceRef (void)
 
const StringGetName (void) const
 
void SetName (const String &name)
 
String GetBubbleHelp (void)
 
Bool TransferGoal (BaseList2D *dst, Bool undolink)
 
Bool TransferMarker (BaseList2D *dst) const
 
Bool Scale (Float scale)
 
Bool Edit (void)
 
void GetIcon (IconData *dat)
 
GeListHeadGetNLARoot (void)
 
BaseList2DAnimationLayerRemap (BaseObject **layer=nullptr)
 
const StringGetTypeName (void)
 
BaseList2DGetMain (void) const
 
void InsertTrackSorted (CTrack *track)
 
Bool AddEventNotification (BaseList2D *bl, NOTIFY_EVENT eventid, NOTIFY_EVENT_FLAG flags, const BaseContainer *data)
 
Bool RemoveEventNotification (BaseDocument *doc, BaseList2D *bl, NOTIFY_EVENT eventid)
 
Bool FindEventNotification (BaseDocument *doc, BaseList2D *bl, NOTIFY_EVENT eventid)
 
Bool SetDescIDState (const DescID &id, DESCIDSTATE descidstate)
 
DESCIDSTATE GetDescIDState (const DescID &id, Bool tolerant) const
 
GeListHeadGetOverrideRoot (void)
 
BaseOverrideGetFirstOverride (void)
 
GeListHeadGetShaderRepositoryRoot (void)
 
void GetMarkerStampEx (UInt32 *l1, UInt32 *l2)
 
const GeMarkerGetMarker (void) const
 
void SetMarker (const GeMarker &m)
 
Bool AddUniqueID (Int32 appid, const Char *const mem, Int bytes)
 
Bool FindUniqueID (Int32 appid, const Char *&mem, Int &bytes) const
 
Int32 GetUniqueIDCount () const
 
Bool GetUniqueIDIndex (Int32 idx, Int32 &id, const Char *&mem, Int &bytes) const
 
Bool SetAnimatedParameter (CTrack *track, const DescID &id, const GeData &t_data1, const GeData &t_data2, Float mix, DESCFLAGS_SET flags)
 
Bool GetAnimatedParameter (const DescID &id, GeData &t_data1, GeData &t_data2, Float &mix, DESCFLAGS_GET flags)
 
BaseShaderGetFirstShader () const
 
void InsertShader (BaseShader *shader, BaseShader *pred=nullptr)
 
void ClearKeyframeSelection ()
 
Bool FindKeyframeSelection (const DescID &id)
 
Bool SetKeyframeSelection (const DescID &id, Bool selection)
 
Bool KeyframeSelectionContent ()
 
LayerObjectGetLayerObject (BaseDocument *doc)
 
Bool SetLayerObject (LayerObject *layer)
 
const LayerDataGetLayerData (BaseDocument *doc, Bool rawdata=false)
 
Bool SetLayerData (BaseDocument *doc, const LayerData &data)
 
GeListHeadGetCTrackRoot (void)
 
CTrackGetFirstCTrack (void)
 
CTrackFindCTrack (const DescID &id)
 
- Public Member Functions inherited from GeListNode
GeListNodeGetNext (void)
 
GeListNodeGetPred (void)
 
GeListNodeGetDown (void)
 
GeListNodeGetUp (void)
 
GeListNodeGetDownLast (void)
 
void InsertBefore (GeListNode *bl)
 
void InsertAfter (GeListNode *bl)
 
void InsertUnder (GeListNode *bl)
 
void InsertUnderLast (GeListNode *bl)
 
void Remove (void)
 
GeListHeadGetListHead (void)
 
Int32 GetNodeID (Int32 index=0) const
 
template<typename CAST >
const CAST * GetNodeData (Int32 index=0) const
 
template<typename CAST >
CAST * GetNodeData (Int32 index=0)
 
void SetCustomData (GeListNode *node)
 
GeListNodeGetCustomData (void)
 
BaseDocumentGetDocument (void)
 
Int32 GetBranchInfo (BranchInfo *info, Int32 max, GETBRANCHINFO flags)
 
Bool IsDocumentRelated (void)
 
Int32 GetInfo (void)
 
Bool GetNBit (NBIT bit) const
 
Bool ChangeNBit (NBIT bit, NBITCONTROL bitmode)
 
- Public Member Functions inherited from C4DAtom
Int32 GetType (void) const
 
Int32 GetRealType (void) const
 
Int32 GetDiskType (void) const
 
Bool IsInstanceOf (Int32 id) const
 
Int32 GetClassification (void) const
 
Bool Message (Int32 type, void *data=nullptr)
 
Bool MultiMessage (MULTIMSG_ROUTE flags, Int32 type, void *data)
 
C4DAtomGetClone (COPYFLAGS flags, AliasTrans *trn)
 
Bool CopyTo (C4DAtom *dst, COPYFLAGS flags, AliasTrans *trn)
 
Bool Read (HyperFile *hf, Int32 id, Int32 level)
 
Bool Write (HyperFile *hf)
 
Bool ReadObject (HyperFile *hf, Bool readheader)
 
Bool WriteObject (HyperFile *hf)
 
Bool GetDescription (Description *description, DESCFLAGS_DESC flags)
 
Bool GetParameter (const DescID &id, GeData &t_data, DESCFLAGS_GET flags)
 
Bool SetParameter (const DescID &id, const GeData &t_data, DESCFLAGS_SET flags)
 
DynamicDescriptionGetDynamicDescription ()
 
Bool GetEnabling (const DescID &id, const GeData &t_data, DESCFLAGS_ENABLE flags, const BaseContainer *itemdesc)
 
Bool TranslateDescID (const DescID &id, DescID &res_id, C4DAtom *&res_at)
 
UInt32 GetDirty (DIRTYFLAGS flags) const
 
void SetDirty (DIRTYFLAGS flags)
 
UInt32 GetHDirty (HDIRTYFLAGS mask) const
 
void SetHDirty (HDIRTYFLAGS mask)
 
- Static Public Member Functions inherited from BaseList2D
static BaseList2DAlloc (Int32 type)
 
static void Free (BaseList2D *&bl)
 

Constructor & Destructor Documentation

§ BaseDocument()

BaseDocument ( )
private

§ ~BaseDocument()

~BaseDocument ( )
private

Member Function Documentation

§ Alloc()

static BaseDocument* Alloc ( void  )
static

Allocates a document. Destroy the allocated document with Free(). Use AutoAlloc to automate the allocation and destruction based on scope.

Returns
The allocated document, or nullptr if the allocation failed.

§ Free()

static void Free ( BaseDocument *&  bl)
static

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

Parameters
[in,out]blThe document to destruct. If the pointer is nullptr nothing happens. The pointer is assigned nullptr afterwards.

§ Flush()

void Flush ( void  )

Empties the document; deletes and frees all resources used.

§ GetNext()

BaseDocument* GetNext ( void  )

Gets the next document in the list. Convenience version of GeListNode::GetNext() returning a pointer to a BaseDocument.

Returns
The next document, or nullptr if there is none. Cinema 4D owns the pointed document.

§ GetPred()

BaseDocument* GetPred ( void  )

Gets the previous document in the list. Convenience version of GeListNode::GetNext() returning a pointer to a BaseDocument.

Returns
The previous document, or nullptr if there is none. Cinema 4D owns the pointed document.

§ GetData()

BaseContainer GetData ( DOCUMENTSETTINGS  type)

Gets the container settings of the specified type.

Parameters
[in]typeSelects the type of settings to get for the document: DOCUMENTSETTINGS
Returns
The settings for the document.

§ SetData()

void SetData ( DOCUMENTSETTINGS  type,
const BaseContainer bc 
)

Merges the container for the settings of the specified type.

Parameters
[in]typeSelects the type of settings to merge for the document: DOCUMENTSETTINGS
[in]bcThe container to take the new settings from.

§ GetSettingsInstance()

BaseContainer* GetSettingsInstance ( Int32  type)

Gets a pointer to the container settings of the specified type. Changes to the pointed container are reflected in the document so it is not needed to call SetData() manually.

Parameters
[in]typeSelects the type of settings to get for the document: DOCUMENTSETTINGS
Returns
The pointer to the settings container. The document owns the pointed container.

§ GetNetRenderDocumentContext()

NetRenderDocumentContext* GetNetRenderDocumentContext ( ) const

Retrieves a context on a client during a NET rendering.

Since
R16
Returns
The information about the current NET rendering. Cinema 4D owns the pointed structure.

§ SetNetRenderDocumentContext()

void SetNetRenderDocumentContext ( NetRenderDocumentContext context)

Sets the current context on a client during a NET rendering.

Since
R16
Parameters
[in]contextThe information about the current NET rendering. The caller owns the pointed structure.

§ GetFirstObject()

BaseObject* GetFirstObject ( void  )

Gets the first object of the document. The other objects in the document can be accessed with BaseObject::GetNext(), BaseObject::GetPred(), BaseObject::GetDown() etc.

Returns
The first object of the document, or nullptr if there are no objects in the document. The document owns the pointed object.

§ GetFirstMaterial()

BaseMaterial* GetFirstMaterial ( void  )

Gets the first material of the document. The other materials in the document can be accessed with BaseMaterial::GetNext() and BaseMaterial::GetPred().

Returns
The first material of the document, or nullptr if there are no materials in the document. The document owns the pointed material.

§ GetFirstRenderData()

RenderData* GetFirstRenderData ( void  )

Gets the first render data or options of the document. The other render settings in the document can be accessed by using the base class list functions, RenderData::GetNext(), RenderData::GetPred(), RenderData::GetDown() etc.

Returns
The first render data of the document, or nullptr if there are no render data associated with the document. The document owns the pointed render data.

§ InsertObject()

void InsertObject ( BaseObject op,
BaseObject parent,
BaseObject pred,
Bool  checknames = false 
)

Inserts the object into the document's object hierarchy.
Optionally the insertion position can either be specified by the parent parameter, inserting the object as the first child of the specified parent, or by the pred parameter, inserting the object below the specified pred object.
If neither is given, the object is inserted at the top of the hierarchy.

Note
If both parent and pred are provided then pred has precedence.
Parameters
[in]opThe object to insert into the document. The document takes over the ownership of the pointed object.
[in]parentAn optional parent object in the document to insert the object as a child of. Can be nullptr. The caller owns the pointed object.
[in]predAn optional object in the document to use as insertion point. The caller owns the pointed object.
[in]checknamesDeprecated.

§ InsertMaterial()

void InsertMaterial ( BaseMaterial mat,
BaseMaterial pred = nullptr,
Bool  checknames = false 
)

Inserts the material into the document's material list.
Optionally the insertion position can be specified by the pred parameter, giving the material before (just to the left of) the wanted position. Otherwise the material is inserted at the first position in the list.

Parameters
[in]matThe material to insert into the document. The document takes over the ownership of the pointed material.
[in]predAn optional material in the document to use as insertion point. The caller owns the pointed material.
[in]checknamesDeprecated.

§ InsertRenderData()

void InsertRenderData ( RenderData rd,
RenderData parent,
RenderData pred 
)

Inserts the render data into the document's render settings hierarchy.
Optionally the insertion position can either be specified by the parent parameter, inserting the render data as the first child of the specified parent, or by the pred parameter, inserting the render data below the specified pred render data.
If neither is given, the render data is inserted at the top of the hierarchy.

Parameters
[in]rdThe render data to insert. The document takes over the ownership of the pointed render data.
[in]parentAn optional parent to insert the render data as a child of. The caller owns the pointed render data.
[in]predAn optional render data of the document to use as insertion point. The caller owns the pointed render data.

§ InsertRenderDataLast()

void InsertRenderDataLast ( RenderData rd)

Inserts the render data as last child into the document's render data list.

Parameters
[in]rdThe render data to insert. The document takes over the ownership of the pointed render data.

§ GetActiveObject()

BaseObject* GetActiveObject ( void  )

Gets the active object in the document. This is the object the user has selected in the Object Manager.

Returns
The active object, or nullptr if no object is active. The document owns the pointed object.

§ GetActiveMaterial()

BaseMaterial* GetActiveMaterial ( void  )

Gets the active material in the document. This is the material the user has selected in the Material Manager.

Returns
The active material, or nullptr if no material is active or multiple are selected. The document owns the pointed material.

§ GetActiveTag()

BaseTag* GetActiveTag ( void  )

Gets the active tag in the document. This is the tag the user has selected in the Object Manager.

Note
Call GetActiveTags() to get multiple selections.
Returns
The active tag, or nullptr if no tag is active. The document owns the pointed tag.

§ GetActiveRenderData()

RenderData* GetActiveRenderData ( void  )

Gets the active render data for the document. These are the settings used for rendering the document.

Returns
The active rendering settings. The document owns the pointed render data.

§ GetRealActiveObject()

BaseObject* GetRealActiveObject ( AtomArray help,
Bool multi 
)

Gets the active object or the dummy axis if multiple objects are selected.

Parameters
[in]helpCan be set to nullptr or for speedup purposes pass an array of active objects. The caller owns the pointed atom array.
[out]multiAssigned true if multiple objects are selected. Can be nullptr.
Returns
The active object or the dummy axis if multiple objects are selected and nullptr if no object is selected. The document owns the pointed object.

§ GetActiveObjects()

void GetActiveObjects ( AtomArray selection,
GETACTIVEOBJECTFLAGS  flags 
) const

Gets the active object multi-selection and optionally the selection order and/or children.

Parameters
[out]selectionFilled with the selected objects.
[in]flagsFlags: GETACTIVEOBJECTFLAGS

§ GetActivePolygonObjects()

void GetActivePolygonObjects ( AtomArray selection,
Bool  children 
) const

Gets the subset of polygon objects in the active object multi-selection.

Parameters
[out]selectionFilled with the selected polygon objects.
[in]childrenIf true then children are also added to selection, provided that they are selected. Otherwise only the topmost parent in each chain is added.

§ GetActiveObjectsFilter()

void GetActiveObjectsFilter ( AtomArray selection,
Bool  children,
Int32  type,
Int32  instanceof 
) const

Gets the active object multi-selection and removes objects that do not match the filter given by type and instanceof.

Parameters
[out]selectionFilled with the selected objects.
[in]childrenIf true then children are also added to selection, provided that they are selected. Otherwise only the topmost parent in each chain is added.
[in]typeChecked against C4DAtom::GetType(). Pass NOTOK to ignore the test.
[in]instanceofChecked against C4DAtom::IsInstanceOf(). Pass NOTOK to ignore the test.

§ GetActiveMaterials()

void GetActiveMaterials ( AtomArray selection) const

Gets the active material multi-selection.

Parameters
[out]selectionFilled with the selected materials.

§ GetActiveTags()

void GetActiveTags ( AtomArray selection) const

Gets the active tag multi-selection.

Parameters
[out]selectionFilled with the selected tags.

§ GetSelection()

void GetSelection ( AtomArray selection) const

Gets the active selection. This function deals with both objects and tags.

Parameters
[out]selectionFilled with the objects and tags selection.

§ SetActiveObject()

void SetActiveObject ( BaseObject op,
Int32  mode = 0 
)

Modifies the current object multi-selection with op depending on mode.

Parameters
[in]opThe object to use. Must be in the document already. The document owns the pointed object.
[in]modeThe selection mode: SELECTION

§ SetActiveMaterial()

void SetActiveMaterial ( BaseMaterial mat,
Int32  mode = 0 
)

Modifies the current material multi-selection with mat depending on mode.

Parameters
[in]matThe material within the document that you want to make active. Must be in the document already. The document owns the pointed material.
[in]modeThe selection mode: SELECTION

§ SetActiveTag()

void SetActiveTag ( BaseTag tag,
Int32  mode = 0 
)

Modifies the current tag multi-selection with tag depending on mode.

Note
This method also activates the object the tag is attached to if it was not previously activated.
Parameters
[in]tagThe tag to make active. Must be in the document already. The document owns the pointed tag.
[in]modeThe selection mode: SELECTION

§ SetActiveRenderData()

void SetActiveRenderData ( RenderData rd)

Sets the active render data for the document. These are the settings that are used for rendering.

Parameters
[in]rdThe render data to make active. Must be in the document already. The document owns the pointed render data.

§ SetSelection()

void SetSelection ( BaseList2D bl,
Int32  mode = 0 
)

Sets the active selection. This function deals with both objects, tags and materials.

Parameters
[in]blThe baselist object within the document that you want to make active. Must be in the document already. The document owns the pointed base list object.
[in]modeThe selection mode: SELECTION

§ SearchObject()

BaseObject* SearchObject ( const String str)

Searches for an object with the case sensitive name given.

Parameters
[in]strThe case sensitive name of the object to search for.
Returns
The found object, or nullptr if no object was found. The document owns the pointed object.

§ SearchObjectInc()

BaseObject* SearchObjectInc ( const String str)

Searches for an object with the closest matching name.

Parameters
[in]strThe name of the object to search for.
Returns
The found object, or nullptr if no object was found. The document owns the pointed object.

§ SearchMaterial()

BaseMaterial* SearchMaterial ( const String str)

Searches for a material with the case sensitive name given.

Parameters
[in]strThe case sensitive name of the material to search for.
Returns
The found material, or nullptr of no material was found. The document owns the pointed material.

§ SearchMaterialInc()

BaseMaterial* SearchMaterialInc ( const String str)

Searches for a material with the closest matching name.

Parameters
[in]strThe name of the material to search for.
Returns
The found material, or nullptr of no material was found. The document owns the pointed material.

§ GetChanged()

Bool GetChanged ( void  )

Checks if the document has been changed since it was last saved.

Returns
true if the document was changed, otherwise false.

§ SetChanged()

void SetChanged ( void  )

Sets the changed state of the document to reflect it has been modified.

§ GetDocumentName()

Filename GetDocumentName ( void  )

Gets the name of the document.

Returns
The name of the file for the document.

§ GetDocumentPath()

Filename GetDocumentPath ( void  )

Gets the path of the document.

Returns
The path of the file for the document. If the document has not been saved then the path is empty.

§ SetDocumentName()

void SetDocumentName ( const Filename fn)

Sets the name of the document.

Parameters
[in]fnThe new name for the document's file. Must contain the name part only.

§ SetDocumentPath()

void SetDocumentPath ( const Filename path)

Sets the path of the document.

Parameters
[in]pathThe new path for the document's file. Must contain the path part only.

§ GetLOD()

Float GetLOD ( void  )

Gets the Level of Detail for the document.

Returns
The Level of Detail for the document.
The default values are:
  • Low = 0.25
  • Medium = 0.5
  • High = 1.0

§ SetLOD()

void SetLOD ( Float  lod)

Sets the Level of Detail for the document.

Parameters
[in]lodThe Level of Detail to set for the document. The default values are:
  • Low = 0.25
  • Medium = 0.5
  • High = 1.0

§ GetRenderLod()

Bool GetRenderLod ( void  )

Checks if the Level of Detail for rendering should be used in the editor.

Returns
true if using the render LOD, otherwise false.

§ SetRenderLod()

void SetRenderLod ( Bool  lod)

Sets if the the Level of Detail for rendering should be used in the editor.

Parameters
[in]lodtrue if the render LOD should be used, otherwise false.

§ GetTime()

BaseTime GetTime ( void  )

Gets the current time for the document's Timeline.
Here is how to get the current frame with GetTime():

Int32 fps = doc.GetFps();
BaseTime time = doc->GetTime();
frame = time.GetFrame(fps);
See also
GetFps()
Returns
The current time of the Timeline.

§ SetTime()

void SetTime ( const BaseTime t)

Sets the current time for the document's Timeline.

See also
GetTime()
Warning
This method only changes the document time, it does not start a redraw and/or animation/expressions. This is done using a combination of the following functions: ExecutePasses(), DrawViews() and EventAdd().
Parameters
[in]tThe new current time of the Timeline.

§ GetFps()

Int32 GetFps ( void  ) const

Gets the number of frames per second (FPS).

Returns
The number of frames per second.

§ SetFps()

void SetFps ( Int32  fps)

Sets the number of frames per second (FPS).

Parameters
[in]fpsThe new number of frames per second.

§ GetMinTime()

BaseTime GetMinTime ( void  )

Gets the starting time for the Timeline in the document.

Returns
The starting time of the document's Timeline.

§ SetMinTime()

void SetMinTime ( const BaseTime t)

Sets the starting time for the Timeline in the document.

Parameters
[in]tThe new starting time of the document's Timeline.

§ GetMaxTime()

BaseTime GetMaxTime ( void  )

Gets the ending time for for the Timeline in the document.

Returns
The ending time of the document's Timeline.

§ SetMaxTime()

void SetMaxTime ( const BaseTime t)

Sets the ending time for the Timeline in the document.

See also
BaseTime for conversion of FPS or other time units.
GetFps()
Parameters
[in]tThe new ending time of the document's Timeline.

§ GetUsedMinTime()

BaseTime GetUsedMinTime ( BaseList2D check)

Gets the lower bound of the range of time used by all sequences, tracks, keys etc. Optionally the calculation is done only for the given object check.

Note
Though the check parameter supports all kinds of nodes, the test when check==nullptr is only done for objects.
Parameters
[in]checkAn object to check or nullptr to check the document's objects.
Returns
The minimal used time in the document.

§ GetUsedMaxTime()

BaseTime GetUsedMaxTime ( BaseList2D check)

Gets the upper bound of the range of time used by all sequences, tracks, keys etc. Optionally the calculation is done only for the given object check.

Note
Though the check parameter supports all kinds of nodes, the test when check==nullptr is only done for objects.
Parameters
[in]checkAn object to check or nullptr to check the document's objects.
Returns
The maximum used time in the document.

§ GetLoopMinTime()

BaseTime GetLoopMinTime ( void  )

Gets the time of the left boundary of the document's loop or preview range.

Returns
The starting time for the document's loop range.

§ SetLoopMinTime()

void SetLoopMinTime ( const BaseTime t)

Sets the time of the left boundary of the document's loop or preview range.

Parameters
[in]tThe new starting time for the document's loop range.

§ GetLoopMaxTime()

BaseTime GetLoopMaxTime ( void  )

Gets the time of the right boundary of the document's loop or preview range.

Returns
The ending time for the document's loop range.

§ SetLoopMaxTime()

void SetLoopMaxTime ( const BaseTime t)

Sets the time of the right boundary of the document's loop or preview range.

Parameters
[in]tThe new ending time for the document's loop range.

§ GetMode()

Int32 GetMode ( void  )

Gets the main editor mode.

Returns
The values for the editor mode are: EditorModes

§ SetMode()

void SetMode ( Int32  m)

Sets the main editor mode.

Parameters
[in]mThe values for the editor mode are: EditorModes

§ IsEditMode()

Bool IsEditMode ( void  )

Checks if the editor is in editable mode. It basically checks if GetMode() is Mpoints, Medges or Mpolygons.

Returns
true if the editor is in point/edge/poly editing mode, otherwise false.

§ GetAction()

Int32 GetAction ( void  )

Gets the current action tool in the editor.

Returns
The return values are ID_MODELING_MOVE, ID_MODELING_SCALE, ID_MODELING_ROTATE etc.

§ SetAction()

void SetAction ( Int32  a)

Sets the current action tool in the editor.

Parameters
[in]aThe values are ID_MODELING_MOVE, ID_MODELING_SCALE, ID_MODELING_ROTATE etc.

§ StartUndo()

Bool StartUndo ( void  )

Tells Cinema 4D to start building a list of undos into a single undo action for the user. This must be paired with an EndUndo().

Note
Before calling StartUndo() in an asynchronous situation, do not forget to call StopAllThreads()
Returns
true if the undo list was successfully started, otherwise false.

§ EndUndo()

Bool EndUndo ( void  )

Ends the building of multiple undo actions into a single user undo. This must be paired with StartUndo().

Returns
true if the undo list was successfully finished, otherwise false.

§ AddUndo() [1/2]

Bool AddUndo ( UNDOTYPE  type,
void *  data,
Bool  allowFromThread = false 
)

Adds an undo type to the list of undo operations started with StartUndo().

Note
AddUndo() always has to be called before a change is made.
In the case of the creation of a new object the call is done afterwards, after insertion into the document/object/track/sequence but before calling subsequent functions like SetActiveObject() which creates another undo:
op->InsertTag(tag);
doc->AddUndo(UNDOTYPE_NEW, tag);
Parameters
[in]typeThe values for the undo type are: UNDOTYPE
[in]dataThe object the undo has been added for.
[in]allowFromThreadIf an undo is added from a thread this is not executed. (As a safety measure, because normally this does not make any sense.)
For explicit cases where a thread has to call AddUndo() (the view redraw and everything else is blocked) this can be set to true.
Returns
true if the change was successfully added to the undo list, otherwise false.

§ AddUndo() [2/2]

Bool AddUndo ( BaseDraw bd)

Adds an undo for a BaseDraw to the list of undo operations started with StartUndo().

Parameters
[in]bdThe base draw to add the change to the undo list.
Returns
true if the change for the base draw was successfully added to the undo list, otherwise false.

§ DoUndo()

Bool DoUndo ( Bool  multiple = false)

Perform an undo operation, same as the user doing Undo from within Cinema 4D's interface.

Parameters
[in]multipleThis parameter only matters if DoUndo() is called between AddUndo() and EndUndo().
If multiple is true then all the AddUndo() steps will be undone. Otherwise only the last AddUndo() step will be undone.
In addition if multiple is set then EndUndo() will be invoked internally so if further undos are to be created after this point StartUndo() must be called afterwards.
If EndUndo() has been called then all steps are always undone regardless of this setting.
Returns
true if the undo list was successfully undone, otherwise false.

§ DoRedo()

Bool DoRedo ( void  )

Performs a redo operation (undo the last undo).

Note
DoRedo() must always be called after EndUndo().
Returns
true if the last undo was successfully undone, otherwise false.

§ FlushUndoBuffer()

void FlushUndoBuffer ( void  )

Flushes the complete undo + redo buffer.

Warning
Only call when absolutely needed.

§ GetUndoPtr()

BaseList2D* GetUndoPtr ( )

Gets the element (object, tag, material, etc.) of the last undo action.
E.g. if you have added a BaseObject undo you can retrieve the object by calling GetUndoPtr() but always be sure to check the type of the result first.

Returns
The last undo element. The document owns the pointed element.

§ FindUndoPtr()

BaseList2D* FindUndoPtr ( BaseList2D bl,
UNDOTYPE  type 
)

Finds the last undo state of the Cinema 4D element bl (object, tag, material, etc.) for the specified undo type.
For instance here is how to retrieve the pre-undo object after a change has been made:

Parameters
[in]blThe element to obtain the last undo action.
[in]typeThe undo type to check: UNDOTYPE
Returns
The last undo state of the element.The document owns the pointed element.

§ AutoKey()

void AutoKey ( BaseList2D undo,
BaseList2D op,
Bool  recursive,
Bool  pos,
Bool  scale,
Bool  rot,
Bool  param,
Bool  pla 
)

Compares the object chain op to object chain undo and sets keyframes for all the changes.

Parameters
[in]undoThe object chain to compare to. The caller owns the pointed object chain.
[in,out]opThe object chain to add the keys to. The caller owns the pointed object chain.
[in]recursiveIf true then the function applies to all children of op as well. The hierarchy of op and undo must match.
[in]posIf true keyframes are added for differences in position.
[in]scaleIf true keyframes are added for differences in scale.
[in]rotIf true keyframes are added for differences in rotation.
[in]paramIf true keyframes are added for differences in parameters.
[in]plaIf true keyframes are added as PLA for differences in point positions.

§ RecordKey()

Bool RecordKey ( BaseList2D op,
const BaseTime time,
const DescID id,
BaseList2D undo,
Bool  eval_attribmanager,
Bool  autokeying,
Bool  allow_linking 
)

Records a key for op at time.

Parameters
[in,out]opThe object to record.
[in]timeThe time to record.
[in]idThe description ID to record.
[in]undoThe object in op in the old state. This is necessary e.g. for auto-keyframing so that Cinema 4D can compare values. Usually this is the object from the undo buffer.
To record keys without auto-keyframing then nullptr can be passed.
[in]eval_attribmanagerIf true Attribute Manager is evaluated.
[in]autokeyingIf true auto-keyframing is used and undo needs to be passed for comparison.
[in]allow_linkingIf true and a Y key will be generated in auto-keyframing, then automatically the X and Z components will be completed. If false then only the Y key will be generated.
Returns
true if the key was successfully recorded, otherwise false.

§ Record()

void Record ( void  )

Records the active objects.

Note
Same as pushing the "Record Active Objects" button in the user interface.

§ GetActiveBaseDraw()

BaseDraw* GetActiveBaseDraw ( void  )

Gets the activate BaseDraw in the editor.

Returns
The active view in the editor or nullptr if there is no active view. The document owns the pointed view.

§ GetRenderBaseDraw()

BaseDraw* GetRenderBaseDraw ( void  )

Gets the BaseDraw the user has chosen as Render View in the editor (see View menu in Cinema 4D).

Returns
The render view in the editor or nullptr if there is no render view. The document owns the pointed view.

§ GetBaseDraw()

BaseDraw* GetBaseDraw ( Int32  num)

Gets the BaseDraw from one of the editor views.

Parameters
[in]numIf there are multiple views this selects the view. 0 <= num < GetBaseDrawCount()
Returns
The requested view in the editor, or nullptr if it is not available. The document owns the pointed view.

§ GetBaseDrawCount()

Int32 GetBaseDrawCount ( )

Gets the number of views in the editor.

Returns
The BaseDraw count in the editor.

§ ForceCreateBaseDraw()

void ForceCreateBaseDraw ( void  )

Call this method to Make sure that GetBaseDraw(0) is accessible. This is only important in import filters where, at the time, there are no valid drawing views.

§ GetDrawTime()

Int32 GetDrawTime ( )

Gets the editor redraw time.

Returns
The editor redraw time.

§ GetPickSession()

const PickSessionDataStruct* GetPickSession ( ) const

Gets the data structure of the current pick session.

Returns
The data structure of the current pick session, or nullptr if there is none. The document owns the pointed pick session data.

§ StartPickSession()

void StartPickSession ( PickSessionDataStruct psd)

Starts a pick session.

Parameters
[in]psdThe initialized data structure for the pick session. The caller owns the pointed pick session data.

§ StopPickSession()

void StopPickSession ( Bool  cancel)

Ends the pick session. For instance after filling the pick session array.

Parameters
[in]cancelPass true to cancel a pick session, for instance if an error occurred. Pass false if the pick session is ended regularly.

§ AnimateObject()

void AnimateObject ( BaseList2D op,
const BaseTime time,
ANIMATEFLAGS  flags 
)

Animates the object op in the document at the given time.

Note
Does not take expressions into account.
Parameters
[in]opThe object to animate. The caller owns the pointed object.
[in]timeThe time at which op is animated.
[in]flagsThe animate flags: ANIMATEFLAGS

§ ExecutePasses()

Bool ExecutePasses ( BaseThread bt,
Bool  animation,
Bool  expressions,
Bool  caches,
BUILDFLAGS  flags 
)

Animates the current frame of the document. Send an update message using EventAdd() to update the editor afterwards.

Parameters
[in]btThe thread can either be nullptr (for the main Cinema 4D thread) or if you are within your own thread then you pass it. The caller owns the pointed thread.
[in]animationIf true animations are evaluated.
[in]expressionsIf true expressions are evaluated.
[in]cachesIf true caches are evaluated.
[in]flagsThe build flags: BUILDFLAGS
Returns
true if the passes were executed successfully, otherwise false.

§ Polygonize()

BaseDocument* Polygonize ( Bool  keepanimation = false)

Makes a clone of the document and turns all objects into polygon based objects.

Parameters
[in]keepanimationIf true the animation is kept on the objects.
Returns
The cloned polygon based document or nullptr if it failed. The caller owns the pointed document.

§ CollectSounds()

Bool CollectSounds ( BaseSound snd,
const BaseTime from,
const BaseTime to 
)

Collects all enabled soundtracks and calculates the downmix of the tracks. The result is stored in snd.

Parameters
[out]sndThe downmix of the collected soundtracks. The caller owns the pointed sound.
[in]fromThe starting time of for the downmix.
[in]toThe ending time for the downmix.
Returns
true if collecting all the document's sounds was successful, otherwise false.

§ FindSceneHook()

BaseSceneHook* FindSceneHook ( Int32  id) const

Finds a scene hook by ID.

Parameters
[in]idThe scene hook ID.
Returns
The found scene hook, or nullptr if there is no scene hook with the searched id. The document owns the pointed scene hook.

§ GetSplinePlane()

Int32 GetSplinePlane ( void  )

Gets the plane in which the splines are created, such as XY plane.

Returns
The values for the spline planes are: PRIM_PLANE_XY, PRIM_PLANE_ZY and PRIM_PLANE_XZ.

§ GetLayerObjectRoot()

GeListHead* GetLayerObjectRoot ( void  )

Gets the list of layers in the document.

Returns
The head of the list of the document's layers. The document owns the pointed list head.

§ GetAllTextures() [1/2]

BaseContainer GetAllTextures ( const AtomArray ar)

Gets all used textures for the objects in ar.

Parameters
[in]arAn atom array. If nullptr, all used textures in the document will be returned.
Returns
A container with all textures filename.

§ GetAllTextures() [2/2]

BaseContainer GetAllTextures ( Bool  isNet,
const AtomArray ar 
)

Gets all used textures for the objects in ar.

Parameters
[in]isNetPass true to retrieve all the textures used in the current NET rendering.
[in]arAn atom array to get the textures for. If nullptr, all used textures in the document will be returned.
Returns
A container with all textures filename.

§ GetHighest()

BaseObject* GetHighest ( Int32  type,
Bool  editor 
)

Gets the first object in the Object Manager hierarchy of the specified type. It searches objects that are not deactivated in the Object Manager (set to red).

Parameters
[in]typeThe object type to search for.
[in]editortrue will search using the editor dot in the Object Manager, false will use the render dot.
Returns
The first object of the requested type or nullptr if no object was found. The document owns the pointed object.

§ GetDocPreviewBitmap()

BaseBitmap* GetDocPreviewBitmap ( )

Gets the preview bitmap of the document.

Returns
The preview bitmap of the document. The document owns the pointed bitmap.

§ GetHighlightedObjects()

void GetHighlightedObjects ( AtomArray selection) const

Private.

§ SetHighlightedObject()

void SetHighlightedObject ( BaseObject op,
Int32  mode = 0 
)

Private.

§ SetHighlightedObjects()

void SetHighlightedObjects ( AtomArray selection,
Int32  mode = 0 
)

Private.

§ GetDefaultKey()

Bool GetDefaultKey ( CKey pKey,
Bool bOverdub 
) const

Gets the document's default keying settings.

Parameters
[in]pKeyAssigned the default keying settings. Cinema 4D owns the pointed key.
[in]bOverdubAssigned the document's default overdub.
Returns
true if the document's default keying settings were retrieved successfully, otherwise false.

§ SetDefaultKey()

void SetDefaultKey ( CKey pKey,
Bool  bOverdub 
)

Sets the document's default keying settings.

Parameters
[in]pKeyThe new default keying settings. Cinema 4D owns the pointed key.
[in]bOverdubThe new document's default overdub.
If a keyframe already exists, the existing keyframe's interpolation type will be maintained when a new keyframe is recorded (only the Value Key will be overwritten).

§ IsCacheBuilt()

Bool IsCacheBuilt ( Bool  force = false)

Private.

§ IsAxisEnabled()

Bool IsAxisEnabled ( void  )

Checks the state of the object axis modifier.

Returns
true if the object axis modifier is enabled, otherwise false.

§ GetHelperAxis()

BaseObject* GetHelperAxis ( void  )

Gets the helper axis for the current multi-selection.

Returns
The axis object. The document owns the pointed object.

§ HandleSelectedTextureFilename()

Bool HandleSelectedTextureFilename ( BaseChannel bc,
const Filename fn,
Filename resfilename,
Bool  undo,
GEMB_R already_answered 
)

Private.

§ ReceiveMaterials()

Bool ReceiveMaterials ( BaseObject op,
AtomArray mat,
Bool  clearfirst 
)

Private.

§ ReceiveNewTexture()

Bool ReceiveNewTexture ( BaseObject op,
const Filename filename,
Bool  sdown,
GEMB_R already_answered 
)

Private.

§ SendInfo()

void SendInfo ( Int32  type,
Int32  format,
const Filename fn,
BaseList2D bl,
Bool  hooks_only 
)

Sends MSG_DOCUMENTINFO messages.

Parameters
[in]typeThe document info message type: MSG_DOCUMENTINFO_TYPE
[in]formatThe file format: (Set for load, merge and before/after save only. Otherwise NOTOK.) FORMAT_FILES
[in]fnThe document filename.
Note
This is not always the same as the filename returned by BaseDocument::GetDocumentPath().
e.g. for MSG_DOCUMENTINFO_TYPE_SAVE_BEFORE BaseDocument::GetDocumentPath() still contains the old path whereas fn designates the real file.
Parameters
[in]blThe object/tag/material that got inserted. It is used if type is of one of the following values:
[in]hooks_onlyIf true the message is sent to scene hooks only.

§ RecordZero()

void RecordZero ( void  )

Private.

§ RecordNoEvent()

void RecordNoEvent ( void  )

markPrivate

§ SetRewind()

void SetRewind ( Int32  flags = 0)

In NodeData::SetDParameter() some operators, objects etc. can call doc->SetRewind() so that Cinema 4D rewinds the whole document (from time 0 to current time) when the next event EVMSG_CHANGE or DrawViews() is processed.

Parameters
[in]flagsNot used.

§ GetTakeData()

TakeData* GetTakeData ( )

Gets the take data for the document.

Since
R17.032
Returns
The take data. The document owns the pointed take data.

§ GetTargetObject()

BaseObject* GetTargetObject ( ) const

Gets target object within a multi-selection.

Since
R17.032
Note
This is the last object selected and is used by commands such as Spline Boolean in order to allow the user to control which object will be used as the target for the command.
The target object displays in the Object Manager as highlighted.
Returns
The target object, or nullptr if it fails or there is no selection.

§ SetTargetObject()

void SetTargetObject ( BaseObject op)

Sets target object within a multi-selection.

Since
R17.032
Note
Implies selection of an object if it is not currently selected, adding it to the existing selection.
Moves the object to the very end of the list when calling BaseDocument::GetActiveObjects(GETACTIVEOBJECTFLAGS_SELECTIONORDER).
Parameters
[in]opThe object to set as the target.