diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2020-05-14 14:29:06 +0200 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2020-05-14 16:54:55 +0200 |
commit | 07bc4e2f96f8f47991339654ff4ab16acc19d44f (patch) | |
tree | 43cdc7cfe8239c23065616a931de3769d2db1e86 /scene/2d/polygon_2d.cpp | |
parent | 0be6d925dc3c6413bce7a3ccb49631b8e4a6e67a (diff) |
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.
Diffstat (limited to 'scene/2d/polygon_2d.cpp')
-rw-r--r-- | scene/2d/polygon_2d.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/scene/2d/polygon_2d.cpp b/scene/2d/polygon_2d.cpp index c05bbb3cd4..b4e3b9bc40 100644 --- a/scene/2d/polygon_2d.cpp +++ b/scene/2d/polygon_2d.cpp @@ -379,6 +379,7 @@ void Polygon2D::set_color(const Color &p_color) { color = p_color; update(); } + Color Polygon2D::get_color() const { return color; } @@ -387,6 +388,7 @@ void Polygon2D::set_vertex_colors(const Vector<Color> &p_colors) { vertex_colors = p_colors; update(); } + Vector<Color> Polygon2D::get_vertex_colors() const { return vertex_colors; } @@ -404,6 +406,7 @@ void Polygon2D::set_texture(const Ref<Texture2D> &p_texture) { }*/ update(); } + Ref<Texture2D> Polygon2D::get_texture() const { return texture; } @@ -448,6 +451,7 @@ void Polygon2D::set_texture_offset(const Vector2 &p_offset) { tex_ofs = p_offset; update(); } + Vector2 Polygon2D::get_texture_offset() const { return tex_ofs; } @@ -456,6 +460,7 @@ void Polygon2D::set_texture_rotation(float p_rot) { tex_rot = p_rot; update(); } + float Polygon2D::get_texture_rotation() const { return tex_rot; } @@ -463,6 +468,7 @@ float Polygon2D::get_texture_rotation() const { void Polygon2D::set_texture_rotation_degrees(float p_rot) { set_texture_rotation(Math::deg2rad(p_rot)); } + float Polygon2D::get_texture_rotation_degrees() const { return Math::rad2deg(get_texture_rotation()); } @@ -471,6 +477,7 @@ void Polygon2D::set_texture_scale(const Size2 &p_scale) { tex_scale = p_scale; update(); } + Size2 Polygon2D::get_texture_scale() const { return tex_scale; } @@ -479,6 +486,7 @@ void Polygon2D::set_invert(bool p_invert) { invert = p_invert; update(); } + bool Polygon2D::get_invert() const { return invert; } @@ -487,6 +495,7 @@ void Polygon2D::set_antialiased(bool p_antialiased) { antialiased = p_antialiased; update(); } + bool Polygon2D::get_antialiased() const { return antialiased; } @@ -495,6 +504,7 @@ void Polygon2D::set_invert_border(float p_invert_border) { invert_border = p_invert_border; update(); } + float Polygon2D::get_invert_border() const { return invert_border; } @@ -516,17 +526,21 @@ void Polygon2D::add_bone(const NodePath &p_path, const Vector<float> &p_weights) bone.weights = p_weights; bone_weights.push_back(bone); } + int Polygon2D::get_bone_count() const { return bone_weights.size(); } + NodePath Polygon2D::get_bone_path(int p_index) const { ERR_FAIL_INDEX_V(p_index, bone_weights.size(), NodePath()); return bone_weights[p_index].path; } + Vector<float> Polygon2D::get_bone_weights(int p_index) const { ERR_FAIL_INDEX_V(p_index, bone_weights.size(), Vector<float>()); return bone_weights[p_index].weights; } + void Polygon2D::erase_bone(int p_idx) { ERR_FAIL_INDEX(p_idx, bone_weights.size()); bone_weights.remove(p_idx); @@ -541,6 +555,7 @@ void Polygon2D::set_bone_weights(int p_index, const Vector<float> &p_weights) { bone_weights.write[p_index].weights = p_weights; update(); } + void Polygon2D::set_bone_path(int p_index, const NodePath &p_path) { ERR_FAIL_INDEX(p_index, bone_weights.size()); bone_weights.write[p_index].path = p_path; @@ -555,6 +570,7 @@ Array Polygon2D::_get_bones() const { } return bones; } + void Polygon2D::_set_bones(const Array &p_bones) { ERR_FAIL_COND(p_bones.size() & 1); clear_bones(); |