Skip to content

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 ​

voidensure_directories() static
voidensure_initialized() static
voidinitialize() static
voidrefresh_database() static
Stringget_parent_package( entity_type: String ) static
boolinherits_from( entity_type: String, potential_parent: String ) static
Array[String]get_inheritance_chain( entity_type: String ) static
AnimationCoreMapget_animation_map( entity_type: String ) static
AnimationLibrarybuild_library_for_entity( entity_type: String ) static
Arrayget_entity_types() static
Arrayget_package_categories( entity_type: String, package: String ) static
Arrayget_category_subcategories( entity_type: String, package: String, category: String, inherit_from_parent: bool = true ) static
Arrayget_animations( entity_type: String, package: String, category: String, subcategory: String ) static
Arrayget_animations_direct( entity_type: String, package: String, category: String, subcategory: String ) static
Arrayget_flat_category_animations( entity_type: String, package: String, category: String, inherit_from_parent: bool = true ) static
boolis_flat_category( package: String, category: String ) static
Arrayget_available_status_effects() static
Arrayget_entities_with_package( package: String ) static
Arrayget_organized_ability_animations( entity_type: String, package: String, category: String, subcategory: String ) static
Arrayget_available_animations( entity_type: String, package: String, category: String, subcategory: String ) static
Stringget_category_display_name( package: String, category: String ) static

Constants ​

  • String ANIMATIONS_RESOURCES_PATH = "res://src/data/animations/" - The folder the animations are read from.
  • Dictionary ANIMATION_PACKAGES = { - Animation package definitions - simplified structure Updated: weapon_melee and weapon_ranged merged into "weapon", added "aim" and "reload"
  • Dictionary WEAPON_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 clips
  • Array OLD_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)