ResourceFormatSaver

package
v0.0.0-...-7325ca5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 31, 2025 License: MIT Imports: 19 Imported by: 0

Documentation

Overview

Package ResourceFormatSaver provides methods for working with ResourceFormatSaver object instances.

Index

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 Any

type Any interface {
	gd.IsClass
	AsResourceFormatSaver() Instance
}

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.

%!(EXTRA string=ResourceFormatSaver)

var Nil Instance

Nil is a nil/null instance of the class. Equivalent to the zero value.

func New

func New() Instance

func (Instance) AsObject

func (self Instance) AsObject() [1]gd.Object

func (Instance) AsRefCounted

func (self Instance) AsRefCounted() [1]gd.RefCounted

func (Instance) AsResourceFormatSaver

func (self Instance) AsResourceFormatSaver() Instance

func (*Instance) UnsafePointer

func (self *Instance) UnsafePointer() unsafe.Pointer

func (Instance) Virtual

func (self Instance) Virtual(name string) reflect.Value

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 [1]gdclass.Resource, 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 [1]gdclass.Resource) bool
	//Returns the list of extensions available for saving the resource object, provided it is recognized (see [method _recognize]).
	GetRecognizedExtensions(resource [1]gdclass.Resource) []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 [1]gdclass.Resource, path string) bool
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL