This command is used to delete an extension attribute from a node type. The attribute can be specified by using either the long or short name. Only one extension attribute can be deleted at a time. Children of a compound attribute cannot be deleted, you must delete the complete compound attribute. This command has no undo, edit, or query capabilities.
Long name (short name) | Argument Types | Properties | |
---|---|---|---|
attribute (at) | unicode | ||
|
|||
forceDelete (fd) | bool | ||
If this flag is set and turned ON then data values for the extension attributes are all deleted without confirmation. If it’s set and turned OFF then any extension attributes that have non-default values set on any node will remain in place. If this flag is not set at all then the user will be asked if they wish to preserve non-default values on this attribute.Flag can appear in Create mode of commandFlag can have multiple arguments, passed either as a tuple or a list. |
|||
nodeType (nt) | unicode | ||
|
Derived from mel command maya.cmds.deleteExtension
Example:
import pymel.core as pm
import maya.cmds as cmds
pm.addExtension( nodeType='planet', longName='martians', shortName='mr', attributeType='double' )
pm.createNode( 'planet', name='jupiter' )
pm.createNode( 'planet', name='mars' )
pm.setAttr( 'mars.mr', 35 )
# Delete an extension attribute named mr/martians.
# Only returns 1 since the planet node 'jupiter'
# does not have a non-default value on the extension.
pm.deleteExtension( nodeType='planet', forceDelete=True, attribute='martians' )
# Return: 1 //
# The attribute is gone since it was forced out
pm.attributeQuery( type='planet', attribute='mr', query=True, exists=True )
# Return: 0 //
# Re-add and delete the extension again, forcing the
# attribute to remain if non-default values exist.
pm.addExtension( nodeType='planet', longName='martians', shortName='mr', attributeType='double' )
pm.setAttr( 'mars.mr', 35 )
pm.deleteExtension( nodeType='planet', forceDelete=False, attribute='mr' )
# Return: 0 //
# The attribute still exists since it had some non-default values
pm.attributeQuery( type='planet', attribute='mr', query=True, exists=True )
# Return: 1 //
pm.attributeQuery( name='jupiter', attribute='mr', query=True, exists=True )
# Return: 1 //