[Bf-blender-cvs] [c81eca3d986] master: Fix T63276: crash deleting object with alembic constraint.

Brecht Van Lommel noreply at git.blender.org
Thu Apr 4 15:16:58 CEST 2019


Commit: c81eca3d986115ae8f3c542e9b00b89795233864
Author: Brecht Van Lommel
Date:   Thu Apr 4 15:07:37 2019 +0200
Branches: master
https://developer.blender.org/rBc81eca3d986115ae8f3c542e9b00b89795233864

Fix T63276: crash deleting object with alembic constraint.

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

M	source/blender/alembic/intern/abc_object.cc
M	source/blender/blenkernel/intern/constraint.c

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

diff --git a/source/blender/alembic/intern/abc_object.cc b/source/blender/alembic/intern/abc_object.cc
index 48aa65717dd..20a43a821ed 100644
--- a/source/blender/alembic/intern/abc_object.cc
+++ b/source/blender/alembic/intern/abc_object.cc
@@ -323,8 +323,13 @@ void AbcObjectReader::read_matrix(float r_mat[4][4], const float time,
 		 * all parent matrices in the Alembic file, we assume that the Blender
 		 * parent object is already updated for the current timekey, and use its
 		 * world matrix. */
-		BLI_assert(m_object->parent);
-		mul_m4_m4m4(r_mat, m_object->parent->obmat, r_mat);
+		if (m_object->parent) {
+			mul_m4_m4m4(r_mat, m_object->parent->obmat, r_mat);
+		}
+		else {
+			/* This can happen if the user deleted the parent object. */
+			unit_m4(r_mat);
+		}
 	}
 	else {
 		/* Only apply scaling to root objects, parenting will propagate it. */
diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c
index b22ffce5300..6d7765d4314 100644
--- a/source/blender/blenkernel/intern/constraint.c
+++ b/source/blender/blenkernel/intern/constraint.c
@@ -4572,10 +4572,12 @@ static void transformcache_evaluate(bConstraint *con, bConstraintOb *cob, ListBa
 	const float frame = DEG_get_ctime(cob->depsgraph);
 	const float time = BKE_cachefile_time_offset(cache_file, frame, FPS);
 
-	BKE_cachefile_ensure_handle(G.main, cache_file);
+	/* Must always load ABC handle on original. */
+	CacheFile *cache_file_orig = (CacheFile *)DEG_get_original_id(&cache_file->id);
+	BKE_cachefile_ensure_handle(G.main, cache_file_orig);
 
 	if (!data->reader) {
-		data->reader = CacheReader_open_alembic_object(cache_file->handle,
+		data->reader = CacheReader_open_alembic_object(cache_file_orig->handle,
 		                                               data->reader,
 		                                               cob->ob,
 		                                               data->object_path);



More information about the Bf-blender-cvs mailing list