[Bf-blender-cvs] [266c90dc175] tmp-b28-motionpath-drawing: COW Fix - Motion paths were not drawing as they weren't getting copied
Joshua Leung
noreply at git.blender.org
Fri Jun 1 11:55:50 CEST 2018
Commit: 266c90dc175ec2e8e75cee8fc66eff0c203d9f2f
Author: Joshua Leung
Date: Fri Jun 1 11:55:45 2018 +0200
Branches: tmp-b28-motionpath-drawing
https://developer.blender.org/rB266c90dc175ec2e8e75cee8fc66eff0c203d9f2f
COW Fix - Motion paths were not drawing as they weren't getting copied
===================================================================
M source/blender/blenkernel/BKE_anim.h
M source/blender/blenkernel/intern/anim.c
M source/blender/blenkernel/intern/object.c
===================================================================
diff --git a/source/blender/blenkernel/BKE_anim.h b/source/blender/blenkernel/BKE_anim.h
index 0fb83162459..701be9d44cc 100644
--- a/source/blender/blenkernel/BKE_anim.h
+++ b/source/blender/blenkernel/BKE_anim.h
@@ -48,6 +48,8 @@ struct Main;
void animviz_settings_init(struct bAnimVizSettings *avs);
+struct bMotionPath *animviz_copy_motionpath(const struct bMotionPath *mpath_src);
+
void animviz_free_motionpath_cache(struct bMotionPath *mpath);
void animviz_free_motionpath(struct bMotionPath *mpath);
diff --git a/source/blender/blenkernel/intern/anim.c b/source/blender/blenkernel/intern/anim.c
index 674cf545ec6..8d420cd2d71 100644
--- a/source/blender/blenkernel/intern/anim.c
+++ b/source/blender/blenkernel/intern/anim.c
@@ -141,6 +141,27 @@ void animviz_free_motionpath(bMotionPath *mpath)
/* ------------------- */
+/* Make a copy of motionpath data, so that viewing with copy on write works */
+bMotionPath *animviz_copy_motionpath(const bMotionPath *mpath_src)
+{
+ bMotionPath *mpath_dst;
+
+ if (mpath_src == NULL)
+ return NULL;
+
+ mpath_dst = MEM_dupallocN(mpath_src);
+ mpath_dst->points = MEM_dupallocN(mpath_src->points);
+
+ /* should get recreated on draw... */
+ mpath_dst->points_vbo = NULL;
+ mpath_dst->batch_line = NULL;
+ mpath_dst->batch_points = NULL;
+
+ return mpath_dst;
+}
+
+/* ------------------- */
+
/**
* Setup motion paths for the given data.
* \note Only used when explicitly calculating paths on bones which may/may not be consider already
diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c
index 8e50d1b32e1..bd004b9b6a8 100644
--- a/source/blender/blenkernel/intern/object.c
+++ b/source/blender/blenkernel/intern/object.c
@@ -1199,7 +1199,7 @@ void BKE_object_copy_data(Main *UNUSED(bmain), Object *ob_dst, const Object *ob_
BLI_listbase_clear(&ob_dst->drawdata);
BLI_listbase_clear(&ob_dst->pc_ids);
- ob_dst->mpath = NULL;
+ ob_dst->mpath = animviz_copy_motionpath(ob_src->mpath);
copy_object_lod(ob_dst, ob_src, flag_subdata);
More information about the Bf-blender-cvs
mailing list