+class ApplyCommandStack (PlaylistCommand):
+ """Apply a :class:`~hooke.command_stack.CommandStack` to each
+ curve in a playlist.
+
+ TODO: discuss `evaluate`.
+ """
+ def __init__(self, plugin):
+ super(ApplyCommandStack, self).__init__(
+ name='apply command stack',
+ arguments=[
+ Argument(name='commands', type='command stack', optional=False,
+ help="""
+Command stack to apply to each curve.
+""".strip()),
+ Argument(name='evaluate', type='bool', default=False,
+ help="""
+Evaluate the applied command stack immediately.
+""".strip()),
+ ],
+ help=self.__doc__, plugin=plugin)
+
+ def _run(self, hooke, inqueue, outqueue, params):
+ if len(params['commands']) == 0:
+ return
+ p = self._playlist(hooke, params)
+ if params['evaluate'] == True:
+ for curve in p.items():
+ for command in params['commands']:
+ curve.command_stack.execute_command(hooke, command)
+ curve.command_stack.append(command)
+ else:
+ for curve in p:
+ curve.command_stack.extend(params['commands'])
+ curve.unload() # force command stack execution on next access.
+
+
+class FilterCommand (PlaylistAddingCommand, PlaylistCommand):