EditorResourcePreview.xml 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <class name="EditorResourcePreview" inherits="Node" version="3.4">
  3. <brief_description>
  4. Helper to generate previews of resources or files.
  5. </brief_description>
  6. <description>
  7. This object is used to generate previews for resources of files.
  8. [b]Note:[/b] This class shouldn't be instantiated directly. Instead, access the singleton using [method EditorInterface.get_resource_previewer].
  9. </description>
  10. <tutorials>
  11. </tutorials>
  12. <methods>
  13. <method name="add_preview_generator">
  14. <return type="void">
  15. </return>
  16. <argument index="0" name="generator" type="EditorResourcePreviewGenerator">
  17. </argument>
  18. <description>
  19. Create an own, custom preview generator.
  20. </description>
  21. </method>
  22. <method name="check_for_invalidation">
  23. <return type="void">
  24. </return>
  25. <argument index="0" name="path" type="String">
  26. </argument>
  27. <description>
  28. Check if the resource changed, if so, it will be invalidated and the corresponding signal emitted.
  29. </description>
  30. </method>
  31. <method name="queue_edited_resource_preview">
  32. <return type="void">
  33. </return>
  34. <argument index="0" name="resource" type="Resource">
  35. </argument>
  36. <argument index="1" name="receiver" type="Object">
  37. </argument>
  38. <argument index="2" name="receiver_func" type="String">
  39. </argument>
  40. <argument index="3" name="userdata" type="Variant">
  41. </argument>
  42. <description>
  43. Queue the [code]resource[/code] being edited for preview. Once the preview is ready, the [code]receiver[/code]'s [code]receiver_func[/code] will be called. The [code]receiver_func[/code] must take the following four arguments: [String] path, [Texture] preview, [Texture] thumbnail_preview, [Variant] userdata. [code]userdata[/code] can be anything, and will be returned when [code]receiver_func[/code] is called.
  44. [b]Note[/b]: If it was not possible to create the preview the [code]receiver_func[/code] will still be called, but the preview will be null.
  45. </description>
  46. </method>
  47. <method name="queue_resource_preview">
  48. <return type="void">
  49. </return>
  50. <argument index="0" name="path" type="String">
  51. </argument>
  52. <argument index="1" name="receiver" type="Object">
  53. </argument>
  54. <argument index="2" name="receiver_func" type="String">
  55. </argument>
  56. <argument index="3" name="userdata" type="Variant">
  57. </argument>
  58. <description>
  59. Queue a resource file located at [code]path[/code] for preview. Once the preview is ready, the [code]receiver[/code]'s [code]receiver_func[/code] will be called. The [code]receiver_func[/code] must take the following four arguments: [String] path, [Texture] preview, [Texture] thumbnail_preview, [Variant] userdata. [code]userdata[/code] can be anything, and will be returned when [code]receiver_func[/code] is called.
  60. [b]Note[/b]: If it was not possible to create the preview the [code]receiver_func[/code] will still be called, but the preview will be null.
  61. </description>
  62. </method>
  63. <method name="remove_preview_generator">
  64. <return type="void">
  65. </return>
  66. <argument index="0" name="generator" type="EditorResourcePreviewGenerator">
  67. </argument>
  68. <description>
  69. Removes a custom preview generator.
  70. </description>
  71. </method>
  72. </methods>
  73. <signals>
  74. <signal name="preview_invalidated">
  75. <argument index="0" name="path" type="String">
  76. </argument>
  77. <description>
  78. Emitted if a preview was invalidated (changed). [code]path[/code] corresponds to the path of the preview.
  79. </description>
  80. </signal>
  81. </signals>
  82. <constants>
  83. </constants>
  84. </class>