c4d
¶
Follow me to the Inheritance diagramm .
GeGetSerialInfo()
GeGetVersionType()
GeGetSystemInfo()
GeGetTimer()
GeGetMilliSeconds()
GetDefaultFPS()
GeGetCurrentOS()
GeGetByteOrder()
GeGetGray()
GetC4DVersion()
GetAPIVersion()
StopAllThreads()
GetGlobalTexturePath()
SetGlobalTexturePath()
GenerateTexturePath()
IsInSearchPath()
FlushUnusedTextures()
SetWorldContainer()
GetWorldContainer()
GetWorldContainerInstance()
GetViewColor()
SetViewColor()
GeIsActiveToolEnabled()
GeGetLanguage()
CopyStringToClipboard()
CopyBitmapToClipboard()
GetStringFromClipboard()
GetBitmapFromClipboard()
GetClipboardType()
GetC4DClipboardOwner()
RestartMe()
CallButton()
PrefsLib_OpenDialog()
GetCustomDataTypeDefault()
CheckIsRunning()
GetMachineFeatures()
StartEditorRender()
Cast()
CallFunction()
AllocListHead()
CopyData()
NEW
c4d.
GeGetSystemInfo
(
)
¶
Returns system information flags.
Return type: | int | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Returns: |
Flags:
|
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:
|
||||
---|---|---|---|---|---|
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:
|
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:
|
c4d.
GeGetByteOrder
(
)
¶
Get the type of OS that is running Cinema 4D.
Return type: | int | ||||
---|---|---|---|---|---|
Returns: |
The byte order:
|
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!")
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()
c4d.
StatusSetBar
(
p
)
¶
Set the status bar text:
import c4d c4d.StatusSetBar(50)
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: |
|
---|
c4d.
StatusSetNetLoad
(
status
)
¶
New in version R16.050.
Sets the NET status bar to status state.
Parameters: |
status
(
int
) –
The NET status state:
|
---|
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:
|
---|
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:
|
||
---|---|---|---|
Return type: | bool | ||
Returns: | True if successful, otherwise False . |
c4d.
SendCoreMessage
(
coreid
,
msg
[
,
eventid=0
]
)
¶
Sends a core message. For example:
msg = c4d.BaseContainer(c4d.COREMSG_CINEMA_GETCOMMANDENABLED) msg.SetLong(c4d.COREMSG_CINEMA_GETCOMMANDENABLED, id) name = c4d.SendCoreMessage(c4d.COREMSG_CINEMA, msg, 0)
or:
#returns the COREMSG_CINEMA_GETMACHINEFEATURES container dat = c4d.SendCoreMessage(c4d.COREMSG_CINEMA, c4d.BaseContainer(c4d.COREMSG_CINEMA_GETMACHINEFEATURES))
Parameters: |
|
||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Return type: |
any |
||||||||||||||||||||
Returns: |
The return data, depends on the message.
|
c4d.
GePluginMessage
(
id
,
data
)
¶
Sends a plugin message to other plugins.
Parameters: |
|
---|---|
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: |
|
||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
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: |
|
---|
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: |
|
---|
c4d.
GenerateTexturePath
(
docpath
,
srcname
,
suggestedfolder
[
,
service
,
bt
]
)
¶
New in version R16.050.
Generates the texture filename for a given texture image.
Parameters: |
|
---|---|
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: |
|
---|---|
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:
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Return type: | c4d.Vector | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Returns: | The color value. |
c4d.
SetViewColor
(
colid
,
col
)
¶
Set a viewport color.
Parameters: |
|
---|
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
(
bool
) –
The task
|
||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Return type: | bool | ||||||||||||
Returns: | True if 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:
|
||||||
---|---|---|---|---|---|---|---|
Return type: | c4d.BaseContainer | ||||||
Returns: |
The BaseContainer containing the computer’s features.
See also For the container ID see OPENGL_Flags and MACHINEINFO_Flags |
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: |
|
---|
c4d.
CallCommand
(
cmdid
[
,
subid=0
]
)
¶
Call Command
Parameters: |
|
---|
c4d.
GetCommandName
(
id
)
¶
Gets the name of the command with ID specified by id .
Parameters: | id ( int ) – Command ID. |
---|---|
Return type: | str |
Returns: | Command name. |
c4d.
GetCommandHelp
(
id
)
¶
Get the help string of a command.
Parameters: | 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.
Parameters: | 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.
Parameters: | id ( int ) – Command ID |
---|---|
Return type: | bool |
Returns: | True if the command is checked, otherwise False |
c4d.
RestartMe
(
[
param=None
,
exitcode=0
]
)
¶
Restarts Cinema 4D.
Parameters: |
|
---|---|
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: |
|
---|
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:
|
||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
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.
|
||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
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:
|
c4d.
GetC4DClipboardOwner
(
)
¶
Get the owner ID of the clipboard.
Return type: | int | ||||
---|---|---|---|---|---|
Returns: |
The owner ID:
|
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: |
|
||||
---|---|---|---|---|---|
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: |
|
---|---|
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.
CopyData
(
op1
,
descid1
,
op2
,
descid2
,
aliastrans
)
¶
New in version R17.032.
Copies a parameter data to another.
Parameters: |
|
---|