Static Public Member Functions

MSwatchRenderRegister Class Reference

Search for all occurrences

Detailed Description

Manages swatch generators.

Provides an interface for plugins to register/unregister swatch generator classes (derived from MSwatchRenderBase) with Maya. Whenever a swatch needs to be generated for a node, it checks the classfication string of the node for the preferred swatch generator. If a match is found, it creates and manages the swatch generator object (that is it deletes the swatch generator object once the image has been generated). The doIteration function is called for generating the swatch. The doIteration function is called repeatedly (during idle events) till it returns true. This allows for generation of the swatch in stages.

#include <MSwatchRenderRegister.h>

List of all members.

Static Public Member Functions

static MStatus registerSwatchRender (MString swatchGenName, MSwatchRenderCreatorFnPtr fnPtr)
 registers a new swatch generator creation function by name.
static MStatus unregisterSwatchRender (MString swatchGenName)
 removes the previously registered swatch generator

Member Function Documentation

MStatus registerSwatchRender ( MString  swatchGenName,
MSwatchRenderCreatorFnPtr  fnPtr 
) [static]

registers a new swatch generator creation function by name.

Register the swatch rendering object creation function with the swatch render manager.

Parameters:
[in]swatchGenNameA name to identify the swatch generator. Should match the name used in the "swatch" classfication string of the nodes
[in]fnPtrPointer to a function which takes the node and resolution of the swatch image to be generated and creates the swatch generator object.

The signature of the function needs to be as follows:

MSwatchRenderBase* fn_name(MObject dependNode, MObject renderNode, int imageResolution)

This function needs to allocate the swatch generator object using new and return the pointer. (This is necessary because delete is called on the returned pointer by Maya when work is done.)

Returns:
  • MS::kFailure if an error occured. Common potential errors include: the swatch generator name has already been used.
  • MS::kSuccess otherwise.
Examples:
hlslPluginMain.cpp.
MStatus unregisterSwatchRender ( MString  swatchGen) [static]

removes the previously registered swatch generator

Un-register the swatch rendering object from the swatch render manager.

Parameters:
[in]swatchGenThe name which was used for the swatch generator. Should match the name used during registration.
Returns:
  • MS::kFailure if an error occured. Common potential errors include: the swatch generator has already been unregistered.
  • MS::kSuccess otherwise.

MSwatchRenderRegister MSwatchRenderRegister MSwatchRenderRegister MSwatchRenderRegister MSwatchRenderRegister MSwatchRenderRegister MSwatchRenderRegister MSwatchRenderRegister MSwatchRenderRegister MSwatchRenderRegister
MSwatchRenderRegister MSwatchRenderRegister MSwatchRenderRegister MSwatchRenderRegister MSwatchRenderRegister MSwatchRenderRegister MSwatchRenderRegister MSwatchRenderRegister MSwatchRenderRegister MSwatchRenderRegister