diff options
author | Peter Schlaile <peter@schlaile.de> | 2010-05-01 19:17:30 +0400 |
---|---|---|
committer | Peter Schlaile <peter@schlaile.de> | 2010-05-01 19:17:30 +0400 |
commit | 93a7f0ef65df2def26188f08a6a2cae35a330d75 (patch) | |
tree | 13f10e5a11c71d1ad1f166465499604ad462e6fa /source/blender | |
parent | d5939c03d1424bfb427a3143a1d3ea997af8d52b (diff) |
Second round of sequencer IPO-conversion to new animation system:
* now non-frame-locked IPOs work, too.
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/blenkernel/intern/ipo.c | 47 |
1 files changed, 33 insertions, 14 deletions
diff --git a/source/blender/blenkernel/intern/ipo.c b/source/blender/blenkernel/intern/ipo.c index a9dd358d813..7f2ac50acd5 100644 --- a/source/blender/blenkernel/intern/ipo.c +++ b/source/blender/blenkernel/intern/ipo.c @@ -792,12 +792,12 @@ static char *particle_adrcodes_to_paths (int adrcode, int *array_index) /* 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 @@ static char *get_rna_access (int blocktype, int adrcode, char actname[], char co /* 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 @@ static void fcurve_add_to_list (ListBase *groups, ListBase *list, FCurve *fcu, c * 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 @@ static void icu_to_fcurves (ID *id, ListBase *groups, ListBase *list, IpoCurve * /* 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 @@ static void icu_to_fcurves (ID *id, ListBase *groups, ListBase *list, IpoCurve * 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 @@ static void icu_to_fcurves (ID *id, ListBase *groups, ListBase *list, IpoCurve * * 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 @@ static void ipo_to_animato (ID *id, Ipo *ipo, char actname[], char constname[], 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 @@ static void ipo_to_animato (ID *id, Ipo *ipo, char actname[], char constname[], } } 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 @@ static void action_to_animato (ID *id, bAction *act, ListBase *groups, ListBase * 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 @@ static void ipo_to_animdata (ID *id, Ipo *ipo, char actname[], char constname[], 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 @@ static void ipo_to_animdata (ID *id, Ipo *ipo, char actname[], char constname[], * 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 @@ void do_versions_ipos_to_animato(Main *main) /* convert IPO */ ipo_to_animdata((ID *)scene, seq->ipo, - NULL, NULL, seq->name+2); + NULL, NULL, seq); seq->ipo->id.us--; seq->ipo = NULL; } |