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:
authormano-wii <germano.costa@ig.com.br>2018-11-25 21:00:26 +0300
committermano-wii <germano.costa@ig.com.br>2018-11-26 12:32:02 +0300
commit36429a5bc99aec3d178fb7c9e0350c82b47bb37a (patch)
tree5547f97b75ed814b4806687f8fbed61c1ab52f00 /source/blender/editors/transform/transform_snap_object.c
parent33cbcd73448fb1cedc083c2b1fb9a27489d09432 (diff)
Fix T56167: Crash when extruding + snap to face.
This is a local fix. The problem with duplicate looptris still remains. That is, it can still be released in one place but not upgraded in the other. (note: setting the looptris to NULL in the evaluated mesh and assert whether it is still NULL when the mesh is freed could indicate where those cases are).
Diffstat (limited to 'source/blender/editors/transform/transform_snap_object.c')
-rw-r--r--source/blender/editors/transform/transform_snap_object.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/source/blender/editors/transform/transform_snap_object.c b/source/blender/editors/transform/transform_snap_object.c
index 0fdb9b54726..7a17515f5f8 100644
--- a/source/blender/editors/transform/transform_snap_object.c
+++ b/source/blender/editors/transform/transform_snap_object.c
@@ -533,7 +533,7 @@ static bool raycastEditMesh(
return retval;
}
- BLI_assert(em->ob->data == BKE_object_get_pre_modified_mesh(ob));
+ BLI_assert(BKE_object_get_pre_modified_mesh(em->ob) == BKE_object_get_pre_modified_mesh(ob));
float imat[4][4];
float ray_start_local[3], ray_normal_local[3];
@@ -599,8 +599,11 @@ static bool raycastEditMesh(
bvh_cache = &em_bvh_cache;
}
+ /* Get original version of the edit_btmesh. */
+ BMEditMesh *em_orig = BKE_editmesh_from_object(DEG_get_original_object(ob));
+
bvhtree_from_editmesh_looptri_ex(
- treedata, em, elem_mask, looptri_num_active,
+ treedata, em_orig, elem_mask, looptri_num_active,
0.0f, 4, 6, bvh_cache);
if (elem_mask) {
@@ -610,10 +613,6 @@ static bool raycastEditMesh(
return retval;
}
}
- else {
- /* COW hack: Update pointers */
- treedata->em = em;
- }
/* Only use closer ray_start in case of ortho view! In perspective one, ray_start
* may already been *inside* boundbox, leading to snap failures (see T38409).
@@ -687,7 +686,10 @@ static bool raycastEditMesh(
retval = true;
if (r_index) {
- *r_index = BM_elem_index_get(em->looptris[hit.index][0]->f);
+ /* Get original version of the edit_btmesh. */
+ BMEditMesh *em_orig = BKE_editmesh_from_object(DEG_get_original_object(ob));
+
+ *r_index = BM_elem_index_get(em_orig->looptris[hit.index][0]->f);
}
}
}
@@ -2036,7 +2038,7 @@ static short snapEditMesh(
BVHTreeFromEditMesh *treedata_vert = NULL, *treedata_edge = NULL;
- BLI_assert(em->ob->data == BKE_object_get_pre_modified_mesh(ob));
+ BLI_assert(BKE_object_get_pre_modified_mesh(ob) == BKE_object_get_pre_modified_mesh(ob));
UNUSED_VARS_NDEBUG(ob);
float lpmat[4][4];