The possible types for a render item are as follows:
These methods can be used for the same purpose as their equivalent methods, passed via an MDrawInfo in the default viewport API. The example plug-in footPrintNode demonstrates how to use these methods: it switches to display a bounding box when user interaction is detected (for example, when the camera is tumbling).
MFrameContext has additional static methods that test for display preferences:
MFrameContext has an additional member method, getCurrentCameraPath(), which can be used to determine the path to the camera that is being used to render the current frame.
MFrameContext has a new method renderingDestination() that queries the destination for rendering. This can be used, for instance, to identify the viewport panel that is being rendered to; or, to distinguish between rendering to the render view or to an image on disk.
//! Rendering destinations enum RenderingDestination { k3dViewport, //!< Rendering to an interactive 3d viewport k2dViewport, //!< Rendering to an interactive 2d viewport //!< such as the render view kImage //!< Rendering to an image }; RenderingDestination renderingDestination(MString & destinationName) const;
MDrawContext allows for a copy of the current color or depth target to be created via these methods, respectively:
MDrawContext has a new method getInternalTexture() that gets an internal texture as specified by the InternalTexture enumeration. Currently, this allows for getting the current transparent depth layer and the opaque depth layer used in depth-peeling transparency. The dx11Shader effects file AutodeskUberShader.fx demonstrates the usage of this method.
MPassContext has three new pass semantics, respectively: kTransparentPeelSemantic, kTransparentPeelAndAvgSemantic and kTransparentWeightedAvgSemantic. The dx11Shader effects file AutodeskUberShader.fx demonstrates the usage of these three pass semantics.
A new plug-in is available that demonstrates the usage of this API for caching scene renders (viewRenderOverrideFrameCache). For more information, see Render target / frame caching.
MTexture supports updating a rectangular sub-region. The MTexture::update() method has an optional region argument which can be used to specify the region to be updated. If no region is specified, then the entire texture is updated.
The sample plug-in hwApiTextureTest demonstrates sample code which inverts the colors for a sub-region of a texture.
contextNodeFullName is an input argument, expecting the full name of the node that owns the file. The original function without this argument remains, but has been deprecated.
layerName and alphaChannelIndex are new optional arguments that can be used to load layers and alpha channels from PSD files. These arguments are only used when loading PSD files.
contextNodeFullName is an input argument expecting the full name of the node that owns the file. The original function without this argument remains, but has been deprecated.
MViewportRenderer and MViewport2Renderer changes
A filter enum with the same name has also been added to MViewportRenderer. However, MViewportRenderer has been deprecated and you should switch to using an MRenderOverride instead.
MPxSubSceneOverride Enhancements
The performance gain of rendering many instances via one render item can be substantial compared to creating one render item per instance. Use this feature when the instances of a render item are identical except for their transformation matrix; or, for simple float/float2/float3/float4 parameters on the shader instance. If the shader applied and the video card you are using both support GPU instancing, then Maya will render multiple instances of the render item using this feature.
Instance transforms can be added one at a time, which allows for efficient individual updates or removals using the returned instance identifier. Alternatively, the transforms of all instances can be set in a single call via a matrix array. Similarly, per-instance float data can be associated with a parameter on the shader instance one instance at a time, or all at once via a float array.
MPxSubSceneOverride has a new interface that indicates that further update calls are required. The method furtherUpdateRequired() can be overridden in derived classes for this purpose. The plug-in example code for apiMeshSubSceneOverride provides a simple example that uses this interface.
If the sub-string “/subscene/volume/” is used for the classification of the registration of the override, then transparent render items will bypass the internal transparency algorithms and post effects. During a transparency pass, render items will be called to draw once.
Use these methods to construct and use geometry and shaders that support both OpenGL and DirectX11 with a single code path, similar to how MPxSubSceneOverride plug-ins operate.
Use these functions instead of acquire()/commit() or map()/unmap() if the source data is already in the correct format for a simple memory copy operation into the destination buffer. In this situation, using update() should be more efficient and require fewer copy operations on the data.
If the internal buffer had not previously been allocated via a call to commit, the buffer will be allocated. If the specified parameters require a larger buffer than had previously been allocated, the buffer will be reallocated to the new size.
Calling MVertexBuffer or MIndexBuffer::unmap() in OpenGL mode will now reset the OpenGL buffer bindings for both GL_ARRAY_BUFFER_ARB and GL_ELEMENT_ARRAY_BUFFER_ARB to 0. This allows for more reliable readback of Maya hardware buffers while also directly interacting with the native graphics API.
MVertexBufferDescriptor has a new optional constructor argument for supplying the semantic name at creation time. The semantic name is used to tag and identify different custom texture streams.
Geometry Extractor Enhancements
kPolyGeom_BaseMesh: Indicates that the base geometry is in smoothCage mode.
The old constructor function still remains, but as a deprecated method.
MShaderInstance* getShaderFromNode(const MObject& shaderNode, const MDagPath& path, LinkLostCallback linkLostCb = 0, MUserData* linkLostUserData = 0, MShaderInstance::DrawCallback preCb = 0, MShaderInstance::DrawCallback postCb = 0) const;
Use this method to obtain an MShaderInstance from a particular node as translated by Maya. This method operates in a similar way to getEffectFileShader(), getEffectsBufferShader(), and getFragmentShader(); however, you can additionally supply a LinkLostCallback to get notified when the shader is no longer linked to the node from which it originates. Call this method again to acquire a new shader from the node once the callback has been triggered if you want parameter changes to continue to automatically update the acquired shader instance.
MStatus addInputFragment(const MString& fragmentName, const MString& outputName, const MString& inputName);
MStatus addOutputFragment(const MString& fragmentName, const MString& inputName);
Use these methods to modify the run-time code for an existing MShaderInstance by attaching a fragment of code registered with the MFragmentManager. The fragment is added by connecting the output of the new fragment with the input of the existing shader instance. These methods are meant to be used in conjunction with MShaderManager::getShaderFromNode() to alter the shader returned from Maya. This can be used to supply additional pattern inputs, adjust shader output, or supply vertex and geometry shaders to an existing fragment shader.
MDagPath returns an additional new parameter value (fPlaybackVisible) when querying for draw override information. The information is part of the MDAGDrawOverrideInfo structure returned from the method MDagPath::getDrawOverrideInfo().
fPlaybackVisible indicates if the draw override setting for visibility during playback has been set on the DAG object associated with the DAG path.
You can now query the dgtimer sub-metrics on the MFnDependencyNode via the enums kTimerMetric_callbackViaAPI and kTimerMetric_callbackNotViaAPI using the OpenMaya API. Previously these options were available, but always returned zero when queried.
The getConnectedSetsAndMembers() and getConnectedShaders() methods, available on MFnMesh, are now also available on MFnNurbsSurface.
Two virtual methods MPxAssembly::postApplyEdits() and MPxAssembly::postUnapplyEdits() have been added. The first is called by performActivate() after edits are applied to the current assembly (and all nested assemblies).
The second is called by performInactivate() after unapplying edits, before any nested assemblies are inactivated, and before the current representation is inactivated with inactivateRep().
These methods complement the existing preApplyEdits() and preUnapplyEdits() methods.
You can use these methods to perform additional work after applying or unapplying edits. The default implementations of these two functions do nothing.
MAnimControl::isScrubbing() has been added. It returns true if an animation is being scrubbed, as opposed to the existing isPlaying() method which only returns true during playback, not while scrubbing.
The addDelayedTimeChangeCallback() and addDelayedTimeChangeRunupCallback() methods have been added to MDGMessage. Whenever time changes, first, all of the addTimeChangeCallback() are executed, followed by all of the addDelayedTimeChangeCallback(), then finally all of the addDelayedTimeChangeRunupCallback(). Separating the time change callbacks into three groups this way can facilitate nodes which have to do runup or solve dynamics.
The following methods have been added to MDynamicsUtil to improve support for runup:
The following new methods have been added to MFnFluid to provide additional support for resizing fluids:
MSceneMessage now has an addReferenceCallback() method. It provides the callback with a reference node and a resolved path. Supported message types are:
MSceneMessage also has a new addCheckReferenceCallback() method which provides the callback with a reference node and a resolved path, in addition to the usual check variable which can be used to abort the operation. The only supported message type is kBeforeLoadReferenceCheck.
A new kAfterSceneReadAndRecordEdits message type has been added to MSceneMessage. It is called after a file load/import/reference/reload-reference operation has completed. Any reference edits made during the callback are recorded.
The MFnDependencyNode::setExternalContentForFileAttr() helper method has been added to allow you to easily add one of the node's file path attributes to an external content table. MPxNode::setExternalContentForFileAttr() provides the same functionality to plug-in nodes.
To support custom file resolvers that resolve paths differently depending on the node that is using the path, MPxFileResolver now provides a resolveURIWithContext() virtual method which takes the full name of the node which owns the file.
In addition, a contextNodeFullName parameter has been added to the following methods which take file paths:
A number of additions have been made to the Accessor class:
MGlobal::currentToolContext() returns a tool's MObject. The new MFnToolContext class can then be used to access information about the tool.
MPxContext now has a doEnterRegion() virtual method which plug-ins can override.
MComputation: Support has been added to allow you to use the progress indicator in Maya's status bar and to control whether the wait cursor is displayed.
MFnDagNode: The getConnectedSetsAndMembers() method has been removed from MFnMesh and moved into its parent class, MFnDagNode, allowing the method to be available to all MFnDagNode-derived classes, such as MFnNurbsSurface.
MGlobal: optionVarExists() and removeOptionVar() added.
MMeshSmoothOptions: The subdivision type can now be specified.
MRampAttribute: sampleColorRamp() and sampleValueRamp() return evenly spaced samples of the ramp.
MString: substitute() and substituteFirst() have been added.
MUserData holds native resources. Set this attribute to false so that MUserData does not release the native resources that it holds when .NET disposes of the MUserData instance.
The MayaQWidgetBaseMixin and MayaQWidgetDockableMixin classes in the maya.app.general.mayaMixin module simplify the integration of PySide-based widgets by providing methods that: auto-name a widget, parent a widget to the Maya main window, dock a widget and so forth. See PyQt and PySide Widget Best Practices for more information.