diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2019-08-09 14:25:31 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-08-09 14:25:31 +0200 |
commit | 7bb2215ed0d7415179a8b59ad4766a3b573cf696 (patch) | |
tree | 595b16a4ec53b373d44d59ecfae8bec2bd1aab71 /scene/resources/curve.cpp | |
parent | 7bc984cd67fbc4a76e107d0e6f7d2c3fa2ba9de7 (diff) | |
parent | af5e0fff66d55d07a7910bcd7f170da2f952f7cb (diff) |
Merge pull request #31213 from KoBeWi/explain_scenes
Replace ERR_EXPLAIN in scene/* code
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; |