diff options
Diffstat (limited to 'editor')
-rw-r--r-- | editor/editor_toaster.cpp | 8 | ||||
-rw-r--r-- | editor/editor_toaster.h | 2 | ||||
-rw-r--r-- | editor/plugins/skeleton_3d_editor_plugin.cpp | 17 |
3 files changed, 21 insertions, 6 deletions
diff --git a/editor/editor_toaster.cpp b/editor/editor_toaster.cpp index 319b4709fe..7ca88bd2a2 100644 --- a/editor/editor_toaster.cpp +++ b/editor/editor_toaster.cpp @@ -385,12 +385,19 @@ Control *EditorToaster::popup(Control *p_control, Severity p_severity, double p_ } void EditorToaster::popup_str(String p_message, Severity p_severity, String p_tooltip) { + if (is_processing_error) { + return; + } + // Since "_popup_str" adds nodes to the tree, and since the "add_child" method is not // thread-safe, it's better to defer the call to the next cycle to be thread-safe. + is_processing_error = true; call_deferred(SNAME("_popup_str"), p_message, p_severity, p_tooltip); + is_processing_error = false; } void EditorToaster::_popup_str(String p_message, Severity p_severity, String p_tooltip) { + is_processing_error = true; // Check if we already have a popup with the given message. Control *control = nullptr; for (KeyValue<Control *, Toast> element : toasts) { @@ -432,6 +439,7 @@ void EditorToaster::_popup_str(String p_message, Severity p_severity, String p_t } else { label->set_text(vformat("%s (%d)", p_message, toasts[control].count)); } + is_processing_error = false; } void EditorToaster::close(Control *p_control) { diff --git a/editor/editor_toaster.h b/editor/editor_toaster.h index 2ad8752bee..059245ce66 100644 --- a/editor/editor_toaster.h +++ b/editor/editor_toaster.h @@ -82,6 +82,8 @@ private: }; Map<Control *, Toast> toasts; + bool is_processing_error = false; // Makes sure that we don't handle errors that are triggered within the EditorToaster error processing. + 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); diff --git a/editor/plugins/skeleton_3d_editor_plugin.cpp b/editor/plugins/skeleton_3d_editor_plugin.cpp index 282ee9a5b7..aadc7a2e66 100644 --- a/editor/plugins/skeleton_3d_editor_plugin.cpp +++ b/editor/plugins/skeleton_3d_editor_plugin.cpp @@ -530,18 +530,23 @@ void Skeleton3DEditor::_joint_tree_selection_changed() { TreeItem *selected = joint_tree->get_selected(); if (selected) { const String path = selected->get_metadata(0); - - if (path.begins_with("bones/")) { - const int b_idx = path.get_slicec('/', 1).to_int(); + if (!path.begins_with("bones/")) { + return; + } + const int b_idx = path.get_slicec('/', 1).to_int(); + selected_bone = b_idx; + if (pose_editor) { const String bone_path = "bones/" + itos(b_idx) + "/"; - pose_editor->set_target(bone_path); pose_editor->set_keyable(keyable); - selected_bone = b_idx; } } - pose_editor->set_visible(selected); + + if (pose_editor && pose_editor->is_inside_tree()) { + pose_editor->set_visible(selected); + } set_bone_options_enabled(selected); + _update_properties(); _update_gizmo_visible(); } |