Fix 48831, Step II: UI icon code was not able to update/generate 'auto ID icon' from non-ID icon draw code.

Now using generic icon rendering system in that case too, instead of custom code
which was only handling 'deferred' custom file-loaded icons.
This commit is contained in:
Bastien Montagne 2016-07-12 21:08:38 +02:00
parent 51812fb502
commit eb04908ccd
Notes: blender-bot 2023-02-14 08:10:06 +01:00
Referenced by issue #48891, Mask Map Mode Properties is not set correctly via the bpy API
Referenced by issue #48860, Christensen-Burley SSS glitch with Spatial Splits.
Referenced by issue #48838, tiling sculpt problem with custom brush
1 changed files with 13 additions and 13 deletions

View File

@ -1061,6 +1061,9 @@ static void icon_create_rect(struct PreviewImage *prv_img, enum eIconSizes size)
}
}
static void ui_id_preview_image_render_size(
const bContext *C, Scene *scene, ID *id, PreviewImage *pi, int size, const bool use_job);
void ui_icon_ensure_deferred(const bContext *C, const int icon_id, const bool big)
{
Icon *icon = BKE_icon_get(icon_id);
@ -1076,22 +1079,19 @@ void ui_icon_ensure_deferred(const bContext *C, const int icon_id, const bool bi
}
if (di) {
if (di->type == ICON_TYPE_PREVIEW) {
PreviewImage *prv = (icon->type != 0) ? BKE_previewimg_id_ensure((ID *)icon->obj) : icon->obj;
switch (di->type) {
case ICON_TYPE_PREVIEW:
{
ID *id = (icon->type != 0) ? icon->obj : NULL;
PreviewImage *prv = id ? BKE_previewimg_id_ensure(id) : icon->obj;
if (prv) {
const int size = big ? ICON_SIZE_PREVIEW : ICON_SIZE_ICON;
if (prv) {
const int size = big ? ICON_SIZE_PREVIEW : ICON_SIZE_ICON;
if (!prv->use_deferred || prv->rect[size] || (prv->flag[size] & PRV_USER_EDITED)) {
return;
if (id || prv->use_deferred) {
ui_id_preview_image_render_size(C, NULL, id, prv, size, true);
}
}
icon_create_rect(prv, size);
/* Always using job (background) version. */
ED_preview_icon_job(C, prv, NULL, prv->rect[size], prv->w[size], prv->h[size]);
prv->flag[size] &= ~PRV_CHANGED;
}
}
}