Documentation
¶
Overview ¶
Resource tooltip plugins are used by FileSystemDock to generate customized tooltips for specific resources. E.g. tooltip for a Texture2D displays a bigger preview and the texture's dimensions.
A plugin must be first registered with FileSystemDock.AddResourceTooltipPlugin. When the user hovers a resource in filesystem dock which is handled by the plugin, MakeTooltipForPath is called to create the tooltip. It works similarly to Control.MakeCustomTooltip.
Index ¶
- type Advanced
- type Any
- type Extension
- type ID
- type Implementation
- type Instance
- func (self Instance) AsEditorResourceTooltipPlugin() Instance
- func (self Instance) AsObject() [1]gd.Object
- func (self Instance) AsRefCounted() [1]gd.RefCounted
- func (self Instance) ID() ID
- func (self Instance) RequestThumbnail(path string, control TextureRect.Instance)
- 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]) AsEditorResourceTooltipPlugin ¶
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.EditorResourceTooltipPlugin
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) AsEditorResourceTooltipPlugin ¶
func (Instance) AsRefCounted ¶
func (self Instance) AsRefCounted() [1]gd.RefCounted
func (Instance) RequestThumbnail ¶
func (self Instance) RequestThumbnail(path string, control TextureRect.Instance)
Requests a thumbnail for the given TextureRect. The thumbnail is created asynchronously by EditorResourcePreview and automatically set when available.
type Interface ¶
type Interface interface { // Return true if the plugin is going to handle the given [Resource] 'type'. // // [Resource]: https://pkg.go.dev/graphics.gd/classdb/Resource Handles(atype string) bool // Create and return a tooltip that will be displayed when the user hovers a resource under the given 'path' in filesystem dock. // // The 'metadata' dictionary is provided by preview generator (see [EditorResourcePreviewGenerator.Generate]). // // 'base' is the base default tooltip, which is a [VBoxContainer] with a file name, type and size labels. If another plugin handled the same file type, 'base' will be output from the previous plugin. For best result, make sure the base tooltip is part of the returned [Control]. // // Note: It's unadvised to use [ResourceLoader.Load], especially with heavy resources like models or textures, because it will make the editor unresponsive when creating the tooltip. You can use [RequestThumbnail] if you want to display a preview in your tooltip. // // Note: If you decide to discard the 'base', make sure to call [Node.QueueFree], because it's not freed automatically. // // // // func _make_tooltip_for_path(path, metadata, base): // // var t_rect = TextureRect.new() // // request_thumbnail(path, t_rect) // // base.add_child(t_rect) # The TextureRect will appear at the bottom of the tooltip. // // return base // // // // [Control]: https://pkg.go.dev/graphics.gd/classdb/Control // [EditorResourcePreviewGenerator.Generate]: https://pkg.go.dev/graphics.gd/classdb/EditorResourcePreviewGenerator#Instance.Generate // [Node.QueueFree]: https://pkg.go.dev/graphics.gd/classdb/Node#Instance.QueueFree // [RequestThumbnail]: https://pkg.go.dev/graphics.gd/classdb/EditorResourceTooltipPlugin#Instance.RequestThumbnail // [ResourceLoader.Load]: https://pkg.go.dev/graphics.gd/classdb/ResourceLoader#Load // [VBoxContainer]: https://pkg.go.dev/graphics.gd/classdb/VBoxContainer MakeTooltipForPath(path string, metadata map[string]interface{}, base Control.Instance) Control.Instance }