Skip to content

Commit 4412391

Browse files
committed
Make TabbedPanelImage/Label mode-aware for icon extraction
- TabbedPanelImage/Label now return plain tables in RmlUi mode - These wrappers work with ActionButton to provide icons - Convert texture_editor.lua to use ActionButton (4 buttons) - Convert players_window.lua to use ActionButton (1 button) - Fixes crash when old editors created Chili buttons with plain table children
1 parent 8017401 commit 4412391

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

scen_edit/view/general/players_window.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ function PlayersWindow:init()
2424
SB.model.teamManager:addListener(self)
2525
self:Populate()
2626

27-
self.btnAddPlayer = TabbedPanelButton({
27+
self.btnAddPlayer = ActionButton({
2828
x = 0,
2929
y = 0,
3030
tooltip = "Add team",

scen_edit/view/main_window/main_window_panel.lua

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,12 @@ function TabbedPanelButton(tbl)
3131
end
3232

3333
function TabbedPanelImage(tbl)
34-
-- In RmlUi mode, just return the table with file property for extraction
34+
-- In RmlUi mode, return plain table (for ActionButton wrapper)
3535
if SB.view and SB.view.useRmlUi then
36-
return tbl -- Return plain table { file = "..." }
36+
return tbl
3737
end
3838

39-
-- Chili mode - create actual Image object
39+
-- In Chili mode, create Chili Image object
4040
return Image:New(Table.Merge({
4141
width = SB.conf.TOOLBOX_ITEM_WIDTH / 2,
4242
height = SB.conf.TOOLBOX_ITEM_HEIGHT / 2,
@@ -47,12 +47,12 @@ function TabbedPanelImage(tbl)
4747
end
4848

4949
function TabbedPanelLabel(tbl)
50-
-- In RmlUi mode, just return the table with caption property for extraction
50+
-- In RmlUi mode, return plain table (for ActionButton wrapper)
5151
if SB.view and SB.view.useRmlUi then
52-
return tbl -- Return plain table { caption = "..." }
52+
return tbl
5353
end
5454

55-
-- Chili mode - create actual Label object
55+
-- In Chili mode, create Chili Label object
5656
return Label:New(Table.Merge({
5757
bottom = SB.conf.TOOLBOX_ITEM_HEIGHT / 8,
5858
width = SB.conf.TOOLBOX_ITEM_WIDTH,

scen_edit/view/map/texture_editor.lua

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ function TextureEditor:init()
137137
name = "dntsIndex",
138138
value = 0,
139139
}))
140-
self.btnPaint = TabbedPanelButton({
140+
self.btnPaint = ActionButton({
141141
x = 0,
142142
y = 0,
143143
tooltip = "Paint the terrain",
@@ -162,7 +162,7 @@ function TextureEditor:init()
162162
end
163163
},
164164
})
165-
self.btnFilter = TabbedPanelButton({
165+
self.btnFilter = ActionButton({
166166
x = SB.conf.TOOLBOX_ITEM_WIDTH,
167167
y = 0,
168168
tooltip = "Apply a filter",
@@ -190,7 +190,7 @@ function TextureEditor:init()
190190
end
191191
},
192192
})
193-
self.btnDNTS = TabbedPanelButton({
193+
self.btnDNTS = ActionButton({
194194
x = SB.conf.TOOLBOX_ITEM_WIDTH * 2,
195195
y = 0,
196196
tooltip = "DNTS textures",
@@ -234,7 +234,7 @@ function TextureEditor:init()
234234
end
235235
},
236236
})
237-
self.btnVoid = TabbedPanelButton({
237+
self.btnVoid = ActionButton({
238238
x = SB.conf.TOOLBOX_ITEM_WIDTH * 3,
239239
y = 0,
240240
tooltip = "Make the terrain transparent",

0 commit comments

Comments
 (0)