diff options
author | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2018-11-02 18:02:46 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2018-11-02 18:54:07 +0300 |
commit | 3e5483ffe10567731e3e84bb6f9ccc6ba1cdbce8 (patch) | |
tree | 1d29ec0ae82cd66ecf6a0badc8f06c411a04d188 | |
parent | 500ebf7348bbc9307537fa51b1600f18be83d134 (diff) |
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.
-rw-r--r-- | source/blender/depsgraph/intern/eval/deg_eval_flush.cc | 10 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_material.c | 20 |
2 files changed, 8 insertions, 22 deletions
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); } |