Documentation
¶
Overview ¶
Custom code to generate previews. Check EditorSettings "filesystem/file_dialog/thumbnail_size" to find a proper size to generate previews at.
Index ¶
- type Advanced
- type Any
- type Extension
- type ID
- type Implementation
- type Instance
- func (self Instance) AsEditorResourcePreviewGenerator() Instance
- func (self Instance) AsObject() [1]gd.Object
- func (self Instance) AsRefCounted() [1]gd.RefCounted
- func (self Instance) ID() ID
- func (self *Instance) SetObject(obj [1]gd.Object) bool
- 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]See Interface for methods that can be overridden by T.
func (*Extension[T]) AsEditorResourcePreviewGenerator ¶
func (*Extension[T]) AsRefCounted ¶
func (self *Extension[T]) AsRefCounted() [1]gd.RefCounted
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.EditorResourcePreviewGenerator
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 (Instance) AsEditorResourcePreviewGenerator ¶
func (Instance) AsRefCounted ¶
func (self Instance) AsRefCounted() [1]gd.RefCounted
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 }