[Bf-blender-cvs] [8095875dffe] master: Fix T97151: Curve vertex parenting crash with dependency cycle

Hans Goudey noreply at git.blender.org
Thu Apr 28 21:58:59 CEST 2022


Commit: 8095875dffebed289791491ff15d68d49deb85ef
Author: Hans Goudey
Date:   Thu Apr 28 14:58:52 2022 -0500
Branches: master
https://developer.blender.org/rB8095875dffebed289791491ff15d68d49deb85ef

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

===================================================================

M	source/blender/blenkernel/intern/object.cc

===================================================================

diff --git a/source/blender/blenkernel/intern/object.cc b/source/blender/blenkernel/intern/object.cc
index 948064ad170..ddaae7a14d0 100644
--- a/source/blender/blenkernel/intern/object.cc
+++ b/source/blender/blenkernel/intern/object.cc
@@ -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 {



More information about the Bf-blender-cvs mailing list