From a00b276233ec3499daaef4f8dfce4e4193849d99 Mon Sep 17 00:00:00 2001 From: Hector <145347438+hudomn@users.noreply.github.com> Date: Wed, 25 Feb 2026 14:42:22 +0800 Subject: [PATCH] IMGui --- imgui.ini | 24 ++++++++++++------------ ui/lui_manager.py | 5 ++++- ui/panels/editor_panels.py | 10 +++++++--- 3 files changed, 23 insertions(+), 16 deletions(-) diff --git a/imgui.ini b/imgui.ini index 56503e61..a5a960c5 100644 --- a/imgui.ini +++ b/imgui.ini @@ -25,25 +25,25 @@ Collapsed=0 [Window][工具栏] Pos=323,20 -Size=1230,32 +Size=690,32 Collapsed=0 DockId=0x0000000D,0 [Window][场景树] Pos=0,20 -Size=321,634 +Size=321,468 Collapsed=0 DockId=0x00000007,0 [Window][属性面板] -Pos=1555,20 -Size=365,989 +Pos=1015,20 +Size=365,730 Collapsed=0 DockId=0x00000003,0 [Window][控制台] -Pos=0,656 -Size=321,353 +Pos=0,490 +Size=321,260 Collapsed=0 DockId=0x00000008,0 @@ -60,7 +60,7 @@ Collapsed=0 [Window][WindowOverViewport_11111111] Pos=0,20 -Size=1920,989 +Size=1380,730 Collapsed=0 [Window][测试窗口1] @@ -84,7 +84,7 @@ Size=400,300 Collapsed=0 [Window][选择路径] -Pos=660,254 +Pos=390,125 Size=600,500 Collapsed=0 @@ -94,13 +94,13 @@ Size=500,400 Collapsed=0 [Window][导入模型] -Pos=660,254 +Pos=390,125 Size=600,500 Collapsed=0 [Window][资源管理器] -Pos=323,827 -Size=1230,182 +Pos=323,568 +Size=690,182 Collapsed=0 DockId=0x00000006,0 @@ -196,7 +196,7 @@ Size=120,384 Collapsed=0 [Docking][Data] -DockSpace ID=0x08BD597D Window=0x1BBC0F80 Pos=0,20 Size=1920,989 Split=X +DockSpace ID=0x08BD597D Window=0x1BBC0F80 Pos=0,20 Size=1380,730 Split=X DockNode ID=0x00000001 Parent=0x08BD597D SizeRef=1553,989 Split=X DockNode ID=0x00000009 Parent=0x00000001 SizeRef=321,989 Split=Y Selected=0xE0015051 DockNode ID=0x00000007 Parent=0x00000009 SizeRef=271,634 Selected=0xE0015051 diff --git a/ui/lui_manager.py b/ui/lui_manager.py index 51442b09..9eba5d14 100644 --- a/ui/lui_manager.py +++ b/ui/lui_manager.py @@ -54,6 +54,9 @@ class LUIManager: def __init__(self, world): self.world = world self.lui_enabled = (lui is not None) + # Always initialize selection fields, even when LUI is unavailable. + self.selected_index = -1 + self._last_selected_index = -1 self.luiFunction = luiFunction @@ -3371,4 +3374,4 @@ class LUIManager: delattr(self, '_temp_selected_index_for_anchor') imgui.close_current_popup() - imgui.end_popup() \ No newline at end of file + imgui.end_popup() diff --git a/ui/panels/editor_panels.py b/ui/panels/editor_panels.py index 17a5c662..a8c5ce94 100644 --- a/ui/panels/editor_panels.py +++ b/ui/panels/editor_panels.py @@ -889,9 +889,13 @@ class EditorPanels: # --- LUI Component Properties --- # 优先检查 LUI 组件选择 - if hasattr(self.app, 'lui_manager') and self.app.lui_manager.selected_index >= 0: - if self.app.lui_manager.luiFunction: - self.app.lui_manager.luiFunction._draw_component_properties(self.app.lui_manager, self.app.lui_manager.selected_index) + if hasattr(self.app, 'lui_manager'): + lui_selected_index = getattr(self.app.lui_manager, "selected_index", -1) + if lui_selected_index >= 0 and self.app.lui_manager.luiFunction: + self.app.lui_manager.luiFunction._draw_component_properties( + self.app.lui_manager, + lui_selected_index + ) return # --- Scene Node Properties ---