diff options
Diffstat (limited to 'source/blender/blenloader/intern/versioning_280.c')
-rw-r--r-- | source/blender/blenloader/intern/versioning_280.c | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/source/blender/blenloader/intern/versioning_280.c b/source/blender/blenloader/intern/versioning_280.c index 2ab7dd22be3..f3dd0ca9a46 100644 --- a/source/blender/blenloader/intern/versioning_280.c +++ b/source/blender/blenloader/intern/versioning_280.c @@ -53,6 +53,7 @@ #include "DNA_world_types.h" #include "BKE_animsys.h" +#include "BKE_blender.h" #include "BKE_brush.h" #include "BKE_cloth.h" #include "BKE_collection.h" @@ -367,7 +368,7 @@ static void do_version_scene_collection_to_collection(Main *bmain, Scene *scene) BLI_listbase_clear(&scene->view_layers); if (!scene->master_collection) { - scene->master_collection = BKE_collection_master_add(); + scene->master_collection = BKE_collection_master_add(scene); } /* Convert scene collections. */ @@ -411,7 +412,7 @@ static void do_version_layers_to_collections(Main *bmain, Scene *scene) /* Since we don't have access to FileData we check the (always valid) first * render layer instead. */ if (!scene->master_collection) { - scene->master_collection = BKE_collection_master_add(); + scene->master_collection = BKE_collection_master_add(scene); } if (scene->view_layers.first) { @@ -512,12 +513,13 @@ static void do_version_layers_to_collections(Main *bmain, Scene *scene) } } + BKE_view_layer_synced_ensure(scene, view_layer); /* for convenience set the same active object in all the layers */ if (scene->basact) { view_layer->basact = BKE_view_layer_base_find(view_layer, scene->basact->object); } - LISTBASE_FOREACH (Base *, base, &view_layer->object_bases) { + LISTBASE_FOREACH (Base *, base, BKE_view_layer_object_bases_get(view_layer)) { if ((base->flag & BASE_SELECTABLE) && (base->object->flag & SELECT)) { base->flag |= BASE_SELECTED; } @@ -537,13 +539,14 @@ static void do_version_layers_to_collections(Main *bmain, Scene *scene) view_layer->flag &= ~VIEW_LAYER_RENDER; } + BKE_view_layer_synced_ensure(scene, view_layer); /* convert active base */ if (scene->basact) { view_layer->basact = BKE_view_layer_base_find(view_layer, scene->basact->object); } /* convert selected bases */ - LISTBASE_FOREACH (Base *, base, &view_layer->object_bases) { + LISTBASE_FOREACH (Base *, base, BKE_view_layer_object_bases_get(view_layer)) { if ((base->flag & BASE_SELECTABLE) && (base->object->flag & SELECT)) { base->flag |= BASE_SELECTED; } @@ -592,7 +595,7 @@ static void do_versions_fix_annotations(bGPdata *gpd) LISTBASE_FOREACH (bGPDframe *, gpf, &gpl->frames) { LISTBASE_FOREACH (bGPDstroke *, gps, &gpf->strokes) { - if ((gps->colorname[0] != '\0') && (STREQ(gps->colorname, palcolor->info))) { + if ((gps->colorname[0] != '\0') && STREQ(gps->colorname, palcolor->info)) { /* copy color settings */ copy_v4_v4(gpl->color, palcolor->color); } @@ -1611,12 +1614,13 @@ void do_versions_after_linking_280(Main *bmain, ReportList *UNUSED(reports)) if (me->totface && !me->totpoly) { /* temporarily switch main so that reading from * external CustomData works */ - Main *gmain = G_MAIN; - G_MAIN = bmain; + Main *orig_gmain = BKE_blender_globals_main_swap(bmain); BKE_mesh_do_versions_convert_mfaces_to_mpolys(me); - G_MAIN = gmain; + Main *tmp_gmain = BKE_blender_globals_main_swap(orig_gmain); + BLI_assert(tmp_gmain == bmain); + UNUSED_VARS_NDEBUG(tmp_gmain); } /* Deprecated, only kept for conversion. */ @@ -1794,10 +1798,9 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain) if (DNA_struct_find(fd->filesdna, "MTexPoly")) { 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) { + if (CustomData_has_layer(&me->ldata, CD_MLOOPUV)) { CustomData_update_typemap(&me->pdata); CustomData_free_layers(&me->pdata, CD_MTEXPOLY, me->totpoly); - BKE_mesh_update_customdata_pointers(me, false); } } } @@ -3376,7 +3379,7 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain) SpaceImage *sima = (SpaceImage *)sl; sima->flag &= ~(SI_FLAG_UNUSED_0 | SI_FLAG_UNUSED_1 | SI_FLAG_UNUSED_3 | SI_FLAG_UNUSED_6 | SI_FLAG_UNUSED_7 | SI_FLAG_UNUSED_8 | - SI_FLAG_UNUSED_17 | SI_CUSTOM_GRID | SI_FLAG_UNUSED_23 | + SI_FLAG_UNUSED_17 | SI_FLAG_UNUSED_18 | SI_FLAG_UNUSED_23 | SI_FLAG_UNUSED_24); break; } @@ -3384,7 +3387,7 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain) View3D *v3d = (View3D *)sl; v3d->flag &= ~(V3D_LOCAL_COLLECTIONS | V3D_FLAG_UNUSED_1 | V3D_FLAG_UNUSED_10 | V3D_FLAG_UNUSED_12); - v3d->flag2 &= ~(V3D_FLAG2_UNUSED_3 | V3D_FLAG2_UNUSED_6 | V3D_FLAG2_UNUSED_12 | + v3d->flag2 &= ~((1 << 3) | V3D_FLAG2_UNUSED_6 | V3D_FLAG2_UNUSED_12 | V3D_FLAG2_UNUSED_13 | V3D_FLAG2_UNUSED_14 | V3D_FLAG2_UNUSED_15); break; } |