From 72446bab1b1dd88c37aa29ea0140d8b413bb4683 Mon Sep 17 00:00:00 2001 From: Marcel Admiraal Date: Wed, 26 May 2021 08:29:12 +0100 Subject: [PATCH] Update EditorResourcePreview queue_*() documentation --- doc/classes/EditorResourcePreview.xml | 6 ++++-- editor/editor_resource_preview.h | 3 ++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/doc/classes/EditorResourcePreview.xml b/doc/classes/EditorResourcePreview.xml index 2033e842fa5..0e1a744d599 100644 --- a/doc/classes/EditorResourcePreview.xml +++ b/doc/classes/EditorResourcePreview.xml @@ -40,7 +40,8 @@ - Queue a resource being edited for preview (using an instance). Once the preview is ready, your receiver.receiver_func will be called either containing the preview texture or an empty texture (if no preview was possible). Callback must have the format: (path,texture,userdata). Userdata can be anything. + Queue the [code]resource[/code] being edited for preview. Once the preview is ready, the [code]receiver[/code]'s [code]receiver_func[/code] will be called. The [code]receiver_func[/code] must take the following four arguments: [String] path, [Texture] preview, [Texture] thumbnail_preview, [Variant] userdata. [code]userdata[/code] can be anything, and will be returned when [code]receiver_func[/code] is called. + [b]Note[/b]: If it was not possible to create the preview the [code]receiver_func[/code] will still be called, but the preview will be null. @@ -55,7 +56,8 @@ - Queue a resource file for preview (using a path). Once the preview is ready, your receiver.receiver_func will be called either containing the preview texture or an empty texture (if no preview was possible). Callback must have the format: (path,texture,userdata). Userdata can be anything. + Queue a resource file located at [code]path[/code] for preview. Once the preview is ready, the [code]receiver[/code]'s [code]receiver_func[/code] will be called. The [code]receiver_func[/code] must take the following four arguments: [String] path, [Texture] preview, [Texture] thumbnail_preview, [Variant] userdata. [code]userdata[/code] can be anything, and will be returned when [code]receiver_func[/code] is called. + [b]Note[/b]: If it was not possible to create the preview the [code]receiver_func[/code] will still be called, but the preview will be null. diff --git a/editor/editor_resource_preview.h b/editor/editor_resource_preview.h index c812b8a2de9..ab91b455b82 100644 --- a/editor/editor_resource_preview.h +++ b/editor/editor_resource_preview.h @@ -101,7 +101,8 @@ protected: public: static EditorResourcePreview *get_singleton(); - //callback function is callback(String p_path,Ref preview,Variant udata) preview null if could not load + // p_receiver_func callback has signature (String p_path, Ref p_preview, Ref p_preview_small, Variant p_userdata) + // p_preview will be null if there was an error void queue_resource_preview(const String &p_path, Object *p_receiver, const StringName &p_receiver_func, const Variant &p_userdata); void queue_edited_resource_preview(const Ref &p_res, Object *p_receiver, const StringName &p_receiver_func, const Variant &p_userdata);