Skip to content

Commit 47a31b2

Browse files
committed
Bugfix: initialize render window only once
- The render window can only be initialized only once per session in the current setup, otherwise there is no proper binding to the new render window. This can be easily checked by switching to a new input file in the current state of the tool. This commit fixes the underlying issue by only initializing the render window if it was not saved on the server side. - Also, there was a non-existent function used for the determination of the current material. This is fixed as well.
1 parent 0503760 commit 47a31b2

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/fourc_webviewer/fourc_webserver.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,9 @@ def init_pyvista_render_objects(self):
267267
268268
The saved vtu file path is hereby utilized.
269269
"""
270-
if "render_window" not in self._actors:
270+
271+
# render window initialization: to be done only once while starting the webviewer, otherwise no proper binding within the current setup!
272+
if "render_window" not in self._server_vars:
271273
self._server_vars["render_window"] = pv.Plotter()
272274

273275
self._server_vars["render_window"].clear_actors()
@@ -1174,7 +1176,9 @@ def change_selected_material(self, selected_material, **kwargs):
11741176
# material (if we are not in an initial rendering scenario)
11751177
if self._server_vars["render_count"]["change_selected_material"] > 0:
11761178
# first get the master material id
1177-
master_mat_id = self.determine_master_mat_ind_for_current_selection()
1179+
master_mat_id = self.determine_master_mat_ind_for_material(
1180+
selected_material
1181+
)
11781182

11791183
# update plotter / render objects
11801184
self.update_pyvista_render_objects()

0 commit comments

Comments
 (0)