diff options
author | Antonioya <blendergit@gmail.com> | 2018-08-18 17:24:18 +0300 |
---|---|---|
committer | Antonioya <blendergit@gmail.com> | 2018-08-18 17:24:18 +0300 |
commit | 20b30b6bee5514393f0aace4314a9ed1749b33d5 (patch) | |
tree | 587908dbef60b534ce9130b8c2b01b8a13614f2c /source | |
parent | 353e691ff96155bcab879a74663b04ff69a4c9b4 (diff) |
GP: Reduce updates of material previews
If there is a update in progress, don't update again.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/makesrna/intern/rna_material.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/source/blender/makesrna/intern/rna_material.c b/source/blender/makesrna/intern/rna_material.c index 44d14975ab0..f99636de991 100644 --- a/source/blender/makesrna/intern/rna_material.c +++ b/source/blender/makesrna/intern/rna_material.c @@ -115,9 +115,20 @@ static void rna_MaterialGpencil_update(Main *bmain, Scene *scene, PointerRNA *pt /* update previews (icon and thumbnail) */ if (preview != NULL) { - preview->flag[ICON_SIZE_ICON] |= PRV_CHANGED; - preview->flag[ICON_SIZE_PREVIEW] |= PRV_CHANGED; - WM_main_add_notifier(NC_MATERIAL | ND_SHADING_PREVIEW, ma); + 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); } |