summaryrefslogtreecommitdiff
path: root/editor/project_settings_editor.cpp
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2019-10-26 08:58:20 +0200
committerGitHub <noreply@github.com>2019-10-26 08:58:20 +0200
commit8cef880c39fb1b4062d75e9cd241288a2ea68f2e (patch)
tree0ef7bab72ae27e0824f8fc415d8d28a500477564 /editor/project_settings_editor.cpp
parent5cdecb8227fe6d15d5f5494334df5df9cdcbda0f (diff)
parent929d8dd20c19c814024906d4dcd1ad59a62534ce (diff)
Merge pull request #33076 from Calinou/project-settings-fix-type-dropdown
Fix off-by-one error in the Project Settings type dropdown
Diffstat (limited to 'editor/project_settings_editor.cpp')
-rw-r--r--editor/project_settings_editor.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/editor/project_settings_editor.cpp b/editor/project_settings_editor.cpp
index 803c806028..f56f7ef7ca 100644
--- a/editor/project_settings_editor.cpp
+++ b/editor/project_settings_editor.cpp
@@ -845,9 +845,10 @@ void ProjectSettingsEditor::_item_adds(String) {
void ProjectSettingsEditor::_item_add() {
- // Initialize the property with the default value for the given type
+ // 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()), NULL, 0, ce);
+ const Variant value = Variant::construct(Variant::Type(type->get_selected() + 1), NULL, 0, ce);
String catname = category->get_text().strip_edges();
String propname = property->get_text().strip_edges();
@@ -1835,7 +1836,7 @@ ProjectSettingsEditor::ProjectSettingsEditor(EditorData *p_data) {
// Start at 1 to avoid adding "Nil" as an option
for (int i = 1; i < Variant::VARIANT_MAX; i++) {
- type->add_item(Variant::get_type_name(Variant::Type(i)), i);
+ type->add_item(Variant::get_type_name(Variant::Type(i)));
}
Button *add = memnew(Button);