:github_url: hide .. DO NOT EDIT THIS FILE!!! .. Generated automatically from Godot engine sources. .. Generator: https://github.com/godotengine/godot/tree/4.1/doc/tools/make_rst.py. .. XML source: https://github.com/godotengine/godot/tree/4.1/doc/classes/EditorResourceTooltipPlugin.xml. .. _class_EditorResourceTooltipPlugin: EditorResourceTooltipPlugin =========================== **Inherits:** :ref:`RefCounted` **<** :ref:`Object` A plugin that advanced tooltip for its handled resource type. .. rst-class:: classref-introduction-group Description ----------- Resource tooltip plugins are used by :ref:`FileSystemDock` to generate customized tooltips for specific resources. E.g. tooltip for a :ref:`Texture2D` displays a bigger preview and the texture's dimensions. A plugin must be first registered with :ref:`FileSystemDock.add_resource_tooltip_plugin`. When the user hovers a resource in filesystem dock which is handled by the plugin, :ref:`_make_tooltip_for_path` is called to create the tooltip. It works similarly to :ref:`Control._make_custom_tooltip`. .. rst-class:: classref-reftable-group Methods ------- .. table:: :widths: auto +-------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`_handles` **(** :ref:`String` type **)** |virtual| |const| | +-------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Control` | :ref:`_make_tooltip_for_path` **(** :ref:`String` path, :ref:`Dictionary` metadata, :ref:`Control` base **)** |virtual| |const| | +-------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`request_thumbnail` **(** :ref:`String` path, :ref:`TextureRect` control **)** |const| | +-------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ .. rst-class:: classref-section-separator ---- .. rst-class:: classref-descriptions-group Method Descriptions ------------------- .. _class_EditorResourceTooltipPlugin_method__handles: .. rst-class:: classref-method :ref:`bool` **_handles** **(** :ref:`String` type **)** |virtual| |const| Return ``true`` if the plugin is going to handle the given :ref:`Resource` ``type``. .. rst-class:: classref-item-separator ---- .. _class_EditorResourceTooltipPlugin_method__make_tooltip_for_path: .. rst-class:: classref-method :ref:`Control` **_make_tooltip_for_path** **(** :ref:`String` path, :ref:`Dictionary` metadata, :ref:`Control` base **)** |virtual| |const| 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 method EditorResourcePreviewGenerator._generate]). \ ``base`` is the base default tooltip, which is a :ref:`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 :ref:`Control`. \ **Note:** It's unadvised to use :ref:`ResourceLoader.load`, especially with heavy resources like models or textures, because it will make the editor unresponsive when creating the tooltip. You can use :ref:`request_thumbnail` if you want to display a preview in your tooltip. \ **Note:** If you decide to discard the ``base``, make sure to call :ref:`Node.queue_free`, 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 .. rst-class:: classref-item-separator ---- .. _class_EditorResourceTooltipPlugin_method_request_thumbnail: .. rst-class:: classref-method void **request_thumbnail** **(** :ref:`String` path, :ref:`TextureRect` control **)** |const| Requests a thumbnail for the given :ref:`TextureRect`. The thumbnail is created asynchronously by :ref:`EditorResourcePreview` and automatically set when available. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)` .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)` .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)` .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)` .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)` .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)` .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)`