diff options
author | Hans Goudey <h.goudey@me.com> | 2020-07-10 17:17:38 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2020-07-10 17:17:38 +0300 |
commit | 75bd1b4bb8ad834fe5e144c1c70f03016f5cbcd3 (patch) | |
tree | 366b24e2cafb4283d3b41430b8e83673810ca904 /source/blender/editors/space_nla | |
parent | 06349b903bb32024676df578721ed1ef8daad03f (diff) | |
parent | 6c1157201a143574c005147367bb2fd4ab320e73 (diff) |
Merge branch 'master' into fcurve-modifier-panels
Diffstat (limited to 'source/blender/editors/space_nla')
-rw-r--r-- | source/blender/editors/space_nla/nla_buttons.c | 6 | ||||
-rw-r--r-- | source/blender/editors/space_nla/nla_channels.c | 35 | ||||
-rw-r--r-- | source/blender/editors/space_nla/nla_draw.c | 5 | ||||
-rw-r--r-- | source/blender/editors/space_nla/nla_edit.c | 46 | ||||
-rw-r--r-- | source/blender/editors/space_nla/space_nla.c | 27 |
5 files changed, 56 insertions, 63 deletions
diff --git a/source/blender/editors/space_nla/nla_buttons.c b/source/blender/editors/space_nla/nla_buttons.c index 3d48583dfc9..e1a247b1bae 100644 --- a/source/blender/editors/space_nla/nla_buttons.c +++ b/source/blender/editors/space_nla/nla_buttons.c @@ -392,7 +392,7 @@ static void nla_panel_properties(const bContext *C, Panel *panel) uiItemR(column, &strip_ptr, "blend_type", 0, NULL, ICON_NONE); /* Blend in/out + auto-blending: - * - blend in/out can only be set when autoblending is off + * - blend in/out can only be set when auto-blending is off. */ uiItemS(layout); @@ -407,7 +407,7 @@ static void nla_panel_properties(const bContext *C, Panel *panel) uiItemR(row, &strip_ptr, "use_auto_blend", 0, NULL, ICON_NONE); // XXX as toggle? /* settings */ - column = uiLayoutColumnWithHeading(layout, true, "Playback"); + column = uiLayoutColumnWithHeading(layout, true, IFACE_("Playback")); row = uiLayoutRow(column, true); uiLayoutSetActive(row, !(RNA_boolean_get(&strip_ptr, "use_animated_influence") || @@ -446,7 +446,7 @@ static void nla_panel_actclip(const bContext *C, Panel *panel) uiItemR(column, &strip_ptr, "action_frame_start", 0, IFACE_("Frame Start"), ICON_NONE); uiItemR(column, &strip_ptr, "action_frame_end", 0, IFACE_("End"), ICON_NONE); - row = uiLayoutRowWithHeading(layout, false, "Sync Length"); + row = uiLayoutRowWithHeading(layout, false, IFACE_("Sync Length")); uiItemR(row, &strip_ptr, "use_sync_length", 0, "", ICON_NONE); uiItemO(row, IFACE_("Now"), ICON_FILE_REFRESH, "NLA_OT_action_sync_length"); diff --git a/source/blender/editors/space_nla/nla_channels.c b/source/blender/editors/space_nla/nla_channels.c index d399ea47d7e..86bb189c638 100644 --- a/source/blender/editors/space_nla/nla_channels.c +++ b/source/blender/editors/space_nla/nla_channels.c @@ -461,10 +461,9 @@ static int nlachannels_pushdown_exec(bContext *C, wmOperator *op) "block)"); return OPERATOR_CANCELLED; } - else { - id = adt_ptr.owner_id; - adt = adt_ptr.data; - } + + id = adt_ptr.owner_id; + adt = adt_ptr.data; } else { /* indexed channel */ @@ -483,7 +482,7 @@ static int nlachannels_pushdown_exec(bContext *C, wmOperator *op) ANIM_animdata_freelist(&anim_data); return OPERATOR_CANCELLED; } - else if (ale->type != ANIMTYPE_NLAACTION) { + if (ale->type != ANIMTYPE_NLAACTION) { BKE_reportf(op->reports, RPT_ERROR, "Animation channel at index %d is not a NLA 'Active Action' channel", @@ -505,22 +504,21 @@ static int nlachannels_pushdown_exec(bContext *C, wmOperator *op) BKE_report(op->reports, RPT_WARNING, "Internal Error - AnimData block is not valid"); return OPERATOR_CANCELLED; } - else if (nlaedit_is_tweakmode_on(&ac)) { + if (nlaedit_is_tweakmode_on(&ac)) { BKE_report(op->reports, RPT_WARNING, "Cannot push down actions while tweaking a strip's action, exit tweak mode first"); return OPERATOR_CANCELLED; } - else if (adt->action == NULL) { + if (adt->action == NULL) { BKE_report(op->reports, RPT_WARNING, "No active action to push down"); return OPERATOR_CANCELLED; } - else { - /* 'push-down' action - only usable when not in TweakMode */ - BKE_nla_action_pushdown(adt); - DEG_id_tag_update_ex(CTX_data_main(C), id, ID_RECALC_ANIMATION | ID_RECALC_COPY_ON_WRITE); - } + /* 'push-down' action - only usable when not in TweakMode */ + BKE_nla_action_pushdown(adt); + + DEG_id_tag_update_ex(CTX_data_main(C), id, ID_RECALC_ANIMATION | ID_RECALC_COPY_ON_WRITE); /* set notifier that things have changed */ WM_event_add_notifier(C, NC_ANIMATION | ND_NLA_ACTCHANGE, NULL); @@ -735,14 +733,13 @@ static int nlaedit_add_tracks_exec(bContext *C, wmOperator *op) /* done */ return OPERATOR_FINISHED; } - else { - /* failed to add any tracks */ - BKE_report( - op->reports, RPT_WARNING, "Select an existing NLA Track or an empty action line first"); - /* not done */ - return OPERATOR_CANCELLED; - } + /* failed to add any tracks */ + BKE_report( + op->reports, RPT_WARNING, "Select an existing NLA Track or an empty action line first"); + + /* not done */ + return OPERATOR_CANCELLED; } void NLA_OT_tracks_add(wmOperatorType *ot) diff --git a/source/blender/editors/space_nla/nla_draw.c b/source/blender/editors/space_nla/nla_draw.c index a56b7f8422e..96599fd92a7 100644 --- a/source/blender/editors/space_nla/nla_draw.c +++ b/source/blender/editors/space_nla/nla_draw.c @@ -645,8 +645,9 @@ static void nla_draw_strip_text(AnimData *adt, UI_view2d_text_cache_add_rectf(v2d, &rect, str, str_len, col); } -/* add frame extents to cache of text-strings to draw in pixelspace - * for now, only used when transforming strips +/** + * Add frame extents to cache of text-strings to draw in pixel-space + * for now, only used when transforming strips. */ static void nla_draw_strip_frames_text( NlaTrack *UNUSED(nlt), NlaStrip *strip, View2D *v2d, float UNUSED(yminc), float ymaxc) diff --git a/source/blender/editors/space_nla/nla_edit.c b/source/blender/editors/space_nla/nla_edit.c index dec7a0fd93c..bc9bd0e18f2 100644 --- a/source/blender/editors/space_nla/nla_edit.c +++ b/source/blender/editors/space_nla/nla_edit.c @@ -269,9 +269,7 @@ static int nlaedit_disable_tweakmode_exec(bContext *C, wmOperator *op) if (ok) { return OPERATOR_FINISHED; } - else { - return OPERATOR_CANCELLED; - } + return OPERATOR_CANCELLED; } void NLA_OT_tweakmode_exit(wmOperatorType *ot) @@ -373,9 +371,8 @@ static int nlaedit_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_nlastrip_extents(&ac, &min, &max, true); @@ -616,7 +613,7 @@ static int nlaedit_add_actionclip_exec(bContext *C, wmOperator *op) // printf("Add strip - actname = '%s'\n", actname); return OPERATOR_CANCELLED; } - else if (act->idroot == 0) { + if (act->idroot == 0) { /* hopefully in this case (i.e. library of userless actions), * the user knows what they're doing... */ BKE_reportf(op->reports, @@ -830,12 +827,11 @@ static int nlaedit_add_transition_exec(bContext *C, wmOperator *op) /* done */ return OPERATOR_FINISHED; } - else { - BKE_report(op->reports, - RPT_ERROR, - "Needs at least a pair of adjacent selected strips with a gap between them"); - return OPERATOR_CANCELLED; - } + + BKE_report(op->reports, + RPT_ERROR, + "Needs at least a pair of adjacent selected strips with a gap between them"); + return OPERATOR_CANCELLED; } void NLA_OT_transition_add(wmOperatorType *ot) @@ -1146,9 +1142,8 @@ static int nlaedit_duplicate_exec(bContext *C, wmOperator *op) /* done */ return OPERATOR_FINISHED; } - else { - return OPERATOR_CANCELLED; - } + + return OPERATOR_CANCELLED; } static int nlaedit_duplicate_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event)) @@ -1293,9 +1288,8 @@ static void nlaedit_split_strip_actclip( if (IS_EQF(len, 0.0f)) { return; } - else { - splitframe = strip->start + (len / 2.0f); - } + + splitframe = strip->start + (len / 2.0f); /* action range */ len = strip->actend - strip->actstart; @@ -2504,10 +2498,9 @@ static int nla_fmodifier_copy_exec(bContext *C, wmOperator *op) BKE_report(op->reports, RPT_ERROR, "No F-Modifiers available to be copied"); return OPERATOR_CANCELLED; } - else { - /* no updates needed - copy is non-destructive operation */ - return OPERATOR_FINISHED; - } + + /* no updates needed - copy is non-destructive operation */ + return OPERATOR_FINISHED; } void NLA_OT_fmodifier_copy(wmOperatorType *ot) @@ -2591,10 +2584,9 @@ static int nla_fmodifier_paste_exec(bContext *C, wmOperator *op) WM_event_add_notifier(C, NC_ANIMATION | ND_NLA | NA_EDITED, NULL); return OPERATOR_FINISHED; } - else { - BKE_report(op->reports, RPT_ERROR, "No F-Modifiers to paste"); - return OPERATOR_CANCELLED; - } + + BKE_report(op->reports, RPT_ERROR, "No F-Modifiers to paste"); + return OPERATOR_CANCELLED; } void NLA_OT_fmodifier_paste(wmOperatorType *ot) diff --git a/source/blender/editors/space_nla/space_nla.c b/source/blender/editors/space_nla/space_nla.c index f060693d9f4..b09536e0621 100644 --- a/source/blender/editors/space_nla/space_nla.c +++ b/source/blender/editors/space_nla/space_nla.c @@ -120,7 +120,7 @@ static SpaceLink *nla_new(const ScrArea *area, const Scene *scene) region->v2d.minzoom = 0.01f; region->v2d.maxzoom = 50; region->v2d.scroll = (V2D_SCROLL_BOTTOM | V2D_SCROLL_HORIZONTAL_HANDLES); - region->v2d.scroll |= (V2D_SCROLL_RIGHT); + region->v2d.scroll |= V2D_SCROLL_RIGHT; region->v2d.keepzoom = V2D_LOCKZOOM_Y; region->v2d.keepofs = V2D_KEEPOFS_Y; region->v2d.align = V2D_ALIGN_NO_POS_Y; @@ -191,7 +191,6 @@ static void nla_channel_region_draw(const bContext *C, ARegion *region) { bAnimContext ac; View2D *v2d = ®ion->v2d; - View2DScrollers *scrollers; /* clear and setup matrix */ UI_ThemeClearColor(TH_BACK); @@ -211,9 +210,7 @@ static void nla_channel_region_draw(const bContext *C, ARegion *region) UI_view2d_view_restore(C); /* scrollers */ - scrollers = UI_view2d_scrollers_calc(v2d, NULL); - UI_view2d_scrollers_draw(v2d, scrollers); - UI_view2d_scrollers_free(scrollers); + UI_view2d_scrollers_draw(v2d, NULL); } /* add handlers, stuff you only do once or on area/region changes */ @@ -237,7 +234,6 @@ static void nla_main_region_draw(const bContext *C, ARegion *region) Scene *scene = CTX_data_scene(C); bAnimContext ac; View2D *v2d = ®ion->v2d; - View2DScrollers *scrollers; short cfra_flag = 0; /* clear and setup matrix */ @@ -263,13 +259,10 @@ static void nla_main_region_draw(const bContext *C, ARegion *region) UI_view2d_text_cache_draw(region); } - UI_view2d_view_ortho(v2d); - /* current frame */ if (snla->flag & SNLA_DRAWTIME) { cfra_flag |= DRAWCFRA_UNIT_SECONDS; } - ANIM_draw_cfra(C, v2d, cfra_flag); /* markers */ UI_view2d_view_orthoSpecial(region, v2d, 1); @@ -290,11 +283,20 @@ static void nla_main_region_draw(const bContext *C, ARegion *region) UI_view2d_view_restore(C); ED_time_scrub_draw(region, scene, snla->flag & SNLA_DRAWTIME, true); +} + +static void nla_main_region_draw_overlay(const bContext *C, ARegion *region) +{ + /* draw entirely, view changes should be handled here */ + const SpaceNla *snla = CTX_wm_space_nla(C); + const Scene *scene = CTX_data_scene(C); + View2D *v2d = ®ion->v2d; + + /* scrubbing region */ + ED_time_scrub_draw_current_frame(region, scene, snla->flag & SNLA_DRAWTIME, true); /* scrollers */ - scrollers = UI_view2d_scrollers_calc(v2d, NULL); - UI_view2d_scrollers_draw(v2d, scrollers); - UI_view2d_scrollers_free(scrollers); + UI_view2d_scrollers_draw(v2d, NULL); } /* add handlers, stuff you only do once or on area/region changes */ @@ -620,6 +622,7 @@ void ED_spacetype_nla(void) art->regionid = RGN_TYPE_WINDOW; art->init = nla_main_region_init; art->draw = nla_main_region_draw; + art->draw_overlay = nla_main_region_draw_overlay; art->listener = nla_main_region_listener; art->message_subscribe = nla_main_region_message_subscribe; art->keymapflag = ED_KEYMAP_VIEW2D | ED_KEYMAP_ANIMATION | ED_KEYMAP_FRAMES; |