[Bf-blender-cvs] [eb04908] master: Fix 48831, Step II: UI icon code was not able to update/generate 'auto ID icon' from non-ID icon draw code.

Bastien Montagne noreply at git.blender.org
Tue Jul 12 21:14:20 CEST 2016


Commit: eb04908ccdf0cafbae292c736543bc089ea10f02
Author: Bastien Montagne
Date:   Tue Jul 12 21:08:38 2016 +0200
Branches: master
https://developer.blender.org/rBeb04908ccdf0cafbae292c736543bc089ea10f02

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.

===================================================================

M	source/blender/editors/interface/interface_icons.c

===================================================================

diff --git a/source/blender/editors/interface/interface_icons.c b/source/blender/editors/interface/interface_icons.c
index e00d8cf..80481c9 100644
--- a/source/blender/editors/interface/interface_icons.c
+++ b/source/blender/editors/interface/interface_icons.c
@@ -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;
-
-				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;
+			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 (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;
 				}
 			}
 		}




More information about the Bf-blender-cvs mailing list