Cleanup: Add doxygen sections, rearrange functions

This commit is contained in:
Hans Goudey 2021-10-03 18:23:58 -05:00
parent 1e5cfebf66
commit c9af025936
1 changed files with 38 additions and 20 deletions

View File

@ -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);
}
/** \} */