Blender V4.3
mesh_data.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2009 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
9#include "MEM_guardedalloc.h"
10
11#include "DNA_object_types.h"
12#include "DNA_scene_types.h"
13#include "DNA_view3d_types.h"
14
15#include "BLI_array.hh"
16#include "BLI_utildefines.h"
17
18#include "BKE_attribute.hh"
19#include "BKE_context.hh"
20#include "BKE_customdata.hh"
21#include "BKE_editmesh.hh"
22#include "BKE_key.hh"
23#include "BKE_mesh.hh"
24#include "BKE_mesh_runtime.hh"
25#include "BKE_report.hh"
26
27#include "DEG_depsgraph.hh"
28
29#include "RNA_prototypes.hh"
30
31#include "WM_api.hh"
32#include "WM_types.hh"
33
34#include "BLT_translation.hh"
35
36#include "ED_mesh.hh"
37#include "ED_object.hh"
38#include "ED_paint.hh"
39#include "ED_screen.hh"
40
42
43#include "mesh_intern.hh" /* own include */
44
45using blender::Array;
46using blender::float2;
47using blender::float3;
49using blender::Span;
50
51static CustomData *mesh_customdata_get_type(Mesh *mesh, const char htype, int *r_tot)
52{
54 BMesh *bm = (mesh->runtime->edit_mesh) ? mesh->runtime->edit_mesh->bm : nullptr;
55 int tot;
56
57 switch (htype) {
58 case BM_VERT:
59 if (bm) {
60 data = &bm->vdata;
61 tot = bm->totvert;
62 }
63 else {
64 data = &mesh->vert_data;
65 tot = mesh->verts_num;
66 }
67 break;
68 case BM_EDGE:
69 if (bm) {
70 data = &bm->edata;
71 tot = bm->totedge;
72 }
73 else {
74 data = &mesh->edge_data;
75 tot = mesh->edges_num;
76 }
77 break;
78 case BM_LOOP:
79 if (bm) {
80 data = &bm->ldata;
81 tot = bm->totloop;
82 }
83 else {
84 data = &mesh->corner_data;
85 tot = mesh->corners_num;
86 }
87 break;
88 case BM_FACE:
89 if (bm) {
90 data = &bm->pdata;
91 tot = bm->totface;
92 }
93 else {
94 data = &mesh->face_data;
95 tot = mesh->faces_num;
96 }
97 break;
98 default:
99 BLI_assert(0);
100 tot = 0;
101 data = nullptr;
102 break;
103 }
104
105 if (r_tot) {
106 *r_tot = tot;
107 }
108 return data;
109}
110
111static void mesh_uv_reset_array(float **fuv, const int len)
112{
113 if (len == 3) {
114 fuv[0][0] = 0.0;
115 fuv[0][1] = 0.0;
116
117 fuv[1][0] = 1.0;
118 fuv[1][1] = 0.0;
119
120 fuv[2][0] = 1.0;
121 fuv[2][1] = 1.0;
122 }
123 else if (len == 4) {
124 fuv[0][0] = 0.0;
125 fuv[0][1] = 0.0;
126
127 fuv[1][0] = 1.0;
128 fuv[1][1] = 0.0;
129
130 fuv[2][0] = 1.0;
131 fuv[2][1] = 1.0;
132
133 fuv[3][0] = 0.0;
134 fuv[3][1] = 1.0;
135 /* Make sure we ignore 2-sided faces. */
136 }
137 else if (len > 2) {
138 float fac = 0.0f, dfac = 1.0f / float(len);
139
140 dfac *= float(M_PI) * 2.0f;
141
142 for (int i = 0; i < len; i++) {
143 fuv[i][0] = 0.5f * sinf(fac) + 0.5f;
144 fuv[i][1] = 0.5f * cosf(fac) + 0.5f;
145
146 fac += dfac;
147 }
148 }
149}
150
151static void mesh_uv_reset_bmface(BMFace *f, const int cd_loop_uv_offset)
152{
154 BMIter liter;
155 BMLoop *l;
156 int i;
157
158 BM_ITER_ELEM_INDEX (l, &liter, f, BM_LOOPS_OF_FACE, i) {
159 fuv[i] = ((float *)BM_ELEM_CD_GET_VOID_P(l, cd_loop_uv_offset));
160 }
161
162 mesh_uv_reset_array(fuv.data(), f->len);
163}
164
165static void mesh_uv_reset_mface(const blender::IndexRange face, float2 *mloopuv)
166{
168
169 for (int i = 0; i < face.size(); i++) {
170 fuv[i] = mloopuv[face[i]];
171 }
172
173 mesh_uv_reset_array(fuv.data(), face.size());
174}
175
176void ED_mesh_uv_loop_reset_ex(Mesh *mesh, const int layernum)
177{
178 if (BMEditMesh *em = mesh->runtime->edit_mesh.get()) {
179 /* Collect BMesh UVs */
180 const int cd_loop_uv_offset = CustomData_get_n_offset(
181 &em->bm->ldata, CD_PROP_FLOAT2, layernum);
182
183 BMFace *efa;
184 BMIter iter;
185
186 BLI_assert(cd_loop_uv_offset >= 0);
187
188 BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
190 continue;
191 }
192
193 mesh_uv_reset_bmface(efa, cd_loop_uv_offset);
194 }
195 }
196 else {
197 /* Collect Mesh UVs */
198 BLI_assert(CustomData_has_layer(&mesh->corner_data, CD_PROP_FLOAT2));
199 float2 *mloopuv = static_cast<float2 *>(CustomData_get_layer_n_for_write(
200 &mesh->corner_data, CD_PROP_FLOAT2, layernum, mesh->corners_num));
201
202 const blender::OffsetIndices polys = mesh->faces();
203 for (const int i : polys.index_range()) {
204 mesh_uv_reset_mface(polys[i], mloopuv);
205 }
206 }
207
208 DEG_id_tag_update(&mesh->id, 0);
209}
210
212{
213 /* could be ldata or pdata */
214 CustomData *ldata = mesh_customdata_get_type(mesh, BM_LOOP, nullptr);
215 const int layernum = CustomData_get_active_layer(ldata, CD_PROP_FLOAT2);
216 ED_mesh_uv_loop_reset_ex(mesh, layernum);
217
219}
220
222 Mesh *mesh, const char *name, const bool active_set, const bool do_init, ReportList *reports)
223{
224 /* NOTE: keep in sync with #ED_mesh_color_add. */
225
226 int layernum_dst;
227
228 if (!name) {
229 name = DATA_("UVMap");
230 }
231
232 AttributeOwner owner = AttributeOwner::from_id(&mesh->id);
233 const std::string unique_name = BKE_attribute_calc_unique_name(owner, name);
234 bool is_init = false;
235
236 if (BMEditMesh *em = mesh->runtime->edit_mesh.get()) {
237 layernum_dst = CustomData_number_of_layers(&em->bm->ldata, CD_PROP_FLOAT2);
238 if (layernum_dst >= MAX_MTFACE) {
239 BKE_reportf(reports, RPT_WARNING, "Cannot add more than %i UV maps", MAX_MTFACE);
240 return -1;
241 }
242
243 BM_data_layer_add_named(em->bm, &em->bm->ldata, CD_PROP_FLOAT2, unique_name.c_str());
245 /* copy data from active UV */
246 if (layernum_dst && do_init) {
247 const int layernum_src = CustomData_get_active_layer(&em->bm->ldata, CD_PROP_FLOAT2);
248 BM_data_layer_copy(em->bm, &em->bm->ldata, CD_PROP_FLOAT2, layernum_src, layernum_dst);
249
250 is_init = true;
251 }
252 if (active_set || layernum_dst == 0) {
253 CustomData_set_layer_active(&em->bm->ldata, CD_PROP_FLOAT2, layernum_dst);
254 }
255 }
256 else {
257 layernum_dst = CustomData_number_of_layers(&mesh->corner_data, CD_PROP_FLOAT2);
258 if (layernum_dst >= MAX_MTFACE) {
259 BKE_reportf(reports, RPT_WARNING, "Cannot add more than %i UV maps", MAX_MTFACE);
260 return -1;
261 }
262
263 if (CustomData_has_layer(&mesh->corner_data, CD_PROP_FLOAT2) && do_init) {
265 &mesh->corner_data,
268 mesh->corners_num,
270 nullptr);
271
272 is_init = true;
273 }
274 else {
276 &mesh->corner_data, CD_PROP_FLOAT2, CD_SET_DEFAULT, mesh->corners_num, unique_name);
277 }
278
279 if (active_set || layernum_dst == 0) {
280 CustomData_set_layer_active(&mesh->corner_data, CD_PROP_FLOAT2, layernum_dst);
281 }
282 }
283
284 /* don't overwrite our copied coords */
285 if (!is_init && do_init) {
286 ED_mesh_uv_loop_reset_ex(mesh, layernum_dst);
287 }
288
289 DEG_id_tag_update(&mesh->id, 0);
291
292 return layernum_dst;
293}
294
295static const bool *mesh_loop_boolean_custom_data_get_by_name(const Mesh &mesh, const char *name)
296{
297 return static_cast<const bool *>(
298 CustomData_get_layer_named(&mesh.corner_data, CD_PROP_BOOL, name));
299}
300
301const bool *ED_mesh_uv_map_vert_select_layer_get(const Mesh *mesh, const int uv_index)
302{
303 using namespace blender::bke;
304 char buffer[MAX_CUSTOMDATA_LAYER_NAME];
305 const char *uv_name = CustomData_get_layer_name(&mesh->corner_data, CD_PROP_FLOAT2, uv_index);
307 *mesh, BKE_uv_map_vert_select_name_get(uv_name, buffer));
308}
309const bool *ED_mesh_uv_map_edge_select_layer_get(const Mesh *mesh, const int uv_index)
310{
311 /* UV map edge selections are stored on face corners (loops) and not on edges
312 * because we need selections per face edge, even when the edge is split in UV space. */
313
314 using namespace blender::bke;
315 char buffer[MAX_CUSTOMDATA_LAYER_NAME];
316 const char *uv_name = CustomData_get_layer_name(&mesh->corner_data, CD_PROP_FLOAT2, uv_index);
318 *mesh, BKE_uv_map_edge_select_name_get(uv_name, buffer));
319}
320
321const bool *ED_mesh_uv_map_pin_layer_get(const Mesh *mesh, const int uv_index)
322{
323 using namespace blender::bke;
324 char buffer[MAX_CUSTOMDATA_LAYER_NAME];
325 const char *uv_name = CustomData_get_layer_name(&mesh->corner_data, CD_PROP_FLOAT2, uv_index);
327 BKE_uv_map_pin_name_get(uv_name, buffer));
328}
329
331{
332 bool *data = static_cast<bool *>(CustomData_get_layer_named_for_write(
333 &mesh.corner_data, CD_PROP_BOOL, name, mesh.corners_num));
334 if (!data) {
335 data = static_cast<bool *>(CustomData_add_layer_named(
336 &mesh.corner_data, CD_PROP_BOOL, CD_SET_DEFAULT, mesh.faces_num, name));
337 }
338 return data;
339}
340
341bool *ED_mesh_uv_map_vert_select_layer_ensure(Mesh *mesh, const int uv_index)
342{
343 using namespace blender::bke;
344 char buffer[MAX_CUSTOMDATA_LAYER_NAME];
345 const char *uv_name = CustomData_get_layer_name(&mesh->corner_data, CD_PROP_FLOAT2, uv_index);
347}
348bool *ED_mesh_uv_map_edge_select_layer_ensure(Mesh *mesh, const int uv_index)
349{
350 using namespace blender::bke;
351 char buffer[MAX_CUSTOMDATA_LAYER_NAME];
352 const char *uv_name = CustomData_get_layer_name(&mesh->corner_data, CD_PROP_FLOAT2, uv_index);
354}
355bool *ED_mesh_uv_map_pin_layer_ensure(Mesh *mesh, const int uv_index)
356{
357 using namespace blender::bke;
358 char buffer[MAX_CUSTOMDATA_LAYER_NAME];
359 const char *uv_name = CustomData_get_layer_name(&mesh->corner_data, CD_PROP_FLOAT2, uv_index);
360 return ensure_corner_boolean_attribute(*mesh, BKE_uv_map_pin_name_get(uv_name, buffer));
361}
362
363void ED_mesh_uv_ensure(Mesh *mesh, const char *name)
364{
365 int layernum_dst;
366
367 if (BMEditMesh *em = mesh->runtime->edit_mesh.get()) {
368 layernum_dst = CustomData_number_of_layers(&em->bm->ldata, CD_PROP_FLOAT2);
369 if (layernum_dst == 0) {
370 ED_mesh_uv_add(mesh, name, true, true, nullptr);
371 }
372 }
373 else {
374 layernum_dst = CustomData_number_of_layers(&mesh->corner_data, CD_PROP_FLOAT2);
375 if (layernum_dst == 0) {
376 ED_mesh_uv_add(mesh, name, true, true, nullptr);
377 }
378 }
379}
380
382 Mesh *mesh, const char *name, const bool active_set, const bool do_init, ReportList *reports)
383{
384 using namespace blender;
385 /* If no name is supplied, provide a backwards compatible default. */
386 if (!name) {
387 name = "Col";
388 }
389
390 AttributeOwner owner = AttributeOwner::from_id(&mesh->id);
392 owner, name, CD_PROP_BYTE_COLOR, bke::AttrDomain::Corner, reports);
393
394 if (do_init) {
395 const char *active_name = mesh->active_color_attribute;
396 if (const CustomDataLayer *active_layer = BKE_id_attributes_color_find(&mesh->id, active_name))
397 {
398 if (const BMEditMesh *em = mesh->runtime->edit_mesh.get()) {
399 BMesh &bm = *em->bm;
400 const int src_i = CustomData_get_named_layer(&bm.ldata, CD_PROP_BYTE_COLOR, active_name);
401 const int dst_i = CustomData_get_named_layer(&bm.ldata, CD_PROP_BYTE_COLOR, layer->name);
403 }
404 else {
405 memcpy(
406 layer->data, active_layer->data, CustomData_get_elem_size(layer) * mesh->corners_num);
407 }
408 }
409 }
410
411 if (active_set) {
412 BKE_id_attributes_active_color_set(&mesh->id, layer->name);
413 }
414
415 DEG_id_tag_update(&mesh->id, 0);
417
418 int dummy;
419 const CustomData *data = mesh_customdata_get_type(mesh, BM_LOOP, &dummy);
420 return CustomData_get_named_layer(data, CD_PROP_BYTE_COLOR, layer->name);
421}
422
423bool ED_mesh_color_ensure(Mesh *mesh, const char *name)
424{
425 using namespace blender;
426 BLI_assert(mesh->runtime->edit_mesh == nullptr);
427 if (BKE_color_attribute_supported(*mesh, mesh->active_color_attribute)) {
428 return true;
429 }
430
431 AttributeOwner owner = AttributeOwner::from_id(&mesh->id);
432 const std::string unique_name = BKE_attribute_calc_unique_name(owner, name);
433 if (!mesh->attributes_for_write().add(unique_name,
434 bke::AttrDomain::Corner,
437 {
438 return false;
439 }
440
444 DEG_id_tag_update(&mesh->id, 0);
445
446 return true;
447}
448
449/*********************** General poll ************************/
450
451static bool layers_poll(bContext *C)
452{
454 ID *data = (ob) ? static_cast<ID *>(ob->data) : nullptr;
455 return (ob && ID_IS_EDITABLE(ob) && !ID_IS_OVERRIDE_LIBRARY(ob) && ob->type == OB_MESH && data &&
456 ID_IS_EDITABLE(data) && !ID_IS_OVERRIDE_LIBRARY(data));
457}
458
459/*********************** UV texture operators ************************/
460
462{
463 if (!layers_poll(C)) {
464 return false;
465 }
466
468 Mesh *mesh = static_cast<Mesh *>(ob->data);
469 CustomData *ldata = mesh_customdata_get_type(mesh, BM_LOOP, nullptr);
470 const int active = CustomData_get_active_layer(ldata, CD_PROP_FLOAT2);
471 if (active != -1) {
472 return true;
473 }
474
475 return false;
476}
477
479{
481 Mesh *mesh = static_cast<Mesh *>(ob->data);
482
483 if (ED_mesh_uv_add(mesh, nullptr, true, true, op->reports) == -1) {
484 return OPERATOR_CANCELLED;
485 }
486
487 if (ob->mode & OB_MODE_TEXTURE_PAINT) {
488 Scene *scene = CTX_data_scene(C);
489 ED_paint_proj_mesh_data_check(*scene, *ob, nullptr, nullptr, nullptr, nullptr);
491 }
492
493 return OPERATOR_FINISHED;
494}
495
497{
498 /* identifiers */
499 ot->name = "Add UV Map";
500 ot->description = "Add UV map";
501 ot->idname = "MESH_OT_uv_texture_add";
502
503 /* api callbacks */
506
507 /* flags */
509}
510
512{
514 Mesh *mesh = static_cast<Mesh *>(ob->data);
515
516 AttributeOwner owner = AttributeOwner::from_id(&mesh->id);
517 CustomData *ldata = mesh_customdata_get_type(mesh, BM_LOOP, nullptr);
518 const char *name = CustomData_get_active_layer_name(ldata, CD_PROP_FLOAT2);
519 if (!BKE_attribute_remove(owner, name, op->reports)) {
520 return OPERATOR_CANCELLED;
521 }
522
523 if (ob->mode & OB_MODE_TEXTURE_PAINT) {
524 Scene *scene = CTX_data_scene(C);
525 ED_paint_proj_mesh_data_check(*scene, *ob, nullptr, nullptr, nullptr, nullptr);
527 }
528
531
532 return OPERATOR_FINISHED;
533}
534
536{
537 /* identifiers */
538 ot->name = "Remove UV Map";
539 ot->description = "Remove UV map";
540 ot->idname = "MESH_OT_uv_texture_remove";
541
542 /* api callbacks */
545
546 /* flags */
548}
549
550/* *** CustomData clear functions, we need an operator for each *** */
551
553 char htype,
554 const eCustomDataType type)
555{
556 Mesh *mesh = ED_mesh_context(C);
557
558 int tot;
559 CustomData *data = mesh_customdata_get_type(mesh, htype, &tot);
560
562
563 if (CustomData_has_layer(data, type)) {
564 if (mesh->runtime->edit_mesh) {
565 BM_data_layer_free(mesh->runtime->edit_mesh->bm, data, type);
566 }
567 else {
568 CustomData_free_layers(data, type, tot);
569 }
570
573
574 return OPERATOR_FINISHED;
575 }
576 return OPERATOR_CANCELLED;
577}
578
579/* Clear Mask */
581{
583 if (ob && ob->type == OB_MESH) {
584 Mesh *mesh = static_cast<Mesh *>(ob->data);
585
586 /* special case - can't run this if we're in sculpt mode */
587 if (ob->mode & OB_MODE_SCULPT) {
588 return false;
589 }
590
591 if (ID_IS_EDITABLE(mesh) && !ID_IS_OVERRIDE_LIBRARY(mesh)) {
592 CustomData *data = mesh_customdata_get_type(mesh, BM_VERT, nullptr);
593 if (CustomData_has_layer_named(data, CD_PROP_FLOAT, ".sculpt_mask")) {
594 return true;
595 }
596 data = mesh_customdata_get_type(mesh, BM_LOOP, nullptr);
598 return true;
599 }
600 }
601 }
602 return false;
603}
605{
607 Mesh *mesh = static_cast<Mesh *>(object->data);
608 AttributeOwner owner = AttributeOwner::from_id(&mesh->id);
609 const bool ret_a = BKE_attribute_remove(owner, ".sculpt_mask", op->reports);
611
612 if (ret_a || ret_b == OPERATOR_FINISHED) {
613 return OPERATOR_FINISHED;
614 }
615 return OPERATOR_CANCELLED;
616}
617
619{
620 /* NOTE: no create_mask yet */
621
622 /* identifiers */
623 ot->name = "Clear Sculpt Mask Data";
624 ot->idname = "MESH_OT_customdata_mask_clear";
625 ot->description = "Clear vertex sculpt masking data from the mesh";
626
627 /* api callbacks */
630
631 /* flags */
633}
634
640{
642
643 if (ob && ob->type == OB_MESH) {
644 Mesh *mesh = static_cast<Mesh *>(ob->data);
645 if (ID_IS_EDITABLE(mesh) && !ID_IS_OVERRIDE_LIBRARY(mesh)) {
646 CustomData *data = mesh_customdata_get_type(mesh, BM_VERT, nullptr);
648 }
649 }
650 return -1;
651}
652
654{
655 return (mesh_customdata_skin_state(C) == 0);
656}
657
659{
661 Mesh *mesh = static_cast<Mesh *>(ob->data);
662
664
665 DEG_id_tag_update(&mesh->id, 0);
667
668 return OPERATOR_FINISHED;
669}
670
672{
673 /* identifiers */
674 ot->name = "Add Skin Data";
675 ot->idname = "MESH_OT_customdata_skin_add";
676 ot->description = "Add a vertex skin layer";
677
678 /* api callbacks */
681
682 /* flags */
684}
685
687{
688 return (mesh_customdata_skin_state(C) == 1);
689}
690
695
697{
698 /* identifiers */
699 ot->name = "Clear Skin Data";
700 ot->idname = "MESH_OT_customdata_skin_clear";
701 ot->description = "Clear vertex skin layer";
702
703 /* api callbacks */
706
707 /* flags */
709}
710
711/* Clear custom loop normals */
713{
714 using namespace blender;
715 Mesh *mesh = ED_mesh_context(C);
717 return OPERATOR_CANCELLED;
718 }
719
720 if (mesh->runtime->edit_mesh) {
721 BMesh &bm = *mesh->runtime->edit_mesh->bm;
723 }
724 else {
726 &mesh->corner_data, CD_CUSTOMLOOPNORMAL, CD_SET_DEFAULT, mesh->corners_num);
727 }
728
729 DEG_id_tag_update(&mesh->id, 0);
731
732 return OPERATOR_FINISHED;
733}
734
736{
737 /* identifiers */
738 ot->name = "Add Custom Split Normals Data";
739 ot->idname = "MESH_OT_customdata_custom_splitnormals_add";
740 ot->description = "Add a custom split normals layer, if none exists yet";
741
742 /* api callbacks */
745
746 /* flags */
748}
749
751{
752 Mesh *mesh = ED_mesh_context(C);
753
754 if (BMEditMesh *em = mesh->runtime->edit_mesh.get()) {
755 BMesh &bm = *em->bm;
757 return OPERATOR_CANCELLED;
758 }
760 if (bm.lnor_spacearr) {
762 }
763 }
764 else {
765 if (!CustomData_has_layer(&mesh->corner_data, CD_CUSTOMLOOPNORMAL)) {
766 return OPERATOR_CANCELLED;
767 }
768 CustomData_free_layers(&mesh->corner_data, CD_CUSTOMLOOPNORMAL, mesh->corners_num);
769 }
770
771 mesh->tag_custom_normals_changed();
774
775 return OPERATOR_FINISHED;
776}
777
779{
780 /* identifiers */
781 ot->name = "Clear Custom Split Normals Data";
782 ot->idname = "MESH_OT_customdata_custom_splitnormals_clear";
783 ot->description = "Remove the custom split normals layer, if it exists";
784
785 /* api callbacks */
788
789 /* flags */
791}
792
793static void mesh_add_verts(Mesh *mesh, int len)
794{
795 using namespace blender;
796 if (len == 0) {
797 return;
798 }
799
800 int totvert = mesh->verts_num + len;
801 CustomData vert_data;
803 &mesh->vert_data, &vert_data, CD_MASK_MESH.vmask, CD_SET_DEFAULT, totvert);
804 CustomData_copy_data(&mesh->vert_data, &vert_data, 0, 0, mesh->verts_num);
805
806 if (!CustomData_has_layer_named(&vert_data, CD_PROP_FLOAT3, "position")) {
807 CustomData_add_layer_named(&vert_data, CD_PROP_FLOAT3, CD_SET_DEFAULT, totvert, "position");
808 }
809
810 CustomData_free(&mesh->vert_data, mesh->verts_num);
811 mesh->vert_data = vert_data;
812
814
815 mesh->verts_num = totvert;
816
817 bke::MutableAttributeAccessor attributes = mesh->attributes_for_write();
818 bke::SpanAttributeWriter<bool> select_vert = attributes.lookup_or_add_for_write_span<bool>(
819 ".select_vert", bke::AttrDomain::Point);
820 select_vert.span.take_back(len).fill(true);
821 select_vert.finish();
822}
823
824static void mesh_add_edges(Mesh *mesh, int len)
825{
826 using namespace blender;
827 CustomData edge_data;
828 int totedge;
829
830 if (len == 0) {
831 return;
832 }
833
834 totedge = mesh->edges_num + len;
835
836 /* Update custom-data. */
838 &mesh->edge_data, &edge_data, CD_MASK_MESH.emask, CD_SET_DEFAULT, totedge);
839 CustomData_copy_data(&mesh->edge_data, &edge_data, 0, 0, mesh->edges_num);
840
841 if (!CustomData_has_layer_named(&edge_data, CD_PROP_INT32_2D, ".edge_verts")) {
843 &edge_data, CD_PROP_INT32_2D, CD_SET_DEFAULT, totedge, ".edge_verts");
844 }
845
846 CustomData_free(&mesh->edge_data, mesh->edges_num);
847 mesh->edge_data = edge_data;
848
850
851 mesh->edges_num = totedge;
852
853 bke::MutableAttributeAccessor attributes = mesh->attributes_for_write();
854 bke::SpanAttributeWriter<bool> select_edge = attributes.lookup_or_add_for_write_span<bool>(
855 ".select_edge", bke::AttrDomain::Edge);
856 select_edge.span.take_back(len).fill(true);
857 select_edge.finish();
858}
859
860static void mesh_add_loops(Mesh *mesh, int len)
861{
862 CustomData ldata;
863 int totloop;
864
865 if (len == 0) {
866 return;
867 }
868
869 totloop = mesh->corners_num + len; /* new face count */
870
871 /* update customdata */
873 &mesh->corner_data, &ldata, CD_MASK_MESH.lmask, CD_SET_DEFAULT, totloop);
874 CustomData_copy_data(&mesh->corner_data, &ldata, 0, 0, mesh->corners_num);
875
876 if (!CustomData_has_layer_named(&ldata, CD_PROP_INT32, ".corner_vert")) {
877 CustomData_add_layer_named(&ldata, CD_PROP_INT32, CD_SET_DEFAULT, totloop, ".corner_vert");
878 }
879 if (!CustomData_has_layer_named(&ldata, CD_PROP_INT32, ".corner_edge")) {
880 CustomData_add_layer_named(&ldata, CD_PROP_INT32, CD_SET_DEFAULT, totloop, ".corner_edge");
881 }
882
884
885 CustomData_free(&mesh->corner_data, mesh->corners_num);
886 mesh->corner_data = ldata;
887
888 mesh->corners_num = totloop;
889
890 /* Keep the last face offset up to date with the corner total (they must be the same). We have
891 * to be careful here though, since the mesh may not be in a valid state at this point. */
892 if (mesh->face_offset_indices) {
893 mesh->face_offsets_for_write().last() = mesh->corners_num;
894 }
895}
896
897static void mesh_add_faces(Mesh *mesh, int len)
898{
899 using namespace blender;
900 CustomData face_data;
901 int faces_num;
902
903 if (len == 0) {
904 return;
905 }
906
907 faces_num = mesh->faces_num + len; /* new face count */
908
909 /* update customdata */
911 &mesh->face_data, &face_data, CD_MASK_MESH.pmask, CD_SET_DEFAULT, faces_num);
912 CustomData_copy_data(&mesh->face_data, &face_data, 0, 0, mesh->faces_num);
913
914 implicit_sharing::resize_trivial_array(&mesh->face_offset_indices,
915 &mesh->runtime->face_offsets_sharing_info,
916 mesh->faces_num == 0 ? 0 : (mesh->faces_num + 1),
917 faces_num + 1);
918 /* Set common values for convenience. */
919 mesh->face_offset_indices[0] = 0;
920 mesh->face_offset_indices[faces_num] = mesh->corners_num;
921
922 CustomData_free(&mesh->face_data, mesh->faces_num);
923 mesh->face_data = face_data;
924
926
927 mesh->faces_num = faces_num;
928
929 bke::MutableAttributeAccessor attributes = mesh->attributes_for_write();
930 bke::SpanAttributeWriter<bool> select_poly = attributes.lookup_or_add_for_write_span<bool>(
931 ".select_poly", bke::AttrDomain::Face);
932 select_poly.span.take_back(len).fill(true);
933 select_poly.finish();
934}
935
936/* -------------------------------------------------------------------- */
940void ED_mesh_verts_add(Mesh *mesh, ReportList *reports, int count)
941{
942 if (mesh->runtime->edit_mesh) {
943 BKE_report(reports, RPT_ERROR, "Cannot add vertices in edit mode");
944 return;
945 }
946 mesh_add_verts(mesh, count);
947}
948
949void ED_mesh_edges_add(Mesh *mesh, ReportList *reports, int count)
950{
951 if (mesh->runtime->edit_mesh) {
952 BKE_report(reports, RPT_ERROR, "Cannot add edges in edit mode");
953 return;
954 }
955 mesh_add_edges(mesh, count);
956}
957
958void ED_mesh_loops_add(Mesh *mesh, ReportList *reports, int count)
959{
960 if (mesh->runtime->edit_mesh) {
961 BKE_report(reports, RPT_ERROR, "Cannot add loops in edit mode");
962 return;
963 }
964 mesh_add_loops(mesh, count);
965}
966
967void ED_mesh_faces_add(Mesh *mesh, ReportList *reports, int count)
968{
969 if (mesh->runtime->edit_mesh) {
970 BKE_report(reports, RPT_ERROR, "Cannot add faces in edit mode");
971 return;
972 }
973 mesh_add_faces(mesh, count);
974}
975
978/* -------------------------------------------------------------------- */
982static void mesh_remove_verts(Mesh *mesh, int len)
983{
984 if (len == 0) {
985 return;
986 }
987 CustomData_ensure_layers_are_mutable(&mesh->vert_data, mesh->verts_num);
988 const int totvert = mesh->verts_num - len;
989 CustomData_free_elem(&mesh->vert_data, totvert, len);
990 mesh->verts_num = totvert;
991}
992
993static void mesh_remove_edges(Mesh *mesh, int len)
994{
995 if (len == 0) {
996 return;
997 }
998 CustomData_ensure_layers_are_mutable(&mesh->edge_data, mesh->edges_num);
999 const int totedge = mesh->edges_num - len;
1000 CustomData_free_elem(&mesh->edge_data, totedge, len);
1001 mesh->edges_num = totedge;
1002}
1003
1004static void mesh_remove_loops(Mesh *mesh, int len)
1005{
1006 if (len == 0) {
1007 return;
1008 }
1009 CustomData_ensure_layers_are_mutable(&mesh->corner_data, mesh->corners_num);
1010 const int totloop = mesh->corners_num - len;
1011 CustomData_free_elem(&mesh->corner_data, totloop, len);
1012 mesh->corners_num = totloop;
1013}
1014
1015static void mesh_remove_faces(Mesh *mesh, int len)
1016{
1017 if (len == 0) {
1018 return;
1019 }
1020 CustomData_ensure_layers_are_mutable(&mesh->face_data, mesh->faces_num);
1021 const int faces_num = mesh->faces_num - len;
1022 CustomData_free_elem(&mesh->face_data, faces_num, len);
1023 mesh->faces_num = faces_num;
1024}
1025
1026void ED_mesh_verts_remove(Mesh *mesh, ReportList *reports, int count)
1027{
1028 if (mesh->runtime->edit_mesh) {
1029 BKE_report(reports, RPT_ERROR, "Cannot remove vertices in edit mode");
1030 return;
1031 }
1032 if (count > mesh->verts_num) {
1033 BKE_report(reports, RPT_ERROR, "Cannot remove more vertices than the mesh contains");
1034 return;
1035 }
1036
1037 mesh_remove_verts(mesh, count);
1038}
1039
1040void ED_mesh_edges_remove(Mesh *mesh, ReportList *reports, int count)
1041{
1042 if (mesh->runtime->edit_mesh) {
1043 BKE_report(reports, RPT_ERROR, "Cannot remove edges in edit mode");
1044 return;
1045 }
1046 if (count > mesh->edges_num) {
1047 BKE_report(reports, RPT_ERROR, "Cannot remove more edges than the mesh contains");
1048 return;
1049 }
1050
1051 mesh_remove_edges(mesh, count);
1052}
1053
1054void ED_mesh_loops_remove(Mesh *mesh, ReportList *reports, int count)
1055{
1056 if (mesh->runtime->edit_mesh) {
1057 BKE_report(reports, RPT_ERROR, "Cannot remove loops in edit mode");
1058 return;
1059 }
1060 if (count > mesh->corners_num) {
1061 BKE_report(reports, RPT_ERROR, "Cannot remove more loops than the mesh contains");
1062 return;
1063 }
1064
1065 mesh_remove_loops(mesh, count);
1066}
1067
1068void ED_mesh_faces_remove(Mesh *mesh, ReportList *reports, int count)
1069{
1070 if (mesh->runtime->edit_mesh) {
1071 BKE_report(reports, RPT_ERROR, "Cannot remove polys in edit mode");
1072 return;
1073 }
1074 if (count > mesh->faces_num) {
1075 BKE_report(reports, RPT_ERROR, "Cannot remove more polys than the mesh contains");
1076 return;
1077 }
1078
1079 mesh_remove_faces(mesh, count);
1080}
1081
1083{
1084 mesh_remove_verts(mesh, mesh->verts_num);
1085 mesh_remove_edges(mesh, mesh->edges_num);
1086 mesh_remove_loops(mesh, mesh->corners_num);
1087 mesh_remove_faces(mesh, mesh->faces_num);
1088}
1089
1092void ED_mesh_report_mirror_ex(wmOperator *op, int totmirr, int totfail, char selectmode)
1093{
1094 const char *elem_type;
1095
1096 if (selectmode & SCE_SELECT_VERTEX) {
1097 elem_type = "vertices";
1098 }
1099 else if (selectmode & SCE_SELECT_EDGE) {
1100 elem_type = "edges";
1101 }
1102 else {
1103 elem_type = "faces";
1104 }
1105
1106 if (totfail) {
1108 op->reports, RPT_WARNING, "%d %s mirrored, %d failed", totmirr, elem_type, totfail);
1109 }
1110 else {
1111 BKE_reportf(op->reports, RPT_INFO, "%d %s mirrored", totmirr, elem_type);
1112 }
1113}
1114
1115void ED_mesh_report_mirror(wmOperator *op, int totmirr, int totfail)
1116{
1117 ED_mesh_report_mirror_ex(op, totmirr, totfail, SCE_SELECT_VERTEX);
1118}
1119
1121{
1122 BLI_assert(me->runtime->edit_mesh && me->runtime->edit_mesh->bm);
1123
1124 return BKE_keyblock_find_by_index(me->key, me->runtime->edit_mesh->bm->shapenr - 1);
1125}
1126
1128{
1129 Mesh *mesh = static_cast<Mesh *>(CTX_data_pointer_get_type(C, "mesh", &RNA_Mesh).data);
1130 if (mesh != nullptr) {
1131 return mesh;
1132 }
1133
1135 if (ob == nullptr) {
1136 return nullptr;
1137 }
1138
1139 ID *data = (ID *)ob->data;
1140 if (data == nullptr || GS(data->name) != ID_ME) {
1141 return nullptr;
1142 }
1143
1144 return (Mesh *)data;
1145}
1146
1148{
1149 using namespace blender;
1150 const OffsetIndices polys = mesh->faces();
1151 const Span<int> corner_edges = mesh->corner_edges();
1152 const bke::AttributeAccessor attributes = mesh->attributes();
1153 const VArray<bool> mesh_sharp_edges = *attributes.lookup_or_default<bool>(
1154 "sharp_edge", bke::AttrDomain::Edge, false);
1155 const VArraySpan<bool> sharp_faces = *attributes.lookup<bool>("sharp_face",
1156 bke::AttrDomain::Face);
1157
1158 Array<bool> sharp_edges(mesh->edges_num);
1159 mesh_sharp_edges.materialize(sharp_edges);
1160
1161 threading::parallel_for(polys.index_range(), 1024, [&](const IndexRange range) {
1162 for (const int face_i : range) {
1163 if (!sharp_faces.is_empty() && sharp_faces[face_i]) {
1164 for (const int edge : corner_edges.slice(polys[face_i])) {
1165 sharp_edges[edge] = true;
1166 }
1167 }
1168 }
1169 });
1170
1171 IndexMaskMemory memory;
1172 const IndexMask split_mask = IndexMask::from_bools(sharp_edges, memory);
1173 if (split_mask.is_empty()) {
1174 return;
1175 }
1176
1177 geometry::split_edges(*mesh, split_mask, {});
1178}
const struct CustomDataLayer * BKE_id_attributes_color_find(const struct ID *id, const char *name)
void BKE_id_attributes_default_color_set(struct ID *id, const char *name)
Definition attribute.cc:994
void BKE_id_attributes_active_color_set(struct ID *id, const char *name)
Definition attribute.cc:965
std::string BKE_attribute_calc_unique_name(const AttributeOwner &owner, const blender::StringRef name)
Definition attribute.cc:359
struct CustomDataLayer * BKE_attribute_new(AttributeOwner &owner, const char *name, eCustomDataType type, blender::bke::AttrDomain domain, struct ReportList *reports)
bool BKE_color_attribute_supported(const struct Mesh &mesh, const blender::StringRef name)
bool BKE_attribute_remove(AttributeOwner &owner, const char *name, struct ReportList *reports)
Definition attribute.cc:501
const char * BKE_uv_map_pin_name_get(const char *uv_map_name, char *buffer)
const char * BKE_uv_map_vert_select_name_get(const char *uv_map_name, char *buffer)
const char * BKE_uv_map_edge_select_name_get(const char *uv_map_name, char *buffer)
PointerRNA CTX_data_pointer_get_type(const bContext *C, const char *member, StructRNA *type)
Scene * CTX_data_scene(const bContext *C)
CustomData interface, see also DNA_customdata_types.h.
void * CustomData_get_layer_named_for_write(CustomData *data, eCustomDataType type, blender::StringRef name, int totelem)
int CustomData_get_named_layer(const CustomData *data, eCustomDataType type, blender::StringRef name)
const void * CustomData_get_layer(const CustomData *data, eCustomDataType type)
int CustomData_get_n_offset(const CustomData *data, eCustomDataType type, int n)
@ CD_SET_DEFAULT
const void * CustomData_get_layer_named(const CustomData *data, eCustomDataType type, blender::StringRef name)
void * CustomData_add_layer_named(CustomData *data, eCustomDataType type, eCDAllocType alloctype, int totelem, blender::StringRef name)
bool CustomData_has_layer_named(const CustomData *data, eCustomDataType type, blender::StringRef name)
const char * CustomData_get_layer_name(const CustomData *data, eCustomDataType type, int n)
void CustomData_free(CustomData *data, int totelem)
void CustomData_free_layers(CustomData *data, eCustomDataType type, int totelem)
void CustomData_init_layout_from(const CustomData *source, CustomData *dest, eCustomDataMask mask, eCDAllocType alloctype, int totelem)
int CustomData_get_active_layer(const CustomData *data, eCustomDataType type)
void CustomData_free_elem(CustomData *data, int index, int count)
void CustomData_copy_data(const CustomData *source, CustomData *dest, int source_index, int dest_index, int count)
bool CustomData_has_layer(const CustomData *data, eCustomDataType type)
size_t CustomData_get_elem_size(const CustomDataLayer *layer)
void CustomData_ensure_layers_are_mutable(CustomData *data, int totelem)
void * CustomData_add_layer(CustomData *data, eCustomDataType type, eCDAllocType alloctype, int totelem)
bool CustomData_layertype_is_singleton(eCustomDataType type)
const char * CustomData_get_active_layer_name(const CustomData *data, eCustomDataType type)
const void * CustomData_add_layer_named_with_data(CustomData *data, eCustomDataType type, void *layer_data, int totelem, blender::StringRef name, const blender::ImplicitSharingInfo *sharing_info)
int CustomData_number_of_layers(const CustomData *data, eCustomDataType type)
void CustomData_set_layer_active(CustomData *data, eCustomDataType type, int n)
void * CustomData_get_layer_n_for_write(CustomData *data, eCustomDataType type, int n, int totelem)
const CustomData_MeshMasks CD_MASK_MESH
KeyBlock * BKE_keyblock_find_by_index(Key *key, int index)
Definition key.cc:1923
void BKE_mesh_tessface_clear(Mesh *mesh)
void BKE_mesh_ensure_skin_customdata(Mesh *mesh)
bool BKE_mesh_has_custom_loop_normals(Mesh *mesh)
void BKE_lnor_spacearr_clear(MLoopNorSpaceArray *lnors_spacearr)
void BKE_mesh_runtime_clear_cache(Mesh *mesh)
void BKE_reportf(ReportList *reports, eReportType type, const char *format,...) ATTR_PRINTF_FORMAT(3
void BKE_report(ReportList *reports, eReportType type, const char *message)
Definition report.cc:125
#define BLI_assert(a)
Definition BLI_assert.h:50
#define M_PI
#define DATA_(msgid)
void DEG_id_tag_update(ID *id, unsigned int flags)
@ ID_RECALC_GEOMETRY
Definition DNA_ID.h:1041
#define ID_IS_EDITABLE(_id)
Definition DNA_ID.h:658
#define ID_IS_OVERRIDE_LIBRARY(_id)
Definition DNA_ID.h:683
@ ID_ME
#define MAX_CUSTOMDATA_LAYER_NAME
@ CD_PROP_BYTE_COLOR
@ CD_MVERT_SKIN
@ CD_PROP_FLOAT
@ CD_CUSTOMLOOPNORMAL
@ CD_PROP_FLOAT3
@ CD_PROP_INT32_2D
@ CD_PROP_INT32
@ CD_PROP_FLOAT2
@ CD_GRID_PAINT_MASK
#define MAX_MTFACE
@ OB_MODE_SCULPT
@ OB_MODE_TEXTURE_PAINT
Object is a sort of wrapper for general info.
@ OB_MESH
@ SCE_SELECT_VERTEX
@ SCE_SELECT_EDGE
bool ED_paint_proj_mesh_data_check(Scene &scene, Object &ob, bool *r_has_uvs, bool *r_has_mat, bool *r_has_tex, bool *r_has_stencil)
bool ED_operator_editable_mesh(bContext *C)
Read Guarded memory(de)allocation.
@ OPTYPE_UNDO
Definition WM_types.hh:162
@ OPTYPE_REGISTER
Definition WM_types.hh:160
#define NC_GEOM
Definition WM_types.hh:360
#define ND_DATA
Definition WM_types.hh:475
#define NC_SCENE
Definition WM_types.hh:345
#define ND_TOOLSETTINGS
Definition WM_types.hh:416
@ BM_LOOP
@ BM_ELEM_SELECT
#define BM_ELEM_CD_GET_VOID_P(ele, offset)
#define BM_elem_flag_test(ele, hflag)
void BM_data_layer_free(BMesh *bm, CustomData *data, int type)
void BM_data_layer_copy(BMesh *bm, CustomData *data, int type, int src_n, int dst_n)
void BM_data_layer_add(BMesh *bm, CustomData *data, int type)
void BM_data_layer_add_named(BMesh *bm, CustomData *data, int type, const char *name)
void BM_uv_map_ensure_select_and_pin_attrs(BMesh *bm)
#define BM_ITER_MESH(ele, iter, bm, itype)
@ BM_FACES_OF_MESH
@ BM_LOOPS_OF_FACE
#define BM_ITER_ELEM_INDEX(ele, iter, data, itype, indexvar)
ATTR_WARN_UNUSED_RESULT BMesh * bm
#define BM_FACE
#define BM_EDGE
#define BM_VERT
ATTR_WARN_UNUSED_RESULT const BMLoop * l
static AttributeOwner from_id(ID *id)
Definition attribute.cc:43
const T * data() const
Definition BLI_array.hh:301
void materialize(MutableSpan< T > r_span) const
#define sinf(x)
#define cosf(x)
int len
draw_view in_light_buf[] float
int count
#define GS(x)
Definition iris.cc:202
void *(* MEM_dupallocN)(const void *vmemh)
Definition mallocn.cc:39
void MESH_OT_customdata_mask_clear(wmOperatorType *ot)
Definition mesh_data.cc:618
void ED_mesh_uv_ensure(Mesh *mesh, const char *name)
Definition mesh_data.cc:363
bool * ED_mesh_uv_map_vert_select_layer_ensure(Mesh *mesh, const int uv_index)
Definition mesh_data.cc:341
void ED_mesh_edges_remove(Mesh *mesh, ReportList *reports, int count)
static bool layers_poll(bContext *C)
Definition mesh_data.cc:451
const bool * ED_mesh_uv_map_edge_select_layer_get(const Mesh *mesh, const int uv_index)
Definition mesh_data.cc:309
static void mesh_uv_reset_bmface(BMFace *f, const int cd_loop_uv_offset)
Definition mesh_data.cc:151
static void mesh_remove_loops(Mesh *mesh, int len)
void ED_mesh_report_mirror_ex(wmOperator *op, int totmirr, int totfail, char selectmode)
bool ED_mesh_color_ensure(Mesh *mesh, const char *name)
Definition mesh_data.cc:423
void MESH_OT_customdata_skin_add(wmOperatorType *ot)
Definition mesh_data.cc:671
static int mesh_customdata_skin_clear_exec(bContext *C, wmOperator *)
Definition mesh_data.cc:691
const bool * ED_mesh_uv_map_vert_select_layer_get(const Mesh *mesh, const int uv_index)
Definition mesh_data.cc:301
static int mesh_uv_texture_remove_exec(bContext *C, wmOperator *op)
Definition mesh_data.cc:511
static int mesh_uv_texture_add_exec(bContext *C, wmOperator *op)
Definition mesh_data.cc:478
bool * ED_mesh_uv_map_edge_select_layer_ensure(Mesh *mesh, const int uv_index)
Definition mesh_data.cc:348
void MESH_OT_uv_texture_remove(wmOperatorType *ot)
Definition mesh_data.cc:535
static int mesh_customdata_clear_exec__internal(bContext *C, char htype, const eCustomDataType type)
Definition mesh_data.cc:552
void ED_mesh_edges_add(Mesh *mesh, ReportList *reports, int count)
Definition mesh_data.cc:949
static bool uv_texture_remove_poll(bContext *C)
Definition mesh_data.cc:461
void ED_mesh_loops_add(Mesh *mesh, ReportList *reports, int count)
Definition mesh_data.cc:958
void ED_mesh_report_mirror(wmOperator *op, int totmirr, int totfail)
void ED_mesh_verts_add(Mesh *mesh, ReportList *reports, int count)
Definition mesh_data.cc:940
static int mesh_customdata_mask_clear_exec(bContext *C, wmOperator *op)
Definition mesh_data.cc:604
void MESH_OT_customdata_skin_clear(wmOperatorType *ot)
Definition mesh_data.cc:696
static void mesh_remove_faces(Mesh *mesh, int len)
void ED_mesh_geometry_clear(Mesh *mesh)
static void mesh_add_edges(Mesh *mesh, int len)
Definition mesh_data.cc:824
void ED_mesh_faces_remove(Mesh *mesh, ReportList *reports, int count)
int ED_mesh_uv_add(Mesh *mesh, const char *name, const bool active_set, const bool do_init, ReportList *reports)
Definition mesh_data.cc:221
void ED_mesh_faces_add(Mesh *mesh, ReportList *reports, int count)
Definition mesh_data.cc:967
static bool mesh_customdata_skin_add_poll(bContext *C)
Definition mesh_data.cc:653
static CustomData * mesh_customdata_get_type(Mesh *mesh, const char htype, int *r_tot)
Definition mesh_data.cc:51
static void mesh_uv_reset_mface(const blender::IndexRange face, float2 *mloopuv)
Definition mesh_data.cc:165
void ED_mesh_loops_remove(Mesh *mesh, ReportList *reports, int count)
static void mesh_add_faces(Mesh *mesh, int len)
Definition mesh_data.cc:897
void ED_mesh_uv_loop_reset_ex(Mesh *mesh, const int layernum)
Definition mesh_data.cc:176
static bool * ensure_corner_boolean_attribute(Mesh &mesh, const blender::StringRefNull name)
Definition mesh_data.cc:330
bool * ED_mesh_uv_map_pin_layer_ensure(Mesh *mesh, const int uv_index)
Definition mesh_data.cc:355
void ED_mesh_uv_loop_reset(bContext *C, Mesh *mesh)
Definition mesh_data.cc:211
static int mesh_customdata_skin_state(bContext *C)
Definition mesh_data.cc:639
static const bool * mesh_loop_boolean_custom_data_get_by_name(const Mesh &mesh, const char *name)
Definition mesh_data.cc:295
static int mesh_customdata_custom_splitnormals_clear_exec(bContext *C, wmOperator *)
Definition mesh_data.cc:750
int ED_mesh_color_add(Mesh *mesh, const char *name, const bool active_set, const bool do_init, ReportList *reports)
Definition mesh_data.cc:381
void ED_mesh_split_faces(Mesh *mesh)
static int mesh_customdata_custom_splitnormals_add_exec(bContext *C, wmOperator *)
Definition mesh_data.cc:712
static void mesh_remove_verts(Mesh *mesh, int len)
Definition mesh_data.cc:982
static void mesh_add_verts(Mesh *mesh, int len)
Definition mesh_data.cc:793
void MESH_OT_uv_texture_add(wmOperatorType *ot)
Definition mesh_data.cc:496
static void mesh_add_loops(Mesh *mesh, int len)
Definition mesh_data.cc:860
static bool mesh_customdata_mask_clear_poll(bContext *C)
Definition mesh_data.cc:580
static void mesh_remove_edges(Mesh *mesh, int len)
Definition mesh_data.cc:993
static int mesh_customdata_skin_add_exec(bContext *C, wmOperator *)
Definition mesh_data.cc:658
KeyBlock * ED_mesh_get_edit_shape_key(const Mesh *me)
void MESH_OT_customdata_custom_splitnormals_add(wmOperatorType *ot)
Definition mesh_data.cc:735
static bool mesh_customdata_skin_clear_poll(bContext *C)
Definition mesh_data.cc:686
void ED_mesh_verts_remove(Mesh *mesh, ReportList *reports, int count)
static void mesh_uv_reset_array(float **fuv, const int len)
Definition mesh_data.cc:111
const bool * ED_mesh_uv_map_pin_layer_get(const Mesh *mesh, const int uv_index)
Definition mesh_data.cc:321
void MESH_OT_customdata_custom_splitnormals_clear(wmOperatorType *ot)
Definition mesh_data.cc:778
Mesh * ED_mesh_context(bContext *C)
Object * context_object(const bContext *C)
Object * context_active_object(const bContext *C)
static void unique_name(bNode *node)
int totvert
struct MLoopNorSpaceArray * lnor_spacearr
CustomData vdata
int totedge
CustomData edata
int totloop
CustomData pdata
CustomData ldata
int totface
Definition DNA_ID.h:413
MeshRuntimeHandle * runtime
struct Key * key
void * data
Definition RNA_types.hh:42
const char * name
Definition WM_types.hh:990
bool(* poll)(bContext *C) ATTR_WARN_UNUSED_RESULT
Definition WM_types.hh:1042
const char * idname
Definition WM_types.hh:992
int(* exec)(bContext *C, wmOperator *op) ATTR_WARN_UNUSED_RESULT
Definition WM_types.hh:1006
const char * description
Definition WM_types.hh:996
struct ReportList * reports
void WM_main_add_notifier(uint type, void *reference)
void WM_event_add_notifier(const bContext *C, uint type, void *reference)
wmOperatorType * ot
Definition wm_files.cc:4125