diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2013-08-19 13:13:15 +0400 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2013-08-19 13:13:15 +0400 |
commit | 0312b183194e703d778e6b989caccdfa35059d13 (patch) | |
tree | 7760904b11743798783ec84092a9320607cc53fc /source/blender/blenkernel/intern/curve.c | |
parent | 2acf0a13546ab0f12774174f18d373e163f0f19a (diff) |
Get rid of a display list stored in Curve datablock
This display list was only used for texture space calculation,
and even there this display list was only used for bounding
box calculation.
Since we already do have bounding box in a curve datablock
there's no reason to duplicate non-modified display list
just to calculate bounding box later, let's just calculate
bounding box at the first point.
This makes code a little be more thread-safe but curves are
still not safe for threads at all because of bevel list and
path. That would be solved later.
--
svn merge -r57939:57940 ^/branches/soc-2013-depsgraph_mt
Diffstat (limited to 'source/blender/blenkernel/intern/curve.c')
-rw-r--r-- | source/blender/blenkernel/intern/curve.c | 38 |
1 files changed, 7 insertions, 31 deletions
diff --git a/source/blender/blenkernel/intern/curve.c b/source/blender/blenkernel/intern/curve.c index 801ed4f00a5..7377a48a87e 100644 --- a/source/blender/blenkernel/intern/curve.c +++ b/source/blender/blenkernel/intern/curve.c @@ -146,7 +146,6 @@ void BKE_curve_free(Curve *cu) { BKE_nurbList_free(&cu->nurb); BLI_freelistN(&cu->bev); - BKE_displist_free(&cu->disp); BKE_curve_editfont_free(cu); BKE_curve_editNurb_free(cu); @@ -228,7 +227,6 @@ Curve *BKE_curve_copy(Curve *cu) cun->key = BKE_key_copy(cu->key); if (cun->key) cun->key->from = (ID *)cun; - cun->disp.first = cun->disp.last = NULL; cun->bev.first = cun->bev.last = NULL; cun->path = NULL; @@ -374,36 +372,14 @@ void BKE_curve_type_test(Object *ob) void BKE_curve_texspace_calc(Curve *cu) { - DispList *dl; - BoundBox *bb; - float *fp, min[3], max[3]; - int tot, do_it = FALSE; - - if (cu->bb == NULL) - cu->bb = MEM_callocN(sizeof(BoundBox), "boundbox"); - bb = cu->bb; - - INIT_MINMAX(min, max); - - dl = cu->disp.first; - while (dl) { - tot = ELEM(dl->type, DL_INDEX3, DL_INDEX4) ? dl->nr : dl->nr * dl->parts; - - if (tot) do_it = TRUE; - fp = dl->verts; - while (tot--) { - minmax_v3v3_v3(min, max, fp); - fp += 3; - } - dl = dl->next; - } - - if (do_it == FALSE) { - min[0] = min[1] = min[2] = -1.0f; - max[0] = max[1] = max[2] = 1.0f; - } + BoundBox *bb = cu->bb; + float min[3], max[3]; - BKE_boundbox_init_from_minmax(bb, min, max); + /* Curve's undeformed bounding box is calculated in displist.c, + * as a part of display list calculation. + */ + copy_v3_v3(min, bb->vec[0]); + copy_v3_v3(max, bb->vec[6]); if (cu->texflag & CU_AUTOSPACE) { mid_v3_v3v3(cu->loc, min, max); |