diff options
author | Jaime van Kessel <nallath@gmail.com> | 2019-08-27 14:26:55 +0300 |
---|---|---|
committer | Jaime van Kessel <nallath@gmail.com> | 2019-08-27 14:26:55 +0300 |
commit | e8cd5723c97d956f2629f13ef0df8fd3370e8685 (patch) | |
tree | 2db6477b52345ded55b98e5be198a93f4437eb9d /plugins/SimulationView | |
parent | ea11187eaf73dc2a2f8f06348394eb6901011f63 (diff) |
Speedup the layerview
We were doing a lot of re-calculations that served no purpose (and
even slowed down the rest of the application)
Diffstat (limited to 'plugins/SimulationView')
-rw-r--r-- | plugins/SimulationView/SimulationView.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/plugins/SimulationView/SimulationView.py b/plugins/SimulationView/SimulationView.py index e7bb88e1ae..72bf1274ea 100644 --- a/plugins/SimulationView/SimulationView.py +++ b/plugins/SimulationView/SimulationView.py @@ -90,7 +90,6 @@ class SimulationView(CuraView): self._global_container_stack = None # type: Optional[ContainerStack] self._proxy = None - self._controller.getScene().getRoot().childrenChanged.connect(self._onSceneChanged) self._resetSettings() self._legend_items = None @@ -109,7 +108,6 @@ class SimulationView(CuraView): Application.getInstance().getPreferences().addPreference("layerview/show_skin", True) Application.getInstance().getPreferences().addPreference("layerview/show_infill", True) - Application.getInstance().getPreferences().preferenceChanged.connect(self._onPreferencesChanged) self._updateWithPreferences() self._solid_layers = int(Application.getInstance().getPreferences().getValue("view/top_layer_count")) @@ -184,6 +182,8 @@ class SimulationView(CuraView): return self._nozzle_node def _onSceneChanged(self, node: "SceneNode") -> None: + if node.getMeshData() is None: + return self.setActivity(False) self.calculateMaxLayers() self.calculateMaxPathsOnLayer(self._current_layer_num) @@ -464,6 +464,10 @@ class SimulationView(CuraView): return True if event.type == Event.ViewActivateEvent: + # Start listening to changes. + Application.getInstance().getPreferences().preferenceChanged.connect(self._onPreferencesChanged) + self._controller.getScene().getRoot().childrenChanged.connect(self._onSceneChanged) + # FIX: on Max OS X, somehow QOpenGLContext.currentContext() can become None during View switching. # This can happen when you do the following steps: # 1. Start Cura @@ -510,6 +514,8 @@ class SimulationView(CuraView): self._composite_pass.setCompositeShader(self._simulationview_composite_shader) elif event.type == Event.ViewDeactivateEvent: + self._controller.getScene().getRoot().childrenChanged.disconnect(self._onSceneChanged) + Application.getInstance().getPreferences().preferenceChanged.disconnect(self._onPreferencesChanged) self._wireprint_warning_message.hide() Application.getInstance().globalContainerStackChanged.disconnect(self._onGlobalStackChanged) if self._global_container_stack: |