animio.lib

Epydoc: animio.lib

This module contains classes and utilities affiliated with the import and export of animation.

Classes

Epydoc: animio.lib.AnimInOutLibrary

class animio.lib.AnimInOutLibrary

Bases: object

contains default implementation for animation export and import

classmethod export(*args, **kwargs)
This is the long version of the method as it is slightly faster than simply using the StartUndo helper

Epydoc: animio.lib.AnimationHandle

class animio.lib.AnimationHandle

Bases: mrv.maya.nt.Network

addAttribute(attr)

Add the given attribute to the node as local dynamic attribute

Parameter:attr – MObject of attribute or Attribute instance as retrieved from a plug
Returns:plug to the newly added attribute
Note:This method is explicitly not undoable as attributes are being deleted in memory right in the moment they are being removed, thus they cannot reside on the undo queue
classmethod addSep(item, sep)
Returns:

item with separator added to it ( just once )

Note:

operates best on strings

Parameters:
  • item – item to add separator to
  • sep – the separator
addTo(setnode, component=<maya.OpenMaya.MObject; proxy of <Swig Object of type 'MObject *' at 0x42494e0> >, **kwargs)

Add ourselves to the given set

Note:method is undoable
See:sets.ObjectSet
allocateFlag()
apiObject()
Returns:the MObject attached to this Node
apiType()
Returns:the MFn Type id of the wrapped object
apply_animation(*args, **kwargs)
This is the long version of the method as it is slightly faster than simply using the StartUndo helper
basename()
Returns:name of this instance
Note:it is mainly for compatability with dagNodes which need this method in order to return the name of their leaf node
children(predicate=<function <lambda> at 0x2b08e713af50>)
Returns:list of intermediate children of path, [ child1 , child2 ]
Parameter:predicate – return True to include x in result
Note:the child objects returned are supposed to be valid paths, not just relative paths
childrenDeep(order=1, predicate=<function <lambda> at 0x2b08e713c0c8>)
Returns:

list of all children of path, [ child1 , child2 ]

Parameters:
  • order – order enumeration
  • predicate – returns true if x may be returned
Note:

the child objects returned are supposed to be valid paths, not just relative paths

classification()
clear(*args, **kwargs)
This is the long version of the method as it is slightly faster than simply using the StartUndo helper
connectedSets(setFilter=(459, False, 0))
Returns:list of object set compatible Nodes having self as member
Parameter:setFilter – tuple( apiType, use_exact_type ) - the combination of the desired api type and the exact type flag allow precise control whether you which to get only renderable shading engines, only objectfSets ( tuple[1] = True ), or all objects supporting the given object type. Its preset to only return shading engines
Note:the returned sets order is defined by the order connections to instObjGroups
Note:only sets will be returned that have the whole object as member, thus you will not see sets having component assignments like per-compoent shader assignments or deformer sets
connections()
Returns:MPlugArray of connected plugs
copyFrom(other, *args, **kwargs)

Copy the data from other into self as good as possible Only copy the data that is unique to your specific class - the data of other classes will be taken care of by them !

Note:you must support args and kwargs if one of your iDuplicate bases does
copyTo(instance, *args, **kwargs)

Copy the values of ourselves onto the given instance which must be an instance of our class to be compatible. Only the common classes will be copied to instance

Returns:altered instance
Note:instance will be altered during the process
copyToOther(instance, *args, **kwargs)
As copyTo, but does only require the objects to have a common base. It will match the actually compatible base classes and call copyFrom if possible. As more checking is performed, this method performs worse than copyTo
classmethod create(*args, **kwargs)
This is the long version of the method as it is slightly faster than simply using the StartUndo helper
createInstance(*args, **kwargs)

Create and Initialize an instance of self.__class__( ... ) based on your own data

Returns:new instance of self
Note:using self.__class__ instead of an explicit class allows derived classes that do not have anything to duplicate just to use your implementeation
Note:you must support args and kwargs if one of your iDuplicate bases does
deallocateAllFlags()
deallocateFlag()
delete()
AnimationHandle will disapear without a trace, no matter if it was created in the current file or if it came from a referenced file
dependencyInfo(attribute, by=True)
Returns:

list of attributes that given attribute affects or that the given attribute is affected by if the attribute turns dirty.

Parameters:
  • attribute – attribute instance or attribute name
  • by – if false, affected attributes will be returned, otherwise the attributes affecting this one
Note:

see also MPlug.affectedByPlugs

Note:

USING MEL: as api command and mObject array always crashed on me ... don’t know :(

duplicate(*args, **kwargs)
This is the long version of the method as it is slightly faster than simply using the StartUndo helper
classmethod from_file(*args, **kwargs)
This is the long version of the method as it is slightly faster than simply using the StartUndo helper
fullChildName(childname)
Add the given name to the string version of our instance :return: string with childname added like name _sep childname
classmethod getMFnClasses()
Returns:list of all function set classes this node supports, most derived function set comes first
hasFn(mfntype)
Returns:True if our object supports the given function set type
isAlive()
Returns:True if the object exists in memory
Note:objects on the undo queue are alive, but NOT valid
isMemberOf(setnode, component=<maya.OpenMaya.MObject; proxy of <Swig Object of type 'MObject *' at 0x4068130> >)
Returns:True if self is part of setnode
Note:method is undoable
See:sets.ObjectSet
isPartOf(other)
Returns:True if self is a part of other, and thus can be found in other
Note:operates on strings only
isRoot()
Returns:True if this path is the root of the DAG
isRootOf(other)
Returns:True other starts with self
Note:operates on strings
Note:we assume other has the same type as self, thus the same separator
isValid()
Returns:True if the object exists in the scene
Note:objects on the undo queue are NOT valid, but alive
iterParents(predicate=<function <lambda> at 0x2b08e713c2a8>)
Returns:generator retrieving all parents up to the root
Parameter:predicate – returns True for all x that you want to be returned
iter_animation(asNode=True)
Returns:iterator yielding managed animation curves as wrapped Node or MObject
Parameter:asNode – if true, iterator yields Node instances else MObjects
iter_assignments(predicate=None, converter=None)
Returns:

iterator yielding source-target assignments as plugs in a tuple(source_plug, target_plug)

Parameters:
  • converter – if not None, the function returns the desired target plug name to use instead of the given plug name. Its called as follows: (string) convert(source_plug, target_plugname).
  • predicate – if not None, after the converter function has been applied, (bool) predicate(source_plug, target_plugname) returns True for each plug to be yielded
Note:

for now, if target_plug does not exist we just print a message and continue

classmethod iter_instances(**kwargs)
Returns:iterator yielding AnimationHandle instances of scene
object()
Returns:the MObject attached to this Node
parent()
Returns:parent of this path, ‘/hello/world’ -> ‘/hello’ or None if this path is the dag’s root
parentDeep()
Returns:all parents of this path, ‘/hello/my/world’ -> [ ‘/hello/my’,’/hello’ ]
paste_animation(*args, **kwargs)
This is the long version of the method as it is slightly faster than simply using the StartUndo helper
referenceFile()
Returns:name ( str ) of file this node is coming from - it could contain a copy number as {x}
Note:will raise if the node is not referenced, use isReferenced to figure that out
removeAttribute(attr)

Remove the given attribute from the node

Parameter:attr – see addAttribute
removeFrom(setnode, component=<maya.OpenMaya.MObject; proxy of <Swig Object of type 'MObject *' at 0x4218850> >)

remove ourselves to the given set

Note:method is undoable
See:sets.ObjectSet
rename(*args, **kwargs)
This is the long version of the method as it is slightly faster than simply using the StartUndo helper
root()
Returns:the root of the DAG - it has no further parents
setLocked(*args, **kwargs)
This is the long version of the method as it is slightly faster than simply using the StartUndo helper
setNamespace(*args, **kwargs)
This is the long version of the method as it is slightly faster than simply using the StartUndo helper
set_animation(*args, **kwargs)
This is the long version of the method as it is slightly faster than simply using the StartUndo helper
sets(setFilter=(459, False, 0))
Returns:list of object set compatible Nodes having self as member
Parameter:setFilter – tuple( apiType, use_exact_type ) - the combination of the desired api type and the exact type flag allow precise control whether you which to get only renderable shading engines, only objectfSets ( tuple[1] = True ), or all objects supporting the given object type. Its preset to only return shading engines
Note:the returned sets order is defined by the order connections to instObjGroups
Note:only sets will be returned that have the whole object as member, thus you will not see sets having component assignments like per-compoent shader assignments or deformer sets
supports(interface_type)
Returns:True if this instance supports the interface of the given type
Parameter:interface_type – Type of the interface you require this instance to support
Note:Must be used in case you only have a weak reference of your interface instance or proxy which is a case where the ordinary isinstance( obj, iInterface ) will not work
to_file(*args, **kwargs)
This is the long version of the method as it is slightly faster than simply using the StartUndo helper

Epydoc: animio.lib

class animio.lib.FileReference(filepath=None, refnode=None)

Bases: mrv.interface.iDagItem

Represents a Maya file reference

Note:do not cache these instances but get a fresh one when you have to work with it
Note:as FileReference is also a iDagItem, all the respective methods, especially for parent/child iteration and query can be used as well
classmethod addSep(item, sep)
Returns:

item with separator added to it ( just once )

Note:

operates best on strings

Parameters:
  • item – item to add separator to
  • sep – the separator
basename()
Returns:basename of this path, ‘/hello/world’ -> ‘world’
children(predicate=<function <lambda> at 0x4416410>)
Returns:all intermediate child references of this instance
childrenDeep(order=1, predicate=<function <lambda> at 0x2b08e713c0c8>)
Returns:

list of all children of path, [ child1 , child2 ]

Parameters:
  • order – order enumeration
  • predicate – returns true if x may be returned
Note:

the child objects returned are supposed to be valid paths, not just relative paths

cleanup(*args, **kwargs)
This is the long version of the method as it is slightly faster than simply using the StartUndo helper
copynumber()
Returns:the references copy number - starting at 0 for the first reference
Note:we do not cache the copy number as mayas internal numbering can change on when references change - the only stable thing is the reference node name
classmethod create(filepath, namespace=None, load=True, **kwargs)

Create a reference with the given namespace

Parameters:
  • filepath – path describing the reference file location
  • namespace – if None, a unique namespace will be generated for you The namespace will contain all referenced objects.
  • load – if True, the reference will be created in loaded state, other wise its loading is deferred
  • kwargs – passed to file command
Raises ValueError:
 

if the namespace does already exist

Raises RuntimeError:
 

if the reference could not be created

exists()
Returns:True if our file reference exists in maya
classmethod fromPaths(paths, **kwargs)

Find the reference for each path in paths. If you provide the path X 2 times, but you only have one reference to X, the return value will be [ FileReference(X), None ] as there are less references than provided paths.

Parameters:
  • paths – a list of paths or references whose references in the scene should be returned. In case a reference is found, its plain path will be used instead.
  • kwargs

    all supported by ls to yield the base set of references we will use to match the paths with. Additionally, you may specify:

    • ignore_extension:
      if True, default False, the extension will be ignored during the search, only the actual base name will matter. This way, an MA file will be matched with an MB file. The references returned will still have their extension original extension.
Returns:

list( FileReference|None, ... ) if a filereference was found for given occurrence of Path, it will be returned at index of the current path in the input paths, otherwise it is None.

Note:

zip( paths, result ) to get a corresponding tuple list associating each input path with the located reference

fullChildName(childname)
Add the given name to the string version of our instance :return: string with childname added like name _sep childname
importRef(*args, **kwargs)
This is the long version of the method as it is slightly faster than simply using the StartUndo helper
isLoaded()
Returns:True if the reference is loaded
isLocked()
Returns:True if reference is locked
isPartOf(other)
Returns:True if self is a part of other, and thus can be found in other
Note:operates on strings only
isRoot()
Returns:True if this path is the root of the DAG
isRootOf(other)
Returns:True other starts with self
Note:operates on strings
Note:we assume other has the same type as self, thus the same separator
iterNodes(*args, **kwargs)

Creates iterator over nodes in this reference

Parameters:
  • args – MFn.kType filter ids to be used to pre-filter all nodes. If you know what you are looking for, setting this can greatly improve performance !
  • kwargs

    additional kwargs will be passed to either iterDagNodes or iterDgNodes ( dag = False ). The following additional kwargs may be specified:

    • asNode:
      if True, default True, return wrapped Nodes, if False MDagPaths or MObjects will be returned
    • dag:
      if True, default False, return dag nodes only. Otherwise return dependency nodes as well. Enables assemblies and assembilesInReference.
    • assemblies:
      if True, return only dagNodes with no parent. Needs dag and is mutually exclusive with assembilesInReference.
    • assembliesInReference:
      if True, return only dag nodes that have no parent in their own reference. They may have a parent not coming from their reference though. This flag has a big negative performance impact and requires dag.
    • predicate:
      if function returns True for Node|MObject|MDagPath n, n will be yielded. Defaults to return True for all.
Raises ValueError:
 

if incompatible arguments have been given

iterParents(predicate=<function <lambda> at 0x2b08e713c2a8>)
Returns:generator retrieving all parents up to the root
Parameter:predicate – returns True for all x that you want to be returned
classmethod ls(rootReference='', predicate=<function <lambda> at 0x4415cf8>)

list all references in the scene or under the given root

Parameters:
  • rootReference – if not empty, the references below it will be returned. Otherwise all scene references will be listed. May be string, Path or FileReference
  • predicate – method returning true for each valid file reference object that should be part of the return value.
Returns:

list of FileReference s objects

classmethod lsDeep(predicate=<function <lambda> at 0x4415de8>, **kwargs)

Return all references recursively

Parameter:kwargs – support for arguments as in ls, hence you can use the rootReference flag to restrict the set of returned FileReferences.
namespace()
Returns:namespace object of the full namespace holding all objects in this reference
parent()
Returns:the parent reference of this instance or None if we are root
parentDeep()
Returns:all parents of this path, ‘/hello/my/world’ -> [ ‘/hello/my’,’/hello’ ]
path(copynumber=False, unresolved=False)
Returns:

Path object with the path containing the reference’s data

Parameters:
  • copynumber – If True, the returned path will include the copy number. As it will be a path object, it might not be fully usable in that state
  • unresolved – see ls
Note:

we always query it from maya as our numbers change if some other reference is being removed and cannot be trusted

referenceNode()
Returns:wrapped reference node managing this reference
remove(*args, **kwargs)
This is the long version of the method as it is slightly faster than simply using the StartUndo helper
replace(*args, **kwargs)
This is the long version of the method as it is slightly faster than simply using the StartUndo helper
root()
Returns:the root of the DAG - it has no further parents
setLoaded(*args, **kwargs)
This is the long version of the method as it is slightly faster than simply using the StartUndo helper
setLocked(*args, **kwargs)
This is the long version of the method as it is slightly faster than simply using the StartUndo helper
setNamespace(*args, **kwargs)
This is the long version of the method as it is slightly faster than simply using the StartUndo helper
supports(interface_type)
Returns:True if this instance supports the interface of the given type
Parameter:interface_type – Type of the interface you require this instance to support
Note:Must be used in case you only have a weak reference of your interface instance or proxy which is a case where the ordinary isinstance( obj, iInterface ) will not work

Epydoc: animio.lib

class animio.lib.Namespace

Bases: unicode, mrv.interface.iDagItem

Represents a Maya namespace Namespaces follow the given nameing conventions:

  • Paths starting with a column are absolute
  • :absolute:path
  • Path separator is ‘:’
classmethod addSep(item, sep)
Returns:

item with separator added to it ( just once )

Note:

operates best on strings

Parameters:
  • item – item to add separator to
  • sep – the separator
basename()
Returns:basename of this path, ‘/hello/world’ -> ‘world’
capitalize

S.capitalize() -> unicode

Return a capitalized version of S, i.e. make the first character have upper case.

center

S.center(width[, fillchar]) -> unicode

Return S centered in a Unicode string of length width. Padding is done using the specified fill character (default is a space)

children(predicate=<function <lambda> at 0x4409320>)
Returns:list of child namespaces
Parameter:predicate – return True to include x in result
childrenDeep(order=1, predicate=<function <lambda> at 0x2b08e713c0c8>)
Returns:

list of all children of path, [ child1 , child2 ]

Parameters:
  • order – order enumeration
  • predicate – returns true if x may be returned
Note:

the child objects returned are supposed to be valid paths, not just relative paths

count

S.count(sub[, start[, end]]) -> int

Return the number of non-overlapping occurrences of substring sub in Unicode string S[start:end]. Optional arguments start and end are interpreted as in slice notation.

classmethod create(*args, **kwargs)
This is the long version of the method as it is slightly faster than simply using the StartUndo helper
classmethod current()
Returns:the currently set absolute namespace
decode

S.decode([encoding[,errors]]) -> string or unicode

Decodes S using the codec registered for encoding. encoding defaults to the default encoding. errors may be given to set a different error handling scheme. Default is ‘strict’ meaning that encoding errors raise a UnicodeDecodeError. Other possible values are ‘ignore’ and ‘replace’ as well as any other name registerd with codecs.register_error that is able to handle UnicodeDecodeErrors.

defaultIncrFunc(b, i)
%s%02i
delete(move_to_namespace=':', autocreate=True)

Delete this namespace and move it’s obejcts to the given move_to_namespace

Parameters:
  • move_to_namespace – if None, the namespace to be deleted must be empty If Namespace, objects in this namespace will be moved there prior to namespace deletion move_to_namespace must exist
  • autocreate – if True, move_to_namespace will be created if it does not exist yet
Note:

can handle sub-namespaces properly

Raises RuntimeError:
 
Todo:

Implement undo !

encode

S.encode([encoding[,errors]]) -> string or unicode

Encodes S using the codec registered for encoding. encoding defaults to the default encoding. errors may be given to set a different error handling scheme. Default is ‘strict’ meaning that encoding errors raise a UnicodeEncodeError. Other possible values are ‘ignore’, ‘replace’ and ‘xmlcharrefreplace’ as well as any other name registered with codecs.register_error that can handle UnicodeEncodeErrors.

endswith

S.endswith(suffix[, start[, end]]) -> bool

Return True if S ends with the specified suffix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. suffix can also be a tuple of strings to try.

exists()
Returns:True if this namespace exists
expandtabs

S.expandtabs([tabsize]) -> unicode

Return a copy of S where all tab characters are expanded using spaces. If tabsize is not given, a tab size of 8 characters is assumed.

find

S.find(sub [,start [,end]]) -> int

Return the lowest index in S where substring sub is found, such that sub is contained within s[start:end]. Optional arguments start and end are interpreted as in slice notation.

Return -1 on failure.

classmethod findUnique(basename, incrementFunc=<function <lambda> at 0x4404cf8>)

Find a unique namespace based on basename which does not yet exist in the scene and can be created.

Parameters:
  • basename – basename of the namespace, like “:mynamespace” or “mynamespace:subspace”
  • incrementFunc – func( basename, index ), returns a unique name generated from the basename and the index representing the current iteration
Returns:

unique namespace that is guaranteed not to exist below the current namespace

format
S.format(*args, **kwargs) -> unicode
fullChildName(childname)
Add the given name to the string version of our instance :return: string with childname added like name _sep childname
index

S.index(sub [,start [,end]]) -> int

Like S.find() but raise ValueError when the substring is not found.

isAbsolute()
Returns:True if this namespace is an absolut one, defining a namespace from the root namespace like “:foo:bar
isPartOf(other)
Returns:True if self is a part of other, and thus can be found in other
Note:operates on strings only
isRoot()
Returns:True if this path is the root of the DAG
isRootOf(other)
Returns:True other starts with self
Note:operates on strings
Note:we assume other has the same type as self, thus the same separator
isalnum

S.isalnum() -> bool

Return True if all characters in S are alphanumeric and there is at least one character in S, False otherwise.

isalpha

S.isalpha() -> bool

Return True if all characters in S are alphabetic and there is at least one character in S, False otherwise.

isdecimal

S.isdecimal() -> bool

Return True if there are only decimal characters in S, False otherwise.

isdigit

S.isdigit() -> bool

Return True if all characters in S are digits and there is at least one character in S, False otherwise.

islower

S.islower() -> bool

Return True if all cased characters in S are lowercase and there is at least one cased character in S, False otherwise.

isnumeric

S.isnumeric() -> bool

Return True if there are only numeric characters in S, False otherwise.

isspace

S.isspace() -> bool

Return True if all characters in S are whitespace and there is at least one character in S, False otherwise.

istitle

S.istitle() -> bool

Return True if S is a titlecased string and there is at least one character in S, i.e. upper- and titlecase characters may only follow uncased characters and lowercase characters only cased ones. Return False otherwise.

isupper

S.isupper() -> bool

Return True if all cased characters in S are uppercase and there is at least one cased character in S, False otherwise.

iterNodes(*args, **kwargs)

Return an iterator on all objects in the namespace

Parameters:
  • args – MFn.kType filter types to be used to pre-filter the nodes in the namespace. This can greatly improve performance !
  • kwargs

    given to iterDagNodes or iterDgNodes, which includes the option to provide a predicate function. Additionally, the following ones may be defined:

    • asNode:
      if true, default True, Nodes will be yielded. If False, you will receive MDagPaths or MObjects depending on the ‘dag’ kwarg
    • dag:
      if True, default False, only dag nodes will be returned, otherwise you will receive dag nodes and dg nodes. Instance information will be lost on the way though.
    • depth:
      if 0, default 0, only objects in this namespace will be returned

      if -1, all subnamespaces will be included as well, the depth is unlimited

      if 0<depth<x include all objects up to the ‘depth’ subnamespace

Note:

this method is quite similar to FileReference.iterNodes, but has a different feature set and needs this code here for maximum performance

iterParents(predicate=<function <lambda> at 0x2b08e713c2a8>)
Returns:generator retrieving all parents up to the root
Parameter:predicate – returns True for all x that you want to be returned
join

S.join(sequence) -> unicode

Return a string which is the concatenation of the strings in the sequence. The separator between elements is S.

ljust

S.ljust(width[, fillchar]) -> int

Return S left-justified in a Unicode string of length width. Padding is done using the specified fill character (default is a space).

lower

S.lower() -> unicode

Return a copy of the string S converted to lowercase.

lstrip

S.lstrip([chars]) -> unicode

Return a copy of the string S with leading whitespace removed. If chars is given and not None, remove characters in chars instead. If chars is a str, it will be converted to unicode before stripping

moveNodes(targetNamespace, force=True, autocreate=True)

Move objects from this to the targetNamespace

Parameters:
  • force – if True, namespace clashes will be resolved by renaming, if false possible clashes would result in an error
  • autocreate – if True, targetNamespace will be created if it does not exist yet
Todo:

Implement undo !

parent()
Returns:parent namespace of this instance
parentDeep()
Returns:all parents of this path, ‘/hello/my/world’ -> [ ‘/hello/my’,’/hello’ ]
partition

S.partition(sep) -> (head, sep, tail)

Search for the separator sep in S, and return the part before it, the separator itself, and the part after it. If the separator is not found, return S and two empty strings.

relativeTo(basenamespace)

returns this namespace relative to the given basenamespace

Parameter:basenamespace – the namespace to which the returned one should be relative too
Raises ValueError:
 If this or basenamespace is not absolute or if no relative namespace exists
Returns:relative namespace
rename(newName)

Rename this namespace to newName - the original namespace will cease to exist

Note:if the namespace already exists, the existing one will be returned with all objects from this one added accordingly
Parameter:newName – the absolute name of the new namespace
Returns:Namespace with the new name
Todo:Implement undo !
replace

S.replace (old, new[, count]) -> unicode

Return a copy of S with all occurrences of substring old replaced by new. If the optional argument count is given, only the first count occurrences are replaced.

rfind

S.rfind(sub [,start [,end]]) -> int

Return the highest index in S where substring sub is found, such that sub is contained within s[start:end]. Optional arguments start and end are interpreted as in slice notation.

Return -1 on failure.

rindex

S.rindex(sub [,start [,end]]) -> int

Like S.rfind() but raise ValueError when the substring is not found.

rjust

S.rjust(width[, fillchar]) -> unicode

Return S right-justified in a Unicode string of length width. Padding is done using the specified fill character (default is a space).

root()
Returns:the root of the DAG - it has no further parents
rpartition

S.rpartition(sep) -> (tail, sep, head)

Search for the separator sep in S, starting at the end of S, and return the part before it, the separator itself, and the part after it. If the separator is not found, return two empty strings and S.

rsplit

S.rsplit([sep [,maxsplit]]) -> list of strings

Return a list of the words in S, using sep as the delimiter string, starting at the end of the string and working to the front. If maxsplit is given, at most maxsplit splits are done. If sep is not specified, any whitespace string is a separator.

rstrip

S.rstrip([chars]) -> unicode

Return a copy of the string S with trailing whitespace removed. If chars is given and not None, remove characters in chars instead. If chars is a str, it will be converted to unicode before stripping

setCurrent(*args, **kwargs)
This is the long version of the method as it is slightly faster than simply using the StartUndo helper
split

S.split([sep [,maxsplit]]) -> list of strings

Return a list of the words in S, using sep as the delimiter string. If maxsplit is given, at most maxsplit splits are done. If sep is not specified or is None, any whitespace string is a separator and empty strings are removed from the result.

classmethod splitNamespace(objectname)

Cut the namespace from the given name and return a tuple( namespacename, objectname )

Note:method assumes that the namespace starts at the beginning of the object
splitlines

S.splitlines([keepends]) -> list of strings

Return a list of the lines in S, breaking at line boundaries. Line breaks are not included in the resulting list unless keepends is given and true.

startswith

S.startswith(prefix[, start[, end]]) -> bool

Return True if S starts with the specified prefix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. prefix can also be a tuple of strings to try.

strip

S.strip([chars]) -> unicode

Return a copy of the string S with leading and trailing whitespace removed. If chars is given and not None, remove characters in chars instead. If chars is a str, it will be converted to unicode before stripping

substitute(find_in, replacement)
Returns:string with our namespace properly substituted with replacement such that the result is a properly formatted object name ( with or without namespace depending of the value of replacement ) As this method is based on string replacement, self might as well match sub-namespaces if it is relative
Note:if replacement is an empty string, it will effectively cut the matched namespace off the object name
Note:handles replacement of subnamespaces correctly as well
Note:as it operates on strings, the actual namespaces do not need to exist
classmethod substituteNamespace(thisns, find_in, replacement)
Same as substitute, but signature might feel more natural
supports(interface_type)
Returns:True if this instance supports the interface of the given type
Parameter:interface_type – Type of the interface you require this instance to support
Note:Must be used in case you only have a weak reference of your interface instance or proxy which is a case where the ordinary isinstance( obj, iInterface ) will not work
swapcase

S.swapcase() -> unicode

Return a copy of S with uppercase characters converted to lowercase and vice versa.

title

S.title() -> unicode

Return a titlecased version of S, i.e. words start with title case characters, all remaining cased characters have lower case.

toRelative()
Returns:a relative version of self, thus it does not start with a colon
Note:the root namespace cannot be relative - if this is of interest for you, you have to check for it. This method gracefully ignores that fact to make it more convenient to use as one does not have to be afraid of exceptions
translate

S.translate(table) -> unicode

Return a copy of the string S, where all characters have been mapped through the given translation table, which must be a mapping of Unicode ordinals to Unicode ordinals, Unicode strings or None. Unmapped characters are left untouched. Characters mapped to None are deleted.

upper

S.upper() -> unicode

Return a copy of S converted to uppercase.

zfill

S.zfill(width) -> unicode

Pad a numeric string S with zeros on the left, to fill a field of the specified width. The string S is never truncated.

Epydoc: animio.lib

class animio.lib.Path

Bases: str, mrv.interface.iDagItem

Represents a filesystem path.

For documentation on individual methods, consult their counterparts in os.path.

abspath()
access(mode)

Return true if current user has access to this path.

mode - One of the constants os.F_OK, os.R_OK, os.W_OK, os.X_OK

classmethod addSep(item, sep)
Returns:

item with separator added to it ( just once )

Note:

operates best on strings

Parameters:
  • item – item to add separator to
  • sep – the separator
atime()
basename(p)
Returns the final component of a pathname
bytes()
Open this file, read all bytes, return them as a string.
capitalize

S.capitalize() -> string

Return a copy of the string S with only its first character capitalized.

center

S.center(width[, fillchar]) -> string

Return S centered in a string of length width. Padding is done using the specified fill character (default is a space)

children(predicate=<function <lambda> at 0x2b08e713ab18>, pattern=None)
Returns:

child paths as retrieved by queryiing the file system.

Note:

files cannot have children, and willl return an empty array accordingly

Parameters:
  • predicate – return p if predicate( p ) returns True
  • pattern – list only elements that match the given simple pattern i.e. .
childrenDeep(order=1, predicate=<function <lambda> at 0x2b08e713c0c8>)
Returns:

list of all children of path, [ child1 , child2 ]

Parameters:
  • order – order enumeration
  • predicate – returns true if x may be returned
Note:

the child objects returned are supposed to be valid paths, not just relative paths

chmod(mode)

Change file mode

Returns:self
chown(uid, gid)

Change file ownership

Returns:self
chroot()

Change the root directory path

Returns:self
containsvars()
Returns:True if this path contains environment variables
copy(dest)

Copy data and source bits to dest

Returns:Path to dest
copy2(dest)

Shutil.copy2 self to dest

Returns:Path to dest
copyfile(dest)

Copy self to dest

Returns:Path to dest
copymode(dest)

Copy our mode to dest

Returns:Path to dest
copystat(dest)

Copy our stats to dest

Returns:Path to dest
copytree(dest, **kwargs)

Deep copy this file or directory to destination

Parameter:kwargs – passed to shutil.copytree
Returns:Path to dest
count

S.count(sub[, start[, end]]) -> int

Return the number of non-overlapping occurrences of substring sub in string S[start:end]. Optional arguments start and end are interpreted as in slice notation.

ctime()
decode

S.decode([encoding[,errors]]) -> object

Decodes S using the codec registered for encoding. encoding defaults to the default encoding. errors may be given to set a different error handling scheme. Default is ‘strict’ meaning that encoding errors raise a UnicodeDecodeError. Other possible values are ‘ignore’ and ‘replace’ as well as any other name registered with codecs.register_error that is able to handle UnicodeDecodeErrors.

digest(hashobject)

Calculate the hash for this file using the given hashobject. It must support the ‘update’ and ‘digest’ methods.

Note:This reads through the entire file.
dirname()
dirs(pattern=None)

D.dirs() -> List of this directory’s subdirectories.

The elements of the list are path objects. This does not walk recursively into subdirectories (but see path.walkdirs).

With the optional pattern argument, this only lists directories whose names match the given pattern. For example, d.dirs(“build-*”).

drive()
The drive specifier, for example ‘C:’. This is always empty on systems that don’t use drive specifiers.
encode

S.encode([encoding[,errors]]) -> object

Encodes S using the codec registered for encoding. encoding defaults to the default encoding. errors may be given to set a different error handling scheme. Default is ‘strict’ meaning that encoding errors raise a UnicodeEncodeError. Other possible values are ‘ignore’, ‘replace’ and ‘xmlcharrefreplace’ as well as any other name registered with codecs.register_error that is able to handle UnicodeEncodeErrors.

endswith

S.endswith(suffix[, start[, end]]) -> bool

Return True if S ends with the specified suffix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. suffix can also be a tuple of strings to try.

exists()
expand()

Clean up a filename by calling expandvars() and expanduser()

This is commonly everything needed to clean up a filename read from a configuration file, for example.

If you are not interested in trailing slashes, you should call normpath() on the resulting Path as well.

expand_or_raise()
Returns:Copy of self with all variables expanded ( using expand )
Raises ValueError:
 If we could not expand all environment variables as their values where missing in the environment
expandtabs

S.expandtabs([tabsize]) -> string

Return a copy of S where all tab characters are expanded using spaces. If tabsize is not given, a tab size of 8 characters is assumed.

expanduser()
expandvars()
ext()
The file extension, for example ‘.py’.
files(pattern=None)

D.files() -> List of the files in this directory.

The elements of the list are path objects. This does not walk into subdirectories (see path.walkfiles).

With the optional pattern argument, this only lists files whose names match the given pattern. For example, d.files(“*.pyc”).

find

S.find(sub [,start [,end]]) -> int

Return the lowest index in S where substring sub is found, such that sub is contained within s[start:end]. Optional arguments start and end are interpreted as in slice notation.

Return -1 on failure.

fnmatch(pattern)

Return True if self.basename() matches the given pattern.

pattern - A filename pattern with wildcards,
for example “*.py”.
format
S.format(*args, **kwargs) -> unicode
fullChildName(childname)
Add the given name to the string version of our instance :return: string with childname added like name _sep childname
classmethod getcwd()
Returns:the current working directory as a path object.
glob(pattern)

Return a list of path objects that match the pattern.

pattern - a path relative to this directory, with wildcards.

For example, path(‘/users’).glob(‘/bin/‘) returns a list of all the files users have in their bin directories.

index

S.index(sub [,start [,end]]) -> int

Like S.find() but raise ValueError when the substring is not found.

isPartOf(other)
Returns:True if self is a part of other, and thus can be found in other
Note:operates on strings only
isRoot()
Returns:True if this path is the root of the DAG
isRootOf(other)
Returns:True other starts with self
Note:operates on strings
Note:we assume other has the same type as self, thus the same separator
isWritable()
Returns:true if the file can be written to
isabs(s)
Test whether a path is absolute
isalnum

S.isalnum() -> bool

Return True if all characters in S are alphanumeric and there is at least one character in S, False otherwise.

isalpha

S.isalpha() -> bool

Return True if all characters in S are alphabetic and there is at least one character in S, False otherwise.

isdigit

S.isdigit() -> bool

Return True if all characters in S are digits and there is at least one character in S, False otherwise.

isdir()
isfile()
islower

S.islower() -> bool

Return True if all cased characters in S are lowercase and there is at least one cased character in S, False otherwise.

ismount()
isspace

S.isspace() -> bool

Return True if all characters in S are whitespace and there is at least one character in S, False otherwise.

istitle

S.istitle() -> bool

Return True if S is a titlecased string and there is at least one character in S, i.e. uppercase characters may only follow uncased characters and lowercase characters only cased ones. Return False otherwise.

isupper

S.isupper() -> bool

Return True if all cased characters in S are uppercase and there is at least one cased character in S, False otherwise.

iterParents(predicate=<function <lambda> at 0x2b08e713c2a8>)
Returns:generator retrieving all parents up to the root
Parameter:predicate – returns True for all x that you want to be returned
join

S.join(sequence) -> string

Return a string which is the concatenation of the strings in the sequence. The separator between elements is S.

joinpath(*args)
Join two or more path components, adding a separator character (os.sep) if needed. Returns a new path object.
lexists()
lines(encoding=None, errors='strict', retain=True)

Open this file, read all lines, return them in a list.

Optional arguments:
  • encoding: The Unicode encoding (or character set) of

    the file. The default is None, meaning the content of the file is read as 8-bit characters and returned as a list of (non-Unicode) str objects.

  • errors: How to handle Unicode errors; see help(str.decode)

    for the options. Default is ‘strict’

  • retain: If true, retain newline characters; but all newline

    character combinations (“r”, “n”, “rn”) are translated to “n”. If false, newline characters are stripped off. Default is True.

This uses “U” mode in Python 2.3 and later.

Create a hard link at ‘newpath’, pointing to this file.

Returns:Path to newpath
listdir(pattern=None)

return list of items in this directory.

Use D.files() or D.dirs() instead if you want a listing of just files or just subdirectories.

The elements of the list are path objects.

With the optional ‘pattern’ argument, this only lists items whose names match the given pattern.

ljust

S.ljust(width[, fillchar]) -> string

Return S left-justified in a string of length width. Padding is done using the specified fill character (default is a space).

lower

S.lower() -> string

Return a copy of the string S converted to lowercase.

lstat()
Like path.stat(), but do not follow symbolic links.
lstrip

S.lstrip([chars]) -> string or unicode

Return a copy of the string S with leading whitespace removed. If chars is given and not None, remove characters in chars instead. If chars is unicode, S will be converted to unicode before stripping

makedirs(mode=511)

Smarter makedir, see os.makedirs

Returns:self
mkdir(mode=511)

Make this directory, fail if it already exists

Returns:self
move(dest)

Move self to dest

Returns:Path to dest
mtime()
namebase()

The same as path.basename(), but with one file extension stripped off.

For example, path(‘/home/guido/python.tar.gz’).name == ‘python.tar.gz’, but path(‘/home/guido/python.tar.gz’).namebase == ‘python.tar’

normcase()
normpath()
open(*args, **kwargs)
Open this file. Return a file object.
owner()

Return the name of the owner of this file or directory.

This follows symbolic links.

On Windows, this returns a name of the form ur’DOMAINUser Name’. On Windows, a group can own a file or directory.

parent()
Returns:the parent directory of this Path or None if this is the root
parentDeep()
Returns:all parents of this path, ‘/hello/my/world’ -> [ ‘/hello/my’,’/hello’ ]
partition

S.partition(sep) -> (head, sep, tail)

Search for the separator sep in S, and return the part before it, the separator itself, and the part after it. If the separator is not found, return S and two empty strings.

pathconf(name)
see os.pathconf

Return the path to which this symbolic link points.

The result may be an absolute or a relative path.

readlinkabs()

Return the path to which this symbolic link points.

The result is always an absolute path.

realpath()
relpath()
Return this path as a relative path, originating from the current working directory.
relpathfrom(dest)
Return a relative path from dest to self
relpathto(dest)

Return a relative path from self to dest.

If there is no relative path from self to dest, for example if they reside on different drives in Windows, then this returns dest.abspath().

remove()

Remove this file

Returns:self
removedirs()

see os.removedirs

Returns:self
rename(new)

os.rename

Returns:Path to new file
renames(new)

os.renames, super rename

Returns:Path to new file
replace

S.replace (old, new[, count]) -> string

Return a copy of string S with all occurrences of substring old replaced by new. If the optional argument count is given, only the first count occurrences are replaced.

rfind

S.rfind(sub [,start [,end]]) -> int

Return the highest index in S where substring sub is found, such that sub is contained within s[start:end]. Optional arguments start and end are interpreted as in slice notation.

Return -1 on failure.

rindex

S.rindex(sub [,start [,end]]) -> int

Like S.rfind() but raise ValueError when the substring is not found.

rjust

S.rjust(width[, fillchar]) -> string

Return S right-justified in a string of length width. Padding is done using the specified fill character (default is a space)

rmdir()

Remove this empty directory

Returns:self
rmtree(**kwargs)

Remove self recursively

Parameter:kwargs – passed to shutil.rmtree
Returns:self
root()
Returns:the root of the DAG - it has no further parents
rpartition

S.rpartition(sep) -> (tail, sep, head)

Search for the separator sep in S, starting at the end of S, and return the part before it, the separator itself, and the part after it. If the separator is not found, return two empty strings and S.

rsplit

S.rsplit([sep [,maxsplit]]) -> list of strings

Return a list of the words in the string S, using sep as the delimiter string, starting at the end of the string and working to the front. If maxsplit is given, at most maxsplit splits are done. If sep is not specified or is None, any whitespace string is a separator.

rstrip

S.rstrip([chars]) -> string or unicode

Return a copy of the string S with trailing whitespace removed. If chars is given and not None, remove characters in chars instead. If chars is unicode, S will be converted to unicode before stripping

samefile(other)
setutime(times)

Set the access and modified times of this file.

Returns:self
size()
split

S.split([sep [,maxsplit]]) -> list of strings

Return a list of the words in the string S, using sep as the delimiter string. If maxsplit is given, at most maxsplit splits are done. If sep is not specified or is None, any whitespace string is a separator and empty strings are removed from the result.

splitall()

Return a list of the path components in this path.

The first item in the list will be a path. Its value will be either os.curdir, os.pardir, empty, or the root directory of this path (for example, ‘/’ or ‘C:’). The other items in the list will be strings.

path.path.joinpath(*result) will yield the original path.

splitdrive()

p.splitdrive() -> Return (p.drive, <the rest of p>).

Split the drive specifier from this path. If there is no drive specifier, p.drive is empty, so the return value is simply (path(‘’), p). This is always the case on Unix.

splitext()

p.splitext() -> Return (p.stripext(), p.ext).

Split the filename extension from this path and return the two parts. Either part may be empty.

The extension is everything from ‘.’ to the end of the last path segment. This has the property that if (a, b) == p.splitext(), then a + b == p.

splitlines

S.splitlines([keepends]) -> list of strings

Return a list of the lines in S, breaking at line boundaries. Line breaks are not included in the resulting list unless keepends is given and true.

splitpath()
p.splitpath() -> Return (p.parent(), p.basename()).
startswith

S.startswith(prefix[, start[, end]]) -> bool

Return True if S starts with the specified prefix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. prefix can also be a tuple of strings to try.

stat()
Perform a stat() system call on this path.
statvfs()
Perform a statvfs() system call on this path.
strip

S.strip([chars]) -> string or unicode

Return a copy of the string S with leading and trailing whitespace removed. If chars is given and not None, remove characters in chars instead. If chars is unicode, S will be converted to unicode before stripping

stripext()

p.stripext() -> Remove one file extension from the path.

For example, path(‘/home/guido/python.tar.gz’).stripext() returns path(‘/home/guido/python.tar’).

supports(interface_type)
Returns:True if this instance supports the interface of the given type
Parameter:interface_type – Type of the interface you require this instance to support
Note:Must be used in case you only have a weak reference of your interface instance or proxy which is a case where the ordinary isinstance( obj, iInterface ) will not work
swapcase

S.swapcase() -> string

Return a copy of the string S with uppercase characters converted to lowercase and vice versa.

Create a symbolic link at ‘newlink’, pointing here.

Returns:Path to newlink
text(encoding=None, errors='strict')

Open this file, read it in, return the content as a string.

This uses “U” mode in Python 2.3 and later, so “rn” and “r” are automatically translated to ‘n’.

Optional arguments:
  • encoding - The Unicode encoding (or character set) of the file. If present, the content of the file is decoded and returned as a unicode object; otherwise it is returned as an 8-bit str.
  • errors - How to handle Unicode errors; see help(str.decode) for the options. Default is ‘strict’.
title

S.title() -> string

Return a titlecased version of S, i.e. words start with uppercase characters, all remaining cased characters have lowercase.

tonative()

Convert the path separator to the type required by the current operating system - on windows / becomes and on linux becomes /

Returns:native version of self
touch(flags=65, mode=438)

Set the access/modified times of this file to the current time. Create the file if it does not exist.

Returns:self
translate

S.translate(table [,deletechars]) -> string

Return a copy of the string S, where all characters occurring in the optional argument deletechars are removed, and the remaining characters have been mapped through the given translation table, which must be a string of length 256.

unlink this file

Returns:self
upper

S.upper() -> string

Return a copy of the string S converted to uppercase.

walk(pattern=None, errors='strict', predicate=<function <lambda> at 0x2b08e713dcf8>)

create iterator over files and subdirs, recursively.

The iterator yields path objects naming each child item of this directory and its descendants.

It performs a depth-first traversal of the directory tree. Each directory is returned just before all its children.

Parameters:
  • pattern – fnmatch compatible pattern or None
  • errors – controls behavior when an error occurs. The default is ‘strict’, which causes an exception. The other allowed values are ‘warn’, which reports the error via log.warn(), and ‘ignore’.
  • predicate – returns True for each Path p to be yielded by iterator
walkdirs(pattern=None, errors='strict', predicate=<function <lambda> at 0x2b08e713dde8>)
D.walkdirs() -> iterator over subdirs, recursively. see walk for a parameter description
walkfiles(pattern=None, errors='strict', predicate=<function <lambda> at 0x2b08e713ded8>)
D.walkfiles() -> iterator over files in D, recursively. see walk for a parameter description
write_bytes(bytes, append=False)

Open this file and write the given bytes to it.

Default behavior is to overwrite any existing file. Call p.write_bytes(bytes, append=True) to append instead. :return: self

write_lines(lines, encoding=None, errors='strict', linesep='n', append=False)

Write the given lines of text to this file.

By default this overwrites any existing file at this path.

This puts a platform-specific newline sequence on every line. See ‘linesep’ below.

lines - A list of strings.

encoding - A Unicode encoding to use. This applies only if
‘lines’ contains any Unicode strings.
errors - How to handle errors in Unicode encoding. This
also applies only to Unicode strings.
linesep - The desired line-ending. This line-ending is
applied to every line. If a line already has any standard line ending, that will be stripped off and this will be used instead. The default is os.linesep, which is platform-dependent (‘rn’ on Windows, ‘n’ on Unix, etc.) Specify None to write the lines as-is, like file.writelines().

Use the keyword argument append=True to append lines to the file. The default is to overwrite the file. Warning: When you use this with Unicode data, if the encoding of the existing data in the file is different from the encoding you specify with the encoding= parameter, the result is mixed-encoding data, which can really confuse someone trying to read the file later.

Returns:self
write_text(text, encoding=None, errors='strict', linesep='n', append=False)

Write the given text to this file.

The default behavior is to overwrite any existing file; to append instead, use the ‘append=True’ keyword argument.

There are two differences between path.write_text() and path.write_bytes(): newline handling and Unicode handling. See below.

Parameters:
  • text - str/unicode - The text to be written.

  • encoding - str - The Unicode encoding that will be used.

    This is ignored if ‘text’ isn’t a Unicode string.

  • errors - str - How to handle Unicode encoding errors.

    Default is ‘strict’. See help(unicode.encode) for the options. This is ignored if ‘text’ isn’t a Unicode string.

  • linesep - keyword argument - str/unicode - The sequence of

    characters to be used to mark end-of-line. The default is os.linesep. You can also specify None; this means to leave all newlines as they are in ‘text’.

  • append - keyword argument - bool - Specifies what to do if

    the file already exists (True: append to the end of it; False: overwrite it.) The default is False.

Newline handling:
  • write_text() converts all standard end-of-line sequences

    (“n”, “r”, and “rn”) to your platforms default end-of-line sequence (see os.linesep; on Windows, for example, the end-of-line marker is “rn”).

  • If you don’t like your platform’s default, you can override it

    using the “linesep=” keyword argument. If you specifically want write_text() to preserve the newlines as-is, use “linesep=None”.

  • This applies to Unicode text the same as to 8-bit text, except

    there are additional standard Unicode end-of-line sequences, check the code to see them.

  • (This is slightly different from when you open a file for

    writing with fopen(filename, “w”) in C or file(filename, “w”) in Python.)

Unicode:

If “text” isn’t Unicode, then apart from newline handling, the bytes are written verbatim to the file. The “encoding” and ‘errors’ arguments are not used and must be omitted.

If ‘text’ is Unicode, it is first converted to bytes using the specified ‘encoding’ (or the default encoding if ‘encoding’ isn’t specified). The ‘errors’ argument applies only to this conversion.

Returns:self
zfill

S.zfill(width) -> string

Pad a numeric string S with zeros on the left, to fill a field of the specified width. The string S is never truncated.

Epydoc: animio.lib

class animio.lib.Scene

Bases: mrv.util.Singleton, mrv.util.EventSender

Singleton Class allowing access to the maya scene

You can register all events available in MSceneMessage easily usnig the following syntax:

>>> scene.kBeforeSoftwareRender = myFunctionObject
afterCreateReference
Implements Scene Callbacks
afterExport
Implements Scene Callbacks
afterExportReference
Implements Scene Callbacks
afterImport
Implements Scene Callbacks
afterImportReference
Implements Scene Callbacks
afterLoadReference
Implements Scene Callbacks
afterNew
Implements Scene Callbacks
afterOpen
Implements Scene Callbacks
afterPluginLoad
Implements Scene Callbacks
afterPluginUnload
Implements Scene Callbacks
afterReference
Implements Scene Callbacks
afterRemoveReference
Implements Scene Callbacks
afterSave
Implements Scene Callbacks
afterSoftwareFrameRender
Implements Scene Callbacks
afterSoftwareRender
Implements Scene Callbacks
afterUnloadReference
Implements Scene Callbacks
beforeCreateReference
Implements Scene Callbacks
beforeCreateReferenceCheck
Implements Scene Callbacks
beforeExport
Implements Scene Callbacks
beforeExportCheck
Implements Scene Callbacks
beforeExportReference
Implements Scene Callbacks
beforeImport
Implements Scene Callbacks
beforeImportCheck
Implements Scene Callbacks
beforeImportReference
Implements Scene Callbacks
beforeLoadReference
Implements Scene Callbacks
beforeLoadReferenceCheck
Implements Scene Callbacks
beforeNew
Implements Scene Callbacks
beforeNewCheck
Implements Scene Callbacks
beforeOpen
Implements Scene Callbacks
beforeOpenCheck
Implements Scene Callbacks
beforePluginLoad
Implements Scene Callbacks
beforePluginUnload
Implements Scene Callbacks
beforeReference
Implements Scene Callbacks
beforeReferenceCheck
Implements Scene Callbacks
beforeRemoveReference
Implements Scene Callbacks
beforeSave
Implements Scene Callbacks
beforeSaveCheck
Implements Scene Callbacks
beforeSoftwareFrameRender
Implements Scene Callbacks
beforeSoftwareRender
Implements Scene Callbacks
beforeUnloadReference
Implements Scene Callbacks
clearAllEvents()

Remove all event receivers for all events registered in this instance.

Note:This usually doesn’t need to be called directly, but might be useful in conjunction with other system that do not release your strongly bound instance
classmethod deleteUnknownNodes()

Deletes all unknown nodes in the scene

Note:only do this if you are about to change the type of the scene during save or export - otherwise the operation would fail if there are still unknown nodes in the scene
classmethod export(outputFile, nodeListOrIterable=None, **kwargs)

Export the given nodes or everything into the file at path

Parameters:
  • outputFile – Path object or path string to which the data should be written to. Parent directories will be created as needed
  • nodeListOrIterable – if None, everything will be exported. Otherwise it may be an MSelectionList ( recommended ), or a list of Nodes, MObjects or MDagPaths
  • kwargs – passed to cmds.file, see the mel docs for modifying flags
Returns:

Path to which the data was exported

classmethod isModified()
last
Implements Scene Callbacks
classmethod listEventNames()
Returns:list of event ids that exist on our class
mayaExiting
Implements Scene Callbacks
mayaInitialized
Implements Scene Callbacks
classmethod name()
classmethod new(force=False, **kwargs)

Create a new scene

Parameters:
  • force – if True, the new scene will be created even though there are unsaved modifications
  • kwargs – passed to cmds.file
Returns:

Path with name of the new file

classmethod open(scenepath=None, force=False, **kwargs)

Open the scene at the given scenepath

Parameters:
  • scenepath – The path to the file to be opened If None, the currently loaded file will reopened
  • force – if True, the new scene will be loaded although currently loaded contains unsaved changes
  • kwargs – passed to cmds.file
Returns:

a Path to the loaded scene

classmethod rename(scenepath)

Rename the currently loaded file to be the file at scenepath

Parameter:scenepath – string or Path pointing describing the new location of the scene.
Returns:Path to scenepath
Note:as opposed to the normal file -rename it will also adjust the extension
Raises RuntimeError:
 if the scene’s extension is not supported.
classmethod save(scenepath=None, autodeleteUnknown=False, **kwargs)

Save the currently opened scene under scenepath in the respective format

Parameters:
  • scenepath – if None, the currently opened scene will be saved, otherwise the name will be changed. Paths leading to the file will automatically be created.
  • autodeleteUnknown – if true, unknown nodes will automatically be deleted before an attempt is made to change the maya file’s type
  • kwargs – passed to cmds.file
Returns:

Path at which the scene has been saved.

sceneUpdate
Implements Scene Callbacks
sender()
Returns:instance which sent the event you are currently processing
Raises ValueError:
 if no event is currently in progress
softwareRenderInterrupted
Implements Scene Callbacks

Epydoc: animio.lib

class animio.lib.UndoRecorder

Bases: object

Utility class allowing to undo and redo operations on the python command stack so far to be undone and redone separately and independently of maya’s undo queue.

It can be used to define sections that need to be undone afterwards, for example to reset a scene to its original state after it was prepared for export.

Use the startRecording method to record all future undoable operations onto the stack. stopRecording will finalize the operation, allowing the undo and redo methods to be used.

If you never call startRecording, the instance does not do anything. If you call startRecording and stopRecording but do not call undo, it will integrate itself transparently with the default undo queue.

Note:as opposed to undoAndClear, this utility may be used even if the user is not at the very beginning of an undoable operation.
Note:If this utility is used incorrectly, the undo queue will be in an inconsistent state which may crash maya or cause unexpected behaviour
Note:You may not interleave the start/stop recording areas of different instances which could happen easily in recursive calls.
doIt()
Called only if the user didn’t call undo
redo()
Redo all stored operations after they have been undone :raise AssertionError: if called before stopRecording
startRecording()

Start recording all future undoable commands onto this stack. The previous stack will be safed and restored once this class gets destroyed or once stopRecording gets called.

Note:this method may only be called once, subsequent calls have no effect
Note:This will forcibly enable the undo queue if required until stopRecording is called.
stopRecording()

Stop recording of undoable comamnds and restore the previous command stack. The instance is now ready to undo and redo the recorded commands

Note:this method may only be called once, subsequent calls have no effect
undo()

Undo all stored operations

Note:Must be called at the right time, otherwise the undo queue is in an inconsistent state.
Note:If this method is never being called, the undo-stack will undo itself as part of mayas undo queue, and thus behaves transparently
Raises AssertionError:
 if called before stopRecording as called
undoIt()
called only if the user didnt call undo

Table Of Contents

Previous topic

animio.ui

Next topic

animio.info

This Page