Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | Friends

MPxMaterialInformation Class Reference

Search for all occurrences

Detailed Description

Material information proxy.

The MPxMaterialInformation class is a way for users to override the viewport representation of shaders. The viewport uses a simple phong model for display in the viewport. With this class users can provide their own values for the phong shading parameters.

#include <MPxMaterialInformation.h>

List of all members.

Public Types

enum   MaterialType { kSimpleMaterial = 0, kTexture, kOverrideDraw }
 

Material types. These affect how the material is shaded.

More...

Public Member Functions

  MPxMaterialInformation (MObject &materialNode)
  Constructor.
virtual  ~MPxMaterialInformation ()
  The class destructor.
bool  useMaterialAsTexture ()
  Tells Maya whether to this material should be displayed as a texture, ie whether it should be baked.
virtual bool  materialInfoIsDirty (const MPlug &plug)=0
  Called by Maya to when a plug on the shader has been changed.
virtual bool  connectAsTexture (const MPlug &plug)=0
  Called by Maya to when an incoming connection is made to plug on the shader.
virtual bool  textureDisconnected (const MPlug &plug)=0
  Called whenever an incoming connection to the shader is broken.
virtual bool  computeMaterial (MaterialInputData &data)=0
  Compute the material properties/information for the shader.

Protected Member Functions

  MPxMaterialInformation ()
  Default constructor.

Protected Attributes

MObject  fMaterialNode
  The shader node this material is based on.
MaterialType  fMaterialType
  Based on the material type the shader will be rendered differently in the Maya viewport.

Friends

class  MFnPlugin

Member Enumeration Documentation

Material types. These affect how the material is shaded.

Enumerator:
kSimpleMaterial 

 

kTexture 

 

kOverrideDraw 

 


Constructor & Destructor Documentation

MPxMaterialInformation ( MObject materialNode )

Constructor.

Parameters:
[in] materialNode material info node

Member Function Documentation

bool useMaterialAsTexture ( )

Tells Maya whether to this material should be displayed as a texture, ie whether it should be baked.

Returns:
true if the material should be baked texture
bool materialInfoIsDirty ( const MPlug plug ) [pure virtual]

Called by Maya to when a plug on the shader has been changed.

This method tells Maya if the material information is dirty. If it is dirty Maya triggers a refresh of the viewport.

Parameters:
[in] plug the plug that was changed
Returns:
true if the material information is dirty, false otherwise
bool connectAsTexture ( const MPlug plug ) [pure virtual]

Called by Maya to when an incoming connection is made to plug on the shader.

This method tells Maya if connection should be treated as a to a texture. If the connection is treated as a texture the Maya will bake the properties of the source plug for display in the viewport. Currently only one channel/plug on the shader can be treated as a texture.

Parameters:
[in] plug the plug that was connected
Returns:
true if connection should be treated as a texture, false otherwise
bool textureDisconnected ( const MPlug plug ) [pure virtual]

Called whenever an incoming connection to the shader is broken.

Parameters:
[in] plug the plug that was disconnected.
Returns:
true if connection should be treated as a texture, false otherwise
bool computeMaterial ( MaterialInputData data ) [pure virtual]

Compute the material properties/information for the shader.

These properties are the parameters for a simple phong shading model used for display in the viewport

Parameters:
[in] data the material properties/information
Returns:
true if valid material properties/information were created, false otherwise

MPxMaterialInformation MPxMaterialInformation MPxMaterialInformation MPxMaterialInformation MPxMaterialInformation MPxMaterialInformation MPxMaterialInformation MPxMaterialInformation MPxMaterialInformation MPxMaterialInformation
MPxMaterialInformation MPxMaterialInformation MPxMaterialInformation MPxMaterialInformation MPxMaterialInformation MPxMaterialInformation MPxMaterialInformation MPxMaterialInformation MPxMaterialInformation MPxMaterialInformation