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:
- Each template is stored in a separate
- The template name is used as the base
name of the associated template file.
- Template files have .template as the file extension. For
example, a template named characterRig would be stored in the XML
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.
The following attributes
are stored on the asset node to define the associated template.
Specifies the name of
the template. This is the primary identifier for the template.
the physical location of the XML template file. This path can be
relative to the current project or it can be an absolute path.
NoteThe 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.
The asset’s current view
mode. Select from the following options:
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.
When the viewMode 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 viewName attribute
is set to the name of the view to use. If the viewName attribute
is empty, the template definition serves as the default view.
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:
Performs actions on a template and its file (create, load, unload,
save, query.) In general, this command operates independently on
the template and its file and does not involve an association with
a particular asset. For a small number of actions, however, an asset node
is specified (for example, when creating a template from an asset
or adding a view).
Provides an interface for accessing the view-related information
for an asset node. The containerView command
operates on a specific asset node and returns the view information
based on the asset’s view settings (viewMode, templateName, viewName).
If the asset is not associated with a template or template view,
the information is derived directly from the asset node. If the
asset has an associated template view in effect, the layout and
display information are derived from the template and/or view definition.
Refer to the command
reference documentation for further details on these commands.