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:
authorCampbell Barton <ideasman42@gmail.com>2012-05-12 20:11:34 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-05-12 20:11:34 +0400
commit53ee7908d6c5a8bbdbec5202196d6dae86972e4c (patch)
treeb32976091f325b3a08ff92851b54f49ac3b6021b /source/blender/blenkernel/intern/nla.c
parentbddc7dfc20919105e02181340d54b2faf52c95ac (diff)
style cleanup: whitespace
Diffstat (limited to 'source/blender/blenkernel/intern/nla.c')
-rw-r--r--source/blender/blenkernel/intern/nla.c348
1 files changed, 174 insertions, 174 deletions
diff --git a/source/blender/blenkernel/intern/nla.c b/source/blender/blenkernel/intern/nla.c
index 96c62a32139..02d44badc65 100644
--- a/source/blender/blenkernel/intern/nla.c
+++ b/source/blender/blenkernel/intern/nla.c
@@ -82,8 +82,8 @@ void free_nlastrip(ListBase *strips, NlaStrip *strip)
return;
/* free child-strips */
- for (cs= strip->strips.first; cs; cs= csn) {
- csn= cs->next;
+ for (cs = strip->strips.first; cs; cs = csn) {
+ csn = cs->next;
free_nlastrip(&strip->strips, cs);
}
@@ -120,8 +120,8 @@ void free_nlatrack(ListBase *tracks, NlaTrack *nlt)
return;
/* free strips */
- for (strip= nlt->strips.first; strip; strip= stripn) {
- stripn= strip->next;
+ for (strip = nlt->strips.first; strip; strip = stripn) {
+ stripn = strip->next;
free_nlastrip(&nlt->strips, strip);
}
@@ -144,19 +144,19 @@ void free_nladata(ListBase *tracks)
return;
/* free tracks one by one */
- for (nlt= tracks->first; nlt; nlt= nltn) {
- nltn= nlt->next;
+ for (nlt = tracks->first; nlt; nlt = nltn) {
+ nltn = nlt->next;
free_nlatrack(tracks, nlt);
}
/* clear the list's pointers to be safe */
- tracks->first= tracks->last= NULL;
+ tracks->first = tracks->last = NULL;
}
/* Copying ------------------------------------------- */
/* Copy NLA strip */
-NlaStrip *copy_nlastrip (NlaStrip *strip)
+NlaStrip *copy_nlastrip(NlaStrip *strip)
{
NlaStrip *strip_d;
NlaStrip *cs, *cs_d;
@@ -166,8 +166,8 @@ NlaStrip *copy_nlastrip (NlaStrip *strip)
return NULL;
/* make a copy */
- strip_d= MEM_dupallocN(strip);
- strip_d->next= strip_d->prev= NULL;
+ strip_d = MEM_dupallocN(strip);
+ strip_d->next = strip_d->prev = NULL;
/* increase user-count of action */
if (strip_d->act)
@@ -178,10 +178,10 @@ NlaStrip *copy_nlastrip (NlaStrip *strip)
copy_fmodifiers(&strip_d->modifiers, &strip->modifiers);
/* make a copy of all the child-strips, one at a time */
- strip_d->strips.first= strip_d->strips.last= NULL;
+ strip_d->strips.first = strip_d->strips.last = NULL;
- for (cs= strip->strips.first; cs; cs= cs->next) {
- cs_d= copy_nlastrip(cs);
+ for (cs = strip->strips.first; cs; cs = cs->next) {
+ cs_d = copy_nlastrip(cs);
BLI_addtail(&strip_d->strips, cs_d);
}
@@ -190,7 +190,7 @@ NlaStrip *copy_nlastrip (NlaStrip *strip)
}
/* Copy NLA Track */
-NlaTrack *copy_nlatrack (NlaTrack *nlt)
+NlaTrack *copy_nlatrack(NlaTrack *nlt)
{
NlaStrip *strip, *strip_d;
NlaTrack *nlt_d;
@@ -200,14 +200,14 @@ NlaTrack *copy_nlatrack (NlaTrack *nlt)
return NULL;
/* make a copy */
- nlt_d= MEM_dupallocN(nlt);
- nlt_d->next= nlt_d->prev= NULL;
+ nlt_d = MEM_dupallocN(nlt);
+ nlt_d->next = nlt_d->prev = NULL;
/* make a copy of all the strips, one at a time */
- nlt_d->strips.first= nlt_d->strips.last= NULL;
+ nlt_d->strips.first = nlt_d->strips.last = NULL;
- for (strip= nlt->strips.first; strip; strip= strip->next) {
- strip_d= copy_nlastrip(strip);
+ for (strip = nlt->strips.first; strip; strip = strip->next) {
+ strip_d = copy_nlastrip(strip);
BLI_addtail(&nlt_d->strips, strip_d);
}
@@ -225,12 +225,12 @@ void copy_nladata(ListBase *dst, ListBase *src)
return;
/* clear out the destination list first for precautions... */
- dst->first= dst->last= NULL;
+ dst->first = dst->last = NULL;
/* copy each NLA-track, one at a time */
- for (nlt= src->first; nlt; nlt= nlt->next) {
+ for (nlt = src->first; nlt; nlt = nlt->next) {
/* make a copy, and add the copy to the destination list */
- nlt_d= copy_nlatrack(nlt);
+ nlt_d = copy_nlatrack(nlt);
BLI_addtail(dst, nlt_d);
}
}
@@ -240,7 +240,7 @@ void copy_nladata(ListBase *dst, ListBase *src)
/* Add a NLA Track to the given AnimData
* - prev: NLA-Track to add the new one after
*/
-NlaTrack *add_nlatrack (AnimData *adt, NlaTrack *prev)
+NlaTrack *add_nlatrack(AnimData *adt, NlaTrack *prev)
{
NlaTrack *nlt;
@@ -249,11 +249,11 @@ NlaTrack *add_nlatrack (AnimData *adt, NlaTrack *prev)
return NULL;
/* allocate new track */
- nlt= MEM_callocN(sizeof(NlaTrack), "NlaTrack");
+ nlt = MEM_callocN(sizeof(NlaTrack), "NlaTrack");
/* set settings requiring the track to not be part of the stack yet */
nlt->flag = NLATRACK_SELECTED;
- nlt->index= BLI_countlist(&adt->nla_tracks);
+ nlt->index = BLI_countlist(&adt->nla_tracks);
/* add track to stack, and make it the active one */
if (prev)
@@ -271,7 +271,7 @@ NlaTrack *add_nlatrack (AnimData *adt, NlaTrack *prev)
}
/* Add a NLA Strip referencing the given Action */
-NlaStrip *add_nlastrip (bAction *act)
+NlaStrip *add_nlastrip(bAction *act)
{
NlaStrip *strip;
@@ -280,7 +280,7 @@ NlaStrip *add_nlastrip (bAction *act)
return NULL;
/* allocate new strip */
- strip= MEM_callocN(sizeof(NlaStrip), "NlaStrip");
+ strip = MEM_callocN(sizeof(NlaStrip), "NlaStrip");
/* generic settings
* - selected flag to highlight this to the user
@@ -290,10 +290,10 @@ NlaStrip *add_nlastrip (bAction *act)
* is not done though, since this should only really happens in editmode for strips now
* though this decision is still subject to further review...
*/
- strip->flag = NLASTRIP_FLAG_SELECT|NLASTRIP_FLAG_AUTO_BLENDS;
+ strip->flag = NLASTRIP_FLAG_SELECT | NLASTRIP_FLAG_AUTO_BLENDS;
/* assign the action reference */
- strip->act= act;
+ strip->act = act;
id_us_plus(&act->id);
/* determine initial range
@@ -302,10 +302,10 @@ NlaStrip *add_nlastrip (bAction *act)
calc_action_range(strip->act, &strip->actstart, &strip->actend, 0);
strip->start = strip->actstart;
- strip->end = (IS_EQF(strip->actstart, strip->actend)) ? (strip->actstart + 1.0f): (strip->actend);
+ strip->end = (IS_EQF(strip->actstart, strip->actend)) ? (strip->actstart + 1.0f) : (strip->actend);
/* strip should be referenced as-is */
- strip->scale= 1.0f;
+ strip->scale = 1.0f;
strip->repeat = 1.0f;
/* return the new strip */
@@ -313,7 +313,7 @@ NlaStrip *add_nlastrip (bAction *act)
}
/* Add new NLA-strip to the top of the NLA stack - i.e. into the last track if space, or a new one otherwise */
-NlaStrip *add_nlastrip_to_stack (AnimData *adt, bAction *act)
+NlaStrip *add_nlastrip_to_stack(AnimData *adt, bAction *act)
{
NlaStrip *strip;
NlaTrack *nlt;
@@ -323,7 +323,7 @@ NlaStrip *add_nlastrip_to_stack (AnimData *adt, bAction *act)
return NULL;
/* create a new NLA strip */
- strip= add_nlastrip(act);
+ strip = add_nlastrip(act);
if (strip == NULL)
return NULL;
@@ -332,7 +332,7 @@ NlaStrip *add_nlastrip_to_stack (AnimData *adt, bAction *act)
/* trying to add to the last track failed (no track or no space),
* so add a new track to the stack, and add to that...
*/
- nlt= add_nlatrack(adt, NULL);
+ nlt = add_nlatrack(adt, NULL);
BKE_nlatrack_add_strip(nlt, strip);
}
@@ -344,7 +344,7 @@ NlaStrip *add_nlastrip_to_stack (AnimData *adt, bAction *act)
}
/* Add a NLA Strip referencing the given speaker's sound */
-NlaStrip *add_nla_soundstrip (Scene *scene, Speaker *speaker)
+NlaStrip *add_nla_soundstrip(Scene *scene, Speaker *speaker)
{
NlaStrip *strip = MEM_callocN(sizeof(NlaStrip), "NlaSoundStrip");
@@ -388,7 +388,7 @@ NlaStrip *add_nla_soundstrip (Scene *scene, Speaker *speaker)
/* non clipped mapping for strip-time <-> global time (for Action-Clips)
* invert = convert action-strip time to global time
*/
-static float nlastrip_get_frame_actionclip (NlaStrip *strip, float cframe, short mode)
+static float nlastrip_get_frame_actionclip(NlaStrip *strip, float cframe, short mode)
{
float actlength, scale;
// float repeat; // UNUSED
@@ -398,7 +398,7 @@ static float nlastrip_get_frame_actionclip (NlaStrip *strip, float cframe, short
// repeat = strip->repeat; // UNUSED
/* scaling */
- if (IS_EQF(strip->scale, 0.0f)) strip->scale= 1.0f;
+ if (IS_EQF(strip->scale, 0.0f)) strip->scale = 1.0f;
scale = fabsf(strip->scale); /* scale must be positive - we've got a special flag for reversing */
/* length of referenced action */
@@ -409,12 +409,12 @@ static float nlastrip_get_frame_actionclip (NlaStrip *strip, float cframe, short
if (strip->flag & NLASTRIP_FLAG_REVERSE) {
// FIXME: this won't work right with Graph Editor?
if (mode == NLATIME_CONVERT_MAP) {
- return strip->end - scale*(cframe - strip->actstart);
+ return strip->end - scale * (cframe - strip->actstart);
}
else if (mode == NLATIME_CONVERT_UNMAP) {
return (strip->end + (strip->actstart * scale - cframe)) / scale;
}
- else /* if (mode == NLATIME_CONVERT_EVAL) */{
+ else { /* if (mode == NLATIME_CONVERT_EVAL) */
if (IS_EQF(cframe, strip->end) && IS_EQF(strip->repeat, ((int)strip->repeat))) {
/* this case prevents the motion snapping back to the first frame at the end of the strip
* by catching the case where repeats is a whole number, which means that the end of the strip
@@ -426,18 +426,18 @@ static float nlastrip_get_frame_actionclip (NlaStrip *strip, float cframe, short
/* - the 'fmod(..., actlength*scale)' is needed to get the repeats working
* - the '/ scale' is needed to ensure that scaling influences the timing within the repeat
*/
- return strip->actend - fmodf(cframe - strip->start, actlength*scale) / scale;
+ return strip->actend - fmodf(cframe - strip->start, actlength * scale) / scale;
}
}
}
else {
if (mode == NLATIME_CONVERT_MAP) {
- return strip->start + scale*(cframe - strip->actstart);
+ return strip->start + scale * (cframe - strip->actstart);
}
else if (mode == NLATIME_CONVERT_UNMAP) {
return strip->actstart + (cframe - strip->start) / scale;
}
- else /* if (mode == NLATIME_CONVERT_EVAL) */{
+ else { /* if (mode == NLATIME_CONVERT_EVAL) */
if (IS_EQF(cframe, strip->end) && IS_EQF(strip->repeat, ((int)strip->repeat))) {
/* this case prevents the motion snapping back to the first frame at the end of the strip
* by catching the case where repeats is a whole number, which means that the end of the strip
@@ -449,7 +449,7 @@ static float nlastrip_get_frame_actionclip (NlaStrip *strip, float cframe, short
/* - the 'fmod(..., actlength*scale)' is needed to get the repeats working
* - the '/ scale' is needed to ensure that scaling influences the timing within the repeat
*/
- return strip->actstart + fmodf(cframe - strip->start, actlength*scale) / scale;
+ return strip->actstart + fmodf(cframe - strip->start, actlength * scale) / scale;
}
}
}
@@ -458,12 +458,12 @@ static float nlastrip_get_frame_actionclip (NlaStrip *strip, float cframe, short
/* non clipped mapping for strip-time <-> global time (for Transitions)
* invert = convert action-strip time to global time
*/
-static float nlastrip_get_frame_transition (NlaStrip *strip, float cframe, short mode)
+static float nlastrip_get_frame_transition(NlaStrip *strip, float cframe, short mode)
{
float length;
/* length of strip */
- length= strip->end - strip->start;
+ length = strip->end - strip->start;
/* reversed = play strip backwards */
if (strip->flag & NLASTRIP_FLAG_REVERSE) {
@@ -481,7 +481,7 @@ static float nlastrip_get_frame_transition (NlaStrip *strip, float cframe, short
}
/* non clipped mapping for strip-time <-> global time
- * mode = eNlaTime_ConvertModes[] -> NLATIME_CONVERT_*
+ * mode = eNlaTime_ConvertModes[] -> NLATIME_CONVERT_*
*
* only secure for 'internal' (i.e. within AnimSys evaluation) operations,
* but should not be directly relied on for stuff which interacts with editors
@@ -515,17 +515,17 @@ float BKE_nla_tweakedit_remap(AnimData *adt, float cframe, short mode)
* - when not in tweakmode, the active Action does not have any scaling applied :)
* - when in tweakmode, if the no-mapping flag is set, do not map
*/
- if ((adt == NULL) || (adt->flag & ADT_NLA_EDIT_ON)==0 || (adt->flag & ADT_NLA_EDIT_NOMAP))
+ if ((adt == NULL) || (adt->flag & ADT_NLA_EDIT_ON) == 0 || (adt->flag & ADT_NLA_EDIT_NOMAP))
return cframe;
/* if the active-strip info has been stored already, access this, otherwise look this up
* and store for (very probable) future usage
*/
if (adt->actstrip == NULL) {
- NlaTrack *nlt= BKE_nlatrack_find_active(&adt->nla_tracks);
- adt->actstrip= BKE_nlastrip_find_active(nlt);
+ NlaTrack *nlt = BKE_nlatrack_find_active(&adt->nla_tracks);
+ adt->actstrip = BKE_nlastrip_find_active(nlt);
}
- strip= adt->actstrip;
+ strip = adt->actstrip;
/* sanity checks
* - in rare cases, we may not be able to find this strip for some reason (internal error)
@@ -559,7 +559,7 @@ short BKE_nlastrips_has_space(ListBase *strips, float start, float end)
}
/* loop over NLA strips checking for any overlaps with this area... */
- for (strip= strips->first; strip; strip= strip->next) {
+ for (strip = strips->first; strip; strip = strip->next) {
/* if start frame of strip is past the target end-frame, that means that
* we've gone past the window we need to check for, so things are fine
*/
@@ -592,21 +592,21 @@ void BKE_nlastrips_sort_strips(ListBase *strips)
/* we simply perform insertion sort on this list, since it is assumed that per track,
* there are only likely to be at most 5-10 strips
*/
- for (strip= strips->first; strip; strip= stripn) {
+ for (strip = strips->first; strip; strip = stripn) {
short not_added = 1;
- stripn= strip->next;
+ stripn = strip->next;
/* remove this strip from the list, and add it to the new list, searching from the end of
* the list, assuming that the lists are in order
*/
BLI_remlink(strips, strip);
- for (sstrip= tmp.last; sstrip; sstrip= sstrip->prev) {
+ for (sstrip = tmp.last; sstrip; sstrip = sstrip->prev) {
/* check if add after */
if (sstrip->end <= strip->start) {
BLI_insertlinkafter(&tmp, sstrip, strip);
- not_added= 0;
+ not_added = 0;
break;
}
}
@@ -617,8 +617,8 @@ void BKE_nlastrips_sort_strips(ListBase *strips)
}
/* reassign the start and end points of the strips */
- strips->first= tmp.first;
- strips->last= tmp.last;
+ strips->first = tmp.first;
+ strips->last = tmp.last;
}
/* Add the given NLA-Strip to the given list of strips, assuming that it
@@ -634,15 +634,15 @@ short BKE_nlastrips_add_strip(ListBase *strips, NlaStrip *strip)
return 0;
/* check if any space to add */
- if (BKE_nlastrips_has_space(strips, strip->start, strip->end)==0)
+ if (BKE_nlastrips_has_space(strips, strip->start, strip->end) == 0)
return 0;
/* find the right place to add the strip to the nominated track */
- for (ns= strips->first; ns; ns= ns->next) {
+ for (ns = strips->first; ns; ns = ns->next) {
/* if current strip occurs after the new strip, add it before */
if (ns->start >= strip->end) {
BLI_insertlinkbefore(strips, ns, strip);
- not_added= 0;
+ not_added = 0;
break;
}
}
@@ -672,14 +672,14 @@ void BKE_nlastrips_make_metas(ListBase *strips, short temp)
return;
/* group all continuous chains of selected strips into meta-strips */
- for (strip= strips->first; strip; strip= stripn) {
- stripn= strip->next;
+ for (strip = strips->first; strip; strip = stripn) {
+ stripn = strip->next;
if (strip->flag & NLASTRIP_FLAG_SELECT) {
/* if there is an existing meta-strip, add this strip to it, otherwise, create a new one */
if (mstrip == NULL) {
/* add a new meta-strip, and add it before the current strip that it will replace... */
- mstrip= MEM_callocN(sizeof(NlaStrip), "Meta-NlaStrip");
+ mstrip = MEM_callocN(sizeof(NlaStrip), "Meta-NlaStrip");
mstrip->type = NLASTRIP_TYPE_META;
BLI_insertlinkbefore(strips, strip, mstrip);
@@ -691,10 +691,10 @@ void BKE_nlastrips_make_metas(ListBase *strips, short temp)
mstrip->flag |= NLASTRIP_FLAG_TEMP_META;
/* set default repeat/scale values to prevent warnings */
- mstrip->repeat= mstrip->scale= 1.0f;
+ mstrip->repeat = mstrip->scale = 1.0f;
/* make its start frame be set to the start frame of the current strip */
- mstrip->start= strip->start;
+ mstrip->start = strip->start;
}
/* remove the selected strips from the track, and add to the meta */
@@ -702,13 +702,13 @@ void BKE_nlastrips_make_metas(ListBase *strips, short temp)
BLI_addtail(&mstrip->strips, strip);
/* expand the meta's dimensions to include the newly added strip- i.e. its last frame */
- mstrip->end= strip->end;
+ mstrip->end = strip->end;
}
else {
/* current strip wasn't selected, so the end of 'island' of selected strips has been reached,
* so stop adding strips to the current meta
*/
- mstrip= NULL;
+ mstrip = NULL;
}
}
}
@@ -725,8 +725,8 @@ void BKE_nlastrips_clear_metastrip(ListBase *strips, NlaStrip *strip)
/* move each one of the meta-strip's children before the meta-strip
* in the list of strips after unlinking them from the meta-strip
*/
- for (cs= strip->strips.first; cs; cs= csn) {
- csn= cs->next;
+ for (cs = strip->strips.first; cs; cs = csn) {
+ csn = cs->next;
BLI_remlink(&strip->strips, cs);
BLI_insertlinkbefore(strips, strip, cs);
}
@@ -748,13 +748,13 @@ void BKE_nlastrips_clear_metas(ListBase *strips, short onlySel, short onlyTemp)
return;
/* remove meta-strips fitting the criteria of the arguments */
- for (strip= strips->first; strip; strip= stripn) {
- stripn= strip->next;
+ for (strip = strips->first; strip; strip = stripn) {
+ stripn = strip->next;
/* check if strip is a meta-strip */
if (strip->type == NLASTRIP_TYPE_META) {
/* if check if selection and 'temporary-only' considerations are met */
- if ((onlySel==0) || (strip->flag & NLASTRIP_FLAG_SELECT)) {
+ if ((onlySel == 0) || (strip->flag & NLASTRIP_FLAG_SELECT)) {
if ((!onlyTemp) || (strip->flag & NLASTRIP_FLAG_TEMP_META)) {
BKE_nlastrips_clear_metastrip(strips, strip);
}
@@ -786,7 +786,7 @@ short BKE_nlameta_add_strip(NlaStrip *mstrip, NlaStrip *strip)
if ((mstrip->prev == NULL) || (mstrip->prev->end <= strip->start)) {
/* add strip to start of meta's list, and expand dimensions */
BLI_addhead(&mstrip->strips, strip);
- mstrip->start= strip->start;
+ mstrip->start = strip->start;
return 1;
}
@@ -800,7 +800,7 @@ short BKE_nlameta_add_strip(NlaStrip *mstrip, NlaStrip *strip)
if ((mstrip->next == NULL) || (mstrip->next->start >= strip->end)) {
/* add strip to end of meta's list, and expand dimensions */
BLI_addtail(&mstrip->strips, strip);
- mstrip->end= strip->end;
+ mstrip->end = strip->end;
return 1;
}
@@ -821,7 +821,7 @@ void BKE_nlameta_flush_transforms(NlaStrip *mstrip)
NlaStrip *strip;
float oStart, oEnd, offset;
float oLen, nLen;
- short scaleChanged= 0;
+ short scaleChanged = 0;
/* sanity checks
* - strip must exist
@@ -836,9 +836,9 @@ void BKE_nlameta_flush_transforms(NlaStrip *mstrip)
* - these are simply the start/end frames of the child strips,
* since we assume they weren't transformed yet
*/
- oStart= ((NlaStrip *)mstrip->strips.first)->start;
- oEnd= ((NlaStrip *)mstrip->strips.last)->end;
- offset= mstrip->start - oStart;
+ oStart = ((NlaStrip *)mstrip->strips.first)->start;
+ oEnd = ((NlaStrip *)mstrip->strips.last)->end;
+ offset = mstrip->start - oStart;
/* optimization:
* don't flush if nothing changed yet
@@ -851,20 +851,20 @@ void BKE_nlameta_flush_transforms(NlaStrip *mstrip)
oLen = oEnd - oStart;
nLen = mstrip->end - mstrip->start;
if (IS_EQF(nLen, oLen) == 0)
- scaleChanged= 1;
+ scaleChanged = 1;
/* for each child-strip, calculate new start/end points based on this new info */
- for (strip= mstrip->strips.first; strip; strip= strip->next) {
+ for (strip = mstrip->strips.first; strip; strip = strip->next) {
if (scaleChanged) {
float p1, p2;
/* compute positions of endpoints relative to old extents of strip */
- p1= (strip->start - oStart) / oLen;
- p2= (strip->end - oStart) / oLen;
+ p1 = (strip->start - oStart) / oLen;
+ p2 = (strip->end - oStart) / oLen;
/* apply new strip endpoints using the proportions, then wait for second pass to flush scale properly */
- strip->start= (p1 * nLen) + mstrip->start;
- strip->end= (p2 * nLen) + mstrip->start;
+ strip->start = (p1 * nLen) + mstrip->start;
+ strip->end = (p2 * nLen) + mstrip->start;
}
else {
/* just apply the changes in offset to both ends of the strip */
@@ -874,7 +874,7 @@ void BKE_nlameta_flush_transforms(NlaStrip *mstrip)
}
/* apply a second pass over child strips, to finish up unfinished business */
- for (strip= mstrip->strips.first; strip; strip= strip->next) {
+ for (strip = mstrip->strips.first; strip; strip = strip->next) {
/* only if scale changed, need to perform RNA updates */
if (scaleChanged) {
PointerRNA ptr;
@@ -894,7 +894,7 @@ void BKE_nlameta_flush_transforms(NlaStrip *mstrip)
/* NLA-Tracks ---------------------------------------- */
/* Find the active NLA-track for the given stack */
-NlaTrack *BKE_nlatrack_find_active (ListBase *tracks)
+NlaTrack *BKE_nlatrack_find_active(ListBase *tracks)
{
NlaTrack *nlt;
@@ -903,7 +903,7 @@ NlaTrack *BKE_nlatrack_find_active (ListBase *tracks)
return NULL;
/* try to find the first active track */
- for (nlt= tracks->first; nlt; nlt= nlt->next) {
+ for (nlt = tracks->first; nlt; nlt = nlt->next) {
if (nlt->flag & NLATRACK_ACTIVE)
return nlt;
}
@@ -924,7 +924,7 @@ void BKE_nlatrack_solo_toggle(AnimData *adt, NlaTrack *nlt)
return;
/* firstly, make sure 'solo' flag for all tracks is disabled */
- for (nt= adt->nla_tracks.first; nt; nt= nt->next) {
+ for (nt = adt->nla_tracks.first; nt; nt = nt->next) {
if (nt != nlt)
nt->flag &= ~NLATRACK_SOLO;
}
@@ -956,7 +956,7 @@ void BKE_nlatrack_set_active(ListBase *tracks, NlaTrack *nlt_a)
return;
/* deactive all the rest */
- for (nlt= tracks->first; nlt; nlt= nlt->next)
+ for (nlt = tracks->first; nlt; nlt = nlt->next)
nlt->flag &= ~NLATRACK_ACTIVE;
/* set the given one as the active one */
@@ -968,9 +968,9 @@ void BKE_nlatrack_set_active(ListBase *tracks, NlaTrack *nlt_a)
short BKE_nlatrack_has_space(NlaTrack *nlt, float start, float end)
{
/* sanity checks
- * - track must exist
- * - track must be editable
- * - bounds cannot be equal (0-length is nasty)
+ * - track must exist
+ * - track must be editable
+ * - bounds cannot be equal (0-length is nasty)
*/
if ((nlt == NULL) || (nlt->flag & NLATRACK_PROTECTED) || IS_EQF(start, end))
return 0;
@@ -1042,7 +1042,7 @@ short BKE_nlatrack_get_bounds(NlaTrack *nlt, float bounds[2])
/* NLA Strips -------------------------------------- */
/* Find the active NLA-strip within the given track */
-NlaStrip *BKE_nlastrip_find_active (NlaTrack *nlt)
+NlaStrip *BKE_nlastrip_find_active(NlaTrack *nlt)
{
NlaStrip *strip;
@@ -1051,7 +1051,7 @@ NlaStrip *BKE_nlastrip_find_active (NlaTrack *nlt)
return NULL;
/* try to find the first active strip */
- for (strip= nlt->strips.first; strip; strip= strip->next) {
+ for (strip = nlt->strips.first; strip; strip = strip->next) {
if (strip->flag & NLASTRIP_FLAG_ACTIVE)
return strip;
}
@@ -1071,8 +1071,8 @@ void BKE_nlastrip_set_active(AnimData *adt, NlaStrip *strip)
return;
/* loop over tracks, deactivating*/
- for (nlt= adt->nla_tracks.first; nlt; nlt= nlt->next) {
- for (nls= nlt->strips.first; nls; nls= nls->next) {
+ for (nlt = adt->nla_tracks.first; nlt; nlt = nlt->next) {
+ for (nls = nlt->strips.first; nls; nls = nls->next) {
if (nls != strip)
nls->flag &= ~NLASTRIP_FLAG_ACTIVE;
else
@@ -1085,8 +1085,8 @@ void BKE_nlastrip_set_active(AnimData *adt, NlaStrip *strip)
/* Does the given NLA-strip fall within the given bounds (times)? */
short BKE_nlastrip_within_bounds(NlaStrip *strip, float min, float max)
{
- const float stripLen= (strip) ? strip->end - strip->start : 0.0f;
- const float boundsLen= fabsf(max - min);
+ const float stripLen = (strip) ? strip->end - strip->start : 0.0f;
+ const float boundsLen = fabsf(max - min);
/* sanity checks */
if ((strip == NULL) || IS_EQF(stripLen, 0.0f) || IS_EQF(boundsLen, 0.0f))
@@ -1128,10 +1128,10 @@ void BKE_nlastrip_recalculate_bounds(NlaStrip *strip)
return;
/* calculate new length factors */
- actlen= strip->actend - strip->actstart;
- if (IS_EQF(actlen, 0.0f)) actlen= 1.0f;
+ actlen = strip->actend - strip->actstart;
+ if (IS_EQF(actlen, 0.0f)) actlen = 1.0f;
- mapping= strip->scale * strip->repeat;
+ mapping = strip->scale * strip->repeat;
/* adjust endpoint of strip in response to this */
if (IS_EQF(mapping, 0.0f) == 0)
@@ -1140,7 +1140,7 @@ void BKE_nlastrip_recalculate_bounds(NlaStrip *strip)
/* Is the given NLA-strip the first one to occur for the given AnimData block */
// TODO: make this an api method if necesary, but need to add prefix first
-static short nlastrip_is_first (AnimData *adt, NlaStrip *strip)
+static short nlastrip_is_first(AnimData *adt, NlaStrip *strip)
{
NlaTrack *nlt;
NlaStrip *ns;
@@ -1155,9 +1155,9 @@ static short nlastrip_is_first (AnimData *adt, NlaStrip *strip)
/* check other tracks to see if they have a strip that's earlier */
// TODO: or should we check that the strip's track is also the first?
- for (nlt= adt->nla_tracks.first; nlt; nlt= nlt->next) {
+ for (nlt = adt->nla_tracks.first; nlt; nlt = nlt->next) {
/* only check the first strip, assuming that they're all in order */
- ns= nlt->strips.first;
+ ns = nlt->strips.first;
if (ns) {
if (ns->start < strip->start)
return 0;
@@ -1180,7 +1180,7 @@ short BKE_nlatrack_has_animated_strips(NlaTrack *nlt)
return 0;
/* check each strip for F-Curves only (don't care about whether the flags are set) */
- for (strip= nlt->strips.first; strip; strip= strip->next) {
+ for (strip = nlt->strips.first; strip; strip = strip->next) {
if (strip->fcurves.first)
return 1;
}
@@ -1199,7 +1199,7 @@ short BKE_nlatracks_have_animated_strips(ListBase *tracks)
return 0;
/* check each track, stopping on the first hit */
- for (nlt= tracks->first; nlt; nlt= nlt->next) {
+ for (nlt = tracks->first; nlt; nlt = nlt->next) {
if (BKE_nlatrack_has_animated_strips(nlt))
return 1;
}
@@ -1220,19 +1220,19 @@ void BKE_nlastrip_validate_fcurves(NlaStrip *strip)
/* if controlling influence... */
if (strip->flag & NLASTRIP_FLAG_USR_INFLUENCE) {
/* try to get F-Curve */
- fcu= list_find_fcurve(&strip->fcurves, "influence", 0);
+ fcu = list_find_fcurve(&strip->fcurves, "influence", 0);
/* add one if not found */
if (fcu == NULL) {
/* make new F-Curve */
- fcu= MEM_callocN(sizeof(FCurve), "NlaStrip FCurve");
+ fcu = MEM_callocN(sizeof(FCurve), "NlaStrip FCurve");
BLI_addtail(&strip->fcurves, fcu);
/* set default flags */
- fcu->flag = (FCURVE_VISIBLE|FCURVE_SELECTED);
+ fcu->flag = (FCURVE_VISIBLE | FCURVE_SELECTED);
/* store path - make copy, and store that */
- fcu->rna_path= BLI_strdupn("influence", 9);
+ fcu->rna_path = BLI_strdupn("influence", 9);
// TODO: insert a few keyframes to ensure default behavior?
}
@@ -1241,19 +1241,19 @@ void BKE_nlastrip_validate_fcurves(NlaStrip *strip)
/* if controlling time... */
if (strip->flag & NLASTRIP_FLAG_USR_TIME) {
/* try to get F-Curve */
- fcu= list_find_fcurve(&strip->fcurves, "strip_time", 0);
+ fcu = list_find_fcurve(&strip->fcurves, "strip_time", 0);
/* add one if not found */
if (fcu == NULL) {
/* make new F-Curve */
- fcu= MEM_callocN(sizeof(FCurve), "NlaStrip FCurve");
+ fcu = MEM_callocN(sizeof(FCurve), "NlaStrip FCurve");
BLI_addtail(&strip->fcurves, fcu);
/* set default flags */
- fcu->flag = (FCURVE_VISIBLE|FCURVE_SELECTED);
+ fcu->flag = (FCURVE_VISIBLE | FCURVE_SELECTED);
/* store path - make copy, and store that */
- fcu->rna_path= BLI_strdupn("strip_time", 10);
+ fcu->rna_path = BLI_strdupn("strip_time", 10);
// TODO: insert a few keyframes to ensure default behavior?
}
@@ -1283,10 +1283,10 @@ void BKE_nlastrip_validate_name(AnimData *adt, NlaStrip *strip)
return;
/* give strip a default name if none already */
- if (strip->name[0]==0) {
+ if (strip->name[0] == 0) {
switch (strip->type) {
case NLASTRIP_TYPE_CLIP: /* act-clip */
- BLI_strncpy(strip->name, (strip->act)?(strip->act->id.name+2):("<No Action>"), sizeof(strip->name));
+ BLI_strncpy(strip->name, (strip->act) ? (strip->act->id.name + 2) : ("<No Action>"), sizeof(strip->name));
break;
case NLASTRIP_TYPE_TRANSITION: /* transition */
BLI_strncpy(strip->name, "Transition", sizeof(strip->name));
@@ -1304,10 +1304,10 @@ void BKE_nlastrip_validate_name(AnimData *adt, NlaStrip *strip)
* - this is easier than iterating over all the tracks+strips hierarchy everytime
* (and probably faster)
*/
- gh= BLI_ghash_new(BLI_ghashutil_strhash, BLI_ghashutil_strcmp, "nlastrip_validate_name gh");
+ gh = BLI_ghash_new(BLI_ghashutil_strhash, BLI_ghashutil_strcmp, "nlastrip_validate_name gh");
- for (nlt= adt->nla_tracks.first; nlt; nlt= nlt->next) {
- for (tstrip= nlt->strips.first; tstrip; tstrip= tstrip->next) {
+ for (nlt = adt->nla_tracks.first; nlt; nlt = nlt->next) {
+ for (tstrip = nlt->strips.first; tstrip; tstrip = tstrip->next) {
/* don't add the strip of interest */
if (tstrip == strip)
continue;
@@ -1333,7 +1333,7 @@ void BKE_nlastrip_validate_name(AnimData *adt, NlaStrip *strip)
* - track: nla-track that the overlapping strips should be found from
* - start, end: frames for the offending endpoints
*/
-static void nlastrip_get_endpoint_overlaps (NlaStrip *strip, NlaTrack *track, float **start, float **end)
+static void nlastrip_get_endpoint_overlaps(NlaStrip *strip, NlaTrack *track, float **start, float **end)
{
NlaStrip *nls;
@@ -1341,46 +1341,46 @@ static void nlastrip_get_endpoint_overlaps (NlaStrip *strip, NlaTrack *track, fl
* but which don't cover the entire length
*/
// TODO: this scheme could get quite slow for doing this on many strips...
- for (nls= track->strips.first; nls; nls= nls->next) {
+ for (nls = track->strips.first; nls; nls = nls->next) {
/* check if strip overlaps (extends over or exactly on) the entire range of the strip we're validating */
if ((nls->start <= strip->start) && (nls->end >= strip->end)) {
- *start= NULL;
- *end= NULL;
+ *start = NULL;
+ *end = NULL;
return;
}
/* check if strip doesn't even occur anywhere near... */
if (nls->end < strip->start)
- continue; /* skip checking this strip... not worthy of mention */
+ continue; /* skip checking this strip... not worthy of mention */
if (nls->start > strip->end)
- return; /* the range we're after has already passed */
+ return; /* the range we're after has already passed */
/* if this strip is not part of an island of continuous strips, it can be used
* - this check needs to be done for each end of the strip we try and use...
*/
- if ((nls->next == NULL) || IS_EQF(nls->next->start, nls->end)==0) {
+ if ((nls->next == NULL) || IS_EQF(nls->next->start, nls->end) == 0) {
if ((nls->end > strip->start) && (nls->end < strip->end))
- *start= &nls->end;
+ *start = &nls->end;
}
- if ((nls->prev == NULL) || IS_EQF(nls->prev->end, nls->start)==0) {
+ if ((nls->prev == NULL) || IS_EQF(nls->prev->end, nls->start) == 0) {
if ((nls->start < strip->end) && (nls->start > strip->start))
- *end= &nls->start;
+ *end = &nls->start;
}
}
}
/* Determine auto-blending for the given strip */
-static void BKE_nlastrip_validate_autoblends (NlaTrack *nlt, NlaStrip *nls)
+static void BKE_nlastrip_validate_autoblends(NlaTrack *nlt, NlaStrip *nls)
{
- float *ps=NULL, *pe=NULL;
- float *ns=NULL, *ne=NULL;
+ float *ps = NULL, *pe = NULL;
+ float *ns = NULL, *ne = NULL;
/* sanity checks */
if (ELEM(NULL, nls, nlt))
return;
if ((nlt->prev == NULL) && (nlt->next == NULL))
return;
- if ((nls->flag & NLASTRIP_FLAG_AUTO_BLENDS)==0)
+ if ((nls->flag & NLASTRIP_FLAG_AUTO_BLENDS) == 0)
return;
/* get test ranges */
@@ -1394,31 +1394,31 @@ static void BKE_nlastrip_validate_autoblends (NlaTrack *nlt, NlaStrip *nls)
* is directly followed/preceeded by another strip, forming an
* 'island' of continuous strips
*/
- if ((ps || ns) && ((nls->prev == NULL) || IS_EQF(nls->prev->end, nls->start)==0)) {
+ if ((ps || ns) && ((nls->prev == NULL) || IS_EQF(nls->prev->end, nls->start) == 0)) {
/* start overlaps - pick the largest overlap */
if ( ((ps && ns) && (*ps > *ns)) || (ps) )
- nls->blendin= *ps - nls->start;
+ nls->blendin = *ps - nls->start;
else
- nls->blendin= *ns - nls->start;
+ nls->blendin = *ns - nls->start;
}
else /* no overlap allowed/needed */
- nls->blendin= 0.0f;
+ nls->blendin = 0.0f;
- if ((pe || ne) && ((nls->next == NULL) || IS_EQF(nls->next->start, nls->end)==0)) {
+ if ((pe || ne) && ((nls->next == NULL) || IS_EQF(nls->next->start, nls->end) == 0)) {
/* end overlaps - pick the largest overlap */
if ( ((pe && ne) && (*pe > *ne)) || (pe) )
- nls->blendout= nls->end - *pe;
+ nls->blendout = nls->end - *pe;
else
- nls->blendout= nls->end - *ne;
+ nls->blendout = nls->end - *ne;
}
else /* no overlap allowed/needed */
- nls->blendout= 0.0f;
+ nls->blendout = 0.0f;
}
/* Ensure that auto-blending and other settings are set correctly */
void BKE_nla_validate_state(AnimData *adt)
{
- NlaStrip *strip, *fstrip=NULL;
+ NlaStrip *strip, *fstrip = NULL;
NlaTrack *nlt;
/* sanity checks */
@@ -1426,20 +1426,20 @@ void BKE_nla_validate_state(AnimData *adt)
return;
/* adjust blending values for auto-blending, and also do an initial pass to find the earliest strip */
- for (nlt= adt->nla_tracks.first; nlt; nlt= nlt->next) {
- for (strip= nlt->strips.first; strip; strip= strip->next) {
+ for (nlt = adt->nla_tracks.first; nlt; nlt = nlt->next) {
+ for (strip = nlt->strips.first; strip; strip = strip->next) {
/* auto-blending first */
BKE_nlastrip_validate_autoblends(nlt, strip);
/* extend mode - find first strip */
if ((fstrip == NULL) || (strip->start < fstrip->start))
- fstrip= strip;
+ fstrip = strip;
}
}
/* second pass over the strips to adjust the extend-mode to fix any problems */
- for (nlt= adt->nla_tracks.first; nlt; nlt= nlt->next) {
- for (strip= nlt->strips.first; strip; strip= strip->next) {
+ for (nlt = adt->nla_tracks.first; nlt; nlt = nlt->next) {
+ for (strip = nlt->strips.first; strip; strip = strip->next) {
/* apart from 'nothing' option which user has to explicitly choose, we don't really know if
* we should be overwriting the extend setting (but assume that's what the user wanted)
*/
@@ -1454,9 +1454,9 @@ void BKE_nla_validate_state(AnimData *adt)
* Should fix problems such as [#29869]
*/
if (strip == fstrip)
- strip->extendmode= NLASTRIP_EXTEND_HOLD;
+ strip->extendmode = NLASTRIP_EXTEND_HOLD;
else if (strip->blendmode == NLASTRIP_MODE_REPLACE)
- strip->extendmode= NLASTRIP_EXTEND_HOLD_FORWARD;
+ strip->extendmode = NLASTRIP_EXTEND_HOLD_FORWARD;
}
}
}
@@ -1489,13 +1489,13 @@ void BKE_nla_action_pushdown(AnimData *adt)
}
/* add a new NLA strip to the track, which references the active action */
- strip= add_nlastrip_to_stack(adt, adt->action);
+ strip = add_nlastrip_to_stack(adt, adt->action);
/* do other necessary work on strip */
if (strip) {
/* clear reference to action now that we've pushed it onto the stack */
id_us_min(&adt->action->id);
- adt->action= NULL;
+ adt->action = NULL;
/* if the strip is the first one in the track it lives in, check if there
* are strips in any other tracks that may be before this, and set the extend
@@ -1506,7 +1506,7 @@ void BKE_nla_action_pushdown(AnimData *adt)
* so that it doesn't override strips in previous tracks
*/
// FIXME: this needs to be more automated, since user can rearrange strips
- strip->extendmode= NLASTRIP_EXTEND_HOLD_FORWARD;
+ strip->extendmode = NLASTRIP_EXTEND_HOLD_FORWARD;
}
/* make strip the active one... */
@@ -1520,8 +1520,8 @@ void BKE_nla_action_pushdown(AnimData *adt)
*/
short BKE_nla_tweakmode_enter(AnimData *adt)
{
- NlaTrack *nlt, *activeTrack=NULL;
- NlaStrip *strip, *activeStrip=NULL;
+ NlaTrack *nlt, *activeTrack = NULL;
+ NlaStrip *strip, *activeStrip = NULL;
/* verify that data is valid */
if (ELEM(NULL, adt, adt->nla_tracks.first))
@@ -1534,16 +1534,16 @@ short BKE_nla_tweakmode_enter(AnimData *adt)
return 1;
/* go over the tracks, finding the active one, and its active strip
- * - if we cannot find both, then there's nothing to do
+ * - if we cannot find both, then there's nothing to do
*/
- for (nlt= adt->nla_tracks.first; nlt; nlt= nlt->next) {
+ for (nlt = adt->nla_tracks.first; nlt; nlt = nlt->next) {
/* check if active */
if (nlt->flag & NLATRACK_ACTIVE) {
/* store reference to this active track */
- activeTrack= nlt;
+ activeTrack = nlt;
/* now try to find active strip */
- activeStrip= BKE_nlastrip_find_active(nlt);
+ activeStrip = BKE_nlastrip_find_active(nlt);
break;
}
}
@@ -1557,18 +1557,18 @@ short BKE_nla_tweakmode_enter(AnimData *adt)
for (nlt = adt->nla_tracks.last; nlt; nlt = nlt->prev) {
if (nlt->flag & NLATRACK_SELECTED) {
/* assume this is the active track */
- activeTrack= nlt;
+ activeTrack = nlt;
/* try to find active strip */
- activeStrip= BKE_nlastrip_find_active(nlt);
+ activeStrip = BKE_nlastrip_find_active(nlt);
break;
}
}
}
if ((activeTrack) && (activeStrip == NULL)) {
/* no active strip in active or last selected track; compromise for first selected (assuming only single)... */
- for (strip = activeTrack->strips.first; strip; strip= strip->next) {
- if (strip->flag & (NLASTRIP_FLAG_SELECT|NLASTRIP_FLAG_ACTIVE)) {
+ for (strip = activeTrack->strips.first; strip; strip = strip->next) {
+ if (strip->flag & (NLASTRIP_FLAG_SELECT | NLASTRIP_FLAG_ACTIVE)) {
activeStrip = strip;
break;
}
@@ -1586,8 +1586,8 @@ short BKE_nla_tweakmode_enter(AnimData *adt)
/* go over all the tracks up to the active one, tagging each strip that uses the same
* action as the active strip, but leaving everything else alone
*/
- for (nlt= activeTrack->prev; nlt; nlt= nlt->prev) {
- for (strip= nlt->strips.first; strip; strip= strip->next) {
+ for (nlt = activeTrack->prev; nlt; nlt = nlt->prev) {
+ for (strip = nlt->strips.first; strip; strip = strip->next) {
if (strip->act == activeStrip->act)
strip->flag |= NLASTRIP_FLAG_TWEAKUSER;
else
@@ -1599,7 +1599,7 @@ short BKE_nla_tweakmode_enter(AnimData *adt)
/* go over all the tracks after AND INCLUDING the active one, tagging them as being disabled
* - the active track needs to also be tagged, otherwise, it'll overlap with the tweaks going on
*/
- for (nlt= activeTrack; nlt; nlt= nlt->next)
+ for (nlt = activeTrack; nlt; nlt = nlt->next)
nlt->flag |= NLATRACK_DISABLED;
/* handle AnimData level changes:
@@ -1608,9 +1608,9 @@ short BKE_nla_tweakmode_enter(AnimData *adt)
* - editing-flag for this AnimData block should also get turned on (for more efficient restoring)
* - take note of the active strip for mapping-correction of keyframes in the action being edited
*/
- adt->tmpact= adt->action;
- adt->action= activeStrip->act;
- adt->actstrip= activeStrip;
+ adt->tmpact = adt->action;
+ adt->action = activeStrip->act;
+ adt->actstrip = activeStrip;
id_us_plus(&activeStrip->act->id);
adt->flag |= ADT_NLA_EDIT_ON;
@@ -1637,10 +1637,10 @@ void BKE_nla_tweakmode_exit(AnimData *adt)
/* for all Tracks, clear the 'disabled' flag
* for all Strips, clear the 'tweak-user' flag
*/
- for (nlt= adt->nla_tracks.first; nlt; nlt= nlt->next) {
+ for (nlt = adt->nla_tracks.first; nlt; nlt = nlt->next) {
nlt->flag &= ~NLATRACK_DISABLED;
- for (strip= nlt->strips.first; strip; strip= strip->next)
+ for (strip = nlt->strips.first; strip; strip = strip->next)
strip->flag &= ~NLASTRIP_FLAG_TWEAKUSER;
}
@@ -1652,15 +1652,15 @@ void BKE_nla_tweakmode_exit(AnimData *adt)
* - clear pointer to active strip
*/
if (adt->action) adt->action->id.us--;
- adt->action= adt->tmpact;
- adt->tmpact= NULL;
- adt->actstrip= NULL;
+ adt->action = adt->tmpact;
+ adt->tmpact = NULL;
+ adt->actstrip = NULL;
adt->flag &= ~ADT_NLA_EDIT_ON;
}
/* Baking Tools ------------------------------------------- */
-static void UNUSED_FUNCTION(BKE_nla_bake) (Scene *scene, ID *UNUSED(id), AnimData *adt, int UNUSED(flag))
+static void UNUSED_FUNCTION(BKE_nla_bake) (Scene * scene, ID *UNUSED(id), AnimData * adt, int UNUSED(flag))
{
/* verify that data is valid