Merge pull request #112349 from kleonc/tile_set_editor_paint_terrain_pick_crash
Fix TileSet editor crash on terrain pick in paint mode
This commit is contained in:
@ -870,6 +870,10 @@ void EditorPropertyEnum::set_option_button_clip(bool p_enable) {
|
||||
options->set_clip_text(p_enable);
|
||||
}
|
||||
|
||||
OptionButton *EditorPropertyEnum::get_option_button() {
|
||||
return options;
|
||||
}
|
||||
|
||||
EditorPropertyEnum::EditorPropertyEnum() {
|
||||
options = memnew(OptionButton);
|
||||
options->set_clip_text(true);
|
||||
|
||||
@ -272,6 +272,7 @@ public:
|
||||
void setup(const Vector<String> &p_options);
|
||||
virtual void update_property() override;
|
||||
void set_option_button_clip(bool p_enable);
|
||||
OptionButton *get_option_button(); // Hack to allow setting icons.
|
||||
EditorPropertyEnum();
|
||||
};
|
||||
|
||||
|
||||
@ -1887,7 +1887,7 @@ void TileDataTerrainsEditor::_update_terrain_selector() {
|
||||
|
||||
// Kind of a hack to set icons.
|
||||
// We could provide a way to modify that in the EditorProperty.
|
||||
OptionButton *option_button = Object::cast_to<OptionButton>(terrain_property_editor->get_child(0));
|
||||
OptionButton *option_button = terrain_property_editor->get_option_button();
|
||||
for (int terrain = 0; terrain < tile_set->get_terrains_count(terrain_set); terrain++) {
|
||||
option_button->set_item_icon(terrain + 1, icons[terrain_set][terrain]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user