class_meshdatatool.rst 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665
  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/4.2/doc/tools/make_rst.py.
  5. .. XML source: https://github.com/godotengine/godot/tree/4.2/doc/classes/MeshDataTool.xml.
  6. .. _class_MeshDataTool:
  7. MeshDataTool
  8. ============
  9. **Inherits:** :ref:`RefCounted<class_RefCounted>` **<** :ref:`Object<class_Object>`
  10. Helper tool to access and edit :ref:`Mesh<class_Mesh>` data.
  11. .. rst-class:: classref-introduction-group
  12. Description
  13. -----------
  14. MeshDataTool provides access to individual vertices in a :ref:`Mesh<class_Mesh>`. It allows users to read and edit vertex data of meshes. It also creates an array of faces and edges.
  15. To use MeshDataTool, load a mesh with :ref:`create_from_surface<class_MeshDataTool_method_create_from_surface>`. When you are finished editing the data commit the data to a mesh with :ref:`commit_to_surface<class_MeshDataTool_method_commit_to_surface>`.
  16. Below is an example of how MeshDataTool may be used.
  17. .. tabs::
  18. .. code-tab:: gdscript
  19. var mesh = ArrayMesh.new()
  20. mesh.add_surface_from_arrays(Mesh.PRIMITIVE_TRIANGLES, BoxMesh.new().get_mesh_arrays())
  21. var mdt = MeshDataTool.new()
  22. mdt.create_from_surface(mesh, 0)
  23. for i in range(mdt.get_vertex_count()):
  24. var vertex = mdt.get_vertex(i)
  25. # In this example we extend the mesh by one unit, which results in separated faces as it is flat shaded.
  26. vertex += mdt.get_vertex_normal(i)
  27. # Save your change.
  28. mdt.set_vertex(i, vertex)
  29. mesh.clear_surfaces()
  30. mdt.commit_to_surface(mesh)
  31. var mi = MeshInstance.new()
  32. mi.mesh = mesh
  33. add_child(mi)
  34. .. code-tab:: csharp
  35. var mesh = new ArrayMesh();
  36. mesh.AddSurfaceFromArrays(Mesh.PrimitiveType.Triangles, new BoxMesh().GetMeshArrays());
  37. var mdt = new MeshDataTool();
  38. mdt.CreateFromSurface(mesh, 0);
  39. for (var i = 0; i < mdt.GetVertexCount(); i++)
  40. {
  41. Vector3 vertex = mdt.GetVertex(i);
  42. // In this example we extend the mesh by one unit, which results in separated faces as it is flat shaded.
  43. vertex += mdt.GetVertexNormal(i);
  44. // Save your change.
  45. mdt.SetVertex(i, vertex);
  46. }
  47. mesh.ClearSurfaces();
  48. mdt.CommitToSurface(mesh);
  49. var mi = new MeshInstance();
  50. mi.Mesh = mesh;
  51. AddChild(mi);
  52. See also :ref:`ArrayMesh<class_ArrayMesh>`, :ref:`ImmediateMesh<class_ImmediateMesh>` and :ref:`SurfaceTool<class_SurfaceTool>` for procedural geometry generation.
  53. \ **Note:** Godot uses clockwise `winding order <https://learnopengl.com/Advanced-OpenGL/Face-culling>`__ for front faces of triangle primitive modes.
  54. .. rst-class:: classref-introduction-group
  55. Tutorials
  56. ---------
  57. - :doc:`Using the MeshDataTool <../tutorials/3d/procedural_geometry/meshdatatool>`
  58. .. rst-class:: classref-reftable-group
  59. Methods
  60. -------
  61. .. table::
  62. :widths: auto
  63. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  64. | void | :ref:`clear<class_MeshDataTool_method_clear>` **(** **)** |
  65. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  66. | :ref:`Error<enum_@GlobalScope_Error>` | :ref:`commit_to_surface<class_MeshDataTool_method_commit_to_surface>` **(** :ref:`ArrayMesh<class_ArrayMesh>` mesh, :ref:`int<class_int>` compression_flags=0 **)** |
  67. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  68. | :ref:`Error<enum_@GlobalScope_Error>` | :ref:`create_from_surface<class_MeshDataTool_method_create_from_surface>` **(** :ref:`ArrayMesh<class_ArrayMesh>` mesh, :ref:`int<class_int>` surface **)** |
  69. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  70. | :ref:`int<class_int>` | :ref:`get_edge_count<class_MeshDataTool_method_get_edge_count>` **(** **)** |const| |
  71. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  72. | :ref:`PackedInt32Array<class_PackedInt32Array>` | :ref:`get_edge_faces<class_MeshDataTool_method_get_edge_faces>` **(** :ref:`int<class_int>` idx **)** |const| |
  73. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  74. | :ref:`Variant<class_Variant>` | :ref:`get_edge_meta<class_MeshDataTool_method_get_edge_meta>` **(** :ref:`int<class_int>` idx **)** |const| |
  75. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  76. | :ref:`int<class_int>` | :ref:`get_edge_vertex<class_MeshDataTool_method_get_edge_vertex>` **(** :ref:`int<class_int>` idx, :ref:`int<class_int>` vertex **)** |const| |
  77. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  78. | :ref:`int<class_int>` | :ref:`get_face_count<class_MeshDataTool_method_get_face_count>` **(** **)** |const| |
  79. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  80. | :ref:`int<class_int>` | :ref:`get_face_edge<class_MeshDataTool_method_get_face_edge>` **(** :ref:`int<class_int>` idx, :ref:`int<class_int>` edge **)** |const| |
  81. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  82. | :ref:`Variant<class_Variant>` | :ref:`get_face_meta<class_MeshDataTool_method_get_face_meta>` **(** :ref:`int<class_int>` idx **)** |const| |
  83. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  84. | :ref:`Vector3<class_Vector3>` | :ref:`get_face_normal<class_MeshDataTool_method_get_face_normal>` **(** :ref:`int<class_int>` idx **)** |const| |
  85. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  86. | :ref:`int<class_int>` | :ref:`get_face_vertex<class_MeshDataTool_method_get_face_vertex>` **(** :ref:`int<class_int>` idx, :ref:`int<class_int>` vertex **)** |const| |
  87. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  88. | :ref:`int<class_int>` | :ref:`get_format<class_MeshDataTool_method_get_format>` **(** **)** |const| |
  89. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  90. | :ref:`Material<class_Material>` | :ref:`get_material<class_MeshDataTool_method_get_material>` **(** **)** |const| |
  91. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  92. | :ref:`Vector3<class_Vector3>` | :ref:`get_vertex<class_MeshDataTool_method_get_vertex>` **(** :ref:`int<class_int>` idx **)** |const| |
  93. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  94. | :ref:`PackedInt32Array<class_PackedInt32Array>` | :ref:`get_vertex_bones<class_MeshDataTool_method_get_vertex_bones>` **(** :ref:`int<class_int>` idx **)** |const| |
  95. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  96. | :ref:`Color<class_Color>` | :ref:`get_vertex_color<class_MeshDataTool_method_get_vertex_color>` **(** :ref:`int<class_int>` idx **)** |const| |
  97. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  98. | :ref:`int<class_int>` | :ref:`get_vertex_count<class_MeshDataTool_method_get_vertex_count>` **(** **)** |const| |
  99. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  100. | :ref:`PackedInt32Array<class_PackedInt32Array>` | :ref:`get_vertex_edges<class_MeshDataTool_method_get_vertex_edges>` **(** :ref:`int<class_int>` idx **)** |const| |
  101. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  102. | :ref:`PackedInt32Array<class_PackedInt32Array>` | :ref:`get_vertex_faces<class_MeshDataTool_method_get_vertex_faces>` **(** :ref:`int<class_int>` idx **)** |const| |
  103. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  104. | :ref:`Variant<class_Variant>` | :ref:`get_vertex_meta<class_MeshDataTool_method_get_vertex_meta>` **(** :ref:`int<class_int>` idx **)** |const| |
  105. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  106. | :ref:`Vector3<class_Vector3>` | :ref:`get_vertex_normal<class_MeshDataTool_method_get_vertex_normal>` **(** :ref:`int<class_int>` idx **)** |const| |
  107. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  108. | :ref:`Plane<class_Plane>` | :ref:`get_vertex_tangent<class_MeshDataTool_method_get_vertex_tangent>` **(** :ref:`int<class_int>` idx **)** |const| |
  109. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  110. | :ref:`Vector2<class_Vector2>` | :ref:`get_vertex_uv<class_MeshDataTool_method_get_vertex_uv>` **(** :ref:`int<class_int>` idx **)** |const| |
  111. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  112. | :ref:`Vector2<class_Vector2>` | :ref:`get_vertex_uv2<class_MeshDataTool_method_get_vertex_uv2>` **(** :ref:`int<class_int>` idx **)** |const| |
  113. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  114. | :ref:`PackedFloat32Array<class_PackedFloat32Array>` | :ref:`get_vertex_weights<class_MeshDataTool_method_get_vertex_weights>` **(** :ref:`int<class_int>` idx **)** |const| |
  115. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  116. | void | :ref:`set_edge_meta<class_MeshDataTool_method_set_edge_meta>` **(** :ref:`int<class_int>` idx, :ref:`Variant<class_Variant>` meta **)** |
  117. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  118. | void | :ref:`set_face_meta<class_MeshDataTool_method_set_face_meta>` **(** :ref:`int<class_int>` idx, :ref:`Variant<class_Variant>` meta **)** |
  119. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  120. | void | :ref:`set_material<class_MeshDataTool_method_set_material>` **(** :ref:`Material<class_Material>` material **)** |
  121. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  122. | void | :ref:`set_vertex<class_MeshDataTool_method_set_vertex>` **(** :ref:`int<class_int>` idx, :ref:`Vector3<class_Vector3>` vertex **)** |
  123. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  124. | void | :ref:`set_vertex_bones<class_MeshDataTool_method_set_vertex_bones>` **(** :ref:`int<class_int>` idx, :ref:`PackedInt32Array<class_PackedInt32Array>` bones **)** |
  125. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  126. | void | :ref:`set_vertex_color<class_MeshDataTool_method_set_vertex_color>` **(** :ref:`int<class_int>` idx, :ref:`Color<class_Color>` color **)** |
  127. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  128. | void | :ref:`set_vertex_meta<class_MeshDataTool_method_set_vertex_meta>` **(** :ref:`int<class_int>` idx, :ref:`Variant<class_Variant>` meta **)** |
  129. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  130. | void | :ref:`set_vertex_normal<class_MeshDataTool_method_set_vertex_normal>` **(** :ref:`int<class_int>` idx, :ref:`Vector3<class_Vector3>` normal **)** |
  131. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  132. | void | :ref:`set_vertex_tangent<class_MeshDataTool_method_set_vertex_tangent>` **(** :ref:`int<class_int>` idx, :ref:`Plane<class_Plane>` tangent **)** |
  133. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  134. | void | :ref:`set_vertex_uv<class_MeshDataTool_method_set_vertex_uv>` **(** :ref:`int<class_int>` idx, :ref:`Vector2<class_Vector2>` uv **)** |
  135. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  136. | void | :ref:`set_vertex_uv2<class_MeshDataTool_method_set_vertex_uv2>` **(** :ref:`int<class_int>` idx, :ref:`Vector2<class_Vector2>` uv2 **)** |
  137. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  138. | void | :ref:`set_vertex_weights<class_MeshDataTool_method_set_vertex_weights>` **(** :ref:`int<class_int>` idx, :ref:`PackedFloat32Array<class_PackedFloat32Array>` weights **)** |
  139. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  140. .. rst-class:: classref-section-separator
  141. ----
  142. .. rst-class:: classref-descriptions-group
  143. Method Descriptions
  144. -------------------
  145. .. _class_MeshDataTool_method_clear:
  146. .. rst-class:: classref-method
  147. void **clear** **(** **)**
  148. Clears all data currently in MeshDataTool.
  149. .. rst-class:: classref-item-separator
  150. ----
  151. .. _class_MeshDataTool_method_commit_to_surface:
  152. .. rst-class:: classref-method
  153. :ref:`Error<enum_@GlobalScope_Error>` **commit_to_surface** **(** :ref:`ArrayMesh<class_ArrayMesh>` mesh, :ref:`int<class_int>` compression_flags=0 **)**
  154. Adds a new surface to specified :ref:`Mesh<class_Mesh>` with edited data.
  155. .. rst-class:: classref-item-separator
  156. ----
  157. .. _class_MeshDataTool_method_create_from_surface:
  158. .. rst-class:: classref-method
  159. :ref:`Error<enum_@GlobalScope_Error>` **create_from_surface** **(** :ref:`ArrayMesh<class_ArrayMesh>` mesh, :ref:`int<class_int>` surface **)**
  160. Uses specified surface of given :ref:`Mesh<class_Mesh>` to populate data for MeshDataTool.
  161. Requires :ref:`Mesh<class_Mesh>` with primitive type :ref:`Mesh.PRIMITIVE_TRIANGLES<class_Mesh_constant_PRIMITIVE_TRIANGLES>`.
  162. .. rst-class:: classref-item-separator
  163. ----
  164. .. _class_MeshDataTool_method_get_edge_count:
  165. .. rst-class:: classref-method
  166. :ref:`int<class_int>` **get_edge_count** **(** **)** |const|
  167. Returns the number of edges in this :ref:`Mesh<class_Mesh>`.
  168. .. rst-class:: classref-item-separator
  169. ----
  170. .. _class_MeshDataTool_method_get_edge_faces:
  171. .. rst-class:: classref-method
  172. :ref:`PackedInt32Array<class_PackedInt32Array>` **get_edge_faces** **(** :ref:`int<class_int>` idx **)** |const|
  173. Returns array of faces that touch given edge.
  174. .. rst-class:: classref-item-separator
  175. ----
  176. .. _class_MeshDataTool_method_get_edge_meta:
  177. .. rst-class:: classref-method
  178. :ref:`Variant<class_Variant>` **get_edge_meta** **(** :ref:`int<class_int>` idx **)** |const|
  179. Returns meta information assigned to given edge.
  180. .. rst-class:: classref-item-separator
  181. ----
  182. .. _class_MeshDataTool_method_get_edge_vertex:
  183. .. rst-class:: classref-method
  184. :ref:`int<class_int>` **get_edge_vertex** **(** :ref:`int<class_int>` idx, :ref:`int<class_int>` vertex **)** |const|
  185. Returns index of specified vertex connected to given edge.
  186. Vertex argument can only be 0 or 1 because edges are comprised of two vertices.
  187. .. rst-class:: classref-item-separator
  188. ----
  189. .. _class_MeshDataTool_method_get_face_count:
  190. .. rst-class:: classref-method
  191. :ref:`int<class_int>` **get_face_count** **(** **)** |const|
  192. Returns the number of faces in this :ref:`Mesh<class_Mesh>`.
  193. .. rst-class:: classref-item-separator
  194. ----
  195. .. _class_MeshDataTool_method_get_face_edge:
  196. .. rst-class:: classref-method
  197. :ref:`int<class_int>` **get_face_edge** **(** :ref:`int<class_int>` idx, :ref:`int<class_int>` edge **)** |const|
  198. Returns specified edge associated with given face.
  199. Edge argument must be either 0, 1, or 2 because a face only has three edges.
  200. .. rst-class:: classref-item-separator
  201. ----
  202. .. _class_MeshDataTool_method_get_face_meta:
  203. .. rst-class:: classref-method
  204. :ref:`Variant<class_Variant>` **get_face_meta** **(** :ref:`int<class_int>` idx **)** |const|
  205. Returns the metadata associated with the given face.
  206. .. rst-class:: classref-item-separator
  207. ----
  208. .. _class_MeshDataTool_method_get_face_normal:
  209. .. rst-class:: classref-method
  210. :ref:`Vector3<class_Vector3>` **get_face_normal** **(** :ref:`int<class_int>` idx **)** |const|
  211. Calculates and returns the face normal of the given face.
  212. .. rst-class:: classref-item-separator
  213. ----
  214. .. _class_MeshDataTool_method_get_face_vertex:
  215. .. rst-class:: classref-method
  216. :ref:`int<class_int>` **get_face_vertex** **(** :ref:`int<class_int>` idx, :ref:`int<class_int>` vertex **)** |const|
  217. Returns the specified vertex index of the given face.
  218. Vertex argument must be either 0, 1, or 2 because faces contain three vertices.
  219. \ **Example:**\
  220. .. tabs::
  221. .. code-tab:: gdscript
  222. var index = mesh_data_tool.get_face_vertex(0, 1) # Gets the index of the second vertex of the first face.
  223. var position = mesh_data_tool.get_vertex(index)
  224. var normal = mesh_data_tool.get_vertex_normal(index)
  225. .. code-tab:: csharp
  226. int index = meshDataTool.GetFaceVertex(0, 1); // Gets the index of the second vertex of the first face.
  227. Vector3 position = meshDataTool.GetVertex(index);
  228. Vector3 normal = meshDataTool.GetVertexNormal(index);
  229. .. rst-class:: classref-item-separator
  230. ----
  231. .. _class_MeshDataTool_method_get_format:
  232. .. rst-class:: classref-method
  233. :ref:`int<class_int>` **get_format** **(** **)** |const|
  234. Returns the :ref:`Mesh<class_Mesh>`'s format. Format is an integer made up of :ref:`Mesh<class_Mesh>` format flags combined together. For example, a mesh containing both vertices and normals would return a format of ``3`` because :ref:`Mesh.ARRAY_FORMAT_VERTEX<class_Mesh_constant_ARRAY_FORMAT_VERTEX>` is ``1`` and :ref:`Mesh.ARRAY_FORMAT_NORMAL<class_Mesh_constant_ARRAY_FORMAT_NORMAL>` is ``2``.
  235. See :ref:`ArrayFormat<enum_Mesh_ArrayFormat>` for a list of format flags.
  236. .. rst-class:: classref-item-separator
  237. ----
  238. .. _class_MeshDataTool_method_get_material:
  239. .. rst-class:: classref-method
  240. :ref:`Material<class_Material>` **get_material** **(** **)** |const|
  241. Returns the material assigned to the :ref:`Mesh<class_Mesh>`.
  242. .. rst-class:: classref-item-separator
  243. ----
  244. .. _class_MeshDataTool_method_get_vertex:
  245. .. rst-class:: classref-method
  246. :ref:`Vector3<class_Vector3>` **get_vertex** **(** :ref:`int<class_int>` idx **)** |const|
  247. Returns the position of the given vertex.
  248. .. rst-class:: classref-item-separator
  249. ----
  250. .. _class_MeshDataTool_method_get_vertex_bones:
  251. .. rst-class:: classref-method
  252. :ref:`PackedInt32Array<class_PackedInt32Array>` **get_vertex_bones** **(** :ref:`int<class_int>` idx **)** |const|
  253. Returns the bones of the given vertex.
  254. .. rst-class:: classref-item-separator
  255. ----
  256. .. _class_MeshDataTool_method_get_vertex_color:
  257. .. rst-class:: classref-method
  258. :ref:`Color<class_Color>` **get_vertex_color** **(** :ref:`int<class_int>` idx **)** |const|
  259. Returns the color of the given vertex.
  260. .. rst-class:: classref-item-separator
  261. ----
  262. .. _class_MeshDataTool_method_get_vertex_count:
  263. .. rst-class:: classref-method
  264. :ref:`int<class_int>` **get_vertex_count** **(** **)** |const|
  265. Returns the total number of vertices in :ref:`Mesh<class_Mesh>`.
  266. .. rst-class:: classref-item-separator
  267. ----
  268. .. _class_MeshDataTool_method_get_vertex_edges:
  269. .. rst-class:: classref-method
  270. :ref:`PackedInt32Array<class_PackedInt32Array>` **get_vertex_edges** **(** :ref:`int<class_int>` idx **)** |const|
  271. Returns an array of edges that share the given vertex.
  272. .. rst-class:: classref-item-separator
  273. ----
  274. .. _class_MeshDataTool_method_get_vertex_faces:
  275. .. rst-class:: classref-method
  276. :ref:`PackedInt32Array<class_PackedInt32Array>` **get_vertex_faces** **(** :ref:`int<class_int>` idx **)** |const|
  277. Returns an array of faces that share the given vertex.
  278. .. rst-class:: classref-item-separator
  279. ----
  280. .. _class_MeshDataTool_method_get_vertex_meta:
  281. .. rst-class:: classref-method
  282. :ref:`Variant<class_Variant>` **get_vertex_meta** **(** :ref:`int<class_int>` idx **)** |const|
  283. Returns the metadata associated with the given vertex.
  284. .. rst-class:: classref-item-separator
  285. ----
  286. .. _class_MeshDataTool_method_get_vertex_normal:
  287. .. rst-class:: classref-method
  288. :ref:`Vector3<class_Vector3>` **get_vertex_normal** **(** :ref:`int<class_int>` idx **)** |const|
  289. Returns the normal of the given vertex.
  290. .. rst-class:: classref-item-separator
  291. ----
  292. .. _class_MeshDataTool_method_get_vertex_tangent:
  293. .. rst-class:: classref-method
  294. :ref:`Plane<class_Plane>` **get_vertex_tangent** **(** :ref:`int<class_int>` idx **)** |const|
  295. Returns the tangent of the given vertex.
  296. .. rst-class:: classref-item-separator
  297. ----
  298. .. _class_MeshDataTool_method_get_vertex_uv:
  299. .. rst-class:: classref-method
  300. :ref:`Vector2<class_Vector2>` **get_vertex_uv** **(** :ref:`int<class_int>` idx **)** |const|
  301. Returns the UV of the given vertex.
  302. .. rst-class:: classref-item-separator
  303. ----
  304. .. _class_MeshDataTool_method_get_vertex_uv2:
  305. .. rst-class:: classref-method
  306. :ref:`Vector2<class_Vector2>` **get_vertex_uv2** **(** :ref:`int<class_int>` idx **)** |const|
  307. Returns the UV2 of the given vertex.
  308. .. rst-class:: classref-item-separator
  309. ----
  310. .. _class_MeshDataTool_method_get_vertex_weights:
  311. .. rst-class:: classref-method
  312. :ref:`PackedFloat32Array<class_PackedFloat32Array>` **get_vertex_weights** **(** :ref:`int<class_int>` idx **)** |const|
  313. Returns bone weights of the given vertex.
  314. .. rst-class:: classref-item-separator
  315. ----
  316. .. _class_MeshDataTool_method_set_edge_meta:
  317. .. rst-class:: classref-method
  318. void **set_edge_meta** **(** :ref:`int<class_int>` idx, :ref:`Variant<class_Variant>` meta **)**
  319. Sets the metadata of the given edge.
  320. .. rst-class:: classref-item-separator
  321. ----
  322. .. _class_MeshDataTool_method_set_face_meta:
  323. .. rst-class:: classref-method
  324. void **set_face_meta** **(** :ref:`int<class_int>` idx, :ref:`Variant<class_Variant>` meta **)**
  325. Sets the metadata of the given face.
  326. .. rst-class:: classref-item-separator
  327. ----
  328. .. _class_MeshDataTool_method_set_material:
  329. .. rst-class:: classref-method
  330. void **set_material** **(** :ref:`Material<class_Material>` material **)**
  331. Sets the material to be used by newly-constructed :ref:`Mesh<class_Mesh>`.
  332. .. rst-class:: classref-item-separator
  333. ----
  334. .. _class_MeshDataTool_method_set_vertex:
  335. .. rst-class:: classref-method
  336. void **set_vertex** **(** :ref:`int<class_int>` idx, :ref:`Vector3<class_Vector3>` vertex **)**
  337. Sets the position of the given vertex.
  338. .. rst-class:: classref-item-separator
  339. ----
  340. .. _class_MeshDataTool_method_set_vertex_bones:
  341. .. rst-class:: classref-method
  342. void **set_vertex_bones** **(** :ref:`int<class_int>` idx, :ref:`PackedInt32Array<class_PackedInt32Array>` bones **)**
  343. Sets the bones of the given vertex.
  344. .. rst-class:: classref-item-separator
  345. ----
  346. .. _class_MeshDataTool_method_set_vertex_color:
  347. .. rst-class:: classref-method
  348. void **set_vertex_color** **(** :ref:`int<class_int>` idx, :ref:`Color<class_Color>` color **)**
  349. Sets the color of the given vertex.
  350. .. rst-class:: classref-item-separator
  351. ----
  352. .. _class_MeshDataTool_method_set_vertex_meta:
  353. .. rst-class:: classref-method
  354. void **set_vertex_meta** **(** :ref:`int<class_int>` idx, :ref:`Variant<class_Variant>` meta **)**
  355. Sets the metadata associated with the given vertex.
  356. .. rst-class:: classref-item-separator
  357. ----
  358. .. _class_MeshDataTool_method_set_vertex_normal:
  359. .. rst-class:: classref-method
  360. void **set_vertex_normal** **(** :ref:`int<class_int>` idx, :ref:`Vector3<class_Vector3>` normal **)**
  361. Sets the normal of the given vertex.
  362. .. rst-class:: classref-item-separator
  363. ----
  364. .. _class_MeshDataTool_method_set_vertex_tangent:
  365. .. rst-class:: classref-method
  366. void **set_vertex_tangent** **(** :ref:`int<class_int>` idx, :ref:`Plane<class_Plane>` tangent **)**
  367. Sets the tangent of the given vertex.
  368. .. rst-class:: classref-item-separator
  369. ----
  370. .. _class_MeshDataTool_method_set_vertex_uv:
  371. .. rst-class:: classref-method
  372. void **set_vertex_uv** **(** :ref:`int<class_int>` idx, :ref:`Vector2<class_Vector2>` uv **)**
  373. Sets the UV of the given vertex.
  374. .. rst-class:: classref-item-separator
  375. ----
  376. .. _class_MeshDataTool_method_set_vertex_uv2:
  377. .. rst-class:: classref-method
  378. void **set_vertex_uv2** **(** :ref:`int<class_int>` idx, :ref:`Vector2<class_Vector2>` uv2 **)**
  379. Sets the UV2 of the given vertex.
  380. .. rst-class:: classref-item-separator
  381. ----
  382. .. _class_MeshDataTool_method_set_vertex_weights:
  383. .. rst-class:: classref-method
  384. void **set_vertex_weights** **(** :ref:`int<class_int>` idx, :ref:`PackedFloat32Array<class_PackedFloat32Array>` weights **)**
  385. Sets the bone weights of the given vertex.
  386. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  387. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  388. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  389. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  390. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  391. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
  392. .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)`