[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [35909] trunk/blender: Propagate Pose Tweaks:

Joshua Leung aligorith at gmail.com
Thu Mar 31 02:45:53 CEST 2011


Revision: 35909
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=35909
Author:   aligorith
Date:     2011-03-31 00:45:52 +0000 (Thu, 31 Mar 2011)
Log Message:
-----------
Propagate Pose Tweaks:
- Renamed "Last Keyframe" mode to "Before End". This mode still just
copies the pose to all keyframes starting from the current frame until
the last one encountered per F-Curve
- "Last Keyframe" mode (new one) now copies the pose to the last
keyframe. This is useful for making animations cyclic (i.e. go to
first keyframe, edit, then Pose->Propagate->To Last Keyframe (Make
Cyclic))

Modified Paths:
--------------
    trunk/blender/release/scripts/startup/bl_ui/space_view3d.py
    trunk/blender/source/blender/editors/armature/poseSlide.c

Modified: trunk/blender/release/scripts/startup/bl_ui/space_view3d.py
===================================================================
--- trunk/blender/release/scripts/startup/bl_ui/space_view3d.py	2011-03-31 00:06:19 UTC (rev 35908)
+++ trunk/blender/release/scripts/startup/bl_ui/space_view3d.py	2011-03-31 00:45:52 UTC (rev 35909)
@@ -1259,6 +1259,7 @@
 
         layout.operator("pose.propagate")
         layout.operator("pose.propagate", text="To Next Keyframe").mode = 'NEXT_KEY'
+        layout.operator("pose.propagate", text="To Last Keyframe (Make Cyclic)").mode = 'LAST_KEY'
 
 
 class VIEW3D_MT_pose_library(bpy.types.Menu):

Modified: trunk/blender/source/blender/editors/armature/poseSlide.c
===================================================================
--- trunk/blender/source/blender/editors/armature/poseSlide.c	2011-03-31 00:06:19 UTC (rev 35908)
+++ trunk/blender/source/blender/editors/armature/poseSlide.c	2011-03-31 00:45:52 UTC (rev 35909)
@@ -862,14 +862,16 @@
 
 /* "termination conditions" - i.e. when we stop */
 typedef enum ePosePropagate_Termination {
-		/* stop when we run out of keyframes */
-	POSE_PROPAGATE_LAST_KEY	= 0,
+		/* stop after the current hold ends */
+	POSE_PROPAGATE_SMART_HOLDS = 0,
+		/* only do on the last keyframe */
+	POSE_PROPAGATE_LAST_KEY,
 		/* stop after the next keyframe */
 	POSE_PROPAGATE_NEXT_KEY,
 		/* stop after the specified frame */
 	POSE_PROPAGATE_BEFORE_FRAME,
-		/* stop after */
-	POSE_PROPAGATE_SMART_HOLDS
+		/* stop when we run out of keyframes */
+	POSE_PROPAGATE_BEFORE_END
 } ePosePropagate_Termination;
 
 /* --------------------------------- */
@@ -1066,13 +1068,18 @@
 		if (ELEM(mode, POSE_PROPAGATE_BEFORE_FRAME, POSE_PROPAGATE_SMART_HOLDS)) {
 			/* stop if keyframe is outside the accepted range */
 			if (bezt->vec[1][0] > endFrame)
-				break;
+				break; 
 		}
 		else if (mode == POSE_PROPAGATE_NEXT_KEY) {
 			/* stop after the first keyframe has been processed */
 			if (first == 0)
 				break;
 		}
+		else if (mode == POSE_PROPAGATE_LAST_KEY) {
+			/* only affect this frame if it will be the last one */
+			if (i != (fcu->totvert-1))
+				continue;
+		}
 		
 		/* just flatten handles, since values will now be the same either side... */
 		// TODO: perhaps a fade-out modulation of the value is required here (optional once again)?
@@ -1142,10 +1149,11 @@
 void POSE_OT_propagate (wmOperatorType *ot)
 {
 	static EnumPropertyItem terminate_items[]= {
-		{POSE_PROPAGATE_LAST_KEY, "LAST_KEY", 0, "Last Keyframe", ""},
-		{POSE_PROPAGATE_NEXT_KEY, "NEXT_KEY", 0, "Next Keyframe", ""},
+		{POSE_PROPAGATE_SMART_HOLDS, "WHILE_HELD", 0, "While Held", "Propagate pose to all keyframes after current frame that don't change (Default behaviour)"},
+		{POSE_PROPAGATE_NEXT_KEY, "NEXT_KEY", 0, "To Next Keyframe", "Propagate pose to first keyframe following the current frame only"},
+		{POSE_PROPAGATE_LAST_KEY, "LAST_KEY", 0, "To Last Keyframe", "Propagate pose to the last keyframe only (i.e. making action cyclic)"},
 		{POSE_PROPAGATE_BEFORE_FRAME, "BEFORE_FRAME", 0, "Before Frame", "Propagate pose to all keyframes between current frame and 'Frame' property"},
-		{POSE_PROPAGATE_SMART_HOLDS, "WHILE_HELD", 0, "While Held", "Propagate pose to all keyframes after current frame that don't change (Default behaviour)"},
+		{POSE_PROPAGATE_BEFORE_END, "BEFORE_END", 0, "Before Last Keyframe", "Propagate pose to all keyframes from current frame until no more are found"},
 		{0, NULL, 0, NULL, NULL}};
 		
 	/* identifiers */
@@ -1163,7 +1171,7 @@
 	/* properties */
 	// TODO: add "fade out" control for tapering off amount of propagation as time goes by?
 	ot->prop= RNA_def_enum(ot->srna, "mode", terminate_items, POSE_PROPAGATE_SMART_HOLDS, "Terminate Mode", "Method used to determine when to stop propagating pose to keyframes");
-	RNA_def_float(ot->srna, "end_frame", 250.0, FLT_MIN, FLT_MAX, "End Frame", "Frame to stop propagating frames to", 1.0, 250.0);
+	RNA_def_float(ot->srna, "end_frame", 250.0, FLT_MIN, FLT_MAX, "End Frame", "Frame to stop propagating frames to (for 'Before Frame' mode)", 1.0, 250.0);
 }
 
 /* **************************************************** */




More information about the Bf-blender-cvs mailing list