0

Python 3.7.7 in next Cinema 4D update

For those who didn’t see the announcement on https://www.3dmotionshow.com and the blog post on our website, the next release of Cinema 4D is moving from Python 2.7.14 to Python 3.7.7.
This next Cinema 4D release will only run on Python 3.7.7 and it will not be possible to execute Python 2.7.14 code.

Python 3.7.7 offers a vast improvement over Python 2.7.14 including better Unicode handling, internal rewriting for better performance, and much more.
For more information about Python 3.7.7 please read the Official Python Documentation.

Those vast improvements may require modifications to existing scripts and plugins.
The only change in the Cinema 4D python module is the class c4d.storage.ByteSeq removed in favor of Python built-in types such as:

  • memoryview: represents a view of the current memory;
  • bytes: represents an immutable bytes sequence;
  • bytearray: represents a mutable bytes sequence.

For code not belonging to the c4d module, lib2to3 can be used to spot possible issues. This can be used with Cinema 4D S22 with `c4dpy -m lib2to3 yourPythonFile.py` for more information look at the lib2to3 official documentation.

To give you an idea, converting the whole Python Github Repository to Python 3 took less than half a day since most of the changes are related to `xrange` changed to `range` and print statement requiring parenthesis. Almost no changes in Cinema 4D API calls were needed. It’s worth noting the updated code on the Github repo will be made available before the Cinema 4D release.

Regarding SDK Support and Python 3 check our Maxon Registered Developer Program to see if you are eligible to participate: getting admitted to the program level-2 will let you early test your plugins against Cinema 4D beta versions.

Finally, any 2.7.x code which is not bound to the Cinema 4D Python API can be ported and tested on 3.7.x with a regular Python Interpreter before the Cinema 4D release. This could speed up porting part of your code before being able to get hands-on the next release.

Hoping this blog post answers some of your questions, we keep looking forward on working together with this new exciting Python update.
Cheers,
MAXON’s SDK Team

Maxime Adam

Maxime Adam

SDK Support Specialist In parallel to studying 3D in art school, I taught myself programming in C++ and Python. On multiple jobs in different companies I built up development experience by improving workflows with custom Cinema 4D plugins and scripts.

Leave a Reply

Your email address will not be published. Required fields are marked *