All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Writing a COP

The base class for all COP nodes is COP2_Node. However, many node types have other base classes, which provide features such as masking and scoping, and implement the parameters and the processing for these features.

Derivatives of COP2_Node, with an example of an existing node for each type.

Most generators derive from COP2_Generator, which provides masking and all the parameters to create planes, the frame range and other characteristics of a COP generator. Deriving a custom COP from COP2_Generator will provide all these features for you. The cook method to override is COP2_Generator::generateTile().

Most filters derive from COP2_MaskOp. This class provides an optional mask input to restrict the operation to the mask. The cook method to override for a maskable filter is COP2_Generator::doCookMyTile().

Filters that can't be usefully masked instead derived from COP2_PixelBase. This class provides frame and plane scoping (restricting the operation to a range of frames or to only a few planes, like color). This class only provides helper methods, so COP2_Node::cookMyTile() is overridden for these nodes.

A certain special class of filters can derive from COP2_PixelOp. This filters process a single input pixel and parameters to produce the corresponding output pixel. These operations can be combined into a single operation when connected in a chain to produce results faster with no data format clipping. Pixel operations must override COP2_PixelOp::addPixelFunction(), which returns an instance of a custom RU_PixelFunction.

COPs that combine multiple inputs into one output derive from COP2_MultiBase. This class provides all the necessary parameters for aligning frame ranges, matching data formats of planes and resolutions. This class implements its code in COP2_MultiBase::cookSequenceInfo(), so any custom COPs that override that method should call the parent class method as well. Cooking occurs in a derived method of COP2_Node::cookMyTile().

COPs that only modify the timing information of the input derive from COP2_TimingBase. They cannot modify image data; only shuffle frames around and/or modify the frame range. These COPs should have COP2_TimingBase::copTimeTransform() overridden to provide an output frame time from an input frame time.

Finally, COPs that require color selection to operate can derive from COP2_KeyBase. This class provides interactive color selection in the viewport. There are a variety of methods which can be overridden to do color space conversions, super-sampling, and keying.

In the diagram above, each class provides additional features to the COP. So a ChromaKey COP not only has color selection in the viewport, but masking and scoping as well. Always override the cook method of the bottommost class, and use the appropriate parent class's template pair and COP_SWITCHER macro for the parameter dialog (SWITCHER macros can be found in COP2_Common.h) .

Before writing a COP node, it is highly recommended that you read COP Concepts.