diff options
author | Pablo Dobarro <pablodp606@gmail.com> | 2020-03-10 17:41:29 +0300 |
---|---|---|
committer | Pablo Dobarro <pablodp606@gmail.com> | 2020-03-10 17:55:50 +0300 |
commit | b37482bc3d86e74f03568d62fa0184e1e78767e6 (patch) | |
tree | 7d4ad2385e0ff3e57d34e46e6ef895b8dd8a4145 /source/blender/blenloader/intern/versioning_280.c | |
parent | e06888cf897ff68bdd606b05ca36f533bc8e4de1 (diff) |
Fix T74613: Assign the default face set color in the versioning code
A default face set color was not being set in previously saved meshes,
so it will always render the default face set with a random color until
the colors were recalculated.
Bump subversion to 283.8
Reviewed By: dfelinto
Maniphest Tasks: T74613
Differential Revision: https://developer.blender.org/D7094
Diffstat (limited to 'source/blender/blenloader/intern/versioning_280.c')
-rw-r--r-- | source/blender/blenloader/intern/versioning_280.c | 49 |
1 files changed, 32 insertions, 17 deletions
diff --git a/source/blender/blenloader/intern/versioning_280.c b/source/blender/blenloader/intern/versioning_280.c index ca22cc71613..e7b6d9d294d 100644 --- a/source/blender/blenloader/intern/versioning_280.c +++ b/source/blender/blenloader/intern/versioning_280.c @@ -1662,6 +1662,15 @@ void do_versions_after_linking_280(Main *bmain, ReportList *UNUSED(reports)) } } + if (!MAIN_VERSION_ATLEAST(bmain, 283, 8)) { + + /* During development of Blender 2.80 the "Object.hide" property was + * removed, and reintroduced in 5e968a996a53 as "Object.hide_viewport". */ + LISTBASE_FOREACH (Object *, ob, &bmain->objects) { + BKE_fcurves_id_cb(&ob->id, do_version_fcurve_hide_viewport_fix, NULL); + } + } + /** * Versioning code until next subversion bump goes here. * @@ -1673,12 +1682,6 @@ void do_versions_after_linking_280(Main *bmain, ReportList *UNUSED(reports)) */ { /* Keep this block, even when empty. */ - - /* During development of Blender 2.80 the "Object.hide" property was - * removed, and reintroduced in 5e968a996a53 as "Object.hide_viewport". */ - LISTBASE_FOREACH (Object *, ob, &bmain->objects) { - BKE_fcurves_id_cb(&ob->id, do_version_fcurve_hide_viewport_fix, NULL); - } } } @@ -4778,17 +4781,7 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain) } } - /** - * Versioning code until next subversion bump goes here. - * - * \note Be sure to check when bumping the version: - * - "versioning_userdef.c", #BLO_version_defaults_userpref_blend - * - "versioning_userdef.c", #do_versions_theme - * - * \note Keep this message at the bottom of the function. - */ - { - /* Keep this block, even when empty. */ + if (!MAIN_VERSION_ATLEAST(bmain, 283, 8)) { if (!DNA_struct_elem_find( fd->filesdna, "View3DOverlay", "float", "sculpt_mode_face_sets_opacity")) { for (bScreen *screen = bmain->screens.first; screen; screen = screen->id.next) { @@ -4831,5 +4824,27 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain) } } } + + /* Default Face Set Color. */ + for (Mesh *me = bmain->meshes.first; me != NULL; me = me->id.next) { + if (me->totpoly > 0) { + int *face_sets = CustomData_get_layer(&me->pdata, CD_SCULPT_FACE_SETS); + if (face_sets) { + me->face_sets_color_default = abs(face_sets[0]); + } + } + } + } + /** + * Versioning code until next subversion bump goes here. + * + * \note Be sure to check when bumping the version: + * - "versioning_userdef.c", #BLO_version_defaults_userpref_blend + * - "versioning_userdef.c", #do_versions_theme + * + * \note Keep this message at the bottom of the function. + */ + { + /* Keep this block, even when empty. */ } } |