Go to: Synopsis. Return value. Keywords. Related. Flags. MEL examples.

Synopsis

containerTemplate [-addBindingSet string] [-addNames] [-addView string] [-allKeyable] [-attribute string] [-attributeList string] [-baseName string] [-bindingSetList string] [-childAnchor] [-delete] [-exists] [-expandCompounds boolean] [-fileName string] [-force] [-fromContainer string] [-fromSelection] [-layoutMode int] [-load] [-matchFile string] [-matchName string] [-parentAnchor] [-publishedNodeList string] [-removeBindingSet string] [-removeView string] [-rootTransform] [-save] [-searchPath string] [-silent] [-templateList string] [-unload] [-updateBindingSet string] [-useHierarchy] [-viewList string]

containerTemplate is NOT undoable, queryable, and editable.

A container template is a description of a container's published interface. This command provides the ability to create and save a template file for a container or load an existing template file. Once a template exists, the user can query the template information.

Return value

None

In query mode, return type is based on queried flag.

Keywords

container, template

Related

container, containerView

Flags

addBindingSet, addNames, addView, allKeyable, attribute, attributeList, baseName, bindingSetList, childAnchor, delete, exists, expandCompounds, fileName, force, fromContainer, fromSelection, layoutMode, load, matchFile, matchName, parentAnchor, publishedNodeList, removeBindingSet, removeView, rootTransform, save, searchPath, silent, templateList, unload, updateBindingSet, useHierarchy, viewList
Long name (short name) Argument types Properties
-addBindingSet(-abs) string createedit
This argument is used to add a new binding set with the given name to a template. A default binding set will be created. If the binding set already exists, the force flag must be used to replace the existing binding set. When used with the fromContainer option, default bindings will be entered based on the current bindings of the designated container. When used without a reference container, the binding set will be made with placeholder entries. The template must be saved before the new binding set is permanently stored with the template file.
-addNames(-an) edit
In edit mode, when used with the fromContainer flag, any published name on the container not present as an attribute on the template will be added to the template.
-addView(-av) string createedit
This argument is used to add a new view with the given name to a template. By default a view containing a flat list of all template attributes will be created. The layoutMode flag provides more layout options. The template must be saved before the new view is permanently stored with the template file.
-allKeyable(-ak) createedit
Used when the fromSelection flag is true and fromContainer is false. If true we will use all keyable attributes to define the template or the view, if false we use the attributes passed in with the attribute flag.
-attribute(-at) string createeditmultiuse
If fromSelection is true and allKeyable is false, this attribute name will be used to create an attribute item in the template file.
-attributeList(-al) string createqueryedit
Used in query mode, returns a list of attributes contained in the template definition.
-baseName(-bn) string createquery
Used in query mode, returns the base name of the template. The basename is the template name with any package qualifiers stripped off.
-bindingSetList(-bsl) string createquery
Used in query mode, returns a list of all binding sets defined on the template.
-childAnchor(-can) createquery
This flag can be optionally specified when querying the publishedNodeList. The resulting list will contain only childAnchor published nodes.
-delete(-d) create
Delete the specified template and its file. All objects that are associated with this template or contained in the same template file will be deleted. To simply unload a template without permanently deleting its file, use unload instead.
-expandCompounds(-ec) boolean createedit
This argument is used to determine how compound parent attributes and their children will be added to generated views when both are published to the container. When true, the compound parent and all compound child attributes published to the container will be included in the view. When false, only the parent attribute is included in the view. Note: if only the child attributes are published and not the parent, the children will be included in the view, this flag is only used in the situation where both parent and child attributes are published to the container. The default value is false.
-fromContainer(-fc) string create
This argument is used in create or edit mode to specify a container node to be used for generating the template contents. In template creation mode, the template definition will be created based on the list of published attributes in the specified container. In edit mode, when used with the addNames flag or with no other flag, any published name on the container not present as an attribute on the template will be added to the template. This flag is also used in conjunction with flags such as addView.
-fromSelection(-fs) createedit
If true, we will use the active selection list to create the template or the view. If allKeyable is also true then we will create the template from all keyable attributes in the selection, otherwise we will create the template using the attributes specified with the attribute flag.
-layoutMode(-lm) int create
This argument is used to specify the layout mode when creating a view. Values correspond as follows: 0: layout in flat list (default when not creating view from container) 1: layout grouped by node (default if creating view from container) The fromContainer or fromSelection argument is required to provide the reference container or selection for layout modes that require node information. Note that views can only refer to defined template attributes. This means that when using the fromContainer or from Selection flag to add a view to an existing template, only attributes that are defined on both the template and the container or the current selection will be included in the view (i.e. published attributes on the container that are not defined in the template will be ignored).
-matchName(-mn) string query
Used in query mode in conjunction with other flags this flag specifies an optional template name that is to be matched as part of the query operation. The base template name is used for matching, any template with the same basename will be matched even across different packages.

In query mode, this flag needs a value.

-parentAnchor(-pan) createquery
This flag can be optionally specified when querying the publishedNodeList. The resulting list will contain only parentAnchor published nodes.
-publishedNodeList(-pnl) string createqueryedit
Used in query mode, returns a list of published nodes contained in the template definition. By default all published nodes on the template will be returned. The list of published nodes can be limited to only include certain types of published nodes using one of the childAnchor, parentAnchor or rootTransform flags. If an optional flag is are specified, only nodes of the specified type will be returned.
-removeBindingSet(-rbs) string createedit
This argument is used to remove the named binding set from the template. The template must be saved before the binding set is permanently removed from the template file.
-removeView(-rv) string createedit
This argument is used to remove the named view from the template. The template must be saved before the view is permanently removed from the template file.
-rootTransform(-rtn) createquery
This flag can be optionally specified when querying the publishedNodeList. The resulting list will contain only rootTransform published nodes.
-save(-s) create
Save the specified template to a file. If a filename is specified for the template, the entire file (and all templates associated with it) will be saved. If no file name is specified, a default filename will be assumed, based on the template name.
-searchPath(-sp) string queryedit
The template searchPath is an ordered list of all locations that are being searched to locate template files (first location searched to last location searched). The template search path setting is stored in the current workspace and can also be set and queried as the file rule entry for 'templates' (see the workspace command for more information). In edit mode, this flag allows the search path setting to be customized. When setting the search path value, the list should conform to a path list format expected on the current platform. This means that paths should be separated by a semicolon (;) on Windows and a colon (:) on Linux and MacOSX. Environment variables can also be used. Additional built-in paths may be added automatically by maya to the customized settings. In query mode, this flag returns the current contents of the search path; all paths, both customized and built-in, will be included in the query return value.
-templateList(-tl) string query
Used in query mode, returns a list of all loaded templates. This query can be used with optional matchFile and matchName flags. When used with the matchFile flag, the list of templates will be restricted to those associated with the specified file. When used with the matchName flag, the list of templates will be restricted to those matching the specified template name.
-updateBindingSet(-ubs) string createedit
This argument is used to update an existing binding set with new bindings. When used with the fromContainer argument binding set entries with be replaced or merged in the binding set based on the bindings of the designated container. If the force flag is used, existing entries in the binding set are replaced with new values. When force is not used, only new entries are merged into the binding set, any existing entries will be left as-is. When used without a reference container, the binding set will be updated with placeholder entries. The template must be saved before the new binding set is permanently stored with the template file.
-useHierarchy(-uh) createedit
If true, and the fromSelection flag is set, the selection list will expand to include it's hierarchy also.
-exists(-ex) query
Returns true or false depending upon whether the specified template exists. When used with the matchFile argument, the query will return true if the template exists and the filename it was loaded from matches the filename given.
-fileName(-fn) string createquery
Specifies the filename associated with the template. This argument can be used in conjunction with load, save or query modes. If no filename is associated with a template, a default file name based on the template name will be used. It is recommended but not required that the filename and template name correspond.
-force(-f) create
This flag is used with some actions to allow them to proceed with an overwrite or destructive operation. When used with load, it will allow an existing template to be reloaded from a file. When used in create mode, it will allow an existing template to be recreated (for example when using fromContainer argument to regenerate a template).
-load(-l)
Load an existing template from a file. If a filename is specified for the template, the entire file (and all templates in it) will be loaded. If no file is specified, a default filename will be assumed, based on the template name.
-matchFile(-mf) string query
Used in query mode in conjunction with other flags this flag specifies an optional file name that is to be matched as part of the query operation.

In query mode, this flag needs a value.

-silent(-si) createqueryedit
Silent mode will suppress any error or warning messages that would normally be reported from the command execution. The return values are unaffected.
-unload(-u) create
Unload the specified template. This action will not delete the associated template file if one exists, it merely removes the template definition from the current session.
-viewList(-vl) string createquery
Used in query mode, returns a list of all views defined on the template.

Flag can appear in Create mode of command Flag can appear in Edit mode of command
Flag can appear in Query mode of command Flag can be used more than once in a command.

MEL examples

// Create a container template using the published attribute information from
// container1.
//
containerTemplate -fromContainer container1 characterRig;
//
// Save the template to a template file in the default template location.
containerTemplate -save characterRig;
//
// Load a template (the template is located along the template search path)
containerTemplate -load characterRig;
//
// Re-load a template that has already been loaded
// This is useful if you have made edits to the template outside of maya
containerTemplate -force -load characterRig;
//
// Determine the file that a template was loaded from
containerTemplate -query -fileName characterRig;
// Result: C:/myTemplates/characterRig.template //
//
// Add a view to a container template. This view will be generated from the
// given container, and will use a group-by-node hierarchical layout.
// The view can be subesequently customized if desired.
//
containerTemplate -edit -addView "newView" -fromContainer container1 -layoutMode 1 characterRig;
containerTemplate -save characterRig;
//
// Add another view to a container template.
// This view will be generated with a default layout and can be
// subsequently customized.
//
containerTemplate -edit -addView "newView2" characterRig;
containerTemplate -save characterRig;
//
// Get the list of attributes in the template.  This will return
// a flat list of attribute names in the order in which they appear
// in the template definition.
//
containerTemplate -query -attributeList characterRig;
// Result:  attribute1 attribute2 attribute3 ...
//
// List all loaded templates
string $list[] = `containerTemplate -query -templateList`;
// List all templates matching a a given template name
// Note that all templates with matching base name (in any package) will
// be returned.
string $matches[] = `containerTemplate -query -templateList -matchName "characterRig"`;
// Result: characterRig
//