Class EditorResourcePreview
- Namespace
- Godot
- Assembly
- GodotSharpEditor.dll
This node is used to generate previews for resources or files.
Note: This class shouldn't be instantiated directly. Instead, access the singleton using GetResourcePreviewer().
public class EditorResourcePreview : Node, IDisposable
- Inheritance
-
EditorResourcePreview
- Implements
- Inherited Members
Methods
AddPreviewGenerator(EditorResourcePreviewGenerator)
Create an own, custom preview generator.
public void AddPreviewGenerator(EditorResourcePreviewGenerator generator)
Parameters
generator
EditorResourcePreviewGenerator
CheckForInvalidation(string)
Check if the resource changed, if so, it will be invalidated and the corresponding signal emitted.
public void CheckForInvalidation(string path)
Parameters
path
string
HasGodotClassMethod(in godot_string_name)
Check if the type contains a method with the given name. This method is used by Godot to check if a method exists before invoking it. Do not call or override this method.
protected override bool HasGodotClassMethod(in godot_string_name method)
Parameters
method
godot_string_nameName of the method to check for.
Returns
HasGodotClassSignal(in godot_string_name)
Check if the type contains a signal with the given name. This method is used by Godot to check if a signal exists before raising it. Do not call or override this method.
protected override bool HasGodotClassSignal(in godot_string_name signal)
Parameters
signal
godot_string_nameName of the signal to check for.
Returns
InvokeGodotClassMethod(in godot_string_name, NativeVariantPtrArgs, out godot_variant)
Invokes the method with the given name, using the given arguments. This method is used by Godot to invoke methods from the engine side. Do not call or override this method.
protected override bool InvokeGodotClassMethod(in godot_string_name method, NativeVariantPtrArgs args, out godot_variant ret)
Parameters
method
godot_string_nameName of the method to invoke.
args
NativeVariantPtrArgsArguments to use with the invoked method.
ret
godot_variantValue returned by the invoked method.
Returns
QueueEditedResourcePreview(Resource, GodotObject, StringName, Variant)
Queue the resource
being edited for preview. Once the preview is ready, the receiver
's receiverFunc
will be called. The receiverFunc
must take the following four arguments: string path, Texture2D preview, Texture2D thumbnail_preview, Variant userdata. userdata
can be anything, and will be returned when receiverFunc
is called.
Note: If it was not possible to create the preview the receiverFunc
will still be called, but the preview will be null.
public void QueueEditedResourcePreview(Resource resource, GodotObject receiver, StringName receiverFunc, Variant userdata)
Parameters
resource
Resourcereceiver
GodotObjectreceiverFunc
StringNameuserdata
Variant
QueueResourcePreview(string, GodotObject, StringName, Variant)
Queue a resource file located at path
for preview. Once the preview is ready, the receiver
's receiverFunc
will be called. The receiverFunc
must take the following four arguments: string path, Texture2D preview, Texture2D thumbnail_preview, Variant userdata. userdata
can be anything, and will be returned when receiverFunc
is called.
Note: If it was not possible to create the preview the receiverFunc
will still be called, but the preview will be null.
public void QueueResourcePreview(string path, GodotObject receiver, StringName receiverFunc, Variant userdata)
Parameters
path
stringreceiver
GodotObjectreceiverFunc
StringNameuserdata
Variant
RemovePreviewGenerator(EditorResourcePreviewGenerator)
Removes a custom preview generator.
public void RemovePreviewGenerator(EditorResourcePreviewGenerator generator)
Parameters
generator
EditorResourcePreviewGenerator
Events
PreviewInvalidated
Emitted if a preview was invalidated (changed). path
corresponds to the path of the preview.
public event EditorResourcePreview.PreviewInvalidatedEventHandler PreviewInvalidated