diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2019-07-03 16:43:05 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2019-07-03 17:05:31 +0300 |
commit | c44144835974ad877212973a4ae45c03b7c66f80 (patch) | |
tree | 269000fd1ee5f8846e5cb85dd1b6f59517670ff9 | |
parent | 3d187a2764c11e72293151bfc4a5dc2da1c75ec2 (diff) |
Fix T66369: Excessive WARN messages in console when opening older files
CDData checking on file load was not taking into account deprecated
CD_MTEXPOLY datatype, which unfortunately shows same weird glitch as
CD_PAINT_MASK and CD_FACEMAP ones...
Note that it was annoying (due to amount of warnings in console), but
totally harmless, since that data type is just deleted anyway.
This commit also generally cleans up the CD_MTEXPOLY deprecation code, we
have a system to handle that, let's use it, instead of defining local
static values to replace it...
-rw-r--r-- | source/blender/alembic/intern/abc_mesh.cc | 3 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/customdata.c | 8 | ||||
-rw-r--r-- | source/blender/blenloader/intern/versioning_280.c | 3 | ||||
-rw-r--r-- | source/blender/editors/uvedit/uvedit_unwrap_ops.c | 1 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_customdata_types.h | 10 |
5 files changed, 15 insertions, 10 deletions
diff --git a/source/blender/alembic/intern/abc_mesh.cc b/source/blender/alembic/intern/abc_mesh.cc index de227be0044..7f7afe0ce5e 100644 --- a/source/blender/alembic/intern/abc_mesh.cc +++ b/source/blender/alembic/intern/abc_mesh.cc @@ -973,8 +973,7 @@ static void *add_customdata_cb(void *user_data, const char *name, int data_type) return cd_ptr; } - /* create a new layer, taking care to construct the hopefully-soon-to-be-removed - * CD_MTEXPOLY layer too, with the same name. */ + /* Create a new layer. */ numloops = mesh->totloop; cd_ptr = CustomData_add_layer_named(loopdata, cd_data_type, CD_DEFAULT, NULL, numloops, name); return cd_ptr; diff --git a/source/blender/blenkernel/intern/customdata.c b/source/blender/blenkernel/intern/customdata.c index 76098db5fd1..5bfb14824b4 100644 --- a/source/blender/blenkernel/intern/customdata.c +++ b/source/blender/blenkernel/intern/customdata.c @@ -26,6 +26,9 @@ #include "MEM_guardedalloc.h" +/* Since we have versioning code here (CustomData_verify_versions()). */ +#define DNA_DEPRECATED_ALLOW + #include "DNA_customdata_types.h" #include "DNA_meshdata_types.h" #include "DNA_ID.h" @@ -4191,9 +4194,10 @@ bool CustomData_verify_versions(struct CustomData *data, int index) * 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)) { + /* XXX Not sure why those three are exception, maybe that should be fixed? */ + !ELEM(layer->type, CD_PAINT_MASK, CD_FACEMAP, CD_MTEXPOLY)) { keeplayer = false; + printf("%d\n", layer->type); CLOG_WARN(&LOG, ".blend file read: removing a data layer that should not have been written"); } } diff --git a/source/blender/blenloader/intern/versioning_280.c b/source/blender/blenloader/intern/versioning_280.c index 4b55364f0b1..5d899ef73a6 100644 --- a/source/blender/blenloader/intern/versioning_280.c +++ b/source/blender/blenloader/intern/versioning_280.c @@ -1180,12 +1180,11 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain) /* MTexPoly now removed. */ if (DNA_struct_find(fd->filesdna, "MTexPoly")) { - const int cd_mtexpoly = 15; /* CD_MTEXPOLY, deprecated */ for (Mesh *me = bmain->meshes.first; me; me = me->id.next) { /* If we have UV's, so this file will have MTexPoly layers too! */ if (me->mloopuv != NULL) { CustomData_update_typemap(&me->pdata); - CustomData_free_layers(&me->pdata, cd_mtexpoly, me->totpoly); + CustomData_free_layers(&me->pdata, CD_MTEXPOLY, me->totpoly); BKE_mesh_update_customdata_pointers(me, false); } } diff --git a/source/blender/editors/uvedit/uvedit_unwrap_ops.c b/source/blender/editors/uvedit/uvedit_unwrap_ops.c index 14cdb674698..a42a6eba3ff 100644 --- a/source/blender/editors/uvedit/uvedit_unwrap_ops.c +++ b/source/blender/editors/uvedit/uvedit_unwrap_ops.c @@ -2282,7 +2282,6 @@ static void uvedit_unwrap_cube_project(BMesh *bm, * component, but clusters all together around the center of map. */ BM_ITER_MESH (efa, &iter, bm, BM_FACES_OF_MESH) { - /* tf = CustomData_bmesh_get(&em->bm->pdata, efa->head.data, CD_MTEXPOLY); */ /* UNUSED */ if (use_select && !BM_elem_flag_test(efa, BM_ELEM_SELECT)) { continue; } diff --git a/source/blender/makesdna/DNA_customdata_types.h b/source/blender/makesdna/DNA_customdata_types.h index c38222a3eb3..75a417150c8 100644 --- a/source/blender/makesdna/DNA_customdata_types.h +++ b/source/blender/makesdna/DNA_customdata_types.h @@ -30,6 +30,8 @@ extern "C" { #endif +#include "DNA_defs.h" + /** descriptor and storage for a custom data layer */ typedef struct CustomDataLayer { /** Type of data in layer. */ @@ -107,9 +109,11 @@ typedef enum CustomDataType { CD_PROP_FLT = 10, CD_PROP_INT = 11, CD_PROP_STR = 12, - CD_ORIGSPACE = 13, /* for modifier stack face location mapping */ - CD_ORCO = 14, /* undeformed vertex coordinates, normalized to 0..1 range */ - /* CD_MTEXPOLY = 15, */ /* deprecated */ + CD_ORIGSPACE = 13, /* for modifier stack face location mapping */ + CD_ORCO = 14, /* undeformed vertex coordinates, normalized to 0..1 range */ +#ifdef DNA_DEPRECATED + CD_MTEXPOLY = 15, /* deprecated */ +#endif CD_MLOOPUV = 16, CD_MLOOPCOL = 17, CD_TANGENT = 18, |