Skip to content

Commit

Permalink
Merge pull request #186 from christianbrodbeck/parallel_scale
Browse files Browse the repository at this point in the history
FIX toggle_render:  store camera parallel_scale
  • Loading branch information
larsoner committed May 18, 2017
2 parents 80f64e2 + 4f631d1 commit f94bea2
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions surfer/viz.py
Original file line number Diff line number Diff line change
Expand Up @@ -518,22 +518,25 @@ def data_dict(self):
# HELPERS
def _toggle_render(self, state, views=None):
"""Turn rendering on (True) or off (False)"""
figs = []
[figs.extend(f) for f in self._figures]
figs = [fig for fig_row in self._figures for fig in fig_row]
if views is None:
views = [None] * len(figs)
for vi, (_f, view) in enumerate(zip(figs, views)):
# Testing backend doesn't have these options
if mlab.options.backend == 'test':
continue

if state is False and view is None:
views[vi] = mlab.view(figure=_f)
views[vi] = (mlab.view(figure=_f),
_f.scene.camera.parallel_scale)

# Testing backend doesn't have this option
if mlab.options.backend != 'test':
_f.scene.disable_render = not state
_f.scene.disable_render = not state

if state is True and view is not None:
mlab.draw(figure=_f)
with warnings.catch_warnings(record=True): # traits focalpoint
mlab.view(*view, figure=_f)
mlab.view(*view[0], figure=_f)
_f.scene.camera.parallel_scale = view[1]
# let's do the ugly force draw
if state is True:
_force_render(self._figures, self._window_backend)
Expand Down

0 comments on commit f94bea2

Please sign in to comment.