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