virtualx-engine-docs/_sources/classes/class_editorresourcepreviewgenerator.rst.txt

125 lines
6.4 KiB
Text
Raw Normal View History

2024-10-23 18:41:33 +02:00
:github_url: hide
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/3.6/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/3.6/doc/classes/EditorResourcePreviewGenerator.xml.
.. _class_EditorResourcePreviewGenerator:
EditorResourcePreviewGenerator
==============================
**Inherits:** :ref:`Reference<class_Reference>` **<** :ref:`Object<class_Object>`
Custom generator of previews.
.. rst-class:: classref-introduction-group
Description
-----------
Custom code to generate previews. Please check ``file_dialog/thumbnail_size`` in :ref:`EditorSettings<class_EditorSettings>` to find out the right size to do previews at.
.. rst-class:: classref-reftable-group
Methods
-------
.. table::
:widths: auto
+-------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`bool<class_bool>` | :ref:`can_generate_small_preview<class_EditorResourcePreviewGenerator_method_can_generate_small_preview>` **(** **)** |virtual| |
+-------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :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:`generate_small_preview_automatically<class_EditorResourcePreviewGenerator_method_generate_small_preview_automatically>` **(** **)** |virtual| |
+-------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`bool<class_bool>` | :ref:`handles<class_EditorResourcePreviewGenerator_method_handles>` **(** :ref:`String<class_String>` type **)** |virtual| |
+-------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
.. rst-class:: classref-section-separator
----
.. rst-class:: classref-descriptions-group
Method Descriptions
-------------------
.. _class_EditorResourcePreviewGenerator_method_can_generate_small_preview:
.. rst-class:: classref-method
:ref:`bool<class_bool>` **can_generate_small_preview** **(** **)** |virtual|
If this function returns ``true``, the generator will call :ref:`generate<class_EditorResourcePreviewGenerator_method_generate>` or :ref:`generate_from_path<class_EditorResourcePreviewGenerator_method_generate_from_path>` for small previews as well.
By default, it returns ``false``.
.. rst-class:: classref-item-separator
----
.. _class_EditorResourcePreviewGenerator_method_generate:
.. rst-class:: classref-method
: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).
.. rst-class:: classref-item-separator
----
.. _class_EditorResourcePreviewGenerator_method_generate_from_path:
.. rst-class:: classref-method
: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).
.. rst-class:: classref-item-separator
----
.. _class_EditorResourcePreviewGenerator_method_generate_small_preview_automatically:
.. rst-class:: classref-method
:ref:`bool<class_bool>` **generate_small_preview_automatically** **(** **)** |virtual|
If this function returns ``true``, the generator will automatically generate the small previews from the normal preview texture generated by the methods :ref:`generate<class_EditorResourcePreviewGenerator_method_generate>` or :ref:`generate_from_path<class_EditorResourcePreviewGenerator_method_generate_from_path>`.
By default, it returns ``false``.
.. rst-class:: classref-item-separator
----
.. _class_EditorResourcePreviewGenerator_method_handles:
.. rst-class:: classref-method
:ref:`bool<class_bool>` **handles** **(** :ref:`String<class_String>` type **)** |virtual|
Returns ``true`` if your generator supports the resource of type ``type``.
.. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
.. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
.. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
.. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`