Identify nodes with tags in the Profiler

You can tag nodes so that they appear in the Profiler with a color and name you can identify, for example "arm", "face", and so on, for a more convenient way to locate performance bottlenecks. The tags are created by adding two sets of metadata: one for the node name and one to assign a color. See also Add metadata to Maya nodes and Visualizing metadata for more information about using metadata to identify Maya nodes as well as components (vertices, faces, and edges, and vertex faces) of Maya mesh objects.

You can only add Profiler Tags with the following MEL script in Maya's Script Editor:

To tag objects so they appear in the Profiler

  1. Load a scene file.
  2. In the Script Editor, execute the following MEL script:
    global proc addProfilerTag(string $tagValue, int $r, int $g, int $b)
    {
        // Add the profile tag data structures we need
        dataStructure -format "raw" -asString "name=NodeProfileStruct:string=NodeProfileTag:int32=NodeProfileTagColor";
        
        // set the channels
        addMetadata -streamName "ProfileTagStream" -channelName "ProfileTag" -structure "NodeProfileStruct";
        addMetadata -streamName "ProfileTagColorStream" -channelName "ProfileTagColor" -structure "NodeProfileStruct";
        
        // set the actual data
        editMetadata -streamName "ProfileTagStream" -memberName "NodeProfileTag" -channelName "ProfileTag" -stringValue $tagValue -index 0;
        
        editMetadata -streamName "ProfileTagColorStream" -memberName "NodeProfileTagColor" -channelName "ProfileTagColor" -value $r -index 0;
        editMetadata -streamName "ProfileTagColorStream" -memberName "NodeProfileTagColor" -channelName "ProfileTagColor" -value $g -index 1;
        editMetadata -streamName "ProfileTagColorStream" -memberName "NodeProfileTagColor" -channelName "ProfileTagColor" -value $b -index 2;    
    
  3. You must select the scene element you want to tag with the following script:
    select -r <elementname>;

    Where <elementname> is what the element is called in the scene. For example, for an object named secondBlendShape use:

    select -r secondBlendShape;
    Note: You must select the element with this script. You cannot tag elements for the Profiler by selecting it in the Viewport.
  4. Execute the following script to set a name and a color:
    addProfilerTag("Blendshape2", 255, 0, 200);
    
    getMetadata -streamName "ProfileTagStream" -memberName "NodeProfileTag" -channelName "ProfileTag" -index "0";
  5. Open the Profiler, click Start Recording, and then play your animation
  6. When you've captured a small amount of animation, click Stop Recording.
The Tag appears in the Profiler If you select the tag, all the related data in the output is selected.