Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorPablo Dobarro <pablodp606@gmail.com>2020-03-10 17:41:29 +0300
committerPablo Dobarro <pablodp606@gmail.com>2020-03-10 17:55:50 +0300
commitb37482bc3d86e74f03568d62fa0184e1e78767e6 (patch)
tree7d4ad2385e0ff3e57d34e46e6ef895b8dd8a4145 /source
parente06888cf897ff68bdd606b05ca36f533bc8e4de1 (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')
-rw-r--r--source/blender/blenkernel/BKE_blender_version.h2
-rw-r--r--source/blender/blenkernel/intern/paint.c5
-rw-r--r--source/blender/blenloader/intern/versioning_280.c49
3 files changed, 38 insertions, 18 deletions
diff --git a/source/blender/blenkernel/BKE_blender_version.h b/source/blender/blenkernel/BKE_blender_version.h
index 233c385c247..eb7078213da 100644
--- a/source/blender/blenkernel/BKE_blender_version.h
+++ b/source/blender/blenkernel/BKE_blender_version.h
@@ -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
diff --git a/source/blender/blenkernel/intern/paint.c b/source/blender/blenkernel/intern/paint.c
index 6afa498cf86..eb21883f0dd 100644
--- a/source/blender/blenkernel/intern/paint.c
+++ b/source/blender/blenkernel/intern/paint.c
@@ -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);
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. */
}
}