Autocompletion Manual

New in version S22.

Introduction

The Cinema 4D Classic Python API is defined in C++, so a regular Python interpreter have no idea about the Cinema 4D SDK.
So we introduced what we call a auto completion dummy package, a Python reflection of the built-in C++ Python API.

It’s located in {C4D_INSTALLATION_PATH}/resource/modules/python/libs/python39/c4d.

Warning

This auto completion dummy package don’t offer Cinema 4D functionality outside of Cinema 4D.
It’s just a package with all the modules classes, methods and their documentation included.
It can be imported as a regular Python Package within your Standalone Python Interpreter. (Compatible with latest Python 2.7 and Python 3.9).
Once it’s done (see Installation), any decent IDE will provide code completion and documentation for the c4d module.

Note

For the moment there is two issues: * Variable members are not exposed. So if you write c4d.Vector. For the package there is no x, y, z arguments. Keep assured that all symbols are present such as c4d.EVENT_ADD. * Possible symbols for an argument are not exposed in the docstring.
Note this package is used by the SDK Team to build the Python documentation, so if you spot any issue, please let us know on PluginCafe.

Installation

  1. Download and Install any Python version from Python Download which match your needs, it’s recommended to match the Cinema 4D version (see Version) but this is not mandatory.

  2. Go to the site package folder, this where to put all 3rd parties Python Package.

    • Windows:

      1. Go to {Python Installation folder}/Lib/site-packages.

    • Mac:

      1. Execute ‘/Applications/Python 3.9/IDLE.app’.

      2. Execute the next script to retrieves the Site Package.

        import site
        print(site.getsitepackages())
        
      3. Go to the first folder indicated by the previous Python script.

  3. Create a Symbolic Link named c4d pointing to the auto completion dummy package.

    • Windows:

      1. Open the command line in the site-package folder.

        ../_images/cmd.gif
      2. Execute the next command mklink /d /h /j c4d “{PATH_TO_THE_AUTOCOMPLETION_DUMMY_PACKAGE}”

        If Cinema 4D is installed in C:\Program Files\Maxon Cinema 4D S24 the complete command to execute will be:

        mklink /d /h /j c4d “C:\Program Files\Maxon Cinema 4D S24\resource\modules\python\libs\python39\c4d”
    • Mac:

      1. Open a terminal in this folder.

      2. Execute the next command ln -s “{PATH_TO_THE_AUTOCOMPLETION_DUMMY_PACKAGE}” c4d.

        If Cinema 4D is installed in /Applications/Maxon Cinema 4D S24` the complete command to execute will be:

        ln -s “/Applications/Maxon Cinema 4D S24/resource/modules/python/libs/python39/c4d” c4d

PyCharm

  1. Add the previously installed Python Interpreter, see https://www.jetbrains.com/help/pycharm/configuring-local-python-interpreters.html.

  2. Create a new project, be sure the selected interpreter is the one you installed. If you decide to use virtualenv, check ‘Inherit global site-packages’.

    ../_images/01_create.jpg
  3. Enjoy.

    ../_images/02_use.jpg

Visual Studio Code

  1. Install the Python extension for Visual Studio Code.

  2. Select the File > Preferences > Settings command (or Ctrl + , or Cmd + , shortcut).

  3. Search the settings for python.jedi and disable it.

    ../_images/01_jedi_remove.jpg
  4. Create a new file.

  5. Defines its language in the bottom right.

    ../_images/02_language.jpg
  1. Defines the used interpreter in the bottom left.

    ../_images/03_interpreter.jpg
  2. Enjoy.

    ../_images/04_use.jpg