Fix T97151: Curve vertex parenting crash with dependency cycle

When the object's position depends on the geometry and the geometry
depends on the object's position, we can't count on the object's
evaluated geometry to be available. Lattices and mesh objects have
equivalent checks in this vertex parenting function.

Differential Revision: https://developer.blender.org/D14781
This commit is contained in:
Hans Goudey 2022-04-28 14:58:52 -05:00
parent 4b7ed584a8
commit 8095875dff
Notes: blender-bot 2023-02-14 10:43:47 +01:00
Referenced by issue #97151, Regression: Crash: Vertex Parent + SimpleDeform modifier with origin / Apply on Spline
1 changed files with 3 additions and 4 deletions

View File

@ -3256,10 +3256,9 @@ static void give_parvert(Object *par, int nr, float vec[3])
else if (ELEM(par->type, OB_CURVES_LEGACY, OB_SURF)) {
ListBase *nurb;
/* Unless there's some weird depsgraph failure the cache should exist. */
BLI_assert(par->runtime.curve_cache != nullptr);
if (par->runtime.curve_cache->deformed_nurbs.first != nullptr) {
/* It is possible that a cycle in the dependency graph was resolved in a way that caused this
* object to be evaluated before its dependencies. In this case the curve cache may be null. */
if (par->runtime.curve_cache && par->runtime.curve_cache->deformed_nurbs.first != nullptr) {
nurb = &par->runtime.curve_cache->deformed_nurbs;
}
else {