Skip to content
0.2.0-dev Download ZIP
65 lines ·3.3 KB Raw
1<?xml version="1.0" encoding="UTF-8" ?>
2<class name="EditorResourcePreview" inherits="Node" api_type="editor" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
3 <brief_description>
4 A node used to generate previews of resources or files.
5 </brief_description>
6 <description>
7 This node is used to generate previews for resources or files.
8 [b]Note:[/b] This class shouldn't be instantiated directly. Instead, access the singleton using [method EditorInterface.get_resource_previewer].
9 </description>
10 <tutorials>
11 </tutorials>
12 <methods>
13 <method name="add_preview_generator">
14 <return type="void" />
15 <param index="0" name="generator" type="EditorResourcePreviewGenerator" />
16 <description>
17 Create an own, custom preview generator.
18 </description>
19 </method>
20 <method name="check_for_invalidation">
21 <return type="void" />
22 <param index="0" name="path" type="String" />
23 <description>
24 Check if the resource changed, if so, it will be invalidated and the corresponding signal emitted.
25 </description>
26 </method>
27 <method name="queue_edited_resource_preview">
28 <return type="void" />
29 <param index="0" name="resource" type="Resource" />
30 <param index="1" name="receiver" type="Object" />
31 <param index="2" name="receiver_func" type="StringName" />
32 <param index="3" name="userdata" type="Variant" />
33 <description>
34 Queue the [param resource] being edited for preview. Once the preview is ready, the [param receiver]'s [param receiver_func] will be called. The [param receiver_func] must take the following four arguments: [String] path, [Texture2D] preview, [Texture2D] thumbnail_preview, [Variant] userdata. [param userdata] can be anything, and will be returned when [param receiver_func] is called.
35 [b]Note:[/b] If it was not possible to create the preview the [param receiver_func] will still be called, but the preview will be [code]null[/code].
36 </description>
37 </method>
38 <method name="queue_resource_preview">
39 <return type="void" />
40 <param index="0" name="path" type="String" />
41 <param index="1" name="receiver" type="Object" />
42 <param index="2" name="receiver_func" type="StringName" />
43 <param index="3" name="userdata" type="Variant" />
44 <description>
45 Queue a resource file located at [param path] for preview. Once the preview is ready, the [param receiver]'s [param receiver_func] will be called. The [param receiver_func] must take the following four arguments: [String] path, [Texture2D] preview, [Texture2D] thumbnail_preview, [Variant] userdata. [param userdata] can be anything, and will be returned when [param receiver_func] is called.
46 [b]Note:[/b] If it was not possible to create the preview the [param receiver_func] will still be called, but the preview will be [code]null[/code].
47 </description>
48 </method>
49 <method name="remove_preview_generator">
50 <return type="void" />
51 <param index="0" name="generator" type="EditorResourcePreviewGenerator" />
52 <description>
53 Removes a custom preview generator.
54 </description>
55 </method>
56 </methods>
57 <signals>
58 <signal name="preview_invalidated">
59 <param index="0" name="path" type="String" />
60 <description>
61 Emitted if a preview was invalidated (changed). [param path] corresponds to the path of the preview.
62 </description>
63 </signal>
64 </signals>
65</class>