From 36b69e515c9dd9631d1367ca057e99f87a6fdca4 Mon Sep 17 00:00:00 2001 From: kingoftheconnors Date: Tue, 6 Oct 2020 22:44:09 -0400 Subject: Add alert in anim trees if resource load fails Add_menu_type implements a resource loading, but only when the resource is initially valid. No alert message is shown if the resource isn't valid, leaving the user without feedback. This commit adds an else clause to the is_valid command to give feedback to the user when loading an animationPlaybackNode into an animation tree fails. --- editor/plugins/animation_blend_space_1d_editor.cpp | 2 ++ editor/plugins/animation_blend_space_2d_editor.cpp | 2 ++ editor/plugins/animation_blend_tree_editor_plugin.cpp | 2 ++ editor/plugins/animation_state_machine_editor.cpp | 2 ++ 4 files changed, 8 insertions(+) diff --git a/editor/plugins/animation_blend_space_1d_editor.cpp b/editor/plugins/animation_blend_space_1d_editor.cpp index d335b29c2f..0ce1f970e8 100644 --- a/editor/plugins/animation_blend_space_1d_editor.cpp +++ b/editor/plugins/animation_blend_space_1d_editor.cpp @@ -363,6 +363,8 @@ void AnimationNodeBlendSpace1DEditor::_file_opened(const String &p_file) { file_loaded = ResourceLoader::load(p_file); if (file_loaded.is_valid()) { _add_menu_type(MENU_LOAD_FILE_CONFIRM); + } else { + EditorNode::get_singleton()->show_warning(TTR("This type of node can't be used. Only root nodes are allowed.")); } } diff --git a/editor/plugins/animation_blend_space_2d_editor.cpp b/editor/plugins/animation_blend_space_2d_editor.cpp index 805df0cbb9..2d62878907 100644 --- a/editor/plugins/animation_blend_space_2d_editor.cpp +++ b/editor/plugins/animation_blend_space_2d_editor.cpp @@ -286,6 +286,8 @@ void AnimationNodeBlendSpace2DEditor::_file_opened(const String &p_file) { file_loaded = ResourceLoader::load(p_file); if (file_loaded.is_valid()) { _add_menu_type(MENU_LOAD_FILE_CONFIRM); + } else { + EditorNode::get_singleton()->show_warning(TTR("This type of node can't be used. Only root nodes are allowed.")); } } diff --git a/editor/plugins/animation_blend_tree_editor_plugin.cpp b/editor/plugins/animation_blend_tree_editor_plugin.cpp index 6419f62343..f5e1788bb7 100644 --- a/editor/plugins/animation_blend_tree_editor_plugin.cpp +++ b/editor/plugins/animation_blend_tree_editor_plugin.cpp @@ -261,6 +261,8 @@ void AnimationNodeBlendTreeEditor::_file_opened(const String &p_file) { file_loaded = ResourceLoader::load(p_file); if (file_loaded.is_valid()) { _add_node(MENU_LOAD_FILE_CONFIRM); + } else { + EditorNode::get_singleton()->show_warning(TTR("This type of node can't be used. Only root nodes are allowed.")); } } diff --git a/editor/plugins/animation_state_machine_editor.cpp b/editor/plugins/animation_state_machine_editor.cpp index 26006d85c9..14468a81eb 100644 --- a/editor/plugins/animation_state_machine_editor.cpp +++ b/editor/plugins/animation_state_machine_editor.cpp @@ -392,6 +392,8 @@ void AnimationNodeStateMachineEditor::_file_opened(const String &p_file) { file_loaded = ResourceLoader::load(p_file); if (file_loaded.is_valid()) { _add_menu_type(MENU_LOAD_FILE_CONFIRM); + } else { + EditorNode::get_singleton()->show_warning(TTR("This type of node can't be used. Only root nodes are allowed.")); } } -- cgit v1.2.3 From 5042e077c27759c5a1fe3199d7cb876ec45fed2f Mon Sep 17 00:00:00 2001 From: kingoftheconnors Date: Sun, 7 Aug 2022 17:32:59 -0400 Subject: Change import animation error to "animation nodes" --- editor/plugins/animation_blend_space_1d_editor.cpp | 2 +- editor/plugins/animation_blend_space_2d_editor.cpp | 2 +- editor/plugins/animation_blend_tree_editor_plugin.cpp | 2 +- editor/plugins/animation_state_machine_editor.cpp | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/editor/plugins/animation_blend_space_1d_editor.cpp b/editor/plugins/animation_blend_space_1d_editor.cpp index 0ce1f970e8..108fd59cac 100644 --- a/editor/plugins/animation_blend_space_1d_editor.cpp +++ b/editor/plugins/animation_blend_space_1d_editor.cpp @@ -364,7 +364,7 @@ void AnimationNodeBlendSpace1DEditor::_file_opened(const String &p_file) { if (file_loaded.is_valid()) { _add_menu_type(MENU_LOAD_FILE_CONFIRM); } else { - EditorNode::get_singleton()->show_warning(TTR("This type of node can't be used. Only root nodes are allowed.")); + EditorNode::get_singleton()->show_warning(TTR("This type of node can't be used. Only animation nodes are allowed.")); } } diff --git a/editor/plugins/animation_blend_space_2d_editor.cpp b/editor/plugins/animation_blend_space_2d_editor.cpp index 2d62878907..dccc8118c9 100644 --- a/editor/plugins/animation_blend_space_2d_editor.cpp +++ b/editor/plugins/animation_blend_space_2d_editor.cpp @@ -287,7 +287,7 @@ void AnimationNodeBlendSpace2DEditor::_file_opened(const String &p_file) { if (file_loaded.is_valid()) { _add_menu_type(MENU_LOAD_FILE_CONFIRM); } else { - EditorNode::get_singleton()->show_warning(TTR("This type of node can't be used. Only root nodes are allowed.")); + EditorNode::get_singleton()->show_warning(TTR("This type of node can't be used. Only animation nodes are allowed.")); } } diff --git a/editor/plugins/animation_blend_tree_editor_plugin.cpp b/editor/plugins/animation_blend_tree_editor_plugin.cpp index f5e1788bb7..a93bff2f34 100644 --- a/editor/plugins/animation_blend_tree_editor_plugin.cpp +++ b/editor/plugins/animation_blend_tree_editor_plugin.cpp @@ -262,7 +262,7 @@ void AnimationNodeBlendTreeEditor::_file_opened(const String &p_file) { if (file_loaded.is_valid()) { _add_node(MENU_LOAD_FILE_CONFIRM); } else { - EditorNode::get_singleton()->show_warning(TTR("This type of node can't be used. Only root nodes are allowed.")); + EditorNode::get_singleton()->show_warning(TTR("This type of node can't be used. Only animation nodes are allowed.")); } } diff --git a/editor/plugins/animation_state_machine_editor.cpp b/editor/plugins/animation_state_machine_editor.cpp index 14468a81eb..1c8cb18fe4 100644 --- a/editor/plugins/animation_state_machine_editor.cpp +++ b/editor/plugins/animation_state_machine_editor.cpp @@ -393,7 +393,7 @@ void AnimationNodeStateMachineEditor::_file_opened(const String &p_file) { if (file_loaded.is_valid()) { _add_menu_type(MENU_LOAD_FILE_CONFIRM); } else { - EditorNode::get_singleton()->show_warning(TTR("This type of node can't be used. Only root nodes are allowed.")); + EditorNode::get_singleton()->show_warning(TTR("This type of node can't be used. Only animation nodes are allowed.")); } } -- cgit v1.2.3