Attribute¶
-
class
cgp_maya_utils.scene.Attribute(fullName)¶ Bases:
objectattribute object that manipulates any kind of attribute
-
connect(source=None, destinations=None)¶ connect the attribute to the source and destinations
Parameters: - source (str or
cgp_maya_utils.scene.Attribute) – source attribute to connect to the attribute -node.attributeorAttribute - destinations (list[str] or list[
cgp_maya_utils.scene.Attribute]) – destination attributes to connect to the attribute -[node1.attribute1 ...]or[Attribute1 ...]
- source (str or
-
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 -Falseconversion nodes are not skipped
Returns: the connections of the attribute
Return type:
-
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:
-
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 -Falseconversion nodes are not skippedReturns: 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.attributeReturn type: str
-
isLocked()¶ check if the attribute is locked
Returns: True: it is locked -False: it is not lockedReturn type: bool
-
isUserDefined()¶ check if the attribute is user defined
Returns: True: it is user defined -False: it is not user definedReturn type: bool
-
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) – Trueattribute will be locked -False: attribute will be unlocked
-
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
-