diff options
author | Germano Cavalcante <germano.costa@ig.com.br> | 2020-03-03 04:12:46 +0300 |
---|---|---|
committer | Germano Cavalcante <germano.costa@ig.com.br> | 2020-03-03 04:12:46 +0300 |
commit | a976fe42ef74e77744f571578bf52998af491cb9 (patch) | |
tree | 8eeaf7b3470b540a117cb9ed2a5f8b02d60aa519 /source/blender/editors | |
parent | c549a9dd4643c97fedc7d4c8366537499ecae984 (diff) |
Revert "Transform Snap: Clear 'SnapObjectData' after changes in the geometry"
This reverts commit fe7c4fb4a2d5d48555ebb9178fd5e7a8c1ace1ee.
It does not work because `mesh_eval_cage` and `mesh_eval_final` always is `NULL` in this case.
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/transform/transform_snap_object.c | 44 |
1 files changed, 9 insertions, 35 deletions
diff --git a/source/blender/editors/transform/transform_snap_object.c b/source/blender/editors/transform/transform_snap_object.c index 7d046c4bb11..ecd267d6f2a 100644 --- a/source/blender/editors/transform/transform_snap_object.c +++ b/source/blender/editors/transform/transform_snap_object.c @@ -218,23 +218,14 @@ static SnapObjectData *snap_object_data_lookup(SnapObjectContext *sctx, Object * static SnapObjectData *snap_object_data_mesh_get(SnapObjectContext *sctx, Object *ob) { - SnapObjectData *sod; void **sod_p; - bool init = false; - if (BLI_ghash_ensure_p(sctx->cache.object_map, ob, &sod_p)) { - sod = *sod_p; - if (sod->type != SNAP_MESH) { - snap_object_data_clear(sod); - init = true; - } + BLI_assert(((SnapObjectData *)*sod_p)->type == SNAP_MESH); } else { - sod = *sod_p = BLI_memarena_calloc(sctx->cache.mem_arena, sizeof(*sod)); - init = true; - } + SnapObjectData *sod = *sod_p = BLI_memarena_calloc(sctx->cache.mem_arena, sizeof(*sod)); - if (init) { + /* Init. */ sod->type = SNAP_MESH; /* start assuming that it has each of these element types */ sod->has_looptris = true; @@ -242,16 +233,14 @@ static SnapObjectData *snap_object_data_mesh_get(SnapObjectContext *sctx, Object sod->has_loose_vert = true; } - return sod; + return *sod_p; } static SnapObjectData *snap_object_data_editmesh_get(SnapObjectContext *sctx, Object *ob, BMEditMesh *em) { - SnapObjectData *sod; void **sod_p; - bool init = false; { /* Use object-data as the key in ghash since the editmesh @@ -269,24 +258,18 @@ static SnapObjectData *snap_object_data_editmesh_get(SnapObjectContext *sctx, } if (BLI_ghash_ensure_p(sctx->cache.object_map, ob, &sod_p)) { - sod = *sod_p; - if (sod->type != SNAP_EDIT_MESH) { - snap_object_data_clear(sod); - init = true; - } + BLI_assert(((SnapObjectData *)*sod_p)->type == SNAP_EDIT_MESH); } else { - sod = *sod_p = BLI_memarena_calloc(sctx->cache.mem_arena, sizeof(*sod)); - init = true; - } + SnapObjectData *sod = *sod_p = BLI_memarena_calloc(sctx->cache.mem_arena, sizeof(*sod)); - if (init) { + /* Init. */ sod->type = SNAP_EDIT_MESH; sod->treedata_editmesh.em = em; bm_mesh_minmax(em->bm, sod->min, sod->max); } - return sod; + return *sod_p; } /** \} */ @@ -2464,16 +2447,7 @@ static short snapEditMesh(SnapObjectContext *sctx, return 0; } - BVHCache **em_bvh_cache; - if (em->mesh_eval_final) { - em_bvh_cache = &em->mesh_eval_final->runtime.bvh_cache; - } - else if (em->mesh_eval_cage) { - em_bvh_cache = &em->mesh_eval_cage->runtime.bvh_cache; - } - else { - em_bvh_cache = &((Mesh *)ob->data)->runtime.bvh_cache; - } + BVHCache **em_bvh_cache = &((Mesh *)ob->data)->runtime.bvh_cache; if (snapdata->snap_to_flag & SCE_SNAP_MODE_VERTEX) { BVHTreeFromEditMesh treedata = {.tree = sod->bvhtree[0]}; |