summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2022-07-31 00:08:06 +0200
committerGitHub <noreply@github.com>2022-07-31 00:08:06 +0200
commit6e8f8c04098fb955723c522466ce29de56551533 (patch)
tree5a88644178a75ba14b71fed831f3d7c2ab346cde
parent73f5742f94f556b308b633efab31a0e38f044666 (diff)
parent4b478c2854946c153bca33cb227cd15452f0a033 (diff)
Merge pull request #52025 from Calinou/open-in-new-inspector-use-packedstringarray
Use a PackedStringArray for the "open in new inspector" editor setting
-rw-r--r--editor/editor_node.cpp9
-rw-r--r--editor/editor_properties.cpp8
2 files changed, 12 insertions, 5 deletions
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp
index e10394a2a8..8b540f9787 100644
--- a/editor/editor_node.cpp
+++ b/editor/editor_node.cpp
@@ -6172,7 +6172,14 @@ EditorNode::EditorNode() {
EDITOR_DEF("interface/inspector/horizontal_vector2_editing", false);
EDITOR_DEF("interface/inspector/horizontal_vector_types_editing", true);
EDITOR_DEF("interface/inspector/open_resources_in_current_inspector", true);
- EDITOR_DEF("interface/inspector/resources_to_open_in_new_inspector", "Script,MeshLibrary");
+
+ PackedStringArray open_in_new_inspector_defaults;
+ // Required for the script editor to work.
+ open_in_new_inspector_defaults.push_back("Script");
+ // Required for the GridMap editor to work.
+ open_in_new_inspector_defaults.push_back("MeshLibrary");
+ EDITOR_DEF("interface/inspector/resources_to_open_in_new_inspector", open_in_new_inspector_defaults);
+
EDITOR_DEF("interface/inspector/default_color_picker_mode", 0);
EditorSettings::get_singleton()->add_property_hint(PropertyInfo(Variant::INT, "interface/inspector/default_color_picker_mode", PROPERTY_HINT_ENUM, "RGB,HSV,RAW,OKHSL", PROPERTY_USAGE_DEFAULT));
EDITOR_DEF("interface/inspector/default_color_picker_shape", (int32_t)ColorPicker::SHAPE_OKHSL_CIRCLE);
diff --git a/editor/editor_properties.cpp b/editor/editor_properties.cpp
index 215a44482e..919443eeb8 100644
--- a/editor/editor_properties.cpp
+++ b/editor/editor_properties.cpp
@@ -4356,11 +4356,11 @@ EditorProperty *EditorInspectorDefaultPlugin::get_editor_for_property(Object *p_
editor->setup(p_object, p_path, p_hint == PROPERTY_HINT_RESOURCE_TYPE ? p_hint_text : "Resource");
if (p_hint == PROPERTY_HINT_RESOURCE_TYPE) {
- String open_in_new = EDITOR_GET("interface/inspector/resources_to_open_in_new_inspector");
- for (int i = 0; i < open_in_new.get_slice_count(","); i++) {
- String type = open_in_new.get_slicec(',', i).strip_edges();
+ const PackedStringArray open_in_new_inspector = EDITOR_GET("interface/inspector/resources_to_open_in_new_inspector");
+
+ for (const String &type : open_in_new_inspector) {
for (int j = 0; j < p_hint_text.get_slice_count(","); j++) {
- String inherits = p_hint_text.get_slicec(',', j);
+ const String inherits = p_hint_text.get_slicec(',', j);
if (ClassDB::is_parent_class(inherits, type)) {
editor->set_use_sub_inspector(false);
}