class_editorresourcepreviewgenerator.rst 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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:`Texture<class_Texture>` | :ref:`generate<class_EditorResourcePreviewGenerator_method_generate>` **(** :ref:`Resource<class_Resource>` from, :ref:`Vector2<class_Vector2>` size **)** virtual |
  17. +-------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  18. | :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 |
  19. +-------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  20. | :ref:`bool<class_bool>` | :ref:`handles<class_EditorResourcePreviewGenerator_method_handles>` **(** :ref:`String<class_String>` type **)** virtual |
  21. +-------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  22. Description
  23. -----------
  24. Custom code to generate previews. Please check "file_dialog/thumbnail_size" in EditorSettings to find out the right size to do previews at.
  25. Method Descriptions
  26. -------------------
  27. .. _class_EditorResourcePreviewGenerator_method_generate:
  28. - :ref:`Texture<class_Texture>` **generate** **(** :ref:`Resource<class_Resource>` from, :ref:`Vector2<class_Vector2>` size **)** virtual
  29. Generate a preview from a given resource with the specified size. This must always be implemented.
  30. Returning an empty texture is an OK way to fail and let another generator take care.
  31. Care must be taken because this function is always called from a thread (not the main thread).
  32. ----
  33. .. _class_EditorResourcePreviewGenerator_method_generate_from_path:
  34. - :ref:`Texture<class_Texture>` **generate_from_path** **(** :ref:`String<class_String>` path, :ref:`Vector2<class_Vector2>` size **)** virtual
  35. 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>`.
  36. Returning an empty texture is an OK way to fail and let another generator take care.
  37. Care must be taken because this function is always called from a thread (not the main thread).
  38. ----
  39. .. _class_EditorResourcePreviewGenerator_method_handles:
  40. - :ref:`bool<class_bool>` **handles** **(** :ref:`String<class_String>` type **)** virtual
  41. Returns if your generator supports this resource type.