c4d.documents.BaseDocument¶
-
class
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.
Methods Signatures
Magic Methods
Deprecated
Deprecated since version R16: |
|
Deprecated since version R13.051: Use |
Uncategorized
Set the frames per second. |
|
Returns the fps of the document. |
|
Get the Level of Detail for this document. |
|
Get the Level of Detail for this document. |
|
Get if the level of detail for rendering should be used in the editor. |
|
Set the level of detail for rendering. |
|
Get the editor redraw time. |
|
Returns the list of layers of the document. |
|
Get the plane in which the splines are created, such as XY plane. |
|
Rewinds the whole document (from time 0 to current time) when the next event EVMSG_CHANGE or |
|
Get the |
|
Empties the document, deleting and freeing all resources used. |
|
Set the file name of the document. |
|
Set the path of the document. |
|
Returns the file name of the document. |
|
Returns the path of the document. |
|
Returns the particle master system of the document. |
|
Makes sure that
GetBaseDraw() (0) is accessible. |
|
Animate the current frame of the document.
|
|
Finds a scene hook by ID. |
|
Tells Cinema 4D to start building a list of undos into a single undo action for the user. |
|
Adds an undo type to the list of undo operations started with |
|
Returns the element of the last undo action. E.g. if you have added a |
|
Flushes the complete undo + redo buffer. |
|
Returns the last undo state of the Cinema 4D element bl (object, tag, material, etc.) for the specified undo action type. |
|
Perform a redo on this document (undo the last undo). |
|
Perform an undo operation, same as the user selecting Undo from within Cinema 4D. |
|
End the building of multiple undo actions into a single user undo. |
|
Records a key for op at time. |
|
Compares the object chain op to undo and sets keyframes for all the changes. |
|
Records the active objects in the document. |
|
Animate a node in this document at the given time. |
|
Make a clone of the document and turn all objects into polygon based objects. |
|
Set the starting time for the timeline of this document. |
|
Set the end time of the timeline for this document. |
|
Get the starting time for the timeline of this document. |
|
Get the end time for the timeline of this document. |
|
Returns the min time. |
|
Set the current time for this documents timeline. |
|
Returns the time of the left boundary of the document’s preview range (loop range). |
|
Sets the left boundary of the document’s preview range (loop range) to the given time. |
|
Returns the time of the right boundary of the document’s preview range (loop range). |
|
Sets the right boundary of the document’s preview range (loop range) to the given time. |
|
Modifies the current multi selection with op, depending on mode. |
|
Sets a tag be the currently active one. |
|
Modifies the current multi selection with op, depending on mode. |
|
Sets the active render settings for the document, these are the settings that are used for rendering. |
|
Returns a collection of all used textures in the document and optionally only for the objects in ar. |
|
Set the current tool in the editor. |
|
Get the ID of the current active tool in the editor. |
|
Gets the original tool data container. |
|
Set the main mode of the editor. |
|
Get the main mode of the editor. |
|
Check if the editor is in an editable mode. |
|
Returns the BaseDraw hook of the editor bd. |
|
Get the activate BaseDraw in the editor, this is where all drawing should be performed. |
|
This is the BaseDraw belonging to the view that the user has chosen as ‘Render View’ (see View menu in Cinema 4D). |
|
Returns the active selected tag. |
|
Returns all materials in a list. |
|
Returns the active selected object. |
|
Returns the active selected render data. |
|
Gets the first render data or options of the document. |
|
Inserts the render data into the document’s render settings hierarchy.
|
|
Inserts the render data as last child into the document’s render data list. |
|
Returns the active selected material. |
|
Get the |
|
Merges the |
|
Returns the internal settings object. |
|
Returns the first object. |
|
Returns the first material. |
|
Returns the material selection. |
|
Returns the object selection. |
|
Returns the tag selection. |
|
Returns the selection of materials, tags and objects in a list. |
|
|
Returns the active object multi selection and removes objects that do not match the filter given by type and instanceof. |
Returns the active object or the dummy axis if multiple objects are selected. |
|
Returns the highest objects without children. |
|
Sets the active selection.
|
|
Search for a material with the same case sensitive name. |
|
Search for an object with the same case sensitive name. |
|
The first object in object manager hierarchy of type type.
|
|
Inserts the object into the document’s object hierarchy.
|
|
Inserts the material into the document’s material list.
|
|
Get the helper axis for the current multi selection. |
|
Checks if the document has been changed since it was last saved. |
|
Set the changed state of the document to reflect it has been modified. |
|
Returns the state of the object axis modifier. |
|
Sends MSG_DOCUMENTINFO messages. |
|
Get the preview bitmap of the document. |
|
Gets the take data for the document. |
|
Gets the target object within a multi-selection. |
|
Sets the target object within a multi-selection. |
|
Retrieves the document’s default keying settings. |
|
Sets the document’s default keying settings. |
|
Returns information about the current pick session. |
|
Starts a pick session. |
|
Ends the pick session.
|
|
Sets the track default interpolation mode. |
|
Gets the track default interpolation mode. |
|
Returns the SceneRepository description. |
Inheritance
Parent Class:
Methods Documentation
-
BaseDocument.
__init__
(self)¶
-
BaseDocument.
GetData
(self, type)¶ Deprecated since version R16:
GetDocumentData()
should be used instead.Get the
BaseContainer
settings of the specified type.- Parameters
type (int) – The DOCUMENTSETTINGS type of the settings to get. See DOCUMENTSETTINGS.
- Return type
- Returns
The settings for the document.
-
BaseDocument.
GetOrderedActiveObjects
(self)¶ Deprecated since version R13.051: Use
GetActiveObjects()
with the corresponding flag instead.Returns the objects in an ordered list.
- Return type
List[c4d.BaseList2D]
- Returns
The oredered list.
-
BaseDocument.
SetFps
(self, fps)¶ Set the frames per second.
- Parameters
fps (int) – The fps.
-
BaseDocument.
GetFps
(self)¶ Returns the fps of the document.
- Return type
int
- Returns
The fps
-
BaseDocument.
SetLOD
(self, 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
(self)¶ 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
(self)¶ 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
(self, lod)¶ Set the level of detail for rendering.
- Parameters
lod (bool) – True if using the render lod.
-
BaseDocument.
GetDrawTime
(self)¶ Get the editor redraw time.
- Return type
int
- Returns
The editor redraw time.
-
BaseDocument.
GetLayerObjectRoot
(self)¶ 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
Optional[c4d.GeListHead]
- Returns
The head of the list of the document’s layers.
-
BaseDocument.
GetSplinePlane
(self)¶ 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
(self, flags=0)¶ Rewinds the whole document (from time 0 to current time) when the next event EVMSG_CHANGE or
DrawViews()
is processed.- Parameters
flags (int) – Not used.
-
BaseDocument.
GetBaseDrawCount
(self)¶ Get the
BaseDraw
count in the editor view.- Return type
int
- Returns
The count.
-
BaseDocument.
Flush
(self)¶ Empties the document, deleting and freeing all resources used.
-
BaseDocument.
SetDocumentName
(self, 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
(self, 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
(self)¶ 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
(self)¶ 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
(self)¶ Returns the particle master system of the document.
- Return type
- Parameters
type – The particle system of the document. Is useless when the document was deleted, None if Thinking Particles is not installed.
-
BaseDocument.
ForceCreateBaseDraw
(self)¶ - 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
(self, 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 (Optional[ 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:
Symbol ID
Description
BUILDFLAGS_NONE
None.
BUILDFLAGS_INTERNALRENDERER
Rendering in the editor.
BUILDFLAGS_EXTERNALRENDERER
Rendering externally.
BUILDFLAGS_ISOPARM
Generate isoparam objects.
BUILDFLAGS_EXPORTONLY
Exporting (e.g. Alembic).
- Return type
bool
- Returns
True if successful, otherwise False.
-
BaseDocument.
FindSceneHook
(self, id)¶ Finds a scene hook by ID.
- Parameters
id (int) – The scene hook ID.
- Return type
Optional[c4d.BaseList2D]
- Returns
The found scene hook, or None.
-
BaseDocument.
StartUndo
(self)¶ Tells Cinema 4D to start building a list of undos into a single undo action for the user.
- 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_NEWOBJ, cube) # Support redo the insert operation doc.EndUndo() # Do not forget to close the undo support
-
BaseDocument.
AddUndo
(self, 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 likeBaseDocument.SetActiveObject()
which creates another undo:tag = c4d.UVWTag(op.GetPointCount()) op.InsertTag(tag) doc.AddUndo(c4d.UNDOTYPE_NEWOBJ, tag) c4d.EventAdd()
- Parameters
type (int) –
The undo type:
Symbol ID
Description
UNDOTYPE_NONE
None.
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 the change.)
UNDOTYPE_CHANGE_NOCHILDREN
Same as UNDOTYPE_CHANGE, but without child modifications. (Needs to be called before the change.)
UNDOTYPE_CHANGE_SMALL
Change to local data only (e.g. data container), no substructures (e.g. no tags on an object) and no children. (Needs to be called before the change.)
UNDOTYPE_CHANGE_SELECTION
Change to point/poly/edge selection only. (Needs to be called before the change.)
UNDOTYPE_NEWOBJ
New object/node/tag etc. was created. (Needs to be called after the change.)
UNDOTYPE_DELETEOBJ
Object/node/tag etc. to be deleted. (Needs to be called before the change.)
UNDOTYPE_ACTIVATE
Automatically managed by
BaseDocument.SetActiveObject()
/SetActiveTag()
/SetActiveMaterial()
etc. No need to use manually.UNDOTYPE_DEACTIVATE
Automatically managed by
BaseDocument.SetActiveObject()
/SetActiveTag()
/SetActiveMaterial()
etc. No need to use manually.UNDOTYPE_BITS
Change to object bits, e.g. selection status. (Needs to be called before the change.)
UNDOTYPE_HIERARCHY_PSR
Change in hierarchical placement and PSR values. (Needs to be called before the change.)
UNDOTYPE_PRIVATE_STRING
Private
UNDOTYPE_PRIVATE_MULTISELECTIONAXIS
Private.
UNDOTYPE_START
Private.
UNDOTYPE_END
Private.
data (c4d.BaseList2D) – The object the undo has been added for.
allowFromThread (Optional[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
(self)¶ 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
- Returns
The last undo element.
-
BaseDocument.
FlushUndoBuffer
(self)¶ Flushes the complete undo + redo buffer.
New in version R14.014.
Warning
Only call when absolutely needed.
-
BaseDocument.
FindUndoPtr
(self, bl, type)¶ Returns the last undo state of the Cinema 4D element bl (object, tag, material, etc.) for the specified undo action type.
New in version R14.014.
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:
Symbol ID
Description
UNDOTYPE_NONE
None.
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 the change.)
UNDOTYPE_CHANGE_NOCHILDREN
Same as UNDOTYPE_CHANGE, but without child modifications. (Needs to be called before the change.)
UNDOTYPE_CHANGE_SMALL
Change to local data only (e.g. data container), no substructures (e.g. no tags on an object) and no children. (Needs to be called before the change.)
UNDOTYPE_CHANGE_SELECTION
Change to point/poly/edge selection only. (Needs to be called before the change.)
UNDOTYPE_NEWOBJ
New object/node/tag etc. was created. (Needs to be called after the change.)
UNDOTYPE_DELETEOBJ
Object/node/tag etc. to be deleted. (Needs to be called before the change.)
UNDOTYPE_ACTIVATE
Automatically managed by
BaseDocument.SetActiveObject()
/SetActiveTag()
/SetActiveMaterial()
etc. No need to use manually.UNDOTYPE_DEACTIVATE
Automatically managed by
BaseDocument.SetActiveObject()
/SetActiveTag()
/SetActiveMaterial()
etc. No need to use manually.UNDOTYPE_BITS
Change to object bits, e.g. selection status. (Needs to be called before the change.)
UNDOTYPE_HIERARCHY_PSR
Change in hierarchical placement and PSR values. (Needs to be called before the change.)
UNDOTYPE_PRIVATE_STRING
Private
UNDOTYPE_PRIVATE_MULTISELECTIONAXIS
Private.
UNDOTYPE_START
Private.
UNDOTYPE_END
Private.
- Return type
- Returns
The last undo element.
-
BaseDocument.
DoRedo
(self)¶ Perform a redo on this document (undo the last undo).
- Return type
bool
- Returns
Success of the operation.
-
BaseDocument.
DoUndo
(self, 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()
andEndUndo()
. If multiple is True then all theAddUndo()
steps will be undone. Otherwise only the lastAddUndo()
step will be undone. IfEndUndo()
has been called then all steps are always undone.- Return type
bool
- Returns
True if successful, otherwise False.
-
BaseDocument.
EndUndo
(self)¶ End the building of multiple undo actions into a single user undo.
Note
This must be paired with
StartUndo()
.- Return type
bool
- Returns
Success of finishing the undo list.
-
BaseDocument.
RecordKey
(self, op, id, time, undo, autoKey, eval_attribmanager)¶ Records a key for op at time.
New in version R16.021.
- Parameters
op (c4d.BaseList2D) – The object to record.
id (c4d.DescID) – The description ID to record.
time (c4d.BaseTime) – The time to record.
undo (Optional[c4d.BaseList2D]) –
The object in the old state.This is necessary e.g. for autokeyframing so that Cinema 4D can compare valuesUsually 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
(self, op, undo, recursive, pos, scale, rot, param, pla)¶ Compares the object chain op to undo and sets keyframes for all the changes.
New in version R16.021.
- 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
(self)¶ Records the active objects in the document.
New in version R19.
-
BaseDocument.
AnimateObject
(self, 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_NONE
None.
ANIMATEFLAGS_NO_PARTICLES
Ignore particles.
ANIMATEFLAGS_NO_CHILDREN
Do not animate children.
ANIMATEFLAGS_INRENDER
Prepare to render scene.
ANIMATEFLAGS_NO_MINMAX
Private.
ANIMATEFLAGS_NO_NLA
Private.
ANIMATEFLAGS_NLA_SUM
Private.
-
BaseDocument.
Polygonize
(self, keepanimation=False)¶ Make a clone of the document and turn all objects into polygon based objects.
- Parameters
keepanimation (bool) – Keep animation.
- Return type
Optional[c4d.documents.BaseDocument]
- Returns
The cloned polygon based document or None if failed.
-
BaseDocument.
SetMinTime
(self, time)¶ Set the starting time for the timeline of this document.
Note
- Parameters
type (c4d.BaseTime) – The time.
-
BaseDocument.
SetMaxTime
(self, time)¶ Set the end time of the timeline for this document.
Note
- Parameters
type (c4d.BaseTime) – The time.
-
BaseDocument.
GetMinTime
(self)¶ Get the starting time for the timeline of this document.
Note
- Return type
- Returns
The time.
-
BaseDocument.
GetMaxTime
(self)¶ Get the end time for the timeline of this document.
Note
- Return type
- Returns
The time.
-
BaseDocument.
GetTime
(self)¶ Returns the min time.
- Return type
- Returns
The current time.
-
BaseDocument.
SetTime
(self, 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
(self)¶ Returns the time of the left boundary of the document’s preview range (loop range).
- Return type
- Returns
The time.
-
BaseDocument.
SetLoopMinTime
(self, 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
(self)¶ Returns the time of the right boundary of the document’s preview range (loop range).
- Return type
- Returns
The time.
-
BaseDocument.
SetLoopMaxTime
(self, 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
(self, op, mode=SELECTION_NEW)¶ Modifies the current multi selection with op, depending on mode.
Note
BaseDocument.GetActiveObject()
Should be called afterward to update the internal selection state.- 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
(self, tag, mode=SELECTION_NEW)¶ Sets a tag be the currently active one.
Note
BaseDocument.GetActiveTag()
Should be called afterward to update the internal selection state.- 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
(self, mp, mode=SELECTION_NEW)¶ Modifies the current multi selection with op, depending on mode.
Note
BaseDocument.GetActiveMaterial()
Should be called afterward to update the internal selection state.- 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
(self, 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
(self, isNet=True, ar=None)¶ Returns a collection of all used textures in the document and optionally only for the objects in ar.
Note
If isNet is passed True (default) then the function only delivers the textures of the current take.Set the parameter to False to get all.- Parameters
isNet (bool) –
New in version R16.021: Pass True (default) to retrieve the textures used in the current NET rendering.
ar (Optional[List[c4d.C4DAtom]]) – An atom array to get the textures for. If None (default), all used textures in the document will be returned.
- Return type
- Returns
A container with all filenames of used textures in the document.
-
BaseDocument.
SetAction
(self, 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
(self)¶ Get the ID of the current active tool in the editor.
- Return type
int
- Returns
The ID.
-
BaseDocument.
GetActiveToolData
(self)¶ Gets the original tool data container.
Note
The container is alive until the host object is freed.
- Return type
- Returns
Tool data container.
-
BaseDocument.
SetMode
(self, 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 mode.
Muvpolygons
UV polygons mode.
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.
Mdrag
Drag mode.
Muvedges
Uv Edge node is enabled.
Muvon
Uv mode is enabled.
-
BaseDocument.
GetMode
(self)¶ 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 mode.
Muvpolygons
UV polygons mode.
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.
Mdrag
Drag mode.
Muvedges
Uv Edge node is enabled.
Muvon
Uv mode is enabled.
-
BaseDocument.
IsEditMode
(self)¶ Check if the editor is in an editable mode.
Note
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
(self, 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
Optional[c4d.BaseDraw]
- Returns
The requested view in the editor, or None
-
BaseDocument.
GetActiveBaseDraw
(self)¶ Get the activate BaseDraw in the editor, this is where all drawing should be performed.
- Return type
- Returns
The active view in the editor.
-
BaseDocument.
GetRenderBaseDraw
(self)¶ This is the BaseDraw belonging to the view that the user has chosen as ‘Render View’ (see View menu in Cinema 4D).
- Return type
- Returns
The render view in the editor.
-
BaseDocument.
GetActiveTag
(self)¶ Returns the active selected tag.
- Return type
Optional[c4d.BaseTag]
- Returns
The active tag, or None.
-
BaseDocument.
GetMaterials
(self)¶ Returns all materials in a list.
- Return type
List[c4d.BaseMaterial]
- Returns
The list of all materials.
-
BaseDocument.
GetActiveObject
(self)¶ Returns the active selected object.
- Return type
Optional[c4d.BaseObject]
- Returns
The active object, or None.
-
BaseDocument.
GetActiveRenderData
(self)¶ Returns the active selected render data.
- Return type
- Returns
The active render data.
Note
Guaranteed to never be None.
-
BaseDocument.
GetFirstRenderData
(self)¶ Gets the first render data or options of the document.
Note
The other render settings in the document can be accessed by using the list functions
GetNext()
,GetPred()
,GetDown()
andGetUp()
.- Return type
Optional[c4d.documents.RenderData]
- Returns
The first render data of the document, or None if there are no render data associated with the document.
-
BaseDocument.
InsertRenderData
(self, rd, parent=None, pred=None)¶ - 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
rd (c4d.documents.RenderData) – The render data to insert.
parent (Optional[c4d.documents.RenderData]) – An optional parent to insert the render data as a child of.
pred (Optional[c4d.documents.RenderData]) – An optional render data of the document to use as insertion point.
-
BaseDocument.
InsertRenderDataLast
(self, rd)¶ Inserts the render data as last child into the document’s render data list.
- Parameters
rd (c4d.documents.RenderData) – The render data to insert.
-
BaseDocument.
GetActiveMaterial
(self)¶ Returns the active selected material.
- Return type
Optional[c4d.BaseMaterial]
- Returns
The active material, or None.
-
BaseDocument.
GetDocumentData
(self, type)¶ Get the
BaseContainer
settings of the specified type.New in version R16.021.
Warning
UseGetSettingsInstance()
to retrieve DOCUMENTSETTINGS_TOOLS.GetDocumentData()
does not return these settings.- Parameters
type (int) – The DOCUMENTSETTINGS type of the settings to get. See DOCUMENTSETTINGS.
- Return type
- Returns
The settings for the document.
-
BaseDocument.
SetDocumentData
(self, type, bc)¶ Merges the
BaseContainer
for the settings of the specified type.New in version R16.021.
Warning
UseGetSettingsInstance()
to change DOCUMENTSETTINGS_TOOLS.SetDocumentData()
does not affect these settings.- Parameters
type (int) – The DOCUMENTSETTINGS type of the settings to merge for the document. See DOCUMENTSETTINGS.
bc (c4d.BaseContainer) – The container to take the new settings from.
-
BaseDocument.
GetSettingsInstance
(self, type)¶ Returns the internal settings object.
Note
Changes to the returned container are reflected in the document so it is not needed to call
SetDocumentData()
manually.Warning
UseGetDocumentData()
/SetDocumentData()
to retrieve/change DOCUMENTSETTINGS_GENERAL.GetSettingsInstance()
does not return these settings.- Parameters
type (int) – The DOCUMENTSETTINGS type of the settings to get. See DOCUMENTSETTINGS.
- Return type
- Returns
The settings for the document.
-
BaseDocument.
GetFirstObject
(self)¶ Returns the first object.
- Return type
Optional[c4d.BaseObject]
- Returns
The first object, or None if no objects are contained in this document.
-
BaseDocument.
GetFirstMaterial
(self)¶ Returns the first material.
- Return type
Optional[c4d.BaseMaterial]
- Returns
The active material, or None.
-
BaseDocument.
GetActiveMaterials
(self)¶ Returns the material selection.
- Return type
List[c4d.BaseMaterial]
- Returns
The selected materials in a list.
-
BaseDocument.
GetActiveObjects
(self, flags)¶ Returns the object selection.
- Parameters
flags (int) –
Flags:
GETACTIVEOBJECTFLAGS_NONE
Only the topmost parent of each chain is added.
GETACTIVEOBJECTFLAGS_CHILDREN
Child objects are added to the selection too, provided they are selected.
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[c4d.BaseList2D]
- Returns
The selected objects in a list.
-
BaseDocument.
GetActiveTags
(self)¶ Returns the tag selection.
- Return type
List[c4d.BaseTag]
- Returns
The selected tags in a list.
-
BaseDocument.
GetSelection
(self)¶ Returns the selection of materials, tags and objects in a list.
- Return type
List[c4d.BaseList2D]
- Returns
The selected objects in a list.
-
BaseDocument.
GetActiveObjectsFilter
(self, 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[c4d.BaseList2D]
- Returns
The selected objects in a list.
-
BaseDocument.
GetRealActiveObject
(self, help)¶ Returns the active object or the dummy axis if multiple objects are selected.
New in version R19.
- Parameters
help (Optional[Iterable[c4d.BaseObject]]) – Can be set to None or for speedup purposes pass a list/tuple of active objects.
- Return type
Optional[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
(self)¶ Returns the highest objects without children.
- Return type
List[c4d.BaseObject]
- Returns
The objects.
-
BaseDocument.
SetSelection
(self, 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
(self, name)¶ Search for a material with the same case sensitive name.
- Parameters
name (str) – The name of the material to search for.
- Return type
Optional[c4d.BaseMaterial]
- Returns
The material or None if nothing was found.
-
BaseDocument.
SearchObject
(self, name)¶ Search for an object with the same case sensitive name.
- Parameters
name (str) – The name of the object to search for.
- Return type
Optional[c4d.BaseObject]
- Returns
The object or None if nothing was found.
-
BaseDocument.
GetHighest
(self, 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
Optional[c4d.BaseObject]
- Returns
The first requested object or None if nothing was found.
-
BaseDocument.
InsertObject
(self, op, parent=None, pred=None, checknames=False)¶ - 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.
Note
If both pred and parent are provided then pred has precedence.
- Raises
ReferenceError – If the passed objects (parent and pred) are not in the same document.
- Parameters
op (Optional[c4d.BaseObject]) – Object to insert into the document.
parent (Optional[c4d.BaseObject]) – Optional parent to insert the object as a child of.
pred (Optional[c4d.BaseObject]) – Optional insertion point.
checknames (bool) – Check for duplicate names and append .1, .2 etc.
-
BaseDocument.
InsertMaterial
(self, op, pred=None, checknames=True)¶ - 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 (Optional[c4d.BaseObject]) –
Optional insertion point for the material.
Note
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
(self)¶ Get the helper axis for the current multi selection.
- Return type
- Returns
The axis object.
-
BaseDocument.
GetChanged
(self)¶ 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
(self)¶ Set the changed state of the document to reflect it has been modified.
-
BaseDocument.
IsAxisEnabled
(self)¶ Returns the state of the object axis modifier.
New in version R14.014.
Note
c4d.CallCommand(12102) toggles the tool.
- Return type
bool
- Returns
True if the object axis modifier is enabled, otherwise False.
-
BaseDocument.
SendInfo
(self, type, format, fn, bl, hooks_only)¶ Sends MSG_DOCUMENTINFO messages.
New in version R14.014.
- 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 merge. data is a MSG_DOCUMENTINFO_TYPE_BEFOREMERGE_RESULT.
MSG_DOCUMENTINFO_TYPE_SAVE_BEFORE
Document is about to be written.
MSG_DOCUMENTINFO_TYPE_SAVE_AFTER
Document was saved.
MSG_DOCUMENTINFO_TYPE_SAVEPROJECT_BEFORE
Save Project with Assets is about to be executed.
MSG_DOCUMENTINFO_TYPE_SAVEPROJECT_AFTER
Save Project with Assets 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 scene hooks.
MSG_DOCUMENTINFO_TYPE_SWAP_XREF
Private.
MSG_DOCUMENTINFO_TYPE_NODE_ASSETS_CHANGED
New in version R20.000: Send around after node assets in a basedocument have been changed.
MSG_DOCUMENTINFO_TYPE_MODE_CHANGED
New in version R20.000: Mode changed.
MSG_DOCUMENTINFO_TYPE_FLUSHCACHES
New in version R19.062: Document caches are flushed. This message is only sent to scene hooks.
format (int) –
The file format: (Set for load, merge and before/after save only. Otherwise NOTOK.)
FORMAT_PREF
Preferences.
FORMAT_WAV
WAV sound.
FORMAT_L4D
Layout.
FORMAT_P4D
Layout.
FORMAT_C4DIMPORT
Cinema 4D import.
FORMAT_C4DEXPORT
Cinema 4D export.
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
Old OBJ import (R16 and older).
FORMAT_OBJEXPORT
Old OBJ export (R16 and older).
FORMAT_Q3DIMPORT
QuickDraw 3D import.
FORMAT_Q3DEXPORT
QuickDraw 3D export.
FORMAT_AIIMPORT
AI import.
FORMAT_DEMIMPORT
DEM import.
FORMAT_D3DEXPORT
Direct3D export.
FORMAT_OBJ2IMPORT
New in version R17.048: New OBJ import (R17 and newer).
FORMAT_OBJ2EXPORT
New in version R17.048: New OBJ export (R17 and newer).
FORMAT_SKPIMPORT
New in version R17.048: SketchUp import.
FORMAT_STEPIMPORT
New in version R20.026: Step import.
FORMAT_CATIAIMPORT
New in version R20.026: Catia V5 import.
FORMAT_IGESIMPORT
New in version R20.026: Iges import.
FORMAT_JTIMPORT
New in version R20.026: Jt import.
FORMAT_SOLIDWORKSIMPORT
New in version R20.026: Solidworks import.
FORMAT_ABCIMPORT
New in version R20.041: Alembic import (R20.041 and newer).
FORMAT_ABCEXPORT
New in version R20.041: Alembic export (R20.041 and newer).
FORMAT_DAE14IMPORT
New in version R20.041: Collada 14 import (R20.041 and newer).
FORMAT_DAE14EXPORT
New in version R20.041: Collada 14 export (R20.041 and newer).
FORMAT_DAE15IMPORT
New in version R20.041: Collada 15 import (R20.041 and newer).
FORMAT_DAE15EXPORT
New in version R20.041: Collada 15 export (R20.041 and newer).
FORMAT_AI_EXPORT
New in version S22: Adobe Illustrator AI export.
FORMAT_ALLPLAN_EXPORT
New in version S22: Allplan XML export.
FORMAT_BVH_IMPORT
New in version S22: BVH import.
FORMAT_FBX_EXPORT
New in version S22: FBX export.
FORMAT_FBX_IMPORT
New in version S22: FBX import.
FORMAT_GLTFEXPORT
New in version S22: glTF export.
FORMAT_DWG_IMPORT
New in version S22: AutoCAD DWG import.
FORMAT_STL_EXPORT
New in version S22: STL export.
FORMAT_STL_IMPORT
New in version S22: STL import.
FORMAT_VDB_EXPORT
New in version S22: Volume VDB export.
FORMAT_VDB_IMPORT
New in version S22: Volume VDB import.
fn (str) –
The document filename.
Note
This is not always the same as
GetDocumentPath()
. E.g. for MSG_DOCUMENTINFO_TYPE_SAVE_BEFOREGetDocumentPath()
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_INSERTMSG_DOCUMENTINFO_TYPE_TAG_INSERTMSG_DOCUMENTINFO_TYPE_MATERIAL_INSERThooks_only (bool) – If True send only to scene hooks.
-
BaseDocument.
GetDocPreviewBitmap
(self)¶ Get the preview bitmap of the document.
New in version R15.037.
- Return type
Optional[c4d.bitmaps.BaseBitmap]
- Returns
The preview bitmap of the document, or None if it could not be retrieved.
-
BaseDocument.
GetTakeData
(self)¶ Gets the take data for the document.
New in version R17.032.
- Return type
- Returns
The take data.
-
BaseDocument.
GetTargetObject
(self)¶ Gets the target object within a multi-selection.
New in version R17.048.
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
Optional[c4d.BaseObject]
- Returns
The target object, or None if it fails or there is no selection.
-
BaseDocument.
SetTargetObject
(self, op)¶ Sets the target object within a multi-selection.
New in version R17.048.
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
(self)¶ Retrieves the document’s default keying settings.
New in version R19.
- Return type
Optional[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
(self, key, overdub)¶ Sets the document’s default keying settings.
New in version R19.
- 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
(self)¶ Returns information about the current pick session.
New in version R19.
- Return type
Optional[Tuple[List[c4d.C4DAtom], 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
(self, callback, multi)¶ Starts a pick session.
New in version R19.
- Parameters
callback (function(active, multi)) –
The pick session callback. The function does not need to return a value. The passed arguments are:
active: List[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
(self, cancel)¶ - Ends the pick session.For instance after filling the pick session array.
New in version R19.
- 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.
-
BaseDocument.
SetTrackDefaultInterpolationMode
(self, mode)¶ Sets the track default interpolation mode.
New in version 24.
- Parameters
mode (int) –
Interpolation mode.
Symbol ID
Description
R23
Hermite evaluation with some tangent issues.
CURRENT
Spline evaluation.
-
BaseDocument.
GetTrackDefaultInterpolationMode
(self)¶ Gets the track default interpolation mode.
New in version 24.
- Returns
Interpolation mode.
Symbol ID
Description
R23
Hermite evaluation with some tangent issues.
CURRENT
Spline evaluation.
- Return type
int
-
BaseDocument.
GetSceneRepository
(self, create)¶ Returns the SceneRepository description.
New in version S26.
- Parameters
create (bool) – True to create if not existing.
- Returns
Reference to a repository.
- Return type