New Features

AxisOp

AxisOp::matrixAt has been made virtual, so that the “look-at” functionality can work correctly with custom cameras:

virtual void matrixAt(const DD::Image::OutputContext& context, DD::Image::Matrix4& matrix) const;

Enumeration_KnobI

A new function has been added to the enumeration knob interface which can be used to check the error state:

virtual const char* getError() const { return NULL; }

An EXACT_MATCH_ONLY flag has been added for Nuke 10 (see Knob); when this is set, any attempt to set an enumeration knob by name to an invalid value will put the knob into an error state. This function can then be used to get the error value; it will return NULL if the knob is not in error.

FileReader

Nuke’s scanline-based architecture means that it will often read a single scanline’s worth of data from an input file at a time, as required. This keeps the memory overhead small in large scripts, but can be bad for performance in scripts that are heavily I/O bound. In the latter case it can be more efficient to read from the file in larger chunks. A downstream node can now set a preference for reading all lines at once on the OutputContext, and this preference will be reflected in the value returned by the function:

bool readAllLinesRequested() const;

It is up to the individual FileReader whether it chooses to obey the request or not. If reading more lines from the file than have been requested by Nuke, the FileReader will need to manage storing the lines in an internal buffer until they are needed - see dpxReader.cpp for an example of this.

GPUContext

Additional binding functions have been added to support 3x3 matrices as well as further built-in types. These additional binding functions extend the parameter types that can be passed to GLSL shaders by plug-ins and soft effects which implement gpuEngine():

/// Bind a bool to the named variable.
bool bind(const std::string& name, bool v) const;

/// Bind a bvec2, bvec3 or bvec4 to the named variable.
bool bind(const std::string& name, int siz, int count, const bool v[]) const;

/// Bind a ivec2, ivec3 or ivec4 to the named variable.
bool bind(const std::string& name, int siz, int count, const int v[]) const;

/// Bind a Matrix3 to the named variable.
bool bind(const std::string& name, const Matrix3& mat) const;

Iop

Plug-ins and soft effects that implement gpuEngine() are strongly advised to override the new virtual function:

virtual Hash gpuEngine_shader_hash_at(double time);

This returns a hash dependent on the shader source code, for the specified time. Note that this is not necessarily a hash of the source code, but is guaranteed to vary deterministically as the source code varies. For example, the source code might depend on the values of one or more of the Iop’s knobs, in which case the hash might contain those knob values, evaluated at the specified time.

The default implementation returns a default constructed Hash object, so sub-classes should take care to override this appropriately if their shader source can vary with time. In the timeline, this hash will be used to determine which versions of the shader source need to be pre-compiled for a particular edit in order to speed up the render. If your shader source can vary with knob values (or otherwise vary with time) and you don’t override this, you might not have all the necessary versions of the shader source cached in advance and they will need to be compiled on-demand at render time, which will be slower.

Ideally, for best performance, the source should not be time- or even knob-dependent, and knob values should be handled with GL uniforms. However, there are situations where that’s impractical and might even harm render performance, merely to cater for knobs that in practice are rarely animated. Hence this function’s support for time dependence.

For an example override, see Grade.cpp in the NDK examples.

Knob

New Knob flags have been added:

  • EXACT_MATCH_ONLY - For Enumeration knobs that should only allow exact matches when the value is being set by name. When this flag is set an attempt to set the value by name without an exact match will put the node into error.
  • STRIP_CASCADE_PREFIX - For Cascading Enumeration knobs: strip out the cascading prefix when serialising.

The new function:

bool isCallbackRegistered( Callback cb, void* closure ) const;

will return whether or not the supplied Callback has been reigstered on the knob.

NukePreferences

New functions have been added for accessing a string-valued preference:

extern DDImage_API std::string (*GetStringPreference)(const char* name);

and for accessing the localisation path specifically:

extern DDImage_API std::string (*GetLocalisationPath)();

Op and Iop

The force_validate function has been made virtual (and is now overridden by Iop):

virtual void force_validate(bool for_real = true);

OutputContext

An OutputContext now has a LineReadPreference which can be used to give a hint to upstream FileReaders that it might be more efficient to read their input files in larger chunks, rather than reading single scanlines as required. There are currently three levels for this preference:

  • eScanlineAlways - upstream Readers should always read frames line by line.
  • ePreferScanline - prefer line-by-line reads, but allow other nodes upstream to override this preference.
  • ePreferAllLines - prefer to read the whole of the requested area at once, but allow other nodes upstream to override this preference.

The following functions can be used to set and get the LineReadPreference:

void setLineReadPreference(LineReadPreference linePreference);
LineReadPreference lineReadPreference() const { return lineReadPreference_; }

The value of the LineReadPreference on the OutputContext will be reflected in the value returned by FileReader::readAllLinesRequested() (see FileReader).

PlanarI

The function:

Box getOutputBox() const;

has been added. This will return the full output box covered by the output stripes, calculated using PlanarI::getStripeBox() and PlanarI::getStripeCount().

Reader

The virtual function:

virtual std::string getDefaultColorspace() const { return ""; }

has been added. If the string it returns is non-empty, this will be used as the default value for the colorspace knob. If the string is non-empty but the colorspace name it returns is not found, the Node will go into error and the user will be required to choose a suitable alternative.

Row

A utility function:

WritablePtr writableConstant(const float val, Channel z);

has been added. This behaves in exactly the same way as Row::writable(Channel z), with the exception that the writable memory will be set to the value passed in after creation.

Thread

DDImage’s Thread interface now contains an OnMainThread() function that can be used to determine whether the calling thread is the main application thread or not:

static bool OnMainThread();

Some functions - including any that generate Ops - must only be called from the main thread.

Version

Note that our version numbering system has changed. The new system is thoroughly documented inside Version.h but as an example, where previously a beta build might be numbered 10.0v1b123, it would now be of the form 10.0v1.000123b (the order of the build phase and release have been swapped, the release is now a six-digit string, and the build phase and release are preceded by a dot).

Write

The Write node now has a “readAllLines” knob whose value is stored in the new member variable bool _readAllLines. This value will be used to update the LineReadPreference on the OutputContext, in order to influence the read chunk size for file reads higher up the tree. It will only have an effect on input formats which support reading all lines (LineReadPreference is ePreferAllLines).

It is also now possible to access the Writer owned by a Write object, via the function:

Writer* getWriter() { return writer; }

This function should be used with caution, since it is not guaranteed that the Write will have a valid Writer.

Table Of Contents

Previous topic

Deprecated Changes