ResourceFormatSaver.xml 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <class name="ResourceFormatSaver" inherits="Reference" category="Core" version="3.1">
  3. <brief_description>
  4. Saves a specific resource type to a file.
  5. </brief_description>
  6. <description>
  7. The engine can save resources when you do it from the editor, or when you call [method ResourceSaver.save]. This is accomplished with multiple [code]ResourceFormatSaver[/code]s, each handling its own format.
  8. By default, Godot saves resources as [code].tres[/code], [code].res[/code] or another built-in format, but you can choose to create your own format by extending this class. You should give it a global class name with [code]class_name[/code] for it to be registered. You may as well implement a [ResourceFormatLoader].
  9. </description>
  10. <tutorials>
  11. </tutorials>
  12. <demos>
  13. </demos>
  14. <methods>
  15. <method name="get_recognized_extensions" qualifiers="virtual">
  16. <return type="PoolStringArray">
  17. </return>
  18. <argument index="0" name="resource" type="Resource">
  19. </argument>
  20. <description>
  21. Gets the list of extensions for files this saver is able to write.
  22. </description>
  23. </method>
  24. <method name="recognize" qualifiers="virtual">
  25. <return type="bool">
  26. </return>
  27. <argument index="0" name="resource" type="Resource">
  28. </argument>
  29. <description>
  30. Returns true if the given resource object can be saved by this saver.
  31. </description>
  32. </method>
  33. <method name="save" qualifiers="virtual">
  34. <return type="int">
  35. </return>
  36. <argument index="0" name="path" type="String">
  37. </argument>
  38. <argument index="1" name="resource" type="Resource">
  39. </argument>
  40. <argument index="2" name="flags" type="int">
  41. </argument>
  42. <description>
  43. Saves the given resource object to a file. [code]flags[/code] is a bitmask composed with [code]FLAG_*[/code] constants defined in [ResourceSaver]. Returns [code]OK[/code] on success, or an [code]ERR_*[/code] constant listed in [@GlobalScope] if it failed.
  44. </description>
  45. </method>
  46. </methods>
  47. <constants>
  48. </constants>
  49. </class>