Commit: 13978f7ff6819e255601f5e5c42d540472c18afb
Author: Bastien Montagne
Date: Fri Mar 8 17:01:18 2019 +0100
Branches: master
https://developer.blender.org/rB13978f7ff6819e255601f5e5c42d540472c18afb
Followup to T62318: Fix on-the-fly that kind of .blend file cddata corruption.
Remove cddata layers which are not supposed to be written in .blend file,
when reading it.
This is a cheap and simple check, which also gives us forward compatibility
in case we decide some day to make a currently un-written layer type
to be written in .blend files.
===================================================================
M source/blender/blenkernel/intern/customdata.c
===================================================================
diff --git a/source/blender/blenkernel/intern/customdata.c
b/source/blender/blenkernel/intern/customdata.c
index fbea4ecc01e..56847aded8b 100644
--- a/source/blender/blenkernel/intern/customdata.c
+++ b/source/blender/blenkernel/intern/customdata.c
@@ -3641,6 +3641,19 @@ bool CustomData_verify_versions(struct CustomData *data,
int index)
{
keeplayer = false; /* multiple layers of which we only
support one */
}
+ /* This is a pre-emptive fix for cases that should not happen
(layers that should not be written
+ * in .blend files), but can happen due to bugs (see e.g.
T62318).
+ * Also for forward compatibility, in future, we may put into
.blend file some currently un-written data types,
+ * this should cover that case as well.
+ * Better to be safe here, and fix issue on the fly rather than
crash... */
+ /* 0 structnum is used in writing code to tag layer types that
should not be written. */
+ else if (typeInfo->structnum == 0 &&
+ /* XXX Not sure why those two are exception, maybe
that should be fixed? */
+ !ELEM(layer->type, CD_PAINT_MASK, CD_FACEMAP))
+ {
+ keeplayer = false;
+ CLOG_WARN(&LOG, ".blend file read: removing a data
layer that should not have been written");
+ }
}
if (!keeplayer) {
_______________________________________________
Bf-blender-cvs mailing list
[email protected]
https://lists.blender.org/mailman/listinfo/bf-blender-cvs