diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-03-10 10:40:19 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-03-10 10:40:19 +0400 |
commit | 02ecd9f84279acab5d5fdc26c3db467164b6542d (patch) | |
tree | b858d000d0cdbe57ac0191acb04b3ad4a77c683e /source | |
parent | f9f707033665dc737f1011e82406a12fafa78326 (diff) |
code cleanup:
- remove unused block from before blender was opensourced (BKE_library_make_local)
noticed by Lawrence D'Oliveiro (ldo)
- remove text_idbutton() unused function.
- test_idbutton(name) was taking (name + 2), then checking 2 bytes before the pointer, this is error prone so better just take the name including the ID prefix.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenkernel/BKE_library.h | 1 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/library.c | 43 | ||||
-rw-r--r-- | source/blender/editors/space_outliner/outliner_draw.c | 4 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_ID.c | 2 |
4 files changed, 7 insertions, 43 deletions
diff --git a/source/blender/blenkernel/BKE_library.h b/source/blender/blenkernel/BKE_library.h index 33e1711f01a..816fb2d1b35 100644 --- a/source/blender/blenkernel/BKE_library.h +++ b/source/blender/blenkernel/BKE_library.h @@ -98,7 +98,6 @@ void tag_main(struct Main *mainvar, const short tag); void rename_id(struct ID *id, const char *name); void name_uiprefix_id(char *name, const struct ID *id); void test_idbutton(char *name); -void text_idbutton(const struct ID *id, char *text); void BKE_library_make_local(struct Main *bmain, struct Library *lib, bool untagged_only); struct ID *BKE_libblock_find_name(const short type, const char *name) #ifdef __GNUC__ diff --git a/source/blender/blenkernel/intern/library.c b/source/blender/blenkernel/intern/library.c index a251a62df97..4038dd2d165 100644 --- a/source/blender/blenkernel/intern/library.c +++ b/source/blender/blenkernel/intern/library.c @@ -1510,7 +1510,7 @@ void tag_main(struct Main *mainvar, const short tag) * bmain is almost certainly G.main */ void BKE_library_make_local(Main *bmain, Library *lib, bool untagged_only) { - ListBase *lbarray[MAX_LIBARRAY], tempbase = {NULL, NULL}; + ListBase *lbarray[MAX_LIBARRAY]; ID *id, *idn; int a; @@ -1545,17 +1545,8 @@ void BKE_library_make_local(Main *bmain, Library *lib, bool untagged_only) } id = idn; } - - /* patch2: make it aphabetically */ - /* FIXME: but nothing is ever put into tempbase! */ - while ( (id = tempbase.first) ) { - BLI_remlink(&tempbase, id); - BLI_addtail(lbarray[a], id); - new_id(lbarray[a], id, NULL); - } } - /* patch 3: make sure library data isn't indirect falsely... */ a = set_listbasepointers(bmain, lbarray); while (a--) { for (id = lbarray[a]->first; id; id = id->next) @@ -1571,44 +1562,18 @@ void test_idbutton(char *name) ID *idtest; - lb = which_libbase(G.main, GS(name - 2) ); + lb = which_libbase(G.main, GS(name) ); if (lb == NULL) return; /* search for id */ - idtest = BLI_findstring(lb, name, offsetof(ID, name) + 2); + idtest = BLI_findstring(lb, name + 2, offsetof(ID, name) + 2); - if (idtest && !new_id(lb, idtest, name)) { + if (idtest && !new_id(lb, idtest, name + 2)) { id_sort_by_name(lb, idtest); } } /** - * Puts into *text a descriptive block type prefix to be displayed before the block name. - */ -/* Not actually used anywhere any more. */ -void text_idbutton(const struct ID *id, char *text) -{ - if (id) { - if (GS(id->name) == ID_SCE) - strcpy(text, "SCE: "); - else if (GS(id->name) == ID_SCR) - strcpy(text, "SCR: "); - else if (GS(id->name) == ID_MA && ((Material *)id)->use_nodes) - strcpy(text, "NT: "); - else { - text[0] = id->name[0]; - text[1] = id->name[1]; - text[2] = ':'; - text[3] = ' '; - text[4] = 0; - } - } - else { - text[0] = '\0'; - } -} - -/** * Sets the name of a block to name, suitably adjusted for uniqueness. */ void rename_id(ID *id, const char *name) diff --git a/source/blender/editors/space_outliner/outliner_draw.c b/source/blender/editors/space_outliner/outliner_draw.c index 4819d3b575f..1700bf0c403 100644 --- a/source/blender/editors/space_outliner/outliner_draw.c +++ b/source/blender/editors/space_outliner/outliner_draw.c @@ -337,7 +337,7 @@ static void namebutton_cb(bContext *C, void *tsep, char *oldname) TreeElement *te = outliner_find_tse(soops, tselem); if (tselem->type == 0) { - test_idbutton(tselem->id->name + 2); // library.c, unique name and alpha sort + test_idbutton(tselem->id->name); // library.c, unique name and alpha sort switch (GS(tselem->id->name)) { case ID_MA: @@ -372,7 +372,7 @@ static void namebutton_cb(bContext *C, void *tsep, char *oldname) defgroup_unique_name(te->directdata, (Object *)tselem->id); // id = object break; case TSE_NLA_ACTION: - test_idbutton(tselem->id->name + 2); + test_idbutton(tselem->id->name); break; case TSE_EBONE: { diff --git a/source/blender/makesrna/intern/rna_ID.c b/source/blender/makesrna/intern/rna_ID.c index 49c0c356461..8be468ba829 100644 --- a/source/blender/makesrna/intern/rna_ID.c +++ b/source/blender/makesrna/intern/rna_ID.c @@ -103,7 +103,7 @@ void rna_ID_name_set(PointerRNA *ptr, const char *value) { ID *id = (ID *)ptr->data; BLI_strncpy_utf8(id->name + 2, value, sizeof(id->name) - 2); - test_idbutton(id->name + 2); + test_idbutton(id->name); } static int rna_ID_name_editable(PointerRNA *ptr) |