Skip to content

Commit

Permalink
postproc.py: new --parallel-projection option
Browse files Browse the repository at this point in the history
- update Viewer.call_mlab(), .render_scene()
  • Loading branch information
jalogik authored and rc committed May 7, 2015
1 parent 547df56 commit 9c37efe
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
6 changes: 6 additions & 0 deletions postproc.py
Expand Up @@ -104,6 +104,8 @@
'[default: if --3d is True: "45,45", else: "0,0"]',
'roll' :
'camera roll angle [default: %default]',
'parallel_projection' :
'use parallel projection',
'fgcolor' :
'foreground color, that is the color of all text annotation labels'
' (axes, orientation axes, scalar bar labels) [default: %default]',
Expand Down Expand Up @@ -244,6 +246,7 @@ def view_file(filename, filter_names, options, view=None):

view(show=options.show, is_3d=options.is_3d, view=options.view,
roll=options.roll,
parallel_projection=options.parallel_projection,
fgcolor=options.fgcolor, bgcolor=options.bgcolor,
layout=options.layout,
scalar_mode=options.scalar_mode,
Expand Down Expand Up @@ -335,6 +338,9 @@ def main():
group.add_option('--roll', type='float', metavar='angle',
action='store', dest='roll',
default=0.0, help=help['roll'])
group.add_option('--parallel-projection', metavar='parallel_projection',
action='store_true', dest='parallel_projection',
default=False, help=help['parallel_projection'])
group.add_option('--fgcolor', metavar='R,G,B',
action='store', dest='fgcolor',
default='0.0,0.0,0.0', help=help['fgcolor'])
Expand Down
5 changes: 4 additions & 1 deletion sfepy/postprocess/viewer.py
Expand Up @@ -673,6 +673,7 @@ def render_scene(self, scene, options):
self.build_mlab_pipeline(**options)
self.source.update() # Force source update to see e.g. streamlines.
scene.scene.reset_zoom()
scene.scene.camera.parallel_projection = options['parallel_projection']

view = options['view']
if view is None:
Expand Down Expand Up @@ -718,7 +719,7 @@ def call_empty(self, *args, **kwargs):
pass

def call_mlab(self, scene=None, show=True, is_3d=False,
view=None, roll=None,
view=None, roll=None, parallel_projection=False,
fgcolor=(0.0, 0.0, 0.0), bgcolor=(1.0, 1.0, 1.0),
layout='rowcol', scalar_mode='iso_surface',
vector_mode='arrows_norm', rel_scaling=None, clamping=False,
Expand All @@ -745,6 +746,8 @@ def call_mlab(self, scene=None, show=True, is_3d=False,
`mlab.view()`.
roll : float
Roll angle tuple as in mlab.roll().
parallel_projection: bool
If True, use parallel projection.
fgcolor : tuple of floats (R, G, B)
The foreground color, that is the color of all text
annotation labels (axes, orientation axes, scalar bar
Expand Down

0 comments on commit 9c37efe

Please sign in to comment.