diff options
author | YimingWu <xp8110@outlook.com> | 2022-04-14 16:18:24 +0300 |
---|---|---|
committer | YimingWu <xp8110@outlook.com> | 2022-04-14 16:18:24 +0300 |
commit | d3e5d48387532b6cfd55d87f688ee6230ee97462 (patch) | |
tree | 62d116673292ed12a752af568855ac4f9b1029f0 /source/blender/blenloader/intern/versioning_300.c | |
parent | c83a9d13909cf15ea13526739056d413ed003a5f (diff) | |
parent | 678b76d99ae5f918777a5706490b680d709d081d (diff) |
Merge remote-tracking branch 'origin/master' into temp-lineart-contained
Diffstat (limited to 'source/blender/blenloader/intern/versioning_300.c')
-rw-r--r-- | source/blender/blenloader/intern/versioning_300.c | 117 |
1 files changed, 117 insertions, 0 deletions
diff --git a/source/blender/blenloader/intern/versioning_300.c b/source/blender/blenloader/intern/versioning_300.c index 88758989399..249efcdceaa 100644 --- a/source/blender/blenloader/intern/versioning_300.c +++ b/source/blender/blenloader/intern/versioning_300.c @@ -30,6 +30,7 @@ #include "DNA_lineart_types.h" #include "DNA_listBase.h" #include "DNA_material_types.h" +#include "DNA_mesh_types.h" #include "DNA_modifier_types.h" #include "DNA_screen_types.h" #include "DNA_space_types.h" @@ -41,8 +42,10 @@ #include "BKE_animsys.h" #include "BKE_armature.h" #include "BKE_asset.h" +#include "BKE_attribute.h" #include "BKE_collection.h" #include "BKE_curve.h" +#include "BKE_data_transfer.h" #include "BKE_deform.h" #include "BKE_fcurve.h" #include "BKE_fcurve_driver.h" @@ -2562,6 +2565,120 @@ void blo_do_versions_300(FileData *fd, Library *UNUSED(lib), Main *bmain) } } + if (!MAIN_VERSION_ATLEAST(bmain, 302, 10)) { + for (bScreen *screen = bmain->screens.first; screen; screen = screen->id.next) { + LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) { + LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) { + if (sl->spacetype != SPACE_FILE) { + continue; + } + SpaceFile *sfile = (SpaceFile *)sl; + if (sfile->browse_mode != FILE_BROWSE_MODE_ASSETS) { + continue; + } + sfile->asset_params->base_params.filter_id |= FILTER_ID_GR; + } + } + } + + /* While vertex-colors were experimental the smear tool became corrupt due + * to bugs in the wm_toolsystem API (auto-creation of sculpt brushes + * was broken). Go through and reset all smear brushes. */ + LISTBASE_FOREACH (Brush *, br, &bmain->brushes) { + if (br->sculpt_tool == SCULPT_TOOL_SMEAR) { + br->alpha = 1.0f; + br->spacing = 5; + br->flag &= ~BRUSH_ALPHA_PRESSURE; + br->flag &= ~BRUSH_SPACE_ATTEN; + br->curve_preset = BRUSH_CURVE_SPHERE; + } + } + + /* Rebuild active/render color attribute references. */ + LISTBASE_FOREACH (Mesh *, me, &bmain->meshes) { + for (int step = 0; step < 2; step++) { + CustomDataLayer *actlayer = NULL; + + int vact1, vact2; + + if (step) { + vact1 = CustomData_get_render_layer_index(&me->vdata, CD_PROP_COLOR); + vact2 = CustomData_get_render_layer_index(&me->ldata, CD_MLOOPCOL); + } + else { + vact1 = CustomData_get_active_layer_index(&me->vdata, CD_PROP_COLOR); + vact2 = CustomData_get_active_layer_index(&me->ldata, CD_MLOOPCOL); + } + + if (vact1 != -1) { + actlayer = me->vdata.layers + vact1; + } + else if (vact2 != -1) { + actlayer = me->ldata.layers + vact2; + } + + if (actlayer) { + if (step) { + BKE_id_attributes_render_color_set(&me->id, actlayer); + } + else { + BKE_id_attributes_active_color_set(&me->id, actlayer); + } + } + } + } + + /* Update data transfer modifiers */ + LISTBASE_FOREACH (Object *, ob, &bmain->objects) { + LISTBASE_FOREACH (ModifierData *, md, &ob->modifiers) { + if (md->type == eModifierType_DataTransfer) { + DataTransferModifierData *dtmd = (DataTransferModifierData *)md; + + for (int i = 0; i < DT_MULTILAYER_INDEX_MAX; i++) { + if (dtmd->layers_select_src[i] == 0) { + dtmd->layers_select_src[i] = DT_LAYERS_ALL_SRC; + } + + if (dtmd->layers_select_dst[i] == 0) { + dtmd->layers_select_dst[i] = DT_LAYERS_NAME_DST; + } + } + } + } + } + } + + if (!MAIN_VERSION_ATLEAST(bmain, 302, 12)) { + /* UV/Image show background grid option. */ + LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) { + LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) { + LISTBASE_FOREACH (SpaceLink *, space, &area->spacedata) { + if (space->spacetype == SPACE_IMAGE) { + SpaceImage *sima = (SpaceImage *)space; + sima->overlay.flag |= SI_OVERLAY_SHOW_GRID_BACKGROUND; + } + } + } + } + + /* Add node storage for the merge by distance node. */ + FOREACH_NODETREE_BEGIN (bmain, ntree, id) { + if (ntree->type == NTREE_GEOMETRY) { + LISTBASE_FOREACH (bNode *, node, &ntree->nodes) { + if (node->type == GEO_NODE_MERGE_BY_DISTANCE) { + if (node->storage == NULL) { + NodeGeometryMergeByDistance *data = MEM_callocN(sizeof(NodeGeometryMergeByDistance), + __func__); + data->mode = GEO_NODE_MERGE_BY_DISTANCE_MODE_ALL; + node->storage = data; + } + } + } + } + } + FOREACH_NODETREE_END; + } + /** * Versioning code until next subversion bump goes here. * |