Table of Contents

Class EditorResourceTooltipPlugin

Namespace
Godot
Assembly
GodotSharpEditor.dll

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 AddResourceTooltipPlugin(EditorResourceTooltipPlugin). When the user hovers a resource in filesystem dock which is handled by the plugin, _MakeTooltipForPath(string, Dictionary, Control) is called to create the tooltip. It works similarly to _MakeCustomTooltip(string).

public class EditorResourceTooltipPlugin : RefCounted, IDisposable
Inheritance
EditorResourceTooltipPlugin
Implements
Inherited Members

Constructors

EditorResourceTooltipPlugin()

public EditorResourceTooltipPlugin()

Methods

HasGodotClassMethod(in godot_string_name)

Check if the type contains a method with the given name. This method is used by Godot to check if a method exists before invoking it. Do not call or override this method.

protected override bool HasGodotClassMethod(in godot_string_name method)

Parameters

method godot_string_name

Name of the method to check for.

Returns

bool

HasGodotClassSignal(in godot_string_name)

Check if the type contains a signal with the given name. This method is used by Godot to check if a signal exists before raising it. Do not call or override this method.

protected override bool HasGodotClassSignal(in godot_string_name signal)

Parameters

signal godot_string_name

Name of the signal to check for.

Returns

bool

InvokeGodotClassMethod(in godot_string_name, NativeVariantPtrArgs, out godot_variant)

Invokes the method with the given name, using the given arguments. This method is used by Godot to invoke methods from the engine side. Do not call or override this method.

protected override bool InvokeGodotClassMethod(in godot_string_name method, NativeVariantPtrArgs args, out godot_variant ret)

Parameters

method godot_string_name

Name of the method to invoke.

args NativeVariantPtrArgs

Arguments to use with the invoked method.

ret godot_variant

Value returned by the invoked method.

Returns

bool

RequestThumbnail(string, TextureRect)

Requests a thumbnail for the given TextureRect. The thumbnail is created asynchronously by EditorResourcePreview and automatically set when available.

public void RequestThumbnail(string path, TextureRect control)

Parameters

path string
control TextureRect

_Handles(string)

Return true if the plugin is going to handle the given Resourcetype.

public virtual bool _Handles(string type)

Parameters

type string

Returns

bool

_MakeTooltipForPath(string, Dictionary, Control)

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 _Generate(Resource, Vector2I, Dictionary)).

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 Load(string, string, CacheMode), especially with heavy resources like models or textures, because it will make the editor unresponsive when creating the tooltip. You can use RequestThumbnail(string, TextureRect) if you want to display a preview in your tooltip.

Note: If you decide to discard the base, make sure to call 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
public virtual Control _MakeTooltipForPath(string path, Dictionary metadata, Control @base)

Parameters

path string
metadata Dictionary
base Control

Returns

Control