diff --git a/editor/editor_properties.cpp b/editor/editor_properties.cpp index 2e46068e07e..0fb57ce40e7 100644 --- a/editor/editor_properties.cpp +++ b/editor/editor_properties.cpp @@ -687,16 +687,21 @@ void EditorPropertyEnum::update_property() { void EditorPropertyEnum::setup(const Vector &p_options) { options->clear(); + HashMap> items; int64_t current_val = 0; - for (int i = 0; i < p_options.size(); i++) { - Vector text_split = p_options[i].split(":"); + for (const String &option : p_options) { + Vector text_split = option.split(":"); if (text_split.size() != 1) { current_val = text_split[1].to_int(); } - options->add_item(text_split[0]); - options->set_item_metadata(i, current_val); + items[current_val].push_back(text_split[0]); current_val += 1; } + + for (const KeyValue> &K : items) { + options->add_item(String(", ").join(K.value)); + options->set_item_metadata(-1, K.key); + } } void EditorPropertyEnum::set_option_button_clip(bool p_enable) {