class_meshlibrary.rst 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  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. Tutorials
  14. ---------
  15. - `3D Kinematic Character Demo <https://godotengine.org/asset-library/asset/126>`_
  16. - `3D Platformer Demo <https://godotengine.org/asset-library/asset/125>`_
  17. Methods
  18. -------
  19. +---------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  20. | void | :ref:`clear<class_MeshLibrary_method_clear>` **(** **)** |
  21. +---------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  22. | void | :ref:`create_item<class_MeshLibrary_method_create_item>` **(** :ref:`int<class_int>` id **)** |
  23. +---------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  24. | :ref:`int<class_int>` | :ref:`find_item_by_name<class_MeshLibrary_method_find_item_by_name>` **(** :ref:`String<class_String>` name **)** |const| |
  25. +---------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  26. | :ref:`PoolIntArray<class_PoolIntArray>` | :ref:`get_item_list<class_MeshLibrary_method_get_item_list>` **(** **)** |const| |
  27. +---------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  28. | :ref:`Mesh<class_Mesh>` | :ref:`get_item_mesh<class_MeshLibrary_method_get_item_mesh>` **(** :ref:`int<class_int>` id **)** |const| |
  29. +---------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  30. | :ref:`String<class_String>` | :ref:`get_item_name<class_MeshLibrary_method_get_item_name>` **(** :ref:`int<class_int>` id **)** |const| |
  31. +---------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  32. | :ref:`NavigationMesh<class_NavigationMesh>` | :ref:`get_item_navmesh<class_MeshLibrary_method_get_item_navmesh>` **(** :ref:`int<class_int>` id **)** |const| |
  33. +---------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  34. | :ref:`Transform<class_Transform>` | :ref:`get_item_navmesh_transform<class_MeshLibrary_method_get_item_navmesh_transform>` **(** :ref:`int<class_int>` id **)** |const| |
  35. +---------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  36. | :ref:`Texture<class_Texture>` | :ref:`get_item_preview<class_MeshLibrary_method_get_item_preview>` **(** :ref:`int<class_int>` id **)** |const| |
  37. +---------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  38. | :ref:`Array<class_Array>` | :ref:`get_item_shapes<class_MeshLibrary_method_get_item_shapes>` **(** :ref:`int<class_int>` id **)** |const| |
  39. +---------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  40. | :ref:`int<class_int>` | :ref:`get_last_unused_item_id<class_MeshLibrary_method_get_last_unused_item_id>` **(** **)** |const| |
  41. +---------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  42. | void | :ref:`remove_item<class_MeshLibrary_method_remove_item>` **(** :ref:`int<class_int>` id **)** |
  43. +---------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  44. | void | :ref:`set_item_mesh<class_MeshLibrary_method_set_item_mesh>` **(** :ref:`int<class_int>` id, :ref:`Mesh<class_Mesh>` mesh **)** |
  45. +---------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  46. | void | :ref:`set_item_name<class_MeshLibrary_method_set_item_name>` **(** :ref:`int<class_int>` id, :ref:`String<class_String>` name **)** |
  47. +---------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  48. | void | :ref:`set_item_navmesh<class_MeshLibrary_method_set_item_navmesh>` **(** :ref:`int<class_int>` id, :ref:`NavigationMesh<class_NavigationMesh>` navmesh **)** |
  49. +---------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  50. | void | :ref:`set_item_navmesh_transform<class_MeshLibrary_method_set_item_navmesh_transform>` **(** :ref:`int<class_int>` id, :ref:`Transform<class_Transform>` navmesh **)** |
  51. +---------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  52. | void | :ref:`set_item_preview<class_MeshLibrary_method_set_item_preview>` **(** :ref:`int<class_int>` id, :ref:`Texture<class_Texture>` texture **)** |
  53. +---------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  54. | void | :ref:`set_item_shapes<class_MeshLibrary_method_set_item_shapes>` **(** :ref:`int<class_int>` id, :ref:`Array<class_Array>` shapes **)** |
  55. +---------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  56. Method Descriptions
  57. -------------------
  58. .. _class_MeshLibrary_method_clear:
  59. - void **clear** **(** **)**
  60. Clears the library.
  61. ----
  62. .. _class_MeshLibrary_method_create_item:
  63. - void **create_item** **(** :ref:`int<class_int>` id **)**
  64. Creates a new item in the library with the given ID.
  65. You can get an unused ID from :ref:`get_last_unused_item_id<class_MeshLibrary_method_get_last_unused_item_id>`.
  66. ----
  67. .. _class_MeshLibrary_method_find_item_by_name:
  68. - :ref:`int<class_int>` **find_item_by_name** **(** :ref:`String<class_String>` name **)** |const|
  69. Returns the first item with the given name.
  70. ----
  71. .. _class_MeshLibrary_method_get_item_list:
  72. - :ref:`PoolIntArray<class_PoolIntArray>` **get_item_list** **(** **)** |const|
  73. Returns the list of item IDs in use.
  74. ----
  75. .. _class_MeshLibrary_method_get_item_mesh:
  76. - :ref:`Mesh<class_Mesh>` **get_item_mesh** **(** :ref:`int<class_int>` id **)** |const|
  77. Returns the item's mesh.
  78. ----
  79. .. _class_MeshLibrary_method_get_item_name:
  80. - :ref:`String<class_String>` **get_item_name** **(** :ref:`int<class_int>` id **)** |const|
  81. Returns the item's name.
  82. ----
  83. .. _class_MeshLibrary_method_get_item_navmesh:
  84. - :ref:`NavigationMesh<class_NavigationMesh>` **get_item_navmesh** **(** :ref:`int<class_int>` id **)** |const|
  85. Returns the item's navigation mesh.
  86. ----
  87. .. _class_MeshLibrary_method_get_item_navmesh_transform:
  88. - :ref:`Transform<class_Transform>` **get_item_navmesh_transform** **(** :ref:`int<class_int>` id **)** |const|
  89. Returns the transform applied to the item's navigation mesh.
  90. ----
  91. .. _class_MeshLibrary_method_get_item_preview:
  92. - :ref:`Texture<class_Texture>` **get_item_preview** **(** :ref:`int<class_int>` id **)** |const|
  93. 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.
  94. ----
  95. .. _class_MeshLibrary_method_get_item_shapes:
  96. - :ref:`Array<class_Array>` **get_item_shapes** **(** :ref:`int<class_int>` id **)** |const|
  97. Returns an item's collision shapes.
  98. The array consists of each :ref:`Shape<class_Shape>` followed by its :ref:`Transform<class_Transform>`.
  99. ----
  100. .. _class_MeshLibrary_method_get_last_unused_item_id:
  101. - :ref:`int<class_int>` **get_last_unused_item_id** **(** **)** |const|
  102. Gets an unused ID for a new item.
  103. ----
  104. .. _class_MeshLibrary_method_remove_item:
  105. - void **remove_item** **(** :ref:`int<class_int>` id **)**
  106. Removes the item.
  107. ----
  108. .. _class_MeshLibrary_method_set_item_mesh:
  109. - void **set_item_mesh** **(** :ref:`int<class_int>` id, :ref:`Mesh<class_Mesh>` mesh **)**
  110. Sets the item's mesh.
  111. ----
  112. .. _class_MeshLibrary_method_set_item_name:
  113. - void **set_item_name** **(** :ref:`int<class_int>` id, :ref:`String<class_String>` name **)**
  114. Sets the item's name.
  115. 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>`.
  116. ----
  117. .. _class_MeshLibrary_method_set_item_navmesh:
  118. - void **set_item_navmesh** **(** :ref:`int<class_int>` id, :ref:`NavigationMesh<class_NavigationMesh>` navmesh **)**
  119. Sets the item's navigation mesh.
  120. ----
  121. .. _class_MeshLibrary_method_set_item_navmesh_transform:
  122. - void **set_item_navmesh_transform** **(** :ref:`int<class_int>` id, :ref:`Transform<class_Transform>` navmesh **)**
  123. Sets the transform to apply to the item's navigation mesh.
  124. ----
  125. .. _class_MeshLibrary_method_set_item_preview:
  126. - void **set_item_preview** **(** :ref:`int<class_int>` id, :ref:`Texture<class_Texture>` texture **)**
  127. Sets a texture to use as the item's preview icon in the editor.
  128. ----
  129. .. _class_MeshLibrary_method_set_item_shapes:
  130. - void **set_item_shapes** **(** :ref:`int<class_int>` id, :ref:`Array<class_Array>` shapes **)**
  131. Sets an item's collision shapes.
  132. 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>`.
  133. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  134. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  135. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`