C++ API Reference
MSwatchRenderBase Class Reference

Swatch Render Base class. More...

#include <MSwatchRenderBase.h>

+ Inheritance diagram for MSwatchRenderBase:

Public Member Functions

 MSwatchRenderBase (MObject obj, MObject renderObj, int res)
 Class constructor. More...
 
virtual ~MSwatchRenderBase ()
 Class destructor.
 
virtual bool doIteration ()
 Method called from the MSwatchRenderRegister for generation of swatch image. More...
 
virtual bool renderParallel ()
 Method indicates if the swatch is rendered parallel. More...
 
virtual void cancelParallelRendering ()
 Method to cancel the parallel rendering. More...
 
MObject swatchNode () const
 This method returns the node for which the swatch is required to be generated.
 
MObject node () const
 This method returns the node that is used to compute the swatch.
 
int resolution () const
 This method returns the expected resolution of the swatch.
 
MImageimage ()
 This method returns the the render swatch as an image.
 
void setRenderQuality (int)
 Method to set the render quality in which the swatch will be rendered. More...
 
int renderQuality () const
 Returns the quality in which the swatch will be rendered. More...
 

Static Public Member Functions

static void cancelCurrentSwatchRender ()
 The method cancels the swatch which is being rendered in parallel, and push the swatch render item back to the render queue after. More...
 
static void enableSwatchRender (bool enable)
 Enable/disable swatch rendering. More...
 

Protected Member Functions

void finishParallelRender ()
 Method to update the swatch image when the parallel rendering is finished. More...
 

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.

Constructor & Destructor Documentation

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

Class constructor.

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

Parameters
[in]objThe node object for which the swatch needs to be generated.
[in]renderObjThe node which will generate the swatch.
[in]resThe expected resolution of the swatch image.

Member Function Documentation

bool doIteration ( )
virtual

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 overridden in derived classes which can compute the swatches in several steps.

Returns
False as long as the swatch computation is not completed.

Reimplemented in MHWShaderSwatchGenerator.

bool renderParallel ( )
virtual

Method indicates if the swatch is rendered parallel.

Returns
False by default.
void cancelParallelRendering ( )
virtual

Method to cancel the parallel rendering.

The derived classes should provide the implementation accordingly if required.

void setRenderQuality ( int  quality)

Method to set the render quality in which the swatch will be rendered.

The derived classes should make sure that the larger the number is set, the better quality is applied.

Parameters
[in]qualityThe quality to render the swatch
int renderQuality ( ) const

Returns the quality in which the swatch will be rendered.

Returns
The quality to render the swatch
void cancelCurrentSwatchRender ( )
static

The method cancels the swatch which is being rendered in parallel, and push the swatch render item back to the render queue after.

The render plugins should make sure that MSwatchRenderBase::cancelParallelRendering() is implemented acoordingly.

void enableSwatchRender ( bool  enable)
static

Enable/disable swatch rendering.

Parameters
[in]enableFlag indicating if swatch rendering should be enabled or disabled.
void finishParallelRender ( )
protected

Method to update the swatch image when the parallel rendering is finished.

If swatch is rendered parallel, this method must be called after parallel rendering finished.


The documentation for this class was generated from the following files: