From 53ec0e5166aaeb5c688d6e6de91c61ea60200922 Mon Sep 17 00:00:00 2001 From: Joshua Leung Date: Sun, 3 Sep 2017 03:35:27 +1200 Subject: Fix T52227: Time Slide tool doesn't take NLA mapping into account To be backported to 2.79 --- source/blender/editors/transform/transform.c | 42 ++++++++++++++++++++-------- 1 file changed, 31 insertions(+), 11 deletions(-) (limited to 'source/blender/editors') diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index 0ebf24b44ce..8cabf8d78ed 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -8362,8 +8362,15 @@ static void initTimeSlide(TransInfo *t) TransData *td = t->data; for (i = 0; i < t->total; i++, td++) { - if (min > *(td->val)) min = *(td->val); - if (max < *(td->val)) max = *(td->val); + AnimData *adt = (t->spacetype != SPACE_NLA) ? td->extra : NULL; + float val = *(td->val); + + /* strip/action time to global (mapped) time */ + if (adt) + val = BKE_nla_tweakedit_remap(adt, val, NLATIME_CONVERT_MAP); + + if (min > val) min = val; + if (max < val) max = val; } if (min == max) { @@ -8438,25 +8445,38 @@ static void applyTimeSlideValue(TransInfo *t, float sval) */ AnimData *adt = (t->spacetype != SPACE_NLA) ? td->extra : NULL; float cval = t->values[0]; - - /* apply NLA-mapping to necessary values */ - if (adt) - cval = BKE_nla_tweakedit_remap(adt, cval, NLATIME_CONVERT_UNMAP); - + /* only apply to data if in range */ if ((sval > minx) && (sval < maxx)) { float cvalc = CLAMPIS(cval, minx, maxx); + float ival = td->ival; float timefac; - + + /* NLA mapping magic here works as follows: + * - "ival" goes from strip time to global time + * - calculation is performed into td->val in global time + * (since sval and min/max are all in global time) + * - "td->val" then gets put back into strip time + */ + if (adt) { + /* strip to global */ + ival = BKE_nla_tweakedit_remap(adt, ival, NLATIME_CONVERT_MAP); + } + /* left half? */ - if (td->ival < sval) { - timefac = (sval - td->ival) / (sval - minx); + if (ival < sval) { + timefac = (sval - ival) / (sval - minx); *(td->val) = cvalc - timefac * (cvalc - minx); } else { - timefac = (td->ival - sval) / (maxx - sval); + timefac = (ival - sval) / (maxx - sval); *(td->val) = cvalc + timefac * (maxx - cvalc); } + + if (adt) { + /* global to strip */ + *(td->val) = BKE_nla_tweakedit_remap(adt, *(td->val), NLATIME_CONVERT_UNMAP); + } } } } -- cgit v1.2.3 From c6719730921f16bcf7758f425540b1e12e46734a Mon Sep 17 00:00:00 2001 From: Joshua Leung Date: Sun, 3 Sep 2017 03:38:44 +1200 Subject: Fix: GPencil Sequence Interpolation for thickness/strength was inverted For example, if you have two keyframes: k1 = 1px, k2 = 10px it was doing: 1px, 9px, 8px, ..., 3px, 2px, 10px instead of: 1px, 2px, 3px, ..., 8px, 9px, 10px --- source/blender/editors/gpencil/gpencil_interpolate.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source/blender/editors') diff --git a/source/blender/editors/gpencil/gpencil_interpolate.c b/source/blender/editors/gpencil/gpencil_interpolate.c index 4bcc9f7b811..83e2a85db49 100644 --- a/source/blender/editors/gpencil/gpencil_interpolate.c +++ b/source/blender/editors/gpencil/gpencil_interpolate.c @@ -117,8 +117,8 @@ static void gp_interpolate_update_points(bGPDstroke *gps_from, bGPDstroke *gps_t /* Interpolate all values */ interp_v3_v3v3(&pt->x, &prev->x, &next->x, factor); - pt->pressure = interpf(prev->pressure, next->pressure, factor); - pt->strength = interpf(prev->strength, next->strength, factor); + pt->pressure = interpf(prev->pressure, next->pressure, 1.0f - factor); + pt->strength = interpf(prev->strength, next->strength, 1.0f - factor); CLAMP(pt->strength, GPENCIL_STRENGTH_MIN, 1.0f); } } -- cgit v1.2.3 From 4f6196a04131a462a1f0712ac7d0f9eb6fb0c150 Mon Sep 17 00:00:00 2001 From: Joshua Leung Date: Sun, 3 Sep 2017 12:40:49 +1200 Subject: Fix: Border select for GPencil keyframes was including those in the "datablock" channels even though those weren't visible This meant that it was easy to accidentally select too many keyframes --- source/blender/editors/space_action/action_select.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'source/blender/editors') diff --git a/source/blender/editors/space_action/action_select.c b/source/blender/editors/space_action/action_select.c index 553be0ad290..17edbc6cc1d 100644 --- a/source/blender/editors/space_action/action_select.c +++ b/source/blender/editors/space_action/action_select.c @@ -262,6 +262,7 @@ static void borderselect_action(bAnimContext *ac, const rcti rect, short mode, s { /* loop over data selecting */ switch (ale->type) { +#if 0 /* XXXX: Keyframes are not currently shown here */ case ANIMTYPE_GPDATABLOCK: { bGPdata *gpd = ale->data; @@ -271,6 +272,7 @@ static void borderselect_action(bAnimContext *ac, const rcti rect, short mode, s } break; } +#endif case ANIMTYPE_GPLAYER: ED_gplayer_frames_select_border(ale->data, rectf.xmin, rectf.xmax, selectmode); break; -- cgit v1.2.3 From b227a3388d44ef56df91a65e6973f2cde687a032 Mon Sep 17 00:00:00 2001 From: Joshua Leung Date: Sun, 3 Sep 2017 12:46:01 +1200 Subject: Fix: Deleting GPencil keyframes in DopeSheet didn't redraw the view --- source/blender/editors/gpencil/editaction_gpencil.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'source/blender/editors') diff --git a/source/blender/editors/gpencil/editaction_gpencil.c b/source/blender/editors/gpencil/editaction_gpencil.c index 9227f9b1097..90d44503013 100644 --- a/source/blender/editors/gpencil/editaction_gpencil.c +++ b/source/blender/editors/gpencil/editaction_gpencil.c @@ -252,8 +252,10 @@ bool ED_gplayer_frames_delete(bGPDlayer *gpl) for (gpf = gpl->frames.first; gpf; gpf = gpfn) { gpfn = gpf->next; - if (gpf->flag & GP_FRAME_SELECT) - changed |= BKE_gpencil_layer_delframe(gpl, gpf); + if (gpf->flag & GP_FRAME_SELECT) { + BKE_gpencil_layer_delframe(gpl, gpf); + changed = true; + } } return changed; -- cgit v1.2.3