From 5ea6ffef6821466f7a193aebbc4fb05d3fad9df8 Mon Sep 17 00:00:00 2001 From: Harley Acheson Date: Mon, 10 Mar 2025 20:28:00 +0100 Subject: [PATCH] Fix #135134: Do Not Show Full Path to Built-In Assets We are showing full paths to the library file on some tooltips, like for brush assets. This PR checks to see if the asset is in the BLENDER_SYSTEM_DATAFILES/assets folder. If so it just shows it as "Built-in Asset:" and with the last portion of the path. Pull Request: https://projects.blender.org/blender/blender/pulls/135593 --- .../interface/regions/interface_region_tooltip.cc | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/source/blender/editors/interface/regions/interface_region_tooltip.cc b/source/blender/editors/interface/regions/interface_region_tooltip.cc index 2845d3bc154..7b841aee0cc 100644 --- a/source/blender/editors/interface/regions/interface_region_tooltip.cc +++ b/source/blender/editors/interface/regions/interface_region_tooltip.cc @@ -25,6 +25,8 @@ #include +#include "AS_essentials_library.hh" + #include "MEM_guardedalloc.h" #include "DNA_userdef_types.h" @@ -1004,12 +1006,14 @@ static std::unique_ptr ui_tooltip_data_from_button_or_extra_icon( if (but->rnapoin.owner_id) { const ID *id = but->rnapoin.owner_id; if (ID_IS_LINKED(id)) { + std::string assets_path = blender::asset_system::essentials_directory_path(); + const bool is_builtin = BLI_path_contains(assets_path.c_str(), id->lib->filepath); + const std::string title = is_builtin ? TIP_("Built-in Asset") : TIP_("Library"); + const std::string lib_path = id->lib->filepath; + const std::string path = is_builtin ? lib_path.substr(assets_path.size()) : + id->lib->filepath; UI_tooltip_text_field_add( - *data, - fmt::format(fmt::runtime(TIP_("Library: {}")), id->lib->filepath), - {}, - UI_TIP_STYLE_NORMAL, - UI_TIP_LC_NORMAL); + *data, fmt::format("{}: {}", title, path), {}, UI_TIP_STYLE_NORMAL, UI_TIP_LC_NORMAL); } } }