c4d.documents.BaseDocument

This object contains the complete description of a scene.

Note

Remember that you need to call StopAllThreads() before making modifications to a user scene.

Definition

class c4d.documents. BaseDocument

Inheritance

Members

BaseDocument. __init__ ( )
Return type: c4d.documents.BaseDocument
Returns: The new document.
BaseDocument. SetFps ( fps )

Set the frames per second.

Parameters: fps ( int ) – The fps.
BaseDocument. GetFps ( )

Returns the fps of the document.

Return type: int
Returns: The fps
BaseDocument. SetLOD ( lod )

Get the Level of Detail for this document.

Parameters: lod ( float ) –

The default level of detail values are:

Low 0.25
Medium 0.5
High 1.0
BaseDocument. GetLOD ( )

Get the Level of Detail for this document.

Return type: float
Returns: The default level of detail values are:
Low 0.25
Medium 0.5
High 1.0
BaseDocument. GetRenderLod ( )

Get if the level of detail for rendering should be used in the editor.

Return type: bool
Returns: True if using the render lod.
BaseDocument. SetRenderLod ( lod )

Set the level of detail for rendering.

Parameters: lod ( bool ) – True if using the render lod.
BaseDocument. GetDrawTime ( )

Get the editor redraw time.

Return type: int
Returns: The editor redraw time.
BaseDocument. GetLayerObjectRoot ( )

Returns the list of layers of the document:

def GetFirstLayer(doc):
  """
  Returns the first layer, if available, otherwise None
  """
  return doc.GetLayerObjectRoot().GetDown()
							

Warning

The hierarchy method GeListNode.GetDown() can only be called on the returned object.

Return type: c4d.GeListNode
Returns: The head of the list of the document’s layers.
BaseDocument. GetSplinePlane ( )

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

Return type: int
Returns: Values for this are:
PRIM_PLANE_XY XY plane.
PRIM_PLANE_ZY ZY plane.
PRIM_PLANE_XZ XZ plane.
BaseDocument. SetRewind ( [ flags=0 ] )

Rewinds the whole document (from time 0 to current time) when the next event EVMSG_CHANGE or DrawViews() is processed.

Int flags: int
Parameters: flags – Not used.
BaseDocument. GetBaseDrawCount ( )

Get the BaseDraw count in the editor view.

Return type: int
Returns: The count.
BaseDocument. Flush ( )

Empties the document, deleting and freeing all resources used.

BaseDocument. SetDocumentName ( name )

Set the file name of the document.

Note

name must contain the filename part only.

Parameters: name ( str ) – The file name part of the document to set.
BaseDocument. SetDocumentPath ( path )

Set the path of the document.

Note

path must contain the path part only.

Parameters: path ( str ) – The path part of the document to set.
BaseDocument. GetDocumentName ( )

Returns the file name of the document.

Return type: str
Returns: The file name of the document.

Note

If the document has not been saved then the name is in the form ‘Untitled 1’, for instance for the first unsaved document.

BaseDocument. GetDocumentPath ( )

Returns the path of the document.

Return type: str
Returns: The path of the document.

Note

If the document has not been saved then the path is empty.

BaseDocument. GetParticleSystem ( )

Returns the particle master system of the document.

Return type: c4d.modules.thinkingparticles.TP_MasterSystem or None
Parameters: type – The particle system of the document. Is useless when the document was deleted, None if Thinking Particles is not installed.
BaseDocument. ForceCreateBaseDraw ( )

Makes sure that GetBaseDraw() (0) is accessible. This is only important in import filters where, at the time, there are no valid base draws.

BaseDocument. ExecutePasses ( bt , animation , expressions , caches , flags )

Animate the current frame of the document. To update the editor you then need to send an update message using c4d.EventAdd() .

Parameters:
  • bt ( c4d.threading.BaseThread ) – This thread can either be None (for the main Cinema 4D thread) or if you are within your own thread then you pass the thread.
  • animation ( bool ) – Animations are evaluated.
  • expressions ( bool ) – Expressions are evaluated.
  • caches ( bool ) – Caches are evaluated.
  • flags ( int ) –

    Flags:

    BUILDFLAGS_0 None.
    BUILDFLAGS_INTERNALRENDERER Rendering in the editor.
    BUILDFLAGS_EXTERNALRENDERER Rendering externally.
    BUILDFLAGS_ISOPARM Generate isoparam objects also.
Return type:

bool

Returns:

True if successful, otherwise False .

BaseDocument. FindSceneHook ( id )

Finds a scene hook by ID.

Parameters: id ( int ) – The scene hook ID.
Return type: c4d.BaseList2D
Returns: The found scene hook, or None .
BaseDocument. StartUndo ( )

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

Return type: bool
Returns: Success of starting the undo list.

Here is a small example how to write a redo support for newly inserted objects:

import c4d
doc.StartUndo()                     # Start undo support
cube = c4d.BaseObject(c4d.Ocube)
doc.InsertObject(cube)              # Insert the object
doc.AddUndo(c4d.UNDOTYPE_NEW, cube) # Support redo the insert operation
doc.EndUndo()                       # Do not forget to close the undo support
							
BaseDocument. AddUndo ( type , data [ , allowFromThread=False ] )

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

Note

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 BaseDocument.SetActiveObject() which creates another undo:
tag = c4d.UVWTag(op.GetPointCount())
op.InsertTag(tag)
doc.AddUndo(c4d.UNDOTYPE_NEW, tag)
c4d.EventAdd()
							
Parameters:
  • type ( int ) –

    The undo type:

    UNDOTYPE_0 No flags.
    UNDOTYPE_CHANGE Any change to an object, including hierarchy modifications; modification in positioning (object has been moved from A to B), substructures etc. (Needs to be called BEFORE action.)
    UNDOTYPE_CHANGE_NOCHILDREN Same as UNDOTYPE_CHANGE , but without child modifications. (Needs to be called BEFORE action.)
    UNDOTYPE_CHANGE_SMALL Change to local data only (e.g. data container), no substructures (e.g. no tags on an object). Also no children. (Needs to be called BEFORE action.)
    UNDOTYPE_CHANGE_SELECTION Change to point/poly/edge selection only. (Needs to be called BEFORE action.)
    UNDOTYPE_NEW New object/node/tag etc. was created. (Needs to be called AFTER action.)
    UNDOTYPE_DELETE Object/node/tag etc. to be deleted. (Needs to be called BEFORE action.)
    UNDOTYPE_ACTIVATE Automatically managed by SetActiveObject()/Tag()/Material() etc. No need to use manually.
    UNDOTYPE_DEACTIVATE Automatically managed by SetActiveObject()/Tag()/Material() etc. No need to use manually.
    UNDOTYPE_BITS Change to object bits, e.g. selection status.
    UNDOTYPE_HIERARCHY_PSR Change in hierarchical placement and PSR values. (Needs to be called before the change.)
    UNDOTYPE_PRIVATE_MULTISELECTIONAXIS Private.
    UNDOTYPE_START Private.
    UNDOTYPE_END Private.
  • data ( c4d.BaseList2D ) – The object the undo has been added for.
  • allowFromThread ( bool ) –

    New in version R14.014.

    If an undo is added from a thread this is not executed. (As a safety measure, because normally this doesn’t 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 .

Return type:

bool

Returns:

Success of adding the undo.

BaseDocument. GetUndoPtr ( )

Returns the element of the last undo action. E.g. if you have added a BaseObject undo you can retrieve the object by calling this method.

Note

Always be sure to check the type of the result first.

Return type: c4d.BaseList2D
Returns: The last undo element.
BaseDocument. FlushUndoBuffer ( )

New in version R14.014.

Flushes the complete undo + redo buffer. Only call when absolutely needed.

BaseDocument. FindUndoPtr ( bl , type )

New in version R14.014.

Returns the last undo state of the Cinema 4D element bl (object, tag, material, etc.) for the specified undo action type.

Here is an how to retrieve the pre-undo object after a change has made:

preundo = doc.FindUndoPtr(obj, c4d.UNDOTYPE_CHANGE)
							

Note

Always check the type of the returned object.

Parameters:
  • bl ( c4d.BaseList2D ) – The element from which to obtain the last undo action.
  • type ( int ) –

    The undo type to check:

    UNDOTYPE_0 No flags.
    UNDOTYPE_CHANGE Any change to an object, including hierarchy modifications; modification in positioning (object has been moved from A to B), substructures etc. (Needs to be called BEFORE action.)
    UNDOTYPE_CHANGE_NOCHILDREN Same as UNDOTYPE_CHANGE , but without child modifications. (Needs to be called BEFORE action.)
    UNDOTYPE_CHANGE_SMALL Change to local data only (e.g. data container), no substructures (e.g. no tags on an object). Also no children. (Needs to be called BEFORE action.)
    UNDOTYPE_CHANGE_SELECTION Change to point/poly/edge selection only. (Needs to be called BEFORE action.)
    UNDOTYPE_NEW New object/node/tag etc. was created. (Needs to be called AFTER action.)
    UNDOTYPE_DELETE Object/node/tag etc. to be deleted. (Needs to be called BEFORE action.)
    UNDOTYPE_ACTIVATE Automatically managed by SetActiveObject()/Tag()/Material() etc. No need to use manually.
    UNDOTYPE_DEACTIVATE Automatically managed by SetActiveObject()/Tag()/Material() etc. No need to use manually.
    UNDOTYPE_BITS Change to object bits, e.g. selection status.
    UNDOTYPE_HIERARCHY_PSR Change in hierarchical placement and PSR values. (Needs to be called before the change.)
    UNDOTYPE_PRIVATE_MULTISELECTIONAXIS Private.
    UNDOTYPE_START Private.
    UNDOTYPE_END Private.
Return type:

c4d.BaseList2D

Returns:

The last undo element.

BaseDocument. DoRedo ( )

Perform a redo on this document (undo the last undo).

Return type: bool
Returns: Success of the operation.
BaseDocument. DoUndo ( [ multiple=False ] )

Perform an undo operation, same as the user selecting Undo from within Cinema 4D.

Parameters: multiple ( bool ) – This parameter only matters if this method 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. If EndUndo() has been called then all steps are always undone.
Return type: bool
Returns: True if successful, otherwise False .
BaseDocument. EndUndo ( )

End the building of multiple undo actions into a single user undo, this must be paired with StartUndo() .

Return type: bool
Returns: Success of finishing the undo list.
BaseDocument. RecordKey ( op , id [ , time , undo , autoKey , eval_attribmanager ] )

New in version R16.021.

Records a key for op at time .

Parameters:
  • op ( c4d.BaseList2D ) – The object to record.
  • id ( c4d.DescID ) – The description ID to record.
  • time ( c4d.BaseTime ) – The time to record.
  • undo ( c4d.BaseList2D ) –

    The object in the old state. This is necessary e.g. for autokeyframing so that Cinema 4D can compare values. Usually this is the object from the undo buffer.

    To record keys (no autokeying) None can be passed.

  • autoKey ( bool ) – If True then autokeying is used and undo needs to be passed for comparison.
  • eval_attribmanager ( bool ) – Evaluate attributes manager.
Return type:

bool

Returns:

True if successful, otherwise False .

BaseDocument. AutoKey ( op , undo [ , recursive , pos , scale , rot , param , pla ] )

New in version R16.021.

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

Parameters:
  • op ( c4d.BaseObject ) – The object chain to add the keys to.
  • undo ( c4d.BaseList2D ) – The object chain to compare to. This is necessary e.g. for autokeyframing so that Cinema 4D can compare values. Usually this is the object from the undo buffer.
  • recursive ( bool ) – If True then the function applies to all children of op as well. The hierarchy of op and undo must match.
  • pos ( bool ) – If True keyframes are added for differences in position.
  • scale ( bool ) – If True keyframes are added for differences in scale.
  • rot ( bool ) – If True keyframes are added for differences in rotation.
  • param ( bool ) – If True keyframes are added for differences in parameters.
  • pla ( bool ) – If True keyframes are added as PLA for differences in point positions.
BaseDocument. Record ( )

New in version R19.

Records the active objects in the document.

BaseDocument. AnimateObject ( op , time , flags )

Animate a node in this document at the given time.

Note

Does not take expressions into account.

Parameters:
  • op ( c4d.BaseList2D ) – This is the node to animate.
  • time ( c4d.BaseTime ) – The time at which it is being animated.
  • flags ( int ) –

    Flags:

    ANIMATEFLAGS_0 No flags.
    ANIMATEFLAGS_NO_PARTICLES Ignore particles.
    ANIMATEFLAGS_QUICK Only fast tracks, e.g. not morphing. (Checks the ANIMINFO_QUICK bit of animation plugins.)
    ANIMATEFLAGS_NO_CHILDS Do not animate children.
    ANIMATEFLAGS_INRENDER Prepare to render scene.
    ANIMATEFLAGS_NO_MINMAX Private.
    ANIMATEFLAGS_NO_NLA Private.
    ANIMATEFLAGS_NLA_SUM Private.
BaseDocument. Polygonize ( [ keepanimation=False ] )

Make a clone of the document and turn all objects into polygon based objects.

Parameters: keepanimation ( bool ) – Keep animation.
Return type: c4d.documents.BaseDocument
Returns: The cloned polygon based document or None if failed.
BaseDocument. SetMinTime ( time )

Set the starting time for the timeline of this document. For conversion of FPS or other time units, see BaseTime . You may also find the GetFps() useful when using this method.

Parameters: type ( c4d.BaseTime ) – The time.
BaseDocument. SetMaxTime ( time )

Set the end time of the timline for this document. For conversion of FPS or other time units, see BaseTime . You may also find the GetFps() useful when using this method.

Parameters: type ( c4d.BaseTime ) – The time.
BaseDocument. GetMinTime ( )

Get the starting time for the timeline of this document. For conversion of FPS or other time units, see BaseTime . You may also find the GetFps() useful when using this method.

Return type: c4d.BaseTime
Returns: The time.
BaseDocument. GetMaxTime ( )

Get the end time for the timeline of this document. For conversion of FPS or other time units, see BaseTime . You may also find the GetFps() useful when using this method.

Return type: c4d.BaseTime
Returns: The time.
BaseDocument. GetTime ( )

Returns the min time.

Return type: c4d.BaseTime
Returns: The current time.
BaseDocument. SetTime ( time )

Set the current time for this documents timeline.

Note

This function only changes the document time, it does not start a redraw and/or animation/expressions.

Parameters: type ( c4d.BaseTime ) – The time.
BaseDocument. GetLoopMinTime ( )

Returns the time of the left boundary of the document’s preview range (loop range).

Return type: c4d.BaseTime
Returns: The time.
BaseDocument. SetLoopMinTime ( time )

Sets the left boundary of the document’s preview range (loop range) to the given time.

Parameters: type ( c4d.BaseTime ) – The time.
BaseDocument. GetLoopMaxTime ( )

Returns the time of the right boundary of the document’s preview range (loop range).

Return type: c4d.BaseTime
Returns: The time.
BaseDocument. SetLoopMaxTime ( time )

Sets the right boundary of the document’s preview range (loop range) to the given time.

Parameters: type ( c4d.BaseTime ) – The time.
BaseDocument. SetActiveObject ( op [ , mode=SELECTION_NEW ] )

Modifies the current multi selection with op , depending on mode .

Parameters:
  • op ( c4d.BaseObject ) – The object.
  • mode ( int ) –

    The selection flag:

    SELECTION_NEW Starts a new selection.
    SELECTION_ADD Adds to the current selection
    SELECTION_SUB Subtracts from the current selection.
BaseDocument. SetActiveTag ( tag [ , mode=SELECTION_NEW ] )

Sets a tag be the currently active one.

Parameters:
  • tag ( c4d.BaseTag ) – The tag to set active.
  • mode ( int ) –

    The selection flag:

    SELECTION_NEW Starts a new selection.
    SELECTION_ADD Adds to the current selection
    SELECTION_SUB Subtracts from the current selection.
BaseDocument. SetActiveMaterial ( mp [ , mode=SELECTION_NEW ] )

Modifies the current multi selection with op , depending on mode .

Parameters:
  • mp ( c4d.BaseMaterial ) – The material to set active.
  • mode ( int ) –

    The selection flag:

    SELECTION_NEW Starts a new selection.
    SELECTION_ADD Adds to the current selection
    SELECTION_SUB Subtracts from the current selection.
BaseDocument. SetActiveRenderData ( rd )

Sets the active render settings for the document, these are the settings that are used for rendering.

Parameters: rd ( c4d.documents.RenderData ) – The render data that you want to make active.
BaseDocument. GetAllTextures ( [ isNet=False , ar=None ] )

Returns a collection of all used textures in the document and optionally only for the objects in ar .

Parameters:
  • isNet ( bool ) –

    New in version R16.021.

    Pass True (default) if in NET.

  • ar ( array of atoms ) – An atom array. If None (default), all used textures in the document will be returned.
Return type:

c4d.BaseContainer

Returns:

A container with all filenames of used textures in the document.

BaseDocument. SetAction ( a )

Set the current tool in the editor.

Parameters: a ( int ) – The values are ID_MODELING_MOVE , ID_MODELING_SCALE , ID_MODELING_ROTATE etc. The IDs are listed in modelingids.h .
BaseDocument. GetAction ( )

Get the ID of the current active tool in the editor.

Return type: int
Returns: The ID.
BaseDocument. GetActiveToolData ( )

Gets the original tool data container. The container is alive until the host object is freed.

Return type: c4d.BaseContainer
Returns: Tool data container.
BaseDocument. SetMode ( m )

Set the main mode of the editor.

Parameters: m ( int ) –

The value:

Mcamera Camera mode.
Mobject Object mode.
Mtexture Texture mode.
Mtextureaxis Texture axis mode.
Mpoints Point edit mode.
Medges Edge edit mode.
Mpolygons Polygon edit mode.
Manimation Animation mode.
Mkinematic IK mode.
Mmodel Model mode.
Mpaint Paint mode.
Muvpoints UV points.
Muvpolygons UV polygons.
Mdrag Drag mode.
Mpolyedgepoint Combined poly/edge/point mode. Must only be used in ViewportSelect .
Medgepoint Combined edge/point mode. Must only be used in ViewportSelect .
Mworkplane Workplane mode.
BaseDocument. GetMode ( )

Get the main mode of the editor.

Return type: int
Returns: The value:
Mcamera Camera mode.
Mobject Object mode.
Mtexture Texture mode.
Mtextureaxis Texture axis mode.
Mpoints Point edit mode.
Medges Edge edit mode.
Mpolygons Polygon edit mode.
Manimation Animation mode.
Mkinematic IK mode.
Mmodel Model mode.
Mpaint Paint mode.
Muvpoints UV points.
Muvpolygons UV polygons.
Mdrag Drag mode.
Mpolyedgepoint Combined poly/edge/point mode. Must only be used in ViewportSelect .
Medgepoint Combined edge/point mode. Must only be used in ViewportSelect .
Mworkplane Workplane mode.
BaseDocument. IsEditMode ( )

Check if the editor is in an editable mode. This checks if GetMode() is Mpoints , Medges or Mpolygons .

Return type: bool
Returns: True if the editor is in point/poly editing mode.
BaseDocument. GetBaseDraw ( bd )

Returns the BaseDraw hook of the editor bd .

Parameters: bd ( int ) – If there are multiple views (multiple basedraws), this selects the view.
Return type: c4d.BaseDraw
Returns: The requested view in the editor, or None
BaseDocument. GetActiveBaseDraw ( )

Get the activate BaseDraw in the editor, this is where all drawing should be performed.

Return type: c4d.BaseDraw
Returns: The active view in the editor.
BaseDocument. GetRenderBaseDraw ( )

This is the BaseDraw belonging to the view that the user has chosen as ‘Render View’ (see View menu in Cinema 4D).

Return type: c4d.BaseDraw
Returns: The render view in the editor.
BaseDocument. GetActiveTag ( )

Returns the active selected tag.

Return type: c4d.BaseTag
Returns: The active tag, or None .
BaseDocument. GetMaterials ( )

Returns all materials in a list.

Return type: list of type BaseMaterial
Returns: The list of all materials.
BaseDocument. GetActiveObject ( )

Returns the active selected object.

Return type: c4d.BaseObject
Returns: The active object, or None .
BaseDocument. GetActiveRenderData ( )

Returns the active selected render data.

Return type: c4d.documents.RenderData
Returns: The active render data.

Note

Guaranteed to never be None .

BaseDocument. GetFirstRenderData ( )

Get the first render setting data for this document. The other render settings in the document can be accessed by using the base class list functions: GetNext() , GetPred() , GetDown() and GetUp() .

Return type: c4d.documents.RenderData
Returns: The first render setting, or None if no render settings are associated with this document.
BaseDocument. InsertRenderData ( rd [ , pred=None ] )

Inserts the render setting data into the document’s render setting list. Optionally you can specify the insertion position with the pred parameter, giving the render setting before (right above) the wanted position. Otherwise the render setting is inserted at the first position in the list.

Parameters:
BaseDocument. InsertRenderDataLast ( rd )

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

Parameters:
BaseDocument. GetActiveMaterial ( )

Returns the active selected material.

Return type: c4d.BaseMaterial
Returns: The active material, or None .
BaseDocument. GetData ( [ type ] )

Get the BaseContainer setting of the specified type.

Deprecated since version R16: GetDocumentData() should be used instead.

Parameters: type ( int ) –

Selects the type of the setting to get.

DOCUMENTSETTINGS_GENERAL General settings.
DOCUMENT_TIME BaseTime Current document time.
DOCUMENT_FPS int Frame rate (frames per second).
DOCUMENT_MINTIME BaseTime Start time.
DOCUMENT_MAXTIME BaseTime End time.
DOCUMENT_LOOPMINTIME BaseTime Start preview (loop) time.
DOCUMENT_LOOPMAXTIME BaseTime End preview (loop) time.
DOCUMENT_LOD float Level of detail (0-100%).
DOCUMENT_RENDERLOD bool Render LOD in editor.
DOCUMENT_USEANIMATION bool Use animation.
DOCUMENT_USEEXPRESSIONS bool Use expressions.
DOCUMENT_USEGENERATORS bool Use generators.
DOCUMENT_USEDEFORMERS bool Use deformers.
DOCUMENT_MODE bool Editor mode.
  Mcamera Camera mode.
  Mobject Object mode.
  Mtexture Texture mode.
  Mtextureaxis Texture axis mode.
  Mpoints Point edit mode.
  Medges Edge edit mode.
  Mpolygons Polygon edit mode.
  Manimation Animation mode.
  Mkinematic IK mode.
  Mmodel Model mode.
  Mpaint Paint mode.
  Muvpoints UV points.
  Muvpolygons UV polygons.
  Mdrag Drag mode.
  Mpolyedgepoint Combined poly/edge/point mode. Must only be used in ViewportSelect .
  Medgepoint Combined edge/point mode. Must only be used in ViewportSelect .
  Mworkplane Workplane mode.
DOCUMENT_ACTION int ID of the current tool.
DOCUMENT_USERCHANGE bool Private.
DOCUMENT_PATH str Document file path.
DOCUMENT_NAME str Name of the document.
DOCUMENT_STATEX bool Lock/unlock X-axis.
DOCUMENT_STATEY bool Lock/unlock Y-axis.
DOCUMENT_STATEZ bool Lock/unlock Z-axis.
DOCUMENT_STATEW bool Use world/object coordinate system.
DOCUMENTSETTINGS_MODELING Modeler settings.
See MDATA_Options and toolsnapping.h
DOCUMENTSETTINGS_DOCUMENT Document settings.
DOCUMENT_COLORPROFILE int Input color profile.
  DOCUMENT_COLORPROFILE_SRGB sRGB.
  DOCUMENT_COLORPROFILE_LINEAR Linear.
  DOCUMENT_COLORPROFILE_DISABLED Disabled.
DOCUMENT_LINEARWORKFLOW bool Use linear workflow.
DOCUMENT_DOCUNIT UnitScaleData Document scale.
DOCUMENT_DEFAULTMATERIAL_TYPE int Default object color preset.
  DOCUMENT_DEFAULTMATERIAL_TYPE_WHITE 80% Gray.
  DOCUMENT_DEFAULTMATERIAL_TYPE_BLUE Gray-Blue.
  DOCUMENT_DEFAULTMATERIAL_TYPE_USER Custom.
DOCUMENT_DEFAULTMATERIAL_COLOR Vector Default object color.
DOCUMENT_CLIPPING_PRESET int View clipping preset.
  DOCUMENT_CLIPPING_PRESET_TINY Tiny.
  DOCUMENT_CLIPPING_PRESET_SMALL Small.
  DOCUMENT_CLIPPING_PRESET_MEDIUM Medium.
  DOCUMENT_CLIPPING_PRESET_LARGE Large.
  DOCUMENT_CLIPPING_PRESET_HUGE Huge.
  DOCUMENT_CLIPPING_PRESET_CUSTOM Custom.
DOCUMENT_CLIPPING_PRESET_NEAR float Near view clipping.
DOCUMENT_CLIPPING_PRESET_FAR float Far view clipping.
DOCUMENT_SELECTIONFILTER int Selection filter bit mask.
  SELECTIONFILTERBIT_0 None.
  SELECTIONFILTERBIT_NULL Null.
  SELECTIONFILTERBIT_POLYGON Polygon.
  SELECTIONFILTERBIT_SPLINE Spline.
  SELECTIONFILTERBIT_GENERATOR Generator.
  SELECTIONFILTERBIT_HYPERNURBS Subdivision Surface.
  SELECTIONFILTERBIT_DEFORMER Deformer.
  SELECTIONFILTERBIT_CAMERA Camera.
  SELECTIONFILTERBIT_LIGHT Light.
  SELECTIONFILTERBIT_SCENE Scene.
  SELECTIONFILTERBIT_PARTICLE Particle.
  SELECTIONFILTERBIT_OTHER Other.
  SELECTIONFILTERBIT_JOINT Joint.
DOCUMENT_RESTRICTEDITORSELECTION bool Restrict editor selection (Selection objects).
DOCUMENT_INFO_DATECREATED long Creation date.
DOCUMENT_INFO_PRGCREATOR_NAME str Name of the creation software.
DOCUMENT_INFO_PRGCREATOR_ID int ID of the creation software.
  MAXON_CREATOR_ID MAXON.
DOCUMENT_MULTISELECTIONHIGHLIGHT BaseLink Private.
DOCUMENT_INFO_AUTHOR str Document author.
DOCUMENT_INFO_COPYRIGHT str Copyright info.
DOCUMENT_INFO_README str Info string.
DOCUMENT_INFO_DATESAVED long Last save date.
DOCUMENT_INFO_PRGWRITER_NAME str Software the document was saved last.
DOCUMENT_INFO_PRGWRITER_ID int ID of the software the document was saved last.
  MAXON_CREATOR_ID MAXON.
DOCUMENTSETTINGS_ANIMATIONSYSTEM Time line settings. (Private!)
DOCUMENTSETTINGS_TOOLS Tools settings. (Unused)
Return type: c4d.BaseContainer
Returns: The settings container.
BaseDocument. GetDocumentData ( )

New in version R16.021.

Get the BaseContainer settings of the specified type .

Parameters: type ( int ) –

Selects the type of settings to get:

DOCUMENTSETTINGS_GENERAL General settings.
DOCUMENT_TIME BaseTime Current document time.
DOCUMENT_FPS int Frame rate (frames per second).
DOCUMENT_MINTIME BaseTime Start time.
DOCUMENT_MAXTIME BaseTime End time.
DOCUMENT_LOOPMINTIME BaseTime Start preview (loop) time.
DOCUMENT_LOOPMAXTIME BaseTime End preview (loop) time.
DOCUMENT_LOD float Level of detail (0-100%).
DOCUMENT_RENDERLOD bool Render LOD in editor.
DOCUMENT_USEANIMATION bool Use animation.
DOCUMENT_USEEXPRESSIONS bool Use expressions.
DOCUMENT_USEGENERATORS bool Use generators.
DOCUMENT_USEDEFORMERS bool Use deformers.
DOCUMENT_MODE bool Editor mode.
  Mcamera Camera mode.
  Mobject Object mode.
  Mtexture Texture mode.
  Mtextureaxis Texture axis mode.
  Mpoints Point edit mode.
  Medges Edge edit mode.
  Mpolygons Polygon edit mode.
  Manimation Animation mode.
  Mkinematic IK mode.
  Mmodel Model mode.
  Mpaint Paint mode.
  Muvpoints UV points.
  Muvpolygons UV polygons.
  Mdrag Drag mode.
  Mpolyedgepoint Combined poly/edge/point mode. Must only be used in ViewportSelect .
  Medgepoint Combined edge/point mode. Must only be used in ViewportSelect .
  Mworkplane Workplane mode.
DOCUMENT_ACTION int ID of the current tool.
DOCUMENT_USERCHANGE bool Private.
DOCUMENT_PATH str Document file path.
DOCUMENT_NAME str Name of the document.
DOCUMENT_STATEX bool Lock/unlock X-axis.
DOCUMENT_STATEY bool Lock/unlock Y-axis.
DOCUMENT_STATEZ bool Lock/unlock Z-axis.
DOCUMENT_STATEW bool Use world/object coordinate system.
DOCUMENTSETTINGS_MODELING Modeler settings.
See MDATA_Options and toolsnapping.h
DOCUMENTSETTINGS_DOCUMENT Document settings.
DOCUMENT_COLORPROFILE int Input color profile.
  DOCUMENT_COLORPROFILE_SRGB sRGB.
  DOCUMENT_COLORPROFILE_LINEAR Linear.
  DOCUMENT_COLORPROFILE_DISABLED Disabled.
DOCUMENT_LINEARWORKFLOW bool Use linear workflow.
DOCUMENT_DOCUNIT UnitScaleData Document scale.
DOCUMENT_DEFAULTMATERIAL_TYPE int Default object color preset.
  DOCUMENT_DEFAULTMATERIAL_TYPE_WHITE 80% Gray.
  DOCUMENT_DEFAULTMATERIAL_TYPE_BLUE Gray-Blue.
  DOCUMENT_DEFAULTMATERIAL_TYPE_USER Custom.
DOCUMENT_DEFAULTMATERIAL_COLOR Vector Default object color.
DOCUMENT_CLIPPING_PRESET int View clipping preset.
  DOCUMENT_CLIPPING_PRESET_TINY Tiny.
  DOCUMENT_CLIPPING_PRESET_SMALL Small.
  DOCUMENT_CLIPPING_PRESET_MEDIUM Medium.
  DOCUMENT_CLIPPING_PRESET_LARGE Large.
  DOCUMENT_CLIPPING_PRESET_HUGE Huge.
  DOCUMENT_CLIPPING_PRESET_CUSTOM Custom.
DOCUMENT_CLIPPING_PRESET_NEAR float Near view clipping.
DOCUMENT_CLIPPING_PRESET_FAR float Far view clipping.
DOCUMENT_SELECTIONFILTER int Selection filter bit mask.
  SELECTIONFILTERBIT_0 None.
  SELECTIONFILTERBIT_NULL Null.
  SELECTIONFILTERBIT_POLYGON Polygon.
  SELECTIONFILTERBIT_SPLINE Spline.
  SELECTIONFILTERBIT_GENERATOR Generator.
  SELECTIONFILTERBIT_HYPERNURBS Subdivision Surface.
  SELECTIONFILTERBIT_DEFORMER Deformer.
  SELECTIONFILTERBIT_CAMERA Camera.
  SELECTIONFILTERBIT_LIGHT Light.
  SELECTIONFILTERBIT_SCENE Scene.
  SELECTIONFILTERBIT_PARTICLE Particle.
  SELECTIONFILTERBIT_OTHER Other.
  SELECTIONFILTERBIT_JOINT Joint.
DOCUMENT_RESTRICTEDITORSELECTION bool Restrict editor selection (Selection objects).
DOCUMENT_INFO_DATECREATED long Creation date.
DOCUMENT_INFO_PRGCREATOR_NAME str Name of the creation software.
DOCUMENT_INFO_PRGCREATOR_ID int ID of the creation software.
  MAXON_CREATOR_ID MAXON.
DOCUMENT_MULTISELECTIONHIGHLIGHT BaseLink Private.
DOCUMENT_INFO_AUTHOR str Document author.
DOCUMENT_INFO_COPYRIGHT str Copyright info.
DOCUMENT_INFO_README str Info string.
DOCUMENT_INFO_DATESAVED long Last save date.
DOCUMENT_INFO_PRGWRITER_NAME str Software the document was saved last.
DOCUMENT_INFO_PRGWRITER_ID int ID of the software the document was saved last.
  MAXON_CREATOR_ID MAXON.
DOCUMENTSETTINGS_ANIMATIONSYSTEM Time line settings. (Private!)
DOCUMENTSETTINGS_TOOLS Tools settings. (Unused)
Return type: c4d.BaseContainer
Returns: The settings container.
BaseDocument. SetDocumentData ( type , bc )

New in version R16.021.

Merge the BaseContainer for the specified settings.

Parameters:
  • type ( int ) –

    Selects the type of settings to set:

    DOCUMENTSETTINGS_GENERAL General settings.
    DOCUMENT_TIME BaseTime Current document time.
    DOCUMENT_FPS int Frame rate (frames per second).
    DOCUMENT_MINTIME BaseTime Start time.
    DOCUMENT_MAXTIME BaseTime End time.
    DOCUMENT_LOOPMINTIME BaseTime Start preview (loop) time.
    DOCUMENT_LOOPMAXTIME BaseTime End preview (loop) time.
    DOCUMENT_LOD float Level of detail (0-100%).
    DOCUMENT_RENDERLOD bool Render LOD in editor.
    DOCUMENT_USEANIMATION bool Use animation.
    DOCUMENT_USEEXPRESSIONS bool Use expressions.
    DOCUMENT_USEGENERATORS bool Use generators.
    DOCUMENT_USEDEFORMERS bool Use deformers.
    DOCUMENT_MODE bool Editor mode.
      Mcamera Camera mode.
      Mobject Object mode.
      Mtexture Texture mode.
      Mtextureaxis Texture axis mode.
      Mpoints Point edit mode.
      Medges Edge edit mode.
      Mpolygons Polygon edit mode.
      Manimation Animation mode.
      Mkinematic IK mode.
      Mmodel Model mode.
      Mpaint Paint mode.
      Muvpoints UV points.
      Muvpolygons UV polygons.
      Mdrag Drag mode.
      Mpolyedgepoint Combined poly/edge/point mode. Must only be used in ViewportSelect .
      Medgepoint Combined edge/point mode. Must only be used in ViewportSelect .
      Mworkplane Workplane mode.
    DOCUMENT_ACTION int ID of the current tool.
    DOCUMENT_USERCHANGE bool Private.
    DOCUMENT_PATH str Document file path.
    DOCUMENT_NAME str Name of the document.
    DOCUMENT_STATEX bool Lock/unlock X-axis.
    DOCUMENT_STATEY bool Lock/unlock Y-axis.
    DOCUMENT_STATEZ bool Lock/unlock Z-axis.
    DOCUMENT_STATEW bool Use world/object coordinate system.
    DOCUMENTSETTINGS_MODELING Modeler settings.
    See MDATA_Options and toolsnapping.h
    DOCUMENTSETTINGS_DOCUMENT Document settings.
    DOCUMENT_COLORPROFILE int Input color profile.
      DOCUMENT_COLORPROFILE_SRGB sRGB.
      DOCUMENT_COLORPROFILE_LINEAR Linear.
      DOCUMENT_COLORPROFILE_DISABLED Disabled.
    DOCUMENT_LINEARWORKFLOW bool Use linear workflow.
    DOCUMENT_DOCUNIT UnitScaleData Document scale.
    DOCUMENT_DEFAULTMATERIAL_TYPE int Default object color preset.
      DOCUMENT_DEFAULTMATERIAL_TYPE_WHITE 80% Gray.
      DOCUMENT_DEFAULTMATERIAL_TYPE_BLUE Gray-Blue.
      DOCUMENT_DEFAULTMATERIAL_TYPE_USER Custom.
    DOCUMENT_DEFAULTMATERIAL_COLOR Vector Default object color.
    DOCUMENT_CLIPPING_PRESET int View clipping preset.
      DOCUMENT_CLIPPING_PRESET_TINY Tiny.
      DOCUMENT_CLIPPING_PRESET_SMALL Small.
      DOCUMENT_CLIPPING_PRESET_MEDIUM Medium.
      DOCUMENT_CLIPPING_PRESET_LARGE Large.
      DOCUMENT_CLIPPING_PRESET_HUGE Huge.
      DOCUMENT_CLIPPING_PRESET_CUSTOM Custom.
    DOCUMENT_CLIPPING_PRESET_NEAR float Near view clipping.
    DOCUMENT_CLIPPING_PRESET_FAR float Far view clipping.
    DOCUMENT_SELECTIONFILTER int Selection filter bit mask.
      SELECTIONFILTERBIT_0 None.
      SELECTIONFILTERBIT_NULL Null.
      SELECTIONFILTERBIT_POLYGON Polygon.
      SELECTIONFILTERBIT_SPLINE Spline.
      SELECTIONFILTERBIT_GENERATOR Generator.
      SELECTIONFILTERBIT_HYPERNURBS Subdivision Surface.
      SELECTIONFILTERBIT_DEFORMER Deformer.
      SELECTIONFILTERBIT_CAMERA Camera.
      SELECTIONFILTERBIT_LIGHT Light.
      SELECTIONFILTERBIT_SCENE Scene.
      SELECTIONFILTERBIT_PARTICLE Particle.
      SELECTIONFILTERBIT_OTHER Other.
      SELECTIONFILTERBIT_JOINT Joint.
    DOCUMENT_RESTRICTEDITORSELECTION bool Restrict editor selection (Selection objects).
    DOCUMENT_INFO_DATECREATED long Creation date.
    DOCUMENT_INFO_PRGCREATOR_NAME str Name of the creation software.
    DOCUMENT_INFO_PRGCREATOR_ID int ID of the creation software.
      MAXON_CREATOR_ID MAXON.
    DOCUMENT_MULTISELECTIONHIGHLIGHT BaseLink Private.
    DOCUMENT_INFO_AUTHOR str Document author.
    DOCUMENT_INFO_COPYRIGHT str Copyright info.
    DOCUMENT_INFO_README str Info string.
    DOCUMENT_INFO_DATESAVED long Last save date.
    DOCUMENT_INFO_PRGWRITER_NAME str Software the document was saved last.
    DOCUMENT_INFO_PRGWRITER_ID int ID of the software the document was saved last.
      MAXON_CREATOR_ID MAXON.
    DOCUMENTSETTINGS_ANIMATIONSYSTEM Time line settings. (Private!)
    DOCUMENTSETTINGS_TOOLS Tools settings. (Unused)
  • bc ( c4d.BaseContainer ) – The container to take the new settings from.
BaseDocument. GetSettingsInstance ( type )

Returns the internal settings object. Changes to the returned container are reflected in the document.

Parameters: int ( type ) –

Selects the type of settings to get:

DOCUMENTSETTINGS_GENERAL General settings.
DOCUMENT_TIME BaseTime Current document time.
DOCUMENT_FPS int Frame rate (frames per second).
DOCUMENT_MINTIME BaseTime Start time.
DOCUMENT_MAXTIME BaseTime End time.
DOCUMENT_LOOPMINTIME BaseTime Start preview (loop) time.
DOCUMENT_LOOPMAXTIME BaseTime End preview (loop) time.
DOCUMENT_LOD float Level of detail (0-100%).
DOCUMENT_RENDERLOD bool Render LOD in editor.
DOCUMENT_USEANIMATION bool Use animation.
DOCUMENT_USEEXPRESSIONS bool Use expressions.
DOCUMENT_USEGENERATORS bool Use generators.
DOCUMENT_USEDEFORMERS bool Use deformers.
DOCUMENT_MODE bool Editor mode.
  Mcamera Camera mode.
  Mobject Object mode.
  Mtexture Texture mode.
  Mtextureaxis Texture axis mode.
  Mpoints Point edit mode.
  Medges Edge edit mode.
  Mpolygons Polygon edit mode.
  Manimation Animation mode.
  Mkinematic IK mode.
  Mmodel Model mode.
  Mpaint Paint mode.
  Muvpoints UV points.
  Muvpolygons UV polygons.
  Mdrag Drag mode.
  Mpolyedgepoint Combined poly/edge/point mode. Must only be used in ViewportSelect .
  Medgepoint Combined edge/point mode. Must only be used in ViewportSelect .
  Mworkplane Workplane mode.
DOCUMENT_ACTION int ID of the current tool.
DOCUMENT_USERCHANGE bool Private.
DOCUMENT_PATH str Document file path.
DOCUMENT_NAME str Name of the document.
DOCUMENT_STATEX bool Lock/unlock X-axis.
DOCUMENT_STATEY bool Lock/unlock Y-axis.
DOCUMENT_STATEZ bool Lock/unlock Z-axis.
DOCUMENT_STATEW bool Use world/object coordinate system.
DOCUMENTSETTINGS_MODELING Modeler settings.
See MDATA_Options and toolsnapping.h
DOCUMENTSETTINGS_DOCUMENT Document settings.
DOCUMENT_COLORPROFILE int Input color profile.
  DOCUMENT_COLORPROFILE_SRGB sRGB.
  DOCUMENT_COLORPROFILE_LINEAR Linear.
  DOCUMENT_COLORPROFILE_DISABLED Disabled.
DOCUMENT_LINEARWORKFLOW bool Use linear workflow.
DOCUMENT_DOCUNIT UnitScaleData Document scale.
DOCUMENT_DEFAULTMATERIAL_TYPE int Default object color preset.
  DOCUMENT_DEFAULTMATERIAL_TYPE_WHITE 80% Gray.
  DOCUMENT_DEFAULTMATERIAL_TYPE_BLUE Gray-Blue.
  DOCUMENT_DEFAULTMATERIAL_TYPE_USER Custom.
DOCUMENT_DEFAULTMATERIAL_COLOR Vector Default object color.
DOCUMENT_CLIPPING_PRESET int View clipping preset.
  DOCUMENT_CLIPPING_PRESET_TINY Tiny.
  DOCUMENT_CLIPPING_PRESET_SMALL Small.
  DOCUMENT_CLIPPING_PRESET_MEDIUM Medium.
  DOCUMENT_CLIPPING_PRESET_LARGE Large.
  DOCUMENT_CLIPPING_PRESET_HUGE Huge.
  DOCUMENT_CLIPPING_PRESET_CUSTOM Custom.
DOCUMENT_CLIPPING_PRESET_NEAR float Near view clipping.
DOCUMENT_CLIPPING_PRESET_FAR float Far view clipping.
DOCUMENT_SELECTIONFILTER int Selection filter bit mask.
  SELECTIONFILTERBIT_0 None.
  SELECTIONFILTERBIT_NULL Null.
  SELECTIONFILTERBIT_POLYGON Polygon.
  SELECTIONFILTERBIT_SPLINE Spline.
  SELECTIONFILTERBIT_GENERATOR Generator.
  SELECTIONFILTERBIT_HYPERNURBS Subdivision Surface.
  SELECTIONFILTERBIT_DEFORMER Deformer.
  SELECTIONFILTERBIT_CAMERA Camera.
  SELECTIONFILTERBIT_LIGHT Light.
  SELECTIONFILTERBIT_SCENE Scene.
  SELECTIONFILTERBIT_PARTICLE Particle.
  SELECTIONFILTERBIT_OTHER Other.
  SELECTIONFILTERBIT_JOINT Joint.
DOCUMENT_RESTRICTEDITORSELECTION bool Restrict editor selection (Selection objects).
DOCUMENT_INFO_DATECREATED long Creation date.
DOCUMENT_INFO_PRGCREATOR_NAME str Name of the creation software.
DOCUMENT_INFO_PRGCREATOR_ID int ID of the creation software.
  MAXON_CREATOR_ID MAXON.
DOCUMENT_MULTISELECTIONHIGHLIGHT BaseLink Private.
DOCUMENT_INFO_AUTHOR str Document author.
DOCUMENT_INFO_COPYRIGHT str Copyright info.
DOCUMENT_INFO_README str Info string.
DOCUMENT_INFO_DATESAVED long Last save date.
DOCUMENT_INFO_PRGWRITER_NAME str Software the document was saved last.
DOCUMENT_INFO_PRGWRITER_ID int ID of the software the document was saved last.
  MAXON_CREATOR_ID MAXON.
DOCUMENTSETTINGS_ANIMATIONSYSTEM Time line settings. (Private!)
DOCUMENTSETTINGS_TOOLS Tools settings. (Unused)
Return type: c4d.BaseContainer
Returns: The settings container.
BaseDocument. GetFirstObject ( )

Returns the first object.

Return type: c4d.BaseObject
Returns: The first object, or None if no objects are contained in this document.
BaseDocument. GetFirstMaterial ( )

Returns the first material.

Return type: c4d.BaseMaterial
Returns: The active material, or None .
BaseDocument. GetActiveMaterials ( )

Returns the material selection.

Return type: list of type BaseMaterial
Returns: The selected materials in a list.
BaseDocument. GetOrderedActiveObjects ( )

Deprecated since version R13.051: Use GetActiveObjects() with the corresponding flag instead.

Returns the objects in an ordered list.

Return type: list of BaseList2D
Returns: The oredered list.
BaseDocument. GetActiveObjects ( flags )

Returns the object selection.

Parameters: flags ( int ) –

Flags:

GETACTIVEOBJECTFLAGS_0 None.
GETACTIVEOBJECTFLAGS_CHILDREN Child objects are added to the selection too, provided they are selected. Otherwise only the topmost parent of each chain is added.
GETACTIVEOBJECTFLAGS_SELECTIONORDER The selection array is sorted in the selection order, e.g. the first selected object is the first element in the array.
Return type: list of type BaseList2D
Returns: The selected objects in a list.
BaseDocument. GetActiveTags ( )

Returns the tag selection.

Return type: list of type BaseTag
Returns: The selected tags in a list.
BaseDocument. GetSelection ( )

Returns the selection of materials, tags and objects in a list.

Return type: list of type BaseList2D
Returns: The selected objects in a list.
BaseDocument. GetActiveObjectsFilter ( children , type , instanceof )

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

Parameters:
  • children ( bool ) – If True then children are also added to selection, provided that they are selected. Otherwise only the topmost parent in each chain is added.
  • type ( int ) – Checked against C4DAtom.GetType() . Pass NOTOK to ignore this test.
  • instanceof ( int ) – Checked against C4DAtom.IsInstanceOf() . Pass NOTOK to ignore this test.
Return type:

list of type BaseList2D

Returns:

The selected objects in a list.

BaseDocument. GetRealActiveObject ( help )

New in version R19.

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

Parameters: help ( list or tuple ) – Can be set to None or for speedup purposes pass a list/tuple of active objects.
Return type: tuple( c4d.BaseObject , bool)
Returns: A tuple with the real active object and a bool telling if multiple objects are selected. None if the method failed.
BaseDocument. GetObjects ( )

Returns the highest objects without children.

Return type: list of type BaseObject
Returns: The objects.
BaseDocument. SetSelection ( bl [ , mode=SELECTION_NEW ] )

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

Parameters:
  • bl ( c4d.BaseList2D ) – The baselist object within this document that you want to make active. Must be in the document already.
  • mode ( int ) –

    The selection mode:

    SELECTION_NEW Starts a new selection.
    SELECTION_ADD Adds to the current selection
    SELECTION_SUB Subtracts from the current selection.
BaseDocument. SearchMaterial ( name )

Search for a material with the same case sensitive name.

Parameters: name ( str ) – The name of the material to search for.
Return type: c4d.BaseMaterial
Returns: The material or None if nothing was found.
BaseDocument. SearchMaterialInc ( name )

Search for a material with the closest matching name.

Parameters: name ( str ) – The name of the material to search for.
Return type: c4d.BaseMaterial
Returns: The material or None if nothing was found.
BaseDocument. SearchObject ( name )

Search for an object with the same case sensitive name.

Parameters: name ( str ) – The name of the object to search for.
Return type: c4d.BaseObject
Returns: The object or None if nothing was found.
BaseDocument. SearchObjectInc ( name )

Search for an object with the closest name.

Parameters: name ( str ) – The name of the object to search for.
Return type: c4d.BaseObject
Returns: The object or None if nothing was found.
BaseDocument. GetHighest ( type , editor )

The first object in object manager hierarchy of type type . It searches objects that are not deactivated in the object manager (set to red).

Parameters:
  • type ( int ) – the object type
  • editor ( bool ) – True will search using the ‘editor dot’ in the Object Manager, False will use the ‘render dot’.
Return type:

c4d.BaseObject

Returns:

The first requested object or None if nothing was found.

BaseDocument. InsertObject ( op [ , parent=None , pred=None , checknames=False ] )

Note

If both pred and parent are provided then pred has precedence.

Inserts the object into the document’s object hierarchy. 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 prev object. If neither is given, the object is inserted at the top of the hierarchy.

Raises:

ReferenceError – If the passed objects ( parent and pred ) are not in the same document.

Parameters:
  • op ( c4d.BaseObject ) – Object to insert into the document.
  • parent ( c4d.BaseObject ) – Optional parent to insert the object as a child of.
  • pred ( c4d.BaseObject ) – Optional insertion point.
  • checknames ( bool ) – Check for duplicate names and append .1, .2 etc.
BaseDocument. InsertMaterial ( op [ , pred=None , checknames=None ] )

Inserts the material into the document’s material list. Optionally you can specify the insertion position with 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:
  • op ( c4d.BaseMaterial ) – Material to insert into the document.
  • pred ( c4d.BaseObject ) – Optional insertion point for the material. Require condition pred.GetDocument()==op.GetDocument()==op . That means, the object has to be in the same document.
  • checknames ( bool ) – Check for duplicate names and append .1, .2 etc.
BaseDocument. GetHelperAxis ( )

Get the helper axis for the current multi selection.

Return type: c4d.BaseObject
Returns: The axis object.
BaseDocument. GetChanged ( )

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

Return type: bool
Returns: True if the document has been changed.
BaseDocument. SetChanged ( )

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

BaseDocument. IsAxisEnabled ( )

New in version R14.014.

Returns the state of the object axis modifier.

Note

c4d.CallCommand(12102) toggles the tool.

Return type: bool
Returns: True if the object axis modifier is enabled, otherwise False .
BaseDocument. SendInfo ( type , format , fn , bl , hooks_only )

New in version R14.014.

Sends MSG_DOCUMENTINFO messages.

Parameters:
  • type ( int ) –

    The message type:

    MSG_DOCUMENTINFO_TYPE_SETACTIVE Document was set as active.
    MSG_DOCUMENTINFO_TYPE_LOAD Document was loaded.
    MSG_DOCUMENTINFO_TYPE_MERGE Document was merged.
    MSG_DOCUMENTINFO_TYPE_BEFOREMERGE Document before merging.
    MSG_DOCUMENTINFO_TYPE_BEFOREMERGE_RESULT Document before merging result.
    MSG_DOCUMENTINFO_TYPE_SAVE_BEFORE The document is about to be written.
    MSG_DOCUMENTINFO_TYPE_SAVE_AFTER Document was saved.
    MSG_DOCUMENTINFO_TYPE_SAVEPROJECT_BEFORE Save Project is about to be executed.
    MSG_DOCUMENTINFO_TYPE_SAVEPROJECT_AFTER Save Project was executed.
    MSG_DOCUMENTINFO_TYPE_REMOVE The document is removed from the document list. All structures are still accessible.
    MSG_DOCUMENTINFO_TYPE_TOOL_CHANGED Tool changed.
    MSG_DOCUMENTINFO_TYPE_OBJECT_INSERT Objects got inserted into the document.
    MSG_DOCUMENTINFO_TYPE_TAG_INSERT Tags got inserted into the document.
    MSG_DOCUMENTINFO_TYPE_MATERIAL_INSERT Materials got inserted into the document.
    MSG_DOCUMENTINFO_TYPE_UNDO Undo was called.
    MSG_DOCUMENTINFO_TYPE_REDO Redo was called.
    MSG_DOCUMENTINFO_TYPE_PASTE Paste was called.
    MSG_DOCUMENTINFO_TYPE_COPY Copy was called. Private.
    MSG_DOCUMENTINFO_TYPE_LOAD_XREFS Private.
    MSG_DOCUMENTINFO_TYPE_MERGE_XREFS Private.
    MSG_DOCUMENTINFO_TYPE_XREFS_IMPORTED Private.
    MSG_DOCUMENTINFO_TYPE_MAKEPROJECT Sent around during ‘Save as Project’ for each texture / asset it copies. The data contains the source and destination files. This message is only sent to scenehooks.
    MSG_DOCUMENTINFO_TYPE_RENDER_CLONE Sent directly after a document is cloned for rendering (render done with RENDERFLAGS_NODOCUMENTCLONE not set). This message is only sent to scenehooks.
  • format ( int ) –

    The file format: (Set for load, merge and before/after save only. Otherwise NOTOK .)

    FORMAT_C4DIMPORT Cinema 4D open
    FORMAT_C4DEXPORT Cinema 4D save
    FORMAT_XMLIMPORT XML import
    FORMAT_XMLEXPORT XML export
    FORMAT_C4D4IMPORT Cinema 4D R4 import
    FORMAT_C4D5IMPORT Cinema 4D R5 import
    FORMAT_VRML1IMPORT VRML 1 import
    FORMAT_VRML1EXPORT VRML 1 export
    FORMAT_VRML2IMPORT VRML 2 import
    FORMAT_VRML2EXPORT VRML 2 export
    FORMAT_DXFIMPORT DXF import
    FORMAT_DXFEXPORT DXF export
    FORMAT_3DSIMPORT 3DS import
    FORMAT_3DSEXPORT 3DS export
    FORMAT_OBJIMPORT Obj import
    FORMAT_OBJEXPORT Obj export
    FORMAT_Q3DIMPORT QuickDraw 3D import
    FORMAT_Q3DEXPORT QuickDraw 3D export
    FORMAT_LWSIMPORT Lws import
    FORMAT_LWOIMPORT Lwo import
    FORMAT_AIIMPORT Ai import
    FORMAT_DEMIMPORT Dem import
    FORMAT_D3DEXPORT Direct3D import
  • fn ( str ) –

    The document filename.

    Note

    This is not always the same as GetDocumentPath() . E.g. for MSG_DOCUMENTINFO_TYPE_SAVE_BEFORE GetDocumentPath() still contains the old path whereas fn designates the real file.

  • bl ( c4d.BaseList2D ) –

    The object/tag/material that got inserted. It is used if type is of one of the following types:

    • MSG_DOCUMENTINFO_TYPE_OBJECT_INSERT
    • MSG_DOCUMENTINFO_TYPE_TAG_INSERT
    • MSG_DOCUMENTINFO_TYPE_MATERIAL_INSERT
  • hooks_only ( bool ) – If True send only to scene hooks.
BaseDocument. GetDocPreviewBitmap ( )

New in version R15.037.

Get the preview bitmap of the document.

Return type: c4d.bitmaps.BaseBitmap
Returns: The preview bitmap of the document, or None if it could not be retrieved.
BaseDocument. GetTakeData ( )

New in version R17.032.

Gets the take data for the document.

Return type: c4d.modules.takesystem.TakeData
Returns: The take data.
BaseDocument. GetTargetObject ( )

New in version R17.048.

Gets the target object within a multi-selection.

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.
Return type: c4d.BaseObject
Returns: The target object, or None if it fails or there is no selection.
BaseDocument. SetTargetObject ( op )

New in version R17.048.

Sets the target object within a multi-selection.

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.
Parameters: op ( c4d.BaseObject ) – The object to set as the target.
BaseDocument. GetDefaultKey ( )

New in version R19.

Retrieves the document’s default keying settings.

Return type: tuple( c4d.CKey , bool)
Returns: A tuple containing a key with the document’s default settings and a bool giving the document’s default overdub state. None if the function failed.
BaseDocument. SetDefaultKey ( key , overdub )

New in version R19.

Sets the document’s default keying settings.

Parameters:
  • key ( c4d.CKey ) – The key to set the new default document’s settings.
  • overdub ( bool ) – The 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).
BaseDocument. GetPickSession ( )

New in version R19.

Returns information about the current pick session.

Return type: tuple(list, bool)
Returns: A tuple with the list of picked objects and the multi-pick state. None if there is no active pick session.
BaseDocument. StartPickSession ( callback , multi )

New in version R19.

Starts a pick session.

Parameters:
  • callback (function( active , multi )) –

    The pick session callback. The function does not need to return a value. The passed arguments are:

    active : list of c4d.BaseObject : The list of picked objects. multi : bool : The multi-pick state.
  • multi ( bool ) – Pass True for multi-pick sessions. Usually a pick session ends when something is selected. With a multi-pick session it ends when the user terminates it (ESC key or double-click).
BaseDocument. StopPickSession ( cancel )

New in version R19.

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

Parameters: cancel ( bool ) – Pass True to cancel a pick session, for instance if an error occurred. Pass False if the pick session is ended regularly.

Document Caching

Sometimes you want to cache stuff and browse through the time of a document. The following code snippet shows you how to do it in the best way:

import c4d
def BrowseDoc(doc):
  """ Pass the document you want to run the time through"""
  ctime = doc.GetTime() # Save current time
  # Get FPS and minimum + maximum frames
  fps = doc.GetFps()
  start = doc.GetMinTime().GetFrame(fps)
  until  = doc.GetMaxTime().GetFrame(fps)
  # Look through the frames
  for frame in xrange(start, until+1):
    c4d.StatusSetBar(100.0*float(frame-start)/float(until-start))
    doc.SetTime(c4d.BaseTime(frame, fps))
    c4d.DrawViews(c4d.DRAWFLAGS_ONLY_ACTIVE_VIEW|c4d.DRAWFLAGS_NO_THREAD|c4d.DRAWFLAGS_NO_REDUCTION|c4d.DRAWFLAGS_STATICBREAK)
    # Do your caching here
    # 'frame' is the current frame
    print "Caching frame", str(frame)
    c4d.GeSyncMessage(c4d.EVMSG_TIMECHANGED) # Update timeline
  doc.SetTime(ctime) # Set time back
  c4d.EventAdd(c4d.EVENT_ANIMATE)
  c4d.StatusClear()
					

Table Of Contents