diff --git a/editor/animation/animation_blend_space_1d_editor.cpp b/editor/animation/animation_blend_space_1d_editor.cpp index 04666cdc1a..ec80f5cccc 100644 --- a/editor/animation/animation_blend_space_1d_editor.cpp +++ b/editor/animation/animation_blend_space_1d_editor.cpp @@ -189,6 +189,7 @@ void AnimationNodeBlendSpace1DEditor::_blend_space_gui_input(const Refis_pressed()) { point = Math::snapped(point, blend_space->get_snap()); } + point = CLAMP(point, blend_space->get_min_space(), blend_space->get_max_space()); updating = true; EditorUndoRedoManager *undo_redo = EditorUndoRedoManager::get_singleton(); @@ -334,6 +335,7 @@ void AnimationNodeBlendSpace1DEditor::_blend_space_draw() { if (snap->is_pressed()) { point = Math::snapped(point, blend_space->get_snap()); } + point = CLAMP(point, blend_space->get_min_space(), blend_space->get_max_space()); } point = (point - blend_space->get_min_space()) / (blend_space->get_max_space() - blend_space->get_min_space()); @@ -566,6 +568,7 @@ void AnimationNodeBlendSpace1DEditor::_update_edited_point_pos() { if (snap->is_pressed()) { pos = Math::snapped(pos, blend_space->get_snap()); } + pos = CLAMP(pos, blend_space->get_min_space(), blend_space->get_max_space()); } updating = true; diff --git a/editor/animation/animation_blend_space_2d_editor.cpp b/editor/animation/animation_blend_space_2d_editor.cpp index f882c2f7ae..a2e8ec3881 100644 --- a/editor/animation/animation_blend_space_2d_editor.cpp +++ b/editor/animation/animation_blend_space_2d_editor.cpp @@ -286,6 +286,7 @@ void AnimationNodeBlendSpace2DEditor::_blend_space_gui_input(const Refis_pressed()) { point = point.snapped(blend_space->get_snap()); } + point = point.clamp(blend_space->get_min_space(), blend_space->get_max_space()); if (!read_only) { updating = true; @@ -598,6 +599,7 @@ void AnimationNodeBlendSpace2DEditor::_blend_space_draw() { if (snap->is_pressed()) { point = point.snapped(blend_space->get_snap()); } + point = point.clamp(blend_space->get_min_space(), blend_space->get_max_space()); } point = (point - blend_space->get_min_space()) / (blend_space->get_max_space() - blend_space->get_min_space()); point *= s; @@ -634,6 +636,7 @@ void AnimationNodeBlendSpace2DEditor::_blend_space_draw() { if (snap->is_pressed()) { point = point.snapped(blend_space->get_snap()); } + point = point.clamp(blend_space->get_min_space(), blend_space->get_max_space()); } point = (point - blend_space->get_min_space()) / (blend_space->get_max_space() - blend_space->get_min_space()); @@ -865,6 +868,7 @@ void AnimationNodeBlendSpace2DEditor::_update_edited_point_pos() { if (snap->is_pressed()) { pos = pos.snapped(blend_space->get_snap()); } + pos = pos.clamp(blend_space->get_min_space(), blend_space->get_max_space()); } updating = true; edit_x->set_value(pos.x);