diff options
author | Antonioya <blendergit@gmail.com> | 2019-07-23 10:46:29 +0300 |
---|---|---|
committer | Antonioya <blendergit@gmail.com> | 2019-07-23 10:46:29 +0300 |
commit | 2204bfcf9e1c3a38e60830bd97775dd72158f4d6 (patch) | |
tree | 4f9c827389a23a431f8771b4ca02f410860c0242 /source/blender/editors/transform/transform.c | |
parent | f64db794ee690f05905ace0a66d81d2e75549b90 (diff) | |
parent | 34ad6da4a06ef46cd19945f61cc5f968538546a8 (diff) |
Merge branch 'master' into temp-gpencil-drw-engine
Diffstat (limited to 'source/blender/editors/transform/transform.c')
-rw-r--r-- | source/blender/editors/transform/transform.c | 58 |
1 files changed, 50 insertions, 8 deletions
diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index 5b3f7d85b43..a316567fc63 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -617,6 +617,8 @@ static void viewRedrawForce(const bContext *C, TransInfo *t) } else if (t->spacetype == SPACE_SEQ) { WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, NULL); + /* Keyframes on strips has been moved, so make sure related editos are informed. */ + WM_event_add_notifier(C, NC_ANIMATION, NULL); } else if (t->spacetype == SPACE_IMAGE) { if (t->options & CTX_MASK) { @@ -6440,6 +6442,8 @@ static void slide_origdata_create_data(TransDataContainer *tc, layer_index_dst = 0; + /* TODO: We don't need `sod->layer_math_map` when there are no loops linked + * to one of the sliding vertices. */ if (CustomData_has_math(&bm->ldata)) { /* over alloc, only 'math' layers are indexed */ sod->layer_math_map = MEM_mallocN(bm->ldata.totlayer * sizeof(int), __func__); @@ -6583,7 +6587,7 @@ static void slide_origdata_interp_data_vert(SlideOrigData *sod, } } - if (sod->layer_math_map_num) { + if (sod->layer_math_map_num && sv->cd_loop_groups) { if (do_loop_weight) { for (j = 0; j < sod->layer_math_map_num; j++) { BM_vert_loop_groups_data_layer_merge_weights( @@ -6699,9 +6703,28 @@ static void slide_origdata_free_date(SlideOrigData *sod) /** \name Transform Edge Slide * \{ */ +/** + * Get the first valid EdgeSlideData. + * + * Note we cannot trust TRANS_DATA_CONTAINER_FIRST_OK because of multi-object that + * may leave items with invalid custom data in the transform data container. + */ +static EdgeSlideData *edgeSlideFirstGet(TransInfo *t) +{ + FOREACH_TRANS_DATA_CONTAINER (t, tc) { + EdgeSlideData *sld = tc->custom.mode.data; + if (sld == NULL) { + continue; + } + return sld; + } + BLI_assert(!"Should never happen, at least one EdgeSlideData should be valid"); + return NULL; +} + static void calcEdgeSlideCustomPoints(struct TransInfo *t) { - EdgeSlideData *sld = TRANS_DATA_CONTAINER_FIRST_OK(t)->custom.mode.data; + EdgeSlideData *sld = edgeSlideFirstGet(t); setCustomPoints(t, &t->mouse, sld->mval_end, sld->mval_start); @@ -7675,10 +7698,14 @@ void projectEdgeSlideData(TransInfo *t, bool is_final) { FOREACH_TRANS_DATA_CONTAINER (t, tc) { EdgeSlideData *sld = tc->custom.mode.data; - SlideOrigData *sod = &sld->orig_data; + if (sld == NULL) { + continue; + } + + SlideOrigData *sod = &sld->orig_data; if (sod->use_origfaces == false) { - return; + continue; } slide_origdata_interp_data(tc->obedit, @@ -7701,7 +7728,7 @@ void freeEdgeSlideVerts(TransInfo *UNUSED(t), { EdgeSlideData *sld = custom_data->data; - if (!sld) { + if (sld == NULL) { return; } @@ -7843,9 +7870,9 @@ static eRedrawFlag handleEventEdgeSlide(struct TransInfo *t, const struct wmEven static void drawEdgeSlide(TransInfo *t) { - if ((t->mode == TFM_EDGE_SLIDE) && TRANS_DATA_CONTAINER_FIRST_OK(t)->custom.mode.data) { + if ((t->mode == TFM_EDGE_SLIDE) && edgeSlideFirstGet(t)) { const EdgeSlideParams *slp = t->custom.mode.data; - EdgeSlideData *sld = TRANS_DATA_CONTAINER_FIRST_OK(t)->custom.mode.data; + EdgeSlideData *sld = edgeSlideFirstGet(t); const bool is_clamp = !(t->flag & T_ALT_TRANSFORM); /* Even mode */ @@ -7964,7 +7991,7 @@ static void drawEdgeSlide(TransInfo *t) static void doEdgeSlide(TransInfo *t, float perc) { EdgeSlideParams *slp = t->custom.mode.data; - EdgeSlideData *sld_active = TRANS_DATA_CONTAINER_FIRST_OK(t)->custom.mode.data; + EdgeSlideData *sld_active = edgeSlideFirstGet(t); slp->perc = perc; @@ -7975,6 +8002,11 @@ static void doEdgeSlide(TransInfo *t, float perc) const float perc_final = fabsf(perc); FOREACH_TRANS_DATA_CONTAINER (t, tc) { EdgeSlideData *sld = tc->custom.mode.data; + + if (sld == NULL) { + continue; + } + TransDataEdgeSlideVert *sv = sld->sv; for (int i = 0; i < sld->totsv; i++, sv++) { madd_v3_v3v3fl(sv->v->co, sv->v_co_orig, sv->dir_side[side_index], perc_final); @@ -7988,6 +8020,11 @@ static void doEdgeSlide(TransInfo *t, float perc) const int side_index = sld_active->curr_side_unclamp; FOREACH_TRANS_DATA_CONTAINER (t, tc) { EdgeSlideData *sld = tc->custom.mode.data; + + if (sld == NULL) { + continue; + } + TransDataEdgeSlideVert *sv = sld->sv; for (int i = 0; i < sld->totsv; i++, sv++) { float dir_flip[3]; @@ -8024,6 +8061,11 @@ static void doEdgeSlide(TransInfo *t, float perc) FOREACH_TRANS_DATA_CONTAINER (t, tc) { EdgeSlideData *sld = tc->custom.mode.data; + + if (sld == NULL) { + continue; + } + TransDataEdgeSlideVert *sv = sld->sv; for (int i = 0; i < sld->totsv; i++, sv++) { if (sv->edge_len > FLT_EPSILON) { |