1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-09 12:50:35 +00:00

Style: clang-format: Disable KeepEmptyLinesAtTheStartOfBlocks

Which means that reduz' beloved style which we all became used to
will now be changed automatically to remove the first empty line.

This makes us lean closer to 1TBS (the one true brace style) instead
of hybridating it with some Allman-inspired spacing.

There's still the case of braces around single-statement blocks that
needs to be addressed (but clang-format can't help with that, but
clang-tidy may if we agree about it).

Part of #33027.
This commit is contained in:
Rémi Verschelde
2020-05-14 13:23:58 +02:00
parent 710b34b702
commit 0be6d925dc
1552 changed files with 1 additions and 33876 deletions

View File

@@ -40,14 +40,12 @@
#include "scene/resources/segment_shape_2d.h"
void CollisionShape2DEditor::_node_removed(Node *p_node) {
if (p_node == node) {
node = nullptr;
}
}
Variant CollisionShape2DEditor::get_handle_value(int idx) const {
switch (shape_type) {
case CAPSULE_SHAPE: {
Ref<CapsuleShape2D> capsule = node->get_shape();
@@ -70,11 +68,9 @@ Variant CollisionShape2DEditor::get_handle_value(int idx) const {
} break;
case CONCAVE_POLYGON_SHAPE: {
} break;
case CONVEX_POLYGON_SHAPE: {
} break;
case LINE_SHAPE: {
@@ -122,7 +118,6 @@ Variant CollisionShape2DEditor::get_handle_value(int idx) const {
}
void CollisionShape2DEditor::set_handle(int idx, Point2 &p_point) {
switch (shape_type) {
case CAPSULE_SHAPE: {
if (idx < 2) {
@@ -150,11 +145,9 @@ void CollisionShape2DEditor::set_handle(int idx, Point2 &p_point) {
} break;
case CONCAVE_POLYGON_SHAPE: {
} break;
case CONVEX_POLYGON_SHAPE: {
} break;
case LINE_SHAPE: {
@@ -217,7 +210,6 @@ void CollisionShape2DEditor::set_handle(int idx, Point2 &p_point) {
}
void CollisionShape2DEditor::commit_handle(int idx, Variant &p_org) {
undo_redo->create_action(TTR("Set Handle"));
switch (shape_type) {
@@ -249,11 +241,9 @@ void CollisionShape2DEditor::commit_handle(int idx, Variant &p_org) {
} break;
case CONCAVE_POLYGON_SHAPE: {
} break;
case CONVEX_POLYGON_SHAPE: {
} break;
case LINE_SHAPE: {
@@ -314,7 +304,6 @@ void CollisionShape2DEditor::commit_handle(int idx, Variant &p_org) {
}
bool CollisionShape2DEditor::forward_canvas_gui_input(const Ref<InputEvent> &p_event) {
if (!node) {
return false;
}
@@ -331,7 +320,6 @@ bool CollisionShape2DEditor::forward_canvas_gui_input(const Ref<InputEvent> &p_e
Transform2D xform = canvas_item_editor->get_canvas_transform() * node->get_global_transform();
if (mb.is_valid()) {
Vector2 gpoint = mb->get_position();
if (mb->get_button_index() == BUTTON_LEFT) {
@@ -373,7 +361,6 @@ bool CollisionShape2DEditor::forward_canvas_gui_input(const Ref<InputEvent> &p_e
Ref<InputEventMouseMotion> mm = p_event;
if (mm.is_valid()) {
if (edit_handle == -1 || !pressed) {
return false;
}
@@ -390,7 +377,6 @@ bool CollisionShape2DEditor::forward_canvas_gui_input(const Ref<InputEvent> &p_e
}
void CollisionShape2DEditor::_get_current_shape_type() {
if (!node) {
return;
}
@@ -425,7 +411,6 @@ void CollisionShape2DEditor::_get_current_shape_type() {
}
void CollisionShape2DEditor::forward_canvas_draw_over_viewport(Control *p_overlay) {
if (!node) {
return;
}
@@ -474,11 +459,9 @@ void CollisionShape2DEditor::forward_canvas_draw_over_viewport(Control *p_overla
} break;
case CONCAVE_POLYGON_SHAPE: {
} break;
case CONVEX_POLYGON_SHAPE: {
} break;
case LINE_SHAPE: {
@@ -533,9 +516,7 @@ void CollisionShape2DEditor::forward_canvas_draw_over_viewport(Control *p_overla
}
void CollisionShape2DEditor::_notification(int p_what) {
switch (p_what) {
case NOTIFICATION_ENTER_TREE: {
get_tree()->connect("node_removed", callable_mp(this, &CollisionShape2DEditor::_node_removed));
} break;
@@ -547,7 +528,6 @@ void CollisionShape2DEditor::_notification(int p_what) {
}
void CollisionShape2DEditor::edit(Node *p_node) {
if (!canvas_item_editor) {
canvas_item_editor = CanvasItemEditor::get_singleton();
}
@@ -568,12 +548,10 @@ void CollisionShape2DEditor::edit(Node *p_node) {
}
void CollisionShape2DEditor::_bind_methods() {
ClassDB::bind_method("_get_current_shape_type", &CollisionShape2DEditor::_get_current_shape_type);
}
CollisionShape2DEditor::CollisionShape2DEditor(EditorNode *p_editor) {
node = nullptr;
canvas_item_editor = nullptr;
editor = p_editor;
@@ -585,24 +563,20 @@ CollisionShape2DEditor::CollisionShape2DEditor(EditorNode *p_editor) {
}
void CollisionShape2DEditorPlugin::edit(Object *p_obj) {
collision_shape_2d_editor->edit(Object::cast_to<Node>(p_obj));
}
bool CollisionShape2DEditorPlugin::handles(Object *p_obj) const {
return p_obj->is_class("CollisionShape2D");
}
void CollisionShape2DEditorPlugin::make_visible(bool visible) {
if (!visible) {
edit(nullptr);
}
}
CollisionShape2DEditorPlugin::CollisionShape2DEditorPlugin(EditorNode *p_editor) {
editor = p_editor;
collision_shape_2d_editor = memnew(CollisionShape2DEditor(p_editor));