SSBO加载模型提高帧率

This commit is contained in:
Hector 2026-03-19 11:13:37 +08:00
parent 46fa1756a1
commit 9bbcc89daa

View File

@ -1519,33 +1519,11 @@ class AppActions:
and getattr(self, "ssbo_editor", None)
and getattr(self.ssbo_editor, "last_import_tree_key", None)
):
selected_key = self.ssbo_editor.last_import_tree_key
selection_cost = None
if hasattr(self.ssbo_editor, "estimate_selection_cost"):
try:
selection_cost = self.ssbo_editor.estimate_selection_cost(selected_key)
except Exception:
selection_cost = None
should_auto_select = True
if selection_cost:
object_count = int(selection_cost.get("object_count", 0))
chunk_count = int(selection_cost.get("chunk_count", 0))
is_root = bool(selection_cost.get("is_root"))
# SSBO 导入后的顶层节点通常覆盖整片模型;
# 只要它跨多个对象或多个 chunk被自动选中后就会让静态批处理失效。
# 因此这里只允许极小代价的单对象选择自动激活,其余统一保持未选中。
if is_root or object_count > 1 or chunk_count > 1:
should_auto_select = False
if should_auto_select:
self.ssbo_editor.select_node(selected_key)
else:
self.ssbo_editor.clear_selection(sync_world_selection=False)
if hasattr(self.ssbo_editor, "_sync_editor_selection_reference"):
self.ssbo_editor._sync_editor_selection_reference(None)
if show_info_message:
self.add_info_message("模型导入完成,已保持 SSBO 静态模式以避免导入后掉帧")
self.ssbo_editor.clear_selection(sync_world_selection=False)
if hasattr(self.ssbo_editor, "_sync_editor_selection_reference"):
self.ssbo_editor._sync_editor_selection_reference(None)
if show_info_message:
self.add_info_message("模型导入完成,已保持 SSBO 静态模式以避免导入后掉帧")
elif hasattr(self, 'selection') and self.selection:
self.selection.updateSelection(model_node)