summaryrefslogtreecommitdiffstats
path: root/scene/resources/curve.cpp
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2020-05-14 14:29:06 +0200
committerRémi Verschelde <rverschelde@gmail.com>2020-05-14 16:54:55 +0200
commit07bc4e2f96f8f47991339654ff4ab16acc19d44f (patch)
tree43cdc7cfe8239c23065616a931de3769d2db1e86 /scene/resources/curve.cpp
parent0be6d925dc3c6413bce7a3ccb49631b8e4a6e67a (diff)
downloadredot-engine-07bc4e2f96f8f47991339654ff4ab16acc19d44f.tar.gz
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/resources/curve.cpp')
-rw-r--r--scene/resources/curve.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/scene/resources/curve.cpp b/scene/resources/curve.cpp
index d8f0640242..9c3e5ad437 100644
--- a/scene/resources/curve.cpp
+++ b/scene/resources/curve.cpp
@@ -529,6 +529,7 @@ void Curve::_bind_methods() {
int Curve2D::get_point_count() const {
return points.size();
}
+
void Curve2D::add_point(const Vector2 &p_pos, const Vector2 &p_in, const Vector2 &p_out, int p_atpos) {
Point n;
n.pos = p_pos;
@@ -550,6 +551,7 @@ void Curve2D::set_point_position(int p_index, const Vector2 &p_pos) {
baked_cache_dirty = true;
emit_signal(CoreStringNames::get_singleton()->changed);
}
+
Vector2 Curve2D::get_point_position(int p_index) const {
ERR_FAIL_INDEX_V(p_index, points.size(), Vector2());
return points[p_index].pos;
@@ -562,6 +564,7 @@ void Curve2D::set_point_in(int p_index, const Vector2 &p_in) {
baked_cache_dirty = true;
emit_signal(CoreStringNames::get_singleton()->changed);
}
+
Vector2 Curve2D::get_point_in(int p_index) const {
ERR_FAIL_INDEX_V(p_index, points.size(), Vector2());
return points[p_index].in;
@@ -727,6 +730,7 @@ float Curve2D::get_baked_length() const {
return baked_max_ofs;
}
+
Vector2 Curve2D::interpolate_baked(float p_offset, bool p_cubic) const {
if (baked_cache_dirty)
_bake();
@@ -876,6 +880,7 @@ Dictionary Curve2D::_get_data() const {
return dc;
}
+
void Curve2D::_set_data(const Dictionary &p_data) {
ERR_FAIL_COND(!p_data.has("points"));
@@ -979,6 +984,7 @@ Curve2D::Curve2D() {
int Curve3D::get_point_count() const {
return points.size();
}
+
void Curve3D::add_point(const Vector3 &p_pos, const Vector3 &p_in, const Vector3 &p_out, int p_atpos) {
Point n;
n.pos = p_pos;
@@ -992,6 +998,7 @@ void Curve3D::add_point(const Vector3 &p_pos, const Vector3 &p_in, const Vector3
baked_cache_dirty = true;
emit_signal(CoreStringNames::get_singleton()->changed);
}
+
void Curve3D::set_point_position(int p_index, const Vector3 &p_pos) {
ERR_FAIL_INDEX(p_index, points.size());
@@ -999,6 +1006,7 @@ void Curve3D::set_point_position(int p_index, const Vector3 &p_pos) {
baked_cache_dirty = true;
emit_signal(CoreStringNames::get_singleton()->changed);
}
+
Vector3 Curve3D::get_point_position(int p_index) const {
ERR_FAIL_INDEX_V(p_index, points.size(), Vector3());
return points[p_index].pos;
@@ -1011,6 +1019,7 @@ void Curve3D::set_point_tilt(int p_index, float p_tilt) {
baked_cache_dirty = true;
emit_signal(CoreStringNames::get_singleton()->changed);
}
+
float Curve3D::get_point_tilt(int p_index) const {
ERR_FAIL_INDEX_V(p_index, points.size(), 0);
return points[p_index].tilt;
@@ -1023,6 +1032,7 @@ void Curve3D::set_point_in(int p_index, const Vector3 &p_in) {
baked_cache_dirty = true;
emit_signal(CoreStringNames::get_singleton()->changed);
}
+
Vector3 Curve3D::get_point_in(int p_index) const {
ERR_FAIL_INDEX_V(p_index, points.size(), Vector3());
return points[p_index].in;
@@ -1246,6 +1256,7 @@ float Curve3D::get_baked_length() const {
return baked_max_ofs;
}
+
Vector3 Curve3D::interpolate_baked(float p_offset, bool p_cubic) const {
if (baked_cache_dirty)
_bake();
@@ -1501,6 +1512,7 @@ Dictionary Curve3D::_get_data() const {
return dc;
}
+
void Curve3D::_set_data(const Dictionary &p_data) {
ERR_FAIL_COND(!p_data.has("points"));
ERR_FAIL_COND(!p_data.has("tilts"));