.. _2d-nukewrapper:

Working With NukeWrapper
========================

  Many plugins will find it useful to have a "mask" input, to define the area of operation.  This will be typically not a binary
  mask, but will act as a per-pixel blend between the modified image and the original one.  Furthermore, they can have an overall
  "mix" to multiply this, so as to easily wipe between unaffected and affected states without.

  Rather than implement this functionality in each plugin, NUKE provides a "NukeWrapper" class.
  This is not a base class, but is instead (as the name implies) a wrapper, which is given a pointer
  to your own Iop, and forwards calls to it as appropriate, while providing the needed functionality.

  You invoke the NukeWrapper by changing the factory that the Iop::Description refers to.  For example:

  .. code-block:: c

    static Op* construct(Node* node) { return new NukeWrapper(new SimpleBlur(node)); }

  The NukeWrapper adds a number of knobs by default:

    1. a channels knob.  this is used to restrict the channels the internal Iop actually operates on.
       Channels that are deselected are simply passed through from the input.

    2. a mask knob.  this allows the mask to be pulled from either the main input itself or from a secondary input.

    3. a mix knob.

  Any of these knobs can be suppressed, by calling functions on the NukeWrapper.

      ==================================   ================================
      Method                               Result
      ==================================   ================================
      NukeWrapper* noChannels()		         omits the channels knob
      NukeWrapper* noMask()		             omits the mask knob
      NukeWrapper* noMix()		             omits the mix knob
      ==================================   ================================

  These would be called in the factory function, like so:

  .. code-block:: c

    static Op* construct(Node* node) { return new NukeWrapper(new SimpleBlur(node))->noChannels(); }


..  XXX: TODO: What you can and can't do this on - ie not on drawiops, split input nodes, or none-iop types such as 3d
