Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSybren A. Stüvel <sybren@blender.org>2021-11-23 14:29:44 +0300
committerSybren A. Stüvel <sybren@blender.org>2021-11-23 14:29:44 +0300
commitcd2849c89b65131cc381a1bf9ab75527afd51a4f (patch)
treebac399cca89d942f7c1fd384ff003975887e03c0 /source/blender/blenkernel/BKE_asset_catalog.hh
parentb02ac2d8be38d198edfece7347919d67f7cc7275 (diff)
Asset Browser: add operator for installing asset bundles
Add an operator "Copy to Asset Library" for installing asset bundles into already-existing asset libraries. The operator is shown when: - the "Current File" library is selected, - the blend file name matches `*_bundle.blend`, and - the file is not already located in an asset library. The user can select a target asset library, then gets a "Save As" dialogue box to select where in that library the file should be saved. This allows for renaming, saving in a subdirectory, etc. The Asset Catalogs from the asset bundle are merged into the target asset library. The operator will refuse to run when external files are referenced. This is not done in its poll function, as it's quite an extensive operator (it loops over all ID datablocks). Reviewed by: Severin Differential Revision: https://developer.blender.org/D13312
Diffstat (limited to 'source/blender/blenkernel/BKE_asset_catalog.hh')
-rw-r--r--source/blender/blenkernel/BKE_asset_catalog.hh14
1 files changed, 14 insertions, 0 deletions
diff --git a/source/blender/blenkernel/BKE_asset_catalog.hh b/source/blender/blenkernel/BKE_asset_catalog.hh
index 766a3f34a66..bdb77571711 100644
--- a/source/blender/blenkernel/BKE_asset_catalog.hh
+++ b/source/blender/blenkernel/BKE_asset_catalog.hh
@@ -98,6 +98,15 @@ class AssetCatalogService {
bool write_to_disk(const CatalogFilePath &blend_file_path);
/**
+ * Ensure that the next call to #on_blend_save_post() will choose a new location for the CDF
+ * suitable for the location of the blend file (regardless of where the current catalogs come
+ * from), and that catalogs will be merged with already-existing ones in that location.
+ *
+ * Use this for a "Save as..." that has to write the catalogs to the new blend file location,
+ * instead of updating the previously read CDF. */
+ void prepare_to_merge_on_write();
+
+ /**
* Merge on-disk changes into the in-memory asset catalogs.
* This should be called before writing the asset catalogs to disk.
*
@@ -238,6 +247,11 @@ class AssetCatalogService {
*/
void create_missing_catalogs();
+ /**
+ * For every catalog, mark it as "dirty".
+ */
+ void tag_all_catalogs_as_unsaved_changes();
+
/* For access by subclasses, as those will not be marked as friend by #AssetCatalogCollection. */
AssetCatalogDefinitionFile *get_catalog_definition_file();
OwningAssetCatalogMap &get_catalogs();