Development for macOS

Requirements

Plugin development on macOS is only supported with Apple Xcode. The supported versions are:

  • Cinema 4D R20 SDK : Xcode 9
  • Cinema 4D R19 SDK : Xcode 8
  • Cinema 4D R18 SDK : Xcode 7
  • Cinema 4D R17 SDK : Xcode 6.0.1
  • Cinema 4D R16 SDK : Xcode 5.0.2
  • Cinema 4D R15 SDK : Xcode 4.6.3
  • Cinema 4D R14 SDK : Xcode 4.3.2
  • Cinema 4D R13 SDK : Xcode 3.2.6

Environment

No special configuration of the development environment is necessary.

Best Practice

macOS Specific Code

macOS specific code can be guarded with the macro MAXON_TARGET_MACOS:

#ifdef MAXON_TARGET_MACOS
#endif

Running Plugins

It is possible to start Cinema 4D from Xcode to run and debug a plugin:

  • In the plugin project scheme set "Run"->"Run" "Info"->"Executable" to the location of a Cinema 4D executable.
  • Under "Arguments" add and set the command line argument g_additionalModulePath to make sure that this Cinema 4D executable will find and load the plugin.

Debugging

The Console displays messages printed with DiagnosticOutput(). See Debug and Output Functions.

For general information on debugging see Debugging.

Automating Processes

The execution of the Project Tool can easily be automated using bash scripts.

This bash script executes the Project Tool on the given location of the SDK and starts Xcode to open the solution file:

# build SDK
# run project tool
/Volumes/development/projecttool/kernel_app.app/Contents/MacOS/kernel_app g_updateproject=/Volumes/development/sdk_extracted
# open xcode
open -a "/Applications/Xcode 9.app/Contents/MacOS/Xcode" /Volumes/development/sdk_extracted/plugins/project/plugins.xcodeproj

This bash script starts Cinema 4D with the location of the plugins:

# run C4D
open -a "/Volumes/development/cinema_4d/CINEMA 4D.app/Contents/MacOS/CINEMA 4D" --args -g_additionalModulePath=/Volumes/development/sdk_extracted/plugins

Additionally one can set the command line argument g_runUnitTests to automatically execute custom unit tests.

DYLIBs

DYLIBs needed by a plugin can be placed in myplugin\res\libs\osx.

Deployment

The final plugin build for deployment should be created using the "Release" build target.

Further Reading