Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacques Lucke <jacques@blender.org>2020-11-06 19:33:00 +0300
committerJacques Lucke <jacques@blender.org>2020-11-06 19:33:13 +0300
commit37ef37711d997899041d84e8c7a17e1fbb4efab9 (patch)
treee27bdc0042524a585074285360e618c20e00ef9d /source/blender/blenkernel
parenta3a6443bfd8ac16824bdbf349913696531f348a1 (diff)
Refactor: move MotionPath .blend I/O to blenkernel
Ref T76372.
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r--source/blender/blenkernel/BKE_anim_visualization.h5
-rw-r--r--source/blender/blenkernel/intern/anim_visualization.c31
2 files changed, 36 insertions, 0 deletions
diff --git a/source/blender/blenkernel/BKE_anim_visualization.h b/source/blender/blenkernel/BKE_anim_visualization.h
index fb7875a112e..decb2e0b210 100644
--- a/source/blender/blenkernel/BKE_anim_visualization.h
+++ b/source/blender/blenkernel/BKE_anim_visualization.h
@@ -32,6 +32,8 @@ struct Scene;
struct bAnimVizSettings;
struct bMotionPath;
struct bPoseChannel;
+struct BlendWriter;
+struct BlendDataReader;
/* ---------------------------------------------------- */
/* Animation Visualization */
@@ -48,6 +50,9 @@ struct bMotionPath *animviz_verify_motionpaths(struct ReportList *reports,
struct Object *ob,
struct bPoseChannel *pchan);
+void animviz_motionpath_blend_write(struct BlendWriter *writer, struct bMotionPath *mpath);
+void animviz_motionpath_blend_read_data(struct BlendDataReader *reader, struct bMotionPath *mpath);
+
#ifdef __cplusplus
}
#endif
diff --git a/source/blender/blenkernel/intern/anim_visualization.c b/source/blender/blenkernel/intern/anim_visualization.c
index 5452e2513fb..ecd71ec08fe 100644
--- a/source/blender/blenkernel/intern/anim_visualization.c
+++ b/source/blender/blenkernel/intern/anim_visualization.c
@@ -34,6 +34,8 @@
#include "GPU_batch.h"
+#include "BLO_read_write.h"
+
/* ******************************************************************** */
/* Animation Visualization */
@@ -224,3 +226,32 @@ bMotionPath *animviz_verify_motionpaths(ReportList *reports,
/* return it */
return mpath;
}
+
+void animviz_motionpath_blend_write(BlendWriter *writer, bMotionPath *mpath)
+{
+ /* sanity checks */
+ if (mpath == NULL) {
+ return;
+ }
+
+ /* firstly, just write the motionpath struct */
+ BLO_write_struct(writer, bMotionPath, mpath);
+
+ /* now write the array of data */
+ BLO_write_struct_array(writer, bMotionPathVert, mpath->length, mpath->points);
+}
+
+void animviz_motionpath_blend_read_data(BlendDataReader *reader, bMotionPath *mpath)
+{
+ /* sanity check */
+ if (mpath == NULL) {
+ return;
+ }
+
+ /* relink points cache */
+ BLO_read_data_address(reader, &mpath->points);
+
+ mpath->points_vbo = NULL;
+ mpath->batch_line = NULL;
+ mpath->batch_points = NULL;
+}