diff options
Diffstat (limited to 'editor/editor_inspector.cpp')
-rw-r--r-- | editor/editor_inspector.cpp | 40 |
1 files changed, 26 insertions, 14 deletions
diff --git a/editor/editor_inspector.cpp b/editor/editor_inspector.cpp index 59816a0eca..0711bbe84e 100644 --- a/editor/editor_inspector.cpp +++ b/editor/editor_inspector.cpp @@ -35,14 +35,14 @@ #include "editor/editor_feature_profile.h" #include "editor/editor_node.h" #include "editor/editor_property_name_processor.h" -#include "editor/editor_scale.h" #include "editor/editor_settings.h" #include "editor/editor_string_names.h" #include "editor/editor_undo_redo_manager.h" #include "editor/gui/editor_validation_panel.h" #include "editor/inspector_dock.h" +#include "editor/multi_node_edit.h" #include "editor/plugins/script_editor_plugin.h" -#include "multi_node_edit.h" +#include "editor/themes/editor_scale.h" #include "scene/gui/spin_box.h" #include "scene/gui/texture_rect.h" #include "scene/property_utils.h" @@ -436,6 +436,10 @@ void EditorProperty::set_doc_path(const String &p_doc_path) { doc_path = p_doc_path; } +void EditorProperty::set_internal(bool p_internal) { + internal = p_internal; +} + void EditorProperty::update_property() { GDVIRTUAL_CALL(_update_property); } @@ -695,15 +699,14 @@ void EditorProperty::gui_input(const Ref<InputEvent> &p_event) { new_coords.y++; } if (new_coords.x < int64_t(object->get("hframes")) && new_coords.y < int64_t(object->get("vframes"))) { - call_deferred(SNAME("emit_changed"), property, new_coords, "", false); + callable_mp(this, &EditorProperty::emit_changed).call_deferred(property, new_coords, "", false); } } else { if (int64_t(object->get(property)) + 1 < (int64_t(object->get("hframes")) * int64_t(object->get("vframes")))) { - call_deferred(SNAME("emit_changed"), property, object->get(property).operator int64_t() + 1, "", false); + callable_mp(this, &EditorProperty::emit_changed).call_deferred(property, object->get(property).operator int64_t() + 1, "", false); } } - - call_deferred(SNAME("update_property")); + callable_mp(this, &EditorProperty::update_property).call_deferred(); } } if (delete_rect.has_point(mpos)) { @@ -749,10 +752,10 @@ void EditorProperty::shortcut_input(const Ref<InputEvent> &p_event) { if (ED_IS_SHORTCUT("property_editor/copy_value", p_event)) { menu_option(MENU_COPY_VALUE); accept_event(); - } else if (ED_IS_SHORTCUT("property_editor/paste_value", p_event) && !is_read_only()) { + } else if (!is_read_only() && ED_IS_SHORTCUT("property_editor/paste_value", p_event)) { menu_option(MENU_PASTE_VALUE); accept_event(); - } else if (ED_IS_SHORTCUT("property_editor/copy_property_path", p_event)) { + } else if (!internal && ED_IS_SHORTCUT("property_editor/copy_property_path", p_event)) { menu_option(MENU_COPY_PROPERTY_PATH); accept_event(); } @@ -1037,6 +1040,8 @@ void EditorProperty::_update_popup() { menu->add_icon_shortcut(get_editor_theme_icon(SNAME("ActionPaste")), ED_GET_SHORTCUT("property_editor/paste_value"), MENU_PASTE_VALUE); menu->add_icon_shortcut(get_editor_theme_icon(SNAME("CopyNodePath")), ED_GET_SHORTCUT("property_editor/copy_property_path"), MENU_COPY_PROPERTY_PATH); menu->set_item_disabled(MENU_PASTE_VALUE, is_read_only()); + menu->set_item_disabled(MENU_COPY_PROPERTY_PATH, internal); + if (!pin_hidden) { menu->add_separator(); if (can_pin) { @@ -1358,7 +1363,7 @@ void EditorInspectorSection::_notification(int p_what) { Ref<Font> light_font = get_theme_font(SNAME("main"), EditorStringName(EditorFonts)); int light_font_size = get_theme_font_size(SNAME("main_size"), EditorStringName(EditorFonts)); - Color light_font_color = get_theme_color(SNAME("disabled_font_color"), EditorStringName(Editor)); + Color light_font_color = get_theme_color(SNAME("font_disabled_color"), EditorStringName(Editor)); // Can we fit the long version of the revertable count text? num_revertable_str = vformat(TTRN("(%d change)", "(%d changes)", revertable_properties.size()), revertable_properties.size()); @@ -3021,7 +3026,7 @@ void EditorInspector::update_tree() { Vector<String> components = path.split("/"); for (int i = 0; i < components.size(); i++) { - String component = components[i]; + const String &component = components[i]; acc_path += (i > 0) ? "/" + component : component; if (!vbox_per_path[root_vbox].has(acc_path)) { @@ -3330,7 +3335,11 @@ void EditorInspector::update_tree() { if (use_doc_hints) { // `|` separator used in `EditorHelpTooltip` for formatting. if (theme_item_name.is_empty()) { - ep->set_tooltip_text("property|" + classname + "|" + property_prefix + p.name + "|"); + if (p.usage & PROPERTY_USAGE_INTERNAL) { + ep->set_tooltip_text("internal_property|" + classname + "|" + property_prefix + p.name + "|"); + } else { + ep->set_tooltip_text("property|" + classname + "|" + property_prefix + p.name + "|"); + } } else { ep->set_tooltip_text("theme_item|" + classname + "|" + theme_item_name + "|"); } @@ -3338,6 +3347,8 @@ void EditorInspector::update_tree() { } ep->set_doc_path(doc_path); + ep->set_internal(p.usage & PROPERTY_USAGE_INTERNAL); + ep->update_property(); ep->_update_pin_flags(); ep->update_editor_property_status(); @@ -3778,13 +3789,13 @@ void EditorInspector::_property_changed(const String &p_path, const Variant &p_v // The "changing" variable must be true for properties that trigger events as typing occurs, // like "text_changed" signal. E.g. text property of Label, Button, RichTextLabel, etc. if (p_changing) { - this->changing++; + changing++; } _edit_set(p_path, p_value, p_update_all, p_name); if (p_changing) { - this->changing--; + changing--; } if (restart_request_props.has(p_path)) { @@ -3980,7 +3991,7 @@ void EditorInspector::_notification(int p_what) { case NOTIFICATION_PROCESS: { if (update_scroll_request >= 0) { - get_v_scroll_bar()->call_deferred(SNAME("set_value"), update_scroll_request); + callable_mp((Range *)get_v_scroll_bar(), &Range::set_value).call_deferred(update_scroll_request); update_scroll_request = -1; } if (update_tree_pending) { @@ -4209,6 +4220,7 @@ EditorInspector::EditorInspector() { main_vbox->add_theme_constant_override("separation", 0); add_child(main_vbox); set_horizontal_scroll_mode(SCROLL_MODE_DISABLED); + set_follow_focus(true); changing = 0; search_box = nullptr; |