diff options
author | Antony Riakiotakis <kalast@gmail.com> | 2015-05-22 13:49:26 +0300 |
---|---|---|
committer | Antony Riakiotakis <kalast@gmail.com> | 2015-05-22 13:49:26 +0300 |
commit | 434ae40d635907c1d4f82b65fac1efaebfc5401b (patch) | |
tree | 1d76a33dc88611ebaded9426adc70358d353779d /source/blender/editors/mesh | |
parent | 94e69a379e83f058244ca163e9e745fa0112dff7 (diff) | |
parent | be6479c9ea5d36451e552ceb10d2106d9a5d6856 (diff) |
Merge branch 'master' into gooseberry
Conflicts:
source/blender/windowmanager/intern/wm_playanim.c
Diffstat (limited to 'source/blender/editors/mesh')
-rw-r--r-- | source/blender/editors/mesh/editmesh_tools.c | 17 | ||||
-rw-r--r-- | source/blender/editors/mesh/editmesh_utils.c | 23 |
2 files changed, 34 insertions, 6 deletions
diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c index f023aecd50b..fd7497542be 100644 --- a/source/blender/editors/mesh/editmesh_tools.c +++ b/source/blender/editors/mesh/editmesh_tools.c @@ -2489,7 +2489,7 @@ void MESH_OT_blend_from_shape(wmOperatorType *ot) /* properties */ prop = RNA_def_enum(ot->srna, "shape", DummyRNA_NULL_items, 0, "Shape", "Shape key to use for blending"); RNA_def_enum_funcs(prop, shape_itemf); - RNA_def_property_flag(prop, PROP_ENUM_NO_TRANSLATE); + RNA_def_property_flag(prop, PROP_ENUM_NO_TRANSLATE | PROP_NEVER_UNLINK); RNA_def_float(ot->srna, "blend", 1.0f, -FLT_MAX, FLT_MAX, "Blend", "Blending factor", -2.0f, 2.0f); RNA_def_boolean(ot->srna, "add", 1, "Add", "Add rather than blend between shapes"); } @@ -3760,7 +3760,20 @@ static int edbm_tris_convert_to_quads_exec(bContext *C, wmOperator *op) Object *obedit = CTX_data_edit_object(C); BMEditMesh *em = BKE_editmesh_from_object(obedit); int dosharp, douvs, dovcols, domaterials; - const float limit = RNA_float_get(op->ptr, "limit"); + float limit; + PropertyRNA *prop; + + /* When joining exactly 2 faces, no limit. + * this is useful for one off joins while editing. */ + prop = RNA_struct_find_property(op->ptr, "limit"); + if ((em->bm->totfacesel == 2) && + (RNA_property_is_set(op->ptr, prop) == false)) + { + limit = DEG2RADF(180.0f); + } + else { + limit = RNA_property_float_get(op->ptr, prop); + } dosharp = RNA_boolean_get(op->ptr, "sharp"); douvs = RNA_boolean_get(op->ptr, "uvs"); diff --git a/source/blender/editors/mesh/editmesh_utils.c b/source/blender/editors/mesh/editmesh_utils.c index 812f0258ea7..373b9df75fd 100644 --- a/source/blender/editors/mesh/editmesh_utils.c +++ b/source/blender/editors/mesh/editmesh_utils.c @@ -38,6 +38,7 @@ #include "BLI_math.h" #include "BLI_alloca.h" #include "BLI_buffer.h" +#include "BLI_kdtree.h" #include "BLI_listbase.h" #include "BKE_DerivedMesh.h" @@ -1114,9 +1115,10 @@ void EDBM_verts_mirror_cache_begin_ex(BMEditMesh *em, const int axis, const bool BMVert *v; int cd_vmirr_offset; int i; + const float maxdist_sq = SQUARE(maxdist); /* one or the other is used depending if topo is enabled */ - struct BMBVHTree *tree = NULL; + KDTree *tree = NULL; MirrTopoStore_t mesh_topo_store = {NULL, -1, -1, -1}; BM_mesh_elem_table_ensure(bm, BM_VERT); @@ -1141,7 +1143,11 @@ void EDBM_verts_mirror_cache_begin_ex(BMEditMesh *em, const int axis, const bool ED_mesh_mirrtopo_init(me, -1, &mesh_topo_store, true); } else { - tree = BKE_bmbvh_new_from_editmesh(em, 0, NULL, false); + tree = BLI_kdtree_new(bm->totvert); + BM_ITER_MESH_INDEX (v, &iter, bm, BM_VERTS_OF_MESH, i) { + BLI_kdtree_insert(tree, i, v->co); + } + BLI_kdtree_balance(tree); } #define VERT_INTPTR(_v, _i) r_index ? &r_index[_i] : BM_ELEM_CD_GET_VOID_P(_v, cd_vmirr_offset); @@ -1161,10 +1167,19 @@ void EDBM_verts_mirror_cache_begin_ex(BMEditMesh *em, const int axis, const bool v_mirr = cache_mirr_intptr_as_bmvert(mesh_topo_store.index_lookup, i); } else { + int i_mirr; float co[3]; copy_v3_v3(co, v->co); co[axis] *= -1.0f; - v_mirr = BKE_bmbvh_find_vert_closest(tree, co, maxdist); + + v_mirr = NULL; + i_mirr = BLI_kdtree_find_nearest(tree, co, NULL); + if (i_mirr != -1) { + BMVert *v_test = BM_vert_at_index(bm, i_mirr); + if (len_squared_v3v3(co, v_test->co) < maxdist_sq) { + v_mirr = v_test; + } + } } if (v_mirr && (use_self || (v_mirr != v))) { @@ -1186,7 +1201,7 @@ void EDBM_verts_mirror_cache_begin_ex(BMEditMesh *em, const int axis, const bool ED_mesh_mirrtopo_free(&mesh_topo_store); } else { - BKE_bmbvh_free(tree); + BLI_kdtree_free(tree); } } |