Follow me to the Inheritance diagramm.
HandleInfo NEW
CameraObject
BaseShader NEW
Get the type of CINEMA 4D application that is running.
Return type: | int | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Returns: |
Flags:
|
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. |
Get the type of CINEMA 4D application that is running.
Return type: | int | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Returns: |
The version type:
|
Get the current timer count in milliseconds.
Return type: | int |
---|---|
Returns: | The time. |
Get the current timer count in milliseconds.
Return type: | float |
---|---|
Returns: | The time |
Get the default frames per second value.
Return type: | int |
---|---|
Returns: | The default FPS value. |
Get the type of OS that is running CINEMA 4D.
Return type: | int | ||||||
---|---|---|---|---|---|---|---|
Returns: |
The default FPS value.
|
Get the type of OS that is running CINEMA 4D.
Return type: | int | ||||
---|---|---|---|---|---|
Returns: |
The default FPS value.
|
Get the color values for the default CINEMA 4D gray.
Return type: | Vector |
---|---|
Returns: | All color components in this vector. |
Get the version of CINEMA 4D that is running, for instance 12016.
Return type: | int |
---|---|
Returns: | The version of CINEMA 4D. |
Get the API version of the Python C4DSDK, for instance (1, 0, 1001)
Return type: | list of int |
---|---|
Returns: | The version of CINEMA 4D. |
Stop all running threads.
Clear the status bar text.
Set the status bar text:
import c4d
c4d.StatusSetText("Hello World!")
Parameters: | str (str) – The text to display. |
---|
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:
import c4d
c4d.StatusSetSpin()
Set the status bar text:
import c4d
c4d.StatusSetBar(50)
Parameters: | p (float) – The percentage of the bar (0-100). |
---|
Adds a global event to CINEMA 4D’s event queue. Results in a CoreMessage() message.
Parameters: |
flags (int) –
One of the following flags:
|
---|
Sends a synchronous event message (for example to make the timeline, timeslider etc. do an instant redraw).
Parameters: |
messageid (int) –
One of the following flags:
|
||||
---|---|---|---|---|---|
Return type: | bool | ||||
Returns: | True if successful, otherwise False. |
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.
|
New in version R13.016.
Sends a plugin message to other plugins.
Parameters: |
|
---|---|
Return type: |
bool |
Returns: |
True if the message could be sent, otherwise False. |
Redraws the editor views. Must be called from the main thread!
Parameters: |
|
||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Return type: |
bool |
||||||||||||||||||||||||||||||||||||||
Returns: |
Success of updating the editor view. |
Adds a custom event to the internal message queue.
Note
There are areas in C4D, 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: |
|
---|
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. |
Set the global texture path.
Parameters: |
|
---|
Flush all unused textures.
Set the main CINEMA 4D settings container. See GetWorldContainer for values.
Parameters: | bc (BaseContainer) – The new settings. |
---|
Returns a copy of the settings container of CINEMA 4D.
Return type: | BaseContainer |
---|---|
Returns: | The main CINEMA 4D settings. |
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_????. These settings cannot be set using GetWorldContainerInstance. |
---|---|
Return type: | BaseContainer |
Returns: | The main CINEMA 4D settings. |
Returns a viewport color.
Parameters: |
colid (int) –
Type of color to get:
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Return type: | Vector | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Returns: | The color value. |
Set a viewport color.
Parameters: |
|
---|
Checks if the active tool is ghosted.
Return type: | bool |
---|---|
Param : | True if the active tool is ghosted, otherwise False. |
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 |
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. |
New in version R13.016.
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. |
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. |
Finds and makes bl visible in its manager.
Parameters: | bl (BaseList2D) – The object to find. |
---|
Check if a task is running.
Parameters: |
type (bool) –
The task
|
||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Return type: | bool | ||||||||||||
Returns: | True if running, otherwise False. |
Get the features of the computer:
import c4d
bc = c4d.GetMachineFeatures()
print bc[c4d.OPENGL_RENDERER_NAME] #Output e.g: NVIDIA GeForce 9600 Engine
Return type: | BaseContainer |
---|---|
Returns: |
The BaseContainer containing the computer’s features.
See also For the container ID see OPENGL_Flags and MACHINEINFO_Flags |
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: |
|
---|
Call Command
Parameters: |
|
---|
Gets the name of the command with ID specified by id.
Parameters: | id (int) – Command ID. |
---|---|
Return type: | str |
Returns: | Command name. |
Get the help string of a command.
Parameters: | id (int) – The ID of the command. |
---|---|
Return type: | str |
Returns: | The help string |
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. |
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 |
Simulate 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()
Parameters: |
|
---|
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. |
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: | BaseContainer | ||||||||||||||||||||||||||||||||||||||||||||
Returns: | Default settings container. |
Copy a text to the clipboard.
Parameters: | text (str) – The text to copy. |
---|
Copy a bitmap to the clipboard.
Parameters: | map (BaseBitmap) – The bitmap to copy. |
---|
Returns a string from the clipboard.
Return type: | str |
---|---|
Returns: | The string or None. |
Returns a bitmap from the clipboard.
Return type: | BaseBitmap |
---|---|
Returns: | The bitmap or None. |
Get the type of the clipboard.
Return type: | int | ||||||
---|---|---|---|---|---|---|---|
Returns: |
The type of the clipboard:
|
Get the owner ID of the clipboard.
Return type: | int | ||||
---|---|---|---|---|---|
Returns: |
The owner ID.
|