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
This commit is contained in:
2020-03-10 15:41:29 +01:00
parent e06888cf89
commit b37482bc3d
3 changed files with 38 additions and 18 deletions

View File

@@ -27,7 +27,7 @@
* \note Use #STRINGIFY() rather than defining with quotes.
*/
#define BLENDER_VERSION 283
#define BLENDER_SUBVERSION 7
#define BLENDER_SUBVERSION 8
/** Several breakages with 280, e.g. collections vs layers. */
#define BLENDER_MINVERSION 280
#define BLENDER_MINSUBVERSION 0

View File

@@ -1545,6 +1545,9 @@ static void sculpt_update_object(
for (int i = 0; i < me->totpoly; i++) {
ss->face_sets[i] = 1;
}
/* Set the default face set color if the datalayer did not exist. */
me->face_sets_color_default = 1;
}
ss->face_sets = CustomData_get_layer(&me->pdata, CD_SCULPT_FACE_SETS);
}
@@ -1555,6 +1558,8 @@ static void sculpt_update_object(
BLI_assert(pbvh == ss->pbvh);
UNUSED_VARS_NDEBUG(pbvh);
BKE_pbvh_face_sets_color_set(ss->pbvh, me->face_sets_color_seed, me->face_sets_color_default);
if (need_pmap && ob->type == OB_MESH && !ss->pmap) {
BKE_mesh_vert_poly_map_create(
&ss->pmap, &ss->pmap_mem, me->mpoly, me->mloop, me->totvert, me->totpoly, me->totloop);

View File

@@ -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. */
}
}