diff options
author | Jacques Lucke <jacques@blender.org> | 2021-03-24 15:27:47 +0300 |
---|---|---|
committer | Jacques Lucke <jacques@blender.org> | 2021-03-24 15:27:47 +0300 |
commit | 9b8262021b782361d82cd0e1f0f1e5711036c580 (patch) | |
tree | 48f31921865c823c7949861d9bb61e08bf239bc9 | |
parent | c0a4c8c3fa68a7343a8444aaf4948f309adec4d6 (diff) |
Geometry Nodes: add versioning for attribute fill
The attribute domain of old nodes should be set to `ATTR_DOMAIN_AUTO`.
-rw-r--r-- | source/blender/blenkernel/BKE_blender_version.h | 2 | ||||
-rw-r--r-- | source/blender/blenloader/intern/versioning_290.c | 27 |
2 files changed, 21 insertions, 8 deletions
diff --git a/source/blender/blenkernel/BKE_blender_version.h b/source/blender/blenkernel/BKE_blender_version.h index eb5f910f555..c9585430ae2 100644 --- a/source/blender/blenkernel/BKE_blender_version.h +++ b/source/blender/blenkernel/BKE_blender_version.h @@ -39,7 +39,7 @@ extern "C" { /* Blender file format version. */ #define BLENDER_FILE_VERSION BLENDER_VERSION -#define BLENDER_FILE_SUBVERSION 13 +#define BLENDER_FILE_SUBVERSION 14 /* Minimum Blender version that supports reading file written with the current * version. Older Blender versions will test this and show a warning if the file diff --git a/source/blender/blenloader/intern/versioning_290.c b/source/blender/blenloader/intern/versioning_290.c index 00f4c49fda9..31e4b659c2f 100644 --- a/source/blender/blenloader/intern/versioning_290.c +++ b/source/blender/blenloader/intern/versioning_290.c @@ -52,6 +52,7 @@ #include "BKE_animsys.h" #include "BKE_armature.h" +#include "BKE_attribute.h" #include "BKE_collection.h" #include "BKE_colortools.h" #include "BKE_cryptomatte.h" @@ -1905,6 +1906,25 @@ void blo_do_versions_290(FileData *fd, Library *UNUSED(lib), Main *bmain) } } + if (!MAIN_VERSION_ATLEAST(bmain, 293, 14)) { + if (!DNA_struct_elem_find(fd->filesdna, "Light", "float", "diff_fac")) { + LISTBASE_FOREACH (Light *, light, &bmain->lights) { + light->diff_fac = 1.0f; + light->volume_fac = 1.0f; + } + } + + LISTBASE_FOREACH (bNodeTree *, ntree, &bmain->nodetrees) { + if (ntree->type == NTREE_GEOMETRY) { + LISTBASE_FOREACH (bNode *, node, &ntree->nodes) { + if (node->type == GEO_NODE_ATTRIBUTE_FILL) { + node->custom2 = ATTR_DOMAIN_AUTO; + } + } + } + } + } + /** * Versioning code until next subversion bump goes here. * @@ -1916,12 +1936,5 @@ void blo_do_versions_290(FileData *fd, Library *UNUSED(lib), Main *bmain) */ { /* Keep this block, even when empty. */ - - if (!DNA_struct_elem_find(fd->filesdna, "Light", "float", "diff_fac")) { - LISTBASE_FOREACH (Light *, light, &bmain->lights) { - light->diff_fac = 1.0f; - light->volume_fac = 1.0f; - } - } } } |