Skip to content

Commit

Permalink
Increase the page size for array/dictionary editors to 20
Browse files Browse the repository at this point in the history
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 godotengine/godot-proposals#2058.

(cherry picked from commit d97d65b)
  • Loading branch information
Calinou authored and akien-mga committed Feb 22, 2021
1 parent a8105d7 commit f1bbb4f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
6 changes: 2 additions & 4 deletions editor/editor_properties_array_dict.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -504,8 +504,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);
Expand Down Expand Up @@ -1000,8 +999,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);
Expand Down
8 changes: 4 additions & 4 deletions editor/editor_properties_array_dict.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ class EditorPropertyArray : public EditorProperty {
bool updating;

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;
Expand Down Expand Up @@ -124,8 +124,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;
Expand Down
4 changes: 4 additions & 0 deletions editor/editor_settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,10 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
_initial_set("interface/editor/save_each_scene_on_quit", true); // Regression
_initial_set("interface/editor/quit_confirmation", true);

// 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);
Expand Down

0 comments on commit f1bbb4f

Please sign in to comment.