AssetTagManager๏
Inherits: Object
Manages the project asset tag dictionary.
Description๏
Singleton that stores hierarchical asset tags, supports CRUD operations, and validates tag hierarchy semantics.
Methods๏
void |
|
add_tag(tag_name: String, comment: String = "", source: String = "default") |
|
void |
|
commit_batch(persist: bool = true) |
|
container_has_all(container: PackedStringArray, query_tags: PackedStringArray) const |
|
container_has_any(container: PackedStringArray, query_tags: PackedStringArray) const |
|
container_has_tag(container: PackedStringArray, tag: String) const |
|
get_tag_info(tag_name: String) const |
|
has_tag_in_dictionary(tag_name: String) const |
|
list_all_tags() const |
|
load() |
|
matches_tag(tag: String, query_tag: String) const |
|
remove_tag(tag_name: String) |
|
rename_tag(old_name: String, new_name: String) |
|
resolve_tag_alias(tag_name: String) const |
|
save() |
|
update_tag_comment(tag_name: String, comment: String) |
Signals๏
redirects_changed() ๐
Emitted when tag rename/remove redirects are updated.
tag_dictionary_changed() ๐
Emitted when the tag dictionary contents change.
Method Descriptions๏
void abort_batch() ๐
Discards the active dictionary batch without persisting changes.
Error add_tag(tag_name: String, comment: String = "", source: String = "default") ๐
Adds tag_name to the dictionary with optional comment and source. Returns @GlobalScope.OK on success, or an Error if the name is invalid or already present.
void begin_batch() ๐
Starts a nested dictionary batch so multiple mutations can be committed together.
Error commit_batch(persist: bool = true) ๐
Ends one batch level and optionally persists the dictionary when persist is true. Returns @GlobalScope.OK on success, or an Error if saving fails.
bool container_has_all(container: PackedStringArray, query_tags: PackedStringArray) const ๐
Returns true when container matches every tag in query_tags, including hierarchical parent matches.
bool container_has_any(container: PackedStringArray, query_tags: PackedStringArray) const ๐
Returns true when container matches at least one tag in query_tags.
bool container_has_tag(container: PackedStringArray, tag: String) const ๐
Returns true when container contains tag or a hierarchical child of it.
Dictionary get_tag_info(tag_name: String) const ๐
Returns metadata for tag_name, including comment and source fields when the tag exists.
bool has_tag_in_dictionary(tag_name: String) const ๐
Returns true when tag_name exists in the dictionary after alias resolution.
PackedStringArray list_all_tags() const ๐
Returns every tag name currently stored in the dictionary.
PackedStringArray list_tags(parent_tag: String = "") const ๐
Returns direct child tags of parent_tag, or root tags when parent_tag is empty.
Loads the tag dictionary from disk. Returns @GlobalScope.OK on success, or an Error if the file cannot be read.
bool matches_tag(tag: String, query_tag: String) const ๐
Returns true when tag equals query_tag or is a hierarchical descendant of it.
Error remove_tag(tag_name: String) ๐
Removes tag_name from the dictionary and records a redirect. Returns @GlobalScope.OK on success, or an Error if the tag is missing.
Error rename_tag(old_name: String, new_name: String) ๐
Renames old_name to new_name and updates redirects. Returns @GlobalScope.OK on success, or an Error if the rename is invalid.
String resolve_tag_alias(tag_name: String) const ๐
Resolves tag_name through redirects and returns the canonical dictionary name.
Persists the tag dictionary to disk. Returns @GlobalScope.OK on success, or an Error if writing fails.
Error update_tag_comment(tag_name: String, comment: String) ๐
Sets the comment text for tag_name. Returns @GlobalScope.OK on success, or an Error if the tag is missing.