class_editorresourcepreviewgenerator.rst 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. .. Generated automatically by doc/tools/makerst.py in Godot's source tree.
  2. .. DO NOT EDIT THIS FILE, but the EditorResourcePreviewGenerator.xml source instead.
  3. .. The source is found in doc/classes or modules/<name>/doc_classes.
  4. .. _class_EditorResourcePreviewGenerator:
  5. EditorResourcePreviewGenerator
  6. ==============================
  7. **Inherits:** :ref:`Reference<class_Reference>` **<** :ref:`Object<class_Object>`
  8. **Category:** Core
  9. Brief Description
  10. -----------------
  11. Custom generator of previews.
  12. Methods
  13. -------
  14. +-------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  15. | :ref:`Texture<class_Texture>` | :ref:`generate<class_EditorResourcePreviewGenerator_method_generate>` **(** :ref:`Resource<class_Resource>` from, :ref:`Vector2<class_Vector2>` size **)** virtual |
  16. +-------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  17. | :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 |
  18. +-------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  19. | :ref:`bool<class_bool>` | :ref:`handles<class_EditorResourcePreviewGenerator_method_handles>` **(** :ref:`String<class_String>` type **)** virtual |
  20. +-------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  21. Description
  22. -----------
  23. Custom code to generate previews. Please check "file_dialog/thumbnail_size" in EditorSettings to find out the right size to do previews at.
  24. Method Descriptions
  25. -------------------
  26. .. _class_EditorResourcePreviewGenerator_method_generate:
  27. - :ref:`Texture<class_Texture>` **generate** **(** :ref:`Resource<class_Resource>` from, :ref:`Vector2<class_Vector2>` size **)** virtual
  28. Generate a preview from a given resource with the specified size. This must always be implemented.
  29. Returning an empty texture is an OK way to fail and let another generator take care.
  30. Care must be taken because this function is always called from a thread (not the main thread).
  31. .. _class_EditorResourcePreviewGenerator_method_generate_from_path:
  32. - :ref:`Texture<class_Texture>` **generate_from_path** **(** :ref:`String<class_String>` path, :ref:`Vector2<class_Vector2>` size **)** virtual
  33. 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>`.
  34. Returning an empty texture is an OK way to fail and let another generator take care.
  35. Care must be taken because this function is always called from a thread (not the main thread).
  36. .. _class_EditorResourcePreviewGenerator_method_handles:
  37. - :ref:`bool<class_bool>` **handles** **(** :ref:`String<class_String>` type **)** virtual
  38. Return if your generator supports this resource type.