diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2023-05-19 08:40:25 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-19 08:40:25 +0200 |
commit | 138882742a95366c833b54035ad58a5764856ffa (patch) | |
tree | c8b4e6735ad51daf8c5804463be83ced3700b081 /editor | |
parent | 60e8a06d4eec393d0a2fc277bd66f080f55333b6 (diff) | |
parent | 5fe254e8f681f400f2ebab187486998f499387f9 (diff) |
Merge pull request #77202 from YuriSizov/4.0-cherrypicks
Cherry-picks for the 4.0 branch (future 4.0.3) - 5th batch
Diffstat (limited to 'editor')
-rw-r--r-- | editor/editor_help.cpp | 19 | ||||
-rw-r--r-- | editor/editor_inspector.cpp | 5 | ||||
-rw-r--r-- | editor/editor_inspector.h | 1 | ||||
-rw-r--r-- | editor/editor_properties.cpp | 1 | ||||
-rw-r--r-- | editor/editor_toaster.cpp | 17 | ||||
-rw-r--r-- | editor/editor_toaster.h | 1 | ||||
-rw-r--r-- | editor/plugins/canvas_item_editor_plugin.cpp | 3 | ||||
-rw-r--r-- | editor/plugins/skeleton_3d_editor_plugin.cpp | 13 | ||||
-rw-r--r-- | editor/plugins/skeleton_3d_editor_plugin.h | 3 |
9 files changed, 35 insertions, 28 deletions
diff --git a/editor/editor_help.cpp b/editor/editor_help.cpp index acbc3ce0dc..bbcf3573ff 100644 --- a/editor/editor_help.cpp +++ b/editor/editor_help.cpp @@ -841,14 +841,15 @@ void EditorHelp::_update_doc() { // Properties overview HashSet<String> skip_methods; - bool has_properties = cd.properties.size() != 0; - if (cd.is_script_doc) { - has_properties = false; - for (int i = 0; i < cd.properties.size(); i++) { - if (cd.properties[i].name.begins_with("_") && cd.properties[i].description.strip_edges().is_empty()) { - continue; - } - has_properties = true; + bool has_properties = false; + bool has_property_descriptions = false; + for (const DocData::PropertyDoc &prop : cd.properties) { + if (cd.is_script_doc && prop.name.begins_with("_") && prop.description.strip_edges().is_empty()) { + continue; + } + has_properties = true; + if (!prop.overridden) { + has_property_descriptions = true; break; } } @@ -1527,7 +1528,7 @@ void EditorHelp::_update_doc() { } // Property descriptions - if (has_properties) { + if (has_property_descriptions) { section_line.push_back(Pair<String, int>(TTR("Property Descriptions"), class_desc->get_paragraph_count() - 2)); _push_title_font(); class_desc->add_text(TTR("Property Descriptions")); diff --git a/editor/editor_inspector.cpp b/editor/editor_inspector.cpp index 8498ddecd6..8118e202fe 100644 --- a/editor/editor_inspector.cpp +++ b/editor/editor_inspector.cpp @@ -1516,6 +1516,11 @@ void EditorInspectorSection::fold() { queue_redraw(); } +void EditorInspectorSection::set_bg_color(const Color &p_bg_color) { + bg_color = p_bg_color; + queue_redraw(); +} + bool EditorInspectorSection::has_revertable_properties() const { return !revertable_properties.is_empty(); } diff --git a/editor/editor_inspector.h b/editor/editor_inspector.h index 76fe929ce4..51a1164350 100644 --- a/editor/editor_inspector.h +++ b/editor/editor_inspector.h @@ -297,6 +297,7 @@ public: VBoxContainer *get_vbox(); void unfold(); void fold(); + void set_bg_color(const Color &p_bg_color); bool has_revertable_properties() const; void property_can_revert_changed(const String &p_path, bool p_can_revert); diff --git a/editor/editor_properties.cpp b/editor/editor_properties.cpp index 348e1ead4a..01a574def6 100644 --- a/editor/editor_properties.cpp +++ b/editor/editor_properties.cpp @@ -3998,6 +3998,7 @@ void EditorPropertyResource::_viewport_selected(const NodePath &p_path) { Ref<ViewportTexture> vt; vt.instantiate(); vt->set_viewport_path_in_scene(get_tree()->get_edited_scene_root()->get_path_to(to_node)); + vt->setup_local_to_scene(); emit_changed(get_edited_property(), vt); update_property(); diff --git a/editor/editor_toaster.cpp b/editor/editor_toaster.cpp index 866a6db2a6..10c3e963af 100644 --- a/editor/editor_toaster.cpp +++ b/editor/editor_toaster.cpp @@ -145,12 +145,6 @@ void EditorToaster::_notification(int p_what) { } void EditorToaster::_error_handler(void *p_self, const char *p_func, const char *p_file, int p_line, const char *p_error, const char *p_errorexp, bool p_editor_notify, ErrorHandlerType p_type) { - // This may be called from a thread. Since we will deal with non-thread-safe elements, - // we have to put it in the queue for safety. - callable_mp_static(&EditorToaster::_error_handler_impl).bind(p_file, p_line, p_error, p_errorexp, p_editor_notify, p_type).call_deferred(); -} - -void EditorToaster::_error_handler_impl(const String &p_file, int p_line, const String &p_error, const String &p_errorexp, bool p_editor_notify, int p_type) { if (!EditorToaster::get_singleton() || !EditorToaster::get_singleton()->is_inside_tree()) { return; } @@ -164,8 +158,13 @@ void EditorToaster::_error_handler_impl(const String &p_file, int p_line, const int show_all_setting = EDITOR_GET("interface/editor/show_internal_errors_in_toast_notifications"); if (p_editor_notify || (show_all_setting == 0 && in_dev) || show_all_setting == 1) { - String err_str = !p_errorexp.is_empty() ? p_errorexp : p_error; - String tooltip_str = p_file + ":" + itos(p_line); + String err_str; + if (p_errorexp && p_errorexp[0]) { + err_str = String::utf8(p_errorexp); + } else { + err_str = String::utf8(p_error); + } + String tooltip_str = String::utf8(p_file) + ":" + itos(p_line); if (!p_editor_notify) { if (p_type == ERR_HANDLER_WARNING) { @@ -175,7 +174,7 @@ void EditorToaster::_error_handler_impl(const String &p_file, int p_line, const } } - Severity severity = ((ErrorHandlerType)p_type == ERR_HANDLER_WARNING) ? SEVERITY_WARNING : SEVERITY_ERROR; + Severity severity = (p_type == ERR_HANDLER_WARNING) ? SEVERITY_WARNING : SEVERITY_ERROR; EditorToaster::get_singleton()->popup_str(err_str, severity, tooltip_str); } } diff --git a/editor/editor_toaster.h b/editor/editor_toaster.h index 4837756b4e..6b834f8288 100644 --- a/editor/editor_toaster.h +++ b/editor/editor_toaster.h @@ -89,7 +89,6 @@ private: const double default_message_duration = 5.0; static void _error_handler(void *p_self, const char *p_func, const char *p_file, int p_line, const char *p_error, const char *p_errorexp, bool p_editor_notify, ErrorHandlerType p_type); - static void _error_handler_impl(const String &p_file, int p_line, const String &p_error, const String &p_errorexp, bool p_editor_notify, int p_type); void _update_vbox_position(); void _update_disable_notifications_button(); void _auto_hide_or_free_toasts(); diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp index f0911ce71d..bb951fbd62 100644 --- a/editor/plugins/canvas_item_editor_plugin.cpp +++ b/editor/plugins/canvas_item_editor_plugin.cpp @@ -4594,6 +4594,9 @@ void CanvasItemEditor::_popup_callback(int p_op) { undo_redo->create_action(TTR("Create Custom Bone2D(s) from Node(s)")); for (const KeyValue<Node *, Object *> &E : selection) { Node2D *n2d = Object::cast_to<Node2D>(E.key); + if (!n2d) { + continue; + } Bone2D *new_bone = memnew(Bone2D); String new_bone_name = n2d->get_name(); diff --git a/editor/plugins/skeleton_3d_editor_plugin.cpp b/editor/plugins/skeleton_3d_editor_plugin.cpp index 285d2e77b2..3d442d24e4 100644 --- a/editor/plugins/skeleton_3d_editor_plugin.cpp +++ b/editor/plugins/skeleton_3d_editor_plugin.cpp @@ -695,9 +695,6 @@ void Skeleton3DEditor::update_joint_tree() { } } -void Skeleton3DEditor::update_editors() { -} - void Skeleton3DEditor::create_editors() { set_h_size_flags(SIZE_EXPAND_FILL); set_focus_mode(FOCUS_ALL); @@ -797,10 +794,8 @@ void Skeleton3DEditor::create_editors() { animation_hb->add_child(key_insert_all_button); // Bone tree. - const Color section_color = get_theme_color(SNAME("prop_subsection"), SNAME("Editor")); - - EditorInspectorSection *bones_section = memnew(EditorInspectorSection); - bones_section->setup("bones", "Bones", skeleton, section_color, true); + bones_section = memnew(EditorInspectorSection); + bones_section->setup("bones", "Bones", skeleton, Color(0.0f, 0.0, 0.0f), true); add_child(bones_section); bones_section->unfold(); @@ -831,7 +826,6 @@ void Skeleton3DEditor::create_editors() { void Skeleton3DEditor::_notification(int p_what) { switch (p_what) { case NOTIFICATION_ENTER_TREE: { - create_editors(); update_joint_tree(); joint_tree->connect("item_selected", callable_mp(this, &Skeleton3DEditor::_joint_tree_selection_changed)); @@ -857,6 +851,7 @@ void Skeleton3DEditor::_notification(int p_what) { key_scale_button->set_icon(get_theme_icon(SNAME("KeyScale"), SNAME("EditorIcons"))); key_insert_button->set_icon(get_theme_icon(SNAME("Key"), SNAME("EditorIcons"))); key_insert_all_button->set_icon(get_theme_icon(SNAME("NewKey"), SNAME("EditorIcons"))); + bones_section->set_bg_color(get_theme_color(SNAME("prop_subsection"), SNAME("Editor"))); update_joint_tree(); } break; @@ -945,6 +940,8 @@ void fragment() { handles_mesh_instance->set_cast_shadows_setting(GeometryInstance3D::SHADOW_CASTING_SETTING_OFF); handles_mesh.instantiate(); handles_mesh_instance->set_mesh(handles_mesh); + + create_editors(); } void Skeleton3DEditor::update_bone_original() { diff --git a/editor/plugins/skeleton_3d_editor_plugin.h b/editor/plugins/skeleton_3d_editor_plugin.h index 3eb840cfa9..f5184976a4 100644 --- a/editor/plugins/skeleton_3d_editor_plugin.h +++ b/editor/plugins/skeleton_3d_editor_plugin.h @@ -132,6 +132,8 @@ class Skeleton3DEditor : public VBoxContainer { Button *key_insert_button = nullptr; Button *key_insert_all_button = nullptr; + EditorInspectorSection *bones_section = nullptr; + EditorFileDialog *file_dialog = nullptr; bool keyable = false; @@ -146,7 +148,6 @@ class Skeleton3DEditor : public VBoxContainer { EditorFileDialog *file_export_lib = nullptr; void update_joint_tree(); - void update_editors(); void create_editors(); |