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_action
parentbba60bb564cf5a16cfcac744d4ba82cf8eba3da9 (diff)
Cleanup: style, use braces for editors
Diffstat (limited to 'source/blender/editors/space_action')
-rw-r--r--source/blender/editors/space_action/action_data.c21
-rw-r--r--source/blender/editors/space_action/action_draw.c27
-rw-r--r--source/blender/editors/space_action/action_edit.c114
-rw-r--r--source/blender/editors/space_action/action_select.c111
-rw-r--r--source/blender/editors/space_action/space_action.c36
5 files changed, 206 insertions, 103 deletions
diff --git a/source/blender/editors/space_action/action_data.c b/source/blender/editors/space_action/action_data.c
index da48a7a9fa1..db504272d2f 100644
--- a/source/blender/editors/space_action/action_data.c
+++ b/source/blender/editors/space_action/action_data.c
@@ -127,10 +127,12 @@ static bAction *action_create_new(bContext *C, bAction *oldact)
if (sa->spacetype == SPACE_ACTION) {
SpaceAction *saction = (SpaceAction *)sa->spacedata.first;
- if (saction->mode == SACTCONT_SHAPEKEY)
+ if (saction->mode == SACTCONT_SHAPEKEY) {
action->idroot = ID_KE;
- else
+ }
+ else {
action->idroot = ID_OB;
+ }
}
return action;
@@ -180,15 +182,17 @@ static bool action_new_poll(bContext *C)
if (saction->mode == SACTCONT_ACTION) {
/* XXX: This assumes that actions are assigned to the active object in this mode */
if (ob) {
- if ((ob->adt == NULL) || (ob->adt->flag & ADT_NLA_EDIT_ON) == 0)
+ if ((ob->adt == NULL) || (ob->adt->flag & ADT_NLA_EDIT_ON) == 0) {
return true;
+ }
}
}
else if (saction->mode == SACTCONT_SHAPEKEY) {
Key *key = BKE_key_from_object(ob);
if (key) {
- if ((key->adt == NULL) || (key->adt->flag & ADT_NLA_EDIT_ON) == 0)
+ if ((key->adt == NULL) || (key->adt->flag & ADT_NLA_EDIT_ON) == 0) {
return true;
+ }
}
}
}
@@ -300,8 +304,9 @@ static bool action_pushdown_poll(bContext *C)
/* NOTE: We check this for the AnimData block in question and not the global flag,
* as the global flag may be left dirty by some of the browsing ops here.
*/
- if (!(adt->flag & ADT_NLA_EDIT_ON))
+ if (!(adt->flag & ADT_NLA_EDIT_ON)) {
return true;
+ }
}
}
@@ -432,8 +437,9 @@ static bool action_stash_create_poll(bContext *C)
/* NOTE: unlike for pushdown,
* this operator needs to be run when creating an action from nothing... */
if (adt) {
- if (!(adt->flag & ADT_NLA_EDIT_ON))
+ if (!(adt->flag & ADT_NLA_EDIT_ON)) {
return true;
+ }
}
else {
/* There may not be any action/animdata yet, so, just fallback to the global setting
@@ -628,8 +634,9 @@ static bool action_unlink_poll(bContext *C)
AnimData *adt = ED_actedit_animdata_from_context(C);
/* Only when there's an active action, in the right modes... */
- if (saction->action && adt)
+ if (saction->action && adt) {
return true;
+ }
}
/* something failed... */
diff --git a/source/blender/editors/space_action/action_draw.c b/source/blender/editors/space_action/action_draw.c
index a517aa3573c..9827967f947 100644
--- a/source/blender/editors/space_action/action_draw.c
+++ b/source/blender/editors/space_action/action_draw.c
@@ -210,8 +210,9 @@ void draw_channel_strips(bAnimContext *ac, SpaceAction *saction, ARegion *ar)
/* determine if any need to draw channel */
if (ale->datatype != ALE_NONE) {
/* determine if channel is selected */
- if (acf->has_setting(ac, ale, ACHANNEL_SETTING_SELECT))
+ if (acf->has_setting(ac, ale, ACHANNEL_SETTING_SELECT)) {
sel = ANIM_channel_setting_get(ac, ale, ACHANNEL_SETTING_SELECT);
+ }
if (ELEM(ac->datatype, ANIMCONT_ACTION, ANIMCONT_DOPESHEET, ANIMCONT_SHAPEKEY)) {
switch (ale->type) {
@@ -407,8 +408,9 @@ void timeline_draw_cache(SpaceAction *saction, Object *ob, Scene *scene)
const float cache_draw_height = (4.0f * UI_DPI_FAC * U.pixelsize);
float yoffs = 0.f;
- if (!(saction->cache_display & TIME_CACHE_DISPLAY) || (!ob))
+ if (!(saction->cache_display & TIME_CACHE_DISPLAY) || (!ob)) {
return;
+ }
BKE_ptcache_ids_from_object(&pidlist, ob, scene, 0);
@@ -421,34 +423,41 @@ void timeline_draw_cache(SpaceAction *saction, Object *ob, Scene *scene)
switch (pid->type) {
case PTCACHE_TYPE_SOFTBODY:
- if (!(saction->cache_display & TIME_CACHE_SOFTBODY))
+ if (!(saction->cache_display & TIME_CACHE_SOFTBODY)) {
continue;
+ }
break;
case PTCACHE_TYPE_PARTICLES:
- if (!(saction->cache_display & TIME_CACHE_PARTICLES))
+ if (!(saction->cache_display & TIME_CACHE_PARTICLES)) {
continue;
+ }
break;
case PTCACHE_TYPE_CLOTH:
- if (!(saction->cache_display & TIME_CACHE_CLOTH))
+ if (!(saction->cache_display & TIME_CACHE_CLOTH)) {
continue;
+ }
break;
case PTCACHE_TYPE_SMOKE_DOMAIN:
case PTCACHE_TYPE_SMOKE_HIGHRES:
- if (!(saction->cache_display & TIME_CACHE_SMOKE))
+ if (!(saction->cache_display & TIME_CACHE_SMOKE)) {
continue;
+ }
break;
case PTCACHE_TYPE_DYNAMICPAINT:
- if (!(saction->cache_display & TIME_CACHE_DYNAMICPAINT))
+ if (!(saction->cache_display & TIME_CACHE_DYNAMICPAINT)) {
continue;
+ }
break;
case PTCACHE_TYPE_RIGIDBODY:
- if (!(saction->cache_display & TIME_CACHE_RIGIDBODY))
+ if (!(saction->cache_display & TIME_CACHE_RIGIDBODY)) {
continue;
+ }
break;
}
- if (pid->cache->cached_frames == NULL)
+ if (pid->cache->cached_frames == NULL) {
continue;
+ }
GPU_matrix_push();
GPU_matrix_translate_2f(0.0, (float)V2D_SCROLL_HEIGHT_TEXT + yoffs);
diff --git a/source/blender/editors/space_action/action_edit.c b/source/blender/editors/space_action/action_edit.c
index e504a4ef9c0..93beb3e851e 100644
--- a/source/blender/editors/space_action/action_edit.c
+++ b/source/blender/editors/space_action/action_edit.c
@@ -86,18 +86,22 @@ static bool act_markers_make_local_poll(bContext *C)
SpaceAction *sact = CTX_wm_space_action(C);
/* 1) */
- if (sact == NULL)
+ if (sact == NULL) {
return 0;
+ }
/* 2) */
- if (ELEM(sact->mode, SACTCONT_ACTION, SACTCONT_SHAPEKEY) == 0)
+ if (ELEM(sact->mode, SACTCONT_ACTION, SACTCONT_SHAPEKEY) == 0) {
return 0;
- if (sact->action == NULL)
+ }
+ if (sact->action == NULL) {
return 0;
+ }
/* 3) */
- if (sact->flag & SACTION_POSEMARKERS_SHOW)
+ if (sact->flag & SACTION_POSEMARKERS_SHOW) {
return 0;
+ }
/* 4) */
return ED_markers_get_first_selected(ED_context_get_markers(C)) != NULL;
@@ -113,8 +117,9 @@ static int act_markers_make_local_exec(bContext *C, wmOperator *UNUSED(op))
TimeMarker *marker, *markern = NULL;
/* sanity checks */
- if (ELEM(NULL, markers, act))
+ if (ELEM(NULL, markers, act)) {
return OPERATOR_CANCELLED;
+ }
/* migrate markers */
for (marker = markers->first; marker; marker = markern) {
@@ -260,12 +265,15 @@ static int actkeys_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_keyframe_extents(&ac, &min, &max, false);
@@ -364,15 +372,17 @@ static int actkeys_viewall(bContext *C, const bool only_sel)
bool found;
/* 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 */
found = get_keyframe_extents(&ac, &min, &max, only_sel);
- if (only_sel && (found == false))
+ if (only_sel && (found == false)) {
return OPERATOR_CANCELLED;
+ }
if (fabsf(max - min) < 1.0f) {
/* Exception - center the single keyfrme */
@@ -558,8 +568,9 @@ static int actkeys_copy_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;
+ }
/* copy keyframes */
if (ac.datatype == ANIMCONT_GPENCIL) {
@@ -607,8 +618,9 @@ static int actkeys_paste_exec(bContext *C, wmOperator *op)
const bool flipped = RNA_boolean_get(op->ptr, "flipped");
/* get editor data */
- if (ANIM_animdata_get_context(C, &ac) == 0)
+ if (ANIM_animdata_get_context(C, &ac) == 0) {
return OPERATOR_CANCELLED;
+ }
/* ac.reports by default will be the global reports list, which won't show warnings */
ac.reports = op->reports;
@@ -745,8 +757,9 @@ static void insert_action_keys(bAnimContext *ac, short mode)
AnimData *adt = ANIM_nla_mapping_get(ac, ale);
/* adjust current frame for NLA-scaling */
- if (adt)
+ if (adt) {
cfra = BKE_nla_tweakedit_remap(adt, (float)CFRA, NLATIME_CONVERT_UNMAP);
+ }
const float curval = evaluate_fcurve(fcu, cfra);
insert_vert_fcurve(fcu, cfra, curval, ts->keyframe_type, 0);
@@ -775,16 +788,19 @@ static void insert_gpencil_keys(bAnimContext *ac, short mode)
/* filter data */
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_FOREDIT |
ANIMFILTER_NODUPLIS);
- if (mode == 2)
+ if (mode == 2) {
filter |= ANIMFILTER_SEL;
+ }
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
/* add a copy or a blank frame? */
- if (ts->gpencil_flags & GP_TOOL_FLAG_RETAIN_LAST)
+ if (ts->gpencil_flags & GP_TOOL_FLAG_RETAIN_LAST) {
add_frame_mode = GP_GETFRAME_ADD_COPY; /* XXX: actframe may not be what we want? */
- else
+ }
+ else {
add_frame_mode = GP_GETFRAME_ADD_NEW;
+ }
/* insert gp frames */
for (ale = anim_data.first; ale; ale = ale->next) {
@@ -804,8 +820,9 @@ static int actkeys_insertkey_exec(bContext *C, wmOperator *op)
short mode;
/* get editor data */
- if (ANIM_animdata_get_context(C, &ac) == 0)
+ if (ANIM_animdata_get_context(C, &ac) == 0) {
return OPERATOR_CANCELLED;
+ }
if (ac.datatype == ANIMCONT_MASK) {
BKE_report(op->reports, RPT_ERROR, "Insert Keyframes is not yet implemented for this mode");
@@ -869,14 +886,18 @@ static void duplicate_action_keys(bAnimContext *ac)
/* loop through filtered data and delete selected keys */
for (ale = anim_data.first; ale; ale = ale->next) {
- if (ELEM(ale->type, ANIMTYPE_FCURVE, ANIMTYPE_NLACURVE))
+ if (ELEM(ale->type, ANIMTYPE_FCURVE, ANIMTYPE_NLACURVE)) {
duplicate_fcurve_keys((FCurve *)ale->key_data);
- else if (ale->type == ANIMTYPE_GPLAYER)
+ }
+ else if (ale->type == ANIMTYPE_GPLAYER) {
ED_gplayer_frames_duplicate((bGPDlayer *)ale->data);
- else if (ale->type == ANIMTYPE_MASKLAYER)
+ }
+ else if (ale->type == ANIMTYPE_MASKLAYER) {
ED_masklayer_frames_duplicate((MaskLayer *)ale->data);
- else
+ }
+ else {
BLI_assert(0);
+ }
ale->update |= ANIM_UPDATE_DEFAULT;
}
@@ -892,8 +913,9 @@ static int actkeys_duplicate_exec(bContext *C, wmOperator *UNUSED(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;
+ }
/* duplicate keyframes */
duplicate_action_keys(&ac);
@@ -983,12 +1005,14 @@ static int actkeys_delete_exec(bContext *C, wmOperator *UNUSED(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;
+ }
/* delete keyframes */
- if (!delete_action_keys(&ac))
+ if (!delete_action_keys(&ac)) {
return OPERATOR_CANCELLED;
+ }
/* set notifier that keyframes have changed */
WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_REMOVED, NULL);
@@ -1045,8 +1069,9 @@ static int actkeys_clean_exec(bContext *C, wmOperator *op)
bool clean_chan;
/* get editor data */
- if (ANIM_animdata_get_context(C, &ac) == 0)
+ if (ANIM_animdata_get_context(C, &ac) == 0) {
return OPERATOR_CANCELLED;
+ }
if (ELEM(ac.datatype, ANIMCONT_GPENCIL, ANIMCONT_MASK)) {
BKE_report(op->reports, RPT_ERROR, "Not implemented");
@@ -1119,8 +1144,9 @@ static int actkeys_sample_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;
+ }
if (ELEM(ac.datatype, ANIMCONT_GPENCIL, ANIMCONT_MASK)) {
BKE_report(op->reports, RPT_ERROR, "Not implemented");
@@ -1224,8 +1250,9 @@ static void setexpo_action_keys(bAnimContext *ac, short mode)
for (fcm = fcu->modifiers.first; fcm; fcm = fcn) {
fcn = fcm->next;
- if (fcm->type == FMODIFIER_TYPE_CYCLES)
+ if (fcm->type == FMODIFIER_TYPE_CYCLES) {
remove_fmodifier(&fcu->modifiers, fcm);
+ }
}
}
}
@@ -1245,8 +1272,9 @@ static int actkeys_expo_exec(bContext *C, wmOperator *op)
short mode;
/* get editor data */
- if (ANIM_animdata_get_context(C, &ac) == 0)
+ if (ANIM_animdata_get_context(C, &ac) == 0) {
return OPERATOR_CANCELLED;
+ }
if (ELEM(ac.datatype, ANIMCONT_GPENCIL, ANIMCONT_MASK)) {
BKE_report(op->reports, RPT_ERROR, "Not implemented");
@@ -1321,8 +1349,9 @@ static int actkeys_ipo_exec(bContext *C, wmOperator *op)
short mode;
/* get editor data */
- if (ANIM_animdata_get_context(C, &ac) == 0)
+ if (ANIM_animdata_get_context(C, &ac) == 0) {
return OPERATOR_CANCELLED;
+ }
if (ELEM(ac.datatype, ANIMCONT_GPENCIL, ANIMCONT_MASK)) {
BKE_report(op->reports, RPT_ERROR, "Not implemented");
@@ -1407,8 +1436,9 @@ static int actkeys_handletype_exec(bContext *C, wmOperator *op)
short mode;
/* get editor data */
- if (ANIM_animdata_get_context(C, &ac) == 0)
+ if (ANIM_animdata_get_context(C, &ac) == 0) {
return OPERATOR_CANCELLED;
+ }
if (ELEM(ac.datatype, ANIMCONT_GPENCIL, ANIMCONT_MASK)) {
BKE_report(op->reports, RPT_ERROR, "Not implemented");
@@ -1507,8 +1537,9 @@ static int actkeys_keytype_exec(bContext *C, wmOperator *op)
short mode;
/* get editor data */
- if (ANIM_animdata_get_context(C, &ac) == 0)
+ if (ANIM_animdata_get_context(C, &ac) == 0) {
return OPERATOR_CANCELLED;
+ }
if (ac.datatype == ANIMCONT_MASK) {
BKE_report(op->reports, RPT_ERROR, "Not implemented for Masks");
@@ -1559,8 +1590,9 @@ void ACTION_OT_keyframe_type(wmOperatorType *ot)
static bool actkeys_framejump_poll(bContext *C)
{
/* prevent changes during render */
- if (G.is_rendering)
+ if (G.is_rendering) {
return 0;
+ }
return ED_operator_action_active(C);
}
@@ -1575,8 +1607,9 @@ static int actkeys_framejump_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;
+ }
/* init edit data */
/* loop over action data, averaging values */
@@ -1591,8 +1624,9 @@ static int actkeys_framejump_exec(bContext *C, wmOperator *UNUSED(op))
ANIM_fcurve_keyframes_loop(&ked, ale->key_data, NULL, bezt_calc_average, NULL);
ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 1, 1);
}
- else
+ else {
ANIM_fcurve_keyframes_loop(&ked, ale->key_data, NULL, bezt_calc_average, NULL);
+ }
}
ANIM_animdata_freelist(&anim_data);
@@ -1716,8 +1750,9 @@ static int actkeys_snap_exec(bContext *C, wmOperator *op)
short mode;
/* get editor data */
- if (ANIM_animdata_get_context(C, &ac) == 0)
+ if (ANIM_animdata_get_context(C, &ac) == 0) {
return OPERATOR_CANCELLED;
+ }
/* get snapping mode */
mode = RNA_enum_get(op->ptr, "type");
@@ -1792,10 +1827,12 @@ static void mirror_action_keys(bAnimContext *ac, short mode)
if (mode == ACTKEYS_MIRROR_MARKER) {
TimeMarker *marker = ED_markers_get_first_selected(ac->markers);
- if (marker)
+ if (marker) {
ked.f1 = (float)marker->frame;
- else
+ }
+ else {
return;
+ }
}
/* filter data */
@@ -1843,8 +1880,9 @@ static int actkeys_mirror_exec(bContext *C, wmOperator *op)
short mode;
/* get editor data */
- if (ANIM_animdata_get_context(C, &ac) == 0)
+ if (ANIM_animdata_get_context(C, &ac) == 0) {
return OPERATOR_CANCELLED;
+ }
/* get mirroring mode */
mode = RNA_enum_get(op->ptr, "type");
diff --git a/source/blender/editors/space_action/action_select.c b/source/blender/editors/space_action/action_select.c
index 8afc9a43f6a..fb35afb6770 100644
--- a/source/blender/editors/space_action/action_select.c
+++ b/source/blender/editors/space_action/action_select.c
@@ -155,8 +155,9 @@ static int actkeys_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");
@@ -243,10 +244,12 @@ static void box_select_action(bAnimContext *ac, const rcti rect, short mode, sho
/* get beztriple editing/validation funcs */
select_cb = ANIM_editkeyframes_select(selectmode);
- if (ELEM(mode, ACTKEYS_BORDERSEL_FRAMERANGE, ACTKEYS_BORDERSEL_ALLKEYS))
+ if (ELEM(mode, ACTKEYS_BORDERSEL_FRAMERANGE, ACTKEYS_BORDERSEL_ALLKEYS)) {
ok_cb = ANIM_editkeyframes_ok(BEZT_OK_FRAMERANGE);
- else
+ }
+ else {
ok_cb = NULL;
+ }
/* init editing data */
memset(&ked, 0, sizeof(KeyframeEditData));
@@ -352,13 +355,16 @@ static int actkeys_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 = ACTKEYS_BORDERSEL_FRAMERANGE;
- else
+ }
+ else {
mode = ACTKEYS_BORDERSEL_CHANNELS;
+ }
}
- else
+ else {
mode = ACTKEYS_BORDERSEL_ALLKEYS;
+ }
/* apply box_select action */
box_select_action(&ac, rect, mode, selectmode);
@@ -535,13 +541,15 @@ static int actkeys_lassoselect_exec(bContext *C, wmOperator *op)
rctf rect_fl;
/* get editor data */
- if (ANIM_animdata_get_context(C, &ac) == 0)
+ if (ANIM_animdata_get_context(C, &ac) == 0) {
return OPERATOR_CANCELLED;
+ }
data_lasso.rectf_view = &rect_fl;
data_lasso.mcords = WM_gesture_lasso_path_to_array(C, op, &data_lasso.mcords_tot);
- if (data_lasso.mcords == NULL)
+ if (data_lasso.mcords == NULL) {
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;
@@ -600,8 +608,9 @@ static int action_circle_select_exec(bContext *C, wmOperator *op)
float radius = RNA_int_get(op->ptr, "radius");
/* 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 = ED_select_op_modal(RNA_enum_get(op->ptr, "mode"),
WM_gesture_is_modal_first(op->customdata));
@@ -747,15 +756,17 @@ static void columnselect_action_keys(bAnimContext *ac, short mode)
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE);
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
- for (ale = anim_data.first; ale; ale = ale->next)
+ for (ale = anim_data.first; ale; ale = ale->next) {
ED_gplayer_make_cfra_list(ale->data, &ked.list, 1);
+ }
}
else {
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE /*| ANIMFILTER_CURVESONLY*/);
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
- for (ale = anim_data.first; ale; ale = ale->next)
+ for (ale = anim_data.first; ale; ale = ale->next) {
ANIM_fcurve_keyframes_loop(&ked, ale->key_data, NULL, bezt_to_cfraelem, NULL);
+ }
}
ANIM_animdata_freelist(&anim_data);
break;
@@ -783,10 +794,12 @@ static void columnselect_action_keys(bAnimContext *ac, short mode)
/* loop through all of the keys and select additional keyframes
* based on the keys found to be selected above
*/
- if (ELEM(ac->datatype, ANIMCONT_GPENCIL, ANIMCONT_MASK))
+ if (ELEM(ac->datatype, ANIMCONT_GPENCIL, ANIMCONT_MASK)) {
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE);
- else
+ }
+ else {
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE /*| ANIMFILTER_CURVESONLY*/);
+ }
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
for (ale = anim_data.first; ale; ale = ale->next) {
@@ -797,10 +810,12 @@ static void columnselect_action_keys(bAnimContext *ac, short mode)
*/
for (ce = ked.list.first; ce; ce = ce->next) {
/* set frame for validation callback to refer to */
- if (adt)
+ if (adt) {
ked.f1 = BKE_nla_tweakedit_remap(adt, ce->cfra, NLATIME_CONVERT_UNMAP);
- else
+ }
+ else {
ked.f1 = ce->cfra;
+ }
/* select elements with frame number matching cfraelem */
if (ale->type == ANIMTYPE_GPLAYER) {
@@ -831,16 +846,19 @@ static int actkeys_columnselect_exec(bContext *C, wmOperator *op)
short mode;
/* get editor data */
- if (ANIM_animdata_get_context(C, &ac) == 0)
+ if (ANIM_animdata_get_context(C, &ac) == 0) {
return OPERATOR_CANCELLED;
+ }
/* action to take depends on the mode */
mode = RNA_enum_get(op->ptr, "mode");
- if (mode == ACTKEYS_COLUMNSEL_MARKERS_BETWEEN)
+ if (mode == ACTKEYS_COLUMNSEL_MARKERS_BETWEEN) {
markers_selectkeys_between(&ac);
- else
+ }
+ else {
columnselect_action_keys(&ac, mode);
+ }
/* set notifier that keyframe selection have changed */
WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_SELECTED, NULL);
@@ -880,8 +898,9 @@ static int actkeys_select_linked_exec(bContext *C, wmOperator *UNUSED(op))
KeyframeEditFunc sel_cb = ANIM_editkeyframes_select(SELECT_ADD);
/* get editor data */
- if (ANIM_animdata_get_context(C, &ac) == 0)
+ if (ANIM_animdata_get_context(C, &ac) == 0) {
return OPERATOR_CANCELLED;
+ }
/* loop through all of the keys and select additional keyframes based on these */
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE /*| ANIMFILTER_CURVESONLY*/ |
@@ -946,8 +965,9 @@ static void select_moreless_action_keys(bAnimContext *ac, short mode)
FCurve *fcu = (FCurve *)ale->key_data;
/* only continue if F-Curve has keyframes */
- if (fcu->bezt == NULL)
+ if (fcu->bezt == NULL) {
continue;
+ }
/* build up map of whether F-Curve's keyframes should be selected or not */
ked.data = MEM_callocN(fcu->totvert, "selmap actEdit more");
@@ -972,8 +992,9 @@ static int actkeys_select_more_exec(bContext *C, wmOperator *UNUSED(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;
+ }
/* perform select changes */
select_moreless_action_keys(&ac, SELMAP_MORE);
@@ -1006,8 +1027,9 @@ static int actkeys_select_less_exec(bContext *C, wmOperator *UNUSED(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;
+ }
/* perform select changes */
select_moreless_action_keys(&ac, SELMAP_LESS);
@@ -1144,18 +1166,22 @@ static int actkeys_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 == ACTKEYS_LRSEL_TEST)
+ if (leftright == ACTKEYS_LRSEL_TEST) {
return OPERATOR_CANCELLED;
+ }
/* do the selecting now */
actkeys_select_leftright(&ac, leftright, selectmode);
@@ -1173,8 +1199,9 @@ static int actkeys_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 == ACTKEYS_LRSEL_TEST) {
@@ -1185,10 +1212,12 @@ static int actkeys_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", ACTKEYS_LRSEL_LEFT);
- else
+ }
+ else {
RNA_enum_set(op->ptr, "mode", ACTKEYS_LRSEL_RIGHT);
+ }
}
/* perform selection */
@@ -1320,10 +1349,12 @@ static void actkeys_mselect_column(bAnimContext *ac, short select_mode, float se
AnimData *adt = ANIM_nla_mapping_get(ac, ale);
/* set frame for validation callback to refer to */
- if (adt)
+ if (adt) {
ked.f1 = BKE_nla_tweakedit_remap(adt, selx, NLATIME_CONVERT_UNMAP);
- else
+ }
+ else {
ked.f1 = selx;
+ }
/* select elements with frame number matching cfra */
if (ale->type == ANIMTYPE_GPLAYER) {
@@ -1411,8 +1442,9 @@ static void mouse_action_keys(
rctf rectf;
/* get dopesheet info */
- if (ELEM(ac->datatype, ANIMCONT_DOPESHEET, ANIMCONT_TIMELINE))
+ if (ELEM(ac->datatype, ANIMCONT_DOPESHEET, ANIMCONT_TIMELINE)) {
ads = ac->data;
+ }
/* use View2D to determine the index of the channel (i.e a row in the list) where keyframe was */
UI_view2d_region_to_view(v2d, mval[0], mval[1], &x, &y);
@@ -1509,10 +1541,12 @@ static void mouse_action_keys(
found = true;
break;
}
- else if (ak->cfra < rectf.xmin)
+ else if (ak->cfra < rectf.xmin) {
akn = ak->right;
- else
+ }
+ else {
akn = ak->left;
+ }
}
/* Remove active channel from list of channels for separate treatment
@@ -1623,17 +1657,20 @@ static int actkeys_clickselect_invoke(bContext *C, wmOperator *op, const wmEvent
bool column, channel;
/* 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 */
/* ar = ac.ar; */ /* UNUSED */
/* 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;
+ }
/* column selection */
column = RNA_boolean_get(op->ptr, "column");
diff --git a/source/blender/editors/space_action/space_action.c b/source/blender/editors/space_action/space_action.c
index d9545e51318..d6d46904db3 100644
--- a/source/blender/editors/space_action/space_action.c
+++ b/source/blender/editors/space_action/space_action.c
@@ -215,8 +215,9 @@ static void action_main_region_draw(const bContext *C, ARegion *ar)
}
/* current frame */
- if (saction->flag & SACTION_DRAWTIME)
+ if (saction->flag & SACTION_DRAWTIME) {
cfra_flag |= DRAWCFRA_UNIT_SECONDS;
+ }
ANIM_draw_cfra(C, v2d, cfra_flag);
/* markers */
@@ -224,8 +225,9 @@ static void action_main_region_draw(const bContext *C, ARegion *ar)
marker_flag = ((ac.markers && (ac.markers != &ac.scene->markers)) ? DRAW_MARKERS_LOCAL : 0) |
DRAW_MARKERS_MARGIN;
- if (saction->flag & SACTION_SHOW_MARKER_LINES)
+ if (saction->flag & SACTION_SHOW_MARKER_LINES) {
marker_flag |= DRAW_MARKERS_LINES;
+ }
ED_markers_draw(C, marker_flag);
/* caches */
@@ -336,22 +338,26 @@ static void action_channel_region_listener(wmWindow *UNUSED(win),
ED_region_tag_redraw(ar);
break;
case ND_MODIFIER:
- if (wmn->action == NA_RENAME)
+ if (wmn->action == NA_RENAME) {
ED_region_tag_redraw(ar);
+ }
break;
}
break;
case NC_GPENCIL:
- if (ELEM(wmn->action, NA_RENAME, NA_SELECTED))
+ if (ELEM(wmn->action, NA_RENAME, NA_SELECTED)) {
ED_region_tag_redraw(ar);
+ }
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;
}
}
@@ -443,8 +449,9 @@ static void action_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)) {
@@ -452,8 +459,9 @@ static void action_main_region_listener(wmWindow *UNUSED(win),
}
break;
default:
- if (wmn->data == ND_KEYS)
+ if (wmn->data == ND_KEYS) {
ED_region_tag_redraw(ar);
+ }
break;
}
}
@@ -661,8 +669,9 @@ static void action_header_region_listener(
switch (wmn->category) {
case NC_SCREEN:
if (saction->mode == SACTCONT_TIMELINE) {
- if (wmn->data == ND_ANIMPLAY)
+ if (wmn->data == ND_ANIMPLAY) {
ED_region_tag_redraw(ar);
+ }
}
break;
case NC_SCENE:
@@ -687,8 +696,9 @@ static void action_header_region_listener(
}
break;
case NC_ID:
- if (wmn->action == NA_RENAME)
+ if (wmn->action == NA_RENAME) {
ED_region_tag_redraw(ar);
+ }
break;
case NC_ANIMATION:
switch (wmn->data) {
@@ -754,8 +764,9 @@ static void action_region_listener(wmWindow *UNUSED(win),
}
break;
default:
- if (wmn->data == ND_KEYS)
+ if (wmn->data == ND_KEYS) {
ED_region_tag_redraw(ar);
+ }
break;
}
}
@@ -781,8 +792,9 @@ static void action_refresh(const bContext *C, ScrArea *sa)
* or else they don't update [#28962]
*/
ED_area_tag_redraw(sa);
- for (ar = sa->regionbase.first; ar; ar = ar->next)
+ for (ar = sa->regionbase.first; ar; ar = ar->next) {
ED_region_tag_redraw(ar);
+ }
}
/* region updates? */