[Bf-blender-cvs] [542518d83ca] temp-sybren-usd-patch-02: USD: Support '.usd' as export extension (thanks @superfunc) and proper filtering in the file browser

Sybren A. Stüvel noreply at git.blender.org
Thu Dec 5 18:33:04 CET 2019


Commit: 542518d83ca73131187c1a7abdadbb296296d86a
Author: Sybren A. Stüvel
Date:   Thu Dec 5 18:13:05 2019 +0100
Branches: temp-sybren-usd-patch-02
https://developer.blender.org/rB542518d83ca73131187c1a7abdadbb296296d86a

USD: Support '.usd' as export extension (thanks @superfunc) and proper filtering in the file browser

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

M	release/scripts/startup/bl_ui/space_topbar.py
M	source/blender/editors/io/io_usd.c
M	source/blender/editors/space_file/filelist.c
M	source/blender/editors/space_file/filesel.c
M	source/blender/windowmanager/intern/wm_operator_props.c

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

diff --git a/release/scripts/startup/bl_ui/space_topbar.py b/release/scripts/startup/bl_ui/space_topbar.py
index 5c010ef38c0..025718d3219 100644
--- a/release/scripts/startup/bl_ui/space_topbar.py
+++ b/release/scripts/startup/bl_ui/space_topbar.py
@@ -401,7 +401,7 @@ class TOPBAR_MT_file_export(Menu):
         if bpy.app.build_options.alembic:
             self.layout.operator("wm.alembic_export", text="Alembic (.abc)")
         if bpy.app.build_options.usd:
-            self.layout.operator("wm.usd_export", text="Universal Scene Description (.usdc, .usda)")
+            self.layout.operator("wm.usd_export", text="Universal Scene Description (.usd, .usdc, .usda)")
 
 
 class TOPBAR_MT_file_external_data(Menu):
diff --git a/source/blender/editors/io/io_usd.c b/source/blender/editors/io/io_usd.c
index c03459a40a7..b08abe016ab 100644
--- a/source/blender/editors/io/io_usd.c
+++ b/source/blender/editors/io/io_usd.c
@@ -164,8 +164,13 @@ void WM_OT_usd_export(struct wmOperatorType *ot)
   ot->poll = WM_operator_winactive;
   ot->ui = wm_usd_export_draw;
 
-  WM_operator_properties_filesel(
-      ot, 0, FILE_BLENDER, FILE_SAVE, WM_FILESEL_FILEPATH, FILE_DEFAULTDISPLAY, FILE_SORT_ALPHA);
+  WM_operator_properties_filesel(ot,
+                                 FILE_TYPE_FOLDER | FILE_TYPE_USD,
+                                 FILE_BLENDER,
+                                 FILE_SAVE,
+                                 WM_FILESEL_FILEPATH,
+                                 FILE_DEFAULTDISPLAY,
+                                 FILE_SORT_ALPHA);
 
   RNA_def_boolean(ot->srna,
                   "selected_objects_only",
diff --git a/source/blender/editors/space_file/filelist.c b/source/blender/editors/space_file/filelist.c
index 71bc191007d..a567aeed826 100644
--- a/source/blender/editors/space_file/filelist.c
+++ b/source/blender/editors/space_file/filelist.c
@@ -1001,6 +1001,9 @@ static int filelist_geticon_ex(const int typeflag,
   else if (typeflag & FILE_TYPE_ALEMBIC) {
     return ICON_FILE_3D;
   }
+  else if (typeflag & FILE_TYPE_USD) {
+    return ICON_FILE_3D;
+  }
   else if (typeflag & FILE_TYPE_OBJECT_IO) {
     return ICON_FILE_3D;
   }
@@ -2130,7 +2133,7 @@ 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_n(path, ".usda", ".usdb", ".usdc", ".usdz", NULL)) {
+  else if (BLI_path_extension_check_n(path, ".usd", ".usda", ".usdc", NULL)) {
     return FILE_TYPE_USD;
   }
   else if (BLI_path_extension_check(path, ".zip")) {
diff --git a/source/blender/editors/space_file/filesel.c b/source/blender/editors/space_file/filesel.c
index f8adf9b707a..099b464dd8e 100644
--- a/source/blender/editors/space_file/filesel.c
+++ b/source/blender/editors/space_file/filesel.c
@@ -218,6 +218,9 @@ short ED_fileselect_set_params(SpaceFile *sfile)
     if ((prop = RNA_struct_find_property(op->ptr, "filter_alembic"))) {
       params->filter |= RNA_property_boolean_get(op->ptr, prop) ? FILE_TYPE_ALEMBIC : 0;
     }
+    if ((prop = RNA_struct_find_property(op->ptr, "filter_usd"))) {
+      params->filter |= RNA_property_boolean_get(op->ptr, prop) ? FILE_TYPE_USD : 0;
+    }
     if ((prop = RNA_struct_find_property(op->ptr, "filter_glob"))) {
       /* Protection against pyscripts not setting proper size limit... */
       char *tmp = RNA_property_string_get_alloc(
diff --git a/source/blender/windowmanager/intern/wm_operator_props.c b/source/blender/windowmanager/intern/wm_operator_props.c
index 9aefb4f68cb..2a40fb138c0 100644
--- a/source/blender/windowmanager/intern/wm_operator_props.c
+++ b/source/blender/windowmanager/intern/wm_operator_props.c
@@ -157,6 +157,8 @@ void WM_operator_properties_filesel(wmOperatorType *ot,
   RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE);
   prop = RNA_def_boolean(
       ot->srna, "filter_alembic", (filter & FILE_TYPE_ALEMBIC) != 0, "Filter Alembic files", "");
+  prop = RNA_def_boolean(
+      ot->srna, "filter_usd", (filter & FILE_TYPE_USD) != 0, "Filter USD files", "");
   RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE);
   prop = RNA_def_boolean(
       ot->srna, "filter_folder", (filter & FILE_TYPE_FOLDER) != 0, "Filter folders", "");



More information about the Bf-blender-cvs mailing list