EditorResourcePreview
A node used to generate previews of resources or files.
描述
This node is used to generate previews for resources or files.
Note: This class shouldn't be instantiated directly. Instead, access the singleton using EditorInterface.get_resource_previewer.
方法
void | add_preview_generator ( generator: EditorResourcePreviewGenerator ) |
void | check_for_invalidation ( path: String ) |
void | queue_edited_resource_preview ( resource: Resource, receiver: Object, receiver_func: StringName, userdata: Variant ) |
void | queue_resource_preview ( path: String, receiver: Object, receiver_func: StringName, userdata: Variant ) |
void | remove_preview_generator ( generator: EditorResourcePreviewGenerator ) |
信号
preview_invalidated ( path: String )
Emitted if a preview was invalidated (changed). path corresponds to the path of the preview.
方法说明
void add_preview_generator ( generator: EditorResourcePreviewGenerator )
Create an own, custom preview generator.
void check_for_invalidation ( path: String )
Check if the resource changed, if so, it will be invalidated and the corresponding signal emitted.
void queue_edited_resource_preview ( resource: Resource, receiver: Object, receiver_func: StringName, userdata: Variant )
Queue the resource being edited for preview. Once the preview is ready, the receiver's receiver_func will be called. The receiver_func must take the following four arguments: String path, Texture2D preview, Texture2D thumbnail_preview, Variant userdata. userdata can be anything, and will be returned when receiver_func is called.
Note: If it was not possible to create the preview the receiver_func will still be called, but the preview will be null.
void queue_resource_preview ( path: String, receiver: Object, receiver_func: StringName, userdata: Variant )
Queue a resource file located at path for preview. Once the preview is ready, the receiver's receiver_func will be called. The receiver_func must take the following four arguments: String path, Texture2D preview, Texture2D thumbnail_preview, Variant userdata. userdata can be anything, and will be returned when receiver_func is called.
Note: If it was not possible to create the preview the receiver_func will still be called, but the preview will be null.
void remove_preview_generator ( generator: EditorResourcePreviewGenerator )
Removes a custom preview generator.
本方法通常需要用户覆盖才能生效。
本方法无副作用,不会修改该实例的任何成员变量。
本方法除了能接受在此处描述的参数外,还能够继续接受任意数量的参数。
本方法用于构造某个类型。
调用本方法无需实例,可直接使用类名进行调用。
本方法描述的是使用本类型作为左操作数的有效运算符。
这个值是由下列位标志构成位掩码的整数。
无返回值。