:github_url: hide .. DO NOT EDIT THIS FILE!!! .. Generated automatically from Godot engine sources. .. Generator: https://github.com/godotengine/godot/tree/3.6/doc/tools/make_rst.py. .. XML source: https://github.com/godotengine/godot/tree/3.6/doc/classes/ResourceSaver.xml. .. _class_ResourceSaver: ResourceSaver ============= **Inherits:** :ref:`Object` Singleton for saving Godot-specific resource types. .. rst-class:: classref-introduction-group Description ----------- Singleton for saving Godot-specific resource types to the filesystem. It uses the many :ref:`ResourceFormatSaver` classes registered in the engine (either built-in or from a plugin) to save engine-specific resource data to text-based (e.g. ``.tres`` or ``.tscn``) or binary files (e.g. ``.res`` or ``.scn``). .. rst-class:: classref-reftable-group Methods ------- .. table:: :widths: auto +-----------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`PoolStringArray` | :ref:`get_recognized_extensions` **(** :ref:`Resource` type **)** | +-----------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Error` | :ref:`save` **(** :ref:`String` path, :ref:`Resource` resource, :ref:`SaverFlags` flags=0 **)** | +-----------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ .. rst-class:: classref-section-separator ---- .. rst-class:: classref-descriptions-group Enumerations ------------ .. _enum_ResourceSaver_SaverFlags: .. rst-class:: classref-enumeration enum **SaverFlags**: .. _class_ResourceSaver_constant_FLAG_RELATIVE_PATHS: .. rst-class:: classref-enumeration-constant :ref:`SaverFlags` **FLAG_RELATIVE_PATHS** = ``1`` Save the resource with a path relative to the scene which uses it. .. _class_ResourceSaver_constant_FLAG_BUNDLE_RESOURCES: .. rst-class:: classref-enumeration-constant :ref:`SaverFlags` **FLAG_BUNDLE_RESOURCES** = ``2`` Bundles external resources. .. _class_ResourceSaver_constant_FLAG_CHANGE_PATH: .. rst-class:: classref-enumeration-constant :ref:`SaverFlags` **FLAG_CHANGE_PATH** = ``4`` Changes the :ref:`Resource.resource_path` of the saved resource to match its new location. .. _class_ResourceSaver_constant_FLAG_OMIT_EDITOR_PROPERTIES: .. rst-class:: classref-enumeration-constant :ref:`SaverFlags` **FLAG_OMIT_EDITOR_PROPERTIES** = ``8`` Do not save editor-specific metadata (identified by their ``__editor`` prefix). .. _class_ResourceSaver_constant_FLAG_SAVE_BIG_ENDIAN: .. rst-class:: classref-enumeration-constant :ref:`SaverFlags` **FLAG_SAVE_BIG_ENDIAN** = ``16`` Save as big endian (see :ref:`File.endian_swap`). .. _class_ResourceSaver_constant_FLAG_COMPRESS: .. rst-class:: classref-enumeration-constant :ref:`SaverFlags` **FLAG_COMPRESS** = ``32`` Compress the resource on save using :ref:`File.COMPRESSION_ZSTD`. Only available for binary resource types. .. _class_ResourceSaver_constant_FLAG_REPLACE_SUBRESOURCE_PATHS: .. rst-class:: classref-enumeration-constant :ref:`SaverFlags` **FLAG_REPLACE_SUBRESOURCE_PATHS** = ``64`` Take over the paths of the saved subresources (see :ref:`Resource.take_over_path`). .. rst-class:: classref-section-separator ---- .. rst-class:: classref-descriptions-group Method Descriptions ------------------- .. _class_ResourceSaver_method_get_recognized_extensions: .. rst-class:: classref-method :ref:`PoolStringArray` **get_recognized_extensions** **(** :ref:`Resource` type **)** Returns the list of extensions available for saving a resource of a given type. .. rst-class:: classref-item-separator ---- .. _class_ResourceSaver_method_save: .. rst-class:: classref-method :ref:`Error` **save** **(** :ref:`String` path, :ref:`Resource` resource, :ref:`SaverFlags` flags=0 **)** Saves a resource to disk to the given path, using a :ref:`ResourceFormatSaver` that recognizes the resource object. The ``flags`` bitmask can be specified to customize the save behavior. Returns :ref:`@GlobalScope.OK` on success. .. |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.)` .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`