summaryrefslogtreecommitdiff
path: root/scene/animation/animation_blend_space_2d.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'scene/animation/animation_blend_space_2d.cpp')
-rw-r--r--scene/animation/animation_blend_space_2d.cpp23
1 files changed, 0 insertions, 23 deletions
diff --git a/scene/animation/animation_blend_space_2d.cpp b/scene/animation/animation_blend_space_2d.cpp
index ad60249f9a..a43619b9f3 100644
--- a/scene/animation/animation_blend_space_2d.cpp
+++ b/scene/animation/animation_blend_space_2d.cpp
@@ -142,12 +142,10 @@ void AnimationNodeBlendSpace2D::remove_blend_point(int p_point) {
}
int AnimationNodeBlendSpace2D::get_blend_point_count() const {
-
return blend_points_used;
}
bool AnimationNodeBlendSpace2D::has_triangle(int p_x, int p_y, int p_z) const {
-
ERR_FAIL_INDEX_V(p_x, blend_points_used, false);
ERR_FAIL_INDEX_V(p_y, blend_points_used, false);
ERR_FAIL_INDEX_V(p_z, blend_points_used, false);
@@ -176,7 +174,6 @@ bool AnimationNodeBlendSpace2D::has_triangle(int p_x, int p_y, int p_z) const {
}
void AnimationNodeBlendSpace2D::add_triangle(int p_x, int p_y, int p_z, int p_at_index) {
-
ERR_FAIL_INDEX(p_x, blend_points_used);
ERR_FAIL_INDEX(p_y, blend_points_used);
ERR_FAIL_INDEX(p_z, blend_points_used);
@@ -209,7 +206,6 @@ void AnimationNodeBlendSpace2D::add_triangle(int p_x, int p_y, int p_z, int p_at
}
}
int AnimationNodeBlendSpace2D::get_triangle_point(int p_triangle, int p_point) {
-
_update_triangles();
ERR_FAIL_INDEX_V(p_point, 3, -1);
@@ -227,7 +223,6 @@ int AnimationNodeBlendSpace2D::get_triangle_count() const {
}
void AnimationNodeBlendSpace2D::set_min_space(const Vector2 &p_min) {
-
min_space = p_min;
if (min_space.x >= max_space.x) {
min_space.x = max_space.x - 1;
@@ -241,7 +236,6 @@ Vector2 AnimationNodeBlendSpace2D::get_min_space() const {
}
void AnimationNodeBlendSpace2D::set_max_space(const Vector2 &p_max) {
-
max_space = p_max;
if (max_space.x <= min_space.x) {
max_space.x = min_space.x + 1;
@@ -284,7 +278,6 @@ void AnimationNodeBlendSpace2D::_add_blend_point(int p_index, const Ref<Animatio
}
void AnimationNodeBlendSpace2D::_set_triangles(const Vector<int> &p_triangles) {
-
if (auto_triangles)
return;
ERR_FAIL_COND(p_triangles.size() % 3 != 0);
@@ -294,7 +287,6 @@ void AnimationNodeBlendSpace2D::_set_triangles(const Vector<int> &p_triangles) {
}
Vector<int> AnimationNodeBlendSpace2D::_get_triangles() const {
-
Vector<int> t;
if (auto_triangles && trianges_dirty)
return t;
@@ -318,7 +310,6 @@ void AnimationNodeBlendSpace2D::_queue_auto_triangles() {
}
void AnimationNodeBlendSpace2D::_update_triangles() {
-
if (!auto_triangles || !trianges_dirty)
return;
@@ -344,7 +335,6 @@ void AnimationNodeBlendSpace2D::_update_triangles() {
}
Vector2 AnimationNodeBlendSpace2D::get_closest_point(const Vector2 &p_point) {
-
_update_triangles();
if (triangles.size() == 0)
@@ -360,7 +350,6 @@ Vector2 AnimationNodeBlendSpace2D::get_closest_point(const Vector2 &p_point) {
}
if (Geometry::is_point_in_triangle(p_point, points[0], points[1], points[2])) {
-
return p_point;
}
@@ -381,7 +370,6 @@ Vector2 AnimationNodeBlendSpace2D::get_closest_point(const Vector2 &p_point) {
}
void AnimationNodeBlendSpace2D::_blend_triangle(const Vector2 &p_pos, const Vector2 *p_points, float *r_weights) {
-
if (p_pos.distance_squared_to(p_points[0]) < CMP_EPSILON2) {
r_weights[0] = 1;
r_weights[1] = 0;
@@ -427,7 +415,6 @@ void AnimationNodeBlendSpace2D::_blend_triangle(const Vector2 &p_pos, const Vect
}
float AnimationNodeBlendSpace2D::process(float p_time, bool p_seek) {
-
_update_triangles();
Vector2 blend_pos = get_parameter(blend_position);
@@ -436,7 +423,6 @@ float AnimationNodeBlendSpace2D::process(float p_time, bool p_seek) {
float mind = 0; //time of min distance point
if (blend_mode == BLEND_MODE_INTERPOLATED) {
-
if (triangles.size() == 0)
return 0;
@@ -452,7 +438,6 @@ float AnimationNodeBlendSpace2D::process(float p_time, bool p_seek) {
}
if (Geometry::is_point_in_triangle(blend_pos, points[0], points[1], points[2])) {
-
blend_triangle = i;
_blend_triangle(blend_pos, points, blend_weights);
break;
@@ -494,7 +479,6 @@ float AnimationNodeBlendSpace2D::process(float p_time, bool p_seek) {
first = true;
for (int i = 0; i < blend_points_used; i++) {
-
bool found = false;
for (int j = 0; j < 3; j++) {
if (i == triangle_points[j]) {
@@ -515,22 +499,18 @@ float AnimationNodeBlendSpace2D::process(float p_time, bool p_seek) {
}
}
} else {
-
int new_closest = -1;
float new_closest_dist = 1e20;
for (int i = 0; i < blend_points_used; i++) {
-
float d = blend_points[i].position.distance_squared_to(blend_pos);
if (d < new_closest_dist) {
-
new_closest = i;
new_closest_dist = d;
}
}
if (new_closest != closest && new_closest != -1) {
-
float from = 0;
if (blend_mode == BLEND_MODE_DISCRETE_CARRY && closest != -1) {
//see how much animation remains
@@ -557,7 +537,6 @@ String AnimationNodeBlendSpace2D::get_caption() const {
}
void AnimationNodeBlendSpace2D::_validate_property(PropertyInfo &property) const {
-
if (auto_triangles && property.name == "triangles") {
property.usage = 0;
}
@@ -601,7 +580,6 @@ AnimationNodeBlendSpace2D::BlendMode AnimationNodeBlendSpace2D::get_blend_mode()
}
void AnimationNodeBlendSpace2D::_bind_methods() {
-
ClassDB::bind_method(D_METHOD("add_blend_point", "node", "pos", "at_index"), &AnimationNodeBlendSpace2D::add_blend_point, DEFVAL(-1));
ClassDB::bind_method(D_METHOD("set_blend_point_position", "point", "pos"), &AnimationNodeBlendSpace2D::set_blend_point_position);
ClassDB::bind_method(D_METHOD("get_blend_point_position", "point"), &AnimationNodeBlendSpace2D::get_blend_point_position);
@@ -666,7 +644,6 @@ void AnimationNodeBlendSpace2D::_bind_methods() {
}
AnimationNodeBlendSpace2D::AnimationNodeBlendSpace2D() {
-
for (int i = 0; i < MAX_BLEND_POINTS; i++) {
blend_points[i].name = itos(i);
}