Add metadata to resource previews

This commit is contained in:
kobewi
2022-08-19 18:14:57 +02:00
parent 74c34aed38
commit 04317e9ced
7 changed files with 108 additions and 87 deletions

View File

@ -20,20 +20,24 @@
<return type="Texture2D" />
<param index="0" name="resource" type="Resource" />
<param index="1" name="size" type="Vector2i" />
<param index="2" name="metadata" type="Dictionary" />
<description>
Generate a preview from a given resource with the specified size. This must always be implemented.
Returning an empty texture is an OK way to fail and let another generator take care.
Care must be taken because this function is always called from a thread (not the main thread).
[param metadata] dictionary can modified to store file-specific metadata that can be used by the editor (like image size, sample length etc.).
</description>
</method>
<method name="_generate_from_path" qualifiers="virtual const">
<return type="Texture2D" />
<param index="0" name="path" type="String" />
<param index="1" name="size" type="Vector2i" />
<param index="2" name="metadata" type="Dictionary" />
<description>
Generate a preview directly from a path with the specified size. Implementing this is optional, as default code will load and call [method _generate].
Returning an empty texture is an OK way to fail and let another generator take care.
Care must be taken because this function is always called from a thread (not the main thread).
[param metadata] dictionary can modified to store file-specific metadata that can be used by the editor (like image size, sample length etc.).
</description>
</method>
<method name="_generate_small_preview_automatically" qualifiers="virtual const">