[Bf-blender-cvs] [45a2ee66602] transform-snap-base: Remove multiple modes (always return the object to the initial position)
Germano Cavalcante
noreply at git.blender.org
Mon Nov 23 19:04:23 CET 2020
Commit: 45a2ee66602b4217566ee35063a16668a43a2087
Author: Germano Cavalcante
Date: Mon Nov 16 09:13:56 2020 -0300
Branches: transform-snap-base
https://developer.blender.org/rB45a2ee66602b4217566ee35063a16668a43a2087
Remove multiple modes (always return the object to the initial position)
===================================================================
M source/blender/editors/include/ED_transform_snap_object_context.h
M source/blender/editors/transform/transform.c
M source/blender/editors/transform/transform.h
M source/blender/editors/transform/transform_mode_edge_slide.c
M source/blender/editors/transform/transform_mode_resize.c
M source/blender/editors/transform/transform_mode_rotate.c
M source/blender/editors/transform/transform_mode_translate.c
M source/blender/editors/transform/transform_mode_vert_slide.c
M source/blender/editors/transform/transform_snap.c
M source/blender/editors/transform/transform_snap.h
M source/blender/editors/transform/transform_snap_object.c
===================================================================
diff --git a/source/blender/editors/include/ED_transform_snap_object_context.h b/source/blender/editors/include/ED_transform_snap_object_context.h
index fa8d61bf7a9..ebaa32941f2 100644
--- a/source/blender/editors/include/ED_transform_snap_object_context.h
+++ b/source/blender/editors/include/ED_transform_snap_object_context.h
@@ -44,7 +44,6 @@ typedef enum eSnapSelect {
SNAP_ALL = 0,
SNAP_NOT_SELECTED = 1,
SNAP_NOT_ACTIVE = 2,
- SNAP_SELECTED_ONLY = 3,
} eSnapSelect;
/** used for storing multiple hits */
diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c
index 452a01a8f23..9a7a0ac0a94 100644
--- a/source/blender/editors/transform/transform.c
+++ b/source/blender/editors/transform/transform.c
@@ -819,7 +819,7 @@ int transformEvent(TransInfo *t, const wmEvent *event)
t->state = TRANS_RUNNING;
}
- if (!(t->modifiers & (MOD_EDIT_BASEPOINT_IN_OBJECT | MOD_EDIT_BASEPOINT_IN_SCENE))) {
+ if (!(t->modifiers & MOD_EDIT_BASEPOINT)) {
applyMouseInput(t, &t->mouse, t->mval, t->values);
}
@@ -836,7 +836,7 @@ int transformEvent(TransInfo *t, const wmEvent *event)
handled = true;
break;
case TFM_MODAL_CONFIRM:
- if (t->modifiers & (MOD_EDIT_BASEPOINT_IN_OBJECT | MOD_EDIT_BASEPOINT_IN_SCENE)) {
+ if (t->modifiers & MOD_EDIT_BASEPOINT) {
tranform_snap_editbasepoint_confirm(t);
}
else {
@@ -1123,7 +1123,7 @@ int transformEvent(TransInfo *t, const wmEvent *event)
}
break;
case TFM_MODAL_EDIT_SNAPWITH:
- tranform_snap_editbasepoint_set_mode(t);
+ tranform_snap_editbasepoint_toggle(t);
break;
/* Those two are only handled in transform's own handler, see T44634! */
case TFM_MODAL_EDGESLIDE_UP:
@@ -1548,6 +1548,7 @@ void saveTransform(bContext *C, TransInfo *t, wmOperator *op)
WM_msg_publish_rna_prop(t->mbus, &t->scene->id, ts, ToolSettings, use_snap);
}
}
+ }
#endif
if ((prop = RNA_struct_find_property(op->ptr, "use_proportional_edit"))) {
@@ -1928,7 +1929,7 @@ void transformApply(bContext *C, TransInfo *t)
if ((t->redraw & TREDRAW_HARD) || (t->draw_handle_apply == NULL && (t->redraw & TREDRAW_SOFT))) {
selectConstraint(t);
- if (t->modifiers & (MOD_EDIT_BASEPOINT_IN_OBJECT | MOD_EDIT_BASEPOINT_IN_SCENE)) {
+ if (t->modifiers & MOD_EDIT_BASEPOINT) {
tranform_snap_editbasepoint_update(t);
}
else if (t->transform) {
diff --git a/source/blender/editors/transform/transform.h b/source/blender/editors/transform/transform.h
index 6f0aa7823e4..3c10e560267 100644
--- a/source/blender/editors/transform/transform.h
+++ b/source/blender/editors/transform/transform.h
@@ -161,8 +161,7 @@ typedef enum {
MOD_SNAP = 1 << 3,
MOD_SNAP_INVERT = 1 << 4,
MOD_FORCE_SNAP = MOD_SNAP | (1 << 5),
- MOD_EDIT_BASEPOINT_IN_OBJECT = 1 << 6,
- MOD_EDIT_BASEPOINT_IN_SCENE = 1 << 7,
+ MOD_EDIT_BASEPOINT = 1 << 6,
} eTransModifiers;
/** #TransInfo.helpline */
@@ -230,7 +229,6 @@ typedef struct TransSnap {
void (*applySnap)(struct TransInfo *, float *);
void (*calcSnap)(struct TransInfo *, float *);
void (*targetSnap)(struct TransInfo *);
- void (*updateBasePoint)(struct TransInfo *, const float *, float *);
/**
* Get the transform distance between two points (used by Closest snap)
*
diff --git a/source/blender/editors/transform/transform_mode_edge_slide.c b/source/blender/editors/transform/transform_mode_edge_slide.c
index 3c6247002f6..dae3fe6f7b4 100644
--- a/source/blender/editors/transform/transform_mode_edge_slide.c
+++ b/source/blender/editors/transform/transform_mode_edge_slide.c
@@ -1512,7 +1512,6 @@ void initEdgeSlide_ex(
t->transform = applyEdgeSlide;
t->handleEvent = handleEventEdgeSlide;
t->tsnap.applySnap = edge_slide_snap_apply;
- t->tsnap.updateBasePoint = transform_snap_translate_update_baseboint_fn;
t->tsnap.distance = transform_snap_distance_len_squared_fn;
{
diff --git a/source/blender/editors/transform/transform_mode_resize.c b/source/blender/editors/transform/transform_mode_resize.c
index cd40e2a3004..62a4fbd6f04 100644
--- a/source/blender/editors/transform/transform_mode_resize.c
+++ b/source/blender/editors/transform/transform_mode_resize.c
@@ -75,19 +75,6 @@ static void ApplySnapResize(TransInfo *t, float vec[3])
}
}
-static void resize_update_baseboint_fn(TransInfo *t,
- const float new_base_point[3],
- float r_base_point_final[3])
-{
- float mat[3][3];
- size_to_mat3(mat, t->values_final);
- invert_m3(mat);
-
- mul_v3_m3v3(r_base_point_final, t->spacemtx_inv, new_base_point);
- mul_m3_v3(mat, r_base_point_final);
- mul_m3_v3(t->spacemtx, r_base_point_final);
-}
-
static void applyResize(TransInfo *t, const int UNUSED(mval[2]))
{
float mat[3][3];
@@ -179,7 +166,6 @@ void initResize(TransInfo *t)
t->mode = TFM_RESIZE;
t->transform = applyResize;
t->tsnap.applySnap = ApplySnapResize;
- t->tsnap.updateBasePoint = resize_update_baseboint_fn;
t->tsnap.distance = ResizeBetween;
initMouseInputMode(t, &t->mouse, INPUT_SPRING_FLIP);
diff --git a/source/blender/editors/transform/transform_mode_rotate.c b/source/blender/editors/transform/transform_mode_rotate.c
index 8e93e5b2592..fb4ba3ee552 100644
--- a/source/blender/editors/transform/transform_mode_rotate.c
+++ b/source/blender/editors/transform/transform_mode_rotate.c
@@ -117,22 +117,6 @@ static void rotate_get_axis(TransInfo *t, float r_axis[3], bool *r_flip_angle)
}
}
-static void rotate_update_baseboint_fn(TransInfo *t,
- const float new_base_point[3],
- float r_base_point_final[3])
-{
- float mat[3][3];
- float angle = -t->values_final[0];
- {
- float axis_final[3];
- bool dummy;
- rotate_get_axis(t, axis_final, &dummy);
- axis_angle_normalized_to_mat3(mat, axis_final, angle);
- }
-
- mul_v3_m3v3(r_base_point_final, mat, new_base_point);
-}
-
static float large_rotation_limit(float angle)
{
/* Limit rotation to 1001 turns max
@@ -266,7 +250,6 @@ void initRotation(TransInfo *t)
t->mode = TFM_ROTATION;
t->transform = applyRotation;
t->tsnap.applySnap = ApplySnapRotation;
- t->tsnap.updateBasePoint = rotate_update_baseboint_fn;
t->tsnap.distance = RotationBetween;
setInputPostFct(&t->mouse, postInputRotation);
diff --git a/source/blender/editors/transform/transform_mode_translate.c b/source/blender/editors/transform/transform_mode_translate.c
index 5a53bf38aec..a54de102966 100644
--- a/source/blender/editors/transform/transform_mode_translate.c
+++ b/source/blender/editors/transform/transform_mode_translate.c
@@ -439,7 +439,6 @@ void initTranslation(TransInfo *t)
t->transform = applyTranslation;
t->tsnap.applySnap = ApplySnapTranslation;
- t->tsnap.updateBasePoint = transform_snap_translate_update_baseboint_fn;
t->tsnap.distance = transform_snap_distance_len_squared_fn;
initMouseInputMode(t, &t->mouse, INPUT_VECTOR);
diff --git a/source/blender/editors/transform/transform_mode_vert_slide.c b/source/blender/editors/transform/transform_mode_vert_slide.c
index 30770f3612c..1e5d027e253 100644
--- a/source/blender/editors/transform/transform_mode_vert_slide.c
+++ b/source/blender/editors/transform/transform_mode_vert_slide.c
@@ -633,7 +633,6 @@ void initVertSlide_ex(TransInfo *t, bool use_even, bool flipped, bool use_clamp)
t->transform = applyVertSlide;
t->handleEvent = handleEventVertSlide;
t->tsnap.applySnap = vert_slide_snap_apply;
- t->tsnap.updateBasePoint = transform_snap_translate_update_baseboint_fn;
t->tsnap.distance = transform_snap_distance_len_squared_fn;
{
diff --git a/source/blender/editors/transform/transform_snap.c b/source/blender/editors/transform/transform_snap.c
index 0efecf189c6..16fff160136 100644
--- a/source/blender/editors/transform/transform_snap.c
+++ b/source/blender/editors/transform/transform_snap.c
@@ -128,7 +128,7 @@ bool validSnap(const TransInfo *t)
bool activeSnap(const TransInfo *t)
{
- if (t->modifiers & (MOD_EDIT_BASEPOINT_IN_OBJECT | MOD_EDIT_BASEPOINT_IN_SCENE)) {
+ if (t->modifiers & MOD_EDIT_BASEPOINT) {
return true;
}
return ((t->modifiers & (MOD_SNAP | MOD_SNAP_INVERT)) == MOD_SNAP) ||
@@ -184,8 +184,7 @@ void drawSnapping(const struct bContext *C, TransInfo *t)
activeCol[3] = 192;
if (t->spacetype == SPACE_VIEW3D) {
- bool draw_target = (t->modifiers &
- (MOD_EDIT_BASEPOINT_IN_OBJECT | MOD_EDIT_BASEPOINT_IN_SCENE)) ||
+ bool draw_target = (t->modifiers & MOD_EDIT_BASEPOINT) ||
(t->tsnap.status & TARGET_INIT) &&
(t->scene->toolsettings->snap_mode & SCE_SNAP_MODE_EDGE_PERPENDICULAR);
@@ -1130,24 +1129,13 @@ short snapObjectsTransform(
{
char snap_select;
float *target = (t->tsnap.status & TARGET_INIT) ? t->tsnap.snapTarget : t->center_global;
- if (t->modifiers & MOD_EDIT_BASEPOINT_IN_SCENE) {
+ if (t->modifiers & MOD_EDIT_BASEPOINT) {
snap_select = SNAP_ALL;
if (t->data_type == TC_MESH_VERTS) {
ED_transform_snap_object_context_set_editmesh_callbacks(
t->tsnap.object_context, NULL, NULL, NULL, NULL);
}
}
- else if (t->modifiers & MOD_EDIT_BASEPOINT_IN_OBJECT) {
- snap_select = SNAP_SELECTED_ONLY;
- if (t->data_type == TC_MESH_VERTS) {
- ED_transform_snap_object_context_set_editmesh_callbacks(
- t->tsnap.object_context,
- (bool (*)(BMVert *, void *))BM_elem_cb_check_hflag_enabled,
- (bool (*)(BMEdge *, void *))BM_elem_cb_check_hflag_enabled,
- (bool (*)(BMFace *, void *))BM_elem_cb_check_hflag_enabled,
- POINTER_FROM_UINT(BM_ELEM_SELECT));
- }
- }
else {
snap_select = t->tsnap.modeSelect;
if (t->data_type == TC_MESH_VERTS) {
@@ -1581,36 +1569,32 @@ bool transform_snap_increment(TransInfo *t, float *val)
return true;
}
-void tranform_snap_editbasepoint_set_mode(TransInfo *t)
+void tranform_snap_editbasepoint_toggle(TransInfo *t)
{
- if (!(t->modifiers & (MOD_E
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list