[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [35209] trunk/blender/source/blender/ editors: Small animation tweaks:

Joshua Leung aligorith at gmail.com
Sun Feb 27 02:53:05 CET 2011


Revision: 35209
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=35209
Author:   aligorith
Date:     2011-02-27 01:53:05 +0000 (Sun, 27 Feb 2011)
Log Message:
-----------
Small animation tweaks:
- Fixed problem where just trying to replace existing keyframes would
result in the intepolation set on that keyframe to get lost. This was
mostly an issue if trying to re-block some animation in the middle of
a shot, with the rest of the keys set to Bezier, but the first
keyframe in this new segment needing to be Constant so that we don't
get sloppy automatic interpolation in the way

- Hooked up Media-Play/Stop/Next/Prev controls to animation playback
and keyframe jumping functionality in default keymap in addition the
existing controls. I'm also considering whether to migrate Next/Prev
Keyframe key mappings off the Ctrl-PageUp/Down keys for a more
ergonomic option (i.e. shift <, shift >)

Modified Paths:
--------------
    trunk/blender/source/blender/editors/animation/keyframes_general.c
    trunk/blender/source/blender/editors/animation/keyframing.c
    trunk/blender/source/blender/editors/screen/screen_ops.c

Modified: trunk/blender/source/blender/editors/animation/keyframes_general.c
===================================================================
--- trunk/blender/source/blender/editors/animation/keyframes_general.c	2011-02-26 22:48:17 UTC (rev 35208)
+++ trunk/blender/source/blender/editors/animation/keyframes_general.c	2011-02-27 01:53:05 UTC (rev 35209)
@@ -323,7 +323,7 @@
 		}
 			
 		/* calculate the new smoothed F-Curve's with weighted averages:
-		 *	- this is done with two passes
+		 *	- this is done with two passes to avoid progressive corruption errors
 		 *	- uses 5 points for each operation (which stores in the relevant handles)
 		 *	-	previous: w/a ratio = 3:5:2:1:1
 		 *	- 	next: w/a ratio = 1:1:2:5:3

Modified: trunk/blender/source/blender/editors/animation/keyframing.c
===================================================================
--- trunk/blender/source/blender/editors/animation/keyframing.c	2011-02-26 22:48:17 UTC (rev 35208)
+++ trunk/blender/source/blender/editors/animation/keyframing.c	2011-02-27 01:53:05 UTC (rev 35209)
@@ -295,6 +295,7 @@
 int insert_vert_fcurve (FCurve *fcu, float x, float y, short flag)
 {
 	BezTriple beztr= {{{0}}};
+	int oldTot = fcu->totvert;
 	int a;
 	
 	/* set all three points, for nicer start position 
@@ -330,10 +331,16 @@
 	if ((fcu->totvert > 2) && (flag & INSERTKEY_REPLACE)==0) {
 		BezTriple *bezt= (fcu->bezt + a);
 		
-		/* set interpolation from previous (if available) */
-		// FIXME: this doesn't work if user tweaked the interpolation specifically, and they were just overwriting some existing key in the process...
-		if (a > 0) bezt->ipo= (bezt-1)->ipo;
-		else if (a < fcu->totvert-1) bezt->ipo= (bezt+1)->ipo;
+		/* set interpolation from previous (if available), but only if we didn't just replace some keyframe 
+		 * 	- replacement is indicated by no-change in number of verts
+		 *	- when replacing, the user may have specified some interpolation that should be kept
+		 */
+		if (fcu->totvert > oldTot) {
+			if (a > 0) 
+				bezt->ipo= (bezt-1)->ipo;
+			else if (a < fcu->totvert-1) 
+				bezt->ipo= (bezt+1)->ipo;
+		}
 			
 		/* don't recalculate handles if fast is set
 		 *	- this is a hack to make importers faster

Modified: trunk/blender/source/blender/editors/screen/screen_ops.c
===================================================================
--- trunk/blender/source/blender/editors/screen/screen_ops.c	2011-02-26 22:48:17 UTC (rev 35208)
+++ trunk/blender/source/blender/editors/screen/screen_ops.c	2011-02-27 01:53:05 UTC (rev 35209)
@@ -3221,11 +3221,17 @@
 	WM_keymap_add_item(keymap, "SCREEN_OT_keyframe_jump", PAGEUPKEY, KM_PRESS, KM_CTRL, 0);
 	RNA_boolean_set(WM_keymap_add_item(keymap, "SCREEN_OT_keyframe_jump", PAGEDOWNKEY, KM_PRESS, KM_CTRL, 0)->ptr, "next", 0);
 	
+	WM_keymap_add_item(keymap, "SCREEN_OT_keyframe_jump", MEDIALAST, KM_PRESS, 0, 0);
+	RNA_boolean_set(WM_keymap_add_item(keymap, "SCREEN_OT_keyframe_jump", MEDIAFIRST, KM_PRESS, 0, 0)->ptr, "next", 0);
+	
 	/* play (forward and backwards) */
 	WM_keymap_add_item(keymap, "SCREEN_OT_animation_play", AKEY, KM_PRESS, KM_ALT, 0);
 	RNA_boolean_set(WM_keymap_add_item(keymap, "SCREEN_OT_animation_play", AKEY, KM_PRESS, KM_ALT|KM_SHIFT, 0)->ptr, "reverse", 1);
 	WM_keymap_add_item(keymap, "SCREEN_OT_animation_cancel", ESCKEY, KM_PRESS, 0, 0);
 	
+	WM_keymap_add_item(keymap, "SCREEN_OT_animation_play", MEDIAPLAY, KM_PRESS, 0, 0);
+	WM_keymap_add_item(keymap, "SCREEN_OT_animation_cancel", MEDIASTOP, KM_PRESS, 0, 0);
+	
 	/* Alternative keys for animation and sequencer playing */
 #if 0 // XXX: disabled for restoring later... bad implementation
 	keymap= WM_keymap_find(keyconf, "Frames", 0, 0);




More information about the Bf-blender-cvs mailing list