C++ API Reference
|
This class contains some global information for the current render frame. More...
#include <MFrameContext.h>
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 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 MRenderTarget * | getCurrentColorRenderTarget () const |
Get current color render target. More... | |
const MRenderTarget * | getCurrentDepthRenderTarget () 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 ¶ms) const |
Get parameters related to how the background is cleared. More... | |
void | getDOFParameters (MFrameContext::DOFParams ¶ms) 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 MSelectionInfo * | getSelectionInfo () 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. | |
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.
enum MatrixType |
Matrices that can be accessed.
enum TupleType |
Tuples that can be accessed. May be one or more values returned depending on the tuple requested.
enum DisplayStyle |
Display styles.
enum LightingMode |
Lighting modes.
enum PostEffectType |
Types of post effects which may be enabled during rendering.
enum FogMode |
enum WireOnShadedMode |
enum RenderingDestination |
|
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:
[in] | value | Semantic name |
[out] | ReturnStatus | return status |
|
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.
[in] | mtype | Type of matrix to return |
[out] | ReturnStatus | Return status |
Reimplemented in MDrawContext.
|
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:
[in] | value | Semantic name |
[out] | ReturnStatus | Return status |
|
virtual |
Get a tuple (vector or position) value of a certain type.
[in] | ttype | Type of vector or position to return |
[out] | ReturnStatus | Return status |
Reimplemented in MDrawContext.
|
virtual |
Get the viewport dimensions.
The origin is the upper left corner of the viewport.
[out] | originX | X coordinate of the viewport origin |
[out] | originY | Y coordinate of the viewport origin |
[out] | width | Width of the viewport |
[out] | height | Height of the viewport |
Reimplemented in MDrawContext.
|
virtual |
Get global line width.
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.
[out] | ReturnStatus | Status code |
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.
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.
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.
MFrameContext::LightingMode getLightingMode | ( | ) | const |
Get the current light mode.
unsigned int getLightLimit | ( | ) | const |
Get the current 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.
bool getPostEffectEnabled | ( | PostEffectType | postEffectType | ) | const |
Returns if a given post effect is currently enabled.
[in] | postEffectType | Type of post effect to query |
MFrameContext::HwFogParams getHwFogParameters | ( | ) | const |
Get all the hardware fog parameters.
Hardware fog parameters include:
MFrameContext::TransparencyAlgorithm getTransparencyAlgorithm | ( | ) | const |
Get the current transparency algoritm.
See the TransparencyAlgorithm enum for possible return values.
|
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.
|
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.
|
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().
|
static |
Returns the display preference indicating whether templated objects should be drawn shaded.
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.
[out] | destinationName | Name 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.
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.
void classificationExclusions | ( | MStringArray & | classifications | ) | const |
Get a list of drawdb strings for object which are excluded from display.
[in,out] | classifications | List of classification strings returned |
void getBackgroundParameters | ( | MFrameContext::BackgroundParams & | params | ) | const |
Get parameters related to how the background is cleared.
[in,out] | params | BackgroundParams structure |
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.
[in,out] | params | DOFParams parameter structure. |
void getRenderOverrideInformation | ( | RenderOverrideInformation & | info | ) | const |
Get information about any render override.
[in,out] | info | override information |
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.
void worldToViewport | ( | const MPoint & | inPoint, |
double & | xPos, | ||
double & | yPos | ||
) | const |
Convert coordinate in world space to coordinate in viewport.
[in] | inPoint | coordinate of point in world space. |
[out] | xPos | calculated x coordinate in viewport, original point is at bottom left. |
[out] | yPos | calculated y coordinate in viewport, original point is at bottom left. |
Convert coordinate in viewport to near cliping plane coordinate in world space.
[in] | xPos | x coordinate in viewport, original point is at bottom left. |
[in] | yPos | y coordinate in viewport, original point is at bottom left. |
[out] | worldNearPt | calculated near cliping plane coordinate in world space. |
[out] | worldFarPt | calculated far cliping plane coordinate in world space. |
|
static |
Returns the name of this class.
|
static |
Bit flags specifying types of objects excluded from displaying in the viewport.
Exclude no object types