2
0

ResourceSaver.xml 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <class name="ResourceSaver" inherits="Object" version="3.4">
  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="PoolStringArray">
  15. </return>
  16. <argument index="0" name="type" type="Resource">
  17. </argument>
  18. <description>
  19. Returns the list of extensions available for saving a resource of a given type.
  20. </description>
  21. </method>
  22. <method name="save">
  23. <return type="int" enum="Error">
  24. </return>
  25. <argument index="0" name="path" type="String">
  26. </argument>
  27. <argument index="1" name="resource" type="Resource">
  28. </argument>
  29. <argument index="2" name="flags" type="int" enum="ResourceSaver.SaverFlags" default="0">
  30. </argument>
  31. <description>
  32. Saves a resource to disk to the given path, using a [ResourceFormatSaver] that recognizes the resource object.
  33. The [code]flags[/code] bitmask can be specified to customize the save behavior.
  34. Returns [constant OK] on success.
  35. </description>
  36. </method>
  37. </methods>
  38. <constants>
  39. <constant name="FLAG_RELATIVE_PATHS" value="1" enum="SaverFlags">
  40. Save the resource with a path relative to the scene which uses it.
  41. </constant>
  42. <constant name="FLAG_BUNDLE_RESOURCES" value="2" enum="SaverFlags">
  43. Bundles external resources.
  44. </constant>
  45. <constant name="FLAG_CHANGE_PATH" value="4" enum="SaverFlags">
  46. Changes the [member Resource.resource_path] of the saved resource to match its new location.
  47. </constant>
  48. <constant name="FLAG_OMIT_EDITOR_PROPERTIES" value="8" enum="SaverFlags">
  49. Do not save editor-specific metadata (identified by their [code]__editor[/code] prefix).
  50. </constant>
  51. <constant name="FLAG_SAVE_BIG_ENDIAN" value="16" enum="SaverFlags">
  52. Save as big endian (see [member File.endian_swap]).
  53. </constant>
  54. <constant name="FLAG_COMPRESS" value="32" enum="SaverFlags">
  55. Compress the resource on save using [constant File.COMPRESSION_ZSTD]. Only available for binary resource types.
  56. </constant>
  57. <constant name="FLAG_REPLACE_SUBRESOURCE_PATHS" value="64" enum="SaverFlags">
  58. Take over the paths of the saved subresources (see [method Resource.take_over_path]).
  59. </constant>
  60. </constants>
  61. </class>