diff options
author | Hans Goudey <h.goudey@me.com> | 2021-10-04 02:23:58 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2021-10-04 02:23:58 +0300 |
commit | c9af025936e8c660d5dbad86a6554a13e72d0457 (patch) | |
tree | 9d42ddfef724350a188c25fed5642263fdf83261 | |
parent | 1e5cfebf660cdae0408bf36a895ef62499e4b13e (diff) |
Cleanup: Add doxygen sections, rearrange functions
-rw-r--r-- | source/blender/blenkernel/intern/curveprofile.cc | 58 |
1 files changed, 38 insertions, 20 deletions
diff --git a/source/blender/blenkernel/intern/curveprofile.cc b/source/blender/blenkernel/intern/curveprofile.cc index 0adce991d0f..c16459afbb3 100644 --- a/source/blender/blenkernel/intern/curveprofile.cc +++ b/source/blender/blenkernel/intern/curveprofile.cc @@ -35,6 +35,10 @@ #include "BLO_read_write.h" +/* -------------------------------------------------------------------- */ +/** \name Data Handling + * \{ */ + void BKE_curveprofile_free_data(CurveProfile *profile) { MEM_SAFE_FREE(profile->path); @@ -74,6 +78,33 @@ CurveProfile *BKE_curveprofile_copy(const CurveProfile *profile) return nullptr; } +void BKE_curveprofile_blend_write(struct BlendWriter *writer, const struct CurveProfile *profile) +{ + BLO_write_struct(writer, CurveProfile, profile); + BLO_write_struct_array(writer, CurveProfilePoint, profile->path_len, profile->path); +} + +/* Expects that the curve profile itself has been read already. */ +void BKE_curveprofile_blend_read(struct BlendDataReader *reader, struct CurveProfile *profile) +{ + BLO_read_data_address(reader, &profile->path); + profile->table = nullptr; + profile->segments = nullptr; + + /* Reset the points' pointers to the profile. */ + for (int i = 0; i < profile->path_len; i++) { + profile->path[i].profile = profile; + } + + BKE_curveprofile_init(profile, profile->segments_len); +} + +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Editing + * \{ */ + /** * Move a point's handle, accounting for the alignment of handles with the #HD_ALIGN type. * @@ -532,6 +563,12 @@ void BKE_curveprofile_reset(CurveProfile *profile) profile->table = nullptr; } +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Sampling and Evaluation + * \{ */ + /** * Helper for 'curve_profile_create' samples. * Returns whether both handles that make up the edge are vector handles. @@ -1103,23 +1140,4 @@ void BKE_curveprofile_evaluate_length_portion(const CurveProfile *profile, *y_out = interpf(profile->table[i].y, profile->table[i + 1].y, lerp_factor); } -void BKE_curveprofile_blend_write(struct BlendWriter *writer, const struct CurveProfile *profile) -{ - BLO_write_struct(writer, CurveProfile, profile); - BLO_write_struct_array(writer, CurveProfilePoint, profile->path_len, profile->path); -} - -/* Expects that the curve profile itself has been read already. */ -void BKE_curveprofile_blend_read(struct BlendDataReader *reader, struct CurveProfile *profile) -{ - BLO_read_data_address(reader, &profile->path); - profile->table = nullptr; - profile->segments = nullptr; - - /* Reset the points' pointers to the profile. */ - for (int i = 0; i < profile->path_len; i++) { - profile->path[i].profile = profile; - } - - BKE_curveprofile_init(profile, profile->segments_len); -} +/** \} */ |