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
This commit is contained in:
Kevin Curry 2022-06-15 15:18:39 +02:00 committed by Julian Eisel
parent 15b4120064
commit 2e33172719
Notes: blender-bot 2023-02-14 02:27:56 +01:00
Referenced by issue #92855, Don't show catalog path when dragging assets over root level catalogs
1 changed files with 9 additions and 2 deletions

View File

@ -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)