Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/transform/transform_mode_vert_slide.c
| Show First 20 Lines • Show All 603 Lines • ▼ Show 20 Lines | static void applyVertSlide(TransInfo *t, const int UNUSED(mval[2])) | ||||
| /* do stuff here */ | /* do stuff here */ | ||||
| doVertSlide(t, final); | doVertSlide(t, final); | ||||
| recalcData(t); | recalcData(t); | ||||
| ED_area_status_text(t->area, str); | ED_area_status_text(t->area, str); | ||||
| } | } | ||||
| static void vert_slide_transform_matrix_fn(struct TransInfo *t, float mat_xform[4][4]) | |||||
| { | |||||
| float delta[3], orig_co[3], final_co[3]; | |||||
| VertSlideParams *slp = t->custom.mode.data; | |||||
| TransDataContainer *tc = TRANS_DATA_CONTAINER_FIRST_OK(t); | |||||
| VertSlideData *sld_active = tc->custom.mode.data; | |||||
| TransDataVertSlideVert *sv_active = &sld_active->sv[sld_active->curr_sv_index]; | |||||
| copy_v3_v3(orig_co, sv_active->co_orig_3d); | |||||
| float tperc = t->values_final[0]; | |||||
| if (slp->use_even) { | |||||
| const float edge_len_curr = len_v3v3(sv_active->co_orig_3d, | |||||
| sv_active->co_link_orig_3d[sv_active->co_link_curr]); | |||||
| tperc *= edge_len_curr; | |||||
| } | |||||
| vert_slide_apply_elem(sv_active, tperc, slp->use_even, slp->flipped, final_co); | |||||
| if (tc->use_local_mat) { | |||||
| mul_m4_v3(tc->mat, orig_co); | |||||
| mul_m4_v3(tc->mat, final_co); | |||||
| } | |||||
| sub_v3_v3v3(delta, final_co, orig_co); | |||||
| add_v3_v3(mat_xform[3], delta); | |||||
| } | |||||
| void initVertSlide_ex(TransInfo *t, bool use_even, bool flipped, bool use_clamp) | void initVertSlide_ex(TransInfo *t, bool use_even, bool flipped, bool use_clamp) | ||||
| { | { | ||||
| t->mode = TFM_VERT_SLIDE; | t->mode = TFM_VERT_SLIDE; | ||||
| t->transform = applyVertSlide; | t->transform = applyVertSlide; | ||||
| t->handleEvent = handleEventVertSlide; | t->handleEvent = handleEventVertSlide; | ||||
| t->transform_matrix = NULL; | t->transform_matrix = vert_slide_transform_matrix_fn; | ||||
| t->tsnap.snap_mode_apply_fn = vert_slide_snap_apply; | t->tsnap.snap_mode_apply_fn = vert_slide_snap_apply; | ||||
| t->tsnap.snap_mode_distance_fn = transform_snap_distance_len_squared_fn; | t->tsnap.snap_mode_distance_fn = transform_snap_distance_len_squared_fn; | ||||
| { | { | ||||
| VertSlideParams *slp = MEM_callocN(sizeof(*slp), __func__); | VertSlideParams *slp = MEM_callocN(sizeof(*slp), __func__); | ||||
| slp->use_even = use_even; | slp->use_even = use_even; | ||||
| slp->flipped = flipped; | slp->flipped = flipped; | ||||
| slp->perc = 0.0f; | slp->perc = 0.0f; | ||||
| ▲ Show 20 Lines • Show All 68 Lines • Show Last 20 Lines | |||||