You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-23 15:16:17 +00:00
Style: Enforce separation line between function definitions
I couldn't find a tool that enforces it, so I went the manual route: ``` find -name "thirdparty" -prune \ -o -name "*.cpp" -o -name "*.h" -o -name "*.m" -o -name "*.mm" \ -o -name "*.glsl" > files perl -0777 -pi -e 's/\n}\n([^#])/\n}\n\n\1/g' $(cat files) misc/scripts/fix_style.sh -c ``` This adds a newline after all `}` on the first column, unless they are followed by `#` (typically `#endif`). This leads to having lots of places with two lines between function/class definitions, but clang-format then fixes it as we enforce max one line of separation. This doesn't fix potential occurrences of function definitions which are indented (e.g. for a helper class defined in a .cpp), but it's better than nothing. Also can't be made to run easily on CI/hooks so we'll have to be careful with new code. Part of #33027.
This commit is contained in:
@@ -530,6 +530,7 @@ void SceneTree::_main_window_close() {
|
||||
_quit = true;
|
||||
}
|
||||
}
|
||||
|
||||
void SceneTree::_main_window_go_back() {
|
||||
if (quit_on_go_back) {
|
||||
_quit = true;
|
||||
@@ -660,6 +661,7 @@ Ref<Material> SceneTree::get_debug_navigation_disabled_material() {
|
||||
|
||||
return navigation_disabled_material;
|
||||
}
|
||||
|
||||
Ref<Material> SceneTree::get_debug_collision_material() {
|
||||
if (collision_material.is_valid())
|
||||
return collision_material;
|
||||
@@ -792,6 +794,7 @@ void SceneMainLoop::_update_listener_2d() {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
void SceneTree::_call_input_pause(const StringName &p_group, const StringName &p_method, const Ref<InputEvent> &p_input, Viewport *p_viewport) {
|
||||
@@ -835,6 +838,7 @@ void SceneTree::_call_input_pause(const StringName &p_group, const StringName &p
|
||||
if (call_lock == 0)
|
||||
call_skip.clear();
|
||||
}
|
||||
|
||||
Variant SceneTree::_call_group_flags(const Variant **p_args, int p_argcount, Callable::CallError &r_error) {
|
||||
r_error.error = Callable::CallError::CALL_OK;
|
||||
|
||||
@@ -878,6 +882,7 @@ Variant SceneTree::_call_group(const Variant **p_args, int p_argcount, Callable:
|
||||
int64_t SceneTree::get_frame() const {
|
||||
return current_frame;
|
||||
}
|
||||
|
||||
int64_t SceneTree::get_event_count() const {
|
||||
return current_event;
|
||||
}
|
||||
@@ -906,6 +911,7 @@ Array SceneTree::_get_nodes_in_group(const StringName &p_group) {
|
||||
bool SceneTree::has_group(const StringName &p_identifier) const {
|
||||
return group_map.has(p_identifier);
|
||||
}
|
||||
|
||||
void SceneTree::get_nodes_in_group(const StringName &p_group, List<Node *> *p_list) {
|
||||
Map<StringName, Group>::Element *E = group_map.find(p_group);
|
||||
if (!E)
|
||||
|
||||
Reference in New Issue
Block a user