mirror of
https://github.com/godotengine/godot.git
synced 2025-10-19 16:03:29 +00:00
Merge pull request #107468 from Calinou/editor-animationtree-warn-disabled
Display AnimationTree editor warnings when the node is disabled
This commit is contained in:
commit
af08ab49f7
6 changed files with 28 additions and 20 deletions
|
@ -589,11 +589,7 @@ void AnimationNodeBlendSpace1DEditor::_notification(int p_what) {
|
||||||
|
|
||||||
String error;
|
String error;
|
||||||
|
|
||||||
if (!tree->is_active()) {
|
error = tree->get_editor_error_message();
|
||||||
error = TTR("AnimationTree is inactive.\nActivate to enable playback, check node warnings if activation fails.");
|
|
||||||
} else if (tree->is_state_invalid()) {
|
|
||||||
error = tree->get_invalid_state_reason();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (error != error_label->get_text()) {
|
if (error != error_label->get_text()) {
|
||||||
error_label->set_text(error);
|
error_label->set_text(error);
|
||||||
|
|
|
@ -812,11 +812,9 @@ void AnimationNodeBlendSpace2DEditor::_notification(int p_what) {
|
||||||
|
|
||||||
String error;
|
String error;
|
||||||
|
|
||||||
if (!tree->is_active()) {
|
error = tree->get_editor_error_message();
|
||||||
error = TTR("AnimationTree is inactive.\nActivate to enable playback, check node warnings if activation fails.");
|
|
||||||
} else if (tree->is_state_invalid()) {
|
if (error.is_empty() && blend_space->get_triangle_count() == 0) {
|
||||||
error = tree->get_invalid_state_reason();
|
|
||||||
} else if (blend_space->get_triangle_count() == 0) {
|
|
||||||
error = TTR("No triangles exist, so no blending can take place.");
|
error = TTR("No triangles exist, so no blending can take place.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -970,11 +970,7 @@ void AnimationNodeBlendTreeEditor::_notification(int p_what) {
|
||||||
|
|
||||||
String error;
|
String error;
|
||||||
|
|
||||||
if (!tree->is_active()) {
|
error = tree->get_editor_error_message();
|
||||||
error = TTR("AnimationTree is inactive.\nActivate to enable playback, check node warnings if activation fails.");
|
|
||||||
} else if (tree->is_state_invalid()) {
|
|
||||||
error = tree->get_invalid_state_reason();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (error != error_label->get_text()) {
|
if (error != error_label->get_text()) {
|
||||||
error_label->set_text(error);
|
error_label->set_text(error);
|
||||||
|
|
|
@ -1393,11 +1393,11 @@ void AnimationNodeStateMachineEditor::_notification(int p_what) {
|
||||||
if (error_time > 0) {
|
if (error_time > 0) {
|
||||||
error = error_text;
|
error = error_text;
|
||||||
error_time -= get_process_delta_time();
|
error_time -= get_process_delta_time();
|
||||||
} else if (!tree->is_active()) {
|
} else {
|
||||||
error = TTR("AnimationTree is inactive.\nActivate to enable playback, check node warnings if activation fails.");
|
error = tree->get_editor_error_message();
|
||||||
} else if (tree->is_state_invalid()) {
|
}
|
||||||
error = tree->get_invalid_state_reason();
|
|
||||||
} else if (playback.is_null()) {
|
if (error.is_empty() && playback.is_null()) {
|
||||||
error = vformat(TTR("No playback resource set at path: %s."), AnimationTreeEditor::get_singleton()->get_base_path() + "playback");
|
error = vformat(TTR("No playback resource set at path: %s."), AnimationTreeEditor::get_singleton()->get_base_path() + "playback");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -990,6 +990,20 @@ real_t AnimationTree::get_connection_activity(const StringName &p_path, int p_co
|
||||||
return activity[p_connection].activity;
|
return activity[p_connection].activity;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef TOOLS_ENABLED
|
||||||
|
String AnimationTree::get_editor_error_message() const {
|
||||||
|
if (!is_active()) {
|
||||||
|
return TTR("The AnimationTree is inactive.\nActivate it in the inspector to enable playback; check node warnings if activation fails.");
|
||||||
|
} else if (!is_enabled()) {
|
||||||
|
return TTR("The AnimationTree node (or one of its parents) has its process mode set to Disabled.\nChange the process mode in the inspector to allow playback.");
|
||||||
|
} else if (is_state_invalid()) {
|
||||||
|
return get_invalid_state_reason();
|
||||||
|
}
|
||||||
|
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void AnimationTree::_bind_methods() {
|
void AnimationTree::_bind_methods() {
|
||||||
ClassDB::bind_method(D_METHOD("set_tree_root", "animation_node"), &AnimationTree::set_root_animation_node);
|
ClassDB::bind_method(D_METHOD("set_tree_root", "animation_node"), &AnimationTree::set_root_animation_node);
|
||||||
ClassDB::bind_method(D_METHOD("get_tree_root"), &AnimationTree::get_root_animation_node);
|
ClassDB::bind_method(D_METHOD("get_tree_root"), &AnimationTree::get_root_animation_node);
|
||||||
|
|
|
@ -352,6 +352,10 @@ public:
|
||||||
|
|
||||||
uint64_t get_last_process_pass() const;
|
uint64_t get_last_process_pass() const;
|
||||||
|
|
||||||
|
#ifdef TOOLS_ENABLED
|
||||||
|
String get_editor_error_message() const;
|
||||||
|
#endif
|
||||||
|
|
||||||
AnimationTree();
|
AnimationTree();
|
||||||
~AnimationTree();
|
~AnimationTree();
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue