Python API 2.0 Reference
OpenMaya.MFnAssembly Class Reference
+ Inheritance diagram for OpenMaya.MFnAssembly:

Public Member Functions

def __init__ ()
 
def activate ()
 
def activateNonRecursive ()
 
def canActivate ()
 
def canRepApplyEdits ()
 
def createRepresentation ()
 
def deleteAllRepresentations ()
 
def deleteRepresentation ()
 
def getAbsoluteRepNamespace ()
 
def getActive ()
 
def getInitialRep ()
 
def getParentAssembly ()
 
def getRepLabel ()
 
def getRepNamespace ()
 
def getRepType ()
 
def getRepresentations ()
 
def getSubAssemblies ()
 
def handlesAddEdits ()
 
def importFile ()
 
def isActive ()
 
def isTopLevel ()
 
def postLoad ()
 
def repTypes ()
 
def setRepLabel ()
 
def setRepName ()
 
def supportsEdits ()
 
def supportsMemberChanges ()
 
- Public Member Functions inherited from OpenMaya.MFnDagNode
def __init__ ()
 
def addChild ()
 
def child ()
 
def childCount ()
 
def create ()
 
def dagPath ()
 
def dagRoot ()
 
def duplicate ()
 
def fullPathName ()
 
def getAllPaths ()
 
def getConnectedSetsAndMembers ()
 
def getPath ()
 
def hasChild ()
 
def hasParent ()
 
def instanceCount ()
 
def isChildOf ()
 
def isInstanced ()
 
def isInstancedAttribute ()
 
def isParentOf ()
 
def parent ()
 
def parentCount ()
 
def partialPathName ()
 
def removeChild ()
 
def removeChildAt ()
 
def setObject ()
 
def transformationMatrix ()
 
- Public Member Functions inherited from OpenMaya.MFnDependencyNode
def __init__ ()
 
def absoluteName ()
 
def addAttribute ()
 
def addExternalContentForFileAttr ()
 
def affectsAnimation ()
 
def attribute ()
 
def attributeClass ()
 
def attributeCount ()
 
def canBeWritten ()
 
def create ()
 
def dgCallbackIds ()
 
def dgCallbacks ()
 
def dgTimer ()
 
def dgTimerOff ()
 
def dgTimerOn ()
 
def dgTimerQueryState ()
 
def dgTimerReset ()
 
def findAlias ()
 
def findPlug ()
 
def getAffectedAttributes ()
 
def getAffectingAttributes ()
 
def getAliasAttr ()
 
def getAliasList ()
 
def getConnections ()
 
def getExternalContent ()
 
def hasAttribute ()
 
def hasUniqueName ()
 
def isFlagSet ()
 
def isNewAttribute ()
 
def isTrackingEdits ()
 
def name ()
 
def plugsAlias ()
 
def removeAttribute ()
 
def reorderedAttribute ()
 
def setAffectsAnimation ()
 
def setAlias ()
 
def setDoNotWrite ()
 
def setExternalContent ()
 
def setExternalContentForFileAttr ()
 
def setFlag ()
 
def setName ()
 
def setUuid ()
 
def uniqueName ()
 
def userNode ()
 
def uuid ()
 
- Public Member Functions inherited from OpenMaya.MFnBase
def __init__ ()
 
def hasObj ()
 
def object ()
 
def setObject ()
 
def type ()
 

Static Public Member Functions

def __new__ ()
 
def getTopLevelAssemblies ()
 
- Static Public Member Functions inherited from OpenMaya.MFnDagNode
def __new__ ()
 
- Static Public Member Functions inherited from OpenMaya.MFnDependencyNode
def __new__ ()
 
def allocateFlag ()
 
def classification ()
 
def deallocateAllFlags ()
 
def deallocateFlag ()
 
- Static Public Member Functions inherited from OpenMaya.MFnBase
def __new__ ()
 

Additional Inherited Members

- Static Public Attributes inherited from OpenMaya.MFnDagNode
int kNextPos = 255
 
- Static Public Attributes inherited from OpenMaya.MFnDependencyNode
int kTimerMetrics = 9
 
int kTimerTypes = 3
 
int kExtensionAttr = 3
 
int kInvalidAttr = 4
 
int kLocalDynamicAttr = 1
 
int kNormalAttr = 2
 
int kTimerInvalidState = 3
 
int kTimerOff = 0
 
int kTimerOn = 1
 
int kTimerUninitialized = 2
 
int kTimerMetric_callback = 0
 
int kTimerMetric_callbackNotViaAPI = 6
 
int kTimerMetric_callbackViaAPI = 5
 
int kTimerMetric_compute = 1
 
int kTimerMetric_computeDuringCallback = 7
 
int kTimerMetric_computeNotDuringCallback = 8
 
int kTimerMetric_dirty = 2
 
int kTimerMetric_draw = 3
 
int kTimerMetric_fetch = 4
 
int kTimerType_count = 2
 
int kTimerType_inclusive = 1
 
int kTimerType_self = 0
 
- Properties inherited from OpenMaya.MFnDagNode
 boundingBox = property(...)
 
 inModel = property(...)
 
 inUnderWorld = property(...)
 
 isInstanceable = property(...)
 
 isIntermediateObject = property(...)
 
 objectColor = property(...)
 
 objectColorRGB = property(...)
 
 objectColorType = property(...)
 
 useObjectColor = property(...)
 
- Properties inherited from OpenMaya.MFnDependencyNode
 isDefaultNode = property(...)
 
 isFromReferencedFile = property(...)
 
 isLocked = property(...)
 
 isShared = property(...)
 
 namespace = property(...)
 
 pluginName = property(...)
 
 typeId = property(...)
 
 typeName = property(...)
 

Detailed Description

Function set for assemblies.

Method resolution order:
-   MFnAssembly
-   MFnDagNode
-   MFnDependencyNode
-   MFnBase
-   builtins.object

Constructor & Destructor Documentation

def OpenMaya.MFnAssembly.__init__ ( )
Initialize self.  See help(type(self)) for accurate signature.

Member Function Documentation

def OpenMaya.MFnAssembly.__new__ ( )
static
Create and return a new object.  See help(type) for accurate signature.
def OpenMaya.MFnAssembly.activate ( )
activate([representation]) -> self

Activate a representation. The representation to activate is specified as a string name. If no representation is specified then the previously-active representation (if any) will be inactivated and no representation will be active. This method will fail if canActivate() returns False.

* representation - representation to activate.
def OpenMaya.MFnAssembly.activateNonRecursive ( )
activateNonRecursive([representation]) -> self

Activate a representation, but prevent any nested assemblies created and initialized during this activation from activating any of their representations.

Normal activation of a representation can create nested assemblies in the representation.  Maya will call MPxAssembly::postLoad() automatically on these nested assemblies to initialize them.  This initialization of nested assemblies can, in turn, call activate on a representation. activateNonRecursive() causes canActivate() to return False on these nested assemblies.  An implementation of MPxAssembly::postLoad() should check canActivate() to determine whether it can activate a representation. Stopping the activation at the current assembly prunes recursive activation of representations.

If canActivate() is False, activateNonRecursive() will return failure.

The representation is specified as a string identifier.  Passing in an empty string argument means inactivate the previously-active representation (if any), and activate no representation.  * representation - Representation to activate.
def OpenMaya.MFnAssembly.canActivate ( )
canActivate() -> bool

Determines whether this assembly can activate a representation, for the node attached to this function set. For example, this method will return False for a nested assembly, during a call to activateNonRecursive() on the parent assembly. If canActivate() returns False, activate() and activateNonRecursive() will fail.
def OpenMaya.MFnAssembly.canRepApplyEdits ( )
canRepApplyEdits(representation) -> bool

Determines whether the given representation can apply edits to its data, for the node attached to this function set. If an empty string is passed in as the representation name, this method will return False, since an invalid (or 'None') representation does not have any data and thus, cannot have edits applied to it.

* representation - Representation to query.
* status         - Return status.

Returns True if the representation can apply edits, False otherwise.
def OpenMaya.MFnAssembly.createRepresentation ( )
createRepresentation(input, type[, undoRedo]) -> MString
createRepresentation(input, type, representation[, undoRedo]) -> MString


Create a representation and add it to the list of those managed by this node.
The input argument string is used as input data to the representation creation process. The semantics of this input are defined by the assembly derived class.
The type of the representation is a property of the representation that expresses its commonality with other representations of this assembly type, for example a "Bounding Box" representation type. See the getRepType() method.
If specified, the representation argument is used as a starting point for the representation name. This string value can be modified to meet uniqueness, or other constraints.
The representation return value string is the representation name, after it has been added.

* input          - Input data for representation creation.
* type           - Type of representation to create.
* representation - Representation name starting point.
* undoRedo       - Optional MDagModifier object, for undo/redo purposes.
def OpenMaya.MFnAssembly.deleteAllRepresentations ( )
deleteAllRepresentations() -> self

Delete all representations managed by the node attached to this function set.
def OpenMaya.MFnAssembly.deleteRepresentation ( )
deleteRepresentation(representation) -> self

Delete a representation managed by the node attached to this function set.
def OpenMaya.MFnAssembly.getAbsoluteRepNamespace ( )
getAbsoluteRepNamespace() -> MString

Get the fully-qualified (absolute) namespace for representations of this assembly node. This is the namespace where nodes created by the activation of a representation will be added. This namespace is shared by all representations.

This namespace starts at the root namespace, contains the namespace of the assembly node, and ends (inclusively) with the representation namespace.

Two namespaces are optionally involved when dealing with an assembly node: the namespace of the assembly node itself, and the namespace of its representations. The representation namespace is a child of its assembly node's namespace. The assembly node's namespace is set by its containing assembly, if it is nested, or by the top-level file. Either the assembly node's namespace, or the representation namespace, or both, can be the empty string.

It should be noted that if the assembly node is nested, the assembly node's namespace will be (by virtue of its nesting) the representation namespace of its containing assembly.

Returns the fully-qualified (absolute) namespace for representations of this assembly node. The name can be empty if the namespace has not been created yet.
def OpenMaya.MFnAssembly.getActive ( )
getActive() -> MString

Get the active representation in the list of representations. If the list of representations is empty, the return string will be empty.
def OpenMaya.MFnAssembly.getInitialRep ( )
getInitialRep() -> (MString, bool)

Get the initial representation to use when the assembly is first loaded.

This method returns the representation which should be activated when the assembly is first initialized and a boolean that indicates whether the assembly has an initial representation. If both an empty string and True is returned it means that assembly has been explicitly set to have no initial representation
def OpenMaya.MFnAssembly.getParentAssembly ( )
getParentAssembly() -> MObject

Return the immediate parent assembly of this assembly if there is one, otherwise returns None. An assembly with no parent is a top level assembly.
def OpenMaya.MFnAssembly.getRepLabel ( )
getRepLabel(representation) -> MString

Get the label of the specified representation. The label of a representation is a string that is meant to be shown in the UI and identify the representation meaningfully to a user. The representation label should support localization requirements. If the specified representation is not found in this assembly, an empty string is returned.

* representation - Representation whose label must be returned.
def OpenMaya.MFnAssembly.getRepNamespace ( )
getRepNamespace() -> MString

Get the representations namespace of this assembly node. This is the namespace where nodes created by the activation of a representation will be added. This namespace is shared by all representations. The name can be updated by Maya if a name clash occurs when the namespace is added to its parent namespace (see MPxAssembly::updateRepNamespace() for details).

Returns the namespace for representations.
def OpenMaya.MFnAssembly.getRepresentations ( )
getRepresentations() -> [MString]

Returns an array of the representations managed by the node attached to this function set.
def OpenMaya.MFnAssembly.getRepType ( )
getRepType(representation) -> MString

Get the type of the specified representation. The type string does not have to be user-readable, and does not have to be localized; the type label should be used for UI purposes. If the specified representation is not found in this assembly, an empty string is returned.

* representation - Representation whose type must be returned.
def OpenMaya.MFnAssembly.getSubAssemblies ( )
getSubAssemblies() -> MObjectArray

Returns a list containing direct children of this assembly that are themselves assemblies, for the currently active representation. The returned list will be empty if there are no assembly children of the currently active representation.
def OpenMaya.MFnAssembly.getTopLevelAssemblies ( )
static
getTopLevelAssemblies() -> MObjectArray

Returns a list containing top-level assemblies. These are assembliesthat are not nested inside another assembly.
def OpenMaya.MFnAssembly.handlesAddEdits ( )
handlesAddEdits() -> bool

Determines whether the assembly supplies edits to its data, for the node attached to this function set.

If this method returns True, Maya will call MPxAssembly::addEdits(). These edits will later be applied, either by Maya, or by the assembly through MPxAssembly::applyEdits(), if MPxAssembly::handlesApplyEdits() returns True.

Adding edits can be done by a plugin that implements its own persistency scheme. When an assembly node is brought into Maya through activation of a representation, this assembly can carry edits and make them known to Maya through the addEdits() method.

Edits can be added for any node in the assembly's representations, which includes edits to any nested assembly of this assembly. In a scene with multiple levels of nested assemblies, if more than one nested assembly has edits to a given lower-level nested assembly, edits are applied by Maya starting at the most nested assembly level, moving up the chain of nesting assemblies. In this way, the most nested assembly's edit are overridden by less nested assembly edits, if they edit the same attribute or connection.

Returns True if the assembly adds edits, False if no edits are added.
def OpenMaya.MFnAssembly.importFile ( )
importFile(fileName[, type][, preserveReferences][, nameSpace][, ignoreVersion]) -> self

Import the scene elements from the given file into this assembly. See MFileIO::importFile() for more information.  All elements imported from the file become members of the assembly. DAG nodes in the imported file that are parented to world are parented to the assembly. DAG nodes in the imported file whose parent is not world keep their existing parenting relationship.

* fileName           - name of the file from which to import objects
* type               - if not specified, Maya will try to deduce the type of the
           file. If specified, it must contain a file type to use
           when importing the file.
* preserveReferences - Boolean to indicate whether the
           references need to be preserved.
* nameSpace          - optional name of the namespace to use when importing
           objects. If empty defaults tp no namespace.
* ignoreVersion      - Boolean to control whether to ignore version when
           importing a file.
def OpenMaya.MFnAssembly.isActive ( )
isActive(representation) -> bool

Determines whether the given representation is the active representation for the node attached to this function set.

* representation - Representation to query.
def OpenMaya.MFnAssembly.isTopLevel ( )
isTopLevel() -> bool

Returns whether this assembly node is a top-level assembly. An assembly node is a top-level assembly if no container in its (possibly empty) chain of nesting parent containers is an assembly. Of course, this includes the trivial case of its immediate parent container being null.

Returns True if the assembly node is a top-level assembly.
def OpenMaya.MFnAssembly.postLoad ( )
postLoad() -> self

Initialize assemblies after their creation.
In general, postLoad() does not need to be called explicity by a plugin. Maya will call it automatically on any assembly node created by representation activation, to initialize the assembly node.
However, if an existing assembly needs to be re-initialized, because of a parameter change for example, the representation activation code path is obviously not involved. In such a case, the postLoad() re-initialization can be done by calling this method explicitly, so that Maya is made aware that the node is being re-initialized, and that for example, no edits should be recorded during this re-initialization.
def OpenMaya.MFnAssembly.repTypes ( )
repTypes() -> [MString]

Return the list of representation types that can be created for this assembly node.
def OpenMaya.MFnAssembly.setRepLabel ( )
setRepLabel(representation, label) -> self

Change the representation label.

* representation - Representation name.
* label          - New representation label.
def OpenMaya.MFnAssembly.setRepName ( )
setRepName(representation, newName) -> MString

Rename a representation. The newName argument is used as a starting point for the new representation name. This string value can be modified by the derived implementation to meet representation name uniqueness, or other constraints. This method returns the final representation name.

* representation - Current representation name.
* newName        - New representation name starting point.
* status         - Return status.

Returns new representation name.
def OpenMaya.MFnAssembly.supportsEdits ( )
supportsEdits() -> bool

Returns True if this assembly supports tracking of edits on its nodes.
def OpenMaya.MFnAssembly.supportsMemberChanges ( )
supportsMemberChanges() -> bool

If the assembly does not use Maya's edit tracking system (see supportsEdits()), does it support changes to its member nodes, outside of activation? If so, this means that any mutatingoperation on Maya nodes (parenting, connecting, disconnecting, renaming, deleting, setting attributes, adding attributes, removing attributes, locking) can be performed on member nodes of the assembly.

This method is only used if supportsEdits() returns False. If supportsEdits() returns True, Maya will track edits to assembly members, and the return value of supportsMemberChanges() will have no meaning.When this method returns False, any mutating operation to member nodes of the assembly is prevented, and the assembly behaves as a read-only container of nodes. When this method returns True, the assembly supports changes to its member nodes.

This predicate is only used outside of representation activation. During activation, all types of changes to the assembly's members are allowed, including of course deleting the previous representation's nodes, and creating nodes for the new representation.

Returns True if the assembly supports changes to its nodes