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-09-24 15:42:44 +0300
committerSybren A. Stüvel <sybren@blender.org>2021-09-24 15:42:48 +0300
commite1e380ba388fbe514b38c3023ca9eb02cc2c78ee (patch)
tree4e5027779aae4a2e954254e87bbd313acaf8008f /source/blender/blenkernel/BKE_asset_catalog.hh
parentab9644382d14eb1254ce33e38227c874fd80a08f (diff)
Asset Catalogs: write catalogs sorted by path & UUID
When writing asset catalog definition files, order the catalogs by (path, UUID). This ensures that every write produces the same file, playing nice with versioning / synchronisation systems.
Diffstat (limited to 'source/blender/blenkernel/BKE_asset_catalog.hh')
-rw-r--r--source/blender/blenkernel/BKE_asset_catalog.hh13
1 files changed, 13 insertions, 0 deletions
diff --git a/source/blender/blenkernel/BKE_asset_catalog.hh b/source/blender/blenkernel/BKE_asset_catalog.hh
index 5fd68e33f4a..51cfa8452c0 100644
--- a/source/blender/blenkernel/BKE_asset_catalog.hh
+++ b/source/blender/blenkernel/BKE_asset_catalog.hh
@@ -32,6 +32,7 @@
#include <map>
#include <memory>
+#include <set>
#include <string>
namespace blender::bke {
@@ -255,4 +256,16 @@ class AssetCatalog {
static std::string sensible_simple_name_for_path(const CatalogPath &path);
};
+struct AssetCatalogPathCmp {
+ bool operator()(const AssetCatalog *lhs, const AssetCatalog *rhs) const
+ {
+ if (lhs->path == rhs->path) {
+ return lhs->catalog_id < rhs->catalog_id;
+ }
+ return lhs->path < rhs->path;
+ }
+};
+
+using AssetCatalogOrderedSet = std::set<const AssetCatalog *, AssetCatalogPathCmp>;
+
} // namespace blender::bke