Skip to content

Commit 720de66

Browse files
committed
Fix Chili field loading and protect RmlUi files from Chili fallback
Fixed critical Chili fallback issue where field definitions weren't loading: 1. **Added Chili field loading**: - view.lua:238 now loads 'view/fields/' directory during Chili initialization - This provides ChoiceField, StringField, etc. needed by trigger windows 2. **Protected RmlUi files from loading during Chili fallback**: - Added guards to all rmlui_* files in view/ directory: - rmlui_manager.lua - rmlui_builder.lua - rmlui_component.lua - rmlui_editor_base.lua - rmlui_fields.lua - rmlui_field_compat.lua - These files now return early if RmlUi is not available - Prevents errors when InitializeChili loads the view/ directory This ensures Chili UI works correctly when RmlUi is not available.
1 parent 41e64b9 commit 720de66

File tree

7 files changed

+33
-0
lines changed

7 files changed

+33
-0
lines changed

scen_edit/view/rmlui_builder.lua

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22
--- Provides helpers to dynamically generate RML/RCSS similar to Chili widget creation
33
--- Used to replace dynamic Chili:New{} calls with RML generation
44

5+
-- Only load if RmlUi is available
6+
if not RmlUi then
7+
return
8+
end
9+
510
RmlUiBuilder = {}
611

712
--- Generate a unique ID for dynamic elements

scen_edit/view/rmlui_component.lua

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22
--- Simpler base class for RmlUi windows/components that aren't full dialogs
33
--- (pickers, floating windows, etc.)
44

5+
-- Only load if RmlUi is available
6+
if not RmlUi then
7+
return
8+
end
9+
510
RmlUiComponent = LCS.class{}
611

712
function RmlUiComponent:init(rmlPath, title)

scen_edit/view/rmlui_editor_base.lua

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22
-- Provides AddField() API for editors - implementation-agnostic!
33
-- ALL editors use ONE generic_editor.rml template that gets populated dynamically
44

5+
-- Only load if RmlUi is available
6+
if not RmlUi then
7+
return
8+
end
9+
510
RmlUiEditorBase = LCS.class{}
611

712
function RmlUiEditorBase:init()

scen_edit/view/rmlui_field_compat.lua

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@
55
-- When RmlUi is active, these create RmlUi fields
66
-- This maintains the exact same API: StringField({name="foo", title="Foo"})
77

8+
-- Only load if RmlUi is available
9+
if not RmlUi then
10+
return
11+
end
12+
813
StringField = RmlUiStringField
914
NumericField = RmlUiNumericField
1015
BooleanField = RmlUiBooleanField

scen_edit/view/rmlui_fields.lua

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@
33
-- Implementation-agnostic: No need to touch RML/HTML to add fields!
44
-- Just use: AddField(StringField({name="foo", title="Foo"}))
55

6+
-- Only load if RmlUi is available
7+
if not RmlUi then
8+
return
9+
end
10+
611
-- Base Field Class
712
RmlUiField = LCS.class{}
813

scen_edit/view/rmlui_manager.lua

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
--- RmlUi Manager
22
--- Manages RmlUi context and documents
33

4+
-- Only load if RmlUi is available
5+
if not RmlUi then
6+
return
7+
end
8+
49
RmlUiManager = LCS.class{}
510

611
function RmlUiManager:init()

scen_edit/view/view.lua

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,9 @@ end
234234

235235
function View:InitializeChili()
236236
-- Original Chili initialization
237+
-- Load Chili field system first (required by other views)
238+
SB.IncludeDir(Path.Join(SB.DIRS.SRC, 'view/fields'))
239+
237240
SB.IncludeDir(Path.Join(SB.DIRS.SRC, 'view'))
238241
SB.Include(Path.Join(SB.DIRS.SRC, 'view/main_window/main_window_panel.lua'))
239242
SB.IncludeDir(Path.Join(SB.DIRS.SRC, 'view/main_window'))

0 commit comments

Comments
 (0)