2 class_name DialogicCharacterFormatSaver
3 extends ResourceFormatSaver
6 func _get_recognized_extensions(_resource: Resource) -> PackedStringArray:
7 return PackedStringArray(["dch"])
10 ## Return true if this resource should be loaded as a DialogicCharacter
11 func _recognize(resource: Resource) -> bool:
12 # Cast instead of using "is" keyword in case is a subclass
13 resource = resource as DialogicCharacter
22 func _save(resource: Resource, path: String = '', _flags: int = 0) -> Error:
23 var file := FileAccess.open(path, FileAccess.WRITE)
26 # For now, just let editor know that for some reason you can't
28 print("[Dialogic] Error opening file:", FileAccess.get_open_error())
29 return FileAccess.get_open_error()
31 var result := var_to_str(inst_to_dict(resource))
32 file.store_string(result)
33 # print('[Dialogic] Saved character "' , path, '"')