diff options
author | Hugo Locurcio <hugo.locurcio@hugo.pro> | 2021-01-01 19:41:11 +0100 |
---|---|---|
committer | Hugo Locurcio <hugo.locurcio@hugo.pro> | 2021-02-12 17:03:00 +0100 |
commit | d97d65b18494fe20aea4802031196a441bd59f97 (patch) | |
tree | f109c21263b0eef93d0d0396d7aefe3887503910 | |
parent | 5e528f35505ba946cbda5f7c1fc800ed578b52dc (diff) |
Increase the page size for array/dictionary editors to 20
With smaller arrays/dictionaries, this makes it possible to view all of
an array/dictionary's items on a single page.
Larger values could be used, but make switching between node selections
quite slow, especially on low-end CPUs. They could also be problematic
with complex resource inspectors for arrays/dictionaries that contain
Resources.
This closes https://github.com/godotengine/godot-proposals/issues/2058.
-rw-r--r-- | editor/editor_properties_array_dict.cpp | 6 | ||||
-rw-r--r-- | editor/editor_properties_array_dict.h | 8 | ||||
-rw-r--r-- | editor/editor_settings.cpp | 4 |
3 files changed, 10 insertions, 8 deletions
diff --git a/editor/editor_properties_array_dict.cpp b/editor/editor_properties_array_dict.cpp index a798344973..de688f2709 100644 --- a/editor/editor_properties_array_dict.cpp +++ b/editor/editor_properties_array_dict.cpp @@ -573,8 +573,7 @@ void EditorPropertyArray::_bind_methods() { EditorPropertyArray::EditorPropertyArray() { object.instance(); - page_idx = 0; - page_len = 10; + page_len = int(EDITOR_GET("interface/inspector/max_array_dictionary_items_per_page")); edit = memnew(Button); edit->set_flat(true); edit->set_h_size_flags(SIZE_EXPAND_FILL); @@ -1069,8 +1068,7 @@ void EditorPropertyDictionary::_bind_methods() { EditorPropertyDictionary::EditorPropertyDictionary() { object.instance(); - page_idx = 0; - page_len = 10; + page_len = int(EDITOR_GET("interface/inspector/max_array_dictionary_items_per_page")); edit = memnew(Button); edit->set_flat(true); edit->set_h_size_flags(SIZE_EXPAND_FILL); diff --git a/editor/editor_properties_array_dict.h b/editor/editor_properties_array_dict.h index 0359f3d9bc..fa5adc788d 100644 --- a/editor/editor_properties_array_dict.h +++ b/editor/editor_properties_array_dict.h @@ -84,8 +84,8 @@ class EditorPropertyArray : public EditorProperty { bool dropping; Ref<EditorPropertyArrayObject> object; - int page_len; - int page_idx; + int page_len = 20; + int page_idx = 0; int changing_type_idx; Button *edit; VBoxContainer *vbox; @@ -129,8 +129,8 @@ class EditorPropertyDictionary : public EditorProperty { bool updating; Ref<EditorPropertyDictionaryObject> object; - int page_len; - int page_idx; + int page_len = 20; + int page_idx = 0; int changing_type_idx; Button *edit; VBoxContainer *vbox; diff --git a/editor/editor_settings.cpp b/editor/editor_settings.cpp index e37173bf68..18f00ec0c5 100644 --- a/editor/editor_settings.cpp +++ b/editor/editor_settings.cpp @@ -381,6 +381,10 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) { _initial_set("interface/editor/hide_console_window", false); _initial_set("interface/editor/save_each_scene_on_quit", true); // Regression + // Inspector + _initial_set("interface/inspector/max_array_dictionary_items_per_page", 20); + hints["interface/inspector/max_array_dictionary_items_per_page"] = PropertyInfo(Variant::INT, "interface/inspector/max_array_dictionary_items_per_page", PROPERTY_HINT_RANGE, "10,100,1", PROPERTY_USAGE_DEFAULT); + // Theme _initial_set("interface/theme/preset", "Default"); hints["interface/theme/preset"] = PropertyInfo(Variant::STRING, "interface/theme/preset", PROPERTY_HINT_ENUM, "Default,Alien,Arc,Godot 2,Grey,Light,Solarized (Dark),Solarized (Light),Custom", PROPERTY_USAGE_DEFAULT); |