[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [27408] trunk/blender/source/blender: Motion Paths + Auto-Keying:

Joshua Leung aligorith at gmail.com
Thu Mar 11 12:15:30 CET 2010


Revision: 27408
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=27408
Author:   aligorith
Date:     2010-03-11 12:15:25 +0100 (Thu, 11 Mar 2010)

Log Message:
-----------
Motion Paths + Auto-Keying:

Revised the conditions under which motion paths get recalculated after transforms (when auto-keying is enabled). Now, the type of path display does not matter, but rather that the object/bone in question has any paths at all. This makes animating with these a much smoother experience.

Modified Paths:
--------------
    trunk/blender/source/blender/blenkernel/intern/anim.c
    trunk/blender/source/blender/editors/armature/poseobject.c
    trunk/blender/source/blender/editors/object/object_edit.c
    trunk/blender/source/blender/editors/transform/transform_conversions.c
    trunk/blender/source/blender/makesdna/DNA_action_types.h

Modified: trunk/blender/source/blender/blenkernel/intern/anim.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/anim.c	2010-03-11 10:46:49 UTC (rev 27407)
+++ trunk/blender/source/blender/blenkernel/intern/anim.c	2010-03-11 11:15:25 UTC (rev 27408)
@@ -208,6 +208,9 @@
 	/* allocate a cache */
 	mpath->points= MEM_callocN(sizeof(bMotionPathVert)*mpath->length, "bMotionPathVerts");
 	
+	/* tag viz settings as currently having some path(s) which use it */
+	avs->path_bakeflag |= MOTIONPATH_BAKE_HAS_PATHS;
+	
 	/* return it */
 	return mpath;
 }

Modified: trunk/blender/source/blender/editors/armature/poseobject.c
===================================================================
--- trunk/blender/source/blender/editors/armature/poseobject.c	2010-03-11 10:46:49 UTC (rev 27407)
+++ trunk/blender/source/blender/editors/armature/poseobject.c	2010-03-11 11:15:25 UTC (rev 27408)
@@ -277,19 +277,26 @@
 void ED_pose_clear_paths(Object *ob)
 {
 	bPoseChannel *pchan;
+	short skipped = 0;
 	
 	if ELEM(NULL, ob, ob->pose)
 		return;
 	
-	/* free the motionpath blocks */
+	/* free the motionpath blocks, but also take note of whether we skipped some... */
 	for (pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
-		if ((pchan->bone) && (pchan->bone->flag & BONE_SELECTED)) {
-			if (pchan->mpath) {
+		if (pchan->mpath) {
+			if ((pchan->bone) && (pchan->bone->flag & BONE_SELECTED)) {
 				animviz_free_motionpath(pchan->mpath);
 				pchan->mpath= NULL;
 			}
+			else 
+				skipped = 1;
 		}
 	}
+	
+	/* if we didn't skip any, we shouldn't have any paths left */
+	if (skipped == 0)
+		ob->pose->avs.path_bakeflag &= ~MOTIONPATH_BAKE_HAS_PATHS;
 }
 
 /* operator callback for this */

Modified: trunk/blender/source/blender/editors/object/object_edit.c
===================================================================
--- trunk/blender/source/blender/editors/object/object_edit.c	2010-03-11 10:46:49 UTC (rev 27407)
+++ trunk/blender/source/blender/editors/object/object_edit.c	2010-03-11 11:15:25 UTC (rev 27408)
@@ -1687,6 +1687,7 @@
 		if (ob->mpath) {
 			animviz_free_motionpath(ob->mpath);
 			ob->mpath= NULL;
+			ob->avs.path_bakeflag &= ~MOTIONPATH_BAKE_HAS_PATHS;
 		}
 	}
 	CTX_DATA_END;

Modified: trunk/blender/source/blender/editors/transform/transform_conversions.c
===================================================================
--- trunk/blender/source/blender/editors/transform/transform_conversions.c	2010-03-11 10:46:49 UTC (rev 27407)
+++ trunk/blender/source/blender/editors/transform/transform_conversions.c	2010-03-11 11:15:25 UTC (rev 27408)
@@ -4688,9 +4688,11 @@
 		}
 		
 		/* do the bone paths 
-		 * NOTE: only do this when there is context info
+		 * 	- only do this when there is context info, since we need that to resolve
+		 *	  how to do the updates and so on...
+		 *	- do not calculate unless there are paths already to update...
 		 */
-		if (C && (ob->pose->avs.path_type == MOTIONPATH_TYPE_ACFRA)) {
+		if (C && (ob->pose->avs.path_bakeflag & MOTIONPATH_BAKE_HAS_PATHS)) {
 			//ED_pose_clear_paths(C, ob); // XXX for now, don't need to clear
 			ED_pose_recalculate_paths(C, scene, ob);
 		}
@@ -4996,7 +4998,8 @@
 			if (!cancelled) {
 				autokeyframe_ob_cb_func(C, t->scene, (View3D *)t->view, ob, t->mode);
 				
-				if (ob->avs.path_type == MOTIONPATH_TYPE_ACFRA)
+				/* only calculate paths if there are paths to be recalculated */
+				if (ob->avs.path_bakeflag & MOTIONPATH_BAKE_HAS_PATHS)
 					recalcObPaths= 1;
 			}
 		}

Modified: trunk/blender/source/blender/makesdna/DNA_action_types.h
===================================================================
--- trunk/blender/source/blender/makesdna/DNA_action_types.h	2010-03-11 10:46:49 UTC (rev 27407)
+++ trunk/blender/source/blender/makesdna/DNA_action_types.h	2010-03-11 11:15:25 UTC (rev 27408)
@@ -161,6 +161,8 @@
 	MOTIONPATH_BAKE_NEEDS_RECALC	= (1<<0),
 		/* for bones - calculate head-points for curves instead of tips */
 	MOTIONPATH_BAKE_HEADS			= (1<<1),
+		/* motion paths exist for AnimVizSettings instance - set when calc for first time, and unset when clearing */
+	MOTIONPATH_BAKE_HAS_PATHS		= (1<<2),
 } eMotionPath_BakeFlag;
 
 /* ************************************************ */





More information about the Bf-blender-cvs mailing list