- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Examples

- Class List
- Class Hierarchy
- Class Members

Public Member Functions

# MSwatchRenderBase Class Reference
OpenMayaRender - API module for rendering

Search for all occurrences

## Detailed Description

Swatch Render Base class.

A class providing an interface through which a plugin can implement a class to provide custom rendered images for swatches which are displayed in hypershade and the Attribute Editor.

By deriving from this class and implementing the doIteration function, swatches for nodes (having the required classification) can be custom rendered by the plugin.

The derived class needs to be registered with Maya using the interface provided by MSwatchRenderRegister. Please refer to documentation of MSwatchRenderRegister for more details.

To indicate that swatch for a certain node type will be generated by the plugin the classfication string of the node needs to contain the following string : "swatch/<swatch generator name>" The swatch generator name string should match the name used to register the swatch generator class.

`#include <MSwatchRenderBase.h>`

Inheritance diagram for MSwatchRenderBase:
[legend]

List of all members.

## Public Member Functions
| MSwatchRenderBase (MObject obj, MObject renderObj, int res)
| constructor
virtual | ~MSwatchRenderBase ()
| destructor
virtual bool | doIteration ()
| Method called to do swatch image generation, derived classes needs to implement this.
MObject | swatchNode () const
| returns the node for which the swatch is required to be generated
MObject | node () const
| returns the node used to compute the swatch
int | resolution () const
| returns the expected resolution of the swatch image
MImage & | image ()
| returns the swatch image

## Constructor & Destructor Documentation

MSwatchRenderBase | ( | MObject | obj,
|  | MObject | renderObj,
|  | int | res
| ) |  |

constructor

Class constructor.

Saves the Node object and image resolution in members for future use.

Parameters:

  [in] | obj | The node object for which the swatch needs to be generated.
  [in] | renderObj | The node which will generate the swatch.
  [in] | res | The expected resolution of the swatch image.

~MSwatchRenderBase | ( |  | ) | `[virtual]`

destructor

Class destructor.

## Member Function Documentation

bool doIteration | ( |  | ) | `[virtual]`

Search for all occurrences

Method called to do swatch image generation, derived classes needs to implement this.

Method called from the MSwatchRenderRegister for generation of swatch image.

The doIteration function is called repeatedly (during idle events) until it returns true. Using this swatch image can be generated in stages.

This method should be overriden in derived classes which can compute the swatches in several steps.

Returns:
  False as long as the swatch comutation is not completed.

Reimplemented in MHWShaderSwatchGenerator.

MObject swatchNode | ( |  | ) | const`[inline]`

Search for all occurrences

returns the node for which the swatch is required to be generated

This method returns the node for which the swatch is required to be generated.

MObject node | ( |  | ) | const`[inline]`

Search for all occurrences

returns the node used to compute the swatch

This method returns the node that is used to compute the swatch.

int resolution | ( |  | ) | const`[inline]`

Search for all occurrences

returns the expected resolution of the swatch image

This method returns the expected resolution of the swatch.

MImage & image | ( |  | ) | `[inline]`

Search for all occurrences

returns the swatch image

This method returns the the render swatch as an image.

MSwatchRenderBase MSwatchRenderBase MSwatchRenderBase MSwatchRenderBase MSwatchRenderBase MSwatchRenderBase MSwatchRenderBase MSwatchRenderBase MSwatchRenderBase MSwatchRenderBase
MSwatchRenderBase MSwatchRenderBase MSwatchRenderBase MSwatchRenderBase MSwatchRenderBase MSwatchRenderBase MSwatchRenderBase MSwatchRenderBase MSwatchRenderBase MSwatchRenderBase