[Bf-blender-cvs] [da82269c58b] master: Cleanup: rename Icon.type -> id_type

Campbell Barton noreply at git.blender.org
Thu Apr 19 12:53:08 CEST 2018


Commit: da82269c58bd7ec1c0ebcb5e1433c731120ec389
Author: Campbell Barton
Date:   Thu Apr 19 12:52:32 2018 +0200
Branches: master
https://developer.blender.org/rBda82269c58bd7ec1c0ebcb5e1433c731120ec389

Cleanup: rename Icon.type -> id_type

Confusing when adding non-id icons.

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

M	source/blender/blenkernel/BKE_icons.h
M	source/blender/blenkernel/intern/icons.c
M	source/blender/editors/interface/interface_icons.c

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

diff --git a/source/blender/blenkernel/BKE_icons.h b/source/blender/blenkernel/BKE_icons.h
index c3f5d7bf7c2..686dba21283 100644
--- a/source/blender/blenkernel/BKE_icons.h
+++ b/source/blender/blenkernel/BKE_icons.h
@@ -39,7 +39,8 @@ typedef void (*DrawInfoFreeFP)(void *drawinfo);
 struct Icon {
 	void *drawinfo;
 	void *obj;
-	short type;
+	/** #ID_Type or 0 when not used for ID preview. */
+	short id_type;
 	DrawInfoFreeFP drawinfo_free;
 };
 
diff --git a/source/blender/blenkernel/intern/icons.c b/source/blender/blenkernel/intern/icons.c
index 6aa00b2c97d..3ac8abd55f6 100644
--- a/source/blender/blenkernel/intern/icons.c
+++ b/source/blender/blenkernel/intern/icons.c
@@ -475,7 +475,7 @@ void BKE_icon_changed(const int icon_id)
 	
 	if (icon) {
 		/* We *only* expect ID-tied icons here, not non-ID icon/preview! */
-		BLI_assert(icon->type != 0);
+		BLI_assert(icon->id_type != 0);
 
 		/* 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. */
@@ -501,7 +501,7 @@ static int icon_id_ensure_create_icon(struct ID *id)
 	new_icon = MEM_mallocN(sizeof(Icon), __func__);
 
 	new_icon->obj = id;
-	new_icon->type = GS(id->name);
+	new_icon->id_type = GS(id->name);
 
 	/* next two lines make sure image gets created */
 	new_icon->drawinfo = NULL;
@@ -577,7 +577,7 @@ int BKE_icon_preview_ensure(ID *id, PreviewImage *preview)
 	new_icon = MEM_mallocN(sizeof(Icon), __func__);
 
 	new_icon->obj = preview;
-	new_icon->type = 0;  /* Special, tags as non-ID icon/preview. */
+	new_icon->id_type = 0;  /* Special, tags as non-ID icon/preview. */
 
 	/* next two lines make sure image gets created */
 	new_icon->drawinfo = NULL;
@@ -654,7 +654,7 @@ void BKE_icon_delete(const int icon_id)
 	icon = BLI_ghash_popkey(gIcons, SET_INT_IN_POINTER(icon_id), NULL);
 
 	if (icon) {
-		if (icon->type) {
+		if (icon->id_type != 0) {
 			((ID *)(icon->obj))->icon_id = 0;
 		}
 		else {
diff --git a/source/blender/editors/interface/interface_icons.c b/source/blender/editors/interface/interface_icons.c
index 62244979c12..ed57412c05c 100644
--- a/source/blender/editors/interface/interface_icons.c
+++ b/source/blender/editors/interface/interface_icons.c
@@ -139,7 +139,7 @@ static DrawInfo *def_internal_icon(ImBuf *bbuf, int icon_id, int xofs, int yofs,
 	new_icon = MEM_callocN(sizeof(Icon), "texicon");
 
 	new_icon->obj = NULL; /* icon is not for library object */
-	new_icon->type = 0;
+	new_icon->id_type = 0;
 
 	di = MEM_callocN(sizeof(DrawInfo), "drawinfo");
 	di->type = type;
@@ -191,7 +191,7 @@ static void def_internal_vicon(int icon_id, VectorDrawFunc drawFunc)
 	new_icon = MEM_callocN(sizeof(Icon), "texicon");
 
 	new_icon->obj = NULL; /* icon is not for library object */
-	new_icon->type = 0;
+	new_icon->id_type = 0;
 
 	di = MEM_callocN(sizeof(DrawInfo), "drawinfo");
 	di->type = ICON_TYPE_VECTOR;
@@ -849,7 +849,7 @@ void ui_icon_ensure_deferred(const bContext *C, const int icon_id, const bool bi
 			switch (di->type) {
 				case ICON_TYPE_PREVIEW:
 				{
-					ID *id = (icon->type != 0) ? icon->obj : NULL;
+					ID *id = (icon->id_type != 0) ? icon->obj : NULL;
 					PreviewImage *prv = id ? BKE_previewimg_id_ensure(id) : icon->obj;
 
 					if (prv) {
@@ -905,7 +905,7 @@ PreviewImage *UI_icon_to_preview(int icon_id)
 		DrawInfo *di = (DrawInfo *)icon->drawinfo;
 		if (di) {
 			if (di->type == ICON_TYPE_PREVIEW) {
-				PreviewImage *prv = (icon->type != 0) ? BKE_previewimg_id_ensure((ID *)icon->obj) : icon->obj;
+				PreviewImage *prv = (icon->id_type != 0) ? BKE_previewimg_id_ensure((ID *)icon->obj) : icon->obj;
 
 				if (prv) {
 					return BKE_previewimg_copy(prv);
@@ -1124,7 +1124,7 @@ static void icon_draw_size(
 		glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
 	}
 	else if (di->type == ICON_TYPE_PREVIEW) {
-		PreviewImage *pi = (icon->type != 0) ? BKE_previewimg_id_ensure((ID *)icon->obj) : icon->obj;
+		PreviewImage *pi = (icon->id_type != 0) ? BKE_previewimg_id_ensure((ID *)icon->obj) : icon->obj;
 
 		if (pi) {
 			/* no create icon on this level in code */



More information about the Bf-blender-cvs mailing list