diff --git a/Packages/vcs/Lib/VTKAnimate.py b/Packages/vcs/Lib/VTKAnimate.py index ff1cee03bc..15c70ea95e 100644 --- a/Packages/vcs/Lib/VTKAnimate.py +++ b/Packages/vcs/Lib/VTKAnimate.py @@ -100,7 +100,7 @@ def run(self): while not self.is_stopped(): self.wait_if_paused() - self.controller.draw_frame(allow_static = True, render_offscreen = False, main_window_png = True) + self.controller.draw_frame(allow_static = False, render_offscreen = False, main_window_png = False) self.controller.frame_num += 1 if self.controller.frame_num >= self.controller.number_of_frames(): @@ -258,7 +258,7 @@ def draw_frame(self, frame_num = None, render_offscreen=True, allow_static=True, else: self.reclaim_renderers() - update_input(self.vcs_self, self._number_of_dims_used_for_plot, frame_num) + update_input(self.vcs_self, self._number_of_dims_used_for_plot, frame_num, update=False) self.vcs_self.backend.renWin.Render() diff --git a/Packages/vcs/Lib/configurator.py b/Packages/vcs/Lib/configurator.py index 0aba4bbaa5..0f7edda952 100644 --- a/Packages/vcs/Lib/configurator.py +++ b/Packages/vcs/Lib/configurator.py @@ -164,6 +164,7 @@ def __init__(self, canvas): self.save_timer = None self.save_listener = None self.save_anim_button = None + self.anim_button = None self.listeners = [] self.animation_last_frame_time = datetime.datetime.now() # Map custom templates to their source template @@ -541,7 +542,7 @@ def setup_animation(self): if self.initialized == False: self.canvas.animate.create() anim_toolbar = self.toolbar.add_toolbar("Animation") - anim_toolbar.add_toggle_button("Animation", on=self.start_animating, off=self.stop_animating, on_prefix="Run", off_prefix="Stop") + self.anim_button = anim_toolbar.add_toggle_button("Animation", on=self.start_animating, off=self.stop_animating, on_prefix="Run", off_prefix="Stop") anim_toolbar.add_button(["Step Forward"], action=self.step_forward) anim_toolbar.add_button(["Step Backward"], action=self.step_back) anim_toolbar.add_slider_button(0, 0, self.canvas.animate.number_of_frames(), "Time Slider", update=self.set_animation_frame, end=self.final_animation_frame) @@ -557,6 +558,9 @@ def step_back(self, state): def save_animation_press(self, state): if state == 1: + if self.animation_timer: + self.stop_animating() + self.anim_button.set_state(0) self.save_listener = self.interactor.AddObserver("TimerEvent", self.save_tick) self.save_timer = self.interactor.CreateRepeatingTimer(10) else: @@ -623,7 +627,7 @@ def set_animation_speed(self, value): def animate(self, obj, event): if self.animation_timer is not None and datetime.datetime.now() - self.animation_last_frame_time > datetime.timedelta(0, 0, 0, int(.9 * 1000. / self.animation_speed)): self.animation_last_frame_time = datetime.datetime.now() - self.canvas.animate.draw_frame((self.canvas.animate.frame_num + 1) % self.canvas.animate.number_of_frames()) + self.canvas.animate.draw_frame((self.canvas.animate.frame_num + 1) % self.canvas.animate.number_of_frames(), render_offscreen=False, allow_static=False) def start_animating(self): if self.animation_timer is None: @@ -633,7 +637,6 @@ def stop_animating(self): if self.animation_timer is not None: t, self.animation_timer = self.animation_timer, None self.interactor.DestroyTimer(t) - self.canvas.animate.draw_frame(allow_static = False, render_offscreen = False) def set_animation_frame(self, value): value = int(value)