|
Blender V4.3
|
#include <AS_asset_catalog_path.hh>
Public Types | |
| using | ComponentIteratorFn = FunctionRef<void(StringRef component_name, bool is_last_component)> |
Static Public Attributes | |
| static const char | SEPARATOR = '/' |
Static Protected Member Functions | |
| static std::string | cleanup_component (StringRef component_name) |
Friends | |
| std::ostream & | operator<< (std::ostream &stream, const AssetCatalogPath &path_to_append) |
Location of an Asset Catalog in the catalog tree, denoted by slash-separated path components.
Each path component is a string that is not allowed to have slashes or colons. The latter is to make things easy to save in the colon-delimited Catalog Definition File format.
The path of a catalog determines where in the catalog hierarchy the catalog is shown. Examples are "Characters/Ellie/Poses/Hand" or "Kit_bash/City/Skyscrapers". The path looks like a file-system path, with a few differences:
See https://developer.blender.org/docs/features/asset_system/backend/asset_catalogs/
Paths are stored as byte sequences, and assumed to be UTF-8.
Definition at line 36 of file AS_asset_catalog_path.hh.
| using blender::asset_system::AssetCatalogPath::ComponentIteratorFn = FunctionRef<void(StringRef component_name, bool is_last_component)> |
Call the callback function for each path component, in left-to-right order.
Definition at line 118 of file AS_asset_catalog_path.hh.
|
default |
Referenced by cleanup(), operator/(), parent(), and rebase().
| blender::asset_system::AssetCatalogPath::AssetCatalogPath | ( | StringRef | path | ) |
Definition at line 21 of file asset_catalog_path.cc.
| blender::asset_system::AssetCatalogPath::AssetCatalogPath | ( | std::string | path | ) |
Definition at line 19 of file asset_catalog_path.cc.
| blender::asset_system::AssetCatalogPath::AssetCatalogPath | ( | const char * | path | ) |
Definition at line 23 of file asset_catalog_path.cc.
|
default |
|
noexcept |
Definition at line 25 of file asset_catalog_path.cc.
|
default |
| const char * blender::asset_system::AssetCatalogPath::c_str | ( | ) | const |
C-string representation of the path.
Definition at line 41 of file asset_catalog_path.cc.
Referenced by blender::ed::asset_browser::AssetCatalogTreeViewItem::build_context_menu(), blender::ed::asset_browser::AssetCatalogTreeViewItem::build_row(), blender::ed::asset::catalog_move(), compare_asset_catalog(), blender::ed::asset::draw_menu_for_catalog(), blender::ed::asset::shelf::settings_is_catalog_path_enabled(), blender::ed::asset::shelf::settings_set_active_catalog(), and blender::ed::asset::shelf::settings_set_catalog_path_enabled().
|
nodiscard |
Clean up the path. This ensures:
Definition at line 102 of file asset_catalog_path.cc.
References AssetCatalogPath(), cleanup_component(), iterate_components(), and SEPARATOR.
Referenced by blender::ed::asset::catalog_move(), blender::ed::asset::catalog_rename(), blender::asset_system::AssetCatalog::from_path(), blender::asset_system::AssetCatalogDefinitionFile::parse_catalog_line(), and blender::asset_system::tests::TEST().
|
staticprotected |
Strip leading/trailing spaces and replace disallowed characters.
Definition at line 130 of file asset_catalog_path.cc.
References blender::StringRefBase::trim().
Referenced by cleanup().
| uint64_t blender::asset_system::AssetCatalogPath::hash | ( | ) | const |
Definition at line 30 of file asset_catalog_path.cc.
| bool blender::asset_system::AssetCatalogPath::is_contained_in | ( | const AssetCatalogPath & | other_path | ) | const |
True: "some/path/there" is contained in "some/path" and "some". False: "path/there" is not contained in "some/path/there".
Note that non-cleaned-up paths (so for example starting or ending with a slash) are not supported, and result in undefined behavior.
Definition at line 138 of file asset_catalog_path.cc.
References length(), SEPARATOR, and blender::StringRefBase::startswith().
Referenced by blender::ed::asset_browser::AssetCatalogDropTarget::can_drop(), blender::asset_system::AssetCatalogService::create_catalog_filter(), blender::asset_system::AssetCatalogService::prune_catalogs_by_path(), rebase(), and blender::asset_system::tests::TEST().
| void blender::asset_system::AssetCatalogPath::iterate_components | ( | ComponentIteratorFn | callback | ) | const |
Definition at line 175 of file asset_catalog_path.cc.
References BLI_path_slash_find(), and callback.
Referenced by blender::ed::sculpt_paint::asset_library_ensure_catalogs_in_path(), cleanup(), blender::asset_system::AssetCatalogTree::insert_item(), and blender::asset_system::tests::TEST().
| uint64_t blender::asset_system::AssetCatalogPath::length | ( | ) | const |
Definition at line 36 of file asset_catalog_path.cc.
Referenced by is_contained_in(), rebase(), blender::ed::asset::shelf::settings_set_active_catalog(), and blender::asset_system::tests::TEST().
| StringRefNull blender::asset_system::AssetCatalogPath::name | ( | ) | const |
Definition at line 51 of file asset_catalog_path.cc.
References SEPARATOR.
Referenced by blender::ed::asset::shelf::add_catalog_tabs(), blender::ed::asset::catalog_move(), and blender::asset_system::tests::compare_item_with_path().
| blender::asset_system::AssetCatalogPath::operator bool | ( | ) | const |
Definition at line 91 of file asset_catalog_path.cc.
| bool blender::asset_system::AssetCatalogPath::operator!= | ( | const AssetCatalogPath & | other_path | ) | const |
Definition at line 66 of file asset_catalog_path.cc.
| AssetCatalogPath blender::asset_system::AssetCatalogPath::operator/ | ( | const AssetCatalogPath & | path_to_append | ) | const |
Concatenate two paths, returning the new path.
Definition at line 76 of file asset_catalog_path.cc.
References AssetCatalogPath(), and SEPARATOR.
| bool blender::asset_system::AssetCatalogPath::operator< | ( | const AssetCatalogPath & | other_path | ) | const |
Definition at line 71 of file asset_catalog_path.cc.
|
default |
|
default |
| bool blender::asset_system::AssetCatalogPath::operator== | ( | const AssetCatalogPath & | other_path | ) | const |
Definition at line 61 of file asset_catalog_path.cc.
| AssetCatalogPath blender::asset_system::AssetCatalogPath::parent | ( | ) | const |
Definition at line 163 of file asset_catalog_path.cc.
References AssetCatalogPath(), and SEPARATOR.
Referenced by blender::ed::asset_browser::AssetCatalogDropTarget::can_drop(), blender::ed::asset::catalog_rename(), blender::asset_system::AssetCatalogService::create_missing_catalogs(), and blender::asset_system::tests::TEST().
| AssetCatalogPath blender::asset_system::AssetCatalogPath::rebase | ( | const AssetCatalogPath & | from_path, |
| const AssetCatalogPath & | to_path ) const |
Change the initial part of the path from from_path to to_path. If this path does not start with from_path, return an empty path as result.
Example:
AssetCatalogPath path("some/path/to/some/catalog"); path.rebase("some/path", "new/base") -> "new/base/to/some/catalog"
Definition at line 198 of file asset_catalog_path.cc.
References AssetCatalogPath(), is_contained_in(), length(), and blender::StringRefBase::substr().
Referenced by blender::asset_system::tests::TEST(), and blender::asset_system::AssetCatalogService::update_catalog_path().
| const std::string & blender::asset_system::AssetCatalogPath::str | ( | ) | const |
Definition at line 46 of file asset_catalog_path.cc.
Referenced by blender::ed::space_node::add_root_catalogs_draw(), blender::ed::asset::shelf::AssetCatalogTreeView::build_catalog_items_recursive(), blender::ed::asset::build_filtered_catalog_tree(), blender::ed::geometry::catalog_assets_draw(), blender::asset_system::tests::compare_item_with_path(), blender::asset_system::AssetCatalogTree::insert_item(), blender::ed::space_node::node_add_catalog_assets_draw(), blender::asset_system::AssetCatalog::sensible_simple_name_for_path(), blender::ed::asset::shelf::settings_is_active_catalog(), blender::asset_system::tests::TEST(), blender::asset_system::tests::TEST_F(), blender::asset_system::tests::TEST_F(), blender::asset_system::tests::TEST_F(), blender::asset_system::tests::TEST_F(), blender::asset_system::tests::TEST_F(), blender::asset_system::tests::TEST_F(), blender::asset_system::tests::TEST_F(), blender::asset_system::tests::TEST_F(), blender::ed::object::ui_template_modifier_asset_menu_items(), blender::ed::space_node::ui_template_node_asset_menu_items(), blender::ed::geometry::ui_template_node_operator_asset_menu_items(), blender::ed::geometry::ui_template_node_operator_asset_root_items(), and blender::ed::sculpt_paint::visit_library_catalogs_catalog_for_search().
|
friend |
Output the path as string.
Definition at line 96 of file asset_catalog_path.cc.
|
static |
Definition at line 45 of file AS_asset_catalog_path.hh.
Referenced by cleanup(), blender::asset_system::tests::compare_item_with_path(), is_contained_in(), name(), operator/(), parent(), and blender::asset_system::AssetCatalog::sensible_simple_name_for_path().