Go to: Synopsis. Return value. Flags. Python examples.

Synopsis

buttonManip( script [selectionItem] , [icon=string])

Note: Strings representing object names and arguments must be separated by commas. This is not depicted in the synopsis.

buttonManip is undoable, NOT queryable, and NOT editable.

This creates a button manipulator. This manipulator has a position in space and a triad manip for positioning. When you click on the top part of the manip, the command defined by the first argument is executed. The command is associated with the manipulator when it is created.

If a dag object is included on the command line, the manip will be parented to the object. This means moving the object will move the manip. You can move the manip independently of the object using its triad.

Note that a buttonManip may not be parented to more than one object.

Return value

None

Flags

icon
Long name (short name) Argument types Properties
icon(i) string create
Specify an icon to represent the manipulator.

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 have multiple arguments, passed either as a tuple or a list.

Python examples

import maya.cmds as cmds

#    Example 1.
#
#    Create a button manipulator that will be parented to a sphere and will
#    print "Button Manipulator" whenever it is pressed.
#
#    Note that moving the sphere will also move the manipulator.
#
sphere = cmds.sphere()
cmds.buttonManip( 'print "Button Manipulator"', sphere[0])

#    Example 2.
#
#    Create a button manipulator that will execute the 'setKeyframe' command
#    when it is pressed.
#
cmds.buttonManip( 'setKeyframe' )