Template file format

 
 
 

Asset templates are used in Maya to store information about the published interface of an asset and to customize the user interface associated with it. This topic provides a reference for advanced users who want to customize template files and understand in more detail the way that asset templates work. A complete template file reference document for FBX Assets is also available at http://www.autodesk.com/maya-docs.

Asset templates are defined in XML template files. This file format allows you to define a hierarchical template with inheritance from multiple types. You can edit and validate the structure of the XML template file using the XML editor of your choice. (See Edit an asset template.)

Once you have saved an asset template, you can find the XML template file in the assets directory of your current project.

Template naming conventions

Within Maya, a template is defined by a unique name. All actions associated with the template use the template name as the primary means of identifying and locating the template. The template name is an object identifier and cannot contain illegal characters such as spaces, special symbols and multibyte characters.

Maya adopts the following naming conventions for template files:

Template search path

Maya uses a search path for locating template files. The template search path contains both built-in and user-designated locations that will be searched in order when attempting to load a template.

Templates are loaded primarily by name. An attempt is made to locate a template file matching the template name along the search path. Template files not on the search path can also be loaded using absolute file paths, but this approach is not recommended as it can lead to problems locating the template in future sessions.

To query the current template search path, use the following command:

containerTemplate -query -searchPath;

By default, this file rule points to the assets subdirectory of the current workspace. The first location in this file rule is also the default location where template files are saved if no other path is specified.

To customize the search path with a location of your choice, see Change the template search path.

Related attributes

The following attributes are stored on the asset node to define the associated template.

Template Name

Specifies the name of the template. This is the primary identifier for the template.

Template Path

(Optional) Specifies the physical location of the XML template file. This path can be relative to the current project or it can be an absolute path.

Note

The template path is used only as secondary information when locating the template. Templates of the same name located along the template search path always take precedence over those found in other locations. If the template cannot be located on the search path, the templatePath is used to attempt to locate the file.

The following asset node attributes define the current asset view.

View Mode

The asset’s current view mode. Select from the following options:

Flat

One of two default modes.

Group By Node

One of two default modes.

Use Template

When selected, the template associated with the asset is used to determine the ordering and layout for the asset’s published interface. If the template includes views, these are also available as additional layout options.

View Name

When the View Mode is set to Use Template, the template definition of the asset is used for layout of the published interface of the asset. If the template has views defined for it, the View Name attribute is set to the name of the view to use. If the View Name attribute is empty, the template definition serves as the default view.

Related commands

All common template operations are provided through the Asset Editor and Attribute Editor, so you will not require the command-line interface in most cases.

The following commands provide the underlying support for asset templates and asset views and can be used for scripted access to these operations:

Refer to the command reference documentation for further details on these commands.