class_resourceformatsaver.rst 4.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. :github_url: hide
  2. .. DO NOT EDIT THIS FILE!!!
  3. .. Generated automatically from Godot engine sources.
  4. .. Generator: https://github.com/godotengine/godot/tree/3.5/doc/tools/make_rst.py.
  5. .. XML source: https://github.com/godotengine/godot/tree/3.5/doc/classes/ResourceFormatSaver.xml.
  6. .. _class_ResourceFormatSaver:
  7. ResourceFormatSaver
  8. ===================
  9. **Inherits:** :ref:`Reference<class_Reference>` **<** :ref:`Object<class_Object>`
  10. Saves a specific resource type to a file.
  11. .. rst-class:: classref-introduction-group
  12. Description
  13. -----------
  14. The engine can save resources when you do it from the editor, or when you use the :ref:`ResourceSaver<class_ResourceSaver>` singleton. This is accomplished thanks to multiple **ResourceFormatSaver**\ s, each handling its own format and called automatically by the engine.
  15. By default, Godot saves resources as ``.tres`` (text-based), ``.res`` (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 ``class_name`` 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 :ref:`ResourceFormatLoader<class_ResourceFormatLoader>`.
  16. .. rst-class:: classref-reftable-group
  17. Methods
  18. -------
  19. .. table::
  20. :widths: auto
  21. +-----------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  22. | :ref:`PoolStringArray<class_PoolStringArray>` | :ref:`get_recognized_extensions<class_ResourceFormatSaver_method_get_recognized_extensions>` **(** :ref:`Resource<class_Resource>` resource **)** |virtual| |
  23. +-----------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  24. | :ref:`bool<class_bool>` | :ref:`recognize<class_ResourceFormatSaver_method_recognize>` **(** :ref:`Resource<class_Resource>` resource **)** |virtual| |
  25. +-----------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  26. | :ref:`int<class_int>` | :ref:`save<class_ResourceFormatSaver_method_save>` **(** :ref:`String<class_String>` path, :ref:`Resource<class_Resource>` resource, :ref:`int<class_int>` flags **)** |virtual| |
  27. +-----------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  28. .. rst-class:: classref-section-separator
  29. ----
  30. .. rst-class:: classref-descriptions-group
  31. Method Descriptions
  32. -------------------
  33. .. _class_ResourceFormatSaver_method_get_recognized_extensions:
  34. .. rst-class:: classref-method
  35. :ref:`PoolStringArray<class_PoolStringArray>` **get_recognized_extensions** **(** :ref:`Resource<class_Resource>` resource **)** |virtual|
  36. Returns the list of extensions available for saving the resource object, provided it is recognized (see :ref:`recognize<class_ResourceFormatSaver_method_recognize>`).
  37. .. rst-class:: classref-item-separator
  38. ----
  39. .. _class_ResourceFormatSaver_method_recognize:
  40. .. rst-class:: classref-method
  41. :ref:`bool<class_bool>` **recognize** **(** :ref:`Resource<class_Resource>` resource **)** |virtual|
  42. Returns whether the given resource object can be saved by this saver.
  43. .. rst-class:: classref-item-separator
  44. ----
  45. .. _class_ResourceFormatSaver_method_save:
  46. .. rst-class:: classref-method
  47. :ref:`int<class_int>` **save** **(** :ref:`String<class_String>` path, :ref:`Resource<class_Resource>` resource, :ref:`int<class_int>` flags **)** |virtual|
  48. Saves the given resource object to a file at the target ``path``. ``flags`` is a bitmask composed with :ref:`SaverFlags<enum_ResourceSaver_SaverFlags>` constants.
  49. Returns :ref:`@GlobalScope.OK<class_@GlobalScope_constant_OK>` on success, or an :ref:`Error<enum_@GlobalScope_Error>` constant in case of failure.
  50. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  51. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  52. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  53. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`