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

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/editors/space_action/action_select.c')
-rw-r--r--source/blender/editors/space_action/action_select.c332
1 files changed, 166 insertions, 166 deletions
diff --git a/source/blender/editors/space_action/action_select.c b/source/blender/editors/space_action/action_select.c
index a28f8ee1b99..0c6b0f5eb3d 100644
--- a/source/blender/editors/space_action/action_select.c
+++ b/source/blender/editors/space_action/action_select.c
@@ -79,42 +79,42 @@
/* Deselects keyframes in the action editor
* - This is called by the deselect all operator, as well as other ones!
*
- * - test: check if select or deselect all
+ * - test: check if select or deselect all
* - sel: how to select keyframes (SELECT_*)
*/
-static void deselect_action_keys (bAnimContext *ac, short test, short sel)
+static void deselect_action_keys(bAnimContext *ac, short test, short sel)
{
ListBase anim_data = {NULL, NULL};
bAnimListElem *ale;
int filter;
- KeyframeEditData ked= {{NULL}};
+ KeyframeEditData ked = {{NULL}};
KeyframeEditFunc test_cb, sel_cb;
/* determine type-based settings */
if (ac->datatype == ANIMCONT_GPENCIL)
- filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_NODUPLIS);
+ filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_NODUPLIS);
else
- filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE /*| ANIMFILTER_CURVESONLY*/ | ANIMFILTER_NODUPLIS);
+ filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE /*| ANIMFILTER_CURVESONLY*/ | ANIMFILTER_NODUPLIS);
/* filter data */
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
/* init BezTriple looping data */
- test_cb= ANIM_editkeyframes_ok(BEZT_OK_SELECTED);
+ test_cb = ANIM_editkeyframes_ok(BEZT_OK_SELECTED);
/* See if we should be selecting or deselecting */
if (test) {
- for (ale= anim_data.first; ale; ale= ale->next) {
+ for (ale = anim_data.first; ale; ale = ale->next) {
if (ale->type == ANIMTYPE_GPLAYER) {
if (is_gplayer_frame_selected(ale->data)) {
- sel= SELECT_SUBTRACT;
+ sel = SELECT_SUBTRACT;
break;
}
}
else {
if (ANIM_fcurve_keyframes_loop(&ked, ale->key_data, NULL, test_cb, NULL)) {
- sel= SELECT_SUBTRACT;
+ sel = SELECT_SUBTRACT;
break;
}
}
@@ -122,10 +122,10 @@ static void deselect_action_keys (bAnimContext *ac, short test, short sel)
}
/* convert sel to selectmode, and use that to get editor */
- sel_cb= ANIM_editkeyframes_select(sel);
+ sel_cb = ANIM_editkeyframes_select(sel);
/* Now set the flags */
- for (ale= anim_data.first; ale; ale= ale->next) {
+ for (ale = anim_data.first; ale; ale = ale->next) {
if (ale->type == ANIMTYPE_GPLAYER)
set_gplayer_frame_selection(ale->data, sel);
else
@@ -153,7 +153,7 @@ static int actkeys_deselectall_exec(bContext *C, wmOperator *op)
deselect_action_keys(&ac, 1, SELECT_ADD);
/* set notifier that keyframe selection have changed */
- WM_event_add_notifier(C, NC_ANIMATION|ND_KEYFRAME|NA_SELECTED, NULL);
+ WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_SELECTED, NULL);
return OPERATOR_FINISHED;
}
@@ -170,7 +170,7 @@ void ACTION_OT_select_all_toggle(wmOperatorType *ot)
ot->poll = ED_operator_action_active;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* props */
ot->prop = RNA_def_boolean(ot->srna, "invert", 0, "Invert", "");
@@ -178,7 +178,7 @@ void ACTION_OT_select_all_toggle(wmOperatorType *ot)
/* ******************** Border Select Operator **************************** */
/* This operator currently works in one of three ways:
- * -> BKEY - 1) all keyframes within region are selected (ACTKEYS_BORDERSEL_ALLKEYS)
+ * -> BKEY - 1) all keyframes within region are selected (ACTKEYS_BORDERSEL_ALLKEYS)
* -> ALT-BKEY - depending on which axis of the region was larger...
* -> 2) x-axis, so select all frames within frame range (ACTKEYS_BORDERSEL_FRAMERANGE)
* -> 3) y-axis, so select all frames within channels that region included (ACTKEYS_BORDERSEL_CHANNELS)
@@ -186,13 +186,13 @@ void ACTION_OT_select_all_toggle(wmOperatorType *ot)
/* defines for borderselect mode */
enum {
- ACTKEYS_BORDERSEL_ALLKEYS = 0,
+ ACTKEYS_BORDERSEL_ALLKEYS = 0,
ACTKEYS_BORDERSEL_FRAMERANGE,
ACTKEYS_BORDERSEL_CHANNELS,
} /*eActKeys_BorderSelect_Mode*/;
-static void borderselect_action (bAnimContext *ac, rcti rect, short mode, short selectmode)
+static void borderselect_action(bAnimContext *ac, rcti rect, short mode, short selectmode)
{
ListBase anim_data = {NULL, NULL};
bAnimListElem *ale;
@@ -200,52 +200,52 @@ static void borderselect_action (bAnimContext *ac, rcti rect, short mode, short
KeyframeEditData ked;
KeyframeEditFunc ok_cb, select_cb;
- View2D *v2d= &ac->ar->v2d;
+ View2D *v2d = &ac->ar->v2d;
rctf rectf;
- float ymin=0, ymax=(float)(-ACHANNEL_HEIGHT_HALF);
+ float ymin = 0, ymax = (float)(-ACHANNEL_HEIGHT_HALF);
/* convert mouse coordinates to frame ranges and channel coordinates corrected for view pan/zoom */
- UI_view2d_region_to_view(v2d, rect.xmin, rect.ymin+2, &rectf.xmin, &rectf.ymin);
- UI_view2d_region_to_view(v2d, rect.xmax, rect.ymax-2, &rectf.xmax, &rectf.ymax);
+ UI_view2d_region_to_view(v2d, rect.xmin, rect.ymin + 2, &rectf.xmin, &rectf.ymin);
+ UI_view2d_region_to_view(v2d, rect.xmax, rect.ymax - 2, &rectf.xmax, &rectf.ymax);
/* filter data */
- filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_LIST_CHANNELS | ANIMFILTER_NODUPLIS);
+ filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_LIST_CHANNELS | ANIMFILTER_NODUPLIS);
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
/* get beztriple editing/validation funcs */
- select_cb= ANIM_editkeyframes_select(selectmode);
+ select_cb = ANIM_editkeyframes_select(selectmode);
if (ELEM(mode, ACTKEYS_BORDERSEL_FRAMERANGE, ACTKEYS_BORDERSEL_ALLKEYS))
- ok_cb= ANIM_editkeyframes_ok(BEZT_OK_FRAMERANGE);
+ ok_cb = ANIM_editkeyframes_ok(BEZT_OK_FRAMERANGE);
else
- ok_cb= NULL;
+ ok_cb = NULL;
/* init editing data */
memset(&ked, 0, sizeof(KeyframeEditData));
/* loop over data, doing border select */
- for (ale= anim_data.first; ale; ale= ale->next) {
- AnimData *adt= ANIM_nla_mapping_get(ac, ale);
+ for (ale = anim_data.first; ale; ale = ale->next) {
+ AnimData *adt = ANIM_nla_mapping_get(ac, ale);
/* get new vertical minimum extent of channel */
- ymin= ymax - ACHANNEL_STEP;
+ ymin = ymax - ACHANNEL_STEP;
/* set horizontal range (if applicable) */
if (ELEM(mode, ACTKEYS_BORDERSEL_FRAMERANGE, ACTKEYS_BORDERSEL_ALLKEYS)) {
/* if channel is mapped in NLA, apply correction */
if (adt) {
- ked.f1= BKE_nla_tweakedit_remap(adt, rectf.xmin, NLATIME_CONVERT_UNMAP);
- ked.f2= BKE_nla_tweakedit_remap(adt, rectf.xmax, NLATIME_CONVERT_UNMAP);
+ ked.f1 = BKE_nla_tweakedit_remap(adt, rectf.xmin, NLATIME_CONVERT_UNMAP);
+ ked.f2 = BKE_nla_tweakedit_remap(adt, rectf.xmax, NLATIME_CONVERT_UNMAP);
}
else {
- ked.f1= rectf.xmin;
- ked.f2= rectf.xmax;
+ ked.f1 = rectf.xmin;
+ ked.f2 = rectf.xmax;
}
}
/* perform vertical suitability check (if applicable) */
if ( (mode == ACTKEYS_BORDERSEL_FRAMERANGE) ||
- !((ymax < rectf.ymin) || (ymin > rectf.ymax)) )
+ !((ymax < rectf.ymin) || (ymin > rectf.ymax)) )
{
/* loop over data selecting */
if (ale->type == ANIMTYPE_GPLAYER)
@@ -255,7 +255,7 @@ static void borderselect_action (bAnimContext *ac, rcti rect, short mode, short
}
/* set minimum extent to be the maximum of the next channel */
- ymax=ymin;
+ ymax = ymin;
}
/* cleanup */
@@ -268,7 +268,7 @@ static int actkeys_borderselect_exec(bContext *C, wmOperator *op)
{
bAnimContext ac;
rcti rect;
- short mode=0, selectmode=0;
+ short mode = 0, selectmode = 0;
int gesture_mode, extend;
/* get editor data */
@@ -276,7 +276,7 @@ static int actkeys_borderselect_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
/* clear all selection if not extending selection */
- extend= RNA_boolean_get(op->ptr, "extend");
+ extend = RNA_boolean_get(op->ptr, "extend");
if (!extend)
deselect_action_keys(&ac, 1, SELECT_SUBTRACT);
@@ -286,7 +286,7 @@ static int actkeys_borderselect_exec(bContext *C, wmOperator *op)
rect.xmax = RNA_int_get(op->ptr, "xmax");
rect.ymax = RNA_int_get(op->ptr, "ymax");
- gesture_mode= RNA_int_get(op->ptr, "gesture_mode");
+ gesture_mode = RNA_int_get(op->ptr, "gesture_mode");
if (gesture_mode == GESTURE_MODAL_SELECT)
selectmode = SELECT_ADD;
else
@@ -300,18 +300,18 @@ static int actkeys_borderselect_exec(bContext *C, wmOperator *op)
* used for tweaking timing when "blocking", while channels is not that useful...
*/
if ((rect.xmax - rect.xmin) >= (rect.ymax - rect.ymin))
- mode= ACTKEYS_BORDERSEL_FRAMERANGE;
+ mode = ACTKEYS_BORDERSEL_FRAMERANGE;
else
- mode= ACTKEYS_BORDERSEL_CHANNELS;
+ mode = ACTKEYS_BORDERSEL_CHANNELS;
}
else
- mode= ACTKEYS_BORDERSEL_ALLKEYS;
+ mode = ACTKEYS_BORDERSEL_ALLKEYS;
/* apply borderselect action */
borderselect_action(&ac, rect, mode, selectmode);
/* set notifier that keyframe selection have changed */
- WM_event_add_notifier(C, NC_ANIMATION|ND_KEYFRAME|NA_SELECTED, NULL);
+ WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_SELECTED, NULL);
return OPERATOR_FINISHED;
}
@@ -332,7 +332,7 @@ void ACTION_OT_select_border(wmOperatorType *ot)
ot->poll = ED_operator_action_active;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* rna */
WM_operator_properties_gesture_border(ot, TRUE);
@@ -362,14 +362,14 @@ static EnumPropertyItem prop_column_select_types[] = {
/* Selects all visible keyframes between the specified markers */
/* TODO, this is almost an _exact_ duplicate of a function of the same name in graph_select.c
* should de-duplicate - campbell */
-static void markers_selectkeys_between (bAnimContext *ac)
+static void markers_selectkeys_between(bAnimContext *ac)
{
ListBase anim_data = {NULL, NULL};
bAnimListElem *ale;
int filter;
KeyframeEditFunc ok_cb, select_cb;
- KeyframeEditData ked= {{NULL}};
+ KeyframeEditData ked = {{NULL}};
float min, max;
/* get extreme markers */
@@ -378,19 +378,19 @@ static void markers_selectkeys_between (bAnimContext *ac)
max += 0.5f;
/* get editing funcs + data */
- ok_cb= ANIM_editkeyframes_ok(BEZT_OK_FRAMERANGE);
- select_cb= ANIM_editkeyframes_select(SELECT_ADD);
+ ok_cb = ANIM_editkeyframes_ok(BEZT_OK_FRAMERANGE);
+ select_cb = ANIM_editkeyframes_select(SELECT_ADD);
- ked.f1= min;
- ked.f2= max;
+ ked.f1 = min;
+ ked.f2 = max;
/* filter data */
- filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE /*| ANIMFILTER_CURVESONLY */ | ANIMFILTER_NODUPLIS);
+ filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE /*| ANIMFILTER_CURVESONLY */ | ANIMFILTER_NODUPLIS);
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
/* select keys in-between */
- for (ale= anim_data.first; ale; ale= ale->next) {
- AnimData *adt= ANIM_nla_mapping_get(ac, ale);
+ for (ale = anim_data.first; ale; ale = ale->next) {
+ AnimData *adt = ANIM_nla_mapping_get(ac, ale);
if (adt) {
ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 0, 1);
@@ -411,16 +411,16 @@ static void markers_selectkeys_between (bAnimContext *ac)
/* Selects all visible keyframes in the same frames as the specified elements */
-static void columnselect_action_keys (bAnimContext *ac, short mode)
+static void columnselect_action_keys(bAnimContext *ac, short mode)
{
- ListBase anim_data= {NULL, NULL};
+ ListBase anim_data = {NULL, NULL};
bAnimListElem *ale;
int filter;
- Scene *scene= ac->scene;
+ Scene *scene = ac->scene;
CfraElem *ce;
KeyframeEditFunc select_cb, ok_cb;
- KeyframeEditData ked= {{NULL}};
+ KeyframeEditData ked = {{NULL}};
/* initialize keyframe editing data */
@@ -428,17 +428,17 @@ static void columnselect_action_keys (bAnimContext *ac, short mode)
switch (mode) {
case ACTKEYS_COLUMNSEL_KEYS: /* list of selected keys */
if (ac->datatype == ANIMCONT_GPENCIL) {
- filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE);
+ 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)
gplayer_make_cfra_list(ale->data, &ked.list, 1);
}
else {
- filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE /*| ANIMFILTER_CURVESONLY*/);
+ 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);
}
BLI_freelistN(&anim_data);
@@ -446,10 +446,10 @@ static void columnselect_action_keys (bAnimContext *ac, short mode)
case ACTKEYS_COLUMNSEL_CFRA: /* current frame */
/* make a single CfraElem for storing this */
- ce= MEM_callocN(sizeof(CfraElem), "cfraElem");
+ ce = MEM_callocN(sizeof(CfraElem), "cfraElem");
BLI_addtail(&ked.list, ce);
- ce->cfra= (float)CFRA;
+ ce->cfra = (float)CFRA;
break;
case ACTKEYS_COLUMNSEL_MARKERS_COLUMN: /* list of selected markers */
@@ -461,30 +461,30 @@ static void columnselect_action_keys (bAnimContext *ac, short mode)
}
/* set up BezTriple edit callbacks */
- select_cb= ANIM_editkeyframes_select(SELECT_ADD);
- ok_cb= ANIM_editkeyframes_ok(BEZT_OK_FRAME);
+ select_cb = ANIM_editkeyframes_select(SELECT_ADD);
+ ok_cb = ANIM_editkeyframes_ok(BEZT_OK_FRAME);
/* loop through all of the keys and select additional keyframes
* based on the keys found to be selected above
*/
if (ac->datatype == ANIMCONT_GPENCIL)
- filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE);
+ filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE);
else
- filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE /*| ANIMFILTER_CURVESONLY*/);
+ 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) {
- AnimData *adt= ANIM_nla_mapping_get(ac, ale);
+ for (ale = anim_data.first; ale; ale = ale->next) {
+ AnimData *adt = ANIM_nla_mapping_get(ac, ale);
/* loop over cfraelems (stored in the KeyframeEditData->list)
* - we need to do this here, as we can apply fewer NLA-mapping conversions
*/
- for (ce= ked.list.first; ce; ce= ce->next) {
+ for (ce = ked.list.first; ce; ce = ce->next) {
/* set frame for validation callback to refer to */
if (adt)
- ked.f1= BKE_nla_tweakedit_remap(adt, ce->cfra, NLATIME_CONVERT_UNMAP);
+ ked.f1 = BKE_nla_tweakedit_remap(adt, ce->cfra, NLATIME_CONVERT_UNMAP);
else
- ked.f1= ce->cfra;
+ ked.f1 = ce->cfra;
/* select elements with frame number matching cfraelem */
if (ale->type == ANIMTYPE_GPLAYER)
@@ -511,7 +511,7 @@ static int actkeys_columnselect_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
/* action to take depends on the mode */
- mode= RNA_enum_get(op->ptr, "mode");
+ mode = RNA_enum_get(op->ptr, "mode");
if (mode == ACTKEYS_COLUMNSEL_MARKERS_BETWEEN)
markers_selectkeys_between(&ac);
@@ -519,7 +519,7 @@ static int actkeys_columnselect_exec(bContext *C, wmOperator *op)
columnselect_action_keys(&ac, mode);
/* set notifier that keyframe selection have changed */
- WM_event_add_notifier(C, NC_ANIMATION|ND_KEYFRAME|NA_SELECTED, NULL);
+ WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_SELECTED, NULL);
return OPERATOR_FINISHED;
}
@@ -536,7 +536,7 @@ void ACTION_OT_select_column(wmOperatorType *ot)
ot->poll = ED_operator_action_active;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* props */
ot->prop = RNA_def_enum(ot->srna, "mode", prop_column_select_types, 0, "Mode", "");
@@ -544,11 +544,11 @@ void ACTION_OT_select_column(wmOperatorType *ot)
/* ******************** Select Linked Operator *********************** */
-static int actkeys_select_linked_exec (bContext *C, wmOperator *UNUSED(op))
+static int actkeys_select_linked_exec(bContext *C, wmOperator *UNUSED(op))
{
bAnimContext ac;
- ListBase anim_data= {NULL, NULL};
+ ListBase anim_data = {NULL, NULL};
bAnimListElem *ale;
int filter;
@@ -560,11 +560,11 @@ static int actkeys_select_linked_exec (bContext *C, wmOperator *UNUSED(op))
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*/ | ANIMFILTER_NODUPLIS);
+ filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE /*| ANIMFILTER_CURVESONLY*/ | ANIMFILTER_NODUPLIS);
ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
- for (ale= anim_data.first; ale; ale= ale->next) {
- FCurve *fcu= (FCurve *)ale->key_data;
+ for (ale = anim_data.first; ale; ale = ale->next) {
+ FCurve *fcu = (FCurve *)ale->key_data;
/* check if anything selected? */
if (ANIM_fcurve_keyframes_loop(NULL, fcu, NULL, ok_cb, NULL)) {
@@ -577,7 +577,7 @@ static int actkeys_select_linked_exec (bContext *C, wmOperator *UNUSED(op))
BLI_freelistN(&anim_data);
/* set notifier that keyframe selection has changed */
- WM_event_add_notifier(C, NC_ANIMATION|ND_KEYFRAME|NA_SELECTED, NULL);
+ WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_SELECTED, NULL);
return OPERATOR_FINISHED;
}
@@ -594,38 +594,38 @@ void ACTION_OT_select_linked(wmOperatorType *ot)
ot->poll = ED_operator_action_active;
/* flags */
- ot->flag = OPTYPE_REGISTER/*|OPTYPE_UNDO*/;
+ ot->flag = OPTYPE_REGISTER /*|OPTYPE_UNDO*/;
}
/* ******************** Select More/Less Operators *********************** */
/* Common code to perform selection */
-static void select_moreless_action_keys (bAnimContext *ac, short mode)
+static void select_moreless_action_keys(bAnimContext *ac, short mode)
{
- ListBase anim_data= {NULL, NULL};
+ ListBase anim_data = {NULL, NULL};
bAnimListElem *ale;
int filter;
- KeyframeEditData ked= {{NULL}};
+ KeyframeEditData ked = {{NULL}};
KeyframeEditFunc build_cb;
/* init selmap building data */
- build_cb= ANIM_editkeyframes_buildselmap(mode);
+ build_cb = ANIM_editkeyframes_buildselmap(mode);
/* loop through all of the keys and select additional keyframes based on these */
- filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE /*| ANIMFILTER_CURVESONLY*/ | ANIMFILTER_NODUPLIS);
+ filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE /*| ANIMFILTER_CURVESONLY*/ | ANIMFILTER_NODUPLIS);
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
- for (ale= anim_data.first; ale; ale= ale->next) {
- FCurve *fcu= (FCurve *)ale->key_data;
+ for (ale = anim_data.first; ale; ale = ale->next) {
+ FCurve *fcu = (FCurve *)ale->key_data;
/* only continue if F-Curve has keyframes */
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");
+ ked.data = MEM_callocN(fcu->totvert, "selmap actEdit more");
ANIM_fcurve_keyframes_loop(&ked, fcu, NULL, build_cb, NULL);
/* based on this map, adjust the selection status of the keyframes */
@@ -633,7 +633,7 @@ static void select_moreless_action_keys (bAnimContext *ac, short mode)
/* free the selmap used here */
MEM_freeN(ked.data);
- ked.data= NULL;
+ ked.data = NULL;
}
/* Cleanup */
@@ -642,7 +642,7 @@ static void select_moreless_action_keys (bAnimContext *ac, short mode)
/* ----------------- */
-static int actkeys_select_more_exec (bContext *C, wmOperator *UNUSED(op))
+static int actkeys_select_more_exec(bContext *C, wmOperator *UNUSED(op))
{
bAnimContext ac;
@@ -654,7 +654,7 @@ static int actkeys_select_more_exec (bContext *C, wmOperator *UNUSED(op))
select_moreless_action_keys(&ac, SELMAP_MORE);
/* set notifier that keyframe selection has changed */
- WM_event_add_notifier(C, NC_ANIMATION|ND_KEYFRAME|NA_SELECTED, NULL);
+ WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_SELECTED, NULL);
return OPERATOR_FINISHED;
}
@@ -671,12 +671,12 @@ void ACTION_OT_select_more(wmOperatorType *ot)
ot->poll = ED_operator_action_active;
/* flags */
- ot->flag = OPTYPE_REGISTER/*|OPTYPE_UNDO*/;
+ ot->flag = OPTYPE_REGISTER /*|OPTYPE_UNDO*/;
}
/* ----------------- */
-static int actkeys_select_less_exec (bContext *C, wmOperator *UNUSED(op))
+static int actkeys_select_less_exec(bContext *C, wmOperator *UNUSED(op))
{
bAnimContext ac;
@@ -688,7 +688,7 @@ static int actkeys_select_less_exec (bContext *C, wmOperator *UNUSED(op))
select_moreless_action_keys(&ac, SELMAP_LESS);
/* set notifier that keyframe selection has changed */
- WM_event_add_notifier(C, NC_ANIMATION|ND_KEYFRAME|NA_SELECTED, NULL);
+ WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_SELECTED, NULL);
return OPERATOR_FINISHED;
}
@@ -705,7 +705,7 @@ void ACTION_OT_select_less(wmOperatorType *ot)
ot->poll = ED_operator_action_active;
/* flags */
- ot->flag = OPTYPE_REGISTER/*|OPTYPE_UNDO*/;
+ ot->flag = OPTYPE_REGISTER /*|OPTYPE_UNDO*/;
}
/* ******************** Select Left/Right Operator ************************* */
@@ -721,19 +721,19 @@ static EnumPropertyItem prop_actkeys_leftright_select_types[] = {
/* --------------------------------- */
-static void actkeys_select_leftright (bAnimContext *ac, short leftright, short select_mode)
+static void actkeys_select_leftright(bAnimContext *ac, short leftright, short select_mode)
{
ListBase anim_data = {NULL, NULL};
bAnimListElem *ale;
int filter;
KeyframeEditFunc ok_cb, select_cb;
- KeyframeEditData ked= {{NULL}};
- Scene *scene= ac->scene;
+ KeyframeEditData ked = {{NULL}};
+ Scene *scene = ac->scene;
/* if select mode is replace, deselect all keyframes (and channels) first */
- if (select_mode==SELECT_REPLACE) {
- select_mode= SELECT_ADD;
+ if (select_mode == SELECT_REPLACE) {
+ select_mode = SELECT_ADD;
/* - deselect all other keyframes, so that just the newly selected remain
* - channels aren't deselected, since we don't re-select any as a consequence
@@ -742,8 +742,8 @@ static void actkeys_select_leftright (bAnimContext *ac, short leftright, short s
}
/* set callbacks and editing data */
- ok_cb= ANIM_editkeyframes_ok(BEZT_OK_FRAMERANGE);
- select_cb= ANIM_editkeyframes_select(select_mode);
+ ok_cb = ANIM_editkeyframes_ok(BEZT_OK_FRAMERANGE);
+ select_cb = ANIM_editkeyframes_select(select_mode);
if (leftright == ACTKEYS_LRSEL_LEFT) {
ked.f1 = MINAFRAMEF;
@@ -756,14 +756,14 @@ static void actkeys_select_leftright (bAnimContext *ac, short leftright, short s
/* filter data */
if (ac->datatype == ANIMCONT_GPENCIL)
- filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_NODUPLIS);
+ filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_NODUPLIS);
else
- filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE /*| ANIMFILTER_CURVESONLY*/ | ANIMFILTER_NODUPLIS);
+ filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE /*| ANIMFILTER_CURVESONLY*/ | ANIMFILTER_NODUPLIS);
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
/* select keys */
- for (ale= anim_data.first; ale; ale= ale->next) {
- AnimData *adt= ANIM_nla_mapping_get(ac, ale);
+ for (ale = anim_data.first; ale; ale = ale->next) {
+ AnimData *adt = ANIM_nla_mapping_get(ac, ale);
if (adt) {
ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 0, 1);
@@ -777,16 +777,16 @@ static void actkeys_select_leftright (bAnimContext *ac, short leftright, short s
}
/* Sync marker support */
- if (select_mode==SELECT_ADD) {
- SpaceAction *saction= (SpaceAction *)ac->sl;
+ if (select_mode == SELECT_ADD) {
+ SpaceAction *saction = (SpaceAction *)ac->sl;
if ((saction) && (saction->flag & SACTION_MARKERS_MOVE)) {
ListBase *markers = ED_animcontext_get_markers(ac);
TimeMarker *marker;
- for (marker= markers->first; marker; marker= marker->next) {
- if ( ((leftright == ACTKEYS_LRSEL_LEFT) && (marker->frame < CFRA)) ||
- ((leftright == ACTKEYS_LRSEL_RIGHT) && (marker->frame >= CFRA)) )
+ for (marker = markers->first; marker; marker = marker->next) {
+ if ( ((leftright == ACTKEYS_LRSEL_LEFT) && (marker->frame < CFRA)) ||
+ ((leftright == ACTKEYS_LRSEL_RIGHT) && (marker->frame >= CFRA)) )
{
marker->flag |= SELECT;
}
@@ -803,7 +803,7 @@ static void actkeys_select_leftright (bAnimContext *ac, short leftright, short s
/* ----------------- */
-static int actkeys_select_leftright_exec (bContext *C, wmOperator *op)
+static int actkeys_select_leftright_exec(bContext *C, wmOperator *op)
{
bAnimContext ac;
short leftright = RNA_enum_get(op->ptr, "mode");
@@ -815,9 +815,9 @@ static int actkeys_select_leftright_exec (bContext *C, wmOperator *op)
/* select mode is either replace (deselect all, then add) or add/extend */
if (RNA_boolean_get(op->ptr, "extend"))
- selectmode= SELECT_INVERT;
+ selectmode = SELECT_INVERT;
else
- selectmode= SELECT_REPLACE;
+ selectmode = SELECT_REPLACE;
/* if "test" mode is set, we don't have any info to set this with */
if (leftright == ACTKEYS_LRSEL_TEST)
@@ -827,12 +827,12 @@ static int actkeys_select_leftright_exec (bContext *C, wmOperator *op)
actkeys_select_leftright(&ac, leftright, selectmode);
/* set notifier that keyframe selection (and channels too) have changed */
- WM_event_add_notifier(C, NC_ANIMATION|ND_KEYFRAME|ND_ANIMCHAN|NA_SELECTED, NULL);
+ WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | ND_ANIMCHAN | NA_SELECTED, NULL);
return OPERATOR_FINISHED;
}
-static int actkeys_select_leftright_invoke (bContext *C, wmOperator *op, wmEvent *event)
+static int actkeys_select_leftright_invoke(bContext *C, wmOperator *op, wmEvent *event)
{
bAnimContext ac;
short leftright = RNA_enum_get(op->ptr, "mode");
@@ -843,9 +843,9 @@ static int actkeys_select_leftright_invoke (bContext *C, wmOperator *op, wmEvent
/* handle mode-based testing */
if (leftright == ACTKEYS_LRSEL_TEST) {
- Scene *scene= ac.scene;
- ARegion *ar= ac.ar;
- View2D *v2d= &ar->v2d;
+ Scene *scene = ac.scene;
+ ARegion *ar = ac.ar;
+ View2D *v2d = &ar->v2d;
float x;
/* determine which side of the current frame mouse is on */
@@ -873,7 +873,7 @@ void ACTION_OT_select_leftright(wmOperatorType *ot)
ot->poll = ED_operator_action_active;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* id-props */
ot->prop = RNA_def_enum(ot->srna, "mode", prop_actkeys_leftright_select_types, ACTKEYS_LRSEL_TEST, "Mode", "");
@@ -891,20 +891,20 @@ void ACTION_OT_select_leftright(wmOperatorType *ot)
*/
/* sensitivity factor for frame-selections */
-#define FRAME_CLICK_THRESH 0.1f
+#define FRAME_CLICK_THRESH 0.1f
/* ------------------- */
/* option 1) select keyframe directly under mouse */
-static void actkeys_mselect_single (bAnimContext *ac, bAnimListElem *ale, short select_mode, float selx)
+static void actkeys_mselect_single(bAnimContext *ac, bAnimListElem *ale, short select_mode, float selx)
{
- KeyframeEditData ked= {{NULL}};
+ KeyframeEditData ked = {{NULL}};
KeyframeEditFunc select_cb, ok_cb;
/* get functions for selecting keyframes */
- select_cb= ANIM_editkeyframes_select(select_mode);
- ok_cb= ANIM_editkeyframes_ok(BEZT_OK_FRAME);
- ked.f1= selx;
+ select_cb = ANIM_editkeyframes_select(select_mode);
+ ok_cb = ANIM_editkeyframes_ok(BEZT_OK_FRAME);
+ ked.f1 = selx;
/* select the nominated keyframe on the given frame */
if (ale->type == ANIMTYPE_GPLAYER)
@@ -919,34 +919,34 @@ static void actkeys_mselect_single (bAnimContext *ac, bAnimListElem *ale, short
/* Option 3) Selects all visible keyframes in the same frame as the mouse click */
static void actkeys_mselect_column(bAnimContext *ac, short select_mode, float selx)
{
- ListBase anim_data= {NULL, NULL};
+ ListBase anim_data = {NULL, NULL};
bAnimListElem *ale;
int filter;
KeyframeEditFunc select_cb, ok_cb;
- KeyframeEditData ked= {{NULL}};
+ KeyframeEditData ked = {{NULL}};
/* set up BezTriple edit callbacks */
- select_cb= ANIM_editkeyframes_select(select_mode);
- ok_cb= ANIM_editkeyframes_ok(BEZT_OK_FRAME);
+ select_cb = ANIM_editkeyframes_select(select_mode);
+ ok_cb = ANIM_editkeyframes_ok(BEZT_OK_FRAME);
/* loop through all of the keys and select additional keyframes
* based on the keys found to be selected above
*/
if (ac->datatype == ANIMCONT_GPENCIL)
- filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE /*| ANIMFILTER_CURVESONLY */ | ANIMFILTER_NODUPLIS);
+ filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE /*| ANIMFILTER_CURVESONLY */ | ANIMFILTER_NODUPLIS);
else
- filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_NODUPLIS);
+ filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_NODUPLIS);
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
- for (ale= anim_data.first; ale; ale= ale->next) {
- AnimData *adt= ANIM_nla_mapping_get(ac, ale);
+ for (ale = anim_data.first; ale; ale = ale->next) {
+ AnimData *adt = ANIM_nla_mapping_get(ac, ale);
/* set frame for validation callback to refer to */
if (adt)
- ked.f1= BKE_nla_tweakedit_remap(adt, selx, NLATIME_CONVERT_UNMAP);
+ ked.f1 = BKE_nla_tweakedit_remap(adt, selx, NLATIME_CONVERT_UNMAP);
else
- ked.f1= selx;
+ ked.f1 = selx;
/* select elements with frame number matching cfra */
if (ale->type == ANIMTYPE_GPLAYER)
@@ -962,14 +962,14 @@ static void actkeys_mselect_column(bAnimContext *ac, short select_mode, float se
/* ------------------- */
-static void mouse_action_keys (bAnimContext *ac, const int mval[2], short select_mode, short column)
+static void mouse_action_keys(bAnimContext *ac, const int mval[2], short select_mode, short column)
{
ListBase anim_data = {NULL, NULL};
DLRBT_Tree anim_keys;
bAnimListElem *ale;
int filter;
- View2D *v2d= &ac->ar->v2d;
+ View2D *v2d = &ac->ar->v2d;
bDopeSheet *ads = NULL;
int channel_index;
short found = 0;
@@ -979,22 +979,22 @@ static void mouse_action_keys (bAnimContext *ac, const int mval[2], short select
/* get dopesheet info */
if (ac->datatype == ANIMCONT_DOPESHEET)
- ads= ac->data;
+ 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);
UI_view2d_listview_view_to_cell(v2d, 0, ACHANNEL_STEP, 0, (float)ACHANNEL_HEIGHT_HALF, x, y, NULL, &channel_index);
/* x-range to check is +/- 7 (in screen/region-space) on either side of mouse click (size of keyframe icon) */
- UI_view2d_region_to_view(v2d, mval[0]-7, mval[1], &rectf.xmin, &rectf.ymin);
- UI_view2d_region_to_view(v2d, mval[0]+7, mval[1], &rectf.xmax, &rectf.ymax);
+ UI_view2d_region_to_view(v2d, mval[0] - 7, mval[1], &rectf.xmin, &rectf.ymin);
+ UI_view2d_region_to_view(v2d, mval[0] + 7, mval[1], &rectf.xmax, &rectf.ymax);
/* filter data */
- filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_LIST_CHANNELS);
+ filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_LIST_CHANNELS);
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
/* try to get channel */
- ale= BLI_findlink(&anim_data, channel_index);
+ ale = BLI_findlink(&anim_data, channel_index);
if (ale == NULL) {
/* channel not found */
printf("Error: animation channel (index = %d) not found in mouse_action_keys()\n", channel_index);
@@ -1003,8 +1003,8 @@ static void mouse_action_keys (bAnimContext *ac, const int mval[2], short select
}
else {
/* found match - must return here... */
- AnimData *adt= ANIM_nla_mapping_get(ac, ale);
- ActKeyColumn *ak, *akn=NULL;
+ AnimData *adt = ANIM_nla_mapping_get(ac, ale);
+ ActKeyColumn *ak, *akn = NULL;
/* make list of keyframes */
BLI_dlrbTree_init(&anim_keys);
@@ -1013,28 +1013,28 @@ static void mouse_action_keys (bAnimContext *ac, const int mval[2], short select
switch (ale->datatype) {
case ALE_SCE:
{
- Scene *scene= (Scene *)ale->key_data;
+ Scene *scene = (Scene *)ale->key_data;
scene_to_keylist(ads, scene, &anim_keys, NULL);
}
- break;
+ break;
case ALE_OB:
{
- Object *ob= (Object *)ale->key_data;
+ Object *ob = (Object *)ale->key_data;
ob_to_keylist(ads, ob, &anim_keys, NULL);
}
- break;
+ break;
case ALE_ACT:
{
- bAction *act= (bAction *)ale->key_data;
+ bAction *act = (bAction *)ale->key_data;
action_to_keylist(adt, act, &anim_keys, NULL);
}
- break;
+ break;
case ALE_FCURVE:
{
- FCurve *fcu= (FCurve *)ale->key_data;
+ FCurve *fcu = (FCurve *)ale->key_data;
fcurve_to_keylist(adt, fcu, &anim_keys, NULL);
}
- break;
+ break;
}
}
else if (ale->type == ANIMTYPE_SUMMARY) {
@@ -1043,7 +1043,7 @@ static void mouse_action_keys (bAnimContext *ac, const int mval[2], short select
}
else if (ale->type == ANIMTYPE_GROUP) {
// TODO: why don't we just give groups key_data too?
- bActionGroup *agrp= (bActionGroup *)ale->data;
+ bActionGroup *agrp = (bActionGroup *)ale->data;
agroup_to_keylist(adt, agrp, &anim_keys, NULL);
}
else if (ale->type == ANIMTYPE_GPLAYER) {
@@ -1053,20 +1053,20 @@ static void mouse_action_keys (bAnimContext *ac, const int mval[2], short select
}
/* start from keyframe at root of BST, traversing until we find one within the range that was clicked on */
- for (ak= anim_keys.root; ak; ak= akn) {
+ for (ak = anim_keys.root; ak; ak = akn) {
if (IN_RANGE(ak->cfra, rectf.xmin, rectf.xmax)) {
/* set the frame to use, and apply inverse-correction for NLA-mapping
* so that the frame will get selected by the selection functions without
* requiring to map each frame once again...
*/
- selx= BKE_nla_tweakedit_remap(adt, ak->cfra, NLATIME_CONVERT_UNMAP);
- found= 1;
+ selx = BKE_nla_tweakedit_remap(adt, ak->cfra, NLATIME_CONVERT_UNMAP);
+ found = 1;
break;
}
else if (ak->cfra < rectf.xmin)
- akn= ak->right;
+ akn = ak->right;
else
- akn= ak->left;
+ akn = ak->left;
}
/* remove active channel from list of channels for separate treatment (since it's needed later on) */
@@ -1095,13 +1095,13 @@ static void mouse_action_keys (bAnimContext *ac, const int mval[2], short select
/* Highlight Action-Group or F-Curve? */
if (ale && ale->data) {
if (ale->type == ANIMTYPE_GROUP) {
- bActionGroup *agrp= ale->data;
+ bActionGroup *agrp = ale->data;
agrp->flag |= AGRP_SELECTED;
ANIM_set_active_channel(ac, ac->data, ac->datatype, filter, agrp, ANIMTYPE_GROUP);
}
else if (ale->type == ANIMTYPE_FCURVE) {
- FCurve *fcu= ale->data;
+ FCurve *fcu = ale->data;
fcu->flag |= FCURVE_SELECTED;
ANIM_set_active_channel(ac, ac->data, ac->datatype, filter, fcu, ANIMTYPE_FCURVE);
@@ -1157,21 +1157,21 @@ static int actkeys_clickselect_invoke(bContext *C, wmOperator *op, wmEvent *even
/* select mode is either replace (deselect all, then add) or add/extend */
if (RNA_boolean_get(op->ptr, "extend"))
- selectmode= SELECT_INVERT;
+ selectmode = SELECT_INVERT;
else
- selectmode= SELECT_REPLACE;
+ selectmode = SELECT_REPLACE;
/* column selection */
- column= RNA_boolean_get(op->ptr, "column");
+ column = RNA_boolean_get(op->ptr, "column");
/* select keyframe(s) based upon mouse position*/
mouse_action_keys(&ac, event->mval, selectmode, column);
/* set notifier that keyframe selection (and channels too) have changed */
- WM_event_add_notifier(C, NC_ANIMATION|ND_KEYFRAME|ND_ANIMCHAN|NA_SELECTED, NULL);
+ WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | ND_ANIMCHAN | NA_SELECTED, NULL);
/* for tweak grab to work */
- return OPERATOR_FINISHED|OPERATOR_PASS_THROUGH;
+ return OPERATOR_FINISHED | OPERATOR_PASS_THROUGH;
}
void ACTION_OT_clickselect(wmOperatorType *ot)
@@ -1186,7 +1186,7 @@ void ACTION_OT_clickselect(wmOperatorType *ot)
ot->poll = ED_operator_action_active;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* id-props */
RNA_def_boolean(ot->srna, "extend", 0, "Extend Select", ""); // SHIFTKEY