:github_url: hide .. Generated automatically by doc/tools/make_rst.py in Godot's source tree. .. DO NOT EDIT THIS FILE, but the ResourceFormatSaver.xml source instead. .. The source is found in doc/classes or modules//doc_classes. .. _class_ResourceFormatSaver: ResourceFormatSaver =================== **Inherits:** :ref:`RefCounted` **<** :ref:`Object` Saves a specific resource type to a file. Description ----------- The engine can save resources when you do it from the editor, or when you use the :ref:`ResourceSaver` singleton. This is accomplished thanks to multiple ``ResourceFormatSaver``\ s, each handling its own format and called automatically by the engine. 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`. Methods ------- +---------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`PackedStringArray` | :ref:`_get_recognized_extensions` **(** :ref:`Resource` resource **)** |virtual| |const| | +---------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`_recognize` **(** :ref:`Resource` resource **)** |virtual| |const| | +---------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`int` | :ref:`_save` **(** :ref:`String` path, :ref:`Resource` resource, :ref:`int` flags **)** |virtual| | +---------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ Method Descriptions ------------------- .. _class_ResourceFormatSaver_method__get_recognized_extensions: - :ref:`PackedStringArray` **_get_recognized_extensions** **(** :ref:`Resource` resource **)** |virtual| |const| Returns the list of extensions available for saving the resource object, provided it is recognized (see :ref:`_recognize`). ---- .. _class_ResourceFormatSaver_method__recognize: - :ref:`bool` **_recognize** **(** :ref:`Resource` resource **)** |virtual| |const| Returns whether the given resource object can be saved by this saver. ---- .. _class_ResourceFormatSaver_method__save: - :ref:`int` **_save** **(** :ref:`String` path, :ref:`Resource` resource, :ref:`int` flags **)** |virtual| Saves the given resource object to a file at the target ``path``. ``flags`` is a bitmask composed with :ref:`SaverFlags` constants. Returns :ref:`@GlobalScope.OK` on success, or an :ref:`Error` constant in case of failure. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)` .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)` .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)` .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)` .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)` .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`