Files
godot-docs/classes/class_editorresourcepreviewgenerator.rst
2020-01-21 09:28:25 +01:00

70 lines
3.5 KiB
ReStructuredText

:github_url: hide
.. Generated automatically by doc/tools/makerst.py in Godot's source tree.
.. DO NOT EDIT THIS FILE, but the EditorResourcePreviewGenerator.xml source instead.
.. The source is found in doc/classes or modules/<name>/doc_classes.
.. _class_EditorResourcePreviewGenerator:
EditorResourcePreviewGenerator
==============================
**Inherits:** :ref:`Reference<class_Reference>` **<** :ref:`Object<class_Object>`
**Category:** Core
Brief Description
-----------------
Custom generator of previews.
Methods
-------
+-------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`Texture<class_Texture>` | :ref:`generate<class_EditorResourcePreviewGenerator_method_generate>` **(** :ref:`Resource<class_Resource>` from, :ref:`Vector2<class_Vector2>` size **)** virtual |
+-------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`Texture<class_Texture>` | :ref:`generate_from_path<class_EditorResourcePreviewGenerator_method_generate_from_path>` **(** :ref:`String<class_String>` path, :ref:`Vector2<class_Vector2>` size **)** virtual |
+-------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`bool<class_bool>` | :ref:`handles<class_EditorResourcePreviewGenerator_method_handles>` **(** :ref:`String<class_String>` type **)** virtual |
+-------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
Description
-----------
Custom code to generate previews. Please check "file_dialog/thumbnail_size" in EditorSettings to find out the right size to do previews at.
Method Descriptions
-------------------
.. _class_EditorResourcePreviewGenerator_method_generate:
- :ref:`Texture<class_Texture>` **generate** **(** :ref:`Resource<class_Resource>` from, :ref:`Vector2<class_Vector2>` size **)** virtual
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).
----
.. _class_EditorResourcePreviewGenerator_method_generate_from_path:
- :ref:`Texture<class_Texture>` **generate_from_path** **(** :ref:`String<class_String>` path, :ref:`Vector2<class_Vector2>` size **)** virtual
Generate a preview directly from a path with the specified size. Implementing this is optional, as default code will load and call :ref:`generate<class_EditorResourcePreviewGenerator_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).
----
.. _class_EditorResourcePreviewGenerator_method_handles:
- :ref:`bool<class_bool>` **handles** **(** :ref:`String<class_String>` type **)** virtual
Returns if your generator supports this resource type.