Commit d54de331 authored by Matt Clarkson's avatar Matt Clarkson

Issue #96: Add flag to control whether camera resets when models added.

parent 75b7da22
......@@ -50,13 +50,15 @@ class VTKOverlayWindow(QVTKRenderWindowInteractor):
:param clipping_range: Near/Far clipping range.
:param aspect_ratio: Relative physical size of pixels, as x/y.
:param zbuffer: if True, will only render zbuffer of main renderer.
:param reset_camera: If True, will reset camera when a new model is added.
"""
def __init__(self,
offscreen=False,
camera_matrix=None,
clipping_range=(1, 1000),
aspect_ratio=1,
zbuffer=False
zbuffer=False,
reset_camera=True
):
"""
Constructs a new VTKOverlayWindow.
......@@ -73,6 +75,7 @@ class VTKOverlayWindow(QVTKRenderWindowInteractor):
self.clipping_range = clipping_range
self.aspect_ratio = aspect_ratio
self.zbuffer = zbuffer
self.reset_camera = reset_camera
self.input = np.ones((400, 400, 3), dtype=np.uint8)
self.rgb_frame = None
......@@ -331,7 +334,9 @@ class VTKOverlayWindow(QVTKRenderWindowInteractor):
for model in models:
renderer.AddActor(model.actor)
renderer.ResetCamera()
if self.reset_camera:
renderer.ResetCamera()
def add_vtk_actor(self, actor, layer=1):
"""
......@@ -354,7 +359,9 @@ class VTKOverlayWindow(QVTKRenderWindowInteractor):
raise ValueError("Invalid layer specified")
renderer.AddActor(actor)
renderer.ResetCamera()
if self.reset_camera:
renderer.ResetCamera()
def get_foreground_renderer(self):
"""
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment