:github_url: hide .. DO NOT EDIT THIS FILE!!! .. Generated automatically from Godot engine sources. .. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py. .. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/EditorResourcePreviewGenerator.xml. .. _class_EditorResourcePreviewGenerator: EditorResourcePreviewGenerator ============================== **Inherits:** :ref:`RefCounted` **<** :ref:`Object` Custom generator of previews. .. rst-class:: classref-introduction-group Description ----------- Custom code to generate previews. Check :ref:`EditorSettings.filesystem/file_dialog/thumbnail_size` to find a proper size to generate previews at. .. rst-class:: classref-reftable-group Methods ------- .. table:: :widths: auto +-----------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`_can_generate_small_preview`\ (\ ) |virtual| |const| | +-----------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Texture2D` | :ref:`_generate`\ (\ resource\: :ref:`Resource`, size\: :ref:`Vector2i`, metadata\: :ref:`Dictionary`\ ) |virtual| |const| | +-----------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Texture2D` | :ref:`_generate_from_path`\ (\ path\: :ref:`String`, size\: :ref:`Vector2i`, metadata\: :ref:`Dictionary`\ ) |virtual| |const| | +-----------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`_generate_small_preview_automatically`\ (\ ) |virtual| |const| | +-----------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`_handles`\ (\ type\: :ref:`String`\ ) |virtual| |const| | +-----------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ .. rst-class:: classref-section-separator ---- .. rst-class:: classref-descriptions-group Method Descriptions ------------------- .. _class_EditorResourcePreviewGenerator_private_method__can_generate_small_preview: .. rst-class:: classref-method :ref:`bool` **_can_generate_small_preview**\ (\ ) |virtual| |const| :ref:`🔗` If this function returns ``true``, the generator will call :ref:`_generate()` or :ref:`_generate_from_path()` for small previews as well. By default, it returns ``false``. .. rst-class:: classref-item-separator ---- .. _class_EditorResourcePreviewGenerator_private_method__generate: .. rst-class:: classref-method :ref:`Texture2D` **_generate**\ (\ resource\: :ref:`Resource`, size\: :ref:`Vector2i`, metadata\: :ref:`Dictionary`\ ) |virtual| |const| :ref:`🔗` Generate a preview from a given resource with the specified size. This must always be implemented. Returning ``null`` 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). \ ``metadata`` dictionary can be modified to store file-specific metadata that can be used in :ref:`EditorResourceTooltipPlugin._make_tooltip_for_path()` (like image size, sample length etc.). .. rst-class:: classref-item-separator ---- .. _class_EditorResourcePreviewGenerator_private_method__generate_from_path: .. rst-class:: classref-method :ref:`Texture2D` **_generate_from_path**\ (\ path\: :ref:`String`, size\: :ref:`Vector2i`, metadata\: :ref:`Dictionary`\ ) |virtual| |const| :ref:`🔗` Generate a preview directly from a path with the specified size. Implementing this is optional, as default code will load and call :ref:`_generate()`. Returning ``null`` 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). \ ``metadata`` dictionary can be modified to store file-specific metadata that can be used in :ref:`EditorResourceTooltipPlugin._make_tooltip_for_path()` (like image size, sample length etc.). .. rst-class:: classref-item-separator ---- .. _class_EditorResourcePreviewGenerator_private_method__generate_small_preview_automatically: .. rst-class:: classref-method :ref:`bool` **_generate_small_preview_automatically**\ (\ ) |virtual| |const| :ref:`🔗` If this function returns ``true``, the generator will automatically generate the small previews from the normal preview texture generated by the methods :ref:`_generate()` or :ref:`_generate_from_path()`. By default, it returns ``false``. .. rst-class:: classref-item-separator ---- .. _class_EditorResourcePreviewGenerator_private_method__handles: .. rst-class:: classref-method :ref:`bool` **_handles**\ (\ type\: :ref:`String`\ ) |virtual| |const| :ref:`🔗` 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.)` .. |required| replace:: :abbr:`required (This method is required to be overridden when extending its base class.)` .. |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.)` .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)` .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)` .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)` .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)` .. |void| replace:: :abbr:`void (No return value.)`