Function set for assemblies.
Method resolution order:
- MFnAssembly
- MFnDagNode
- MFnDependencyNode
- MFnBase
- builtins.object
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.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.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.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.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.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