[Bf-blender-cvs] [d46c9b8] asset-experiments: Merge branch 'master' into asset-experiments
Bastien Montagne
noreply at git.blender.org
Wed Jan 7 12:05:41 CET 2015
Commit: d46c9b876c99e0cc3e89d534f7c9c8f4c932064e
Author: Bastien Montagne
Date: Wed Jan 7 12:05:23 2015 +0100
Branches: asset-experiments
https://developer.blender.org/rBd46c9b876c99e0cc3e89d534f7c9c8f4c932064e
Merge branch 'master' into asset-experiments
Conflicts:
source/blender/editors/space_file/filelist.c
===================================================================
===================================================================
diff --cc source/blender/editors/interface/interface.c
index c80d474,0b1d1c8..599d104
--- a/source/blender/editors/interface/interface.c
+++ b/source/blender/editors/interface/interface.c
@@@ -3071,28 -3083,8 +3103,22 @@@ static uiBut *ui_def_but(uiBlock *block
but->retval = retval;
slen = strlen(str);
- if (slen >= UI_MAX_NAME_STR) {
- but->str = MEM_mallocN(slen + 1, "ui_def_but str");
- }
- else {
- but->str = but->strdata;
- }
- memcpy(but->str, str, slen + 1);
+ ui_but_string_set_internal(but, str, slen);
+ if (tip) {
+ slen = strlen(tip);
+ if (slen >= UI_MAX_NAME_STR) {
+ but->tip = MEM_mallocN(slen + 1, "ui_def_but tip");
+ }
+ else {
+ but->tip = but->tipdata;
+ }
+ memcpy(but->tip, tip, slen + 1);
+ }
+ else {
+ but->tip = NULL;
+ }
+
but->rect.xmin = x;
but->rect.ymin = y;
but->rect.xmax = but->rect.xmin + width;
diff --cc source/blender/editors/space_file/filelist.c
index 9490028,bcef081..4cf13ed
--- a/source/blender/editors/space_file/filelist.c
+++ b/source/blender/editors/space_file/filelist.c
@@@ -337,41 -308,30 +333,37 @@@ static int compare_direntry_generic(con
if (strcmp(entry2->relname, ".") == 0) return (1);
if (strcmp(entry1->relname, "..") == 0) return (-1);
if (strcmp(entry2->relname, "..") == 0) return (1);
+
+ return 0;
+ }
+
+ static int compare_name(const void *a1, const void *a2)
+ {
+ const struct direntry *entry1 = a1, *entry2 = a2;
++ char dir1[FILE_MAX_LIBEXTRA], dir2[FILE_MAX_LIBEXTRA];
++ char *name1, *name2;
+ int ret;
+
+ if ((ret = compare_direntry_generic(entry1, entry2))) {
+ return ret;
+ }
- return (BLI_natstrcmp(entry1->relname, entry2->relname));
+ name1 = fileentry_uiname(entry1, dir1);
+ name2 = fileentry_uiname(entry2, dir2);
+
+ return BLI_natstrcmp(name1, name2);
}
static int compare_date(const void *a1, const void *a2)
{
const struct direntry *entry1 = a1, *entry2 = a2;
+ char dir1[FILE_MAX_LIBEXTRA], dir2[FILE_MAX_LIBEXTRA];
+ char *name1, *name2;
+ int ret;
-
+
- /* type is equal to stat.st_mode */
-
- if (compare_is_directory(entry1)) {
- if (compare_is_directory(entry2) == 0) return (-1);
- }
- else {
- if (compare_is_directory(entry2)) return (1);
- }
- if (S_ISREG(entry1->type)) {
- if (S_ISREG(entry2->type) == 0) return (-1);
+ if ((ret = compare_direntry_generic(entry1, entry2))) {
+ return ret;
}
- else {
- if (S_ISREG(entry2->type)) return (1);
- }
- if ((entry1->type & S_IFMT) < (entry2->type & S_IFMT)) return (-1);
- if ((entry1->type & S_IFMT) > (entry2->type & S_IFMT)) return (1);
-
- /* make sure "." and ".." are always first */
- if (strcmp(entry1->relname, ".") == 0) return (-1);
- if (strcmp(entry2->relname, ".") == 0) return (1);
- if (strcmp(entry1->relname, "..") == 0) return (-1);
- if (strcmp(entry2->relname, "..") == 0) return (1);
if (entry1->s.st_mtime < entry2->s.st_mtime) return 1;
if (entry1->s.st_mtime > entry2->s.st_mtime) return -1;
@@@ -385,31 -342,11 +377,13 @@@
static int compare_size(const void *a1, const void *a2)
{
const struct direntry *entry1 = a1, *entry2 = a2;
+ char dir1[FILE_MAX_LIBEXTRA], dir2[FILE_MAX_LIBEXTRA];
+ char *name1, *name2;
+ int ret;
- /* type is equal to stat.st_mode */
-
- if (compare_is_directory(entry1)) {
- if (compare_is_directory(entry2) == 0) return (-1);
+ if ((ret = compare_direntry_generic(entry1, entry2))) {
+ return ret;
}
- else {
- if (compare_is_directory(entry2)) return (1);
- }
- if (S_ISREG(entry1->type)) {
- if (S_ISREG(entry2->type) == 0) return (-1);
- }
- else {
- if (S_ISREG(entry2->type)) return (1);
- }
- if ((entry1->type & S_IFMT) < (entry2->type & S_IFMT)) return (-1);
- if ((entry1->type & S_IFMT) > (entry2->type & S_IFMT)) return (1);
-
- /* make sure "." and ".." are always first */
- if (strcmp(entry1->relname, ".") == 0) return (-1);
- if (strcmp(entry2->relname, ".") == 0) return (1);
- if (strcmp(entry1->relname, "..") == 0) return (-1);
- if (strcmp(entry2->relname, "..") == 0) return (1);
if (entry1->s.st_size < entry2->s.st_size) return 1;
if (entry1->s.st_size > entry2->s.st_size) return -1;
@@@ -433,58 -371,7 +412,34 @@@ static int compare_extension(const voi
if (!sufix1) sufix1 = nil;
if (!sufix2) sufix2 = nil;
- /* type is equal to stat.st_mode */
-
- if (compare_is_directory(entry1)) {
- if (compare_is_directory(entry2) == 0) return (-1);
- }
- else {
- if (compare_is_directory(entry2)) return (1);
- }
-
- if (S_ISREG(entry1->type)) {
- if (S_ISREG(entry2->type) == 0) return (-1);
- }
- else {
- if (S_ISREG(entry2->type)) return (1);
- }
- if ((entry1->type & S_IFMT) < (entry2->type & S_IFMT)) return (-1);
- if ((entry1->type & S_IFMT) > (entry2->type & S_IFMT)) return (1);
-
- /* make sure "." and ".." are always first */
- if (strcmp(entry1->relname, ".") == 0) return (-1);
- if (strcmp(entry2->relname, ".") == 0) return (1);
- if (strcmp(entry1->relname, "..") == 0) return (-1);
- if (strcmp(entry2->relname, "..") == 0) return (1);
-
- return (BLI_strcasecmp(sufix1, sufix2));
+ if ((entry1->flags & FILE_TYPE_BLENDERLIB) && !(entry2->flags & FILE_TYPE_BLENDERLIB)) return -1;
+ if (!(entry1->flags & FILE_TYPE_BLENDERLIB) && (entry2->flags & FILE_TYPE_BLENDERLIB)) return 1;
+ if ((entry1->flags & FILE_TYPE_BLENDERLIB) && (entry2->flags & FILE_TYPE_BLENDERLIB)) {
+ char lib1[FILE_MAX_LIBEXTRA], lib2[FILE_MAX_LIBEXTRA];
+ char *group1, *group2, *name1, *name2;
+ int grp_comp;
+
+ BLO_library_path_explode(entry1->path, lib1, &group1, &name1);
+ BLO_library_path_explode(entry2->path, lib2, &group2, &name2);
+
+ BLI_assert(group1);
+ BLI_assert(group2);
+
+ grp_comp = strcmp(group1, group2);
+ if (grp_comp != 0 || (!name1 && !name2)) {
+ return grp_comp;
+ }
+
+ if (!name1) {
+ return -1;
+ }
+ if (!name2) {
+ return 1;
+ }
+ return BLI_strcasecmp(name1, name2);
+ }
+
+ return BLI_strcasecmp(sufix1, sufix2);
}
bool filelist_need_sorting(struct FileList *filelist)
More information about the Bf-blender-cvs
mailing list