[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [46152] trunk/blender/source/blender/ blenkernel/intern/anim.c: Bugfix [#30097] Motion paths range not correct - Part B (Recalculating existing
Joshua Leung
aligorith at gmail.com
Tue May 1 15:10:37 CEST 2012
Revision: 46152
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=46152
Author: aligorith
Date: 2012-05-01 13:10:36 +0000 (Tue, 01 May 2012)
Log Message:
-----------
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.
Modified Paths:
--------------
trunk/blender/source/blender/blenkernel/intern/anim.c
Modified: trunk/blender/source/blender/blenkernel/intern/anim.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/anim.c 2012-05-01 13:01:24 UTC (rev 46151)
+++ trunk/blender/source/blender/blenkernel/intern/anim.c 2012-05-01 13:10:36 UTC (rev 46152)
@@ -144,9 +144,11 @@
/* ------------------- */
/* 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 @@
}
/* 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 */
More information about the Bf-blender-cvs
mailing list