Made curves almost thread-safe

Now modifier stack wouldn't modify original curve's nurbs
and will operate on a copy of nurbs.

This makes it possible to process curve object update with
shared curve datablocks from multiple threads. There's no
big overhead for creating a copy of nurbs comparing to old
behavior which was allocating original vertex array and
apply coordinates on curve after all modifier are applied.

The only remained issue with curves is curve's bounding box
and texture space. It's not thread-safe, but it wouldn't
lead to crashes -- it just could lead to either memory
leak or wrong texture coordinates due to difference in
modifiers stacks of objects which shares the same curve.

--
svn merge -r57959:57961 ^/branches/soc-2013-depsgraph_mt
This commit is contained in:
2013-08-19 09:36:40 +00:00
parent 345fff872b
commit 7ef3f98de1
7 changed files with 44 additions and 63 deletions

View File

@@ -2417,7 +2417,7 @@ static void bevlist_firstlast_direction_calc_from_bpoint(Nurb *nu, BevList *bl)
}
}
void BKE_curve_bevelList_make(Object *ob)
void BKE_curve_bevelList_make(Object *ob, ListBase *nurbs, bool for_render)
{
/*
* - convert all curves to polys, with indication of resol and flags for double-vertices
@@ -2449,14 +2449,10 @@ void BKE_curve_bevelList_make(Object *ob)
/* STEP 1: MAKE POLYS */
BLI_freelistN(&(ob->curve_cache->bev));
nu = nurbs->first;
if (cu->editnurb && ob->type != OB_FONT) {
ListBase *nurbs = BKE_curve_editNurbs_get(cu);
nu = nurbs->first;
is_editmode = 1;
}
else {
nu = cu->nurb.first;
}
for (; nu; nu = nu->next) {
@@ -2477,7 +2473,7 @@ void BKE_curve_bevelList_make(Object *ob)
bl->charidx = nu->charidx;
}
else {
if (G.is_rendering && cu->resolu_ren != 0)
if (for_render && cu->resolu_ren != 0)
resolu = cu->resolu_ren;
else
resolu = nu->resolu;