class_meshlibrary.rst 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217
  1. :github_url: hide
  2. .. Generated automatically by doc/tools/makerst.py in Godot's source tree.
  3. .. DO NOT EDIT THIS FILE, but the MeshLibrary.xml source instead.
  4. .. The source is found in doc/classes or modules/<name>/doc_classes.
  5. .. _class_MeshLibrary:
  6. MeshLibrary
  7. ===========
  8. **Inherits:** :ref:`Resource<class_Resource>` **<** :ref:`Reference<class_Reference>` **<** :ref:`Object<class_Object>`
  9. Library of meshes.
  10. Description
  11. -----------
  12. A library of meshes. Contains a list of :ref:`Mesh<class_Mesh>` resources, each with a name and ID. Each item can also include collision and navigation shapes. This resource is used in :ref:`GridMap<class_GridMap>`.
  13. Methods
  14. -------
  15. +---------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  16. | void | :ref:`clear<class_MeshLibrary_method_clear>` **(** **)** |
  17. +---------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  18. | void | :ref:`create_item<class_MeshLibrary_method_create_item>` **(** :ref:`int<class_int>` id **)** |
  19. +---------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  20. | :ref:`int<class_int>` | :ref:`find_item_by_name<class_MeshLibrary_method_find_item_by_name>` **(** :ref:`String<class_String>` name **)** |const| |
  21. +---------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  22. | :ref:`PoolIntArray<class_PoolIntArray>` | :ref:`get_item_list<class_MeshLibrary_method_get_item_list>` **(** **)** |const| |
  23. +---------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  24. | :ref:`Mesh<class_Mesh>` | :ref:`get_item_mesh<class_MeshLibrary_method_get_item_mesh>` **(** :ref:`int<class_int>` id **)** |const| |
  25. +---------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  26. | :ref:`String<class_String>` | :ref:`get_item_name<class_MeshLibrary_method_get_item_name>` **(** :ref:`int<class_int>` id **)** |const| |
  27. +---------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  28. | :ref:`NavigationMesh<class_NavigationMesh>` | :ref:`get_item_navmesh<class_MeshLibrary_method_get_item_navmesh>` **(** :ref:`int<class_int>` id **)** |const| |
  29. +---------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  30. | :ref:`Transform<class_Transform>` | :ref:`get_item_navmesh_transform<class_MeshLibrary_method_get_item_navmesh_transform>` **(** :ref:`int<class_int>` id **)** |const| |
  31. +---------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  32. | :ref:`Texture<class_Texture>` | :ref:`get_item_preview<class_MeshLibrary_method_get_item_preview>` **(** :ref:`int<class_int>` id **)** |const| |
  33. +---------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  34. | :ref:`Array<class_Array>` | :ref:`get_item_shapes<class_MeshLibrary_method_get_item_shapes>` **(** :ref:`int<class_int>` id **)** |const| |
  35. +---------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  36. | :ref:`int<class_int>` | :ref:`get_last_unused_item_id<class_MeshLibrary_method_get_last_unused_item_id>` **(** **)** |const| |
  37. +---------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  38. | void | :ref:`remove_item<class_MeshLibrary_method_remove_item>` **(** :ref:`int<class_int>` id **)** |
  39. +---------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  40. | void | :ref:`set_item_mesh<class_MeshLibrary_method_set_item_mesh>` **(** :ref:`int<class_int>` id, :ref:`Mesh<class_Mesh>` mesh **)** |
  41. +---------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  42. | void | :ref:`set_item_name<class_MeshLibrary_method_set_item_name>` **(** :ref:`int<class_int>` id, :ref:`String<class_String>` name **)** |
  43. +---------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  44. | void | :ref:`set_item_navmesh<class_MeshLibrary_method_set_item_navmesh>` **(** :ref:`int<class_int>` id, :ref:`NavigationMesh<class_NavigationMesh>` navmesh **)** |
  45. +---------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  46. | void | :ref:`set_item_navmesh_transform<class_MeshLibrary_method_set_item_navmesh_transform>` **(** :ref:`int<class_int>` id, :ref:`Transform<class_Transform>` navmesh **)** |
  47. +---------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  48. | void | :ref:`set_item_preview<class_MeshLibrary_method_set_item_preview>` **(** :ref:`int<class_int>` id, :ref:`Texture<class_Texture>` texture **)** |
  49. +---------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  50. | void | :ref:`set_item_shapes<class_MeshLibrary_method_set_item_shapes>` **(** :ref:`int<class_int>` id, :ref:`Array<class_Array>` shapes **)** |
  51. +---------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  52. Method Descriptions
  53. -------------------
  54. .. _class_MeshLibrary_method_clear:
  55. - void **clear** **(** **)**
  56. Clears the library.
  57. ----
  58. .. _class_MeshLibrary_method_create_item:
  59. - void **create_item** **(** :ref:`int<class_int>` id **)**
  60. Creates a new item in the library with the given ID.
  61. You can get an unused ID from :ref:`get_last_unused_item_id<class_MeshLibrary_method_get_last_unused_item_id>`.
  62. ----
  63. .. _class_MeshLibrary_method_find_item_by_name:
  64. - :ref:`int<class_int>` **find_item_by_name** **(** :ref:`String<class_String>` name **)** |const|
  65. Returns the first item with the given name.
  66. ----
  67. .. _class_MeshLibrary_method_get_item_list:
  68. - :ref:`PoolIntArray<class_PoolIntArray>` **get_item_list** **(** **)** |const|
  69. Returns the list of item IDs in use.
  70. ----
  71. .. _class_MeshLibrary_method_get_item_mesh:
  72. - :ref:`Mesh<class_Mesh>` **get_item_mesh** **(** :ref:`int<class_int>` id **)** |const|
  73. Returns the item's mesh.
  74. ----
  75. .. _class_MeshLibrary_method_get_item_name:
  76. - :ref:`String<class_String>` **get_item_name** **(** :ref:`int<class_int>` id **)** |const|
  77. Returns the item's name.
  78. ----
  79. .. _class_MeshLibrary_method_get_item_navmesh:
  80. - :ref:`NavigationMesh<class_NavigationMesh>` **get_item_navmesh** **(** :ref:`int<class_int>` id **)** |const|
  81. Returns the item's navigation mesh.
  82. ----
  83. .. _class_MeshLibrary_method_get_item_navmesh_transform:
  84. - :ref:`Transform<class_Transform>` **get_item_navmesh_transform** **(** :ref:`int<class_int>` id **)** |const|
  85. Returns the transform applied to the item's navigation mesh.
  86. ----
  87. .. _class_MeshLibrary_method_get_item_preview:
  88. - :ref:`Texture<class_Texture>` **get_item_preview** **(** :ref:`int<class_int>` id **)** |const|
  89. When running in the editor, returns a generated item preview (a 3D rendering in isometric perspective). When used in a running project, returns the manually-defined item preview which can be set using :ref:`set_item_preview<class_MeshLibrary_method_set_item_preview>`. Returns an empty :ref:`Texture<class_Texture>` if no preview was manually set in a running project.
  90. ----
  91. .. _class_MeshLibrary_method_get_item_shapes:
  92. - :ref:`Array<class_Array>` **get_item_shapes** **(** :ref:`int<class_int>` id **)** |const|
  93. Returns an item's collision shapes.
  94. The array consists of each :ref:`Shape<class_Shape>` followed by its :ref:`Transform<class_Transform>`.
  95. ----
  96. .. _class_MeshLibrary_method_get_last_unused_item_id:
  97. - :ref:`int<class_int>` **get_last_unused_item_id** **(** **)** |const|
  98. Gets an unused ID for a new item.
  99. ----
  100. .. _class_MeshLibrary_method_remove_item:
  101. - void **remove_item** **(** :ref:`int<class_int>` id **)**
  102. Removes the item.
  103. ----
  104. .. _class_MeshLibrary_method_set_item_mesh:
  105. - void **set_item_mesh** **(** :ref:`int<class_int>` id, :ref:`Mesh<class_Mesh>` mesh **)**
  106. Sets the item's mesh.
  107. ----
  108. .. _class_MeshLibrary_method_set_item_name:
  109. - void **set_item_name** **(** :ref:`int<class_int>` id, :ref:`String<class_String>` name **)**
  110. Sets the item's name.
  111. This name is shown in the editor. It can also be used to look up the item later using :ref:`find_item_by_name<class_MeshLibrary_method_find_item_by_name>`.
  112. ----
  113. .. _class_MeshLibrary_method_set_item_navmesh:
  114. - void **set_item_navmesh** **(** :ref:`int<class_int>` id, :ref:`NavigationMesh<class_NavigationMesh>` navmesh **)**
  115. Sets the item's navigation mesh.
  116. ----
  117. .. _class_MeshLibrary_method_set_item_navmesh_transform:
  118. - void **set_item_navmesh_transform** **(** :ref:`int<class_int>` id, :ref:`Transform<class_Transform>` navmesh **)**
  119. Sets the transform to apply to the item's navigation mesh.
  120. ----
  121. .. _class_MeshLibrary_method_set_item_preview:
  122. - void **set_item_preview** **(** :ref:`int<class_int>` id, :ref:`Texture<class_Texture>` texture **)**
  123. Sets a texture to use as the item's preview icon in the editor.
  124. ----
  125. .. _class_MeshLibrary_method_set_item_shapes:
  126. - void **set_item_shapes** **(** :ref:`int<class_int>` id, :ref:`Array<class_Array>` shapes **)**
  127. Sets an item's collision shapes.
  128. The array should consist of :ref:`Shape<class_Shape>` objects, each followed by a :ref:`Transform<class_Transform>` that will be applied to it. For shapes that should not have a transform, use :ref:`Transform.IDENTITY<class_Transform_constant_IDENTITY>`.
  129. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  130. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  131. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`