pymel.core.general.AttributeDefaults

Inheritance diagram of AttributeDefaults

class AttributeDefaults(*args, **kwargs)
DisconnectBehavior = Enum( EnumValue('DisconnectBehavior', 0, 'delete'), EnumValue('DisconnectBehavior', 1, 'reset'), EnumValue('DisconnectBehavior', 2, 'nothing'))
accepts(type)

Returns true if this attribute can accept a connection of the given type.

Parameters :
type : Data.Type

data type

values: ‘numeric’, ‘plugin’, ‘pluginGeometry’, ‘string’, ‘matrix’, ‘stringArray’, ‘doubleArray’, ‘intArray’, ‘pointArray’, ‘vectorArray’, ‘componentList’, ‘mesh’, ‘lattice’, ‘nurbsCurve’, ‘nurbsSurface’, ‘sphere’, ‘dynArrayAttrs’, ‘dynSweptGeometry’, ‘subdSurface’, ‘NObject’, ‘NId’, ‘any’

Return type:

bool

Derived from api method maya.OpenMaya.MFnData.accepts

addToCategory(category)

Add the attribute to the named category.

Parameters :
category : unicode

New category to which the attribute is to be added

Derived from api method maya.OpenMaya.MFnAttribute.addToCategory

Undo is not currently supported for this method

getAddAttrCmd(useLongName=False)

Returns a string containing the addAttr command which would be required to recreate the attribute on a node. The command includes the terminating semicolon and is formatted as if for use with a selected node, meaning that it contains no node name.

Parameters :
useLongName : bool

if true, use the attribute’s long name rather than its short name

Return type:

unicode

Derived from api method maya.OpenMaya.MFnAttribute.getAddAttrCmd

getAffectsAppearance()

Returns true if this attribute affects the appearance of the object when rendering in the viewport.

Return type:bool

Derived from api method maya.OpenMaya.MFnAttribute.affectsAppearance

getCategories()

Get all of the categories to which this attribute belongs.

Return type:list list

Derived from api method maya.OpenMaya.MFnAttribute.getCategories

getDisconnectBehavior()

Returns the behavior of this attribute when it is disconnected. The possible settings are as follows:

Return type:AttributeDefaults.DisconnectBehavior

Derived from api method maya.OpenMaya.MFnAttribute.disconnectBehavior

getIndexMatters()

Determines whether the user must specify an index when connecting to this attribute, or whether the next available index can be used. This method only applies to array attributes which are non readable, i.e. destination attributes.

Return type:bool

Derived from api method maya.OpenMaya.MFnAttribute.indexMatters

getInternal()

Returns true if a node has internal member data representing this attribute.

Return type:bool

Derived from api method maya.OpenMaya.MFnAttribute.internal

getUsesArrayDataBuilder()

Returns true if this attribute uses an array data builder. If so, then the MArrayDataBuilder class may be used with this attribute.

Return type:bool

Derived from api method maya.OpenMaya.MFnAttribute.usesArrayDataBuilder

hasCategory(category)

Check to see if the attribute belongs to the named category.

Parameters :
category : unicode

Category to check for attribute membership

Return type:

bool

Derived from api method maya.OpenMaya.MFnAttribute.hasCategory

isAffectsWorldSpace()

Returns true if this attribute affects worldspace.

Return type:bool

Derived from api method maya.OpenMaya.MFnAttribute.isAffectsWorldSpace

isArray()

Returns true if this attribute supports an array of data.

Return type:bool

Derived from api method maya.OpenMaya.MFnAttribute.isArray

isCached()

Returns true if this attribute is cached locally in the node’s data block. The default for this is true. Caching a node locally causes a copy of the attribute value for the node to be cached with the node. This removes the need to traverse through the graph to get the value each time it is requested.

Return type:bool

Derived from api method maya.OpenMaya.MFnAttribute.isCached

isChannelBoxFlagSet()

Returns true if this attribute has its channel box flag set. Attributes will appear in the channel box if their channel box flag is set or if they are keyable.

Return type:bool

Derived from api method maya.OpenMaya.MFnAttribute.isChannelBoxFlagSet

isConnectable()

Returns true if this attribute accepts dependency graph connections. If it does, then the readable and writable methods will indicate what types of connections are accepted.

Return type:bool

Derived from api method maya.OpenMaya.MFnAttribute.isConnectable

isDynamic()

Returns true if this attribute is a dynamic attribute.

Return type:bool

Derived from api method maya.OpenMaya.MFnAttribute.isDynamic

isExtension()

Returns true if this attribute is an extension attribute.

Return type:bool

Derived from api method maya.OpenMaya.MFnAttribute.isExtension

isHidden()

Returns true if this attribute is to hidden from the UI. The attribute will not show up in attribute editors.

Return type:bool

Derived from api method maya.OpenMaya.MFnAttribute.isHidden

isIndeterminant()

Returns true if this attribute is indeterminant. If an attribute may or may not be used during an evaluation then it is indeterminant. This attribute classification is mainly used on rendering nodes to indicate that some attributes are not always used.

Return type:bool

Derived from api method maya.OpenMaya.MFnAttribute.isIndeterminant

isKeyable()

Returns true if this attribute is keyable. Keyable attributes will be keyed by AutoKey and the Set Keyframe UI. Non-keyable attributes prevent the user from setting keys via the obvious UI provided for keying. Being non-keyable is not a hard block against adding keys to an attribute.

Return type:bool

Derived from api method maya.OpenMaya.MFnAttribute.isKeyable

isReadable()

Returns true if this attribute is readable. If an attribute is readable, then it can be used as the source in a dependency graph connection.

Return type:bool

Derived from api method maya.OpenMaya.MFnAttribute.isReadable

isRenderSource()

Returns true if this attribute is a render source. This attribute is used on rendering nodes to override the rendering sampler info.

Return type:bool

Derived from api method maya.OpenMaya.MFnAttribute.isRenderSource

isStorable()

Returns true if this attribute is to be stored when the node is saved to a file.

Return type:bool

Derived from api method maya.OpenMaya.MFnAttribute.isStorable

isUsedAsColor()

Returns true if this attribute is to be presented as a color in the UI.

Return type:bool

Derived from api method maya.OpenMaya.MFnAttribute.isUsedAsColor

isUsedAsFilename()

Returns true if this attribute is to be used as a filename. In the UI this attr will be presented as a file name.

Return type:bool

Derived from api method maya.OpenMaya.MFnAttribute.isUsedAsFilename

isWorldSpace()

Returns true if this attribute is worldspace.

Return type:bool

Derived from api method maya.OpenMaya.MFnAttribute.isWorldSpace

isWritable()

Returns true if this attribute is writable. If an attribute is writable, then it can be used as the destination in a dependency graph connection.

Return type:bool

Derived from api method maya.OpenMaya.MFnAttribute.isWritable

name()
parent()

Get the parent of this attribute, if it has one.

Return type:PyNode

Derived from api method maya.OpenMaya.MFnAttribute.parent

removeFromCategory(category)

Remove the attribute from the named category.

Parameters :
category : unicode

Category from which the attribute is to be removed

Derived from api method maya.OpenMaya.MFnAttribute.removeFromCategory

Undo is not currently supported for this method

setAffectsAppearance(state)

Sets whether this attribute affects the appearance of the object when rendering in the viewport.

Parameters :
state : bool

whether the attribute affects the appearance of the object when rendering in the viewport.

Derived from api method maya.OpenMaya.MFnAttribute.setAffectsAppearance

setAffectsWorldSpace(state)

Sets whether this attribute should affect worldspace. NOTES: This property is ignored on non-dag nodes.

Parameters :
state : bool

whether the attribute should affect worldspace

Derived from api method maya.OpenMaya.MFnAttribute.setAffectsWorldSpace

setArray(state)

Sets whether this attribute should have an array of data. This should be set to true if the attribute needs to accept multiple incoming connections.

Parameters :
state : bool

whether the attribute is to have an array of data

Derived from api method maya.OpenMaya.MFnAttribute.setArray

setCached(state)

Sets whether the data for this attribute is cached locally in the node’s data block. The default for this is true. Caching a node locally causes a copy of the attribute value for the node to be cached with the node. This removes the need to traverse through the graph to get the value each time it is requested. This should only get called in the initialize call of your node creator.

Parameters :
state : bool

whether the attribute is to be cached locally

Derived from api method maya.OpenMaya.MFnAttribute.setCached

setChannelBox(state)

Sets whether this attribute should appear in the channel box when the node is selected. This should only get called in the initialize call of your node creator. Keyable attributes are always shown in the channel box so this flag is ignored on keyable attributes. It is for intended for use on non-keyable attributes which you want to appear in the channel box.

Parameters :
state : bool

whether the attribute is to appear in the channel box

Derived from api method maya.OpenMaya.MFnAttribute.setChannelBox

Undo is not currently supported for this method

setConnectable(state)

Sets whether this attribute should allow dependency graph connections. This should only get called in the initialize call of your node creator.

Parameters :
state : bool

whether the attribute is to be connectable

Derived from api method maya.OpenMaya.MFnAttribute.setConnectable

setDisconnectBehavior(behavior)

Sets the disconnection behavior for this attribute. This determines what happens when a connection to this attribute is deleted. This should only get called in the initialize call of your node creator.

Parameters :
behavior : AttributeDefaults.DisconnectBehavior

the new disconnect behavior

values: ‘delete’, ‘reset’, ‘nothing’

Derived from api method maya.OpenMaya.MFnAttribute.setDisconnectBehavior

setHidden(state)

Sets whether this attribute should be hidden from the UI. This is useful if the attribute is being used for blind data, or if it is being used as scratch space for a geometry calculation (should also be marked non-connectable in that case).

Parameters :
state : bool

whether the attribute is to be hidden

Derived from api method maya.OpenMaya.MFnAttribute.setHidden

setIndeterminant(state)

Sets whether this attribute is indeterminant. If an attribute may or may not be used during an evaluation then it is indeterminant. This attribute classification is mainly used on rendering nodes to indicate that some attributes are not always used.

Parameters :
state : bool

whether the attribute indeterminant

Derived from api method maya.OpenMaya.MFnAttribute.setIndeterminant

setIndexMatters(state)

If the attribute is an array, then this method specifies whether to force the user to specify an index when connecting to this attribute, or to use the next available index.

Parameters :
state : bool

whether the attribute’s index must be specified when connecting to this attribute using the connectAttr command

Derived from api method maya.OpenMaya.MFnAttribute.setIndexMatters

setInternal(state)

The function controls an attribute’s data storage. When set to true, the virtual methods MPxNode::setInternalValueInContext() and MPxNode::getInternalValueInContext() are invoked whenever the attribute value is set or queried, respectively. By default, attributes are not internal.

Parameters :
state : bool

whether the attribute uses internal data

Derived from api method maya.OpenMaya.MFnAttribute.setInternal

setKeyable(state)

Sets whether this attribute should accept keyframe data. This should only get called in the initialize call of your node creator. Keyable attributes will be keyed by AutoKey and the Set Keyframe UI. Non-keyable attributes prevent the user from setting keys via the obvious UI provided for keying. Being non-keyable is not a hard block against adding keys to an attribute.

Parameters :
state : bool

whether the attribute is to be keyable

Derived from api method maya.OpenMaya.MFnAttribute.setKeyable

setNiceNameOverride(localizedName)

Sets the localized string which should be used for this attribute in the UI.

Parameters :
localizedName : unicode

The name to use for the current locale.

Derived from api method maya.OpenMaya.MFnAttribute.setNiceNameOverride

Undo is not currently supported for this method

setReadable(state)

Sets whether this attribute should be readable. If an attribute is readable, then it can be used as the source in a dependency graph connection.

Parameters :
state : bool

whether the attribute is to be readable

Derived from api method maya.OpenMaya.MFnAttribute.setReadable

setRenderSource(state)

Sets whether this attribute should be used as a render source attribute. When writing shader plug-ins, it is sometimes useful to be able to modify the sampler info, so upstream shading network can be re- evaluated with different sampler info values.

Parameters :
state : bool

whether the attribute is to be a render source

Derived from api method maya.OpenMaya.MFnAttribute.setRenderSource

setStorable(state)

Sets whether this attribute should be storable. If an attribute is storable, then it will be writen out when the node is stored to a file. This should only get called in the initialize call of your node creator.

Parameters :
state : bool

whether the attribute is to be storable

Derived from api method maya.OpenMaya.MFnAttribute.setStorable

setUsedAsColor(state)

Sets whether this attribute should be presented as a color in the UI.

Parameters :
state : bool

whether the attribute is to be presented as a color

Derived from api method maya.OpenMaya.MFnAttribute.setUsedAsColor

setUsedAsFilename(state)

Sets whether this attribute should be presented as a filename in the UI.

Parameters :
state : bool

whether the attribute is to be presented as a filename

Derived from api method maya.OpenMaya.MFnAttribute.setUsedAsFilename

setUsesArrayDataBuilder(state)

Sets whether this attribute uses an array data builder. If true, then the MArrayDataBuilder class may be used with this attribute to generate its data. If false, MArrayDataHandle::builder will fail.

Parameters :
state : bool

whether the attribute uses an array data builder

Derived from api method maya.OpenMaya.MFnAttribute.setUsesArrayDataBuilder

setWorldSpace(state)

Sets whether this attribute should be treated as worldspace. Being worldspace indicates the attribute is dependent on the worldSpace transformation of this node, and will be marked dirty by any attribute changes in the hierarchy that affects the worldSpace transformation. The attribute needs to be an array since during instancing there are multiple worldSpace paths to the node & Maya requires one array element per path for worldSpace attributes.

Parameters :
state : bool

whether the attribute is to be presented as worldspace

Derived from api method maya.OpenMaya.MFnAttribute.setWorldSpace

setWritable(state)

Sets whether this attribute should be writable. If an attribute is writable, then it can be used as the destination in a dependency graph connection. If an attribute is not writable then setAttr commands will fail to change the attribute.

Parameters :
state : bool

whether the attribute is to be writable

Derived from api method maya.OpenMaya.MFnAttribute.setWritable

shortName()

Returns the short name of the attribute. If the attribute has no short name then its long name is returned.

Return type:unicode

Derived from api method maya.OpenMaya.MFnAttribute.shortName

Previous topic

pymel.core.general.Attribute

Next topic

pymel.core.general.Component

Core

Core Modules

Other Modules

This Page