- added a new setting in Preferences ("3D compatibility") controlled by a checkbox. If the checkbox is checked then multithreading is disabled for the 3D mode (lower performance but perhaps more compatibility, especially for Linux) - this was done from the research done by Matti Eiden on bitbucket

This commit is contained in:
Marius Stanciu
2022-09-25 05:44:43 +03:00
committed by Marius
parent 565c839460
commit 9b08191660
7 changed files with 25 additions and 7 deletions

View File

@@ -230,7 +230,7 @@ class ShapeGroup(object):
class ShapeCollectionVisual(CompoundVisual):
def __init__(self, linewidth=1, triangulation='vispy', layers=3, pool=None, **kwargs):
def __init__(self, linewidth=1, triangulation='vispy', layers=3, pool=None, fcoptions=None, **kwargs):
"""
Represents collection of shapes to draw on VisPy scene
:param linewidth: float
@@ -244,6 +244,8 @@ class ShapeCollectionVisual(CompoundVisual):
Each layer adds 2 visuals on VisPy scene. Be careful: more layers cause less fps
:param kwargs:
"""
self.fc_options = fcoptions
self.data = {}
self.last_key = -1
@@ -329,11 +331,14 @@ class ShapeCollectionVisual(CompoundVisual):
if linewidth:
self._line_width = linewidth
# Add data to process pool if pool exists
try:
self.results[key] = self.pool.map_async(_update_shape_buffers, [self.data[key]])
except Exception:
if self.fc_options and self.fc_options["global_graphic_engine_3d_no_mp"] is True:
self.data[key] = _update_shape_buffers(self.data[key])
else:
# Add data to process pool if pool exists
try:
self.results[key] = self.pool.map_async(_update_shape_buffers, [self.data[key]])
except Exception:
self.data[key] = _update_shape_buffers(self.data[key])
if update:
self.redraw() # redraw() waits for pool process end