Attribute

class cgp_maya_utils.scene.Attribute(fullName)

Bases: object

attribute object that manipulates any kind of attribute

attributeType()

the type of the attribute

Returns:the type of the attribute
Return type:str
connect(source=None, destinations=None)

connect the attribute to the source and destinations

Parameters:
connections(nodeTypes=None, source=True, destinations=True, nodeTypesIncluded=True, skipConversionNodes=False)

get the connections of the attribute

Parameters:
  • nodeTypes (list[str]) – types of nodes used to get the connections - All if nothing is specified
  • source (bool) – define whether or not the command will get the source connection
  • destinations (bool) – define whether or not the command will get the destination connections
  • nodeTypesIncluded (bool) – True : include specified node types - False : exclude specified node types
  • skipConversionNodes (bool) – True : conversion nodes are skipped - False conversion nodes are not skipped
Returns:

the connections of the attribute

Return type:

list[cgp_maya_utils.scene.Connection]

classmethod create(node, name, value=None, connectionSource=None, connectionDestinations=None, **__)

create an attribute

Parameters:
  • node (str) – node on which to create the attribute
  • name (str) – name of the attribute to create
  • value (int or bool) – value to set on the attribute
  • connectionSource (str or cgp_maya_utils.scene.Attribute) – attribute to connect as source - node.attribute
  • connectionDestinations (list[str] or list[cgp_maya_utils.scene.Attribute]) – attributes to connect as destination - [node1.attribute1, node2.attribute2 ...]
Returns:

the created attribute

Return type:

cgp_maya_utils.scene.Attribute

data(skipConversionNodes=True)

data necessary to store the attribute on disk and/or recreate it from scratch

Parameters:skipConversionNodes (bool) – True : conversion nodes are skipped - False conversion nodes are not skipped
Returns:the data of the attribute
Return type:dict
delete()

delete the attribute

disconnect(source=True, destinations=True, destinationAttributes=None)

disconnect the attribute from the source and the specified destinations

Parameters:
  • source (bool) – defines whether or not the source connected attribute will be disconnected
  • destinations (bool) – defines whether or not the destination connected attribute will be disconnected
  • destinationAttributes (list) – destination attributes to disconnect from the attribute - All if None is specified
fullName()

get the full name of the attribute

Returns:the full name of the attribute - node.attribute
Return type:str
isLocked()

check if the attribute is locked

Returns:True : it is locked - False : it is not locked
Return type:bool
isUserDefined()

check if the attribute is user defined

Returns:True : it is user defined - False : it is not user defined
Return type:bool
name()

the name of the attribute

Returns:the name of the attribute
Return type:str
node()

the node on which the attribute lives

Returns:the node of the attribute
Return type:cgp_maya_utils.scene.Node
setLock(isLocked)

set the lock state of the attribute

Parameters:isLocked (bool) – True attribute will be locked - False : attribute will be unlocked
setName(name)

set the name of the attribute

Parameters:name (str) – new name of the attribute
setValue(value)

set the value on the attribute

Parameters:value (any) – value used to set the attribute
value()

the value of the attribute

Returns:the value of the attribute
Return type:any