DatabaseAnimation ​
Inherits: RefCounted
The animation library of the project, read from the folders under res://src/data/animations/.
Description ​
The first folder level is an ENTITY TYPE (humanoid, monster ...). Inside it are the animation PACKAGES that ANIMATION_PACKAGES lists (ability animations, core, social, status effects), each with categories and subcategories. An entity type can name a parent package in its animation_map.tres (made automatically), and the animations it does not have are taken from its parent. The folders are scanned once on first use; call refresh_database after adding files.
Methods ​
void | ensure_directories() static |
void | ensure_initialized() static |
void | initialize() static |
void | refresh_database() static |
String | get_parent_package( entity_type: String ) static |
bool | inherits_from( entity_type: String, potential_parent: String ) static |
Array[String] | get_inheritance_chain( entity_type: String ) static |
AnimationCoreMap | get_animation_map( entity_type: String ) static |
AnimationLibrary | build_library_for_entity( entity_type: String ) static |
Array | get_entity_types() static |
Array | get_package_categories( entity_type: String, package: String ) static |
Array | get_category_subcategories( entity_type: String, package: String, category: String, inherit_from_parent: bool = true ) static |
Array | get_animations( entity_type: String, package: String, category: String, subcategory: String ) static |
Array | get_animations_direct( entity_type: String, package: String, category: String, subcategory: String ) static |
Array | get_flat_category_animations( entity_type: String, package: String, category: String, inherit_from_parent: bool = true ) static |
bool | is_flat_category( package: String, category: String ) static |
Array | get_available_status_effects() static |
Array | get_entities_with_package( package: String ) static |
Array | get_organized_ability_animations( entity_type: String, package: String, category: String, subcategory: String ) static |
Array | get_available_animations( entity_type: String, package: String, category: String, subcategory: String ) static |
String | get_category_display_name( package: String, category: String ) static |
Constants ​
StringANIMATIONS_RESOURCES_PATH ="res://src/data/animations/"- The folder the animations are read from.DictionaryANIMATION_PACKAGES ={- Animation package definitions - simplified structure Updated: weapon_melee and weapon_ranged merged into "weapon", added "aim" and "reload"DictionaryWEAPON_ROLES ={"weapon": "attack", "aim": "aim", "reload": "reload"}- The category of the ability animations (weapon, aim, reload) and the role of the Weapon Profile that holds the same clipsArrayOLD_WEAPON_CATEGORIES =["weapon", "aim", "reload"]- The folders of the ability animations that the weapon animations replaced (packs that still have them keep working)
Method descriptions ​
void ensure_directories() ​
Ensure all required directories exist
void ensure_initialized() ​
Makes the animations folder (when missing) and scans the animations once.
void initialize() ​
Initialize the animation database by scanning all entity types
void refresh_database() ​
Force refresh of the entire database (useful for development)
String get_parent_package( entity_type: String ) ​
Get the parent package for an entity type (cached)
bool inherits_from( entity_type: String, potential_parent: String ) ​
Check if entity_type inherits from potential_parent (directly or indirectly)
Array[String] get_inheritance_chain( entity_type: String ) ​
Get the full inheritance chain for an entity type
AnimationCoreMap get_animation_map( entity_type: String ) ​
Get animation map for a specific entity type
AnimationLibrary build_library_for_entity( entity_type: String ) ​
Build an AnimationLibrary for a specific entity (includes parent animations)
Array get_entity_types() ​
Get all available entity types
Array get_package_categories( entity_type: String, package: String ) ​
Get available categories within a package for an entity
Array get_category_subcategories( entity_type: String, package: String, category: String, inherit_from_parent: bool = true ) ​
Get available subcategories within a category for an entity package Includes parent package subcategories if inherit_from_parent is true
Array get_animations( entity_type: String, package: String, category: String, subcategory: String ) ​
Get animations for a specific path with parent fallback
Array get_animations_direct( entity_type: String, package: String, category: String, subcategory: String ) ​
The animations of a path in one pack, without the parent packs (empty when the pack has none)
Array get_flat_category_animations( entity_type: String, package: String, category: String, inherit_from_parent: bool = true ) ​
Get animations from a flat category (returns array directly, not subcategories) Used for categories like casting, spell_cast, special_attack, aim, reload
bool is_flat_category( package: String, category: String ) ​
Check if a category uses flat structure (array) vs categorized (dictionary with subcategories)
Array get_available_status_effects() ​
Get all available status effects from all entities
Array get_entities_with_package( package: String ) ​
Get entities that have a specific package
Array get_organized_ability_animations( entity_type: String, package: String, category: String, subcategory: String ) ​
Get organized ability animations with parent fallback
Array get_available_animations( entity_type: String, package: String, category: String, subcategory: String ) ​
Get available animations for a specific entity, package, category, and subcategory Returns animations in the correct sequence based on category type Includes parent package fallback
String get_category_display_name( package: String, category: String ) ​
Get display name for a category (converts internal names to user-friendly names)