Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/blenkernel/intern/ipo.c')
-rw-r--r--source/blender/blenkernel/intern/ipo.c297
1 files changed, 198 insertions, 99 deletions
diff --git a/source/blender/blenkernel/intern/ipo.c b/source/blender/blenkernel/intern/ipo.c
index 46315e1bc9a..d641229d5e0 100644
--- a/source/blender/blenkernel/intern/ipo.c
+++ b/source/blender/blenkernel/intern/ipo.c
@@ -92,18 +92,22 @@ void BKE_ipo_free(Ipo *ipo)
icn = icu->next;
n++;
- if (icu->bezt)
+ if (icu->bezt) {
MEM_freeN(icu->bezt);
- if (icu->bp)
+ }
+ if (icu->bp) {
MEM_freeN(icu->bp);
- if (icu->driver)
+ }
+ if (icu->driver) {
MEM_freeN(icu->driver);
+ }
BLI_freelinkN(&ipo->curve, icu);
}
- if (G.debug & G_DEBUG)
+ if (G.debug & G_DEBUG) {
printf("Freed %d (Unconverted) Ipo-Curves from IPO '%s'\n", n, ipo->id.name + 2);
+ }
}
/* *************************************************** */
@@ -378,42 +382,60 @@ static const char *mtex_adrcodes_to_paths(int adrcode, int *UNUSED(array_index))
static char buf[128];
/* base part of path */
- if (adrcode & MA_MAP1)
+ if (adrcode & MA_MAP1) {
base = "textures[0]";
- else if (adrcode & MA_MAP2)
+ }
+ else if (adrcode & MA_MAP2) {
base = "textures[1]";
- else if (adrcode & MA_MAP3)
+ }
+ else if (adrcode & MA_MAP3) {
base = "textures[2]";
- else if (adrcode & MA_MAP4)
+ }
+ else if (adrcode & MA_MAP4) {
base = "textures[3]";
- else if (adrcode & MA_MAP5)
+ }
+ else if (adrcode & MA_MAP5) {
base = "textures[4]";
- else if (adrcode & MA_MAP6)
+ }
+ else if (adrcode & MA_MAP6) {
base = "textures[5]";
- else if (adrcode & MA_MAP7)
+ }
+ else if (adrcode & MA_MAP7) {
base = "textures[6]";
- else if (adrcode & MA_MAP8)
+ }
+ else if (adrcode & MA_MAP8) {
base = "textures[7]";
- else if (adrcode & MA_MAP9)
+ }
+ else if (adrcode & MA_MAP9) {
base = "textures[8]";
- else if (adrcode & MA_MAP10)
+ }
+ else if (adrcode & MA_MAP10) {
base = "textures[9]";
- else if (adrcode & MA_MAP11)
+ }
+ else if (adrcode & MA_MAP11) {
base = "textures[10]";
- else if (adrcode & MA_MAP12)
+ }
+ else if (adrcode & MA_MAP12) {
base = "textures[11]";
- else if (adrcode & MA_MAP13)
+ }
+ else if (adrcode & MA_MAP13) {
base = "textures[12]";
- else if (adrcode & MA_MAP14)
+ }
+ else if (adrcode & MA_MAP14) {
base = "textures[13]";
- else if (adrcode & MA_MAP15)
+ }
+ else if (adrcode & MA_MAP15) {
base = "textures[14]";
- else if (adrcode & MA_MAP16)
+ }
+ else if (adrcode & MA_MAP16) {
base = "textures[15]";
- else if (adrcode & MA_MAP17)
+ }
+ else if (adrcode & MA_MAP17) {
base = "textures[16]";
- else if (adrcode & MA_MAP18)
+ }
+ else if (adrcode & MA_MAP18) {
base = "textures[17]";
+ }
/* property identifier for path */
adrcode = (adrcode & (MA_MAP1 - 1));
@@ -469,8 +491,9 @@ static const char *mtex_adrcodes_to_paths(int adrcode, int *UNUSED(array_index))
BLI_snprintf(buf, 128, "%s.%s", base, prop);
return buf;
}
- else
+ else {
return NULL;
+ }
}
/* Texture types */
@@ -913,8 +936,9 @@ static char *get_rna_access(ID *id,
int dummy_index = 0;
/* hack: if constname is set, we can only be dealing with an Constraint curve */
- if (constname)
+ if (constname) {
blocktype = ID_CO;
+ }
/* get property name based on blocktype */
switch (blocktype) {
@@ -1002,16 +1026,18 @@ static char *get_rna_access(ID *id,
*/
if ((propname == NULL) && (blocktype > 0)) {
/* nothing was found, so exit */
- if (array_index)
+ if (array_index) {
*array_index = 0;
+ }
BLI_dynstr_free(path);
return NULL;
}
else {
- if (array_index)
+ if (array_index) {
*array_index = dummy_index;
+ }
}
/* 'buf' _must_ be initialized in this block */
@@ -1050,8 +1076,9 @@ static char *get_rna_access(ID *id,
BLI_dynstr_append(path, buf);
/* need to add dot before property if there was anything precceding this */
- if (buf[0])
+ if (buf[0]) {
BLI_dynstr_append(path, ".");
+ }
/* now write name of property */
BLI_dynstr_append(path, propname);
@@ -1116,8 +1143,9 @@ static ChannelDriver *idriver_to_cdriver(IpoDriver *idriver)
/* PyDriver only requires the expression to be copied */
// FIXME: expression will be useless due to API changes, but at least not totally lost
cdriver->type = DRIVER_TYPE_PYTHON;
- if (idriver->name[0])
+ if (idriver->name[0]) {
BLI_strncpy(cdriver->expression, idriver->name, sizeof(cdriver->expression));
+ }
}
else {
DriverVar *dvar = NULL;
@@ -1137,16 +1165,18 @@ static ChannelDriver *idriver_to_cdriver(IpoDriver *idriver)
dtar = &dvar->targets[0];
dtar->id = (ID *)idriver->ob;
dtar->idtype = ID_OB;
- if (idriver->name[0])
+ if (idriver->name[0]) {
BLI_strncpy(dtar->pchan_name, idriver->name, sizeof(dtar->pchan_name));
+ }
/* second bone target (name was stored in same var as the first one) */
dtar = &dvar->targets[1];
dtar->id = (ID *)idriver->ob;
dtar->idtype = ID_OB;
- if (idriver->name[0]) // xxx... for safety
+ if (idriver->name[0]) { // xxx... for safety
BLI_strncpy(
dtar->pchan_name, idriver->name + DRIVER_NAME_OFFS, sizeof(dtar->pchan_name));
+ }
}
else {
/* only a single variable, of type 'transform channel' */
@@ -1157,8 +1187,9 @@ static ChannelDriver *idriver_to_cdriver(IpoDriver *idriver)
dtar = &dvar->targets[0];
dtar->id = (ID *)idriver->ob;
dtar->idtype = ID_OB;
- if (idriver->name[0])
+ if (idriver->name[0]) {
BLI_strncpy(dtar->pchan_name, idriver->name, sizeof(dtar->pchan_name));
+ }
dtar->transChan = adrcode_to_dtar_transchan(idriver->adrcode);
dtar->flag |= DTAR_FLAG_LOCALSPACE; /* old drivers took local space */
}
@@ -1210,8 +1241,9 @@ static void fcurve_add_to_list(
agrp = MEM_callocN(sizeof(bActionGroup), "bActionGroup");
agrp->flag = AGRP_SELECTED;
- if (muteipo)
+ if (muteipo) {
agrp->flag |= AGRP_MUTED;
+ }
BLI_strncpy(agrp->name, grpname, sizeof(agrp->name));
@@ -1228,8 +1260,9 @@ static void fcurve_add_to_list(
/* WARNING: this func should only need to look at the stuff we initialized, if not, things may crash */
action_groups_add_channel(&tmp_act, agrp, fcu);
- if (agrp->flag & AGRP_MUTED) /* flush down */
+ if (agrp->flag & AGRP_MUTED) { /* flush down */
fcu->flag |= FCURVE_MUTED;
+ }
/* set the output lists based on the ones in the temp action */
groups->first = tmp_act.groups.first;
@@ -1266,20 +1299,26 @@ static void icu_to_fcurves(ID *id,
fcu = MEM_callocN(sizeof(FCurve), "FCurve");
/* convert driver */
- if (icu->driver)
+ if (icu->driver) {
fcu->driver = idriver_to_cdriver(icu->driver);
+ }
/* copy flags */
- if (icu->flag & IPO_VISIBLE)
+ if (icu->flag & IPO_VISIBLE) {
fcu->flag |= FCURVE_VISIBLE;
- if (icu->flag & IPO_SELECT)
+ }
+ if (icu->flag & IPO_SELECT) {
fcu->flag |= FCURVE_SELECTED;
- if (icu->flag & IPO_ACTIVE)
+ }
+ if (icu->flag & IPO_ACTIVE) {
fcu->flag |= FCURVE_ACTIVE;
- if (icu->flag & IPO_MUTE)
+ }
+ if (icu->flag & IPO_MUTE) {
fcu->flag |= FCURVE_MUTED;
- if (icu->flag & IPO_PROTECT)
+ }
+ if (icu->flag & IPO_PROTECT) {
fcu->flag |= FCURVE_PROTECTED;
+ }
/* set extrapolation */
switch (icu->extrap) {
@@ -1300,10 +1339,12 @@ static void icu_to_fcurves(ID *id,
FMod_Cycles *data = (FMod_Cycles *)fcm->data;
/* if 'offset' one is in use, set appropriate settings */
- if (icu->extrap == IPO_CYCLX)
+ if (icu->extrap == IPO_CYCLX) {
data->before_mode = data->after_mode = FCM_EXTRAPOLATE_CYCLIC_OFFSET;
- else
+ }
+ else {
data->before_mode = data->after_mode = FCM_EXTRAPOLATE_CYCLIC;
+ }
break;
}
}
@@ -1316,8 +1357,9 @@ static void icu_to_fcurves(ID *id,
FCurve *fcurve;
int b;
- if (G.debug & G_DEBUG)
+ if (G.debug & G_DEBUG) {
printf("\tconvert bitflag ipocurve, totbits = %d\n", totbits);
+ }
/* add the 'only int values' flag */
fcu->flag |= (FCURVE_INT_VALUES | FCURVE_DISCRETE_VALUES);
@@ -1332,10 +1374,12 @@ static void icu_to_fcurves(ID *id,
unsigned int i = 0;
/* make a copy of existing base-data if not the last curve */
- if (b < (totbits - 1))
+ if (b < (totbits - 1)) {
fcurve = copy_fcurve(fcu);
- else
+ }
+ else {
fcurve = fcu;
+ }
/* set path */
fcurve->rna_path = BLI_strdup(abp->path);
@@ -1366,17 +1410,21 @@ static void icu_to_fcurves(ID *id,
/* auto-handles - per curve to per handle */
if (icu->flag & IPO_AUTO_HORIZ) {
- if (dst->h1 == HD_AUTO)
+ if (dst->h1 == HD_AUTO) {
dst->h1 = HD_AUTO_ANIM;
- if (dst->h2 == HD_AUTO)
+ }
+ if (dst->h2 == HD_AUTO) {
dst->h2 = HD_AUTO_ANIM;
+ }
}
/* correct values, by checking if the flag of interest is set */
- if (((int)(dst->vec[1][1])) & (abp->bit))
+ if (((int)(dst->vec[1][1])) & (abp->bit)) {
dst->vec[0][1] = dst->vec[1][1] = dst->vec[2][1] = 1.0f;
- else
+ }
+ else {
dst->vec[0][1] = dst->vec[1][1] = dst->vec[2][1] = 0.0f;
+ }
}
}
else if (icu->bp) {
@@ -1397,8 +1445,9 @@ static void icu_to_fcurves(ID *id,
*/
fcu->rna_path = get_rna_access(
id, icu->blocktype, icu->adrcode, actname, constname, seq, &fcu->array_index);
- if (fcu->rna_path == NULL)
+ if (fcu->rna_path == NULL) {
fcu->flag |= FCURVE_DISABLED;
+ }
/* convert keyframes
* - beztriples and bpoints are mutually exclusive, so we won't have both at the same time
@@ -1418,18 +1467,21 @@ static void icu_to_fcurves(ID *id,
*dst = *src;
/* now copy interpolation from curve (if not already set) */
- if (icu->ipo != IPO_MIXED)
+ if (icu->ipo != IPO_MIXED) {
dst->ipo = icu->ipo;
+ }
/* 'hide' flag is now used for keytype - only 'keyframes' existed before */
dst->hide = BEZT_KEYTYPE_KEYFRAME;
/* auto-handles - per curve to per handle */
if (icu->flag & IPO_AUTO_HORIZ) {
- if (dst->h1 == HD_AUTO)
+ if (dst->h1 == HD_AUTO) {
dst->h1 = HD_AUTO_ANIM;
- if (dst->h2 == HD_AUTO)
+ }
+ if (dst->h2 == HD_AUTO) {
dst->h2 = HD_AUTO_ANIM;
+ }
}
/* correct values for euler rotation curves
@@ -1524,11 +1576,13 @@ static void ipo_to_animato(ID *id,
IpoCurve *icu;
/* sanity check */
- if (ELEM(NULL, ipo, anim, drivers))
+ if (ELEM(NULL, ipo, anim, drivers)) {
return;
+ }
- if (G.debug & G_DEBUG)
+ if (G.debug & G_DEBUG) {
printf("ipo_to_animato\n");
+ }
/* validate actname and constname
* - clear actname if it was one of the generic <builtin> ones (i.e. 'Object', or 'Shapes')
@@ -1537,10 +1591,12 @@ static void ipo_to_animato(ID *id,
* F-Curves for bones). This may be added later... for now let's just dump without them...
*/
if (actname) {
- if ((ipo->blocktype == ID_OB) && STREQ(actname, "Object"))
+ if ((ipo->blocktype == ID_OB) && STREQ(actname, "Object")) {
actname = NULL;
- else if ((ipo->blocktype == ID_OB) && STREQ(actname, "Shape"))
+ }
+ else if ((ipo->blocktype == ID_OB) && STREQ(actname, "Shape")) {
actname = NULL;
+ }
}
/* loop over IPO-Curves, freeing as we progress */
@@ -1558,8 +1614,9 @@ static void ipo_to_animato(ID *id,
icu->driver = NULL;
}
}
- else
+ else {
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... */
@@ -1571,14 +1628,17 @@ static void ipo_to_animato(ID *id,
icn = icu->next;
/* free driver */
- if (icu->driver)
+ if (icu->driver) {
MEM_freeN(icu->driver);
+ }
/* free old data of curve now that it's no longer needed for converting any more curves */
- if (icu->bezt)
+ if (icu->bezt) {
MEM_freeN(icu->bezt);
- if (icu->bp)
+ }
+ if (icu->bp) {
MEM_freeN(icu->bezt);
+ }
/* free this IPO-Curve */
BLI_freelinkN(&ipo->curve, icu);
@@ -1598,13 +1658,15 @@ static void action_to_animato(
bConstraintChannel *conchan, *conchann;
/* only continue if there are Action Channels (indicating unconverted data) */
- if (BLI_listbase_is_empty(&act->chanbase))
+ if (BLI_listbase_is_empty(&act->chanbase)) {
return;
+ }
/* get rid of all Action Groups */
// XXX this is risky if there's some old + some new data in the Action...
- if (act->groups.first)
+ if (act->groups.first) {
BLI_freelistN(&act->groups);
+ }
/* loop through Action-Channels, converting data, freeing as we go */
for (achan = act->chanbase.first; achan; achan = achann) {
@@ -1654,8 +1716,9 @@ static void ipo_to_animdata(
ListBase drivers = {NULL, NULL};
/* sanity check */
- if (ELEM(NULL, id, ipo))
+ if (ELEM(NULL, id, ipo)) {
return;
+ }
if (adt == NULL) {
CLOG_ERROR(&LOG, "adt invalid");
return;
@@ -1679,8 +1742,9 @@ static void ipo_to_animdata(
/* deal with animation first */
if (anim.first) {
- if (G.debug & G_DEBUG)
+ if (G.debug & G_DEBUG) {
printf("\thas anim\n");
+ }
/* try to get action */
if (adt->action == NULL) {
char nameBuf[MAX_ID_NAME];
@@ -1688,8 +1752,9 @@ static void ipo_to_animdata(
BLI_snprintf(nameBuf, sizeof(nameBuf), "CDA:%s", ipo->id.name + 2);
adt->action = BKE_action_add(bmain, nameBuf);
- if (G.debug & G_DEBUG)
+ if (G.debug & G_DEBUG) {
printf("\t\tadded new action - '%s'\n", nameBuf);
+ }
}
/* add F-Curves to action */
@@ -1698,8 +1763,9 @@ static void ipo_to_animdata(
/* deal with drivers */
if (drivers.first) {
- if (G.debug & G_DEBUG)
+ if (G.debug & G_DEBUG) {
printf("\thas drivers\n");
+ }
/* add drivers to end of driver stack */
BLI_movelisttolist(&adt->drivers, &drivers);
}
@@ -1713,14 +1779,16 @@ static void action_to_animdata(ID *id, bAction *act)
AnimData *adt = BKE_animdata_from_id(id);
/* only continue if there are Action Channels (indicating unconverted data) */
- if (ELEM(NULL, adt, act->chanbase.first))
+ if (ELEM(NULL, adt, act->chanbase.first)) {
return;
+ }
/* check if we need to set this Action as the AnimData's action */
if (adt->action == NULL) {
/* set this Action as AnimData's Action */
- if (G.debug & G_DEBUG)
+ if (G.debug & G_DEBUG) {
printf("act_to_adt - set adt action to act\n");
+ }
adt->action = act;
}
@@ -1769,31 +1837,38 @@ static void nlastrips_to_animdata(ID *id, ListBase *strips)
/* action reuse */
strip->repeat = as->repeat;
strip->scale = as->scale;
- if (as->flag & ACTSTRIP_LOCK_ACTION)
+ if (as->flag & ACTSTRIP_LOCK_ACTION) {
strip->flag |= NLASTRIP_FLAG_SYNC_LENGTH;
+ }
/* blending */
strip->blendin = as->blendin;
strip->blendout = as->blendout;
strip->blendmode = (as->mode == ACTSTRIPMODE_ADD) ? NLASTRIP_MODE_ADD :
NLASTRIP_MODE_REPLACE;
- if (as->flag & ACTSTRIP_AUTO_BLENDS)
+ if (as->flag & ACTSTRIP_AUTO_BLENDS) {
strip->flag |= NLASTRIP_FLAG_AUTO_BLENDS;
+ }
/* assorted setting flags */
- if (as->flag & ACTSTRIP_SELECT)
+ if (as->flag & ACTSTRIP_SELECT) {
strip->flag |= NLASTRIP_FLAG_SELECT;
- if (as->flag & ACTSTRIP_ACTIVE)
+ }
+ if (as->flag & ACTSTRIP_ACTIVE) {
strip->flag |= NLASTRIP_FLAG_ACTIVE;
+ }
- if (as->flag & ACTSTRIP_MUTE)
+ if (as->flag & ACTSTRIP_MUTE) {
strip->flag |= NLASTRIP_FLAG_MUTED;
- if (as->flag & ACTSTRIP_REVERSE)
+ }
+ if (as->flag & ACTSTRIP_REVERSE) {
strip->flag |= NLASTRIP_FLAG_REVERSE;
+ }
/* by default, we now always extrapolate, while in the past this was optional */
- if ((as->flag & ACTSTRIP_HOLDLASTFRAME) == 0)
+ if ((as->flag & ACTSTRIP_HOLDLASTFRAME) == 0) {
strip->extendmode = NLASTRIP_EXTEND_NOTHING;
+ }
}
/* try to add this strip to the current NLA-Track (i.e. the 'last' one on the stack atm) */
@@ -1811,8 +1886,9 @@ static void nlastrips_to_animdata(ID *id, ListBase *strips)
/* modifiers */
// FIXME: for now, we just free them...
- if (as->modifiers.first)
+ if (as->modifiers.first) {
BLI_freelistN(&as->modifiers);
+ }
/* free the old strip */
BLI_freelinkN(strips, as);
@@ -1848,8 +1924,9 @@ void do_versions_ipos_to_animato(Main *bmain)
CLOG_WARN(&LOG, "Animation data too new to convert (Version %d)", bmain->versionfile);
return;
}
- else if (G.debug & G_DEBUG)
+ else if (G.debug & G_DEBUG) {
printf("INFO: Converting to Animato...\n");
+ }
/* ----------- Animation Attached to Data -------------- */
@@ -1860,8 +1937,9 @@ void do_versions_ipos_to_animato(Main *bmain)
bConstraint *con;
bConstraintChannel *conchan, *conchann;
- if (G.debug & G_DEBUG)
+ if (G.debug & G_DEBUG) {
printf("\tconverting ob %s\n", id->name + 2);
+ }
/* check if object has any animation data */
if (ob->nlastrips.first) {
@@ -1976,8 +2054,9 @@ void do_versions_ipos_to_animato(Main *bmain)
/* object's action will always be object-rooted */
{
AnimData *adt = BKE_animdata_from_id(id);
- if (adt && adt->action)
+ if (adt && adt->action) {
adt->action->idroot = ID_OB;
+ }
}
}
@@ -1985,8 +2064,9 @@ void do_versions_ipos_to_animato(Main *bmain)
for (id = bmain->shapekeys.first; id; id = id->next) {
Key *key = (Key *)id;
- if (G.debug & G_DEBUG)
+ if (G.debug & G_DEBUG) {
printf("\tconverting key %s\n", id->name + 2);
+ }
/* we're only interested in the IPO
* NOTE: for later, it might be good to port these over to Object instead, as many of these
@@ -1999,8 +2079,9 @@ void do_versions_ipos_to_animato(Main *bmain)
/* Convert Shapekey data... */
ipo_to_animdata(bmain, id, key->ipo, NULL, NULL, NULL);
- if (adt->action)
+ if (adt->action) {
adt->action->idroot = key->ipo->blocktype;
+ }
id_us_min(&key->ipo->id);
key->ipo = NULL;
@@ -2011,8 +2092,9 @@ void do_versions_ipos_to_animato(Main *bmain)
for (id = bmain->materials.first; id; id = id->next) {
Material *ma = (Material *)id;
- if (G.debug & G_DEBUG)
+ if (G.debug & G_DEBUG) {
printf("\tconverting material %s\n", id->name + 2);
+ }
/* we're only interested in the IPO */
if (ma->ipo) {
@@ -2022,8 +2104,9 @@ void do_versions_ipos_to_animato(Main *bmain)
/* Convert Material data... */
ipo_to_animdata(bmain, id, ma->ipo, NULL, NULL, NULL);
- if (adt->action)
+ if (adt->action) {
adt->action->idroot = ma->ipo->blocktype;
+ }
id_us_min(&ma->ipo->id);
ma->ipo = NULL;
@@ -2034,8 +2117,9 @@ void do_versions_ipos_to_animato(Main *bmain)
for (id = bmain->worlds.first; id; id = id->next) {
World *wo = (World *)id;
- if (G.debug & G_DEBUG)
+ if (G.debug & G_DEBUG) {
printf("\tconverting world %s\n", id->name + 2);
+ }
/* we're only interested in the IPO */
if (wo->ipo) {
@@ -2045,8 +2129,9 @@ void do_versions_ipos_to_animato(Main *bmain)
/* Convert World data... */
ipo_to_animdata(bmain, id, wo->ipo, NULL, NULL, NULL);
- if (adt->action)
+ if (adt->action) {
adt->action->idroot = wo->ipo->blocktype;
+ }
id_us_min(&wo->ipo->id);
wo->ipo = NULL;
@@ -2066,8 +2151,9 @@ void do_versions_ipos_to_animato(Main *bmain)
IpoCurve *icu = (seq->ipo) ? seq->ipo->curve.first : NULL;
short adrcode = SEQ_FAC1;
- if (G.debug & G_DEBUG)
+ if (G.debug & G_DEBUG) {
printf("\tconverting sequence strip %s\n", seq->name + 2);
+ }
if (ELEM(NULL, seq->ipo, icu)) {
seq->flag |= SEQ_USE_EFFECT_DEFAULT_FADE;
@@ -2095,8 +2181,9 @@ void do_versions_ipos_to_animato(Main *bmain)
/* convert IPO */
ipo_to_animdata(bmain, (ID *)scene, seq->ipo, NULL, NULL, seq);
- if (adt->action)
+ if (adt->action) {
adt->action->idroot = ID_SCE; /* scene-rooted */
+ }
id_us_min(&seq->ipo->id);
seq->ipo = NULL;
@@ -2109,8 +2196,9 @@ void do_versions_ipos_to_animato(Main *bmain)
for (id = bmain->textures.first; id; id = id->next) {
Tex *te = (Tex *)id;
- if (G.debug & G_DEBUG)
+ if (G.debug & G_DEBUG) {
printf("\tconverting texture %s\n", id->name + 2);
+ }
/* we're only interested in the IPO */
if (te->ipo) {
@@ -2120,8 +2208,9 @@ void do_versions_ipos_to_animato(Main *bmain)
/* Convert Texture data... */
ipo_to_animdata(bmain, id, te->ipo, NULL, NULL, NULL);
- if (adt->action)
+ if (adt->action) {
adt->action->idroot = te->ipo->blocktype;
+ }
id_us_min(&te->ipo->id);
te->ipo = NULL;
@@ -2132,8 +2221,9 @@ void do_versions_ipos_to_animato(Main *bmain)
for (id = bmain->cameras.first; id; id = id->next) {
Camera *ca = (Camera *)id;
- if (G.debug & G_DEBUG)
+ if (G.debug & G_DEBUG) {
printf("\tconverting camera %s\n", id->name + 2);
+ }
/* we're only interested in the IPO */
if (ca->ipo) {
@@ -2143,8 +2233,9 @@ void do_versions_ipos_to_animato(Main *bmain)
/* Convert Camera data... */
ipo_to_animdata(bmain, id, ca->ipo, NULL, NULL, NULL);
- if (adt->action)
+ if (adt->action) {
adt->action->idroot = ca->ipo->blocktype;
+ }
id_us_min(&ca->ipo->id);
ca->ipo = NULL;
@@ -2155,8 +2246,9 @@ void do_versions_ipos_to_animato(Main *bmain)
for (id = bmain->lights.first; id; id = id->next) {
Light *la = (Light *)id;
- if (G.debug & G_DEBUG)
+ if (G.debug & G_DEBUG) {
printf("\tconverting light %s\n", id->name + 2);
+ }
/* we're only interested in the IPO */
if (la->ipo) {
@@ -2166,8 +2258,9 @@ void do_versions_ipos_to_animato(Main *bmain)
/* Convert Light data... */
ipo_to_animdata(bmain, id, la->ipo, NULL, NULL, NULL);
- if (adt->action)
+ if (adt->action) {
adt->action->idroot = la->ipo->blocktype;
+ }
id_us_min(&la->ipo->id);
la->ipo = NULL;
@@ -2178,8 +2271,9 @@ void do_versions_ipos_to_animato(Main *bmain)
for (id = bmain->curves.first; id; id = id->next) {
Curve *cu = (Curve *)id;
- if (G.debug & G_DEBUG)
+ if (G.debug & G_DEBUG) {
printf("\tconverting curve %s\n", id->name + 2);
+ }
/* we're only interested in the IPO */
if (cu->ipo) {
@@ -2189,8 +2283,9 @@ void do_versions_ipos_to_animato(Main *bmain)
/* Convert Curve data... */
ipo_to_animdata(bmain, id, cu->ipo, NULL, NULL, NULL);
- if (adt->action)
+ if (adt->action) {
adt->action->idroot = cu->ipo->blocktype;
+ }
id_us_min(&cu->ipo->id);
cu->ipo = NULL;
@@ -2212,12 +2307,14 @@ void do_versions_ipos_to_animato(Main *bmain)
for (id = bmain->actions.first; id; id = id->next) {
bAction *act = (bAction *)id;
- if (G.debug & G_DEBUG)
+ if (G.debug & G_DEBUG) {
printf("\tconverting action %s\n", id->name + 2);
+ }
/* if old action, it will be object-only... */
- if (act->chanbase.first)
+ if (act->chanbase.first) {
act->idroot = ID_OB;
+ }
/* be careful! some of the actions we encounter will be converted ones... */
action_to_animato(NULL, act, &act->groups, &act->curves, &drivers);
@@ -2227,8 +2324,9 @@ void do_versions_ipos_to_animato(Main *bmain)
for (id = bmain->ipo.first; id; id = id->next) {
Ipo *ipo = (Ipo *)id;
- if (G.debug & G_DEBUG)
+ if (G.debug & G_DEBUG) {
printf("\tconverting ipo %s\n", id->name + 2);
+ }
/* most likely this IPO has already been processed, so check if any curves left to convert */
if (ipo->curve.first) {
@@ -2248,6 +2346,7 @@ void do_versions_ipos_to_animato(Main *bmain)
/* free unused drivers from actions + ipos */
free_fcurves(&drivers);
- if (G.debug & G_DEBUG)
+ if (G.debug & G_DEBUG) {
printf("INFO: Animato convert done\n");
+ }
}