2 class_name DialogicPortraitAnimationUtil
4 enum AnimationType {ALL=-1, IN=1, OUT=2, ACTION=3, CROSSFADE=4}
7 static func guess_animation(string:String, type := AnimationType.ALL) -> String:
15 filter = {"type":AnimationType.IN}
18 filter = {"type":AnimationType.OUT}
21 filter = {"type":AnimationType.ACTION}
22 AnimationType.CROSSFADE:
23 filter = {"type":AnimationType.CROSSFADE}
25 return DialogicResourceUtil.guess_special_resource(&"PortraitAnimation", string, default, filter, ignores).get("path", "")
28 static func get_portrait_animations_filtered(type := AnimationType.ALL) -> Dictionary:
29 var filter := {"type":type}
30 if type == AnimationType.ALL:
31 filter["type"] = [AnimationType.IN, AnimationType.OUT, AnimationType.ACTION]
32 return DialogicResourceUtil.list_special_resources("PortraitAnimation", filter)
35 static func get_suggestions(_search_text := "", current_value:= "", empty_text := "Default", action := AnimationType.ALL) -> Dictionary:
38 if empty_text and current_value:
39 suggestions[empty_text] = {'value':"", 'editor_icon':["GuiRadioUnchecked", "EditorIcons"]}
41 for anim_name in get_portrait_animations_filtered(action):
42 suggestions[DialogicUtil.pretty_name(anim_name)] = {
43 'value' : DialogicUtil.pretty_name(anim_name),
44 'editor_icon' : ["Animation", "EditorIcons"]