1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-04 12:00:25 +00:00

Fix StateMachine process when transition to end & optimize StringName

This commit is contained in:
Silc Lizard (Tokage) Renew
2024-07-13 17:32:31 +09:00
parent 97b8ad1af0
commit 7cdeac94d1
3 changed files with 44 additions and 47 deletions

View File

@@ -618,7 +618,7 @@ bool AnimationNodeStateMachineEditor::_create_submenu(PopupMenu *p_menu, Ref<Ani
if (ansm == state_machine) {
end_menu->add_item(E, nodes_to_connect.size());
nodes_to_connect.push_back(state_machine->end_node);
nodes_to_connect.push_back(AnimationNodeStateMachine::END_NODE);
continue;
}
@@ -1111,10 +1111,10 @@ void AnimationNodeStateMachineEditor::_state_machine_draw() {
Ref<StyleBox> node_frame_style = is_selected ? theme_cache.node_frame_selected : theme_cache.node_frame;
state_machine_draw->draw_style_box(node_frame_style, nr.node);
if (!is_selected && state_machine->start_node == name) {
if (!is_selected && AnimationNodeStateMachine::START_NODE == name) {
state_machine_draw->draw_style_box(theme_cache.node_frame_start, nr.node);
}
if (!is_selected && state_machine->end_node == name) {
if (!is_selected && AnimationNodeStateMachine::END_NODE == name) {
state_machine_draw->draw_style_box(theme_cache.node_frame_end, nr.node);
}
if (playing && (blend_from == name || current == name || travel_path.has(name))) {
@@ -1188,7 +1188,7 @@ void AnimationNodeStateMachineEditor::_state_machine_pos_draw_individual(const S
return;
}
if (p_name == state_machine->start_node || p_name == state_machine->end_node || p_name.is_empty()) {
if (p_name == AnimationNodeStateMachine::START_NODE || p_name == AnimationNodeStateMachine::END_NODE || p_name.is_empty()) {
return;
}
@@ -1523,7 +1523,7 @@ void AnimationNodeStateMachineEditor::_erase_selected(const bool p_nested_action
undo_redo->create_action(TTR("Node Removed"));
for (int i = 0; i < node_rects.size(); i++) {
if (node_rects[i].node_name == state_machine->start_node || node_rects[i].node_name == state_machine->end_node) {
if (node_rects[i].node_name == AnimationNodeStateMachine::START_NODE || node_rects[i].node_name == AnimationNodeStateMachine::END_NODE) {
continue;
}
@@ -1583,7 +1583,7 @@ void AnimationNodeStateMachineEditor::_update_mode() {
if (tool_select->is_pressed()) {
selection_tools_hb->show();
bool nothing_selected = selected_nodes.is_empty() && selected_transition_from == StringName() && selected_transition_to == StringName();
bool start_end_selected = selected_nodes.size() == 1 && (*selected_nodes.begin() == state_machine->start_node || *selected_nodes.begin() == state_machine->end_node);
bool start_end_selected = selected_nodes.size() == 1 && (*selected_nodes.begin() == AnimationNodeStateMachine::START_NODE || *selected_nodes.begin() == AnimationNodeStateMachine::END_NODE);
tool_erase->set_disabled(nothing_selected || start_end_selected || read_only);
} else {
selection_tools_hb->hide();