Developing Nuke Plugins on Windows

Written by Sebastian Elsner on .

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.

Comments   

 
0 # behram patel 2010-07-27 03:27
fantastic topic.
Really looking forward to learn more of this.
Thanks


b
 
 
0 # Roberto Hradec 2010-08-09 00:19
I'm wondering if you guys know about any success on building windows dll plugins using mingw gcc. I never had any luck on building maya plugins with mingw, but I wonder if nuke would be ok with dll's that mingw generates. (fyi, mingw64 project is my flavour of choice thanks to the very active development and being able to build w32 and w64 dll/binarys)

thanks a lot for the great tutorial, by the way! :-)

-H
 
 
0 # Sebastian Elsner 2010-08-09 07:25
There was one guy on the dev mailing list who got it to work. You can search there. But don't expect the Foundry to support mingw if things don't work....
 
 
0 # Roberto Hradec 2010-08-09 12:00
sure thing! np! thanks! =)
 
 
+1 # Nihal Kenkre 2010-08-17 08:10
Hey,

New to Nuke.

I just compiled the add.cpp plugin source. and copied the dll into the Nuke/plugins folder. how do i use that node. do i have to do some py coding to call / load it in the nodes menu.

Thanks,
Nihal Kenkre.
 
 
0 # srinivas b 2014-03-21 06:53
Just open the nuke press x,then u can find a window type ur plugin name(i.e.,Add) in that one then u will get plugin(i.e.,Add).
 
 
0 # Sebastian Elsner 2010-08-17 08:17
Just updated the article. Has to be checked by the admins first.

Maybe you learn Nuke first, then create plugins.
 
 
0 # Nihal Kenkre 2010-08-17 08:22
yes... thanks. .... ran the nuke.createNode ("node_string") . and its working for now :-)
 
 
0 # Jathavan Sriram 2011-01-18 09:56
Thanks a lot for this brief overview!
 
 
0 # Jathavan Sriram 2011-12-08 11:14
After some research, and a week spend trying to get Visual Studio 2010 with Win7 to create plugins that won't crash at some point in Nuke I can say for sure:
>>> Don't use Visual Studio 2010! - stick with Visual Studio 2005.
>>> For using Visual Studio 2005 with Win7 you need the additional SP1 and the special update for Vista/Win7
 
 
0 # Dushyant Kumar Kashyap 2012-05-10 08:10
Awesome :-)
 
 
0 # Nathan Rusch 2012-06-14 00:46
Another thing that might be worth mentioning: somewhere along the line, The Foundry added a VS version check to DDImage_API.h, which will just flat-out prevent your code from compiling in VS 2008 unless you define NDK_IGNORE_VISU AL_STUDIO_VERSI ON_CHECK somewhere (in stdafx.h along with _SECURE_SCL is a nice simple place).
 
 
0 # Nathan Rusch 2012-06-14 00:48
Hmm, for some reason the site decided I was 'a guest' for that comment...
 
 
0 # Alex Sudnikov 2012-07-13 06:57
"To use Visual Studio 2005 on Windows 7 you will need to install both Visual Studio 2005 Service Pack 1 and the Visual Studio 2005 Service Pack 1 Update for Windows Vista."

Jathavan Sriram : could you please tell if those are the ones you've mentioned ?
 

You have no rights to post comments

We have 2331 guests and 38 members online