class_meshlibrary.rst 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371
  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/MeshLibrary.xml.
  6. .. _class_MeshLibrary:
  7. MeshLibrary
  8. ===========
  9. **Inherits:** :ref:`Resource<class_Resource>` **<** :ref:`RefCounted<class_RefCounted>` **<** :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:`PackedInt32Array<class_PackedInt32Array>` | :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:`Transform3D<class_Transform3D>` | :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:`int<class_int>` | :ref:`get_item_navigation_layers<class_MeshLibrary_method_get_item_navigation_layers>` **(** :ref:`int<class_int>` id **)** |const| |
  41. +-------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  42. | :ref:`NavigationMesh<class_NavigationMesh>` | :ref:`get_item_navigation_mesh<class_MeshLibrary_method_get_item_navigation_mesh>` **(** :ref:`int<class_int>` id **)** |const| |
  43. +-------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  44. | :ref:`Transform3D<class_Transform3D>` | :ref:`get_item_navigation_mesh_transform<class_MeshLibrary_method_get_item_navigation_mesh_transform>` **(** :ref:`int<class_int>` id **)** |const| |
  45. +-------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  46. | :ref:`Texture2D<class_Texture2D>` | :ref:`get_item_preview<class_MeshLibrary_method_get_item_preview>` **(** :ref:`int<class_int>` id **)** |const| |
  47. +-------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  48. | :ref:`Array<class_Array>` | :ref:`get_item_shapes<class_MeshLibrary_method_get_item_shapes>` **(** :ref:`int<class_int>` id **)** |const| |
  49. +-------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  50. | :ref:`int<class_int>` | :ref:`get_last_unused_item_id<class_MeshLibrary_method_get_last_unused_item_id>` **(** **)** |const| |
  51. +-------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  52. | void | :ref:`remove_item<class_MeshLibrary_method_remove_item>` **(** :ref:`int<class_int>` id **)** |
  53. +-------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  54. | void | :ref:`set_item_mesh<class_MeshLibrary_method_set_item_mesh>` **(** :ref:`int<class_int>` id, :ref:`Mesh<class_Mesh>` mesh **)** |
  55. +-------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  56. | void | :ref:`set_item_mesh_transform<class_MeshLibrary_method_set_item_mesh_transform>` **(** :ref:`int<class_int>` id, :ref:`Transform3D<class_Transform3D>` mesh_transform **)** |
  57. +-------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  58. | void | :ref:`set_item_name<class_MeshLibrary_method_set_item_name>` **(** :ref:`int<class_int>` id, :ref:`String<class_String>` name **)** |
  59. +-------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  60. | void | :ref:`set_item_navigation_layers<class_MeshLibrary_method_set_item_navigation_layers>` **(** :ref:`int<class_int>` id, :ref:`int<class_int>` navigation_layers **)** |
  61. +-------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  62. | void | :ref:`set_item_navigation_mesh<class_MeshLibrary_method_set_item_navigation_mesh>` **(** :ref:`int<class_int>` id, :ref:`NavigationMesh<class_NavigationMesh>` navigation_mesh **)** |
  63. +-------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  64. | void | :ref:`set_item_navigation_mesh_transform<class_MeshLibrary_method_set_item_navigation_mesh_transform>` **(** :ref:`int<class_int>` id, :ref:`Transform3D<class_Transform3D>` navigation_mesh **)** |
  65. +-------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  66. | void | :ref:`set_item_preview<class_MeshLibrary_method_set_item_preview>` **(** :ref:`int<class_int>` id, :ref:`Texture2D<class_Texture2D>` texture **)** |
  67. +-------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  68. | void | :ref:`set_item_shapes<class_MeshLibrary_method_set_item_shapes>` **(** :ref:`int<class_int>` id, :ref:`Array<class_Array>` shapes **)** |
  69. +-------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  70. .. rst-class:: classref-section-separator
  71. ----
  72. .. rst-class:: classref-descriptions-group
  73. Method Descriptions
  74. -------------------
  75. .. _class_MeshLibrary_method_clear:
  76. .. rst-class:: classref-method
  77. void **clear** **(** **)**
  78. Clears the library.
  79. .. rst-class:: classref-item-separator
  80. ----
  81. .. _class_MeshLibrary_method_create_item:
  82. .. rst-class:: classref-method
  83. void **create_item** **(** :ref:`int<class_int>` id **)**
  84. Creates a new item in the library with the given ID.
  85. You can get an unused ID from :ref:`get_last_unused_item_id<class_MeshLibrary_method_get_last_unused_item_id>`.
  86. .. rst-class:: classref-item-separator
  87. ----
  88. .. _class_MeshLibrary_method_find_item_by_name:
  89. .. rst-class:: classref-method
  90. :ref:`int<class_int>` **find_item_by_name** **(** :ref:`String<class_String>` name **)** |const|
  91. Returns the first item with the given name.
  92. .. rst-class:: classref-item-separator
  93. ----
  94. .. _class_MeshLibrary_method_get_item_list:
  95. .. rst-class:: classref-method
  96. :ref:`PackedInt32Array<class_PackedInt32Array>` **get_item_list** **(** **)** |const|
  97. Returns the list of item IDs in use.
  98. .. rst-class:: classref-item-separator
  99. ----
  100. .. _class_MeshLibrary_method_get_item_mesh:
  101. .. rst-class:: classref-method
  102. :ref:`Mesh<class_Mesh>` **get_item_mesh** **(** :ref:`int<class_int>` id **)** |const|
  103. Returns the item's mesh.
  104. .. rst-class:: classref-item-separator
  105. ----
  106. .. _class_MeshLibrary_method_get_item_mesh_transform:
  107. .. rst-class:: classref-method
  108. :ref:`Transform3D<class_Transform3D>` **get_item_mesh_transform** **(** :ref:`int<class_int>` id **)** |const|
  109. Returns the transform applied to the item's mesh.
  110. .. rst-class:: classref-item-separator
  111. ----
  112. .. _class_MeshLibrary_method_get_item_name:
  113. .. rst-class:: classref-method
  114. :ref:`String<class_String>` **get_item_name** **(** :ref:`int<class_int>` id **)** |const|
  115. Returns the item's name.
  116. .. rst-class:: classref-item-separator
  117. ----
  118. .. _class_MeshLibrary_method_get_item_navigation_layers:
  119. .. rst-class:: classref-method
  120. :ref:`int<class_int>` **get_item_navigation_layers** **(** :ref:`int<class_int>` id **)** |const|
  121. Returns the item's navigation layers bitmask.
  122. .. rst-class:: classref-item-separator
  123. ----
  124. .. _class_MeshLibrary_method_get_item_navigation_mesh:
  125. .. rst-class:: classref-method
  126. :ref:`NavigationMesh<class_NavigationMesh>` **get_item_navigation_mesh** **(** :ref:`int<class_int>` id **)** |const|
  127. Returns the item's navigation mesh.
  128. .. rst-class:: classref-item-separator
  129. ----
  130. .. _class_MeshLibrary_method_get_item_navigation_mesh_transform:
  131. .. rst-class:: classref-method
  132. :ref:`Transform3D<class_Transform3D>` **get_item_navigation_mesh_transform** **(** :ref:`int<class_int>` id **)** |const|
  133. Returns the transform applied to the item's navigation mesh.
  134. .. rst-class:: classref-item-separator
  135. ----
  136. .. _class_MeshLibrary_method_get_item_preview:
  137. .. rst-class:: classref-method
  138. :ref:`Texture2D<class_Texture2D>` **get_item_preview** **(** :ref:`int<class_int>` id **)** |const|
  139. 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:`Texture2D<class_Texture2D>` if no preview was manually set in a running project.
  140. .. rst-class:: classref-item-separator
  141. ----
  142. .. _class_MeshLibrary_method_get_item_shapes:
  143. .. rst-class:: classref-method
  144. :ref:`Array<class_Array>` **get_item_shapes** **(** :ref:`int<class_int>` id **)** |const|
  145. Returns an item's collision shapes.
  146. The array consists of each :ref:`Shape3D<class_Shape3D>` followed by its :ref:`Transform3D<class_Transform3D>`.
  147. .. rst-class:: classref-item-separator
  148. ----
  149. .. _class_MeshLibrary_method_get_last_unused_item_id:
  150. .. rst-class:: classref-method
  151. :ref:`int<class_int>` **get_last_unused_item_id** **(** **)** |const|
  152. Gets an unused ID for a new item.
  153. .. rst-class:: classref-item-separator
  154. ----
  155. .. _class_MeshLibrary_method_remove_item:
  156. .. rst-class:: classref-method
  157. void **remove_item** **(** :ref:`int<class_int>` id **)**
  158. Removes the item.
  159. .. rst-class:: classref-item-separator
  160. ----
  161. .. _class_MeshLibrary_method_set_item_mesh:
  162. .. rst-class:: classref-method
  163. void **set_item_mesh** **(** :ref:`int<class_int>` id, :ref:`Mesh<class_Mesh>` mesh **)**
  164. Sets the item's mesh.
  165. .. rst-class:: classref-item-separator
  166. ----
  167. .. _class_MeshLibrary_method_set_item_mesh_transform:
  168. .. rst-class:: classref-method
  169. void **set_item_mesh_transform** **(** :ref:`int<class_int>` id, :ref:`Transform3D<class_Transform3D>` mesh_transform **)**
  170. Sets the transform to apply to the item's mesh.
  171. .. rst-class:: classref-item-separator
  172. ----
  173. .. _class_MeshLibrary_method_set_item_name:
  174. .. rst-class:: classref-method
  175. void **set_item_name** **(** :ref:`int<class_int>` id, :ref:`String<class_String>` name **)**
  176. Sets the item's name.
  177. 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>`.
  178. .. rst-class:: classref-item-separator
  179. ----
  180. .. _class_MeshLibrary_method_set_item_navigation_layers:
  181. .. rst-class:: classref-method
  182. void **set_item_navigation_layers** **(** :ref:`int<class_int>` id, :ref:`int<class_int>` navigation_layers **)**
  183. Sets the item's navigation layers bitmask.
  184. .. rst-class:: classref-item-separator
  185. ----
  186. .. _class_MeshLibrary_method_set_item_navigation_mesh:
  187. .. rst-class:: classref-method
  188. void **set_item_navigation_mesh** **(** :ref:`int<class_int>` id, :ref:`NavigationMesh<class_NavigationMesh>` navigation_mesh **)**
  189. Sets the item's navigation mesh.
  190. .. rst-class:: classref-item-separator
  191. ----
  192. .. _class_MeshLibrary_method_set_item_navigation_mesh_transform:
  193. .. rst-class:: classref-method
  194. void **set_item_navigation_mesh_transform** **(** :ref:`int<class_int>` id, :ref:`Transform3D<class_Transform3D>` navigation_mesh **)**
  195. Sets the transform to apply to the item's navigation mesh.
  196. .. rst-class:: classref-item-separator
  197. ----
  198. .. _class_MeshLibrary_method_set_item_preview:
  199. .. rst-class:: classref-method
  200. void **set_item_preview** **(** :ref:`int<class_int>` id, :ref:`Texture2D<class_Texture2D>` texture **)**
  201. Sets a texture to use as the item's preview icon in the editor.
  202. .. rst-class:: classref-item-separator
  203. ----
  204. .. _class_MeshLibrary_method_set_item_shapes:
  205. .. rst-class:: classref-method
  206. void **set_item_shapes** **(** :ref:`int<class_int>` id, :ref:`Array<class_Array>` shapes **)**
  207. Sets an item's collision shapes.
  208. The array should consist of :ref:`Shape3D<class_Shape3D>` objects, each followed by a :ref:`Transform3D<class_Transform3D>` that will be applied to it. For shapes that should not have a transform, use :ref:`Transform3D.IDENTITY<class_Transform3D_constant_IDENTITY>`.
  209. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  210. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  211. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  212. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  213. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  214. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
  215. .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)`