What is New in S26

S26

Python Improvement

In addition to the Cinema 4D Connector with Visual Studio Code, which allows to send and receive a python script from Cinema 4D to Visual Studio Code and vice versa. Several improvements have been made to the overall scripting experience:

  • Access to frameworks in the maxon API for Python has been improved. Thus it is no longer necessary to import each framework explicitly.

    import maxon
    from maxon.frameworks import volume # This line is not anymore needed.
    
  • Objects exposed in frameworks are directly accessible in the maxon module. Thus any code written in C++ for the Maxon API, is identical in python.

    # C++ code
    #include <assets.h>
    maxon::AssetInterface::GetApplicationRepository();
    
    # S26 Python
    import maxon
    maxon.AssetInterface.GetApplicationRepository()
    
    # R25 Python, still compatible with S26
    import maxon
    from maxon.frameworks import asset
    maxon.frameworks.asset.AssetInterface.GetApplicationRepository()
    
  • The “Script Word Wrap” option set in the global preference in the “Interface” tab is now supported by the Script Editor and the console in Python mode.

  • Improved word wrapping in multi-line text including the Python console via the CTRL + Left / Right shortcuts. They now jump correctly to starting/ending words.

  • The category selected in the console (Default, Python, Team Render, etc.) is now saved and restored after restarting Cinema 4D.

  • All default code has been modified to support Python typing.

  • Support Python Typing in the c4d Auto Completion Dummy Package.

  • Improved the BaseList2D representing a script loaded in the Script Manager, by supporting BIT_ACTIVE to indicate which one had it’s code visible in the Script Manager and also exposing the read-only PYTHONSCRIPT_SCRIPTPATH parameter to contain the file path to the python script.

  • Improved the Script Manager script chooser by displaying the full path of script.

Asset API

In this release, the Asset API has been exposed in Python which provides content in the form of reusable assets served by the Cinema 4D asset browser. Documentation about it can be found in The Asset Framework page.

The Asset API is a collection of interfaces for the Asset Browser, replacing the older Content Browser. The API does provide only limited access to the graphical user interface of the Asset Browser and primarily exposes the underlying data structures that are represented by the Asset Browser.

Assets come natively in the form of scenes, objects, materials, media files, presets and other minor types as category and keyword assets. This data wrapped by an asset can be loaded into a scene with the Asset Browser and is stored in asset databases. Asset databases also store metadata for all their assets. This asset metadata is accessible in its most tangible form in the Info Area of the Asset Browser, displaying for example an annotation which describes a single asset.

It is recommended to read the Asset API Manual or even the C++ Asset API HandBook pages and sub-pages to have a broad overview of the Asset API.

Finally several Asset API examples have been added to the Python GitHub repository in the Script | 05_modules | assets folder.

Link

Description

Asset Databases

Provides examples for handling asset databases and repositories.

Asset Types

Provides examples for creating and loading different asset types.

Asset Metadata

Provides examples for reading and writing asset metadata.

Cinema 4D Connector with Visual Studio Code

A plugin in Cinema 4D to exchange code between the Script Manager and Visual Studio Code has been introduced.

In addition, the Visual Studio Code Extension Cinema 4D Connector enhances the development experience of all Cinema 4D developers by providing automatic completion of the “c4d” python package, debugging support, syntax highlighting for “.*res” and “.*str” files or even getting Cinema 4D’s Python console output directly into Visual Studio Code.

The Cinema 4D Connector - Documentation documents more extensively each features.

The compiled Cinema 4D plugin can be downloaded on GitHub - Cinema 4D Plugin. The Visual Studio Code extension can be found directly within the Visual Studio Marketplace by searching Cinema 4D Connector or on GitHub - Visual Studio Extension. Finally, the source code of these projects is available on GitHub via the following links:

Nodes API Helper

With the S26 version of Cinema 4D, helper functions from maxon.GraphModelInterface have been marked as deprecated and moved to the new maxon.GraphModelHelper interface. This new interface consists of static methods only. The interface provides convenient methods to simplify the use of the Node API, but does not offer more possibilities than you would have using the standard methods.

The new maxon.GraphModelHelper allows to:

  • mute or unmute a connection, check if it exists or delete it.

  • select or deselect nodes, ports, connections or return if the items are selected.

  • create ports on groups or on the root.

  • search for connected nodes (predecessors, successors).

  • search for nodes or ports by name, ID, asset ID.

Various changes

  • Added CMD_HIDDEN flag, allowing to hide a command if this value is returned in the CommandData.GetState() method.

  • The type c4d.NormalTag representing a Point Normal Tag have been exposed in python.

  • The c4d.Vector class has been enhanced to be on par with its C++ version.

  • Several functions have been added to facilitate the loading of Python files in the script manager, an example of use can be found in load_python_script_s26.py in the Python Github Repository.

  • Variation Shader provide an API to manipulate inner layer through parameter access, an example of use can be found in shader_variation_s26.py in the Python Github Repository.

API Changelog

See API Changelog S26 page.