diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2019-07-01 13:39:00 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2019-07-01 13:42:42 +0300 |
commit | 6b9c41719bdf7514b9f9ca88e8fb09d3270cf1f2 (patch) | |
tree | 2d85b857879e3f322425774806eeeecdee8f4459 /source/blender/blenkernel/intern/mesh.c | |
parent | 67fc4f4bedded86a04d2bf98ca1642a12d9662b3 (diff) |
Fix T65798: Incorrect auto-tex space for Curves
There are several aspects to the fix:
- Always calculate bounding box for meshes and curves from dependency
graph evaluation function.
There is a reason why mesh was tagged for geometry update, so can not
be spare here in attempts to avoid calculation.
- Remove texture space evaluation from RNA accessor.
Such data is to be evaluated by a dependency graph.
Don't see a reason to be different here: we never force evaluation of
any kind from RNA.
- Copy bounding box and texture space to original object for active
dependency graph.
This matches object-level bounding box and allows to remove bounding
box evaluation from RNA.
Diffstat (limited to 'source/blender/blenkernel/intern/mesh.c')
-rw-r--r-- | source/blender/blenkernel/intern/mesh.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/source/blender/blenkernel/intern/mesh.c b/source/blender/blenkernel/intern/mesh.c index 755a8036e8e..35f96e50e3a 100644 --- a/source/blender/blenkernel/intern/mesh.c +++ b/source/blender/blenkernel/intern/mesh.c @@ -50,6 +50,7 @@ #include "BKE_editmesh.h" #include "DEG_depsgraph.h" +#include "DEG_depsgraph_query.h" enum { MESHCMP_DVERT_WEIGHTMISMATCH = 1, @@ -1995,9 +1996,7 @@ void BKE_mesh_split_faces(Mesh *mesh, bool free_loop_normals) void BKE_mesh_eval_geometry(Depsgraph *depsgraph, Mesh *mesh) { DEG_debug_print_eval(depsgraph, __func__, mesh->id.name, mesh); - if (mesh->bb == NULL || (mesh->bb->flag & BOUNDBOX_DIRTY)) { - BKE_mesh_texspace_calc(mesh); - } + BKE_mesh_texspace_calc(mesh); /* Clear autospace flag in evaluated mesh, so that texspace does not get recomputed when bbox is * (e.g. after modifiers, etc.) */ mesh->texflag &= ~ME_AUTOSPACE; @@ -2009,4 +2008,16 @@ void BKE_mesh_eval_geometry(Depsgraph *depsgraph, Mesh *mesh) BKE_id_free(NULL, mesh->runtime.mesh_eval); mesh->runtime.mesh_eval = NULL; } + if (DEG_is_active(depsgraph)) { + Mesh *mesh_orig = (Mesh *)DEG_get_original_id(&mesh->id); + BoundBox *bb = mesh->bb; + if (bb != NULL) { + if (mesh_orig->bb == NULL) { + mesh_orig->bb = MEM_mallocN(sizeof(*mesh_orig->bb), __func__); + } + *mesh_orig->bb = *bb; + copy_v3_v3(mesh_orig->loc, mesh->loc); + copy_v3_v3(mesh_orig->size, mesh->size); + } + } } |