diff options
Diffstat (limited to 'source/blender/editors/transform/transform.c')
-rw-r--r-- | source/blender/editors/transform/transform.c | 98 |
1 files changed, 64 insertions, 34 deletions
diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index d5a9d0f9f93..ce2f07f1813 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -1749,29 +1749,32 @@ void saveTransform(bContext *C, TransInfo *t, wmOperator *op) // If modal, save settings back in scene if not set as operator argument if (t->flag & T_MODAL) { - /* save settings if not set in operator */ - if ((prop = RNA_struct_find_property(op->ptr, "proportional")) && - !RNA_property_is_set(op->ptr, prop)) - { - if (t->obedit) - ts->proportional = proportional; - else if (t->options & CTX_MASK) - ts->proportional_mask = (proportional != PROP_EDIT_OFF); - else - ts->proportional_objects = (proportional != PROP_EDIT_OFF); - } - if ((prop = RNA_struct_find_property(op->ptr, "proportional_size")) && - !RNA_property_is_set(op->ptr, prop)) - { - ts->proportional_size = t->prop_size; - } + /* skip saving proportional edit if it was not actually used */ + if (!(t->options & CTX_NO_PET)) { + if ((prop = RNA_struct_find_property(op->ptr, "proportional")) && + !RNA_property_is_set(op->ptr, prop)) + { + if (t->obedit) + ts->proportional = proportional; + else if (t->options & CTX_MASK) + ts->proportional_mask = (proportional != PROP_EDIT_OFF); + else + ts->proportional_objects = (proportional != PROP_EDIT_OFF); + } - if ((prop = RNA_struct_find_property(op->ptr, "proportional_edit_falloff")) && - !RNA_property_is_set(op->ptr, prop)) - { - ts->prop_mode = t->prop_mode; + if ((prop = RNA_struct_find_property(op->ptr, "proportional_size")) && + !RNA_property_is_set(op->ptr, prop)) + { + ts->proportional_size = t->prop_size; + } + + if ((prop = RNA_struct_find_property(op->ptr, "proportional_edit_falloff")) && + !RNA_property_is_set(op->ptr, prop)) + { + ts->prop_mode = t->prop_mode; + } } /* do we check for parameter? */ @@ -1851,7 +1854,7 @@ int initTransform(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *even options |= CTX_TEXTURE; } } - + t->options = options; t->mode = mode; @@ -1893,6 +1896,7 @@ int initTransform(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *even else if (t->spacetype == SPACE_CLIP) { unit_m3(t->spacemtx); t->draw_handle_view = ED_region_draw_cb_activate(t->ar->type, drawTransformView, t, REGION_DRAW_POST_VIEW); + t->draw_handle_cursor = WM_paint_cursor_activate(CTX_wm_manager(C), helpline_poll, drawHelpline, t); } else if (t->spacetype == SPACE_NODE) { unit_m3(t->spacemtx); @@ -3005,7 +3009,12 @@ static void ElementResize(TransInfo *t, TransData *td, float mat[3][3]) copy_v3_v3(center, td->center); } else if (t->options & CTX_MOVIECLIP) { - copy_v3_v3(center, td->center); + if (td->flag & TD_INDIVIDUAL_SCALE) { + copy_v3_v3(center, td->center); + } + else { + copy_v3_v3(center, t->center); + } } else { copy_v3_v3(center, t->center); @@ -4795,6 +4804,26 @@ static BMEdge *get_other_edge(BMVert *v, BMEdge *e) return NULL; } +/* interpoaltes along a line made up of 2 segments (used for edge slide) */ +static void interp_line_v3_v3v3v3(float p[3], const float v1[3], const float v2[3], const float v3[3], const float t) +{ + float t_mid, t_delta; + + /* could be pre-calculated */ + t_mid = line_point_factor_v3(v2, v1, v3); + + t_delta = t - t_mid; + if (fabsf(t_delta) < FLT_EPSILON) { + copy_v3_v3(p, v2); + } + else if (t_delta < 0.0f) { + interp_v3_v3v3(p, v1, v2, t / t_mid); + } + else { + interp_v3_v3v3(p, v2, v3, (t - t_mid) / (1.0f - t_mid)); + } +} + static void len_v3_ensure(float v[3], const float length) { normalize_v3(v); @@ -4820,7 +4849,7 @@ static bool bm_loop_calc_opposite_co(BMLoop *l_tmp, float tvec[3]; if (isect_line_plane_v3(tvec, l_iter->v->co, l_iter->next->v->co, - l_tmp->v->co, plane_no, false)) + l_tmp->v->co, plane_no)) { const float fac = line_point_factor_v3(tvec, l_iter->v->co, l_iter->next->v->co); /* allow some overlap to avoid missing the intersection because of float precision */ @@ -5707,20 +5736,16 @@ static void drawEdgeSlide(const struct bContext *C, TransInfo *t) /* Non-Prop mode */ if (sld && sld->is_proportional == FALSE) { View3D *v3d = CTX_wm_view3d(C); - float marker[3]; - float v1[3], v2[3]; - float interp_v; + float co_a[3], co_b[3], co_mark[3]; TransDataEdgeSlideVert *curr_sv = &sld->sv[sld->curr_sv_index]; + const float fac = (sld->perc + 1.0f) / 2.0f; const float ctrl_size = UI_GetThemeValuef(TH_FACEDOT_SIZE) + 1.5f; const float guide_size = ctrl_size - 0.5f; const float line_size = UI_GetThemeValuef(TH_OUTLINE_WIDTH) + 0.5f; const int alpha_shade = -30; - add_v3_v3v3(v1, curr_sv->v_co_orig, curr_sv->dir_a); - add_v3_v3v3(v2, curr_sv->v_co_orig, curr_sv->dir_b); - - interp_v = (sld->perc + 1.0f) / 2.0f; - interp_v3_v3v3(marker, v2, v1, interp_v); + add_v3_v3v3(co_a, curr_sv->v_co_orig, curr_sv->dir_a); + add_v3_v3v3(co_b, curr_sv->v_co_orig, curr_sv->dir_b); if (v3d && v3d->zbuf) glDisable(GL_DEPTH_TEST); @@ -5761,7 +5786,12 @@ static void drawEdgeSlide(const struct bContext *C, TransInfo *t) UI_ThemeColorShadeAlpha(TH_SELECT, 255, alpha_shade); glPointSize(guide_size); bglBegin(GL_POINTS); - bglVertex3fv(marker); +#if 0 + interp_v3_v3v3(co_mark, co_b, co_a, fac); + bglVertex3fv(co_mark); +#endif + interp_line_v3_v3v3v3(co_mark, co_b, curr_sv->v_co_orig, co_a, fac); + bglVertex3fv(co_mark); bglEnd(); @@ -5823,10 +5853,10 @@ static int doEdgeSlide(TransInfo *t, float perc) add_v3_v3v3(co_b, sv->v_co_orig, sv->dir_b); if (sld->flipped_vtx) { - interp_v3_v3v3(sv->v->co, co_b, co_a, fac); + interp_line_v3_v3v3v3(sv->v->co, co_b, sv->v_co_orig, co_a, fac); } else { - interp_v3_v3v3(sv->v->co, co_a, co_b, fac); + interp_line_v3_v3v3v3(sv->v->co, co_a, sv->v_co_orig, co_b, fac); } } } |