Developing Nuke Plugins on Windows
Now that the Nuke distributions come with a standard Visual Studio solution to be used as a template for your own Plugins, it has become quite easy to set up your dev environment.
1) Prequisites
You need a copy of Nuke version 6+ (no PLE) and a copy of Visual Studio 2005 (you can possibly use the 2008 version, but that is not officially supported). Express versions will work, but you cannot build x64 plugins.
2) Using the sample project
Navigate to your NDK development directory (C:\Program Files\Nuke6.0v6\Documentation\NDK\). Copy the vc8 folder to a location where you want to reside your code in. Now we need to edit the solution and project: Rename the sln, the ExamplePlugin folder and the vcproj file to match your plugin name, we will use MyPlugin here. Open the sln and vcproj file with your favourite text editor and search and replace "ExamplePlugin" with "MyPlugin". In the vcproj file only replace Mirror.cpp with MyPlugin.cpp. Now also rename the cpp file itself and delete the ncb.
3) Building MyPlugin.dll
Open your renamed solution file in visual studio. For VS 2008 add the following to the stdafx.h file (thanks to I. Shdaifat for the tipp)
1 |
#define _SECURE_SCL 0 |
Now you should be able to compile against VS2008. Press F7 to build.
Copy your MyPlugin.dll to %USERPROFILE%\.nuke\MyPlugin.dll. To copy the results directly after building, right click the project select 'Properties', navigate to 'Configuration Properties' > 'Build Events' > 'Post-Build Event' set the command line to
1 |
copy "$(TargetDir)$(TargetFileName)" "%USERPROFILE%\.nuke\$(TargetFileName)" |
This will copy the plugin directly to the Nuke plugin folder. Notice that Nuke must not use the plugin, so close Nuke when compiling.
Start Nuke, in the toolbar select etc, > All Plugins > Update. In the graph press tab and type the plugin's name.
4) Debugging
For debugging build the RELEASE version of your plug in MyPlugin.dll. The Debug version will probably crash Nuke at some point. In VS navigate to "Debug" menu > "Attach to Process" select Nuke.
Alternatively you can start debugging (in the release version) by pressing the play button and when asked which program to be attached to, select C:\Program
Files\Nuke6.0v6\Nuke6.0.exe.
You can do this also in the Project Properties > Configuration Properties > Debugging. Set the Command text to
C:\Program Files\Nuke6.0v5\Nuke6.0.exe
Set break points inside your plug in project to see if it works as desired.