WIP: Snapping & precision modeling improvements #105941
|
@ -165,10 +165,8 @@ ENUM_OPERATORS(eTModifier, MOD_NODE_ATTACH)
|
|||
typedef enum eTSnap {
|
||||
SNAP_RESETTED = 0,
|
||||
SNAP_SOURCE_FOUND = 1 << 0,
|
||||
/* Special flag for snap to grid. */
|
||||
SNAP_TARGET_GRID_FOUND = 1 << 1,
|
||||
SNAP_TARGET_FOUND = 1 << 2,
|
||||
SNAP_MULTI_POINTS = 1 << 3,
|
||||
SNAP_TARGET_FOUND = 1 << 1,
|
||||
SNAP_MULTI_POINTS = 1 << 2,
|
||||
} eTSnap;
|
||||
ENUM_OPERATORS(eTSnap, SNAP_MULTI_POINTS)
|
||||
|
||||
|
@ -303,7 +301,6 @@ typedef struct TransSnap {
|
|||
float snap_source[3];
|
||||
/** to this point (in global-space). */
|
||||
float snap_target[3];
|
||||
float snap_target_grid[3];
|
||||
float snapNormal[3];
|
||||
char snapNodeBorder;
|
||||
ListBase points;
|
||||
|
|
|
@ -348,28 +348,6 @@ static void headerTranslation(TransInfo *t, const float vec[3], char str[UI_MAX_
|
|||
/** \name Transform (Translation) Snapping
|
||||
* \{ */
|
||||
|
||||
static void translate_snap_target_grid_ensure(TransInfo *t)
|
||||
{
|
||||
/* Only need to calculate once. */
|
||||
if ((t->tsnap.status & SNAP_TARGET_GRID_FOUND) == 0) {
|
||||
if (t->data_type == &TransConvertType_Cursor3D) {
|
||||
/* Use a fallback when transforming the cursor.
|
||||
* In this case the center is _not_ derived from the cursor which is being transformed. */
|
||||
copy_v3_v3(t->tsnap.snap_target_grid, TRANS_DATA_CONTAINER_FIRST_SINGLE(t)->data->iloc);
|
||||
}
|
||||
else if (t->around == V3D_AROUND_CURSOR) {
|
||||
/* Use a fallback for cursor selection,
|
||||
* this isn't useful as a global center for absolute grid snapping
|
||||
* since its not based on the position of the selection. */
|
||||
tranform_snap_target_median_calc(t, t->tsnap.snap_target_grid);
|
||||
}
|
||||
else {
|
||||
copy_v3_v3(t->tsnap.snap_target_grid, t->center_global);
|
||||
}
|
||||
t->tsnap.status |= SNAP_TARGET_GRID_FOUND;
|
||||
}
|
||||
}
|
||||
|
||||
static void ApplySnapTranslation(TransInfo *t, float vec[3])
|
||||
{
|
||||
float point[3];
|
||||
|
@ -397,13 +375,7 @@ static void ApplySnapTranslation(TransInfo *t, float vec[3])
|
|||
}
|
||||
}
|
||||
|
||||
if (t->tsnap.snapElem == SCE_SNAP_MODE_GRID) {
|
||||
translate_snap_target_grid_ensure(t);
|
||||
sub_v3_v3v3(vec, point, t->tsnap.snap_target_grid);
|
||||
}
|
||||
else {
|
||||
sub_v3_v3v3(vec, point, t->tsnap.snap_source);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -606,7 +606,7 @@ void transform_snap_mixed_apply(TransInfo *t, float *vec)
|
|||
/* Time base quirky code to go around find-nearest slowness. */
|
||||
/* TODO: add exception for object mode, no need to slow it down then. */
|
||||
if (current - t->tsnap.last >= 0.01) {
|
||||
if (t->tsnap.snap_target_fn && (t->tsnap.mode != SCE_SNAP_MODE_GRID)) {
|
||||
if (t->tsnap.snap_target_fn) {
|
||||
t->tsnap.snap_target_fn(t, vec);
|
||||
}
|
||||
if (t->tsnap.snap_source_fn) {
|
||||
|
|
Loading…
Reference in New Issue