c4d

class c4d

Types

Functions Signatures

Clipboard

c4d.CopyBitmapToClipboard(map, ownerid) Copy a bitmap to the clipboard.
c4d.CopyStringToClipboard(text) Copy a text to the clipboard.
c4d.GetBitmapFromClipboard() Returns a bitmap from the clipboard.
c4d.GetC4DClipboardOwner() Get the owner ID of the clipboard.
c4d.GetClipboardType() Get the type of the clipboard.
c4d.GetStringFromClipboard() Returns a string from the clipboard.

Command Handler

c4d.CallCommand(cmdid[, subid]) Executes a command.
c4d.GetCommandHelp(id) Gets the help string of a command.
c4d.GetCommandName(id) Gets the name of a command.
c4d.IsCommandChecked(id) Checks if a command is checked.
c4d.IsCommandEnabled(id) Checks if a command is enabled.

Common Stuff

c4d.GeGetByteOrder() Get the type of OS that is running Cinema 4D.
c4d.GeGetCurrentOS() Get the type of OS that is running Cinema 4D.
c4d.GeGetGray() Get the color values for the default Cinema 4D gray.
c4d.GeGetMilliSeconds() Get the current timer count in milliseconds.
c4d.GeGetTimer() Get the current timer count in milliseconds.
c4d.GetAPIVersion() Get the API version of the Python SDK, for instance (1, 0, 1001)
c4d.GetC4DVersion() Get the version of Cinema 4D that is running, for instance 12016.
c4d.GetDefaultFPS() Get the default frames per second value.
c4d.StopAllThreads() Stop all running threads.

License

c4d.ExportLicenses()
Returns a json string representation of the licensing information as shown in the ExportLicenses menu command including productId, systemId, userId etc.
c4d.GeGetSerialInfo() Returns user registration information.
c4d.GetGeneralLicensingInformation() Returns information about the currently used license and system.

Net Status Bar

c4d.StatusNetClear() Clears the NET status bar text.
c4d.StatusSetNetBar(p, dat) Sets the NET status bar progress and custom color.
c4d.StatusSetNetLoad(status) Sets the NET status bar to status state.
c4d.StatusSetNetText(str) Sets the NET status bar text.

Network

c4d.IsClient() Checks if a NET client application is running.
c4d.IsNet() Checks if either a NET server or client application is running.
c4d.IsServer() Checks if a NET server application is running.

Object Stuff

c4d.FindInManager(bl) Finds and makes bl visible in its manager.
c4d.GetObjectName(type)
Gets a user presentable name from an object type ID.
c4d.GetObjectType(name)
The inverse of GetObjectName().
c4d.GetTagName(type)
Gets a user presentable name from a tag type ID.

Settings

c4d.GeGetLanguage(index)
Can be used to enumerate information about the available languages.
c4d.GeIsActiveToolEnabled() Checks if the active tool is ghosted.
c4d.GetViewColor(colid) Returns a viewport color.
c4d.GetWorldContainer() Returns a copy of the settings container of Cinema 4D.
c4d.GetWorldContainerInstance() Return a reference to the main Cinema 4D settings container that can be changed directly.
c4d.SetViewColor(colid, col) Set a viewport color.
c4d.SetWorldContainer(bc) Set the main Cinema 4D settings container. See WPREF in the C++ doc.

Status Bar

c4d.StatusClear() Clear the status bar text.
c4d.StatusSetBar(p) Set the status bar text.
c4d.StatusSetSpin()
Set the status bar progress bar spinning.
c4d.StatusSetText(str) Set the status bar text.

Texture

c4d.FlushUnusedTextures() Flush all unused textures.
c4d.GenerateTexturePath(docpath, srcname, ...) Generates the texture filename for a given texture image.
c4d.GetGlobalTexturePath(i)

Deprecated since version R20.

c4d.GetGlobalTexturePaths() Retrieves the global texture paths.
c4d.IsInSearchPath(texfilename, docpath) Checks if the texture texfilename is in the search path for files located in docpath.
c4d.SetGlobalTexturePath(i, fn)

Deprecated since version R20.

c4d.SetGlobalTexturePaths(texturePaths) Sets the global texture paths.

Update

c4d.DrawViews(flags[, bd]) Redraws the editor views. Must be called from the main thread!
c4d.EventAdd([flags]) Adds a global event to Cinema 4D’s event queue. Results in a CoreMessage() message.
c4d.GePluginMessage(id, data) Sends a plugin message to other plugins.
c4d.GeSyncMessage(messageid) Sends a synchronous event message. (For example to make the timeline, timeslider etc. do an instant redraw.)
c4d.SendCoreMessage(coreid, msg[, eventid]) Sends a core message. For example
c4d.SpecialEventAdd(messageid[, p1, p2]) Adds a custom event to the internal message queue.

Version Information

c4d.GeGetCinemaInfo(info) Checks if the current license is an NFR (Not For Resell) version.
c4d.GeGetVersionType() Get the type of Cinema 4D application that is running.
c4d.IsEducation() Checks if the current license is an Education version
c4d.IsLiteVersion() Checks if the current license is a Lite version.
c4d.IsNFR() Checks if the current license is an NFR (Not For Resell) version.
c4d.IsTrial() Checks if the current license is a Trial version.

Uncategorized

c4d.PrefsLib_OpenDialog(page) Used to open the preference dialog of Cinema 4D on a specific page.
c4d.RestartMe([param, exitcode]) Restarts Cinema 4D.
c4d.CallButton(op, id) Simulates a click of a button.
c4d.GetCustomDataTypeDefault(type) Retrieve the default settings for a data type. Used to create a default datatype container which can be set with BaseList2D.AddUserData().
c4d.CheckIsRunning(type) Check if a task is running.
c4d.GetMachineFeatures([type]) Retrieves the features of the computer
c4d.StartEditorRender(active_only, raybrush, ...) Starts the editor renderer.
c4d.Cast(type, obj) Casts obj to the given type.
c4d.CallFunction(op, function, arg1, ...)
Calls a function defined within a scripting expression.
c4d.AllocListHead() Allocates a list head.
c4d.CopyData(op1, descid1, op2, ...) Copies a parameter data to another.
c4d.WriteConsole(str) Writes str to the Python console.

Functions Documentation

c4d.CopyBitmapToClipboard(map, ownerid)

Copy a bitmap to the clipboard.

Parameters:
c4d.CopyStringToClipboard(text)

Copy a text to the clipboard.

Parameters:text (str) – The text to copy.
c4d.GetBitmapFromClipboard()

Returns a bitmap from the clipboard.

Return type:c4d.bitmaps.BaseBitmap
Returns:The bitmap or None.
c4d.GetC4DClipboardOwner()

Get the owner ID of the clipboard.

Return type:int
Returns:The owner ID:
CLIPBOARDOWNER_BODYPAINT BodyPaint 3D owns the clipboard.
CLIPBOARDOWNER_PICTUREVIEWER The Picture Viewer owns the clipboard.
c4d.GetClipboardType()

Get the type of the clipboard.

Return type:int
Returns:The type of the clipboard:
CLIPBOARDTYPE_EMPTY Clipboard is empty.
CLIPBOARDTYPE_STRING Clipboard contains a string.
CLIPBOARDTYPE_BITMAP Clipboard contains a bitmap.
c4d.GetStringFromClipboard()

Returns a string from the clipboard.

Return type:str
Returns:The string or None.
c4d.CallCommand(cmdid, subid=0)

Executes a command.

Warning

Must be called from the main thread only.
Forbidden to call in expressions (Python generator, tag, XPresso node, etc.). See Threading Information.
Parameters:
  • cmdid (int) – The ID of the command.
  • subid (int) – The sub-command ID.
c4d.GetCommandHelp(id)

Gets the help string of a command.

Warning

Must be called from the main thread only.
Forbidden to call in expressions (Python generator, tag, XPresso node, etc.). See Threading Information.
Parameters:id (int) – The ID of the command.
Return type:str
Returns:The help string.
c4d.GetCommandName(id)

Gets the name of a command.

Warning

Must be called from the main thread only.
Forbidden to call in expressions (Python generator, tag, XPresso node, etc.). See Threading Information.
Parameters:id (int) – The ID of the command.
Return type:str
Returns:The command name.
c4d.IsCommandChecked(id)

Checks if a command is checked.

Warning

Must be called from the main thread only.
Forbidden to call in expressions (Python generator, tag, XPresso node, etc.). See Threading Information.
Parameters:id (int) – The ID of the command.
Return type:bool
Returns:True if the command is checked, otherwise False
c4d.IsCommandEnabled(id)

Checks if a command is enabled.

Warning

Must be called from the main thread only.
Forbidden to call in expressions (Python generator, tag, XPresso node, etc.). See Threading Information.
Parameters:id (int) – The ID of the command.
Return type:bool
Returns:True if the command is enabled, otherwise False.
c4d.GeGetByteOrder()

Get the type of OS that is running Cinema 4D.

Return type:int
Returns:The byte order:
BYTEORDER_MOTOROLA Motorola, big endian.
BYTEORDER_INTEL Intel, little endian.
c4d.GeGetCurrentOS()

Get the type of OS that is running Cinema 4D.

Return type:int
Returns:The OS running Cinema 4D:
OPERATINGSYSTEM_WIN Windows.
OPERATINGSYSTEM_OSX OS X.
OPERATINGSYSTEM_UNIX Unix.
c4d.GeGetGray()

Get the color values for the default Cinema 4D gray.

Return type:c4d.Vector
Returns:All color components in this vector.
c4d.GeGetMilliSeconds()

Get the current timer count in milliseconds.

Return type:float
Returns:The current timer count in milliseconds.
c4d.GeGetTimer()

Get the current timer count in milliseconds.

Return type:int
Returns:The current timer count in milliseconds.
c4d.GetAPIVersion()

Get the API version of the Python SDK, for instance (1, 0, 1001)

Return type:List[int]
Returns:The version of the Cinema 4D Python SDK.
c4d.GetC4DVersion()

Get the version of Cinema 4D that is running, for instance 12016.

Return type:int
Returns:The version of Cinema 4D.
c4d.GetDefaultFPS()

Get the default frames per second value.

Return type:int
Returns:The default FPS value.
c4d.StopAllThreads()

Stop all running threads.

c4d.ExportLicenses()
Returns a json string representation of the licensing information as shown in the ExportLicenses menu command including productId, systemId, userId etc.

New in version R21.

import c4d
import json

data = json.loads(c4d.ExportLicenses())
print data["username"]
Return type:str
Returns:A json string representation of the license information.
c4d.GeGetSerialInfo()

Returns user registration information.

Changed in version R21.

Warning

This function is there only for internal reason, don’t use it instead use c4d.ExportLicenses() or c4d.GetGeneralLicensingInformation().
organization, street, city and country are always empty string.
Return type:dict{licenseId: str, organization: str, name: str, street: str, city: str, country: str}
Returns:A dictionary with the serial information for Cinema 4D.
c4d.GetGeneralLicensingInformation()

Returns information about the currently used license and system.

New in version R21.

Return type:tuple(str, str, str)
Returns:In this order:
  • product ID, the product id of the active license.
  • system ID, a unique system identifier.
  • User ID, the user id that the active license is assigned with.
c4d.StatusNetClear()

Clears the NET status bar text.

New in version R16.050.

c4d.StatusSetNetBar(p, dat)

Sets the NET status bar progress and custom color.

New in version R16.050.

Parameters:
  • p (float) – The percentage of the progress (0-100).
  • dat (any) – The color for the NET status bar. Can be a color constant COLOR_BG, COLOR_TEXT, etc. or a color Vector.
c4d.StatusSetNetLoad(status)

Sets the NET status bar to status state.

New in version R16.050.

Parameters:status (int) –

The NET status state:

STATUSNETSTATE_NONE None.
STATUSNETSTATE_DISABLE Disable.
STATUSNETSTATE_IDLE Idle.
STATUSNETSTATE_BUSY Busy.
STATUSNETSTATE_BUSY2 Busy 2.
STATUSNETSTATE_CRITICAL Critical.
c4d.StatusSetNetText(str)

Sets the NET status bar text.

New in version R16.050.

Parameters:str (str) – The text to display.
c4d.IsClient()

Checks if a NET client application is running.

New in version R15.037.

Return type:bool
Returns:True if a NET client application is running, otherwise False.
c4d.IsNet()

Checks if either a NET server or client application is running.

New in version R15.037.

Return type:bool
Returns:True if NET is running, otherwise False.
c4d.IsServer()

Checks if a NET server application is running.

New in version R15.037.

Return type:bool
Returns:True if a NET server application is running, otherwise False.
c4d.FindInManager(bl)

Finds and makes bl visible in its manager.

Parameters:bl (c4d.BaseList2D) – The object to find.
c4d.GetObjectName(type)
Gets a user presentable name from an object type ID.
For example, GetObjectName (Ocube) returns “Cube”.
Parameters:type (int) – An object type ID.
Return type:str
Returns:The object name for type.
c4d.GetObjectType(name)
The inverse of GetObjectName().
Returns an object type from an object name.
Parameters:name (str) – An object name.
Return type:int
Returns:The object type for name.
c4d.GetTagName(type)
Gets a user presentable name from a tag type ID.
For example, GetTagName (Tphong) returns “Phong”.
Parameters:type (int) – A tag type ID.
Return type:str
Returns:The tag name for type.
c4d.GeGetLanguage(index)
Can be used to enumerate information about the available languages.
Start with index==0 and then iterate until the function returns None.
lang = GeGetLanguage(index)
if lang==None: return

index+=1
# str, str, bool
print lang["extensions"], lang["name"], lang["default_language"]
Parameters:index (int) – The language index.
Return type:dict{extensions: str, name: str, default_language: bool}
Returns:Information about the language
c4d.GeIsActiveToolEnabled()

Checks if the active tool is ghosted.

Return type:bool
Param:True if the active tool is ghosted, otherwise False.
c4d.GetViewColor(colid)

Returns a viewport color.

Parameters:colid (int) –

Type of color to get:

VIEWCOLOR_C4DBACKGROUND  
VIEWCOLOR_FILMFORMAT  
VIEWCOLOR_HORIZON  
VIEWCOLOR_GRID_MAJOR  
VIEWCOLOR_GRID_MINOR  
VIEWCOLOR_SPLINESTART  
VIEWCOLOR_SPLINEEND  
VIEWCOLOR_CAMERA  
VIEWCOLOR_PARTICLE  
VIEWCOLOR_PMODIFIER  
DELME_VIEWCOLOR_BONE  
VIEWCOLOR_MODIFIER  
VIEWCOLOR_ACTIVEPOINT  
VIEWCOLOR_INACTIVEPOINT  
VIEWCOLOR_TANGENT  
VIEWCOLOR_ACTIVEPOLYGON  
VIEWCOLOR_INACTIVEPOLYGON  
VIEWCOLOR_TEXTURE  
VIEWCOLOR_TEXTUREAXIS  
VIEWCOLOR_ACTIVEBOX  
VIEWCOLOR_ANIMPATH  
VIEWCOLOR_XAXIS  
VIEWCOLOR_YAXIS  
VIEWCOLOR_ZAXIS  
VIEWCOLOR_WXAXIS  
VIEWCOLOR_WYAXIS  
VIEWCOLOR_WZAXIS  
VIEWCOLOR_SELECT_AXIS  
VIEWCOLOR_LAYER0  
VIEWCOLOR_LAYER1  
VIEWCOLOR_LAYER2  
VIEWCOLOR_LAYER3  
VIEWCOLOR_LAYER4  
VIEWCOLOR_LAYER5  
VIEWCOLOR_LAYER6  
VIEWCOLOR_LAYER7  
VIEWCOLOR_VERTEXSTART  
VIEWCOLOR_VERTEXEND  
VIEWCOLOR_UVMESH_GREYED  
VIEWCOLOR_UVMESH_APOLY  
VIEWCOLOR_UVMESH_IAPOLY  
VIEWCOLOR_UVMESH_APOINT  
VIEWCOLOR_UVMESH_IAPOINT  
VIEWCOLOR_NORMAL  
VIEWCOLOR_ACTIVECHILDBOX  
VIEWCOLOR_ACTIVEPOLYBOX  
VIEWCOLOR_ACTIVEPOLYCHILDBOX  
VIEWCOLOR_SELECTION_PREVIEW  
VIEWCOLOR_MEASURETOOL  
VIEWCOLOR_SHADEDWIRE  
VIEWCOLOR_NGONLINE  
VIEWCOLOR_FRONTFACING  
VIEWCOLOR_BACKFACING  
VIEWCOLOR_MINSOFTSELECT  
VIEWCOLOR_MAXSOFTSELECT  
VIEWCOLOR_MINHNWEIGHT  
VIEWCOLOR_ZEROHNWEIGHT  
VIEWCOLOR_MAXHNWEIGHT  
VIEWCOLOR_IRR  
VIEWCOLOR_OBJECTHIGHLIGHT  
VIEWCOLOR_OBJECTSELECT  
VIEWCOLOR_C4DBACKGROUND_GRAD1  
VIEWCOLOR_C4DBACKGROUND_GRAD2  
VIEWCOLOR_BRUSHPREVIEW  
VIEWCOLOR_SPLINEHULL  
VIEWCOLOR_TOOLHANDLE  
VIEWCOLOR_ACTIVETOOLHANDLE  
VIEWCOLOR_TOOLHANDLEHIGHLIGHT  
VIEWCOLOR_TOOLHANDLE2  
VIEWCOLOR_TOOLHANDLEHIGHLIGHT2  
VIEWCOLOR_ACTIVETOOLHANDLE2  
VIEWCOLOR_TOOLSELECTION  
VIEWCOLOR_BASEGRID  
VIEWCOLOR_VERTEX_NORMAL

New in version R18.

VIEWCOLOR_MOSELECTEDFG

New in version R18.

VIEWCOLOR_MOSELECTEDBG

New in version R18.

VIEWCOLOR_MODESELECTEDFG

New in version R18.

VIEWCOLOR_MODESELECTEDBG

New in version R18.

VIEWCOLOR_TESSELLATIONWIRE

New in version R18.

VIEWCOLOR_FIELDGIZMO_COLOR1

New in version R21.

VIEWCOLOR_FIELDGIZMO_COLOR2

New in version R21.

VIEWCOLOR_FIELDGIZMO_FALLOFF1

New in version R21.

VIEWCOLOR_FIELDGIZMO_FALLOFF2

New in version R21.

VIEWCOLOR_UVGIZMO_NORMAL

New in version R21.

VIEWCOLOR_UVGIZMO_CANDIDATE

New in version R21.

VIEWCOLOR_UVGIZMO_IN_MOTION

New in version R21.

VIEWCOLOR_UVGIZMO_ANCHOR_SNAPPED

New in version R21.

VIEWCOLOR_UV_AXIS_U

New in version R21.

VIEWCOLOR_UV_AXIS_V

New in version R21.

VIEWCOLOR_JOINT

New in version R21.

VIEWCOLOR_HANDLES

New in version R21.

VIEWCOLOR_MAXCOLORS

New in version R18.

Return type:c4d.Vector
Returns:The color value.
c4d.GetWorldContainer()

Returns a copy of the settings container of Cinema 4D.

Return type:c4d.BaseContainer
Returns:The main Cinema 4D settings.
c4d.GetWorldContainerInstance()

Return a reference to the main Cinema 4D settings container that can be changed directly.

Note

There are a few settings that are transferred to the world container within the call GetWorldContainer(), for example WPREF_UNITS_BASIC to WPREF_COLOR_XXX.
These settings cannot be set using GetWorldContainerInstance().
Return type:c4d.BaseContainer
Returns:The main Cinema 4D settings.
c4d.SetViewColor(colid, col)

Set a viewport color.

Parameters:
  • colid (int) –

    Type of color to set:

    VIEWCOLOR_C4DBACKGROUND  
    VIEWCOLOR_FILMFORMAT  
    VIEWCOLOR_HORIZON  
    VIEWCOLOR_GRID_MAJOR  
    VIEWCOLOR_GRID_MINOR  
    VIEWCOLOR_SPLINESTART  
    VIEWCOLOR_SPLINEEND  
    VIEWCOLOR_CAMERA  
    VIEWCOLOR_PARTICLE  
    VIEWCOLOR_PMODIFIER  
    DELME_VIEWCOLOR_BONE  
    VIEWCOLOR_MODIFIER  
    VIEWCOLOR_ACTIVEPOINT  
    VIEWCOLOR_INACTIVEPOINT  
    VIEWCOLOR_TANGENT  
    VIEWCOLOR_ACTIVEPOLYGON  
    VIEWCOLOR_INACTIVEPOLYGON  
    VIEWCOLOR_TEXTURE  
    VIEWCOLOR_TEXTUREAXIS  
    VIEWCOLOR_ACTIVEBOX  
    VIEWCOLOR_ANIMPATH  
    VIEWCOLOR_XAXIS  
    VIEWCOLOR_YAXIS  
    VIEWCOLOR_ZAXIS  
    VIEWCOLOR_WXAXIS  
    VIEWCOLOR_WYAXIS  
    VIEWCOLOR_WZAXIS  
    VIEWCOLOR_SELECT_AXIS  
    VIEWCOLOR_LAYER0  
    VIEWCOLOR_LAYER1  
    VIEWCOLOR_LAYER2  
    VIEWCOLOR_LAYER3  
    VIEWCOLOR_LAYER4  
    VIEWCOLOR_LAYER5  
    VIEWCOLOR_LAYER6  
    VIEWCOLOR_LAYER7  
    VIEWCOLOR_VERTEXSTART  
    VIEWCOLOR_VERTEXEND  
    VIEWCOLOR_UVMESH_GREYED  
    VIEWCOLOR_UVMESH_APOLY  
    VIEWCOLOR_UVMESH_IAPOLY  
    VIEWCOLOR_UVMESH_APOINT  
    VIEWCOLOR_UVMESH_IAPOINT  
    VIEWCOLOR_NORMAL  
    VIEWCOLOR_ACTIVECHILDBOX  
    VIEWCOLOR_ACTIVEPOLYBOX  
    VIEWCOLOR_ACTIVEPOLYCHILDBOX  
    VIEWCOLOR_SELECTION_PREVIEW  
    VIEWCOLOR_MEASURETOOL  
    VIEWCOLOR_SHADEDWIRE  
    VIEWCOLOR_NGONLINE  
    VIEWCOLOR_FRONTFACING  
    VIEWCOLOR_BACKFACING  
    VIEWCOLOR_MINSOFTSELECT  
    VIEWCOLOR_MAXSOFTSELECT  
    VIEWCOLOR_MINHNWEIGHT  
    VIEWCOLOR_ZEROHNWEIGHT  
    VIEWCOLOR_MAXHNWEIGHT  
    VIEWCOLOR_IRR  
    VIEWCOLOR_OBJECTHIGHLIGHT  
    VIEWCOLOR_OBJECTSELECT  
    VIEWCOLOR_C4DBACKGROUND_GRAD1  
    VIEWCOLOR_C4DBACKGROUND_GRAD2  
    VIEWCOLOR_BRUSHPREVIEW  
    VIEWCOLOR_SPLINEHULL  
    VIEWCOLOR_TOOLHANDLE  
    VIEWCOLOR_ACTIVETOOLHANDLE  
    VIEWCOLOR_TOOLHANDLEHIGHLIGHT  
    VIEWCOLOR_TOOLHANDLE2  
    VIEWCOLOR_TOOLHANDLEHIGHLIGHT2  
    VIEWCOLOR_ACTIVETOOLHANDLE2  
    VIEWCOLOR_TOOLSELECTION  
    VIEWCOLOR_BASEGRID  
    VIEWCOLOR_VERTEX_NORMAL

    New in version R18.

    VIEWCOLOR_MOSELECTEDFG

    New in version R18.

    VIEWCOLOR_MOSELECTEDBG

    New in version R18.

    VIEWCOLOR_MODESELECTEDFG

    New in version R18.

    VIEWCOLOR_MODESELECTEDBG

    New in version R18.

    VIEWCOLOR_TESSELLATIONWIRE

    New in version R18.

    VIEWCOLOR_FIELDGIZMO_COLOR1

    New in version R21.

    VIEWCOLOR_FIELDGIZMO_COLOR2

    New in version R21.

    VIEWCOLOR_FIELDGIZMO_FALLOFF1

    New in version R21.

    VIEWCOLOR_FIELDGIZMO_FALLOFF2

    New in version R21.

    VIEWCOLOR_UVGIZMO_NORMAL

    New in version R21.

    VIEWCOLOR_UVGIZMO_CANDIDATE

    New in version R21.

    VIEWCOLOR_UVGIZMO_IN_MOTION

    New in version R21.

    VIEWCOLOR_UVGIZMO_ANCHOR_SNAPPED

    New in version R21.

    VIEWCOLOR_UV_AXIS_U

    New in version R21.

    VIEWCOLOR_UV_AXIS_V

    New in version R21.

    VIEWCOLOR_JOINT

    New in version R21.

    VIEWCOLOR_HANDLES

    New in version R21.

    VIEWCOLOR_MAXCOLORS

    New in version R18.

  • col (c4d.Vector) – The new color.
c4d.SetWorldContainer(bc)

Set the main Cinema 4D settings container. See WPREF in the C++ doc.

Parameters:bc (c4d.BaseContainer) – The new settings.
c4d.StatusClear()

Clear the status bar text.

c4d.StatusSetBar(p)

Set the status bar text.

import c4d
c4d.StatusSetBar(50)
../../_images/c4d_statussetbar.png
Parameters:p (float) – The percentage of the bar (0-100).
c4d.StatusSetSpin()
Set the status bar progress bar spinning.
Use this to indicate that your plugin is still processing even if the progress bar is not increasing.
import c4d
c4d.StatusSetSpin()
../../_images/c4d_statussetspin.png
c4d.StatusSetText(str)

Set the status bar text.

import c4d
c4d.StatusSetText("Hello World!")
../../_images/c4d_statussettext.png
Parameters:str (str) – The text to display.
c4d.FlushUnusedTextures()

Flush all unused textures.

c4d.GenerateTexturePath(docpath, srcname, suggestedfolder, service, bt)

Generates the texture filename for a given texture image.

New in version R16.050.

Parameters:
  • docpath (str) – The filename of the document for the texture.
  • srcname (str) – The filename of the image.
  • suggestedfolder (str) – A suggested folder path for the image. Can be an empty string.
  • service (c4d.modules.net.NetRenderService) – An optional NET render service for the operation.
  • bt (c4d.threading.BaseThread) – An optional thread for the operation.
Return type:

str

Returns:

The generated texture path.

c4d.GetGlobalTexturePath(i)

Deprecated since version R20: Use GetGlobalTexturePaths() instead.

Get the global texture path.

Parameters:i (int) – The index of the texture path (0-9).
Return type:str
Returns:The texture path for Cinema 4D.
c4d.GetGlobalTexturePaths()

Retrieves the global texture paths.

New in version R20.

Return type:List[Tuple(str,bool)]
Returns:The global texture paths in a list of tuples with the path name and its enabled state.
c4d.IsInSearchPath(texfilename, docpath)

Checks if the texture texfilename is in the search path for files located in docpath.

New in version R16.050.

Parameters:
  • texfilename (str) – The filename of the texture.
  • docpath (str) – The document path.
Return type:

bool

Returns:

True if the texture file is in the search path, otherwise False.

c4d.SetGlobalTexturePath(i, fn)

Deprecated since version R20: Use SetGlobalTexturePaths() instead.

Set the global texture path.

Parameters:
  • i (int) – The index of the texture path (0-9).
  • fn (str) – The texture path.
c4d.SetGlobalTexturePaths(texturePaths)

Sets the global texture paths.

New in version R20.

Parameters:texturePaths (List[Tuple(str,bool)]) – The global texture paths to set in a list of tuples with the path name and its enabled state.
c4d.DrawViews(flags, bd=None)

Redraws the editor views. Must be called from the main thread!

Parameters:
  • flags (int) –

    Which part of the editors view should be updated:

    DRAWFLAGS_NONE None.
    DRAWFLAGS_NO_THREAD Synchronous call.
    DRAWFLAGS_NO_REDUCTION Ignore redraw limit.
    DRAWFLAGS_NO_ANIMATION Ignore all animation.
    DRAWFLAGS_ONLY_ACTIVE_VIEW Only redraw the active view.
    DRAWFLAGS_NO_EXPRESSIONS Ignore expressions.
    DRAWFLAGS_INDRAG In drag.
    DRAWFLAGS_NO_HIGHLIGHT_PLANE The entire view is drawn, not just the highlight plane.
    DRAWFLAGS_FORCEFULLREDRAW Force full redraw.
    DRAWFLAGS_ONLY_CAMERAEXPRESSION Camera expression.
    DRAWFLAGS_INMOVE In move.
    DRAWFLAGS_ONLY_BASEDRAW Draw specific base draw only.
    DRAWFLAGS_ONLY_HIGHLIGHT Only highlights.
    DRAWFLAGS_STATICBREAK If the display is done in the main thread (Cinema 4D only does this during animation playback) this allows that a special thread is used that polls the escape key. Note: Use only in combination with DRAWFLAGS_NO_THREAD.
    DRAWFLAGS_PRIVATE_NO_WAIT_GL_FINISHED Private.
    DRAWFLAGS_PRIVATE_ONLYBACKGROUND Private.
    DRAWFLAGS_PRIVATE_NOBLIT Private.
    DRAWFLAGS_PRIVATE_OPENGLHACK Private.
    DRAWFLAGS_PRIVATE_ONLY_PREPARE Private.
    DRAWFLAGS_PRIVATE_NO_DCLIPPING Private.
  • bd (c4d.BaseDraw) – The basedraw to draw when DRAWFLAGS_ONLY_BASEDRAW is set in flags.
Return type:

bool

Returns:

Success of updating the editor views.

c4d.EventAdd(flags=EVENT_NONE)

Adds a global event to Cinema 4D’s event queue. Results in a CoreMessage() message.

Note

Useless to call from an expression, for instance from a Python generator or tag.
Since R19 if c4d.EventAdd() is called from within the code of an expression, then it is simply skipped.
Parameters:flags (int) –

One of the following flags:

EVENT_NONE None.
EVENT_FORCEREDRAW Force a complete redraw.
EVENT_ANIMATE Animate document.
EVENT_NOEXPRESSION Do not execute expressions.
EVENT_GLHACK Private.
EVENT_CAMERAEXPRESSION If set(and not EVENT_NOEXPRESSION) the event will only update camera dependent expressions (for faster speed).
EVENT_ENQUEUE_REDRAW

New in version R17.032: | Do not stop the current redraw if DrawViews() is running at the moment. | In that case enqueue the redraw after the current draw is done.

c4d.GePluginMessage(id, data)

Sends a plugin message to other plugins.

Parameters:
  • id (int) – The ID of the message.
  • data (any) – The message data.
Return type:

bool

Returns:

True if the message could be sent, otherwise False.

c4d.GeSyncMessage(messageid)

Sends a synchronous event message. (For example to make the timeline, timeslider etc. do an instant redraw.)

Parameters:messageid (int) –

The message ID:

EVMSG_CHANGE Sent by EventAdd().
EVMSG_DOCUMENTRECALCULATED Sent while drawing after the animation, expressions and cache building have been done. It allows that certain managers (e.g. attribute manager) update their values to the changes done by the expressions etc. Any reactions on this message should be pretty fast! No modifying stuff must be done here as the draw thread is running at the same time and accesses the same data!
EVMSG_TOOLCHANGED A tool setting has changed (local event).
EVMSG_GRAPHVIEWCHANGED Something in XPresso has been changed (local event).
EVMSG_AUTKEYMODECHANGED The autokey mode was changed.
EVMSG_UPDATEHIGHLIGHT A special message sent by Cinema 4D in the case that only the highlighting changes. This happens for example when the mouse is moved over the viewport. Plugins usually do not need to care about this.
EVMSG_UPDATEBASEDRAW Sent in the case that the view should be redrawn.
EVMSG_CHANGEDSCRIPTMODE Sent when the script mode changed.
EVMSG_SHOWIN_SB Show in Scene Browser.
EVMSG_SHOWIN_TL Show in Timeline.
EVMSG_SHOWIN_FC Show in Function Curve editor.
EVMSG_SHOWIN_LM Show in Layer Manager.
EVMSG_TLOM_MERGE Private.
EVMSG_SHOWIN_MT Show in Motion editor.
EVMSG_TIMELINESELECTION A timeline selection has been changed (local event).
EVMSG_BROWSERCHANGE Something in the browser has been changed (local event).
EVMSG_MATERIALSELECTION A material selection has been changed (local event).
EVMSG_FCURVECHANGE Something in the F-Curve manager has been changed (local event).
EVMSG_RAYTRACER_FINISHED Private.
EVMSG_MATERIALPREVIEW Private.
EVMSG_ACTIVEVIEWCHANGED Private.
EVMSG_ASYNCEDITORMOVE The user moved something in the editor window. Managers should update things like position fields.
EVMSG_TIMECHANGED Private.
EVMSG_VIEWWINDOW_OUTPUT Private.
EVMSG_VIEWWINDOW_3DPAINTUPD Private.
EVMSG_UPDATESCHEME Scheme has been updated.
EVMSG_TAKECHANGED

New in version R17.032: Sent by the Take System when the current Take ID changed to let all managers react to the new status.

Return type:bool
Returns:True if successful, otherwise False.
c4d.SendCoreMessage(coreid, msg, eventid=0)

Sends a core message. For example

machine = c4d.SendCoreMessage(c4d.COREMSG_CINEMA, c4d.BaseContainer(c4d.COREMSG_CINEMA_GETMACHINEFEATURES))
Parameters:
  • coreid (int) – The core ID. COREMSG_CINEMA for Cinema 4D core.
  • msg (c4d.BaseContainer) –

    The message container:

    COREMSG_CINEMA_GETMACHINEFEATURES Retrieves machine features. Returned container IDs see MACHINEINFO and OPENGL.
    COREMSG_CINEMA_GETCOMMANDNAME Returns the name of the command with ID specified by COREMSG_CINEMA_GETCOMMANDNAME in msg. The name is returned as a string.
    COREMSG_CINEMA_GETCOMMANDENABLED Checks if the command with ID specified by COREMSG_CINEMA_GETCOMMANDENABLED in msg is enabled or disabled. The state is returned as True or False.
    COREMSG_CINEMA_GETCOMMANDCHECKED Checks if the command with ID specified by COREMSG_CINEMA_GETCOMMANDCHECKED in msg is checked or not. The state is given as True or False.
    COREMSG_CINEMA_EXECUTEEDITORCOMMAND Executes the command with ID specified by COREMSG_CINEMA_EXECUTEEDITORCOMMAND in msg.
    COREMSG_CINEMA_EXECUTESUBID Pass the sub-ID for COREMSG_CINEMA_EXECUTEEDITORCOMMAND.
    COREMSG_CINEMA_EXECUTEOPTIONMODE Pass whether to open the option dialog or not for COREMSG_CINEMA_EXECUTEEDITORCOMMAND.
    COREMSG_CINEMA_GETCOMMANDHELP Gets the help string of a command. Pass the command’s ID. The help is returned as string.
    COREMSG_CINEMA_FORCE_AM_UPDATE Forces an Attribute Manager update.
    COREMSG_UPDATECOMMANDSMESSAGE Private.
  • eventid (int) – The event ID.
Return type:

Any

Returns:

The returned data. Depends on the message, see table above.

c4d.SpecialEventAdd(messageid, p1=0, p2=0)

Adds a custom event to the internal message queue.

Note

There are areas in Cinema 4D, especially the GUI, which can only be handled by the main thread.
For instance, if you want to update the GUI from another thread, you can use SpecialEventAdd.
This function adds a custom event to the internal message queue which is handled by the main thread. See example below.
Use a plugin ID for messageid to make sure that there’s no collision.
Results in a GeDialog.CoreMessage() message.
c4d.SpecialEventAdd(MY_PLUGIN_ID) #e.g: called in Thread 1509

#[...]

def CoreMessage(self, id, msg):
    if id==MY_PLUGIN_ID:
        #Fired by the main thread...
        self.dlg.LayoutChanged(GROUP_ID)
        return True

    return gui.GeDialog.CoreMessage(self, id, msg)
Parameters:
  • messageid (int) – The message ID. Use a unique ID, for example your plugin ID.
  • p1 (int) – Private data for the sent message.
  • p2 (int) – Private data for the sent message.
c4d.GeGetCinemaInfo(info)

Checks if the current license is an NFR (Not For Resell) version.

New in version R21.

Parameters:info – Retrieves information about Cinema 4D’s application runtime.
Return type:int
Returns:The Cinema 4D’s information.
c4d.GeGetVersionType()

Get the type of Cinema 4D application that is running.

Changed in version R21.

Return type:int
Returns:The version type:

Changed in version R21.

Symbol ID Description
VERSIONTYPE_UNKNOWN Unknown version.
VERSIONTYPE_LITE Cinema 4D Lite. Lite is feature-restricted in many ways and does not allow for loading of plugins.
VERSIONTYPE_BENCHMARK Cinebench. Cinebench is restricted to a subset of libraries.
VERSIONTYPE_UPDATER Online updater. The Online updater only loads a limited subset of libraries.
VERSIONTYPE_TEAMRENDER_CLIENT Cinema 4D Teamrender client.
VERSIONTYPE_TEAMRENDER_SERVER Cinema 4D Teamrender server.
VERSIONTYPE_CINEMA4D Cinema 4D Cinema 4D.
VERSIONTYPE_COMMANDLINE Command line application. Note that this is different from c4d.GeGetCinemaInfo(c4d.CINEMAINFO_FORBID_GUI). The regular app can run without UI, but is not necessarily a special command line executable.
VERSIONTYPE_CINEWARE CineWare - The renderer used in AfterEffects, Vectorworks, Archicad and Allplan. Runs without UI and does not allow for plugins.
VERSIONTYPE_CPYTHON Python - The python executable. Runs without UI.
VERSIONTYPE_CPYTHON3 Python 3 - The python executable. Runs without UI.
c4d.IsEducation()

Checks if the current license is an Education version

New in version R21.

Return type:bool
Returns:True if it’s an Education version.
c4d.IsLiteVersion()

Checks if the current license is a Lite version.

New in version R21.

Return type:bool
Returns:True if it’s a Lite version.
c4d.IsNFR()

Checks if the current license is an NFR (Not For Resell) version.

New in version R21.

Return type:bool
Returns:True if it’s an NFR version.
c4d.IsTrial()

Checks if the current license is a Trial version.

New in version R21.

Return type:bool
Returns:True if it’s a Trial version.
c4d.PrefsLib_OpenDialog(page)

Used to open the preference dialog of Cinema 4D on a specific page.

import c4d
c4d.PrefsLib_OpenDialog(c4d.PREFS_MEMORY)
Parameters:page (int) –

The page to open:

Preferences main categories:

PREFS_THEME Interface Colors.
PREFS_COLORNEW Editor Colors.
PREFS_MOUSE Input Devices.
PREFS_OPENGL OpenGL.
PREFS_VIEW Viewport.
PREFS_FILES Files.
PREFS_UNITS Units.
PREFS_MEMORY Memory.
PREFS_COMMUNICATION Communication.
PREFS_RENDERERNEW Renderer.
PREFS_NEWPREFS Interface.
PREFS_BP Bodypaint 3D.
PREFS_MATMANAGER Material.
PREFS_IMPORTEXPORT Import/Export.
PREFS_LINUX Linux Command Line.
PREFS_SCHEMECOLORS Color Scheme.
PREFS_HAIR_COLOR Hair Color.
PREFS_NAVIGATION Navigation.
PREFS_PLUGINS Plugins.
PREFS_GPURENDERER ProRender.
PREFS_PATHS Files Paths.

Preferences format:

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).

Return type:bool
Returns:True on success otherwise False.
c4d.RestartMe(param=None, exitcode=0)

Restarts Cinema 4D.

Parameters:
  • param (int) – The parameter.
  • exitcode (int) – The exit code.
Return type:

bool

Returns:

Always True.

c4d.CallButton(op, id)

Simulates a click of a button.

For example, here is how to call the ‘Apply’ button of a Tool.

import c4d

c4d.CallCommand(c4d.ID_MODELING_TRANSFER_TOOL) # Set Transfer as current Tool

tool = plugins.FindPlugin(doc.GetAction(), c4d.PLUGINTYPE_TOOL) # Search Transfer Tool instance
if tool is not None:
    c4d.CallButton(tool, c4d.MDATA_APPLY)
    c4d.EventAdd()

Warning

Must be called from the main thread only.
Forbidden to call in expressions (Python generator, tag, XPresso node, etc.). See Threading Information.
Parameters:
  • op (c4d.BaseList2D) – The object.
  • id (int) – The ID of the button.
c4d.GetCustomDataTypeDefault(type)

Retrieve the default settings for a data type. Used to create a default datatype container which can be set with BaseList2D.AddUserData().

Parameters:type (int) –

Data type ID.

DTYPE_NONE None.
DTYPE_CHILDREN Children.
DTYPE_GROUP Group.
DTYPE_COLOR Color.
DTYPE_SUBCONTAINER BaseContainer.
DTYPE_MULTIPLEDATA Multiple data entry.
DTYPE_TEXTURE Texture name.
DTYPE_BUTTON Button.
DTYPE_DYNAMIC GV dynamic.
DTYPE_SEPARATOR Separator.
DTYPE_STATICTEXT Static text.
DTYPE_POPUP Popup.
DTYPE_LONG Integer.
DTYPE_REAL Float.
DTYPE_TIME BaseTime.
DTYPE_VECTOR Vector.
DTYPE_MATRIX Matrix.
DTYPE_STRING String.
DTYPE_FILENAME String.
DTYPE_BASELISTLINK BaseList2D.
DTYPE_BOOL GV bool ID_GV_DATA_TYPE_BOOL.
DTYPE_NORMAL GV normal ID_GV_DATA_TYPE_NORMAL.
DTYPE_COLORA Color with Alpha.
DTYPE_VECTOR4D Vector with 4 components.
Return type:c4d.BaseContainer
Returns:Default settings container.
c4d.CheckIsRunning(type)

Check if a task is running.

Parameters:type (int) –

The task:

CHECKISRUNNING_ANIMATIONRUNNING Animation running.
CHECKISRUNNING_VIEWDRAWING View drawing.
CHECKISRUNNING_EDITORRENDERING Editor rendering.
CHECKISRUNNING_EXTERNALRENDERING External rendering.
CHECKISRUNNING_PAINTERUPDATING Painter updating.
CHECKISRUNNING_MATERIALPREVIEWRUNNING Material preview running.
CHECKISRUNNING_EVENTSYSTEM Event System.
CHECKISRUNNING_BAKING Baking.
CHECKISRUNNING_INTERACTIVERENDERING Interactive rendering.
Return type:bool
Returns:True if the task running, otherwise False.
c4d.GetMachineFeatures(type=HARDWARE_OGL)

Retrieves the features of the computer

import c4d
bc = c4d.GetMachineFeatures()
print bc[c4d.OPENGL_RENDERER_NAME] #Output e.g: NVIDIA GeForce 9600 Engine
Parameters:type (int) –

New in version R18.020.

The machine features type:

CURRENT Get machine features for the currently active OpenGL type.
HARDWARE_OGL Get machine features for Hardware OpenGL.
SOFTWARE_OGL Get machine features for Software OpenGL.
Return type:c4d.BaseContainer
Returns:The container with the machine features. Returned container IDs see MACHINEINFO and OPENGL.
c4d.StartEditorRender(active_only, raybrush, x1, y1, x2, y2, bt, bd, newthread)

Starts the editor renderer.

import c4d
def RenderEditor(doc):
    bd = doc.GetActiveBaseDraw()
    c4d.StartEditorRender(active_only=False, raybrush=False, x1=0, y1=0, x2=500, y2=500, bt=None, bd=bd, newthread=False) #render a view
Parameters:
  • active_only (bool) – Active object only.
  • raybrush (bool) – Ray brush mode.
  • x1 (int) – X coordinate of the first corner of the render rectangle.
  • y1 (int) – Y coordinate of the first corner of the render rectangle.
  • x2 (int) – X coordinate of the second corner of the render rectangle.
  • y2 (int) – Y coordinate of the second corner of the render rectangle.
  • bt (c4d.threading.BaseThread) – Must be None. Private.
  • bd (c4d.BaseDraw) – Base draw to draw to.
  • newthread (bool) – If this is True then the editor render is done asynchronously.
c4d.Cast(type, obj)

Casts obj to the given type.

New in version R16.021.

Note

Useful in a NET/Team render context when catching C4DPL_JOBFINISHED_POST message in PluginMessage():

if id == c4d.C4DPL_JOBFINISHED_POST:
    jobUuid = c4d.Cast(c4d.modules.uuid.UUID, data)

Changed in version R17.048: If type is None the function casts it to a data (GeData in Cinema 4D API).

Parameters:
  • type (Type) – The type to cast to. Supported types are str, c4d.BaseContainer, c4d.Matrix and uui.Uuid.
  • obj (Object) – The object to cast.
Return type:

Any

Returns:

The result of the cast operation.

c4d.CallFunction(op, function, arg1, arg2, arg3)
Calls a function defined within a scripting expression.
This works for all parts of Cinema 4D where Python is embedded. See Embedded.

New in version R16.021.

Note

The arguments and returned value have to be of any Cinema 4D data type i.e. anytype or GeData in the C++ API.
Anything else will be converted to a void* before being sent to the other object.
As the maximum number of arguments is 3, to send more make one of the arguments a BaseContainer which can store more information.

Warning

Bear in mind that just as with any function call it is possible to accidentally set up a cyclical dependency of one function calling another which might call the original function (either directly or indirectly by e.g. invoking an EventAdd() which might cause the original function to be re-called) and so on and which would crash Cinema 4D.
This risk is the same as with directly calling a function from within your own script.
Parameters:
  • op (BaseList2D) – The object to search the function within its script.
  • function (str) – The name of the function to call.
  • arg1 (any) – The first optional argument.
  • arg2 (any) – The second optional argument.
  • arg3 (any) – The third optional argument.
Return type:

Any

Returns:

The value returned by the called function.

c4d.AllocListHead()

Allocates a list head.

New in version R16.050.

Return type:c4d.GeListHead
Returns:The allocated list head node.
Raises:AllocationError

If a list head could not be allocated.

Changed in version R19.

The function now returns a c4d.GeListHead object.

c4d.CopyData(op1, descid1, op2, descid2, aliastrans)

Copies a parameter data to another.

New in version R17.032.

Parameters:
  • op1 (c4d.BaseList2D) – The source base list.
  • descid1 (c4d.DescID) – The parameter description ID to copy the data from.
  • op2 (c4d.BaseList2D) – The destination base list.
  • descid2 (c4d.DescID) – The parameter description ID to copy the data to.
  • aliastrans (c4d.AliasTrans) –

    New in version R17.053.

    An alias translator for the operation.

c4d.WriteConsole(str)

Writes str to the Python console.

New in version R20.

Parameters:str (str) – The string to print.