[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [55153] trunk/blender/source/blender: code cleanup:
Campbell Barton
ideasman42 at gmail.com
Sun Mar 10 07:40:20 CET 2013
Revision: 55153
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=55153
Author: campbellbarton
Date: 2013-03-10 06:40:19 +0000 (Sun, 10 Mar 2013)
Log Message:
-----------
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.
Modified Paths:
--------------
trunk/blender/source/blender/blenkernel/BKE_library.h
trunk/blender/source/blender/blenkernel/intern/library.c
trunk/blender/source/blender/editors/space_outliner/outliner_draw.c
trunk/blender/source/blender/makesrna/intern/rna_ID.c
Modified: trunk/blender/source/blender/blenkernel/BKE_library.h
===================================================================
--- trunk/blender/source/blender/blenkernel/BKE_library.h 2013-03-10 06:18:03 UTC (rev 55152)
+++ trunk/blender/source/blender/blenkernel/BKE_library.h 2013-03-10 06:40:19 UTC (rev 55153)
@@ -98,7 +98,6 @@
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__
Modified: trunk/blender/source/blender/blenkernel/intern/library.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/library.c 2013-03-10 06:18:03 UTC (rev 55152)
+++ trunk/blender/source/blender/blenkernel/intern/library.c 2013-03-10 06:40:19 UTC (rev 55153)
@@ -1510,7 +1510,7 @@
* 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 @@
}
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 @@
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)
Modified: trunk/blender/source/blender/editors/space_outliner/outliner_draw.c
===================================================================
--- trunk/blender/source/blender/editors/space_outliner/outliner_draw.c 2013-03-10 06:18:03 UTC (rev 55152)
+++ trunk/blender/source/blender/editors/space_outliner/outliner_draw.c 2013-03-10 06:40:19 UTC (rev 55153)
@@ -337,7 +337,7 @@
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 @@
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:
{
Modified: trunk/blender/source/blender/makesrna/intern/rna_ID.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_ID.c 2013-03-10 06:18:03 UTC (rev 55152)
+++ trunk/blender/source/blender/makesrna/intern/rna_ID.c 2013-03-10 06:40:19 UTC (rev 55153)
@@ -103,7 +103,7 @@
{
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)
More information about the Bf-blender-cvs
mailing list