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:
authorBastien Montagne <montagne29@wanadoo.fr>2018-03-16 19:06:43 +0300
committerBastien Montagne <montagne29@wanadoo.fr>2018-03-16 19:06:43 +0300
commit1a71d5ae85c8080705fc88188b6ef78aad29efdd (patch)
treed4804960a4e45f2ac7f0182efdc6eab855982e6b /source
parent67e2806dcbd3adfc1b691554ff22281a49db680a (diff)
Fix T54310: Assert when enable Brush custom icon.
We had a mix of two issues here actually: * First, Brush are currently using their own sauce for custom previews, this is not great, but moving them to use common ImagePreview system of IDs is a low-priority TODO. For now, they should totally ignore their own ImagePreview. * Second, BKE_icon_changed() would systematically create a PreviewImage for ID types supporting it, which does not really makes sense, this function is merely here to 'tag' previews as outdated. Actual creation of previews is deferred to later, when we actually need them.
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenkernel/intern/icons.c12
-rw-r--r--source/blender/makesrna/intern/rna_brush.c1
2 files changed, 7 insertions, 6 deletions
diff --git a/source/blender/blenkernel/intern/icons.c b/source/blender/blenkernel/intern/icons.c
index 447a68e345a..d56d758d4f0 100644
--- a/source/blender/blenkernel/intern/icons.c
+++ b/source/blender/blenkernel/intern/icons.c
@@ -440,14 +440,16 @@ void BKE_icon_changed(const int icon_id)
icon = BLI_ghash_lookup(gIcons, SET_INT_IN_POINTER(icon_id));
if (icon) {
- PreviewImage *prv = BKE_previewimg_id_ensure((ID *)icon->obj);
+ /* Do not enforce creation of previews for valid ID types using BKE_previewimg_id_ensure() here ,
+ * we only want to ensure *existing* preview images are properly tagged as changed/invalid, that's all. */
+ PreviewImage **p_prv = BKE_previewimg_id_get_p((ID *)icon->obj);
- /* all previews changed */
- if (prv) {
+ /* If we have previews, they all are now invalid changed. */
+ if (p_prv && *p_prv) {
int i;
for (i = 0; i < NUM_ICON_SIZES; ++i) {
- prv->flag[i] |= PRV_CHANGED;
- prv->changed_timestamp[i]++;
+ (*p_prv)->flag[i] |= PRV_CHANGED;
+ (*p_prv)->changed_timestamp[i]++;
}
}
}
diff --git a/source/blender/makesrna/intern/rna_brush.c b/source/blender/makesrna/intern/rna_brush.c
index 6a67e036c5d..1fd17afdc60 100644
--- a/source/blender/makesrna/intern/rna_brush.c
+++ b/source/blender/makesrna/intern/rna_brush.c
@@ -430,7 +430,6 @@ static void rna_Brush_icon_update(Main *UNUSED(bmain), Scene *UNUSED(scene), Poi
br->id.icon_id = 0;
if (br->flag & BRUSH_CUSTOM_ICON) {
- BKE_previewimg_id_ensure(&br->id);
BKE_icon_changed(BKE_icon_id_ensure(&br->id));
}