From 7a776d68b6f7cae8c88dbf3aeef97f5a7b481cde Mon Sep 17 00:00:00 2001 From: kleonc <9283098+kleonc@users.noreply.github.com> Date: Tue, 20 Apr 2021 18:50:36 +0200 Subject: [PATCH] ProjectSettingsEditor: Make "Type" OptionButton item ids match corresponding Variant::Type enum values. (cherry picked from commit f8f12d05640eaf17cd9bc61817be74647e2e6111) --- editor/project_settings_editor.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/editor/project_settings_editor.cpp b/editor/project_settings_editor.cpp index 2fd9f9247ec..f0a23d0b967 100644 --- a/editor/project_settings_editor.cpp +++ b/editor/project_settings_editor.cpp @@ -840,9 +840,8 @@ void ProjectSettingsEditor::_item_adds(String) { void ProjectSettingsEditor::_item_add() { // Initialize the property with the default value for the given type. - // The type list starts at 1 (as we exclude Nil), so add 1 to the selected value. Variant::CallError ce; - const Variant value = Variant::construct(Variant::Type(type->get_selected() + 1), NULL, 0, ce); + const Variant value = Variant::construct(Variant::Type(type->get_selected_id()), NULL, 0, ce); String name = property->get_text().strip_edges(); @@ -1826,7 +1825,7 @@ ProjectSettingsEditor::ProjectSettingsEditor(EditorData *p_data) { // There's no point in adding Nil types, and Object types // can't be serialized correctly in the project settings. if (i != Variant::NIL && i != Variant::OBJECT) { - type->add_item(Variant::get_type_name(Variant::Type(i))); + type->add_item(Variant::get_type_name(Variant::Type(i)), i); } }