Optimize SSBO root selection to avoid full dynamic activation

This commit is contained in:
Your Name 2026-02-27 16:11:35 +08:00
parent 2183d3fc3e
commit f3f8da7b90

View File

@ -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