Documentation
¶
Overview ¶
Package ResourceFormatSaver provides methods for working with ResourceFormatSaver object instances.
Index ¶
- type Advanced
- type Any
- type Extension
- type ID
- type Implementation
- type Instance
- func (self Instance) AsObject() [1]gd.Object
- func (self Instance) AsRefCounted() [1]gd.RefCounted
- func (self Instance) AsResourceFormatSaver() Instance
- func (self Instance) ID() ID
- func (self *Instance) SetObject(obj [1]gd.Object) bool
- func (self *Instance) UnsafePointer() unsafe.Pointer
- func (self Instance) Virtual(name string) reflect.Value
- type Interface
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Advanced ¶
type Advanced = class
Advanced exposes a 1:1 low-level instance of the class, undocumented, for those who know what they are doing.
type Extension ¶
Extension can be embedded in a new struct to create an extension of this class. T should be the type that is embedding this Extension
func (*Extension[T]) AsRefCounted ¶
func (self *Extension[T]) AsRefCounted() [1]gd.RefCounted
func (*Extension[T]) AsResourceFormatSaver ¶
type ID ¶
ID is a typed object ID (reference) to an instance of this class, use it to store references to objects with unknown lifetimes, as an ID will not panic on use if the underlying object has been destroyed.
type Implementation ¶
type Implementation = implementation
Implementation implements Interface with empty methods.
type Instance ¶
type Instance [1]gdclass.ResourceFormatSaver
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. 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].
See [Interface] for methods that can be overridden by a [Class] that extends it.
var Nil Instance
Nil is a nil/null instance of the class. Equivalent to the zero value.
func (Instance) AsRefCounted ¶
func (self Instance) AsRefCounted() [1]gd.RefCounted
func (Instance) AsResourceFormatSaver ¶
func (*Instance) UnsafePointer ¶
type Interface ¶
type Interface interface { //Saves the given resource object to a file at the target [param path]. [param flags] is a bitmask composed with [enum ResourceSaver.SaverFlags] constants. //Returns [constant OK] on success, or an [enum Error] constant in case of failure. Save(resource Resource.Instance, path string, flags int) error //Sets a new UID for the resource at the given [param path]. Returns [constant OK] on success, or an [enum Error] constant in case of failure. SetUid(path string, uid int) error //Returns whether the given resource object can be saved by this saver. Recognize(resource Resource.Instance) bool //Returns the list of extensions available for saving the resource object, provided it is recognized (see [method _recognize]). GetRecognizedExtensions(resource Resource.Instance) []string //Returns [code]true[/code] if this saver handles a given save path and [code]false[/code] otherwise. //If this method is not implemented, the default behavior returns whether the path's extension is within the ones provided by [method _get_recognized_extensions]. RecognizePath(resource Resource.Instance, path string) bool }