Go to: Synopsis. Flags. Return value. Python examples.
uiTemplate(
[templateName]
, [exists=boolean])
Note: Strings representing object names and arguments must be separated by commas. This is not depicted in the synopsis.
uiTemplate is undoable, queryable, and editable.
This command creates a new command template object. Template objects can hold default flag arguments for multiple UI commands. The command arguments are specified with the individual commands using the -defineTemplate flag and the desired flags and arguments. See also setUITemplate.| Long name (short name) | [argument types] | Properties | ||
|---|---|---|---|---|
exists(ex)
|
boolean
|
|
||
|
||||
import maya.cmds as cmds # Create a new template. # if cmds.uiTemplate( 'ExampleTemplate', exists=True ): cmds.deleteUI( 'ExampleTemplate', uiTemplate=True ) cmds.uiTemplate( 'ExampleTemplate' ) cmds.button( defineTemplate='ExampleTemplate', width=100, height=40, align='left' ) cmds.frameLayout( defineTemplate='ExampleTemplate', borderVisible=True, labelVisible=False ) # Create a window and apply the template. # window = cmds.window() cmds.setUITemplate( 'ExampleTemplate', pushTemplate=True ) cmds.columnLayout( rowSpacing=5 ) cmds.frameLayout() cmds.columnLayout() cmds.button( label='One' ) cmds.button( label='Two' ) cmds.button( label='Three' ) cmds.setParent( '..' ) cmds.setParent( '..' ) cmds.frameLayout() cmds.columnLayout() cmds.button( label='Red' ) cmds.button( label='Green' ) cmds.button( label='Blue' ) cmds.setParent( '..' ) cmds.setParent( '..' ) cmds.setUITemplate( popTemplate=True ) cmds.showWindow( window )