[Bf-blender-cvs] [f08aeaba95f] temp-asset-browser-catalogs: Correct name of catalog-tree item child container alias

Julian Eisel noreply at git.blender.org
Mon Sep 6 15:45:51 CEST 2021


Commit: f08aeaba95f4831eb3f2e0d79fcd90a84bb48bcc
Author: Julian Eisel
Date:   Mon Sep 6 15:44:46 2021 +0200
Branches: temp-asset-browser-catalogs
https://developer.blender.org/rBf08aeaba95f4831eb3f2e0d79fcd90a84bb48bcc

Correct name of catalog-tree item child container alias

This used to be a set, now it's a map.

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

M	source/blender/blenkernel/BKE_asset_catalog.hh
M	source/blender/blenkernel/intern/asset_catalog.cc

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

diff --git a/source/blender/blenkernel/BKE_asset_catalog.hh b/source/blender/blenkernel/BKE_asset_catalog.hh
index 8ee7395af4c..2eafc177494 100644
--- a/source/blender/blenkernel/BKE_asset_catalog.hh
+++ b/source/blender/blenkernel/BKE_asset_catalog.hh
@@ -109,7 +109,7 @@ class AssetCatalogTreeItem {
   friend class AssetCatalogService;
 
  public:
-  using ChildSet = std::map<std::string, AssetCatalogTreeItem>;
+  using ChildMap = std::map<std::string, AssetCatalogTreeItem>;
   using ItemIterFn = FunctionRef<void(const AssetCatalogTreeItem &)>;
 
   AssetCatalogTreeItem(StringRef name, const AssetCatalogTreeItem *parent = nullptr);
@@ -120,11 +120,11 @@ class AssetCatalogTreeItem {
   CatalogPath catalog_path() const;
   int count_parents() const;
 
-  static void foreach_item_recursive(const ChildSet &children_, const ItemIterFn callback);
+  static void foreach_item_recursive(const ChildMap &children_, const ItemIterFn callback);
 
  protected:
   /** Child tree items, ordered by their names. */
-  ChildSet children_;
+  ChildMap children_;
   /** The user visible name of this component. */
   CatalogPathComponent name_;
 
@@ -146,7 +146,7 @@ class AssetCatalogTree {
 
  protected:
   /** Child tree items, ordered by their names. */
-  AssetCatalogTreeItem::ChildSet children_;
+  AssetCatalogTreeItem::ChildMap children_;
 };
 
 /** Keeps track of which catalogs are defined in a certain file on disk.
diff --git a/source/blender/blenkernel/intern/asset_catalog.cc b/source/blender/blenkernel/intern/asset_catalog.cc
index 5e24ba30e55..21dd3cc438c 100644
--- a/source/blender/blenkernel/intern/asset_catalog.cc
+++ b/source/blender/blenkernel/intern/asset_catalog.cc
@@ -243,7 +243,7 @@ std::unique_ptr<AssetCatalogTree> AssetCatalogService::read_into_tree()
     fs::path catalog_path = catalog->path;
 
     const AssetCatalogTreeItem *parent = nullptr;
-    AssetCatalogTreeItem::ChildSet *insert_to_set = &tree->children_;
+    AssetCatalogTreeItem::ChildMap *insert_to_map = &tree->children_;
 
     BLI_assert_msg(catalog_path.is_relative() && !catalog_path.has_root_path(),
                    "Malformed catalog path: Path should be a relative path, with no root-name or "
@@ -252,12 +252,12 @@ std::unique_ptr<AssetCatalogTree> AssetCatalogService::read_into_tree()
       std::string component_name = component.string();
 
       /* Insert new tree element - if no matching one is there yet! */
-      auto [item, was_inserted] = insert_to_set->emplace(
+      auto [item, was_inserted] = insert_to_map->emplace(
           component_name, AssetCatalogTreeItem(component_name, parent));
 
       /* Walk further into the path (no matter if a new item was created or not). */
       parent = &item->second;
-      insert_to_set = &item->second.children_;
+      insert_to_map = &item->second.children_;
     }
   }
 
@@ -297,7 +297,7 @@ void AssetCatalogTree::foreach_item(const AssetCatalogTreeItem::ItemIterFn callb
   AssetCatalogTreeItem::foreach_item_recursive(children_, callback);
 }
 
-void AssetCatalogTreeItem::foreach_item_recursive(const AssetCatalogTreeItem::ChildSet &children,
+void AssetCatalogTreeItem::foreach_item_recursive(const AssetCatalogTreeItem::ChildMap &children,
                                                   const ItemIterFn callback)
 {
   for (const auto &[key, item] : children) {



More information about the Bf-blender-cvs mailing list