[Bf-blender-cvs] [d813cc706d7] master: File Browser: Add Zip files as native recognised file type

William Reynish noreply at git.blender.org
Thu Sep 5 07:54:45 CEST 2019


Commit: d813cc706d79daf84100f9090db5f11c917e50c0
Author: William Reynish
Date:   Thu Sep 5 07:54:41 2019 +0200
Branches: master
https://developer.blender.org/rBd813cc706d79daf84100f9090db5f11c917e50c0

File Browser: Add Zip files as native recognised file type

Differential Revision: https://developer.blender.org/D5683

Reviewers: Brecht

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

M	source/blender/editors/space_file/filelist.c
M	source/blender/editors/space_file/filesel.c
M	source/blender/makesdna/DNA_space_types.h
M	source/blender/windowmanager/intern/wm_operator_props.c

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

diff --git a/source/blender/editors/space_file/filelist.c b/source/blender/editors/space_file/filelist.c
index 46302e0d087..df783358625 100644
--- a/source/blender/editors/space_file/filelist.c
+++ b/source/blender/editors/space_file/filelist.c
@@ -1006,6 +1006,9 @@ static int filelist_geticon_ex(const int typeflag,
   else if (typeflag & FILE_TYPE_TEXT) {
     return ICON_FILE_TEXT;
   }
+  else if (typeflag & FILE_TYPE_ARCHIVE) {
+    return ICON_FILE_ARCHIVE;
+  }
   else if (typeflag & FILE_TYPE_BLENDERLIB) {
     const int ret = UI_idcode_icon_get(blentype);
     if (ret != ICON_NONE) {
@@ -2126,6 +2129,9 @@ int ED_path_extension_type(const char *path)
   else if (BLI_path_extension_check(path, ".abc")) {
     return FILE_TYPE_ALEMBIC;
   }
+  else if (BLI_path_extension_check(path, ".zip")) {
+    return FILE_TYPE_ARCHIVE;
+  }
   else if (BLI_path_extension_check_n(path, ".obj", ".3ds", ".fbx", ".glb", ".gltf", NULL)) {
     return FILE_TYPE_OBJECT_IO;
   }
@@ -2183,6 +2189,8 @@ int ED_file_extension_icon(const char *path)
       return ICON_FILE_3D;
     case FILE_TYPE_TEXT:
       return ICON_FILE_TEXT;
+    case FILE_TYPE_ARCHIVE:
+      return ICON_FILE_ARCHIVE;
     default:
       return ICON_FILE_BLANK;
   }
diff --git a/source/blender/editors/space_file/filesel.c b/source/blender/editors/space_file/filesel.c
index 3223fe0c6ce..d683c9d5c98 100644
--- a/source/blender/editors/space_file/filesel.c
+++ b/source/blender/editors/space_file/filesel.c
@@ -199,6 +199,9 @@ short ED_fileselect_set_params(SpaceFile *sfile)
     if ((prop = RNA_struct_find_property(op->ptr, "filter_text"))) {
       params->filter |= RNA_property_boolean_get(op->ptr, prop) ? FILE_TYPE_TEXT : 0;
     }
+    if ((prop = RNA_struct_find_property(op->ptr, "filter_archive"))) {
+      params->filter |= RNA_property_boolean_get(op->ptr, prop) ? FILE_TYPE_ARCHIVE : 0;
+    }
     if ((prop = RNA_struct_find_property(op->ptr, "filter_folder"))) {
       params->filter |= RNA_property_boolean_get(op->ptr, prop) ? FILE_TYPE_FOLDER : 0;
     }
diff --git a/source/blender/makesdna/DNA_space_types.h b/source/blender/makesdna/DNA_space_types.h
index 2fc42e904c2..f212346f547 100644
--- a/source/blender/makesdna/DNA_space_types.h
+++ b/source/blender/makesdna/DNA_space_types.h
@@ -826,7 +826,7 @@ typedef enum eFileSel_File_Types {
   FILE_TYPE_FTFONT = (1 << 7),
   FILE_TYPE_SOUND = (1 << 8),
   FILE_TYPE_TEXT = (1 << 9),
-  /* 1 << 10 was FILE_TYPE_MOVIE_ICON, got rid of this so free slot for future type... */
+  FILE_TYPE_ARCHIVE = (1 << 10),
   /** represents folders for filtering */
   FILE_TYPE_FOLDER = (1 << 11),
   FILE_TYPE_BTX = (1 << 12),
diff --git a/source/blender/windowmanager/intern/wm_operator_props.c b/source/blender/windowmanager/intern/wm_operator_props.c
index de82c3942db..04775a7a880 100644
--- a/source/blender/windowmanager/intern/wm_operator_props.c
+++ b/source/blender/windowmanager/intern/wm_operator_props.c
@@ -155,6 +155,9 @@ void WM_operator_properties_filesel(wmOperatorType *ot,
   prop = RNA_def_boolean(
       ot->srna, "filter_text", (filter & FILE_TYPE_TEXT) != 0, "Filter text files", "");
   RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE);
+  prop = RNA_def_boolean(
+      ot->srna, "filter_archive", (filter & FILE_TYPE_ARCHIVE) != 0, "Filter archive files", "");
+  RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE);
   prop = RNA_def_boolean(
       ot->srna, "filter_btx", (filter & FILE_TYPE_BTX) != 0, "Filter btx files", "");
   RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE);



More information about the Bf-blender-cvs mailing list