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/3d/camera.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/3d/camera.cpp')
-rw-r--r-- | scene/3d/camera.cpp | 25 |
1 files changed, 5 insertions, 20 deletions
diff --git a/scene/3d/camera.cpp b/scene/3d/camera.cpp index c7d6919a2b..9f8510248c 100644 --- a/scene/3d/camera.cpp +++ b/scene/3d/camera.cpp @@ -279,10 +279,7 @@ Vector3 Camera::project_ray_normal(const Point2 &p_pos) const { Vector3 Camera::project_local_ray_normal(const Point2 &p_pos) const { - if (!is_inside_tree()) { - ERR_EXPLAIN("Camera is not inside scene."); - ERR_FAIL_COND_V(!is_inside_tree(), Vector3()); - } + ERR_FAIL_COND_V_MSG(!is_inside_tree(), Vector3(), "Camera is not inside scene."); Size2 viewport_size = get_viewport()->get_camera_rect_size(); Vector2 cpos = get_viewport()->get_camera_coords(p_pos); @@ -304,10 +301,7 @@ Vector3 Camera::project_local_ray_normal(const Point2 &p_pos) const { Vector3 Camera::project_ray_origin(const Point2 &p_pos) const { - if (!is_inside_tree()) { - ERR_EXPLAIN("Camera is not inside scene."); - ERR_FAIL_COND_V(!is_inside_tree(), Vector3()); - } + ERR_FAIL_COND_V_MSG(!is_inside_tree(), Vector3(), "Camera is not inside scene."); Size2 viewport_size = get_viewport()->get_camera_rect_size(); Vector2 cpos = get_viewport()->get_camera_coords(p_pos); @@ -345,10 +339,7 @@ bool Camera::is_position_behind(const Vector3 &p_pos) const { } Vector<Vector3> Camera::get_near_plane_points() const { - if (!is_inside_tree()) { - ERR_EXPLAIN("Camera is not inside scene."); - ERR_FAIL_COND_V(!is_inside_tree(), Vector<Vector3>()); - } + ERR_FAIL_COND_V_MSG(!is_inside_tree(), Vector<Vector3>(), "Camera is not inside scene."); Size2 viewport_size = get_viewport()->get_visible_rect().size; @@ -372,10 +363,7 @@ Vector<Vector3> Camera::get_near_plane_points() const { Point2 Camera::unproject_position(const Vector3 &p_pos) const { - if (!is_inside_tree()) { - ERR_EXPLAIN("Camera is not inside scene."); - ERR_FAIL_COND_V(!is_inside_tree(), Vector2()); - } + ERR_FAIL_COND_V_MSG(!is_inside_tree(), Vector2(), "Camera is not inside scene."); Size2 viewport_size = get_viewport()->get_visible_rect().size; @@ -400,10 +388,7 @@ Point2 Camera::unproject_position(const Vector3 &p_pos) const { Vector3 Camera::project_position(const Point2 &p_point, float p_z_depth) const { - if (!is_inside_tree()) { - ERR_EXPLAIN("Camera is not inside scene."); - ERR_FAIL_COND_V(!is_inside_tree(), Vector3()); - } + ERR_FAIL_COND_V_MSG(!is_inside_tree(), Vector3(), "Camera is not inside scene."); if (p_z_depth == 0) { return get_global_transform().origin; |