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>2019-04-22 02:19:45 +0300
committerCampbell Barton <ideasman42@gmail.com>2019-04-22 12:48:16 +0300
commit620b960d3d8cfd90b9f0df6ba3671c33eccb8309 (patch)
tree64f69db4bf9d44f0a32d1c92b0714bf2dc98ff2d /source/blender/editors/space_nla
parentbba60bb564cf5a16cfcac744d4ba82cf8eba3da9 (diff)
Cleanup: style, use braces for editors
Diffstat (limited to 'source/blender/editors/space_nla')
-rw-r--r--source/blender/editors/space_nla/nla_buttons.c42
-rw-r--r--source/blender/editors/space_nla/nla_channels.c72
-rw-r--r--source/blender/editors/space_nla/nla_draw.c30
-rw-r--r--source/blender/editors/space_nla/nla_edit.c171
-rw-r--r--source/blender/editors/space_nla/nla_ops.c15
-rw-r--r--source/blender/editors/space_nla/nla_select.c60
-rw-r--r--source/blender/editors/space_nla/space_nla.c24
7 files changed, 276 insertions, 138 deletions
diff --git a/source/blender/editors/space_nla/nla_buttons.c b/source/blender/editors/space_nla/nla_buttons.c
index 18c31d3a7f7..d6353a9b0d4 100644
--- a/source/blender/editors/space_nla/nla_buttons.c
+++ b/source/blender/editors/space_nla/nla_buttons.c
@@ -84,8 +84,9 @@ bool nla_panel_context(const bContext *C,
/* For now, only draw if we could init the anim-context info
* (necessary for all animation-related tools)
* to work correctly is able to be correctly retrieved. There's no point showing empty panels? */
- if (ANIM_animdata_get_context(C, &ac) == 0)
+ if (ANIM_animdata_get_context(C, &ac) == 0) {
return false;
+ }
/* extract list of active channel(s), of which we should only take the first one
* - we need the channels flag to get the active AnimData block when there are no NLA Tracks
@@ -168,8 +169,9 @@ bool nla_panel_context(const bContext *C,
}
}
- if (found > 0)
+ if (found > 0) {
break;
+ }
}
/* free temp data */
@@ -208,10 +210,12 @@ static bool nla_strip_actclip_panel_poll(const bContext *C, PanelType *UNUSED(pt
PointerRNA ptr;
NlaStrip *strip;
- if (!nla_panel_context(C, NULL, NULL, &ptr))
+ if (!nla_panel_context(C, NULL, NULL, &ptr)) {
return 0;
- if (ptr.data == NULL)
+ }
+ if (ptr.data == NULL) {
return 0;
+ }
strip = ptr.data;
return (strip->type == NLASTRIP_TYPE_CLIP);
@@ -222,15 +226,18 @@ static bool nla_strip_eval_panel_poll(const bContext *C, PanelType *UNUSED(pt))
PointerRNA ptr;
NlaStrip *strip;
- if (!nla_panel_context(C, NULL, NULL, &ptr))
+ if (!nla_panel_context(C, NULL, NULL, &ptr)) {
return 0;
- if (ptr.data == NULL)
+ }
+ if (ptr.data == NULL) {
return 0;
+ }
strip = ptr.data;
- if (strip->type == NLASTRIP_TYPE_SOUND)
+ if (strip->type == NLASTRIP_TYPE_SOUND) {
return 0;
+ }
return 1;
}
@@ -247,8 +254,9 @@ static void nla_panel_animdata(const bContext *C, Panel *pa)
uiBlock *block;
/* check context and also validity of pointer */
- if (!nla_panel_context(C, &adt_ptr, NULL, NULL))
+ if (!nla_panel_context(C, &adt_ptr, NULL, NULL)) {
return;
+ }
/* adt = adt_ptr.data; */
@@ -312,8 +320,9 @@ static void nla_panel_track(const bContext *C, Panel *pa)
uiBlock *block;
/* check context and also validity of pointer */
- if (!nla_panel_context(C, NULL, &nlt_ptr, NULL))
+ if (!nla_panel_context(C, NULL, &nlt_ptr, NULL)) {
return;
+ }
block = uiLayoutGetBlock(layout);
UI_block_func_handle_set(block, do_nla_region_buttons, NULL);
@@ -332,8 +341,9 @@ static void nla_panel_properties(const bContext *C, Panel *pa)
uiBlock *block;
short showEvalProps = 1;
- if (!nla_panel_context(C, NULL, NULL, &strip_ptr))
+ if (!nla_panel_context(C, NULL, NULL, &strip_ptr)) {
return;
+ }
block = uiLayoutGetBlock(layout);
UI_block_func_handle_set(block, do_nla_region_buttons, NULL);
@@ -353,8 +363,9 @@ static void nla_panel_properties(const bContext *C, Panel *pa)
/* Evaluation-Related Strip Properties ------------------ */
/* sound properties strips don't have these settings */
- if (RNA_enum_get(&strip_ptr, "type") == NLASTRIP_TYPE_SOUND)
+ if (RNA_enum_get(&strip_ptr, "type") == NLASTRIP_TYPE_SOUND) {
showEvalProps = 0;
+ }
/* only show if allowed to... */
if (showEvalProps) {
@@ -398,8 +409,9 @@ static void nla_panel_actclip(const bContext *C, Panel *pa)
uiBlock *block;
/* check context and also validity of pointer */
- if (!nla_panel_context(C, NULL, NULL, &strip_ptr))
+ if (!nla_panel_context(C, NULL, NULL, &strip_ptr)) {
return;
+ }
block = uiLayoutGetBlock(layout);
UI_block_func_handle_set(block, do_nla_region_buttons, NULL);
@@ -439,8 +451,9 @@ static void nla_panel_evaluation(const bContext *C, Panel *pa)
uiBlock *block;
/* check context and also validity of pointer */
- if (!nla_panel_context(C, NULL, NULL, &strip_ptr))
+ if (!nla_panel_context(C, NULL, NULL, &strip_ptr)) {
return;
+ }
block = uiLayoutGetBlock(layout);
UI_block_func_handle_set(block, do_nla_region_buttons, NULL);
@@ -472,8 +485,9 @@ static void nla_panel_modifiers(const bContext *C, Panel *pa)
uiBlock *block;
/* check context and also validity of pointer */
- if (!nla_panel_context(C, NULL, NULL, &strip_ptr))
+ if (!nla_panel_context(C, NULL, NULL, &strip_ptr)) {
return;
+ }
strip = strip_ptr.data;
block = uiLayoutGetBlock(pa->layout);
diff --git a/source/blender/editors/space_nla/nla_channels.c b/source/blender/editors/space_nla/nla_channels.c
index 9332a6d6763..638ad62592e 100644
--- a/source/blender/editors/space_nla/nla_channels.c
+++ b/source/blender/editors/space_nla/nla_channels.c
@@ -91,9 +91,10 @@ static int mouse_nla_channels(
ale = BLI_findlink(&anim_data, channel_index);
if (ale == NULL) {
/* channel not found */
- if (G.debug & G_DEBUG)
+ if (G.debug & G_DEBUG) {
printf("Error: animation channel (index = %d) not found in mouse_anim_channels()\n",
channel_index);
+ }
ANIM_animdata_freelist(&anim_data);
return 0;
@@ -110,13 +111,15 @@ static int mouse_nla_channels(
if (selectmode == SELECT_INVERT) {
/* swap select */
sce->flag ^= SCE_DS_SELECTED;
- if (adt)
+ if (adt) {
adt->flag ^= ADT_UI_SELECTED;
+ }
}
else {
sce->flag |= SCE_DS_SELECTED;
- if (adt)
+ if (adt) {
adt->flag |= ADT_UI_SELECTED;
+ }
}
notifierFlags |= (ND_ANIMCHAN | NA_SELECTED);
@@ -135,8 +138,9 @@ static int mouse_nla_channels(
ED_object_base_select(base, BA_INVERT);
BKE_scene_object_base_flag_sync_from_base(base);
- if (adt)
+ if (adt) {
adt->flag ^= ADT_UI_SELECTED;
+ }
}
else {
/* deselect all */
@@ -144,22 +148,25 @@ static int mouse_nla_channels(
for (Base *b = view_layer->object_bases.first; b; b = b->next) {
ED_object_base_select(b, BA_DESELECT);
BKE_scene_object_base_flag_sync_from_base(b);
- if (b->object->adt)
+ if (b->object->adt) {
b->object->adt->flag &= ~(ADT_UI_SELECTED | ADT_UI_ACTIVE);
+ }
}
/* select object now */
ED_object_base_select(base, BA_SELECT);
BKE_scene_object_base_flag_sync_from_base(base);
- if (adt)
+ if (adt) {
adt->flag |= ADT_UI_SELECTED;
+ }
}
/* change active object - regardless of whether it is now selected [T37883] */
ED_object_base_activate(C, base); /* adds notifier */
- if ((adt) && (adt->flag & ADT_UI_SELECTED))
+ if ((adt) && (adt->flag & ADT_UI_SELECTED)) {
adt->flag |= ADT_UI_ACTIVE;
+ }
/* notifiers - channel was selected */
notifierFlags |= (ND_ANIMCHAN | NA_SELECTED);
@@ -199,8 +206,9 @@ static int mouse_nla_channels(
}
/* set active? */
- if ((ale->adt) && (ale->adt->flag & ADT_UI_SELECTED))
+ if ((ale->adt) && (ale->adt->flag & ADT_UI_SELECTED)) {
ale->adt->flag |= ADT_UI_ACTIVE;
+ }
}
notifierFlags |= (ND_ANIMCHAN | NA_SELECTED);
@@ -214,13 +222,16 @@ static int mouse_nla_channels(
/* offset for start of channel (on LHS of channel-list) */
if (ale->id) {
/* special exception for materials and particles */
- if (ELEM(GS(ale->id->name), ID_MA, ID_PA))
+ if (ELEM(GS(ale->id->name), ID_MA, ID_PA)) {
offset = 21 + NLACHANNEL_BUTTON_WIDTH;
- else
+ }
+ else {
offset = 14;
+ }
}
- else
+ else {
offset = 0;
+ }
if (x >= (v2d->cur.xmax - NLACHANNEL_BUTTON_WIDTH)) {
/* toggle protection (only if there's a toggle there) */
@@ -259,8 +270,9 @@ static int mouse_nla_channels(
/* if NLA-Track is selected now,
* make NLA-Track the 'active' one in the visible list */
- if (nlt->flag & NLATRACK_SELECTED)
+ if (nlt->flag & NLATRACK_SELECTED) {
ANIM_set_active_channel(ac, ac->data, ac->datatype, filter, nlt, ANIMTYPE_NLATRACK);
+ }
/* notifier flags - channel was selected */
notifierFlags |= (ND_ANIMCHAN | NA_SELECTED);
@@ -319,8 +331,9 @@ static int mouse_nla_channels(
}
/* set active? */
- if (adt->flag & ADT_UI_SELECTED)
+ if (adt->flag & ADT_UI_SELECTED) {
adt->flag |= ADT_UI_ACTIVE;
+ }
notifierFlags |= (ND_ANIMCHAN | NA_SELECTED);
}
@@ -328,8 +341,9 @@ static int mouse_nla_channels(
break;
}
default:
- if (G.debug & G_DEBUG)
+ if (G.debug & G_DEBUG) {
printf("Error: Invalid channel type in mouse_nla_channels()\n");
+ }
break;
}
@@ -356,8 +370,9 @@ static int nlachannels_mouseclick_invoke(bContext *C, wmOperator *op, const wmEv
float x, y;
/* get editor data */
- if (ANIM_animdata_get_context(C, &ac) == 0)
+ if (ANIM_animdata_get_context(C, &ac) == 0) {
return OPERATOR_CANCELLED;
+ }
/* get useful pointers from animation context data */
snla = (SpaceNla *)ac.sl;
@@ -365,10 +380,12 @@ static int nlachannels_mouseclick_invoke(bContext *C, wmOperator *op, const wmEv
v2d = &ar->v2d;
/* select mode is either replace (deselect all, then add) or add/extend */
- if (RNA_boolean_get(op->ptr, "extend"))
+ if (RNA_boolean_get(op->ptr, "extend")) {
selectmode = SELECT_INVERT;
- else
+ }
+ else {
selectmode = SELECT_REPLACE;
+ }
/**
* Figure out which channel user clicked in:
@@ -431,8 +448,9 @@ static int nlachannels_pushdown_exec(bContext *C, wmOperator *op)
int channel_index = RNA_int_get(op->ptr, "channel_index");
/* get editor data */
- if (ANIM_animdata_get_context(C, &ac) == 0)
+ if (ANIM_animdata_get_context(C, &ac) == 0) {
return OPERATOR_CANCELLED;
+ }
/* get anim-channel to use (or more specifically, the animdata block behind it) */
if (channel_index == -1) {
@@ -558,13 +576,15 @@ static int nla_action_unlink_exec(bContext *C, wmOperator *op)
AnimData *adt;
/* check context and also validity of pointer */
- if (!nla_panel_context(C, &adt_ptr, NULL, NULL))
+ if (!nla_panel_context(C, &adt_ptr, NULL, NULL)) {
return OPERATOR_CANCELLED;
+ }
/* get animdata */
adt = adt_ptr.data;
- if (adt == NULL)
+ if (adt == NULL) {
return OPERATOR_CANCELLED;
+ }
/* do unlinking */
if (adt && adt->action) {
@@ -701,8 +721,9 @@ static int nlaedit_add_tracks_exec(bContext *C, wmOperator *op)
bool op_done = false;
/* get editor data */
- if (ANIM_animdata_get_context(C, &ac) == 0)
+ if (ANIM_animdata_get_context(C, &ac) == 0) {
return OPERATOR_CANCELLED;
+ }
/* perform adding in two passes - existing first so that we don't double up for empty */
op_done |= nlaedit_add_tracks_existing(&ac, above_sel);
@@ -762,8 +783,9 @@ static int nlaedit_delete_tracks_exec(bContext *C, wmOperator *UNUSED(op))
int filter;
/* get editor data */
- if (ANIM_animdata_get_context(C, &ac) == 0)
+ if (ANIM_animdata_get_context(C, &ac) == 0) {
return OPERATOR_CANCELLED;
+ }
/* get a list of the AnimData blocks being shown in the NLA */
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_SEL |
@@ -779,8 +801,9 @@ static int nlaedit_delete_tracks_exec(bContext *C, wmOperator *UNUSED(op))
/* if track is currently 'solo', then AnimData should have its
* 'has solo' flag disabled
*/
- if (nlt->flag & NLATRACK_SOLO)
+ if (nlt->flag & NLATRACK_SOLO) {
adt->flag &= ~ADT_NLA_SOLO_TRACK;
+ }
/* call delete on this track - deletes all strips too */
BKE_nlatrack_free(&adt->nla_tracks, nlt, true);
@@ -833,8 +856,9 @@ static int nlaedit_objects_add_exec(bContext *C, wmOperator *UNUSED(op))
SpaceNla *snla;
/* get editor data */
- if (ANIM_animdata_get_context(C, &ac) == 0)
+ if (ANIM_animdata_get_context(C, &ac) == 0) {
return OPERATOR_CANCELLED;
+ }
/* ensure that filters are set so that the effect will be immediately visible */
snla = (SpaceNla *)ac.sl;
diff --git a/source/blender/editors/space_nla/nla_draw.c b/source/blender/editors/space_nla/nla_draw.c
index 65115819874..1df2190b7af 100644
--- a/source/blender/editors/space_nla/nla_draw.c
+++ b/source/blender/editors/space_nla/nla_draw.c
@@ -86,8 +86,9 @@ void nla_action_get_color(AnimData *adt, bAction *act, float color[4])
/* when an NLA track is tagged "solo", action doesn't contribute,
* so shouldn't be as prominent */
- if (adt && (adt->flag & ADT_NLA_SOLO_TRACK))
+ if (adt && (adt->flag & ADT_NLA_SOLO_TRACK)) {
color[3] *= 0.15f;
+ }
}
/* draw the keyframes in the specified Action */
@@ -99,8 +100,9 @@ static void nla_action_draw_keyframes(
BLI_dlrbTree_init(&keys);
action_to_keylist(adt, act, &keys, 0);
- if (ELEM(NULL, act, keys.first))
+ if (ELEM(NULL, act, keys.first)) {
return;
+ }
/* draw a darkened region behind the strips
* - get and reset the background color, this time without the alpha to stand out better
@@ -181,8 +183,9 @@ static void nla_actionclip_draw_markers(
{
const bAction *act = strip->act;
- if (ELEM(NULL, act, act->markers.first))
+ if (ELEM(NULL, act, act->markers.first)) {
return;
+ }
const uint shdr_pos = GPU_vertformat_attr_add(
immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
@@ -351,16 +354,18 @@ static void nla_draw_strip_curves(NlaStrip *strip, float yminc, float ymaxc, uns
immVertex2f(pos, strip->start, yminc);
immVertex2f(pos, strip->start + strip->blendin, ymaxc);
}
- else
+ else {
immVertex2f(pos, strip->start, ymaxc);
+ }
/* end of strip */
if (IS_EQF(strip->blendout, 0.0f) == 0) {
immVertex2f(pos, strip->end - strip->blendout, ymaxc);
immVertex2f(pos, strip->end, yminc);
}
- else
+ else {
immVertex2f(pos, strip->end, ymaxc);
+ }
immEnd();
}
@@ -489,15 +494,17 @@ static void nla_draw_strip(SpaceNla *snla,
/* draw strip's control 'curves'
* - only if user hasn't hidden them...
*/
- if ((snla->flag & SNLA_NOSTRIPCURVES) == 0)
+ if ((snla->flag & SNLA_NOSTRIPCURVES) == 0) {
nla_draw_strip_curves(strip, yminc, ymaxc, shdr_pos);
+ }
immUnbindProgram();
/* draw markings indicating locations of local markers
* (useful for lining up different actions) */
- if ((snla->flag & SNLA_NOLOCALMARKERS) == 0)
+ if ((snla->flag & SNLA_NOLOCALMARKERS) == 0) {
nla_strip_draw_markers(strip, yminc, ymaxc);
+ }
/* draw strip outline
* - color used here is to indicate active vs non-active
@@ -615,10 +622,12 @@ static void nla_draw_strip_text(AnimData *adt,
}
/* text opacity depends on whether if there's a solo'd track, this isn't it */
- if (non_solo == 0)
+ if (non_solo == 0) {
col[3] = 255;
- else
+ }
+ else {
col[3] = 128;
+ }
/* set bounding-box for text
* - padding of 2 'units' on either side
@@ -722,8 +731,9 @@ void draw_nla_main_data(bAnimContext *ac, SpaceNla *snla, ARegion *ar)
/* if transforming strips (only real reason for temp-metas currently),
* add to the cache the frame numbers of the strip's extents
*/
- if (strip->flag & NLASTRIP_FLAG_TEMP_META)
+ if (strip->flag & NLASTRIP_FLAG_TEMP_META) {
nla_draw_strip_frames_text(nlt, strip, v2d, yminc, ymaxc);
+ }
}
}
break;
diff --git a/source/blender/editors/space_nla/nla_edit.c b/source/blender/editors/space_nla/nla_edit.c
index 99c2b7aa99c..76930d3117b 100644
--- a/source/blender/editors/space_nla/nla_edit.c
+++ b/source/blender/editors/space_nla/nla_edit.c
@@ -113,8 +113,9 @@ static int nlaedit_enable_tweakmode_exec(bContext *C, wmOperator *op)
bool ok = false;
/* get editor data */
- if (ANIM_animdata_get_context(C, &ac) == 0)
+ if (ANIM_animdata_get_context(C, &ac) == 0) {
return OPERATOR_CANCELLED;
+ }
/* get a list of the AnimData blocks being shown in the NLA */
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_ANIMDATA);
@@ -257,17 +258,20 @@ static int nlaedit_disable_tweakmode_exec(bContext *C, wmOperator *op)
bool ok = false;
/* get editor data */
- if (ANIM_animdata_get_context(C, &ac) == 0)
+ if (ANIM_animdata_get_context(C, &ac) == 0) {
return OPERATOR_CANCELLED;
+ }
/* perform operation */
ok = nlaedit_disable_tweakmode(&ac, do_solo);
/* success? */
- if (ok)
+ if (ok) {
return OPERATOR_FINISHED;
- else
+ }
+ else {
return OPERATOR_CANCELLED;
+ }
}
void NLA_OT_tweakmode_exit(wmOperatorType *ot)
@@ -362,13 +366,16 @@ static int nlaedit_previewrange_exec(bContext *C, wmOperator *UNUSED(op))
float min, max;
/* get editor data */
- if (ANIM_animdata_get_context(C, &ac) == 0)
+ if (ANIM_animdata_get_context(C, &ac) == 0) {
return OPERATOR_CANCELLED;
+ }
- if (ac.scene == NULL)
+ if (ac.scene == NULL) {
return OPERATOR_CANCELLED;
- else
+ }
+ else {
scene = ac.scene;
+ }
/* set the range directly */
get_nlastrip_extents(&ac, &min, &max, true);
@@ -464,8 +471,9 @@ static int nlaedit_viewall(bContext *C, const bool only_sel)
float extra;
/* get editor data */
- if (ANIM_animdata_get_context(C, &ac) == 0)
+ if (ANIM_animdata_get_context(C, &ac) == 0) {
return OPERATOR_CANCELLED;
+ }
v2d = &ac.ar->v2d;
/* set the horizontal range, with an extra offset so that the extreme keys will be in view */
@@ -597,8 +605,9 @@ static int nlaedit_add_actionclip_exec(bContext *C, wmOperator *op)
float cfra;
/* get editor data */
- if (ANIM_animdata_get_context(C, &ac) == 0)
+ if (ANIM_animdata_get_context(C, &ac) == 0) {
return OPERATOR_CANCELLED;
+ }
scene = ac.scene;
cfra = (float)CFRA;
@@ -735,8 +744,9 @@ static int nlaedit_add_transition_exec(bContext *C, wmOperator *op)
bool done = false;
/* get editor data */
- if (ANIM_animdata_get_context(C, &ac) == 0)
+ if (ANIM_animdata_get_context(C, &ac) == 0) {
return OPERATOR_CANCELLED;
+ }
/* get a list of the editable tracks being shown in the NLA */
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_FOREDIT);
@@ -749,8 +759,9 @@ static int nlaedit_add_transition_exec(bContext *C, wmOperator *op)
NlaStrip *s1, *s2;
/* get initial pair of strips */
- if (ELEM(nlt->strips.first, NULL, nlt->strips.last))
+ if (ELEM(nlt->strips.first, NULL, nlt->strips.last)) {
continue;
+ }
s1 = nlt->strips.first;
s2 = s1->next;
@@ -759,20 +770,24 @@ static int nlaedit_add_transition_exec(bContext *C, wmOperator *op)
NlaStrip *strip;
/* check if both are selected */
- if (ELEM(0, (s1->flag & NLASTRIP_FLAG_SELECT), (s2->flag & NLASTRIP_FLAG_SELECT)))
+ if (ELEM(0, (s1->flag & NLASTRIP_FLAG_SELECT), (s2->flag & NLASTRIP_FLAG_SELECT))) {
continue;
+ }
/* check if there's space between the two */
- if (IS_EQF(s1->end, s2->start))
+ if (IS_EQF(s1->end, s2->start)) {
continue;
+ }
/* make sure neither one is a transition
* - although this is impossible to create with the standard tools,
* the user may have altered the settings
*/
- if (ELEM(NLASTRIP_TYPE_TRANSITION, s1->type, s2->type))
+ if (ELEM(NLASTRIP_TYPE_TRANSITION, s1->type, s2->type)) {
continue;
+ }
/* also make sure neither one is a soundclip */
- if (ELEM(NLASTRIP_TYPE_SOUND, s1->type, s2->type))
+ if (ELEM(NLASTRIP_TYPE_SOUND, s1->type, s2->type)) {
continue;
+ }
/* allocate new strip */
strip = MEM_callocN(sizeof(NlaStrip), "NlaStrip");
@@ -856,8 +871,9 @@ static int nlaedit_add_sound_exec(bContext *C, wmOperator *UNUSED(op))
int cfra;
/* get editor data */
- if (ANIM_animdata_get_context(C, &ac) == 0)
+ if (ANIM_animdata_get_context(C, &ac) == 0) {
return OPERATOR_CANCELLED;
+ }
scene = ac.scene;
cfra = CFRA;
@@ -877,8 +893,9 @@ static int nlaedit_add_sound_exec(bContext *C, wmOperator *UNUSED(op))
NlaStrip *strip;
/* does this belong to speaker - assumed to live on Object level only */
- if ((GS(ale->id->name) != ID_OB) || (ob->type != OB_SPEAKER))
+ if ((GS(ale->id->name) != ID_OB) || (ob->type != OB_SPEAKER)) {
continue;
+ }
/* create a new strip, and offset it to start on the current frame */
strip = BKE_nla_add_soundstrip(ac.scene, ob->data);
@@ -940,8 +957,9 @@ static int nlaedit_add_meta_exec(bContext *C, wmOperator *UNUSED(op))
int filter;
/* get editor data */
- if (ANIM_animdata_get_context(C, &ac) == 0)
+ if (ANIM_animdata_get_context(C, &ac) == 0) {
return OPERATOR_CANCELLED;
+ }
/* get a list of the editable tracks being shown in the NLA */
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_FOREDIT);
@@ -959,8 +977,9 @@ static int nlaedit_add_meta_exec(bContext *C, wmOperator *UNUSED(op))
/* name the metas */
for (strip = nlt->strips.first; strip; strip = strip->next) {
/* auto-name this strip if selected (that means it is a meta) */
- if (strip->flag & NLASTRIP_FLAG_SELECT)
+ if (strip->flag & NLASTRIP_FLAG_SELECT) {
BKE_nlastrip_validate_name(adt, strip);
+ }
}
ale->update |= ANIM_UPDATE_DEPS;
@@ -1004,8 +1023,9 @@ static int nlaedit_remove_meta_exec(bContext *C, wmOperator *UNUSED(op))
int filter;
/* get editor data */
- if (ANIM_animdata_get_context(C, &ac) == 0)
+ if (ANIM_animdata_get_context(C, &ac) == 0) {
return OPERATOR_CANCELLED;
+ }
/* get a list of the editable tracks being shown in the NLA */
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_FOREDIT);
@@ -1064,8 +1084,9 @@ static int nlaedit_duplicate_exec(bContext *C, wmOperator *op)
bool done = false;
/* get editor data */
- if (ANIM_animdata_get_context(C, &ac) == 0)
+ if (ANIM_animdata_get_context(C, &ac) == 0) {
return OPERATOR_CANCELLED;
+ }
/* get a list of editable tracks being shown in the NLA */
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_FOREDIT);
@@ -1127,8 +1148,9 @@ static int nlaedit_duplicate_exec(bContext *C, wmOperator *op)
/* done */
return OPERATOR_FINISHED;
}
- else
+ else {
return OPERATOR_CANCELLED;
+ }
}
static int nlaedit_duplicate_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
@@ -1180,8 +1202,9 @@ static int nlaedit_delete_exec(bContext *C, wmOperator *UNUSED(op))
int filter;
/* get editor data */
- if (ANIM_animdata_get_context(C, &ac) == 0)
+ if (ANIM_animdata_get_context(C, &ac) == 0) {
return OPERATOR_CANCELLED;
+ }
/* get a list of the editable tracks being shown in the NLA */
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_FOREDIT);
@@ -1198,8 +1221,9 @@ static int nlaedit_delete_exec(bContext *C, wmOperator *UNUSED(op))
/* if selected, delete */
if (strip->flag & NLASTRIP_FLAG_SELECT) {
/* if a strip either side of this was a transition, delete those too */
- if ((strip->prev) && (strip->prev->type == NLASTRIP_TYPE_TRANSITION))
+ if ((strip->prev) && (strip->prev->type == NLASTRIP_TYPE_TRANSITION)) {
BKE_nlastrip_free(&nlt->strips, strip->prev, true);
+ }
if ((nstrip) && (nstrip->type == NLASTRIP_TYPE_TRANSITION)) {
nstrip = nstrip->next;
BKE_nlastrip_free(&nlt->strips, strip->next, true);
@@ -1268,17 +1292,21 @@ static void nlaedit_split_strip_actclip(
/* strip extents */
len = strip->end - strip->start;
- if (IS_EQF(len, 0.0f))
+ if (IS_EQF(len, 0.0f)) {
return;
- else
+ }
+ else {
splitframe = strip->start + (len / 2.0f);
+ }
/* action range */
len = strip->actend - strip->actstart;
- if (IS_EQF(len, 0.0f))
+ if (IS_EQF(len, 0.0f)) {
splitaframe = strip->actend;
- else
+ }
+ else {
splitaframe = strip->actstart + (len / 2.0f);
+ }
}
/* make a copy (assume that this is possible) and append
@@ -1324,8 +1352,9 @@ static int nlaedit_split_exec(bContext *C, wmOperator *UNUSED(op))
int filter;
/* get editor data */
- if (ANIM_animdata_get_context(C, &ac) == 0)
+ if (ANIM_animdata_get_context(C, &ac) == 0) {
return OPERATOR_CANCELLED;
+ }
/* get a list of editable tracks being shown in the NLA */
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_FOREDIT);
@@ -1402,8 +1431,9 @@ static int nlaedit_toggle_mute_exec(bContext *C, wmOperator *UNUSED(op))
int filter;
/* get editor data */
- if (ANIM_animdata_get_context(C, &ac) == 0)
+ if (ANIM_animdata_get_context(C, &ac) == 0) {
return OPERATOR_CANCELLED;
+ }
/* get a list of the editable tracks being shown in the NLA */
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_FOREDIT);
@@ -1465,8 +1495,9 @@ static int nlaedit_swap_exec(bContext *C, wmOperator *op)
int filter;
/* get editor data */
- if (ANIM_animdata_get_context(C, &ac) == 0)
+ if (ANIM_animdata_get_context(C, &ac) == 0) {
return OPERATOR_CANCELLED;
+ }
/* get a list of the editable tracks being shown in the NLA */
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_FOREDIT);
@@ -1634,8 +1665,9 @@ static int nlaedit_move_up_exec(bContext *C, wmOperator *UNUSED(op))
int filter;
/* get editor data */
- if (ANIM_animdata_get_context(C, &ac) == 0)
+ if (ANIM_animdata_get_context(C, &ac) == 0) {
return OPERATOR_CANCELLED;
+ }
/* get a list of the editable tracks being shown in the NLA */
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_FOREDIT);
@@ -1650,8 +1682,9 @@ static int nlaedit_move_up_exec(bContext *C, wmOperator *UNUSED(op))
NlaStrip *strip, *stripn;
/* if this track has no tracks after it, skip for now... */
- if (nltn == NULL)
+ if (nltn == NULL) {
continue;
+ }
/* for every selected strip, try to move */
for (strip = nlt->strips.first; strip; strip = stripn) {
@@ -1709,8 +1742,9 @@ static int nlaedit_move_down_exec(bContext *C, wmOperator *UNUSED(op))
int filter;
/* get editor data */
- if (ANIM_animdata_get_context(C, &ac) == 0)
+ if (ANIM_animdata_get_context(C, &ac) == 0) {
return OPERATOR_CANCELLED;
+ }
/* get a list of the editable tracks being shown in the NLA */
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_FOREDIT);
@@ -1725,8 +1759,9 @@ static int nlaedit_move_down_exec(bContext *C, wmOperator *UNUSED(op))
NlaStrip *strip, *stripn;
/* if this track has no tracks before it, skip for now... */
- if (nltp == NULL)
+ if (nltp == NULL) {
continue;
+ }
/* for every selected strip, try to move */
for (strip = nlt->strips.first; strip; strip = stripn) {
@@ -1785,13 +1820,15 @@ static int nlaedit_sync_actlen_exec(bContext *C, wmOperator *op)
const bool active_only = RNA_boolean_get(op->ptr, "active");
/* get editor data */
- if (ANIM_animdata_get_context(C, &ac) == 0)
+ if (ANIM_animdata_get_context(C, &ac) == 0) {
return OPERATOR_CANCELLED;
+ }
/* get a list of the editable tracks being shown in the NLA */
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_FOREDIT);
- if (active_only)
+ if (active_only) {
filter |= ANIMFILTER_ACTIVE;
+ }
ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
/* for each NLA-Track, apply scale of all selected strips */
@@ -1802,18 +1839,21 @@ static int nlaedit_sync_actlen_exec(bContext *C, wmOperator *op)
for (strip = nlt->strips.first; strip; strip = strip->next) {
/* strip selection/active status check */
if (active_only) {
- if ((strip->flag & NLASTRIP_FLAG_ACTIVE) == 0)
+ if ((strip->flag & NLASTRIP_FLAG_ACTIVE) == 0) {
continue;
+ }
}
else {
- if ((strip->flag & NLASTRIP_FLAG_SELECT) == 0)
+ if ((strip->flag & NLASTRIP_FLAG_SELECT) == 0) {
continue;
+ }
}
/* must be action-clip only (transitions don't have scale) */
if (strip->type == NLASTRIP_TYPE_CLIP) {
- if (strip->act == NULL)
+ if (strip->act == NULL) {
continue;
+ }
/* recalculate the length of the action */
calc_action_range(strip->act, &strip->actstart, &strip->actend, 0);
@@ -1874,8 +1914,9 @@ static int nlaedit_make_single_user_exec(bContext *C, wmOperator *UNUSED(op))
bool copied = false;
/* get editor data */
- if (ANIM_animdata_get_context(C, &ac) == 0)
+ if (ANIM_animdata_get_context(C, &ac) == 0) {
return OPERATOR_CANCELLED;
+ }
/* get a list of the editable tracks being shown in the NLA */
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_FOREDIT);
@@ -1892,8 +1933,9 @@ static int nlaedit_make_single_user_exec(bContext *C, wmOperator *UNUSED(op))
for (strip = nlt->strips.last; strip; strip = strip->prev) {
/* must be action-clip only (as only these have actions) */
if ((strip->flag & NLASTRIP_FLAG_SELECT) && (strip->type == NLASTRIP_TYPE_CLIP)) {
- if (strip->act == NULL)
+ if (strip->act == NULL) {
continue;
+ }
/* multi-user? */
if (ID_REAL_USERS(strip->act) > 1) {
@@ -1975,8 +2017,9 @@ static int nlaedit_apply_scale_exec(bContext *C, wmOperator *UNUSED(op))
KeyframeEditData ked = {{NULL}};
/* get editor data */
- if (ANIM_animdata_get_context(C, &ac) == 0)
+ if (ANIM_animdata_get_context(C, &ac) == 0) {
return OPERATOR_CANCELLED;
+ }
/* get a list of the editable tracks being shown in the NLA */
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_FOREDIT);
@@ -1993,8 +2036,9 @@ static int nlaedit_apply_scale_exec(bContext *C, wmOperator *UNUSED(op))
if ((strip->flag & NLASTRIP_FLAG_SELECT) && (strip->type == NLASTRIP_TYPE_CLIP)) {
/* if the referenced action is used by other strips,
* make this strip use its own copy */
- if (strip->act == NULL)
+ if (strip->act == NULL) {
continue;
+ }
if (strip->act->id.us > 1) {
/* make a copy of the Action to work on */
bAction *act = BKE_action_copy(bmain, strip->act);
@@ -2067,8 +2111,9 @@ static int nlaedit_clear_scale_exec(bContext *C, wmOperator *UNUSED(op))
int filter;
/* get editor data */
- if (ANIM_animdata_get_context(C, &ac) == 0)
+ if (ANIM_animdata_get_context(C, &ac) == 0) {
return OPERATOR_CANCELLED;
+ }
/* get a list of the editable tracks being shown in the NLA */
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_FOREDIT);
@@ -2145,8 +2190,9 @@ static int nlaedit_snap_exec(bContext *C, wmOperator *op)
float secf;
/* get editor data */
- if (ANIM_animdata_get_context(C, &ac) == 0)
+ if (ANIM_animdata_get_context(C, &ac) == 0) {
return OPERATOR_CANCELLED;
+ }
/* get a list of the editable tracks being shown in the NLA */
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_FOREDIT);
@@ -2294,10 +2340,12 @@ static const EnumPropertyItem *nla_fmodifier_itemf(bContext *C,
int index;
/* check if modifier is valid for this context */
- if (fmi == NULL)
+ if (fmi == NULL) {
continue;
- if (i == FMODIFIER_TYPE_CYCLES) /* we already have repeat... */
+ }
+ if (i == FMODIFIER_TYPE_CYCLES) { /* we already have repeat... */
continue;
+ }
index = RNA_enum_from_value(rna_enum_fmodifier_type_items, fmi->type);
if (index != -1) { /* Not all types are implemented yet... */
@@ -2324,8 +2372,9 @@ static int nla_fmodifier_add_exec(bContext *C, wmOperator *op)
const bool active_only = RNA_boolean_get(op->ptr, "only_active");
/* get editor data */
- if (ANIM_animdata_get_context(C, &ac) == 0)
+ if (ANIM_animdata_get_context(C, &ac) == 0) {
return OPERATOR_CANCELLED;
+ }
/* get a list of the editable tracks being shown in the NLA */
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_FOREDIT);
@@ -2340,18 +2389,21 @@ static int nla_fmodifier_add_exec(bContext *C, wmOperator *op)
/* can F-Modifier be added to the current strip? */
if (active_only) {
/* if not active, cannot add since we're only adding to active strip */
- if ((strip->flag & NLASTRIP_FLAG_ACTIVE) == 0)
+ if ((strip->flag & NLASTRIP_FLAG_ACTIVE) == 0) {
continue;
+ }
}
else {
/* strip must be selected, since we're not just doing active */
- if ((strip->flag & NLASTRIP_FLAG_SELECT) == 0)
+ if ((strip->flag & NLASTRIP_FLAG_SELECT) == 0) {
continue;
+ }
}
/* sound clips are not affected by FModifiers */
- if (strip->type == NLASTRIP_TYPE_SOUND)
+ if (strip->type == NLASTRIP_TYPE_SOUND) {
continue;
+ }
/* add F-Modifier of specified type to selected, and make it the active one */
fcm = add_fmodifier(&strip->modifiers, type, NULL);
@@ -2418,8 +2470,9 @@ static int nla_fmodifier_copy_exec(bContext *C, wmOperator *op)
bool ok = false;
/* get editor data */
- if (ANIM_animdata_get_context(C, &ac) == 0)
+ if (ANIM_animdata_get_context(C, &ac) == 0) {
return OPERATOR_CANCELLED;
+ }
/* clear buffer first */
ANIM_fmodifiers_copybuf_free();
@@ -2435,8 +2488,9 @@ static int nla_fmodifier_copy_exec(bContext *C, wmOperator *op)
for (strip = nlt->strips.first; strip; strip = strip->next) {
/* only add F-Modifier if on active strip? */
- if ((strip->flag & NLASTRIP_FLAG_ACTIVE) == 0)
+ if ((strip->flag & NLASTRIP_FLAG_ACTIVE) == 0) {
continue;
+ }
// TODO: when 'active' vs 'all' boolean is added, change last param!
ok |= ANIM_fmodifiers_copy_to_buf(&strip->modifiers, 0);
@@ -2494,8 +2548,9 @@ static int nla_fmodifier_paste_exec(bContext *C, wmOperator *op)
const bool replace = RNA_boolean_get(op->ptr, "replace");
/* get editor data */
- if (ANIM_animdata_get_context(C, &ac) == 0)
+ if (ANIM_animdata_get_context(C, &ac) == 0) {
return OPERATOR_CANCELLED;
+ }
/* get a list of the editable tracks being shown in the NLA */
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_FOREDIT |
@@ -2511,13 +2566,15 @@ static int nla_fmodifier_paste_exec(bContext *C, wmOperator *op)
/* can F-Modifier be added to the current strip? */
if (active_only) {
/* if not active, cannot add since we're only adding to active strip */
- if ((strip->flag & NLASTRIP_FLAG_ACTIVE) == 0)
+ if ((strip->flag & NLASTRIP_FLAG_ACTIVE) == 0) {
continue;
+ }
}
else {
/* strip must be selected, since we're not just doing active */
- if ((strip->flag & NLASTRIP_FLAG_SELECT) == 0)
+ if ((strip->flag & NLASTRIP_FLAG_SELECT) == 0) {
continue;
+ }
}
/* paste FModifiers from buffer */
diff --git a/source/blender/editors/space_nla/nla_ops.c b/source/blender/editors/space_nla/nla_ops.c
index 9c2eb541f52..55470388e22 100644
--- a/source/blender/editors/space_nla/nla_ops.c
+++ b/source/blender/editors/space_nla/nla_ops.c
@@ -56,12 +56,14 @@ bool nlaop_poll_tweakmode_off(bContext *C)
* but not all AnimData blocks will be in tweakmode for
* various reasons
*/
- if (ED_operator_nla_active(C) == 0)
+ if (ED_operator_nla_active(C) == 0) {
return 0;
+ }
scene = CTX_data_scene(C);
- if ((scene == NULL) || (scene->flag & SCE_NLA_EDIT_ON))
+ if ((scene == NULL) || (scene->flag & SCE_NLA_EDIT_ON)) {
return 0;
+ }
return 1;
}
@@ -78,12 +80,14 @@ bool nlaop_poll_tweakmode_on(bContext *C)
* but not all AnimData blocks will be in tweakmode for
* various reasons
*/
- if (ED_operator_nla_active(C) == 0)
+ if (ED_operator_nla_active(C) == 0) {
return 0;
+ }
scene = CTX_data_scene(C);
- if ((scene == NULL) || !(scene->flag & SCE_NLA_EDIT_ON))
+ if ((scene == NULL) || !(scene->flag & SCE_NLA_EDIT_ON)) {
return 0;
+ }
return 1;
}
@@ -91,8 +95,9 @@ bool nlaop_poll_tweakmode_on(bContext *C)
/* is tweakmode enabled - for use in NLA operator code */
bool nlaedit_is_tweakmode_on(bAnimContext *ac)
{
- if (ac && ac->scene)
+ if (ac && ac->scene) {
return (ac->scene->flag & SCE_NLA_EDIT_ON) != 0;
+ }
return 0;
}
diff --git a/source/blender/editors/space_nla/nla_select.c b/source/blender/editors/space_nla/nla_select.c
index c872ae3e182..cb54129a820 100644
--- a/source/blender/editors/space_nla/nla_select.c
+++ b/source/blender/editors/space_nla/nla_select.c
@@ -119,8 +119,9 @@ static void deselect_nla_strips(bAnimContext *ac, short test, short sel)
}
}
- if (sel == SELECT_SUBTRACT)
+ if (sel == SELECT_SUBTRACT) {
break;
+ }
}
}
@@ -135,8 +136,9 @@ static void deselect_nla_strips(bAnimContext *ac, short test, short sel)
/* apply same selection to all strips */
for (strip = nlt->strips.first; strip; strip = strip->next) {
/* set selection */
- if (test != DESELECT_STRIPS_CLEARACTIVE)
+ if (test != DESELECT_STRIPS_CLEARACTIVE) {
ACHANNEL_SET_FLAG(strip, smode, NLASTRIP_FLAG_SELECT);
+ }
/* clear active flag */
/* TODO: for clear active,
@@ -156,8 +158,9 @@ static int nlaedit_deselectall_exec(bContext *C, wmOperator *op)
bAnimContext ac;
/* get editor data */
- if (ANIM_animdata_get_context(C, &ac) == 0)
+ if (ANIM_animdata_get_context(C, &ac) == 0) {
return OPERATOR_CANCELLED;
+ }
/* 'standard' behavior - check if selected, then apply relevant selection */
const int action = RNA_enum_get(op->ptr, "action");
@@ -284,8 +287,9 @@ static int nlaedit_box_select_exec(bContext *C, wmOperator *op)
short mode = 0;
/* get editor data */
- if (ANIM_animdata_get_context(C, &ac) == 0)
+ if (ANIM_animdata_get_context(C, &ac) == 0) {
return OPERATOR_CANCELLED;
+ }
const eSelectOp sel_op = RNA_enum_get(op->ptr, "mode");
const int selectmode = (sel_op != SEL_OP_SUB) ? SELECT_ADD : SELECT_SUBTRACT;
@@ -305,13 +309,16 @@ static int nlaedit_box_select_exec(bContext *C, wmOperator *op)
* as frame-range one is often.
* Used for tweaking timing when "blocking", while channels is not that useful.
*/
- if (BLI_rcti_size_x(&rect) >= BLI_rcti_size_y(&rect))
+ if (BLI_rcti_size_x(&rect) >= BLI_rcti_size_y(&rect)) {
mode = NLA_BOXSEL_FRAMERANGE;
- else
+ }
+ else {
mode = NLA_BOXSEL_CHANNELS;
+ }
}
- else
+ else {
mode = NLA_BOXSEL_ALLSTRIPS;
+ }
/* apply box_select action */
box_select_nla_strips(&ac, rect, mode, selectmode);
@@ -373,8 +380,9 @@ static void nlaedit_select_leftright(bContext *C,
float xmin, xmax;
/* if currently in tweakmode, exit tweakmode first */
- if (scene->flag & SCE_NLA_EDIT_ON)
+ if (scene->flag & SCE_NLA_EDIT_ON) {
WM_operator_name_call(C, "NLA_OT_tweakmode_exit", WM_OP_EXEC_DEFAULT, NULL);
+ }
/* if select mode is replace, deselect all keyframes (and channels) first */
if (select_mode == SELECT_REPLACE) {
@@ -428,18 +436,22 @@ static int nlaedit_select_leftright_exec(bContext *C, wmOperator *op)
short selectmode;
/* get editor data */
- if (ANIM_animdata_get_context(C, &ac) == 0)
+ if (ANIM_animdata_get_context(C, &ac) == 0) {
return OPERATOR_CANCELLED;
+ }
/* select mode is either replace (deselect all, then add) or add/extend */
- if (RNA_boolean_get(op->ptr, "extend"))
+ if (RNA_boolean_get(op->ptr, "extend")) {
selectmode = SELECT_INVERT;
- else
+ }
+ else {
selectmode = SELECT_REPLACE;
+ }
/* if "test" mode is set, we don't have any info to set this with */
- if (leftright == NLAEDIT_LRSEL_TEST)
+ if (leftright == NLAEDIT_LRSEL_TEST) {
return OPERATOR_CANCELLED;
+ }
/* do the selecting now */
nlaedit_select_leftright(C, &ac, leftright, selectmode);
@@ -457,8 +469,9 @@ static int nlaedit_select_leftright_invoke(bContext *C, wmOperator *op, const wm
short leftright = RNA_enum_get(op->ptr, "mode");
/* get editor data */
- if (ANIM_animdata_get_context(C, &ac) == 0)
+ if (ANIM_animdata_get_context(C, &ac) == 0) {
return OPERATOR_CANCELLED;
+ }
/* handle mode-based testing */
if (leftright == NLAEDIT_LRSEL_TEST) {
@@ -469,10 +482,12 @@ static int nlaedit_select_leftright_invoke(bContext *C, wmOperator *op, const wm
/* determine which side of the current frame mouse is on */
x = UI_view2d_region_to_view_x(v2d, event->mval[0]);
- if (x < CFRA)
+ if (x < CFRA) {
RNA_enum_set(op->ptr, "mode", NLAEDIT_LRSEL_LEFT);
- else
+ }
+ else {
RNA_enum_set(op->ptr, "mode", NLAEDIT_LRSEL_RIGHT);
+ }
}
/* perform selection */
@@ -562,8 +577,9 @@ static void mouse_nla_strips(bContext *C, bAnimContext *ac, const int mval[2], s
/* loop over NLA-strips in this track,
* trying to find one which occurs in the necessary bounds */
for (strip = nlt->strips.first; strip; strip = strip->next) {
- if (BKE_nlastrip_within_bounds(strip, xmin, xmax))
+ if (BKE_nlastrip_within_bounds(strip, xmin, xmax)) {
break;
+ }
}
}
@@ -578,8 +594,9 @@ static void mouse_nla_strips(bContext *C, bAnimContext *ac, const int mval[2], s
/* if currently in tweakmode, exit tweakmode before changing selection states
* now that we've found our target...
*/
- if (scene->flag & SCE_NLA_EDIT_ON)
+ if (scene->flag & SCE_NLA_EDIT_ON) {
WM_operator_name_call(C, "NLA_OT_tweakmode_exit", WM_OP_EXEC_DEFAULT, NULL);
+ }
/* for replacing selection, firstly need to clear existing selection */
if (select_mode == SELECT_REPLACE) {
@@ -636,8 +653,9 @@ static int nlaedit_clickselect_invoke(bContext *C, wmOperator *op, const wmEvent
short selectmode;
/* get editor data */
- if (ANIM_animdata_get_context(C, &ac) == 0)
+ if (ANIM_animdata_get_context(C, &ac) == 0) {
return OPERATOR_CANCELLED;
+ }
/* get useful pointers from animation context data */
/* scene= ac.scene; */ /* UNUSED */
@@ -645,10 +663,12 @@ static int nlaedit_clickselect_invoke(bContext *C, wmOperator *op, const wmEvent
// v2d= &ar->v2d;
/* select mode is either replace (deselect all, then add) or add/extend */
- if (RNA_boolean_get(op->ptr, "extend"))
+ if (RNA_boolean_get(op->ptr, "extend")) {
selectmode = SELECT_INVERT;
- else
+ }
+ else {
selectmode = SELECT_REPLACE;
+ }
/* select strips based upon mouse position */
mouse_nla_strips(C, &ac, event->mval, selectmode);
diff --git a/source/blender/editors/space_nla/space_nla.c b/source/blender/editors/space_nla/space_nla.c
index 26a7b42efd2..527a4f6e5f6 100644
--- a/source/blender/editors/space_nla/space_nla.c
+++ b/source/blender/editors/space_nla/space_nla.c
@@ -272,15 +272,17 @@ static void nla_main_region_draw(const bContext *C, ARegion *ar)
UI_view2d_view_ortho(v2d);
/* current frame */
- if (snla->flag & SNLA_DRAWTIME)
+ if (snla->flag & SNLA_DRAWTIME) {
cfra_flag |= DRAWCFRA_UNIT_SECONDS;
+ }
ANIM_draw_cfra(C, v2d, cfra_flag);
/* markers */
UI_view2d_view_orthoSpecial(ar, v2d, 1);
int marker_draw_flag = DRAW_MARKERS_MARGIN;
- if (snla->flag & SNLA_SHOW_MARKER_LINES)
+ if (snla->flag & SNLA_SHOW_MARKER_LINES) {
marker_draw_flag |= DRAW_MARKERS_LINES;
+ }
ED_markers_draw(C, marker_draw_flag);
/* preview range */
@@ -364,8 +366,9 @@ static void nla_region_listener(wmWindow *UNUSED(win),
}
break;
default:
- if (wmn->data == ND_KEYS)
+ if (wmn->data == ND_KEYS) {
ED_region_tag_redraw(ar);
+ }
break;
}
}
@@ -410,8 +413,9 @@ static void nla_main_region_listener(wmWindow *UNUSED(win),
}
break;
case NC_ID:
- if (wmn->action == NA_RENAME)
+ if (wmn->action == NA_RENAME) {
ED_region_tag_redraw(ar);
+ }
break;
case NC_SCREEN:
if (ELEM(wmn->data, ND_LAYER)) {
@@ -419,8 +423,9 @@ static void nla_main_region_listener(wmWindow *UNUSED(win),
}
break;
default:
- if (wmn->data == ND_KEYS)
+ if (wmn->data == ND_KEYS) {
ED_region_tag_redraw(ar);
+ }
break;
}
}
@@ -495,12 +500,14 @@ static void nla_channel_region_listener(wmWindow *UNUSED(win),
}
break;
case NC_ID:
- if (wmn->action == NA_RENAME)
+ if (wmn->action == NA_RENAME) {
ED_region_tag_redraw(ar);
+ }
break;
default:
- if (wmn->data == ND_KEYS)
+ if (wmn->data == ND_KEYS) {
ED_region_tag_redraw(ar);
+ }
break;
}
}
@@ -570,8 +577,9 @@ static void nla_listener(wmWindow *UNUSED(win), ScrArea *sa, wmNotifier *wmn, Sc
}
break;
case NC_SPACE:
- if (wmn->data == ND_SPACE_NLA)
+ if (wmn->data == ND_SPACE_NLA) {
ED_area_tag_redraw(sa);
+ }
break;
}
}