: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//doc_classes. .. _class_EditorResourcePreviewGenerator: EditorResourcePreviewGenerator ============================== **Inherits:** :ref:`Reference` **<** :ref:`Object` **Category:** Core Brief Description ----------------- Custom generator of previews. Methods ------- +-------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`can_generate_small_preview` **(** **)** virtual | +-------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Texture` | :ref:`generate` **(** :ref:`Resource` from, :ref:`Vector2` size **)** virtual | +-------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Texture` | :ref:`generate_from_path` **(** :ref:`String` path, :ref:`Vector2` size **)** virtual | +-------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`generate_small_preview_automatically` **(** **)** virtual | +-------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`handles` **(** :ref:`String` type **)** virtual | +-------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ Description ----------- Custom code to generate previews. Please check ``file_dialog/thumbnail_size`` in :ref:`EditorSettings` to find out the right size to do previews at. Method Descriptions ------------------- .. _class_EditorResourcePreviewGenerator_method_can_generate_small_preview: - :ref:`bool` **can_generate_small_preview** **(** **)** virtual 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``. .. _class_EditorResourcePreviewGenerator_method_generate: - :ref:`Texture` **generate** **(** :ref:`Resource` from, :ref:`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` **generate_from_path** **(** :ref:`String` path, :ref:`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`. 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_small_preview_automatically: - :ref:`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` or :ref:`generate_from_path`. By default, it returns ``false``. .. _class_EditorResourcePreviewGenerator_method_handles: - :ref:`bool` **handles** **(** :ref:`String` type **)** virtual Returns ``true`` if your generator supports the resource of type ``type``.