Skip to content

Commit 1adfcb2

Browse files
committed
Merge pull request #112349 from kleonc/tile_set_editor_paint_terrain_pick_crash
Fix TileSet editor crash on terrain pick in paint mode
2 parents 76b44eb + fb5a299 commit 1adfcb2

File tree

3 files changed

+6
-1
lines changed

3 files changed

+6
-1
lines changed

editor/inspector/editor_properties.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -870,6 +870,10 @@ void EditorPropertyEnum::set_option_button_clip(bool p_enable) {
870870
options->set_clip_text(p_enable);
871871
}
872872

873+
OptionButton *EditorPropertyEnum::get_option_button() {
874+
return options;
875+
}
876+
873877
EditorPropertyEnum::EditorPropertyEnum() {
874878
options = memnew(OptionButton);
875879
options->set_clip_text(true);

editor/inspector/editor_properties.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,7 @@ class EditorPropertyEnum : public EditorProperty {
272272
void setup(const Vector<String> &p_options);
273273
virtual void update_property() override;
274274
void set_option_button_clip(bool p_enable);
275+
OptionButton *get_option_button(); // Hack to allow setting icons.
275276
EditorPropertyEnum();
276277
};
277278

editor/scene/2d/tiles/tile_data_editors.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1887,7 +1887,7 @@ void TileDataTerrainsEditor::_update_terrain_selector() {
18871887

18881888
// Kind of a hack to set icons.
18891889
// We could provide a way to modify that in the EditorProperty.
1890-
OptionButton *option_button = Object::cast_to<OptionButton>(terrain_property_editor->get_child(0));
1890+
OptionButton *option_button = terrain_property_editor->get_option_button();
18911891
for (int terrain = 0; terrain < tile_set->get_terrains_count(terrain_set); terrain++) {
18921892
option_button->set_item_icon(terrain + 1, icons[terrain_set][terrain]);
18931893
}

0 commit comments

Comments
 (0)