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:
authorJoshua Leung <aligorith@gmail.com>2012-05-01 17:10:36 +0400
committerJoshua Leung <aligorith@gmail.com>2012-05-01 17:10:36 +0400
commit7a87b89a6040a9d1c7f29a679972da89af96b50a (patch)
tree76c331aea26bdff5a233822ccd806c55bd07cb0d /source/blender/blenkernel/intern/anim.c
parentcb99062ebcc60969930464df7b7a4031542ab6e8 (diff)
Bugfix [#30097] Motion paths range not correct - Part B (Recalculating existing
paths with new ranges) If an object/bone already had a motion path, it was not possible to recalculate it over a different frame range without firstly clearing these paths. This was both a confusing and troublesome workflow, and has since been removed.
Diffstat (limited to 'source/blender/blenkernel/intern/anim.c')
-rw-r--r--source/blender/blenkernel/intern/anim.c29
1 files changed, 22 insertions, 7 deletions
diff --git a/source/blender/blenkernel/intern/anim.c b/source/blender/blenkernel/intern/anim.c
index 7afcd828573..ce66d828a98 100644
--- a/source/blender/blenkernel/intern/anim.c
+++ b/source/blender/blenkernel/intern/anim.c
@@ -144,9 +144,11 @@ void animviz_free_motionpath(bMotionPath *mpath)
/* ------------------- */
/* Setup motion paths for the given data
- * - scene: current scene (for frame ranges, etc.)
- * - ob: object to add paths for (must be provided)
- * - pchan: posechannel to add paths for (optional; if not provided, object-paths are assumed)
+ * - Only used when explicitly calculating paths on bones which may/may not be consider already
+ *
+ * < scene: current scene (for frame ranges, etc.)
+ * < ob: object to add paths for (must be provided)
+ * < pchan: posechannel to add paths for (optional; if not provided, object-paths are assumed)
*/
bMotionPath *animviz_verify_motionpaths(ReportList *reports, Scene *scene, Object *ob, bPoseChannel *pchan)
{
@@ -180,14 +182,27 @@ bMotionPath *animviz_verify_motionpaths(ReportList *reports, Scene *scene, Objec
}
/* if there is already a motionpath, just return that,
- * but provided it's settings are ok
+ * provided it's settings are ok (saves extra free+alloc)
*/
if (*dst != NULL) {
+ int expected_length = avs->path_ef - avs->path_sf;
+
mpath= *dst;
- /* if range is not invalid, and/or length is set ok, just return */
- if ((mpath->start_frame != mpath->end_frame) && (mpath->length > 0))
- return mpath;
+ /* path is "valid" if length is valid, but must also be of the same length as is being requested */
+ if ((mpath->start_frame != mpath->end_frame) && (mpath->length > 0)) {
+ /* outer check ensures that we have some curve data for this path */
+ if (mpath->length == expected_length) {
+ /* return/use this as it is already valid length */
+ return mpath;
+ }
+ else {
+ /* clear the existing path (as the range has changed), and reallocate below */
+ if (mpath->points)
+ MEM_freeN(mpath->points);
+ mpath->points = NULL;
+ }
+ }
}
else {
/* create a new motionpath, and assign it */