paya.runtime.plugs.Attribute#

class Attribute(*args, **kwargs)#

Inheritance

Attribute PyNode ProxyUnicode

classmethod createAttr(attrName, node=None, **kwargs)#

Creates an attribute.

Parameters
  • attrName (str) – the name of the attribute

  • node (str, DependNode) – the node on which to create the attribute; if omitted, a free-standing network node will be created to hold the attribute; defaults to None

  • **kwargs – forwarded to addAttr()

Returns

The generated attribute.

Return type

Attribute

hasInputs(recursive=False)#
Parameters

recursive/r (bool) – if this is a compound, inspect children as well

Returns

True if this plug has inputs, otherwise False.

Return type

bool

splitInputs()#

Splits any compound-level input into per-child connections. The compound-level connection is maintained.

Returns

self

createProxy(node, longName=None, shortName=None)#

Creates a proxy of this attribute.

Parameters
  • node (str, DependNode) – the node on which to create the proxy

  • longName/ln (str) – a long name for the proxy attribute; defaults this attribute’s long name

  • shortName/sn (str) – a short name for the proxy attribute; defaults this attribute’s short name

Returns

The proxy attribute.

Return type

Attribute

hasUnits()#
Returns

True if this is a linear, angle or time attribute, or a compound with any children for which this is True, otherwise False.

Return type

bool

unitType()#
Returns

One of ‘angle’, ‘distance’, ‘time’ or None.

Return type

str | None

isAnimatableDynamic()#
Returns

True if this is a dynamic attribute that can be exposed for keying.

plugInfo()#

Calls paya.pluginfo.getInfoFromAttr() on this attribute and returns the result.

mathDimension()#
Returns

The math dimension of this plug (e.g. 16 for a matrix), if any.

Return type

int, None

plugType(inherited=False)#

Returns abstract type information for this plug.

Parameters

inherited/i (bool) – return the full hierarchy stack instead of just a single type; defaults to False

Returns

The type information.

Return type

str or list

setClass(cls)#

Convenience method to enable chained dot notation when reassigning the plug class (sometimes necessary for ambiguous output types, e.g. on ‘choice’ nodes). Returns self.

Equivalent to:

self.__class__ = cls
Parameters

cls (type) – the class to assign

Returns

This instance, with a reassigned class.

Return type

Attribute

get(plug=False, **kwargs)#

Extends pymel.core.general.Attribute.get() with the plug keyword argument, which is useful when the decision whether to work statically or dynamically rests with the end-user.

Parameters
  • plug/p (bool) – if True, return self; defaults to False

  • **kwargs – forwarded to the base method

Returns

Attribute or a value type

enable(recursive=False, force=False)#

Equivalent to:

self.show()
self.unlock()

See show() and unlock() for details.

disable(recursive=False)#

Equivalent to:

self.lock()
self.hide()

See lock() and hide() for details.

lock(recursive=False, **kwargs)#

Overloads Attribute to implement the recursive option and return self.

Parameters
  • recursive/r (bool) – if this is a compound, lock its children too; defaults to False

  • **kwargs – forwarded to lock()

Returns

self

Return type

Attribute

hide(recursive=False)#

Turns off keyable and channelBox for this attribute.

Parameters

recursive/r (bool) – if this is a compound, edit the children too; defaults to False

Returns

self

Return type

Attribute

unlock(recursive=False, force=False, **kwargs)#

Overloads Attribute to implement the recursive and force options and return self.

Parameters
  • recursive/r (bool) – if this is a compound, unlock the children too; defaults to False

  • force/f (bool) – if this is the child of a compound, unlock the compound parent too; defaults to False

  • **kwargs – forwarded to unlock()

Returns

self

Return type

Attribute

show(recursive=False, force=False, keyable=True)#

Unhides this attribute in the channel box.

Parameters
  • recursive/r (bool) – if this is a compound, edit the children as well; defaults to False

  • force/f (bool) – if this is the child of a compound, edit the parent attribute too; defaults to False

  • keyable/k (bool) – reveal by making the attribute keyable; if this is False, the attribute will be made settable instead; defaults to True

Returns

self

Return type

Attribute

release(recursive=False, force=False)#

Unlocks this attribute and disconnects any inputs.

Parameters
  • force/f (bool) – if this is the child of a compound, release the parent too; defaults to False

  • recursive/r (bool) – if this is a compound, release child attributes too; defaults to False

Returns

put(source, plug=None)#

Helper for mixed plug / value workflows. If ‘source’ is an attribute, it will be connected into this plug. Otherwise, this plug will be set to ‘source’.

Parameters
  • source – the source value or plug

  • plug/p (bool or None) – if you know whether ‘source’ is a plug or not, specify if here; defaults to None

Returns

self

isSectionAttr()#
Returns

True if this attribute is a ‘section’ enum.

Return type

bool

sendAbove(attrName)#

Sends this attribute above another attribute in the channel box.

Parameters

attrName (str) – the name of the ‘anchor’ attribute

Returns

This attribute, rebuilt.

Return type

Attribute

sendBelow(attrName)#

Sends this attribute below another attribute in the channel box.

Parameters

attrName (str) – the name of the ‘anchor’ attribute

Returns

This attribute, rebuilt.

Return type

Attribute

getNextArrayIndex(fillGaps=False)#

Returns the next available logical array index.

Parameters

fillGaps/fg (bool) – return the first available gap in the logical array indices; defaults to False

Returns

The index.

Return type

int