Fix T42257: Curve vertex parent not working with animation

Vertex parent was using original non-modified nurbs list, simply because
it didn't have something else to operate with.

Now we've got deformed by pre-tessellation modifiers nurbs in the curve
cache which might be used y the vertex parent.
This commit is contained in:
2014-10-21 14:44:08 +02:00
parent 5e2f3c0102
commit bae0f904ee
3 changed files with 19 additions and 15 deletions

View File

@@ -185,6 +185,7 @@ void BKE_object_free_curve_cache(Object *ob)
if (ob->curve_cache->path) {
free_path(ob->curve_cache->path);
}
BKE_nurbList_free(&ob->curve_cache->deformed_nurbs);
MEM_freeN(ob->curve_cache);
ob->curve_cache = NULL;
}
@@ -321,18 +322,7 @@ void BKE_object_free_derived_caches(Object *ob)
ob->derivedDeform = NULL;
}
if (ob->curve_cache) {
BKE_displist_free(&ob->curve_cache->disp);
BKE_curve_bevelList_free(&ob->curve_cache->bev);
if (ob->curve_cache->path) {
free_path(ob->curve_cache->path);
ob->curve_cache->path = NULL;
}
/* Signal for viewport to run DAG workarounds. */
MEM_freeN(ob->curve_cache);
ob->curve_cache = NULL;
}
BKE_object_free_curve_cache(ob);
}
/* do not free object itself */
@@ -2219,8 +2209,18 @@ static void give_parvert(Object *par, int nr, float vec[3])
}
}
else if (ELEM(par->type, OB_CURVE, OB_SURF)) {
Curve *cu = par->data;
ListBase *nurb = BKE_curve_nurbs_get(cu);
ListBase *nurb;
/* Unless there's some weird depsgraph failure the cache should exist. */
BLI_assert(par->curve_cache != NULL);
if (par->curve_cache->deformed_nurbs.first != NULL) {
nurb = &par->curve_cache->deformed_nurbs;
}
else {
Curve *cu = par->data;
nurb = BKE_curve_nurbs_get(cu);
}
BKE_nurbList_index_get_co(nurb, nr, vec);
}