summaryrefslogtreecommitdiff
path: root/scene/resources/curve.cpp
diff options
context:
space:
mode:
authorTomasz Chabora <kobewi4e@gmail.com>2019-08-08 22:11:48 +0200
committerTomasz Chabora <kobewi4e@gmail.com>2019-08-09 13:54:52 +0200
commitaf5e0fff66d55d07a7910bcd7f170da2f952f7cb (patch)
treecdf217de6cd3ce1c038b7d159d06635a641105f2 /scene/resources/curve.cpp
parentd2a67c9c1fdee470064f2b3c5750c98f174b5399 (diff)
Remove ERR_EXPLAIN from scene/* code
Diffstat (limited to 'scene/resources/curve.cpp')
-rw-r--r--scene/resources/curve.cpp40
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;