Connection

class cgp_maya_utils.scene.Connection(source, destination)

Bases: object

connection object that manipulates live or virtual connection between two attributes

connect()

connect the connection

classmethod create(source, destination)

create a connection

Parameters:
  • source (str) – attribute that drives the connection - node.attribute
  • destination (str) – attribute that is driven by the connection - node.attribute
Returns:

the created connection

Return type:

cgp_maya_utils.scene.Connection

data()

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

Returns:the data of the connection
Return type:tuple
destination()

the destination attribute of the connection

Returns:the destination attribute
Return type:cgp_maya_utils.scene.Attribute
disconnect()

disconnect the connection

classmethod get(node, attributes=None, sources=True, destinations=True, nodeTypes=None, nodeTypesIncluded=True, skipConversionNodes=False)

get the connections from the specified node

Parameters:
  • node (str or cgp_maya_utils.scene.Node) – node to get the connections from
  • attributes (list[str]) – list of attributes to get the connections from - get all if nothing specified
  • sources (bool) – True : get the source connections - False does not get source connections
  • destinations (bool) – True : get the destination connections - False does not get destination connections
  • nodeTypes (list[str]) – types of nodes used to get the connections - All if nothing is specified
  • 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

Return type:

list[cgp_maya_utils.scene.Connection]

isConnected()

check if the connection exists or not

Returns:True : connection is live - False : connection is virtual
Return type:bool
setDestination(node=None, attribute=None)

set the destination of the connection

Parameters:
  • node (str) – the new name of the destination node - keep current if None is specified
  • attribute (str) – the new name of the destination attribute - keep current if None is specified
setSource(node=None, attribute=None)

set the source of the connection

Parameters:
  • node (str) – the new name of the source node - keep current if None is specified
  • attribute (str) – the new name of the source attribute - keep current if None is specified
source()

the source attribute of the connection

Returns:the source attribute
Return type:cgp_maya_utis.scene.Attribute