Files
godot-docs/classes/class_editorresourcetooltipplugin.rst
2023-05-13 03:19:02 +00:00

107 lines
6.6 KiB
ReStructuredText

:github_url: hide
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/EditorResourceTooltipPlugin.xml.
.. _class_EditorResourceTooltipPlugin:
EditorResourceTooltipPlugin
===========================
**Inherits:** :ref:`RefCounted<class_RefCounted>` **<** :ref:`Object<class_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<class_FileSystemDock>` to generate customized tooltips for specific resources. E.g. tooltip for a :ref:`Texture2D<class_Texture2D>` displays a bigger preview and the texture's dimensions.
A plugin must be first registered with :ref:`FileSystemDock.add_resource_tooltip_plugin<class_FileSystemDock_method_add_resource_tooltip_plugin>`. When the user hovers a resource in filesystem dock which is handled by the plugin, :ref:`_make_tooltip_for_path<class_EditorResourceTooltipPlugin_method__make_tooltip_for_path>` is called to create the tooltip. It works similarly to :ref:`Control._make_custom_tooltip<class_Control_method__make_custom_tooltip>`.
.. rst-class:: classref-reftable-group
Methods
-------
.. table::
:widths: auto
+-------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`bool<class_bool>` | :ref:`_handles<class_EditorResourceTooltipPlugin_method__handles>` **(** :ref:`String<class_String>` type **)** |virtual| |const| |
+-------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`Object<class_Object>` | :ref:`_make_tooltip_for_path<class_EditorResourceTooltipPlugin_method__make_tooltip_for_path>` **(** :ref:`String<class_String>` path, :ref:`Dictionary<class_Dictionary>` metadata **)** |virtual| |const| |
+-------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`VBoxContainer<class_VBoxContainer>` | :ref:`make_default_tooltip<class_EditorResourceTooltipPlugin_method_make_default_tooltip>` **(** :ref:`String<class_String>` path **)** |static| |
+-------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`request_thumbnail<class_EditorResourceTooltipPlugin_method_request_thumbnail>` **(** :ref:`String<class_String>` path, :ref:`TextureRect<class_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<class_bool>` **_handles** **(** :ref:`String<class_String>` type **)** |virtual| |const|
Return ``true`` if the plugin is going to handle the given :ref:`Resource<class_Resource>` ``type``.
.. rst-class:: classref-item-separator
----
.. _class_EditorResourceTooltipPlugin_method__make_tooltip_for_path:
.. rst-class:: classref-method
:ref:`Object<class_Object>` **_make_tooltip_for_path** **(** :ref:`String<class_String>` path, :ref:`Dictionary<class_Dictionary>` metadata **)** |virtual| |const|
Create and return a tooltip that will be displayed when the user hovers resource under given ``path`` in filesystem dock. For best results, use :ref:`make_default_tooltip<class_EditorResourceTooltipPlugin_method_make_default_tooltip>` as a base.
The ``metadata`` dictionary is provided by preview generator (see method EditorResourcePreviewGenerator._generate]).
\ **Note:** It's unadvised to use :ref:`ResourceLoader.load<class_ResourceLoader_method_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<class_EditorResourceTooltipPlugin_method_request_thumbnail>` if you want to display a preview in your tooltip.
.. rst-class:: classref-item-separator
----
.. _class_EditorResourceTooltipPlugin_method_make_default_tooltip:
.. rst-class:: classref-method
:ref:`VBoxContainer<class_VBoxContainer>` **make_default_tooltip** **(** :ref:`String<class_String>` path **)** |static|
Creates a default file tooltip. The tooltip includes file name, file size and :ref:`Resource<class_Resource>` type if available.
.. rst-class:: classref-item-separator
----
.. _class_EditorResourceTooltipPlugin_method_request_thumbnail:
.. rst-class:: classref-method
void **request_thumbnail** **(** :ref:`String<class_String>` path, :ref:`TextureRect<class_TextureRect>` control **)** |const|
Requests a thumbnail for the given :ref:`TextureRect<class_TextureRect>`. The thumbnail is created asynchronously by :ref:`EditorResourcePreview<class_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.)`