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:
parent
5e2f3c0102
commit
bae0f904ee
Notes:
blender-bot
2023-02-14 09:56:33 +01:00
Referenced by issue #42257, Curve vertex parent not working with animation
|
@ -49,6 +49,7 @@ struct rctf;
|
|||
typedef struct CurveCache {
|
||||
ListBase disp;
|
||||
ListBase bev;
|
||||
ListBase deformed_nurbs;
|
||||
struct Path *path;
|
||||
} CurveCache;
|
||||
|
||||
|
|
|
@ -1271,6 +1271,7 @@ void BKE_displist_make_surf(Scene *scene, Object *ob, ListBase *dispbase,
|
|||
}
|
||||
|
||||
if (!for_orco) {
|
||||
BKE_nurbList_duplicate(&ob->curve_cache->deformed_nurbs, &nubase);
|
||||
curve_calc_modifiers_post(scene, ob, &nubase, dispbase, r_dm_final,
|
||||
for_render, use_render_resolution);
|
||||
}
|
||||
|
@ -1729,8 +1730,10 @@ static void do_makeDispListCurveTypes(Scene *scene, Object *ob, ListBase *dispba
|
|||
}
|
||||
}
|
||||
|
||||
if (!for_orco)
|
||||
if (!for_orco) {
|
||||
BKE_nurbList_duplicate(&ob->curve_cache->deformed_nurbs, &nubase);
|
||||
curve_calc_modifiers_post(scene, ob, &nubase, dispbase, r_dm_final, for_render, use_render_resolution);
|
||||
}
|
||||
|
||||
if (cu->flag & CU_DEFORM_FILL && !ob->derivedFinal) {
|
||||
curve_to_filledpoly(cu, &nubase, dispbase);
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue