mirror of
https://github.com/godotengine/godot.git
synced 2025-12-07 22:00:10 +00:00
Merge pull request #111935 from vaner-org/statemachine-transitions-improve-validation
Improve validation for adding transition in StateMachine
This commit is contained in:
commit
d64b6bddef
1 changed files with 20 additions and 6 deletions
|
|
@ -1010,8 +1010,20 @@ void AnimationNodeStateMachineEditor::_connect_to(int p_index) {
|
|||
|
||||
void AnimationNodeStateMachineEditor::_add_transition(const bool p_nested_action) {
|
||||
if (connecting_from != StringName() && connecting_to_node != StringName()) {
|
||||
if (connecting_to_node == SceneStringName(Start)) {
|
||||
EditorNode::get_singleton()->show_warning(TTR("Cannot transition to \"Start\"!"));
|
||||
connecting = false;
|
||||
return;
|
||||
}
|
||||
|
||||
if (connecting_from == SceneStringName(End)) {
|
||||
EditorNode::get_singleton()->show_warning(TTR("Cannot transition from \"End\"!"));
|
||||
connecting = false;
|
||||
return;
|
||||
}
|
||||
|
||||
if (state_machine->has_transition(connecting_from, connecting_to_node)) {
|
||||
EditorNode::get_singleton()->show_warning("Transition exists!");
|
||||
EditorNode::get_singleton()->show_warning(TTR("Transition already exists!"));
|
||||
connecting = false;
|
||||
return;
|
||||
}
|
||||
|
|
@ -1039,11 +1051,13 @@ void AnimationNodeStateMachineEditor::_add_transition(const bool p_nested_action
|
|||
|
||||
_select_transition(connecting_from, connecting_to_node);
|
||||
|
||||
if (!state_machine->is_transition_across_group(selected_transition_index)) {
|
||||
EditorNode::get_singleton()->push_item(tr.ptr(), "", true);
|
||||
} else {
|
||||
EditorNode::get_singleton()->push_item(tr.ptr(), "", true);
|
||||
EditorNode::get_singleton()->push_item(nullptr, "", true);
|
||||
if (selected_transition_index >= 0) {
|
||||
if (!state_machine->is_transition_across_group(selected_transition_index)) {
|
||||
EditorNode::get_singleton()->push_item(tr.ptr(), "", true);
|
||||
} else {
|
||||
EditorNode::get_singleton()->push_item(tr.ptr(), "", true);
|
||||
EditorNode::get_singleton()->push_item(nullptr, "", true);
|
||||
}
|
||||
}
|
||||
_update_mode();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue