[Bf-blender-cvs] [5a92ebe7b7a] asset-browser: Remove WIP code for asset catalogs

Julian Eisel noreply at git.blender.org
Tue Dec 1 19:23:03 CET 2020


Commit: 5a92ebe7b7abb19e52732e1df5c6adf6d7853d7e
Author: Julian Eisel
Date:   Tue Dec 1 18:06:04 2020 +0100
Branches: asset-browser
https://developer.blender.org/rB5a92ebe7b7abb19e52732e1df5c6adf6d7853d7e

Remove WIP code for asset catalogs

I still have a local version of the branch with this code, but for the merge
into master this isn't needed and adds unecessary review overhead.

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

M	CMakeLists.txt
M	release/scripts/startup/bl_ui/space_filebrowser.py
M	source/blender/blenkernel/BKE_asset.h
M	source/blender/blenkernel/intern/asset.c
M	source/blender/blenkernel/intern/blender.c
M	source/blender/blenkernel/intern/blendfile.c
M	source/blender/blenloader/BLO_blend_defs.h
M	source/blender/blenloader/BLO_readfile.h
M	source/blender/blenloader/BLO_writefile.h
M	source/blender/blenloader/intern/readblenentry.c
M	source/blender/blenloader/intern/readfile.c
M	source/blender/blenloader/intern/writefile.c
M	source/blender/editors/asset/asset_edit.c
M	source/blender/editors/asset/asset_ops.c
M	source/blender/makesdna/DNA_asset_types.h
M	source/blender/windowmanager/intern/wm_files.c

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

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 863cb86b91f..7bc1406dc59 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -450,8 +450,6 @@ else()
   set(WITH_EXPERIMENTAL_FEATURES ON)
 endif()
 
-add_definitions(-DWITH_ASSET_REPO_INFO)
-
 # Unit testsing
 option(WITH_GTESTS "Enable GTest unit testing" OFF)
 option(WITH_OPENGL_RENDER_TESTS "Enable OpenGL render related unit testing (Experimental)" OFF)
diff --git a/release/scripts/startup/bl_ui/space_filebrowser.py b/release/scripts/startup/bl_ui/space_filebrowser.py
index d9fdd014fcb..ac05882896f 100644
--- a/release/scripts/startup/bl_ui/space_filebrowser.py
+++ b/release/scripts/startup/bl_ui/space_filebrowser.py
@@ -562,10 +562,6 @@ class ASSETBROWSER_PT_navigation_bar(asset_utils.AssetBrowserPanel, Panel):
         col.scale_y = 1.3
         col.prop(space_file.params, "asset_category", expand=True)
 
-        col.separator()
-
-        col.operator("asset.catalog_add", text="Add Catalog", icon='ADD')
-
 
 class ASSETBROWSER_PT_metadata(asset_utils.AssetBrowserPanel, Panel):
     bl_region_type = 'TOOL_PROPS'
diff --git a/source/blender/blenkernel/BKE_asset.h b/source/blender/blenkernel/BKE_asset.h
index 4d467deadfe..30743fed598 100644
--- a/source/blender/blenkernel/BKE_asset.h
+++ b/source/blender/blenkernel/BKE_asset.h
@@ -32,13 +32,6 @@ struct BlendDataReader;
 struct ID;
 struct PreviewImage;
 
-#ifdef WITH_ASSET_REPO_INFO
-struct AssetRepositoryInfo *BKE_asset_repository_info_global_ensure(void);
-void BKE_asset_repository_info_free(struct AssetRepositoryInfo **repository_info);
-void BKE_asset_repository_info_global_free(void);
-void BKE_asset_repository_info_update_for_file_read(struct AssetRepositoryInfo **repository_info);
-#endif
-
 struct AssetCatalog *BKE_asset_repository_catalog_create(const char *name);
 void BKE_asset_repository_catalog_free(struct AssetCatalog **catalog);
 
diff --git a/source/blender/blenkernel/intern/asset.c b/source/blender/blenkernel/intern/asset.c
index d352d36ab5d..c68e4106fcc 100644
--- a/source/blender/blenkernel/intern/asset.c
+++ b/source/blender/blenkernel/intern/asset.c
@@ -37,57 +37,6 @@
 
 #include "MEM_guardedalloc.h"
 
-#ifdef WITH_ASSET_REPO_INFO
-AssetRepositoryInfo *G_asset_repository_info;
-
-AssetRepositoryInfo *BKE_asset_repository_info_global_ensure(void)
-{
-  if (!G_asset_repository_info) {
-    G_asset_repository_info = MEM_callocN(sizeof(*G_asset_repository_info), __func__);
-  }
-
-  return G_asset_repository_info;
-}
-
-void BKE_asset_repository_info_free(AssetRepositoryInfo **repository_info)
-{
-  if (!*repository_info) {
-    return;
-  }
-
-  LISTBASE_FOREACH_MUTABLE (AssetCatalog *, catalog, &(*repository_info)->catalogs) {
-    BLI_remlink(&(*repository_info)->catalogs, catalog);
-    BKE_asset_repository_catalog_free(&catalog);
-  }
-  MEM_SAFE_FREE(*repository_info);
-}
-
-void BKE_asset_repository_info_global_free(void)
-{
-  BKE_asset_repository_info_free(&G_asset_repository_info);
-}
-
-void BKE_asset_repository_info_update_for_file_read(AssetRepositoryInfo **old_repository_info)
-{
-  /* Force recreation of the repository info. */
-  BKE_asset_repository_info_free(old_repository_info);
-}
-
-#endif
-
-AssetCatalog *BKE_asset_repository_catalog_create(const char *name)
-{
-  AssetCatalog *catalog = MEM_callocN(sizeof(*catalog), __func__);
-
-  BLI_strncpy(catalog->name, name, sizeof(catalog->name));
-  return catalog;
-}
-
-void BKE_asset_repository_catalog_free(AssetCatalog **catalog)
-{
-  MEM_SAFE_FREE(*catalog);
-}
-
 AssetMetaData *BKE_asset_metadata_create(void)
 {
   AssetMetaData *asset_data = MEM_callocN(sizeof(AssetMetaData), __func__);
diff --git a/source/blender/blenkernel/intern/blender.c b/source/blender/blenkernel/intern/blender.c
index 161f0bd1a72..021b1764d5d 100644
--- a/source/blender/blenkernel/intern/blender.c
+++ b/source/blender/blenkernel/intern/blender.c
@@ -37,9 +37,6 @@
 #include "IMB_moviecache.h"
 
 #include "BKE_addon.h"
-#ifdef WITH_ASSET_REPO_INFO
-#  include "BKE_asset.h"
-#endif
 #include "BKE_blender.h" /* own include */
 #include "BKE_blender_user_menu.h"
 #include "BKE_blender_version.h" /* own include */
@@ -84,9 +81,6 @@ void BKE_blender_free(void)
 
   BKE_main_free(G_MAIN);
   G_MAIN = NULL;
-#ifdef WITH_ASSET_REPO_INFO
-  BKE_asset_repository_info_global_free();
-#endif
 
   if (G.log.file != NULL) {
     fclose(G.log.file);
diff --git a/source/blender/blenkernel/intern/blendfile.c b/source/blender/blenkernel/intern/blendfile.c
index f890ddf206b..f0f2049d92f 100644
--- a/source/blender/blenkernel/intern/blendfile.c
+++ b/source/blender/blenkernel/intern/blendfile.c
@@ -26,9 +26,6 @@
 
 #include "MEM_guardedalloc.h"
 
-#ifdef WITH_ASSET_REPO_INFO
-#  include "DNA_asset_types.h"
-#endif
 #include "DNA_scene_types.h"
 #include "DNA_screen_types.h"
 #include "DNA_workspace_types.h"
@@ -43,9 +40,6 @@
 
 #include "BKE_addon.h"
 #include "BKE_appdir.h"
-#ifdef WITH_ASSET_REPO_INFO
-#  include "BKE_asset.h"
-#endif
 #include "BKE_blender.h"
 #include "BKE_blender_version.h"
 #include "BKE_blendfile.h"
@@ -289,17 +283,6 @@ static void setup_app_data(bContext *C,
   bmain = G_MAIN = bfd->main;
   bfd->main = NULL;
 
-#ifdef WITH_ASSET_REPO_INFO
-  if (mode != LOAD_UNDO) {
-    /* Close old repository info. */
-    BKE_asset_repository_info_update_for_file_read(&G_asset_repository_info);
-
-    /* Move read repository info to the current app. */
-    G_asset_repository_info = bfd->asset_repository_info;
-    bfd->asset_repository_info = NULL;
-  }
-#endif
-
   CTX_data_main_set(C, bmain);
 
   /* case G_FILE_NO_UI or no screens in file */
diff --git a/source/blender/blenloader/BLO_blend_defs.h b/source/blender/blenloader/BLO_blend_defs.h
index c30412b61b8..40da63f20e8 100644
--- a/source/blender/blenloader/BLO_blend_defs.h
+++ b/source/blender/blenloader/BLO_blend_defs.h
@@ -64,18 +64,6 @@ enum {
    * (written to #BLENDER_STARTUP_FILE & #BLENDER_USERPREF_FILE).
    */
   USER = BLEND_MAKE_ID('U', 'S', 'E', 'R'),
-#ifdef WITH_ASSET_REPO_INFO
-  /**
-   * Used for #AssetRepositoryInfo, meta-data to add to repositories for files containing assets.
-   *
-   * If the blend contains any asset data-blocks, it becomes a potential repository, or part of
-   * one. So #AssetRepositoryInfo is added to the file, allowing assets to be queried together with
-   * the meta-data they want to add to the repository. A repositories meta-data is then established
-   * by creating a union of all meta-data written into all the repository's .blend files (possibly
-   * extended by an Asset Manager Bride add-on).
-   */
-  ASSET_REPOSITORY_INFO = BLEND_MAKE_ID('A', 'R', 'E', 'P'),
-#endif
   /**
    * Terminate reading (no data).
    */
diff --git a/source/blender/blenloader/BLO_readfile.h b/source/blender/blenloader/BLO_readfile.h
index 18d8bc17bea..788ecc64bd6 100644
--- a/source/blender/blenloader/BLO_readfile.h
+++ b/source/blender/blenloader/BLO_readfile.h
@@ -68,9 +68,6 @@ typedef enum eBlenFileType {
 typedef struct BlendFileData {
   struct Main *main;
   struct UserDef *user;
-#ifdef WITH_ASSET_REPO_INFO
-  struct AssetRepositoryInfo *asset_repository_info;
-#endif
 
   int fileflags;
   int globalf;
diff --git a/source/blender/blenloader/BLO_writefile.h b/source/blender/blenloader/BLO_writefile.h
index c596eb8b8e9..746c663926d 100644
--- a/source/blender/blenloader/BLO_writefile.h
+++ b/source/blender/blenloader/BLO_writefile.h
@@ -58,9 +58,6 @@ struct BlendFileWriteParams {
   uint use_save_as_copy : 1;
   uint use_userdef : 1;
   const struct BlendThumbnail *thumb;
-#ifdef WITH_ASSET_REPO_INFO
-  const struct AssetRepositoryInfo *asset_repository_info;
-#endif
 };
 
 extern bool BLO_write_file(struct Main *mainvar,
diff --git a/source/blender/blenloader/intern/readblenentry.c b/source/blender/blenloader/intern/readblenentry.c
index 33f59987176..f5eddc6ea02 100644
--- a/source/blender/blenloader/intern/readblenentry.c
+++ b/source/blender/blenloader/intern/readblenentry.c
@@ -40,9 +40,6 @@
 #include "DNA_genfile.h"
 #include "DNA_sdna_types.h"
 
-#ifdef WITH_ASSET_REPO_INFO
-#  include "BKE_asset.h"
-#endif
 #include "BKE_idtype.h"
 #include "BKE_main.h"
 
@@ -480,11 +477,5 @@ void BLO_blendfiledata_free(BlendFileData *bfd)
     MEM_freeN(bfd->user);
   }
 
-#ifdef WITH_ASSET_REPO_INFO
-  if (bfd->asset_repository_info) {
-    BKE_asset_repository_info_free(&bfd->asset_repository_info);
-  }
-#endif
-
   MEM_freeN(bfd);
 }
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index 5dd038f0993..4502e6f9006 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -1053,7 +1053,8 @@ static bool read_file_dna(FileData *fd, const char **r_error_message)
         /* used to retrieve ID names from (bhead+1) */
         fd->id_name_offs = DNA_elem_offset(fd->filesdna, "ID", "char", "name[]");
         BLI_assert(fd->id_name_offs != -1);
-        fd->id_asset_data_offs = DNA_elem_offset(fd->filesdna, "ID", "AssetMetaData", "*asset_data");
+        fd->id_asset_data_offs = DNA_elem_offset(
+            fd->filesdna, "ID", "AssetMetaData", "*asset_data");
 
         return true;
       }
@@ -3717,30 +3718,6 @@ static void link_global(FileData *fd, BlendFileData *bfd)
 
 /** \} */
 
-#ifdef WITH_ASSET_REPO_INFO
-/* -------------------------------------------------------------------- */
-/** \name Read Asset Repository Data
- * \{ */
-
-static BHead *read_asset_repository_info(BlendFileData *bfd, FileData *fd, BHead *bhead)
-{
-  AssetRepositoryInfo *repository_info = read_struct(fd, bhead, "asset repository info");
-
-  bfd->asset_repository_info = repository_info;
-
-  bhead = read_data_into_datamap(fd, bhead, "asset repository data");
-
-  BlendDataReader reader_ = {fd};
-  BlendDataReader *reader = &reader_;
-
-  BLO_read_list(reader, &repository_info->catalogs);
-
-  return bhead;
-}
-
-/** \} */
-#endif
-
 /* -------------------------------------------------------------------- */
 /** \name Versioning
  * \{ */
@@ -4067,11 +4044,6 @@ BlendFileData *blo_read_file_internal(FileData *fd, const char *filepath)
           bhead = read_userdef(bfd, fd, bhead);
         }
         break;
-#ifdef WITH_ASSE

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list