diff options
author | YimingWu <xp8110@outlook.com> | 2022-04-22 11:46:18 +0300 |
---|---|---|
committer | YimingWu <xp8110@outlook.com> | 2022-04-22 12:20:15 +0300 |
commit | 0b9c5184ef083bf733e444f40da1cbe974a66a2f (patch) | |
tree | b597847653d0b8eaf78c581076a905156e4af6e8 /source/blender/blenloader/intern/versioning_300.c | |
parent | 64355e332322454dcd53227e1f90b127d4f326b5 (diff) | |
parent | 73bf98912a056f81fb68695de825b7b72f1b313b (diff) |
Merge branch 'temp-lineart-contained' into lineart-shadow
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 4d9609ff46f..5e178c6820a 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" @@ -2572,6 +2575,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. * |