Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Montagne <montagne29@wanadoo.fr>2018-11-25 19:16:11 +0300
committerBastien Montagne <montagne29@wanadoo.fr>2018-11-25 20:49:57 +0300
commit5f6fae9ad0bdb4184fb430d533dbbdec9c3da67f (patch)
tree6462e37a074cf0eb6f99d0f167114f52a019d83d /source/blender/blenkernel/intern/curve.c
parent5e5db7db896fa6ef31736ca2e42f344c494c2e92 (diff)
Fix T57070, T57389, and other bbox-related issues with meshes.
Thinks whole bbox code needs a complete rewrite, one can see a lot of old history in it, it has way too many functions doing nearly-the-same-thing(c), it spreads in very inconsistent ways across a lot of files, ... But have no time for this right now, and would not be a good idea with Beta comming up close anyway. So for now going the simple and (hopefully) sane & safe way: forbid object-level functions to affect data-level bbox. Mesh and curve ones would generate bbox in obdata instead of object, for some reason (all other obdata types only use object's bbox ever). That may have been working in old ages, but with CoW and threaded depsgraph this is just calling for piles of issues.
Diffstat (limited to 'source/blender/blenkernel/intern/curve.c')
-rw-r--r--source/blender/blenkernel/intern/curve.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/source/blender/blenkernel/intern/curve.c b/source/blender/blenkernel/intern/curve.c
index 872b5074e4e..a4f348578f7 100644
--- a/source/blender/blenkernel/intern/curve.c
+++ b/source/blender/blenkernel/intern/curve.c
@@ -325,16 +325,22 @@ void BKE_curve_boundbox_calc(Curve *cu, float r_loc[3], float r_size[3])
BoundBox *BKE_curve_boundbox_get(Object *ob)
{
- Curve *cu = ob->data;
+ /* This is Object-level data access, DO NOT touch to Mesh's bb, would be totally thread-unsafe. */
+ if (ob->bb == NULL || ob->bb->flag & BOUNDBOX_DIRTY) {
+ Curve *cu = ob->data;
+ float min[3], max[3];
- if (ob->bb)
- return ob->bb;
+ INIT_MINMAX(min, max);
+ BKE_curve_minmax(cu, true, min, max);
- if (cu->bb == NULL || (cu->bb->flag & BOUNDBOX_DIRTY)) {
- BKE_curve_texspace_calc(cu);
+ if (ob->bb == NULL) {
+ ob->bb = MEM_mallocN(sizeof(*ob->bb), __func__);
+ }
+ BKE_boundbox_init_from_minmax(ob->bb, min, max);
+ ob->bb->flag &= ~BOUNDBOX_DIRTY;
}
- return cu->bb;
+ return ob->bb;
}
void BKE_curve_texspace_calc(Curve *cu)