[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [26829] trunk/blender: Bugfix #21094:

Joshua Leung aligorith at gmail.com
Fri Feb 12 02:06:18 CET 2010


Revision: 26829
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=26829
Author:   aligorith
Date:     2010-02-12 02:06:18 +0100 (Fri, 12 Feb 2010)

Log Message:
-----------
Bugfix #21094: 

Inserting keyframes for properties that don't already have F-Curves shouldn't occur if auto keyframing is set to 'replace' only (i.e. see timeline -> frame -> autokey mode menu for details). 

Modified Paths:
--------------
    trunk/blender/release/scripts/ui/space_time.py
    trunk/blender/source/blender/editors/animation/keyframing.c
    trunk/blender/source/blender/editors/space_sequencer/sequencer_edit.c

Modified: trunk/blender/release/scripts/ui/space_time.py
===================================================================
--- trunk/blender/release/scripts/ui/space_time.py	2010-02-12 01:03:22 UTC (rev 26828)
+++ trunk/blender/release/scripts/ui/space_time.py	2010-02-12 01:06:18 UTC (rev 26829)
@@ -130,7 +130,6 @@
         layout.separator()
 
         sub = layout.row()
-        #sub.active = tools.enable_auto_key
         sub.menu("TIME_MT_autokey")
 
 
@@ -165,8 +164,6 @@
         layout = self.layout
         tools = context.tool_settings
 
-        layout.active = tools.enable_auto_key
-
         layout.prop_enum(tools, "autokey_mode", 'ADD_REPLACE_KEYS')
         layout.prop_enum(tools, "autokey_mode", 'REPLACE_KEYS')
 

Modified: trunk/blender/source/blender/editors/animation/keyframing.c
===================================================================
--- trunk/blender/source/blender/editors/animation/keyframing.c	2010-02-12 01:03:22 UTC (rev 26828)
+++ trunk/blender/source/blender/editors/animation/keyframing.c	2010-02-12 01:06:18 UTC (rev 26829)
@@ -222,10 +222,12 @@
 {
 	int i= 0;
 	
+	/* are there already keyframes? */
 	if (fcu->bezt) {
 		short replace = -1;
 		i = binarysearch_bezt_index(fcu->bezt, bezt->vec[1][0], fcu->totvert, &replace);
 		
+		/* replace an existing keyframe? */
 		if (replace) {			
 			/* sanity check: 'i' may in rare cases exceed arraylen */
 			if ((i >= 0) && (i < fcu->totvert)) {
@@ -252,6 +254,7 @@
 				}
 			}
 		}
+		/* keyframing modes allow to not replace keyframe */
 		else if ((flag & INSERTKEY_REPLACE) == 0) {
 			/* insert new - if we're not restricted to replacing keyframes only */
 			BezTriple *newb= MEM_callocN((fcu->totvert+1)*sizeof(BezTriple), "beztriple");
@@ -270,16 +273,27 @@
 			/* replace (+ free) old with new, only if necessary to do so */
 			MEM_freeN(fcu->bezt);
 			fcu->bezt= newb;
-				
+			
 			fcu->totvert++;
 		}
 	}
-	else {
-		// TODO: need to check for old sample-data now...
+	/* no keyframes already, but can only add if...
+	 *	1) keyframing modes say that keyframes can only be replaced, so adding new ones won't know
+	 *	2) there are no samples on the curve
+	 *		// NOTE: maybe we may want to allow this later when doing samples -> bezt conversions, 
+	 *		// but for now, having both is asking for trouble
+	 */
+	else if ((flag & INSERTKEY_REPLACE)==0 && (fcu->fpt==NULL)) {
+		/* create new keyframes array */
 		fcu->bezt= MEM_callocN(sizeof(BezTriple), "beztriple");
 		*(fcu->bezt)= *bezt;
 		fcu->totvert= 1;
 	}
+	/* cannot add anything */
+	else {
+		/* return error code -1 to prevent any misunderstandings */
+		return -1;
+	}
 	
 	
 	/* we need to return the index, so that some tools which do post-processing can 

Modified: trunk/blender/source/blender/editors/space_sequencer/sequencer_edit.c
===================================================================
--- trunk/blender/source/blender/editors/space_sequencer/sequencer_edit.c	2010-02-12 01:03:22 UTC (rev 26828)
+++ trunk/blender/source/blender/editors/space_sequencer/sequencer_edit.c	2010-02-12 01:06:18 UTC (rev 26829)
@@ -791,34 +791,12 @@
 static Sequence *dupli_seq(struct Scene *scene, Sequence *seq)
 {
 	Sequence *seqn = MEM_dupallocN(seq);
-	// XXX animato: ID *id;
 
 	seq->tmp = seqn;
-		
 	seqn->strip= MEM_dupallocN(seq->strip);
 
-	// XXX animato
-#if 0
-	if (seqn->ipo) {
-		if (U.dupflag & USER_DUP_IPO) {
-			id= (ID *)seqn->ipo;
-			seqn->ipo= copy_ipo(seqn->ipo);
-			/* we don't need to decrease the number
-			 * of the ipo because we never increase it,
-			 * for example, adduplicate need decrease
-			 * the number but only because copy_object
-			 * call id_us_plus for the ipo block and
-			 * single_ipo_users only work if id->us > 1.
-			 *
-			 * need call ipo_idnew here, for drivers ??
-			 * - Diego
-			 */
-		}
-		else
-			seqn->ipo->id.us++;
-	}
-#endif
-
+	// XXX: add F-Curve duplication stuff?
+		
 	seqn->strip->tstripdata = 0;
 	seqn->strip->tstripdata_startstill = 0;
 	seqn->strip->tstripdata_endstill = 0;





More information about the Bf-blender-cvs mailing list