[Bf-blender-cvs] [36429a5bc99] blender2.8: Fix T56167: Crash when extruding + snap to face.
mano-wii
noreply at git.blender.org
Mon Nov 26 11:56:38 CET 2018
Commit: 36429a5bc99aec3d178fb7c9e0350c82b47bb37a
Author: mano-wii
Date: Sun Nov 25 16:00:26 2018 -0200
Branches: blender2.8
https://developer.blender.org/rB36429a5bc99aec3d178fb7c9e0350c82b47bb37a
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).
===================================================================
M source/blender/editors/transform/transform_snap_object.c
===================================================================
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];
More information about the Bf-blender-cvs
mailing list