1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-12 13:20:55 +00:00

Style: clang-format: Disable KeepEmptyLinesAtTheStartOfBlocks

This commit is contained in:
Rémi Verschelde
2021-05-04 14:41:06 +02:00
parent 64a63e0861
commit b5e1e05ef2
1439 changed files with 1 additions and 34187 deletions

View File

@@ -37,7 +37,6 @@
PhysicsServer *PhysicsServer::singleton = NULL;
void PhysicsDirectBodyState::integrate_forces() {
real_t step = get_step();
Vector3 lv = get_linear_velocity();
lv += get_total_gravity() * step;
@@ -62,19 +61,16 @@ void PhysicsDirectBodyState::integrate_forces() {
}
Object *PhysicsDirectBodyState::get_contact_collider_object(int p_contact_idx) const {
ObjectID objid = get_contact_collider_id(p_contact_idx);
Object *obj = ObjectDB::get_instance(objid);
return obj;
}
PhysicsServer *PhysicsServer::get_singleton() {
return singleton;
}
void PhysicsDirectBodyState::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_total_gravity"), &PhysicsDirectBodyState::get_total_gravity);
ClassDB::bind_method(D_METHOD("get_total_linear_damp"), &PhysicsDirectBodyState::get_total_linear_damp);
ClassDB::bind_method(D_METHOD("get_total_angular_damp"), &PhysicsDirectBodyState::get_total_angular_damp);
@@ -139,58 +135,47 @@ PhysicsDirectBodyState::PhysicsDirectBodyState() {}
///////////////////////////////////////////////////////
void PhysicsShapeQueryParameters::set_shape(const RES &p_shape) {
ERR_FAIL_COND(p_shape.is_null());
shape = p_shape->get_rid();
}
void PhysicsShapeQueryParameters::set_shape_rid(const RID &p_shape) {
shape = p_shape;
}
RID PhysicsShapeQueryParameters::get_shape_rid() const {
return shape;
}
void PhysicsShapeQueryParameters::set_transform(const Transform &p_transform) {
transform = p_transform;
}
Transform PhysicsShapeQueryParameters::get_transform() const {
return transform;
}
void PhysicsShapeQueryParameters::set_margin(float p_margin) {
margin = p_margin;
}
float PhysicsShapeQueryParameters::get_margin() const {
return margin;
}
void PhysicsShapeQueryParameters::set_collision_mask(int p_collision_mask) {
collision_mask = p_collision_mask;
}
int PhysicsShapeQueryParameters::get_collision_mask() const {
return collision_mask;
}
void PhysicsShapeQueryParameters::set_exclude(const Vector<RID> &p_exclude) {
exclude.clear();
for (int i = 0; i < p_exclude.size(); i++)
exclude.insert(p_exclude[i]);
}
Vector<RID> PhysicsShapeQueryParameters::get_exclude() const {
Vector<RID> ret;
ret.resize(exclude.size());
int idx = 0;
@@ -217,7 +202,6 @@ bool PhysicsShapeQueryParameters::is_collide_with_areas_enabled() const {
}
void PhysicsShapeQueryParameters::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_shape", "shape"), &PhysicsShapeQueryParameters::set_shape);
ClassDB::bind_method(D_METHOD("set_shape_rid", "shape"), &PhysicsShapeQueryParameters::set_shape_rid);
ClassDB::bind_method(D_METHOD("get_shape_rid"), &PhysicsShapeQueryParameters::get_shape_rid);
@@ -251,7 +235,6 @@ void PhysicsShapeQueryParameters::_bind_methods() {
}
PhysicsShapeQueryParameters::PhysicsShapeQueryParameters() {
margin = 0;
collision_mask = 0x7FFFFFFF;
collide_with_bodies = true;
@@ -261,7 +244,6 @@ PhysicsShapeQueryParameters::PhysicsShapeQueryParameters() {
/////////////////////////////////////
Dictionary PhysicsDirectSpaceState::_intersect_ray(const Vector3 &p_from, const Vector3 &p_to, const Vector<RID> &p_exclude, uint32_t p_collision_mask, bool p_collide_with_bodies, bool p_collide_with_areas) {
RayResult inters;
Set<RID> exclude;
for (int i = 0; i < p_exclude.size(); i++)
@@ -284,7 +266,6 @@ Dictionary PhysicsDirectSpaceState::_intersect_ray(const Vector3 &p_from, const
}
Array PhysicsDirectSpaceState::_intersect_shape(const Ref<PhysicsShapeQueryParameters> &p_shape_query, int p_max_results) {
ERR_FAIL_COND_V(!p_shape_query.is_valid(), Array());
Vector<ShapeResult> sr;
@@ -293,7 +274,6 @@ Array PhysicsDirectSpaceState::_intersect_shape(const Ref<PhysicsShapeQueryParam
Array ret;
ret.resize(rc);
for (int i = 0; i < rc; i++) {
Dictionary d;
d["rid"] = sr[i].rid;
d["collider_id"] = sr[i].collider_id;
@@ -306,7 +286,6 @@ Array PhysicsDirectSpaceState::_intersect_shape(const Ref<PhysicsShapeQueryParam
}
Array PhysicsDirectSpaceState::_cast_motion(const Ref<PhysicsShapeQueryParameters> &p_shape_query, const Vector3 &p_motion) {
ERR_FAIL_COND_V(!p_shape_query.is_valid(), Array());
float closest_safe = 1.0f, closest_unsafe = 1.0f;
@@ -320,7 +299,6 @@ Array PhysicsDirectSpaceState::_cast_motion(const Ref<PhysicsShapeQueryParameter
return ret;
}
Array PhysicsDirectSpaceState::_collide_shape(const Ref<PhysicsShapeQueryParameters> &p_shape_query, int p_max_results) {
ERR_FAIL_COND_V(!p_shape_query.is_valid(), Array());
Vector<Vector3> ret;
@@ -336,7 +314,6 @@ Array PhysicsDirectSpaceState::_collide_shape(const Ref<PhysicsShapeQueryParamet
return r;
}
Dictionary PhysicsDirectSpaceState::_get_rest_info(const Ref<PhysicsShapeQueryParameters> &p_shape_query) {
ERR_FAIL_COND_V(!p_shape_query.is_valid(), Dictionary());
ShapeRestInfo sri;
@@ -360,7 +337,6 @@ PhysicsDirectSpaceState::PhysicsDirectSpaceState() {
}
void PhysicsDirectSpaceState::_bind_methods() {
ClassDB::bind_method(D_METHOD("intersect_ray", "from", "to", "exclude", "collision_mask", "collide_with_bodies", "collide_with_areas"), &PhysicsDirectSpaceState::_intersect_ray, DEFVAL(Array()), DEFVAL(0x7FFFFFFF), DEFVAL(true), DEFVAL(false));
ClassDB::bind_method(D_METHOD("intersect_shape", "shape", "max_results"), &PhysicsDirectSpaceState::_intersect_shape, DEFVAL(32));
ClassDB::bind_method(D_METHOD("cast_motion", "shape", "motion"), &PhysicsDirectSpaceState::_cast_motion);
@@ -369,23 +345,18 @@ void PhysicsDirectSpaceState::_bind_methods() {
}
int PhysicsShapeQueryResult::get_result_count() const {
return result.size();
}
RID PhysicsShapeQueryResult::get_result_rid(int p_idx) const {
return result[p_idx].rid;
}
ObjectID PhysicsShapeQueryResult::get_result_object_id(int p_idx) const {
return result[p_idx].collider_id;
}
Object *PhysicsShapeQueryResult::get_result_object(int p_idx) const {
return result[p_idx].collider;
}
int PhysicsShapeQueryResult::get_result_object_shape(int p_idx) const {
return result[p_idx].shape;
}
@@ -393,7 +364,6 @@ PhysicsShapeQueryResult::PhysicsShapeQueryResult() {
}
void PhysicsShapeQueryResult::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_result_count"), &PhysicsShapeQueryResult::get_result_count);
ClassDB::bind_method(D_METHOD("get_result_rid", "idx"), &PhysicsShapeQueryResult::get_result_rid);
ClassDB::bind_method(D_METHOD("get_result_object_id", "idx"), &PhysicsShapeQueryResult::get_result_object_id);
@@ -404,7 +374,6 @@ void PhysicsShapeQueryResult::_bind_methods() {
///////////////////////////////////////
void PhysicsServer::_bind_methods() {
#ifndef _3D_DISABLED
ClassDB::bind_method(D_METHOD("shape_create", "type"), &PhysicsServer::shape_create);
@@ -724,13 +693,11 @@ void PhysicsServer::_bind_methods() {
}
PhysicsServer::PhysicsServer() {
ERR_FAIL_COND(singleton != NULL);
singleton = this;
}
PhysicsServer::~PhysicsServer() {
singleton = NULL;
}
@@ -740,7 +707,6 @@ int PhysicsServerManager::default_server_priority = -1;
const String PhysicsServerManager::setting_property_name("physics/3d/physics_engine");
void PhysicsServerManager::on_servers_changed() {
String physics_servers2("DEFAULT");
for (int i = get_servers_count() - 1; 0 <= i; --i) {
physics_servers2 += "," + get_server_name(i);
@@ -749,7 +715,6 @@ void PhysicsServerManager::on_servers_changed() {
}
void PhysicsServerManager::register_server(const String &p_name, CreatePhysicsServerCallback p_creat_callback) {
ERR_FAIL_COND(!p_creat_callback);
ERR_FAIL_COND(find_server_id(p_name) != -1);
physics_servers.push_back(ClassInfo(p_name, p_creat_callback));
@@ -757,7 +722,6 @@ void PhysicsServerManager::register_server(const String &p_name, CreatePhysicsSe
}
void PhysicsServerManager::set_default_server(const String &p_name, int p_priority) {
const int id = find_server_id(p_name);
ERR_FAIL_COND(id == -1); // Not found
if (default_server_priority < p_priority) {
@@ -767,7 +731,6 @@ void PhysicsServerManager::set_default_server(const String &p_name, int p_priori
}
int PhysicsServerManager::find_server_id(const String &p_name) {
for (int i = physics_servers.size() - 1; 0 <= i; --i) {
if (p_name == physics_servers[i].name) {
return i;