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-10-19 19:07:22 +0300
committerSybren A. Stüvel <sybren@blender.org>2021-10-19 19:07:22 +0300
commit823996b0342b7352fc5b2e24eceb6204612438cd (patch)
tree08dca1ce5386c2b06ab01fad1f2f1ac5c236047a /source/blender/blenkernel/intern/asset_catalog_test.cc
parentb6c3b41d413813d8059476f2c0357b7a4e51ad22 (diff)
Asset Browser: Improved workflow for asset catalog saving
No longer save asset catalogs on blendfile save. Instead: - extend the confirmation prompt for unsaved changes to show unsaved catalogs. - In the confirmation prompt, make catalog saving explicit & optional, just like we do it for external images. {F10881736} - In the Asset Browser catalog tree, show an operator icon to save the catalogs to disk. It's grayed out if there are no changes to save, or if the .blend wasn't saved yet (required to know where to save the catalog definitions to). {F10881743} Much of the work was done by @Severin and reviewed by me, then we swapped roles. Reviewed By: Severin Differential Revision: https://developer.blender.org/D12796
Diffstat (limited to 'source/blender/blenkernel/intern/asset_catalog_test.cc')
-rw-r--r--source/blender/blenkernel/intern/asset_catalog_test.cc18
1 files changed, 9 insertions, 9 deletions
diff --git a/source/blender/blenkernel/intern/asset_catalog_test.cc b/source/blender/blenkernel/intern/asset_catalog_test.cc
index d1413d521a1..d743d250c1d 100644
--- a/source/blender/blenkernel/intern/asset_catalog_test.cc
+++ b/source/blender/blenkernel/intern/asset_catalog_test.cc
@@ -222,7 +222,7 @@ class AssetCatalogTest : public testing::Test {
const AssetCatalog *cat = service.create_catalog("some/catalog/path");
/* Mock that the blend file is written to the directory already containing a CDF. */
- ASSERT_TRUE(service.write_to_disk_on_blendfile_save(blendfilename));
+ ASSERT_TRUE(service.write_to_disk(blendfilename));
/* Test that the CDF still exists in the expected location. */
EXPECT_TRUE(BLI_exists(cdf_toplevel.c_str()));
@@ -489,7 +489,7 @@ TEST_F(AssetCatalogTest, no_writing_empty_files)
{
const CatalogFilePath temp_lib_root = create_temp_path();
AssetCatalogService service(temp_lib_root);
- service.write_to_disk_on_blendfile_save(temp_lib_root + "phony.blend");
+ service.write_to_disk(temp_lib_root + "phony.blend");
const CatalogFilePath default_cdf_path = temp_lib_root +
AssetCatalogService::DEFAULT_CATALOG_FILENAME;
@@ -515,7 +515,7 @@ TEST_F(AssetCatalogTest, on_blendfile_save__with_existing_cdf)
const AssetCatalog *cat = service.create_catalog("some/catalog/path");
const CatalogFilePath blendfilename = top_level_dir + "subdir/some_file.blend";
- ASSERT_TRUE(service.write_to_disk_on_blendfile_save(blendfilename));
+ ASSERT_TRUE(service.write_to_disk(blendfilename));
EXPECT_EQ(cdf_filename, service.get_catalog_definition_file()->file_path);
/* Test that the CDF was created in the expected location. */
@@ -542,7 +542,7 @@ TEST_F(AssetCatalogTest, on_blendfile_save__from_memory_into_empty_directory)
const AssetCatalog *cat = service.create_catalog("some/catalog/path");
const CatalogFilePath blendfilename = target_dir + "some_file.blend";
- ASSERT_TRUE(service.write_to_disk_on_blendfile_save(blendfilename));
+ ASSERT_TRUE(service.write_to_disk(blendfilename));
/* Test that the CDF was created in the expected location. */
const CatalogFilePath expected_cdf_path = target_dir +
@@ -575,7 +575,7 @@ TEST_F(AssetCatalogTest, on_blendfile_save__from_memory_into_existing_cdf_and_me
/* Mock that the blend file is written to a subdirectory of the asset library. */
const CatalogFilePath blendfilename = target_dir + "some_file.blend";
- ASSERT_TRUE(service.write_to_disk_on_blendfile_save(blendfilename));
+ ASSERT_TRUE(service.write_to_disk(blendfilename));
/* Test that the CDF still exists in the expected location. */
const CatalogFilePath backup_filename = writable_cdf_file + "~";
@@ -630,7 +630,7 @@ TEST_F(AssetCatalogTest, create_first_catalog_from_scratch)
EXPECT_FALSE(BLI_exists(temp_lib_root.c_str()));
/* Writing to disk should create the directory + the default file. */
- service.write_to_disk_on_blendfile_save(temp_lib_root + "phony.blend");
+ service.write_to_disk(temp_lib_root + "phony.blend");
EXPECT_TRUE(BLI_is_dir(temp_lib_root.c_str()));
const CatalogFilePath definition_file_path = temp_lib_root + "/" +
@@ -681,7 +681,7 @@ TEST_F(AssetCatalogTest, create_catalog_after_loading_file)
<< "expecting newly added catalog to not yet be saved to " << temp_lib_root;
/* Write and reload the catalog file. */
- service.write_to_disk_on_blendfile_save(temp_lib_root + "phony.blend");
+ service.write_to_disk(temp_lib_root + "phony.blend");
AssetCatalogService reloaded_service(temp_lib_root);
reloaded_service.load_from_disk();
EXPECT_NE(nullptr, reloaded_service.find_catalog(UUID_POSES_ELLIE))
@@ -867,7 +867,7 @@ TEST_F(AssetCatalogTest, merge_catalog_files)
ASSERT_EQ(0, BLI_copy(modified_cdf_file.c_str(), temp_cdf_file.c_str()));
/* Overwrite the modified file. This should merge the on-disk file with our catalogs. */
- service.write_to_disk_on_blendfile_save(cdf_dir + "phony.blend");
+ service.write_to_disk(cdf_dir + "phony.blend");
AssetCatalogService loaded_service(cdf_dir);
loaded_service.load_from_disk();
@@ -897,7 +897,7 @@ TEST_F(AssetCatalogTest, backups)
AssetCatalogService service(cdf_dir);
service.load_from_disk();
service.delete_catalog_by_id(UUID_POSES_ELLIE);
- service.write_to_disk_on_blendfile_save(cdf_dir + "phony.blend");
+ service.write_to_disk(cdf_dir + "phony.blend");
const CatalogFilePath backup_path = writable_cdf_file + "~";
ASSERT_TRUE(BLI_is_file(backup_path.c_str()));