AssetTagRegistry๏
Inherits: Object
Reverse index of asset paths by tag.
Description๏
Stores and queries per-asset tag assignments for editor search and MCP tools.
Methods๏
void |
|
add_tags_to_asset(path: String, tags: PackedStringArray) |
|
asset_matches_tag_filter(path: String, tag_tokens: PackedStringArray, require_all: bool = true) const |
|
void |
|
void |
|
find_assets_by_tag(tag: String, match_parent: bool = true) const |
|
get_indexed_paths() const |
|
get_tags_for_asset(path: String) const |
|
get_unused_tags() const |
|
load() |
|
void |
|
remove_tags_from_asset(path: String, tags: PackedStringArray) |
|
rename_asset_path(old_path: String, new_path: String) |
|
rescan() |
|
save() |
|
void |
|
search_assets(tags: PackedStringArray, type_filter: String = "", path_glob: String = "", path_regex: String = "", require_all: bool = true) const |
|
set_tags_for_asset(path: String, tags: PackedStringArray) |
Signals๏
asset_tags_batch_changed(paths: PackedStringArray) ๐
Emitted after a batch commit with the list of asset paths whose tags changed.
asset_tags_changed(path: String) ๐
Emitted when tags change for a single asset path outside a batch.
index_reloaded() ๐
Emitted when the asset tag index is reloaded from disk.
Method Descriptions๏
void abort_batch() ๐
Discards the active index batch without persisting pending path changes.
Error add_tags_to_asset(path: String, tags: PackedStringArray) ๐
Adds tags to the asset at path. Returns @GlobalScope.OK on success, or an Error if the update fails.
bool asset_matches_tag_filter(path: String, tag_tokens: PackedStringArray, require_all: bool = true) const ๐
Returns true when the asset at path matches tag_tokens. When require_all is true, every token must match.
void begin_batch() ๐
Starts a nested index batch so multiple asset tag mutations can be committed together.
void cancel_opened_batch() ๐
Aborts every nested open batch and restores the previous index state.
Ends one batch level and persists dirty index paths when the outermost batch closes. Returns @GlobalScope.OK on success, or an Error if saving fails.
PackedStringArray find_assets_by_tag(tag: String, match_parent: bool = true) const ๐
Returns asset paths tagged with tag. When match_parent is true, hierarchical children of tag also match.
PackedStringArray get_indexed_paths() const ๐
Returns every asset path currently present in the tag index.
PackedStringArray get_tags_for_asset(path: String) const ๐
Returns the tags assigned to the asset at path.
PackedStringArray get_unused_tags() const ๐
Returns dictionary tags that are not assigned to any indexed asset.
Loads the asset tag index from disk. Returns @GlobalScope.OK on success, or an Error if the index cannot be read.
void prune_removed_paths() ๐
Immediately removes index entries whose asset paths no longer exist on disk.
Error remove_tags_from_asset(path: String, tags: PackedStringArray) ๐
Removes tags from the asset at path. Returns @GlobalScope.OK on success, or an Error if the update fails.
bool rename_asset_path(old_path: String, new_path: String) ๐
Moves indexed tags from old_path to new_path. Returns true when the path was remapped.
Rebuilds the reverse lookup from the current index and persists it. Returns @GlobalScope.OK on success, or an Error if saving fails.
Persists the asset tag index to disk. Returns @GlobalScope.OK on success, or an Error if writing fails.
void schedule_prune_removed_paths() ๐
Schedules a debounced call to prune_removed_paths().
Dictionary search_assets(tags: PackedStringArray, type_filter: String = "", path_glob: String = "", path_regex: String = "", require_all: bool = true) const ๐
Searches indexed assets by tags with optional type and path filters. Returns a result dictionary containing matching paths and metadata.
Error set_tags_for_asset(path: String, tags: PackedStringArray) ๐
Replaces all tags on the asset at path with tags. Returns @GlobalScope.OK on success, or an Error if the update fails.