Sometimes I have thought that would it be cool if you could make custom shelf tools in Cinema 4D and use those as any native tool. Whether it be object, generator, effector, field or whatever. By a shelf tool I mean that there’s a clickable icon in the toolbar that loads the asset. And all without the hassle to create a proper Python plug-in for such simple tool.

Creating a custom shelf tool:

  1. Download the latest ar_shelf_tool.py Python Module.
  2. Place the module to “C:\Users\{USER}\AppData\Roaming\MAXON\{CINEMA 4D VERSION}\python39\libs\”
  3. Create the asset file somewhere. It it’s recommended to use c4d file format.
  4. Customize the template code below and save it to “C:\Users\{USER}\AppData\Roaming\MAXON\{CINEMA 4D VERSION}\library\scripts”. Name the file as you want but the extension has to be “.py” (Python file).
  5. Create an icon for the script 64×64 pixel resolution tif-format, with transparent background. Name it same as the python script (only the extension is different) and place it also in the scripts folder.
  6. Run/restart Cinema 4D and now you are ready to use your new shelf tool!

Shelf tool template script:

"""
Name-US: Asset's Name
Description-US: Asset's Description
"""

# Libraries
import ar_shelf_tool as st

# Functions
def main():
    # File path of the asset, change this, very important!
    assetPath = ""

    # Import the asset
    st.Import(path=assetPath, # Asset path
              icon=__file__,  # Icon path
              color=None,     # Color in c4d.Vector() format
              matsOnly=False) # If 'True' imports only materials from asset file

# Execute main()
if __name__=='__main__':
    main()
  • Replace “Asset’s Name” with a proper asset name. This is the name of the script that will be displayed in Cinema 4D.
  • Replace “Asset’s Desciprtion” with a proper description. This will be showed as a tooltip when mouse hovers over the script icon.
  • Replace “assetPath” with the absolute file path of the c4d-file you want to load. Use forward slashes (“/”) instead of backward slashes (“\”) in the file path.
  • If you don’t want that script changes the assets’s icon, change “icon=iconPath” in the code to “icon=None”.

The script automatically recognizes the asset’s type, for example: if it’s an effector it puts it in selected MoGraph Generators like normally using effectors and so on. The script also works with key modifiers as Cinema 4D by default works when creating a new object.

N.B. Shelf tool script loads ONLY the first object of the c4d document! If you have multiple objects, group everything under one null object! This is very important!

If you want to make shelf tools for my Python Effectors, you can find some icons here: AR_Utility_Icons

Updated 06/05/2022
> Updated ar_shelf_tool.py module in Github, so template script is now a bit cleaner

Asset, Cinema 4D, Python

Finally I have updated AR_Scripts for Cinema 4D R25 (and S26) and Python 3.9.1. These updated scripts can be found on my Github. Check them out!

I have added many nice scripts and removed some buggy and deprecated ones. I have now moved to work with R25 (and now with new S26) and this means that I’m not writing scripts nor tools for the older Cinema 4D versions and Python 2. For now I’m keeping old scripts in “AR_Scripts_1.0.16_R21_Deprecated” folder on Github for those who uses older C4D’s.

All of the scripts should work with Windows and MacOS machines. There’s currently 91 scripts, many with multiple actions (via keyboard modifier) and new scripts are coming depending how lazy I’m.

AR_Scripts (Aturtur’s Cinema 4D Scripts)

Cinema 4D, Python

More and more I have to deliver different versions from the project. One for television one for web, social media, and so on. Many times the aspect ratio and the resolution varies quite much. That’s why I created this simple but useful asset to help me to see how one render looks in different aspect ratios.

Note that the aspect ratio guide should be placed under the camera object.

Some calculations in Pythonish pseudocode:

doc = c4d.documents.GetActiveDocument()
temp_height = distance_from_camera * math.tan((camera_fov_ver * 0.5)) * 2.0
temp_width = distance_from_camera * math.tan((camera_fov_hor * 0.5)) * 2.0

guide_position_x = temp_width * film_offset_x
guide_position_y = temp_height * film_offset_y * -1

old_aspect_ratio = resolution_width / resolution_height # Calculate aspect ratio
if old_aspect_ratio > new_aspect_ratio: # If old aspect ratio is bigger than new aspect ratio
    guide_width = temp_height * new_aspect_ratio
    guide_height = temp_height
elif old_aspect_ratio < new_aspect_ratio: # If old aspect ratio is smaller than new aspect ratio
    guide_width  = temp_width
    guide_height  = temp_height / new_ar
else: # If old and new aspect ratios are same
    guide_width  = temp_height
    guide_height  = temp_width

Supports:

  • Perspective Projection
  • Focal Length changes
  • Sensor Size changes
  • Film offset changes
  • Render resolution changes
  • Position Z changes

Updated 06/11/2021
> Added text fields to see guides width and height values in pixels
> Added two buttons to get current aspect ratio and crop current resolution based on guides resolution

Updated 13/10/2022
> Updated version with scaling parameter

Included in AR_Scripts!

ar_aspect_ratio_guide.c4d v1.1.1 (2023)

Asset, Cinema 4D, Python, Tag

This is nothing special, just an old Python Generator asset practice that I found lying around. Its only purpose is to show index numbers. Mainly created to show polygon object’s polygon, edge, and point numbers. Because sometimes you have to know the specific index number and instead of searching it in ‘Structure’ tab this is faster. Under the hood this Python Generator is just a basic matrix object with Display mode turned to ‘Index’.

Supports

  • Polygon objects
  • Splines objects
  • Some MoGraph objects, like matrix and cloner

Updated 02/04/2022
> Fixed generator handling

ar_generator_index.c4d v1.0.1 (2023)

Asset, Cinema 4D, Generator, Python

Creating custom render tokens for Cinema 4D is very simple with Python. First you want to loop through tokens and check that there is no duplicates.

if __name__=="__main__":
    for registeredToken in c4d.modules.tokensystem.GetAllTokenEntries():
        if registeredToken.get("_token") in ["my_token"]:
            exit()

Next you register your custom token with following command:

c4d.plugins.RegisterToken("my_token", "Comment", "Example value", MyFunction)

Last but not least you need the function that returns some kind of string that the token outputs:

def MyFunction(data):
    return "myString" # Replace this with your more advanced script

Here is my collection of custom tokens that might be useful.

Tokens included:

  • Date Year Full (2021) – Token: $YYYY
  • Date Year Short (21) – Token: $YY
  • Date Month (01) – Token: $MM
  • Date Day (16) – Token: $DD
  • Date Hour (18) – Token: $hh
  • Date Minute (42) – Token: $mm
  • Date Second (10) – Token: $ss
  • PC Name (String) – Token: $pcname
  • Username (String) – Token: $pcuser
  • Render Engine (Redshift) – Token: $renderer
  • Project version – Token: $ver (Parses version number of the project name)
  • Object Name – Token: $objname (Returns name of the first object in the object manager)

N.B. Many of these tokens are now already included in newer Cinema 4D versions! When using custom tokens beaware that you are not trying to overwrite existing tokens.

Updated 02/09/2021
> Added two new tokens
> Fixed render engine name token

Place the folder in the zip file to Cinema 4D’s plug-in folder.
ar_tokens_v1.0.2.zip

Cinema 4D, Plug-in, Python

This is handy plug-in for Cinema 4D. It helps exporting Redshift Proxy files different ways. It works like the default Redshift Proxy File Exporter but this plug-in gives some goodies.

Extra features:

  • Export all or selected objects to separate files
  • Option to create folders for objects
  • Open export folder in explorer while exporting
  • Monitor exporting process in status bar

Installation:
Place Redshift Proxy Exporter plug-in to your appdata plug-in folder to make it work properly (avoid permission errors), since plug-in has to write and read the settings file.

If you close the dialog with “Close” button, the plug-in will remeber the last used settings, if you close it with the cross button, the plug-in does not save the settings.

Win: “C:\Users\[USER]\AppData\Roaming\MAXON\Cinema 4D R[VERSION]\plugins\”
Mac: “/Users/[USER]/Library/Preferences/MAXON/CINEMA 4D R[VERSION]/plugins”

Updated 21/02/2021 (v0.0.2)
> File/folder path input field. Now you can export to network locations much easier. Creates missing folders automatically when you modify path string
> Option to export proxies without frame number suffix in file names.

Updated 28/02/2021 (v0.0.3)
> Support for Cinema 4D R23
> Bug fixes

Get it here: https://gum.co/rsproxyexporterc4d

Cinema 4D, Plug-in, Redshift

Hawkeye (v1.0) is an effect plug-in for Adobe After Effects (currently only for Microsoft Windows) that helps you to create beautiful and dynamic letterboxes and composition guides super easily.

Plug-in supports 8-bit, 16-bit and 32-bit colors.

Letterboxes includes 37 favorite aspect ratio presets including cinemascopes and custom mode let’s you define almost infinite amount of different aspect ratios.

Guides section has many different options to choose beautiful and useful compositing guides including: Center lines, rule of thirds, golden ratio, different sets of dynamic symmetry rectangle, harmonious triangles, harmonic armature, diagonals and many more. You can layer multiple guides top of each other by duplicating the Hawkeye effect.

Custom grid section let’s you determine your own custom grid that fits perfectly to your source footages dimensions.

License is prepertual and you can install the plug-in to two personal workstations. Once you purhace the product, you will get lifetime free updates!

Installation:
Put the downloaded aex file to the following folder:
C:\Program Files\Adobe\Adobe After Effects [version]\Support Files\Plug-ins

Once the After Effects is opened, the plug-in can be found here Effect->Aturtur->Hawkeye

Tested with:
Adobe After Effects 2019 (v16.1.3)
Adobe After Effects CC 2020 (v17.0.6)

Get it here: https://gum.co/hawkeye

After Effects, Plug-in

To celebrate my 30th birthday I completely revamped my Cinema 4D script repository on GitHub. This is the initial release for AR_Scripts for Cinema 4D. Every single script has now own icon, so scripts can be easily attached to the Cinema 4D’s interface.

Scripts are written for Maxon Cinema 4D R21.207 so they are using Python 2.7.14. I don’t have access to the newest Cinema 4D R23 which uses Python 3, so I’m not able to update any of my stuff. Scripts are also made and tested with Microsoft Windows 10 Pro, so some scripts might not work with Mac OS.

For now there are 81 different scripts. Actually there are much more, since some of the scipts have multiple functions (scripts that can be used with keyboard modifiers). I’ll update and add more scripts depending on the support and my own feeling.

N.B. AR_Scripts are updated for Cinema 4D R25, AR_Scripts for Cinema 4D R25

Check AR_Scripts on GitHub.

Cinema 4D, Python, Redshift

This is a Python Tag called Stage Manager. It let’s you set active ‘stage’ camera with timeline markers. Just give a same name for your marker as your camera and Stage Manager takes care of the rest. There are two different modes: Directive and Strict. Directive mode is designed for markers without range and strict is for markers with custom lengths. If there are no suitable camera found, then the dump camera is used if linked.

ar_stage_manager.c4d v1.0.1 (2023)

Cinema 4D, Python, Tag

Mirror Python Generator for generating duplicated mirrored objects. Works exactly like Symmetry Object, but keeps individual objects and does not merge them into one object.

Options to generate instance objects or actual copies from mirrored objects. You can mirror along XY, ZY and XZ planes. ‘Use Hierarchy’ enables mode to use top level children.

ar_generator_mirror.c4d v1.0.1 (2023)

Asset, Cinema 4D, Generator, Python