class MSwatchRenderRegister

Jump to documentation

Manages swatch generators (OpenMayaRender) (OpenMayaRender.py)

public members:

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

Documentation

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.
Description

Provides an interface to register/unregister the plug-in swatch generator objects.

Functions

MStatus MSwatchRenderRegister:: registerSwatchRender ( MString swatchGenName, MSwatchRenderCreatorFnPtr fnPtr)

Description

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

Arguments

  • swatchGenName a name to identify the swatch generator. Should match the name used in the "swatch" classfication string of the nodes

  • fnPtr Pointer to a function which takes the node and resolution of the swatch image to be generated and creates the swatch generator object.

    The MSwatchRenderCreatorFnPtr type is defined as follows.

    Hence the signature of the function needs to be as follows:

    MSwatchRenderBase* <fn_name> (MObject dependNode, 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.)

Return Value

  • MS::kFailure if an error occured. Common potential errors include: the swatch generator name has already been used.
  • MS::kSuccess otherwise.

MStatus MSwatchRenderRegister:: unregisterSwatchRender ( MString swatchGen)

Description

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

Arguments

  • swatchGenName the name which was used for the swatch generator. Should match the name used during registration.

Return Value

  • MS::kFailure if an error occured. Common potential errors include: the swatch generator has already been unregistered.

  • MS::kSuccess otherwise.

This class has no child classes.


Autodesk® Maya® 8.0 © 1997-2006 Autodesk, Inc. All rights reserved. doc++ Copyright