From 855c11ff8c3363521ac956f4a1b8991a66d774ad Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 8 May 2012 16:02:13 +0000 Subject: [PATCH] style cleanup: space action --- .../editors/space_action/action_draw.c | 118 +++---- .../editors/space_action/action_edit.c | 324 ++++++++--------- .../editors/space_action/action_intern.h | 4 +- .../blender/editors/space_action/action_ops.c | 90 ++--- .../editors/space_action/action_select.c | 332 +++++++++--------- .../editors/space_action/space_action.c | 140 ++++---- 6 files changed, 504 insertions(+), 504 deletions(-) diff --git a/source/blender/editors/space_action/action_draw.c b/source/blender/editors/space_action/action_draw.c index 024a9ffb57d..3961e566f80 100644 --- a/source/blender/editors/space_action/action_draw.c +++ b/source/blender/editors/space_action/action_draw.c @@ -73,22 +73,22 @@ void draw_channel_names(bContext *C, bAnimContext *ac, ARegion *ar) bAnimListElem *ale; int filter; - View2D *v2d= &ar->v2d; - float y= 0.0f; + View2D *v2d = &ar->v2d; + float y = 0.0f; size_t items; int height; /* build list of channels to draw */ - filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_LIST_CHANNELS); - items= ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype); + filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_LIST_CHANNELS); + items = ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype); /* Update max-extent of channels here (taking into account scrollers): - * - this is done to allow the channel list to be scrollable, but must be done here - * to avoid regenerating the list again and/or also because channels list is drawn first + * - this is done to allow the channel list to be scrollable, but must be done here + * to avoid regenerating the list again and/or also because channels list is drawn first * - offset of ACHANNEL_HEIGHT*2 is added to the height of the channels, as first is for * start of list offset, and the second is as a correction for the scrollers. */ - height= ((items*ACHANNEL_STEP) + (ACHANNEL_HEIGHT*2)); + height = ((items * ACHANNEL_STEP) + (ACHANNEL_HEIGHT * 2)); if (height > (v2d->mask.ymax - v2d->mask.ymin)) { /* don't use totrect set, as the width stays the same * (NOTE: this is ok here, the configuration is pretty straightforward) @@ -99,16 +99,16 @@ void draw_channel_names(bContext *C, bAnimContext *ac, ARegion *ar) UI_view2d_sync(NULL, ac->sa, v2d, V2D_LOCK_COPY); /* loop through channels, and set up drawing depending on their type */ - { /* first pass: just the standard GL-drawing for backdrop + text */ - y= (float)ACHANNEL_FIRST; + { /* first pass: just the standard GL-drawing for backdrop + text */ + y = (float)ACHANNEL_FIRST; - for (ale= anim_data.first; ale; ale= ale->next) { - float yminc= (float)(y - ACHANNEL_HEIGHT_HALF); - float ymaxc= (float)(y + ACHANNEL_HEIGHT_HALF); + for (ale = anim_data.first; ale; ale = ale->next) { + float yminc = (float)(y - ACHANNEL_HEIGHT_HALF); + float ymaxc = (float)(y + ACHANNEL_HEIGHT_HALF); /* check if visible */ - if ( IN_RANGE(yminc, v2d->cur.ymin, v2d->cur.ymax) || - IN_RANGE(ymaxc, v2d->cur.ymin, v2d->cur.ymax) ) + if (IN_RANGE(yminc, v2d->cur.ymin, v2d->cur.ymax) || + IN_RANGE(ymaxc, v2d->cur.ymin, v2d->cur.ymax) ) { /* draw all channels using standard channel-drawing API */ ANIM_channel_draw(ac, ale, yminc, ymaxc); @@ -118,19 +118,19 @@ void draw_channel_names(bContext *C, bAnimContext *ac, ARegion *ar) y -= ACHANNEL_STEP; } } - { /* second pass: widgets */ - uiBlock *block= uiBeginBlock(C, ar, __func__, UI_EMBOSS); + { /* second pass: widgets */ + uiBlock *block = uiBeginBlock(C, ar, __func__, UI_EMBOSS); size_t channel_index = 0; - y= (float)ACHANNEL_FIRST; + y = (float)ACHANNEL_FIRST; - for (ale= anim_data.first; ale; ale= ale->next) { - float yminc= (float)(y - ACHANNEL_HEIGHT_HALF); - float ymaxc= (float)(y + ACHANNEL_HEIGHT_HALF); + for (ale = anim_data.first; ale; ale = ale->next) { + float yminc = (float)(y - ACHANNEL_HEIGHT_HALF); + float ymaxc = (float)(y + ACHANNEL_HEIGHT_HALF); /* check if visible */ - if ( IN_RANGE(yminc, v2d->cur.ymin, v2d->cur.ymax) || - IN_RANGE(ymaxc, v2d->cur.ymin, v2d->cur.ymax) ) + if (IN_RANGE(yminc, v2d->cur.ymin, v2d->cur.ymax) || + IN_RANGE(ymaxc, v2d->cur.ymin, v2d->cur.ymax) ) { /* draw all channels using standard channel-drawing API */ ANIM_channel_draw_widgets(C, ac, ale, block, yminc, ymaxc, channel_index); @@ -153,7 +153,7 @@ void draw_channel_names(bContext *C, bAnimContext *ac, ARegion *ar) /* Keyframes */ /* extra padding for lengths (to go under scrollers) */ -#define EXTRA_SCROLL_PAD 100.0f +#define EXTRA_SCROLL_PAD 100.0f /* draw keyframes in each channel */ void draw_channel_strips(bAnimContext *ac, SpaceAction *saction, ARegion *ar) @@ -162,9 +162,9 @@ void draw_channel_strips(bAnimContext *ac, SpaceAction *saction, ARegion *ar) bAnimListElem *ale; int filter; - View2D *v2d= &ar->v2d; - bDopeSheet *ads= &saction->ads; - AnimData *adt= NULL; + View2D *v2d = &ar->v2d; + bDopeSheet *ads = &saction->ads; + AnimData *adt = NULL; float act_start, act_end, y; size_t items; @@ -196,41 +196,41 @@ void draw_channel_strips(bAnimContext *ac, SpaceAction *saction, ARegion *ar) } /* build list of channels to draw */ - filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_LIST_CHANNELS); - items= ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype); + filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_LIST_CHANNELS); + items = ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype); /* Update max-extent of channels here (taking into account scrollers): - * - this is done to allow the channel list to be scrollable, but must be done here - * to avoid regenerating the list again and/or also because channels list is drawn first + * - this is done to allow the channel list to be scrollable, but must be done here + * to avoid regenerating the list again and/or also because channels list is drawn first * - offset of ACHANNEL_HEIGHT*2 is added to the height of the channels, as first is for * start of list offset, and the second is as a correction for the scrollers. */ - height= ((items*ACHANNEL_STEP) + (ACHANNEL_HEIGHT*2)); + height = ((items * ACHANNEL_STEP) + (ACHANNEL_HEIGHT * 2)); /* don't use totrect set, as the width stays the same * (NOTE: this is ok here, the configuration is pretty straightforward) */ v2d->tot.ymin = (float)(-height); /* first backdrop strips */ - y= (float)(-ACHANNEL_HEIGHT); + y = (float)(-ACHANNEL_HEIGHT); glEnable(GL_BLEND); - for (ale= anim_data.first; ale; ale= ale->next) { - const float yminc= (float)(y - ACHANNEL_HEIGHT_HALF); - const float ymaxc= (float)(y + ACHANNEL_HEIGHT_HALF); + for (ale = anim_data.first; ale; ale = ale->next) { + const float yminc = (float)(y - ACHANNEL_HEIGHT_HALF); + const float ymaxc = (float)(y + ACHANNEL_HEIGHT_HALF); /* check if visible */ - if ( IN_RANGE(yminc, v2d->cur.ymin, v2d->cur.ymax) || - IN_RANGE(ymaxc, v2d->cur.ymin, v2d->cur.ymax) ) + if (IN_RANGE(yminc, v2d->cur.ymin, v2d->cur.ymax) || + IN_RANGE(ymaxc, v2d->cur.ymin, v2d->cur.ymax) ) { - bAnimChannelType *acf= ANIM_channel_get_typeinfo(ale); - int sel=0; + bAnimChannelType *acf = ANIM_channel_get_typeinfo(ale); + int sel = 0; /* 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)) - sel= ANIM_channel_setting_get(ac, ale, ACHANNEL_SETTING_SELECT); + sel = ANIM_channel_setting_get(ac, ale, ACHANNEL_SETTING_SELECT); if (ELEM3(ac->datatype, ANIMCONT_ACTION, ANIMCONT_DOPESHEET, ANIMCONT_SHAPEKEY)) { switch (ale->type) { @@ -239,7 +239,7 @@ void draw_channel_strips(bAnimContext *ac, SpaceAction *saction, ARegion *ar) // FIXME: hardcoded colors - reddish color from NLA glColor4f(0.8f, 0.2f, 0.0f, 0.4f); } - break; + break; case ANIMTYPE_SCENE: case ANIMTYPE_OBJECT: @@ -247,7 +247,7 @@ void draw_channel_strips(bAnimContext *ac, SpaceAction *saction, ARegion *ar) if (sel) glColor4ub(col1b[0], col1b[1], col1b[2], 0x45); else glColor4ub(col1b[0], col1b[1], col1b[2], 0x22); } - break; + break; case ANIMTYPE_FILLACTD: case ANIMTYPE_DSSKEY: @@ -256,39 +256,39 @@ void draw_channel_strips(bAnimContext *ac, SpaceAction *saction, ARegion *ar) if (sel) glColor4ub(col2b[0], col2b[1], col2b[2], 0x45); else glColor4ub(col2b[0], col2b[1], col2b[2], 0x22); } - break; + break; case ANIMTYPE_GROUP: { if (sel) glColor4ub(col1a[0], col1a[1], col1a[2], 0x22); else glColor4ub(col2a[0], col2a[1], col2a[2], 0x22); } - break; + break; default: { if (sel) glColor4ub(col1[0], col1[1], col1[2], 0x22); else glColor4ub(col2[0], col2[1], col2[2], 0x22); } - break; + break; } /* draw region twice: firstly backdrop, then the current range */ - glRectf(v2d->cur.xmin, (float)y-ACHANNEL_HEIGHT_HALF, v2d->cur.xmax+EXTRA_SCROLL_PAD, (float)y+ACHANNEL_HEIGHT_HALF); + glRectf(v2d->cur.xmin, (float)y - ACHANNEL_HEIGHT_HALF, v2d->cur.xmax + EXTRA_SCROLL_PAD, (float)y + ACHANNEL_HEIGHT_HALF); if (ac->datatype == ANIMCONT_ACTION) - glRectf(act_start, (float)y-ACHANNEL_HEIGHT_HALF, act_end, (float)y+ACHANNEL_HEIGHT_HALF); + glRectf(act_start, (float)y - ACHANNEL_HEIGHT_HALF, act_end, (float)y + ACHANNEL_HEIGHT_HALF); } else if (ac->datatype == ANIMCONT_GPENCIL) { /* frames less than one get less saturated background */ if (sel) glColor4ub(col1[0], col1[1], col1[2], 0x22); else glColor4ub(col2[0], col2[1], col2[2], 0x22); - glRectf(0.0f, (float)y-ACHANNEL_HEIGHT_HALF, v2d->cur.xmin, (float)y+ACHANNEL_HEIGHT_HALF); + glRectf(0.0f, (float)y - ACHANNEL_HEIGHT_HALF, v2d->cur.xmin, (float)y + ACHANNEL_HEIGHT_HALF); /* frames one and higher get a saturated background */ if (sel) glColor4ub(col1[0], col1[1], col1[2], 0x44); else glColor4ub(col2[0], col2[1], col2[2], 0x44); - glRectf(v2d->cur.xmin, (float)y-ACHANNEL_HEIGHT_HALF, v2d->cur.xmax+EXTRA_SCROLL_PAD, (float)y+ACHANNEL_HEIGHT_HALF); + glRectf(v2d->cur.xmin, (float)y - ACHANNEL_HEIGHT_HALF, v2d->cur.xmax + EXTRA_SCROLL_PAD, (float)y + ACHANNEL_HEIGHT_HALF); } } } @@ -303,19 +303,19 @@ void draw_channel_strips(bAnimContext *ac, SpaceAction *saction, ARegion *ar) * This is to try to optimize this for heavier data sets * 2) Keyframes which are out of view horizontally are disregarded */ - y= (float)(-ACHANNEL_HEIGHT); + y = (float)(-ACHANNEL_HEIGHT); - for (ale= anim_data.first; ale; ale= ale->next) { - const float yminc= (float)(y - ACHANNEL_HEIGHT_HALF); - const float ymaxc= (float)(y + ACHANNEL_HEIGHT_HALF); + for (ale = anim_data.first; ale; ale = ale->next) { + const float yminc = (float)(y - ACHANNEL_HEIGHT_HALF); + const float ymaxc = (float)(y + ACHANNEL_HEIGHT_HALF); /* check if visible */ - if ( IN_RANGE(yminc, v2d->cur.ymin, v2d->cur.ymax) || - IN_RANGE(ymaxc, v2d->cur.ymin, v2d->cur.ymax) ) + if (IN_RANGE(yminc, v2d->cur.ymin, v2d->cur.ymax) || + IN_RANGE(ymaxc, v2d->cur.ymin, v2d->cur.ymax) ) { /* check if anything to show for this channel */ if (ale->datatype != ALE_NONE) { - adt= ANIM_nla_mapping_get(ac, ale); + adt = ANIM_nla_mapping_get(ac, ale); /* draw 'keyframes' for each specific datatype */ switch (ale->datatype) { @@ -344,7 +344,7 @@ void draw_channel_strips(bAnimContext *ac, SpaceAction *saction, ARegion *ar) } } - y-= ACHANNEL_STEP; + y -= ACHANNEL_STEP; } /* free tempolary channels used for drawing */ @@ -355,8 +355,8 @@ void draw_channel_strips(bAnimContext *ac, SpaceAction *saction, ARegion *ar) glColor3f(0.0f, 0.0f, 0.0f); glBegin(GL_LINES); - glVertex2f(saction->timeslide, v2d->cur.ymin-EXTRA_SCROLL_PAD); - glVertex2f(saction->timeslide, v2d->cur.ymax); + glVertex2f(saction->timeslide, v2d->cur.ymin - EXTRA_SCROLL_PAD); + glVertex2f(saction->timeslide, v2d->cur.ymax); glEnd(); } } diff --git a/source/blender/editors/space_action/action_edit.c b/source/blender/editors/space_action/action_edit.c index 723efdc484c..73c36fd8086 100644 --- a/source/blender/editors/space_action/action_edit.c +++ b/source/blender/editors/space_action/action_edit.c @@ -86,7 +86,7 @@ static int act_new_exec(bContext *C, wmOperator *UNUSED(op)) uiIDContextProperty(C, &ptr, &prop); if (prop) { - bAction *action=NULL, *oldact=NULL; + bAction *action = NULL, *oldact = NULL; PointerRNA oldptr; /* create action - the way to do this depends on whether we've got an @@ -96,13 +96,13 @@ static int act_new_exec(bContext *C, wmOperator *UNUSED(op)) oldptr = RNA_property_pointer_get(&ptr, prop); oldact = (bAction *)oldptr.id.data; - if (oldact && GS(oldact->id.name)==ID_AC) { + if (oldact && GS(oldact->id.name) == ID_AC) { /* make a copy of the existing action */ - action= BKE_action_copy(oldact); + action = BKE_action_copy(oldact); } else { /* just make a new (empty) action */ - action= add_empty_action("Action"); + action = add_empty_action("Action"); } /* when creating new ID blocks, use is already 1 (fake user), @@ -116,7 +116,7 @@ static int act_new_exec(bContext *C, wmOperator *UNUSED(op)) } /* set notifier that keyframes have changed */ - WM_event_add_notifier(C, NC_ANIMATION|ND_KEYFRAME|NA_EDITED, NULL); + WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, NULL); return OPERATOR_FINISHED; } @@ -130,11 +130,11 @@ void ACTION_OT_new(wmOperatorType *ot) /* api callbacks */ ot->exec = act_new_exec; - // NOTE: this is used in the NLA too... + // NOTE: this is used in the NLA too... //ot->poll = ED_operator_action_active; /* flags */ - ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO; + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; } /* ************************************************************************** */ @@ -143,9 +143,9 @@ void ACTION_OT_new(wmOperatorType *ot) /* *************************** Localise Markers ***************************** */ /* ensure that there is: - * 1) an active action editor - * 2) that the mode will have an active action available - * 3) that the set of markers being shown are the scene markers, not the list we're merging + * 1) an active action editor + * 2) that the mode will have an active action available + * 3) that the set of markers being shown are the scene markers, not the list we're merging * 4) that there are some selected markers */ static int act_markers_make_local_poll(bContext *C) @@ -170,14 +170,14 @@ static int act_markers_make_local_poll(bContext *C) return ED_markers_get_first_selected(ED_context_get_markers(C)) != NULL; } -static int act_markers_make_local_exec (bContext *C, wmOperator *UNUSED(op)) +static int act_markers_make_local_exec(bContext *C, wmOperator *UNUSED(op)) { ListBase *markers = ED_context_get_markers(C); SpaceAction *sact = CTX_wm_space_action(C); - bAction *act = (sact)? sact->action : NULL; + bAction *act = (sact) ? sact->action : NULL; - TimeMarker *marker, *markern=NULL; + TimeMarker *marker, *markern = NULL; /* sanity checks */ if (ELEM(NULL, markers, act)) @@ -198,8 +198,8 @@ static int act_markers_make_local_exec (bContext *C, wmOperator *UNUSED(op)) sact->flag |= SACTION_POSEMARKERS_SHOW; /* notifiers - both sets, as this change affects both */ - WM_event_add_notifier(C, NC_SCENE|ND_MARKERS, NULL); - WM_event_add_notifier(C, NC_ANIMATION|ND_MARKERS, NULL); + WM_event_add_notifier(C, NC_SCENE | ND_MARKERS, NULL); + WM_event_add_notifier(C, NC_ANIMATION | ND_MARKERS, NULL); return OPERATOR_FINISHED; } @@ -216,7 +216,7 @@ void ACTION_OT_markers_make_local(wmOperatorType *ot) ot->poll = act_markers_make_local_poll; /* flags */ - ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO; + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; } /* ************************************************************************** */ @@ -225,7 +225,7 @@ void ACTION_OT_markers_make_local(wmOperatorType *ot) /* *************************** Calculate Range ************************** */ /* Get the min/max keyframes*/ -static void get_keyframe_extents (bAnimContext *ac, float *min, float *max, const short onlySel) +static void get_keyframe_extents(bAnimContext *ac, float *min, float *max, const short onlySel) { ListBase anim_data = {NULL, NULL}; bAnimListElem *ale; @@ -234,43 +234,43 @@ static void get_keyframe_extents (bAnimContext *ac, float *min, float *max, cons /* get data to filter, from Action or Dopesheet */ // XXX: what is sel doing here?! // Commented it, was breaking things (eg. the "auto preview range" tool). - filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE /*| ANIMFILTER_SEL *//*| ANIMFILTER_CURVESONLY*/ | ANIMFILTER_NODUPLIS); + filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE /*| ANIMFILTER_SEL *//*| ANIMFILTER_CURVESONLY*/ | ANIMFILTER_NODUPLIS); ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype); /* set large values to try to override */ - *min= 999999999.0f; - *max= -999999999.0f; + *min = 999999999.0f; + *max = -999999999.0f; /* check if any channels to set range with */ if (anim_data.first) { /* go through channels, finding max extents */ - 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 (ale->datatype == ALE_GPFRAME) { - bGPDlayer *gpl= ale->data; + bGPDlayer *gpl = ale->data; bGPDframe *gpf; /* find gp-frame which is less than or equal to cframe */ - for (gpf= gpl->frames.first; gpf; gpf= gpf->next) { - *min= MIN2(*min, gpf->framenum); - *max= MAX2(*max, gpf->framenum); + for (gpf = gpl->frames.first; gpf; gpf = gpf->next) { + *min = MIN2(*min, gpf->framenum); + *max = MAX2(*max, gpf->framenum); } } else { - FCurve *fcu= (FCurve *)ale->key_data; + FCurve *fcu = (FCurve *)ale->key_data; float tmin, tmax; /* get range and apply necessary scaling before processing */ calc_fcurve_range(fcu, &tmin, &tmax, onlySel, TRUE); if (adt) { - tmin= BKE_nla_tweakedit_remap(adt, tmin, NLATIME_CONVERT_MAP); - tmax= BKE_nla_tweakedit_remap(adt, tmax, NLATIME_CONVERT_MAP); + tmin = BKE_nla_tweakedit_remap(adt, tmin, NLATIME_CONVERT_MAP); + tmax = BKE_nla_tweakedit_remap(adt, tmax, NLATIME_CONVERT_MAP); } /* try to set cur using these values, if they're more extreme than previously set values */ - *min= MIN2(*min, tmin); - *max= MAX2(*max, tmax); + *min = MIN2(*min, tmin); + *max = MAX2(*max, tmax); } } @@ -280,12 +280,12 @@ static void get_keyframe_extents (bAnimContext *ac, float *min, float *max, cons else { /* set default range */ if (ac->scene) { - *min= (float)ac->scene->r.sfra; - *max= (float)ac->scene->r.efra; + *min = (float)ac->scene->r.sfra; + *max = (float)ac->scene->r.efra; } else { - *min= -5; - *max= 100; + *min = -5; + *max = 100; } } } @@ -304,17 +304,17 @@ static int actkeys_previewrange_exec(bContext *C, wmOperator *UNUSED(op)) if (ac.scene == NULL) return OPERATOR_CANCELLED; else - scene= ac.scene; + scene = ac.scene; /* set the range directly */ get_keyframe_extents(&ac, &min, &max, FALSE); scene->r.flag |= SCER_PRV_RANGE; - scene->r.psfra= (int)floor(min + 0.5f); - scene->r.pefra= (int)floor(max + 0.5f); + scene->r.psfra = (int)floor(min + 0.5f); + scene->r.pefra = (int)floor(max + 0.5f); /* set notifier that things have changed */ // XXX err... there's nothing for frame ranges yet, but this should do fine too - WM_event_add_notifier(C, NC_SCENE|ND_FRAME, ac.scene); + WM_event_add_notifier(C, NC_SCENE | ND_FRAME, ac.scene); return OPERATOR_FINISHED; } @@ -331,7 +331,7 @@ void ACTION_OT_previewrange_set(wmOperatorType *ot) ot->poll = ED_operator_action_active; /* flags */ - ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO; + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; } /* ****************** View-All Operator ****************** */ @@ -345,12 +345,12 @@ static int actkeys_viewall(bContext *C, const short onlySel) /* get editor data */ if (ANIM_animdata_get_context(C, &ac) == 0) return OPERATOR_CANCELLED; - v2d= &ac.ar->v2d; + v2d = &ac.ar->v2d; /* set the horizontal range, with an extra offset so that the extreme keys will be in view */ get_keyframe_extents(&ac, &v2d->cur.xmin, &v2d->cur.xmax, onlySel); - extra= 0.1f * (v2d->cur.xmax - v2d->cur.xmin); + extra = 0.1f * (v2d->cur.xmax - v2d->cur.xmin); v2d->cur.xmin -= extra; v2d->cur.xmax += extra; @@ -393,7 +393,7 @@ void ACTION_OT_view_all(wmOperatorType *ot) ot->poll = ED_operator_action_active; /* flags */ - ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO; + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; } void ACTION_OT_view_selected(wmOperatorType *ot) @@ -408,7 +408,7 @@ void ACTION_OT_view_selected(wmOperatorType *ot) ot->poll = ED_operator_action_active; /* flags */ - ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO; + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; } /* ************************************************************************** */ @@ -417,20 +417,20 @@ void ACTION_OT_view_selected(wmOperatorType *ot) /* ******************** Copy/Paste Keyframes Operator ************************* */ /* NOTE: the backend code for this is shared with the graph editor */ -static short copy_action_keys (bAnimContext *ac) +static short copy_action_keys(bAnimContext *ac) { ListBase anim_data = {NULL, NULL}; - int filter, ok=0; + int filter, ok = 0; /* clear buffer first */ free_anim_copybuf(); /* 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); /* copy keyframes */ - ok= copy_animedit_keys(ac, &anim_data); + ok = copy_animedit_keys(ac, &anim_data); /* clean up */ BLI_freelistN(&anim_data); @@ -439,18 +439,18 @@ static short copy_action_keys (bAnimContext *ac) } -static short paste_action_keys (bAnimContext *ac, - const eKeyPasteOffset offset_mode, const eKeyMergeMode merge_mode) +static short paste_action_keys(bAnimContext *ac, + const eKeyPasteOffset offset_mode, const eKeyMergeMode merge_mode) { ListBase anim_data = {NULL, NULL}; - int filter, ok=0; + int filter, ok = 0; /* filter data */ - filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_SEL | ANIMFILTER_FOREDIT /*| ANIMFILTER_CURVESONLY*/ | ANIMFILTER_NODUPLIS); + filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_SEL | ANIMFILTER_FOREDIT /*| ANIMFILTER_CURVESONLY*/ | ANIMFILTER_NODUPLIS); ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype); /* paste keyframes */ - ok= paste_animedit_keys(ac, &anim_data, offset_mode, merge_mode); + ok = paste_animedit_keys(ac, &anim_data, offset_mode, merge_mode); /* clean up */ BLI_freelistN(&anim_data); @@ -496,22 +496,22 @@ void ACTION_OT_copy(wmOperatorType *ot) ot->poll = ED_operator_action_active; /* flags */ - ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO; + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; } static int actkeys_paste_exec(bContext *C, wmOperator *op) { bAnimContext ac; - const eKeyPasteOffset offset_mode= RNA_enum_get(op->ptr, "offset"); - const eKeyMergeMode merge_mode= RNA_enum_get(op->ptr, "merge"); + const eKeyPasteOffset offset_mode = RNA_enum_get(op->ptr, "offset"); + const eKeyMergeMode merge_mode = RNA_enum_get(op->ptr, "merge"); /* get editor data */ 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; + ac.reports = op->reports; /* paste keyframes */ if (ac.datatype == ANIMCONT_GPENCIL) { @@ -530,7 +530,7 @@ static int actkeys_paste_exec(bContext *C, wmOperator *op) ANIM_editkeyframes_refresh(&ac); /* set notifier that keyframes have changed */ - WM_event_add_notifier(C, NC_ANIMATION|ND_KEYFRAME|NA_EDITED, NULL); + WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, NULL); return OPERATOR_FINISHED; } @@ -548,7 +548,7 @@ void ACTION_OT_paste(wmOperatorType *ot) ot->poll = ED_operator_action_active; /* flags */ - ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO; + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; /* props */ RNA_def_enum(ot->srna, "offset", keyframe_paste_offset_items, KEYFRAME_PASTE_OFFSET_CFRA_START, "Offset", "Paste time offset of keys"); @@ -573,13 +573,13 @@ static void insert_action_keys(bAnimContext *ac, short mode) int filter; ReportList *reports = ac->reports; - Scene *scene= ac->scene; + Scene *scene = ac->scene; short flag = 0; /* filter data */ - filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_FOREDIT /*| ANIMFILTER_CURVESONLY*/ | ANIMFILTER_NODUPLIS); - if (mode == 2) filter |= ANIMFILTER_SEL; - else if (mode == 3) filter |= ANIMFILTER_ACTGROUPED; + filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_FOREDIT /*| ANIMFILTER_CURVESONLY*/ | ANIMFILTER_NODUPLIS); + if (mode == 2) filter |= ANIMFILTER_SEL; + else if (mode == 3) filter |= ANIMFILTER_ACTGROUPED; ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype); @@ -587,20 +587,20 @@ static void insert_action_keys(bAnimContext *ac, short mode) flag = ANIM_get_keyframing_flags(scene, 1); /* insert keyframes */ - for (ale= anim_data.first; ale; ale= ale->next) { - AnimData *adt= ANIM_nla_mapping_get(ac, ale); - FCurve *fcu= (FCurve *)ale->key_data; + for (ale = anim_data.first; ale; ale = ale->next) { + AnimData *adt = ANIM_nla_mapping_get(ac, ale); + FCurve *fcu = (FCurve *)ale->key_data; float cfra; /* adjust current frame for NLA-scaling */ if (adt) - cfra= BKE_nla_tweakedit_remap(adt, (float)CFRA, NLATIME_CONVERT_UNMAP); + cfra = BKE_nla_tweakedit_remap(adt, (float)CFRA, NLATIME_CONVERT_UNMAP); else - cfra= (float)CFRA; + cfra = (float)CFRA; /* if there's an id */ if (ale->id) - insert_keyframe(reports, ale->id, NULL, ((fcu->grp)?(fcu->grp->name):(NULL)), fcu->rna_path, fcu->array_index, cfra, flag); + insert_keyframe(reports, ale->id, NULL, ((fcu->grp) ? (fcu->grp->name) : (NULL)), fcu->rna_path, fcu->array_index, cfra, flag); else insert_vert_fcurve(fcu, cfra, fcu->curval, 0); } @@ -622,7 +622,7 @@ static int actkeys_insertkey_exec(bContext *C, wmOperator *op) return OPERATOR_CANCELLED; /* what channels to affect? */ - mode= RNA_enum_get(op->ptr, "type"); + mode = RNA_enum_get(op->ptr, "type"); /* insert keyframes */ insert_action_keys(&ac, mode); @@ -631,7 +631,7 @@ static int actkeys_insertkey_exec(bContext *C, wmOperator *op) ANIM_editkeyframes_refresh(&ac); /* set notifier that keyframes have changed */ - WM_event_add_notifier(C, NC_ANIMATION|ND_KEYFRAME|NA_EDITED, NULL); + WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, NULL); return OPERATOR_FINISHED; } @@ -649,7 +649,7 @@ void ACTION_OT_keyframe_insert(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, "type", prop_actkeys_insertkey_types, 0, "Type", ""); @@ -657,7 +657,7 @@ void ACTION_OT_keyframe_insert(wmOperatorType *ot) /* ******************** Duplicate Keyframes Operator ************************* */ -static void duplicate_action_keys (bAnimContext *ac) +static void duplicate_action_keys(bAnimContext *ac) { ListBase anim_data = {NULL, NULL}; bAnimListElem *ale; @@ -665,13 +665,13 @@ static void duplicate_action_keys (bAnimContext *ac) /* filter data */ if (ac->datatype == ANIMCONT_GPENCIL) - filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_NODUPLIS); + filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_NODUPLIS); else - filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_FOREDIT /*| ANIMFILTER_CURVESONLY*/ | ANIMFILTER_NODUPLIS); + filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_FOREDIT /*| ANIMFILTER_CURVESONLY*/ | ANIMFILTER_NODUPLIS); ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype); /* loop through filtered data and delete selected keys */ - for (ale= anim_data.first; ale; ale= ale->next) { + for (ale = anim_data.first; ale; ale = ale->next) { if (ale->type == ANIMTYPE_FCURVE) duplicate_fcurve_keys((FCurve *)ale->key_data); else @@ -700,7 +700,7 @@ static int actkeys_duplicate_exec(bContext *C, wmOperator *UNUSED(op)) ANIM_editkeyframes_refresh(&ac); /* set notifier that keyframes have changed */ - WM_event_add_notifier(C, NC_ANIMATION|ND_KEYFRAME|NA_EDITED, NULL); + WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, NULL); return OPERATOR_FINISHED; } @@ -725,12 +725,12 @@ void ACTION_OT_duplicate(wmOperatorType *ot) ot->poll = ED_operator_action_active; /* flags */ - ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO; + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; } /* ******************** Delete Keyframes Operator ************************* */ -static void delete_action_keys (bAnimContext *ac) +static void delete_action_keys(bAnimContext *ac) { ListBase anim_data = {NULL, NULL}; bAnimListElem *ale; @@ -738,16 +738,16 @@ static void delete_action_keys (bAnimContext *ac) /* filter data */ if (ac->datatype == ANIMCONT_GPENCIL) - filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_NODUPLIS); + filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_NODUPLIS); else - filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_FOREDIT /*| ANIMFILTER_CURVESONLY*/ | ANIMFILTER_NODUPLIS); + filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_FOREDIT /*| ANIMFILTER_CURVESONLY*/ | ANIMFILTER_NODUPLIS); ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype); /* loop through filtered data and delete selected keys */ - for (ale= anim_data.first; ale; ale= ale->next) { + for (ale = anim_data.first; ale; ale = ale->next) { if (ale->type != ANIMTYPE_GPLAYER) { - FCurve *fcu= (FCurve *)ale->key_data; - AnimData *adt= ale->adt; + FCurve *fcu = (FCurve *)ale->key_data; + AnimData *adt = ale->adt; /* delete selected keyframes only */ delete_fcurve_keys(fcu); @@ -782,7 +782,7 @@ static int actkeys_delete_exec(bContext *C, wmOperator *UNUSED(op)) ANIM_editkeyframes_refresh(&ac); /* set notifier that keyframes have changed */ - WM_event_add_notifier(C, NC_ANIMATION|ND_KEYFRAME|NA_EDITED, NULL); + WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, NULL); return OPERATOR_FINISHED; } @@ -800,23 +800,23 @@ void ACTION_OT_delete(wmOperatorType *ot) ot->poll = ED_operator_action_active; /* flags */ - ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO; + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; } /* ******************** Clean Keyframes Operator ************************* */ -static void clean_action_keys (bAnimContext *ac, float thresh) +static void clean_action_keys(bAnimContext *ac, float thresh) { ListBase anim_data = {NULL, NULL}; bAnimListElem *ale; int filter; /* filter data */ - filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_SEL /*| ANIMFILTER_CURVESONLY*/ | ANIMFILTER_NODUPLIS); + filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_SEL /*| ANIMFILTER_CURVESONLY*/ | ANIMFILTER_NODUPLIS); ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype); /* loop through filtered data and clean curves */ - for (ale= anim_data.first; ale; ale= ale->next) + for (ale = anim_data.first; ale; ale = ale->next) clean_fcurve((FCurve *)ale->key_data, thresh); /* free temp data */ @@ -837,7 +837,7 @@ static int actkeys_clean_exec(bContext *C, wmOperator *op) return OPERATOR_PASS_THROUGH; /* get cleaning threshold */ - thresh= RNA_float_get(op->ptr, "threshold"); + thresh = RNA_float_get(op->ptr, "threshold"); /* clean keyframes */ clean_action_keys(&ac, thresh); @@ -846,7 +846,7 @@ static int actkeys_clean_exec(bContext *C, wmOperator *op) ANIM_editkeyframes_refresh(&ac); /* set notifier that keyframes have changed */ - WM_event_add_notifier(C, NC_ANIMATION|ND_KEYFRAME|NA_EDITED, NULL); + WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, NULL); return OPERATOR_FINISHED; } @@ -864,7 +864,7 @@ void ACTION_OT_clean(wmOperatorType *ot) ot->poll = ED_operator_action_active; /* flags */ - ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO; + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; /* properties */ ot->prop = RNA_def_float(ot->srna, "threshold", 0.001f, 0.0f, FLT_MAX, "Threshold", "", 0.0f, 1000.0f); @@ -873,18 +873,18 @@ void ACTION_OT_clean(wmOperatorType *ot) /* ******************** Sample Keyframes Operator *********************** */ /* Evaluates the curves between each selected keyframe on each frame, and keys the value */ -static void sample_action_keys (bAnimContext *ac) +static void sample_action_keys(bAnimContext *ac) { ListBase anim_data = {NULL, NULL}; bAnimListElem *ale; int filter; /* filter data */ - filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_FOREDIT /*| ANIMFILTER_CURVESONLY*/ | ANIMFILTER_NODUPLIS); + filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_FOREDIT /*| ANIMFILTER_CURVESONLY*/ | ANIMFILTER_NODUPLIS); ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype); /* loop through filtered data and add keys between selected keyframes on every frame */ - for (ale= anim_data.first; ale; ale= ale->next) + for (ale = anim_data.first; ale; ale = ale->next) sample_fcurve((FCurve *)ale->key_data); /* admin and redraws */ @@ -910,7 +910,7 @@ static int actkeys_sample_exec(bContext *C, wmOperator *UNUSED(op)) ANIM_editkeyframes_refresh(&ac); /* set notifier that keyframes have changed */ - WM_event_add_notifier(C, NC_ANIMATION|ND_KEYFRAME|NA_EDITED, NULL); + WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, NULL); return OPERATOR_FINISHED; } @@ -927,7 +927,7 @@ void ACTION_OT_sample(wmOperatorType *ot) ot->poll = ED_operator_action_active; /* flags */ - ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO; + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; } /* ************************************************************************** */ @@ -936,8 +936,8 @@ void ACTION_OT_sample(wmOperatorType *ot) /* ******************** Set Extrapolation-Type Operator *********************** */ /* defines for make/clear cyclic extrapolation tools */ -#define MAKE_CYCLIC_EXPO -1 -#define CLEAR_CYCLIC_EXPO -2 +#define MAKE_CYCLIC_EXPO -1 +#define CLEAR_CYCLIC_EXPO -2 /* defines for set extrapolation-type for selected keyframes tool */ static EnumPropertyItem prop_actkeys_expo_types[] = { @@ -957,16 +957,16 @@ static void setexpo_action_keys(bAnimContext *ac, short mode) int filter; /* filter data */ - filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_SEL /*| ANIMFILTER_CURVESONLY*/ | ANIMFILTER_NODUPLIS); + filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_SEL /*| ANIMFILTER_CURVESONLY*/ | ANIMFILTER_NODUPLIS); ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype); /* loop through setting mode per F-Curve */ - for (ale= anim_data.first; ale; ale= ale->next) { - FCurve *fcu= (FCurve *)ale->data; + for (ale = anim_data.first; ale; ale = ale->next) { + FCurve *fcu = (FCurve *)ale->data; if (mode >= 0) { /* just set mode setting */ - fcu->extend= mode; + fcu->extend = mode; } else { /* shortcuts for managing Cycles F-Modifiers to make it easier to toggle cyclic animation @@ -981,7 +981,7 @@ static void setexpo_action_keys(bAnimContext *ac, short mode) } else if (mode == CLEAR_CYCLIC_EXPO) { /* remove all the modifiers fitting this description */ - FModifier *fcm, *fcn=NULL; + FModifier *fcm, *fcn = NULL; for (fcm = fcu->modifiers.first; fcm; fcm = fcn) { fcn = fcm->next; @@ -1011,7 +1011,7 @@ static int actkeys_expo_exec(bContext *C, wmOperator *op) return OPERATOR_PASS_THROUGH; /* get handle setting mode */ - mode= RNA_enum_get(op->ptr, "type"); + mode = RNA_enum_get(op->ptr, "type"); /* set handle type */ setexpo_action_keys(&ac, mode); @@ -1020,7 +1020,7 @@ static int actkeys_expo_exec(bContext *C, wmOperator *op) ANIM_editkeyframes_refresh(&ac); /* set notifier that keyframe properties have changed */ - WM_event_add_notifier(C, NC_ANIMATION|ND_KEYFRAME_PROP, NULL); + WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME_PROP, NULL); return OPERATOR_FINISHED; } @@ -1038,7 +1038,7 @@ void ACTION_OT_extrapolation_type(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, "type", prop_actkeys_expo_types, 0, "Type", ""); @@ -1052,16 +1052,16 @@ static void setipo_action_keys(bAnimContext *ac, short mode) ListBase anim_data = {NULL, NULL}; bAnimListElem *ale; int filter; - KeyframeEditFunc set_cb= ANIM_editkeyframes_ipo(mode); + KeyframeEditFunc set_cb = ANIM_editkeyframes_ipo(mode); /* filter data */ - filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_FOREDIT /*| ANIMFILTER_CURVESONLY*/ | ANIMFILTER_NODUPLIS); + filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_FOREDIT /*| ANIMFILTER_CURVESONLY*/ | ANIMFILTER_NODUPLIS); ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype); /* loop through setting BezTriple interpolation * Note: we do not supply KeyframeEditData to the looper yet. Currently that's not necessary here... */ - for (ale= anim_data.first; ale; ale= ale->next) + for (ale = anim_data.first; ale; ale = ale->next) ANIM_fcurve_keyframes_loop(NULL, ale->key_data, NULL, set_cb, calchandles_fcurve); /* cleanup */ @@ -1082,7 +1082,7 @@ static int actkeys_ipo_exec(bContext *C, wmOperator *op) return OPERATOR_PASS_THROUGH; /* get handle setting mode */ - mode= RNA_enum_get(op->ptr, "type"); + mode = RNA_enum_get(op->ptr, "type"); /* set handle type */ setipo_action_keys(&ac, mode); @@ -1091,7 +1091,7 @@ static int actkeys_ipo_exec(bContext *C, wmOperator *op) ANIM_editkeyframes_refresh(&ac); /* set notifier that keyframe properties have changed */ - WM_event_add_notifier(C, NC_ANIMATION|ND_KEYFRAME_PROP, NULL); + WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME_PROP, NULL); return OPERATOR_FINISHED; } @@ -1109,7 +1109,7 @@ void ACTION_OT_interpolation_type(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, "type", beztriple_interpolation_mode_items, 0, "Type", ""); @@ -1124,18 +1124,18 @@ static void sethandles_action_keys(bAnimContext *ac, short mode) bAnimListElem *ale; int filter; - KeyframeEditFunc edit_cb= ANIM_editkeyframes_handles(mode); - KeyframeEditFunc sel_cb= ANIM_editkeyframes_ok(BEZT_OK_SELECTED); + KeyframeEditFunc edit_cb = ANIM_editkeyframes_handles(mode); + KeyframeEditFunc sel_cb = ANIM_editkeyframes_ok(BEZT_OK_SELECTED); /* filter data */ - filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_FOREDIT /*| ANIMFILTER_CURVESONLY*/ | ANIMFILTER_NODUPLIS); + filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_FOREDIT /*| ANIMFILTER_CURVESONLY*/ | ANIMFILTER_NODUPLIS); ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype); /* loop through setting flags for handles * Note: we do not supply KeyframeEditData to the looper yet. Currently that's not necessary here... */ - 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; /* any selected keyframes for editing? */ if (ANIM_fcurve_keyframes_loop(NULL, fcu, NULL, sel_cb, NULL)) { @@ -1162,7 +1162,7 @@ static int actkeys_handletype_exec(bContext *C, wmOperator *op) return OPERATOR_PASS_THROUGH; /* get handle setting mode */ - mode= RNA_enum_get(op->ptr, "type"); + mode = RNA_enum_get(op->ptr, "type"); /* set handle type */ sethandles_action_keys(&ac, mode); @@ -1171,7 +1171,7 @@ static int actkeys_handletype_exec(bContext *C, wmOperator *op) ANIM_editkeyframes_refresh(&ac); /* set notifier that keyframe properties have changed */ - WM_event_add_notifier(C, NC_ANIMATION|ND_KEYFRAME_PROP, NULL); + WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME_PROP, NULL); return OPERATOR_FINISHED; } @@ -1189,7 +1189,7 @@ void ACTION_OT_handle_type(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, "type", keyframe_handle_type_items, 0, "Type", ""); @@ -1203,16 +1203,16 @@ static void setkeytype_action_keys(bAnimContext *ac, short mode) ListBase anim_data = {NULL, NULL}; bAnimListElem *ale; int filter; - KeyframeEditFunc set_cb= ANIM_editkeyframes_keytype(mode); + KeyframeEditFunc set_cb = ANIM_editkeyframes_keytype(mode); /* filter data */ - filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_FOREDIT /*| ANIMFILTER_CURVESONLY*/ | ANIMFILTER_NODUPLIS); + filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_FOREDIT /*| ANIMFILTER_CURVESONLY*/ | ANIMFILTER_NODUPLIS); ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype); /* loop through setting BezTriple interpolation * Note: we do not supply KeyframeEditData to the looper yet. Currently that's not necessary here... */ - for (ale= anim_data.first; ale; ale= ale->next) + for (ale = anim_data.first; ale; ale = ale->next) ANIM_fcurve_keyframes_loop(NULL, ale->key_data, NULL, set_cb, NULL); /* cleanup */ @@ -1233,7 +1233,7 @@ static int actkeys_keytype_exec(bContext *C, wmOperator *op) return OPERATOR_PASS_THROUGH; /* get handle setting mode */ - mode= RNA_enum_get(op->ptr, "type"); + mode = RNA_enum_get(op->ptr, "type"); /* set handle type */ setkeytype_action_keys(&ac, mode); @@ -1242,7 +1242,7 @@ static int actkeys_keytype_exec(bContext *C, wmOperator *op) ANIM_editkeyframes_refresh(&ac); /* set notifier that keyframe properties have changed */ - WM_event_add_notifier(C, NC_ANIMATION|ND_KEYFRAME_PROP, NULL); + WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME_PROP, NULL); return OPERATOR_FINISHED; } @@ -1260,7 +1260,7 @@ void ACTION_OT_keyframe_type(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, "type", beztriple_keyframe_type_items, 0, "Type", ""); @@ -1275,10 +1275,10 @@ void ACTION_OT_keyframe_type(wmOperatorType *ot) static int actkeys_framejump_exec(bContext *C, wmOperator *UNUSED(op)) { bAnimContext ac; - ListBase anim_data= {NULL, NULL}; + ListBase anim_data = {NULL, NULL}; bAnimListElem *ale; int filter; - KeyframeEditData ked= {{NULL}}; + KeyframeEditData ked = {{NULL}}; /* get editor data */ if (ANIM_animdata_get_context(C, &ac) == 0) @@ -1286,11 +1286,11 @@ static int actkeys_framejump_exec(bContext *C, wmOperator *UNUSED(op)) /* init edit data */ /* loop over action data, averaging values */ - 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) { - 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); ANIM_fcurve_keyframes_loop(&ked, ale->key_data, NULL, bezt_calc_average, NULL); @@ -1304,13 +1304,13 @@ static int actkeys_framejump_exec(bContext *C, wmOperator *UNUSED(op)) /* set the new current frame value, based on the average time */ if (ked.i1) { - Scene *scene= ac.scene; - CFRA= (int)floor((ked.f1 / ked.i1) + 0.5f); - SUBFRA= 0.f; + Scene *scene = ac.scene; + CFRA = (int)floor((ked.f1 / ked.i1) + 0.5f); + SUBFRA = 0.f; } /* set notifier that things have changed */ - WM_event_add_notifier(C, NC_SCENE|ND_FRAME, ac.scene); + WM_event_add_notifier(C, NC_SCENE | ND_FRAME, ac.scene); return OPERATOR_FINISHED; } @@ -1327,7 +1327,7 @@ void ACTION_OT_frame_jump(wmOperatorType *ot) ot->poll = ED_operator_action_active; /* flags */ - ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO; + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; } /* ******************** Snap Keyframes Operator *********************** */ @@ -1348,28 +1348,28 @@ static void snap_action_keys(bAnimContext *ac, short mode) bAnimListElem *ale; int filter; - KeyframeEditData ked= {{NULL}}; + KeyframeEditData ked = {{NULL}}; KeyframeEditFunc edit_cb; /* filter data */ if (ac->datatype == ANIMCONT_GPENCIL) - filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_FOREDIT); + filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_FOREDIT); else - filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_FOREDIT /*| ANIMFILTER_CURVESONLY*/ | ANIMFILTER_NODUPLIS); + filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_FOREDIT /*| ANIMFILTER_CURVESONLY*/ | ANIMFILTER_NODUPLIS); ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype); /* get beztriple editing callbacks */ - edit_cb= ANIM_editkeyframes_snap(mode); + edit_cb = ANIM_editkeyframes_snap(mode); - ked.scene= ac->scene; + ked.scene = ac->scene; if (mode == ACTKEYS_SNAP_NEAREST_MARKER) { - ked.list.first= (ac->markers) ? ac->markers->first : NULL; - ked.list.last= (ac->markers) ? ac->markers->last : NULL; + ked.list.first = (ac->markers) ? ac->markers->first : NULL; + ked.list.last = (ac->markers) ? ac->markers->last : NULL; } /* snap keyframes */ - 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); @@ -1401,7 +1401,7 @@ static int actkeys_snap_exec(bContext *C, wmOperator *op) return OPERATOR_PASS_THROUGH; /* get snapping mode */ - mode= RNA_enum_get(op->ptr, "type"); + mode = RNA_enum_get(op->ptr, "type"); /* snap keyframes */ snap_action_keys(&ac, mode); @@ -1410,7 +1410,7 @@ static int actkeys_snap_exec(bContext *C, wmOperator *op) ANIM_editkeyframes_refresh(&ac); /* set notifier that keyframes have changed */ - WM_event_add_notifier(C, NC_ANIMATION|ND_KEYFRAME|NA_EDITED, NULL); + WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, NULL); return OPERATOR_FINISHED; } @@ -1428,7 +1428,7 @@ void ACTION_OT_snap(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, "type", prop_actkeys_snap_types, 0, "Type", ""); @@ -1451,39 +1451,39 @@ static void mirror_action_keys(bAnimContext *ac, short mode) bAnimListElem *ale; int filter; - KeyframeEditData ked= {{NULL}}; + KeyframeEditData ked = {{NULL}}; KeyframeEditFunc edit_cb; /* get beztriple editing callbacks */ - edit_cb= ANIM_editkeyframes_mirror(mode); + edit_cb = ANIM_editkeyframes_mirror(mode); - ked.scene= ac->scene; + ked.scene = ac->scene; /* for 'first selected marker' mode, need to find first selected marker first! */ // XXX should this be made into a helper func in the API? if (mode == ACTKEYS_MIRROR_MARKER) { - TimeMarker *marker= NULL; + TimeMarker *marker = NULL; /* find first selected marker */ - marker= ED_markers_get_first_selected(ac->markers); + marker = ED_markers_get_first_selected(ac->markers); /* store marker's time (if available) */ if (marker) - ked.f1= (float)marker->frame; + ked.f1 = (float)marker->frame; else return; } /* filter data */ if (ac->datatype == ANIMCONT_GPENCIL) - filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_NODUPLIS); + filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_NODUPLIS); else - filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_FOREDIT /*| ANIMFILTER_CURVESONLY*/ | ANIMFILTER_NODUPLIS); + filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_FOREDIT /*| ANIMFILTER_CURVESONLY*/ | ANIMFILTER_NODUPLIS); ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype); /* mirror keyframes */ - 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); @@ -1515,7 +1515,7 @@ static int actkeys_mirror_exec(bContext *C, wmOperator *op) return OPERATOR_PASS_THROUGH; /* get mirroring mode */ - mode= RNA_enum_get(op->ptr, "type"); + mode = RNA_enum_get(op->ptr, "type"); /* mirror keyframes */ mirror_action_keys(&ac, mode); @@ -1524,7 +1524,7 @@ static int actkeys_mirror_exec(bContext *C, wmOperator *op) ANIM_editkeyframes_refresh(&ac); /* set notifier that keyframes have changed */ - WM_event_add_notifier(C, NC_ANIMATION|ND_KEYFRAME|NA_EDITED, NULL); + WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, NULL); return OPERATOR_FINISHED; } @@ -1542,7 +1542,7 @@ void ACTION_OT_mirror(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, "type", prop_actkeys_mirror_types, 0, "Type", ""); diff --git a/source/blender/editors/space_action/action_intern.h b/source/blender/editors/space_action/action_intern.h index 7074a109228..c684ae1de51 100644 --- a/source/blender/editors/space_action/action_intern.h +++ b/source/blender/editors/space_action/action_intern.h @@ -61,14 +61,14 @@ void ACTION_OT_clickselect(struct wmOperatorType *ot); /* defines for left-right select tool */ enum { - ACTKEYS_LRSEL_TEST = 0, + ACTKEYS_LRSEL_TEST = 0, ACTKEYS_LRSEL_LEFT, ACTKEYS_LRSEL_RIGHT } eActKeys_LeftRightSelect_Mode; /* defines for column-select mode */ enum { - ACTKEYS_COLUMNSEL_KEYS = 0, + ACTKEYS_COLUMNSEL_KEYS = 0, ACTKEYS_COLUMNSEL_CFRA, ACTKEYS_COLUMNSEL_MARKERS_COLUMN, ACTKEYS_COLUMNSEL_MARKERS_BETWEEN, diff --git a/source/blender/editors/space_action/action_ops.c b/source/blender/editors/space_action/action_ops.c index da3e88ba188..e4a161e3e22 100644 --- a/source/blender/editors/space_action/action_ops.c +++ b/source/blender/editors/space_action/action_ops.c @@ -55,7 +55,7 @@ void action_operatortypes(void) { /* keyframes */ - /* selection */ + /* selection */ WM_operatortype_append(ACTION_OT_clickselect); WM_operatortype_append(ACTION_OT_select_all_toggle); WM_operatortype_append(ACTION_OT_select_border); @@ -65,7 +65,7 @@ void action_operatortypes(void) WM_operatortype_append(ACTION_OT_select_less); WM_operatortype_append(ACTION_OT_select_leftright); - /* editing */ + /* editing */ WM_operatortype_append(ACTION_OT_snap); WM_operatortype_append(ACTION_OT_mirror); WM_operatortype_append(ACTION_OT_frame_jump); @@ -96,7 +96,7 @@ void ED_operatormacros_action(void) ot = WM_operatortype_append_macro("ACTION_OT_duplicate_move", "Duplicate", "Make a copy of all selected keyframes and move them", - OPTYPE_UNDO|OPTYPE_REGISTER); + OPTYPE_UNDO | OPTYPE_REGISTER); if (ot) { WM_operatortype_macro_define(ot, "ACTION_OT_duplicate"); otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_transform"); @@ -107,82 +107,82 @@ void ED_operatormacros_action(void) /* ************************** registration - keymaps **********************************/ -static void action_keymap_keyframes (wmKeyConfig *keyconf, wmKeyMap *keymap) +static void action_keymap_keyframes(wmKeyConfig *keyconf, wmKeyMap *keymap) { wmKeyMapItem *kmi; /* action_select.c - selection tools */ - /* click-select */ + /* click-select */ kmi = WM_keymap_add_item(keymap, "ACTION_OT_clickselect", SELECTMOUSE, KM_PRESS, 0, 0); - RNA_boolean_set(kmi->ptr, "extend", FALSE); - RNA_boolean_set(kmi->ptr, "column", FALSE); + RNA_boolean_set(kmi->ptr, "extend", FALSE); + RNA_boolean_set(kmi->ptr, "column", FALSE); kmi = WM_keymap_add_item(keymap, "ACTION_OT_clickselect", SELECTMOUSE, KM_PRESS, KM_ALT, 0); - RNA_boolean_set(kmi->ptr, "extend", FALSE); - RNA_boolean_set(kmi->ptr, "column", TRUE); + RNA_boolean_set(kmi->ptr, "extend", FALSE); + RNA_boolean_set(kmi->ptr, "column", TRUE); kmi = WM_keymap_add_item(keymap, "ACTION_OT_clickselect", SELECTMOUSE, KM_PRESS, KM_SHIFT, 0); - RNA_boolean_set(kmi->ptr, "extend", TRUE); - RNA_boolean_set(kmi->ptr, "column", FALSE); - kmi = WM_keymap_add_item(keymap, "ACTION_OT_clickselect", SELECTMOUSE, KM_PRESS, KM_ALT|KM_SHIFT, 0); - RNA_boolean_set(kmi->ptr, "extend", TRUE); - RNA_boolean_set(kmi->ptr, "column", TRUE); + RNA_boolean_set(kmi->ptr, "extend", TRUE); + RNA_boolean_set(kmi->ptr, "column", FALSE); + kmi = WM_keymap_add_item(keymap, "ACTION_OT_clickselect", SELECTMOUSE, KM_PRESS, KM_ALT | KM_SHIFT, 0); + RNA_boolean_set(kmi->ptr, "extend", TRUE); + RNA_boolean_set(kmi->ptr, "column", TRUE); - /* select left/right */ + /* select left/right */ kmi = WM_keymap_add_item(keymap, "ACTION_OT_select_leftright", SELECTMOUSE, KM_PRESS, KM_CTRL, 0); - RNA_boolean_set(kmi->ptr, "extend", FALSE); - RNA_enum_set(kmi->ptr, "mode", ACTKEYS_LRSEL_TEST); - kmi = WM_keymap_add_item(keymap, "ACTION_OT_select_leftright", SELECTMOUSE, KM_PRESS, KM_CTRL|KM_SHIFT, 0); - RNA_boolean_set(kmi->ptr, "extend", TRUE); - RNA_enum_set(kmi->ptr, "mode", ACTKEYS_LRSEL_TEST); + RNA_boolean_set(kmi->ptr, "extend", FALSE); + RNA_enum_set(kmi->ptr, "mode", ACTKEYS_LRSEL_TEST); + kmi = WM_keymap_add_item(keymap, "ACTION_OT_select_leftright", SELECTMOUSE, KM_PRESS, KM_CTRL | KM_SHIFT, 0); + RNA_boolean_set(kmi->ptr, "extend", TRUE); + RNA_enum_set(kmi->ptr, "mode", ACTKEYS_LRSEL_TEST); kmi = WM_keymap_add_item(keymap, "ACTION_OT_select_leftright", LEFTBRACKETKEY, KM_PRESS, 0, 0); - RNA_boolean_set(kmi->ptr, "extend", FALSE); - RNA_enum_set(kmi->ptr, "mode", ACTKEYS_LRSEL_LEFT); + RNA_boolean_set(kmi->ptr, "extend", FALSE); + RNA_enum_set(kmi->ptr, "mode", ACTKEYS_LRSEL_LEFT); kmi = WM_keymap_add_item(keymap, "ACTION_OT_select_leftright", RIGHTBRACKETKEY, KM_PRESS, 0, 0); - RNA_boolean_set(kmi->ptr, "extend", FALSE); - RNA_enum_set(kmi->ptr, "mode", ACTKEYS_LRSEL_RIGHT); + RNA_boolean_set(kmi->ptr, "extend", FALSE); + RNA_enum_set(kmi->ptr, "mode", ACTKEYS_LRSEL_RIGHT); - /* deselect all */ + /* deselect all */ kmi = WM_keymap_add_item(keymap, "ACTION_OT_select_all_toggle", AKEY, KM_PRESS, 0, 0); - RNA_boolean_set(kmi->ptr, "invert", FALSE); + RNA_boolean_set(kmi->ptr, "invert", FALSE); kmi = WM_keymap_add_item(keymap, "ACTION_OT_select_all_toggle", IKEY, KM_PRESS, KM_CTRL, 0); - RNA_boolean_set(kmi->ptr, "invert", TRUE); + RNA_boolean_set(kmi->ptr, "invert", TRUE); - /* borderselect */ + /* borderselect */ kmi = WM_keymap_add_item(keymap, "ACTION_OT_select_border", BKEY, KM_PRESS, 0, 0); - RNA_boolean_set(kmi->ptr, "axis_range", FALSE); + RNA_boolean_set(kmi->ptr, "axis_range", FALSE); kmi = WM_keymap_add_item(keymap, "ACTION_OT_select_border", BKEY, KM_PRESS, KM_ALT, 0); - RNA_boolean_set(kmi->ptr, "axis_range", TRUE); + RNA_boolean_set(kmi->ptr, "axis_range", TRUE); - /* column select */ + /* column select */ RNA_enum_set(WM_keymap_add_item(keymap, "ACTION_OT_select_column", KKEY, KM_PRESS, 0, 0)->ptr, "mode", ACTKEYS_COLUMNSEL_KEYS); RNA_enum_set(WM_keymap_add_item(keymap, "ACTION_OT_select_column", KKEY, KM_PRESS, KM_CTRL, 0)->ptr, "mode", ACTKEYS_COLUMNSEL_CFRA); RNA_enum_set(WM_keymap_add_item(keymap, "ACTION_OT_select_column", KKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "mode", ACTKEYS_COLUMNSEL_MARKERS_COLUMN); RNA_enum_set(WM_keymap_add_item(keymap, "ACTION_OT_select_column", KKEY, KM_PRESS, KM_ALT, 0)->ptr, "mode", ACTKEYS_COLUMNSEL_MARKERS_BETWEEN); - /* select more/less */ + /* select more/less */ WM_keymap_add_item(keymap, "ACTION_OT_select_more", PADPLUSKEY, KM_PRESS, KM_CTRL, 0); WM_keymap_add_item(keymap, "ACTION_OT_select_less", PADMINUS, KM_PRESS, KM_CTRL, 0); - /* select linekd */ + /* select linekd */ WM_keymap_add_item(keymap, "ACTION_OT_select_linked", LKEY, KM_PRESS, 0, 0); /* action_edit.c */ - /* snap - current frame to selected keys */ - // TODO: maybe since this is called jump, we're better to have it on -J? - WM_keymap_add_item(keymap, "ACTION_OT_frame_jump", SKEY, KM_PRESS, KM_CTRL|KM_SHIFT, 0); + /* snap - current frame to selected keys */ + // TODO: maybe since this is called jump, we're better to have it on -J? + WM_keymap_add_item(keymap, "ACTION_OT_frame_jump", SKEY, KM_PRESS, KM_CTRL | KM_SHIFT, 0); - /* menu + single-step transform */ + /* menu + single-step transform */ WM_keymap_add_item(keymap, "ACTION_OT_snap", SKEY, KM_PRESS, KM_SHIFT, 0); WM_keymap_add_item(keymap, "ACTION_OT_mirror", MKEY, KM_PRESS, KM_SHIFT, 0); - /* menu + set setting */ + /* menu + set setting */ WM_keymap_add_item(keymap, "ACTION_OT_handle_type", VKEY, KM_PRESS, 0, 0); WM_keymap_add_item(keymap, "ACTION_OT_interpolation_type", TKEY, KM_PRESS, 0, 0); WM_keymap_add_item(keymap, "ACTION_OT_extrapolation_type", EKEY, KM_PRESS, KM_SHIFT, 0); WM_keymap_add_item(keymap, "ACTION_OT_keyframe_type", RKEY, KM_PRESS, 0, 0); - /* destructive */ + /* destructive */ WM_keymap_add_item(keymap, "ACTION_OT_clean", OKEY, KM_PRESS, 0, 0); WM_keymap_add_item(keymap, "ACTION_OT_sample", OKEY, KM_PRESS, KM_SHIFT, 0); @@ -192,19 +192,19 @@ static void action_keymap_keyframes (wmKeyConfig *keyconf, wmKeyMap *keymap) WM_keymap_add_item(keymap, "ACTION_OT_duplicate_move", DKEY, KM_PRESS, KM_SHIFT, 0); WM_keymap_add_item(keymap, "ACTION_OT_keyframe_insert", IKEY, KM_PRESS, 0, 0); - /* copy/paste */ + /* copy/paste */ WM_keymap_add_item(keymap, "ACTION_OT_copy", CKEY, KM_PRESS, KM_CTRL, 0); WM_keymap_add_item(keymap, "ACTION_OT_paste", VKEY, KM_PRESS, KM_CTRL, 0); - /* auto-set range */ - WM_keymap_add_item(keymap, "ACTION_OT_previewrange_set", PKEY, KM_PRESS, KM_CTRL|KM_ALT, 0); + /* auto-set range */ + WM_keymap_add_item(keymap, "ACTION_OT_previewrange_set", PKEY, KM_PRESS, KM_CTRL | KM_ALT, 0); WM_keymap_add_item(keymap, "ACTION_OT_view_all", HOMEKEY, KM_PRESS, 0, 0); WM_keymap_add_item(keymap, "ACTION_OT_view_selected", PADPERIOD, KM_PRESS, 0, 0); /* animation module */ - /* channels list - * NOTE: these operators were originally for the channels list, but are added here too for convenience... - */ + /* channels list + * NOTE: these operators were originally for the channels list, but are added here too for convenience... + */ WM_keymap_add_item(keymap, "ANIM_OT_channels_editable_toggle", TABKEY, KM_PRESS, 0, 0); /* transform system */ 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 diff --git a/source/blender/editors/space_action/space_action.c b/source/blender/editors/space_action/space_action.c index c1875eb3a9a..ae4020aaaba 100644 --- a/source/blender/editors/space_action/space_action.c +++ b/source/blender/editors/space_action/space_action.c @@ -60,67 +60,67 @@ #include "ED_anim_api.h" #include "ED_markers.h" -#include "action_intern.h" // own include +#include "action_intern.h" /* own include */ /* ******************** default callbacks for action space ***************** */ static SpaceLink *action_new(const bContext *C) { - ScrArea *sa= CTX_wm_area(C); + ScrArea *sa = CTX_wm_area(C); SpaceAction *saction; ARegion *ar; - saction= MEM_callocN(sizeof(SpaceAction), "initaction"); - saction->spacetype= SPACE_ACTION; + saction = MEM_callocN(sizeof(SpaceAction), "initaction"); + saction->spacetype = SPACE_ACTION; saction->autosnap = SACTSNAP_FRAME; - saction->mode= SACTCONT_DOPESHEET; + saction->mode = SACTCONT_DOPESHEET; saction->ads.filterflag |= ADS_FILTER_SUMMARY; /* header */ - ar= MEM_callocN(sizeof(ARegion), "header for action"); + ar = MEM_callocN(sizeof(ARegion), "header for action"); BLI_addtail(&saction->regionbase, ar); - ar->regiontype= RGN_TYPE_HEADER; - ar->alignment= RGN_ALIGN_BOTTOM; + ar->regiontype = RGN_TYPE_HEADER; + ar->alignment = RGN_ALIGN_BOTTOM; /* channel list region */ - ar= MEM_callocN(sizeof(ARegion), "channel area for action"); + ar = MEM_callocN(sizeof(ARegion), "channel area for action"); BLI_addtail(&saction->regionbase, ar); - ar->regiontype= RGN_TYPE_CHANNELS; - ar->alignment= RGN_ALIGN_LEFT; + ar->regiontype = RGN_TYPE_CHANNELS; + ar->alignment = RGN_ALIGN_LEFT; - /* only need to set scroll settings, as this will use 'listview' v2d configuration */ + /* only need to set scroll settings, as this will use 'listview' v2d configuration */ ar->v2d.scroll = V2D_SCROLL_BOTTOM; ar->v2d.flag = V2D_VIEWSYNC_AREA_VERTICAL; /* main area */ - ar= MEM_callocN(sizeof(ARegion), "main area for action"); + ar = MEM_callocN(sizeof(ARegion), "main area for action"); BLI_addtail(&saction->regionbase, ar); - ar->regiontype= RGN_TYPE_WINDOW; + ar->regiontype = RGN_TYPE_WINDOW; ar->v2d.tot.xmin = -10.0f; - ar->v2d.tot.ymin = (float)(-sa->winy)/3.0f; + ar->v2d.tot.ymin = (float)(-sa->winy) / 3.0f; ar->v2d.tot.xmax = (float)(sa->winx); ar->v2d.tot.ymax = 0.0f; ar->v2d.cur = ar->v2d.tot; - ar->v2d.min[0]= 0.0f; - ar->v2d.min[1]= 0.0f; + ar->v2d.min[0] = 0.0f; + ar->v2d.min[1] = 0.0f; - ar->v2d.max[0]= MAXFRAMEF; - ar->v2d.max[1]= FLT_MAX; + ar->v2d.max[0] = MAXFRAMEF; + ar->v2d.max[1] = FLT_MAX; - ar->v2d.minzoom= 0.01f; - ar->v2d.maxzoom= 50; - ar->v2d.scroll = (V2D_SCROLL_BOTTOM|V2D_SCROLL_SCALE_HORIZONTAL); + ar->v2d.minzoom = 0.01f; + ar->v2d.maxzoom = 50; + ar->v2d.scroll = (V2D_SCROLL_BOTTOM | V2D_SCROLL_SCALE_HORIZONTAL); ar->v2d.scroll |= (V2D_SCROLL_RIGHT); - ar->v2d.keepzoom= V2D_LOCKZOOM_Y; - ar->v2d.keepofs= V2D_KEEPOFS_Y; - ar->v2d.align= V2D_ALIGN_NO_POS_Y; + ar->v2d.keepzoom = V2D_LOCKZOOM_Y; + ar->v2d.keepofs = V2D_KEEPOFS_Y; + ar->v2d.align = V2D_ALIGN_NO_POS_Y; ar->v2d.flag = V2D_VIEWSYNC_AREA_VERTICAL; return (SpaceLink *)saction; @@ -143,7 +143,7 @@ static void action_init(struct wmWindowManager *UNUSED(wm), ScrArea *sa) static SpaceLink *action_duplicate(SpaceLink *sl) { - SpaceAction *sactionn= MEM_dupallocN(sl); + SpaceAction *sactionn = MEM_dupallocN(sl); /* clear or remove stuff from old */ @@ -167,12 +167,12 @@ static void action_main_area_init(wmWindowManager *wm, ARegion *ar) static void action_main_area_draw(const bContext *C, ARegion *ar) { /* draw entirely, view changes should be handled here */ - SpaceAction *saction= CTX_wm_space_action(C); + SpaceAction *saction = CTX_wm_space_action(C); bAnimContext ac; - View2D *v2d= &ar->v2d; + View2D *v2d = &ar->v2d; View2DGrid *grid; View2DScrollers *scrollers; - short unit=0, flag=0; + short unit = 0, flag = 0; /* clear and setup matrix */ UI_ThemeClearColor(TH_BACK); @@ -181,8 +181,8 @@ static void action_main_area_draw(const bContext *C, ARegion *ar) UI_view2d_view_ortho(v2d); /* time grid */ - unit= (saction->flag & SACTION_DRAWTIME)? V2D_UNIT_SECONDS : V2D_UNIT_FRAMES; - grid= UI_view2d_grid_calc(CTX_data_scene(C), v2d, unit, V2D_GRID_CLAMP, V2D_ARG_DUMMY, V2D_ARG_DUMMY, ar->winx, ar->winy); + unit = (saction->flag & SACTION_DRAWTIME) ? V2D_UNIT_SECONDS : V2D_UNIT_FRAMES; + grid = UI_view2d_grid_calc(CTX_data_scene(C), v2d, unit, V2D_GRID_CLAMP, V2D_ARG_DUMMY, V2D_ARG_DUMMY, ar->winx, ar->winy); UI_view2d_grid_draw(v2d, grid, V2D_GRIDLINES_ALL); UI_view2d_grid_free(grid); @@ -192,14 +192,14 @@ static void action_main_area_draw(const bContext *C, ARegion *ar) } /* current frame */ - if (saction->flag & SACTION_DRAWTIME) flag |= DRAWCFRA_UNIT_SECONDS; - if ((saction->flag & SACTION_NODRAWCFRANUM)==0) flag |= DRAWCFRA_SHOW_NUMBOX; + if (saction->flag & SACTION_DRAWTIME) flag |= DRAWCFRA_UNIT_SECONDS; + if ((saction->flag & SACTION_NODRAWCFRANUM) == 0) flag |= DRAWCFRA_SHOW_NUMBOX; ANIM_draw_cfra(C, v2d, flag); /* markers */ UI_view2d_view_orthoSpecial(ar, v2d, 1); - flag = (ac.markers && (ac.markers != &ac.scene->markers))? DRAW_MARKERS_LOCAL : 0; + flag = (ac.markers && (ac.markers != &ac.scene->markers)) ? DRAW_MARKERS_LOCAL : 0; draw_markers_time(C, flag); /* preview range */ @@ -210,7 +210,7 @@ static void action_main_area_draw(const bContext *C, ARegion *ar) UI_view2d_view_restore(C); /* scrollers */ - scrollers= UI_view2d_scrollers_calc(C, v2d, unit, V2D_GRID_CLAMP, V2D_ARG_DUMMY, V2D_ARG_DUMMY); + scrollers = UI_view2d_scrollers_calc(C, v2d, unit, V2D_GRID_CLAMP, V2D_ARG_DUMMY, V2D_ARG_DUMMY); UI_view2d_scrollers_draw(C, v2d, scrollers); UI_view2d_scrollers_free(scrollers); } @@ -231,7 +231,7 @@ static void action_channel_area_draw(const bContext *C, ARegion *ar) { /* draw entirely, view changes should be handled here */ bAnimContext ac; - View2D *v2d= &ar->v2d; + View2D *v2d = &ar->v2d; View2DScrollers *scrollers; /* clear and setup matrix */ @@ -249,7 +249,7 @@ static void action_channel_area_draw(const bContext *C, ARegion *ar) UI_view2d_view_restore(C); /* scrollers */ - scrollers= UI_view2d_scrollers_calc(C, v2d, V2D_ARG_DUMMY, V2D_ARG_DUMMY, V2D_ARG_DUMMY, V2D_ARG_DUMMY); + scrollers = UI_view2d_scrollers_calc(C, v2d, V2D_ARG_DUMMY, V2D_ARG_DUMMY, V2D_ARG_DUMMY, V2D_ARG_DUMMY); UI_view2d_scrollers_draw(C, v2d, scrollers); UI_view2d_scrollers_free(scrollers); } @@ -299,7 +299,7 @@ static void action_channel_area_listener(ARegion *ar, wmNotifier *wmn) ED_region_tag_redraw(ar); break; default: - if (wmn->data==ND_KEYS) + if (wmn->data == ND_KEYS) ED_region_tag_redraw(ar); } } @@ -346,7 +346,7 @@ static void action_main_area_listener(ARegion *ar, wmNotifier *wmn) break; default: - if (wmn->data==ND_KEYS) + if (wmn->data == ND_KEYS) ED_region_tag_redraw(ar); } } @@ -354,7 +354,7 @@ static void action_main_area_listener(ARegion *ar, wmNotifier *wmn) /* editor level listener */ static void action_listener(ScrArea *sa, wmNotifier *wmn) { - SpaceAction *saction= (SpaceAction *)sa->spacedata.first; + SpaceAction *saction = (SpaceAction *)sa->spacedata.first; /* context changes */ switch (wmn->category) { @@ -379,7 +379,7 @@ static void action_listener(ScrArea *sa, wmNotifier *wmn) break; case NC_SCENE: switch (wmn->data) { - case ND_OB_ACTIVE: /* selection changed, so force refresh to flush (needs flag set to do syncing) */ + case ND_OB_ACTIVE: /* selection changed, so force refresh to flush (needs flag set to do syncing) */ case ND_OB_SELECT: saction->flag |= SACTION_TEMP_NEEDCHANSYNC; ED_area_tag_refresh(sa); @@ -392,7 +392,7 @@ static void action_listener(ScrArea *sa, wmNotifier *wmn) break; case NC_OBJECT: switch (wmn->data) { - case ND_BONE_SELECT: /* selection changed, so force refresh to flush (needs flag set to do syncing) */ + case ND_BONE_SELECT: /* selection changed, so force refresh to flush (needs flag set to do syncing) */ case ND_BONE_ACTIVE: saction->flag |= SACTION_TEMP_NEEDCHANSYNC; ED_area_tag_refresh(sa); @@ -446,7 +446,7 @@ static void action_header_area_listener(ARegion *ar, wmNotifier *wmn) static void action_refresh(const bContext *C, ScrArea *sa) { - SpaceAction *saction= (SpaceAction *)sa->spacedata.first; + SpaceAction *saction = (SpaceAction *)sa->spacedata.first; /* update the state of the animchannels in response to changes from the data they represent * NOTE: the temp flag is used to indicate when this needs to be done, and will be cleared once handled @@ -464,52 +464,52 @@ static void action_refresh(const bContext *C, ScrArea *sa) /* only called once, from space/spacetypes.c */ void ED_spacetype_action(void) { - SpaceType *st= MEM_callocN(sizeof(SpaceType), "spacetype action"); + SpaceType *st = MEM_callocN(sizeof(SpaceType), "spacetype action"); ARegionType *art; - st->spaceid= SPACE_ACTION; + st->spaceid = SPACE_ACTION; strncpy(st->name, "Action", BKE_ST_MAXNAME); - st->new= action_new; - st->free= action_free; - st->init= action_init; - st->duplicate= action_duplicate; - st->operatortypes= action_operatortypes; - st->keymap= action_keymap; - st->listener= action_listener; - st->refresh= action_refresh; + st->new = action_new; + st->free = action_free; + st->init = action_init; + st->duplicate = action_duplicate; + st->operatortypes = action_operatortypes; + st->keymap = action_keymap; + st->listener = action_listener; + st->refresh = action_refresh; /* regions: main window */ - art= MEM_callocN(sizeof(ARegionType), "spacetype action region"); + art = MEM_callocN(sizeof(ARegionType), "spacetype action region"); art->regionid = RGN_TYPE_WINDOW; - art->init= action_main_area_init; - art->draw= action_main_area_draw; - art->listener= action_main_area_listener; - art->keymapflag= ED_KEYMAP_VIEW2D|ED_KEYMAP_MARKERS|ED_KEYMAP_ANIMATION|ED_KEYMAP_FRAMES; + art->init = action_main_area_init; + art->draw = action_main_area_draw; + art->listener = action_main_area_listener; + art->keymapflag = ED_KEYMAP_VIEW2D | ED_KEYMAP_MARKERS | ED_KEYMAP_ANIMATION | ED_KEYMAP_FRAMES; BLI_addhead(&st->regiontypes, art); /* regions: header */ - art= MEM_callocN(sizeof(ARegionType), "spacetype action region"); + art = MEM_callocN(sizeof(ARegionType), "spacetype action region"); art->regionid = RGN_TYPE_HEADER; - art->prefsizey= HEADERY; - art->keymapflag= ED_KEYMAP_UI|ED_KEYMAP_VIEW2D|ED_KEYMAP_FRAMES|ED_KEYMAP_HEADER; + art->prefsizey = HEADERY; + art->keymapflag = ED_KEYMAP_UI | ED_KEYMAP_VIEW2D | ED_KEYMAP_FRAMES | ED_KEYMAP_HEADER; - art->init= action_header_area_init; - art->draw= action_header_area_draw; - art->listener= action_header_area_listener; + art->init = action_header_area_init; + art->draw = action_header_area_draw; + art->listener = action_header_area_listener; BLI_addhead(&st->regiontypes, art); /* regions: channels */ - art= MEM_callocN(sizeof(ARegionType), "spacetype action region"); + art = MEM_callocN(sizeof(ARegionType), "spacetype action region"); art->regionid = RGN_TYPE_CHANNELS; - art->prefsizex= 200; - art->keymapflag= ED_KEYMAP_UI|ED_KEYMAP_VIEW2D; + art->prefsizex = 200; + art->keymapflag = ED_KEYMAP_UI | ED_KEYMAP_VIEW2D; - art->init= action_channel_area_init; - art->draw= action_channel_area_draw; - art->listener= action_channel_area_listener; + art->init = action_channel_area_init; + art->draw = action_channel_area_draw; + art->listener = action_channel_area_listener; BLI_addhead(&st->regiontypes, art);