EditorResourcePreviewGenerator

package
v0.0.0-...-357ca8a Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2025 License: MIT Imports: 26 Imported by: 0

Documentation

Overview

Custom code to generate previews. Check EditorSettings "filesystem/file_dialog/thumbnail_size" to find a proper size to generate previews at.

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

type Extension

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

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]See Interface for methods that can be overridden by T.

func (*Extension[T]) AsEditorResourcePreviewGenerator

func (self *Extension[T]) AsEditorResourcePreviewGenerator() Instance

func (*Extension[T]) AsObject

func (self *Extension[T]) AsObject() [1]gd.Object

func (*Extension[T]) AsRefCounted

func (self *Extension[T]) AsRefCounted() [1]gd.RefCounted

type ID

type ID Object.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.

func (ID) Instance

func (id ID) Instance() (Instance, bool)

type Implementation

type Implementation = implementation

Implementation implements Interface with empty methods.

type Instance

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) AsEditorResourcePreviewGenerator

func (self Instance) AsEditorResourcePreviewGenerator() Instance

func (Instance) AsObject

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

func (Instance) AsRefCounted

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

func (Instance) ID

func (self Instance) ID() ID

func (*Instance) SetObject

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

func (Instance) Virtual

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

type Interface

type Interface interface {
	// Returns true if your generator supports the resource of type 'type'.
	Handles(atype string) bool
	// Generate a preview from a given resource with the specified size. This must always be implemented.
	//
	// Returning null is an OK way to fail and let another generator take care.
	//
	// Care must be taken because this function is always called from a thread (not the main thread).
	//
	// 'metadata' dictionary can be modified to store file-specific metadata that can be used in [EditorResourceTooltipPlugin.MakeTooltipForPath] (like image size, sample length etc.).
	//
	// [EditorResourceTooltipPlugin.MakeTooltipForPath]: https://pkg.go.dev/graphics.gd/classdb/EditorResourceTooltipPlugin#Instance.MakeTooltipForPath
	Generate(resource Resource.Instance, size Vector2i.XY, metadata map[string]interface{}) Texture2D.Instance
	// Generate a preview directly from a path with the specified size. Implementing this is optional, as default code will load and call [Generate].
	//
	// Returning null is an OK way to fail and let another generator take care.
	//
	// Care must be taken because this function is always called from a thread (not the main thread).
	//
	// 'metadata' dictionary can be modified to store file-specific metadata that can be used in [EditorResourceTooltipPlugin.MakeTooltipForPath] (like image size, sample length etc.).
	//
	// [EditorResourceTooltipPlugin.MakeTooltipForPath]: https://pkg.go.dev/graphics.gd/classdb/EditorResourceTooltipPlugin#Instance.MakeTooltipForPath
	// [Generate]: https://pkg.go.dev/graphics.gd/classdb/EditorResourcePreviewGenerator#Interface
	GenerateFromPath(path string, size Vector2i.XY, metadata map[string]interface{}) Texture2D.Instance
	// If this function returns true, the generator will automatically generate the small previews from the normal preview texture generated by the methods [Generate] or [GenerateFromPath].
	//
	// By default, it returns false.
	//
	// [Generate]: https://pkg.go.dev/graphics.gd/classdb/EditorResourcePreviewGenerator#Interface
	// [GenerateFromPath]: https://pkg.go.dev/graphics.gd/classdb/EditorResourcePreviewGenerator#Interface
	GenerateSmallPreviewAutomatically() bool
	// If this function returns true, the generator will call [Generate] or [GenerateFromPath] for small previews as well.
	//
	// By default, it returns false.
	//
	// [Generate]: https://pkg.go.dev/graphics.gd/classdb/EditorResourcePreviewGenerator#Interface
	// [GenerateFromPath]: https://pkg.go.dev/graphics.gd/classdb/EditorResourcePreviewGenerator#Interface
	CanGenerateSmallPreview() bool
}

Jump to

Keyboard shortcuts

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