You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-04 12:00:25 +00:00
Improve use of Ref.is_null/valid
Use `is_null` over `!is_valid` and vice versa.
This commit is contained in:
committed by
AThousandShips
parent
0f95e9f8e6
commit
a1846b27ea
@@ -329,7 +329,7 @@ void PhysicsShapeQueryParameters2D::_bind_methods() {
|
||||
///////////////////////////////////////////////////////
|
||||
|
||||
Dictionary PhysicsDirectSpaceState2D::_intersect_ray(const Ref<PhysicsRayQueryParameters2D> &p_ray_query) {
|
||||
ERR_FAIL_COND_V(!p_ray_query.is_valid(), Dictionary());
|
||||
ERR_FAIL_COND_V(p_ray_query.is_null(), Dictionary());
|
||||
|
||||
RayResult result;
|
||||
bool res = intersect_ray(p_ray_query->get_parameters(), result);
|
||||
@@ -375,7 +375,7 @@ TypedArray<Dictionary> PhysicsDirectSpaceState2D::_intersect_point(const Ref<Phy
|
||||
}
|
||||
|
||||
TypedArray<Dictionary> PhysicsDirectSpaceState2D::_intersect_shape(const Ref<PhysicsShapeQueryParameters2D> &p_shape_query, int p_max_results) {
|
||||
ERR_FAIL_COND_V(!p_shape_query.is_valid(), TypedArray<Dictionary>());
|
||||
ERR_FAIL_COND_V(p_shape_query.is_null(), TypedArray<Dictionary>());
|
||||
|
||||
Vector<ShapeResult> sr;
|
||||
sr.resize(p_max_results);
|
||||
@@ -395,7 +395,7 @@ TypedArray<Dictionary> PhysicsDirectSpaceState2D::_intersect_shape(const Ref<Phy
|
||||
}
|
||||
|
||||
Vector<real_t> PhysicsDirectSpaceState2D::_cast_motion(const Ref<PhysicsShapeQueryParameters2D> &p_shape_query) {
|
||||
ERR_FAIL_COND_V(!p_shape_query.is_valid(), Vector<real_t>());
|
||||
ERR_FAIL_COND_V(p_shape_query.is_null(), Vector<real_t>());
|
||||
|
||||
real_t closest_safe, closest_unsafe;
|
||||
bool res = cast_motion(p_shape_query->get_parameters(), closest_safe, closest_unsafe);
|
||||
@@ -410,7 +410,7 @@ Vector<real_t> PhysicsDirectSpaceState2D::_cast_motion(const Ref<PhysicsShapeQue
|
||||
}
|
||||
|
||||
TypedArray<Vector2> PhysicsDirectSpaceState2D::_collide_shape(const Ref<PhysicsShapeQueryParameters2D> &p_shape_query, int p_max_results) {
|
||||
ERR_FAIL_COND_V(!p_shape_query.is_valid(), TypedArray<Vector2>());
|
||||
ERR_FAIL_COND_V(p_shape_query.is_null(), TypedArray<Vector2>());
|
||||
|
||||
Vector<Vector2> ret;
|
||||
ret.resize(p_max_results * 2);
|
||||
@@ -428,7 +428,7 @@ TypedArray<Vector2> PhysicsDirectSpaceState2D::_collide_shape(const Ref<PhysicsS
|
||||
}
|
||||
|
||||
Dictionary PhysicsDirectSpaceState2D::_get_rest_info(const Ref<PhysicsShapeQueryParameters2D> &p_shape_query) {
|
||||
ERR_FAIL_COND_V(!p_shape_query.is_valid(), Dictionary());
|
||||
ERR_FAIL_COND_V(p_shape_query.is_null(), Dictionary());
|
||||
|
||||
ShapeRestInfo sri;
|
||||
|
||||
@@ -606,7 +606,7 @@ void PhysicsTestMotionResult2D::_bind_methods() {
|
||||
///////////////////////////////////////
|
||||
|
||||
bool PhysicsServer2D::_body_test_motion(RID p_body, const Ref<PhysicsTestMotionParameters2D> &p_parameters, const Ref<PhysicsTestMotionResult2D> &p_result) {
|
||||
ERR_FAIL_COND_V(!p_parameters.is_valid(), false);
|
||||
ERR_FAIL_COND_V(p_parameters.is_null(), false);
|
||||
|
||||
MotionResult *result_ptr = nullptr;
|
||||
if (p_result.is_valid()) {
|
||||
|
||||
Reference in New Issue
Block a user