diff options
author | Brecht Van Lommel <brecht@blender.org> | 2020-02-28 14:59:18 +0300 |
---|---|---|
committer | Brecht Van Lommel <brecht@blender.org> | 2020-02-28 15:01:02 +0300 |
commit | da1140f75e08ac5228474e5cdbb995ec7c0df579 (patch) | |
tree | 0603441863f1ec4537d363217c29be745848b386 /source/blender/makesrna | |
parent | 7a8a074a30b045eafbef6eeb5293f1e76a3cb5a7 (diff) |
Revert "Objects: make evaluated data runtime storage usable for types other than mesh"
This reverts commit f2b95b9eae2ee913c99cff7595527b18d8b49d0a.
Fix T74283: modifier display lost when moving object in edit mode.
The cause is not immediately obvious so better to revert and look at this
carefully.
Diffstat (limited to 'source/blender/makesrna')
-rw-r--r-- | source/blender/makesrna/intern/rna_object_api.c | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/source/blender/makesrna/intern/rna_object_api.c b/source/blender/makesrna/intern/rna_object_api.c index cbeb8f17991..5552de00be8 100644 --- a/source/blender/makesrna/intern/rna_object_api.c +++ b/source/blender/makesrna/intern/rna_object_api.c @@ -487,7 +487,7 @@ static Object *eval_object_ensure(Object *ob, ReportList *reports, PointerRNA *rnaptr_depsgraph) { - if (ob->runtime.data_eval == NULL) { + if (ob->runtime.mesh_eval == NULL) { Object *ob_orig = ob; Depsgraph *depsgraph = rnaptr_depsgraph != NULL ? rnaptr_depsgraph->data : NULL; if (depsgraph == NULL) { @@ -496,7 +496,7 @@ static Object *eval_object_ensure(Object *ob, if (depsgraph != NULL) { ob = DEG_get_evaluated_object(depsgraph, ob); } - if (ob == NULL || BKE_object_get_evaluated_mesh(ob) == NULL) { + if (ob == NULL || ob->runtime.mesh_eval == NULL) { BKE_reportf( reports, RPT_ERROR, "Object '%s' has no evaluated mesh data", ob_orig->id.name + 2); return NULL; @@ -521,7 +521,8 @@ static void rna_Object_ray_cast(Object *ob, /* TODO(sergey): This isn't very reliable check. It is possible to have non-NULL pointer * but which is out of date, and possibly dangling one. */ - if ((ob = eval_object_ensure(ob, C, reports, rnaptr_depsgraph)) == NULL) { + if (ob->runtime.mesh_eval == NULL && + (ob = eval_object_ensure(ob, C, reports, rnaptr_depsgraph)) == NULL) { return; } @@ -537,8 +538,7 @@ static void rna_Object_ray_cast(Object *ob, /* No need to managing allocation or freeing of the BVH data. * This is generated and freed as needed. */ - Mesh *mesh_eval = BKE_object_get_evaluated_mesh(ob); - BKE_bvhtree_from_mesh_get(&treeData, mesh_eval, BVHTREE_FROM_LOOPTRI, 4); + BKE_bvhtree_from_mesh_get(&treeData, ob->runtime.mesh_eval, BVHTREE_FROM_LOOPTRI, 4); /* may fail if the mesh has no faces, in that case the ray-cast misses */ if (treeData.tree != NULL) { @@ -559,7 +559,8 @@ static void rna_Object_ray_cast(Object *ob, copy_v3_v3(r_location, hit.co); copy_v3_v3(r_normal, hit.no); - *r_index = mesh_looptri_to_poly_index(mesh_eval, &treeData.looptri[hit.index]); + *r_index = mesh_looptri_to_poly_index(ob->runtime.mesh_eval, + &treeData.looptri[hit.index]); } } @@ -588,14 +589,14 @@ static void rna_Object_closest_point_on_mesh(Object *ob, { BVHTreeFromMesh treeData = {NULL}; - if ((ob = eval_object_ensure(ob, C, reports, rnaptr_depsgraph)) == NULL) { + if (ob->runtime.mesh_eval == NULL && + (ob = eval_object_ensure(ob, C, reports, rnaptr_depsgraph)) == NULL) { return; } /* No need to managing allocation or freeing of the BVH data. * this is generated and freed as needed. */ - Mesh *mesh_eval = BKE_object_get_evaluated_mesh(ob); - BKE_bvhtree_from_mesh_get(&treeData, mesh_eval, BVHTREE_FROM_LOOPTRI, 4); + BKE_bvhtree_from_mesh_get(&treeData, ob->runtime.mesh_eval, BVHTREE_FROM_LOOPTRI, 4); if (treeData.tree == NULL) { BKE_reportf(reports, @@ -616,7 +617,8 @@ static void rna_Object_closest_point_on_mesh(Object *ob, copy_v3_v3(r_location, nearest.co); copy_v3_v3(r_normal, nearest.no); - *r_index = mesh_looptri_to_poly_index(mesh_eval, &treeData.looptri[nearest.index]); + *r_index = mesh_looptri_to_poly_index(ob->runtime.mesh_eval, + &treeData.looptri[nearest.index]); goto finally; } @@ -657,7 +659,8 @@ void rna_Object_me_eval_info( switch (type) { case 1: case 2: - if ((ob = eval_object_ensure(ob, C, NULL, rnaptr_depsgraph)) == NULL) { + if (ob->runtime.mesh_eval == NULL && + (ob = eval_object_ensure(ob, C, NULL, rnaptr_depsgraph)) == NULL) { return; } } @@ -672,7 +675,7 @@ void rna_Object_me_eval_info( me_eval = ob->runtime.mesh_deform_eval; break; case 2: - me_eval = BKE_object_get_evaluated_mesh(ob); + me_eval = ob->runtime.mesh_eval; break; } |