[Bf-blender-cvs] [3e5483ffe10] blender2.8: Fix T57316: material preview icons not updating.
Brecht Van Lommel
noreply at git.blender.org
Fri Nov 2 16:54:36 CET 2018
Commit: 3e5483ffe10567731e3e84bb6f9ccc6ba1cdbce8
Author: Brecht Van Lommel
Date: Fri Nov 2 16:02:46 2018 +0100
Branches: blender2.8
https://developer.blender.org/rB3e5483ffe10567731e3e84bb6f9ccc6ba1cdbce8
Fix T57316: material preview icons not updating.
The editors update callback was getting the COW datablock, it should be the
original where the preview icons are stored.
===================================================================
M source/blender/depsgraph/intern/eval/deg_eval_flush.cc
M source/blender/makesrna/intern/rna_material.c
===================================================================
diff --git a/source/blender/depsgraph/intern/eval/deg_eval_flush.cc b/source/blender/depsgraph/intern/eval/deg_eval_flush.cc
index 18806f389ca..d84f1be4ee0 100644
--- a/source/blender/depsgraph/intern/eval/deg_eval_flush.cc
+++ b/source/blender/depsgraph/intern/eval/deg_eval_flush.cc
@@ -262,9 +262,15 @@ void flush_editors_id_update(Main *bmain,
DEG_DEBUG_PRINTF((::Depsgraph *)graph,
EVAL, "Accumulated recalc bits for %s: %u\n",
id_orig->name, (unsigned int)id_cow->recalc);
- /* Inform editors. */
+
+ /* Inform editors. Only if the datablock is being evaluated a second
+ * time, to distinguish between user edits and initial evaluation when
+ * the datablock becomes visible.
+ *
+ * TODO: image datablocks do not use COW, so might not be detected
+ * correctly. */
if (deg_copy_on_write_is_expanded(id_cow)) {
- deg_editors_id_update(update_ctx, id_cow);
+ deg_editors_id_update(update_ctx, id_orig);
/* ID may need to get its auto-override operations refreshed. */
if (ID_IS_STATIC_OVERRIDE_AUTO(id_orig)) {
id_orig->tag |= LIB_TAG_OVERRIDESTATIC_AUTOREFRESH;
diff --git a/source/blender/makesrna/intern/rna_material.c b/source/blender/makesrna/intern/rna_material.c
index 42ec5871109..2d38a99af63 100644
--- a/source/blender/makesrna/intern/rna_material.c
+++ b/source/blender/makesrna/intern/rna_material.c
@@ -114,27 +114,8 @@ static void rna_Material_update_previews(Main *UNUSED(bmain), Scene *UNUSED(scen
static void rna_MaterialGpencil_update(Main *bmain, Scene *scene, PointerRNA *ptr)
{
Material *ma = ptr->id.data;
- PreviewImage *preview = ma->preview;
rna_Material_update(bmain, scene, ptr);
-
- /* update previews (icon and thumbnail) */
- if (preview != NULL) {
- bool changed = false;
- if ((preview->flag[ICON_SIZE_ICON] & PRV_CHANGED) == 0) {
- preview->flag[ICON_SIZE_ICON] |= PRV_CHANGED;
- changed = true;
- }
-
- if ((preview->flag[ICON_SIZE_PREVIEW] & PRV_CHANGED) == 0) {
- preview->flag[ICON_SIZE_PREVIEW] |= PRV_CHANGED;
- changed = true;
- }
-
- if (changed) {
- WM_main_add_notifier(NC_MATERIAL | ND_SHADING_PREVIEW, ma);
- }
- }
WM_main_add_notifier(NC_GPENCIL | ND_DATA, ma);
}
@@ -143,7 +124,6 @@ static void rna_MaterialGpencil_nopreview_update(Main *bmain, Scene *scene, Poin
Material *ma = ptr->id.data;
rna_Material_update(bmain, scene, ptr);
-
WM_main_add_notifier(NC_GPENCIL | ND_DATA, ma);
}
More information about the Bf-blender-cvs
mailing list