From 01d9bbaa5ef914b779bc00decd85f9336340db26 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 15 Feb 2014 11:35:40 +1100 Subject: Code cleanup: remove more string encoded menu functions --- source/blender/blenkernel/intern/library.c | 129 ----------------------------- 1 file changed, 129 deletions(-) (limited to 'source/blender/blenkernel/intern/library.c') diff --git a/source/blender/blenkernel/intern/library.c b/source/blender/blenkernel/intern/library.c index 516bcf77ad6..0bd1f97a279 100644 --- a/source/blender/blenkernel/intern/library.c +++ b/source/blender/blenkernel/intern/library.c @@ -1096,135 +1096,6 @@ ID *BKE_libblock_find_name(const short type, const char *name) /* type: "OB return BLI_findstring(lb, name, offsetof(ID, name) + 2); } -#if 0 /* UNUSED */ -#define MAX_IDPUP 60 /* was 24 */ - -static void get_flags_for_id(ID *id, char *buf) -{ - int isfake = id->flag & LIB_FAKEUSER; - int isnode = 0; - /* Writeout the flags for the entry, note there - * is a small hack that writes 5 spaces instead - * of 4 if no flags are displayed... this makes - * things usually line up ok - better would be - * to have that explicit, oh well - zr - */ - - if (GS(id->name) == ID_MA) - isnode = ((Material *)id)->use_nodes; - if (GS(id->name) == ID_TE) - isnode = ((Tex *)id)->use_nodes; - - if (id->us < 0) - strcpy(buf, "-1W "); - else if (!id->lib && !isfake && id->us && !isnode) - strcpy(buf, " "); - else if (isnode) - sprintf(buf, "%c%cN%c ", id->lib ? 'L' : ' ', isfake ? 'F' : ' ', (id->us == 0) ? 'O' : ' '); - else - sprintf(buf, "%c%c%c ", id->lib ? 'L' : ' ', isfake ? 'F' : ' ', (id->us == 0) ? 'O' : ' '); -} - -#define IDPUP_NO_VIEWER 1 - -static void IDnames_to_dyn_pupstring(DynStr *pupds, ListBase *lb, ID *link, short *nr, int hideflag) -{ - int i, nids = BLI_countlist(lb); - - if (nr) *nr = -1; - - if (nr && nids > MAX_IDPUP) { - BLI_dynstr_append(pupds, "DataBrowse %x-2"); - *nr = -2; - } - else { - ID *id; - - for (i = 0, id = lb->first; id; id = id->next, i++) { - char numstr[32]; - - if (nr && id == link) *nr = i + 1; - - if (U.uiflag & USER_HIDE_DOT && id->name[2] == '.') - continue; - if (hideflag & IDPUP_NO_VIEWER) - if (GS(id->name) == ID_IM) - if ( ((Image *)id)->source == IMA_SRC_VIEWER) - continue; - - get_flags_for_id(id, numstr); - - BLI_dynstr_append(pupds, numstr); - BLI_dynstr_append(pupds, id->name + 2); - BLI_snprintf(numstr, sizeof(numstr), "%%x%d", i + 1); - BLI_dynstr_append(pupds, numstr); - - /* icon */ - switch (GS(id->name)) { - case ID_MA: /* fall through */ - case ID_TE: /* fall through */ - case ID_IM: /* fall through */ - case ID_WO: /* fall through */ - case ID_LA: /* fall through */ - BLI_snprintf(numstr, sizeof(numstr), "%%i%d", BKE_icon_getid(id)); - BLI_dynstr_append(pupds, numstr); - break; - default: - break; - } - - if (id->next) - BLI_dynstr_append(pupds, "|"); - } - } -} - -/* used by headerbuttons.c buttons.c editobject.c editseq.c */ -/* if (nr == NULL) no MAX_IDPUP, this for non-header browsing */ -void IDnames_to_pupstring(const char **str, const char *title, const char *extraops, ListBase *lb, ID *link, short *nr) -{ - DynStr *pupds = BLI_dynstr_new(); - - if (title) { - BLI_dynstr_append(pupds, title); - BLI_dynstr_append(pupds, "%t|"); - } - - if (extraops) { - BLI_dynstr_append(pupds, extraops); - if (BLI_dynstr_get_len(pupds)) - BLI_dynstr_append(pupds, "|"); - } - - IDnames_to_dyn_pupstring(pupds, lb, link, nr, 0); - - *str = BLI_dynstr_get_cstring(pupds); - BLI_dynstr_free(pupds); -} - -/* skips viewer images */ -void IMAnames_to_pupstring(const char **str, const char *title, const char *extraops, ListBase *lb, ID *link, short *nr) -{ - DynStr *pupds = BLI_dynstr_new(); - - if (title) { - BLI_dynstr_append(pupds, title); - BLI_dynstr_append(pupds, "%t|"); - } - - if (extraops) { - BLI_dynstr_append(pupds, extraops); - if (BLI_dynstr_get_len(pupds)) - BLI_dynstr_append(pupds, "|"); - } - - IDnames_to_dyn_pupstring(pupds, lb, link, nr, IDPUP_NO_VIEWER); - - *str = BLI_dynstr_get_cstring(pupds); - BLI_dynstr_free(pupds); -} -#endif - void id_sort_by_name(ListBase *lb, ID *id) { ID *idtest; -- cgit v1.2.3