EditorResourcePreviewGenerator.xml 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <class name="EditorResourcePreviewGenerator" inherits="Reference" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
  3. <brief_description>
  4. Custom generator of previews.
  5. </brief_description>
  6. <description>
  7. Custom code to generate previews. Please check [code]file_dialog/thumbnail_size[/code] in [EditorSettings] to find out the right size to do previews at.
  8. </description>
  9. <tutorials>
  10. </tutorials>
  11. <methods>
  12. <method name="can_generate_small_preview" qualifiers="virtual">
  13. <return type="bool" />
  14. <description>
  15. If this function returns [code]true[/code], the generator will call [method generate] or [method generate_from_path] for small previews as well.
  16. By default, it returns [code]false[/code].
  17. </description>
  18. </method>
  19. <method name="generate" qualifiers="virtual">
  20. <return type="Texture" />
  21. <argument index="0" name="from" type="Resource" />
  22. <argument index="1" name="size" type="Vector2" />
  23. <description>
  24. Generate a preview from a given resource with the specified size. This must always be implemented.
  25. Returning an empty texture is an OK way to fail and let another generator take care.
  26. Care must be taken because this function is always called from a thread (not the main thread).
  27. </description>
  28. </method>
  29. <method name="generate_from_path" qualifiers="virtual">
  30. <return type="Texture" />
  31. <argument index="0" name="path" type="String" />
  32. <argument index="1" name="size" type="Vector2" />
  33. <description>
  34. Generate a preview directly from a path with the specified size. Implementing this is optional, as default code will load and call [method generate].
  35. Returning an empty texture is an OK way to fail and let another generator take care.
  36. Care must be taken because this function is always called from a thread (not the main thread).
  37. </description>
  38. </method>
  39. <method name="generate_small_preview_automatically" qualifiers="virtual">
  40. <return type="bool" />
  41. <description>
  42. If this function returns [code]true[/code], the generator will automatically generate the small previews from the normal preview texture generated by the methods [method generate] or [method generate_from_path].
  43. By default, it returns [code]false[/code].
  44. </description>
  45. </method>
  46. <method name="handles" qualifiers="virtual">
  47. <return type="bool" />
  48. <argument index="0" name="type" type="String" />
  49. <description>
  50. Returns [code]true[/code] if your generator supports the resource of type [code]type[/code].
  51. </description>
  52. </method>
  53. </methods>
  54. <constants>
  55. </constants>
  56. </class>