class_resourcepreloader.rst 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  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/ResourcePreloader.xml.
  6. .. _class_ResourcePreloader:
  7. ResourcePreloader
  8. =================
  9. **Inherits:** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
  10. A node used to preload sub-resources inside a scene.
  11. .. rst-class:: classref-introduction-group
  12. Description
  13. -----------
  14. This node is used to preload sub-resources inside a scene, so when the scene is loaded, all the resources are ready to use and can be retrieved from the preloader. You can add the resources using the ResourcePreloader tab when the node is selected.
  15. GDScript has a simplified :ref:`@GDScript.preload<class_@GDScript_method_preload>` built-in method which can be used in most situations, leaving the use of **ResourcePreloader** for more advanced scenarios.
  16. .. rst-class:: classref-reftable-group
  17. Methods
  18. -------
  19. .. table::
  20. :widths: auto
  21. +---------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  22. | |void| | :ref:`add_resource<class_ResourcePreloader_method_add_resource>`\ (\ name\: :ref:`StringName<class_StringName>`, resource\: :ref:`Resource<class_Resource>`\ ) |
  23. +---------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  24. | :ref:`Resource<class_Resource>` | :ref:`get_resource<class_ResourcePreloader_method_get_resource>`\ (\ name\: :ref:`StringName<class_StringName>`\ ) |const| |
  25. +---------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  26. | :ref:`PackedStringArray<class_PackedStringArray>` | :ref:`get_resource_list<class_ResourcePreloader_method_get_resource_list>`\ (\ ) |const| |
  27. +---------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  28. | :ref:`bool<class_bool>` | :ref:`has_resource<class_ResourcePreloader_method_has_resource>`\ (\ name\: :ref:`StringName<class_StringName>`\ ) |const| |
  29. +---------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  30. | |void| | :ref:`remove_resource<class_ResourcePreloader_method_remove_resource>`\ (\ name\: :ref:`StringName<class_StringName>`\ ) |
  31. +---------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  32. | |void| | :ref:`rename_resource<class_ResourcePreloader_method_rename_resource>`\ (\ name\: :ref:`StringName<class_StringName>`, newname\: :ref:`StringName<class_StringName>`\ ) |
  33. +---------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  34. .. rst-class:: classref-section-separator
  35. ----
  36. .. rst-class:: classref-descriptions-group
  37. Method Descriptions
  38. -------------------
  39. .. _class_ResourcePreloader_method_add_resource:
  40. .. rst-class:: classref-method
  41. |void| **add_resource**\ (\ name\: :ref:`StringName<class_StringName>`, resource\: :ref:`Resource<class_Resource>`\ ) :ref:`🔗<class_ResourcePreloader_method_add_resource>`
  42. Adds a resource to the preloader with the given ``name``. If a resource with the given ``name`` already exists, the new resource will be renamed to "``name`` N" where N is an incrementing number starting from 2.
  43. .. rst-class:: classref-item-separator
  44. ----
  45. .. _class_ResourcePreloader_method_get_resource:
  46. .. rst-class:: classref-method
  47. :ref:`Resource<class_Resource>` **get_resource**\ (\ name\: :ref:`StringName<class_StringName>`\ ) |const| :ref:`🔗<class_ResourcePreloader_method_get_resource>`
  48. Returns the resource associated to ``name``.
  49. .. rst-class:: classref-item-separator
  50. ----
  51. .. _class_ResourcePreloader_method_get_resource_list:
  52. .. rst-class:: classref-method
  53. :ref:`PackedStringArray<class_PackedStringArray>` **get_resource_list**\ (\ ) |const| :ref:`🔗<class_ResourcePreloader_method_get_resource_list>`
  54. Returns the list of resources inside the preloader.
  55. .. rst-class:: classref-item-separator
  56. ----
  57. .. _class_ResourcePreloader_method_has_resource:
  58. .. rst-class:: classref-method
  59. :ref:`bool<class_bool>` **has_resource**\ (\ name\: :ref:`StringName<class_StringName>`\ ) |const| :ref:`🔗<class_ResourcePreloader_method_has_resource>`
  60. Returns ``true`` if the preloader contains a resource associated to ``name``.
  61. .. rst-class:: classref-item-separator
  62. ----
  63. .. _class_ResourcePreloader_method_remove_resource:
  64. .. rst-class:: classref-method
  65. |void| **remove_resource**\ (\ name\: :ref:`StringName<class_StringName>`\ ) :ref:`🔗<class_ResourcePreloader_method_remove_resource>`
  66. Removes the resource associated to ``name`` from the preloader.
  67. .. rst-class:: classref-item-separator
  68. ----
  69. .. _class_ResourcePreloader_method_rename_resource:
  70. .. rst-class:: classref-method
  71. |void| **rename_resource**\ (\ name\: :ref:`StringName<class_StringName>`, newname\: :ref:`StringName<class_StringName>`\ ) :ref:`🔗<class_ResourcePreloader_method_rename_resource>`
  72. Renames a resource inside the preloader from ``name`` to ``newname``.
  73. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  74. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  75. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  76. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  77. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  78. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
  79. .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)`
  80. .. |void| replace:: :abbr:`void (No return value.)`