[Bf-blender-cvs] [2e33172719c] master: Assets: Don't show duplicated catalog name when dragging assets

Kevin Curry noreply at git.blender.org
Wed Jun 15 15:28:03 CEST 2022


Commit: 2e33172719c99267ed4fbf99145c26ef09b3ef1d
Author: Kevin Curry
Date:   Wed Jun 15 15:18:39 2022 +0200
Branches: master
https://developer.blender.org/rB2e33172719c99267ed4fbf99145c26ef09b3ef1d

Assets: Don't show duplicated catalog name when dragging assets

While dragging assets over a catalog, we would show both the name and
the full catalog path in the drag tooltip. For catalogs at the root
level (catalogs without parents) the name and the full path are the
same, so it would just display the name twice. This is more confusing
than helpful. Now skip displaying the full path in that case.

Reviewed by: Julian Eisel
Addresses T92855

Differential Revision: https://developer.blender.org/D15190

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

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 e5a4919f548..87595ecdb88 100644
--- a/source/blender/editors/space_file/asset_catalog_tree_view.cc
+++ b/source/blender/editors/space_file/asset_catalog_tree_view.cc
@@ -407,8 +407,15 @@ std::string AssetCatalogDropController::drop_tooltip_asset_list(const wmDrag &dr
   std::string basic_tip = is_multiple_assets ? TIP_("Move assets to catalog") :
                                                TIP_("Move asset to catalog");
 
-  return basic_tip + ": " + catalog_item_.get_name() + " (" + catalog_item_.catalog_path().str() +
-         ")";
+  basic_tip += ": " + catalog_item_.get_name();
+
+  /* Display the full catalog path, but only if it's not exactly the same as the already shown name
+   * (i.e. not a root level catalog with no parent). */
+  if (catalog_item_.get_name() != catalog_item_.catalog_path().str()) {
+    basic_tip += " (" + catalog_item_.catalog_path().str() + ")";
+  }
+
+  return basic_tip;
 }
 
 bool AssetCatalogDropController::on_drop(struct bContext *C, const wmDrag &drag)



More information about the Bf-blender-cvs mailing list