Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/transform/transform_mode_edge_slide.c
| Show First 20 Lines • Show All 1,286 Lines • ▼ Show 20 Lines | static void edge_slide_snap_apply(TransInfo *t, float *value) | ||||
| else { | else { | ||||
| /* Could be pre-calculated. */ | /* Could be pre-calculated. */ | ||||
| t_mid = line_point_factor_v3((float[3]){0.0f, 0.0f, 0.0f}, sv->dir_side[0], sv->dir_side[1]); | t_mid = line_point_factor_v3((float[3]){0.0f, 0.0f, 0.0f}, sv->dir_side[0], sv->dir_side[1]); | ||||
| float t_snap = line_point_factor_v3(snap_point, co_dest[0], co_dest[1]); | float t_snap = line_point_factor_v3(snap_point, co_dest[0], co_dest[1]); | ||||
| side_index = t_snap >= t_mid; | side_index = t_snap >= t_mid; | ||||
| } | } | ||||
| 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_dest[side_index], co_orig); | sub_v3_v3v3(co_dir, co_dest[side_index], co_orig); | ||||
| 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 20 Lines • Show All 135 Lines • ▼ Show 20 Lines | static void applyEdgeSlide(TransInfo *t, const int UNUSED(mval[2])) | ||||
| EdgeSlideParams *slp = t->custom.mode.data; | EdgeSlideParams *slp = t->custom.mode.data; | ||||
| bool flipped = slp->flipped; | bool flipped = slp->flipped; | ||||
| bool use_even = slp->use_even; | 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, -1.0f, 1.0f); | CLAMP(final, -1.0f, 1.0f); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 100 Lines • Show Last 20 Lines | |||||