Package animio :: Module lib :: Class AnimationHandle
[hide private]
[frames] | no frames]

Class AnimationHandle

source code

mrv.maya.nt.Network --+
                      |
                     AnimationHandle

Instance Methods [hide private]
 
__new__(cls, *args) source code
    Iteration
 
iter_animation(self, asNode=True)
Returns: iterator yielding managed animation curves as wrapped Node or MObject
source code
 
iter_assignments(self, predicate=None, converter=None)
Returns: iterator yielding source-target assignments as plugs in a tuple(source_plug, target_plug)
source code
    Edit
 
clear(self)
Forget our managed animation completely
source code
 
set_animation(self, iter_nodes)
The previous animation information will be removed.
source code
 
apply_animation(self, converter=None)
respective target plugs
source code
    Utilities
 
paste_animation(self, sTimeRange=tuple(), tTimeRange=tuple(), option="fitInsert", predicate=None, converter=None)
paste the stored animation to their respective target animation curves, if target does not exist it will be created :param sTimeRange: tuple of timerange passed to copyKey :param tTimeRange: tuple of timerange passed to pasteKey :param option: option on how to paste forwarded to pasteKey (useful: "fitInsert", "fitReplace", "scaleInsert", "scaleReplace") :param predicate and converter: passed to iter_assignments, see documentation there :todo: handle if range is out of curve (error:nothing to paste from) - should paste the pose in this range
source code
    File IO
 
to_file(self, output_file, **kwargs)
export the AnimationHandle and all managed nodes to the given file
source code
 
delete(self)
AnimationHandle will disapear without a trace, no matter if it was created in the current file or if it came from a referenced file
source code
Class Methods [hide private]
 
_is_handle(cls, ah)
Returns: True if ah in a propper AnimationHandle
source code
    Iteration
 
iter_instances(cls, **kwargs)
Returns: iterator yielding AnimationHandle instances of scene
source code
    Edit
 
create(cls, name="animationHandle", **kwargs)
Returns: New instance of our type providing the AnimationHandle interface
source code
    File IO
 
from_file(cls, input_file)
FileReference as well as an iterator yielding AmimationHandles of input_file
source code
Class Variables [hide private]
  __mrv_virtual_subtype__ = True
  _l_connection_info_attr = 'connectionInfo'
  _s_connection_info_attr = 'cifo'
  _k_separator = ','
  _networktype = nt.api.MFn.kAffect
Method Details [hide private]

_is_handle(cls, ah)
Class Method

source code 
Returns:
True if ah in a propper AnimationHandle

iter_instances(cls, **kwargs)
Class Method

source code 
Returns:
iterator yielding AnimationHandle instances of scene

iter_animation(self, asNode=True)

source code 
Parameters:
  • asNode - if true, iterator yields Node instances else MObjects
Returns:
iterator yielding managed animation curves as wrapped Node or MObject

iter_assignments(self, predicate=None, converter=None)

source code 
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
Returns:
iterator yielding source-target assignments as plugs in a tuple(source_plug, target_plug)

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

create(cls, name="animationHandle", **kwargs)
Class Method

source code 
Parameters:
  • kwargs - Passed to createNode method of mrv
Returns:
New instance of our type providing the AnimationHandle interface
Decorators:
  • @undoable

clear(self)

source code 
Forget our managed animation completely
Decorators:
  • @undoable

set_animation(self, iter_nodes)

source code 
Set this handle to manage the animation of the given nodes.
The previous animation information will be removed.
Parameters:
  • iter_nodes - MSelectionList or iterable of Nodes or api objects pointing to nodes connected to animation.
Decorators:
  • @undoable
Notes:
  • Will not raise if the nodes do not have any animation
  • Heavily optimized for speed, hence we work directly with the apiObjects, skipping the mrv layer as we are in a tight loop here

apply_animation(self, converter=None)

source code 
Apply the stored animation by (re)connecting the animation nodes to their
respective target plugs
Decorators:
  • @undoable

Note: Will break existing destination connections

paste_animation(self, sTimeRange=tuple(), tTimeRange=tuple(), option="fitInsert", predicate=None, converter=None)

source code 
paste the stored animation to their respective target animation curves, if target does not exist it will be created :param sTimeRange: tuple of timerange passed to copyKey :param tTimeRange: tuple of timerange passed to pasteKey :param option: option on how to paste forwarded to pasteKey (useful: "fitInsert", "fitReplace", "scaleInsert", "scaleReplace") :param predicate and converter: passed to iter_assignments, see documentation there :todo: handle if range is out of curve (error:nothing to paste from) - should paste the pose in this range
Decorators:
  • @undoable

from_file(cls, input_file)
Class Method

source code 
references imput_file into scene by using an unique namespace, returning
FileReference as well as an iterator yielding AmimationHandles of input_file
Parameters:
  • input_file - valid path to a maya file
Returns:
tuple(FileReference, iterator of AnimationHandles)
Decorators:
  • @notundoable

to_file(self, output_file, **kwargs)

source code 
export the AnimationHandle and all managed nodes to the given file
Parameters:
  • output_file - Path object or path string to export file. Parent directories will be created as needed
  • kwargs - passed to the Scene.export method
Returns:
path to exported file
Decorators:
  • @notundoable