Commit: 3993965bd7a7951e40135ba27c7da2ff80dfd50d
Author: Bastien Montagne
Date:   Sun Jan 4 18:31:23 2015 +0100
Branches: asset-experiments
https://developer.blender.org/rB3993965bd7a7951e40135ba27c7da2ff80dfd50d

Merge branch 'master' into asset-experiments

Conflicts:
        source/blender/editors/space_file/file_draw.c
        source/blender/editors/space_file/filelist.c
        source/blender/editors/space_file/filesel.c
        source/blender/makesdna/DNA_space_types.h
        source/blender/windowmanager/intern/wm_operators.c

===================================================================



===================================================================

diff --cc source/blender/editors/space_file/file_draw.c
index 9ebf2d7,5d0734d..366dec6
--- a/source/blender/editors/space_file/file_draw.c
+++ b/source/blender/editors/space_file/file_draw.c
@@@ -509,11 -539,10 +509,11 @@@ void file_draw_list(const bContext *C, 
                                is_icon = 1;
                        }
                        
-                       file_draw_preview(block, files, i, sx, sy, imb, layout, 
!is_icon && (file->flags & IMAGEFILE), do_drag);
 -                      file_draw_preview(block, file, sx, sy, imb, layout, 
!is_icon && (file->flags & FILE_TYPE_IMAGE), do_drag);
++                      file_draw_preview(block, files, i, sx, sy, imb, layout, 
!is_icon && (file->flags & FILE_TYPE_IMAGE), do_drag);
                }
                else {
 -                      file_draw_icon(block, file->path, sx, sy - (UI_UNIT_Y / 
6), get_file_icon(file), ICON_DEFAULT_WIDTH_SCALE, ICON_DEFAULT_HEIGHT_SCALE, 
do_drag);
 +                      file_draw_icon(block, file->path, sx, sy - (UI_UNIT_Y / 
6), filelist_geticon(files, i),
 +                                     ICON_DEFAULT_WIDTH_SCALE, 
ICON_DEFAULT_HEIGHT_SCALE, do_drag);
                        sx += ICON_DEFAULT_WIDTH_SCALE + 0.2f * UI_UNIT_X;
                }
  
@@@ -546,9 -575,9 +546,9 @@@
                        }
                }
  
-               if (!(file->selflag & EDITING_FILE)) {
+               if (!(file->selflag & FILE_SEL_EDITING)) {
                        int tpos = (FILE_IMGDISPLAY == params->display) ? sy - 
layout->tile_h + layout->textheight : sy;
 -                      file_draw_string(sx + 1, tpos, file->relname, 
(float)textwidth, textheight, align);
 +                      file_draw_string(sx + 1, tpos, name, (float)textwidth, 
textheight, align);
                }
  
                if (params->display == FILE_SHORTDISPLAY) {
diff --cc source/blender/editors/space_file/filelist.c
index 8478f00,f35a207..9490028
--- a/source/blender/editors/space_file/filelist.c
+++ b/source/blender/editors/space_file/filelist.c
@@@ -259,10 -237,8 +259,10 @@@ typedef struct FileList 
        bool (*filterf)(struct direntry *, const char *, FileListFilter *);
  } FileList;
  
 +#define FILELIST_MAX_RECURSION 3
 +
  #define FILENAME_IS_BREADCRUMBS(_n) \
-       (((_n)[0] == '.' && (_n)[1] == '\0') || ((_n)[0] == '.' && (_n)[1] == 
'.' && (_n)[2] == '\0'))
+       ((_n)[0] == '.' && ((_n)[1] == '\0' || ((_n)[1] == '.' && (_n)[2] == 
'\0')))
  
  #define SPECIAL_IMG_SIZE 48
  #define SPECIAL_IMG_ROWS 4
@@@ -454,35 -414,8 +456,35 @@@ static int compare_extension(const voi
        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 & BLENDERLIB) && !(entry2->flags & BLENDERLIB)) 
return -1;
-       if (!(entry1->flags & BLENDERLIB) && (entry2->flags & BLENDERLIB)) 
return 1;
-       if ((entry1->flags & BLENDERLIB) && (entry2->flags & BLENDERLIB)) {
++      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)
@@@ -594,17 -510,12 +596,17 @@@ static bool is_filtered_file(struct dir
  
  static bool is_filtered_lib(struct direntry *file, const char *root, 
FileListFilter *filter)
  {
 -      bool is_filtered = !is_hidden_file(file->relname, filter);
 -      char dir[FILE_MAXDIR], group[BLO_GROUP_MAX];
 +      bool is_filtered;
 +      char path[FILE_MAX_LIBEXTRA], dir[FILE_MAXDIR], *group;
 +
 +      BLI_join_dirfile(path, sizeof(path), root, file->relname);
  
 -      if (BLO_is_a_library(root, dir, group)) {
 +      if (BLO_library_path_explode(path, dir, &group, NULL)) {
                is_filtered = !is_hidden_file(file->relname, filter);
                if (is_filtered && filter->filter && 
!FILENAME_IS_BREADCRUMBS(file->relname)) {
-                       if ((file->type & S_IFDIR) && !(filter->filter & 
FOLDERFILE)) {
++                      if ((file->type & S_IFDIR) && !(filter->filter & 
FILE_TYPE_FOLDER)) {
 +                              is_filtered = false;
 +                      }
                        if (is_filtered && (filter->filter_search[0] != '\0')) {
                                if (fnmatch(filter->filter_search, 
file->relname, FNM_CASEFOLD) != 0) {
                                        is_filtered = false;
@@@ -774,178 -688,40 +776,178 @@@ static ImBuf *filelist_geticon_image_ex
                        ibuf = gSpecialFileImages[SPECIAL_IMG_FOLDER];
                }
        }
-       else if (flags & (BLENDERFILE)) {
 -      else {
 -              ibuf = gSpecialFileImages[SPECIAL_IMG_UNKNOWNFILE];
 -      }
 -
 -      if (file->flags & FILE_TYPE_BLENDER) {
++      else if (flags & (FILE_TYPE_BLENDER)) {
                ibuf = gSpecialFileImages[SPECIAL_IMG_BLENDFILE];
        }
-       else if (flags & (BLENDERLIB)) {
 -      else if ((file->flags & FILE_TYPE_MOVIE) || (file->flags & 
FILE_TYPE_MOVIE_ICON)) {
++      else if (flags & (FILE_TYPE_BLENDERLIB)) {
 +              ibuf = gSpecialFileImages[SPECIAL_IMG_UNKNOWNFILE];
 +      }
-       else if (flags & (MOVIEFILE | MOVIEFILE_ICON)) {
++      else if (flags & (FILE_TYPE_MOVIE | FILE_TYPE_MOVIE_ICON)) {
                ibuf = gSpecialFileImages[SPECIAL_IMG_MOVIEFILE];
        }
-       else if (flags & SOUNDFILE) {
 -      else if (file->flags & FILE_TYPE_SOUND) {
++      else if (flags & FILE_TYPE_SOUND) {
                ibuf = gSpecialFileImages[SPECIAL_IMG_SOUNDFILE];
        }
-       else if (flags & PYSCRIPTFILE) {
 -      else if (file->flags & FILE_TYPE_PYSCRIPT) {
++      else if (flags & FILE_TYPE_PYSCRIPT) {
                ibuf = gSpecialFileImages[SPECIAL_IMG_PYTHONFILE];
        }
-       else if (flags & FTFONTFILE) {
 -      else if (file->flags & FILE_TYPE_FTFONT) {
++      else if (flags & FILE_TYPE_FTFONT) {
                ibuf = gSpecialFileImages[SPECIAL_IMG_FONTFILE];
        }
-       else if (flags & TEXTFILE) {
 -      else if (file->flags & FILE_TYPE_TEXT) {
++      else if (flags & FILE_TYPE_TEXT) {
                ibuf = gSpecialFileImages[SPECIAL_IMG_TEXTFILE];
        }
-       else if (flags & IMAGEFILE) {
 -      else if (file->flags & FILE_TYPE_IMAGE) {
++      else if (flags & FILE_TYPE_IMAGE) {
                ibuf = gSpecialFileImages[SPECIAL_IMG_LOADING];
        }
-       else if (flags & BLENDERFILE_BACKUP) {
 -      else if (file->flags & FILE_TYPE_BLENDER_BACKUP) {
++      else if (flags & FILE_TYPE_BLENDER_BACKUP) {
                ibuf = gSpecialFileImages[SPECIAL_IMG_BACKUP];
        }
 +      else {
 +              ibuf = gSpecialFileImages[SPECIAL_IMG_UNKNOWNFILE];
 +      }
  
        return ibuf;
  }
  
 +ImBuf *filelist_geticon_image(struct FileList *filelist, const int index)
 +{
 +      struct direntry *file = filelist_geticon_get_file(filelist, index);
 +
 +      return filelist_geticon_image_ex(file->type, file->flags, 
file->relname);
 +}
 +
 +static int filelist_geticon_ex(const unsigned int type, const unsigned int 
flags, const char *path, const char *relname, const bool ignore_libdir)
 +{
-       if (type & S_IFDIR && !(ignore_libdir && (flags & (BLENDERLIB | 
BLENDERFILE)))) {
++      if (type & S_IFDIR && !(ignore_libdir && (flags & (FILE_TYPE_BLENDERLIB 
| FILE_TYPE_BLENDER)))) {
 +              if (strcmp(relname, "..") == 0) {
 +                      return ICON_FILE_PARENT;
 +              }
-               if (flags & APPLICATIONBUNDLE) {
++              if (flags & FILE_TYPE_APPLICATIONBUNDLE) {
 +                      return ICON_UGLYPACKAGE;
 +              }
-               if (flags & BLENDERFILE) {
++              if (flags & FILE_TYPE_BLENDER) {
 +                      return ICON_FILE_BLEND;
 +              }
 +              return ICON_FILE_FOLDER;
 +      }
-       else if (flags & BLENDERFILE)
++      else if (flags & FILE_TYPE_BLENDER)
 +              return ICON_FILE_BLEND;
-       else if (flags & BLENDERFILE_BACKUP)
++      else if (flags & FILE_TYPE_BLENDER_BACKUP)
 +              return ICON_FILE_BACKUP;
-       else if (flags & IMAGEFILE)
++      else if (flags & FILE_TYPE_IMAGE)
 +              return ICON_FILE_IMAGE;
-       else if (flags & MOVIEFILE)
++      else if (flags & FILE_TYPE_MOVIE)
 +              return ICON_FILE_MOVIE;
-       else if (flags & PYSCRIPTFILE)
++      else if (flags & FILE_TYPE_PYSCRIPT)
 +              return ICON_FILE_SCRIPT;
-       else if (flags & SOUNDFILE)
++      else if (flags & FILE_TYPE_SOUND)
 +              return ICON_FILE_SOUND;
-       else if (flags & FTFONTFILE)
++      else if (flags & FILE_TYPE_FTFONT)
 +              return ICON_FILE_FONT;
-       else if (flags & BTXFILE)
++      else if (flags & FILE_TYPE_BTX)
 +              return ICON_FILE_BLANK;
-       else if (flags & COLLADAFILE)
++      else if (flags & FILE_TYPE_COLLADA)
 +              return ICON_FILE_BLANK;
-       else if (flags & TEXTFILE)
++      else if (flags & FILE_TYPE_TEXT)
 +              return ICON_FILE_TEXT;
-       else if (flags & BLENDERLIB) {
++      else if (flags & FILE_TYPE_BLENDERLIB) {
 +              char lib[FILE_MAXDIR], *group;
 +
 +              if (BLO_library_path_explode(path, lib, &group, NULL) && group) 
{
 +                      int idcode = groupname_to_code(group);
 +
 +                      /* TODO: this should most likely be completed and moved 
to UI_interface_icons.h ? unless it already exists somewhere... */
 +                      switch (idcode) {
 +                              case ID_AC:
 +                                      return ICON_ANIM_DATA;
 +                              case ID_AR:
 +                                      return ICON_ARMATURE_DATA;
 +                              case ID_BR:
 +                                      return ICON_BRUSH_DATA;
 +                              case ID_CA:
 +                                      return ICON_CAMERA_DATA;
 +                              case ID_CU:
 +                                      return ICON_CURVE_DATA;
 +                              case ID_GD:
 +                                      return ICON_GREASEPENCIL;
 +                              case ID_GR:
 +                                      return ICON_GROUP;
 +                              case ID_IM:
 +                                      return ICON_IMAGE_DATA;
 +                              case ID_LA:
 +                                      return ICON_LAMP_DATA;
 +                              case ID_LS:
 +                                      return ICON_LINE_DATA;
 +                              case ID_LT:
 +                                      return ICON_LATTICE_DATA;
 +                              case ID_MA:
 +                                      return ICON_MATERIAL_DATA;
 +                              case ID_MB:
 +                                      return ICON_META_DATA;
 +                              case ID_MC:
 +                                      return ICON_CLIP;
 +                              case ID_ME:
 +                                      return ICON_MESH_DATA;
 +                              case ID_MSK:
 +                                      return ICON_MOD_MASK;  /* TODO! this 
would need its own icon! */
 +                              case ID_NT:
 +                                      return ICON_NODETREE;
 +                              case ID_OB:
 +                                      return ICON_OBJECT_DATA;
 +                              case ID_PAL:
 +                                      return ICON_COLOR;  /* TODO! this would 
need its own icon! */
 +                              case ID_PC:
 +                                      return ICON_CURVE_BEZCURVE;  /* TODO! 
this would need its own icon! */
 +                              case ID_SCE:
 +                                      return ICON_SCENE_DATA;
 +                              case ID_SPK:
 +                                      return ICON_SPEAKER;
 +                              case ID_SO:
 +                                      return ICON_SOUND;
 +                              case ID_TE:
 +                                      return ICON_TEXTURE_DATA;
 +                              case ID_TXT:
 +                                      return ICON

@@ Diff output truncated at 10240 characters. @@

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to