Cinema 4D C++ Plugins – Getting Started

Philipp Bokatius, 9. September 2019

1. Intro

Things you’ll need to get started:

  1. A valid installation of Cinema 4D
  2. Maxon’s C++ Project Tool (R20, R21)
  3. Visual Studio 2019

2. Basic SDK Setup

  1. Go to your C4D Installation directory (Usually: “C:\Program Files\MAXON\Cinema 4D R20\“) and look for “sdk.zip“. I’d recommend to extract it to “C:\SDK” for the ease of typing the path in consoles. Always keep a copy of the original file. In case of loss, you’ll have to reinstall C4D.
  2. Extract the downloaded Project Tool to “C:\projecttool“.
  3. A new Plugin is set up by creating a folder inside of “C:\sdk\plugins\“. Name the folder how you want to call your plugin.
    1. Inside this newly created folder create two subfolders called “project” and “source“.
    2. Create a .txt file inside of “project” called “projectdefinition.txt” with the following content:
// support Windows and macOS
Platform=Win64;OSX
 
// this is a plugin
Type=DLL
 
// this plugin depends on these frameworks:
APIS=\
  cinema.framework; \
  misc.framework; \
  image.framework; \
  core.framework
 
// defines the level of rigour of the source processor's style check
stylecheck.level=0
 
// plugin/module ID
ModuleId=com.examplecompany.myplugin
 
//all files in the source folder have to be listed here
INCLUDE=source/main.cpp;
// support Windows and macOS
Platform=Win64;OSX
// this is a plugin
Type=DLL
// this plugin depends on these frameworks:
APIS=\
cinema.framework; \
misc.framework; \
image.framework; \
core.framework
// defines the level of rigour of the source processor's style check
stylecheck.level=0
// plugin/module ID
ModuleId=com.examplecompany.myplugin
//all files in the source folder have to be listed here
INCLUDE=source/main.cpp;

C. Go to “C:\sdk\plugins\project” and add your plugin name to the “projectdefinition.txt” like the following:

Platform=Win64;OSX
Type=Solution
 
// included plugin projects
Solution=\
	plugins/cinema4dsdk;\
	plugins/newplugin;\
	plugins/YourPluginFolder
Platform=Win64;OSX
Type=Solution
// included plugin projects
Solution=\
plugins/cinema4dsdk;\
plugins/newplugin;\
plugins/YourPluginFolder

4. To create files we actually can work with, Maxon created the so-called “Project Tool“. It adds our created Folder to the needed Visual Studio Solution.

    1. Go to “C:\projecttool“, press “shift + right-click” and choose “Open PowerShell window here” and type:

start kernel_app_64bit.exe g_updateproject=C:\sdk\

          as well as:

start kernel_app_64bit.exe g_updateproject=C:\SDK\plugins\myplugin\project

This should have created a “plugins.sln” (Visual Studio Solution) file in “C:\sdk\plugins\project“. Go and Open it.

      B. To test if everything works click on “Build” -> “Build Solution” (Ctrl + Shift + B). Everything should be fine if this message appears:

      C. To be able to use these Plugins we have to add the “C:\sdk\plugins\” Folder in Cinema 4D’s settings (Ctrl + E -> Plugins) and restart.

 

3. Errors

If you are compiling for R20 you’ll most likely have to change the C++ Language Standard to an older version.

Philipp Bokatius®