.. _2d-nukewrapper:

Working with NukeWrapper
========================

  Many plug-ins find it useful to have a "mask" input to define the area of operation.  This is typically not a binary
  mask, but acts 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.

  Rather than implement this functionality in each plug-in, NUKE provides a "NukeWrapper" class.
  This is not a base class, but instead (as the name implies) a wrapper. It 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 - i.e. not on drawiops, split input nodes, or none-iop types such as 3D
