微软 Windows 开发
在微软 Windows 的插件开发仅支持微软 Visual Studio。支持的版本:
(*) 使用 Visual Studio 2017 for Cinema 4D R20 SDK 仅支持 Windows 10。必须手动适配工程文件。
(**) Cinema 4D R21.0 SDK (修复于 Cinema 4D R21.1 SDK) 默认启用 AVX (高级向量扩展) 支持。要禁用 AVX 支持,移除相应行从 frameworks\settings\Base.props 文件:
<EnableEnhancedInstructionSet>AdvancedVectorExtensions</EnableEnhancedInstructionSet>SDK 包括几种数据类型的 Natvis 文件。文件:
The files can simply be copied to the local "Documents\\Visual Studio 2015\\Visualizers" folder.
Alternatively, it is possible to include the Natvis files in a solution using AdditionalSolutionFiles :
// Configuration of a custom solution in the projectdefinition.txt file// support Windows and macOS Platform=Win64; OSX
// this is a solution Type=Solution
// included plugin projects Solution=\ plugins/pluginA;\ plugins/pluginB
// include natvis files in Visual Studio solution file AdditionalSolutionFiles=\ ..\..\frameworks\core.framework\project\typeviewer\msvc\maxon.natvis;\ ..\..\frameworks\cinema.framework\project\typeviewer\msvc\c4dapi.natvis
Windows specific code can be guarded with the macro MAXON_TARGET_WINDOWS:
#ifdef MAXON_TARGET_WINDOWS #endifIf a source code file includes Windows header files it must also include undef_win_macros.h to un-define certain macros.
#ifdef MAXON_TARGET_WINDOWS #include <wtypes.h> #include " maxon/utilities/undef_win_macros.h " #endif
#undef COMPONENT
may be needed, depending on the Windows header files involved. This will be added to the
undef_win_macros.h
header in a later release.
It is possible to start Cinema 4D from Visual Studio to run and debug a plugin:
The Cinema 4D executable must find the compiled plugins. The plugin location can be set with the g_additionalModulePath command line argument. One can also use "$(ProjectDir)..\.." instead of the absolute path.
Additional command line arguments can be set (e.g. to run unit tests). See Unit Tests Manual and Configuration Variables .
The 输出 console displays messages printed with DiagnosticOutput() 。见 Debug and Output Functions .
For general information on debugging see 调试 .
The execution of the Project Tool can easily be automated using Windows batch files.
This batch file executes the Project Tool on the given location of the SDK and starts Visual Studio to open the solution file:
REM Build SDK CD /D C:\development\project_tool kernel_app_64bit.exe g_updateproject=C:/development/sdk_extracted CD /D C:\programs\vs17\Common7\IDE devenv.exe C:\development\sdk_extracted\plugins\project\plugins.slnThis batch file starts Cinema 4D with the location of the plugins:
REM run C4D CD /D C:\programs\cinema_4d "CINEMA 4D.exe" g_additionalModulePath=C:\development\sdk_extracted\pluginsAdditionally one can set the command line argument g_runUnitTests to automatically execute custom unit tests.
Cinema 4D can be informed on the type of license model to use - which can be helpful in certain automated tasks - by using:
DLLs needed by a plugin can be placed in myplugin\res\libs\win64 .
The final plugin build for deployment should be created using the "Release" build target.