diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2021-04-20 20:00:59 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-20 20:00:59 +0200 |
commit | 7879e0494b6b38d2862c2be9f0a398bbd321224d (patch) | |
tree | bf09fff21fed89ef640e10b84b5a69e54b6c073b | |
parent | c36807994d06d812053f469c4189c81439f69231 (diff) | |
parent | f8f12d05640eaf17cd9bc61817be74647e2e6111 (diff) |
Merge pull request #48048 from kleonc/project_settings_add_property_type_fix
ProjectSettingsEditor: Make "Type" OptionButton item ids match corresponding Variant::Type enum values
-rw-r--r-- | editor/project_settings_editor.cpp | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/editor/project_settings_editor.cpp b/editor/project_settings_editor.cpp index de7996eaa2..faec3355ac 100644 --- a/editor/project_settings_editor.cpp +++ b/editor/project_settings_editor.cpp @@ -102,10 +102,9 @@ void ProjectSettingsEditor::_add_setting() { String setting = _get_setting_name(); // 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. Callable::CallError ce; Variant value; - Variant::construct(Variant::Type(type->get_selected() + 1), value, nullptr, 0, ce); + Variant::construct(Variant::Type(type->get_selected_id()), value, nullptr, 0, ce); undo_redo->create_action(TTR("Add Project Setting")); undo_redo->add_do_property(ps, setting, value); @@ -584,7 +583,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); } } |