C++ API Reference
MFrameContext Class Reference

This class contains some global information for the current render frame. More...

#include <MFrameContext.h>

+ Inheritance diagram for MFrameContext:

Classes

struct  BackgroundParams
 Background parameters. More...
 
struct  DOFParams
 Depth-of-field parameters. More...
 
struct  EnvironmentParams
 Struct for environment map parameters. More...
 
struct  HwFogParams
 Struct for hardware fog parameters. More...
 
struct  RenderOverrideInformation
 Render override information. More...
 

Public Types

enum  MatrixType {
  kWorldMtx, kWorldTransposeMtx, kWorldInverseMtx, kWorldTranspInverseMtx,
  kViewMtx, kViewTransposeMtx, kViewInverseMtx, kViewTranspInverseMtx,
  kProjectionMtx, kProjectionTranposeMtx, kProjectionInverseMtx, kProjectionTranspInverseMtx,
  kViewProjMtx, kViewProjTranposeMtx, kViewProjInverseMtx, kViewProjTranspInverseMtx,
  kWorldViewMtx, kWorldViewTransposeMtx, kWorldViewInverseMtx, kWorldViewTranspInverseMtx,
  kWorldViewProjMtx, kWorldViewProjTransposeMtx, kWorldViewProjInverseMtx, kWorldViewProjTranspInverseMtx
}
 Matrices that can be accessed. More...
 
enum  TupleType {
  kViewPosition, kViewDirection, kViewUp, kViewRight,
  kViewportPixelSize, kViewNearClipValue, kViewFarClipValue, kViewUnnormlizedNearClipValue,
  kViewUnnormalizedFarClipValue
}
 Tuples that can be accessed. May be one or more values returned depending on the tuple requested. More...
 
enum  DisplayStyle {
  kGouraudShaded = (0x1), kWireFrame = (0x1 << 1), kBoundingBox = (0x1 << 2), kTextured = (0x1 << 3),
  kDefaultMaterial = (0x1 << 4), kXrayJoint = (0x1 << 5), kXray = (0x1 << 6), kTwoSidedLighting = (0x1 << 7),
  kFlatShaded = (0x1 << 8), kShadeActiveOnly = (0x1 << 9), kXrayActiveComponents = (0x1 << 10), kBackfaceCulling = (0x1 << 11),
  kSmoothWireframe = (0x1 << 12)
}
 Display styles. More...
 
enum  LightingMode {
  kNoLighting, kAmbientLight, kLightDefault, kSelectedLights,
  kSceneLights, kCustomLights
}
 Lighting modes. More...
 
enum  PostEffectType {
  kAmbientOcclusion, kMotionBlur, kGammaCorrection, kViewColorTransformEnabled = kGammaCorrection,
  kDepthOfField, kAntiAliasing
}
 Types of post effects which may be enabled during rendering. More...
 
enum  FogMode { kFogLinear, kFogExp, kFogExp2 }
 Types of the fog mode. More...
 
enum  TransparencyAlgorithm { kUnsorted, kObjectSorting, kWeightedAverage, kDepthPeeling }
 Options for transparency algorithm. More...
 
enum  WireOnShadedMode { kWireframeOnShadedFull, kWireFrameOnShadedReduced, kWireFrameOnShadedNone }
 Wireframe on shaded modes. More...
 
enum  RenderingDestination { k3dViewport, k2dViewport, kImage }
 Rendering destinations. More...
 

Public Member Functions

virtual MMatrix getMatrix (MFrameContext::MatrixType mtype, MStatus *ReturnStatus=NULL) const
 Get a matrix value of a certain type. More...
 
virtual MDoubleArray getTuple (MFrameContext::TupleType ttype, MStatus *ReturnStatus=NULL) const
 Get a tuple (vector or position) value of a certain type. More...
 
virtual MStatus getViewportDimensions (int &originX, int &originY, int &width, int &height) const
 Get the viewport dimensions. More...
 
virtual float getGlobalLineWidth () const
 Get global line width. More...
 
MDagPath getCurrentCameraPath (MStatus *ReturnStatus=NULL) const
 Get the path to the camera being used to render the current frame. More...
 
const MRenderTargetgetCurrentColorRenderTarget () const
 Get current color render target. More...
 
const MRenderTargetgetCurrentDepthRenderTarget () const
 Get current depth render target. More...
 
unsigned int getDisplayStyle () const
 Get the current display style as a bit field. More...
 
LightingMode getLightingMode () const
 Get the current light mode. More...
 
unsigned int getLightLimit () const
 Get the current light limit. More...
 
EnvironmentParams getEnvironmentParameters () const
 Get parameters for currently used environment. More...
 
bool getPostEffectEnabled (PostEffectType postEffectType) const
 Returns if a given post effect is currently enabled. More...
 
HwFogParams getHwFogParameters () const
 Get all the hardware fog parameters. More...
 
TransparencyAlgorithm getTransparencyAlgorithm () const
 Get the current transparency algoritm. More...
 
RenderingDestination renderingDestination (MString &destinationName) const
 Return value indicates the destination that the renderer is drawing to. More...
 
MUint64 objectTypeExclusions () const
 Get the object type exclusions as a bitfield. More...
 
void classificationExclusions (MStringArray &classification) const
 Get a list of drawdb strings for object which are excluded from display. More...
 
void getBackgroundParameters (MFrameContext::BackgroundParams &params) const
 Get parameters related to how the background is cleared. More...
 
void getDOFParameters (MFrameContext::DOFParams &params) const
 Get the parameters generated by Maya for the circle-of-confusion depth shader used for a pass used when computing depth of field. More...
 
void getRenderOverrideInformation (RenderOverrideInformation &info) const
 Get information about any render override. More...
 
const MSelectionInfogetSelectionInfo () const
 Get the selection state information if the method is called in selection pass; nullptr will be returned otherwise. More...
 
void worldToViewport (const MPoint &inPoint, double &xPos, double &yPos) const
 Convert coordinate in world space to coordinate in viewport. More...
 
void viewportToWorld (double xPos, double yPos, MPoint &worldNearPt, MPoint &worldFarPt) const
 Convert coordinate in viewport to near cliping plane coordinate in world space. More...
 

Static Public Member Functions

static MFrameContext::MatrixType semanticToMatrixType (const MString &value, MStatus *ReturnStatus=NULL)
 It is assumed that these flags match between MFrameContext and TexcludeObjectDisplay, but that is not enforced elsewhere. More...
 
static MFrameContext::TupleType semanticToTupleType (const MString &value, MStatus *ReturnStatus=NULL)
 Given a semantic name return the corresponding tuple enumeration that can be used to retrieve a value via the getTuple() method. More...
 
static bool inUserInteraction ()
 Returns true during any interactive refresh, as when user is interacting with the scene in any way including camera changes, object or component TRS changes, etc. More...
 
static bool userChangingViewContext ()
 Returns true during any interactive refresh, as when user is changing the view using view context tools such as tumble, dolly or track. More...
 
static WireOnShadedMode wireOnShadedMode ()
 Returns the global user display preference which indicates how wireframe should be drawn on top of objects while in shaded mode. More...
 
static bool shadeTemplates ()
 Returns the display preference indicating whether templated objects should be drawn shaded. More...
 
static const char * className ()
 Returns the name of this class. More...
 

Static Public Attributes

static constexpr MUint64 kExcludeNone = MUint64(0)
 Bit flags specifying types of objects excluded from displaying in the viewport. More...
 
static constexpr MUint64 kExcludeNurbsCurves = MUint64(1) << (0)
 Exclude NURBS curves.
 
static constexpr MUint64 kExcludeNurbsSurfaces = MUint64(1) << (1)
 Exclude NURBS surface.
 
static constexpr MUint64 kExcludeMeshes = MUint64(1) << (2)
 Exclude polygonal meshes.
 
static constexpr MUint64 kExcludePlanes = MUint64(1) << (3)
 Exclude planes.
 
static constexpr MUint64 kExcludeLights = MUint64(1) << (4)
 Exclude lights.
 
static constexpr MUint64 kExcludeCameras = MUint64(1) << (5)
 Exclude camera.
 
static constexpr MUint64 kExcludeJoints = MUint64(1) << (6)
 Exclude joints.
 
static constexpr MUint64 kExcludeIkHandles = MUint64(1) << (7)
 Exclude IK handles.
 
static constexpr MUint64 kExcludeDeformers = MUint64(1) << (8)
 Exclude all deformations.
 
static constexpr MUint64 kExcludeDynamics = MUint64(1) << (9)
 Exclude all dynamics objects (emiiters, cloth)
 
static constexpr MUint64 kExcludeParticleInstancers = MUint64(1) << (10)
 Exclude all Particle Instancers.
 
static constexpr MUint64 kExcludeLocators = MUint64(1) << (11)
 Exclude locators.
 
static constexpr MUint64 kExcludeDimensions = MUint64(1) << (12)
 Exclude all measurement objects.
 
static constexpr MUint64 kExcludeSelectHandles = MUint64(1) << (13)
 Exclude selection handles.
 
static constexpr MUint64 kExcludePivots = MUint64(1) << (14)
 Exclude pivots.
 
static constexpr MUint64 kExcludeTextures = MUint64(1) << (15)
 Exclude texure placement objects.
 
static constexpr MUint64 kExcludeGrid = MUint64(1) << (16)
 Exclude grid drawing.
 
static constexpr MUint64 kExcludeCVs = MUint64(1) << (17)
 Exclude NURBS control vertices.
 
static constexpr MUint64 kExcludeHulls = MUint64(1) << (18)
 Exclude NURBS hulls.
 
static constexpr MUint64 kExcludeStrokes = MUint64(1) << (19)
 Exclude PaintFX strokes.
 
static constexpr MUint64 kExcludeSubdivSurfaces = MUint64(1) << (20)
 Exclude subdivision surfaces.
 
static constexpr MUint64 kExcludeFluids = MUint64(1) << (21)
 Exclude fluid objects.
 
static constexpr MUint64 kExcludeFollicles = MUint64(1) << (22)
 Exclude hair follicles.
 
static constexpr MUint64 kExcludeHairSystems = MUint64(1) << (23)
 Exclude hair system.
 
static constexpr MUint64 kExcludeImagePlane = MUint64(1) << (24)
 Exclude image planes.
 
static constexpr MUint64 kExcludeNCloths = MUint64(1) << (25)
 Exclude N-cloth objects.
 
static constexpr MUint64 kExcludeNRigids = MUint64(1) << (26)
 Exclude rigid-body objects.
 
static constexpr MUint64 kExcludeDynamicConstraints = MUint64(1) << (27)
 Exclude rigid-body constraints.
 
static constexpr MUint64 kExcludeManipulators = MUint64(1) << (28)
 Exclude manipulators.
 
static constexpr MUint64 kExcludeNParticles = MUint64(1) << (29)
 Exclude N-particle objects.
 
static constexpr MUint64 kExcludeMotionTrails = MUint64(1) << (30)
 Exclude motion trails.
 
static constexpr MUint64 kExcludeHoldOuts = MUint64(1) << (31)
 Exclude Hold-Outs.
 
static constexpr MUint64 kExcludePluginShapes = MUint64(1) << (32)
 Exclude plug-in shapes.
 
static constexpr MUint64 kExcludeHUD = MUint64(1) << (33)
 Exclude HUD.
 
static constexpr MUint64 kExcludeClipGhosts = MUint64(1) << (34)
 Exclude animation clip ghosts.
 
static constexpr MUint64 kExcludeGreasePencils = MUint64(1) << (35)
 Exclude grease-pencil draw.
 
static constexpr MUint64 kExcludeControllers = MUint64(1) << (36)
 Exclude Controllers.
 
static constexpr MUint64 kExcludeAll = ~MUint64(0)
 Exclude all listed object types.
 

Detailed Description

This class contains some global information for the current render frame.

MFrameContext is designed to provide information which is available per frame render. This includes information such as render targets, viewport size and camera information.

In terms of relative scope, MFrameContext can be thought of as encompassing the time period for a "pass" (MPassContext) and the time period for actual drawing (MDrawContext).

MDrawContext is derived from MFrameContext and provides its own implementation for all virtual methods. The values returned from these methods may differ slightly between MFrameContext and MDrawContext as MFrameContext retrieves the values from Maya and MDrawContext retrieves the values from the GPU device state. Also, MFrameContext::getMatrix() is not able to return values for any matrix type requiring the object-to-world matrix as that information is only available at draw time.

Examples:
apiDirectionalLightShape/apiDirectionalLightShape.cpp, apiMeshShape/apiMeshSubSceneOverride.cpp, apiMeshShape/apiMeshSubSceneOverride.h, cvColorNode/cvColorNode.cpp, footPrintManip/footPrintManip.cpp, footPrintNode/footPrintNode.cpp, footPrintNode_SubSceneOverride/footPrintNode_SubSceneOverride.cpp, geometryReplicator/geometryReplicator.cpp, gpuCache/gpuCacheDrawOverride.cpp, gpuCache/gpuCacheDrawOverride.h, gpuCache/gpuCacheSubSceneOverride.cpp, gpuCache/gpuCacheSubSceneOverride.h, grabUVMain.cpp, lineManip/lineManip.cpp, lineManip/lineManip.h, lineManipContainer/lineManipContainer.cpp, lineManipContainer/lineManipContainer.h, marqueeTool/marqueeTool.cpp, MayaPluginForSpreticle/spReticleLoc.cpp, MayaPluginForSpreticle/spReticleLoc.h, moveManip/moveManip.cpp, moveTool/moveTool.cpp, narrowPolyRenderOverride/narrowPolyRenderOverride.cpp, narrowPolyRenderOverride/narrowPolyRenderOverride.h, pointManip/pointManip.cpp, pointManip/pointManip.h, rawfootPrintNode/rawfootPrintNode.cpp, richSelectionTool/richSelectionTool.cpp, simpleEvaluationDraw/simpleEvaluationDraw.cpp, squareScaleManip/squareScaleManip.cpp, squareScaleManip/squareScaleManip.h, squareScaleManipContext/squareScaleManipContext.cpp, squareScaleManipContext/squareScaleManipContext.h, squaresNode_noDepthTest/squaresNode_noDepthTest.cpp, swissArmyManip/swissArmyManip.cpp, transformDrawNode/transformDrawNode.cpp, uiDrawManager/uiDrawManager.cpp, viewMRenderOverride/viewMRenderOverride.cpp, viewRenderOverride/viewRenderOverride.h, viewRenderOverride/viewRenderOverrideOperations.cpp, and viewRenderOverride/viewRenderOverrideUserOperation.cpp.

Member Enumeration Documentation

enum MatrixType

Matrices that can be accessed.

Enumerator
kWorldMtx 

Object to world matrix.

kWorldTransposeMtx 

Object to world matrix transpose.

kWorldInverseMtx 

Object to world matrix inverse.

kWorldTranspInverseMtx 

Object to world matrix transpose inverse (adjoint)

kViewMtx 

World to view matrix.

kViewTransposeMtx 

World to view matrix tranpose.

kViewInverseMtx 

World to view matrix inverse.

kViewTranspInverseMtx 

World to view matrix transpose inverse (adjoint)

kProjectionMtx 

Projection matrix.

kProjectionTranposeMtx 

Projection matrix tranpose.

kProjectionInverseMtx 

Projection matrix inverse.

kProjectionTranspInverseMtx 

Projection matrix tranpose inverse (adjoint)

kViewProjMtx 

View * projection matrix.

kViewProjTranposeMtx 

View * projection matrix tranpose.

kViewProjInverseMtx 

View * projection matrix inverse.

kViewProjTranspInverseMtx 

View * projection matrix tranpose inverse (adjoint)

kWorldViewMtx 

World * view matrix.

kWorldViewTransposeMtx 

World * view matrix transpose.

kWorldViewInverseMtx 

World * view matrix inverse.

kWorldViewTranspInverseMtx 

World * view matrix transpose inverse (adjoint)

kWorldViewProjMtx 

World * view * projection matrix.

kWorldViewProjTransposeMtx 

World * view * projection matrix transpose.

kWorldViewProjInverseMtx 

World * view * projection matrix inverse.

kWorldViewProjTranspInverseMtx 

World * view * projection matrix tranpose inverse (adjoint)

enum TupleType

Tuples that can be accessed. May be one or more values returned depending on the tuple requested.

Enumerator
kViewPosition 

View position.

kViewDirection 

View direction vector.

kViewUp 

View up vector.

kViewRight 

View right vector.

kViewportPixelSize 

Viewport size in pixels (single value)

kViewNearClipValue 

Camera near clip value (single value)

kViewFarClipValue 

Camera far clip value (single value)

kViewUnnormlizedNearClipValue 

Unnormalized camera near clip value (single value)

kViewUnnormalizedFarClipValue 

Unnormalized camera far clip value (single value)

Display styles.

Enumerator
kGouraudShaded 

Shaded display.

kWireFrame 

Wire frame display.

kBoundingBox 

Bounding box display.

kTextured 

Textured display.

kDefaultMaterial 

Default material display.

kXrayJoint 

X-ray joint display.

kXray 

X-ray display.

kTwoSidedLighting 

Two-sided lighting enabled.

kFlatShaded 

Flat shading display.

kShadeActiveOnly 

Shade active object only.

kXrayActiveComponents 

X-ray active components.

kBackfaceCulling 

Backface culling enabled.

kSmoothWireframe 

Smooth wireframe enabled.

Lighting modes.

Enumerator
kNoLighting 

Use no light.

kAmbientLight 

Use global ambient light.

kLightDefault 

Use default light.

kSelectedLights 

Use lights which are selected.

kSceneLights 

Use all lights in the scene.

kCustomLights 

A custom set of lights which are not part of the scene.

Currently this applies for use in the Hypershade Material Viewer panel

Types of post effects which may be enabled during rendering.

Enumerator
kAmbientOcclusion 

Screen-space ambient occlusion.

kMotionBlur 

2D Motion blur

kGammaCorrection 

Gamma correction.

kViewColorTransformEnabled 

Color managed viewing.

kDepthOfField 

Depth of field.

kAntiAliasing 

Hardware multi-sampling.

enum FogMode

Types of the fog mode.

Enumerator
kFogLinear 

The linear fog.

kFogExp 

The exponential fog.

kFogExp2 

The exponential squared fog.

Options for transparency algorithm.

Enumerator
kUnsorted 

Unsorted transparent object drawing.

kObjectSorting 

Object sorting of transparent objects.

kWeightedAverage 

Weight average transparency.

kDepthPeeling 

Depth-peel transparency.

Wireframe on shaded modes.

Enumerator
kWireframeOnShadedFull 

Draw wireframe.

kWireFrameOnShadedReduced 

Draw wireframe but with reduced quality.

kWireFrameOnShadedNone 

Do not draw wireframe.

Rendering destinations.

Enumerator
k3dViewport 

Rendering to an interactive 3d viewport.

k2dViewport 

Rendering to an interactive 2d viewport such as the render view.

kImage 

Rendering to an image.

Member Function Documentation

MFrameContext::MatrixType semanticToMatrixType ( const MString value,
MStatus ReturnStatus = NULL 
)
static

It is assumed that these flags match between MFrameContext and TexcludeObjectDisplay, but that is not enforced elsewhere.

Given a semantic name return the corresponding matrix enumeration that can be used to retrieve a matrix value via the getMatrix() method.

Valid semantic names include:

  • world
  • worldtranspose
  • worldinverse
  • worldinversetranspose
  • worldview
  • worldviewtranspose
  • worldviewinverse
  • worldviewinversetranspose
  • worldviewprojection
  • worldviewprojectiontranspose
  • worldviewprojectioninverse
  • worldviewprojectioninversetranspose
  • view
  • viewtranspose
  • viewinverse
  • viewinversetranspose
  • projection
  • projectiontranspose
  • projectioninverse
  • projectioninversetranspose
  • viewprojection
  • viewprojectiontranspose
  • viewprojectioninverse
  • viewprojectioninversetranspose
Parameters
[in]valueSemantic name
[out]ReturnStatusreturn status
Returns
Matrix type enumeration
Status Codes:
  • MS::kSuccess A valid enumeration could be returned
  • MS::kFailure The semantic is invalid so no valid enumeration could be returned. In this case MFrameContext::kWorldMtx is the return value.
MMatrix getMatrix ( MFrameContext::MatrixType  mtype,
MStatus ReturnStatus = NULL 
) const
virtual

Get a matrix value of a certain type.

Note that not all types are available for querying in MFrameContext. Matrix types requiring the object-to-world matrix, are only available from MDrawContext.

Parameters
[in]mtypeType of matrix to return
[out]ReturnStatusReturn status
Returns
The requested matrix
Status Codes:
  • MS::kSuccess Method succeeded
  • MS::kNotImplemented Matrix type not available from MFrameContext
  • MS::kUnknownParameter Unknown matrix type

Reimplemented in MDrawContext.

Examples:
gpuCache/gpuCacheSubSceneOverride.cpp.
MFrameContext::TupleType semanticToTupleType ( const MString value,
MStatus ReturnStatus = NULL 
)
static

Given a semantic name return the corresponding tuple enumeration that can be used to retrieve a value via the getTuple() method.

Valid semantic names include:

  • viewdirection
  • worldcameraposition
  • viewportpixelsize
Parameters
[in]valueSemantic name
[out]ReturnStatusReturn status
Returns
Tuple type enumeration
Status Codes:
  • MS::kSuccess A valid enumeration could be returned
  • MS::kFailure The semantic is invalid so no valid enumeration could be returned. In this case MFrameContext::kViewPosition is the return value.
MDoubleArray getTuple ( MFrameContext::TupleType  ttype,
MStatus ReturnStatus = NULL 
) const
virtual

Get a tuple (vector or position) value of a certain type.

Parameters
[in]ttypeType of vector or position to return
[out]ReturnStatusReturn status
Returns
The requested tuple
Status Codes:
  • MS::kSuccess Method succeeded
  • MS::kUnknownParameter Unknown tuple type

Reimplemented in MDrawContext.

MStatus getViewportDimensions ( int &  originX,
int &  originY,
int &  width,
int &  height 
) const
virtual

Get the viewport dimensions.

The origin is the upper left corner of the viewport.

Parameters
[out]originXX coordinate of the viewport origin
[out]originYY coordinate of the viewport origin
[out]widthWidth of the viewport
[out]heightHeight of the viewport
Returns
Status code
Status Codes:
  • MS::kSuccess method succeeded
  • MS::kFailure method does not have a valid object

Reimplemented in MDrawContext.

Examples:
MayaPluginForSpreticle/spReticleLoc.cpp, viewMRenderOverride/viewMRenderOverride.cpp, and viewRenderOverride/viewRenderOverrideOperations.cpp.
float getGlobalLineWidth ( ) const
virtual

Get global line width.

Returns
The current global line width
Examples:
apiMeshShape/apiMeshSubSceneOverride.cpp.
MDagPath getCurrentCameraPath ( MStatus ReturnStatus = NULL) const

Get the path to the camera being used to render the current frame.

This DAG path is provided for read-only access to the camera. Attempts to modify the camera or other nodes in the scene while rendering can lead to undefined behaviour and instability.

Parameters
[out]ReturnStatusStatus code
Returns
The path to the current camera
Status Codes:
  • MS::kSuccess Method succeeded
  • MS::kFailure Method failed to retrieve current camera
Examples:
apiDirectionalLightShape/apiDirectionalLightShape.cpp, gpuCache/gpuCacheDrawOverride.cpp, and rawfootPrintNode/rawfootPrintNode.cpp.
const MRenderTarget * getCurrentColorRenderTarget ( ) const

Get current color render target.

Calling code is responsible for invoking MRenderTargetManager::releaseRenderTarget() to release the reference to the target after use.

Returns
The current color target
Examples:
blast2Cmd/blast2Cmd.cpp.
const MRenderTarget * getCurrentDepthRenderTarget ( ) const

Get current depth render target.

Calling code is responsible for invoking MRenderTargetManager::releaseRenderTarget() to release the reference to the target after use.

Returns
The current depth target
unsigned int getDisplayStyle ( ) const

Get the current display style as a bit field.

The DisplayStyle enums can be use to test the bit field for the enabling of any of the listed display modes. For example to test for wireframe on shaded the test would be test against the bit for kGourandShaded or kFlatShaded as well as testing against the bit for kWireframe.

Returns
The current display styles.
Examples:
apiDirectionalLightShape/apiDirectionalLightShape.cpp, footPrintManip/footPrintManip.cpp, footPrintNode/footPrintNode.cpp, gpuCache/gpuCacheDrawOverride.cpp, gpuCache/gpuCacheSubSceneOverride.cpp, rawfootPrintNode/rawfootPrintNode.cpp, and squaresNode_noDepthTest/squaresNode_noDepthTest.cpp.
unsigned int getLightLimit ( ) const

Get the current light limit.

Returns
Light limit
MFrameContext::EnvironmentParams getEnvironmentParameters ( ) const

Get parameters for currently used environment.

Note that this information is set per viewport and so might change between draw calls if multiple viewports are displayed at the same time.

Returns
all environment parameters within struct EnvironmentParams.
bool getPostEffectEnabled ( PostEffectType  postEffectType) const

Returns if a given post effect is currently enabled.

Parameters
[in]postEffectTypeType of post effect to query
Returns
true if effect is enabled
Examples:
dx11Shader/dx11Shader.cpp, and rawfootPrintNode/rawfootPrintNode.cpp.
MFrameContext::HwFogParams getHwFogParameters ( ) const

Get all the hardware fog parameters.

Hardware fog parameters include:

  • hardware fog enabled
  • hardware fog mode: Linear, Exponential, Exponential squared.
  • hardware fog start: The near distance used in the linear fog.
  • hardware fog end: The far distance used in the linear fog.
  • hardware fog density: The density of the exponential fog.
  • hardware fog color: (r, g, b, a).
Returns
all fog parameters within struct HwFogParams.
Examples:
cgFx/cgfxShaderNode.cpp, dx11Shader/dx11Shader.cpp, and rawfootPrintNode/rawfootPrintNode.cpp.
MFrameContext::TransparencyAlgorithm getTransparencyAlgorithm ( ) const

Get the current transparency algoritm.

See the TransparencyAlgorithm enum for possible return values.

Returns
Transparency algorithm
Examples:
dx11Shader/dx11Shader.cpp, and glslShader/GLSLShader.cpp.
bool inUserInteraction ( )
static

Returns true during any interactive refresh, as when user is interacting with the scene in any way including camera changes, object or component TRS changes, etc.

Use userChangingViewContext for determining whether user is changing the view using view context tools such as tumble, dolly or track.

Returns
  • True if user is interacting with scene
Examples:
apiMeshShape/apiMeshSubSceneOverride.cpp, and rawfootPrintNode/rawfootPrintNode.cpp.
bool userChangingViewContext ( )
static

Returns true during any interactive refresh, as when user is changing the view using view context tools such as tumble, dolly or track.

Useful for changing drawing mode to something simpler to speed up interaction re-draw. Use inUserInteraction for determining whether user is interacting with the scene in any way.

Returns
True if user is changing the view using view context tools such as tumble, dolly or track
Examples:
apiMeshShape/apiMeshSubSceneOverride.cpp, and rawfootPrintNode/rawfootPrintNode.cpp.
MFrameContext::WireOnShadedMode wireOnShadedMode ( )
static

Returns the global user display preference which indicates how wireframe should be drawn on top of objects while in shaded mode.

Please refer to documentation on the "Wireframe on shaded" option under the "Display->View" tab in the preferences window.

Note that "viewport is in wireframe on shaded mode" is a different option which is per viewport. This can be tested by testing if a shaded mode is set as well as wireframe mode. Refer to the enumerations DisplayStyle and the method getDisplayStyle().

Returns
Wireframe on shaded preference
bool shadeTemplates ( )
static

Returns the display preference indicating whether templated objects should be drawn shaded.

Returns
Shade templates preference
MFrameContext::RenderingDestination renderingDestination ( MString destinationName) const

Return value indicates the destination that the renderer is drawing to.

The name of the destination is returned as an argument.

Parameters
[out]destinationNameName of the destination.

If the destination is a 3d viewport (k3dViewport) then the name of the viewport panel will be returned.

If the destination is an image (kImage) then the name of the image file will be returned.

If the destination is a 2d viewport (k2dViewport) then the destination name is either the name of the uv editor panel or the name of the render view panel.

Returns
RenderingDestination value
Examples:
apiMeshShape/apiMeshSubSceneOverride.cpp, and rawfootPrintNode/rawfootPrintNode.cpp.
MUint64 objectTypeExclusions ( ) const

Get the object type exclusions as a bitfield.

The bitfield can be tested using the bits defined by class statics starting with kExclude.

Returns
Exclusion bitfield
Examples:
rawfootPrintNode/rawfootPrintNode.cpp.
void classificationExclusions ( MStringArray classifications) const

Get a list of drawdb strings for object which are excluded from display.

Parameters
[in,out]classificationsList of classification strings returned
Examples:
rawfootPrintNode/rawfootPrintNode.cpp.
void getBackgroundParameters ( MFrameContext::BackgroundParams params) const

Get parameters related to how the background is cleared.

Parameters
[in,out]paramsBackgroundParams structure
Examples:
rawfootPrintNode/rawfootPrintNode.cpp.
void getDOFParameters ( MFrameContext::DOFParams params) const

Get the parameters generated by Maya for the circle-of-confusion depth shader used for a pass used when computing depth of field.

This pass is indicated by the pass semantic MPassContext::kDOFPassSemantic. The shader fragment used is called cocDepthSurface. The XML wrapper can be queried from MFragmentManager or using the 'ogs -xml maya_CocDepthSurface' command.

Parameters
[in,out]paramsDOFParams parameter structure.
Examples:
rawfootPrintNode/rawfootPrintNode.cpp.
void getRenderOverrideInformation ( RenderOverrideInformation info) const

Get information about any render override.

Parameters
[in,out]infooverride information
Examples:
rawfootPrintNode/rawfootPrintNode.cpp.
const MSelectionInfo * getSelectionInfo ( ) const

Get the selection state information if the method is called in selection pass; nullptr will be returned otherwise.

The lifetime and ownership of the MSelectionInfo object is handled by Maya, thus the user should not delete the returned pointer or save it for later use.

Returns
The selection state information
Examples:
apiMeshShape/apiMeshSubSceneOverride.cpp.
void worldToViewport ( const MPoint inPoint,
double &  xPos,
double &  yPos 
) const

Convert coordinate in world space to coordinate in viewport.

Parameters
[in]inPointcoordinate of point in world space.
[out]xPoscalculated x coordinate in viewport, original point is at bottom left.
[out]yPoscalculated y coordinate in viewport, original point is at bottom left.
Examples:
uiDrawManager/uiDrawManager.cpp.
void viewportToWorld ( double  xPos,
double  yPos,
MPoint worldNearPt,
MPoint worldFarPt 
) const

Convert coordinate in viewport to near cliping plane coordinate in world space.

Parameters
[in]xPosx coordinate in viewport, original point is at bottom left.
[in]yPosy coordinate in viewport, original point is at bottom left.
[out]worldNearPtcalculated near cliping plane coordinate in world space.
[out]worldFarPtcalculated far cliping plane coordinate in world space.
Examples:
gpuCache/gpuCacheDrawOverride.cpp, rawfootPrintNode/rawfootPrintNode.cpp, and uiDrawManager/uiDrawManager.cpp.
const char * className ( )
static

Returns the name of this class.

Returns
Name of this class.

Member Data Documentation

constexpr MUint64 kExcludeNone = MUint64(0)
static

Bit flags specifying types of objects excluded from displaying in the viewport.

Exclude no object types


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