Technical Breakdown of the Maya plug-in

New Maya Nodes

Several new nodes have been added:

Node lifetime

When the Beast plug-in is loaded (in Maya), it automatically creates the following nodes: beastSettings, defaultBeastPass, defaultBeastTextureTarget, and defaultBeastVertexTarget. When a Maya instance is added to a Beast target, a beastInstance is automatically created and connected to the Maya instance (if no other beastInstance is present). A beastEntity node is also created and connected for each target a Maya instance is added to.

The beastEntity is considered temporary and will be removed when the Maya instance is removed from the target.

Source code orientation

The solution for the Beast Maya plug-in is located in BeastSDK\maya, and depends (only) on the Beast and Maya APIs.

API Documentation

The Maya plug-in API documentation is available in the Maya plug-in API Reference section of this document; it is also included in the SDK. This documentation is extracted from the comments in the source code.

Building the plug-in

When you build the plug-in, it will replace the precompiled binaries in BeastSDK\bin. If you have successfully used the precompiled plug-in with Maya you should expect no issues with recompiling the plug-in.

In a standard installation of Maya, the solution will be able to locate your Maya installation automatically. However, it also checks the MAYA_LOCATION_2013_32 (for 32-bit), MAYA_LOCATION_2013_64 (for 64-bit), and MAYA_LOCATION environment variables to support non-standard installations.

Additional Details

Namespace

All source code in the plug-in is located in the beastmaya namespace; all references to types in the documentation refer to this namespace implicitly.

API Wrappers

The Beast API is wrapped in C++. These wrappers are located in a separate sub-directory called beastwrappers. Use of the Beast API directly, or write wrappers, is optional and depends on your preferences.

Entry point

The entry point for the plug-in is beastplugin.cpp. This file contains all the C++ plumbing required for defining the Maya plug-in, and it contains the commands that invoke the various Beast rendering jobs. A global instance of the BeastComponents type (beastcomponents.cpp/.h) is created when the plug-in is initialized. This global instance includes plumbing-related resources, and—importantly—a global BeastPluginContext (beastplugincontext.cpp/.h) used to set up the Beast API and register custom Maya node types (customnodes.cpp/.h), extension attributes (customattributes.cpp/.h), and the UI scripts for the plug-in (userinterface.cpp/.h). The

Maya commands

The Beast Maya plug-in defines the following Maya commands:

  • beastRenderFinal: start a final render (offline)
  • beastBakeFinal: start a final bake (offline)
  • beastRenderLive: start/stop an interactive camera render session
  • beastBakeLive: start/stop an interactive bake session
  • beastIsLive: return if an interactive session is running
  • beastCreateUVSet: create new UV-sets with applied atlas scale and offset from baked results
  • beastUVUnwrap: create UV’s for meshes using Beast UV unwrapping
  • beastCreateMesh: creates a Beast mesh from a Maya mesh (used internally by plug-in)

These render commands execute a render through a RenderManager instance (rendermanager.cpp/.h). The RenderManager parses the Maya DAG for targets to bake or render, and validates the collected target setup. When this is done, it exports the scene, creates a bake/render job, exports the targets, runs the job, and imports the results if the job succeeded. When running through an interactive session, the job starts asynchronously, and continues to run after the RenderManager and the invoked Maya command have finished.

Interactive session components

There are two main components of an interactive session: BeastViewportLiveJob and BeastViewportRenderer (both contained in beastviewportrenderer.cpp/.h). The BeastViewPortLiveJob continuously queries the Beast API for new frame updates, reads the new data, and updates the frame buffer in the BeastViewportRenderer.

BeastViewportLiveJob is a specialized action of LiveAsyncJob (liveasyncjob.cpp/.h) which contains most of the code. Maya controls the redrawing of the BeastViewportRenderer; both BeastViewportLiveJob and BeastViewportRenderer are managed with a thread lock since both Beast and Maya will trigger access to the same buffer.