You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-04 12:00:25 +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:
@@ -47,6 +47,7 @@ void Decal::set_texture(DecalTexture p_type, const Ref<Texture2D> &p_texture) {
|
||||
RID texture_rid = p_texture.is_valid() ? p_texture->get_rid() : RID();
|
||||
RS::get_singleton()->decal_set_texture(decal, RS::DecalTexture(p_type), texture_rid);
|
||||
}
|
||||
|
||||
Ref<Texture2D> Decal::get_texture(DecalTexture p_type) const {
|
||||
ERR_FAIL_INDEX_V(p_type, TEXTURE_MAX, Ref<Texture2D>());
|
||||
return textures[p_type];
|
||||
@@ -56,6 +57,7 @@ void Decal::set_emission_energy(float p_energy) {
|
||||
emission_energy = p_energy;
|
||||
RS::get_singleton()->decal_set_emission_energy(decal, emission_energy);
|
||||
}
|
||||
|
||||
float Decal::get_emission_energy() const {
|
||||
return emission_energy;
|
||||
}
|
||||
@@ -64,6 +66,7 @@ void Decal::set_albedo_mix(float p_mix) {
|
||||
albedo_mix = p_mix;
|
||||
RS::get_singleton()->decal_set_albedo_mix(decal, albedo_mix);
|
||||
}
|
||||
|
||||
float Decal::get_albedo_mix() const {
|
||||
return albedo_mix;
|
||||
}
|
||||
@@ -72,6 +75,7 @@ void Decal::set_upper_fade(float p_fade) {
|
||||
upper_fade = p_fade;
|
||||
RS::get_singleton()->decal_set_fade(decal, upper_fade, lower_fade);
|
||||
}
|
||||
|
||||
float Decal::get_upper_fade() const {
|
||||
return upper_fade;
|
||||
}
|
||||
@@ -80,6 +84,7 @@ void Decal::set_lower_fade(float p_fade) {
|
||||
lower_fade = p_fade;
|
||||
RS::get_singleton()->decal_set_fade(decal, upper_fade, lower_fade);
|
||||
}
|
||||
|
||||
float Decal::get_lower_fade() const {
|
||||
return lower_fade;
|
||||
}
|
||||
@@ -88,6 +93,7 @@ void Decal::set_normal_fade(float p_fade) {
|
||||
normal_fade = p_fade;
|
||||
RS::get_singleton()->decal_set_normal_fade(decal, normal_fade);
|
||||
}
|
||||
|
||||
float Decal::get_normal_fade() const {
|
||||
return normal_fade;
|
||||
}
|
||||
@@ -105,6 +111,7 @@ void Decal::set_enable_distance_fade(bool p_enable) {
|
||||
distance_fade_enabled = p_enable;
|
||||
RS::get_singleton()->decal_set_distance_fade(decal, distance_fade_enabled, distance_fade_begin, distance_fade_length);
|
||||
}
|
||||
|
||||
bool Decal::is_distance_fade_enabled() const {
|
||||
return distance_fade_enabled;
|
||||
}
|
||||
@@ -113,6 +120,7 @@ void Decal::set_distance_fade_begin(float p_distance) {
|
||||
distance_fade_begin = p_distance;
|
||||
RS::get_singleton()->decal_set_distance_fade(decal, distance_fade_enabled, distance_fade_begin, distance_fade_length);
|
||||
}
|
||||
|
||||
float Decal::get_distance_fade_begin() const {
|
||||
return distance_fade_begin;
|
||||
}
|
||||
@@ -121,6 +129,7 @@ void Decal::set_distance_fade_length(float p_length) {
|
||||
distance_fade_length = p_length;
|
||||
RS::get_singleton()->decal_set_distance_fade(decal, distance_fade_enabled, distance_fade_begin, distance_fade_length);
|
||||
}
|
||||
|
||||
float Decal::get_distance_fade_length() const {
|
||||
return distance_fade_length;
|
||||
}
|
||||
@@ -129,6 +138,7 @@ void Decal::set_cull_mask(uint32_t p_layers) {
|
||||
cull_mask = p_layers;
|
||||
RS::get_singleton()->decal_set_cull_mask(decal, cull_mask);
|
||||
}
|
||||
|
||||
uint32_t Decal::get_cull_mask() const {
|
||||
return cull_mask;
|
||||
}
|
||||
@@ -139,6 +149,7 @@ AABB Decal::get_aabb() const {
|
||||
aabb.size = extents * 2.0;
|
||||
return aabb;
|
||||
}
|
||||
|
||||
Vector<Face3> Decal::get_faces(uint32_t p_usage_flags) const {
|
||||
return Vector<Face3>();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user