Advice for Developers

Here are some general advice:

  • Only use Cinema 4D routines, no direct calls to C4DOS.
  • No direct system calls.
  • Only use Cinema 4D data types (Bool, Int32, Float etc.) for easy porting to other platforms.
  • Only use Cinema 4D memory model (NewObj(), NewObjClear(), DeleteObj(), NewMem(), NewMemClear(), ReallocMem(), DeleteMem()) for maximum speed and stability.
  • Use AutoAlloc whenever possible to avoid memory leaks.
  • Make use of external resource files, do not hardcode descriptions, dialogs and strings.
  • Always do "defensive programming": check pointers and results everywhere (except when the documentation explicitly states that a result does not need to be checked).
  • Integrate plugins fully into Cinema 4D and support all features so that it works reliably in all situations. (To name a few things that should be considered: alpha for icons, generation of undo, consistent interface etc.)
  • There are a few hooks in the SDK (SceneHookData, VideoPostData with PLUGINFLAG_VIDEOPOST_INHERENT) that are extremely sensitive to plugins that do not work properly.
    Test extensively those plugin hooks, otherwise the whole application's stability and speed is affected.
    In case of a VideoPostData with PLUGINFLAG_VIDEOPOST_INHERENT, make sure that it does not generally cost extra calculation time.
  • Make use of Cinema 4D level concept for disk reading/writing. This allows up and (!) downward compatibility of plugin data.
  • Cinema 4D installation into application folder is not recommended.