Skip to content

Commit 682c0e5

Browse files
committed
Skip utility windows during editor initialization
1. Skip editors with no_serialize=true in View:InitializeAllEditors() - These are utility windows (objectPropertyWindow, collisionView, etc.) - Should be created on-demand, not during initialization - Prevents initialization errors when SB.view not yet set 2. Add nil check in ObjectPropertyWindow:init() - Guards SB.view.selectionManager access - Needed in case editor is created before SB.view is assigned - This is defensive - shouldn't happen now with no_serialize skip Fixes: "attempt to index field 'view' (a nil value)" in object_property_window.lua:366
1 parent 48d70f4 commit 682c0e5

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

scen_edit/view/object/object_property_window.lua

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -363,8 +363,13 @@ function ObjectPropertyWindow:init()
363363
)
364364

365365
self:Finalize(children)
366-
SB.view.selectionManager:addListener(self)
367-
self:OnSelectionChanged()
366+
367+
-- Defer listener registration if SB.view not set yet (during init)
368+
-- This can happen when editors are pre-initialized in RmlUi mode
369+
if SB.view then
370+
SB.view.selectionManager:addListener(self)
371+
self:OnSelectionChanged()
372+
end
368373
SB.commandManager:addListener(self)
369374
end
370375

scen_edit/view/view.lua

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,13 +172,16 @@ function View:InitializeAllEditors()
172172
-- Instantiate all editors from editorRegistry
173173
-- This calls their init() which calls Finalize() which generates RML
174174
-- Doing this upfront catches field errors early instead of when users click buttons
175+
-- Skip editors with no_serialize=true (utility windows created on-demand)
175176
Log.Notice("Initializing all editors from editorRegistry...")
176177
local count = 0
177178
for name, editorCfg in pairs(SB.editorRegistry) do
178-
if editorCfg.editor then
179+
if editorCfg.editor and not editorCfg.no_serialize then
179180
Log.Notice(" Creating editor: " .. name)
180181
SB.editors[name] = editorCfg.editor()
181182
count = count + 1
183+
elseif editorCfg.no_serialize then
184+
Log.Notice(" Skipping utility window: " .. name .. " (no_serialize)")
182185
else
183186
Log.Warning(" Editor " .. name .. " has no constructor function")
184187
end

0 commit comments

Comments
 (0)