Resource

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: May 24, 2026 License: MIT Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Duplicate

func Duplicate[T Any](res T) T

Duplicate this resource, returning a new resource with its exported or PROPERTY_USAGE_STORAGE properties copied from the original.

func GenerateSceneUniqueId

func GenerateSceneUniqueId() string

func Library

func Library[T any]() *T

func Load

func Load[T Any, P string | Path.ToResource](path_to_resource P) T

Load behaves like the builtin "load" function in GDScript. It can also be used to preload a resource if called before startup.

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
	AsResource() Instance
}

type DeepDuplicateMode

type DeepDuplicateMode int64 //gd:Resource.DeepDuplicateMode
const (
	DeepDuplicateNone     DeepDuplicateMode = 0
	DeepDuplicateInternal DeepDuplicateMode = 1
	DeepDuplicateAll      DeepDuplicateMode = 2
)

type Expanded

type Expanded = MoreArgs

type Extension

type Extension[T gdclass.Interface] struct{ gdclass.Extension[T, Instance] }

Extension can be embedded in a new struct to create a Go extension of this class.

T must be a type that is embedding this Extension as the first field. It is unsafe and invalid to use this type directly, or embedded in any other way. See Interface for methods that can be overridden by T.

func (*Extension[T]) AsObject

func (o *Extension[T]) AsObject() [1]gdreference.Object

func (*Extension[T]) AsRefCounted

func (o *Extension[T]) AsRefCounted() ie.RC

func (*Extension[T]) AsResource

func (o *Extension[T]) AsResource() Instance

func (*Extension[T]) EmitChanged

func (o *Extension[T]) EmitChanged()

func (*Extension[T]) GetIdForPath

func (o *Extension[T]) GetIdForPath(path string) string

func (*Extension[T]) GetRid

func (o *Extension[T]) GetRid() ID

func (*Extension[T]) IsBuiltIn

func (o *Extension[T]) IsBuiltIn() bool

func (*Extension[T]) OnChanged

func (o *Extension[T]) OnChanged(cb func(), flags ...Signal.Flags) *Extension[T]

func (*Extension[T]) OnSetupLocalToSceneRequested

func (o *Extension[T]) OnSetupLocalToSceneRequested(cb func(), flags ...Signal.Flags) *Extension[T]

func (*Extension[T]) ResetState

func (o *Extension[T]) ResetState()

func (*Extension[T]) ResourceLocalToScene

func (o *Extension[T]) ResourceLocalToScene() bool

func (*Extension[T]) ResourceName

func (o *Extension[T]) ResourceName() string

func (*Extension[T]) ResourcePath

func (o *Extension[T]) ResourcePath() string

func (*Extension[T]) ResourceSceneUniqueId

func (o *Extension[T]) ResourceSceneUniqueId() string

func (*Extension[T]) SetIdForPath

func (o *Extension[T]) SetIdForPath(path string, id string) *Extension[T]

func (*Extension[T]) SetPathCache

func (o *Extension[T]) SetPathCache(path string) *Extension[T]

func (*Extension[T]) SetResourceLocalToScene

func (o *Extension[T]) SetResourceLocalToScene(value bool) *Extension[T]

func (*Extension[T]) SetResourceName

func (o *Extension[T]) SetResourceName(value string) *Extension[T]

func (*Extension[T]) SetResourcePath

func (o *Extension[T]) SetResourcePath(value string) *Extension[T]

func (*Extension[T]) SetResourceSceneUniqueId

func (o *Extension[T]) SetResourceSceneUniqueId(value string) *Extension[T]

func (*Extension[T]) SetupLocalToScene

func (o *Extension[T]) SetupLocalToScene()

func (*Extension[T]) TakeOverPath

func (o *Extension[T]) TakeOverPath(path string)

type ID

type ID = gd.RID

ID that uniquely identifies a resource.

func AllocateID

func AllocateID() ID

New allocates a unique ID which can be used by the implementation to construct an RID. This is used mainly from native extensions to implement servers.

func Int64

func Int64(id int64) ID

Int64 returns a resource ID from the given int64.

type Implementation

type Implementation = implementation

Implementation implements Interface with empty methods.

type Instance

type Instance [1]gdclass.Resource

Instance of the class with convieniently typed arguments and results.

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 (o Instance) AsObject() [1]gdreference.Object

func (Instance) AsRefCounted

func (o Instance) AsRefCounted() ie.RC

func (Instance) AsResource

func (o Instance) AsResource() Instance

func (Instance) Duplicate

func (self Instance) Duplicate() Instance

func (Instance) DuplicateDeep

func (self Instance) DuplicateDeep() Instance

func (Instance) EmitChanged

func (self Instance) EmitChanged()

func (Instance) GetIdForPath

func (self Instance) GetIdForPath(path string) string

func (Instance) GetRid

func (self Instance) GetRid() ID

func (Instance) IsBuiltIn

func (self Instance) IsBuiltIn() bool

func (Instance) MoreArgs

func (self Instance) MoreArgs() MoreArgs

MoreArgs enables certain functions to be called with additional 'optional' arguments.

func (Instance) OnChanged

func (self Instance) OnChanged(cb func(), flags ...Signal.Flags) Instance

func (Instance) OnSetupLocalToSceneRequested

func (self Instance) OnSetupLocalToSceneRequested(cb func(), flags ...Signal.Flags) Instance

func (Instance) ResetState

func (self Instance) ResetState()

func (Instance) ResourceLocalToScene

func (self Instance) ResourceLocalToScene() bool

func (Instance) ResourceName

func (self Instance) ResourceName() string

func (Instance) ResourcePath

func (self Instance) ResourcePath() string

func (Instance) ResourceSceneUniqueId

func (self Instance) ResourceSceneUniqueId() string

func (Instance) SetIdForPath

func (self Instance) SetIdForPath(path string, id string) Instance

func (*Instance) SetObject

func (self *Instance) SetObject(obj [1]gdreference.Object) bool

func (Instance) SetPathCache

func (self Instance) SetPathCache(path string) Instance

func (Instance) SetResourceLocalToScene

func (self Instance) SetResourceLocalToScene(value bool) Instance

SetResourceLocalToScene sets the property returned by [IsLocalToScene]. Returns the instance, so that property settings can be chained.

func (Instance) SetResourceName

func (self Instance) SetResourceName(value string) Instance

SetResourceName sets the property returned by [GetName]. Returns the instance, so that property settings can be chained.

func (Instance) SetResourcePath

func (self Instance) SetResourcePath(value string) Instance

SetResourcePath sets the property returned by [GetPath]. Returns the instance, so that property settings can be chained.

func (Instance) SetResourceSceneUniqueId

func (self Instance) SetResourceSceneUniqueId(value string) Instance

SetResourceSceneUniqueId sets the property returned by [GetSceneUniqueId]. Returns the instance, so that property settings can be chained.

func (Instance) SetupLocalToScene

func (self Instance) SetupLocalToScene()

func (Instance) TakeOverPath

func (self Instance) TakeOverPath(path string)

func (Instance) Virtual

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

type Interface

type Interface interface {
	SetupLocalToScene()
	GetRid() ID
	ResetState()
	SetPathCache(path string)
}

type MoreArgs

type MoreArgs [1]gdclass.Resource

MoreArgs is a container for Instance functions with additional 'optional' arguments.

func (MoreArgs) Duplicate

func (self MoreArgs) Duplicate(deep bool) Instance

func (MoreArgs) DuplicateDeep

func (self MoreArgs) DuplicateDeep(deep_subresources_mode DeepDuplicateMode) Instance

type Singleton

type Singleton[T gdclass.Interface] = Extension[T]

Singleton can be embedded in a new struct to create a Go singleton extension of the class.

It will become available as a global inside scripts and any any other Go Extension types will have any *T typed fields filled in to point at this singleton once they have been instantiated.

T must be a type that is embedding this Singleton as the first field. It is unsafe and invalid to use this type directly, or embedded in any other way. See Interface for methods that can be overridden by T.

type UID

type UID int

UID uniquely identifies a resource that has been imported into the graphics directory. Remains valid even if the resource is relocated or renamed.

Jump to

Keyboard shortcuts

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