pymel.core.general.attributeName

attributeName(*args, **kwargs)

This command takes one node.attribute-style specifier on the command line and returns either the attribute’s long, short, or nice name. (The nicename, or UI name, is the name used to display the attribute in Maya’s interface, and may be localized when running Maya in a language other than English.) If more than one node.attributespecifier is given on the command line, only the first valid specifier is processed.

Flags:

Long Name / Short Name Argument Types Properties
leaf / lf bool ../../../_images/create.gif
  When false, shows parent multi attributes (like controlPoints[2].xValue). When true, shows only the leaf-level attribute name (like xValue). Default is true. Note that for incomplete attribute strings, like a missing multi-parent index (controlPoints.xValue) or an incorrectly named compound (cntrlPnts[2].xValue), this flag defaults to true and provides a result as long as the named leaf-level attribute is defined for the node.
long / l bool ../../../_images/create.gif
  Returns names in long nameformat like translateX
nice / n bool ../../../_images/create.gif
  Returns names in nice nameformat like Translate X
short / s bool ../../../_images/create.gif
  Returns names in short nameformat like txFlag can have multiple arguments, passed either as a tuple or a list.

Derived from mel command maya.cmds.attributeName

Example:

import pymel.core as pm

import maya.cmds as cmds
pm.attributeName( "persp.tx" )
# Result: u'Translate X' #
pm.attributeName( "persp.translateX", s=True )
# Result: u'tx' #
pm.attributeName( "persp.tx", l=True )
# Result: u'translateX' #
pm.attributeName( "nurbsSphere1.controlPoints[50].xv", leaf=True )
// Result: xValue //
pm.attributeName( "nurbsSphere1.controlPoints[50].xv", leaf=False )
// Result: Control Points[50].X Value //