diff options
author | Joseph Eagar <joeedh@gmail.com> | 2022-02-21 18:48:43 +0300 |
---|---|---|
committer | Joseph Eagar <joeedh@gmail.com> | 2022-02-21 18:48:43 +0300 |
commit | 5cbf05a637272492e0bf89e5f8d3463bf8be48c0 (patch) | |
tree | a888f25eddd29bfca42abb16ce18aee4415bf36d /source/blender/blenloader | |
parent | 13f84446731b07153ddf6a87967df7c883c18ae1 (diff) | |
parent | 68a2dc58dee719dc37a0ba2b84c5488999c2a458 (diff) |
Merge branch 'master' into temp-sculpt-colors
Diffstat (limited to 'source/blender/blenloader')
-rw-r--r-- | source/blender/blenloader/BLO_undofile.h | 2 | ||||
-rw-r--r-- | source/blender/blenloader/intern/blend_validate.c | 15 | ||||
-rw-r--r-- | source/blender/blenloader/intern/readfile.c | 22 | ||||
-rw-r--r-- | source/blender/blenloader/intern/versioning_250.c | 2 | ||||
-rw-r--r-- | source/blender/blenloader/intern/versioning_300.c | 15 | ||||
-rw-r--r-- | source/blender/blenloader/intern/versioning_common.cc | 2 | ||||
-rw-r--r-- | source/blender/blenloader/intern/versioning_legacy.c | 2 |
7 files changed, 49 insertions, 11 deletions
diff --git a/source/blender/blenloader/BLO_undofile.h b/source/blender/blenloader/BLO_undofile.h index 49f7f62cb9b..48334444c4c 100644 --- a/source/blender/blenloader/BLO_undofile.h +++ b/source/blender/blenloader/BLO_undofile.h @@ -5,7 +5,7 @@ /** \file * \ingroup blenloader - * External writefile function prototypes. + * External write-file function prototypes. */ #include "BLI_filereader.h" diff --git a/source/blender/blenloader/intern/blend_validate.c b/source/blender/blenloader/intern/blend_validate.c index 10150f56098..e1527201e22 100644 --- a/source/blender/blenloader/intern/blend_validate.c +++ b/source/blender/blenloader/intern/blend_validate.c @@ -181,5 +181,20 @@ bool BLO_main_validate_shapekeys(Main *bmain, ReportList *reports) BKE_main_unlock(bmain); + /* NOTE: #BKE_id_delete also locks `bmain`, so we need to do this loop outside of the lock here. + */ + LISTBASE_FOREACH_MUTABLE (Key *, shapekey, &bmain->shapekeys) { + if (shapekey->from != NULL) { + continue; + } + + BKE_reportf(reports, + RPT_ERROR, + "Shapekey %s has an invalid 'from' pointer (%p), it will be deleted", + shapekey->id.name, + shapekey->from); + BKE_id_delete(bmain, shapekey); + } + return is_valid; } diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 84625fea6fc..9539436cf69 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -320,15 +320,22 @@ static void oldnewmap_increase_size(OldNewMap *onm) /* Public OldNewMap API */ -static OldNewMap *oldnewmap_new(void) +static void oldnewmap_init_data(OldNewMap *onm, const int capacity_exp) { - OldNewMap *onm = MEM_callocN(sizeof(*onm), "OldNewMap"); + memset(onm, 0x0, sizeof(*onm)); - onm->capacity_exp = DEFAULT_SIZE_EXP; + onm->capacity_exp = capacity_exp; onm->entries = MEM_malloc_arrayN( ENTRIES_CAPACITY(onm), sizeof(*onm->entries), "OldNewMap.entries"); onm->map = MEM_malloc_arrayN(MAP_CAPACITY(onm), sizeof(*onm->map), "OldNewMap.map"); oldnewmap_clear_map(onm); +} + +static OldNewMap *oldnewmap_new(void) +{ + OldNewMap *onm = MEM_mallocN(sizeof(*onm), "OldNewMap"); + + oldnewmap_init_data(onm, DEFAULT_SIZE_EXP); return onm; } @@ -395,9 +402,10 @@ static void oldnewmap_clear(OldNewMap *onm) } } - onm->capacity_exp = DEFAULT_SIZE_EXP; - oldnewmap_clear_map(onm); - onm->nentries = 0; + MEM_freeN(onm->entries); + MEM_freeN(onm->map); + + oldnewmap_init_data(onm, DEFAULT_SIZE_EXP); } static void oldnewmap_free(OldNewMap *onm) @@ -2913,7 +2921,7 @@ static const char *dataname(short id_code) return "Data from MA"; case ID_TE: return "Data from TE"; - case ID_CU: + case ID_CU_LEGACY: return "Data from CU"; case ID_GR: return "Data from GR"; diff --git a/source/blender/blenloader/intern/versioning_250.c b/source/blender/blenloader/intern/versioning_250.c index 6bf3402eafe..ac59e3efc72 100644 --- a/source/blender/blenloader/intern/versioning_250.c +++ b/source/blender/blenloader/intern/versioning_250.c @@ -1644,7 +1644,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain) BLI_addtail((ListBase *)&ob->modifiers, lmd); ob->partype = PAROBJECT; } - else if (parent->type == OB_CURVE && ob->partype == PARCURVE) { + else if (parent->type == OB_CURVES_LEGACY && ob->partype == PARCURVE) { CurveModifierData *cmd; cmd = (CurveModifierData *)BKE_modifier_new(eModifierType_Curve); diff --git a/source/blender/blenloader/intern/versioning_300.c b/source/blender/blenloader/intern/versioning_300.c index 920f9234cf2..bb2396701ed 100644 --- a/source/blender/blenloader/intern/versioning_300.c +++ b/source/blender/blenloader/intern/versioning_300.c @@ -2546,6 +2546,21 @@ void blo_do_versions_300(FileData *fd, Library *UNUSED(lib), Main *bmain) } } + if (!MAIN_VERSION_ATLEAST(bmain, 301, 7) || + (bmain->versionfile == 302 && !MAIN_VERSION_ATLEAST(bmain, 302, 4))) { + /* Duplicate value for two flags that mistakenly had the same numeric value. */ + LISTBASE_FOREACH (Object *, ob, &bmain->objects) { + LISTBASE_FOREACH (ModifierData *, md, &ob->modifiers) { + if (md->type == eModifierType_WeightVGProximity) { + WeightVGProximityModifierData *wpmd = (WeightVGProximityModifierData *)md; + if (wpmd->proximity_flags & MOD_WVG_PROXIMITY_INVERT_VGROUP_MASK) { + wpmd->proximity_flags |= MOD_WVG_PROXIMITY_WEIGHTS_NORMALIZE; + } + } + } + } + } + if (!MAIN_VERSION_ATLEAST(bmain, 302, 2)) { LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) { if (scene->ed != NULL) { diff --git a/source/blender/blenloader/intern/versioning_common.cc b/source/blender/blenloader/intern/versioning_common.cc index 6aac76642d5..281769410bd 100644 --- a/source/blender/blenloader/intern/versioning_common.cc +++ b/source/blender/blenloader/intern/versioning_common.cc @@ -56,7 +56,7 @@ ID *do_versions_rename_id(Main *bmain, ListBase *lb = which_libbase(bmain, id_type); ID *id = nullptr; LISTBASE_FOREACH (ID *, idtest, lb) { - if (idtest->lib == nullptr) { + if (!ID_IS_LINKED(idtest)) { if (STREQ(idtest->name + 2, name_src)) { id = idtest; } diff --git a/source/blender/blenloader/intern/versioning_legacy.c b/source/blender/blenloader/intern/versioning_legacy.c index cd4efa95d5e..2908b2b151b 100644 --- a/source/blender/blenloader/intern/versioning_legacy.c +++ b/source/blender/blenloader/intern/versioning_legacy.c @@ -1356,7 +1356,7 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain) bFollowPathConstraint *data = con->data; Object *obc = blo_do_versions_newlibadr(fd, lib, data->tar); - if (obc && obc->type == OB_CURVE) { + if (obc && obc->type == OB_CURVES_LEGACY) { Curve *cu = blo_do_versions_newlibadr(fd, lib, obc->data); if (cu) { cu->flag |= CU_PATH; |