ResourceSaver.xml 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <class name="ResourceSaver" inherits="Object" version="4.0">
  3. <brief_description>
  4. Singleton for saving Godot-specific resource types.
  5. </brief_description>
  6. <description>
  7. Singleton for saving Godot-specific resource types to the filesystem.
  8. It uses the many [ResourceFormatSaver] classes registered in the engine (either built-in or from a plugin) to save engine-specific resource data to text-based (e.g. [code].tres[/code] or [code].tscn[/code]) or binary files (e.g. [code].res[/code] or [code].scn[/code]).
  9. </description>
  10. <tutorials>
  11. </tutorials>
  12. <methods>
  13. <method name="get_recognized_extensions">
  14. <return type="PackedStringArray" />
  15. <argument index="0" name="type" type="Resource" />
  16. <description>
  17. Returns the list of extensions available for saving a resource of a given type.
  18. </description>
  19. </method>
  20. <method name="save">
  21. <return type="int" enum="Error" />
  22. <argument index="0" name="path" type="String" />
  23. <argument index="1" name="resource" type="Resource" />
  24. <argument index="2" name="flags" type="int" enum="ResourceSaver.SaverFlags" default="0" />
  25. <description>
  26. Saves a resource to disk to the given path, using a [ResourceFormatSaver] that recognizes the resource object.
  27. The [code]flags[/code] bitmask can be specified to customize the save behavior.
  28. Returns [constant OK] on success.
  29. </description>
  30. </method>
  31. </methods>
  32. <constants>
  33. <constant name="FLAG_RELATIVE_PATHS" value="1" enum="SaverFlags">
  34. Save the resource with a path relative to the scene which uses it.
  35. </constant>
  36. <constant name="FLAG_BUNDLE_RESOURCES" value="2" enum="SaverFlags">
  37. Bundles external resources.
  38. </constant>
  39. <constant name="FLAG_CHANGE_PATH" value="4" enum="SaverFlags">
  40. Changes the [member Resource.resource_path] of the saved resource to match its new location.
  41. </constant>
  42. <constant name="FLAG_OMIT_EDITOR_PROPERTIES" value="8" enum="SaverFlags">
  43. Do not save editor-specific metadata (identified by their [code]__editor[/code] prefix).
  44. </constant>
  45. <constant name="FLAG_SAVE_BIG_ENDIAN" value="16" enum="SaverFlags">
  46. Save as big endian (see [member File.big_endian]).
  47. </constant>
  48. <constant name="FLAG_COMPRESS" value="32" enum="SaverFlags">
  49. Compress the resource on save using [constant File.COMPRESSION_ZSTD]. Only available for binary resource types.
  50. </constant>
  51. <constant name="FLAG_REPLACE_SUBRESOURCE_PATHS" value="64" enum="SaverFlags">
  52. Take over the paths of the saved subresources (see [method Resource.take_over_path]).
  53. </constant>
  54. </constants>
  55. </class>