Commit: 2566c7f1b2014df48dd872f7fd715f567bf692f1
Author: Julian Eisel
Date:   Tue Aug 25 01:15:24 2020 +0200
Branches: asset-browser
https://developer.blender.org/rB2566c7f1b2014df48dd872f7fd715f567bf692f1

By default, show object assets in $HOME/assets.blend

Obviously using this fixed path is a temporary hack. Right now goal is really
just to get quick visual results to test and evaluate.

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

M       source/blender/editors/space_file/filesel.c

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

diff --git a/source/blender/editors/space_file/filesel.c 
b/source/blender/editors/space_file/filesel.c
index fd6bbd7a123..b2bf8711eef 100644
--- a/source/blender/editors/space_file/filesel.c
+++ b/source/blender/editors/space_file/filesel.c
@@ -56,6 +56,7 @@
 
 #include "BKE_appdir.h"
 #include "BKE_context.h"
+#include "BKE_idtype.h"
 #include "BKE_main.h"
 
 #include "BLF_api.h"
@@ -299,11 +300,29 @@ short ED_fileselect_set_params(SpaceFile *sfile)
     params->type = FILE_UNIX;
     params->flag |= U_default.file_space_data.flag;
     params->flag &= ~FILE_DIRSEL_ONLY;
-    params->display = ED_fileselect_is_asset_browser(params) ? FILE_IMGDISPLAY 
:
-                                                               
FILE_VERTICALDISPLAY;
+    params->display = FILE_VERTICALDISPLAY;
     params->sort = FILE_SORT_ALPHA;
     params->filter = 0;
     params->filter_glob[0] = '\0';
+
+    if (ED_fileselect_is_asset_browser(params)) {
+      /* TODO Fixed file path. */
+      const char *doc_path = BKE_appdir_folder_default();
+
+      if (doc_path) {
+        const char *asset_blend_name = "assets.blend";
+        const char *id_group_name = BKE_idtype_idcode_to_name(ID_OB);
+
+        BLI_join_dirfile(params->dir, sizeof(params->dir), doc_path, 
asset_blend_name);
+        BLI_path_join(
+            params->dir, sizeof(params->dir), doc_path, asset_blend_name, 
id_group_name, NULL);
+        params->file[0] = '\0';
+      }
+
+      params->type = FILE_LOADLIB;
+      params->flag |= FILE_ASSETS_ONLY;
+      params->display = FILE_IMGDISPLAY;
+    }
   }
 
   /* operator has no setting for this */

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

Reply via email to