c4d

Functions

Miscellaneous

c4d.GeGetSystemInfo()

Returns system information flags.

Return type:int
Returns:Flags:
SYSTEMINFO_0 None.
SYSTEMINFO_COMMANDLINE Application runs in command line mode.
SYSTEMINFO_SAVABLEDEMO Savable demo version.
SYSTEMINFO_SAVABLEDEMOACTIVE Activated savable demo version, SYSTEMINFO_SAVABLEDEMO is still set.
SYSTEMINFO_OPENGL OpenGL is activated and loaded correctly.
SYSTEMINFO_STUDENT Activated student version, always set along with SYSTEMINFO_SAVABLEDEMO.
SYSTEMINFO_LITE Lite version, cannot load any plugins.
SYSTEMINFO_LITE_ACTIVE Lite version is registered, SYSTEMINFO_LITE is still set.
SYSTEMINFO_CINEWARE CineWare - The Adobe AfterEffects connection.
SYSTEMINFO_CINERENDER CineRender - The renderer used in Vectorworks, Archicad and Allplan.
c4d.GeGetSerialInfo()

Returns user registration information.

Note

A multi-license has the following formating: 201[100]00519-ABCDEF. The third, fourth and fifth digits equal the number of licenses, in the previous example it is 100 licenses.

Example:

import c4d

def main():
  si = c4d.GeGetSerialInfo(c4d.SERIALINFO_MULTILICENSE)
  if len(si['nr']) > 0:
    # Multi-license, do something
    print "Multi-license"
    print si
  else:
    si = c4d.GeGetSerialInfo(c4d.SERIALINFO_CINEMA4D)
    print "Single-license"
    print si
    # Single-license, do something

if __name__=='__main__':
  main()
Parameters:type (int) –

The information to retrieve:

SERIALINFO_CINEMA4D Serial for Cinema 4D.
SERIALINFO_MULTILICENSE Serial for Cinema 4D running in a license server enviroment.
SERIALINFO_RLMLICENSE Serial for Cinema 4D running in an RLM license server environment. Private.
Return type:dict{nr: str, organization: str, name: str, street: str, city: str, country: str}
Returns:A dictionary with the serial information for Cinema 4D.
c4d.GeGetVersionType()

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

Return type:int
Returns:The version type:
VERSIONTYPE_PRIME Cinema 4D Prime.
VERSIONTYPE_BODYPAINT Bodypaint 3D.
VERSIONTYPE_STUDIO Cinema 4D Studio.
VERSIONTYPE_VISUALIZE Cinema 4D Visualize.
VERSIONTYPE_BROADCAST Cinema 4D Broadcast.
VERSIONTYPE_BENCHMARK Cinebench.
VERSIONTYPE_UPDATER Online updater.
VERSIONTYPE_INSTALLER Installer.
VERSIONTYPE_NET_CLIENT Cinema 4D Net Client.
VERSIONTYPE_NET_SERVER_3 Cinema 4D Net Server.
VERSIONTYPE_NET_SERVER_UNLIMITED Cinema 4D Net Server.
VERSIONTYPE_UNKNOWN Unknown.
VERSIONTYPE_LICENSESERVER Cinema 4D License Server.
c4d.GeGetTimer()

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 OS running Cinema 4D:
OPERATINGSYSTEM_WIN Windows.
OPERATINGSYSTEM_OSX OS X.
OPERATINGSYSTEM_UNIX Unix.
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.GeGetGray()

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

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

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

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

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

Return type:list of int
Returns:The version of the Cinema 4D Python SDK.
c4d.StopAllThreads()

Stop all running threads.

c4d.StatusClear()

Clear the status bar text.

c4d.StatusSetText(str)

Set the status bar text:

import c4d
c4d.StatusSetText("Hello World!")
../../_images/statussettext.png
Parameters: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 is not increasing:

import c4d
c4d.StatusSetSpin()
../../_images/statussetspin.png
c4d.StatusSetBar(p)

Set the status bar text:

import c4d
c4d.StatusSetBar(50)
../../_images/statussetbar.png
Parameters:p (float) – The percentage of the bar (0-100).
c4d.StatusNetClear()

New in version R16.050.

Clears the NET status bar text.

c4d.StatusSetNetBar(p, dat)

New in version R16.050.

Sets the NET status bar progress and custom color.

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)

New in version R16.050.

Sets the NET status bar to status state.

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)

New in version R16.050.

Sets the NET status bar text.

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

New in version R15.037.

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

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

New in version R15.037.

Checks if a NET server application is running.

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

New in version R15.037.

Checks if a NET client application is running.

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

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_0 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.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_ASYNCEDITORMOVE The user moved something in the editor window. Managers should update things like position fields.
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.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.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_0 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.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.GetGlobalTexturePath(i)

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.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.GenerateTexturePath(docpath, srcname, suggestedfolder[, service, bt])

New in version R16.050.

Generates the texture filename for a given texture image.

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.IsInSearchPath(texfilename, docpath)

New in version R16.050.

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

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

Flush all unused textures.

c4d.SetWorldContainer(bc)

Set the main Cinema 4D settings container. See GetWorldContainer for values.

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

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

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

Returnce 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.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  
VIEWCOLOR_MOSELECTEDFG  
VIEWCOLOR_MOSELECTEDBG  
VIEWCOLOR_MODESELECTEDFG  
VIEWCOLOR_MODESELECTEDBG  
VIEWCOLOR_TESSELLATIONWIRE  
VIEWCOLOR_MAXCOLORS  
Return type:c4d.Vector
Returns:The color value.
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  
    VIEWCOLOR_MOSELECTEDFG  
    VIEWCOLOR_MOSELECTEDBG  
    VIEWCOLOR_MODESELECTEDFG  
    VIEWCOLOR_MODESELECTEDBG  
    VIEWCOLOR_TESSELLATIONWIRE  
    VIEWCOLOR_MAXCOLORS  
  • col (c4d.Vector) – The new color.
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(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.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.FindInManager(bl)

Finds and makes bl visible in its manager.

Parameters:bl (c4d.BaseList2D) – The object to find.
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=c4d.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.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.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.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.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.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.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

Only calls from the main thread!

Parameters:
  • op (c4d.BaseList2D) – The object.
  • id (int) – The ID of the button.
c4d.PrefsLib_OpenDialog(page)

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

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

The page to open:

PREFS_PRI_COMMON Common.
PREFS_PRI_DOCUMENT Document.
PREFS_PRI_INTERFACE Interface.
PREFS_PRI_THEME Theme.
PREFS_PRI_MOUSE Input Devices.
PREFS_PRI_OPENGL OpenGL.
PREFS_PRI_VIEWPORT Viewport.
PREFS_PRI_FILES Files.
PREFS_PRI_UNITS Units.
PREFS_PRI_MEMORY Memory.
PREFS_PRI_INTERNET Communication.
PREFS_PRI_RENDER Renderer.
PREFS_PRI_BODYPAINT3D Bodypaint 3D
PREFS_PRI_MODULES Modules specific.
PREFS_PRI_IMEXPORT Import/Export.
PREFS_PRI_ADVANCED Advanced Settings.
PREFS_PRI_NET NET.
Return type:bool
Returns:True on success otherwise False.
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.
Return type:c4d.BaseContainer
Returns:Default settings container.
c4d.CopyStringToClipboard(text)

Copy a text to the clipboard.

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

Copy a bitmap to the clipboard.

Parameters:map (c4d.bitmaps.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:c4d.bitmaps.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 owns the clipboard.
CLIPBOARDOWNER_PICTUREVIEWER The Picture Viewer owns the clipboard.
c4d.Cast(type, obj)

New in version R16.021.

Casts obj to the given type.

Note

Particulary 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)
Parameters:
  • type (type) –

    The type to cast to. Supported types are:

    BaseContainer
    str
    Matrix
    UUID

    Changed in version R17.048.

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

  • obj (object) – The object to cast.
Return type:

any

Returns:

The result of the cast operation.

c4d.CallFunction(op, function, arg1, arg2, arg3)

New in version R16.021.

Calls a function defined within a scripting expression.
This works for both Python and C.O.F.F.E.E. scripting tags, effectors, XPresso nodes, Interaction tags and also for Python generators.

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. This make it possible to call a C.O.F.F.E.E. function from Python and vice versa.
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()

New in version R16.050.

Allocates a list head.

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)

New in version R17.032.

Copies a parameter data to another.

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.