class_editorresourcepreviewgenerator.rst 5.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. :github_url: hide
  2. .. Generated automatically by doc/tools/makerst.py in Godot's source tree.
  3. .. DO NOT EDIT THIS FILE, but the EditorResourcePreviewGenerator.xml source instead.
  4. .. The source is found in doc/classes or modules/<name>/doc_classes.
  5. .. _class_EditorResourcePreviewGenerator:
  6. EditorResourcePreviewGenerator
  7. ==============================
  8. **Inherits:** :ref:`Reference<class_Reference>` **<** :ref:`Object<class_Object>`
  9. **Category:** Core
  10. Brief Description
  11. -----------------
  12. Custom generator of previews.
  13. Methods
  14. -------
  15. +-------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  16. | :ref:`bool<class_bool>` | :ref:`can_generate_small_preview<class_EditorResourcePreviewGenerator_method_can_generate_small_preview>` **(** **)** virtual |
  17. +-------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  18. | :ref:`Texture<class_Texture>` | :ref:`generate<class_EditorResourcePreviewGenerator_method_generate>` **(** :ref:`Resource<class_Resource>` from, :ref:`Vector2<class_Vector2>` size **)** virtual |
  19. +-------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  20. | :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 |
  21. +-------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  22. | :ref:`bool<class_bool>` | :ref:`generate_small_preview_automatically<class_EditorResourcePreviewGenerator_method_generate_small_preview_automatically>` **(** **)** virtual |
  23. +-------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  24. | :ref:`bool<class_bool>` | :ref:`handles<class_EditorResourcePreviewGenerator_method_handles>` **(** :ref:`String<class_String>` type **)** virtual |
  25. +-------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  26. Description
  27. -----------
  28. 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.
  29. Method Descriptions
  30. -------------------
  31. .. _class_EditorResourcePreviewGenerator_method_can_generate_small_preview:
  32. - :ref:`bool<class_bool>` **can_generate_small_preview** **(** **)** virtual
  33. 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.
  34. By default, it returns ``false``.
  35. .. _class_EditorResourcePreviewGenerator_method_generate:
  36. - :ref:`Texture<class_Texture>` **generate** **(** :ref:`Resource<class_Resource>` from, :ref:`Vector2<class_Vector2>` size **)** virtual
  37. Generate a preview from a given resource with the specified size. This must always be implemented.
  38. Returning an empty texture is an OK way to fail and let another generator take care.
  39. Care must be taken because this function is always called from a thread (not the main thread).
  40. .. _class_EditorResourcePreviewGenerator_method_generate_from_path:
  41. - :ref:`Texture<class_Texture>` **generate_from_path** **(** :ref:`String<class_String>` path, :ref:`Vector2<class_Vector2>` size **)** virtual
  42. 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>`.
  43. Returning an empty texture is an OK way to fail and let another generator take care.
  44. Care must be taken because this function is always called from a thread (not the main thread).
  45. .. _class_EditorResourcePreviewGenerator_method_generate_small_preview_automatically:
  46. - :ref:`bool<class_bool>` **generate_small_preview_automatically** **(** **)** virtual
  47. 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>`.
  48. By default, it returns ``false``.
  49. .. _class_EditorResourcePreviewGenerator_method_handles:
  50. - :ref:`bool<class_bool>` **handles** **(** :ref:`String<class_String>` type **)** virtual
  51. Returns ``true`` if your generator supports the resource of type ``type``.