diff options
author | Jacques Lucke <jacques@blender.org> | 2020-06-23 18:02:49 +0300 |
---|---|---|
committer | Jacques Lucke <jacques@blender.org> | 2020-06-23 18:08:39 +0300 |
commit | 56f95297754dae0562c107737fd3e8a85b9c34df (patch) | |
tree | 5e3e5fdb6bc5de9a8f34f15933c871282a379993 /source/blender/blenkernel/intern/curveprofile.c | |
parent | f345625ded0ac3507c69160654360ebe8a463c84 (diff) |
Refactor: move blenloader code of curve profile to blenkernel
Diffstat (limited to 'source/blender/blenkernel/intern/curveprofile.c')
-rw-r--r-- | source/blender/blenkernel/intern/curveprofile.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/curveprofile.c b/source/blender/blenkernel/intern/curveprofile.c index a748dfbab3e..f43e0355eaa 100644 --- a/source/blender/blenkernel/intern/curveprofile.c +++ b/source/blender/blenkernel/intern/curveprofile.c @@ -41,6 +41,8 @@ #include "BKE_curveprofile.h" #include "BKE_fcurve.h" +#include "BLO_read_write.h" + void BKE_curveprofile_free_data(CurveProfile *profile) { MEM_SAFE_FREE(profile->path); @@ -1070,3 +1072,17 @@ void BKE_curveprofile_evaluate_length_portion(const CurveProfile *profile, *x_out = interpf(profile->table[i].x, profile->table[i + 1].x, lerp_factor); *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 = NULL; + profile->segments = NULL; +} |