- small changes in the VisPyVisuals that should improve a bit the performance

This commit is contained in:
Marius Stanciu
2021-10-30 14:10:48 +03:00
committed by Marius
parent 3e916f4e09
commit b309a14929
2 changed files with 21 additions and 3 deletions

View File

@@ -292,8 +292,21 @@ class ShapeCollectionVisual(CompoundVisual):
self.key_lock.release()
# Prepare data for translation
self.data[key] = {'geometry': shape, 'color': color, 'alpha': alpha, 'face_color': face_color,
'visible': visible, 'layer': layer, 'tolerance': tolerance}
self.data[key] = {
'geometry': shape,
'color': color,
'alpha': alpha,
'face_color': face_color,
'visible': visible,
'layer': layer,
'tolerance': tolerance,
# the following keys are updated in the _update_shape_buffers() method
'mesh_vertices': [], # Vertices for mesh
'mesh_tris': [], # Faces for mesh
'mesh_colors': [], # Face colors
'line_pts': [], # Vertices for line
'line_colors': [] # Line colors
}
if linewidth:
self._line_width = linewidth
@@ -497,7 +510,7 @@ class ShapeCollectionVisual(CompoundVisual):
self.update_lock.acquire(True)
# Merge shapes buffers
for data in list(self.data.values()):
for data in self.data.values():
if data['visible'] and 'line_pts' in data:
try:
line_pts[data['layer']] += data['line_pts']