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-21 17:06:14 +0300
committerSybren A. Stüvel <sybren@blender.org>2021-10-21 17:06:14 +0300
commit4b48b1079d9175a5b86b2299c902cac0fbe27f09 (patch)
tree89f4d53d2a715d1aa7aa57733c30189d003a1f85 /source/blender/blenkernel/intern/asset_catalog.cc
parent5ccec8ec6bed3e0eda1cffaae565fdfaccd2a6ac (diff)
Asset Catalogs: refresh simple name when renaming catalog
When renaming an asset catalog, also update its simple name. Catalogs will most likely be created from within Blender, so via the catalog tree in the asset browser. Here catalogs are always named "Catalog" until the user renames them, which was reflected in all simple names being "Catalog".
Diffstat (limited to 'source/blender/blenkernel/intern/asset_catalog.cc')
-rw-r--r--source/blender/blenkernel/intern/asset_catalog.cc9
1 files changed, 9 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/asset_catalog.cc b/source/blender/blenkernel/intern/asset_catalog.cc
index 51f8457ebd9..9dd5ccdf3cf 100644
--- a/source/blender/blenkernel/intern/asset_catalog.cc
+++ b/source/blender/blenkernel/intern/asset_catalog.cc
@@ -219,6 +219,10 @@ void AssetCatalogService::update_catalog_path(const CatalogID catalog_id,
continue;
}
cat->path = new_path;
+ cat->simple_name_refresh();
+
+ /* TODO(Sybren): go over all assets that are assigned to this catalog, defined in the current
+ * blend file, and update the catalog simple name stored there. */
}
this->rebuild_tree();
@@ -953,6 +957,11 @@ std::unique_ptr<AssetCatalog> AssetCatalog::from_path(const AssetCatalogPath &pa
return catalog;
}
+void AssetCatalog::simple_name_refresh()
+{
+ this->simple_name = sensible_simple_name_for_path(this->path);
+}
+
std::string AssetCatalog::sensible_simple_name_for_path(const AssetCatalogPath &path)
{
std::string name = path.str();