This documentation is for the free plugin Py4D in CINEMA 4D R11.5 and not for the C4DSDK of Python in CINEMA 4D R12. For R12, please visit PluginCafe.com

c4d – the main module

To get an overview of the class members, check out the diagram.

Functions

c4d.GeGetSerialInfo()

Returns a dict from the user’s registration info.

Return type:dict str
Returns:A list with the strings of the registration.
Key nr:str
Parameter:nr – first 11 digits

Key organization:
 

str

Parameters:
  • organization – Organization
  • name – str
  • street – Street
  • city – City
  • country – Country
Key name:

str

Key street:

str

Key city:

str

Key country:

str

c4d.GeGetVersionType()

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

Return type:

int

Returns:

The version type.

VERSION_CINEMA4D

C4D.

VERSION_BODYPAINT

BodyPaint 1.

VERSION_NET

NET client.

VERSION_SERVER

NET server.

VERSION_DEMO

Demo version.

VERSION_BENCHMARK

Cinebench.

VERSION_BODYPAINT2_EX

Old BodyPaint.

VERSION_MODELER

Modeler.

VERSION_BPSTANDALONE

BodyPaint Standalone.

VERSION_UPDATER

Updater.

VERSION_SAVABLEDEMO

Saveable demo version.

VERSION_SAVABLEDEMO_ACTIVE

Activated savable demo version.

VERSION_INSTALLER

Installer.

c4d.GeGetSystemInfo()

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

Return type:

int

Returns:

The version type.

SYSTEMINFO_OSX

OS X.

SYSTEMINFO_NOGUI

No GUI.

c4d.GetTimer()

Get the current timer count in milliseconds.

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

Get the current timer count in milliseconds.

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

Get the default frames per second value.

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

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

Return type:

int

Returns:

The default FPS value.

GE_WIN

OS X.

GE_MAC

Mac.

GE_UNIX

Unix.

c4d.GeGetByteOrder()

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

Return type:

int

Returns:

The default FPS value.

GE_MOTOROLA

Motorola, big endian.

GE_INTEL

Intel, little endian.

c4d.GeGetGray()

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

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

Get the version of CINEMA 4D that is running.

Return type:int
Returns:The version of CINEMA 4D.
c4d.GetAPIVersion()

Get the API version of Py4D.

Return type:int
Returns:The version of CINEMA 4D.
c4d.StopAllThreads()
Stop all running threads.
c4d.StatusClear(fn)
Clear the status bar text.
c4d.StatusSetText(str)

Set the status bar text.

Parameter:str (str) – The text to display.
c4d.StatusSetSpin()
Set the status bar progress bar spinning. Use this to indicate that your plugin is still processing even if the progress bar isn’t increasing.
c4d.StatusSetBar(p)

Set the status bar text.

Parameter:p (int) – The percentage of the bar (0-100).
c4d.EventAdd(flags=0)

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

Parameter:flags (int) –

One of the following flags:

EVENT_FORCEREDRAW Force a complete redraw.
EVENT_ANIMATE Animate document.
EVENT_NOEXPRESSION Don’t execute expressions.
EVENT_GLHACK Assigned the human readable language name.
EVENT_CAMERAEXPRESSION If this is set (and not EVENT_NOEXPRESSION), the event will only update camera dependant expressions (for faster speed).
c4d.GeSyncMessage(messageid)

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

Parameter:messageid (int) –

One of the following flags:

EVMSG_ASYNCEDITORMOVE The user moved something in the editor window. Managers should update things like position fields.
EVMSG_TIMECHANGED Private.
Return type:bool
Returns:True if successful, otherwise False.
c4d.DrawViews([id=DA_ONLY_ACTIVE_VIEW|DA_NO_THREAD|DA_NO_ANIMATION, bd])

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

Parameters:
  • id (int) –

    Which part of the editors view should be updated.

    Constant Description
    DA_NO_THREAD Synchronous call.
    DA_NO_REDUCTION Ignore redraw limit.
    DA_NO_ANIMATION Ignore all animation.
    DA_ONLY_ACTIVE_VIEW Only redraw the active view
    DA_NO_EXPRESSIONS Ignore expression.
    DA_INDRAG In drag.
    DA_CAMERAEXPRESSION Camera expression.
    DA_ONLY_HIGHLIGHT Only highlights.
    DA_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.
    DA_FORCEFULLREDRAW Force full redraw.
    DA_NODUALPLANE No dual plane.
    DA_ONLY_BASEDRAW Draw specific basedraw only.
    DA_IRR Interactive Render Region.
  • bd (BaseDraw) – The basedraw to draw when DA_ONLY_BASEDRAW is set in flags.
Return type:

bool

Returns:

Success of updating the editor view.

c4d.GetGlobalTexturePath(i)

Get the global texture path.

Parameter:i (int) – The index of the texture path (0-9).
Return type:str
Returns:The texture path for CINEMA 4D.
c4d.SetGlobalTexturePath(i, fn)

Set the global texture path.

Parameters:
  • i (int) – The index of the texture path (0-9).
  • fn (str) – The texture path.
c4d.FlushUnusedTextures()
Flush all unused textures.
c4d.GetWorldContainer()

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

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

Returns the settings container of CINEMA 4D that can be changed directly.

Warning

Please do not use in a global scope, otherwise use GetWorldContainer()

Note:Please do not edit the settings WPREF_UNITS_BASIC, _WPREF_COLOR_LAST_. These settings cannot be set with c4d.GetWorldContainerInstance().
Return type:BaseContainer
Returns:The main CINEMA 4D settings.
c4d.GetViewColor()

Returns the original reference to the main CINEMA 4D settings container that can be changed directly.

Return type:BaseContainer
Returns:The main CINEMA 4D settings.
c4d.GetViewColor(colid)

Returns one of the main CINEMA 4D colors.

Parameter:colid (int) – Type of color to get. See c4d_colors.h to get the constants.
Return type:Vector
Returns:The color value.
c4d.SetViewColor(colid, col)

Set one of the main CINEMA 4D colors.

Parameters:
  • colid (int) – Type of color to set. See c4d_colors.h to get the constants.
  • col (Vector) – The color value.
c4d.GeIsActiveToolEnabled()

Checks if the active tool is ghosted.

Return type:bool
Param:True if the active tool is ghosted, otherwise False.
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(i) if not lang: return

# str, str, bool lang[“extensions”], lang[“extensions”], lang[“extensions”]

Parameter:index (int) – The language index.
Return type:dict
c4d.GetObjectName(type)

Gets a user presentable name from an object type ID.

Parameter:type (int) – An object type ID.
Return type:str
Returns:The object name for type.
c4d.GetTagName(type)

Gets a user presentable name from a tag type ID.

Parameter:type (int) – An tag type ID.
Return type:str
Returns:The tag name for type.
c4d.FindInManager(bl)

Finds and makes bl visible in its manager.

Parameter:bl (BaseList2D) – The object to find.
c4d.CheckIsRunning(type)

Check if a task is running.

Parameter:type (BaseList2D) –

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.
Return type:bool
Returns:True if running, otherwise False.
c4d.GeGetMemoryStat()

Gets CINEMA 4D memory statistics.

Return type:

bool

Returns:

True if successful, otherwise False.

C4D_MEMORY_STAT_MEMORY_INUSE

long

Bytes in use.

C4D_MEMORY_STAT_MEMORY_PEAK

long

Peak usage in bytes.

C4D_MEMORY_STAT_NO_OF_ALLOCATIONS_TOTAL

long

Total number of allocations.

C4D_MEMORY_STAT_NO_OF_ALLOCATIONS_CURRENT

long

Current number of allocations.

C4D_MEMORY_STAT_EOGL_TEXBUFFER

long

Texture buffer usage.

C4D_MEMORY_STAT_EOGL_VERTEXBUFFER

long

Vertex buffer usage.

C4D_MEMORY_STAT_LOWMEMCNT

int

The number of low memory conditions.

c4d.GetMachineFeatures()

Get the features of the computer.

Return type:BaseContainer
Returns:The BaseContainer containing the computer’s features.
c4d.StartEditorRender(bd[, x1=0][, y1=0][, x2=-1][, y2=-1][, active_only=False][, raybrush=False])

Starts the editor renderer:

def RenderEditor(doc):
    bd = doc.GetActiveBaseDraw()
    c4d.StartEditorRender(bd) #render whole basedraw

Note

This fuction is done asynchronously.

Parameters:
  • bd (BaseDraw) – Base draw to draw to.
  • 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.
  • active_only (bool) – Active object only.
  • raybrush (bool) – Ray brush mode.
c4d.CallCommand(cmdid[, subid=0])

Call Command

Parameters:
  • cmdid (int) – Command ID
  • subid (int) – Sub ID (used for scripts)
c4d.GetCommandName(id)

Gets the name of the command with ID specified by id.

Parameter:id (int) – Command ID.
Return type:str
Returns:Command name.
c4d.GetCommandHelp(id)

Get the help string of a command.

Parameter:id (int) – The ID of the command.
Return type:str
Returns:The help string
c4d.IsCommandEnabled(id)

Checks if the command with ID specified by id is enabled.

Parameter:id (int) – Command ID
Return type:bool
Returns:True if the command is enabled, otherwise False.
c4d.IsCommandChecked(id)

Checks if the command with ID specified by id is checked.

Parameter:id (int) – Command ID
Return type:bool
Returns:True if the command is checked, otherwise False
c4d.CallButton(op, id)

Simulate a click of a button.

Parameters:
  • op (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.AddCustomDataType.

Parameter:type (int) –

Data type ID.

DTYPE_NONE None
DTYPE_CHILDS Childs
DTYPE_GROUP Group
DTYPE_COLOR Color
DTYPE_SUBCONTAINER Subcontainer Data
DTYPE_MULTIPLEDATA Multiple Data Entry
DTYPE_TEXTURE Texture
DTYPE_BUTTON Button
DTYPE_DYNAMIC GV Dynamic
DTYPE_SEPARATOR Seperator
DTYPE_STATICTEXT Statictext
DTYPE_POPUP Popup
DTYPE_INT int
DTYPE_FLOAT float
DTYPE_TIME BaseTime
DTYPE_VECTOR Vector
DTYPE_MATRIX Matrix
DTYPE_STRING str
DTYPE_FILENAME str
DTYPE_BASELISTLINK BaseLink
DTYPE_BOOL bool
DTYPE_NORMAL Normal.
Return type:BaseContainer
Returns:Default settings container.
c4d.CopyStringToClipboard(text)

Copy a text to the clipboard.

Parameter:text (str) – The text to copy.
c4d.CopyBitmapToClipboard(map, ownerid)

Copy a bitmap to the clipboard.

Parameter:map (BaseBitmap) – The bitmap to copy.
c4d.GetStringFromClipboard()

Returns a string from the clipboard.

Return type:str
Returns:The string or None.
c4d.GetBitmapFromClipboard()

Returns a bitmap from the clipboard.

Return type:BaseBitmap
Returns:The bitmap or None.
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.GetC4DClipboardOwner()

Get the owner ID of the clipboard.

Return type:

int

Returns:

The owner ID.

CLIPBOARDOWNER_BODYPAINT

Bodypaint 3D.

CLIPBOARDOWNER_PICTUREVIEWER

The Picture Viewer.

Table Of Contents

This Page