Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHoward Trickey <howard.trickey@gmail.com>2019-03-06 17:04:31 +0300
committerHoward Trickey <howard.trickey@gmail.com>2019-03-06 17:05:12 +0300
commit208fafb285367d51328a2c5396fc86ee7746832f (patch)
tree908650b0401df515ce8cb85bad3fa4f14cc94c34 /source/blender/editors/mesh/editmesh_inset.c
parent3fc7d51ed3d3e42a67a07a7be686907358fcd872 (diff)
Fix T61773 Bevel and Inset mouse sensitivity, and bevel tool units.
The mouse movement scale needed adjusting according to object scale, since the amount is on the unscaled model but the viewport shows the scaled one. Also fixed proper units for amounts in bevel tool, as was already done for modifier. Percent should be comfortably adjustable by mouse.
Diffstat (limited to 'source/blender/editors/mesh/editmesh_inset.c')
-rw-r--r--source/blender/editors/mesh/editmesh_inset.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/source/blender/editors/mesh/editmesh_inset.c b/source/blender/editors/mesh/editmesh_inset.c
index d638f4f60c9..c63f0db1f2b 100644
--- a/source/blender/editors/mesh/editmesh_inset.c
+++ b/source/blender/editors/mesh/editmesh_inset.c
@@ -64,6 +64,7 @@ typedef struct {
bool is_modal;
bool shift;
float shift_amount;
+ float max_obj_scale;
NumInput num_input;
InsetObjectStore *ob_store;
@@ -126,12 +127,16 @@ static bool edbm_inset_init(bContext *C, wmOperator *op, const bool is_modal)
uint objects_used_len = 0;
+ opdata->max_obj_scale = FLT_MIN;
+
{
uint ob_store_len = 0;
Object **objects = BKE_view_layer_array_from_objects_in_edit_mode_unique_data(view_layer, CTX_wm_view3d(C), &ob_store_len);
opdata->ob_store = MEM_malloc_arrayN(ob_store_len, sizeof(*opdata->ob_store), __func__);
for (uint ob_index = 0; ob_index < ob_store_len; ob_index++) {
Object *obedit = objects[ob_index];
+ float scale = mat4_to_scale(obedit->obmat);
+ opdata->max_obj_scale = max_ff(opdata->max_obj_scale, scale);
BMEditMesh *em = BKE_editmesh_from_object(obedit);
if (em->bm->totvertsel > 0) {
opdata->ob_store[objects_used_len].em = em;
@@ -379,9 +384,11 @@ static int edbm_inset_modal(bContext *C, wmOperator *op, const wmEvent *event)
mdiff[1] = opdata->mcenter[1] - event->mval[1];
if (opdata->modify_depth)
- amount = opdata->old_depth + ((len_v2(mdiff) - opdata->initial_length) * opdata->pixel_size);
+ amount = opdata->old_depth +
+ ((len_v2(mdiff) - opdata->initial_length) * opdata->pixel_size) / opdata->max_obj_scale;
else
- amount = opdata->old_thickness - ((len_v2(mdiff) - opdata->initial_length) * opdata->pixel_size);
+ amount = opdata->old_thickness -
+ ((len_v2(mdiff) - opdata->initial_length) * opdata->pixel_size) / opdata->max_obj_scale;
/* Fake shift-transform... */
if (opdata->shift)