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:
authorCampbell Barton <ideasman42@gmail.com>2012-03-13 05:11:08 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-03-13 05:11:08 +0400
commit8646bb446419592f8acc8ed0cdf8337bfc4a07eb (patch)
tree4ee959f06e2ffe18cb9dd1c91266c9e9ad81c686 /source/blender/editors
parentb457c7fdbdf0b8cf7a4535574d9894d8850c55f4 (diff)
workaround [#30480] Knife tool flicker
the problem was numeric precision when in ortho mode the start/end points for the view vector would be 2000 apart which caused trouble for the intersection test.
Diffstat (limited to 'source/blender/editors')
-rw-r--r--source/blender/editors/mesh/bmesh_tools.c5
-rw-r--r--source/blender/editors/mesh/knifetool.c10
2 files changed, 12 insertions, 3 deletions
diff --git a/source/blender/editors/mesh/bmesh_tools.c b/source/blender/editors/mesh/bmesh_tools.c
index bbfbb16a5bb..7fd82be7571 100644
--- a/source/blender/editors/mesh/bmesh_tools.c
+++ b/source/blender/editors/mesh/bmesh_tools.c
@@ -4447,7 +4447,7 @@ static int mesh_bevel_exec(bContext *C, wmOperator *op)
BMIter iter;
BMEdge *eed;
BMOperator bmop;
- float factor = RNA_float_get(op->ptr, "percent"), fac = factor /*, dfac */ /* UNUSED */, df, s;
+ float factor = RNA_float_get(op->ptr, "percent"), /*, dfac */ /* UNUSED */, df, s;
int i, recursion = RNA_int_get(op->ptr, "recursion");
const int use_even = RNA_boolean_get(op->ptr, "use_even");
const int use_dist = RNA_boolean_get(op->ptr, "use_dist");
@@ -4484,9 +4484,8 @@ static int mesh_bevel_exec(bContext *C, wmOperator *op)
mul_vn_fl(w, recursion, 1.0f / (float)ftot);
- fac = factor;
for (i = 0; i < recursion; i++) {
- fac = w[recursion - i - 1] * factor;
+ float fac = w[recursion - i - 1] * factor;
if (!EDBM_InitOpf(em, &bmop, op,
"bevel geom=%hev percent=%f lengthlayer=%i use_lengths=%b use_even=%b use_dist=%b",
diff --git a/source/blender/editors/mesh/knifetool.c b/source/blender/editors/mesh/knifetool.c
index f70257614bf..1866b88a1bf 100644
--- a/source/blender/editors/mesh/knifetool.c
+++ b/source/blender/editors/mesh/knifetool.c
@@ -1178,6 +1178,16 @@ static void knife_find_line_hits(knifetool_opdata *kcd)
mul_m4_v3(kcd->ob->imat, v3);
mul_m4_v3(kcd->ob->imat, v4);
+ /* numeric error, 'v1' -> 'v2', 'v2' -> 'v4' can end up being ~2000 units apart in otho mode
+ * (from ED_view3d_win_to_segment_clip() above)
+ * this gives precision error in 'knife_edge_tri_isect', rather then solving properly
+ * (which may involve using doubles everywhere!),
+ * limit the distance between these points */
+ if (kcd->is_ortho) {
+ limit_dist_v3(v1, v3, 200.0f);
+ limit_dist_v3(v2, v4, 200.0f);
+ }
+
BLI_smallhash_init(ehash);
/* test two triangles of sceen line's plane */