WeaponProfiles ​
Inherits: RefCounted
The Weapon Animation Profiles at work: the list of them, the folders they make in the animation packs, and the clips a pack has for a profile.
Description ​
A profile (see WeaponProfile) is defined once. This class puts its folders weapon_animations/<folder>/<role>/ in EVERY animation pack under res://src/data/animations/ (the ones that exist and, through DatabaseAnimation.create_entity_folder_structure, the ones made later), and answers what clip a pack plays for a role of a profile. A pack takes the clips it has not from its parent pack. Old projects that named the weapon folders by hand keep working: a tag that is not the folder of a profile is looked up in the old places (ability_animations/weapon/<tag>).
Methods ​
Array[WeaponProfile] | all() static |
WeaponProfile | find( profile_id: int ) static |
WeaponProfile | find_by_folder( folder: String ) static |
String | unique_folder_name( display_name: String ) static |
Dictionary | build_tags( profile: WeaponProfile, left_hand: bool = false ) static |
String | profile_folder_of_tag( tag: String ) static |
PackedStringArray | get_pack_names() static |
int | create_folders_for( pack: String ) static |
int | sync_all() static |
Array[Dictionary] | get_missing_folders( pack: String ) static |
Array[String] | get_clips( pack: String, folder: String, role: String ) static |
String | left_hand_tag( folder: String ) static |
Array[String] | resolve_clips( pack: String, tag: String, role: String ) static |
String | first_clip( pack: String, tag: String, role: String ) static |
Array[Dictionary] | get_pack_report( pack: String ) static |
Constants ​
StringPACKAGE ="weapon_animations"- The folder of the weapon animations in a pack
Method descriptions ​
Array[WeaponProfile] all() ​
Every profile, sorted by name (Unarmed first)
WeaponProfile find( profile_id: int ) ​
The profile with this id (null for none)
WeaponProfile find_by_folder( folder: String ) ​
The profile whose folder is this (null when no profile has it: an old tag)
String unique_folder_name( display_name: String ) ​
A folder name no profile uses yet, made from a name ("One Hand" -> "one_hand", then "one_hand_2")
Dictionary build_tags( profile: WeaponProfile, left_hand: bool = false ) ​
The animation tags of a profile, as the entity hands them to the animation player and the abilities: attack_tag, stance_tag, aim_tag, reload_tag (the folder of the profile; the attack of the left hand has a role after a slash) and is_ranged
String profile_folder_of_tag( tag: String ) ​
The profile an animation tag belongs to: its folder, without the role after a slash ("one_hand/attack_left" -> "one_hand"). A tag that is not a profile gives itself
PackedStringArray get_pack_names() ​
The names of the animation packs (the folders under res://src/data/animations/)
int create_folders_for( pack: String ) ​
Makes the folders of every profile in a pack (the ones that are missing). Gives how many folders it made
int sync_all() ​
Makes the folders of every profile in every pack, so a profile made today is in the packs of yesterday. Gives how many folders it made
Array[Dictionary] get_missing_folders( pack: String ) ​
The folders a pack lacks for the profiles (the report of the editor): [{profile, path}]
Array[String] get_clips( pack: String, folder: String, role: String ) ​
The clips of a role of a profile in a pack, with the clips of its parent packs when it has none of its own (empty when the folder has no clips or the tag is not a profile)
String left_hand_tag( folder: String ) ​
The tag of the left hand's attack of a profile ("one_hand/attack_left"): the animation tags of the abilities are the folder of the profile, with a role after a slash when it is not the default one
Array[String] resolve_clips( pack: String, tag: String, role: String ) ​
The clips of a pack for a role of the profile named by tag (its folder, or "folder/role"), as the animation player needs them: the left hand's attack falls back on the right hand's. Empty when the tag is not the folder of a profile
String first_clip( pack: String, tag: String, role: String ) ​
The first clip of a role (the stance), or "" when there is none
Array[Dictionary] get_pack_report( pack: String ) ​
For every profile, how many clips each role has in a pack: [{profile, roles: [{role, own, inherited}], missing_folders}] (the table of the editor)