From f3f8da7b909168e3c2b567ef227b0aafb0be885a Mon Sep 17 00:00:00 2001 From: Your Name Date: Fri, 27 Feb 2026 16:11:35 +0800 Subject: [PATCH] Optimize SSBO root selection to avoid full dynamic activation --- ssbo_component/ssbo_editor.py | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/ssbo_component/ssbo_editor.py b/ssbo_component/ssbo_editor.py index fa9c6b75..f323fd52 100644 --- a/ssbo_component/ssbo_editor.py +++ b/ssbo_component/ssbo_editor.py @@ -542,6 +542,23 @@ class SSBOEditor: self.selected_name = key self.selected_ids = self.controller.name_to_ids.get(key, []) + is_root_selection = ( + self.controller and + key == getattr(self.controller, "tree_root_key", None) + ) + + # Root selection should stay lightweight: + # keep static chunks active and transform the model root directly. + if is_root_selection: + self.controller.set_active_ids([]) + if self._transform_gizmo and self.model and not self.model.is_empty(): + self._transform_gizmo.attach(self.model) + else: + if self._transform_gizmo: + self._transform_gizmo.detach() + self._stop_pick_sync_task() + return + self.controller.set_active_ids(self.selected_ids) if not self._transform_gizmo or not self.selected_ids: @@ -708,7 +725,18 @@ class SSBOEditor: if self.keys.get('x'): acc.y -= speed if acc.length_squared() > 0: - for idx in self.selected_ids: - self.controller.move_object(idx, acc) + is_root_selection = ( + self.selected_name == getattr(self.controller, "tree_root_key", None) + ) + if is_root_selection and self.model and not self.model.is_empty(): + next_pos = self.model.get_pos() + acc + if hasattr(self.model, "set_fluid_pos"): + self.model.set_fluid_pos(next_pos) + else: + self.model.set_pos(next_pos) + self._sync_pick_root_transform() + else: + for idx in self.selected_ids: + self.controller.move_object(idx, acc) return task.cont