Debian Codegraph @

scene/resources/mesh_data_tool.cpp

raw symbols SCIP
1 /**************************************************************************/
2 /* mesh_data_tool.cpp */
3 /**************************************************************************/
4 /* This file is part of: */
5 /* GODOT ENGINE */
6 /* https://godotengine.org */
7 /**************************************************************************/
8 /* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
9 /* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
10 /* */
11 /* Permission is hereby granted, free of charge, to any person obtaining */
12 /* a copy of this software and associated documentation files (the */
13 /* "Software"), to deal in the Software without restriction, including */
14 /* without limitation the rights to use, copy, modify, merge, publish, */
15 /* distribute, sublicense, and/or sell copies of the Software, and to */
16 /* permit persons to whom the Software is furnished to do so, subject to */
17 /* the following conditions: */
18 /* */
19 /* The above copyright notice and this permission notice shall be */
20 /* included in all copies or substantial portions of the Software. */
21 /* */
22 /* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
23 /* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
24 /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
25 /* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
26 /* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
27 /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
28 /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
29 /**************************************************************************/
30
31 #include "mesh_data_tool.h"
32 #include "mesh_data_tool.compat.inc"
33
34 void MeshDataTool::clear() {
35 vertices.clear();
36 edges.clear();
37 faces.clear();
38 material = Ref<Material>();
39 format = 0;
40 }
41
42 Error MeshDataTool::create_from_surface(const Ref<ArrayMesh> &p_mesh, int p_surface) {
43 ERR_FAIL_COND_V(p_mesh.is_null(), ERR_INVALID_PARAMETER);
44 ERR_FAIL_COND_V(p_mesh->surface_get_primitive_type(p_surface) != Mesh::PRIMITIVE_TRIANGLES, ERR_INVALID_PARAMETER);
45
46 Array arrays = p_mesh->surface_get_arrays(p_surface);
47 ERR_FAIL_COND_V(arrays.is_empty(), ERR_INVALID_PARAMETER);
48
49 Vector<Vector3> varray = arrays[Mesh::ARRAY_VERTEX];
50
51 int vcount = varray.size();
52 ERR_FAIL_COND_V(vcount == 0, ERR_INVALID_PARAMETER);
53
54 Vector<int> indices;
55
56 if (arrays[Mesh::ARRAY_INDEX].get_type() != Variant::NIL) {
57 indices = arrays[Mesh::ARRAY_INDEX];
58 } else {
59 //make code simpler
60 indices.resize(vcount);
61 int *iw = indices.ptrw();
62 for (int i = 0; i < vcount; i++) {
63 iw[i] = i;
64 }
65 }
66
67 int icount = indices.size();
68 const int *r = indices.ptr();
69
70 ERR_FAIL_COND_V(icount == 0, ERR_INVALID_PARAMETER);
71 ERR_FAIL_COND_V(icount % 3, ERR_INVALID_PARAMETER);
72 for (int i = 0; i < icount; i++) {
73 ERR_FAIL_INDEX_V(r[i], vcount, ERR_INVALID_PARAMETER);
74 }
75
76 clear();
77 format = p_mesh->surface_get_format(p_surface);
78 material = p_mesh->surface_get_material(p_surface);
79
80 const Vector3 *vr = varray.ptr();
81
82 const Vector3 *nr = nullptr;
83 if (arrays[Mesh::ARRAY_NORMAL].get_type() != Variant::NIL) {
84 nr = arrays[Mesh::ARRAY_NORMAL].operator Vector<Vector3>().ptr();
85 }
86
87 const real_t *ta = nullptr;
88 if (arrays[Mesh::ARRAY_TANGENT].get_type() != Variant::NIL) {
89 ta = arrays[Mesh::ARRAY_TANGENT].operator Vector<real_t>().ptr();
90 }
91
92 const Vector2 *uv = nullptr;
93 if (arrays[Mesh::ARRAY_TEX_UV].get_type() != Variant::NIL) {
94 uv = arrays[Mesh::ARRAY_TEX_UV].operator Vector<Vector2>().ptr();
95 }
96 const Vector2 *uv2 = nullptr;
97 if (arrays[Mesh::ARRAY_TEX_UV2].get_type() != Variant::NIL) {
98 uv2 = arrays[Mesh::ARRAY_TEX_UV2].operator Vector<Vector2>().ptr();
99 }
100
101 const Color *col = nullptr;
102 if (arrays[Mesh::ARRAY_COLOR].get_type() != Variant::NIL) {
103 col = arrays[Mesh::ARRAY_COLOR].operator Vector<Color>().ptr();
104 }
105
106 const int *bo = nullptr;
107 if (arrays[Mesh::ARRAY_BONES].get_type() != Variant::NIL) {
108 bo = arrays[Mesh::ARRAY_BONES].operator Vector<int>().ptr();
109 }
110
111 const float *we = nullptr;
112 if (arrays[Mesh::ARRAY_WEIGHTS].get_type() != Variant::NIL) {
113 we = arrays[Mesh::ARRAY_WEIGHTS].operator Vector<float>().ptr();
114 }
115
116 vertices.resize(vcount);
117
118 for (int i = 0; i < vcount; i++) {
119 Vertex v;
120 v.vertex = vr[i];
121 if (nr) {
122 v.normal = nr[i];
123 }
124 if (ta) {
125 v.tangent = Plane(ta[i * 4 + 0], ta[i * 4 + 1], ta[i * 4 + 2], ta[i * 4 + 3]);
126 }
127 if (uv) {
128 v.uv = uv[i];
129 }
130 if (uv2) {
131 v.uv2 = uv2[i];
132 }
133 if (col) {
134 v.color = col[i];
135 }
136
137 if (we) {
138 v.weights.push_back(we[i * 4 + 0]);
139 v.weights.push_back(we[i * 4 + 1]);
140 v.weights.push_back(we[i * 4 + 2]);
141 v.weights.push_back(we[i * 4 + 3]);
142 }
143
144 if (bo) {
145 v.bones.push_back(bo[i * 4 + 0]);
146 v.bones.push_back(bo[i * 4 + 1]);
147 v.bones.push_back(bo[i * 4 + 2]);
148 v.bones.push_back(bo[i * 4 + 3]);
149 }
150
151 vertices.write[i] = v;
152 }
153
154 HashMap<Point2i, int> edge_indices;
155
156 for (int i = 0; i < icount; i += 3) {
157 Vertex *v[3] = { &vertices.write[r[i + 0]], &vertices.write[r[i + 1]], &vertices.write[r[i + 2]] };
158
159 int fidx = faces.size();
160 Face face;
161
162 for (int j = 0; j < 3; j++) {
163 face.v[j] = r[i + j];
164
165 Point2i edge(r[i + j], r[i + (j + 1) % 3]);
166 if (edge.x > edge.y) {
167 SWAP(edge.x, edge.y);
168 }
169
170 if (edge_indices.has(edge)) {
171 face.edges[j] = edge_indices[edge];
172
173 } else {
174 face.edges[j] = edge_indices.size();
175 edge_indices[edge] = face.edges[j];
176 Edge e;
177 e.vertex[0] = edge.x;
178 e.vertex[1] = edge.y;
179 edges.push_back(e);
180 v[j]->edges.push_back(face.edges[j]);
181 v[(j + 1) % 3]->edges.push_back(face.edges[j]);
182 }
183
184 edges.write[face.edges[j]].faces.push_back(fidx);
185 v[j]->faces.push_back(fidx);
186 }
187
188 faces.push_back(face);
189 }
190
191 return OK;
192 }
193
194 Error MeshDataTool::commit_to_surface(const Ref<ArrayMesh> &p_mesh, uint64_t p_compression_flags) {
195 ERR_FAIL_COND_V(p_mesh.is_null(), ERR_INVALID_PARAMETER);
196 Array arr;
197 arr.resize(Mesh::ARRAY_MAX);
198
199 int vcount = vertices.size();
200
201 Vector<Vector3> v;
202 Vector<Vector3> n;
203 Vector<real_t> t;
204 Vector<Vector2> u;
205 Vector<Vector2> u2;
206 Vector<Color> c;
207 Vector<int> b;
208 Vector<real_t> w;
209 Vector<int> in;
210
211 {
212 v.resize(vcount);
213 Vector3 *vr = v.ptrw();
214
215 Vector3 *nr = nullptr;
216 if (format & Mesh::ARRAY_FORMAT_NORMAL) {
217 n.resize(vcount);
218 nr = n.ptrw();
219 }
220
221 real_t *ta = nullptr;
222 if (format & Mesh::ARRAY_FORMAT_TANGENT) {
223 t.resize(vcount * 4);
224 ta = t.ptrw();
225 }
226
227 Vector2 *uv = nullptr;
228 if (format & Mesh::ARRAY_FORMAT_TEX_UV) {
229 u.resize(vcount);
230 uv = u.ptrw();
231 }
232
233 Vector2 *uv2 = nullptr;
234 if (format & Mesh::ARRAY_FORMAT_TEX_UV2) {
235 u2.resize(vcount);
236 uv2 = u2.ptrw();
237 }
238
239 Color *col = nullptr;
240 if (format & Mesh::ARRAY_FORMAT_COLOR) {
241 c.resize(vcount);
242 col = c.ptrw();
243 }
244
245 int *bo = nullptr;
246 if (format & Mesh::ARRAY_FORMAT_BONES) {
247 b.resize(vcount * 4);
248 bo = b.ptrw();
249 }
250
251 real_t *we = nullptr;
252 if (format & Mesh::ARRAY_FORMAT_WEIGHTS) {
253 w.resize(vcount * 4);
254 we = w.ptrw();
255 }
256
257 for (int i = 0; i < vcount; i++) {
258 const Vertex &vtx = vertices[i];
259
260 vr[i] = vtx.vertex;
261 if (nr) {
262 nr[i] = vtx.normal;
263 }
264 if (ta) {
265 ta[i * 4 + 0] = vtx.tangent.normal.x;
266 ta[i * 4 + 1] = vtx.tangent.normal.y;
267 ta[i * 4 + 2] = vtx.tangent.normal.z;
268 ta[i * 4 + 3] = vtx.tangent.d;
269 }
270 if (uv) {
271 uv[i] = vtx.uv;
272 }
273 if (uv2) {
274 uv2[i] = vtx.uv2;
275 }
276 if (col) {
277 col[i] = vtx.color;
278 }
279
280 if (we) {
281 we[i * 4 + 0] = vtx.weights[0];
282 we[i * 4 + 1] = vtx.weights[1];
283 we[i * 4 + 2] = vtx.weights[2];
284 we[i * 4 + 3] = vtx.weights[3];
285 }
286
287 if (bo) {
288 bo[i * 4 + 0] = vtx.bones[0];
289 bo[i * 4 + 1] = vtx.bones[1];
290 bo[i * 4 + 2] = vtx.bones[2];
291 bo[i * 4 + 3] = vtx.bones[3];
292 }
293 }
294
295 int fc = faces.size();
296 in.resize(fc * 3);
297 int *iw = in.ptrw();
298 for (int i = 0; i < fc; i++) {
299 iw[i * 3 + 0] = faces[i].v[0];
300 iw[i * 3 + 1] = faces[i].v[1];
301 iw[i * 3 + 2] = faces[i].v[2];
302 }
303 }
304
305 arr[Mesh::ARRAY_VERTEX] = v;
306 arr[Mesh::ARRAY_INDEX] = in;
307 if (n.size()) {
308 arr[Mesh::ARRAY_NORMAL] = n;
309 }
310 if (c.size()) {
311 arr[Mesh::ARRAY_COLOR] = c;
312 }
313 if (u.size()) {
314 arr[Mesh::ARRAY_TEX_UV] = u;
315 }
316 if (u2.size()) {
317 arr[Mesh::ARRAY_TEX_UV2] = u2;
318 }
319 if (t.size()) {
320 arr[Mesh::ARRAY_TANGENT] = t;
321 }
322 if (b.size()) {
323 arr[Mesh::ARRAY_BONES] = b;
324 }
325 if (w.size()) {
326 arr[Mesh::ARRAY_WEIGHTS] = w;
327 }
328
329 Ref<ArrayMesh> ncmesh = p_mesh;
330 int sc = ncmesh->get_surface_count();
331 ncmesh->add_surface_from_arrays(Mesh::PRIMITIVE_TRIANGLES, arr, TypedArray<Array>(), Dictionary(), p_compression_flags);
332 ncmesh->surface_set_material(sc, material);
333
334 return OK;
335 }
336
337 uint64_t MeshDataTool::get_format() const {
338 return format;
339 }
340
341 int MeshDataTool::get_vertex_count() const {
342 return vertices.size();
343 }
344
345 int MeshDataTool::get_edge_count() const {
346 return edges.size();
347 }
348
349 int MeshDataTool::get_face_count() const {
350 return faces.size();
351 }
352
353 Vector3 MeshDataTool::get_vertex(int p_idx) const {
354 ERR_FAIL_INDEX_V(p_idx, vertices.size(), Vector3());
355 return vertices[p_idx].vertex;
356 }
357
358 void MeshDataTool::set_vertex(int p_idx, const Vector3 &p_vertex) {
359 ERR_FAIL_INDEX(p_idx, vertices.size());
360 vertices.write[p_idx].vertex = p_vertex;
361 }
362
363 Vector3 MeshDataTool::get_vertex_normal(int p_idx) const {
364 ERR_FAIL_INDEX_V(p_idx, vertices.size(), Vector3());
365 return vertices[p_idx].normal;
366 }
367
368 void MeshDataTool::set_vertex_normal(int p_idx, const Vector3 &p_normal) {
369 ERR_FAIL_INDEX(p_idx, vertices.size());
370 vertices.write[p_idx].normal = p_normal;
371 format |= Mesh::ARRAY_FORMAT_NORMAL;
372 }
373
374 Plane MeshDataTool::get_vertex_tangent(int p_idx) const {
375 ERR_FAIL_INDEX_V(p_idx, vertices.size(), Plane());
376 return vertices[p_idx].tangent;
377 }
378
379 void MeshDataTool::set_vertex_tangent(int p_idx, const Plane &p_tangent) {
380 ERR_FAIL_INDEX(p_idx, vertices.size());
381 vertices.write[p_idx].tangent = p_tangent;
382 format |= Mesh::ARRAY_FORMAT_TANGENT;
383 }
384
385 Vector2 MeshDataTool::get_vertex_uv(int p_idx) const {
386 ERR_FAIL_INDEX_V(p_idx, vertices.size(), Vector2());
387 return vertices[p_idx].uv;
388 }
389
390 void MeshDataTool::set_vertex_uv(int p_idx, const Vector2 &p_uv) {
391 ERR_FAIL_INDEX(p_idx, vertices.size());
392 vertices.write[p_idx].uv = p_uv;
393 format |= Mesh::ARRAY_FORMAT_TEX_UV;
394 }
395
396 Vector2 MeshDataTool::get_vertex_uv2(int p_idx) const {
397 ERR_FAIL_INDEX_V(p_idx, vertices.size(), Vector2());
398 return vertices[p_idx].uv2;
399 }
400
401 void MeshDataTool::set_vertex_uv2(int p_idx, const Vector2 &p_uv2) {
402 ERR_FAIL_INDEX(p_idx, vertices.size());
403 vertices.write[p_idx].uv2 = p_uv2;
404 format |= Mesh::ARRAY_FORMAT_TEX_UV2;
405 }
406
407 Color MeshDataTool::get_vertex_color(int p_idx) const {
408 ERR_FAIL_INDEX_V(p_idx, vertices.size(), Color());
409 return vertices[p_idx].color;
410 }
411
412 void MeshDataTool::set_vertex_color(int p_idx, const Color &p_color) {
413 ERR_FAIL_INDEX(p_idx, vertices.size());
414 vertices.write[p_idx].color = p_color;
415 format |= Mesh::ARRAY_FORMAT_COLOR;
416 }
417
418 Vector<int> MeshDataTool::get_vertex_bones(int p_idx) const {
419 ERR_FAIL_INDEX_V(p_idx, vertices.size(), Vector<int>());
420 return vertices[p_idx].bones;
421 }
422
423 void MeshDataTool::set_vertex_bones(int p_idx, const Vector<int> &p_bones) {
424 ERR_FAIL_INDEX(p_idx, vertices.size());
425 ERR_FAIL_COND(p_bones.size() != 4);
426 vertices.write[p_idx].bones = p_bones;
427 format |= Mesh::ARRAY_FORMAT_BONES;
428 }
429
430 Vector<float> MeshDataTool::get_vertex_weights(int p_idx) const {
431 ERR_FAIL_INDEX_V(p_idx, vertices.size(), Vector<float>());
432 return vertices[p_idx].weights;
433 }
434
435 void MeshDataTool::set_vertex_weights(int p_idx, const Vector<float> &p_weights) {
436 ERR_FAIL_INDEX(p_idx, vertices.size());
437 ERR_FAIL_COND(p_weights.size() != 4);
438 vertices.write[p_idx].weights = p_weights;
439 format |= Mesh::ARRAY_FORMAT_WEIGHTS;
440 }
441
442 Variant MeshDataTool::get_vertex_meta(int p_idx) const {
443 ERR_FAIL_INDEX_V(p_idx, vertices.size(), Variant());
444 return vertices[p_idx].meta;
445 }
446
447 void MeshDataTool::set_vertex_meta(int p_idx, const Variant &p_meta) {
448 ERR_FAIL_INDEX(p_idx, vertices.size());
449 vertices.write[p_idx].meta = p_meta;
450 }
451
452 Vector<int> MeshDataTool::get_vertex_edges(int p_idx) const {
453 ERR_FAIL_INDEX_V(p_idx, vertices.size(), Vector<int>());
454 return vertices[p_idx].edges;
455 }
456
457 Vector<int> MeshDataTool::get_vertex_faces(int p_idx) const {
458 ERR_FAIL_INDEX_V(p_idx, vertices.size(), Vector<int>());
459 return vertices[p_idx].faces;
460 }
461
462 int MeshDataTool::get_edge_vertex(int p_edge, int p_vertex) const {
463 ERR_FAIL_INDEX_V(p_edge, edges.size(), -1);
464 ERR_FAIL_INDEX_V(p_vertex, 2, -1);
465 return edges[p_edge].vertex[p_vertex];
466 }
467
468 Vector<int> MeshDataTool::get_edge_faces(int p_edge) const {
469 ERR_FAIL_INDEX_V(p_edge, edges.size(), Vector<int>());
470 return edges[p_edge].faces;
471 }
472
473 Variant MeshDataTool::get_edge_meta(int p_idx) const {
474 ERR_FAIL_INDEX_V(p_idx, edges.size(), Variant());
475 return edges[p_idx].meta;
476 }
477
478 void MeshDataTool::set_edge_meta(int p_idx, const Variant &p_meta) {
479 ERR_FAIL_INDEX(p_idx, edges.size());
480 edges.write[p_idx].meta = p_meta;
481 }
482
483 int MeshDataTool::get_face_vertex(int p_face, int p_vertex) const {
484 ERR_FAIL_INDEX_V(p_face, faces.size(), -1);
485 ERR_FAIL_INDEX_V(p_vertex, 3, -1);
486 return faces[p_face].v[p_vertex];
487 }
488
489 int MeshDataTool::get_face_edge(int p_face, int p_vertex) const {
490 ERR_FAIL_INDEX_V(p_face, faces.size(), -1);
491 ERR_FAIL_INDEX_V(p_vertex, 3, -1);
492 return faces[p_face].edges[p_vertex];
493 }
494
495 Variant MeshDataTool::get_face_meta(int p_face) const {
496 ERR_FAIL_INDEX_V(p_face, faces.size(), Variant());
497 return faces[p_face].meta;
498 }
499
500 void MeshDataTool::set_face_meta(int p_face, const Variant &p_meta) {
501 ERR_FAIL_INDEX(p_face, faces.size());
502 faces.write[p_face].meta = p_meta;
503 }
504
505 Vector3 MeshDataTool::get_face_normal(int p_face) const {
506 ERR_FAIL_INDEX_V(p_face, faces.size(), Vector3());
507 Vector3 v0 = vertices[faces[p_face].v[0]].vertex;
508 Vector3 v1 = vertices[faces[p_face].v[1]].vertex;
509 Vector3 v2 = vertices[faces[p_face].v[2]].vertex;
510
511 return Plane(v0, v1, v2).normal;
512 }
513
514 Ref<Material> MeshDataTool::get_material() const {
515 return material;
516 }
517
518 void MeshDataTool::set_material(const Ref<Material> &p_material) {
519 material = p_material;
520 }
521
522 void MeshDataTool::_bind_methods() {
523 ClassDB::bind_method(D_METHOD("clear"), &MeshDataTool::clear);
524 ClassDB::bind_method(D_METHOD("create_from_surface", "mesh", "surface"), &MeshDataTool::create_from_surface);
525 ClassDB::bind_method(D_METHOD("commit_to_surface", "mesh", "compression_flags"), &MeshDataTool::commit_to_surface, DEFVAL(0));
526
527 ClassDB::bind_method(D_METHOD("get_format"), &MeshDataTool::get_format);
528
529 ClassDB::bind_method(D_METHOD("get_vertex_count"), &MeshDataTool::get_vertex_count);
530 ClassDB::bind_method(D_METHOD("get_edge_count"), &MeshDataTool::get_edge_count);
531 ClassDB::bind_method(D_METHOD("get_face_count"), &MeshDataTool::get_face_count);
532
533 ClassDB::bind_method(D_METHOD("set_vertex", "idx", "vertex"), &MeshDataTool::set_vertex);
534 ClassDB::bind_method(D_METHOD("get_vertex", "idx"), &MeshDataTool::get_vertex);
535
536 ClassDB::bind_method(D_METHOD("set_vertex_normal", "idx", "normal"), &MeshDataTool::set_vertex_normal);
537 ClassDB::bind_method(D_METHOD("get_vertex_normal", "idx"), &MeshDataTool::get_vertex_normal);
538
539 ClassDB::bind_method(D_METHOD("set_vertex_tangent", "idx", "tangent"), &MeshDataTool::set_vertex_tangent);
540 ClassDB::bind_method(D_METHOD("get_vertex_tangent", "idx"), &MeshDataTool::get_vertex_tangent);
541
542 ClassDB::bind_method(D_METHOD("set_vertex_uv", "idx", "uv"), &MeshDataTool::set_vertex_uv);
543 ClassDB::bind_method(D_METHOD("get_vertex_uv", "idx"), &MeshDataTool::get_vertex_uv);
544
545 ClassDB::bind_method(D_METHOD("set_vertex_uv2", "idx", "uv2"), &MeshDataTool::set_vertex_uv2);
546 ClassDB::bind_method(D_METHOD("get_vertex_uv2", "idx"), &MeshDataTool::get_vertex_uv2);
547
548 ClassDB::bind_method(D_METHOD("set_vertex_color", "idx", "color"), &MeshDataTool::set_vertex_color);
549 ClassDB::bind_method(D_METHOD("get_vertex_color", "idx"), &MeshDataTool::get_vertex_color);
550
551 ClassDB::bind_method(D_METHOD("set_vertex_bones", "idx", "bones"), &MeshDataTool::set_vertex_bones);
552 ClassDB::bind_method(D_METHOD("get_vertex_bones", "idx"), &MeshDataTool::get_vertex_bones);
553
554 ClassDB::bind_method(D_METHOD("set_vertex_weights", "idx", "weights"), &MeshDataTool::set_vertex_weights);
555 ClassDB::bind_method(D_METHOD("get_vertex_weights", "idx"), &MeshDataTool::get_vertex_weights);
556
557 ClassDB::bind_method(D_METHOD("set_vertex_meta", "idx", "meta"), &MeshDataTool::set_vertex_meta);
558 ClassDB::bind_method(D_METHOD("get_vertex_meta", "idx"), &MeshDataTool::get_vertex_meta);
559
560 ClassDB::bind_method(D_METHOD("get_vertex_edges", "idx"), &MeshDataTool::get_vertex_edges);
561 ClassDB::bind_method(D_METHOD("get_vertex_faces", "idx"), &MeshDataTool::get_vertex_faces);
562
563 ClassDB::bind_method(D_METHOD("get_edge_vertex", "idx", "vertex"), &MeshDataTool::get_edge_vertex);
564 ClassDB::bind_method(D_METHOD("get_edge_faces", "idx"), &MeshDataTool::get_edge_faces);
565
566 ClassDB::bind_method(D_METHOD("set_edge_meta", "idx", "meta"), &MeshDataTool::set_edge_meta);
567 ClassDB::bind_method(D_METHOD("get_edge_meta", "idx"), &MeshDataTool::get_edge_meta);
568
569 ClassDB::bind_method(D_METHOD("get_face_vertex", "idx", "vertex"), &MeshDataTool::get_face_vertex);
570 ClassDB::bind_method(D_METHOD("get_face_edge", "idx", "edge"), &MeshDataTool::get_face_edge);
571
572 ClassDB::bind_method(D_METHOD("set_face_meta", "idx", "meta"), &MeshDataTool::set_face_meta);
573 ClassDB::bind_method(D_METHOD("get_face_meta", "idx"), &MeshDataTool::get_face_meta);
574
575 ClassDB::bind_method(D_METHOD("get_face_normal", "idx"), &MeshDataTool::get_face_normal);
576
577 ClassDB::bind_method(D_METHOD("set_material", "material"), &MeshDataTool::set_material);
578 ClassDB::bind_method(D_METHOD("get_material"), &MeshDataTool::get_material);
579 }
580
581 MeshDataTool::MeshDataTool() {
582 clear();
583 }