summaryrefslogtreecommitdiffstats
path: root/editor/plugins/animation_state_machine_editor.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'editor/plugins/animation_state_machine_editor.cpp')
-rw-r--r--editor/plugins/animation_state_machine_editor.cpp15
1 files changed, 5 insertions, 10 deletions
diff --git a/editor/plugins/animation_state_machine_editor.cpp b/editor/plugins/animation_state_machine_editor.cpp
index dbfb143b22..f24747d903 100644
--- a/editor/plugins/animation_state_machine_editor.cpp
+++ b/editor/plugins/animation_state_machine_editor.cpp
@@ -337,10 +337,7 @@ void AnimationNodeStateMachineEditor::_state_machine_gui_input(const Ref<InputEv
if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == MouseButton::LEFT && tool_select->is_pressed()) {
box_selecting = true;
box_selecting_from = box_selecting_to = state_machine_draw->get_local_mouse_position();
- box_selecting_rect = Rect2(MIN(box_selecting_from.x, box_selecting_to.x),
- MIN(box_selecting_from.y, box_selecting_to.y),
- ABS(box_selecting_from.x - box_selecting_to.x),
- ABS(box_selecting_from.y - box_selecting_to.y));
+ box_selecting_rect = Rect2(box_selecting_from.min(box_selecting_to), (box_selecting_from - box_selecting_to).abs());
if (mb->is_command_or_control_pressed() || mb->is_shift_pressed()) {
previous_selected = selected_nodes;
@@ -423,10 +420,7 @@ void AnimationNodeStateMachineEditor::_state_machine_gui_input(const Ref<InputEv
if (mm.is_valid() && box_selecting) {
box_selecting_to = state_machine_draw->get_local_mouse_position();
- box_selecting_rect = Rect2(MIN(box_selecting_from.x, box_selecting_to.x),
- MIN(box_selecting_from.y, box_selecting_to.y),
- ABS(box_selecting_from.x - box_selecting_to.x),
- ABS(box_selecting_from.y - box_selecting_to.y));
+ box_selecting_rect = Rect2(box_selecting_from.min(box_selecting_to), (box_selecting_from - box_selecting_to).abs());
for (int i = 0; i < node_rects.size(); i++) {
bool in_box = node_rects[i].node.intersects(box_selecting_rect);
@@ -1247,14 +1241,14 @@ void AnimationNodeStateMachineEditor::_state_machine_pos_draw_all() {
{
float len = MAX(0.0001, current_length);
float pos = CLAMP(current_play_pos, 0, len);
- float c = current_length == HUGE_LENGTH ? 1 : (pos / len);
+ float c = pos / len;
_state_machine_pos_draw_individual(playback->get_current_node(), c);
}
{
float len = MAX(0.0001, fade_from_length);
float pos = CLAMP(fade_from_current_play_pos, 0, len);
- float c = fade_from_length == HUGE_LENGTH ? 1 : (pos / len);
+ float c = pos / len;
_state_machine_pos_draw_individual(playback->get_fading_from_node(), c);
}
}
@@ -1815,6 +1809,7 @@ AnimationNodeStateMachineEditor::AnimationNodeStateMachineEditor() {
add_child(delete_window);
delete_tree = memnew(Tree);
+ delete_tree->set_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED);
delete_tree->set_hide_root(true);
delete_tree->connect("draw", callable_mp(this, &AnimationNodeStateMachineEditor::_delete_tree_draw));
delete_window->add_child(delete_tree);