EditorResourcePreview.xml 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <class name="EditorResourcePreview" inherits="Node" version="4.0">
  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. <argument index="0" name="generator" type="EditorResourcePreviewGenerator" />
  16. <description>
  17. Create an own, custom preview generator.
  18. </description>
  19. </method>
  20. <method name="check_for_invalidation">
  21. <return type="void" />
  22. <argument index="0" name="path" type="String" />
  23. <description>
  24. Check if the resource changed, if so, it will be invalidated and the corresponding signal emitted.
  25. </description>
  26. </method>
  27. <method name="queue_edited_resource_preview">
  28. <return type="void" />
  29. <argument index="0" name="resource" type="Resource" />
  30. <argument index="1" name="receiver" type="Object" />
  31. <argument index="2" name="receiver_func" type="StringName" />
  32. <argument index="3" name="userdata" type="Variant" />
  33. <description>
  34. 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, [Texture2D] preview, [Texture2D] thumbnail_preview, [Variant] userdata. [code]userdata[/code] can be anything, and will be returned when [code]receiver_func[/code] is called.
  35. [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.
  36. </description>
  37. </method>
  38. <method name="queue_resource_preview">
  39. <return type="void" />
  40. <argument index="0" name="path" type="String" />
  41. <argument index="1" name="receiver" type="Object" />
  42. <argument index="2" name="receiver_func" type="StringName" />
  43. <argument index="3" name="userdata" type="Variant" />
  44. <description>
  45. 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, [Texture2D] preview, [Texture2D] thumbnail_preview, [Variant] userdata. [code]userdata[/code] can be anything, and will be returned when [code]receiver_func[/code] is called.
  46. [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.
  47. </description>
  48. </method>
  49. <method name="remove_preview_generator">
  50. <return type="void" />
  51. <argument index="0" name="generator" type="EditorResourcePreviewGenerator" />
  52. <description>
  53. Removes a custom preview generator.
  54. </description>
  55. </method>
  56. </methods>
  57. <signals>
  58. <signal name="preview_invalidated">
  59. <argument index="0" name="path" type="String" />
  60. <description>
  61. Emitted if a preview was invalidated (changed). [code]path[/code] corresponds to the path of the preview.
  62. </description>
  63. </signal>
  64. </signals>
  65. </class>