class_meshlibrary.rst 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339
  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/3.6/doc/tools/make_rst.py.
  5. .. XML source: https://github.com/godotengine/godot/tree/3.6/doc/classes/MeshLibrary.xml.
  6. .. _class_MeshLibrary:
  7. MeshLibrary
  8. ===========
  9. **Inherits:** :ref:`Resource<class_Resource>` **<** :ref:`Reference<class_Reference>` **<** :ref:`Object<class_Object>`
  10. Library of meshes.
  11. .. rst-class:: classref-introduction-group
  12. Description
  13. -----------
  14. 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>`.
  15. .. rst-class:: classref-introduction-group
  16. Tutorials
  17. ---------
  18. - `3D Kinematic Character Demo <https://godotengine.org/asset-library/asset/126>`__
  19. - `3D Platformer Demo <https://godotengine.org/asset-library/asset/125>`__
  20. .. rst-class:: classref-reftable-group
  21. Methods
  22. -------
  23. .. table::
  24. :widths: auto
  25. +---------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  26. | void | :ref:`clear<class_MeshLibrary_method_clear>` **(** **)** |
  27. +---------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  28. | void | :ref:`create_item<class_MeshLibrary_method_create_item>` **(** :ref:`int<class_int>` id **)** |
  29. +---------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  30. | :ref:`int<class_int>` | :ref:`find_item_by_name<class_MeshLibrary_method_find_item_by_name>` **(** :ref:`String<class_String>` name **)** |const| |
  31. +---------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  32. | :ref:`PoolIntArray<class_PoolIntArray>` | :ref:`get_item_list<class_MeshLibrary_method_get_item_list>` **(** **)** |const| |
  33. +---------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  34. | :ref:`Mesh<class_Mesh>` | :ref:`get_item_mesh<class_MeshLibrary_method_get_item_mesh>` **(** :ref:`int<class_int>` id **)** |const| |
  35. +---------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  36. | :ref:`Transform<class_Transform>` | :ref:`get_item_mesh_transform<class_MeshLibrary_method_get_item_mesh_transform>` **(** :ref:`int<class_int>` id **)** |const| |
  37. +---------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  38. | :ref:`String<class_String>` | :ref:`get_item_name<class_MeshLibrary_method_get_item_name>` **(** :ref:`int<class_int>` id **)** |const| |
  39. +---------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  40. | :ref:`NavigationMesh<class_NavigationMesh>` | :ref:`get_item_navmesh<class_MeshLibrary_method_get_item_navmesh>` **(** :ref:`int<class_int>` id **)** |const| |
  41. +---------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  42. | :ref:`Transform<class_Transform>` | :ref:`get_item_navmesh_transform<class_MeshLibrary_method_get_item_navmesh_transform>` **(** :ref:`int<class_int>` id **)** |const| |
  43. +---------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  44. | :ref:`Texture<class_Texture>` | :ref:`get_item_preview<class_MeshLibrary_method_get_item_preview>` **(** :ref:`int<class_int>` id **)** |const| |
  45. +---------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  46. | :ref:`Array<class_Array>` | :ref:`get_item_shapes<class_MeshLibrary_method_get_item_shapes>` **(** :ref:`int<class_int>` id **)** |const| |
  47. +---------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  48. | :ref:`int<class_int>` | :ref:`get_last_unused_item_id<class_MeshLibrary_method_get_last_unused_item_id>` **(** **)** |const| |
  49. +---------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  50. | void | :ref:`remove_item<class_MeshLibrary_method_remove_item>` **(** :ref:`int<class_int>` id **)** |
  51. +---------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  52. | void | :ref:`set_item_mesh<class_MeshLibrary_method_set_item_mesh>` **(** :ref:`int<class_int>` id, :ref:`Mesh<class_Mesh>` mesh **)** |
  53. +---------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  54. | void | :ref:`set_item_mesh_transform<class_MeshLibrary_method_set_item_mesh_transform>` **(** :ref:`int<class_int>` id, :ref:`Transform<class_Transform>` mesh_transform **)** |
  55. +---------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  56. | void | :ref:`set_item_name<class_MeshLibrary_method_set_item_name>` **(** :ref:`int<class_int>` id, :ref:`String<class_String>` name **)** |
  57. +---------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  58. | void | :ref:`set_item_navmesh<class_MeshLibrary_method_set_item_navmesh>` **(** :ref:`int<class_int>` id, :ref:`NavigationMesh<class_NavigationMesh>` navmesh **)** |
  59. +---------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  60. | void | :ref:`set_item_navmesh_transform<class_MeshLibrary_method_set_item_navmesh_transform>` **(** :ref:`int<class_int>` id, :ref:`Transform<class_Transform>` navmesh **)** |
  61. +---------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  62. | void | :ref:`set_item_preview<class_MeshLibrary_method_set_item_preview>` **(** :ref:`int<class_int>` id, :ref:`Texture<class_Texture>` texture **)** |
  63. +---------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  64. | void | :ref:`set_item_shapes<class_MeshLibrary_method_set_item_shapes>` **(** :ref:`int<class_int>` id, :ref:`Array<class_Array>` shapes **)** |
  65. +---------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  66. .. rst-class:: classref-section-separator
  67. ----
  68. .. rst-class:: classref-descriptions-group
  69. Method Descriptions
  70. -------------------
  71. .. _class_MeshLibrary_method_clear:
  72. .. rst-class:: classref-method
  73. void **clear** **(** **)**
  74. Clears the library.
  75. .. rst-class:: classref-item-separator
  76. ----
  77. .. _class_MeshLibrary_method_create_item:
  78. .. rst-class:: classref-method
  79. void **create_item** **(** :ref:`int<class_int>` id **)**
  80. Creates a new item in the library with the given ID.
  81. You can get an unused ID from :ref:`get_last_unused_item_id<class_MeshLibrary_method_get_last_unused_item_id>`.
  82. .. rst-class:: classref-item-separator
  83. ----
  84. .. _class_MeshLibrary_method_find_item_by_name:
  85. .. rst-class:: classref-method
  86. :ref:`int<class_int>` **find_item_by_name** **(** :ref:`String<class_String>` name **)** |const|
  87. Returns the first item with the given name.
  88. .. rst-class:: classref-item-separator
  89. ----
  90. .. _class_MeshLibrary_method_get_item_list:
  91. .. rst-class:: classref-method
  92. :ref:`PoolIntArray<class_PoolIntArray>` **get_item_list** **(** **)** |const|
  93. Returns the list of item IDs in use.
  94. .. rst-class:: classref-item-separator
  95. ----
  96. .. _class_MeshLibrary_method_get_item_mesh:
  97. .. rst-class:: classref-method
  98. :ref:`Mesh<class_Mesh>` **get_item_mesh** **(** :ref:`int<class_int>` id **)** |const|
  99. Returns the item's mesh.
  100. .. rst-class:: classref-item-separator
  101. ----
  102. .. _class_MeshLibrary_method_get_item_mesh_transform:
  103. .. rst-class:: classref-method
  104. :ref:`Transform<class_Transform>` **get_item_mesh_transform** **(** :ref:`int<class_int>` id **)** |const|
  105. Returns the transform applied to the item's mesh.
  106. .. rst-class:: classref-item-separator
  107. ----
  108. .. _class_MeshLibrary_method_get_item_name:
  109. .. rst-class:: classref-method
  110. :ref:`String<class_String>` **get_item_name** **(** :ref:`int<class_int>` id **)** |const|
  111. Returns the item's name.
  112. .. rst-class:: classref-item-separator
  113. ----
  114. .. _class_MeshLibrary_method_get_item_navmesh:
  115. .. rst-class:: classref-method
  116. :ref:`NavigationMesh<class_NavigationMesh>` **get_item_navmesh** **(** :ref:`int<class_int>` id **)** |const|
  117. Returns the item's navigation mesh.
  118. .. rst-class:: classref-item-separator
  119. ----
  120. .. _class_MeshLibrary_method_get_item_navmesh_transform:
  121. .. rst-class:: classref-method
  122. :ref:`Transform<class_Transform>` **get_item_navmesh_transform** **(** :ref:`int<class_int>` id **)** |const|
  123. Returns the transform applied to the item's navigation mesh.
  124. .. rst-class:: classref-item-separator
  125. ----
  126. .. _class_MeshLibrary_method_get_item_preview:
  127. .. rst-class:: classref-method
  128. :ref:`Texture<class_Texture>` **get_item_preview** **(** :ref:`int<class_int>` id **)** |const|
  129. 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.
  130. .. rst-class:: classref-item-separator
  131. ----
  132. .. _class_MeshLibrary_method_get_item_shapes:
  133. .. rst-class:: classref-method
  134. :ref:`Array<class_Array>` **get_item_shapes** **(** :ref:`int<class_int>` id **)** |const|
  135. Returns an item's collision shapes.
  136. The array consists of each :ref:`Shape<class_Shape>` followed by its :ref:`Transform<class_Transform>`.
  137. .. rst-class:: classref-item-separator
  138. ----
  139. .. _class_MeshLibrary_method_get_last_unused_item_id:
  140. .. rst-class:: classref-method
  141. :ref:`int<class_int>` **get_last_unused_item_id** **(** **)** |const|
  142. Gets an unused ID for a new item.
  143. .. rst-class:: classref-item-separator
  144. ----
  145. .. _class_MeshLibrary_method_remove_item:
  146. .. rst-class:: classref-method
  147. void **remove_item** **(** :ref:`int<class_int>` id **)**
  148. Removes the item.
  149. .. rst-class:: classref-item-separator
  150. ----
  151. .. _class_MeshLibrary_method_set_item_mesh:
  152. .. rst-class:: classref-method
  153. void **set_item_mesh** **(** :ref:`int<class_int>` id, :ref:`Mesh<class_Mesh>` mesh **)**
  154. Sets the item's mesh.
  155. .. rst-class:: classref-item-separator
  156. ----
  157. .. _class_MeshLibrary_method_set_item_mesh_transform:
  158. .. rst-class:: classref-method
  159. void **set_item_mesh_transform** **(** :ref:`int<class_int>` id, :ref:`Transform<class_Transform>` mesh_transform **)**
  160. Sets the transform to apply to the item's mesh.
  161. .. rst-class:: classref-item-separator
  162. ----
  163. .. _class_MeshLibrary_method_set_item_name:
  164. .. rst-class:: classref-method
  165. void **set_item_name** **(** :ref:`int<class_int>` id, :ref:`String<class_String>` name **)**
  166. Sets the item's name.
  167. 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>`.
  168. .. rst-class:: classref-item-separator
  169. ----
  170. .. _class_MeshLibrary_method_set_item_navmesh:
  171. .. rst-class:: classref-method
  172. void **set_item_navmesh** **(** :ref:`int<class_int>` id, :ref:`NavigationMesh<class_NavigationMesh>` navmesh **)**
  173. Sets the item's navigation mesh.
  174. .. rst-class:: classref-item-separator
  175. ----
  176. .. _class_MeshLibrary_method_set_item_navmesh_transform:
  177. .. rst-class:: classref-method
  178. void **set_item_navmesh_transform** **(** :ref:`int<class_int>` id, :ref:`Transform<class_Transform>` navmesh **)**
  179. Sets the transform to apply to the item's navigation mesh.
  180. .. rst-class:: classref-item-separator
  181. ----
  182. .. _class_MeshLibrary_method_set_item_preview:
  183. .. rst-class:: classref-method
  184. void **set_item_preview** **(** :ref:`int<class_int>` id, :ref:`Texture<class_Texture>` texture **)**
  185. Sets a texture to use as the item's preview icon in the editor.
  186. .. rst-class:: classref-item-separator
  187. ----
  188. .. _class_MeshLibrary_method_set_item_shapes:
  189. .. rst-class:: classref-method
  190. void **set_item_shapes** **(** :ref:`int<class_int>` id, :ref:`Array<class_Array>` shapes **)**
  191. Sets an item's collision shapes.
  192. 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>`.
  193. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  194. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  195. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  196. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`