diff options
Diffstat (limited to 'scene/resources/curve.cpp')
-rw-r--r-- | scene/resources/curve.cpp | 40 |
1 files changed, 8 insertions, 32 deletions
diff --git a/scene/resources/curve.cpp b/scene/resources/curve.cpp index cb710dde43..bb14cf3ab1 100644 --- a/scene/resources/curve.cpp +++ b/scene/resources/curve.cpp @@ -765,10 +765,7 @@ Vector2 Curve2D::interpolate_baked(float p_offset, bool p_cubic) const { //validate// int pc = baked_point_cache.size(); - if (pc == 0) { - ERR_EXPLAIN("No points in Curve2D."); - ERR_FAIL_V(Vector2()); - } + ERR_FAIL_COND_V_MSG(pc == 0, Vector2(), "No points in Curve2D."); if (pc == 1) return baked_point_cache.get(0); @@ -831,10 +828,7 @@ Vector2 Curve2D::get_closest_point(const Vector2 &p_to_point) const { //validate// int pc = baked_point_cache.size(); - if (pc == 0) { - ERR_EXPLAIN("No points in Curve2D."); - ERR_FAIL_V(Vector2()); - } + ERR_FAIL_COND_V_MSG(pc == 0, Vector2(), "No points in Curve2D."); if (pc == 1) return baked_point_cache.get(0); @@ -870,10 +864,7 @@ float Curve2D::get_closest_offset(const Vector2 &p_to_point) const { //validate// int pc = baked_point_cache.size(); - if (pc == 0) { - ERR_EXPLAIN("No points in Curve2D."); - ERR_FAIL_V(0.0f); - } + ERR_FAIL_COND_V_MSG(pc == 0, 0.0f, "No points in Curve2D."); if (pc == 1) return 0.0f; @@ -1336,10 +1327,7 @@ Vector3 Curve3D::interpolate_baked(float p_offset, bool p_cubic) const { //validate// int pc = baked_point_cache.size(); - if (pc == 0) { - ERR_EXPLAIN("No points in Curve3D."); - ERR_FAIL_V(Vector3()); - } + ERR_FAIL_COND_V_MSG(pc == 0, Vector3(), "No points in Curve3D."); if (pc == 1) return baked_point_cache.get(0); @@ -1381,10 +1369,7 @@ float Curve3D::interpolate_baked_tilt(float p_offset) const { //validate// int pc = baked_tilt_cache.size(); - if (pc == 0) { - ERR_EXPLAIN("No tilts in Curve3D."); - ERR_FAIL_V(0); - } + ERR_FAIL_COND_V_MSG(pc == 0, 0, "No tilts in Curve3D."); if (pc == 1) return baked_tilt_cache.get(0); @@ -1420,10 +1405,7 @@ Vector3 Curve3D::interpolate_baked_up_vector(float p_offset, bool p_apply_tilt) //validate// // curve may not have baked up vectors int count = baked_up_vector_cache.size(); - if (count == 0) { - ERR_EXPLAIN("No up vectors in Curve3D."); - ERR_FAIL_V(Vector3(0, 1, 0)); - } + ERR_FAIL_COND_V_MSG(count == 0, Vector3(0, 1, 0), "No up vectors in Curve3D."); if (count == 1) return baked_up_vector_cache.get(0); @@ -1491,10 +1473,7 @@ Vector3 Curve3D::get_closest_point(const Vector3 &p_to_point) const { //validate// int pc = baked_point_cache.size(); - if (pc == 0) { - ERR_EXPLAIN("No points in Curve3D."); - ERR_FAIL_V(Vector3()); - } + ERR_FAIL_COND_V_MSG(pc == 0, Vector3(), "No points in Curve3D."); if (pc == 1) return baked_point_cache.get(0); @@ -1530,10 +1509,7 @@ float Curve3D::get_closest_offset(const Vector3 &p_to_point) const { //validate// int pc = baked_point_cache.size(); - if (pc == 0) { - ERR_EXPLAIN("No points in Curve3D."); - ERR_FAIL_V(0.0f); - } + ERR_FAIL_COND_V_MSG(pc == 0, 0.0f, "No points in Curve3D."); if (pc == 1) return 0.0f; |