EditorResourceTooltipPlugin

package
v0.0.0-...-fa94a0d Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2025 License: MIT Imports: 25 Imported by: 0

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

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
	AsEditorResourceTooltipPlugin() 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]) AsEditorResourceTooltipPlugin

func (self *Extension[T]) AsEditorResourceTooltipPlugin() 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) AsEditorResourceTooltipPlugin

func (self Instance) AsEditorResourceTooltipPlugin() 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) 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.

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 {
	// 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
}

Jump to

Keyboard shortcuts

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