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

- Class List
- Class Hierarchy
- Class Members

Public Member Functions | Static Public Member Functions

# MHWShaderSwatchGenerator Class Reference
OpenMayaUI - API module for user interface

Search for all occurrences

## Detailed Description

Hardware shader swatch generator utility class.

Derived from the MSwatchRenderBase class as a utility for generating a swatch for a plugin hardware shader class. This class supports hardware shaders derived from both MPxHardwareShader and the older MPxHwShaderNode base classes.

`#include <MHWShaderSwatchGenerator.h>`

Inheritance diagram for MHWShaderSwatchGenerator:
[legend]

List of all members.

## Public Member Functions
| MHWShaderSwatchGenerator (MObject obj, MObject renderObj, int res)
| Class constructor.
virtual bool | doIteration ()
| This method will be called from the MSwatchRenderRegister for generating a swatch image.
## Static Public Member Functions
static MSwatchRenderBase * | createObj (MObject obj, MObject renderObj, int res)
| Class constructor.
static const MString & | initialize ()
| This method sets a swatch name, and registers a new swatch generator creation function for the swatch name.
static void | getSwatchBackgroundColor (float &r, float &g, float &b, float &a)
| This method returns the default background color for the hardware rendered swatch.

## Constructor & Destructor Documentation

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

Class constructor.

Initializes base class

Parameters:

  [in] | obj | The node object for which the swatch needs to be generated.
  [in] | renderObj | The node used to actually compute the swatch. In most situations, this can be the same as obj. This parameter can be used to request the computation of the swatch on another node, and display the swatch on the obj node.
  [in] | res | The expected resolution of the swatch image.

## Member Function Documentation

MSwatchRenderBase * createObj | ( | MObject | obj,
|  | MObject | renderObj,
|  | int | resolution
| ) |  | `[static]`

Search for all occurrences

Class constructor.

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

Parameters:

  [in] | obj | The node object for which the swatch needs to be generated.
  [in] | renderObj | The node used to actually compute the swatch. In most situations, this can be the same as obj. This parameter can be used to request the computation of the swatch on another node, and display the swatch on the obj node.
  [in] | resolution | The expected resolution of the swatch image.

Examples:
  hlslPluginMain.cpp.

const MString & initialize | ( |  | ) | `[static]`

Search for all occurrences

This method sets a swatch name, and registers a new swatch generator creation function for the swatch name.

The string returned from this method can be used for node classification purpose.

Examples:
  hwColorPerVertexShader.cpp, hwPhongShader.cpp, and pluginMain.cpp.

void getSwatchBackgroundColor | ( | float & | r,
|  | float & | g,
|  | float & | b,
|  | float & | a
| ) |  | `[static]`

Search for all occurrences

This method returns the default background color for the hardware rendered swatch.

Parameters:

  [out] | r | Storage variable for red component.
  [out] | g | Storage variable for green component.
  [out] | b | Storage variable for blue component.
  [out] | a | Storage variable for alpha component.

Examples:
  cgfxShaderNode.cpp, hlslShader.cpp, hwColorPerVertexShader.cpp, and hwPhongShader.cpp.

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

Search for all occurrences

This method will be called from the MSwatchRenderRegister for generating a swatch image.

This doIteration function is called repeatedly (during idle events) till it returns true.

Reimplemented from MSwatchRenderBase.

MHWShaderSwatchGenerator MHWShaderSwatchGenerator MHWShaderSwatchGenerator MHWShaderSwatchGenerator MHWShaderSwatchGenerator MHWShaderSwatchGenerator MHWShaderSwatchGenerator MHWShaderSwatchGenerator MHWShaderSwatchGenerator MHWShaderSwatchGenerator
MHWShaderSwatchGenerator MHWShaderSwatchGenerator MHWShaderSwatchGenerator MHWShaderSwatchGenerator MHWShaderSwatchGenerator MHWShaderSwatchGenerator MHWShaderSwatchGenerator MHWShaderSwatchGenerator MHWShaderSwatchGenerator MHWShaderSwatchGenerator