[Bf-blender-cvs] [38342e4] alembic_pointcache: Nicer error handling for unimplemented CustomData layer types.

Lukas Tönne noreply at git.blender.org
Mon Mar 9 09:58:47 CET 2015


Commit: 38342e444ad60fc75c993a8f2292165bad95b6ee
Author: Lukas Tönne
Date:   Mon Mar 9 09:57:26 2015 +0100
Branches: alembic_pointcache
https://developer.blender.org/rB38342e444ad60fc75c993a8f2292165bad95b6ee

Nicer error handling for unimplemented CustomData layer types.

Instead of failing an assert, simply print an error message and return
gracefully. We don't want Blender crashing because of this.

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

M	source/blender/pointcache/alembic/abc_customdata.cpp

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

diff --git a/source/blender/pointcache/alembic/abc_customdata.cpp b/source/blender/pointcache/alembic/abc_customdata.cpp
index cc26f5f..f7c27ef 100644
--- a/source/blender/pointcache/alembic/abc_customdata.cpp
+++ b/source/blender/pointcache/alembic/abc_customdata.cpp
@@ -55,7 +55,7 @@ template <CustomDataType CDTYPE>
 static void write_sample(CustomDataWriter *writer, OCompoundProperty &parent, const std::string &name, void *data, int num_data)
 {
 	/* no implementation available, should not happen */
-	BLI_assert(false);
+	printf("ERROR: CustomData type %s has no write_sample implementation\n", CustomData_layertype_name((int)CDTYPE));
 }
 
 template <>
@@ -101,7 +101,8 @@ template <CustomDataType CDTYPE>
 static PTCReadSampleResult read_sample(CustomDataReader *reader, ICompoundProperty &parent, const ISampleSelector &ss, const std::string &name, void *data, int num_data)
 {
 	/* no implementation available, should not happen */
-	BLI_assert(false);
+	printf("ERROR: CustomData type %s has no read_sample implementation\n", CustomData_layertype_name((int)CDTYPE));
+	return PTC_READ_SAMPLE_INVALID;
 }
 
 template <>




More information about the Bf-blender-cvs mailing list