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
@@ -355,7 +355,7 @@ void PhysicsShapeQueryParameters3D::_bind_methods() {
|
||||
/////////////////////////////////////
|
||||
|
||||
Dictionary PhysicsDirectSpaceState3D::_intersect_ray(const Ref<PhysicsRayQueryParameters3D> &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);
|
||||
@@ -402,7 +402,7 @@ TypedArray<Dictionary> PhysicsDirectSpaceState3D::_intersect_point(const Ref<Phy
|
||||
}
|
||||
|
||||
TypedArray<Dictionary> PhysicsDirectSpaceState3D::_intersect_shape(const Ref<PhysicsShapeQueryParameters3D> &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);
|
||||
@@ -422,7 +422,7 @@ TypedArray<Dictionary> PhysicsDirectSpaceState3D::_intersect_shape(const Ref<Phy
|
||||
}
|
||||
|
||||
Vector<real_t> PhysicsDirectSpaceState3D::_cast_motion(const Ref<PhysicsShapeQueryParameters3D> &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 = 1.0f, closest_unsafe = 1.0f;
|
||||
bool res = cast_motion(p_shape_query->get_parameters(), closest_safe, closest_unsafe);
|
||||
@@ -437,7 +437,7 @@ Vector<real_t> PhysicsDirectSpaceState3D::_cast_motion(const Ref<PhysicsShapeQue
|
||||
}
|
||||
|
||||
TypedArray<Vector3> PhysicsDirectSpaceState3D::_collide_shape(const Ref<PhysicsShapeQueryParameters3D> &p_shape_query, int p_max_results) {
|
||||
ERR_FAIL_COND_V(!p_shape_query.is_valid(), TypedArray<Vector3>());
|
||||
ERR_FAIL_COND_V(p_shape_query.is_null(), TypedArray<Vector3>());
|
||||
|
||||
Vector<Vector3> ret;
|
||||
ret.resize(p_max_results * 2);
|
||||
@@ -455,7 +455,7 @@ TypedArray<Vector3> PhysicsDirectSpaceState3D::_collide_shape(const Ref<PhysicsS
|
||||
}
|
||||
|
||||
Dictionary PhysicsDirectSpaceState3D::_get_rest_info(const Ref<PhysicsShapeQueryParameters3D> &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;
|
||||
|
||||
@@ -651,7 +651,7 @@ void PhysicsTestMotionResult3D::_bind_methods() {
|
||||
///////////////////////////////////////
|
||||
|
||||
bool PhysicsServer3D::_body_test_motion(RID p_body, const Ref<PhysicsTestMotionParameters3D> &p_parameters, const Ref<PhysicsTestMotionResult3D> &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