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

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2012-05-08 22:05:57 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-05-08 22:05:57 +0400
commitf605679515bad2f9ebbe8c5cf5bd833219fcbbff (patch)
tree9e3522f9a09f57f2e9151b88809905de2ebb85a8 /source/blender/editors/space_nla/nla_select.c
parent855c11ff8c3363521ac956f4a1b8991a66d774ad (diff)
style cleanup: nla
Diffstat (limited to 'source/blender/editors/space_nla/nla_select.c')
-rw-r--r--source/blender/editors/space_nla/nla_select.c148
1 files changed, 74 insertions, 74 deletions
diff --git a/source/blender/editors/space_nla/nla_select.c b/source/blender/editors/space_nla/nla_select.c
index cfd4a3202d2..1ba15d529e8 100644
--- a/source/blender/editors/space_nla/nla_select.c
+++ b/source/blender/editors/space_nla/nla_select.c
@@ -57,12 +57,12 @@
#include "UI_view2d.h"
-#include "nla_intern.h" // own include
+#include "nla_intern.h" // own include
/* ******************** Utilities ***************************************** */
/* Convert SELECT_* flags to ACHANNEL_SETFLAG_* flags */
-static short selmodes_to_flagmodes (short sel)
+static short selmodes_to_flagmodes(short sel)
{
/* convert selection modes to selection modes */
switch (sel) {
@@ -98,13 +98,13 @@ enum {
/* Deselects strips in the NLA Editor
* - This is called by the deselect all operator, as well as other ones!
*
- * - test: check if select or deselect all (1) or clear all active (2)
+ * - test: check if select or deselect all (1) or clear all active (2)
* - sel: how to select keyframes
* 0 = deselect
* 1 = select
* 2 = invert
*/
-static void deselect_nla_strips (bAnimContext *ac, short test, short sel)
+static void deselect_nla_strips(bAnimContext *ac, short test, short sel)
{
ListBase anim_data = {NULL, NULL};
bAnimListElem *ale;
@@ -113,21 +113,21 @@ static void deselect_nla_strips (bAnimContext *ac, short test, short sel)
/* determine type-based settings */
// FIXME: double check whether ANIMFILTER_LIST_VISIBLE is needed!
- filter= (ANIMFILTER_DATA_VISIBLE);
+ filter = (ANIMFILTER_DATA_VISIBLE);
/* filter data */
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
/* See if we should be selecting or deselecting */
if (test == DESELECT_STRIPS_TEST) {
- for (ale= anim_data.first; ale; ale= ale->next) {
- NlaTrack *nlt= (NlaTrack *)ale->data;
+ for (ale = anim_data.first; ale; ale = ale->next) {
+ NlaTrack *nlt = (NlaTrack *)ale->data;
NlaStrip *strip;
/* if any strip is selected, break out, since we should now be deselecting */
- for (strip= nlt->strips.first; strip; strip= strip->next) {
+ for (strip = nlt->strips.first; strip; strip = strip->next) {
if (strip->flag & NLASTRIP_FLAG_SELECT) {
- sel= SELECT_SUBTRACT;
+ sel = SELECT_SUBTRACT;
break;
}
}
@@ -138,15 +138,15 @@ static void deselect_nla_strips (bAnimContext *ac, short test, short sel)
}
/* convert selection modes to selection modes */
- smode= selmodes_to_flagmodes(sel);
+ smode = selmodes_to_flagmodes(sel);
/* Now set the flags */
- for (ale= anim_data.first; ale; ale= ale->next) {
- NlaTrack *nlt= (NlaTrack *)ale->data;
+ for (ale = anim_data.first; ale; ale = ale->next) {
+ NlaTrack *nlt = (NlaTrack *)ale->data;
NlaStrip *strip;
/* apply same selection to all strips */
- for (strip= nlt->strips.first; strip; strip= strip->next) {
+ for (strip = nlt->strips.first; strip; strip = strip->next) {
/* set selection */
if (test != DESELECT_STRIPS_CLEARACTIVE)
ACHANNEL_SET_FLAG(strip, smode, NLASTRIP_FLAG_SELECT);
@@ -178,7 +178,7 @@ static int nlaedit_deselectall_exec(bContext *C, wmOperator *op)
deselect_nla_strips(&ac, DESELECT_STRIPS_TEST, SELECT_ADD);
/* set notifier that things have changed */
- WM_event_add_notifier(C, NC_ANIMATION|ND_NLA|NA_SELECTED, NULL);
+ WM_event_add_notifier(C, NC_ANIMATION | ND_NLA | NA_SELECTED, NULL);
return OPERATOR_FINISHED;
}
@@ -195,7 +195,7 @@ void NLA_OT_select_all_toggle(wmOperatorType *ot)
ot->poll = nlaop_poll_tweakmode_off;
/* flags */
- ot->flag = OPTYPE_REGISTER/*|OPTYPE_UNDO*/;
+ ot->flag = OPTYPE_REGISTER /*|OPTYPE_UNDO*/;
/* props */
RNA_def_boolean(ot->srna, "invert", 0, "Invert", "");
@@ -203,57 +203,57 @@ void NLA_OT_select_all_toggle(wmOperatorType *ot)
/* ******************** Border Select Operator **************************** */
/* This operator currently works in one of three ways:
- * -> BKEY - 1) all strips within region are selected (NLAEDIT_BORDERSEL_ALLSTRIPS)
- * -> ALT-BKEY - depending on which axis of the region was larger...
- * -> 2) x-axis, so select all frames within frame range (NLAEDIT_BORDERSEL_FRAMERANGE)
- * -> 3) y-axis, so select all frames within channels that region included (NLAEDIT_BORDERSEL_CHANNELS)
+ * -> BKEY - 1) all strips within region are selected (NLAEDIT_BORDERSEL_ALLSTRIPS)
+ * -> ALT-BKEY - depending on which axis of the region was larger...
+ * -> 2) x-axis, so select all frames within frame range (NLAEDIT_BORDERSEL_FRAMERANGE)
+ * -> 3) y-axis, so select all frames within channels that region included (NLAEDIT_BORDERSEL_CHANNELS)
*/
/* defines for borderselect mode */
enum {
- NLA_BORDERSEL_ALLSTRIPS = 0,
+ NLA_BORDERSEL_ALLSTRIPS = 0,
NLA_BORDERSEL_FRAMERANGE,
NLA_BORDERSEL_CHANNELS,
} /* eNLAEDIT_BorderSelect_Mode */;
-static void borderselect_nla_strips (bAnimContext *ac, rcti rect, short mode, short selectmode)
+static void borderselect_nla_strips(bAnimContext *ac, rcti rect, short mode, short selectmode)
{
ListBase anim_data = {NULL, NULL};
bAnimListElem *ale;
int filter;
SpaceNla *snla = (SpaceNla *)ac->sl;
- View2D *v2d= &ac->ar->v2d;
+ View2D *v2d = &ac->ar->v2d;
rctf rectf;
- float ymin /* =(float)(-NLACHANNEL_HEIGHT(snla)) */ /* UNUSED */, ymax=0;
+ float ymin /* =(float)(-NLACHANNEL_HEIGHT(snla)) */ /* UNUSED */, ymax = 0;
/* convert border-region to view coordinates */
- 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);
+ filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_LIST_CHANNELS);
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
/* convert selection modes to selection modes */
- selectmode= selmodes_to_flagmodes(selectmode);
+ selectmode = selmodes_to_flagmodes(selectmode);
/* loop over data, doing border select */
- for (ale= anim_data.first; ale; ale= ale->next) {
- ymin= ymax - NLACHANNEL_STEP(snla);
+ for (ale = anim_data.first; ale; ale = ale->next) {
+ ymin = ymax - NLACHANNEL_STEP(snla);
/* perform vertical suitability check (if applicable) */
if ( (mode == NLA_BORDERSEL_FRAMERANGE) ||
- !((ymax < rectf.ymin) || (ymin > rectf.ymax)) )
+ !((ymax < rectf.ymin) || (ymin > rectf.ymax)) )
{
/* loop over data selecting (only if NLA-Track) */
if (ale->type == ANIMTYPE_NLATRACK) {
- NlaTrack *nlt= (NlaTrack *)ale->data;
+ NlaTrack *nlt = (NlaTrack *)ale->data;
NlaStrip *strip;
/* only select strips if they fall within the required ranges (if applicable) */
- for (strip= nlt->strips.first; strip; strip= strip->next) {
+ for (strip = nlt->strips.first; strip; strip = strip->next) {
if ( (mode == NLA_BORDERSEL_CHANNELS) ||
BKE_nlastrip_within_bounds(strip, rectf.xmin, rectf.xmax))
{
@@ -268,7 +268,7 @@ static void borderselect_nla_strips (bAnimContext *ac, rcti rect, short mode, sh
}
/* set minimum extent to be the maximum of the next channel */
- ymax= ymin;
+ ymax = ymin;
}
/* cleanup */
@@ -281,7 +281,7 @@ static int nlaedit_borderselect_exec(bContext *C, wmOperator *op)
{
bAnimContext ac;
rcti rect;
- short mode=0, selectmode=0;
+ short mode = 0, selectmode = 0;
int extend;
/* get editor data */
@@ -289,7 +289,7 @@ static int nlaedit_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_nla_strips(&ac, DESELECT_STRIPS_TEST, SELECT_SUBTRACT);
@@ -312,18 +312,18 @@ static int nlaedit_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= NLA_BORDERSEL_FRAMERANGE;
+ mode = NLA_BORDERSEL_FRAMERANGE;
else
- mode= NLA_BORDERSEL_CHANNELS;
+ mode = NLA_BORDERSEL_CHANNELS;
}
else
- mode= NLA_BORDERSEL_ALLSTRIPS;
+ mode = NLA_BORDERSEL_ALLSTRIPS;
/* apply borderselect action */
borderselect_nla_strips(&ac, rect, mode, selectmode);
/* set notifier that things have changed */
- WM_event_add_notifier(C, NC_ANIMATION|ND_NLA|NA_SELECTED, NULL);
+ WM_event_add_notifier(C, NC_ANIMATION | ND_NLA | NA_SELECTED, NULL);
return OPERATOR_FINISHED;
}
@@ -344,7 +344,7 @@ void NLA_OT_select_border(wmOperatorType *ot)
ot->poll = nlaop_poll_tweakmode_off;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* rna */
WM_operator_properties_gesture_border(ot, 1);
@@ -365,13 +365,13 @@ static EnumPropertyItem prop_nlaedit_leftright_select_types[] = {
/* ------------------- */
-static void nlaedit_select_leftright (bContext *C, bAnimContext *ac, short leftright, short select_mode)
+static void nlaedit_select_leftright(bContext *C, bAnimContext *ac, short leftright, short select_mode)
{
ListBase anim_data = {NULL, NULL};
bAnimListElem *ale;
int filter;
- Scene *scene= ac->scene;
+ Scene *scene = ac->scene;
float xmin, xmax;
/* if currently in tweakmode, exit tweakmode first */
@@ -379,8 +379,8 @@ static void nlaedit_select_leftright (bContext *C, bAnimContext *ac, short leftr
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) {
- 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
@@ -398,20 +398,20 @@ static void nlaedit_select_leftright (bContext *C, bAnimContext *ac, short leftr
xmax = MAXFRAMEF;
}
- select_mode= selmodes_to_flagmodes(select_mode);
+ select_mode = selmodes_to_flagmodes(select_mode);
/* filter data */
- 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);
/* select strips on the side where most data occurs */
- for (ale= anim_data.first; ale; ale= ale->next) {
- NlaTrack *nlt= (NlaTrack *)ale->data;
+ for (ale = anim_data.first; ale; ale = ale->next) {
+ NlaTrack *nlt = (NlaTrack *)ale->data;
NlaStrip *strip;
/* check each strip to see if it is appropriate */
- for (strip= nlt->strips.first; strip; strip= strip->next) {
+ for (strip = nlt->strips.first; strip; strip = strip->next) {
if (BKE_nlastrip_within_bounds(strip, xmin, xmax)) {
ACHANNEL_SET_FLAG(strip, select_mode, NLASTRIP_FLAG_SELECT);
}
@@ -424,7 +424,7 @@ static void nlaedit_select_leftright (bContext *C, bAnimContext *ac, short leftr
/* ------------------- */
-static int nlaedit_select_leftright_exec (bContext *C, wmOperator *op)
+static int nlaedit_select_leftright_exec(bContext *C, wmOperator *op)
{
bAnimContext ac;
short leftright = RNA_enum_get(op->ptr, "mode");
@@ -436,9 +436,9 @@ static int nlaedit_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 == NLAEDIT_LRSEL_TEST)
@@ -448,12 +448,12 @@ static int nlaedit_select_leftright_exec (bContext *C, wmOperator *op)
nlaedit_select_leftright(C, &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 nlaedit_select_leftright_invoke (bContext *C, wmOperator *op, wmEvent *event)
+static int nlaedit_select_leftright_invoke(bContext *C, wmOperator *op, wmEvent *event)
{
bAnimContext ac;
short leftright = RNA_enum_get(op->ptr, "mode");
@@ -464,9 +464,9 @@ static int nlaedit_select_leftright_invoke (bContext *C, wmOperator *op, wmEvent
/* handle mode-based testing */
if (leftright == NLAEDIT_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 */
@@ -494,7 +494,7 @@ void NLA_OT_select_leftright(wmOperatorType *ot)
ot->poll = ED_operator_nla_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_nlaedit_leftright_select_types, NLAEDIT_LRSEL_TEST, "Mode", "");
@@ -505,15 +505,15 @@ void NLA_OT_select_leftright(wmOperatorType *ot)
/* ******************** Mouse-Click Select Operator *********************** */
/* select strip directly under mouse */
-static void mouse_nla_strips (bContext *C, bAnimContext *ac, const int mval[2], short select_mode)
+static void mouse_nla_strips(bContext *C, bAnimContext *ac, const int mval[2], short select_mode)
{
ListBase anim_data = {NULL, NULL};
bAnimListElem *ale = NULL;
int filter;
SpaceNla *snla = (SpaceNla *)ac->sl;
- View2D *v2d= &ac->ar->v2d;
- Scene *scene= ac->scene;
+ View2D *v2d = &ac->ar->v2d;
+ Scene *scene = ac->scene;
NlaStrip *strip = NULL;
int channel_index;
float xmin, xmax, dummy;
@@ -527,15 +527,15 @@ static void mouse_nla_strips (bContext *C, bAnimContext *ac, const int mval[2],
/* x-range to check is +/- 7 (in screen/region-space) on either side of mouse click
* (that is the size of keyframe icons, so user should be expecting similar tolerances)
*/
- UI_view2d_region_to_view(v2d, mval[0]-7, mval[1], &xmin, &dummy);
- UI_view2d_region_to_view(v2d, mval[0]+7, mval[1], &xmax, &dummy);
+ UI_view2d_region_to_view(v2d, mval[0] - 7, mval[1], &xmin, &dummy);
+ UI_view2d_region_to_view(v2d, mval[0] + 7, mval[1], &xmax, &dummy);
/* 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_nla_strips()\n", channel_index);
@@ -545,10 +545,10 @@ static void mouse_nla_strips (bContext *C, bAnimContext *ac, const int mval[2],
else {
/* found some channel - we only really should do somethign when its an Nla-Track */
if (ale->type == ANIMTYPE_NLATRACK) {
- NlaTrack *nlt= (NlaTrack *)ale->data;
+ NlaTrack *nlt = (NlaTrack *)ale->data;
/* 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) {
+ for (strip = nlt->strips.first; strip; strip = strip->next) {
if (BKE_nlastrip_within_bounds(strip, xmin, xmax))
break;
}
@@ -580,7 +580,7 @@ static void mouse_nla_strips (bContext *C, bAnimContext *ac, const int mval[2],
/* Highlight NLA-Track */
if (ale->type == ANIMTYPE_NLATRACK) {
- NlaTrack *nlt= (NlaTrack *)ale->data;
+ NlaTrack *nlt = (NlaTrack *)ale->data;
nlt->flag |= NLATRACK_SELECTED;
ANIM_set_active_channel(ac, ac->data, ac->datatype, filter, nlt, ANIMTYPE_NLATRACK);
@@ -591,7 +591,7 @@ static void mouse_nla_strips (bContext *C, bAnimContext *ac, const int mval[2],
if (ale) {
/* select the strip accordingly (if a matching one was found) */
if (strip) {
- select_mode= selmodes_to_flagmodes(select_mode);
+ select_mode = selmodes_to_flagmodes(select_mode);
ACHANNEL_SET_FLAG(strip, select_mode, NLASTRIP_FLAG_SELECT);
/* if we selected it, we can make it active too
@@ -629,18 +629,18 @@ static int nlaedit_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;
/* select strips based upon mouse position */
mouse_nla_strips(C, &ac, event->mval, selectmode);
/* set notifier that things have changed */
- WM_event_add_notifier(C, NC_ANIMATION|ND_NLA|NA_SELECTED, NULL);
+ WM_event_add_notifier(C, NC_ANIMATION | ND_NLA | NA_SELECTED, NULL);
/* for tweak grab to work */
- return OPERATOR_FINISHED|OPERATOR_PASS_THROUGH;
+ return OPERATOR_FINISHED | OPERATOR_PASS_THROUGH;
}
void NLA_OT_click_select(wmOperatorType *ot)
@@ -655,7 +655,7 @@ void NLA_OT_click_select(wmOperatorType *ot)
ot->poll = ED_operator_nla_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