[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [28527] trunk/blender/source/blender/ blenkernel/intern/ipo.c: Second round of sequencer IPO-conversion to new animation system:

Peter Schlaile peter at schlaile.de
Sat May 1 17:17:30 CEST 2010


Revision: 28527
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=28527
Author:   schlaile
Date:     2010-05-01 17:17:30 +0200 (Sat, 01 May 2010)

Log Message:
-----------
Second round of sequencer IPO-conversion to new animation system:
* now non-frame-locked IPOs work, too.

Modified Paths:
--------------
    trunk/blender/source/blender/blenkernel/intern/ipo.c

Modified: trunk/blender/source/blender/blenkernel/intern/ipo.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/ipo.c	2010-05-01 14:09:45 UTC (rev 28526)
+++ trunk/blender/source/blender/blenkernel/intern/ipo.c	2010-05-01 15:17:30 UTC (rev 28527)
@@ -792,12 +792,12 @@
 /* Allocate memory for RNA-path for some property given a blocktype, adrcode, and 'root' parts of path
  *	Input:
  *		- blocktype, adrcode	- determines setting to get
- *		- actname, constname,seqname - used to build path
+ *		- actname, constname,seq - used to build path
  *	Output:
  *		- array_index			- index in property's array (if applicable) to use
  *		- return				- the allocated path...
  */
-static char *get_rna_access (int blocktype, int adrcode, char actname[], char constname[], char seqname[], int *array_index)
+static char *get_rna_access (int blocktype, int adrcode, char actname[], char constname[], Sequence * seq, int *array_index)
 {
 	DynStr *path= BLI_dynstr_new();
 	char *propname=NULL, *rpath=NULL;
@@ -919,9 +919,10 @@
 		/* Constraint in Object */
 		sprintf(buf, "constraints[\"%s\"]", constname);
 	}
-	else if (seqname && seqname[0]) {
+	else if (seq) {
 		/* Sequence names in Scene */
-		sprintf(buf, "sequence_editor.sequences_all[\"%s\"]", seqname);
+		sprintf(buf, "sequence_editor.sequences_all[\"%s\"]", 
+			seq->name+2);
 	}
 	else
 		strcpy(buf, ""); /* empty string */
@@ -1115,9 +1116,9 @@
  * is not relevant, BUT do not free the IPO-Curve itself...
  *	actname: name of Action-Channel (if applicable) that IPO-Curve's IPO-block belonged to
  *	constname: name of Constraint-Channel (if applicable) that IPO-Curve's IPO-block belonged to
- *      seqname: name of sequencer-strip (if applicable) that IPO-Curve's IPO-block belonged to
+ *      seq: sequencer-strip (if applicable) that IPO-Curve's IPO-block belonged to
  */
-static void icu_to_fcurves (ID *id, ListBase *groups, ListBase *list, IpoCurve *icu, char *actname, char *constname, char * seqname, int muteipo)
+static void icu_to_fcurves (ID *id, ListBase *groups, ListBase *list, IpoCurve *icu, char *actname, char *constname, Sequence * seq, int muteipo)
 {
 	AdrBit2Path *abp;
 	FCurve *fcu;
@@ -1240,7 +1241,7 @@
 		/* get rna-path
 		 *	- we will need to set the 'disabled' flag if no path is able to be made (for now)
 		 */
-		fcu->rna_path= get_rna_access(icu->blocktype, icu->adrcode, actname, constname, seqname, &fcu->array_index);
+		fcu->rna_path= get_rna_access(icu->blocktype, icu->adrcode, actname, constname, seq, &fcu->array_index);
 		if (fcu->rna_path == NULL)
 			fcu->flag |= FCURVE_DISABLED;
 		
@@ -1312,6 +1313,24 @@
 						dst->vec[2][0] *= fac;
 					}
 				}
+				
+				/* correct values for sequencer curves,
+				   that were not locked to frame */
+
+				if (seq && 
+				    (seq->flag & SEQ_IPO_FRAME_LOCKED) == 0) {
+					double mul= (seq->enddisp-seq->startdisp)/100.0f;
+					double offset= seq->startdisp;
+					
+					dst->vec[0][0] *= mul;
+					dst->vec[0][0] += offset;
+
+					dst->vec[1][0] *= mul;
+					dst->vec[1][0] += offset;
+
+					dst->vec[2][0] *= mul;
+					dst->vec[2][0] += offset;
+				}
 			}
 		}
 		else if (icu->bp) {
@@ -1331,7 +1350,7 @@
  * This does not assume that any ID or AnimData uses it, but does assume that
  * it is given two lists, which it will perform driver/animation-data separation.
  */
-static void ipo_to_animato (ID *id, Ipo *ipo, char actname[], char constname[], char seqname[], ListBase *animgroups, ListBase *anim, ListBase *drivers)
+static void ipo_to_animato (ID *id, Ipo *ipo, char actname[], char constname[], Sequence * seq, ListBase *animgroups, ListBase *anim, ListBase *drivers)
 {
 	IpoCurve *icu;
 	
@@ -1362,7 +1381,7 @@
 		if (icu->driver) {
 			/* Blender 2.4x allowed empty drivers, but we don't now, since they cause more trouble than they're worth */
 			if ((icu->driver->ob) || (icu->driver->type == IPO_DRIVER_TYPE_PYTHON)) {
-				icu_to_fcurves(id, NULL, drivers, icu, actname, constname, seqname, ipo->muteipo);
+				icu_to_fcurves(id, NULL, drivers, icu, actname, constname, seq, ipo->muteipo);
 			}
 			else {
 				MEM_freeN(icu->driver);
@@ -1370,7 +1389,7 @@
 			}
 		}
 		else
-			icu_to_fcurves(id, animgroups, anim, icu, actname, constname, seqname, ipo->muteipo);
+			icu_to_fcurves(id, animgroups, anim, icu, actname, constname, seq, ipo->muteipo);
 	}
 	
 	/* if this IPO block doesn't have any users after this one, free... */
@@ -1455,7 +1474,7 @@
  * This assumes that AnimData has been added already. Separation of drivers
  * from animation data is accomplished here too...
  */
-static void ipo_to_animdata (ID *id, Ipo *ipo, char actname[], char constname[], char seqname[])
+static void ipo_to_animdata (ID *id, Ipo *ipo, char actname[], char constname[], Sequence * seq)
 {
 	AnimData *adt= BKE_animdata_from_id(id);
 	ListBase anim = {NULL, NULL};
@@ -1471,7 +1490,7 @@
 	
 	if (G.f & G_DEBUG) {
 		printf("ipo to animdata - ID:%s, IPO:%s, actname:%s constname:%s seqname:%s  curves:%d \n", 
-		       id->name+2, ipo->id.name+2, (actname)?actname:"<None>", (constname)?constname:"<None>", (seqname)?seqname:"<None>",
+		       id->name+2, ipo->id.name+2, (actname)?actname:"<None>", (constname)?constname:"<None>", (seq)?(seq->name+2):"<None>",
 			BLI_countlist(&ipo->curve));
 	}
 	
@@ -1479,7 +1498,7 @@
 	 * and the try to put these lists in the right places, but do not free the lists here
 	 */
 	// XXX there shouldn't be any need for the groups, so don't supply pointer for that now... 
-	ipo_to_animato(id, ipo, actname, constname, seqname, NULL, &anim, &drivers);
+	ipo_to_animato(id, ipo, actname, constname, seq, NULL, &anim, &drivers);
 	
 	/* deal with animation first */
 	if (anim.first) {
@@ -1859,7 +1878,7 @@
 				
 				/* convert IPO */
 				ipo_to_animdata((ID *)scene, seq->ipo, 
-						NULL, NULL, seq->name+2);
+						NULL, NULL, seq);
 				seq->ipo->id.us--;
 				seq->ipo = NULL;
 			}





More information about the Bf-blender-cvs mailing list