summaryrefslogtreecommitdiffstats
path: root/doc
diff options
context:
space:
mode:
authorkobewi <kobewi4e@gmail.com>2023-05-18 17:03:22 +0200
committerkobewi <kobewi4e@gmail.com>2023-05-30 23:13:50 +0200
commit5baebf75f26ce83654e25840f1bf393e341f1ddf (patch)
treed8aae15e4c9dd673a75c6e13886f3194676874e2 /doc
parent6101240231600c871f5c5473872532c68ea3268c (diff)
downloadredot-engine-5baebf75f26ce83654e25840f1bf393e341f1ddf.tar.gz
Small rework of tooltip plugins
Diffstat (limited to 'doc')
-rw-r--r--doc/classes/EditorResourceTooltipPlugin.xml21
1 files changed, 12 insertions, 9 deletions
diff --git a/doc/classes/EditorResourceTooltipPlugin.xml b/doc/classes/EditorResourceTooltipPlugin.xml
index ada91c4e7c..f6ce99b878 100644
--- a/doc/classes/EditorResourceTooltipPlugin.xml
+++ b/doc/classes/EditorResourceTooltipPlugin.xml
@@ -18,20 +18,23 @@
</description>
</method>
<method name="_make_tooltip_for_path" qualifiers="virtual const">
- <return type="Object" />
+ <return type="Control" />
<param index="0" name="path" type="String" />
<param index="1" name="metadata" type="Dictionary" />
+ <param index="2" name="base" type="Control" />
<description>
- Create and return a tooltip that will be displayed when the user hovers resource under given [param path] in filesystem dock. For best results, use [method make_default_tooltip] as a base.
+ Create and return a tooltip that will be displayed when the user hovers a resource under the given [param path] in filesystem dock.
The [param metadata] dictionary is provided by preview generator (see method EditorResourcePreviewGenerator._generate]).
+ [param 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, [param base] will be output from the previous plugin. For best result, make sure the base tooltip is part of the returned [Control].
[b]Note:[/b] It's unadvised to use [method ResourceLoader.load], especially with heavy resources like models or textures, because it will make the editor unresponsive when creating the tooltip. You can use [method request_thumbnail] if you want to display a preview in your tooltip.
- </description>
- </method>
- <method name="make_default_tooltip" qualifiers="static">
- <return type="VBoxContainer" />
- <param index="0" name="path" type="String" />
- <description>
- Creates a default file tooltip. The tooltip includes file name, file size and [Resource] type if available.
+ [b]Note:[/b] If you decide to discard the [param base], make sure to call [method Node.queue_free], because it's not freed automatically.
+ [codeblock]
+ 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
+ [/codeblock]
</description>
</method>
<method name="request_thumbnail" qualifiers="const">