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.
This commit is contained in:
parent
fe6109101f
commit
36b69e515c
|
@ -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."));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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."));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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."));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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."));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue