Cleanup: rename Icon.type -> id_type
Confusing when adding non-id icons.
This commit is contained in:
parent
63225d7c8b
commit
da82269c58
@ -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;
|
||||
};
|
||||
|
||||
|
@ -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 {
|
||||
|
@ -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 */
|
||||
|
Loading…
Reference in New Issue
Block a user