summaryrefslogtreecommitdiffstats
path: root/servers/physics_3d/godot_physics_server_3d.cpp
diff options
context:
space:
mode:
authorA Thousand Ships <96648715+AThousandShips@users.noreply.github.com>2023-09-09 17:04:18 +0200
committerA Thousand Ships <96648715+AThousandShips@users.noreply.github.com>2023-09-25 18:45:30 +0200
commitfdd3d36c6d09923f4e458d4526a7b968e7e026d8 (patch)
treed6eb7281c6af0748f77ed81e16d410afcaa9cf9a /servers/physics_3d/godot_physics_server_3d.cpp
parent82f6e9be5ea06bfef1adb315f15a409939b4a100 (diff)
downloadredot-engine-fdd3d36c6d09923f4e458d4526a7b968e7e026d8.tar.gz
[Servers] Replace `ERR_FAIL_COND` with `ERR_FAIL_NULL` where applicable
Diffstat (limited to 'servers/physics_3d/godot_physics_server_3d.cpp')
-rw-r--r--servers/physics_3d/godot_physics_server_3d.cpp360
1 files changed, 180 insertions, 180 deletions
diff --git a/servers/physics_3d/godot_physics_server_3d.cpp b/servers/physics_3d/godot_physics_server_3d.cpp
index b6d8acfbf3..02e22775e8 100644
--- a/servers/physics_3d/godot_physics_server_3d.cpp
+++ b/servers/physics_3d/godot_physics_server_3d.cpp
@@ -104,25 +104,25 @@ RID GodotPhysicsServer3D::custom_shape_create() {
void GodotPhysicsServer3D::shape_set_data(RID p_shape, const Variant &p_data) {
GodotShape3D *shape = shape_owner.get_or_null(p_shape);
- ERR_FAIL_COND(!shape);
+ ERR_FAIL_NULL(shape);
shape->set_data(p_data);
};
void GodotPhysicsServer3D::shape_set_custom_solver_bias(RID p_shape, real_t p_bias) {
GodotShape3D *shape = shape_owner.get_or_null(p_shape);
- ERR_FAIL_COND(!shape);
+ ERR_FAIL_NULL(shape);
shape->set_custom_bias(p_bias);
}
PhysicsServer3D::ShapeType GodotPhysicsServer3D::shape_get_type(RID p_shape) const {
const GodotShape3D *shape = shape_owner.get_or_null(p_shape);
- ERR_FAIL_COND_V(!shape, SHAPE_CUSTOM);
+ ERR_FAIL_NULL_V(shape, SHAPE_CUSTOM);
return shape->get_type();
};
Variant GodotPhysicsServer3D::shape_get_data(RID p_shape) const {
const GodotShape3D *shape = shape_owner.get_or_null(p_shape);
- ERR_FAIL_COND_V(!shape, Variant());
+ ERR_FAIL_NULL_V(shape, Variant());
ERR_FAIL_COND_V(!shape->is_configured(), Variant());
return shape->get_data();
};
@@ -136,7 +136,7 @@ real_t GodotPhysicsServer3D::shape_get_margin(RID p_shape) const {
real_t GodotPhysicsServer3D::shape_get_custom_solver_bias(RID p_shape) const {
const GodotShape3D *shape = shape_owner.get_or_null(p_shape);
- ERR_FAIL_COND_V(!shape, 0);
+ ERR_FAIL_NULL_V(shape, 0);
return shape->get_custom_bias();
}
@@ -146,7 +146,7 @@ RID GodotPhysicsServer3D::space_create() {
space->set_self(id);
RID area_id = area_create();
GodotArea3D *area = area_owner.get_or_null(area_id);
- ERR_FAIL_COND_V(!area, RID());
+ ERR_FAIL_NULL_V(area, RID());
space->set_default_area(area);
area->set_space(space);
area->set_priority(-1);
@@ -160,7 +160,7 @@ RID GodotPhysicsServer3D::space_create() {
void GodotPhysicsServer3D::space_set_active(RID p_space, bool p_active) {
GodotSpace3D *space = space_owner.get_or_null(p_space);
- ERR_FAIL_COND(!space);
+ ERR_FAIL_NULL(space);
if (p_active) {
active_spaces.insert(space);
} else {
@@ -170,27 +170,27 @@ void GodotPhysicsServer3D::space_set_active(RID p_space, bool p_active) {
bool GodotPhysicsServer3D::space_is_active(RID p_space) const {
const GodotSpace3D *space = space_owner.get_or_null(p_space);
- ERR_FAIL_COND_V(!space, false);
+ ERR_FAIL_NULL_V(space, false);
return active_spaces.has(space);
}
void GodotPhysicsServer3D::space_set_param(RID p_space, SpaceParameter p_param, real_t p_value) {
GodotSpace3D *space = space_owner.get_or_null(p_space);
- ERR_FAIL_COND(!space);
+ ERR_FAIL_NULL(space);
space->set_param(p_param, p_value);
}
real_t GodotPhysicsServer3D::space_get_param(RID p_space, SpaceParameter p_param) const {
const GodotSpace3D *space = space_owner.get_or_null(p_space);
- ERR_FAIL_COND_V(!space, 0);
+ ERR_FAIL_NULL_V(space, 0);
return space->get_param(p_param);
}
PhysicsDirectSpaceState3D *GodotPhysicsServer3D::space_get_direct_state(RID p_space) {
GodotSpace3D *space = space_owner.get_or_null(p_space);
- ERR_FAIL_COND_V(!space, nullptr);
+ ERR_FAIL_NULL_V(space, nullptr);
ERR_FAIL_COND_V_MSG((using_threads && !doing_sync) || space->is_locked(), nullptr, "Space state is inaccessible right now, wait for iteration or physics process notification.");
return space->get_direct_state();
@@ -198,19 +198,19 @@ PhysicsDirectSpaceState3D *GodotPhysicsServer3D::space_get_direct_state(RID p_sp
void GodotPhysicsServer3D::space_set_debug_contacts(RID p_space, int p_max_contacts) {
GodotSpace3D *space = space_owner.get_or_null(p_space);
- ERR_FAIL_COND(!space);
+ ERR_FAIL_NULL(space);
space->set_debug_contacts(p_max_contacts);
}
Vector<Vector3> GodotPhysicsServer3D::space_get_contacts(RID p_space) const {
GodotSpace3D *space = space_owner.get_or_null(p_space);
- ERR_FAIL_COND_V(!space, Vector<Vector3>());
+ ERR_FAIL_NULL_V(space, Vector<Vector3>());
return space->get_debug_contacts();
}
int GodotPhysicsServer3D::space_get_contact_count(RID p_space) const {
GodotSpace3D *space = space_owner.get_or_null(p_space);
- ERR_FAIL_COND_V(!space, 0);
+ ERR_FAIL_NULL_V(space, 0);
return space->get_debug_contact_count();
}
@@ -223,12 +223,12 @@ RID GodotPhysicsServer3D::area_create() {
void GodotPhysicsServer3D::area_set_space(RID p_area, RID p_space) {
GodotArea3D *area = area_owner.get_or_null(p_area);
- ERR_FAIL_COND(!area);
+ ERR_FAIL_NULL(area);
GodotSpace3D *space = nullptr;
if (p_space.is_valid()) {
space = space_owner.get_or_null(p_space);
- ERR_FAIL_COND(!space);
+ ERR_FAIL_NULL(space);
}
if (area->get_space() == space) {
@@ -241,7 +241,7 @@ void GodotPhysicsServer3D::area_set_space(RID p_area, RID p_space) {
RID GodotPhysicsServer3D::area_get_space(RID p_area) const {
GodotArea3D *area = area_owner.get_or_null(p_area);
- ERR_FAIL_COND_V(!area, RID());
+ ERR_FAIL_NULL_V(area, RID());
GodotSpace3D *space = area->get_space();
if (!space) {
@@ -252,20 +252,20 @@ RID GodotPhysicsServer3D::area_get_space(RID p_area) const {
void GodotPhysicsServer3D::area_add_shape(RID p_area, RID p_shape, const Transform3D &p_transform, bool p_disabled) {
GodotArea3D *area = area_owner.get_or_null(p_area);
- ERR_FAIL_COND(!area);
+ ERR_FAIL_NULL(area);
GodotShape3D *shape = shape_owner.get_or_null(p_shape);
- ERR_FAIL_COND(!shape);
+ ERR_FAIL_NULL(shape);
area->add_shape(shape, p_transform, p_disabled);
}
void GodotPhysicsServer3D::area_set_shape(RID p_area, int p_shape_idx, RID p_shape) {
GodotArea3D *area = area_owner.get_or_null(p_area);
- ERR_FAIL_COND(!area);
+ ERR_FAIL_NULL(area);
GodotShape3D *shape = shape_owner.get_or_null(p_shape);
- ERR_FAIL_COND(!shape);
+ ERR_FAIL_NULL(shape);
ERR_FAIL_COND(!shape->is_configured());
area->set_shape(p_shape_idx, shape);
@@ -273,45 +273,45 @@ void GodotPhysicsServer3D::area_set_shape(RID p_area, int p_shape_idx, RID p_sha
void GodotPhysicsServer3D::area_set_shape_transform(RID p_area, int p_shape_idx, const Transform3D &p_transform) {
GodotArea3D *area = area_owner.get_or_null(p_area);
- ERR_FAIL_COND(!area);
+ ERR_FAIL_NULL(area);
area->set_shape_transform(p_shape_idx, p_transform);
}
int GodotPhysicsServer3D::area_get_shape_count(RID p_area) const {
GodotArea3D *area = area_owner.get_or_null(p_area);
- ERR_FAIL_COND_V(!area, -1);
+ ERR_FAIL_NULL_V(area, -1);
return area->get_shape_count();
}
RID GodotPhysicsServer3D::area_get_shape(RID p_area, int p_shape_idx) const {
GodotArea3D *area = area_owner.get_or_null(p_area);
- ERR_FAIL_COND_V(!area, RID());
+ ERR_FAIL_NULL_V(area, RID());
GodotShape3D *shape = area->get_shape(p_shape_idx);
- ERR_FAIL_COND_V(!shape, RID());
+ ERR_FAIL_NULL_V(shape, RID());
return shape->get_self();
}
Transform3D GodotPhysicsServer3D::area_get_shape_transform(RID p_area, int p_shape_idx) const {
GodotArea3D *area = area_owner.get_or_null(p_area);
- ERR_FAIL_COND_V(!area, Transform3D());
+ ERR_FAIL_NULL_V(area, Transform3D());
return area->get_shape_transform(p_shape_idx);
}
void GodotPhysicsServer3D::area_remove_shape(RID p_area, int p_shape_idx) {
GodotArea3D *area = area_owner.get_or_null(p_area);
- ERR_FAIL_COND(!area);
+ ERR_FAIL_NULL(area);
area->remove_shape(p_shape_idx);
}
void GodotPhysicsServer3D::area_clear_shapes(RID p_area) {
GodotArea3D *area = area_owner.get_or_null(p_area);
- ERR_FAIL_COND(!area);
+ ERR_FAIL_NULL(area);
while (area->get_shape_count()) {
area->remove_shape(0);
@@ -320,7 +320,7 @@ void GodotPhysicsServer3D::area_clear_shapes(RID p_area) {
void GodotPhysicsServer3D::area_set_shape_disabled(RID p_area, int p_shape_idx, bool p_disabled) {
GodotArea3D *area = area_owner.get_or_null(p_area);
- ERR_FAIL_COND(!area);
+ ERR_FAIL_NULL(area);
ERR_FAIL_INDEX(p_shape_idx, area->get_shape_count());
FLUSH_QUERY_CHECK(area);
area->set_shape_disabled(p_shape_idx, p_disabled);
@@ -332,7 +332,7 @@ void GodotPhysicsServer3D::area_attach_object_instance_id(RID p_area, ObjectID p
p_area = space->get_default_area()->get_self();
}
GodotArea3D *area = area_owner.get_or_null(p_area);
- ERR_FAIL_COND(!area);
+ ERR_FAIL_NULL(area);
area->set_instance_id(p_id);
}
@@ -342,7 +342,7 @@ ObjectID GodotPhysicsServer3D::area_get_object_instance_id(RID p_area) const {
p_area = space->get_default_area()->get_self();
}
GodotArea3D *area = area_owner.get_or_null(p_area);
- ERR_FAIL_COND_V(!area, ObjectID());
+ ERR_FAIL_NULL_V(area, ObjectID());
return area->get_instance_id();
}
@@ -352,13 +352,13 @@ void GodotPhysicsServer3D::area_set_param(RID p_area, AreaParameter p_param, con
p_area = space->get_default_area()->get_self();
}
GodotArea3D *area = area_owner.get_or_null(p_area);
- ERR_FAIL_COND(!area);
+ ERR_FAIL_NULL(area);
area->set_param(p_param, p_value);
};
void GodotPhysicsServer3D::area_set_transform(RID p_area, const Transform3D &p_transform) {
GodotArea3D *area = area_owner.get_or_null(p_area);
- ERR_FAIL_COND(!area);
+ ERR_FAIL_NULL(area);
area->set_transform(p_transform);
};
@@ -368,49 +368,49 @@ Variant GodotPhysicsServer3D::area_get_param(RID p_area, AreaParameter p_param)
p_area = space->get_default_area()->get_self();
}
GodotArea3D *area = area_owner.get_or_null(p_area);
- ERR_FAIL_COND_V(!area, Variant());
+ ERR_FAIL_NULL_V(area, Variant());
return area->get_param(p_param);
};
Transform3D GodotPhysicsServer3D::area_get_transform(RID p_area) const {
GodotArea3D *area = area_owner.get_or_null(p_area);
- ERR_FAIL_COND_V(!area, Transform3D());
+ ERR_FAIL_NULL_V(area, Transform3D());
return area->get_transform();
};
void GodotPhysicsServer3D::area_set_collision_layer(RID p_area, uint32_t p_layer) {
GodotArea3D *area = area_owner.get_or_null(p_area);
- ERR_FAIL_COND(!area);
+ ERR_FAIL_NULL(area);
area->set_collision_layer(p_layer);
}
uint32_t GodotPhysicsServer3D::area_get_collision_layer(RID p_area) const {
GodotArea3D *area = area_owner.get_or_null(p_area);
- ERR_FAIL_COND_V(!area, 0);
+ ERR_FAIL_NULL_V(area, 0);
return area->get_collision_layer();
}
void GodotPhysicsServer3D::area_set_collision_mask(RID p_area, uint32_t p_mask) {
GodotArea3D *area = area_owner.get_or_null(p_area);
- ERR_FAIL_COND(!area);
+ ERR_FAIL_NULL(area);
area->set_collision_mask(p_mask);
}
uint32_t GodotPhysicsServer3D::area_get_collision_mask(RID p_area) const {
GodotArea3D *area = area_owner.get_or_null(p_area);
- ERR_FAIL_COND_V(!area, 0);
+ ERR_FAIL_NULL_V(area, 0);
return area->get_collision_mask();
}
void GodotPhysicsServer3D::area_set_monitorable(RID p_area, bool p_monitorable) {
GodotArea3D *area = area_owner.get_or_null(p_area);
- ERR_FAIL_COND(!area);
+ ERR_FAIL_NULL(area);
FLUSH_QUERY_CHECK(area);
area->set_monitorable(p_monitorable);
@@ -418,21 +418,21 @@ void GodotPhysicsServer3D::area_set_monitorable(RID p_area, bool p_monitorable)
void GodotPhysicsServer3D::area_set_monitor_callback(RID p_area, const Callable &p_callback) {
GodotArea3D *area = area_owner.get_or_null(p_area);
- ERR_FAIL_COND(!area);
+ ERR_FAIL_NULL(area);
area->set_monitor_callback(p_callback.is_valid() ? p_callback : Callable());
}
void GodotPhysicsServer3D::area_set_ray_pickable(RID p_area, bool p_enable) {
GodotArea3D *area = area_owner.get_or_null(p_area);
- ERR_FAIL_COND(!area);
+ ERR_FAIL_NULL(area);
area->set_ray_pickable(p_enable);
}
void GodotPhysicsServer3D::area_set_area_monitor_callback(RID p_area, const Callable &p_callback) {
GodotArea3D *area = area_owner.get_or_null(p_area);
- ERR_FAIL_COND(!area);
+ ERR_FAIL_NULL(area);
area->set_area_monitor_callback(p_callback.is_valid() ? p_callback : Callable());
}
@@ -448,12 +448,12 @@ RID GodotPhysicsServer3D::body_create() {
void GodotPhysicsServer3D::body_set_space(RID p_body, RID p_space) {
GodotBody3D *body = body_owner.get_or_null(p_body);
- ERR_FAIL_COND(!body);
+ ERR_FAIL_NULL(body);
GodotSpace3D *space = nullptr;
if (p_space.is_valid()) {
space = space_owner.get_or_null(p_space);
- ERR_FAIL_COND(!space);
+ ERR_FAIL_NULL(space);
}
if (body->get_space() == space) {
@@ -466,7 +466,7 @@ void GodotPhysicsServer3D::body_set_space(RID p_body, RID p_space) {
RID GodotPhysicsServer3D::body_get_space(RID p_body) const {
GodotBody3D *body = body_owner.get_or_null(p_body);
- ERR_FAIL_COND_V(!body, RID());
+ ERR_FAIL_NULL_V(body, RID());
GodotSpace3D *space = body->get_space();
if (!space) {
@@ -477,65 +477,65 @@ RID GodotPhysicsServer3D::body_get_space(RID p_body) const {
void GodotPhysicsServer3D::body_set_mode(RID p_body, BodyMode p_mode) {
GodotBody3D *body = body_owner.get_or_null(p_body);
- ERR_FAIL_COND(!body);
+ ERR_FAIL_NULL(body);
body->set_mode(p_mode);
};
PhysicsServer3D::BodyMode GodotPhysicsServer3D::body_get_mode(RID p_body) const {
GodotBody3D *body = body_owner.get_or_null(p_body);
- ERR_FAIL_COND_V(!body, BODY_MODE_STATIC);
+ ERR_FAIL_NULL_V(body, BODY_MODE_STATIC);
return body->get_mode();
};
void GodotPhysicsServer3D::body_add_shape(RID p_body, RID p_shape, const Transform3D &p_transform, bool p_disabled) {
GodotBody3D *body = body_owner.get_or_null(p_body);
- ERR_FAIL_COND(!body);
+ ERR_FAIL_NULL(body);
GodotShape3D *shape = shape_owner.get_or_null(p_shape);
- ERR_FAIL_COND(!shape);
+ ERR_FAIL_NULL(shape);
body->add_shape(shape, p_transform, p_disabled);
}
void GodotPhysicsServer3D::body_set_shape(RID p_body, int p_shape_idx, RID p_shape) {
GodotBody3D *body = body_owner.get_or_null(p_body);
- ERR_FAIL_COND(!body);
+ ERR_FAIL_NULL(body);
GodotShape3D *shape = shape_owner.get_or_null(p_shape);
- ERR_FAIL_COND(!shape);
+ ERR_FAIL_NULL(shape);
ERR_FAIL_COND(!shape->is_configured());
body->set_shape(p_shape_idx, shape);
}
void GodotPhysicsServer3D::body_set_shape_transform(RID p_body, int p_shape_idx, const Transform3D &p_transform) {
GodotBody3D *body = body_owner.get_or_null(p_body);
- ERR_FAIL_COND(!body);
+ ERR_FAIL_NULL(body);
body->set_shape_transform(p_shape_idx, p_transform);
}
int GodotPhysicsServer3D::body_get_shape_count(RID p_body) const {
GodotBody3D *body = body_owner.get_or_null(p_body);
- ERR_FAIL_COND_V(!body, -1);
+ ERR_FAIL_NULL_V(body, -1);
return body->get_shape_count();
}
RID GodotPhysicsServer3D::body_get_shape(RID p_body, int p_shape_idx) const {
GodotBody3D *body = body_owner.get_or_null(p_body);
- ERR_FAIL_COND_V(!body, RID());
+ ERR_FAIL_NULL_V(body, RID());
GodotShape3D *shape = body->get_shape(p_shape_idx);
- ERR_FAIL_COND_V(!shape, RID());
+ ERR_FAIL_NULL_V(shape, RID());
return shape->get_self();
}
void GodotPhysicsServer3D::body_set_shape_disabled(RID p_body, int p_shape_idx, bool p_disabled) {
GodotBody3D *body = body_owner.get_or_null(p_body);
- ERR_FAIL_COND(!body);
+ ERR_FAIL_NULL(body);
ERR_FAIL_INDEX(p_shape_idx, body->get_shape_count());
FLUSH_QUERY_CHECK(body);
@@ -544,21 +544,21 @@ void GodotPhysicsServer3D::body_set_shape_disabled(RID p_body, int p_shape_idx,
Transform3D GodotPhysicsServer3D::body_get_shape_transform(RID p_body, int p_shape_idx) const {
GodotBody3D *body = body_owner.get_or_null(p_body);
- ERR_FAIL_COND_V(!body, Transform3D());
+ ERR_FAIL_NULL_V(body, Transform3D());
return body->get_shape_transform(p_shape_idx);
}
void GodotPhysicsServer3D::body_remove_shape(RID p_body, int p_shape_idx) {
GodotBody3D *body = body_owner.get_or_null(p_body);
- ERR_FAIL_COND(!body);
+ ERR_FAIL_NULL(body);
body->remove_shape(p_shape_idx);
}
void GodotPhysicsServer3D::body_clear_shapes(RID p_body) {
GodotBody3D *body = body_owner.get_or_null(p_body);
- ERR_FAIL_COND(!body);
+ ERR_FAIL_NULL(body);
while (body->get_shape_count()) {
body->remove_shape(0);
@@ -567,56 +567,56 @@ void GodotPhysicsServer3D::body_clear_shapes(RID p_body) {
void GodotPhysicsServer3D::body_set_enable_continuous_collision_detection(RID p_body, bool p_enable) {
GodotBody3D *body = body_owner.get_or_null(p_body);
- ERR_FAIL_COND(!body);
+ ERR_FAIL_NULL(body);
body->set_continuous_collision_detection(p_enable);
}
bool GodotPhysicsServer3D::body_is_continuous_collision_detection_enabled(RID p_body) const {
GodotBody3D *body = body_owner.get_or_null(p_body);
- ERR_FAIL_COND_V(!body, false);
+ ERR_FAIL_NULL_V(body, false);
return body->is_continuous_collision_detection_enabled();
}
void GodotPhysicsServer3D::body_set_collision_layer(RID p_body, uint32_t p_layer) {
GodotBody3D *body = body_owner.get_or_null(p_body);
- ERR_FAIL_COND(!body);
+ ERR_FAIL_NULL(body);
body->set_collision_layer(p_layer);
}
uint32_t GodotPhysicsServer3D::body_get_collision_layer(RID p_body) const {
const GodotBody3D *body = body_owner.get_or_null(p_body);
- ERR_FAIL_COND_V(!body, 0);
+ ERR_FAIL_NULL_V(body, 0);
return body->get_collision_layer();
}
void GodotPhysicsServer3D::body_set_collision_mask(RID p_body, uint32_t p_mask) {
GodotBody3D *body = body_owner.get_or_null(p_body);
- ERR_FAIL_COND(!body);
+ ERR_FAIL_NULL(body);
body->set_collision_mask(p_mask);
}
uint32_t GodotPhysicsServer3D::body_get_collision_mask(RID p_body) const {
const GodotBody3D *body = body_owner.get_or_null(p_body);
- ERR_FAIL_COND_V(!body, 0);
+ ERR_FAIL_NULL_V(body, 0);
return body->get_collision_mask();
}
void GodotPhysicsServer3D::body_set_collision_priority(RID p_body, real_t p_priority) {
GodotBody3D *body = body_owner.get_or_null(p_body);
- ERR_FAIL_COND(!body);
+ ERR_FAIL_NULL(body);
body->set_collision_priority(p_priority);
}
real_t GodotPhysicsServer3D::body_get_collision_priority(RID p_body) const {
const GodotBody3D *body = body_owner.get_or_null(p_body);
- ERR_FAIL_COND_V(!body, 0);
+ ERR_FAIL_NULL_V(body, 0);
return body->get_collision_priority();
}
@@ -639,61 +639,61 @@ void GodotPhysicsServer3D::body_attach_object_instance_id(RID p_body, ObjectID p
ObjectID GodotPhysicsServer3D::body_get_object_instance_id(RID p_body) const {
GodotBody3D *body = body_owner.get_or_null(p_body);
- ERR_FAIL_COND_V(!body, ObjectID());
+ ERR_FAIL_NULL_V(body, ObjectID());
return body->get_instance_id();
}
void GodotPhysicsServer3D::body_set_user_flags(RID p_body, uint32_t p_flags) {
GodotBody3D *body = body_owner.get_or_null(p_body);
- ERR_FAIL_COND(!body);
+ ERR_FAIL_NULL(body);
}
uint32_t GodotPhysicsServer3D::body_get_user_flags(RID p_body) const {
GodotBody3D *body = body_owner.get_or_null(p_body);
- ERR_FAIL_COND_V(!body, 0);
+ ERR_FAIL_NULL_V(body, 0);
return 0;
}
void GodotPhysicsServer3D::body_set_param(RID p_body, BodyParameter p_param, const Variant &p_value) {
GodotBody3D *body = body_owner.get_or_null(p_body);
- ERR_FAIL_COND(!body);
+ ERR_FAIL_NULL(body);
body->set_param(p_param, p_value);
}
Variant GodotPhysicsServer3D::body_get_param(RID p_body, BodyParameter p_param) const {
GodotBody3D *body = body_owner.get_or_null(p_body);
- ERR_FAIL_COND_V(!body, 0);
+ ERR_FAIL_NULL_V(body, 0);
return body->get_param(p_param);
}
void GodotPhysicsServer3D::body_reset_mass_properties(RID p_body) {
GodotBody3D *body = body_owner.get_or_null(p_body);
- ERR_FAIL_COND(!body);
+ ERR_FAIL_NULL(body);
return body->reset_mass_properties();
}
void GodotPhysicsServer3D::body_set_state(RID p_body, BodyState p_state, const Variant &p_variant) {
GodotBody3D *body = body_owner.get_or_null(p_body);
- ERR_FAIL_COND(!body);
+ ERR_FAIL_NULL(body);
body->set_state(p_state, p_variant);
}
Variant GodotPhysicsServer3D::body_get_state(RID p_body, BodyState p_state) const {
GodotBody3D *body = body_owner.get_or_null(p_body);
- ERR_FAIL_COND_V(!body, Variant());
+ ERR_FAIL_NULL_V(body, Variant());
return body->get_state(p_state);
}
void GodotPhysicsServer3D::body_apply_central_impulse(RID p_body, const Vector3 &p_impulse) {
GodotBody3D *body = body_owner.get_or_null(p_body);
- ERR_FAIL_COND(!body);
+ ERR_FAIL_NULL(body);
_update_shapes();
@@ -703,7 +703,7 @@ void GodotPhysicsServer3D::body_apply_central_impulse(RID p_body, const Vector3
void GodotPhysicsServer3D::body_apply_impulse(RID p_body, const Vector3 &p_impulse, const Vector3 &p_position) {
GodotBody3D *body = body_owner.get_or_null(p_body);
- ERR_FAIL_COND(!body);
+ ERR_FAIL_NULL(body);
_update_shapes();
@@ -713,7 +713,7 @@ void GodotPhysicsServer3D::body_apply_impulse(RID p_body, const Vector3 &p_impul
void GodotPhysicsServer3D::body_apply_torque_impulse(RID p_body, const Vector3 &p_impulse) {
GodotBody3D *body = body_owner.get_or_null(p_body);
- ERR_FAIL_COND(!body);
+ ERR_FAIL_NULL(body);
_update_shapes();
@@ -723,7 +723,7 @@ void GodotPhysicsServer3D::body_apply_torque_impulse(RID p_body, const Vector3 &
void GodotPhysicsServer3D::body_apply_central_force(RID p_body, const Vector3 &p_force) {
GodotBody3D *body = body_owner.get_or_null(p_body);
- ERR_FAIL_COND(!body);
+ ERR_FAIL_NULL(body);
body->apply_central_force(p_force);
body->wakeup();
@@ -731,7 +731,7 @@ void GodotPhysicsServer3D::body_apply_central_force(RID p_body, const Vector3 &p
void GodotPhysicsServer3D::body_apply_force(RID p_body, const Vector3 &p_force, const Vector3 &p_position) {
GodotBody3D *body = body_owner.get_or_null(p_body);
- ERR_FAIL_COND(!body);
+ ERR_FAIL_NULL(body);
body->apply_force(p_force, p_position);
body->wakeup();
@@ -739,7 +739,7 @@ void GodotPhysicsServer3D::body_apply_force(RID p_body, const Vector3 &p_force,
void GodotPhysicsServer3D::body_apply_torque(RID p_body, const Vector3 &p_torque) {
GodotBody3D *body = body_owner.get_or_null(p_body);
- ERR_FAIL_COND(!body);
+ ERR_FAIL_NULL(body);
body->apply_torque(p_torque);
body->wakeup();
@@ -747,7 +747,7 @@ void GodotPhysicsServer3D::body_apply_torque(RID p_body, const Vector3 &p_torque
void GodotPhysicsServer3D::body_add_constant_central_force(RID p_body, const Vector3 &p_force) {
GodotBody3D *body = body_owner.get_or_null(p_body);
- ERR_FAIL_COND(!body);
+ ERR_FAIL_NULL(body);
body->add_constant_central_force(p_force);
body->wakeup();
@@ -755,7 +755,7 @@ void GodotPhysicsServer3D::body_add_constant_central_force(RID p_body, const Vec
void GodotPhysicsServer3D::body_add_constant_force(RID p_body, const Vector3 &p_force, const Vector3 &p_position) {
GodotBody3D *body = body_owner.get_or_null(p_body);
- ERR_FAIL_COND(!body);
+ ERR_FAIL_NULL(body);
body->add_constant_force(p_force, p_position);
body->wakeup();
@@ -763,7 +763,7 @@ void GodotPhysicsServer3D::body_add_constant_force(RID p_body, const Vector3 &p_
void GodotPhysicsServer3D::body_add_constant_torque(RID p_body, const Vector3 &p_torque) {
GodotBody3D *body = body_owner.get_or_null(p_body);
- ERR_FAIL_COND(!body);
+ ERR_FAIL_NULL(body);
body->add_constant_torque(p_torque);
body->wakeup();
@@ -771,7 +771,7 @@ void GodotPhysicsServer3D::body_add_constant_torque(RID p_body, const Vector3 &p
void GodotPhysicsServer3D::body_set_constant_force(RID p_body, const Vector3 &p_force) {
GodotBody3D *body = body_owner.get_or_null(p_body);
- ERR_FAIL_COND(!body);
+ ERR_FAIL_NULL(body);
body->set_constant_force(p_force);
if (!p_force.is_zero_approx()) {
@@ -781,13 +781,13 @@ void GodotPhysicsServer3D::body_set_constant_force(RID p_body, const Vector3 &p_
Vector3 GodotPhysicsServer3D::body_get_constant_force(RID p_body) const {
GodotBody3D *body = body_owner.get_or_null(p_body);
- ERR_FAIL_COND_V(!body, Vector3());
+ ERR_FAIL_NULL_V(body, Vector3());
return body->get_constant_force();
}
void GodotPhysicsServer3D::body_set_constant_torque(RID p_body, const Vector3 &p_torque) {
GodotBody3D *body = body_owner.get_or_null(p_body);
- ERR_FAIL_COND(!body);
+ ERR_FAIL_NULL(body);
body->set_constant_torque(p_torque);
if (!p_torque.is_zero_approx()) {
@@ -797,14 +797,14 @@ void GodotPhysicsServer3D::body_set_constant_torque(RID p_body, const Vector3 &p
Vector3 GodotPhysicsServer3D::body_get_constant_torque(RID p_body) const {
GodotBody3D *body = body_owner.get_or_null(p_body);
- ERR_FAIL_COND_V(!body, Vector3());
+ ERR_FAIL_NULL_V(body, Vector3());
return body->get_constant_torque();
}
void GodotPhysicsServer3D::body_set_axis_velocity(RID p_body, const Vector3 &p_axis_velocity) {
GodotBody3D *body = body_owner.get_or_null(p_body);
- ERR_FAIL_COND(!body);
+ ERR_FAIL_NULL(body);
_update_shapes();
@@ -818,7 +818,7 @@ void GodotPhysicsServer3D::body_set_axis_velocity(RID p_body, const Vector3 &p_a
void GodotPhysicsServer3D::body_set_axis_lock(RID p_body, BodyAxis p_axis, bool p_lock) {
GodotBody3D *body = body_owner.get_or_null(p_body);
- ERR_FAIL_COND(!body);
+ ERR_FAIL_NULL(body);
body->set_axis_lock(p_axis, p_lock);
body->wakeup();
@@ -826,13 +826,13 @@ void GodotPhysicsServer3D::body_set_axis_lock(RID p_body, BodyAxis p_axis, bool
bool GodotPhysicsServer3D::body_is_axis_locked(RID p_body, BodyAxis p_axis) const {
const GodotBody3D *body = body_owner.get_or_null(p_body);
- ERR_FAIL_COND_V(!body, 0);
+ ERR_FAIL_NULL_V(body, 0);
return body->is_axis_locked(p_axis);
}
void GodotPhysicsServer3D::body_add_collision_exception(RID p_body, RID p_body_b) {
GodotBody3D *body = body_owner.get_or_null(p_body);
- ERR_FAIL_COND(!body);
+ ERR_FAIL_NULL(body);
body->add_exception(p_body_b);
body->wakeup();
@@ -840,7 +840,7 @@ void GodotPhysicsServer3D::body_add_collision_exception(RID p_body, RID p_body_b
void GodotPhysicsServer3D::body_remove_collision_exception(RID p_body, RID p_body_b) {
GodotBody3D *body = body_owner.get_or_null(p_body);
- ERR_FAIL_COND(!body);
+ ERR_FAIL_NULL(body);
body->remove_exception(p_body_b);
body->wakeup();
@@ -848,7 +848,7 @@ void GodotPhysicsServer3D::body_remove_collision_exception(RID p_body, RID p_bod
void GodotPhysicsServer3D::body_get_collision_exceptions(RID p_body, List<RID> *p_exceptions) {
GodotBody3D *body = body_owner.get_or_null(p_body);
- ERR_FAIL_COND(!body);
+ ERR_FAIL_NULL(body);
for (int i = 0; i < body->get_exceptions().size(); i++) {
p_exceptions->push_back(body->get_exceptions()[i]);
@@ -857,61 +857,61 @@ void GodotPhysicsServer3D::body_get_collision_exceptions(RID p_body, List<RID> *
void GodotPhysicsServer3D::body_set_contacts_reported_depth_threshold(RID p_body, real_t p_threshold) {
GodotBody3D *body = body_owner.get_or_null(p_body);
- ERR_FAIL_COND(!body);
+ ERR_FAIL_NULL(body);
};
real_t GodotPhysicsServer3D::body_get_contacts_reported_depth_threshold(RID p_body) const {
GodotBody3D *body = body_owner.get_or_null(p_body);
- ERR_FAIL_COND_V(!body, 0);
+ ERR_FAIL_NULL_V(body, 0);
return 0;
};
void GodotPhysicsServer3D::body_set_omit_force_integration(RID p_body, bool p_omit) {
GodotBody3D *body = body_owner.get_or_null(p_body);
- ERR_FAIL_COND(!body);
+ ERR_FAIL_NULL(body);
body->set_omit_force_integration(p_omit);
};
bool GodotPhysicsServer3D::body_is_omitting_force_integration(RID p_body) const {
GodotBody3D *body = body_owner.get_or_null(p_body);
- ERR_FAIL_COND_V(!body, false);
+ ERR_FAIL_NULL_V(body, false);
return body->get_omit_force_integration();
};
void GodotPhysicsServer3D::body_set_max_contacts_reported(RID p_body, int p_contacts) {
GodotBody3D *body = body_owner.get_or_null(p_body);
- ERR_FAIL_COND(!body);
+ ERR_FAIL_NULL(body);
body->set_max_contacts_reported(p_contacts);
}
int GodotPhysicsServer3D::body_get_max_contacts_reported(RID p_body) const {
GodotBody3D *body = body_owner.get_or_null(p_body);
- ERR_FAIL_COND_V(!body, -1);
+ ERR_FAIL_NULL_V(body, -1);
return body->get_max_contacts_reported();
}
void GodotPhysicsServer3D::body_set_state_sync_callback(RID p_body, const Callable &p_callable) {
GodotBody3D *body = body_owner.get_or_null(p_body);
- ERR_FAIL_COND(!body);
+ ERR_FAIL_NULL(body);
body->set_state_sync_callback(p_callable);
}
void GodotPhysicsServer3D::body_set_force_integration_callback(RID p_body, const Callable &p_callable, const Variant &p_udata) {
GodotBody3D *body = body_owner.get_or_null(p_body);
- ERR_FAIL_COND(!body);
+ ERR_FAIL_NULL(body);
body->set_force_integration_callback(p_callable, p_udata);
}
void GodotPhysicsServer3D::body_set_ray_pickable(RID p_body, bool p_enable) {
GodotBody3D *body = body_owner.get_or_null(p_body);
- ERR_FAIL_COND(!body);
+ ERR_FAIL_NULL(body);
body->set_ray_pickable(p_enable);
}
bool GodotPhysicsServer3D::body_test_motion(RID p_body, const MotionParameters &p_parameters, MotionResult *r_result) {
GodotBody3D *body = body_owner.get_or_null(p_body);
- ERR_FAIL_COND_V(!body, false);
+ ERR_FAIL_NULL_V(body, false);
ERR_FAIL_COND_V(!body->get_space(), false);
ERR_FAIL_COND_V(body->get_space()->is_locked(), false);
@@ -950,19 +950,19 @@ RID GodotPhysicsServer3D::soft_body_create() {
void GodotPhysicsServer3D::soft_body_update_rendering_server(RID p_body, PhysicsServer3DRenderingServerHandler *p_rendering_server_handler) {
GodotSoftBody3D *soft_body = soft_body_owner.get_or_null(p_body);
- ERR_FAIL_COND(!soft_body);
+ ERR_FAIL_NULL(soft_body);
soft_body->update_rendering_server(p_rendering_server_handler);
}
void GodotPhysicsServer3D::soft_body_set_space(RID p_body, RID p_space) {
GodotSoftBody3D *soft_body = soft_body_owner.get_or_null(p_body);
- ERR_FAIL_COND(!soft_body);
+ ERR_FAIL_NULL(soft_body);
GodotSpace3D *space = nullptr;
if (p_space.is_valid()) {
space = space_owner.get_or_null(p_space);
- ERR_FAIL_COND(!space);
+ ERR_FAIL_NULL(space);
}
if (soft_body->get_space() == space) {
@@ -974,7 +974,7 @@ void GodotPhysicsServer3D::soft_body_set_space(RID p_body, RID p_space) {
RID GodotPhysicsServer3D::soft_body_get_space(RID p_body) const {
GodotSoftBody3D *soft_body = soft_body_owner.get_or_null(p_body);
- ERR_FAIL_COND_V(!soft_body, RID());
+ ERR_FAIL_NULL_V(soft_body, RID());
GodotSpace3D *space = soft_body->get_space();
if (!space) {
@@ -985,49 +985,49 @@ RID GodotPhysicsServer3D::soft_body_get_space(RID p_body) const {
void GodotPhysicsServer3D::soft_body_set_collision_layer(RID p_body, uint32_t p_layer) {
GodotSoftBody3D *soft_body = soft_body_owner.get_or_null(p_body);
- ERR_FAIL_COND(!soft_body);
+ ERR_FAIL_NULL(soft_body);
soft_body->set_collision_layer(p_layer);
}
uint32_t GodotPhysicsServer3D::soft_body_get_collision_layer(RID p_body) const {
GodotSoftBody3D *soft_body = soft_body_owner.get_or_null(p_body);
- ERR_FAIL_COND_V(!soft_body, 0);
+ ERR_FAIL_NULL_V(soft_body, 0);
return soft_body->get_collision_layer();
}
void GodotPhysicsServer3D::soft_body_set_collision_mask(RID p_body, uint32_t p_mask) {
GodotSoftBody3D *soft_body = soft_body_owner.get_or_null(p_body);
- ERR_FAIL_COND(!soft_body);
+ ERR_FAIL_NULL(soft_body);
soft_body->set_collision_mask(p_mask);
}
uint32_t GodotPhysicsServer3D::soft_body_get_collision_mask(RID p_body) const {
GodotSoftBody3D *soft_body = soft_body_owner.get_or_null(p_body);
- ERR_FAIL_COND_V(!soft_body, 0);
+ ERR_FAIL_NULL_V(soft_body, 0);
return soft_body->get_collision_mask();
}
void GodotPhysicsServer3D::soft_body_add_collision_exception(RID p_body, RID p_body_b) {
GodotSoftBody3D *soft_body = soft_body_owner.get_or_null(p_body);
- ERR_FAIL_COND(!soft_body);
+ ERR_FAIL_NULL(soft_body);
soft_body->add_exception(p_body_b);
}
void GodotPhysicsServer3D::soft_body_remove_collision_exception(RID p_body, RID p_body_b) {
GodotSoftBody3D *soft_body = soft_body_owner.get_or_null(p_body);
- ERR_FAIL_COND(!soft_body);
+ ERR_FAIL_NULL(soft_body);
soft_body->remove_exception(p_body_b);
}
void GodotPhysicsServer3D::soft_body_get_collision_exceptions(RID p_body, List<RID> *p_exceptions) {
GodotSoftBody3D *soft_body = soft_body_owner.get_or_null(p_body);
- ERR_FAIL_COND(!soft_body);
+ ERR_FAIL_NULL(soft_body);
for (int i = 0; i < soft_body->get_exceptions().size(); i++) {
p_exceptions->push_back(soft_body->get_exceptions()[i]);
@@ -1036,154 +1036,154 @@ void GodotPhysicsServer3D::soft_body_get_collision_exceptions(RID p_body, List<R
void GodotPhysicsServer3D::soft_body_set_state(RID p_body, BodyState p_state, const Variant &p_variant) {
GodotSoftBody3D *soft_body = soft_body_owner.get_or_null(p_body);
- ERR_FAIL_COND(!soft_body);
+ ERR_FAIL_NULL(soft_body);
soft_body->set_state(p_state, p_variant);
}
Variant GodotPhysicsServer3D::soft_body_get_state(RID p_body, BodyState p_state) const {
GodotSoftBody3D *soft_body = soft_body_owner.get_or_null(p_body);
- ERR_FAIL_COND_V(!soft_body, Variant());
+ ERR_FAIL_NULL_V(soft_body, Variant());
return soft_body->get_state(p_state);
}
void GodotPhysicsServer3D::soft_body_set_transform(RID p_body, const Transform3D &p_transform) {
GodotSoftBody3D *soft_body = soft_body_owner.get_or_null(p_body);
- ERR_FAIL_COND(!soft_body);
+ ERR_FAIL_NULL(soft_body);
soft_body->set_state(BODY_STATE_TRANSFORM, p_transform);
}
void GodotPhysicsServer3D::soft_body_set_ray_pickable(RID p_body, bool p_enable) {
GodotSoftBody3D *soft_body = soft_body_owner.get_or_null(p_body);
- ERR_FAIL_COND(!soft_body);
+ ERR_FAIL_NULL(soft_body);
soft_body->set_ray_pickable(p_enable);
}
void GodotPhysicsServer3D::soft_body_set_simulation_precision(RID p_body, int p_simulation_precision) {
GodotSoftBody3D *soft_body = soft_body_owner.get_or_null(p_body);
- ERR_FAIL_COND(!soft_body);
+ ERR_FAIL_NULL(soft_body);
soft_body->set_iteration_count(p_simulation_precision);
}
int GodotPhysicsServer3D::soft_body_get_simulation_precision(RID p_body) const {
GodotSoftBody3D *soft_body = soft_body_owner.get_or_null(p_body);
- ERR_FAIL_COND_V(!soft_body, 0.f);
+ ERR_FAIL_NULL_V(soft_body, 0.f);
return soft_body->get_iteration_count();
}
void GodotPhysicsServer3D::soft_body_set_total_mass(RID p_body, real_t p_total_mass) {
GodotSoftBody3D *soft_body = soft_body_owner.get_or_null(p_body);
- ERR_FAIL_COND(!soft_body);
+ ERR_FAIL_NULL(soft_body);
soft_body->set_total_mass(p_total_mass);
}
real_t GodotPhysicsServer3D::soft_body_get_total_mass(RID p_body) const {
GodotSoftBody3D *soft_body = soft_body_owner.get_or_null(p_body);
- ERR_FAIL_COND_V(!soft_body, 0.f);
+ ERR_FAIL_NULL_V(soft_body, 0.f);
return soft_body->get_total_mass();
}
void GodotPhysicsServer3D::soft_body_set_linear_stiffness(RID p_body, real_t p_stiffness) {
GodotSoftBody3D *soft_body = soft_body_owner.get_or_null(p_body);
- ERR_FAIL_COND(!soft_body);
+ ERR_FAIL_NULL(soft_body);
soft_body->set_linear_stiffness(p_stiffness);
}
real_t GodotPhysicsServer3D::soft_body_get_linear_stiffness(RID p_body) const {
GodotSoftBody3D *soft_body = soft_body_owner.get_or_null(p_body);
- ERR_FAIL_COND_V(!soft_body, 0.f);
+ ERR_FAIL_NULL_V(soft_body, 0.f);
return soft_body->get_linear_stiffness();
}
void GodotPhysicsServer3D::soft_body_set_pressure_coefficient(RID p_body, real_t p_pressure_coefficient) {
GodotSoftBody3D *soft_body = soft_body_owner.get_or_null(p_body);
- ERR_FAIL_COND(!soft_body);
+ ERR_FAIL_NULL(soft_body);
soft_body->set_pressure_coefficient(p_pressure_coefficient);
}
real_t GodotPhysicsServer3D::soft_body_get_pressure_coefficient(RID p_body) const {
GodotSoftBody3D *soft_body = soft_body_owner.get_or_null(p_body);
- ERR_FAIL_COND_V(!soft_body, 0.f);
+ ERR_FAIL_NULL_V(soft_body, 0.f);
return soft_body->get_pressure_coefficient();
}
void GodotPhysicsServer3D::soft_body_set_damping_coefficient(RID p_body, real_t p_damping_coefficient) {
GodotSoftBody3D *soft_body = soft_body_owner.get_or_null(p_body);
- ERR_FAIL_COND(!soft_body);
+ ERR_FAIL_NULL(soft_body);
soft_body->set_damping_coefficient(p_damping_coefficient);
}
real_t GodotPhysicsServer3D::soft_body_get_damping_coefficient(RID p_body) const {
GodotSoftBody3D *soft_body = soft_body_owner.get_or_null(p_body);
- ERR_FAIL_COND_V(!soft_body, 0.f);
+ ERR_FAIL_NULL_V(soft_body, 0.f);
return soft_body->get_damping_coefficient();
}
void GodotPhysicsServer3D::soft_body_set_drag_coefficient(RID p_body, real_t p_drag_coefficient) {
GodotSoftBody3D *soft_body = soft_body_owner.get_or_null(p_body);
- ERR_FAIL_COND(!soft_body);
+ ERR_FAIL_NULL(soft_body);
soft_body->set_drag_coefficient(p_drag_coefficient);
}
real_t GodotPhysicsServer3D::soft_body_get_drag_coefficient(RID p_body) const {
GodotSoftBody3D *soft_body = soft_body_owner.get_or_null(p_body);
- ERR_FAIL_COND_V(!soft_body, 0.f);
+ ERR_FAIL_NULL_V(soft_body, 0.f);
return soft_body->get_drag_coefficient();
}
void GodotPhysicsServer3D::soft_body_set_mesh(RID p_body, RID p_mesh) {
GodotSoftBody3D *soft_body = soft_body_owner.get_or_null(p_body);
- ERR_FAIL_COND(!soft_body);
+ ERR_FAIL_NULL(soft_body);
soft_body->set_mesh(p_mesh);
}
AABB GodotPhysicsServer3D::soft_body_get_bounds(RID p_body) const {
GodotSoftBody3D *soft_body = soft_body_owner.get_or_null(p_body);
- ERR_FAIL_COND_V(!soft_body, AABB());
+ ERR_FAIL_NULL_V(soft_body, AABB());
return soft_body->get_bounds();
}
void GodotPhysicsServer3D::soft_body_move_point(RID p_body, int p_point_index, const Vector3 &p_global_position) {
GodotSoftBody3D *soft_body = soft_body_owner.get_or_null(p_body);
- ERR_FAIL_COND(!soft_body);
+ ERR_FAIL_NULL(soft_body);
soft_body->set_vertex_position(p_point_index, p_global_position);
}
Vector3 GodotPhysicsServer3D::soft_body_get_point_global_position(RID p_body, int p_point_index) const {
GodotSoftBody3D *soft_body = soft_body_owner.get_or_null(p_body);
- ERR_FAIL_COND_V(!soft_body, Vector3());
+ ERR_FAIL_NULL_V(soft_body, Vector3());
return soft_body->get_vertex_position(p_point_index);
}
void GodotPhysicsServer3D::soft_body_remove_all_pinned_points(RID p_body) {
GodotSoftBody3D *soft_body = soft_body_owner.get_or_null(p_body);
- ERR_FAIL_COND(!soft_body);
+ ERR_FAIL_NULL(soft_body);
soft_body->unpin_all_vertices();
}
void GodotPhysicsServer3D::soft_body_pin_point(RID p_body, int p_point_index, bool p_pin) {
GodotSoftBody3D *soft_body = soft_body_owner.get_or_null(p_body);
- ERR_FAIL_COND(!soft_body);
+ ERR_FAIL_NULL(soft_body);
if (p_pin) {
soft_body->pin_vertex(p_point_index);
@@ -1194,7 +1194,7 @@ void GodotPhysicsServer3D::soft_body_pin_point(RID p_body, int p_point_index, bo
bool GodotPhysicsServer3D::soft_body_is_point_pinned(RID p_body, int p_point_index) const {
GodotSoftBody3D *soft_body = soft_body_owner.get_or_null(p_body);
- ERR_FAIL_COND_V(!soft_body, false);
+ ERR_FAIL_NULL_V(soft_body, false);
return soft_body->is_vertex_pinned(p_point_index);
}
@@ -1222,7 +1222,7 @@ void GodotPhysicsServer3D::joint_clear(RID p_joint) {
void GodotPhysicsServer3D::joint_make_pin(RID p_joint, RID p_body_A, const Vector3 &p_local_A, RID p_body_B, const Vector3 &p_local_B) {
GodotBody3D *body_A = body_owner.get_or_null(p_body_A);
- ERR_FAIL_COND(!body_A);
+ ERR_FAIL_NULL(body_A);
if (!p_body_B.is_valid()) {
ERR_FAIL_COND(!body_A->get_space());
@@ -1230,12 +1230,12 @@ void GodotPhysicsServer3D::joint_make_pin(RID p_joint, RID p_body_A, const Vecto
}
GodotBody3D *body_B = body_owner.get_or_null(p_body_B);
- ERR_FAIL_COND(!body_B);
+ ERR_FAIL_NULL(body_B);
ERR_FAIL_COND(body_A == body_B);
GodotJoint3D *prev_joint = joint_owner.get_or_null(p_joint);
- ERR_FAIL_COND(prev_joint == nullptr);
+ ERR_FAIL_NULL(prev_joint);
GodotJoint3D *joint = memnew(GodotPinJoint3D(body_A, p_local_A, body_B, p_local_B));
@@ -1246,7 +1246,7 @@ void GodotPhysicsServer3D::joint_make_pin(RID p_joint, RID p_body_A, const Vecto
void GodotPhysicsServer3D::pin_joint_set_param(RID p_joint, PinJointParam p_param, real_t p_value) {
GodotJoint3D *joint = joint_owner.get_or_null(p_joint);
- ERR_FAIL_COND(!joint);
+ ERR_FAIL_NULL(joint);
ERR_FAIL_COND(joint->get_type() != JOINT_TYPE_PIN);
GodotPinJoint3D *pin_joint = static_cast<GodotPinJoint3D *>(joint);
pin_joint->set_param(p_param, p_value);
@@ -1254,7 +1254,7 @@ void GodotPhysicsServer3D::pin_joint_set_param(RID p_joint, PinJointParam p_para
real_t GodotPhysicsServer3D::pin_joint_get_param(RID p_joint, PinJointParam p_param) const {
GodotJoint3D *joint = joint_owner.get_or_null(p_joint);
- ERR_FAIL_COND_V(!joint, 0);
+ ERR_FAIL_NULL_V(joint, 0);
ERR_FAIL_COND_V(joint->get_type() != JOINT_TYPE_PIN, 0);
GodotPinJoint3D *pin_joint = static_cast<GodotPinJoint3D *>(joint);
return pin_joint->get_param(p_param);
@@ -1262,7 +1262,7 @@ real_t GodotPhysicsServer3D::pin_joint_get_param(RID p_joint, PinJointParam p_pa
void GodotPhysicsServer3D::pin_joint_set_local_a(RID p_joint, const Vector3 &p_A) {
GodotJoint3D *joint = joint_owner.get_or_null(p_joint);
- ERR_FAIL_COND(!joint);
+ ERR_FAIL_NULL(joint);
ERR_FAIL_COND(joint->get_type() != JOINT_TYPE_PIN);
GodotPinJoint3D *pin_joint = static_cast<GodotPinJoint3D *>(joint);
pin_joint->set_pos_a(p_A);
@@ -1270,7 +1270,7 @@ void GodotPhysicsServer3D::pin_joint_set_local_a(RID p_joint, const Vector3 &p_A
Vector3 GodotPhysicsServer3D::pin_joint_get_local_a(RID p_joint) const {
GodotJoint3D *joint = joint_owner.get_or_null(p_joint);
- ERR_FAIL_COND_V(!joint, Vector3());
+ ERR_FAIL_NULL_V(joint, Vector3());
ERR_FAIL_COND_V(joint->get_type() != JOINT_TYPE_PIN, Vector3());
GodotPinJoint3D *pin_joint = static_cast<GodotPinJoint3D *>(joint);
return pin_joint->get_position_a();
@@ -1278,7 +1278,7 @@ Vector3 GodotPhysicsServer3D::pin_joint_get_local_a(RID p_joint) const {
void GodotPhysicsServer3D::pin_joint_set_local_b(RID p_joint, const Vector3 &p_B) {
GodotJoint3D *joint = joint_owner.get_or_null(p_joint);
- ERR_FAIL_COND(!joint);
+ ERR_FAIL_NULL(joint);
ERR_FAIL_COND(joint->get_type() != JOINT_TYPE_PIN);
GodotPinJoint3D *pin_joint = static_cast<GodotPinJoint3D *>(joint);
pin_joint->set_pos_b(p_B);
@@ -1286,7 +1286,7 @@ void GodotPhysicsServer3D::pin_joint_set_local_b(RID p_joint, const Vector3 &p_B
Vector3 GodotPhysicsServer3D::pin_joint_get_local_b(RID p_joint) const {
GodotJoint3D *joint = joint_owner.get_or_null(p_joint);
- ERR_FAIL_COND_V(!joint, Vector3());
+ ERR_FAIL_NULL_V(joint, Vector3());
ERR_FAIL_COND_V(joint->get_type() != JOINT_TYPE_PIN, Vector3());
GodotPinJoint3D *pin_joint = static_cast<GodotPinJoint3D *>(joint);
return pin_joint->get_position_b();
@@ -1294,7 +1294,7 @@ Vector3 GodotPhysicsServer3D::pin_joint_get_local_b(RID p_joint) const {
void GodotPhysicsServer3D::joint_make_hinge(RID p_joint, RID p_body_A, const Transform3D &p_frame_A, RID p_body_B, const Transform3D &p_frame_B) {
GodotBody3D *body_A = body_owner.get_or_null(p_body_A);
- ERR_FAIL_COND(!body_A);
+ ERR_FAIL_NULL(body_A);
if (!p_body_B.is_valid()) {
ERR_FAIL_COND(!body_A->get_space());
@@ -1302,12 +1302,12 @@ void GodotPhysicsServer3D::joint_make_hinge(RID p_joint, RID p_body_A, const Tra
}
GodotBody3D *body_B = body_owner.get_or_null(p_body_B);
- ERR_FAIL_COND(!body_B);
+ ERR_FAIL_NULL(body_B);
ERR_FAIL_COND(body_A == body_B);
GodotJoint3D *prev_joint = joint_owner.get_or_null(p_joint);
- ERR_FAIL_COND(prev_joint == nullptr);
+ ERR_FAIL_NULL(prev_joint);
GodotJoint3D *joint = memnew(GodotHingeJoint3D(body_A, body_B, p_frame_A, p_frame_B));
@@ -1318,7 +1318,7 @@ void GodotPhysicsServer3D::joint_make_hinge(RID p_joint, RID p_body_A, const Tra
void GodotPhysicsServer3D::joint_make_hinge_simple(RID p_joint, RID p_body_A, const Vector3 &p_pivot_A, const Vector3 &p_axis_A, RID p_body_B, const Vector3 &p_pivot_B, const Vector3 &p_axis_B) {
GodotBody3D *body_A = body_owner.get_or_null(p_body_A);
- ERR_FAIL_COND(!body_A);
+ ERR_FAIL_NULL(body_A);
if (!p_body_B.is_valid()) {
ERR_FAIL_COND(!body_A->get_space());
@@ -1326,12 +1326,12 @@ void GodotPhysicsServer3D::joint_make_hinge_simple(RID p_joint, RID p_body_A, co
}
GodotBody3D *body_B = body_owner.get_or_null(p_body_B);
- ERR_FAIL_COND(!body_B);
+ ERR_FAIL_NULL(body_B);
ERR_FAIL_COND(body_A == body_B);
GodotJoint3D *prev_joint = joint_owner.get_or_null(p_joint);
- ERR_FAIL_COND(prev_joint == nullptr);
+ ERR_FAIL_NULL(prev_joint);
GodotJoint3D *joint = memnew(GodotHingeJoint3D(body_A, body_B, p_pivot_A, p_pivot_B, p_axis_A, p_axis_B));
@@ -1342,7 +1342,7 @@ void GodotPhysicsServer3D::joint_make_hinge_simple(RID p_joint, RID p_body_A, co
void GodotPhysicsServer3D::hinge_joint_set_param(RID p_joint, HingeJointParam p_param, real_t p_value) {
GodotJoint3D *joint = joint_owner.get_or_null(p_joint);
- ERR_FAIL_COND(!joint);
+ ERR_FAIL_NULL(joint);
ERR_FAIL_COND(joint->get_type() != JOINT_TYPE_HINGE);
GodotHingeJoint3D *hinge_joint = static_cast<GodotHingeJoint3D *>(joint);
hinge_joint->set_param(p_param, p_value);
@@ -1350,7 +1350,7 @@ void GodotPhysicsServer3D::hinge_joint_set_param(RID p_joint, HingeJointParam p_
real_t GodotPhysicsServer3D::hinge_joint_get_param(RID p_joint, HingeJointParam p_param) const {
GodotJoint3D *joint = joint_owner.get_or_null(p_joint);
- ERR_FAIL_COND_V(!joint, 0);
+ ERR_FAIL_NULL_V(joint, 0);
ERR_FAIL_COND_V(joint->get_type() != JOINT_TYPE_HINGE, 0);
GodotHingeJoint3D *hinge_joint = static_cast<GodotHingeJoint3D *>(joint);
return hinge_joint->get_param(p_param);
@@ -1358,7 +1358,7 @@ real_t GodotPhysicsServer3D::hinge_joint_get_param(RID p_joint, HingeJointParam
void GodotPhysicsServer3D::hinge_joint_set_flag(RID p_joint, HingeJointFlag p_flag, bool p_value) {
GodotJoint3D *joint = joint_owner.get_or_null(p_joint);
- ERR_FAIL_COND(!joint);
+ ERR_FAIL_NULL(joint);
ERR_FAIL_COND(joint->get_type() != JOINT_TYPE_HINGE);
GodotHingeJoint3D *hinge_joint = static_cast<GodotHingeJoint3D *>(joint);
hinge_joint->set_flag(p_flag, p_value);
@@ -1366,7 +1366,7 @@ void GodotPhysicsServer3D::hinge_joint_set_flag(RID p_joint, HingeJointFlag p_fl
bool GodotPhysicsServer3D::hinge_joint_get_flag(RID p_joint, HingeJointFlag p_flag) const {
GodotJoint3D *joint = joint_owner.get_or_null(p_joint);
- ERR_FAIL_COND_V(!joint, false);
+ ERR_FAIL_NULL_V(joint, false);
ERR_FAIL_COND_V(joint->get_type() != JOINT_TYPE_HINGE, false);
GodotHingeJoint3D *hinge_joint = static_cast<GodotHingeJoint3D *>(joint);
return hinge_joint->get_flag(p_flag);
@@ -1374,19 +1374,19 @@ bool GodotPhysicsServer3D::hinge_joint_get_flag(RID p_joint, HingeJointFlag p_fl
void GodotPhysicsServer3D::joint_set_solver_priority(RID p_joint, int p_priority) {
GodotJoint3D *joint = joint_owner.get_or_null(p_joint);
- ERR_FAIL_COND(!joint);
+ ERR_FAIL_NULL(joint);
joint->set_priority(p_priority);
}
int GodotPhysicsServer3D::joint_get_solver_priority(RID p_joint) const {
GodotJoint3D *joint = joint_owner.get_or_null(p_joint);
- ERR_FAIL_COND_V(!joint, 0);
+ ERR_FAIL_NULL_V(joint, 0);
return joint->get_priority();
}
void GodotPhysicsServer3D::joint_disable_collisions_between_bodies(RID p_joint, bool p_disable) {
GodotJoint3D *joint = joint_owner.get_or_null(p_joint);
- ERR_FAIL_COND(!joint);
+ ERR_FAIL_NULL(joint);
joint->disable_collisions_between_bodies(p_disable);
@@ -1406,20 +1406,20 @@ void GodotPhysicsServer3D::joint_disable_collisions_between_bodies(RID p_joint,
bool GodotPhysicsServer3D::joint_is_disabled_collisions_between_bodies(RID p_joint) const {
GodotJoint3D *joint = joint_owner.get_or_null(p_joint);
- ERR_FAIL_COND_V(!joint, true);
+ ERR_FAIL_NULL_V(joint, true);
return joint->is_disabled_collisions_between_bodies();
}
GodotPhysicsServer3D::JointType GodotPhysicsServer3D::joint_get_type(RID p_joint) const {
GodotJoint3D *joint = joint_owner.get_or_null(p_joint);
- ERR_FAIL_COND_V(!joint, JOINT_TYPE_PIN);
+ ERR_FAIL_NULL_V(joint, JOINT_TYPE_PIN);
return joint->get_type();
}
void GodotPhysicsServer3D::joint_make_slider(RID p_joint, RID p_body_A, const Transform3D &p_local_frame_A, RID p_body_B, const Transform3D &p_local_frame_B) {
GodotBody3D *body_A = body_owner.get_or_null(p_body_A);
- ERR_FAIL_COND(!body_A);
+ ERR_FAIL_NULL(body_A);
if (!p_body_B.is_valid()) {
ERR_FAIL_COND(!body_A->get_space());
@@ -1427,12 +1427,12 @@ void GodotPhysicsServer3D::joint_make_slider(RID p_joint, RID p_body_A, const Tr
}
GodotBody3D *body_B = body_owner.get_or_null(p_body_B);
- ERR_FAIL_COND(!body_B);
+ ERR_FAIL_NULL(body_B);
ERR_FAIL_COND(body_A == body_B);
GodotJoint3D *prev_joint = joint_owner.get_or_null(p_joint);
- ERR_FAIL_COND(prev_joint == nullptr);
+ ERR_FAIL_NULL(prev_joint);
GodotJoint3D *joint = memnew(GodotSliderJoint3D(body_A, body_B, p_local_frame_A, p_local_frame_B));
@@ -1443,7 +1443,7 @@ void GodotPhysicsServer3D::joint_make_slider(RID p_joint, RID p_body_A, const Tr
void GodotPhysicsServer3D::slider_joint_set_param(RID p_joint, SliderJointParam p_param, real_t p_value) {
GodotJoint3D *joint = joint_owner.get_or_null(p_joint);
- ERR_FAIL_COND(!joint);
+ ERR_FAIL_NULL(joint);
ERR_FAIL_COND(joint->get_type() != JOINT_TYPE_SLIDER);
GodotSliderJoint3D *slider_joint = static_cast<GodotSliderJoint3D *>(joint);
slider_joint->set_param(p_param, p_value);
@@ -1451,7 +1451,7 @@ void GodotPhysicsServer3D::slider_joint_set_param(RID p_joint, SliderJointParam
real_t GodotPhysicsServer3D::slider_joint_get_param(RID p_joint, SliderJointParam p_param) const {
GodotJoint3D *joint = joint_owner.get_or_null(p_joint);
- ERR_FAIL_COND_V(!joint, 0);
+ ERR_FAIL_NULL_V(joint, 0);
ERR_FAIL_COND_V(joint->get_type() != JOINT_TYPE_CONE_TWIST, 0);
GodotSliderJoint3D *slider_joint = static_cast<GodotSliderJoint3D *>(joint);
return slider_joint->get_param(p_param);
@@ -1459,7 +1459,7 @@ real_t GodotPhysicsServer3D::slider_joint_get_param(RID p_joint, SliderJointPara
void GodotPhysicsServer3D::joint_make_cone_twist(RID p_joint, RID p_body_A, const Transform3D &p_local_frame_A, RID p_body_B, const Transform3D &p_local_frame_B) {
GodotBody3D *body_A = body_owner.get_or_null(p_body_A);
- ERR_FAIL_COND(!body_A);
+ ERR_FAIL_NULL(body_A);
if (!p_body_B.is_valid()) {
ERR_FAIL_COND(!body_A->get_space());
@@ -1467,12 +1467,12 @@ void GodotPhysicsServer3D::joint_make_cone_twist(RID p_joint, RID p_body_A, cons
}
GodotBody3D *body_B = body_owner.get_or_null(p_body_B);
- ERR_FAIL_COND(!body_B);
+ ERR_FAIL_NULL(body_B);
ERR_FAIL_COND(body_A == body_B);
GodotJoint3D *prev_joint = joint_owner.get_or_null(p_joint);
- ERR_FAIL_COND(prev_joint == nullptr);
+ ERR_FAIL_NULL(prev_joint);
GodotJoint3D *joint = memnew(GodotConeTwistJoint3D(body_A, body_B, p_local_frame_A, p_local_frame_B));
@@ -1483,7 +1483,7 @@ void GodotPhysicsServer3D::joint_make_cone_twist(RID p_joint, RID p_body_A, cons
void GodotPhysicsServer3D::cone_twist_joint_set_param(RID p_joint, ConeTwistJointParam p_param, real_t p_value) {
GodotJoint3D *joint = joint_owner.get_or_null(p_joint);
- ERR_FAIL_COND(!joint);
+ ERR_FAIL_NULL(joint);
ERR_FAIL_COND(joint->get_type() != JOINT_TYPE_CONE_TWIST);
GodotConeTwistJoint3D *cone_twist_joint = static_cast<GodotConeTwistJoint3D *>(joint);
cone_twist_joint->set_param(p_param, p_value);
@@ -1491,7 +1491,7 @@ void GodotPhysicsServer3D::cone_twist_joint_set_param(RID p_joint, ConeTwistJoin
real_t GodotPhysicsServer3D::cone_twist_joint_get_param(RID p_joint, ConeTwistJointParam p_param) const {
GodotJoint3D *joint = joint_owner.get_or_null(p_joint);
- ERR_FAIL_COND_V(!joint, 0);
+ ERR_FAIL_NULL_V(joint, 0);
ERR_FAIL_COND_V(joint->get_type() != JOINT_TYPE_CONE_TWIST, 0);
GodotConeTwistJoint3D *cone_twist_joint = static_cast<GodotConeTwistJoint3D *>(joint);
return cone_twist_joint->get_param(p_param);
@@ -1499,7 +1499,7 @@ real_t GodotPhysicsServer3D::cone_twist_joint_get_param(RID p_joint, ConeTwistJo
void GodotPhysicsServer3D::joint_make_generic_6dof(RID p_joint, RID p_body_A, const Transform3D &p_local_frame_A, RID p_body_B, const Transform3D &p_local_frame_B) {
GodotBody3D *body_A = body_owner.get_or_null(p_body_A);
- ERR_FAIL_COND(!body_A);
+ ERR_FAIL_NULL(body_A);
if (!p_body_B.is_valid()) {
ERR_FAIL_COND(!body_A->get_space());
@@ -1507,12 +1507,12 @@ void GodotPhysicsServer3D::joint_make_generic_6dof(RID p_joint, RID p_body_A, co
}
GodotBody3D *body_B = body_owner.get_or_null(p_body_B);
- ERR_FAIL_COND(!body_B);
+ ERR_FAIL_NULL(body_B);
ERR_FAIL_COND(body_A == body_B);
GodotJoint3D *prev_joint = joint_owner.get_or_null(p_joint);
- ERR_FAIL_COND(prev_joint == nullptr);
+ ERR_FAIL_NULL(prev_joint);
GodotJoint3D *joint = memnew(GodotGeneric6DOFJoint3D(body_A, body_B, p_local_frame_A, p_local_frame_B, true));
@@ -1523,7 +1523,7 @@ void GodotPhysicsServer3D::joint_make_generic_6dof(RID p_joint, RID p_body_A, co
void GodotPhysicsServer3D::generic_6dof_joint_set_param(RID p_joint, Vector3::Axis p_axis, G6DOFJointAxisParam p_param, real_t p_value) {
GodotJoint3D *joint = joint_owner.get_or_null(p_joint);
- ERR_FAIL_COND(!joint);
+ ERR_FAIL_NULL(joint);
ERR_FAIL_COND(joint->get_type() != JOINT_TYPE_6DOF);
GodotGeneric6DOFJoint3D *generic_6dof_joint = static_cast<GodotGeneric6DOFJoint3D *>(joint);
generic_6dof_joint->set_param(p_axis, p_param, p_value);
@@ -1531,7 +1531,7 @@ void GodotPhysicsServer3D::generic_6dof_joint_set_param(RID p_joint, Vector3::Ax
real_t GodotPhysicsServer3D::generic_6dof_joint_get_param(RID p_joint, Vector3::Axis p_axis, G6DOFJointAxisParam p_param) const {
GodotJoint3D *joint = joint_owner.get_or_null(p_joint);
- ERR_FAIL_COND_V(!joint, 0);
+ ERR_FAIL_NULL_V(joint, 0);
ERR_FAIL_COND_V(joint->get_type() != JOINT_TYPE_6DOF, 0);
GodotGeneric6DOFJoint3D *generic_6dof_joint = static_cast<GodotGeneric6DOFJoint3D *>(joint);
return generic_6dof_joint->get_param(p_axis, p_param);
@@ -1539,7 +1539,7 @@ real_t GodotPhysicsServer3D::generic_6dof_joint_get_param(RID p_joint, Vector3::
void GodotPhysicsServer3D::generic_6dof_joint_set_flag(RID p_joint, Vector3::Axis p_axis, G6DOFJointAxisFlag p_flag, bool p_enable) {
GodotJoint3D *joint = joint_owner.get_or_null(p_joint);
- ERR_FAIL_COND(!joint);
+ ERR_FAIL_NULL(joint);
ERR_FAIL_COND(joint->get_type() != JOINT_TYPE_6DOF);
GodotGeneric6DOFJoint3D *generic_6dof_joint = static_cast<GodotGeneric6DOFJoint3D *>(joint);
generic_6dof_joint->set_flag(p_axis, p_flag, p_enable);
@@ -1547,7 +1547,7 @@ void GodotPhysicsServer3D::generic_6dof_joint_set_flag(RID p_joint, Vector3::Axi
bool GodotPhysicsServer3D::generic_6dof_joint_get_flag(RID p_joint, Vector3::Axis p_axis, G6DOFJointAxisFlag p_flag) const {
GodotJoint3D *joint = joint_owner.get_or_null(p_joint);
- ERR_FAIL_COND_V(!joint, false);
+ ERR_FAIL_NULL_V(joint, false);
ERR_FAIL_COND_V(joint->get_type() != JOINT_TYPE_6DOF, false);
GodotGeneric6DOFJoint3D *generic_6dof_joint = static_cast<GodotGeneric6DOFJoint3D *>(joint);
return generic_6dof_joint->get_flag(p_axis, p_flag);