Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/transform/transform_mode_vert_slide.c
| Show First 20 Lines • Show All 533 Lines • ▼ Show 20 Lines | static void vert_slide_snap_apply(TransInfo *t, float *value) | ||||
| copy_v3_v3(co_curr_3d, sv->co_link_orig_3d[sv->co_link_curr]); | copy_v3_v3(co_curr_3d, sv->co_link_orig_3d[sv->co_link_curr]); | ||||
| if (tc->use_local_mat) { | if (tc->use_local_mat) { | ||||
| mul_m4_v3(tc->mat, co_orig_3d); | mul_m4_v3(tc->mat, co_orig_3d); | ||||
| mul_m4_v3(tc->mat, co_curr_3d); | mul_m4_v3(tc->mat, co_curr_3d); | ||||
| } | } | ||||
| getSnapPoint(t, dvec); | getSnapPoint(t, dvec); | ||||
| sub_v3_v3(dvec, t->tsnap.snapTarget); | sub_v3_v3(dvec, t->tsnap.snapTarget); | ||||
| if (t->tsnap.snapElem & (SCE_SNAP_MODE_EDGE | SCE_SNAP_MODE_FACE)) { | if (t->tsnap.snapElem & (SCE_SNAP_MODE_EDGE | SCE_SNAP_MODE_FACE_RAYCAST)) { | ||||
| float co_dir[3]; | float co_dir[3]; | ||||
| sub_v3_v3v3(co_dir, co_curr_3d, co_orig_3d); | sub_v3_v3v3(co_dir, co_curr_3d, co_orig_3d); | ||||
| normalize_v3(co_dir); | normalize_v3(co_dir); | ||||
| if (t->tsnap.snapElem & SCE_SNAP_MODE_EDGE) { | if (t->tsnap.snapElem & SCE_SNAP_MODE_EDGE) { | ||||
| transform_constraint_snap_axis_to_edge(t, co_dir, dvec); | transform_constraint_snap_axis_to_edge(t, co_dir, dvec); | ||||
| } | } | ||||
| else { | else { | ||||
| transform_constraint_snap_axis_to_face(t, co_dir, dvec); | transform_constraint_snap_axis_to_face(t, co_dir, dvec); | ||||
| Show All 12 Lines | static void applyVertSlide(TransInfo *t, const int UNUSED(mval[2])) | ||||
| VertSlideParams *slp = t->custom.mode.data; | VertSlideParams *slp = t->custom.mode.data; | ||||
| const bool flipped = slp->flipped; | const bool flipped = slp->flipped; | ||||
| const bool use_even = slp->use_even; | const bool use_even = slp->use_even; | ||||
| const bool is_clamp = !(t->flag & T_ALT_TRANSFORM); | const bool is_clamp = !(t->flag & T_ALT_TRANSFORM); | ||||
| const bool is_constrained = !(is_clamp == false || hasNumInput(&t->num)); | const bool is_constrained = !(is_clamp == false || hasNumInput(&t->num)); | ||||
| final = t->values[0] + t->values_modal_offset[0]; | final = t->values[0] + t->values_modal_offset[0]; | ||||
| applySnapping(t, &final); | applySnappingAsGroup(t, &final); | ||||
| if (!validSnap(t)) { | if (!validSnap(t)) { | ||||
| transform_snap_increment(t, &final); | transform_snap_increment(t, &final); | ||||
| } | } | ||||
| /* only do this so out of range values are not displayed */ | /* only do this so out of range values are not displayed */ | ||||
| if (is_constrained) { | if (is_constrained) { | ||||
| CLAMP(final, 0.0f, 1.0f); | CLAMP(final, 0.0f, 1.0f); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 96 Lines • Show Last 20 Lines | |||||