Node

class cgp_maya_utils.scene.Node(name)

Bases: object

node object that manipulates any kind of node

MFn()

the function set of the node

Returns:the function set of the node
Return type:maya.api.OpenMaya.MFn
MObject()

the MObject of the node

Returns:the MObject of the node
Return type:maya.api.OpenMaya.MObject
attribute(attribute)

the attribute of the node from an attribute name

Parameters:attribute (str) – name of the attribute to get
Returns:the attribute object
Return type:cgp_maya_utils.scene.Attribute
attributeValues()

the values of the available attributes of the node

Returns:the attribute values
Return type:dict
attributes(attributeTypes=None, attributeTypesIncluded=True, onlyUserDefined=False)

the attributes of the node from attribute types

Parameters:
  • attributeTypes (list[str]) – types of attributes to get - All if nothing is specified
  • attributeTypesIncluded (bool) – True : attribute types are included - False : attribute types are excluded
  • onlyUserDefined (bool) – True : only user defined attributes - False : not only user defined attributes
Returns:

the attributes

Return type:

list[cgp_maya_utils.scene.Attribute]

connections(attributes=None, sources=True, destinations=True, nodeTypes=None, nodeTypesIncluded=True, skipConversionNodes=False)

the source and destination connections of the node

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

Return type:

list[cgp_maya_utils.scene.Connection]

classmethod create(nodeType, connections=None, attributeValues=None, name=None, **__)

create a node

Parameters:
  • nodeType (str) – type of node to create
  • connections (list[tuple[str]]) – connections to set on the created node
  • attributeValues (dict) – attribute values to set on the node
  • name (str) – name of the node
Returns:

the created node

Return type:

cgp_maya_utils.scene.Node

data()

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

Returns:the data of the node
Return type:dict
delete()

delete the node

duplicate()

duplicate the node

Returns:the duplicated node
Return type:cgp_maya_utils.scene.Node
hasAttribute(attribute)

check if the node has the attribute

Parameters:attribute (str) – the attribute to check
Returns:True : it has the attribute - False : it does not have the attribute
Return type:bool
hasAttributes(attributes)

check if the node has the attributes

Parameters:attributes (list[str]) – attributes to check on the node
Returns:True : it has the attributes - False : it does not have the attributes
Return type:bool
isLocked()

check if the node is locked

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

check if the node is referenced

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

the name of the node

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

the namespace of the node

Returns:the namespace of the node
Return type:cgp_maya_utils.scene.Namespace
nodeType()

the type of the node

Returns:the type of the node
Return type:str
rebuild()

rebuild the node

reference()

the reference of the node

Returns:the reference object
Return type:cgp_maya_utils.scene.Reference
select()

select the node

setAttributeValues(attributeValues)

set the values of the attributes of the node

Parameters:attributeValues (dict) – values to set to the attributes of the node - {attr1: value1, attr2: value2 ...}
setConnections(connections)

set the connections of the node

Parameters:connections (list[tuple[str]]) – connection data used to set the connections
setLock(isLocked)

set the lock status of the node

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

set the name of the node

Parameters:name (str) – new name of the node