Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Packages/vcs/Lib/VTKAnimate.py
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand Down Expand Up @@ -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()

Expand Down
9 changes: 6 additions & 3 deletions Packages/vcs/Lib/configurator.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand All @@ -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:
Expand Down Expand Up @@ -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:
Expand All @@ -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)
Expand Down