Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenloader/intern/versioning_290.c
| Show All 15 Lines | |||||
| /** \file | /** \file | ||||
| * \ingroup blenloader | * \ingroup blenloader | ||||
| */ | */ | ||||
| /* allow readfile to use deprecated functionality */ | /* allow readfile to use deprecated functionality */ | ||||
| #define DNA_DEPRECATED_ALLOW | #define DNA_DEPRECATED_ALLOW | ||||
| #include "BLI_listbase.h" | #include "BLI_listbase.h" | ||||
| #include "BLI_math.h" | |||||
| #include "BLI_utildefines.h" | #include "BLI_utildefines.h" | ||||
| #include "DNA_brush_types.h" | #include "DNA_brush_types.h" | ||||
| #include "DNA_constraint_types.h" | #include "DNA_constraint_types.h" | ||||
| #include "DNA_genfile.h" | #include "DNA_genfile.h" | ||||
| #include "DNA_gpencil_modifier_types.h" | #include "DNA_gpencil_modifier_types.h" | ||||
| #include "DNA_modifier_types.h" | #include "DNA_modifier_types.h" | ||||
| #include "DNA_object_types.h" | #include "DNA_object_types.h" | ||||
| #include "DNA_screen_types.h" | #include "DNA_screen_types.h" | ||||
| #include "DNA_shader_fx_types.h" | #include "DNA_shader_fx_types.h" | ||||
| #include "BKE_collection.h" | #include "BKE_collection.h" | ||||
| #include "BKE_colortools.h" | #include "BKE_colortools.h" | ||||
| #include "BKE_lib_id.h" | #include "BKE_lib_id.h" | ||||
| #include "BKE_main.h" | #include "BKE_main.h" | ||||
| #include "BKE_node.h" | |||||
| #include "BLO_readfile.h" | #include "BLO_readfile.h" | ||||
| #include "readfile.h" | #include "readfile.h" | ||||
| /* Make preferences read-only, use versioning_userdef.c. */ | /* Make preferences read-only, use versioning_userdef.c. */ | ||||
| #define U (*((const UserDef *)&U)) | #define U (*((const UserDef *)&U)) | ||||
| void do_versions_after_linking_290(Main *bmain, ReportList *UNUSED(reports)) | void do_versions_after_linking_290(Main *bmain, ReportList *UNUSED(reports)) | ||||
| ▲ Show 20 Lines • Show All 203 Lines • ▼ Show 20 Lines | if (!MAIN_VERSION_ATLEAST(bmain, 290, 4)) { | ||||
| */ | */ | ||||
| LISTBASE_FOREACH (Object *, ob, &bmain->objects) { | LISTBASE_FOREACH (Object *, ob, &bmain->objects) { | ||||
| LISTBASE_FOREACH (ModifierData *, md, &ob->modifiers) { | LISTBASE_FOREACH (ModifierData *, md, &ob->modifiers) { | ||||
| if (md->type == eModifierType_WeightVGEdit) { | if (md->type == eModifierType_WeightVGEdit) { | ||||
| ((WeightVGEditModifierData *)md)->edit_flags &= ~MOD_WVG_EDIT_WEIGHTS_NORMALIZE; | ((WeightVGEditModifierData *)md)->edit_flags &= ~MOD_WVG_EDIT_WEIGHTS_NORMALIZE; | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| /* Initialize parameters of the new Nishita sky model. */ | |||||
| if (!DNA_struct_elem_find(fd->filesdna, "NodeTexSky", "float", "sun_size")) { | |||||
| FOREACH_NODETREE_BEGIN (bmain, ntree, id) { | |||||
| if (ntree->type == NTREE_SHADER) { | |||||
| LISTBASE_FOREACH (bNode *, node, &ntree->nodes) { | |||||
| if (node->type == SH_NODE_TEX_SKY && node->storage) { | |||||
| NodeTexSky *tex = (NodeTexSky *)node->storage; | |||||
| tex->sun_disc = true; | |||||
| tex->sun_size = DEG2RADF(0.545); | |||||
| tex->sun_intensity = 1.0f; | |||||
| tex->sun_elevation = M_PI_2; | |||||
| tex->sun_rotation = 0.0f; | |||||
| tex->altitude = 0.0f; | |||||
| tex->air_density = 1.0f; | |||||
| tex->dust_density = 1.0f; | |||||
| tex->ozone_density = 1.0f; | |||||
| } | |||||
| } | |||||
| } | |||||
| } | |||||
| FOREACH_NODETREE_END; | |||||
| } | |||||
| } | } | ||||
| if (!MAIN_VERSION_ATLEAST(bmain, 290, 6)) { | if (!MAIN_VERSION_ATLEAST(bmain, 290, 6)) { | ||||
| /* Transition to saving expansion for all of a modifier's sub-panels. */ | /* Transition to saving expansion for all of a modifier's sub-panels. */ | ||||
| if (!DNA_struct_elem_find(fd->filesdna, "ModifierData", "short", "ui_expand_flag")) { | if (!DNA_struct_elem_find(fd->filesdna, "ModifierData", "short", "ui_expand_flag")) { | ||||
| for (Object *object = bmain->objects.first; object != NULL; object = object->id.next) { | for (Object *object = bmain->objects.first; object != NULL; object = object->id.next) { | ||||
| LISTBASE_FOREACH (ModifierData *, md, &object->modifiers) { | LISTBASE_FOREACH (ModifierData *, md, &object->modifiers) { | ||||
| if (md->mode & eModifierMode_Expanded_DEPRECATED) { | if (md->mode & eModifierMode_Expanded_DEPRECATED) { | ||||
| ▲ Show 20 Lines • Show All 94 Lines • ▼ Show 20 Lines | void blo_do_versions_290(FileData *fd, Library *UNUSED(lib), Main *bmain) | ||||
| * \note Be sure to check when bumping the version: | * \note Be sure to check when bumping the version: | ||||
| * - "versioning_userdef.c", #BLO_version_defaults_userpref_blend | * - "versioning_userdef.c", #BLO_version_defaults_userpref_blend | ||||
| * - "versioning_userdef.c", #do_versions_theme | * - "versioning_userdef.c", #do_versions_theme | ||||
| * | * | ||||
| * \note Keep this message at the bottom of the function. | * \note Keep this message at the bottom of the function. | ||||
| */ | */ | ||||
| { | { | ||||
| /* Keep this block, even when empty. */ | /* Keep this block, even when empty. */ | ||||
| /* Initialize additional parameter of the Nishita sky model and change altitude unit. */ | |||||
| if (!DNA_struct_elem_find(fd->filesdna, "NodeTexSky", "float", "sun_intensity")) { | |||||
| FOREACH_NODETREE_BEGIN (bmain, ntree, id) { | |||||
| if (ntree->type == NTREE_SHADER) { | |||||
| LISTBASE_FOREACH (bNode *, node, &ntree->nodes) { | |||||
| if (node->type == SH_NODE_TEX_SKY && node->storage) { | |||||
| NodeTexSky *tex = (NodeTexSky *)node->storage; | |||||
| tex->sun_intensity = 1.0f; | |||||
| tex->altitude *= 0.001f; | |||||
| } | |||||
| } | |||||
| } | |||||
| } | |||||
| FOREACH_NODETREE_END; | |||||
| } | |||||
| } | } | ||||
| } | } | ||||