diff options
author | Campbell Barton <ideasman42@gmail.com> | 2007-04-06 14:08:48 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2007-04-06 14:08:48 +0400 |
commit | 6a684948faa1287e0dac171f6efe1fbcd35763bf (patch) | |
tree | fe83558dbe9d347b9c8776b3498c7322a29ccc99 /source | |
parent | 29c07081455c3b32f13f13c5c63da59c7055e136 (diff) |
All data in blender's libBlock linked lists are supposed to be sorted but in some cases wernt.
The problem was that new ID's that didnt have any naming collisions whould not run sort_alpha_id, which lead to most images not being sorted.
Simple fix is to make sort_alpha_id run on all new ID's. but we need to make sure all data is kept sorted. maybe a check when running in debug mode would help.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenkernel/intern/library.c | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/source/blender/blenkernel/intern/library.c b/source/blender/blenkernel/intern/library.c index 2a10d44d9e6..803059ee0b4 100644 --- a/source/blender/blenkernel/intern/library.c +++ b/source/blender/blenkernel/intern/library.c @@ -341,7 +341,7 @@ static ID *alloc_libblock_notest(short type) return id; } -// used everywhere in blenkernel and text.c +/* used everywhere in blenkernel and text.c */ void *alloc_libblock(ListBase *lb, short type, const char *name) { ID *id= NULL; @@ -365,7 +365,7 @@ void *alloc_libblock(ListBase *lb, short type, const char *name) /* from blendef: */ #define GS(a) (*((short *)(a))) -// used everywhere in blenkernel and text.c +/* used everywhere in blenkernel and text.c */ void *copy_libblock(void *rt) { ID *idn, *id; @@ -396,7 +396,7 @@ static void free_library(Library *lib) /* no freeing needed for libraries yet */ } -// used in headerbuttons.c image.c mesh.c screen.c sound.c and library.c +/* used in headerbuttons.c image.c mesh.c screen.c sound.c and library.c */ void free_libblock(ListBase *lb, void *idv) { ID *id= idv; @@ -672,8 +672,8 @@ static void IPOnames_to_dyn_pupstring(DynStr *pupds, ListBase *lb, ID *link, sho } } -// used by headerbuttons.c buttons.c editobject.c editseq.c -// if nr==NULL no MAX_IDPUP, this for non-header browsing +/* 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(char **str, char *title, char *extraops, ListBase *lb, ID *link, short *nr) { DynStr *pupds= BLI_dynstr_new(); @@ -718,7 +718,7 @@ void IMAnames_to_pupstring(char **str, char *title, char *extraops, ListBase *lb } -// only used by headerbuttons.c +/* only used by headerbuttons.c */ void IPOnames_to_pupstring(char **str, char *title, char *extraops, ListBase *lb, ID *link, short *nr, int blocktype) { DynStr *pupds= BLI_dynstr_new(); @@ -740,7 +740,7 @@ void IPOnames_to_pupstring(char **str, char *title, char *extraops, ListBase *lb BLI_dynstr_free(pupds); } -// used by buttons.c library.c mball.c +/* used by buttons.c library.c mball.c */ void splitIDname(char *name, char *left, int *nr) { int a; @@ -904,13 +904,19 @@ int new_id(ListBase *lb, ID *id, const char *tname) result = check_for_dupid( lb, id, name ); strcpy( id->name+2, name ); - if( result ) - sort_alpha_id(lb, id); - + /* This was in 2.43 and previous releases + * however all data in blender should be sorted, not just duplicate names + * sorting should not hurt, but noting just incause it alters the way other + * functions work, so sort every time */ + /* if( result ) + sort_alpha_id(lb, id);*/ + + sort_alpha_id(lb, id); + return result; } -// next to indirect usage in read/writefile also in editobject.c scene.c +/* next to indirect usage in read/writefile also in editobject.c scene.c */ void clear_id_newpoins() { ListBase *lbarray[MAX_LIBARRAY]; |