diff options
38 files changed, 203 insertions, 114 deletions
diff --git a/.github/workflows/windows_builds.yml b/.github/workflows/windows_builds.yml index 8c88c8fa64..c0b291b252 100644 --- a/.github/workflows/windows_builds.yml +++ b/.github/workflows/windows_builds.yml @@ -5,7 +5,7 @@ on: [push, pull_request] # SCONS_CACHE for windows must be set in the build environment env: # Only used for the cache key. Increment version to force clean build. - GODOT_BASE_BRANCH: master + GODOT_BASE_BRANCH: master-v2 SCONSFLAGS: verbose=yes warnings=all werror=yes module_text_server_fb_enabled=yes SCONS_CACHE_MSVC_CONFIG: true @@ -57,6 +57,7 @@ jobs: target: ${{ matrix.target }} tools: ${{ matrix.tools }} tests: ${{ matrix.tests }} + scons-cache-limit: 8192 # Execute unit tests for the editor - name: Unit tests diff --git a/core/core_bind.cpp b/core/core_bind.cpp index 8b060b09f9..706395afa9 100644 --- a/core/core_bind.cpp +++ b/core/core_bind.cpp @@ -2093,10 +2093,6 @@ int ClassDB::get_integer_constant(const StringName &p_class, const StringName &p return c; } -StringName ClassDB::get_category(const StringName &p_node) const { - return ::ClassDB::get_category(p_node); -} - bool ClassDB::has_enum(const StringName &p_class, const StringName &p_name, bool p_no_inheritance) const { return ::ClassDB::has_enum(p_class, p_name, p_no_inheritance); } @@ -2168,7 +2164,6 @@ void ClassDB::_bind_methods() { ::ClassDB::bind_method(D_METHOD("class_get_enum_constants", "class", "enum", "no_inheritance"), &ClassDB::get_enum_constants, DEFVAL(false)); ::ClassDB::bind_method(D_METHOD("class_get_integer_constant_enum", "class", "name", "no_inheritance"), &ClassDB::get_integer_constant_enum, DEFVAL(false)); - ::ClassDB::bind_method(D_METHOD("class_get_category", "class"), &ClassDB::get_category); ::ClassDB::bind_method(D_METHOD("is_class_enabled", "class"), &ClassDB::is_class_enabled); } diff --git a/core/core_bind.h b/core/core_bind.h index 2942f54a15..907f37c5fa 100644 --- a/core/core_bind.h +++ b/core/core_bind.h @@ -605,7 +605,6 @@ public: PackedStringArray get_integer_constant_list(const StringName &p_class, bool p_no_inheritance = false) const; bool has_integer_constant(const StringName &p_class, const StringName &p_name) const; int get_integer_constant(const StringName &p_class, const StringName &p_name) const; - StringName get_category(const StringName &p_node) const; bool has_enum(const StringName &p_class, const StringName &p_name, bool p_no_inheritance = false) const; PackedStringArray get_enum_list(const StringName &p_class, bool p_no_inheritance = false) const; diff --git a/core/doc_data.h b/core/doc_data.h index 9286b843be..194a39a729 100644 --- a/core/doc_data.h +++ b/core/doc_data.h @@ -152,7 +152,7 @@ public: struct ClassDoc { String name; String inherits; - String category; + String category; // FIXME: Wrongly used by VisualScriptPropertySelector, should be removed. String brief_description; String description; Vector<TutorialDoc> tutorials; diff --git a/core/io/ip.h b/core/io/ip.h index ab00b7b0a6..ebd944a949 100644 --- a/core/io/ip.h +++ b/core/io/ip.h @@ -38,7 +38,6 @@ struct _IP_ResolverPrivate; class IP : public Object { GDCLASS(IP, Object); - OBJ_CATEGORY("Networking"); public: enum ResolverStatus { diff --git a/core/io/resource.h b/core/io/resource.h index b1e1c15541..8068000f32 100644 --- a/core/io/resource.h +++ b/core/io/resource.h @@ -48,7 +48,6 @@ private: class Resource : public RefCounted { GDCLASS(Resource, RefCounted); - OBJ_CATEGORY("Resources"); public: static void register_custom_data_to_otdb() { ClassDB::add_resource_base_extension("res", get_class_static()); } diff --git a/core/io/stream_peer.h b/core/io/stream_peer.h index e71941b7e1..4609e52aa2 100644 --- a/core/io/stream_peer.h +++ b/core/io/stream_peer.h @@ -39,7 +39,6 @@ class StreamPeer : public RefCounted { GDCLASS(StreamPeer, RefCounted); - OBJ_CATEGORY("Networking"); protected: static void _bind_methods(); diff --git a/core/io/stream_peer_tcp.h b/core/io/stream_peer_tcp.h index f2c47b25cf..bf49cc8a5f 100644 --- a/core/io/stream_peer_tcp.h +++ b/core/io/stream_peer_tcp.h @@ -38,7 +38,6 @@ class StreamPeerTCP : public StreamPeer { GDCLASS(StreamPeerTCP, StreamPeer); - OBJ_CATEGORY("Networking"); public: enum Status { diff --git a/core/object/class_db.cpp b/core/object/class_db.cpp index 51ca06d9d2..fd86a02b90 100644 --- a/core/object/class_db.cpp +++ b/core/object/class_db.cpp @@ -1556,15 +1556,6 @@ bool ClassDB::is_class_exposed(const StringName &p_class) { return ti->exposed; } -StringName ClassDB::get_category(const StringName &p_node) { - ERR_FAIL_COND_V(!classes.has(p_node), StringName()); -#ifdef DEBUG_ENABLED - return classes[p_node].category; -#else - return StringName(); -#endif -} - void ClassDB::add_resource_base_extension(const StringName &p_extension, const StringName &p_class) { if (resource_base_extensions.has(p_extension)) { return; diff --git a/core/object/class_db.h b/core/object/class_db.h index 4211601d15..b8a4b3ea2b 100644 --- a/core/object/class_db.h +++ b/core/object/class_db.h @@ -109,7 +109,6 @@ public: Set<StringName> methods_in_properties; List<MethodInfo> virtual_methods; Map<StringName, MethodInfo> virtual_methods_map; - StringName category; Map<StringName, Vector<Error>> method_error_values; #endif HashMap<StringName, PropertySetGet> property_setget; @@ -331,8 +330,6 @@ public: static Vector<Error> get_method_error_return_values(const StringName &p_class, const StringName &p_method); static Variant class_get_default_property_value(const StringName &p_class, const StringName &p_property, bool *r_valid = nullptr); - static StringName get_category(const StringName &p_node); - static void set_class_enabled(const StringName &p_class, bool p_enable); static bool is_class_enabled(const StringName &p_class); diff --git a/core/object/object.h b/core/object/object.h index 41365cfe51..dbaf9f13fd 100644 --- a/core/object/object.h +++ b/core/object/object.h @@ -344,16 +344,6 @@ public: m_inherits::get_inheritance_list_static(p_inheritance_list); \ p_inheritance_list->push_back(String(#m_class)); \ } \ - static String get_category_static() { \ - String category = m_inherits::get_category_static(); \ - if (_get_category != m_inherits::_get_category) { \ - if (!category.is_empty()) { \ - category += "/"; \ - } \ - category += _get_category(); \ - } \ - return category; \ - } \ virtual bool is_class(const String &p_class) const override { \ if (_get_extension() && _get_extension()->is_class(p_class)) { \ return true; \ @@ -454,12 +444,6 @@ protected: \ private: -#define OBJ_CATEGORY(m_category) \ -protected: \ - _FORCE_INLINE_ static String _get_category() { return m_category; } \ - \ -private: - #define OBJ_SAVE_TYPE(m_class) \ public: \ virtual String get_save_class() const override { return #m_class; } \ @@ -590,7 +574,6 @@ protected: virtual void _get_property_listv(List<PropertyInfo> *p_list, bool p_reversed) const {}; virtual void _notificationv(int p_notification, bool p_reversed) {} - static String _get_category() { return ""; } static void _bind_methods(); bool _set(const StringName &p_name, const Variant &p_property) { return false; }; bool _get(const StringName &p_name, Variant &r_property) const { return false; }; @@ -694,7 +677,6 @@ public: static String get_class_static() { return "Object"; } static String get_parent_class_static() { return String(); } - static String get_category_static() { return String(); } virtual String get_class() const { if (_extension) { diff --git a/core/os/main_loop.h b/core/os/main_loop.h index a6a32f0138..2bb1ea2ef4 100644 --- a/core/os/main_loop.h +++ b/core/os/main_loop.h @@ -38,7 +38,6 @@ class MainLoop : public Object { GDCLASS(MainLoop, Object); - OBJ_CATEGORY("Main Loop"); Ref<Script> initialize_script; diff --git a/doc/classes/ClassDB.xml b/doc/classes/ClassDB.xml index 835588b293..43210de686 100644 --- a/doc/classes/ClassDB.xml +++ b/doc/classes/ClassDB.xml @@ -23,13 +23,6 @@ Returns whether the specified [code]class[/code] is available or not. </description> </method> - <method name="class_get_category" qualifiers="const"> - <return type="StringName" /> - <argument index="0" name="class" type="StringName" /> - <description> - Returns a category associated with the class for use in documentation and the Asset Library. Debug mode required. - </description> - </method> <method name="class_get_enum_constants" qualifiers="const"> <return type="PackedStringArray" /> <argument index="0" name="class" type="StringName" /> diff --git a/editor/debugger/script_editor_debugger.cpp b/editor/debugger/script_editor_debugger.cpp index 40b53c2636..92345f024c 100644 --- a/editor/debugger/script_editor_debugger.cpp +++ b/editor/debugger/script_editor_debugger.cpp @@ -1763,7 +1763,7 @@ ScriptEditorDebugger::ScriptEditorDebugger() { inspector = memnew(EditorDebuggerInspector); inspector->set_h_size_flags(SIZE_EXPAND_FILL); inspector->set_v_size_flags(SIZE_EXPAND_FILL); - inspector->set_enable_capitalize_paths(false); + inspector->set_property_name_style(EditorPropertyNameProcessor::STYLE_RAW); inspector->set_read_only(true); inspector->connect("object_selected", callable_mp(this, &ScriptEditorDebugger::_remote_object_selected)); inspector->connect("object_edited", callable_mp(this, &ScriptEditorDebugger::_remote_object_edited)); diff --git a/editor/editor_feature_profile.cpp b/editor/editor_feature_profile.cpp index 3d5ca7de42..cf45848ed3 100644 --- a/editor/editor_feature_profile.cpp +++ b/editor/editor_feature_profile.cpp @@ -608,18 +608,24 @@ void EditorFeatureProfileManager::_class_list_item_selected() { TreeItem *properties = property_list->create_item(root); properties->set_text(0, TTR("Class Properties:")); + const EditorPropertyNameProcessor::Style text_style = EditorPropertyNameProcessor::get_settings_style(); + const EditorPropertyNameProcessor::Style tooltip_style = EditorPropertyNameProcessor::get_tooltip_style(text_style); + for (const PropertyInfo &E : props) { String name = E.name; if (!(E.usage & PROPERTY_USAGE_EDITOR)) { continue; } + const String text = EditorPropertyNameProcessor::get_singleton()->process_name(name, text_style); + const String tooltip = EditorPropertyNameProcessor::get_singleton()->process_name(name, tooltip_style); + TreeItem *property = property_list->create_item(properties); property->set_cell_mode(0, TreeItem::CELL_MODE_CHECK); property->set_editable(0, true); property->set_selectable(0, true); property->set_checked(0, !edited->is_class_property_disabled(class_name, name)); - property->set_text(0, EditorPropertyNameProcessor::get_singleton()->process_name(name)); - property->set_tooltip(0, EditorPropertyNameProcessor::get_singleton()->make_tooltip_for_name(name)); + property->set_text(0, text); + property->set_tooltip(0, tooltip); property->set_metadata(0, name); String icon_type = Variant::get_type_name(E.type); property->set_icon(0, EditorNode::get_singleton()->get_class_icon(icon_type)); diff --git a/editor/editor_inspector.cpp b/editor/editor_inspector.cpp index 18c9a9f495..483082858e 100644 --- a/editor/editor_inspector.cpp +++ b/editor/editor_inspector.cpp @@ -44,14 +44,14 @@ #include "scene/property_utils.h" #include "scene/resources/packed_scene.h" -static bool _property_path_matches(const String &p_property_path, const String &p_filter) { +static bool _property_path_matches(const String &p_property_path, const String &p_filter, EditorPropertyNameProcessor::Style p_style) { if (p_property_path.findn(p_filter) != -1) { return true; } const Vector<String> sections = p_property_path.split("/"); for (int i = 0; i < sections.size(); i++) { - if (p_filter.is_subsequence_ofn(EditorPropertyNameProcessor::get_singleton()->process_name(sections[i]))) { + if (p_filter.is_subsequence_ofn(EditorPropertyNameProcessor::get_singleton()->process_name(sections[i], p_style))) { return true; } } @@ -2456,6 +2456,8 @@ void EditorInspector::update_tree() { _parse_added_editors(main_vbox, ped); } + bool in_script_variables = false; + // Get the lists of editors for properties. for (List<PropertyInfo>::Element *E_property = plist.front(); E_property; E_property = E_property->next()) { PropertyInfo &p = E_property->get(); @@ -2547,6 +2549,9 @@ void EditorInspector::update_tree() { if (category->icon.is_null() && has_theme_icon(base_type, SNAME("EditorIcons"))) { category->icon = get_theme_icon(base_type, SNAME("EditorIcons")); } + in_script_variables = true; + } else { + in_script_variables = false; } if (category->icon.is_null()) { if (!type.is_empty()) { // Can happen for built-in scripts. @@ -2673,18 +2678,22 @@ void EditorInspector::update_tree() { // Get the property label's string. String name_override = (path.contains("/")) ? path.substr(path.rfind("/") + 1) : path; - String property_label_string = name_override; - if (capitalize_paths) { - // Capitalize paths. - int dot = property_label_string.find("."); + String feature_tag; + { + const int dot = name_override.find("."); if (dot != -1) { + feature_tag = name_override.right(dot); name_override = name_override.substr(0, dot); - property_label_string = EditorPropertyNameProcessor::get_singleton()->process_name(name_override) + property_label_string.substr(dot); - } else { - property_label_string = EditorPropertyNameProcessor::get_singleton()->process_name(property_label_string); } } + // Don't localize properties in Script Variables category. + EditorPropertyNameProcessor::Style name_style = property_name_style; + if (in_script_variables && name_style == EditorPropertyNameProcessor::STYLE_LOCALIZED) { + name_style = EditorPropertyNameProcessor::STYLE_CAPITALIZED; + } + const String property_label_string = EditorPropertyNameProcessor::get_singleton()->process_name(name_override, name_style) + feature_tag; + // Remove the property from the path. int idx = path.rfind("/"); if (idx > -1) { @@ -2696,7 +2705,7 @@ void EditorInspector::update_tree() { // Ignore properties that do not fit the filter. if (use_filter && !filter.is_empty()) { const String property_path = property_prefix + (path.is_empty() ? "" : path + "/") + name_override; - if (!_property_path_matches(property_path, filter)) { + if (!_property_path_matches(property_path, filter, property_name_style)) { continue; } } @@ -2733,15 +2742,13 @@ void EditorInspector::update_tree() { current_vbox->add_child(section); sections.push_back(section); - String label = component; - if (capitalize_paths) { - label = EditorPropertyNameProcessor::get_singleton()->process_name(label); - } + const String label = EditorPropertyNameProcessor::get_singleton()->process_name(component, property_name_style); + const String tooltip = EditorPropertyNameProcessor::get_singleton()->process_name(component, EditorPropertyNameProcessor::get_tooltip_style(property_name_style)); Color c = sscolor; c.a /= level; section->setup(acc_path, label, object, c, use_folding, section_depth); - section->set_tooltip(EditorPropertyNameProcessor::get_singleton()->make_tooltip_for_name(component)); + section->set_tooltip(tooltip); // Add editors at the start of a group. for (Ref<EditorInspectorPlugin> &ped : valid_plugins) { @@ -2773,7 +2780,7 @@ void EditorInspector::update_tree() { editor_inspector_array = memnew(EditorInspectorArray); String array_label = path.contains("/") ? path.substr(path.rfind("/") + 1) : path; - array_label = EditorPropertyNameProcessor::get_singleton()->process_name(property_label_string); + array_label = EditorPropertyNameProcessor::get_singleton()->process_name(property_label_string, property_name_style); int page = per_array_page.has(array_element_prefix) ? per_array_page[array_element_prefix] : 0; editor_inspector_array->setup_with_move_element_function(object, array_label, array_element_prefix, page, c, use_folding); editor_inspector_array->connect("page_change_request", callable_mp(this, &EditorInspector::_page_change_request), varray(array_element_prefix)); @@ -3037,12 +3044,15 @@ void EditorInspector::set_read_only(bool p_read_only) { update_tree(); } -bool EditorInspector::is_capitalize_paths_enabled() const { - return capitalize_paths; +EditorPropertyNameProcessor::Style EditorInspector::get_property_name_style() const { + return property_name_style; } -void EditorInspector::set_enable_capitalize_paths(bool p_capitalize) { - capitalize_paths = p_capitalize; +void EditorInspector::set_property_name_style(EditorPropertyNameProcessor::Style p_style) { + if (property_name_style == p_style) { + return; + } + property_name_style = p_style; update_tree(); } diff --git a/editor/editor_inspector.h b/editor/editor_inspector.h index d625a8043c..87703564b9 100644 --- a/editor/editor_inspector.h +++ b/editor/editor_inspector.h @@ -31,6 +31,7 @@ #ifndef EDITOR_INSPECTOR_H #define EDITOR_INSPECTOR_H +#include "editor_property_name_processor.h" #include "scene/gui/box_container.h" #include "scene/gui/button.h" #include "scene/gui/dialogs.h" @@ -448,7 +449,7 @@ class EditorInspector : public ScrollContainer { bool hide_script = true; bool hide_metadata = true; bool use_doc_hints = false; - bool capitalize_paths = true; + EditorPropertyNameProcessor::Style property_name_style = EditorPropertyNameProcessor::STYLE_CAPITALIZED; bool use_filter = false; bool autoclear = false; bool use_folding = false; @@ -545,8 +546,9 @@ public: void set_keying(bool p_active); void set_read_only(bool p_read_only); - bool is_capitalize_paths_enabled() const; - void set_enable_capitalize_paths(bool p_capitalize); + EditorPropertyNameProcessor::Style get_property_name_style() const; + void set_property_name_style(EditorPropertyNameProcessor::Style p_style); + void set_autoclear(bool p_enable); void set_show_categories(bool p_show); diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index 65101792b7..92ab20b999 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -6055,9 +6055,10 @@ EditorNode::EditorNode() { EDITOR_DEF("interface/editor/save_on_focus_loss", false); EDITOR_DEF("interface/editor/show_update_spinner", false); EDITOR_DEF("interface/editor/update_continuously", false); - EDITOR_DEF("interface/editor/translate_properties", true); + EDITOR_DEF("interface/editor/localize_settings", true); EDITOR_DEF_RST("interface/scene_tabs/restore_scenes_on_load", true); - EDITOR_DEF_RST("interface/inspector/capitalize_properties", true); + EDITOR_DEF_RST("interface/inspector/default_property_name_style", EditorPropertyNameProcessor::STYLE_CAPITALIZED); + EditorSettings::get_singleton()->add_property_hint(PropertyInfo(Variant::INT, "interface/inspector/default_property_name_style", PROPERTY_HINT_ENUM, "Raw,Capitalized,Localized")); EDITOR_DEF_RST("interface/inspector/default_float_step", 0.001); EditorSettings::get_singleton()->add_property_hint(PropertyInfo(Variant::FLOAT, "interface/inspector/default_float_step", PROPERTY_HINT_RANGE, "0,1,0")); EDITOR_DEF_RST("interface/inspector/disable_folding", false); diff --git a/editor/editor_properties.cpp b/editor/editor_properties.cpp index b495d29911..cdb96bd0c8 100644 --- a/editor/editor_properties.cpp +++ b/editor/editor_properties.cpp @@ -3221,7 +3221,7 @@ void EditorPropertyResource::update_property() { sub_inspector->set_use_doc_hints(true); sub_inspector->set_sub_inspector(true); - sub_inspector->set_enable_capitalize_paths(bool(EDITOR_GET("interface/inspector/capitalize_properties"))); + sub_inspector->set_property_name_style(InspectorDock::get_singleton()->get_property_name_style()); sub_inspector->connect("property_keyed", callable_mp(this, &EditorPropertyResource::_sub_inspector_property_keyed)); sub_inspector->connect("resource_selected", callable_mp(this, &EditorPropertyResource::_sub_inspector_resource_selected)); diff --git a/editor/editor_property_name_processor.cpp b/editor/editor_property_name_processor.cpp index f55b2b61c8..d89247b429 100644 --- a/editor/editor_property_name_processor.cpp +++ b/editor/editor_property_name_processor.cpp @@ -34,6 +34,28 @@ EditorPropertyNameProcessor *EditorPropertyNameProcessor::singleton = nullptr; +EditorPropertyNameProcessor::Style EditorPropertyNameProcessor::get_default_inspector_style() { + const Style style = (Style)EDITOR_GET("interface/inspector/default_property_name_style").operator int(); + if (style == STYLE_LOCALIZED && !is_localization_available()) { + return STYLE_CAPITALIZED; + } + return style; +} + +EditorPropertyNameProcessor::Style EditorPropertyNameProcessor::get_settings_style() { + const bool translate = EDITOR_GET("interface/editor/localize_settings"); + return translate ? STYLE_LOCALIZED : STYLE_CAPITALIZED; +} + +EditorPropertyNameProcessor::Style EditorPropertyNameProcessor::get_tooltip_style(Style p_style) { + return p_style == STYLE_LOCALIZED ? STYLE_CAPITALIZED : STYLE_LOCALIZED; +} + +bool EditorPropertyNameProcessor::is_localization_available() { + const Vector<String> forbidden = String("en").split(","); + return forbidden.find(EDITOR_GET("interface/editor/editor_language")) == -1; +} + String EditorPropertyNameProcessor::_capitalize_name(const String &p_name) const { const Map<String, String>::Element *cached = capitalize_string_cache.find(p_name); if (cached) { @@ -55,20 +77,21 @@ String EditorPropertyNameProcessor::_capitalize_name(const String &p_name) const return capitalized; } -String EditorPropertyNameProcessor::process_name(const String &p_name) const { - const String capitalized_string = _capitalize_name(p_name); - if (EDITOR_GET("interface/editor/translate_properties")) { - return TTRGET(capitalized_string); - } - return capitalized_string; -} +String EditorPropertyNameProcessor::process_name(const String &p_name, Style p_style) const { + switch (p_style) { + case STYLE_RAW: { + return p_name; + } break; + + case STYLE_CAPITALIZED: { + return _capitalize_name(p_name); + } break; -String EditorPropertyNameProcessor::make_tooltip_for_name(const String &p_name) const { - const String capitalized_string = _capitalize_name(p_name); - if (EDITOR_GET("interface/editor/translate_properties")) { - return capitalized_string; + case STYLE_LOCALIZED: { + return TTRGET(_capitalize_name(p_name)); + } break; } - return TTRGET(capitalized_string); + ERR_FAIL_V_MSG(p_name, "Unexpected property name style."); } EditorPropertyNameProcessor::EditorPropertyNameProcessor() { @@ -84,6 +107,8 @@ EditorPropertyNameProcessor::EditorPropertyNameProcessor() { capitalize_string_remaps["adb"] = "ADB"; capitalize_string_remaps["ao"] = "AO"; capitalize_string_remaps["apk"] = "APK"; + capitalize_string_remaps["arm64-v8a"] = "arm64-v8a"; + capitalize_string_remaps["armeabi-v7a"] = "armeabi-v7a"; capitalize_string_remaps["arvr"] = "ARVR"; capitalize_string_remaps["bg"] = "BG"; capitalize_string_remaps["bp"] = "BP"; @@ -130,6 +155,7 @@ EditorPropertyNameProcessor::EditorPropertyNameProcessor() { capitalize_string_remaps["ipad"] = "iPad"; capitalize_string_remaps["iphone"] = "iPhone"; capitalize_string_remaps["ipv6"] = "IPv6"; + capitalize_string_remaps["ir"] = "IR"; capitalize_string_remaps["jit"] = "JIT"; capitalize_string_remaps["k1"] = "K1"; capitalize_string_remaps["k2"] = "K2"; @@ -139,10 +165,12 @@ EditorPropertyNameProcessor::EditorPropertyNameProcessor() { capitalize_string_remaps["lowpass"] = "Low-pass"; capitalize_string_remaps["macos"] = "macOS"; capitalize_string_remaps["mb"] = "(MB)"; // Unit. + capitalize_string_remaps["mms"] = "MMS"; capitalize_string_remaps["ms"] = "(ms)"; // Unit // Not used for now as AudioEffectReverb has a `msec` property. //capitalize_string_remaps["msec"] = "(msec)"; // Unit. capitalize_string_remaps["msaa"] = "MSAA"; + capitalize_string_remaps["nfc"] = "NFC"; capitalize_string_remaps["normalmap"] = "Normal Map"; capitalize_string_remaps["ok"] = "OK"; capitalize_string_remaps["opengl"] = "OpenGL"; @@ -162,6 +190,7 @@ EditorPropertyNameProcessor::EditorPropertyNameProcessor() { capitalize_string_remaps["sdfgi"] = "SDFGI"; capitalize_string_remaps["sdk"] = "SDK"; capitalize_string_remaps["sec"] = "(sec)"; // Unit. + capitalize_string_remaps["sms"] = "SMS"; capitalize_string_remaps["srgb"] = "sRGB"; capitalize_string_remaps["ssao"] = "SSAO"; capitalize_string_remaps["ssh"] = "SSH"; @@ -182,12 +211,15 @@ EditorPropertyNameProcessor::EditorPropertyNameProcessor() { capitalize_string_remaps["uv2"] = "UV2"; capitalize_string_remaps["uwp"] = "UWP"; capitalize_string_remaps["vector2"] = "Vector2"; + capitalize_string_remaps["vpn"] = "VPN"; capitalize_string_remaps["vram"] = "VRAM"; capitalize_string_remaps["vsync"] = "V-Sync"; + capitalize_string_remaps["wap"] = "WAP"; capitalize_string_remaps["webp"] = "WebP"; capitalize_string_remaps["webrtc"] = "WebRTC"; capitalize_string_remaps["websocket"] = "WebSocket"; capitalize_string_remaps["wifi"] = "Wi-Fi"; + capitalize_string_remaps["x86"] = "x86"; capitalize_string_remaps["xr"] = "XR"; capitalize_string_remaps["xy"] = "XY"; capitalize_string_remaps["xz"] = "XZ"; diff --git a/editor/editor_property_name_processor.h b/editor/editor_property_name_processor.h index 616c4cac46..351736550f 100644 --- a/editor/editor_property_name_processor.h +++ b/editor/editor_property_name_processor.h @@ -41,16 +41,27 @@ class EditorPropertyNameProcessor : public Node { mutable Map<String, String> capitalize_string_cache; Map<String, String> capitalize_string_remaps; + // Capitalizes property path segments. String _capitalize_name(const String &p_name) const; public: + // Matches `interface/inspector/capitalize_properties` editor setting. + enum Style { + STYLE_RAW, + STYLE_CAPITALIZED, + STYLE_LOCALIZED, + }; + static EditorPropertyNameProcessor *get_singleton() { return singleton; } - // Capitalize & localize property path segments. - String process_name(const String &p_name) const; + static Style get_default_inspector_style(); + static Style get_settings_style(); + static Style get_tooltip_style(Style p_style); + + static bool is_localization_available(); - // Make tooltip string for names processed by process_name(). - String make_tooltip_for_name(const String &p_name) const; + // Turns property path segment into the given style. + String process_name(const String &p_name, Style p_style) const; EditorPropertyNameProcessor(); ~EditorPropertyNameProcessor(); diff --git a/editor/editor_sectioned_inspector.cpp b/editor/editor_sectioned_inspector.cpp index 627fa0eb35..801a1a4641 100644 --- a/editor/editor_sectioned_inspector.cpp +++ b/editor/editor_sectioned_inspector.cpp @@ -32,15 +32,16 @@ #include "editor/editor_property_name_processor.h" #include "editor/editor_scale.h" +#include "editor/editor_settings.h" -static bool _property_path_matches(const String &p_property_path, const String &p_filter) { +static bool _property_path_matches(const String &p_property_path, const String &p_filter, EditorPropertyNameProcessor::Style p_style) { if (p_property_path.findn(p_filter) != -1) { return true; } const Vector<String> sections = p_property_path.split("/"); for (int i = 0; i < sections.size(); i++) { - if (p_filter.is_subsequence_ofn(EditorPropertyNameProcessor::get_singleton()->process_name(sections[i]))) { + if (p_filter.is_subsequence_ofn(EditorPropertyNameProcessor::get_singleton()->process_name(sections[i], p_style))) { return true; } } @@ -235,6 +236,9 @@ void SectionedInspector::update_category_list() { filter = search_box->get_text(); } + const EditorPropertyNameProcessor::Style name_style = EditorPropertyNameProcessor::get_settings_style(); + const EditorPropertyNameProcessor::Style tooltip_style = EditorPropertyNameProcessor::get_tooltip_style(name_style); + for (PropertyInfo &pi : pinfo) { if (pi.usage & PROPERTY_USAGE_CATEGORY) { continue; @@ -246,7 +250,7 @@ void SectionedInspector::update_category_list() { continue; } - if (!filter.is_empty() && !_property_path_matches(pi.name, filter)) { + if (!filter.is_empty() && !_property_path_matches(pi.name, filter, name_style)) { continue; } @@ -274,8 +278,12 @@ void SectionedInspector::update_category_list() { if (!section_map.has(metasection)) { TreeItem *ms = sections->create_item(parent); section_map[metasection] = ms; - ms->set_text(0, EditorPropertyNameProcessor::get_singleton()->process_name(sectionarr[i])); - ms->set_tooltip(0, EditorPropertyNameProcessor::get_singleton()->make_tooltip_for_name(sectionarr[i])); + + const String text = EditorPropertyNameProcessor::get_singleton()->process_name(sectionarr[i], name_style); + const String tooltip = EditorPropertyNameProcessor::get_singleton()->process_name(sectionarr[i], tooltip_style); + + ms->set_text(0, text); + ms->set_tooltip(0, tooltip); ms->set_metadata(0, metasection); ms->set_selectable(0, false); } @@ -304,6 +312,14 @@ void SectionedInspector::_search_changed(const String &p_what) { update_category_list(); } +void SectionedInspector::_notification(int p_what) { + switch (p_what) { + case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: { + inspector->set_property_name_style(EditorPropertyNameProcessor::get_settings_style()); + } break; + } +} + EditorInspector *SectionedInspector::get_inspector() { return inspector; } @@ -337,6 +353,7 @@ SectionedInspector::SectionedInspector() : inspector->set_v_size_flags(SIZE_EXPAND_FILL); right_vb->add_child(inspector, true); inspector->set_use_doc_hints(true); + inspector->set_property_name_style(EditorPropertyNameProcessor::get_settings_style()); sections->connect("cell_selected", callable_mp(this, &SectionedInspector::_section_selected)); } diff --git a/editor/editor_sectioned_inspector.h b/editor/editor_sectioned_inspector.h index f81c4631e4..7c21e00c03 100644 --- a/editor/editor_sectioned_inspector.h +++ b/editor/editor_sectioned_inspector.h @@ -58,6 +58,9 @@ class SectionedInspector : public HSplitContainer { void _search_changed(const String &p_what); +protected: + void _notification(int p_what); + public: void register_search_box(LineEdit *p_box); EditorInspector *get_inspector(); diff --git a/editor/editor_settings_dialog.cpp b/editor/editor_settings_dialog.cpp index 63b5b5b803..285b909b66 100644 --- a/editor/editor_settings_dialog.cpp +++ b/editor/editor_settings_dialog.cpp @@ -142,6 +142,8 @@ void EditorSettingsDialog::_notification(int p_what) { if (update_shortcuts_tab) { _update_shortcuts(); } + + inspector->update_category_list(); } break; } } @@ -415,6 +417,9 @@ void EditorSettingsDialog::_update_shortcuts() { List<String> slist; EditorSettings::get_singleton()->get_shortcut_list(&slist); + const EditorPropertyNameProcessor::Style name_style = EditorPropertyNameProcessor::get_settings_style(); + const EditorPropertyNameProcessor::Style tooltip_style = EditorPropertyNameProcessor::get_tooltip_style(name_style); + for (const String &E : slist) { Ref<Shortcut> sc = EditorSettings::get_singleton()->get_shortcut(E); if (!sc->has_meta("original")) { @@ -431,9 +436,11 @@ void EditorSettingsDialog::_update_shortcuts() { } else { section = shortcuts->create_item(root); - String item_name = EditorPropertyNameProcessor::get_singleton()->process_name(section_name); + const String item_name = EditorPropertyNameProcessor::get_singleton()->process_name(section_name, name_style); + const String tooltip = EditorPropertyNameProcessor::get_singleton()->process_name(section_name, tooltip_style); + section->set_text(0, item_name); - section->set_tooltip(0, EditorPropertyNameProcessor::get_singleton()->make_tooltip_for_name(section_name)); + section->set_tooltip(0, tooltip); section->set_selectable(0, false); section->set_selectable(1, false); section->set_custom_bg_color(0, shortcuts->get_theme_color(SNAME("prop_subsection"), SNAME("Editor"))); diff --git a/editor/import/scene_import_settings.cpp b/editor/import/scene_import_settings.cpp index 5045e4a541..302bc98499 100644 --- a/editor/import/scene_import_settings.cpp +++ b/editor/import/scene_import_settings.cpp @@ -844,6 +844,10 @@ void SceneImportSettings::_notification(int p_what) { case NOTIFICATION_READY: { connect("confirmed", callable_mp(this, &SceneImportSettings::_re_import)); } break; + + case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: { + inspector->set_property_name_style(EditorPropertyNameProcessor::get_settings_style()); + } break; } } @@ -1231,6 +1235,7 @@ SceneImportSettings::SceneImportSettings() { inspector = memnew(EditorInspector); inspector->set_custom_minimum_size(Size2(300 * EDSCALE, 0)); + inspector->set_property_name_style(EditorPropertyNameProcessor::get_settings_style()); property_split->add_child(inspector); diff --git a/editor/import_dock.cpp b/editor/import_dock.cpp index 9f1daac69f..4df46f2348 100644 --- a/editor/import_dock.cpp +++ b/editor/import_dock.cpp @@ -564,6 +564,7 @@ void ImportDock::_notification(int p_what) { switch (p_what) { case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: { imported->add_theme_style_override("normal", get_theme_stylebox(SNAME("normal"), SNAME("LineEdit"))); + import_opts->set_property_name_style(EditorPropertyNameProcessor::get_settings_style()); } break; case NOTIFICATION_ENTER_TREE: { @@ -638,6 +639,7 @@ ImportDock::ImportDock() { import_opts = memnew(EditorInspector); content->add_child(import_opts); import_opts->set_v_size_flags(SIZE_EXPAND_FILL); + import_opts->set_property_name_style(EditorPropertyNameProcessor::get_settings_style()); import_opts->connect("property_edited", callable_mp(this, &ImportDock::_property_edited)); import_opts->connect("property_toggled", callable_mp(this, &ImportDock::_property_toggled)); diff --git a/editor/inspector_dock.cpp b/editor/inspector_dock.cpp index 9ebea79435..b6dba7ec36 100644 --- a/editor/inspector_dock.cpp +++ b/editor/inspector_dock.cpp @@ -37,6 +37,13 @@ InspectorDock *InspectorDock::singleton = nullptr; +void InspectorDock::_prepare_menu() { + PopupMenu *menu = object_menu->get_popup(); + for (int i = EditorPropertyNameProcessor::STYLE_RAW; i <= EditorPropertyNameProcessor::STYLE_LOCALIZED; i++) { + menu->set_item_checked(menu->get_item_index(PROPERTY_NAME_STYLE_RAW + i), i == property_name_style); + } +} + void InspectorDock::_menu_option(int p_option) { _menu_option_confirm(p_option, false); } @@ -175,6 +182,13 @@ void InspectorDock::_menu_option_confirm(int p_option, bool p_confirmed) { } break; + case PROPERTY_NAME_STYLE_RAW: + case PROPERTY_NAME_STYLE_CAPITALIZED: + case PROPERTY_NAME_STYLE_LOCALIZED: { + property_name_style = (EditorPropertyNameProcessor::Style)(p_option - PROPERTY_NAME_STYLE_RAW); + inspector->set_property_name_style(property_name_style); + } break; + default: { if (p_option >= OBJECT_METHOD_BASE) { ERR_FAIL_COND(!current); @@ -499,8 +513,19 @@ void InspectorDock::update(Object *p_object) { p->clear(); p->add_icon_shortcut(get_theme_icon(SNAME("GuiTreeArrowDown"), SNAME("EditorIcons")), ED_SHORTCUT("property_editor/expand_all", TTR("Expand All")), EXPAND_ALL); p->add_icon_shortcut(get_theme_icon(SNAME("GuiTreeArrowRight"), SNAME("EditorIcons")), ED_SHORTCUT("property_editor/collapse_all", TTR("Collapse All")), COLLAPSE_ALL); - p->add_separator(); + p->add_separator(TTR("Property Name Style")); + p->add_radio_check_item(TTR("Raw"), PROPERTY_NAME_STYLE_RAW); + p->add_radio_check_item(TTR("Capitalized"), PROPERTY_NAME_STYLE_CAPITALIZED); + p->add_radio_check_item(TTR("Localized"), PROPERTY_NAME_STYLE_LOCALIZED); + + if (!EditorPropertyNameProcessor::is_localization_available()) { + const int index = p->get_item_index(PROPERTY_NAME_STYLE_LOCALIZED); + p->set_item_disabled(index, true); + p->set_item_tooltip(index, TTR("Localization not available for current language.")); + } + + p->add_separator(); p->add_shortcut(ED_SHORTCUT("property_editor/copy_params", TTR("Copy Properties")), OBJECT_COPY_PARAMS); p->add_shortcut(ED_SHORTCUT("property_editor/paste_params", TTR("Paste Properties")), OBJECT_PASTE_PARAMS); @@ -534,12 +559,18 @@ void InspectorDock::go_back() { _edit_back(); } +EditorPropertyNameProcessor::Style InspectorDock::get_property_name_style() const { + return property_name_style; +} + InspectorDock::InspectorDock(EditorData &p_editor_data) { singleton = this; set_name("Inspector"); editor_data = &p_editor_data; + property_name_style = EditorPropertyNameProcessor::get_default_inspector_style(); + HBoxContainer *general_options_hb = memnew(HBoxContainer); add_child(general_options_hb); @@ -632,6 +663,7 @@ InspectorDock::InspectorDock(EditorData &p_editor_data) { object_menu->set_shortcut_context(this); property_tools_hb->add_child(object_menu); object_menu->set_tooltip(TTR("Manage object properties.")); + object_menu->get_popup()->connect("about_to_popup", callable_mp(this, &InspectorDock::_prepare_menu)); object_menu->get_popup()->connect("id_pressed", callable_mp(this, &InspectorDock::_menu_option)); warning = memnew(Button); @@ -680,7 +712,7 @@ InspectorDock::InspectorDock(EditorData &p_editor_data) { inspector->set_use_doc_hints(true); inspector->set_hide_script(false); inspector->set_hide_metadata(false); - inspector->set_enable_capitalize_paths(bool(EDITOR_GET("interface/inspector/capitalize_properties"))); + inspector->set_property_name_style(EditorPropertyNameProcessor::get_default_inspector_style()); inspector->set_use_folding(!bool(EDITOR_GET("interface/inspector/disable_folding"))); inspector->register_text_enter(search); inspector->set_undo_redo(&editor_data->get_undo_redo()); diff --git a/editor/inspector_dock.h b/editor/inspector_dock.h index 27552407bd..7e653c4750 100644 --- a/editor/inspector_dock.h +++ b/editor/inspector_dock.h @@ -62,6 +62,11 @@ class InspectorDock : public VBoxContainer { COLLAPSE_ALL, EXPAND_ALL, + // Matches `EditorPropertyNameProcessor::Style`. + PROPERTY_NAME_STYLE_RAW, + PROPERTY_NAME_STYLE_CAPITALIZED, + PROPERTY_NAME_STYLE_LOCALIZED, + OBJECT_METHOD_BASE = 500 }; @@ -94,6 +99,9 @@ class InspectorDock : public VBoxContainer { ConfirmationDialog *unique_resources_confirmation; Tree *unique_resources_list_tree; + EditorPropertyNameProcessor::Style property_name_style; + + void _prepare_menu(); void _menu_option(int p_option); void _menu_confirm_current(); void _menu_option_confirm(int p_option, bool p_confirmed); @@ -139,6 +147,8 @@ public: Container *get_addon_area(); EditorInspector *get_inspector() { return inspector; } + EditorPropertyNameProcessor::Style get_property_name_style() const; + InspectorDock(EditorData &p_editor_data); ~InspectorDock(); }; diff --git a/editor/project_export.cpp b/editor/project_export.cpp index cd9aef1e99..1344afbd3a 100644 --- a/editor/project_export.cpp +++ b/editor/project_export.cpp @@ -68,6 +68,10 @@ void ProjectExportDialog::_notification(int p_what) { connect("confirmed", callable_mp(this, &ProjectExportDialog::_export_pck_zip)); _update_export_all(); } break; + + case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: { + parameters->set_property_name_style(EditorPropertyNameProcessor::get_settings_style()); + } break; } } @@ -1066,6 +1070,7 @@ ProjectExportDialog::ProjectExportDialog() { sections->add_child(parameters); parameters->set_name(TTR("Options")); parameters->set_v_size_flags(Control::SIZE_EXPAND_FILL); + parameters->set_property_name_style(EditorPropertyNameProcessor::get_settings_style()); parameters->connect("property_edited", callable_mp(this, &ProjectExportDialog::_update_parameters)); EditorExport::get_singleton()->connect("export_presets_updated", callable_mp(this, &ProjectExportDialog::_force_update_current_preset_parameters)); diff --git a/editor/scene_tree_dock.cpp b/editor/scene_tree_dock.cpp index 13ece9011b..1d3b18a7d1 100644 --- a/editor/scene_tree_dock.cpp +++ b/editor/scene_tree_dock.cpp @@ -2547,10 +2547,10 @@ void SceneTreeDock::_files_dropped(Vector<String> p_files, NodePath p_to, int p_ property_drop_node = node; resource_drop_path = res_path; - bool capitalize = bool(EDITOR_GET("interface/inspector/capitalize_properties")); + const EditorPropertyNameProcessor::Style style = InspectorDock::get_singleton()->get_property_name_style(); menu_properties->clear(); for (const String &p : valid_properties) { - menu_properties->add_item(capitalize ? p.capitalize() : p); + menu_properties->add_item(EditorPropertyNameProcessor::get_singleton()->process_name(p, style)); menu_properties->set_item_metadata(-1, p); } diff --git a/editor/shader_globals_editor.cpp b/editor/shader_globals_editor.cpp index 70a43d24ba..864afa5c1c 100644 --- a/editor/shader_globals_editor.cpp +++ b/editor/shader_globals_editor.cpp @@ -477,7 +477,7 @@ ShaderGlobalsEditor::ShaderGlobalsEditor() { inspector->set_v_size_flags(SIZE_EXPAND_FILL); add_child(inspector); inspector->set_use_wide_editors(true); - inspector->set_enable_capitalize_paths(false); + inspector->set_property_name_style(EditorPropertyNameProcessor::STYLE_RAW); inspector->set_use_deletable_properties(true); inspector->connect("property_deleted", callable_mp(this, &ShaderGlobalsEditor::_variable_deleted), varray(), CONNECT_DEFERRED); diff --git a/scene/3d/collision_shape_3d.h b/scene/3d/collision_shape_3d.h index bd5595f974..fbcabf6529 100644 --- a/scene/3d/collision_shape_3d.h +++ b/scene/3d/collision_shape_3d.h @@ -37,7 +37,6 @@ class CollisionObject3D; class CollisionShape3D : public Node3D { GDCLASS(CollisionShape3D, Node3D); - OBJ_CATEGORY("3D Physics Nodes"); Ref<Shape3D> shape; diff --git a/scene/3d/light_3d.h b/scene/3d/light_3d.h index 81c25f01c3..383fa644e5 100644 --- a/scene/3d/light_3d.h +++ b/scene/3d/light_3d.h @@ -35,7 +35,6 @@ class Light3D : public VisualInstance3D { GDCLASS(Light3D, VisualInstance3D); - OBJ_CATEGORY("3D Light Nodes"); public: enum Param { diff --git a/scene/3d/node_3d.h b/scene/3d/node_3d.h index 65d0e071cf..6d857a83ea 100644 --- a/scene/3d/node_3d.h +++ b/scene/3d/node_3d.h @@ -50,7 +50,6 @@ public: class Node3D : public Node { GDCLASS(Node3D, Node); - OBJ_CATEGORY("3D"); public: enum RotationEditMode { diff --git a/scene/3d/visual_instance_3d.h b/scene/3d/visual_instance_3d.h index 1c044ba681..f8fd4378fe 100644 --- a/scene/3d/visual_instance_3d.h +++ b/scene/3d/visual_instance_3d.h @@ -35,7 +35,6 @@ class VisualInstance3D : public Node3D { GDCLASS(VisualInstance3D, Node3D); - OBJ_CATEGORY("3D Visual Nodes"); RID base; RID instance; diff --git a/scene/animation/animation_player.h b/scene/animation/animation_player.h index c4fc69f370..a68f6b9d5b 100644 --- a/scene/animation/animation_player.h +++ b/scene/animation/animation_player.h @@ -62,7 +62,6 @@ public: class AnimationPlayer : public Node { GDCLASS(AnimationPlayer, Node); - OBJ_CATEGORY("Animation Nodes"); public: enum AnimationProcessCallback { diff --git a/scene/gui/control.h b/scene/gui/control.h index 9f78d003ae..4240d52b65 100644 --- a/scene/gui/control.h +++ b/scene/gui/control.h @@ -44,7 +44,6 @@ class Panel; class Control : public CanvasItem { GDCLASS(Control, CanvasItem); - OBJ_CATEGORY("GUI Nodes"); public: enum Anchor { diff --git a/scene/main/node.h b/scene/main/node.h index f5fbcf6587..196d23c14f 100644 --- a/scene/main/node.h +++ b/scene/main/node.h @@ -43,7 +43,6 @@ class PropertyTweener; class Node : public Object { GDCLASS(Node, Object); - OBJ_CATEGORY("Nodes"); public: enum ProcessMode { |