[Bf-blender-cvs] [98c43574cbb] temp-asset-browser-catalogs-ui: Fix broken catalog adding logic

Julian Eisel noreply at git.blender.org
Thu Sep 23 16:25:15 CEST 2021


Commit: 98c43574cbb0bbea76bd98a69684f560ab1f0645
Author: Julian Eisel
Date:   Thu Sep 23 16:24:50 2021 +0200
Branches: temp-asset-browser-catalogs-ui
https://developer.blender.org/rB98c43574cbb0bbea76bd98a69684f560ab1f0645

Fix broken catalog adding logic

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

M	source/blender/editors/space_file/asset_catalog_tree_view.cc

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

diff --git a/source/blender/editors/space_file/asset_catalog_tree_view.cc b/source/blender/editors/space_file/asset_catalog_tree_view.cc
index f085ea1d2dc..a79b55bd270 100644
--- a/source/blender/editors/space_file/asset_catalog_tree_view.cc
+++ b/source/blender/editors/space_file/asset_catalog_tree_view.cc
@@ -92,21 +92,20 @@ class AssetCatalogTreeViewItem : public uiBasicTreeViewItem {
     }
 
     PointerRNA *props;
-    char uuid_buffer[UUID_STRING_LEN] = "";
+    char catalog_id_str_buffer[UUID_STRING_LEN] = "";
     CatalogID catalog_id = catalog_.get_catalog_id();
-    if (BLI_uuid_is_nil(catalog_id)) {
-      /* There's not much we can do without a catalog ID. */
-      return;
-    }
 
-    BLI_uuid_format(uuid_buffer, catalog_id);
+    BLI_uuid_format(catalog_id_str_buffer, catalog_id);
 
     props = UI_but_extra_operator_icon_add(
         button(), "ASSET_OT_catalog_new", WM_OP_INVOKE_DEFAULT, ICON_ADD);
-    RNA_string_set(props, "parent_path", uuid_buffer);
-    props = UI_but_extra_operator_icon_add(
-        button(), "ASSET_OT_catalog_delete", WM_OP_INVOKE_DEFAULT, ICON_X);
-    RNA_string_set(props, "catalog_id", uuid_buffer);
+    RNA_string_set(props, "parent_path", catalog_.catalog_path().c_str());
+    /* Can't actually delete items without catalog ID. */
+    if (!BLI_uuid_is_nil(catalog_id)) {
+      props = UI_but_extra_operator_icon_add(
+          button(), "ASSET_OT_catalog_delete", WM_OP_INVOKE_DEFAULT, ICON_X);
+      RNA_string_set(props, "catalog_id", catalog_id_str_buffer);
+    }
   }
 };



More information about the Bf-blender-cvs mailing list