class_editorresourcepreview.rst 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. :github_url: hide
  2. .. DO NOT EDIT THIS FILE!!!
  3. .. Generated automatically from Godot engine sources.
  4. .. Generator: https://github.com/godotengine/godot/tree/4.0/doc/tools/make_rst.py.
  5. .. XML source: https://github.com/godotengine/godot/tree/4.0/doc/classes/EditorResourcePreview.xml.
  6. .. _class_EditorResourcePreview:
  7. EditorResourcePreview
  8. =====================
  9. **Inherits:** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
  10. A node used to generate previews of resources or files.
  11. .. rst-class:: classref-introduction-group
  12. Description
  13. -----------
  14. This node is used to generate previews for resources of files.
  15. \ **Note:** This class shouldn't be instantiated directly. Instead, access the singleton using :ref:`EditorInterface.get_resource_previewer<class_EditorInterface_method_get_resource_previewer>`.
  16. .. rst-class:: classref-reftable-group
  17. Methods
  18. -------
  19. .. table::
  20. :widths: auto
  21. +------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  22. | void | :ref:`add_preview_generator<class_EditorResourcePreview_method_add_preview_generator>` **(** :ref:`EditorResourcePreviewGenerator<class_EditorResourcePreviewGenerator>` generator **)** |
  23. +------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  24. | void | :ref:`check_for_invalidation<class_EditorResourcePreview_method_check_for_invalidation>` **(** :ref:`String<class_String>` path **)** |
  25. +------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  26. | void | :ref:`queue_edited_resource_preview<class_EditorResourcePreview_method_queue_edited_resource_preview>` **(** :ref:`Resource<class_Resource>` resource, :ref:`Object<class_Object>` receiver, :ref:`StringName<class_StringName>` receiver_func, :ref:`Variant<class_Variant>` userdata **)** |
  27. +------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  28. | void | :ref:`queue_resource_preview<class_EditorResourcePreview_method_queue_resource_preview>` **(** :ref:`String<class_String>` path, :ref:`Object<class_Object>` receiver, :ref:`StringName<class_StringName>` receiver_func, :ref:`Variant<class_Variant>` userdata **)** |
  29. +------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  30. | void | :ref:`remove_preview_generator<class_EditorResourcePreview_method_remove_preview_generator>` **(** :ref:`EditorResourcePreviewGenerator<class_EditorResourcePreviewGenerator>` generator **)** |
  31. +------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  32. .. rst-class:: classref-section-separator
  33. ----
  34. .. rst-class:: classref-descriptions-group
  35. Signals
  36. -------
  37. .. _class_EditorResourcePreview_signal_preview_invalidated:
  38. .. rst-class:: classref-signal
  39. **preview_invalidated** **(** :ref:`String<class_String>` path **)**
  40. Emitted if a preview was invalidated (changed). ``path`` corresponds to the path of the preview.
  41. .. rst-class:: classref-section-separator
  42. ----
  43. .. rst-class:: classref-descriptions-group
  44. Method Descriptions
  45. -------------------
  46. .. _class_EditorResourcePreview_method_add_preview_generator:
  47. .. rst-class:: classref-method
  48. void **add_preview_generator** **(** :ref:`EditorResourcePreviewGenerator<class_EditorResourcePreviewGenerator>` generator **)**
  49. Create an own, custom preview generator.
  50. .. rst-class:: classref-item-separator
  51. ----
  52. .. _class_EditorResourcePreview_method_check_for_invalidation:
  53. .. rst-class:: classref-method
  54. void **check_for_invalidation** **(** :ref:`String<class_String>` path **)**
  55. Check if the resource changed, if so, it will be invalidated and the corresponding signal emitted.
  56. .. rst-class:: classref-item-separator
  57. ----
  58. .. _class_EditorResourcePreview_method_queue_edited_resource_preview:
  59. .. rst-class:: classref-method
  60. void **queue_edited_resource_preview** **(** :ref:`Resource<class_Resource>` resource, :ref:`Object<class_Object>` receiver, :ref:`StringName<class_StringName>` receiver_func, :ref:`Variant<class_Variant>` userdata **)**
  61. Queue the ``resource`` being edited for preview. Once the preview is ready, the ``receiver``'s ``receiver_func`` will be called. The ``receiver_func`` must take the following four arguments: :ref:`String<class_String>` path, :ref:`Texture2D<class_Texture2D>` preview, :ref:`Texture2D<class_Texture2D>` thumbnail_preview, :ref:`Variant<class_Variant>` userdata. ``userdata`` can be anything, and will be returned when ``receiver_func`` is called.
  62. \ **Note:** If it was not possible to create the preview the ``receiver_func`` will still be called, but the preview will be null.
  63. .. rst-class:: classref-item-separator
  64. ----
  65. .. _class_EditorResourcePreview_method_queue_resource_preview:
  66. .. rst-class:: classref-method
  67. void **queue_resource_preview** **(** :ref:`String<class_String>` path, :ref:`Object<class_Object>` receiver, :ref:`StringName<class_StringName>` receiver_func, :ref:`Variant<class_Variant>` userdata **)**
  68. Queue a resource file located at ``path`` for preview. Once the preview is ready, the ``receiver``'s ``receiver_func`` will be called. The ``receiver_func`` must take the following four arguments: :ref:`String<class_String>` path, :ref:`Texture2D<class_Texture2D>` preview, :ref:`Texture2D<class_Texture2D>` thumbnail_preview, :ref:`Variant<class_Variant>` userdata. ``userdata`` can be anything, and will be returned when ``receiver_func`` is called.
  69. \ **Note:** If it was not possible to create the preview the ``receiver_func`` will still be called, but the preview will be null.
  70. .. rst-class:: classref-item-separator
  71. ----
  72. .. _class_EditorResourcePreview_method_remove_preview_generator:
  73. .. rst-class:: classref-method
  74. void **remove_preview_generator** **(** :ref:`EditorResourcePreviewGenerator<class_EditorResourcePreviewGenerator>` generator **)**
  75. Removes a custom preview generator.
  76. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  77. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  78. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  79. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  80. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  81. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`