[Bf-blender-cvs] [4bdb87c] ui-preview-buttons: Some cleanup...

Bastien Montagne noreply at git.blender.org
Tue Apr 21 17:56:42 CEST 2015


Commit: 4bdb87c15d827a84f832c562d1d7cd322d468faf
Author: Bastien Montagne
Date:   Tue Apr 21 17:56:25 2015 +0200
Branches: ui-preview-buttons
https://developer.blender.org/rB4bdb87c15d827a84f832c562d1d7cd322d468faf

Some cleanup...

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

M	source/blender/blenkernel/intern/icons.c
M	source/blender/editors/interface/interface_icons.c
M	source/blender/makesdna/DNA_ID.h
M	source/blender/makesrna/intern/rna_main_api.c

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

diff --git a/source/blender/blenkernel/intern/icons.c b/source/blender/blenkernel/intern/icons.c
index 75a1f61..857fd1d 100644
--- a/source/blender/blenkernel/intern/icons.c
+++ b/source/blender/blenkernel/intern/icons.c
@@ -459,7 +459,7 @@ void BKE_icon_id_delete(struct ID *id)
 }
 
 /**
- * Remove icon and free data (including preview if this is a 'preview icon').
+ * Remove icon and free data.
  */
 void BKE_icon_delete(int icon_id)
 {
@@ -473,6 +473,9 @@ void BKE_icon_delete(int icon_id)
 		if (icon->type) {
 			((ID *)(icon->obj))->icon_id = 0;
 		}
+		else {
+			((PreviewImage *)(icon->obj))->icon_id = 0;
+		}
 		icon_free(icon);
 	}
 }
diff --git a/source/blender/editors/interface/interface_icons.c b/source/blender/editors/interface/interface_icons.c
index d63df03..fb5960f 100644
--- a/source/blender/editors/interface/interface_icons.c
+++ b/source/blender/editors/interface/interface_icons.c
@@ -1173,7 +1173,7 @@ static void icon_draw_size(float x, float y, int icon_id, float aspect, float al
 static void ui_id_preview_image_render_size(
         const bContext *C, Scene *scene, ID *id, PreviewImage *pi, int size, const bool use_job)
 {
-	if ((pi->flag[size] & CHANGED || !pi->rect[size])) { /* changed only ever set by dynamic icons */
+	if (((pi->flag[size] & CHANGED) || !pi->rect[size])) { /* changed only ever set by dynamic icons */
 		/* create the rect if necessary */
 		icon_set_image(C, scene, id, pi, size, use_job);
 
@@ -1204,7 +1204,7 @@ static void ui_id_brush_render(const bContext *C, ID *id)
 	for (i = 0; i < NUM_ICON_SIZES; i++) {
 		/* check if rect needs to be created; changed
 		 * only set by dynamic icons */
-		if ((pi->flag[i] & CHANGED || !pi->rect[i])) {
+		if (((pi->flag[i] & CHANGED) || !pi->rect[i])) {
 			icon_set_image(C, NULL, id, pi, i, true);
 			pi->flag[i] &= ~CHANGED;
 		}
diff --git a/source/blender/makesdna/DNA_ID.h b/source/blender/makesdna/DNA_ID.h
index 666ebe8..0673d2d 100644
--- a/source/blender/makesdna/DNA_ID.h
+++ b/source/blender/makesdna/DNA_ID.h
@@ -155,9 +155,10 @@ typedef struct Library {
 
 enum eIconSizes {
 	ICON_SIZE_ICON = 0,
-	ICON_SIZE_PREVIEW = 1
+	ICON_SIZE_PREVIEW = 1,
+
+	NUM_ICON_SIZES
 };
-#define NUM_ICON_SIZES (ICON_SIZE_PREVIEW + 1)
 
 /* for PreviewImage->flag */
 enum ePreviewImage_Flag {
@@ -172,7 +173,7 @@ typedef struct PreviewImage {
 	short flag[2];
 	short changed_timestamp[2];
 	int icon_id;  /* Used by previews outside of ID context. */
-	int pad;
+	int pad_i1;
 	unsigned int *rect[2];
 	struct GPUTexture *gputexture[2];
 } PreviewImage;
diff --git a/source/blender/makesrna/intern/rna_main_api.c b/source/blender/makesrna/intern/rna_main_api.c
index 3b8932e..cc026c3 100644
--- a/source/blender/makesrna/intern/rna_main_api.c
+++ b/source/blender/makesrna/intern/rna_main_api.c
@@ -833,7 +833,7 @@ void RNA_api_main(StructRNA *srna)
 		{THB_SOURCE_IMAGE, "IMAGE", 0, "Image", ""},
 		{THB_SOURCE_MOVIE, "MOVIE", 0, "Movie", ""},
 		{THB_SOURCE_BLEND, "BLEND", 0, "Blend File", ""},
-	    {THB_SOURCE_FONT, "FONT", 0, "Font", ""},
+		{THB_SOURCE_FONT, "FONT", 0, "Font", ""},
 		{0, NULL, 0, NULL, NULL}
 	};




More information about the Bf-blender-cvs mailing list