1
0
mirror of https://github.com/godotengine/godot.git synced 2025-12-04 17:04:49 +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

@@ -33,7 +33,6 @@
#include "core/method_bind_ext.gen.inc"
bool GraphNode::_set(const StringName &p_name, const Variant &p_value) {
if (!p_name.operator String().begins_with("slot/"))
return false;
@@ -65,7 +64,6 @@ bool GraphNode::_set(const StringName &p_name, const Variant &p_value) {
}
bool GraphNode::_get(const StringName &p_name, Variant &r_ret) const {
if (!p_name.operator String().begins_with("slot/")) {
return false;
}
@@ -95,7 +93,6 @@ bool GraphNode::_get(const StringName &p_name, Variant &r_ret) const {
return true;
}
void GraphNode::_get_property_list(List<PropertyInfo> *p_list) const {
int idx = 0;
for (int i = 0; i < get_child_count(); i++) {
Control *c = Object::cast_to<Control>(get_child(i));
@@ -116,7 +113,6 @@ void GraphNode::_get_property_list(List<PropertyInfo> *p_list) const {
}
void GraphNode::_resort() {
int sep = get_theme_constant("separation");
Ref<StyleBox> sb = get_theme_stylebox("frame");
bool first = true;
@@ -167,7 +163,6 @@ void GraphNode::_resort() {
}
bool GraphNode::has_point(const Point2 &p_point) const {
if (comment) {
Ref<StyleBox> comment = get_theme_stylebox("comment");
Ref<Texture2D> resizer = get_theme_icon("resizer");
@@ -188,17 +183,14 @@ bool GraphNode::has_point(const Point2 &p_point) const {
}
void GraphNode::_notification(int p_what) {
switch (p_what) {
case NOTIFICATION_DRAW: {
Ref<StyleBox> sb;
if (comment) {
sb = get_theme_stylebox(selected ? "commentfocus" : "comment");
} else {
sb = get_theme_stylebox(selected ? "selectedframe" : "frame");
}
@@ -223,10 +215,8 @@ void GraphNode::_notification(int p_what) {
switch (overlay) {
case OVERLAY_DISABLED: {
} break;
case OVERLAY_BREAKPOINT: {
draw_style_box(get_theme_stylebox("breakpoint"), Rect2(Point2(), get_size()));
} break;
case OVERLAY_POSITION: {
@@ -251,7 +241,6 @@ void GraphNode::_notification(int p_what) {
}
for (Map<int, Slot>::Element *E = slot_info.front(); E; E = E->next()) {
if (E->key() < 0 || E->key() >= cache_y.size())
continue;
if (!slot_info.has(E->key()))
@@ -280,19 +269,16 @@ void GraphNode::_notification(int p_what) {
} break;
case NOTIFICATION_SORT_CHILDREN: {
_resort();
} break;
case NOTIFICATION_THEME_CHANGED: {
minimum_size_changed();
} break;
}
}
void GraphNode::set_slot(int p_idx, bool p_enable_left, int p_type_left, const Color &p_color_left, bool p_enable_right, int p_type_right, const Color &p_color_right, const Ref<Texture2D> &p_custom_left, const Ref<Texture2D> &p_custom_right) {
ERR_FAIL_COND(p_idx < 0);
if (!p_enable_left && p_type_left == 0 && p_color_left == Color(1, 1, 1, 1) && !p_enable_right && p_type_right == 0 && p_color_right == Color(1, 1, 1, 1)) {
@@ -315,61 +301,52 @@ void GraphNode::set_slot(int p_idx, bool p_enable_left, int p_type_left, const C
}
void GraphNode::clear_slot(int p_idx) {
slot_info.erase(p_idx);
update();
connpos_dirty = true;
}
void GraphNode::clear_all_slots() {
slot_info.clear();
update();
connpos_dirty = true;
}
bool GraphNode::is_slot_enabled_left(int p_idx) const {
if (!slot_info.has(p_idx))
return false;
return slot_info[p_idx].enable_left;
}
int GraphNode::get_slot_type_left(int p_idx) const {
if (!slot_info.has(p_idx))
return 0;
return slot_info[p_idx].type_left;
}
Color GraphNode::get_slot_color_left(int p_idx) const {
if (!slot_info.has(p_idx))
return Color(1, 1, 1, 1);
return slot_info[p_idx].color_left;
}
bool GraphNode::is_slot_enabled_right(int p_idx) const {
if (!slot_info.has(p_idx))
return false;
return slot_info[p_idx].enable_right;
}
int GraphNode::get_slot_type_right(int p_idx) const {
if (!slot_info.has(p_idx))
return 0;
return slot_info[p_idx].type_right;
}
Color GraphNode::get_slot_color_right(int p_idx) const {
if (!slot_info.has(p_idx))
return Color(1, 1, 1, 1);
return slot_info[p_idx].color_right;
}
Size2 GraphNode::get_minimum_size() const {
Ref<Font> title_font = get_theme_font("title_font");
int sep = get_theme_constant("separation");
@@ -384,7 +361,6 @@ Size2 GraphNode::get_minimum_size() const {
}
for (int i = 0; i < get_child_count(); i++) {
Control *c = Object::cast_to<Control>(get_child(i));
if (!c)
continue;
@@ -406,7 +382,6 @@ Size2 GraphNode::get_minimum_size() const {
}
void GraphNode::set_title(const String &p_title) {
if (title == p_title)
return;
title = p_title;
@@ -416,19 +391,16 @@ void GraphNode::set_title(const String &p_title) {
}
String GraphNode::get_title() const {
return title;
}
void GraphNode::set_offset(const Vector2 &p_offset) {
offset = p_offset;
emit_signal("offset_changed");
update();
}
Vector2 GraphNode::get_offset() const {
return offset;
}
@@ -453,17 +425,14 @@ Vector2 GraphNode::get_drag_from() {
}
void GraphNode::set_show_close_button(bool p_enable) {
show_close = p_enable;
update();
}
bool GraphNode::is_close_button_visible() const {
return show_close;
}
void GraphNode::_connpos_update() {
int edgeofs = get_theme_constant("port_offset");
int sep = get_theme_constant("separation");
@@ -487,7 +456,6 @@ void GraphNode::_connpos_update() {
int h = size.y;
if (slot_info.has(idx)) {
if (slot_info[idx].enable_left) {
ConnCache cc;
cc.pos = Point2i(edgeofs, y + h / 2);
@@ -514,14 +482,12 @@ void GraphNode::_connpos_update() {
}
int GraphNode::get_connection_input_count() {
if (connpos_dirty)
_connpos_update();
return conn_input_cache.size();
}
int GraphNode::get_connection_output_count() {
if (connpos_dirty)
_connpos_update();
@@ -529,7 +495,6 @@ int GraphNode::get_connection_output_count() {
}
Vector2 GraphNode::get_connection_input_position(int p_idx) {
if (connpos_dirty)
_connpos_update();
@@ -541,7 +506,6 @@ Vector2 GraphNode::get_connection_input_position(int p_idx) {
}
int GraphNode::get_connection_input_type(int p_idx) {
if (connpos_dirty)
_connpos_update();
@@ -550,7 +514,6 @@ int GraphNode::get_connection_input_type(int p_idx) {
}
Color GraphNode::get_connection_input_color(int p_idx) {
if (connpos_dirty)
_connpos_update();
@@ -559,7 +522,6 @@ Color GraphNode::get_connection_input_color(int p_idx) {
}
Vector2 GraphNode::get_connection_output_position(int p_idx) {
if (connpos_dirty)
_connpos_update();
@@ -571,7 +533,6 @@ Vector2 GraphNode::get_connection_output_position(int p_idx) {
}
int GraphNode::get_connection_output_type(int p_idx) {
if (connpos_dirty)
_connpos_update();
@@ -580,7 +541,6 @@ int GraphNode::get_connection_output_type(int p_idx) {
}
Color GraphNode::get_connection_output_color(int p_idx) {
if (connpos_dirty)
_connpos_update();
@@ -589,14 +549,11 @@ Color GraphNode::get_connection_output_color(int p_idx) {
}
void GraphNode::_gui_input(const Ref<InputEvent> &p_ev) {
Ref<InputEventMouseButton> mb = p_ev;
if (mb.is_valid()) {
ERR_FAIL_COND_MSG(get_parent_control() == nullptr, "GraphNode must be the child of a GraphEdit node.");
if (mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT) {
Vector2 mpos = Vector2(mb->get_position().x, mb->get_position().y);
if (close_rect.size != Size2() && close_rect.has_point(mpos)) {
//send focus to parent
@@ -609,7 +566,6 @@ void GraphNode::_gui_input(const Ref<InputEvent> &p_ev) {
Ref<Texture2D> resizer = get_theme_icon("resizer");
if (resizable && mpos.x > get_size().x - resizer->get_width() && mpos.y > get_size().y - resizer->get_height()) {
resizing = true;
resizing_from = mpos;
resizing_from_size = get_size();
@@ -636,40 +592,33 @@ void GraphNode::_gui_input(const Ref<InputEvent> &p_ev) {
}
void GraphNode::set_overlay(Overlay p_overlay) {
overlay = p_overlay;
update();
}
GraphNode::Overlay GraphNode::get_overlay() const {
return overlay;
}
void GraphNode::set_comment(bool p_enable) {
comment = p_enable;
update();
}
bool GraphNode::is_comment() const {
return comment;
}
void GraphNode::set_resizable(bool p_enable) {
resizable = p_enable;
update();
}
bool GraphNode::is_resizable() const {
return resizable;
}
void GraphNode::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_title", "title"), &GraphNode::set_title);
ClassDB::bind_method(D_METHOD("get_title"), &GraphNode::get_title);
ClassDB::bind_method(D_METHOD("_gui_input"), &GraphNode::_gui_input);
@@ -732,7 +681,6 @@ void GraphNode::_bind_methods() {
}
GraphNode::GraphNode() {
overlay = OVERLAY_DISABLED;
show_close = false;
connpos_dirty = true;