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.
c4d.documents.
BaseDocument
¶
BaseDocument.GetData()
BaseDocument.GetDocumentData()
BaseDocument.SetDocumentData()
BaseDocument.GetSettingsInstance()
BaseDocument.InsertRenderData()
BaseDocument.InsertRenderDataLast()
BaseDocument.InsertMaterial()
BaseDocument.InsertObject()
BaseDocument.GetActiveRenderData()
BaseDocument.GetActiveObject()
BaseDocument.GetActiveMaterial()
BaseDocument.GetActiveTag()
BaseDocument.GetOrderedActiveObjects()
BaseDocument.GetActiveObjects()
BaseDocument.GetActiveTags()
BaseDocument.GetActiveMaterials()
BaseDocument.GetSelection()
BaseDocument.GetActiveObjectsFilter()
BaseDocument.GetRealActiveObject()
NEW
BaseDocument.SetActiveObject()
BaseDocument.SetActiveRenderData()
BaseDocument.SetActiveTag()
BaseDocument.SetActiveMaterial()
BaseDocument.SetSelection()
BaseDocument.SearchMaterial()
BaseDocument.SearchMaterialInc()
BaseDocument.SearchObject()
BaseDocument.SearchObjectInc()
BaseDocument.SetDocumentName()
BaseDocument.SetDocumentPath()
BaseDocument.GetDocumentName()
BaseDocument.GetDocumentPath()
BaseDocument.StartUndo()
BaseDocument.EndUndo()
BaseDocument.AddUndo()
BaseDocument.DoRedo()
BaseDocument.DoUndo()
BaseDocument.GetUndoPtr()
BaseDocument.FlushUndoBuffer()
BaseDocument.FindUndoPtr()
BaseDocument.GetActiveBaseDraw()
BaseDocument.GetRenderBaseDraw()
BaseDocument.GetBaseDraw()
BaseDocument.GetBaseDrawCount()
BaseDocument.AnimateObject()
BaseDocument.FindSceneHook()
BaseDocument.ForceCreateBaseDraw()
BaseDocument.ExecutePasses()
BaseDocument.GetDrawTime()
BaseDocument.GetLayerObjectRoot()
BaseDocument.GetParticleSystem()
BaseDocument.GetSplinePlane()
BaseDocument.IsAxisEnabled()
BaseDocument.Polygonize()
BaseDocument.SendInfo()
BaseDocument.SetRewind()
BaseDocument.GetDocPreviewBitmap()
BaseDocument.GetPickSession()
NEW
BaseDocument.StartPickSession()
NEW
BaseDocument.StopPickSession()
NEW
c4d.BaseList2D
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:
|
---|
BaseDocument.
GetLOD
(
)
¶
Get the Level of Detail for this document.
Return type: | float | ||||||
---|---|---|---|---|---|---|---|
Returns: |
The default level of detail values are:
|
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:
|
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: |
|
||||||||
---|---|---|---|---|---|---|---|---|---|
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: |
|
||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
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: |
|
||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Return type: | |||||||||||||||||||||||||||||
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: |
|
---|---|
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: |
|
---|
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: |
|
---|
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: |
|
---|
BaseDocument.
SetActiveTag
(
tag
[
,
mode=SELECTION_NEW
]
)
¶
Sets a tag be the currently active one.
Parameters: |
|
---|
BaseDocument.
SetActiveMaterial
(
mp
[
,
mode=SELECTION_NEW
]
)
¶
Modifies the current multi selection with op , depending on mode .
Parameters: |
|
---|
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: |
|
---|---|
Return type: | |
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:
|
---|
BaseDocument.
GetMode
(
)
¶
Get the main mode of the editor.
Return type: | int | ||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Returns: |
The value:
|
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.
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
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:
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
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: |
|
---|
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:
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
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:
|
||||||
---|---|---|---|---|---|---|---|
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: |
|
---|---|
Return type: |
list of type
|
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: |
|
---|
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: |
|
---|---|
Return type: | |
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: |
|
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: |
|
---|
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: |
|
---|
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: |
|
---|
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: |
|
---|
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. |
---|
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()