Python in Cinema 4D

Introduction

A separate Python installation is not needed. Python is integrated into Cinema 4D and runs out of the box.

Python can be found in different parts of the Cinema 4D eco-system.
It can be used to extend, automate or improve workflow by creating custom scripts or plugins.

Being all the functions of the “c4d” module calling their C++ equivalent, executing a Python code, invoking only Cinema 4D SDK functions, takes almost the same time of the equivalent C++ code.

A python interpreter called c4dpy is available to execute python code with the Cinema 4D API outside of Cinema 4D.
Moreover c4dpy bring extra features such as Autocompletion or Debugging for Python Script (Plugin are not supported). See the c4dpy manual.

Version

The Cinema 4D Python interpreter versions are:

  • Windows: Python version 3.9.1+ (pipelines/8936:778d593, Jan 25 2021, 20:35:13) [MSC v.1900 64 bit (AMD64)]

  • Mac OS: Python version 3.9.1+ (pipelines/8936:778d593, Jan 25 2021, 20:35:13) [Clang 12.0.0 (clang-1200.0.32.29)]

General

There are general places where Python can be found within the Cinema 4D eco-system:

  • c4dpy. A custom python interpreter which supports Cinema 4D modules.

  • Python_init.py. An optional python file called before plugin registration.

  • Python Libraries. Information about 3rd party libraries / modules.

  • Python Console. The Python Console / interpreter within Cinema 4D.

  • Python Script Manager. The Script manager to edit and run scripts within Cinema 4D.

Embedded

Python is embedded in various places of Cinema 4D, such as:

Note

Use of Python in these situations is context-specific, which means some functions/methods are not possible to be called (e.g. insert new object in a document from a Python Tag). See Threading Information.

Plugins

In addition Python in Cinema 4D can be used to creates the following plugins in order to extend and create new Cinema 4D component: