2 class_name DialogicTimelineFormatLoader
3 extends ResourceFormatLoader
6 ## Returns all excepted extenstions
7 func _get_recognized_extensions() -> PackedStringArray:
8 return PackedStringArray(["dtl"])
11 ## Returns "Resource" if this file can/should be loaded by this script
12 func _get_resource_type(path: String) -> String:
13 var ext := path.get_extension().to_lower()
20 ## Returns the script class associated with a Resource
21 func _get_resource_script_class(path: String) -> String:
22 var ext := path.get_extension().to_lower()
24 return "DialogicTimeline"
29 ## Return true if this type is handled
30 func _handles_type(typename: StringName) -> bool:
31 return ClassDB.is_parent_class(typename, "Resource")
34 ## Parse the file and return a resource
35 func _load(path: String, _original_path: String, _use_sub_threads: bool, _cache_mode: int) -> Variant:
36 var file := FileAccess.open(path, FileAccess.READ)
39 # For now, just let editor know that for some reason you can't
41 print("[Dialogic] Error opening file:", FileAccess.get_open_error())
42 return FileAccess.get_open_error()
44 var tml := DialogicTimeline.new()
45 tml.from_text(file.get_as_text())