diff options
Diffstat (limited to 'editor')
35 files changed, 303 insertions, 133 deletions
diff --git a/editor/code_editor.cpp b/editor/code_editor.cpp index 2896fda2d2..b6da21bc79 100644 --- a/editor/code_editor.cpp +++ b/editor/code_editor.cpp @@ -854,7 +854,7 @@ void CodeTextEditor::_code_complete_timer_timeout() { } void CodeTextEditor::_complete_request() { - List<ScriptCodeCompletionOption> entries; + List<ScriptLanguage::CodeCompletionOption> entries; String ctext = text_editor->get_text_for_code_completion(); _code_complete_script(ctext, &entries); bool forced = false; @@ -865,7 +865,7 @@ void CodeTextEditor::_complete_request() { return; } - for (const ScriptCodeCompletionOption &e : entries) { + for (const ScriptLanguage::CodeCompletionOption &e : entries) { Color font_color = completion_font_color; if (e.insert_text.begins_with("\"") || e.insert_text.begins_with("\'")) { font_color = completion_string_color; @@ -877,41 +877,41 @@ void CodeTextEditor::_complete_request() { text_editor->update_code_completion_options(forced); } -Ref<Texture2D> CodeTextEditor::_get_completion_icon(const ScriptCodeCompletionOption &p_option) { +Ref<Texture2D> CodeTextEditor::_get_completion_icon(const ScriptLanguage::CodeCompletionOption &p_option) { Ref<Texture2D> tex; switch (p_option.kind) { - case ScriptCodeCompletionOption::KIND_CLASS: { + case ScriptLanguage::CODE_COMPLETION_KIND_CLASS: { if (has_theme_icon(p_option.display, SNAME("EditorIcons"))) { tex = get_theme_icon(p_option.display, SNAME("EditorIcons")); } else { tex = get_theme_icon(SNAME("Object"), SNAME("EditorIcons")); } } break; - case ScriptCodeCompletionOption::KIND_ENUM: + case ScriptLanguage::CODE_COMPLETION_KIND_ENUM: tex = get_theme_icon(SNAME("Enum"), SNAME("EditorIcons")); break; - case ScriptCodeCompletionOption::KIND_FILE_PATH: + case ScriptLanguage::CODE_COMPLETION_KIND_FILE_PATH: tex = get_theme_icon(SNAME("File"), SNAME("EditorIcons")); break; - case ScriptCodeCompletionOption::KIND_NODE_PATH: + case ScriptLanguage::CODE_COMPLETION_KIND_NODE_PATH: tex = get_theme_icon(SNAME("NodePath"), SNAME("EditorIcons")); break; - case ScriptCodeCompletionOption::KIND_VARIABLE: + case ScriptLanguage::CODE_COMPLETION_KIND_VARIABLE: tex = get_theme_icon(SNAME("Variant"), SNAME("EditorIcons")); break; - case ScriptCodeCompletionOption::KIND_CONSTANT: + case ScriptLanguage::CODE_COMPLETION_KIND_CONSTANT: tex = get_theme_icon(SNAME("MemberConstant"), SNAME("EditorIcons")); break; - case ScriptCodeCompletionOption::KIND_MEMBER: + case ScriptLanguage::CODE_COMPLETION_KIND_MEMBER: tex = get_theme_icon(SNAME("MemberProperty"), SNAME("EditorIcons")); break; - case ScriptCodeCompletionOption::KIND_SIGNAL: + case ScriptLanguage::CODE_COMPLETION_KIND_SIGNAL: tex = get_theme_icon(SNAME("MemberSignal"), SNAME("EditorIcons")); break; - case ScriptCodeCompletionOption::KIND_FUNCTION: + case ScriptLanguage::CODE_COMPLETION_KIND_FUNCTION: tex = get_theme_icon(SNAME("MemberMethod"), SNAME("EditorIcons")); break; - case ScriptCodeCompletionOption::KIND_PLAIN_TEXT: + case ScriptLanguage::CODE_COMPLETION_KIND_PLAIN_TEXT: tex = get_theme_icon(SNAME("BoxMesh"), SNAME("EditorIcons")); break; default: diff --git a/editor/code_editor.h b/editor/code_editor.h index d7025e7fd9..bbc45d6ec0 100644 --- a/editor/code_editor.h +++ b/editor/code_editor.h @@ -134,7 +134,7 @@ public: FindReplaceBar(); }; -typedef void (*CodeTextEditorCodeCompleteFunc)(void *p_ud, const String &p_code, List<ScriptCodeCompletionOption> *r_options, bool &r_forced); +typedef void (*CodeTextEditorCodeCompleteFunc)(void *p_ud, const String &p_code, List<ScriptLanguage::CodeCompletionOption> *r_options, bool &r_forced); class CodeTextEditor : public VBoxContainer { GDCLASS(CodeTextEditor, VBoxContainer); @@ -166,7 +166,7 @@ class CodeTextEditor : public VBoxContainer { void _update_text_editor_theme(); void _complete_request(); - Ref<Texture2D> _get_completion_icon(const ScriptCodeCompletionOption &p_option); + Ref<Texture2D> _get_completion_icon(const ScriptLanguage::CodeCompletionOption &p_option); void _font_resize_timeout(); bool _add_font_size(int p_delta); @@ -197,7 +197,7 @@ class CodeTextEditor : public VBoxContainer { protected: virtual void _load_theme_settings() {} virtual void _validate_script() {} - virtual void _code_complete_script(const String &p_code, List<ScriptCodeCompletionOption> *r_options) {} + virtual void _code_complete_script(const String &p_code, List<ScriptLanguage::CodeCompletionOption> *r_options) {} void _text_changed_idle_timeout(); void _code_complete_timer_timeout(); 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_file_dialog.cpp b/editor/editor_file_dialog.cpp index fe19e73db9..ab403c4212 100644 --- a/editor/editor_file_dialog.cpp +++ b/editor/editor_file_dialog.cpp @@ -1308,6 +1308,18 @@ void EditorFileDialog::_update_favorites() { favorite->set_pressed(false); Vector<String> favorited = EditorSettings::get_singleton()->get_favorites(); + + bool fav_changed = false; + for (int i = favorited.size() - 1; i >= 0; i--) { + if (!dir_access->dir_exists(favorited[i])) { + favorited.remove_at(i); + fav_changed = true; + } + } + if (fav_changed) { + EditorSettings::get_singleton()->set_favorites(favorited); + } + for (int i = 0; i < favorited.size(); i++) { bool cres = favorited[i].begins_with("res://"); if (cres != res) { diff --git a/editor/editor_file_system.cpp b/editor/editor_file_system.cpp index 98ba3ae3d8..f3d9449c6c 100644 --- a/editor/editor_file_system.cpp +++ b/editor/editor_file_system.cpp @@ -888,7 +888,7 @@ void EditorFileSystem::_scan_new_dir(EditorFileSystemDirectory *p_dir, DirAccess if (script == nullptr) { continue; } - const Vector<DocData::ClassDoc> &docs = script->get_documentation(); + Vector<DocData::ClassDoc> docs = script->get_documentation(); for (int j = 0; j < docs.size(); j++) { EditorHelp::get_doc_data()->add_doc(docs[j]); } 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 305fe5f6ff..92ab20b999 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -546,6 +546,12 @@ void EditorNode::_update_from_settings() { RS::get_singleton()->decals_set_filter(RS::DecalFilter(int(GLOBAL_GET("rendering/textures/decals/filter")))); RS::get_singleton()->light_projectors_set_filter(RS::LightProjectorFilter(int(GLOBAL_GET("rendering/textures/light_projectors/filter")))); + + SceneTree *tree = get_tree(); + tree->set_debug_collisions_color(GLOBAL_GET("debug/shapes/collision/shape_color")); + tree->set_debug_collision_contact_color(GLOBAL_GET("debug/shapes/collision/contact_color")); + tree->set_debug_navigation_color(GLOBAL_GET("debug/shapes/navigation/geometry_color")); + tree->set_debug_navigation_disabled_color(GLOBAL_GET("debug/shapes/navigation/disabled_geometry_color")); } void EditorNode::_select_default_main_screen_plugin() { @@ -6049,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/editor_spin_slider.cpp b/editor/editor_spin_slider.cpp index 9bf3c4c590..32d28cd3a7 100644 --- a/editor/editor_spin_slider.cpp +++ b/editor/editor_spin_slider.cpp @@ -81,7 +81,7 @@ void EditorSpinSlider::gui_input(const Ref<InputEvent> &p_event) { if (grabbing_spinner_attempt) { if (grabbing_spinner) { Input::get_singleton()->set_mouse_mode(Input::MOUSE_MODE_VISIBLE); - Input::get_singleton()->warp_mouse_position(grabbing_spinner_mouse_pos); + Input::get_singleton()->warp_mouse(grabbing_spinner_mouse_pos); update(); } else { _focus_entered(); @@ -414,7 +414,7 @@ void EditorSpinSlider::_draw_spin_slider() { grabber->set_position(get_global_position() + (grabber_rect.get_center() - grabber->get_size() * 0.5) * scale); if (mousewheel_over_grabber) { - Input::get_singleton()->warp_mouse_position(grabber->get_position() + grabber_rect.size); + Input::get_singleton()->warp_mouse(grabber->get_position() + grabber_rect.size); } grabber_range = width; diff --git a/editor/filesystem_dock.cpp b/editor/filesystem_dock.cpp index 2100a787c8..ee7ed77957 100644 --- a/editor/filesystem_dock.cpp +++ b/editor/filesystem_dock.cpp @@ -224,6 +224,19 @@ void FileSystemDock::_update_tree(const Vector<String> &p_uncollapsed_paths, boo favorites->set_collapsed(p_uncollapsed_paths.find("Favorites") < 0); Vector<String> favorite_paths = EditorSettings::get_singleton()->get_favorites(); + + DirAccessRef da = DirAccess::create(DirAccess::ACCESS_RESOURCES); + bool fav_changed = false; + for (int i = favorite_paths.size() - 1; i >= 0; i--) { + if (!da->dir_exists(favorite_paths[i])) { + favorite_paths.remove_at(i); + fav_changed = true; + } + } + if (fav_changed) { + EditorSettings::get_singleton()->set_favorites(favorite_paths); + } + for (int i = 0; i < favorite_paths.size(); i++) { String fave = favorite_paths[i]; if (!fave.begins_with("res://")) { diff --git a/editor/import/resource_importer_texture.cpp b/editor/import/resource_importer_texture.cpp index 8d6db7d1e0..e2fa624fc6 100644 --- a/editor/import/resource_importer_texture.cpp +++ b/editor/import/resource_importer_texture.cpp @@ -171,6 +171,11 @@ bool ResourceImporterTexture::get_option_visibility(const String &p_path, const if (compress_mode < COMPRESS_VRAM_COMPRESSED) { return false; } + } else if (p_option == "compress/normal_map") { + int compress_mode = int(p_options["compress/mode"]); + if (compress_mode == COMPRESS_LOSSLESS) { + return false; + } } else if (p_option == "mipmaps/limit") { return p_options["mipmaps/generate"]; 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/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp index d713e70251..764f467192 100644 --- a/editor/plugins/canvas_item_editor_plugin.cpp +++ b/editor/plugins/canvas_item_editor_plugin.cpp @@ -4324,8 +4324,8 @@ void CanvasItemEditor::_popup_callback(int p_op) { undo_redo->add_do_method(this, "emit_signal", "item_lock_status_changed"); undo_redo->add_undo_method(this, "emit_signal", "item_lock_status_changed"); } - undo_redo->add_do_method(viewport, "update", Variant()); - undo_redo->add_undo_method(viewport, "update", Variant()); + undo_redo->add_do_method(viewport, "update"); + undo_redo->add_undo_method(viewport, "update"); undo_redo->commit_action(); } break; case UNLOCK_SELECTED: { @@ -4346,8 +4346,8 @@ void CanvasItemEditor::_popup_callback(int p_op) { undo_redo->add_do_method(this, "emit_signal", "item_lock_status_changed"); undo_redo->add_undo_method(this, "emit_signal", "item_lock_status_changed"); } - undo_redo->add_do_method(viewport, "update", Variant()); - undo_redo->add_undo_method(viewport, "update", Variant()); + undo_redo->add_do_method(viewport, "update"); + undo_redo->add_undo_method(viewport, "update"); undo_redo->commit_action(); } break; case GROUP_SELECTED: { @@ -4368,8 +4368,8 @@ void CanvasItemEditor::_popup_callback(int p_op) { undo_redo->add_do_method(this, "emit_signal", "item_group_status_changed"); undo_redo->add_undo_method(this, "emit_signal", "item_group_status_changed"); } - undo_redo->add_do_method(viewport, "update", Variant()); - undo_redo->add_undo_method(viewport, "update", Variant()); + undo_redo->add_do_method(viewport, "update"); + undo_redo->add_undo_method(viewport, "update"); undo_redo->commit_action(); } break; case UNGROUP_SELECTED: { @@ -4390,8 +4390,8 @@ void CanvasItemEditor::_popup_callback(int p_op) { undo_redo->add_do_method(this, "emit_signal", "item_group_status_changed"); undo_redo->add_undo_method(this, "emit_signal", "item_group_status_changed"); } - undo_redo->add_do_method(viewport, "update", Variant()); - undo_redo->add_undo_method(viewport, "update", Variant()); + undo_redo->add_do_method(viewport, "update"); + undo_redo->add_undo_method(viewport, "update"); undo_redo->commit_action(); } break; diff --git a/editor/plugins/node_3d_editor_plugin.cpp b/editor/plugins/node_3d_editor_plugin.cpp index 52e60b606c..ea119a33fa 100644 --- a/editor/plugins/node_3d_editor_plugin.cpp +++ b/editor/plugins/node_3d_editor_plugin.cpp @@ -205,7 +205,7 @@ void ViewportRotationControl::gui_input(const Ref<InputEvent> &p_event) { orbiting = false; if (Input::get_singleton()->get_mouse_mode() == Input::MOUSE_MODE_CAPTURED) { Input::get_singleton()->set_mouse_mode(Input::MOUSE_MODE_VISIBLE); - Input::get_singleton()->warp_mouse_position(orbiting_mouse_start); + Input::get_singleton()->warp_mouse(orbiting_mouse_start); } } } diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp index 2da5978fab..bbaf2bef98 100644 --- a/editor/plugins/script_editor_plugin.cpp +++ b/editor/plugins/script_editor_plugin.cpp @@ -1348,7 +1348,7 @@ void ScriptEditor::_menu_option(int p_option) { } if (script != nullptr) { - const Vector<DocData::ClassDoc> &documentations = script->get_documentation(); + Vector<DocData::ClassDoc> documentations = script->get_documentation(); for (int j = 0; j < documentations.size(); j++) { const DocData::ClassDoc &doc = documentations.get(j); if (EditorHelp::get_doc_data()->has_doc(doc.name)) { @@ -1361,7 +1361,7 @@ void ScriptEditor::_menu_option(int p_option) { EditorNode::get_singleton()->save_resource_as(resource); if (script != nullptr) { - const Vector<DocData::ClassDoc> &documentations = script->get_documentation(); + Vector<DocData::ClassDoc> documentations = script->get_documentation(); for (int j = 0; j < documentations.size(); j++) { const DocData::ClassDoc &doc = documentations.get(j); EditorHelp::get_doc_data()->add_doc(doc); @@ -2464,7 +2464,7 @@ void ScriptEditor::save_current_script() { } if (script != nullptr) { - const Vector<DocData::ClassDoc> &documentations = script->get_documentation(); + Vector<DocData::ClassDoc> documentations = script->get_documentation(); for (int j = 0; j < documentations.size(); j++) { const DocData::ClassDoc &doc = documentations.get(j); if (EditorHelp::get_doc_data()->has_doc(doc.name)) { @@ -2486,7 +2486,7 @@ void ScriptEditor::save_current_script() { } if (script != nullptr) { - const Vector<DocData::ClassDoc> &documentations = script->get_documentation(); + Vector<DocData::ClassDoc> documentations = script->get_documentation(); for (int j = 0; j < documentations.size(); j++) { const DocData::ClassDoc &doc = documentations.get(j); EditorHelp::get_doc_data()->add_doc(doc); @@ -2537,7 +2537,7 @@ void ScriptEditor::save_all_scripts() { } if (script != nullptr) { - const Vector<DocData::ClassDoc> &documentations = script->get_documentation(); + Vector<DocData::ClassDoc> documentations = script->get_documentation(); for (int j = 0; j < documentations.size(); j++) { const DocData::ClassDoc &doc = documentations.get(j); if (EditorHelp::get_doc_data()->has_doc(doc.name)) { @@ -2549,7 +2549,7 @@ void ScriptEditor::save_all_scripts() { EditorNode::get_singleton()->save_resource(edited_res); //external script, save it if (script != nullptr) { - const Vector<DocData::ClassDoc> &documentations = script->get_documentation(); + Vector<DocData::ClassDoc> documentations = script->get_documentation(); for (int j = 0; j < documentations.size(); j++) { const DocData::ClassDoc &doc = documentations.get(j); EditorHelp::get_doc_data()->add_doc(doc); diff --git a/editor/plugins/script_text_editor.cpp b/editor/plugins/script_text_editor.cpp index 30ca1c605f..c1b0a32fc7 100644 --- a/editor/plugins/script_text_editor.cpp +++ b/editor/plugins/script_text_editor.cpp @@ -684,12 +684,12 @@ void ScriptEditor::_update_modified_scripts_for_external_editor(Ref<Script> p_fo } } -void ScriptTextEditor::_code_complete_scripts(void *p_ud, const String &p_code, List<ScriptCodeCompletionOption> *r_options, bool &r_force) { +void ScriptTextEditor::_code_complete_scripts(void *p_ud, const String &p_code, List<ScriptLanguage::CodeCompletionOption> *r_options, bool &r_force) { ScriptTextEditor *ste = (ScriptTextEditor *)p_ud; ste->_code_complete_script(p_code, r_options, r_force); } -void ScriptTextEditor::_code_complete_script(const String &p_code, List<ScriptCodeCompletionOption> *r_options, bool &r_force) { +void ScriptTextEditor::_code_complete_script(const String &p_code, List<ScriptLanguage::CodeCompletionOption> *r_options, bool &r_force) { if (color_panel->is_visible()) { return; } @@ -771,7 +771,7 @@ void ScriptTextEditor::_lookup_symbol(const String &p_symbol, int p_row, int p_c _goto_line(p_row); switch (result.type) { - case ScriptLanguage::LookupResult::RESULT_SCRIPT_LOCATION: { + case ScriptLanguage::LOOKUP_RESULT_SCRIPT_LOCATION: { if (result.script.is_valid()) { emit_signal(SNAME("request_open_script_at_line"), result.script, result.location - 1); } else { @@ -779,10 +779,10 @@ void ScriptTextEditor::_lookup_symbol(const String &p_symbol, int p_row, int p_c goto_line_centered(result.location - 1); } } break; - case ScriptLanguage::LookupResult::RESULT_CLASS: { + case ScriptLanguage::LOOKUP_RESULT_CLASS: { emit_signal(SNAME("go_to_help"), "class_name:" + result.class_name); } break; - case ScriptLanguage::LookupResult::RESULT_CLASS_CONSTANT: { + case ScriptLanguage::LOOKUP_RESULT_CLASS_CONSTANT: { StringName cname = result.class_name; bool success; while (true) { @@ -798,11 +798,11 @@ void ScriptTextEditor::_lookup_symbol(const String &p_symbol, int p_row, int p_c emit_signal(SNAME("go_to_help"), "class_constant:" + result.class_name + ":" + result.class_member); } break; - case ScriptLanguage::LookupResult::RESULT_CLASS_PROPERTY: { + case ScriptLanguage::LOOKUP_RESULT_CLASS_PROPERTY: { emit_signal(SNAME("go_to_help"), "class_property:" + result.class_name + ":" + result.class_member); } break; - case ScriptLanguage::LookupResult::RESULT_CLASS_METHOD: { + case ScriptLanguage::LOOKUP_RESULT_CLASS_METHOD: { StringName cname = result.class_name; while (true) { @@ -817,7 +817,7 @@ void ScriptTextEditor::_lookup_symbol(const String &p_symbol, int p_row, int p_c emit_signal(SNAME("go_to_help"), "class_method:" + result.class_name + ":" + result.class_member); } break; - case ScriptLanguage::LookupResult::RESULT_CLASS_ENUM: { + case ScriptLanguage::LOOKUP_RESULT_CLASS_ENUM: { StringName cname = result.class_name; StringName success; while (true) { @@ -833,9 +833,11 @@ void ScriptTextEditor::_lookup_symbol(const String &p_symbol, int p_row, int p_c emit_signal(SNAME("go_to_help"), "class_enum:" + result.class_name + ":" + result.class_member); } break; - case ScriptLanguage::LookupResult::RESULT_CLASS_TBD_GLOBALSCOPE: { + case ScriptLanguage::LOOKUP_RESULT_CLASS_TBD_GLOBALSCOPE: { emit_signal(SNAME("go_to_help"), "class_global:" + result.class_name + ":" + result.class_member); } break; + default: { + } } } else if (ProjectSettings::get_singleton()->has_autoload(p_symbol)) { // Check for Autoload scenes. diff --git a/editor/plugins/script_text_editor.h b/editor/plugins/script_text_editor.h index 1e2284b403..5c3a66404e 100644 --- a/editor/plugins/script_text_editor.h +++ b/editor/plugins/script_text_editor.h @@ -162,8 +162,8 @@ protected: void _update_bookmark_list(); void _bookmark_item_pressed(int p_idx); - static void _code_complete_scripts(void *p_ud, const String &p_code, List<ScriptCodeCompletionOption> *r_options, bool &r_force); - void _code_complete_script(const String &p_code, List<ScriptCodeCompletionOption> *r_options, bool &r_force); + static void _code_complete_scripts(void *p_ud, const String &p_code, List<ScriptLanguage::CodeCompletionOption> *r_options, bool &r_force); + void _code_complete_script(const String &p_code, List<ScriptLanguage::CodeCompletionOption> *r_options, bool &r_force); void _load_theme_settings(); void _set_theme_for_script(); diff --git a/editor/plugins/shader_editor_plugin.cpp b/editor/plugins/shader_editor_plugin.cpp index dbe6ca192c..070f1fac1e 100644 --- a/editor/plugins/shader_editor_plugin.cpp +++ b/editor/plugins/shader_editor_plugin.cpp @@ -222,7 +222,7 @@ static ShaderLanguage::DataType _get_global_variable_type(const StringName &p_va return (ShaderLanguage::DataType)RS::global_variable_type_get_shader_datatype(gvt); } -void ShaderTextEditor::_code_complete_script(const String &p_code, List<ScriptCodeCompletionOption> *r_options) { +void ShaderTextEditor::_code_complete_script(const String &p_code, List<ScriptLanguage::CodeCompletionOption> *r_options) { _check_shader_mode(); ShaderLanguage sl; diff --git a/editor/plugins/shader_editor_plugin.h b/editor/plugins/shader_editor_plugin.h index b1391e4f66..600b14362e 100644 --- a/editor/plugins/shader_editor_plugin.h +++ b/editor/plugins/shader_editor_plugin.h @@ -65,7 +65,7 @@ protected: static void _bind_methods(); virtual void _load_theme_settings() override; - virtual void _code_complete_script(const String &p_code, List<ScriptCodeCompletionOption> *r_options) override; + virtual void _code_complete_script(const String &p_code, List<ScriptLanguage::CodeCompletionOption> *r_options) override; public: virtual void _validate_script() override; 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/scene_tree_editor.cpp b/editor/scene_tree_editor.cpp index 3b8c540592..44eb5c670d 100644 --- a/editor/scene_tree_editor.cpp +++ b/editor/scene_tree_editor.cpp @@ -96,8 +96,8 @@ void SceneTreeEditor::_cell_button_pressed(Object *p_item, int p_column, int p_i if (n->is_class("CanvasItem") || n->is_class("Node3D")) { undo_redo->add_do_method(n, "remove_meta", "_edit_lock_"); undo_redo->add_undo_method(n, "set_meta", "_edit_lock_", true); - undo_redo->add_do_method(this, "_update_tree", Variant()); - undo_redo->add_undo_method(this, "_update_tree", Variant()); + undo_redo->add_do_method(this, "_update_tree"); + undo_redo->add_undo_method(this, "_update_tree"); undo_redo->add_do_method(this, "emit_signal", "node_changed"); undo_redo->add_undo_method(this, "emit_signal", "node_changed"); } @@ -114,8 +114,8 @@ void SceneTreeEditor::_cell_button_pressed(Object *p_item, int p_column, int p_i if (n->is_class("CanvasItem") || n->is_class("Node3D")) { undo_redo->add_do_method(n, "remove_meta", "_edit_group_"); undo_redo->add_undo_method(n, "set_meta", "_edit_group_", true); - undo_redo->add_do_method(this, "_update_tree", Variant()); - undo_redo->add_undo_method(this, "_update_tree", Variant()); + undo_redo->add_do_method(this, "_update_tree"); + undo_redo->add_undo_method(this, "_update_tree"); undo_redo->add_do_method(this, "emit_signal", "node_changed"); undo_redo->add_undo_method(this, "emit_signal", "node_changed"); } diff --git a/editor/script_create_dialog.cpp b/editor/script_create_dialog.cpp index baafef8639..72f77c859b 100644 --- a/editor/script_create_dialog.cpp +++ b/editor/script_create_dialog.cpp @@ -106,15 +106,7 @@ static Vector<String> _get_hierarchy(String p_class_name) { void ScriptCreateDialog::_notification(int p_what) { switch (p_what) { - case NOTIFICATION_ENTER_TREE: - case NOTIFICATION_THEME_CHANGED: { - for (int i = 0; i < ScriptServer::get_language_count(); i++) { - Ref<Texture2D> language_icon = get_theme_icon(ScriptServer::get_language(i)->get_type(), SNAME("EditorIcons")); - if (language_icon.is_valid()) { - language_menu->set_item_icon(i, language_icon); - } - } - + case NOTIFICATION_ENTER_TREE: { String last_language = EditorSettings::get_singleton()->get_project_metadata("script_setup", "last_selected_language", ""); if (!last_language.is_empty()) { for (int i = 0; i < language_menu->get_item_count(); i++) { @@ -127,9 +119,15 @@ void ScriptCreateDialog::_notification(int p_what) { } else { language_menu->select(default_language); } - if (EditorSettings::get_singleton()->has_meta("script_setup/use_script_templates")) { - is_using_templates = bool(EditorSettings::get_singleton()->get_meta("script_setup/use_script_templates")); - use_templates->set_pressed(is_using_templates); + + [[fallthrough]]; + } + case NOTIFICATION_THEME_CHANGED: { + for (int i = 0; i < ScriptServer::get_language_count(); i++) { + Ref<Texture2D> language_icon = get_theme_icon(ScriptServer::get_language(i)->get_type(), SNAME("EditorIcons")); + if (language_icon.is_valid()) { + language_menu->set_item_icon(i, language_icon); + } } path_button->set_icon(get_theme_icon(SNAME("Folder"), SNAME("EditorIcons"))); @@ -332,13 +330,8 @@ void ScriptCreateDialog::_template_changed(int p_template) { dic_templates_project[parent_name->get_text()] = sinfo.get_hash(); EditorSettings::get_singleton()->set_project_metadata("script_setup", "templates_dictionary", dic_templates_project); } else { - // Save template into to editor dictionary (not a project template). - Dictionary dic_templates; - if (EditorSettings::get_singleton()->has_meta("script_setup/templates_dictionary")) { - dic_templates = (Dictionary)EditorSettings::get_singleton()->get_meta("script_setup/templates_dictionary"); - } - dic_templates[parent_name->get_text()] = sinfo.get_hash(); - EditorSettings::get_singleton()->set_meta("script_setup/templates_dictionary", dic_templates); + // Save template info to editor dictionary (not a project template). + templates_dictionary[parent_name->get_text()] = sinfo.get_hash(); // Remove template from project dictionary as we last used an editor level template. Dictionary dic_templates_project = EditorSettings::get_singleton()->get_project_metadata("script_setup", "templates_dictionary", Dictionary()); if (dic_templates_project.has(parent_name->get_text())) { @@ -479,7 +472,6 @@ void ScriptCreateDialog::_built_in_pressed() { void ScriptCreateDialog::_use_template_pressed() { is_using_templates = use_templates->is_pressed(); - EditorSettings::get_singleton()->set_meta("script_setup/use_script_templates", is_using_templates); _update_dialog(); } @@ -597,10 +589,6 @@ void ScriptCreateDialog::_update_template_menu() { if (is_language_using_templates) { // Get the latest templates used for each type of node from project settings then global settings. Dictionary last_local_templates = EditorSettings::get_singleton()->get_project_metadata("script_setup", "templates_dictionary", Dictionary()); - Dictionary last_global_templates; - if (EditorSettings::get_singleton()->has_meta("script_setup/templates_dictionary")) { - last_global_templates = (Dictionary)EditorSettings::get_singleton()->get_meta("script_setup/templates_dictionary"); - } String inherits_base_type = parent_name->get_text(); // If it inherits from a script, get its parent class first. @@ -655,7 +643,7 @@ void ScriptCreateDialog::_update_template_menu() { // Check for last used template for this node in project settings then in global settings. if (last_local_templates.has(parent_name->get_text()) && t.get_hash() == String(last_local_templates[parent_name->get_text()])) { last_used_template = id; - } else if (last_used_template == -1 && last_global_templates.has(parent_name->get_text()) && t.get_hash() == String(last_global_templates[parent_name->get_text()])) { + } else if (last_used_template == -1 && templates_dictionary.has(parent_name->get_text()) && t.get_hash() == String(templates_dictionary[parent_name->get_text()])) { last_used_template = id; } t.id = id; diff --git a/editor/script_create_dialog.h b/editor/script_create_dialog.h index d7c43f322c..e9f634e2c0 100644 --- a/editor/script_create_dialog.h +++ b/editor/script_create_dialog.h @@ -83,6 +83,7 @@ class ScriptCreateDialog : public ConfirmationDialog { int current_language; int default_language; bool re_check_path = false; + Dictionary templates_dictionary; Control *path_controls[2]; Control *name_controls[2]; 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); |