Inheritance #
- AudioServer
- CameraServer
- ClassDB
- DisplayServer
- EditorFileSystemDirectory
- EditorInterface
- EditorPaths
- EditorSelection
- EditorUndoRedoManager
- EditorVCSInterface
- Engine
- EngineDebugger
- FramebufferCacheRD
- GDExtensionManager
- Geometry2D
- Geometry3D
- IP
- Input
- InputMap
- JNISingleton
- JSONRPC
- JavaClassWrapper
- JavaScriptBridge
- MainLoop (1)
- Marshalls
- MovieWriter
- NativeMenu
- NavigationMeshGenerator
- NavigationServer2D
- NavigationServer3D
- Node (21)
- OS
- OpenXRExtensionWrapperExtension
- OpenXRInteractionProfileMetadata
- Performance
- PhysicsDirectBodyState2D (1)
- PhysicsDirectBodyState3D (1)
- PhysicsDirectSpaceState2D (1)
- PhysicsDirectSpaceState3D (1)
- PhysicsServer2D (1)
- PhysicsServer2DManager
- PhysicsServer3D (1)
- PhysicsServer3DManager
- PhysicsServer3DRendering
ServerHandler
- ProjectSettings
- RefCounted (121)
- RenderData (2)
- RenderSceneData (2)
- RenderingDevice
- RenderingServer
- ResourceLoader
- ResourceSaver
- ResourceUID
- ScriptLanguage (1)
- ShaderIncludeDB
- TextServerManager
- ThemeDB
- TileData
- Time
- TranslationServer
- TreeItem
- UndoRedo
- UniformSetCacheRD
- WorkerThreadPool
- XRServer
- XRVRS
Table of contents
-
func add_resource_format_saver(at_front: bool = false) -> void -
func get_recognized_extensions(type: Resource) -> PackedStringArray -
func get_resource_id_for_path(generate: bool = false) -> int -
func remove_resource_format_saver(format_saver: ResourceFormatSaver) -> void -
func save(flags: int = 0 enumResourceSaver.SaverFlags) -> intError -
const FLAG_NONE = 0 enum SaverFlagsBitfield -
const FLAG_RELATIVE_PATHS = 1 enum SaverFlagsBitfield -
const FLAG_BUNDLE_RESOURCES = 2 enum SaverFlagsBitfield -
const FLAG_CHANGE_PATH = 4 enum SaverFlagsBitfield -
const FLAG_OMIT_EDITOR_PROPERTIES = 8 enum SaverFlagsBitfield -
const FLAG_SAVE_BIG_ENDIAN = 16 enum SaverFlagsBitfield -
const FLAG_COMPRESS = 32 enum SaverFlagsBitfield -
const FLAG_REPLACE_SUBRESOURCE_PATHS = 64 enum SaverFlagsBitfield -
enum SaverFlags
ResourceSaver #
is_instantiable, resource, core, not_builtin_classes, singleton
A singleton for saving Resources to the filesystem.
A singleton for saving resource types to the filesystem.
It uses the many ResourceFormatSaver classes registered in the engine (either built-in or from a plugin) to save resource data to text-based (e.g. .tres or .tscn) or binary files (e.g. .res or .scn).
Members #
Methods #
func add_resource_format_saver(at_front: bool = false) -> void#
Registers a new ResourceFormatSaver. The ResourceSaver will use the ResourceFormatSaver as described in save.
This method is performed implicitly for ResourceFormatSavers written in GDScript (see ResourceFormatSaver for more information).
func get_recognized_extensions(type: Resource) -> PackedStringArray#
Returns the list of extensions available for saving a resource of a given type.
func get_resource_id_for_path(generate: bool = false) -> int#
Returns the resource ID for the given path. If generate is true, a new resource ID will be generated if one for the path is not found. If generate is false and the path is not found, ResourceUID.INVALID_ID is returned.
func remove_resource_format_saver(format_saver: ResourceFormatSaver) -> void#
Unregisters the given ResourceFormatSaver.
func save(flags: int = 0 enumResourceSaver.SaverFlags) -> intError#
Saves a resource to disk to the given path, using a ResourceFormatSaver that recognizes the resource object. If path is empty, ResourceSaver will try to use Resource.resource_path.
The flags bitmask can be specified to customize the save behavior using SaverFlags flags.
Returns OK on success.
Note: When the project is running, any generated UID associated with the resource will not be saved as the required code is only executed in editor mode.
Annotations #
Constants #
const FLAG_NONE = 0 enum SaverFlagsBitfield#
No resource saving option.
const FLAG_RELATIVE_PATHS = 1 enum SaverFlagsBitfield#
Save the resource with a path relative to the scene which uses it.
const FLAG_BUNDLE_RESOURCES = 2 enum SaverFlagsBitfield#
Bundles external resources.
const FLAG_CHANGE_PATH = 4 enum SaverFlagsBitfield#
Changes the Resource.resource_path of the saved resource to match its new location.
const FLAG_OMIT_EDITOR_PROPERTIES = 8 enum SaverFlagsBitfield#
Do not save editor-specific metadata (identified by their __editor prefix).
const FLAG_SAVE_BIG_ENDIAN = 16 enum SaverFlagsBitfield#
Save as big endian (see FileAccess.big_endian).
const FLAG_COMPRESS = 32 enum SaverFlagsBitfield#
Compress the resource on save using FileAccess.COMPRESSION_ZSTD. Only available for binary resource types.
const FLAG_REPLACE_SUBRESOURCE_PATHS = 64 enum SaverFlagsBitfield#
Take over the paths of the saved subresources (see Resource.take_over_path).
Constructors #
Enums #
SaverFlags#
enum SaverFlags {
FLAG_NONE = 0,
FLAG_RELATIVE_PATHS = 1,
FLAG_BUNDLE_RESOURCES = 2,
FLAG_CHANGE_PATH = 4,
FLAG_OMIT_EDITOR_PROPERTIES = 8,
FLAG_SAVE_BIG_ENDIAN = 16,
FLAG_COMPRESS = 32,
FLAG_REPLACE_SUBRESOURCE_PATHS = 64,
}