diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2013-08-19 13:58:28 +0400 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2013-08-19 13:58:28 +0400 |
commit | f030758515f5b1ecaf4ff9b9454094ec9aae1ffb (patch) | |
tree | 939587496f0539af0c3b0de1c830d80c2ea1c734 /source/blender/blenkernel/intern/object.c | |
parent | 2dcb1d70022e06eedfe7339930c3191a8859e7c4 (diff) |
Tag object-data level boundbox as invalid rather than freeing it
Object update used to free object-data level bounding box to trigger
it's re-calculation in the future. Such a freeing performed from
object update isn't thread-safe because mesh could be shared between
multiple objects.
Rather than freeing bounding box, tag it's as invalid, this is safe
from threading point of view and also prevents unnecessary memory
re-allocation.
Object-level bounding box is still reallocating, but think we could
change this easily in the future as well.
--
svn merge -r58154:58156 -r59258:59259 ^/branches/soc-2013-depsgraph_mt
Diffstat (limited to 'source/blender/blenkernel/intern/object.c')
-rw-r--r-- | source/blender/blenkernel/intern/object.c | 23 |
1 files changed, 9 insertions, 14 deletions
diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index c3da7aef4b4..6d2f1a4622a 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -259,8 +259,14 @@ void BKE_object_free_derived_caches(Object *ob) Mesh *me = ob->data; if (me->bb) { - MEM_freeN(me->bb); - me->bb = NULL; + me->bb->flag |= BOUNDBOX_DIRTY; + } + } + else if (ELEM3(ob->type, OB_SURF, OB_CURVE, OB_FONT)) { + Curve *cu = ob->data; + + if (cu->bb) { + cu->bb->flag |= BOUNDBOX_DIRTY; } } @@ -2384,18 +2390,7 @@ void BKE_object_minmax(Object *ob, float min_r[3], float max_r[3], const bool us case OB_FONT: case OB_SURF: { - Curve *cu = ob->data; - - /* Use the object bounding box so that modifier output - * gets taken into account */ - if (ob->bb) { - bb = *(ob->bb); - } - else { - if (cu->bb == NULL) - BKE_curve_texspace_calc(cu); - bb = *(cu->bb); - } + bb = *BKE_curve_boundbox_get(ob); for (a = 0; a < 8; a++) { mul_m4_v3(ob->obmat, bb.vec[a]); |