class_editorresourcepreview.rst 7.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  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/master/doc/tools/make_rst.py.
  5. .. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/EditorResourcePreview.xml.
  6. .. _class_EditorResourcePreview:
  7. EditorResourcePreview
  8. =====================
  9. **Inherits:** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
  10. Helper to generate previews of resources or files.
  11. Description
  12. -----------
  13. This object is used to generate previews for resources of files.
  14. \ **Note:** This class shouldn't be instantiated directly. Instead, access the singleton using :ref:`EditorInterface.get_resource_previewer<class_EditorInterface_method_get_resource_previewer>`.
  15. Methods
  16. -------
  17. +------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  18. | void | :ref:`add_preview_generator<class_EditorResourcePreview_method_add_preview_generator>` **(** :ref:`EditorResourcePreviewGenerator<class_EditorResourcePreviewGenerator>` generator **)** |
  19. +------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  20. | void | :ref:`check_for_invalidation<class_EditorResourcePreview_method_check_for_invalidation>` **(** :ref:`String<class_String>` path **)** |
  21. +------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  22. | 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 **)** |
  23. +------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  24. | 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 **)** |
  25. +------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  26. | void | :ref:`remove_preview_generator<class_EditorResourcePreview_method_remove_preview_generator>` **(** :ref:`EditorResourcePreviewGenerator<class_EditorResourcePreviewGenerator>` generator **)** |
  27. +------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  28. Signals
  29. -------
  30. .. _class_EditorResourcePreview_signal_preview_invalidated:
  31. - **preview_invalidated** **(** :ref:`String<class_String>` path **)**
  32. Emitted if a preview was invalidated (changed). ``path`` corresponds to the path of the preview.
  33. Method Descriptions
  34. -------------------
  35. .. _class_EditorResourcePreview_method_add_preview_generator:
  36. - void **add_preview_generator** **(** :ref:`EditorResourcePreviewGenerator<class_EditorResourcePreviewGenerator>` generator **)**
  37. Create an own, custom preview generator.
  38. ----
  39. .. _class_EditorResourcePreview_method_check_for_invalidation:
  40. - void **check_for_invalidation** **(** :ref:`String<class_String>` path **)**
  41. Check if the resource changed, if so, it will be invalidated and the corresponding signal emitted.
  42. ----
  43. .. _class_EditorResourcePreview_method_queue_edited_resource_preview:
  44. - 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 **)**
  45. 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.
  46. \ **Note:** If it was not possible to create the preview the ``receiver_func`` will still be called, but the preview will be null.
  47. ----
  48. .. _class_EditorResourcePreview_method_queue_resource_preview:
  49. - 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 **)**
  50. 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.
  51. \ **Note:** If it was not possible to create the preview the ``receiver_func`` will still be called, but the preview will be null.
  52. ----
  53. .. _class_EditorResourcePreview_method_remove_preview_generator:
  54. - void **remove_preview_generator** **(** :ref:`EditorResourcePreviewGenerator<class_EditorResourcePreviewGenerator>` generator **)**
  55. Removes a custom preview generator.
  56. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  57. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  58. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  59. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  60. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  61. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`