Loading, Editing, and Saving Kernels

Kernel management is taken care of on the first tab of the BlinkScript properties panel. Double-click the BlinkScript node in the Node Graph to display its properties.

Note:  Loading, editing, and saving kernels is only available if you have a NukeX license.

Loading Kernels

1.   Enter the file-path in the Kernel File field or click the folder icon to browse to the kernel's location.

Tip:  BlinkScript kernels use the .rpp file extension.

2.   Click Load.

The selected kernel is compiled and read into the Kernel Source field.

Editing Kernels

You can edit existing kernels or write your own from scratch by clicking Clear and entering code in the Kernel Source field. You won't see any results in the Viewer until you click Recompile.

Tip:  You can change how text in the Kernel Source appears using the controls in the Preferences > Panels > Script Editor tab. After saving your preferences, close and then re-open the Kernel Source in the Properties panel to apply the changes.

The first line in a kernel is always a declaration, similar to a C++ class and derived from ImageComputationKernel, which describes a kernel used to produce an output image.

Note:  BlinkScript in Nuke only works with ImageComputation kernels. It does not work with reduction or rolling kernels. Reduction and rolling kernels can, however, be used in the Blink API as part of an NDK plug-in written in C++.

In the case of the default SwirlomaticKernel:

kernel SwirlomaticKernel : ImageComputationKernel<eComponentWise>

Parameters for the kernel are declared in the param section, in the same way as you would declare member variables in a C++ class. If your kernel doesn’t require any parameters, you can omit this section.

For example, the SwirlomaticKernel has three parameters amount, size and centre.

param:

float amount; //Swirl amount in degrees.

int size; //Swirl radius.

float2 centre; //Swirl centre.

When a kernel is compiled inside the BlinkScript node, controls are generated for each of the kernel’s parameters and added to the Kernel Parameters tab. In the case of SwirlomaticKernel, its three custom parameters are accessible in the Kernel Parameters tab.

Kernel parameters can be C++ built-in types such as float or int. Vector and matrix parameters are also supported. The following table contains the control types that the Kernel Source can expose on the Kernel Parameters tab in the properties panel.

Control Type

Description

Bool_knob

Parameters of type bool are represented by a Bool_knob, or single checkbox.

Int_knob

Parameters of type int generate an Int_knob with a single numeric input box. Right-clicking in the input box displays a menu allowing you to animate the value.

MultiInt_knob

Parameters of type int2, int3, int4, or int[ ] generate a MultiInt_knob, with multiple numeric input boxes. As with the Int_knob, right-clicking in the input boxes displays a menu allowing you to animate the values.

Float_knob

Parameters of type float generate a Float_knob with a numeric input box, linear slider, and animation menu button. The slider ranges from 0 to twice the default value of the parameter, or 0 to 1 if no default value is set.

XY_knob

Parameters with two floating-point values, types float2 or float[2], are interpreted as positions in 2D space and generate an XY_knob with an adjustable handle in the Viewer.

XYZ_knob

Parameters with three floating-point values, types float3 or float[3], are interpreted as positions in 3D space and generate an XYZ_knob with an adjustable handle in the 3D Viewer.

AColor_knob

Parameters with four floating-point values, type float4 or float[4], are interpreted as colors with alpha, and generate an AColor_knob. This initially displays a single entry box and slider, a button to split to four entry boxes, a button to display the Nuke color wheel, and a swatch showing the current color with an eyedropper for sampling in the Viewer.

Array_knob

Parameters with nine floating-point values, including float3x3, are displayed as an Array_knob with a 3x3 grid. Parameters with sixteen floating-point values, including float4x4, are displayed as an Array_knob with a 4x4 grid.

MultiFloat_knob

Parameters with numbers of floating-point values not already listed above, such as float[5], generate a MultiFloat_knob with a numerical entry box for each value, a single linear slider, and an animation menu button. The slider ranges from 0 to 1.

The rest of the kernel is up to you, within certain guidelines listed in Nuke's Help menu under Documentation > Guide to Writing Blink Kernels or at https://learn.foundry.com/nuke/developers/15.1/BlinkKernels/. There are also several example kernels to get you started.

Saving Kernels

1.   Enter the file path in the Kernel File field or click the folder icon to browse to the intended location.

Tip:  BlinkScript kernels use the .rpp file extension.

2.   Click Save.

The selected kernel is saved to the specified location. There is no compile step during saving as the kernel is compiled when loaded.