@@ -400,6 +400,7 @@ void EditorPropertyTextEnum::update_property() {
400400 // Manually entered value.
401401 if (default_option < 0 && !current_value.is_empty ()) {
402402 option_button->add_item (current_value, options.size () + 1001 );
403+ option_button->set_item_metadata (-1 , current_value);
403404 option_button->select (0 );
404405
405406 option_button->add_separator ();
@@ -409,7 +410,8 @@ void EditorPropertyTextEnum::update_property() {
409410 option_button->add_item (" " , options.size () + 1000 );
410411
411412 for (int i = 0 ; i < options.size (); i++) {
412- option_button->add_item (options[i], i);
413+ option_button->add_item (option_names[i], i);
414+ option_button->set_item_metadata (-1 , options[i]);
413415 if (options[i] == current_value) {
414416 option_button->select (option_button->get_item_count () - 1 );
415417 }
@@ -429,20 +431,20 @@ void EditorPropertyTextEnum::setup(const Vector<String> &p_options, const Vector
429431 loose_mode = p_loose_mode;
430432
431433 options = p_options;
434+ if (p_option_names.is_empty ()) {
435+ option_names = p_options;
436+ } else {
437+ option_names = p_option_names;
438+ }
432439
433440 if (loose_mode) {
434441 // Add an explicit empty value for clearing the property in the loose mode.
435442 option_button->add_item (" " , options.size () + 1000 );
436443 option_button->set_item_metadata (-1 , String ());
437444 }
438445
439- bool use_option_names = !p_option_names.is_empty ();
440- for (int i = 0 ; i < p_options.size (); i++) {
441- if (use_option_names) {
442- option_button->add_item (p_option_names[i], i);
443- } else {
444- option_button->add_item (p_options[i], i);
445- }
446+ for (int i = 0 ; i < options.size (); i++) {
447+ option_button->add_item (option_names[i], i);
446448 option_button->set_item_metadata (-1 , options[i]);
447449 }
448450
0 commit comments