Python in Cinema 4D¶
Introduction¶
c4dpy is available to execute python code with the Cinema 4D API outside of Cinema 4D.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 2.7.14 (default, May 3 2018, 18:05:57) Build with MSC v.1500 64 bit (AMD64) (Microsoft Visual Studio 2008)
Mac OS: Python version 2.7.14 (default, May 5 2018, 00:43:48) Build with GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.37)
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:
PluginMessagecatches some specific Cinema 4D event like (e.g. start of Cinema 4D, end of Cinema 4D, etc…).
BitmapLoaderDatacreates a bitmap importer (e.g. Py-Xample).
BitmapSaverDatacreates a bitmap exporter (e.g. Py-Xample).
CommandDatacreates a command (e.g. Py-TextureBaker).
FalloffDatacreates a Falloff. Falloff are no more exposed in R20+. (e.g. Py-NoiseFalloff).
MessageDatacatches some CoreMessage or creates a global timer (e.g.c4d.plugins.MessageData).
ToolDatacreates a tool (e.g. Py-LiquidPainter).
SculptBrushToolDatacreates a brush (not only limited to sculpting) (e.g. all examples prefixed with py-sculpt such as Py-Sculpt Grab Brush).
NodeDatacreates a BaseList2D object.
TagDatacreates a tag (e.g. Py-LookAtCamera).
ObjectDatacreates an object. It can be:
A generator delivering a
c4d.PolygonObject(e.g. Py-RoundedTube).A generator delivering a
c4d.SplineObject(e.g. Py-DoubleCircle).A polygon modifier (e.g. Py-SpherifyModifier).
A particle modifier (e.g. Py-Gravitation).
ShaderDatacreates a shader (e.g. Py-Fresnel).
SceneLoaderDatacreates a scene importer.
SceneSaverDatacreates a scene exporter (e.g. Py-IESMeta).
PreferenceDatacreates global preferences (e.g. Py-Preference).