ResourceFormatSaver.xml 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <class name="ResourceFormatSaver" inherits="Reference" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
  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 use the [ResourceSaver] singleton. This is accomplished thanks to multiple [ResourceFormatSaver]s, each handling its own format and called automatically by the engine.
  8. By default, Godot saves resources as [code].tres[/code] (text-based), [code].res[/code] (binary) or another built-in format, but you can choose to create your own format by extending this class. Be sure to respect the documented return types and values. You should give it a global class name with [code]class_name[/code] for it to be registered. Like built-in ResourceFormatSavers, it will be called automatically when saving resources of its recognized type(s). You may also implement a [ResourceFormatLoader].
  9. </description>
  10. <tutorials>
  11. </tutorials>
  12. <methods>
  13. <method name="get_recognized_extensions" qualifiers="virtual">
  14. <return type="PoolStringArray" />
  15. <argument index="0" name="resource" type="Resource" />
  16. <description>
  17. Returns the list of extensions available for saving the resource object, provided it is recognized (see [method recognize]).
  18. </description>
  19. </method>
  20. <method name="recognize" qualifiers="virtual">
  21. <return type="bool" />
  22. <argument index="0" name="resource" type="Resource" />
  23. <description>
  24. Returns whether the given resource object can be saved by this saver.
  25. </description>
  26. </method>
  27. <method name="save" qualifiers="virtual">
  28. <return type="int" />
  29. <argument index="0" name="path" type="String" />
  30. <argument index="1" name="resource" type="Resource" />
  31. <argument index="2" name="flags" type="int" />
  32. <description>
  33. Saves the given resource object to a file at the target [code]path[/code]. [code]flags[/code] is a bitmask composed with [enum ResourceSaver.SaverFlags] constants.
  34. Returns [constant OK] on success, or an [enum Error] constant in case of failure.
  35. </description>
  36. </method>
  37. </methods>
  38. <constants>
  39. </constants>
  40. </class>