Blender  V3.3
rna_mesh.c
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 
3 /* NOTE: the original vertex color stuff is now just used for
4  * getting info on the layers themselves, accessing the data is
5  * done through the (not yet written) mpoly interfaces. */
6 
11 #include <stdlib.h>
12 
13 #include "MEM_guardedalloc.h"
14 
15 #include "DNA_material_types.h"
16 #include "DNA_mesh_types.h"
17 #include "DNA_meshdata_types.h"
18 #include "DNA_object_types.h"
19 
20 #include "BLI_math_base.h"
21 #include "BLI_math_rotation.h"
22 #include "BLI_utildefines.h"
23 
24 #include "BKE_attribute.h"
25 #include "BKE_editmesh.h"
26 
27 #include "RNA_access.h"
28 #include "RNA_define.h"
29 #include "RNA_enum_types.h"
30 #include "RNA_types.h"
31 
32 #include "rna_internal.h"
33 
34 #include "WM_types.h"
35 
37  {BMO_DELIM_NORMAL, "NORMAL", 0, "Normal", "Delimit by face directions"},
38  {BMO_DELIM_MATERIAL, "MATERIAL", 0, "Material", "Delimit by face material"},
39  {BMO_DELIM_SEAM, "SEAM", 0, "Seam", "Delimit by edge seams"},
40  {BMO_DELIM_SHARP, "SHARP", 0, "Sharp", "Delimit by sharp edges"},
41  {BMO_DELIM_UV, "UV", 0, "UVs", "Delimit by UV coordinates"},
42  {0, NULL, 0, NULL, NULL},
43 };
44 
46  {REMESH_VOXEL, "VOXEL", 0, "Voxel", "Use the voxel remesher"},
47  {REMESH_QUAD, "QUAD", 0, "Quad", "Use the quad remesher"},
48  {0, NULL, 0, NULL, NULL},
49 };
50 
51 #ifdef RNA_RUNTIME
52 
53 # include "DNA_scene_types.h"
54 
55 # include "BLI_math.h"
56 
57 # include "BKE_customdata.h"
58 # include "BKE_main.h"
59 # include "BKE_mesh.h"
60 # include "BKE_mesh_runtime.h"
61 # include "BKE_report.h"
62 
63 # include "DEG_depsgraph.h"
64 
65 # include "ED_mesh.h" /* XXX Bad level call */
66 
67 # include "WM_api.h"
68 
69 # include "rna_mesh_utils.h"
70 
71 /* -------------------------------------------------------------------- */
75 static Mesh *rna_mesh(const PointerRNA *ptr)
76 {
77  Mesh *me = (Mesh *)ptr->owner_id;
78  return me;
79 }
80 
81 static CustomData *rna_mesh_vdata_helper(Mesh *me)
82 {
83  return (me->edit_mesh) ? &me->edit_mesh->bm->vdata : &me->vdata;
84 }
85 
86 static CustomData *rna_mesh_edata_helper(Mesh *me)
87 {
88  return (me->edit_mesh) ? &me->edit_mesh->bm->edata : &me->edata;
89 }
90 
91 static CustomData *rna_mesh_pdata_helper(Mesh *me)
92 {
93  return (me->edit_mesh) ? &me->edit_mesh->bm->pdata : &me->pdata;
94 }
95 
96 static CustomData *rna_mesh_ldata_helper(Mesh *me)
97 {
98  return (me->edit_mesh) ? &me->edit_mesh->bm->ldata : &me->ldata;
99 }
100 
101 static CustomData *rna_mesh_fdata_helper(Mesh *me)
102 {
103  return (me->edit_mesh) ? NULL : &me->fdata;
104 }
105 
106 static CustomData *rna_mesh_vdata(const PointerRNA *ptr)
107 {
108  Mesh *me = rna_mesh(ptr);
109  return rna_mesh_vdata_helper(me);
110 }
111 # if 0
112 static CustomData *rna_mesh_edata(PointerRNA *ptr)
113 {
114  Mesh *me = rna_mesh(ptr);
115  return rna_mesh_edata_helper(me);
116 }
117 # endif
118 static CustomData *rna_mesh_pdata(const PointerRNA *ptr)
119 {
120  Mesh *me = rna_mesh(ptr);
121  return rna_mesh_pdata_helper(me);
122 }
123 
124 static CustomData *rna_mesh_ldata(const PointerRNA *ptr)
125 {
126  Mesh *me = rna_mesh(ptr);
127  return rna_mesh_ldata_helper(me);
128 }
129 
132 /* -------------------------------------------------------------------- */
136 static void rna_cd_layer_name_set(CustomData *cdata, CustomDataLayer *cdl, const char *value)
137 {
138  BLI_strncpy_utf8(cdl->name, value, sizeof(cdl->name));
139  CustomData_set_layer_unique_name(cdata, cdl - cdata->layers);
140 }
141 
142 /* avoid using where possible!, ideally the type is known */
143 static CustomData *rna_cd_from_layer(PointerRNA *ptr, CustomDataLayer *cdl)
144 {
145  /* find out where we come from by */
146  Mesh *me = (Mesh *)ptr->owner_id;
147  CustomData *cd;
148 
149  /* rely on negative values wrapping */
150 # define TEST_CDL(cmd) \
151  if ((void)(cd = cmd(me)), ARRAY_HAS_ITEM(cdl, cd->layers, cd->totlayer)) { \
152  return cd; \
153  } \
154  ((void)0)
155 
156  TEST_CDL(rna_mesh_vdata_helper);
157  TEST_CDL(rna_mesh_edata_helper);
158  TEST_CDL(rna_mesh_pdata_helper);
159  TEST_CDL(rna_mesh_ldata_helper);
160  TEST_CDL(rna_mesh_fdata_helper);
161 
162 # undef TEST_CDL
163 
164  /* should _never_ happen */
165  return NULL;
166 }
167 
168 static void rna_MeshVertexLayer_name_set(PointerRNA *ptr, const char *value)
169 {
171 
173  BKE_id_attribute_rename(ptr->owner_id, layer->name, value, NULL);
174  }
175  else {
176  rna_cd_layer_name_set(rna_mesh_vdata(ptr), layer, value);
177  }
178 }
179 # if 0
180 static void rna_MeshEdgeLayer_name_set(PointerRNA *ptr, const char *value)
181 {
183 
185  BKE_id_attribute_rename(ptr->owner_id, layer->name, value, NULL);
186  }
187  else {
188  rna_cd_layer_name_set(rna_mesh_edata(ptr), layer, value);
189  }
190 }
191 # endif
192 static void rna_MeshPolyLayer_name_set(PointerRNA *ptr, const char *value)
193 {
195 
197  BKE_id_attribute_rename(ptr->owner_id, layer->name, value, NULL);
198  }
199  else {
200  rna_cd_layer_name_set(rna_mesh_pdata(ptr), layer, value);
201  }
202 }
203 static void rna_MeshLoopLayer_name_set(PointerRNA *ptr, const char *value)
204 {
206 
208  BKE_id_attribute_rename(ptr->owner_id, layer->name, value, NULL);
209  }
210  else {
211  rna_cd_layer_name_set(rna_mesh_ldata(ptr), layer, value);
212  }
213 }
214 /* only for layers shared between types */
215 static void rna_MeshAnyLayer_name_set(PointerRNA *ptr, const char *value)
216 {
218 
220  BKE_id_attribute_rename(ptr->owner_id, layer->name, value, NULL);
221  }
222  else {
223  CustomData *cd = rna_cd_from_layer(ptr, layer);
224  rna_cd_layer_name_set(cd, layer, value);
225  }
226 }
227 
228 static bool rna_Mesh_has_custom_normals_get(PointerRNA *ptr)
229 {
230  Mesh *me = ptr->data;
232 }
233 
236 /* -------------------------------------------------------------------- */
251 static void rna_Mesh_update_data_legacy_deg_tag_all(Main *UNUSED(bmain),
252  Scene *UNUSED(scene),
253  PointerRNA *ptr)
254 {
255  ID *id = ptr->owner_id;
256  if (id->us <= 0) { /* See note in section heading. */
257  return;
258  }
259 
260  DEG_id_tag_update(id, 0);
262 }
263 
264 static void rna_Mesh_update_geom_and_params(Main *UNUSED(bmain),
265  Scene *UNUSED(scene),
266  PointerRNA *ptr)
267 {
268  ID *id = ptr->owner_id;
269  if (id->us <= 0) { /* See note in section heading. */
270  return;
271  }
272 
275 }
276 
277 static void rna_Mesh_update_data_edit_weight(Main *bmain, Scene *scene, PointerRNA *ptr)
278 {
280 
281  rna_Mesh_update_data_legacy_deg_tag_all(bmain, scene, ptr);
282 }
283 
284 static void rna_Mesh_update_data_edit_active_color(Main *bmain, Scene *scene, PointerRNA *ptr)
285 {
287 
288  rna_Mesh_update_data_legacy_deg_tag_all(bmain, scene, ptr);
289 }
290 static void rna_Mesh_update_select(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
291 {
292  ID *id = ptr->owner_id;
293  if (id->us <= 0) { /* See note in section heading. */
294  return;
295  }
296 
298 }
299 
301 {
302  ID *id = ptr->owner_id;
303  if (id->us <= 0) { /* See note in section heading. */
304  return;
305  }
306 
308 }
309 
310 static void rna_Mesh_update_vertmask(Main *bmain, Scene *scene, PointerRNA *ptr)
311 {
312  Mesh *me = ptr->data;
315  }
316 
318 
319  rna_Mesh_update_draw(bmain, scene, ptr);
320 }
321 
322 static void rna_Mesh_update_facemask(Main *bmain, Scene *scene, PointerRNA *ptr)
323 {
324  Mesh *me = ptr->data;
327  }
328 
330 
331  rna_Mesh_update_draw(bmain, scene, ptr);
332 }
333 
334 static void rna_Mesh_update_positions_tag(Main *bmain, Scene *scene, PointerRNA *ptr)
335 {
336  Mesh *mesh = rna_mesh(ptr);
338  rna_Mesh_update_data_legacy_deg_tag_all(bmain, scene, ptr);
339 }
340 
343 /* -------------------------------------------------------------------- */
347 static void rna_MeshVertex_normal_get(PointerRNA *ptr, float *value)
348 {
349  Mesh *mesh = rna_mesh(ptr);
350  const float(*vert_normals)[3] = BKE_mesh_vertex_normals_ensure(mesh);
351 
352  const int index = (MVert *)ptr->data - mesh->mvert;
353  BLI_assert(index >= 0);
354  BLI_assert(index < mesh->totvert);
355 
356  copy_v3_v3(value, vert_normals[index]);
357 }
358 
359 static float rna_MeshVertex_bevel_weight_get(PointerRNA *ptr)
360 {
361  MVert *mvert = (MVert *)ptr->data;
362  return mvert->bweight / 255.0f;
363 }
364 
365 static void rna_MeshVertex_bevel_weight_set(PointerRNA *ptr, float value)
366 {
367  MVert *mvert = (MVert *)ptr->data;
368  mvert->bweight = round_fl_to_uchar_clamp(value * 255.0f);
369 }
370 
371 static float rna_MEdge_bevel_weight_get(PointerRNA *ptr)
372 {
373  MEdge *medge = (MEdge *)ptr->data;
374  return medge->bweight / 255.0f;
375 }
376 
377 static void rna_MEdge_bevel_weight_set(PointerRNA *ptr, float value)
378 {
379  MEdge *medge = (MEdge *)ptr->data;
380  medge->bweight = round_fl_to_uchar_clamp(value * 255.0f);
381 }
382 
383 static float rna_MEdge_crease_get(PointerRNA *ptr)
384 {
385  MEdge *medge = (MEdge *)ptr->data;
386  return medge->crease / 255.0f;
387 }
388 
389 static void rna_MEdge_crease_set(PointerRNA *ptr, float value)
390 {
391  MEdge *medge = (MEdge *)ptr->data;
392  medge->crease = round_fl_to_uchar_clamp(value * 255.0f);
393 }
394 
395 static void rna_MeshLoop_normal_get(PointerRNA *ptr, float *values)
396 {
397  Mesh *me = rna_mesh(ptr);
398  MLoop *ml = (MLoop *)ptr->data;
399  const float(*vec)[3] = CustomData_get(&me->ldata, (int)(ml - me->mloop), CD_NORMAL);
400 
401  if (!vec) {
402  zero_v3(values);
403  }
404  else {
405  copy_v3_v3(values, (const float *)vec);
406  }
407 }
408 
409 static void rna_MeshLoop_normal_set(PointerRNA *ptr, const float *values)
410 {
411  Mesh *me = rna_mesh(ptr);
412  MLoop *ml = (MLoop *)ptr->data;
413  float(*vec)[3] = CustomData_get(&me->ldata, (int)(ml - me->mloop), CD_NORMAL);
414 
415  if (vec) {
416  normalize_v3_v3(*vec, values);
417  }
418 }
419 
420 static void rna_MeshLoop_tangent_get(PointerRNA *ptr, float *values)
421 {
422  Mesh *me = rna_mesh(ptr);
423  MLoop *ml = (MLoop *)ptr->data;
424  const float(*vec)[4] = CustomData_get(&me->ldata, (int)(ml - me->mloop), CD_MLOOPTANGENT);
425 
426  if (!vec) {
427  zero_v3(values);
428  }
429  else {
430  copy_v3_v3(values, (const float *)vec);
431  }
432 }
433 
434 static float rna_MeshLoop_bitangent_sign_get(PointerRNA *ptr)
435 {
436  Mesh *me = rna_mesh(ptr);
437  MLoop *ml = (MLoop *)ptr->data;
438  const float(*vec)[4] = CustomData_get(&me->ldata, (int)(ml - me->mloop), CD_MLOOPTANGENT);
439 
440  return (vec) ? (*vec)[3] : 0.0f;
441 }
442 
443 static void rna_MeshLoop_bitangent_get(PointerRNA *ptr, float *values)
444 {
445  Mesh *me = rna_mesh(ptr);
446  MLoop *ml = (MLoop *)ptr->data;
447  const float(*nor)[3] = CustomData_get(&me->ldata, (int)(ml - me->mloop), CD_NORMAL);
448  const float(*vec)[4] = CustomData_get(&me->ldata, (int)(ml - me->mloop), CD_MLOOPTANGENT);
449 
450  if (nor && vec) {
451  cross_v3_v3v3(values, (const float *)nor, (const float *)vec);
452  mul_v3_fl(values, (*vec)[3]);
453  }
454  else {
455  zero_v3(values);
456  }
457 }
458 
459 static void rna_MeshPolygon_normal_get(PointerRNA *ptr, float *values)
460 {
461  Mesh *me = rna_mesh(ptr);
462  MPoly *mp = (MPoly *)ptr->data;
463 
464  BKE_mesh_calc_poly_normal(mp, me->mloop + mp->loopstart, me->mvert, values);
465 }
466 
467 static void rna_MeshPolygon_center_get(PointerRNA *ptr, float *values)
468 {
469  Mesh *me = rna_mesh(ptr);
470  MPoly *mp = (MPoly *)ptr->data;
471 
472  BKE_mesh_calc_poly_center(mp, me->mloop + mp->loopstart, me->mvert, values);
473 }
474 
475 static float rna_MeshPolygon_area_get(PointerRNA *ptr)
476 {
477  Mesh *me = (Mesh *)ptr->owner_id;
478  MPoly *mp = (MPoly *)ptr->data;
479 
480  return BKE_mesh_calc_poly_area(mp, me->mloop + mp->loopstart, me->mvert);
481 }
482 
483 static void rna_MeshPolygon_flip(ID *id, MPoly *mp)
484 {
485  Mesh *me = (Mesh *)id;
486 
487  BKE_mesh_polygon_flip(mp, me->mloop, &me->ldata);
491 }
492 
493 static void rna_MeshLoopTriangle_verts_get(PointerRNA *ptr, int *values)
494 {
495  Mesh *me = rna_mesh(ptr);
496  MLoopTri *lt = (MLoopTri *)ptr->data;
497  values[0] = me->mloop[lt->tri[0]].v;
498  values[1] = me->mloop[lt->tri[1]].v;
499  values[2] = me->mloop[lt->tri[2]].v;
500 }
501 
502 static void rna_MeshLoopTriangle_normal_get(PointerRNA *ptr, float *values)
503 {
504  Mesh *me = rna_mesh(ptr);
505  MLoopTri *lt = (MLoopTri *)ptr->data;
506  unsigned int v1 = me->mloop[lt->tri[0]].v;
507  unsigned int v2 = me->mloop[lt->tri[1]].v;
508  unsigned int v3 = me->mloop[lt->tri[2]].v;
509 
510  normal_tri_v3(values, me->mvert[v1].co, me->mvert[v2].co, me->mvert[v3].co);
511 }
512 
513 static void rna_MeshLoopTriangle_split_normals_get(PointerRNA *ptr, float *values)
514 {
515  Mesh *me = rna_mesh(ptr);
516  const float(*lnors)[3] = CustomData_get_layer(&me->ldata, CD_NORMAL);
517 
518  if (!lnors) {
519  zero_v3(values + 0);
520  zero_v3(values + 3);
521  zero_v3(values + 6);
522  }
523  else {
524  MLoopTri *lt = (MLoopTri *)ptr->data;
525  copy_v3_v3(values + 0, lnors[lt->tri[0]]);
526  copy_v3_v3(values + 3, lnors[lt->tri[1]]);
527  copy_v3_v3(values + 6, lnors[lt->tri[2]]);
528  }
529 }
530 
531 static float rna_MeshLoopTriangle_area_get(PointerRNA *ptr)
532 {
533  Mesh *me = rna_mesh(ptr);
534  MLoopTri *lt = (MLoopTri *)ptr->data;
535  unsigned int v1 = me->mloop[lt->tri[0]].v;
536  unsigned int v2 = me->mloop[lt->tri[1]].v;
537  unsigned int v3 = me->mloop[lt->tri[2]].v;
538 
539  return area_tri_v3(me->mvert[v1].co, me->mvert[v2].co, me->mvert[v3].co);
540 }
541 
542 static void rna_MeshLoopColor_color_get(PointerRNA *ptr, float *values)
543 {
544  MLoopCol *mlcol = (MLoopCol *)ptr->data;
545 
546  values[0] = mlcol->r / 255.0f;
547  values[1] = mlcol->g / 255.0f;
548  values[2] = mlcol->b / 255.0f;
549  values[3] = mlcol->a / 255.0f;
550 }
551 
552 static void rna_MeshLoopColor_color_set(PointerRNA *ptr, const float *values)
553 {
554  MLoopCol *mlcol = (MLoopCol *)ptr->data;
555 
556  mlcol->r = round_fl_to_uchar_clamp(values[0] * 255.0f);
557  mlcol->g = round_fl_to_uchar_clamp(values[1] * 255.0f);
558  mlcol->b = round_fl_to_uchar_clamp(values[2] * 255.0f);
559  mlcol->a = round_fl_to_uchar_clamp(values[3] * 255.0f);
560 }
561 
562 static int rna_Mesh_texspace_editable(PointerRNA *ptr, const char **UNUSED(r_info))
563 {
564  Mesh *me = (Mesh *)ptr->data;
566 }
567 
568 static void rna_Mesh_texspace_size_get(PointerRNA *ptr, float values[3])
569 {
570  Mesh *me = (Mesh *)ptr->data;
571 
573 
574  copy_v3_v3(values, me->size);
575 }
576 
577 static void rna_Mesh_texspace_loc_get(PointerRNA *ptr, float values[3])
578 {
579  Mesh *me = (Mesh *)ptr->data;
580 
582 
583  copy_v3_v3(values, me->loc);
584 }
585 
586 static void rna_MeshVertex_groups_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
587 {
588  Mesh *me = rna_mesh(ptr);
589 
590  if (me->dvert) {
591  MVert *mvert = (MVert *)ptr->data;
592  MDeformVert *dvert = me->dvert + (mvert - me->mvert);
593 
595  iter, (void *)dvert->dw, sizeof(MDeformWeight), dvert->totweight, 0, NULL);
596  }
597  else {
598  rna_iterator_array_begin(iter, NULL, 0, 0, 0, NULL);
599  }
600 }
601 
602 static void rna_MeshVertex_undeformed_co_get(PointerRNA *ptr, float values[3])
603 {
604  Mesh *me = rna_mesh(ptr);
605  MVert *mvert = (MVert *)ptr->data;
606  const float(*orco)[3] = CustomData_get_layer(&me->vdata, CD_ORCO);
607 
608  if (orco) {
609  /* orco is normalized to 0..1, we do inverse to match mvert->co */
610  float loc[3], size[3];
611 
612  BKE_mesh_texspace_get(me->texcomesh ? me->texcomesh : me, loc, size);
613  madd_v3_v3v3v3(values, loc, orco[(mvert - me->mvert)], size);
614  }
615  else {
616  copy_v3_v3(values, mvert->co);
617  }
618 }
619 
620 static int rna_CustomDataLayer_active_get(PointerRNA *ptr, CustomData *data, int type, bool render)
621 {
622  int n = ((CustomDataLayer *)ptr->data) - data->layers;
623 
624  if (render) {
626  }
627  else {
629  }
630 }
631 
632 static int rna_CustomDataLayer_clone_get(PointerRNA *ptr, CustomData *data, int type)
633 {
634  int n = ((CustomDataLayer *)ptr->data) - data->layers;
635 
637 }
638 
639 static void rna_CustomDataLayer_active_set(
640  PointerRNA *ptr, CustomData *data, int value, int type, int render)
641 {
642  Mesh *me = (Mesh *)ptr->owner_id;
643  int n = (((CustomDataLayer *)ptr->data) - data->layers) - CustomData_get_layer_index(data, type);
644 
645  if (value == 0) {
646  return;
647  }
648 
649  if (render) {
651  }
652  else {
654  }
655 
657 }
658 
659 static void rna_CustomDataLayer_clone_set(PointerRNA *ptr, CustomData *data, int value, int type)
660 {
661  int n = ((CustomDataLayer *)ptr->data) - data->layers;
662 
663  if (value == 0) {
664  return;
665  }
666 
668 }
669 
670 static bool rna_MEdge_freestyle_edge_mark_get(PointerRNA *ptr)
671 {
672  const Mesh *me = rna_mesh(ptr);
673  const MEdge *medge = (MEdge *)ptr->data;
674  const FreestyleEdge *fed = CustomData_get(
675  &me->edata, (int)(medge - me->medge), CD_FREESTYLE_EDGE);
676 
677  return fed && (fed->flag & FREESTYLE_EDGE_MARK) != 0;
678 }
679 
680 static void rna_MEdge_freestyle_edge_mark_set(PointerRNA *ptr, bool value)
681 {
682  Mesh *me = rna_mesh(ptr);
683  MEdge *medge = (MEdge *)ptr->data;
684  FreestyleEdge *fed = CustomData_get(&me->edata, (int)(medge - me->medge), CD_FREESTYLE_EDGE);
685 
686  if (!fed) {
688  }
689  if (value) {
690  fed->flag |= FREESTYLE_EDGE_MARK;
691  }
692  else {
693  fed->flag &= ~FREESTYLE_EDGE_MARK;
694  }
695 }
696 
697 static bool rna_MPoly_freestyle_face_mark_get(PointerRNA *ptr)
698 {
699  const Mesh *me = rna_mesh(ptr);
700  const MPoly *mpoly = (MPoly *)ptr->data;
701  const FreestyleFace *ffa = CustomData_get(
702  &me->pdata, (int)(mpoly - me->mpoly), CD_FREESTYLE_FACE);
703 
704  return ffa && (ffa->flag & FREESTYLE_FACE_MARK) != 0;
705 }
706 
707 static void rna_MPoly_freestyle_face_mark_set(PointerRNA *ptr, int value)
708 {
709  Mesh *me = rna_mesh(ptr);
710  MPoly *mpoly = (MPoly *)ptr->data;
711  FreestyleFace *ffa = CustomData_get(&me->pdata, (int)(mpoly - me->mpoly), CD_FREESTYLE_FACE);
712 
713  if (!ffa) {
715  }
716  if (value) {
717  ffa->flag |= FREESTYLE_FACE_MARK;
718  }
719  else {
720  ffa->flag &= ~FREESTYLE_FACE_MARK;
721  }
722 }
723 
724 /* uv_layers */
725 
727 DEFINE_CUSTOMDATA_LAYER_COLLECTION_ACTIVEITEM(uv_layer, ldata, CD_MLOOPUV, active, MeshUVLoopLayer)
728 DEFINE_CUSTOMDATA_LAYER_COLLECTION_ACTIVEITEM(uv_layer, ldata, CD_MLOOPUV, clone, MeshUVLoopLayer)
730  uv_layer, ldata, CD_MLOOPUV, stencil, MeshUVLoopLayer)
731 DEFINE_CUSTOMDATA_LAYER_COLLECTION_ACTIVEITEM(uv_layer, ldata, CD_MLOOPUV, render, MeshUVLoopLayer)
732 
733 /* MeshUVLoopLayer */
734 
735 static char *rna_MeshUVLoopLayer_path(const PointerRNA *ptr)
736 {
737  const CustomDataLayer *cdl = ptr->data;
738  char name_esc[sizeof(cdl->name) * 2];
739  BLI_str_escape(name_esc, cdl->name, sizeof(name_esc));
740  return BLI_sprintfN("uv_layers[\"%s\"]", name_esc);
741 }
742 
743 static void rna_MeshUVLoopLayer_data_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
744 {
745  Mesh *me = rna_mesh(ptr);
748  iter, layer->data, sizeof(MLoopUV), (me->edit_mesh) ? 0 : me->totloop, 0, NULL);
749 }
750 
751 static int rna_MeshUVLoopLayer_data_length(PointerRNA *ptr)
752 {
753  Mesh *me = rna_mesh(ptr);
754  return (me->edit_mesh) ? 0 : me->totloop;
755 }
756 
757 static bool rna_MeshUVLoopLayer_active_render_get(PointerRNA *ptr)
758 {
759  return rna_CustomDataLayer_active_get(ptr, rna_mesh_ldata(ptr), CD_MLOOPUV, 1);
760 }
761 
762 static bool rna_MeshUVLoopLayer_active_get(PointerRNA *ptr)
763 {
764  return rna_CustomDataLayer_active_get(ptr, rna_mesh_ldata(ptr), CD_MLOOPUV, 0);
765 }
766 
767 static bool rna_MeshUVLoopLayer_clone_get(PointerRNA *ptr)
768 {
769  return rna_CustomDataLayer_clone_get(ptr, rna_mesh_ldata(ptr), CD_MLOOPUV);
770 }
771 
772 static void rna_MeshUVLoopLayer_active_render_set(PointerRNA *ptr, bool value)
773 {
774  rna_CustomDataLayer_active_set(ptr, rna_mesh_ldata(ptr), value, CD_MLOOPUV, 1);
775 }
776 
777 static void rna_MeshUVLoopLayer_active_set(PointerRNA *ptr, bool value)
778 {
779  rna_CustomDataLayer_active_set(ptr, rna_mesh_ldata(ptr), value, CD_MLOOPUV, 0);
780 }
781 
782 static void rna_MeshUVLoopLayer_clone_set(PointerRNA *ptr, bool value)
783 {
784  rna_CustomDataLayer_clone_set(ptr, rna_mesh_ldata(ptr), value, CD_MLOOPUV);
785 }
786 
787 /* vertex_color_layers */
788 
791  vertex_color, ldata, CD_PROP_BYTE_COLOR, active, MeshLoopColorLayer)
792 
793 static void rna_MeshLoopColorLayer_data_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
794 {
795  Mesh *me = rna_mesh(ptr);
798  iter, layer->data, sizeof(MLoopCol), (me->edit_mesh) ? 0 : me->totloop, 0, NULL);
799 }
800 
801 static int rna_MeshLoopColorLayer_data_length(PointerRNA *ptr)
802 {
803  Mesh *me = rna_mesh(ptr);
804  return (me->edit_mesh) ? 0 : me->totloop;
805 }
806 
807 static bool rna_MeshLoopColorLayer_active_render_get(PointerRNA *ptr)
808 {
809  return rna_CustomDataLayer_active_get(ptr, rna_mesh_ldata(ptr), CD_PROP_BYTE_COLOR, 1);
810 }
811 
812 static bool rna_MeshLoopColorLayer_active_get(PointerRNA *ptr)
813 {
814  return rna_CustomDataLayer_active_get(ptr, rna_mesh_ldata(ptr), CD_PROP_BYTE_COLOR, 0);
815 }
816 
817 static void rna_MeshLoopColorLayer_active_render_set(PointerRNA *ptr, bool value)
818 {
819  rna_CustomDataLayer_active_set(ptr, rna_mesh_ldata(ptr), value, CD_PROP_BYTE_COLOR, 1);
820 }
821 
822 static void rna_MeshLoopColorLayer_active_set(PointerRNA *ptr, bool value)
823 {
824  rna_CustomDataLayer_active_set(ptr, rna_mesh_ldata(ptr), value, CD_PROP_BYTE_COLOR, 0);
825 }
826 
827 /* sculpt_vertex_color_layers */
828 
829 DEFINE_CUSTOMDATA_LAYER_COLLECTION(sculpt_vertex_color, vdata, CD_PROP_COLOR)
831  sculpt_vertex_color, vdata, CD_PROP_COLOR, active, MeshVertColorLayer)
832 
833 static void rna_MeshVertColorLayer_data_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
834 {
835  Mesh *me = rna_mesh(ptr);
838  iter, layer->data, sizeof(MPropCol), (me->edit_mesh) ? 0 : me->totvert, 0, NULL);
839 }
840 
841 static int rna_MeshVertColorLayer_data_length(PointerRNA *ptr)
842 {
843  Mesh *me = rna_mesh(ptr);
844  return (me->edit_mesh) ? 0 : me->totvert;
845 }
846 
847 static bool rna_MeshVertColorLayer_active_render_get(PointerRNA *ptr)
848 {
849  return rna_CustomDataLayer_active_get(ptr, rna_mesh_vdata(ptr), CD_PROP_COLOR, 1);
850 }
851 
852 static bool rna_MeshVertColorLayer_active_get(PointerRNA *ptr)
853 {
854  return rna_CustomDataLayer_active_get(ptr, rna_mesh_vdata(ptr), CD_PROP_COLOR, 0);
855 }
856 
857 static void rna_MeshVertColorLayer_active_render_set(PointerRNA *ptr, bool value)
858 {
859  rna_CustomDataLayer_active_set(ptr, rna_mesh_vdata(ptr), value, CD_PROP_COLOR, 1);
860 }
861 
862 static void rna_MeshVertColorLayer_active_set(PointerRNA *ptr, bool value)
863 {
864  rna_CustomDataLayer_active_set(ptr, rna_mesh_vdata(ptr), value, CD_PROP_COLOR, 0);
865 }
866 
867 static int rna_float_layer_check(CollectionPropertyIterator *UNUSED(iter), void *data)
868 {
870  return (layer->type != CD_PROP_FLOAT);
871 }
872 
873 static void rna_Mesh_vertex_float_layers_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
874 {
875  CustomData *vdata = rna_mesh_vdata(ptr);
877  (void *)vdata->layers,
878  sizeof(CustomDataLayer),
879  vdata->totlayer,
880  0,
881  rna_float_layer_check);
882 }
883 static void rna_Mesh_polygon_float_layers_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
884 {
885  CustomData *pdata = rna_mesh_pdata(ptr);
887  (void *)pdata->layers,
888  sizeof(CustomDataLayer),
889  pdata->totlayer,
890  0,
891  rna_float_layer_check);
892 }
893 
894 static int rna_Mesh_vertex_float_layers_length(PointerRNA *ptr)
895 {
896  return CustomData_number_of_layers(rna_mesh_vdata(ptr), CD_PROP_FLOAT);
897 }
898 static int rna_Mesh_polygon_float_layers_length(PointerRNA *ptr)
899 {
900  return CustomData_number_of_layers(rna_mesh_pdata(ptr), CD_PROP_FLOAT);
901 }
902 
903 static int rna_int_layer_check(CollectionPropertyIterator *UNUSED(iter), void *data)
904 {
906  return (layer->type != CD_PROP_INT32);
907 }
908 
909 static void rna_Mesh_vertex_int_layers_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
910 {
911  CustomData *vdata = rna_mesh_vdata(ptr);
913  (void *)vdata->layers,
914  sizeof(CustomDataLayer),
915  vdata->totlayer,
916  0,
917  rna_int_layer_check);
918 }
919 static void rna_Mesh_polygon_int_layers_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
920 {
921  CustomData *pdata = rna_mesh_pdata(ptr);
923  (void *)pdata->layers,
924  sizeof(CustomDataLayer),
925  pdata->totlayer,
926  0,
927  rna_int_layer_check);
928 }
929 
930 static int rna_Mesh_vertex_int_layers_length(PointerRNA *ptr)
931 {
932  return CustomData_number_of_layers(rna_mesh_vdata(ptr), CD_PROP_INT32);
933 }
934 static int rna_Mesh_polygon_int_layers_length(PointerRNA *ptr)
935 {
936  return CustomData_number_of_layers(rna_mesh_pdata(ptr), CD_PROP_INT32);
937 }
938 
939 static int rna_string_layer_check(CollectionPropertyIterator *UNUSED(iter), void *data)
940 {
942  return (layer->type != CD_PROP_STRING);
943 }
944 
945 static void rna_Mesh_vertex_string_layers_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
946 {
947  CustomData *vdata = rna_mesh_vdata(ptr);
949  (void *)vdata->layers,
950  sizeof(CustomDataLayer),
951  vdata->totlayer,
952  0,
953  rna_string_layer_check);
954 }
955 static void rna_Mesh_polygon_string_layers_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
956 {
957  CustomData *pdata = rna_mesh_pdata(ptr);
959  (void *)pdata->layers,
960  sizeof(CustomDataLayer),
961  pdata->totlayer,
962  0,
963  rna_string_layer_check);
964 }
965 
966 static int rna_Mesh_vertex_string_layers_length(PointerRNA *ptr)
967 {
968  return CustomData_number_of_layers(rna_mesh_vdata(ptr), CD_PROP_STRING);
969 }
970 static int rna_Mesh_polygon_string_layers_length(PointerRNA *ptr)
971 {
972  return CustomData_number_of_layers(rna_mesh_pdata(ptr), CD_PROP_STRING);
973 }
974 
975 /* Skin vertices */
977 
978 static char *rna_MeshSkinVertexLayer_path(const PointerRNA *ptr)
979 {
980  const CustomDataLayer *cdl = ptr->data;
981  char name_esc[sizeof(cdl->name) * 2];
982  BLI_str_escape(name_esc, cdl->name, sizeof(name_esc));
983  return BLI_sprintfN("skin_vertices[\"%s\"]", name_esc);
984 }
985 
986 static char *rna_VertCustomData_data_path(const PointerRNA *ptr, const char *collection, int type);
987 static char *rna_MeshSkinVertex_path(const PointerRNA *ptr)
988 {
989  return rna_VertCustomData_data_path(ptr, "skin_vertices", CD_MVERT_SKIN);
990 }
991 
992 static void rna_MeshSkinVertexLayer_data_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
993 {
994  Mesh *me = rna_mesh(ptr);
996  rna_iterator_array_begin(iter, layer->data, sizeof(MVertSkin), me->totvert, 0, NULL);
997 }
998 
999 static int rna_MeshSkinVertexLayer_data_length(PointerRNA *ptr)
1000 {
1001  Mesh *me = rna_mesh(ptr);
1002  return me->totvert;
1003 }
1004 
1005 /* End skin vertices */
1006 
1007 /* Vertex creases */
1008 DEFINE_CUSTOMDATA_LAYER_COLLECTION(vertex_crease, vdata, CD_CREASE)
1009 
1010 static char *rna_MeshVertexCreaseLayer_path(const PointerRNA *ptr)
1011 {
1012  return rna_VertCustomData_data_path(ptr, "vertex_creases", CD_CREASE);
1013 }
1014 
1015 static void rna_MeshVertexCreaseLayer_data_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
1016 {
1017  Mesh *me = rna_mesh(ptr);
1018  CustomDataLayer *layer = (CustomDataLayer *)ptr->data;
1019  rna_iterator_array_begin(iter, layer->data, sizeof(float), me->totvert, 0, NULL);
1020 }
1021 
1022 static int rna_MeshVertexCreaseLayer_data_length(PointerRNA *ptr)
1023 {
1024  Mesh *me = rna_mesh(ptr);
1025  return me->totvert;
1026 }
1027 
1028 /* End vertex creases */
1029 
1030 /* Paint mask */
1031 DEFINE_CUSTOMDATA_LAYER_COLLECTION(vertex_paint_mask, vdata, CD_PAINT_MASK)
1032 
1033 static char *rna_MeshPaintMaskLayer_path(const PointerRNA *ptr)
1034 {
1035  const CustomDataLayer *cdl = ptr->data;
1036  char name_esc[sizeof(cdl->name) * 2];
1037  BLI_str_escape(name_esc, cdl->name, sizeof(name_esc));
1038  return BLI_sprintfN("vertex_paint_masks[\"%s\"]", name_esc);
1039 }
1040 
1041 static char *rna_MeshPaintMask_path(const PointerRNA *ptr)
1042 {
1043  return rna_VertCustomData_data_path(ptr, "vertex_paint_masks", CD_PAINT_MASK);
1044 }
1045 
1046 static void rna_MeshPaintMaskLayer_data_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
1047 {
1048  Mesh *me = rna_mesh(ptr);
1049  CustomDataLayer *layer = (CustomDataLayer *)ptr->data;
1051  iter, layer->data, sizeof(MFloatProperty), (me->edit_mesh) ? 0 : me->totvert, 0, NULL);
1052 }
1053 
1054 static int rna_MeshPaintMaskLayer_data_length(PointerRNA *ptr)
1055 {
1056  Mesh *me = rna_mesh(ptr);
1057  return (me->edit_mesh) ? 0 : me->totvert;
1058 }
1059 
1060 /* End paint mask */
1061 
1062 /* Face maps */
1063 
1066  face_map, pdata, CD_FACEMAP, active, MeshFaceMapLayer)
1067 
1068 static char *rna_MeshFaceMapLayer_path(const PointerRNA *ptr)
1069 {
1070  const CustomDataLayer *cdl = ptr->data;
1071  char name_esc[sizeof(cdl->name) * 2];
1072  BLI_str_escape(name_esc, cdl->name, sizeof(name_esc));
1073  return BLI_sprintfN("face_maps[\"%s\"]", name_esc);
1074 }
1075 
1076 static void rna_MeshFaceMapLayer_data_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
1077 {
1078  Mesh *me = rna_mesh(ptr);
1079  CustomDataLayer *layer = (CustomDataLayer *)ptr->data;
1081  iter, layer->data, sizeof(int), (me->edit_mesh) ? 0 : me->totpoly, 0, NULL);
1082 }
1083 
1084 static int rna_MeshFaceMapLayer_data_length(PointerRNA *ptr)
1085 {
1086  Mesh *me = rna_mesh(ptr);
1087  return (me->edit_mesh) ? 0 : me->totpoly;
1088 }
1089 
1090 static PointerRNA rna_Mesh_face_map_new(struct Mesh *me, ReportList *reports, const char *name)
1091 {
1092  if (BKE_mesh_ensure_facemap_customdata(me) == false) {
1093  BKE_report(reports, RPT_ERROR, "Currently only single face map layers are supported");
1094  return PointerRNA_NULL;
1095  }
1096 
1097  CustomData *pdata = rna_mesh_pdata_helper(me);
1098 
1099  int index = CustomData_get_layer_index(pdata, CD_FACEMAP);
1100  BLI_assert(index != -1);
1101  CustomDataLayer *cdl = &pdata->layers[index];
1102  rna_cd_layer_name_set(pdata, cdl, name);
1103 
1104  PointerRNA ptr;
1105  RNA_pointer_create(&me->id, &RNA_MeshFaceMapLayer, cdl, &ptr);
1106  return ptr;
1107 }
1108 
1109 static void rna_Mesh_face_map_remove(struct Mesh *me,
1110  ReportList *reports,
1111  struct CustomDataLayer *layer)
1112 {
1113  /* just for sanity check */
1114  {
1115  CustomData *pdata = rna_mesh_pdata_helper(me);
1116  int index = CustomData_get_layer_index(pdata, CD_FACEMAP);
1117  if (index != -1) {
1118  CustomDataLayer *layer_test = &pdata->layers[index];
1119  if (layer != layer_test) {
1120  /* don't show name, its likely freed memory */
1121  BKE_report(reports, RPT_ERROR, "Face map not in mesh");
1122  return;
1123  }
1124  }
1125  }
1126 
1127  if (BKE_mesh_clear_facemap_customdata(me) == false) {
1128  BKE_report(reports, RPT_ERROR, "Error removing face map");
1129  }
1130 }
1131 
1132 /* End face maps */
1133 
1134 /* poly.vertices - this is faked loop access for convenience */
1135 static int rna_MeshPoly_vertices_get_length(const PointerRNA *ptr,
1137 {
1138  const MPoly *mp = (MPoly *)ptr->data;
1139  /* NOTE: raw access uses dummy item, this _could_ crash,
1140  * watch out for this, #MFace uses it but it can't work here. */
1141  return (length[0] = mp->totloop);
1142 }
1143 
1144 static void rna_MeshPoly_vertices_get(PointerRNA *ptr, int *values)
1145 {
1146  Mesh *me = rna_mesh(ptr);
1147  MPoly *mp = (MPoly *)ptr->data;
1148  MLoop *ml = &me->mloop[mp->loopstart];
1149  unsigned int i;
1150  for (i = mp->totloop; i > 0; i--, values++, ml++) {
1151  *values = ml->v;
1152  }
1153 }
1154 
1155 static void rna_MeshPoly_vertices_set(PointerRNA *ptr, const int *values)
1156 {
1157  Mesh *me = rna_mesh(ptr);
1158  MPoly *mp = (MPoly *)ptr->data;
1159  MLoop *ml = &me->mloop[mp->loopstart];
1160  unsigned int i;
1161  for (i = mp->totloop; i > 0; i--, values++, ml++) {
1162  ml->v = *values;
1163  }
1164 }
1165 
1166 /* disabling, some importers don't know the total material count when assigning materials */
1167 # if 0
1168 static void rna_MeshPoly_material_index_range(
1169  PointerRNA *ptr, int *min, int *max, int *softmin, int *softmax)
1170 {
1171  Mesh *me = rna_mesh(ptr);
1172  *min = 0;
1173  *max = max_ii(0, me->totcol - 1);
1174 }
1175 # endif
1176 
1177 static int rna_MeshVertex_index_get(PointerRNA *ptr)
1178 {
1179  Mesh *me = rna_mesh(ptr);
1180  MVert *vert = (MVert *)ptr->data;
1181  return (int)(vert - me->mvert);
1182 }
1183 
1184 static int rna_MeshEdge_index_get(PointerRNA *ptr)
1185 {
1186  Mesh *me = rna_mesh(ptr);
1187  MEdge *edge = (MEdge *)ptr->data;
1188  return (int)(edge - me->medge);
1189 }
1190 
1191 static int rna_MeshLoopTriangle_index_get(PointerRNA *ptr)
1192 {
1193  Mesh *me = rna_mesh(ptr);
1194  MLoopTri *ltri = (MLoopTri *)ptr->data;
1195  return (int)(ltri - me->runtime.looptris.array);
1196 }
1197 
1198 static int rna_MeshLoopTriangle_material_index_get(PointerRNA *ptr)
1199 {
1200  Mesh *me = rna_mesh(ptr);
1201  MLoopTri *ltri = (MLoopTri *)ptr->data;
1202  return me->mpoly[ltri->poly].mat_nr;
1203 }
1204 
1205 static bool rna_MeshLoopTriangle_use_smooth_get(PointerRNA *ptr)
1206 {
1207  Mesh *me = rna_mesh(ptr);
1208  MLoopTri *ltri = (MLoopTri *)ptr->data;
1209  return me->mpoly[ltri->poly].flag & ME_SMOOTH;
1210 }
1211 
1212 static int rna_MeshPolygon_index_get(PointerRNA *ptr)
1213 {
1214  Mesh *me = rna_mesh(ptr);
1215  MPoly *mpoly = (MPoly *)ptr->data;
1216  return (int)(mpoly - me->mpoly);
1217 }
1218 
1219 static int rna_MeshLoop_index_get(PointerRNA *ptr)
1220 {
1221  Mesh *me = rna_mesh(ptr);
1222  MLoop *mloop = (MLoop *)ptr->data;
1223  return (int)(mloop - me->mloop);
1224 }
1225 
1226 /* path construction */
1227 
1228 static char *rna_VertexGroupElement_path(const PointerRNA *ptr)
1229 {
1230  const Mesh *me = rna_mesh(ptr); /* XXX not always! */
1231  const MDeformWeight *dw = (MDeformWeight *)ptr->data;
1232  const MDeformVert *dvert;
1233  int a, b;
1234 
1235  for (a = 0, dvert = me->dvert; a < me->totvert; a++, dvert++) {
1236  for (b = 0; b < dvert->totweight; b++) {
1237  if (dw == &dvert->dw[b]) {
1238  return BLI_sprintfN("vertices[%d].groups[%d]", a, b);
1239  }
1240  }
1241  }
1242 
1243  return NULL;
1244 }
1245 
1246 static char *rna_MeshPolygon_path(const PointerRNA *ptr)
1247 {
1248  return BLI_sprintfN("polygons[%d]", (int)((MPoly *)ptr->data - rna_mesh(ptr)->mpoly));
1249 }
1250 
1251 static char *rna_MeshLoopTriangle_path(const PointerRNA *ptr)
1252 {
1253  return BLI_sprintfN("loop_triangles[%d]",
1254  (int)((MLoopTri *)ptr->data - rna_mesh(ptr)->runtime.looptris.array));
1255 }
1256 
1257 static char *rna_MeshEdge_path(const PointerRNA *ptr)
1258 {
1259  return BLI_sprintfN("edges[%d]", (int)((MEdge *)ptr->data - rna_mesh(ptr)->medge));
1260 }
1261 
1262 static char *rna_MeshLoop_path(const PointerRNA *ptr)
1263 {
1264  return BLI_sprintfN("loops[%d]", (int)((MLoop *)ptr->data - rna_mesh(ptr)->mloop));
1265 }
1266 
1267 static char *rna_MeshVertex_path(const PointerRNA *ptr)
1268 {
1269  return BLI_sprintfN("vertices[%d]", (int)((MVert *)ptr->data - rna_mesh(ptr)->mvert));
1270 }
1271 
1272 static char *rna_VertCustomData_data_path(const PointerRNA *ptr, const char *collection, int type)
1273 {
1274  const CustomDataLayer *cdl;
1275  const Mesh *me = rna_mesh(ptr);
1276  const CustomData *vdata = rna_mesh_vdata(ptr);
1277  int a, b, totvert = (me->edit_mesh) ? 0 : me->totvert;
1278 
1279  for (cdl = vdata->layers, a = 0; a < vdata->totlayer; cdl++, a++) {
1280  if (cdl->type == type) {
1281  b = ((char *)ptr->data - ((char *)cdl->data)) / CustomData_sizeof(type);
1282  if (b >= 0 && b < totvert) {
1283  char name_esc[sizeof(cdl->name) * 2];
1284  BLI_str_escape(name_esc, cdl->name, sizeof(name_esc));
1285  return BLI_sprintfN("%s[\"%s\"].data[%d]", collection, name_esc, b);
1286  }
1287  }
1288  }
1289 
1290  return NULL;
1291 }
1292 
1293 static char *rna_PolyCustomData_data_path(const PointerRNA *ptr, const char *collection, int type)
1294 {
1295  const CustomDataLayer *cdl;
1296  const Mesh *me = rna_mesh(ptr);
1297  const CustomData *pdata = rna_mesh_pdata(ptr);
1298  int a, b, totpoly = (me->edit_mesh) ? 0 : me->totpoly;
1299 
1300  for (cdl = pdata->layers, a = 0; a < pdata->totlayer; cdl++, a++) {
1301  if (cdl->type == type) {
1302  b = ((char *)ptr->data - ((char *)cdl->data)) / CustomData_sizeof(type);
1303  if (b >= 0 && b < totpoly) {
1304  char name_esc[sizeof(cdl->name) * 2];
1305  BLI_str_escape(name_esc, cdl->name, sizeof(name_esc));
1306  return BLI_sprintfN("%s[\"%s\"].data[%d]", collection, name_esc, b);
1307  }
1308  }
1309  }
1310 
1311  return NULL;
1312 }
1313 
1314 static char *rna_LoopCustomData_data_path(const PointerRNA *ptr, const char *collection, int type)
1315 {
1316  const CustomDataLayer *cdl;
1317  const Mesh *me = rna_mesh(ptr);
1318  const CustomData *ldata = rna_mesh_ldata(ptr);
1319  int a, b, totloop = (me->edit_mesh) ? 0 : me->totloop;
1320 
1321  for (cdl = ldata->layers, a = 0; a < ldata->totlayer; cdl++, a++) {
1322  if (cdl->type == type) {
1323  b = ((char *)ptr->data - ((char *)cdl->data)) / CustomData_sizeof(type);
1324  if (b >= 0 && b < totloop) {
1325  char name_esc[sizeof(cdl->name) * 2];
1326  BLI_str_escape(name_esc, cdl->name, sizeof(name_esc));
1327  return BLI_sprintfN("%s[\"%s\"].data[%d]", collection, name_esc, b);
1328  }
1329  }
1330  }
1331 
1332  return NULL;
1333 }
1334 
1335 static void rna_Mesh_vertex_normals_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
1336 {
1337  const Mesh *mesh = rna_mesh(ptr);
1339  rna_iterator_array_begin(iter, (void *)normals, sizeof(float[3]), mesh->totvert, false, NULL);
1340 }
1341 
1342 static int rna_Mesh_vertex_normals_length(PointerRNA *ptr)
1343 {
1344  const Mesh *mesh = rna_mesh(ptr);
1345  return mesh->totvert;
1346 }
1347 
1348 static void rna_Mesh_poly_normals_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
1349 {
1350  const Mesh *mesh = rna_mesh(ptr);
1352  rna_iterator_array_begin(iter, (void *)normals, sizeof(float[3]), mesh->totpoly, false, NULL);
1353 }
1354 
1355 static int rna_Mesh_poly_normals_length(PointerRNA *ptr)
1356 {
1357  const Mesh *mesh = rna_mesh(ptr);
1358  return mesh->totpoly;
1359 }
1360 
1361 static char *rna_MeshUVLoop_path(const PointerRNA *ptr)
1362 {
1363  return rna_LoopCustomData_data_path(ptr, "uv_layers", CD_MLOOPUV);
1364 }
1365 
1366 static char *rna_MeshLoopColorLayer_path(const PointerRNA *ptr)
1367 {
1368  const CustomDataLayer *cdl = ptr->data;
1369  char name_esc[sizeof(cdl->name) * 2];
1370  BLI_str_escape(name_esc, cdl->name, sizeof(name_esc));
1371  return BLI_sprintfN("vertex_colors[\"%s\"]", name_esc);
1372 }
1373 
1374 static char *rna_MeshColor_path(const PointerRNA *ptr)
1375 {
1376  return rna_LoopCustomData_data_path(ptr, "vertex_colors", CD_PROP_BYTE_COLOR);
1377 }
1378 
1379 static char *rna_MeshVertColorLayer_path(const PointerRNA *ptr)
1380 {
1381  const CustomDataLayer *cdl = ptr->data;
1382  char name_esc[sizeof(cdl->name) * 2];
1383  BLI_str_escape(name_esc, cdl->name, sizeof(name_esc));
1384  return BLI_sprintfN("sculpt_vertex_colors[\"%s\"]", name_esc);
1385 }
1386 
1387 static char *rna_MeshVertColor_path(const PointerRNA *ptr)
1388 {
1389  return rna_VertCustomData_data_path(ptr, "sculpt_vertex_colors", CD_PROP_COLOR);
1390 }
1391 
1392 /**** Float Property Layer API ****/
1393 static char *rna_MeshVertexFloatPropertyLayer_path(const PointerRNA *ptr)
1394 {
1395  const CustomDataLayer *cdl = ptr->data;
1396  char name_esc[sizeof(cdl->name) * 2];
1397  BLI_str_escape(name_esc, cdl->name, sizeof(name_esc));
1398  return BLI_sprintfN("vertex_float_layers[\"%s\"]", name_esc);
1399 }
1400 static char *rna_MeshPolygonFloatPropertyLayer_path(const PointerRNA *ptr)
1401 {
1402  const CustomDataLayer *cdl = ptr->data;
1403  char name_esc[sizeof(cdl->name) * 2];
1404  BLI_str_escape(name_esc, cdl->name, sizeof(name_esc));
1405  return BLI_sprintfN("polygon_float_layers[\"%s\"]", name_esc);
1406 }
1407 
1408 static char *rna_MeshVertexFloatProperty_path(const PointerRNA *ptr)
1409 {
1410  return rna_VertCustomData_data_path(ptr, "vertex_layers_float", CD_PROP_FLOAT);
1411 }
1412 static char *rna_MeshPolygonFloatProperty_path(const PointerRNA *ptr)
1413 {
1414  return rna_PolyCustomData_data_path(ptr, "polygon_layers_float", CD_PROP_FLOAT);
1415 }
1416 
1417 static void rna_MeshVertexFloatPropertyLayer_data_begin(CollectionPropertyIterator *iter,
1418  PointerRNA *ptr)
1419 {
1420  Mesh *me = rna_mesh(ptr);
1421  CustomDataLayer *layer = (CustomDataLayer *)ptr->data;
1422  rna_iterator_array_begin(iter, layer->data, sizeof(MFloatProperty), me->totvert, 0, NULL);
1423 }
1424 static void rna_MeshPolygonFloatPropertyLayer_data_begin(CollectionPropertyIterator *iter,
1425  PointerRNA *ptr)
1426 {
1427  Mesh *me = rna_mesh(ptr);
1428  CustomDataLayer *layer = (CustomDataLayer *)ptr->data;
1429  rna_iterator_array_begin(iter, layer->data, sizeof(MFloatProperty), me->totpoly, 0, NULL);
1430 }
1431 
1432 static int rna_MeshVertexFloatPropertyLayer_data_length(PointerRNA *ptr)
1433 {
1434  Mesh *me = rna_mesh(ptr);
1435  return me->totvert;
1436 }
1437 static int rna_MeshPolygonFloatPropertyLayer_data_length(PointerRNA *ptr)
1438 {
1439  Mesh *me = rna_mesh(ptr);
1440  return me->totpoly;
1441 }
1442 
1443 /**** Int Property Layer API ****/
1444 static char *rna_MeshVertexIntPropertyLayer_path(const PointerRNA *ptr)
1445 {
1446  const CustomDataLayer *cdl = ptr->data;
1447  char name_esc[sizeof(cdl->name) * 2];
1448  BLI_str_escape(name_esc, cdl->name, sizeof(name_esc));
1449  return BLI_sprintfN("vertex_int_layers[\"%s\"]", name_esc);
1450 }
1451 static char *rna_MeshPolygonIntPropertyLayer_path(const PointerRNA *ptr)
1452 {
1453  const CustomDataLayer *cdl = ptr->data;
1454  char name_esc[sizeof(cdl->name) * 2];
1455  BLI_str_escape(name_esc, cdl->name, sizeof(name_esc));
1456  return BLI_sprintfN("polygon_int_layers[\"%s\"]", name_esc);
1457 }
1458 
1459 static char *rna_MeshVertexIntProperty_path(const PointerRNA *ptr)
1460 {
1461  return rna_VertCustomData_data_path(ptr, "vertex_layers_int", CD_PROP_INT32);
1462 }
1463 static char *rna_MeshPolygonIntProperty_path(const PointerRNA *ptr)
1464 {
1465  return rna_PolyCustomData_data_path(ptr, "polygon_layers_int", CD_PROP_INT32);
1466 }
1467 
1468 static void rna_MeshVertexIntPropertyLayer_data_begin(CollectionPropertyIterator *iter,
1469  PointerRNA *ptr)
1470 {
1471  Mesh *me = rna_mesh(ptr);
1472  CustomDataLayer *layer = (CustomDataLayer *)ptr->data;
1473  rna_iterator_array_begin(iter, layer->data, sizeof(MIntProperty), me->totvert, 0, NULL);
1474 }
1475 static void rna_MeshPolygonIntPropertyLayer_data_begin(CollectionPropertyIterator *iter,
1476  PointerRNA *ptr)
1477 {
1478  Mesh *me = rna_mesh(ptr);
1479  CustomDataLayer *layer = (CustomDataLayer *)ptr->data;
1480  rna_iterator_array_begin(iter, layer->data, sizeof(MIntProperty), me->totpoly, 0, NULL);
1481 }
1482 
1483 static int rna_MeshVertexIntPropertyLayer_data_length(PointerRNA *ptr)
1484 {
1485  Mesh *me = rna_mesh(ptr);
1486  return me->totvert;
1487 }
1488 static int rna_MeshPolygonIntPropertyLayer_data_length(PointerRNA *ptr)
1489 {
1490  Mesh *me = rna_mesh(ptr);
1491  return me->totpoly;
1492 }
1493 
1494 /**** String Property Layer API ****/
1495 static char *rna_MeshVertexStringPropertyLayer_path(const PointerRNA *ptr)
1496 {
1497  const CustomDataLayer *cdl = ptr->data;
1498  char name_esc[sizeof(cdl->name) * 2];
1499  BLI_str_escape(name_esc, cdl->name, sizeof(name_esc));
1500  return BLI_sprintfN("vertex_string_layers[\"%s\"]", name_esc);
1501 }
1502 static char *rna_MeshPolygonStringPropertyLayer_path(const PointerRNA *ptr)
1503 {
1504  const CustomDataLayer *cdl = ptr->data;
1505  char name_esc[sizeof(cdl->name) * 2];
1506  BLI_str_escape(name_esc, cdl->name, sizeof(name_esc));
1507  return BLI_sprintfN("polygon_string_layers[\"%s\"]", name_esc);
1508 }
1509 
1510 static char *rna_MeshVertexStringProperty_path(const PointerRNA *ptr)
1511 {
1512  return rna_VertCustomData_data_path(ptr, "vertex_layers_string", CD_PROP_STRING);
1513 }
1514 static char *rna_MeshPolygonStringProperty_path(const PointerRNA *ptr)
1515 {
1516  return rna_PolyCustomData_data_path(ptr, "polygon_layers_string", CD_PROP_STRING);
1517 }
1518 
1519 static void rna_MeshVertexStringPropertyLayer_data_begin(CollectionPropertyIterator *iter,
1520  PointerRNA *ptr)
1521 {
1522  Mesh *me = rna_mesh(ptr);
1523  CustomDataLayer *layer = (CustomDataLayer *)ptr->data;
1524  rna_iterator_array_begin(iter, layer->data, sizeof(MStringProperty), me->totvert, 0, NULL);
1525 }
1526 static void rna_MeshPolygonStringPropertyLayer_data_begin(CollectionPropertyIterator *iter,
1527  PointerRNA *ptr)
1528 {
1529  Mesh *me = rna_mesh(ptr);
1530  CustomDataLayer *layer = (CustomDataLayer *)ptr->data;
1531  rna_iterator_array_begin(iter, layer->data, sizeof(MStringProperty), me->totpoly, 0, NULL);
1532 }
1533 
1534 static int rna_MeshVertexStringPropertyLayer_data_length(PointerRNA *ptr)
1535 {
1536  Mesh *me = rna_mesh(ptr);
1537  return me->totvert;
1538 }
1539 static int rna_MeshPolygonStringPropertyLayer_data_length(PointerRNA *ptr)
1540 {
1541  Mesh *me = rna_mesh(ptr);
1542  return me->totpoly;
1543 }
1544 
1545 /* XXX, we don't have proper byte string support yet, so for now use the (bytes + 1)
1546  * bmesh API exposes correct python/byte-string access. */
1547 void rna_MeshStringProperty_s_get(PointerRNA *ptr, char *value)
1548 {
1550  BLI_strncpy(value, ms->s, (int)ms->s_len + 1);
1551 }
1552 
1553 int rna_MeshStringProperty_s_length(PointerRNA *ptr)
1554 {
1556  return (int)ms->s_len + 1;
1557 }
1558 
1559 void rna_MeshStringProperty_s_set(PointerRNA *ptr, const char *value)
1560 {
1562  BLI_strncpy(ms->s, value, sizeof(ms->s));
1563 }
1564 
1565 static char *rna_MeshFaceMap_path(const PointerRNA *ptr)
1566 {
1567  return rna_PolyCustomData_data_path(ptr, "face_maps", CD_FACEMAP);
1568 }
1569 
1570 /***************************************/
1571 
1572 static int rna_Mesh_tot_vert_get(PointerRNA *ptr)
1573 {
1574  Mesh *me = rna_mesh(ptr);
1575  return me->edit_mesh ? me->edit_mesh->bm->totvertsel : 0;
1576 }
1577 static int rna_Mesh_tot_edge_get(PointerRNA *ptr)
1578 {
1579  Mesh *me = rna_mesh(ptr);
1580  return me->edit_mesh ? me->edit_mesh->bm->totedgesel : 0;
1581 }
1582 static int rna_Mesh_tot_face_get(PointerRNA *ptr)
1583 {
1584  Mesh *me = rna_mesh(ptr);
1585  return me->edit_mesh ? me->edit_mesh->bm->totfacesel : 0;
1586 }
1587 
1588 static PointerRNA rna_Mesh_vertex_color_new(struct Mesh *me,
1589  ReportList *reports,
1590  const char *name,
1591  const bool do_init)
1592 {
1593  PointerRNA ptr;
1594  CustomData *ldata;
1595  CustomDataLayer *cdl = NULL;
1596  int index = ED_mesh_color_add(me, name, false, do_init, reports);
1597 
1598  if (index != -1) {
1599  ldata = rna_mesh_ldata_helper(me);
1600  cdl = &ldata->layers[CustomData_get_layer_index_n(ldata, CD_PROP_BYTE_COLOR, index)];
1601  }
1602 
1603  RNA_pointer_create(&me->id, &RNA_MeshLoopColorLayer, cdl, &ptr);
1604  return ptr;
1605 }
1606 
1607 static void rna_Mesh_vertex_color_remove(struct Mesh *me,
1608  ReportList *reports,
1609  CustomDataLayer *layer)
1610 {
1611  if (ED_mesh_color_remove_named(me, layer->name) == false) {
1612  BKE_reportf(reports, RPT_ERROR, "Vertex color '%s' not found", layer->name);
1613  }
1614 }
1615 
1616 static PointerRNA rna_Mesh_sculpt_vertex_color_new(struct Mesh *me,
1617  ReportList *reports,
1618  const char *name,
1619  const bool do_init)
1620 {
1621  PointerRNA ptr;
1622  CustomData *vdata;
1623  CustomDataLayer *cdl = NULL;
1624  int index = ED_mesh_sculpt_color_add(me, name, false, do_init, reports);
1625 
1626  if (index != -1) {
1627  vdata = rna_mesh_vdata_helper(me);
1628  cdl = &vdata->layers[CustomData_get_layer_index_n(vdata, CD_PROP_COLOR, index)];
1629  }
1630 
1631  RNA_pointer_create(&me->id, &RNA_MeshVertColorLayer, cdl, &ptr);
1632  return ptr;
1633 }
1634 
1635 static void rna_Mesh_sculpt_vertex_color_remove(struct Mesh *me,
1636  ReportList *reports,
1637  CustomDataLayer *layer)
1638 {
1639  if (ED_mesh_sculpt_color_remove_named(me, layer->name) == false) {
1640  BKE_reportf(reports, RPT_ERROR, "Sculpt vertex color '%s' not found", layer->name);
1641  }
1642 }
1643 
1644 # define DEFINE_CUSTOMDATA_PROPERTY_API( \
1645  elemname, datatype, cd_prop_type, cdata, countvar, layertype) \
1646  static PointerRNA rna_Mesh_##elemname##_##datatype##_property_new(struct Mesh *me, \
1647  const char *name) \
1648  { \
1649  PointerRNA ptr; \
1650  CustomDataLayer *cdl = NULL; \
1651  int index; \
1652 \
1653  CustomData_add_layer_named(&me->cdata, cd_prop_type, CD_DEFAULT, NULL, me->countvar, name); \
1654  index = CustomData_get_named_layer_index(&me->cdata, cd_prop_type, name); \
1655 \
1656  cdl = (index == -1) ? NULL : &(me->cdata.layers[index]); \
1657 \
1658  RNA_pointer_create(&me->id, &RNA_##layertype, cdl, &ptr); \
1659  return ptr; \
1660  }
1661 
1662 DEFINE_CUSTOMDATA_PROPERTY_API(
1663  vertex, float, CD_PROP_FLOAT, vdata, totvert, MeshVertexFloatPropertyLayer)
1664 DEFINE_CUSTOMDATA_PROPERTY_API(
1665  vertex, int, CD_PROP_INT32, vdata, totvert, MeshVertexIntPropertyLayer)
1666 DEFINE_CUSTOMDATA_PROPERTY_API(
1667  vertex, string, CD_PROP_STRING, vdata, totvert, MeshVertexStringPropertyLayer)
1668 DEFINE_CUSTOMDATA_PROPERTY_API(
1669  polygon, float, CD_PROP_FLOAT, pdata, totpoly, MeshPolygonFloatPropertyLayer)
1670 DEFINE_CUSTOMDATA_PROPERTY_API(
1671  polygon, int, CD_PROP_INT32, pdata, totpoly, MeshPolygonIntPropertyLayer)
1672 DEFINE_CUSTOMDATA_PROPERTY_API(
1673  polygon, string, CD_PROP_STRING, pdata, totpoly, MeshPolygonStringPropertyLayer)
1674 # undef DEFINE_CUSTOMDATA_PROPERTY_API
1675 
1676 static PointerRNA rna_Mesh_uv_layers_new(struct Mesh *me,
1677  ReportList *reports,
1678  const char *name,
1679  const bool do_init)
1680 {
1681  PointerRNA ptr;
1682  CustomData *ldata;
1683  CustomDataLayer *cdl = NULL;
1684  int index = ED_mesh_uv_add(me, name, false, do_init, reports);
1685 
1686  if (index != -1) {
1687  ldata = rna_mesh_ldata_helper(me);
1688  cdl = &ldata->layers[CustomData_get_layer_index_n(ldata, CD_MLOOPUV, index)];
1689  }
1690 
1691  RNA_pointer_create(&me->id, &RNA_MeshUVLoopLayer, cdl, &ptr);
1692  return ptr;
1693 }
1694 
1695 static void rna_Mesh_uv_layers_remove(struct Mesh *me, ReportList *reports, CustomDataLayer *layer)
1696 {
1697  if (ED_mesh_uv_remove_named(me, layer->name) == false) {
1698  BKE_reportf(reports, RPT_ERROR, "Texture layer '%s' not found", layer->name);
1699  }
1700 }
1701 
1702 static bool rna_Mesh_is_editmode_get(PointerRNA *ptr)
1703 {
1704  Mesh *me = rna_mesh(ptr);
1705  return (me->edit_mesh != NULL);
1706 }
1707 
1708 /* only to quiet warnings */
1709 static void UNUSED_FUNCTION(rna_mesh_unused)(void)
1710 {
1711  /* unused functions made by macros */
1712  (void)rna_Mesh_skin_vertice_index_range;
1713  (void)rna_Mesh_vertex_paint_mask_index_range;
1714  (void)rna_Mesh_uv_layer_render_get;
1715  (void)rna_Mesh_uv_layer_render_index_get;
1716  (void)rna_Mesh_uv_layer_render_index_set;
1717  (void)rna_Mesh_uv_layer_render_set;
1718  (void)rna_Mesh_face_map_index_range;
1719  (void)rna_Mesh_face_map_active_index_set;
1720  (void)rna_Mesh_face_map_active_index_get;
1721  (void)rna_Mesh_face_map_active_set;
1722  (void)rna_Mesh_vertex_crease_index_range;
1723  /* end unused function block */
1724 }
1725 
1726 static bool rna_Mesh_materials_override_apply(Main *bmain,
1727  PointerRNA *ptr_dst,
1728  PointerRNA *UNUSED(ptr_src),
1729  PointerRNA *UNUSED(ptr_storage),
1730  PropertyRNA *prop_dst,
1731  PropertyRNA *UNUSED(prop_src),
1732  PropertyRNA *UNUSED(prop_storage),
1733  const int UNUSED(len_dst),
1734  const int UNUSED(len_src),
1735  const int UNUSED(len_storage),
1736  PointerRNA *ptr_item_dst,
1737  PointerRNA *ptr_item_src,
1738  PointerRNA *UNUSED(ptr_item_storage),
1740 {
1742  "Unsupported RNA override operation on collections' objects");
1743  UNUSED_VARS_NDEBUG(opop);
1744 
1745  Mesh *mesh_dst = (Mesh *)ptr_dst->owner_id;
1746 
1747  if (ptr_item_dst->type == NULL || ptr_item_src->type == NULL) {
1748  // BLI_assert_msg(0, "invalid source or destination material.");
1749  return false;
1750  }
1751 
1752  Material *mat_dst = ptr_item_dst->data;
1753  Material *mat_src = ptr_item_src->data;
1754 
1755  if (mat_src == mat_dst) {
1756  return true;
1757  }
1758 
1759  bool is_modified = false;
1760  for (int i = 0; i < mesh_dst->totcol; i++) {
1761  if (mesh_dst->mat[i] == mat_dst) {
1762  id_us_min(&mat_dst->id);
1763  mesh_dst->mat[i] = mat_src;
1764  id_us_plus(&mat_src->id);
1765  is_modified = true;
1766  }
1767  }
1768 
1769  if (is_modified) {
1770  RNA_property_update_main(bmain, NULL, ptr_dst, prop_dst);
1771  }
1772 
1773  return true;
1774 }
1775 
1778 #else
1779 
1780 /* -------------------------------------------------------------------- */
1785 {
1786  StructRNA *srna;
1787  PropertyRNA *prop;
1788 
1789  srna = RNA_def_struct(brna, "VertexGroupElement", NULL);
1790  RNA_def_struct_sdna(srna, "MDeformWeight");
1791  RNA_def_struct_path_func(srna, "rna_VertexGroupElement_path");
1793  srna, "Vertex Group Element", "Weight value of a vertex in a vertex group");
1794  RNA_def_struct_ui_icon(srna, ICON_GROUP_VERTEX);
1795 
1796  /* we can't point to actual group, it is in the object and so
1797  * there is no unique group to point to, hence the index */
1798  prop = RNA_def_property(srna, "group", PROP_INT, PROP_UNSIGNED);
1799  RNA_def_property_int_sdna(prop, NULL, "def_nr");
1801  RNA_def_property_ui_text(prop, "Group Index", "");
1802  RNA_def_property_update(prop, 0, "rna_Mesh_update_data_legacy_deg_tag_all");
1803 
1804  prop = RNA_def_property(srna, "weight", PROP_FLOAT, PROP_NONE);
1805  RNA_def_property_range(prop, 0.0f, 1.0f);
1806  RNA_def_property_ui_text(prop, "Weight", "Vertex Weight");
1807  RNA_def_property_update(prop, 0, "rna_Mesh_update_data_edit_weight");
1808 }
1809 
1810 static void rna_def_mvert(BlenderRNA *brna)
1811 {
1812  StructRNA *srna;
1813  PropertyRNA *prop;
1814 
1815  srna = RNA_def_struct(brna, "MeshVertex", NULL);
1816  RNA_def_struct_sdna(srna, "MVert");
1817  RNA_def_struct_ui_text(srna, "Mesh Vertex", "Vertex in a Mesh data-block");
1818  RNA_def_struct_path_func(srna, "rna_MeshVertex_path");
1819  RNA_def_struct_ui_icon(srna, ICON_VERTEXSEL);
1820 
1821  prop = RNA_def_property(srna, "co", PROP_FLOAT, PROP_TRANSLATION);
1822  RNA_def_property_ui_text(prop, "Location", "");
1823  RNA_def_property_update(prop, 0, "rna_Mesh_update_positions_tag");
1824 
1825  prop = RNA_def_property(srna, "normal", PROP_FLOAT, PROP_DIRECTION);
1826  RNA_def_property_array(prop, 3);
1828  RNA_def_property_float_funcs(prop, "rna_MeshVertex_normal_get", NULL, NULL);
1829  RNA_def_property_ui_text(prop, "Normal", "Vertex Normal");
1830 
1831  prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
1832  RNA_def_property_boolean_sdna(prop, NULL, "flag", SELECT);
1833  RNA_def_property_ui_text(prop, "Select", "");
1834  RNA_def_property_update(prop, 0, "rna_Mesh_update_select");
1835 
1836  prop = RNA_def_property(srna, "hide", PROP_BOOLEAN, PROP_NONE);
1837  RNA_def_property_boolean_sdna(prop, NULL, "flag", ME_HIDE);
1838  RNA_def_property_ui_text(prop, "Hide", "");
1839  RNA_def_property_update(prop, 0, "rna_Mesh_update_select");
1840 
1841  prop = RNA_def_property(srna, "bevel_weight", PROP_FLOAT, PROP_NONE);
1843  prop, "rna_MeshVertex_bevel_weight_get", "rna_MeshVertex_bevel_weight_set", NULL);
1845  prop, "Bevel Weight", "Weight used by the Bevel modifier 'Only Vertices' option");
1846  RNA_def_property_update(prop, 0, "rna_Mesh_update_data_legacy_deg_tag_all");
1847 
1848  prop = RNA_def_property(srna, "groups", PROP_COLLECTION, PROP_NONE);
1850  "rna_MeshVertex_groups_begin",
1851  "rna_iterator_array_next",
1852  "rna_iterator_array_end",
1853  "rna_iterator_array_get",
1854  NULL,
1855  NULL,
1856  NULL,
1857  NULL);
1858  RNA_def_property_struct_type(prop, "VertexGroupElement");
1860  prop, "Groups", "Weights for the vertex groups this vertex is member of");
1861 
1862  prop = RNA_def_property(srna, "index", PROP_INT, PROP_UNSIGNED);
1864  RNA_def_property_int_funcs(prop, "rna_MeshVertex_index_get", NULL, NULL);
1865  RNA_def_property_ui_text(prop, "Index", "Index of this vertex");
1866 
1867  prop = RNA_def_property(srna, "undeformed_co", PROP_FLOAT, PROP_TRANSLATION);
1868  RNA_def_property_array(prop, 3);
1870  prop,
1871  "Undeformed Location",
1872  "For meshes with modifiers applied, the coordinate of the vertex with no deforming "
1873  "modifiers applied, as used for generated texture coordinates");
1874  RNA_def_property_float_funcs(prop, "rna_MeshVertex_undeformed_co_get", NULL, NULL);
1876 }
1877 
1878 static void rna_def_medge(BlenderRNA *brna)
1879 {
1880  StructRNA *srna;
1881  PropertyRNA *prop;
1882 
1883  srna = RNA_def_struct(brna, "MeshEdge", NULL);
1884  RNA_def_struct_sdna(srna, "MEdge");
1885  RNA_def_struct_ui_text(srna, "Mesh Edge", "Edge in a Mesh data-block");
1886  RNA_def_struct_path_func(srna, "rna_MeshEdge_path");
1887  RNA_def_struct_ui_icon(srna, ICON_EDGESEL);
1888 
1889  prop = RNA_def_property(srna, "vertices", PROP_INT, PROP_UNSIGNED);
1890  RNA_def_property_int_sdna(prop, NULL, "v1");
1891  RNA_def_property_array(prop, 2);
1892  RNA_def_property_ui_text(prop, "Vertices", "Vertex indices");
1893  /* XXX allows creating invalid meshes */
1894 
1895  prop = RNA_def_property(srna, "crease", PROP_FLOAT, PROP_NONE);
1896  RNA_def_property_float_funcs(prop, "rna_MEdge_crease_get", "rna_MEdge_crease_set", NULL);
1898  prop, "Crease", "Weight used by the Subdivision Surface modifier for creasing");
1899  RNA_def_property_update(prop, 0, "rna_Mesh_update_data_legacy_deg_tag_all");
1900 
1901  prop = RNA_def_property(srna, "bevel_weight", PROP_FLOAT, PROP_NONE);
1903  prop, "rna_MEdge_bevel_weight_get", "rna_MEdge_bevel_weight_set", NULL);
1904  RNA_def_property_ui_text(prop, "Bevel Weight", "Weight used by the Bevel modifier");
1905  RNA_def_property_update(prop, 0, "rna_Mesh_update_data_legacy_deg_tag_all");
1906 
1907  prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
1908  RNA_def_property_boolean_sdna(prop, NULL, "flag", SELECT);
1909  RNA_def_property_ui_text(prop, "Select", "");
1910  RNA_def_property_update(prop, 0, "rna_Mesh_update_select");
1911 
1912  prop = RNA_def_property(srna, "hide", PROP_BOOLEAN, PROP_NONE);
1913  RNA_def_property_boolean_sdna(prop, NULL, "flag", ME_HIDE);
1914  RNA_def_property_ui_text(prop, "Hide", "");
1915  RNA_def_property_update(prop, 0, "rna_Mesh_update_select");
1916 
1917  prop = RNA_def_property(srna, "use_seam", PROP_BOOLEAN, PROP_NONE);
1918  RNA_def_property_boolean_sdna(prop, NULL, "flag", ME_SEAM);
1919  RNA_def_property_ui_text(prop, "Seam", "Seam edge for UV unwrapping");
1920  RNA_def_property_update(prop, 0, "rna_Mesh_update_select");
1921 
1922  prop = RNA_def_property(srna, "use_edge_sharp", PROP_BOOLEAN, PROP_NONE);
1924  RNA_def_property_ui_text(prop, "Sharp", "Sharp edge for the Edge Split modifier");
1925  RNA_def_property_update(prop, 0, "rna_Mesh_update_data_legacy_deg_tag_all");
1926 
1927  prop = RNA_def_property(srna, "is_loose", PROP_BOOLEAN, PROP_NONE);
1929  RNA_def_property_ui_text(prop, "Loose", "Loose edge");
1930 
1931  prop = RNA_def_property(srna, "use_freestyle_mark", PROP_BOOLEAN, PROP_NONE);
1933  prop, "rna_MEdge_freestyle_edge_mark_get", "rna_MEdge_freestyle_edge_mark_set");
1934  RNA_def_property_ui_text(prop, "Freestyle Edge Mark", "Edge mark for Freestyle line rendering");
1935  RNA_def_property_update(prop, 0, "rna_Mesh_update_data_legacy_deg_tag_all");
1936 
1937  prop = RNA_def_property(srna, "index", PROP_INT, PROP_UNSIGNED);
1939  RNA_def_property_int_funcs(prop, "rna_MeshEdge_index_get", NULL, NULL);
1940  RNA_def_property_ui_text(prop, "Index", "Index of this edge");
1941 }
1942 
1943 static void rna_def_mlooptri(BlenderRNA *brna)
1944 {
1945  StructRNA *srna;
1946  PropertyRNA *prop;
1947  const int splitnor_dim[] = {3, 3};
1948 
1949  srna = RNA_def_struct(brna, "MeshLoopTriangle", NULL);
1950  RNA_def_struct_sdna(srna, "MLoopTri");
1951  RNA_def_struct_ui_text(srna, "Mesh Loop Triangle", "Tessellated triangle in a Mesh data-block");
1952  RNA_def_struct_path_func(srna, "rna_MeshLoopTriangle_path");
1953  RNA_def_struct_ui_icon(srna, ICON_FACESEL);
1954 
1955  prop = RNA_def_property(srna, "vertices", PROP_INT, PROP_UNSIGNED);
1956  RNA_def_property_array(prop, 3);
1957  RNA_def_property_int_funcs(prop, "rna_MeshLoopTriangle_verts_get", NULL, NULL);
1958  RNA_def_property_ui_text(prop, "Vertices", "Indices of triangle vertices");
1960 
1961  prop = RNA_def_property(srna, "loops", PROP_INT, PROP_UNSIGNED);
1962  RNA_def_property_int_sdna(prop, NULL, "tri");
1963  RNA_def_property_ui_text(prop, "Loops", "Indices of mesh loops that make up the triangle");
1965 
1966  prop = RNA_def_property(srna, "polygon_index", PROP_INT, PROP_UNSIGNED);
1967  RNA_def_property_int_sdna(prop, NULL, "poly");
1969  prop, "Polygon", "Index of mesh polygon that the triangle is a part of");
1971 
1972  prop = RNA_def_property(srna, "normal", PROP_FLOAT, PROP_DIRECTION);
1973  RNA_def_property_array(prop, 3);
1974  RNA_def_property_range(prop, -1.0f, 1.0f);
1976  RNA_def_property_float_funcs(prop, "rna_MeshLoopTriangle_normal_get", NULL, NULL);
1978  prop, "Triangle Normal", "Local space unit length normal vector for this triangle");
1979 
1980  prop = RNA_def_property(srna, "split_normals", PROP_FLOAT, PROP_DIRECTION);
1981  RNA_def_property_multi_array(prop, 2, splitnor_dim);
1982  RNA_def_property_range(prop, -1.0f, 1.0f);
1984  RNA_def_property_float_funcs(prop, "rna_MeshLoopTriangle_split_normals_get", NULL, NULL);
1986  prop,
1987  "Split Normals",
1988  "Local space unit length split normals vectors of the vertices of this triangle "
1989  "(must be computed beforehand using calc_normals_split or calc_tangents)");
1990 
1991  prop = RNA_def_property(srna, "area", PROP_FLOAT, PROP_UNSIGNED);
1993  RNA_def_property_float_funcs(prop, "rna_MeshLoopTriangle_area_get", NULL, NULL);
1994  RNA_def_property_ui_text(prop, "Triangle Area", "Area of this triangle");
1995 
1996  prop = RNA_def_property(srna, "index", PROP_INT, PROP_UNSIGNED);
1998  RNA_def_property_int_funcs(prop, "rna_MeshLoopTriangle_index_get", NULL, NULL);
1999  RNA_def_property_ui_text(prop, "Index", "Index of this loop triangle");
2000 
2001  prop = RNA_def_property(srna, "material_index", PROP_INT, PROP_UNSIGNED);
2003  RNA_def_property_int_funcs(prop, "rna_MeshLoopTriangle_material_index_get", NULL, NULL);
2004  RNA_def_property_ui_text(prop, "Material Index", "Material slot index of this triangle");
2005 
2006  prop = RNA_def_property(srna, "use_smooth", PROP_BOOLEAN, PROP_NONE);
2008  RNA_def_property_boolean_funcs(prop, "rna_MeshLoopTriangle_use_smooth_get", NULL);
2009  RNA_def_property_ui_text(prop, "Smooth", "");
2010 }
2011 
2012 static void rna_def_mloop(BlenderRNA *brna)
2013 {
2014  StructRNA *srna;
2015  PropertyRNA *prop;
2016 
2017  srna = RNA_def_struct(brna, "MeshLoop", NULL);
2018  RNA_def_struct_sdna(srna, "MLoop");
2019  RNA_def_struct_ui_text(srna, "Mesh Loop", "Loop in a Mesh data-block");
2020  RNA_def_struct_path_func(srna, "rna_MeshLoop_path");
2021  RNA_def_struct_ui_icon(srna, ICON_EDGESEL);
2022 
2023  prop = RNA_def_property(srna, "vertex_index", PROP_INT, PROP_UNSIGNED);
2024  RNA_def_property_int_sdna(prop, NULL, "v");
2025  RNA_def_property_ui_text(prop, "Vertex", "Vertex index");
2026 
2027  prop = RNA_def_property(srna, "edge_index", PROP_INT, PROP_UNSIGNED);
2028  RNA_def_property_int_sdna(prop, NULL, "e");
2029  RNA_def_property_ui_text(prop, "Edge", "Edge index");
2030 
2031  prop = RNA_def_property(srna, "index", PROP_INT, PROP_UNSIGNED);
2033  RNA_def_property_int_funcs(prop, "rna_MeshLoop_index_get", NULL, NULL);
2034  RNA_def_property_ui_text(prop, "Index", "Index of this loop");
2035 
2036  prop = RNA_def_property(srna, "normal", PROP_FLOAT, PROP_DIRECTION);
2037  RNA_def_property_array(prop, 3);
2038  RNA_def_property_range(prop, -1.0f, 1.0f);
2039  RNA_def_property_float_funcs(prop, "rna_MeshLoop_normal_get", "rna_MeshLoop_normal_set", NULL);
2041  prop,
2042  "Normal",
2043  "Local space unit length split normal vector of this vertex for this polygon "
2044  "(must be computed beforehand using calc_normals_split or calc_tangents)");
2045 
2046  prop = RNA_def_property(srna, "tangent", PROP_FLOAT, PROP_DIRECTION);
2047  RNA_def_property_array(prop, 3);
2048  RNA_def_property_range(prop, -1.0f, 1.0f);
2050  RNA_def_property_float_funcs(prop, "rna_MeshLoop_tangent_get", NULL, NULL);
2052  prop,
2053  "Tangent",
2054  "Local space unit length tangent vector of this vertex for this polygon "
2055  "(must be computed beforehand using calc_tangents)");
2056 
2057  prop = RNA_def_property(srna, "bitangent_sign", PROP_FLOAT, PROP_NONE);
2058  RNA_def_property_range(prop, -1.0f, 1.0f);
2060  RNA_def_property_float_funcs(prop, "rna_MeshLoop_bitangent_sign_get", NULL, NULL);
2062  prop,
2063  "Bitangent Sign",
2064  "Sign of the bitangent vector of this vertex for this polygon (must be computed "
2065  "beforehand using calc_tangents, bitangent = bitangent_sign * cross(normal, tangent))");
2066 
2067  prop = RNA_def_property(srna, "bitangent", PROP_FLOAT, PROP_DIRECTION);
2068  RNA_def_property_array(prop, 3);
2069  RNA_def_property_range(prop, -1.0f, 1.0f);
2071  RNA_def_property_float_funcs(prop, "rna_MeshLoop_bitangent_get", NULL, NULL);
2073  prop,
2074  "Bitangent",
2075  "Bitangent vector of this vertex for this polygon (must be computed beforehand using "
2076  "calc_tangents, use it only if really needed, slower access than bitangent_sign)");
2077 }
2078 
2079 static void rna_def_mpolygon(BlenderRNA *brna)
2080 {
2081  StructRNA *srna;
2082  PropertyRNA *prop;
2083  FunctionRNA *func;
2084 
2085  srna = RNA_def_struct(brna, "MeshPolygon", NULL);
2086  RNA_def_struct_sdna(srna, "MPoly");
2087  RNA_def_struct_ui_text(srna, "Mesh Polygon", "Polygon in a Mesh data-block");
2088  RNA_def_struct_path_func(srna, "rna_MeshPolygon_path");
2089  RNA_def_struct_ui_icon(srna, ICON_FACESEL);
2090 
2091  /* Faked, actually access to loop vertex values, don't this way because manually setting up
2092  * vertex/edge per loop is very low level.
2093  * Instead we setup poly sizes, assign indices, then calc edges automatic when creating
2094  * meshes from rna/py. */
2095  prop = RNA_def_property(srna, "vertices", PROP_INT, PROP_UNSIGNED);
2096  /* Eek, this is still used in some cases but in fact we don't want to use it at all here. */
2097  RNA_def_property_array(prop, 3);
2099  RNA_def_property_dynamic_array_funcs(prop, "rna_MeshPoly_vertices_get_length");
2100  RNA_def_property_int_funcs(prop, "rna_MeshPoly_vertices_get", "rna_MeshPoly_vertices_set", NULL);
2101  RNA_def_property_ui_text(prop, "Vertices", "Vertex indices");
2102 
2103  /* these are both very low level access */
2104  prop = RNA_def_property(srna, "loop_start", PROP_INT, PROP_UNSIGNED);
2105  RNA_def_property_int_sdna(prop, NULL, "loopstart");
2106  RNA_def_property_ui_text(prop, "Loop Start", "Index of the first loop of this polygon");
2107  /* also low level */
2108  prop = RNA_def_property(srna, "loop_total", PROP_INT, PROP_UNSIGNED);
2109  RNA_def_property_int_sdna(prop, NULL, "totloop");
2110  RNA_def_property_ui_text(prop, "Loop Total", "Number of loops used by this polygon");
2111 
2112  prop = RNA_def_property(srna, "material_index", PROP_INT, PROP_UNSIGNED);
2113  RNA_def_property_int_sdna(prop, NULL, "mat_nr");
2114  RNA_def_property_ui_text(prop, "Material Index", "Material slot index of this polygon");
2115 # if 0
2116  RNA_def_property_int_funcs(prop, NULL, NULL, "rna_MeshPoly_material_index_range");
2117 # endif
2118  RNA_def_property_update(prop, 0, "rna_Mesh_update_data_legacy_deg_tag_all");
2119 
2120  prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
2122  RNA_def_property_ui_text(prop, "Select", "");
2123  RNA_def_property_update(prop, 0, "rna_Mesh_update_select");
2124 
2125  prop = RNA_def_property(srna, "hide", PROP_BOOLEAN, PROP_NONE);
2126  RNA_def_property_boolean_sdna(prop, NULL, "flag", ME_HIDE);
2127  RNA_def_property_ui_text(prop, "Hide", "");
2128  RNA_def_property_update(prop, 0, "rna_Mesh_update_select");
2129 
2130  prop = RNA_def_property(srna, "use_smooth", PROP_BOOLEAN, PROP_NONE);
2132  RNA_def_property_ui_text(prop, "Smooth", "");
2133  RNA_def_property_update(prop, 0, "rna_Mesh_update_data_legacy_deg_tag_all");
2134 
2135  prop = RNA_def_property(srna, "use_freestyle_mark", PROP_BOOLEAN, PROP_NONE);
2137  prop, "rna_MPoly_freestyle_face_mark_get", "rna_MPoly_freestyle_face_mark_set");
2138  RNA_def_property_ui_text(prop, "Freestyle Face Mark", "Face mark for Freestyle line rendering");
2139  RNA_def_property_update(prop, 0, "rna_Mesh_update_data_legacy_deg_tag_all");
2140 
2141  prop = RNA_def_property(srna, "normal", PROP_FLOAT, PROP_DIRECTION);
2142  RNA_def_property_array(prop, 3);
2143  RNA_def_property_range(prop, -1.0f, 1.0f);
2145  RNA_def_property_float_funcs(prop, "rna_MeshPolygon_normal_get", NULL, NULL);
2147  prop, "Polygon Normal", "Local space unit length normal vector for this polygon");
2148 
2149  prop = RNA_def_property(srna, "center", PROP_FLOAT, PROP_XYZ);
2150  RNA_def_property_array(prop, 3);
2152  RNA_def_property_float_funcs(prop, "rna_MeshPolygon_center_get", NULL, NULL);
2153  RNA_def_property_ui_text(prop, "Polygon Center", "Center of this polygon");
2154 
2155  prop = RNA_def_property(srna, "area", PROP_FLOAT, PROP_UNSIGNED);
2157  RNA_def_property_float_funcs(prop, "rna_MeshPolygon_area_get", NULL, NULL);
2158  RNA_def_property_ui_text(prop, "Polygon Area", "Read only area of this polygon");
2159 
2160  prop = RNA_def_property(srna, "index", PROP_INT, PROP_UNSIGNED);
2162  RNA_def_property_int_funcs(prop, "rna_MeshPolygon_index_get", NULL, NULL);
2163  RNA_def_property_ui_text(prop, "Index", "Index of this polygon");
2164 
2165  func = RNA_def_function(srna, "flip", "rna_MeshPolygon_flip");
2167  RNA_def_function_ui_description(func, "Invert winding of this polygon (flip its normal)");
2168 }
2169 
2170 /* mesh.loop_uvs */
2171 static void rna_def_mloopuv(BlenderRNA *brna)
2172 {
2173  StructRNA *srna;
2174  PropertyRNA *prop;
2175 
2176  srna = RNA_def_struct(brna, "MeshUVLoopLayer", NULL);
2177  RNA_def_struct_sdna(srna, "CustomDataLayer");
2178  RNA_def_struct_path_func(srna, "rna_MeshUVLoopLayer_path");
2179 
2180  prop = RNA_def_property(srna, "data", PROP_COLLECTION, PROP_NONE);
2181  RNA_def_property_struct_type(prop, "MeshUVLoop");
2183  "rna_MeshUVLoopLayer_data_begin",
2184  "rna_iterator_array_next",
2185  "rna_iterator_array_end",
2186  "rna_iterator_array_get",
2187  "rna_MeshUVLoopLayer_data_length",
2188  NULL,
2189  NULL,
2190  NULL);
2191 
2192  prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
2193  RNA_def_struct_name_property(srna, prop);
2194  RNA_def_property_string_funcs(prop, NULL, NULL, "rna_MeshLoopLayer_name_set");
2195  RNA_def_property_ui_text(prop, "Name", "Name of UV map");
2196  RNA_def_property_update(prop, 0, "rna_Mesh_update_data_legacy_deg_tag_all");
2197 
2198  prop = RNA_def_property(srna, "active", PROP_BOOLEAN, PROP_NONE);
2200  prop, "rna_MeshUVLoopLayer_active_get", "rna_MeshUVLoopLayer_active_set");
2201  RNA_def_property_ui_text(prop, "Active", "Set the map as active for display and editing");
2202  RNA_def_property_update(prop, 0, "rna_Mesh_update_data_legacy_deg_tag_all");
2203 
2204  prop = RNA_def_property(srna, "active_render", PROP_BOOLEAN, PROP_NONE);
2205  RNA_def_property_boolean_sdna(prop, NULL, "active_rnd", 0);
2207  prop, "rna_MeshUVLoopLayer_active_render_get", "rna_MeshUVLoopLayer_active_render_set");
2208  RNA_def_property_ui_text(prop, "Active Render", "Set the UV map as active for rendering");
2209  RNA_def_property_update(prop, 0, "rna_Mesh_update_data_legacy_deg_tag_all");
2210 
2211  prop = RNA_def_property(srna, "active_clone", PROP_BOOLEAN, PROP_NONE);
2212  RNA_def_property_boolean_sdna(prop, NULL, "active_clone", 0);
2214  prop, "rna_MeshUVLoopLayer_clone_get", "rna_MeshUVLoopLayer_clone_set");
2215  RNA_def_property_ui_text(prop, "Active Clone", "Set the map as active for cloning");
2216  RNA_def_property_update(prop, 0, "rna_Mesh_update_data_legacy_deg_tag_all");
2217 
2218  srna = RNA_def_struct(brna, "MeshUVLoop", NULL);
2219  RNA_def_struct_sdna(srna, "MLoopUV");
2220  RNA_def_struct_path_func(srna, "rna_MeshUVLoop_path");
2221 
2222  prop = RNA_def_property(srna, "uv", PROP_FLOAT, PROP_XYZ);
2223  RNA_def_property_update(prop, 0, "rna_Mesh_update_data_legacy_deg_tag_all");
2224 
2225  prop = RNA_def_property(srna, "pin_uv", PROP_BOOLEAN, PROP_NONE);
2227  RNA_def_property_ui_text(prop, "UV Pinned", "");
2228 
2229  prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
2231  RNA_def_property_ui_text(prop, "UV Select", "");
2232 
2233  prop = RNA_def_property(srna, "select_edge", PROP_BOOLEAN, PROP_NONE);
2235  RNA_def_property_ui_text(prop, "UV Edge Select", "");
2236 }
2237 
2238 static void rna_def_mloopcol(BlenderRNA *brna)
2239 {
2240  StructRNA *srna;
2241  PropertyRNA *prop;
2242 
2243  srna = RNA_def_struct(brna, "MeshLoopColorLayer", NULL);
2245  srna, "Mesh Vertex Color Layer", "Layer of vertex colors in a Mesh data-block");
2246  RNA_def_struct_sdna(srna, "CustomDataLayer");
2247  RNA_def_struct_path_func(srna, "rna_MeshLoopColorLayer_path");
2248  RNA_def_struct_ui_icon(srna, ICON_GROUP_VCOL);
2249 
2250  prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
2251  RNA_def_struct_name_property(srna, prop);
2252  RNA_def_property_string_funcs(prop, NULL, NULL, "rna_MeshLoopLayer_name_set");
2253  RNA_def_property_ui_text(prop, "Name", "Name of Vertex color layer");
2254  RNA_def_property_update(prop, 0, "rna_Mesh_update_data_legacy_deg_tag_all");
2255 
2256  prop = RNA_def_property(srna, "active", PROP_BOOLEAN, PROP_NONE);
2258  prop, "rna_MeshLoopColorLayer_active_get", "rna_MeshLoopColorLayer_active_set");
2259  RNA_def_property_ui_text(prop, "Active", "Sets the layer as active for display and editing");
2260  RNA_def_property_update(prop, 0, "rna_Mesh_update_data_legacy_deg_tag_all");
2261 
2262  prop = RNA_def_property(srna, "active_render", PROP_BOOLEAN, PROP_NONE);
2263  RNA_def_property_boolean_sdna(prop, NULL, "active_rnd", 0);
2265  "rna_MeshLoopColorLayer_active_render_get",
2266  "rna_MeshLoopColorLayer_active_render_set");
2267  RNA_def_property_ui_text(prop, "Active Render", "Sets the layer as active for rendering");
2268  RNA_def_property_update(prop, 0, "rna_Mesh_update_data_legacy_deg_tag_all");
2269 
2270  prop = RNA_def_property(srna, "data", PROP_COLLECTION, PROP_NONE);
2271  RNA_def_property_struct_type(prop, "MeshLoopColor");
2272  RNA_def_property_ui_text(prop, "Data", "");
2274  "rna_MeshLoopColorLayer_data_begin",
2275  "rna_iterator_array_next",
2276  "rna_iterator_array_end",
2277  "rna_iterator_array_get",
2278  "rna_MeshLoopColorLayer_data_length",
2279  NULL,
2280  NULL,
2281  NULL);
2282 
2283  srna = RNA_def_struct(brna, "MeshLoopColor", NULL);
2284  RNA_def_struct_sdna(srna, "MLoopCol");
2285  RNA_def_struct_ui_text(srna, "Mesh Vertex Color", "Vertex loop colors in a Mesh");
2286  RNA_def_struct_path_func(srna, "rna_MeshColor_path");
2287 
2288  prop = RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR);
2289  RNA_def_property_array(prop, 4);
2290  RNA_def_property_range(prop, 0.0f, 1.0f);
2292  prop, "rna_MeshLoopColor_color_get", "rna_MeshLoopColor_color_set", NULL);
2293  RNA_def_property_ui_text(prop, "Color", "Color in sRGB color space");
2294  RNA_def_property_update(prop, 0, "rna_Mesh_update_data_legacy_deg_tag_all");
2295 }
2296 
2297 static void rna_def_MPropCol(BlenderRNA *brna)
2298 {
2299  StructRNA *srna;
2300  PropertyRNA *prop;
2301 
2302  srna = RNA_def_struct(brna, "MeshVertColorLayer", NULL);
2304  "Mesh Sculpt Vertex Color Layer",
2305  "Layer of sculpt vertex colors in a Mesh data-block");
2306  RNA_def_struct_sdna(srna, "CustomDataLayer");
2307  RNA_def_struct_path_func(srna, "rna_MeshVertColorLayer_path");
2308  RNA_def_struct_ui_icon(srna, ICON_GROUP_VCOL);
2309 
2310  prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
2311  RNA_def_struct_name_property(srna, prop);
2312  RNA_def_property_string_funcs(prop, NULL, NULL, "rna_MeshVertexLayer_name_set");
2313  RNA_def_property_ui_text(prop, "Name", "Name of Sculpt Vertex color layer");
2314  RNA_def_property_update(prop, 0, "rna_Mesh_update_data_legacy_deg_tag_all");
2315 
2316  prop = RNA_def_property(srna, "active", PROP_BOOLEAN, PROP_NONE);
2318  prop, "rna_MeshVertColorLayer_active_get", "rna_MeshVertColorLayer_active_set");
2320  prop, "Active", "Sets the sculpt vertex color layer as active for display and editing");
2321  RNA_def_property_update(prop, 0, "rna_Mesh_update_data_legacy_deg_tag_all");
2322 
2323  prop = RNA_def_property(srna, "active_render", PROP_BOOLEAN, PROP_NONE);
2324  RNA_def_property_boolean_sdna(prop, NULL, "active_rnd", 0);
2326  "rna_MeshVertColorLayer_active_render_get",
2327  "rna_MeshVertColorLayer_active_render_set");
2329  prop, "Active Render", "Sets the sculpt vertex color layer as active for rendering");
2330  RNA_def_property_update(prop, 0, "rna_Mesh_update_data_legacy_deg_tag_all");
2331 
2332  prop = RNA_def_property(srna, "data", PROP_COLLECTION, PROP_NONE);
2333  RNA_def_property_struct_type(prop, "MeshVertColor");
2334  RNA_def_property_ui_text(prop, "Data", "");
2336  "rna_MeshVertColorLayer_data_begin",
2337  "rna_iterator_array_next",
2338  "rna_iterator_array_end",
2339  "rna_iterator_array_get",
2340  "rna_MeshVertColorLayer_data_length",
2341  NULL,
2342  NULL,
2343  NULL);
2344 
2345  srna = RNA_def_struct(brna, "MeshVertColor", NULL);
2346  RNA_def_struct_sdna(srna, "MPropCol");
2347  RNA_def_struct_ui_text(srna, "Mesh Sculpt Vertex Color", "Vertex colors in a Mesh");
2348  RNA_def_struct_path_func(srna, "rna_MeshVertColor_path");
2349 
2350  prop = RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR);
2351  RNA_def_property_array(prop, 4);
2352  RNA_def_property_range(prop, 0.0f, 1.0f);
2353  RNA_def_property_ui_text(prop, "Color", "");
2354  RNA_def_property_update(prop, 0, "rna_Mesh_update_data_legacy_deg_tag_all");
2355 }
2357 {
2358  StructRNA *srna;
2359  PropertyRNA *prop;
2360 
2361  /* Float */
2362 # define MESH_FLOAT_PROPERTY_LAYER(elemname) \
2363  srna = RNA_def_struct(brna, "Mesh" elemname "FloatPropertyLayer", NULL); \
2364  RNA_def_struct_sdna(srna, "CustomDataLayer"); \
2365  RNA_def_struct_ui_text(srna, \
2366  "Mesh " elemname " Float Property Layer", \
2367  "User defined layer of floating-point number values"); \
2368  RNA_def_struct_path_func(srna, "rna_Mesh" elemname "FloatPropertyLayer_path"); \
2369 \
2370  prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE); \
2371  RNA_def_struct_name_property(srna, prop); \
2372  RNA_def_property_string_funcs(prop, NULL, NULL, "rna_MeshAnyLayer_name_set"); \
2373  RNA_def_property_ui_text(prop, "Name", ""); \
2374  RNA_def_property_update(prop, 0, "rna_Mesh_update_data_legacy_deg_tag_all"); \
2375 \
2376  prop = RNA_def_property(srna, "data", PROP_COLLECTION, PROP_NONE); \
2377  RNA_def_property_struct_type(prop, "Mesh" elemname "FloatProperty"); \
2378  RNA_def_property_ui_text(prop, "Data", ""); \
2379  RNA_def_property_collection_funcs(prop, \
2380  "rna_Mesh" elemname "FloatPropertyLayer_data_begin", \
2381  "rna_iterator_array_next", \
2382  "rna_iterator_array_end", \
2383  "rna_iterator_array_get", \
2384  "rna_Mesh" elemname "FloatPropertyLayer_data_length", \
2385  NULL, \
2386  NULL, \
2387  NULL); \
2388 \
2389  srna = RNA_def_struct(brna, "Mesh" elemname "FloatProperty", NULL); \
2390  RNA_def_struct_sdna(srna, "MFloatProperty"); \
2391  RNA_def_struct_ui_text( \
2392  srna, \
2393  "Mesh " elemname " Float Property", \
2394  "User defined floating-point number value in a float properties layer"); \
2395  RNA_def_struct_path_func(srna, "rna_Mesh" elemname "FloatProperty_path"); \
2396 \
2397  prop = RNA_def_property(srna, "value", PROP_FLOAT, PROP_NONE); \
2398  RNA_def_property_float_sdna(prop, NULL, "f"); \
2399  RNA_def_property_ui_text(prop, "Value", ""); \
2400  RNA_def_property_update(prop, 0, "rna_Mesh_update_data_legacy_deg_tag_all"); \
2401  ((void)0)
2402 
2403  /* Int */
2404 # define MESH_INT_PROPERTY_LAYER(elemname) \
2405  srna = RNA_def_struct(brna, "Mesh" elemname "IntPropertyLayer", NULL); \
2406  RNA_def_struct_sdna(srna, "CustomDataLayer"); \
2407  RNA_def_struct_ui_text(srna, \
2408  "Mesh " elemname " Int Property Layer", \
2409  "User defined layer of integer number values"); \
2410  RNA_def_struct_path_func(srna, "rna_Mesh" elemname "IntPropertyLayer_path"); \
2411 \
2412  prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE); \
2413  RNA_def_struct_name_property(srna, prop); \
2414  RNA_def_property_string_funcs(prop, NULL, NULL, "rna_MeshAnyLayer_name_set"); \
2415  RNA_def_property_ui_text(prop, "Name", ""); \
2416  RNA_def_property_update(prop, 0, "rna_Mesh_update_data_legacy_deg_tag_all"); \
2417 \
2418  prop = RNA_def_property(srna, "data", PROP_COLLECTION, PROP_NONE); \
2419  RNA_def_property_struct_type(prop, "Mesh" elemname "IntProperty"); \
2420  RNA_def_property_ui_text(prop, "Data", ""); \
2421  RNA_def_property_collection_funcs(prop, \
2422  "rna_Mesh" elemname "IntPropertyLayer_data_begin", \
2423  "rna_iterator_array_next", \
2424  "rna_iterator_array_end", \
2425  "rna_iterator_array_get", \
2426  "rna_Mesh" elemname "IntPropertyLayer_data_length", \
2427  NULL, \
2428  NULL, \
2429  NULL); \
2430 \
2431  srna = RNA_def_struct(brna, "Mesh" elemname "IntProperty", NULL); \
2432  RNA_def_struct_sdna(srna, "MIntProperty"); \
2433  RNA_def_struct_ui_text(srna, \
2434  "Mesh " elemname " Int Property", \
2435  "User defined integer number value in an integer properties layer"); \
2436  RNA_def_struct_path_func(srna, "rna_Mesh" elemname "IntProperty_path"); \
2437 \
2438  prop = RNA_def_property(srna, "value", PROP_INT, PROP_NONE); \
2439  RNA_def_property_int_sdna(prop, NULL, "i"); \
2440  RNA_def_property_ui_text(prop, "Value", ""); \
2441  RNA_def_property_update(prop, 0, "rna_Mesh_update_data_legacy_deg_tag_all"); \
2442  ((void)0)
2443 
2444  /* String */
2445 # define MESH_STRING_PROPERTY_LAYER(elemname) \
2446  srna = RNA_def_struct(brna, "Mesh" elemname "StringPropertyLayer", NULL); \
2447  RNA_def_struct_sdna(srna, "CustomDataLayer"); \
2448  RNA_def_struct_ui_text(srna, \
2449  "Mesh " elemname " String Property Layer", \
2450  "User defined layer of string text values"); \
2451  RNA_def_struct_path_func(srna, "rna_Mesh" elemname "StringPropertyLayer_path"); \
2452 \
2453  prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE); \
2454  RNA_def_struct_name_property(srna, prop); \
2455  RNA_def_property_string_funcs(prop, NULL, NULL, "rna_MeshAnyLayer_name_set"); \
2456  RNA_def_property_ui_text(prop, "Name", ""); \
2457  RNA_def_property_update(prop, 0, "rna_Mesh_update_data_legacy_deg_tag_all"); \
2458 \
2459  prop = RNA_def_property(srna, "data", PROP_COLLECTION, PROP_NONE); \
2460  RNA_def_property_struct_type(prop, "Mesh" elemname "StringProperty"); \
2461  RNA_def_property_ui_text(prop, "Data", ""); \
2462  RNA_def_property_collection_funcs(prop, \
2463  "rna_Mesh" elemname "StringPropertyLayer_data_begin", \
2464  "rna_iterator_array_next", \
2465  "rna_iterator_array_end", \
2466  "rna_iterator_array_get", \
2467  "rna_Mesh" elemname "StringPropertyLayer_data_length", \
2468  NULL, \
2469  NULL, \
2470  NULL); \
2471 \
2472  srna = RNA_def_struct(brna, "Mesh" elemname "StringProperty", NULL); \
2473  RNA_def_struct_sdna(srna, "MStringProperty"); \
2474  RNA_def_struct_ui_text(srna, \
2475  "Mesh " elemname " String Property", \
2476  "User defined string text value in a string properties layer"); \
2477  RNA_def_struct_path_func(srna, "rna_Mesh" elemname "StringProperty_path"); \
2478 \
2479  /* low level mesh data access, treat as bytes */ \
2480  prop = RNA_def_property(srna, "value", PROP_STRING, PROP_BYTESTRING); \
2481  RNA_def_property_string_sdna(prop, NULL, "s"); \
2482  RNA_def_property_string_funcs(prop, \
2483  "rna_MeshStringProperty_s_get", \
2484  "rna_MeshStringProperty_s_length", \
2485  "rna_MeshStringProperty_s_set"); \
2486  RNA_def_property_ui_text(prop, "Value", ""); \
2487  RNA_def_property_update(prop, 0, "rna_Mesh_update_data_legacy_deg_tag_all");
2488 
2489  MESH_FLOAT_PROPERTY_LAYER("Vertex");
2490  MESH_FLOAT_PROPERTY_LAYER("Polygon");
2491  MESH_INT_PROPERTY_LAYER("Vertex");
2492  MESH_INT_PROPERTY_LAYER("Polygon");
2493  MESH_STRING_PROPERTY_LAYER("Vertex")
2494  MESH_STRING_PROPERTY_LAYER("Polygon")
2495 # undef MESH_PROPERTY_LAYER
2496 }
2497 
2498 void rna_def_texmat_common(StructRNA *srna, const char *texspace_editable)
2499 {
2500  PropertyRNA *prop;
2501 
2502  /* texture space */
2503  prop = RNA_def_property(srna, "auto_texspace", PROP_BOOLEAN, PROP_NONE);
2504  RNA_def_property_boolean_sdna(prop, NULL, "texflag", ME_AUTOSPACE);
2506  prop,
2507  "Auto Texture Space",
2508  "Adjust active object's texture space automatically when transforming object");
2509 
2510  prop = RNA_def_property(srna, "texspace_location", PROP_FLOAT, PROP_TRANSLATION);
2511  RNA_def_property_float_sdna(prop, NULL, "loc");
2512  RNA_def_property_ui_text(prop, "Texture Space Location", "Texture space location");
2513  RNA_def_property_float_funcs(prop, "rna_Mesh_texspace_loc_get", NULL, NULL);
2514  RNA_def_property_editable_func(prop, texspace_editable);
2515  RNA_def_property_update(prop, 0, "rna_Mesh_update_data_legacy_deg_tag_all");
2516 
2517  prop = RNA_def_property(srna, "texspace_size", PROP_FLOAT, PROP_XYZ);
2518  RNA_def_property_float_sdna(prop, NULL, "size");
2520  RNA_def_property_ui_text(prop, "Texture Space Size", "Texture space size");
2521  RNA_def_property_float_funcs(prop, "rna_Mesh_texspace_size_get", NULL, NULL);
2522  RNA_def_property_editable_func(prop, texspace_editable);
2523  RNA_def_property_update(prop, 0, "rna_Mesh_update_data_legacy_deg_tag_all");
2524 
2525  /* materials */
2526  prop = RNA_def_property(srna, "materials", PROP_COLLECTION, PROP_NONE);
2527  RNA_def_property_collection_sdna(prop, NULL, "mat", "totcol");
2528  RNA_def_property_struct_type(prop, "Material");
2529  RNA_def_property_ui_text(prop, "Materials", "");
2530  RNA_def_property_srna(prop, "IDMaterials"); /* see rna_ID.c */
2532  RNA_def_property_override_funcs(prop, NULL, NULL, "rna_Mesh_materials_override_apply");
2534  prop, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "rna_IDMaterials_assign_int");
2535 }
2536 
2537 /* scene.objects */
2538 /* mesh.vertices */
2540 {
2541  StructRNA *srna;
2542  /* PropertyRNA *prop; */
2543 
2544  FunctionRNA *func;
2545  PropertyRNA *parm;
2546 
2547  RNA_def_property_srna(cprop, "MeshVertices");
2548  srna = RNA_def_struct(brna, "MeshVertices", NULL);
2549  RNA_def_struct_sdna(srna, "Mesh");
2550  RNA_def_struct_ui_text(srna, "Mesh Vertices", "Collection of mesh vertices");
2551 
2552  func = RNA_def_function(srna, "add", "ED_mesh_verts_add");
2554  parm = RNA_def_int(
2555  func, "count", 0, 0, INT_MAX, "Count", "Number of vertices to add", 0, INT_MAX);
2557 # if 0 /* BMESH_TODO Remove until BMesh merge */
2558  func = RNA_def_function(srna, "remove", "ED_mesh_verts_remove");
2560  RNA_def_int(func, "count", 0, 0, INT_MAX, "Count", "Number of vertices to remove", 0, INT_MAX);
2561 # endif
2562 }
2563 
2564 /* mesh.edges */
2565 static void rna_def_mesh_edges(BlenderRNA *brna, PropertyRNA *cprop)
2566 {
2567  StructRNA *srna;
2568  /* PropertyRNA *prop; */
2569 
2570  FunctionRNA *func;
2571  PropertyRNA *parm;
2572 
2573  RNA_def_property_srna(cprop, "MeshEdges");
2574  srna = RNA_def_struct(brna, "MeshEdges", NULL);
2575  RNA_def_struct_sdna(srna, "Mesh");
2576  RNA_def_struct_ui_text(srna, "Mesh Edges", "Collection of mesh edges");
2577 
2578  func = RNA_def_function(srna, "add", "ED_mesh_edges_add");
2580  parm = RNA_def_int(func, "count", 0, 0, INT_MAX, "Count", "Number of edges to add", 0, INT_MAX);
2582 # if 0 /* BMESH_TODO Remove until BMesh merge */
2583  func = RNA_def_function(srna, "remove", "ED_mesh_edges_remove");
2585  RNA_def_int(func, "count", 0, 0, INT_MAX, "Count", "Number of edges to remove", 0, INT_MAX);
2586 # endif
2587 }
2588 
2589 /* mesh.loop_triangles */
2591 {
2592  StructRNA *srna;
2593 
2594  RNA_def_property_srna(cprop, "MeshLoopTriangles");
2595  srna = RNA_def_struct(brna, "MeshLoopTriangles", NULL);
2596  RNA_def_struct_sdna(srna, "Mesh");
2598  srna, "Mesh Loop Triangles", "Tessellation of mesh polygons into triangles");
2599 }
2600 
2601 /* mesh.loops */
2602 static void rna_def_mesh_loops(BlenderRNA *brna, PropertyRNA *cprop)
2603 {
2604  StructRNA *srna;
2605 
2606  // PropertyRNA *prop;
2607 
2608  FunctionRNA *func;
2609  PropertyRNA *parm;
2610 
2611  RNA_def_property_srna(cprop, "MeshLoops");
2612  srna = RNA_def_struct(brna, "MeshLoops", NULL);
2613  RNA_def_struct_sdna(srna, "Mesh");
2614  RNA_def_struct_ui_text(srna, "Mesh Loops", "Collection of mesh loops");
2615 
2616  func = RNA_def_function(srna, "add", "ED_mesh_loops_add");
2618  parm = RNA_def_int(func, "count", 0, 0, INT_MAX, "Count", "Number of loops to add", 0, INT_MAX);
2620 }
2621 
2622 /* mesh.polygons */
2624 {
2625  StructRNA *srna;
2626 
2627  PropertyRNA *prop;
2628 
2629  FunctionRNA *func;
2630  PropertyRNA *parm;
2631 
2632  RNA_def_property_srna(cprop, "MeshPolygons");
2633  srna = RNA_def_struct(brna, "MeshPolygons", NULL);
2634  RNA_def_struct_sdna(srna, "Mesh");
2635  RNA_def_struct_ui_text(srna, "Mesh Polygons", "Collection of mesh polygons");
2636 
2637  prop = RNA_def_property(srna, "active", PROP_INT, PROP_NONE);
2638  RNA_def_property_int_sdna(prop, NULL, "act_face");
2639  RNA_def_property_ui_text(prop, "Active Polygon", "The active polygon for this mesh");
2640 
2641  func = RNA_def_function(srna, "add", "ED_mesh_polys_add");
2643  parm = RNA_def_int(
2644  func, "count", 0, 0, INT_MAX, "Count", "Number of polygons to add", 0, INT_MAX);
2646 }
2647 
2648 /* Defines a read-only vector type since normals should not be modified manually. */
2650 {
2651  StructRNA *srna = RNA_def_struct(brna, "MeshNormalValue", NULL);
2652  RNA_def_struct_sdna(srna, "vec3f");
2653  RNA_def_struct_ui_text(srna, "Mesh Normal Vector", "Vector in a mesh normal array");
2654 
2655  PropertyRNA *prop = RNA_def_property(srna, "vector", PROP_FLOAT, PROP_DIRECTION);
2656  RNA_def_property_ui_text(prop, "Vector", "3D vector");
2657  RNA_def_property_float_sdna(prop, NULL, "x");
2658  RNA_def_property_array(prop, 3);
2660 }
2661 
2662 static void rna_def_loop_colors(BlenderRNA *brna, PropertyRNA *cprop)
2663 {
2664  StructRNA *srna;
2665  PropertyRNA *prop;
2666 
2667  FunctionRNA *func;
2668  PropertyRNA *parm;
2669 
2670  RNA_def_property_srna(cprop, "LoopColors");
2671  srna = RNA_def_struct(brna, "LoopColors", NULL);
2672  RNA_def_struct_sdna(srna, "Mesh");
2673  RNA_def_struct_ui_text(srna, "Loop Colors", "Collection of vertex colors");
2674 
2675  func = RNA_def_function(srna, "new", "rna_Mesh_vertex_color_new");
2676  RNA_def_function_ui_description(func, "Add a vertex color layer to Mesh");
2678  RNA_def_string(func, "name", "Col", 0, "", "Vertex color name");
2679  RNA_def_boolean(func,
2680  "do_init",
2681  true,
2682  "",
2683  "Whether new layer's data should be initialized by copying current active one");
2684  parm = RNA_def_pointer(func, "layer", "MeshLoopColorLayer", "", "The newly created layer");
2686  RNA_def_function_return(func, parm);
2687 
2688  func = RNA_def_function(srna, "remove", "rna_Mesh_vertex_color_remove");
2689  RNA_def_function_ui_description(func, "Remove a vertex color layer");
2691  parm = RNA_def_pointer(func, "layer", "MeshLoopColorLayer", "", "The layer to remove");
2694 
2695  prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
2696  RNA_def_property_struct_type(prop, "MeshLoopColorLayer");
2698  prop, "rna_Mesh_vertex_color_active_get", "rna_Mesh_vertex_color_active_set", NULL, NULL);
2700  RNA_def_property_ui_text(prop, "Active Vertex Color Layer", "Active vertex color layer");
2701  RNA_def_property_update(prop, 0, "rna_Mesh_update_data_edit_active_color");
2702 
2703  prop = RNA_def_property(srna, "active_index", PROP_INT, PROP_UNSIGNED);
2705  "rna_Mesh_vertex_color_active_index_get",
2706  "rna_Mesh_vertex_color_active_index_set",
2707  "rna_Mesh_vertex_color_index_range");
2708  RNA_def_property_ui_text(prop, "Active Vertex Color Index", "Active vertex color index");
2709  RNA_def_property_update(prop, 0, "rna_Mesh_update_data_edit_active_color");
2710 }
2711 
2712 static void rna_def_vert_colors(BlenderRNA *brna, PropertyRNA *cprop)
2713 {
2714  StructRNA *srna;
2715  PropertyRNA *prop;
2716 
2717  FunctionRNA *func;
2718  PropertyRNA *parm;
2719 
2720  RNA_def_property_srna(cprop, "VertColors");
2721  srna = RNA_def_struct(brna, "VertColors", NULL);
2722  RNA_def_struct_sdna(srna, "Mesh");
2723  RNA_def_struct_ui_text(srna, "Vert Colors", "Collection of sculpt vertex colors");
2724 
2725  func = RNA_def_function(srna, "new", "rna_Mesh_sculpt_vertex_color_new");
2726  RNA_def_function_ui_description(func, "Add a sculpt vertex color layer to Mesh");
2728  RNA_def_string(func, "name", "Col", 0, "", "Sculpt Vertex color name");
2729  RNA_def_boolean(func,
2730  "do_init",
2731  true,
2732  "",
2733  "Whether new layer's data should be initialized by copying current active one");
2734  parm = RNA_def_pointer(func, "layer", "MeshVertColorLayer", "", "The newly created layer");
2736  RNA_def_function_return(func, parm);
2737 
2738  func = RNA_def_function(srna, "remove", "rna_Mesh_sculpt_vertex_color_remove");
2739  RNA_def_function_ui_description(func, "Remove a vertex color layer");
2741  parm = RNA_def_pointer(func, "layer", "MeshVertColorLayer", "", "The layer to remove");
2744 
2745  prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
2746  RNA_def_property_struct_type(prop, "MeshVertColorLayer");
2748  "rna_Mesh_sculpt_vertex_color_active_get",
2749  "rna_Mesh_sculpt_vertex_color_active_set",
2750  NULL,
2751  NULL);
2754  prop, "Active Sculpt Vertex Color Layer", "Active sculpt vertex color layer");
2755  RNA_def_property_update(prop, 0, "rna_Mesh_update_data_edit_active_color");
2756 
2757  prop = RNA_def_property(srna, "active_index", PROP_INT, PROP_UNSIGNED);
2759  "rna_Mesh_sculpt_vertex_color_active_index_get",
2760  "rna_Mesh_sculpt_vertex_color_active_index_set",
2761  "rna_Mesh_sculpt_vertex_color_index_range");
2763  prop, "Active Sculpt Vertex Color Index", "Active sculpt vertex color index");
2764  RNA_def_property_update(prop, 0, "rna_Mesh_update_data_edit_active_color");
2765 }
2766 
2767 static void rna_def_uv_layers(BlenderRNA *brna, PropertyRNA *cprop)
2768 {
2769  StructRNA *srna;
2770  PropertyRNA *prop;
2771 
2772  FunctionRNA *func;
2773  PropertyRNA *parm;
2774 
2775  RNA_def_property_srna(cprop, "UVLoopLayers");
2776  srna = RNA_def_struct(brna, "UVLoopLayers", NULL);
2777  RNA_def_struct_sdna(srna, "Mesh");
2778  RNA_def_struct_ui_text(srna, "UV Map Layers", "Collection of UV map layers");
2779 
2780  func = RNA_def_function(srna, "new", "rna_Mesh_uv_layers_new");
2782  RNA_def_function_ui_description(func, "Add a UV map layer to Mesh");
2783  RNA_def_string(func, "name", "UVMap", 0, "", "UV map name");
2784  RNA_def_boolean(func,
2785  "do_init",
2786  true,
2787  "",
2788  "Whether new layer's data should be initialized by copying current active one, "
2789  "or if none is active, with a default UVmap");
2790  parm = RNA_def_pointer(func, "layer", "MeshUVLoopLayer", "", "The newly created layer");
2792  RNA_def_function_return(func, parm);
2793 
2794  func = RNA_def_function(srna, "remove", "rna_Mesh_uv_layers_remove");
2795  RNA_def_function_ui_description(func, "Remove a vertex color layer");
2797  parm = RNA_def_pointer(func, "layer", "MeshUVLoopLayer", "", "The layer to remove");
2799 
2800  prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
2801  RNA_def_property_struct_type(prop, "MeshUVLoopLayer");
2803  prop, "rna_Mesh_uv_layer_active_get", "rna_Mesh_uv_layer_active_set", NULL, NULL);
2805  RNA_def_property_ui_text(prop, "Active UV Map Layer", "Active UV Map layer");
2806  RNA_def_property_update(prop, 0, "rna_Mesh_update_data_legacy_deg_tag_all");
2807 
2808  prop = RNA_def_property(srna, "active_index", PROP_INT, PROP_UNSIGNED);
2810  "rna_Mesh_uv_layer_active_index_get",
2811  "rna_Mesh_uv_layer_active_index_set",
2812  "rna_Mesh_uv_layer_index_range");
2813  RNA_def_property_ui_text(prop, "Active UV Map Index", "Active UV map index");
2814  RNA_def_property_update(prop, 0, "rna_Mesh_update_data_legacy_deg_tag_all");
2815 }
2816 
2817 /* mesh float layers */
2819 {
2820  StructRNA *srna;
2821 
2822  FunctionRNA *func;
2823  PropertyRNA *parm;
2824 
2825  RNA_def_property_srna(cprop, "VertexFloatProperties");
2826  srna = RNA_def_struct(brna, "VertexFloatProperties", NULL);
2827  RNA_def_struct_sdna(srna, "Mesh");
2828  RNA_def_struct_ui_text(srna, "Vertex Float Properties", "Collection of float properties");
2829 
2830  func = RNA_def_function(srna, "new", "rna_Mesh_vertex_float_property_new");
2831  RNA_def_function_ui_description(func, "Add a float property layer to Mesh");
2832  RNA_def_string(func, "name", "Float Prop", 0, "", "Float property name");
2833  parm = RNA_def_pointer(
2834  func, "layer", "MeshVertexFloatPropertyLayer", "", "The newly created layer");
2836  RNA_def_function_return(func, parm);
2837 }
2838 
2839 /* mesh int layers */
2841 {
2842  StructRNA *srna;
2843 
2844  FunctionRNA *func;
2845  PropertyRNA *parm;
2846 
2847  RNA_def_property_srna(cprop, "VertexIntProperties");
2848  srna = RNA_def_struct(brna, "VertexIntProperties", NULL);
2849  RNA_def_struct_sdna(srna, "Mesh");
2850  RNA_def_struct_ui_text(srna, "Vertex Int Properties", "Collection of int properties");
2851 
2852  func = RNA_def_function(srna, "new", "rna_Mesh_vertex_int_property_new");
2853  RNA_def_function_ui_description(func, "Add a integer property layer to Mesh");
2854  RNA_def_string(func, "name", "Int Prop", 0, "", "Int property name");
2855  parm = RNA_def_pointer(
2856  func, "layer", "MeshVertexIntPropertyLayer", "", "The newly created layer");
2858  RNA_def_function_return(func, parm);
2859 }
2860 
2861 /* mesh string layers */
2863 {
2864  StructRNA *srna;
2865 
2866  FunctionRNA *func;
2867  PropertyRNA *parm;
2868 
2869  RNA_def_property_srna(cprop, "VertexStringProperties");
2870  srna = RNA_def_struct(brna, "VertexStringProperties", NULL);
2871  RNA_def_struct_sdna(srna, "Mesh");
2872  RNA_def_struct_ui_text(srna, "Vertex String Properties", "Collection of string properties");
2873 
2874  func = RNA_def_function(srna, "new", "rna_Mesh_vertex_string_property_new");
2875  RNA_def_function_ui_description(func, "Add a string property layer to Mesh");
2876  RNA_def_string(func, "name", "String Prop", 0, "", "String property name");
2877  parm = RNA_def_pointer(
2878  func, "layer", "MeshVertexStringPropertyLayer", "", "The newly created layer");
2880  RNA_def_function_return(func, parm);
2881 }
2882 
2883 /* mesh float layers */
2885 {
2886  StructRNA *srna;
2887 
2888  FunctionRNA *func;
2889  PropertyRNA *parm;
2890 
2891  RNA_def_property_srna(cprop, "PolygonFloatProperties");
2892  srna = RNA_def_struct(brna, "PolygonFloatProperties", NULL);
2893  RNA_def_struct_sdna(srna, "Mesh");
2894  RNA_def_struct_ui_text(srna, "Polygon Float Properties", "Collection of float properties");
2895 
2896  func = RNA_def_function(srna, "new", "rna_Mesh_polygon_float_property_new");
2897  RNA_def_function_ui_description(func, "Add a float property layer to Mesh");
2898  RNA_def_string(func, "name", "Float Prop", 0, "", "Float property name");
2899  parm = RNA_def_pointer(
2900  func, "layer", "MeshPolygonFloatPropertyLayer", "", "The newly created layer");
2902  RNA_def_function_return(func, parm);
2903 }
2904 
2905 /* mesh int layers */
2907 {
2908  StructRNA *srna;
2909 
2910  FunctionRNA *func;
2911  PropertyRNA *parm;
2912 
2913  RNA_def_property_srna(cprop, "PolygonIntProperties");
2914  srna = RNA_def_struct(brna, "PolygonIntProperties", NULL);
2915  RNA_def_struct_sdna(srna, "Mesh");
2916  RNA_def_struct_ui_text(srna, "Polygon Int Properties", "Collection of int properties");
2917 
2918  func = RNA_def_function(srna, "new", "rna_Mesh_polygon_int_property_new");
2919  RNA_def_function_ui_description(func, "Add a integer property layer to Mesh");
2920  RNA_def_string(func, "name", "Int Prop", 0, "", "Int property name");
2921  parm = RNA_def_pointer(
2922  func, "layer", "MeshPolygonIntPropertyLayer", "", "The newly created layer");
2924  RNA_def_function_return(func, parm);
2925 }
2926 
2927 /* mesh string layers */
2929 {
2930  StructRNA *srna;
2931 
2932  FunctionRNA *func;
2933  PropertyRNA *parm;
2934 
2935  RNA_def_property_srna(cprop, "PolygonStringProperties");
2936  srna = RNA_def_struct(brna, "PolygonStringProperties", NULL);
2937  RNA_def_struct_sdna(srna, "Mesh");
2938  RNA_def_struct_ui_text(srna, "Polygon String Properties", "Collection of string properties");
2939 
2940  func = RNA_def_function(srna, "new", "rna_Mesh_polygon_string_property_new");
2941  RNA_def_function_ui_description(func, "Add a string property layer to Mesh");
2942  RNA_def_string(func, "name", "String Prop", 0, "", "String property name");
2943  parm = RNA_def_pointer(
2944  func, "layer", "MeshPolygonStringPropertyLayer", "", "The newly created layer");
2946  RNA_def_function_return(func, parm);
2947 }
2948 
2950 {
2951  StructRNA *srna;
2952  PropertyRNA *prop;
2953 
2954  srna = RNA_def_struct(brna, "MeshSkinVertexLayer", NULL);
2956  srna, "Mesh Skin Vertex Layer", "Per-vertex skin data for use with the Skin modifier");
2957  RNA_def_struct_sdna(srna, "CustomDataLayer");
2958  RNA_def_struct_path_func(srna, "rna_MeshSkinVertexLayer_path");
2959 
2960  prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
2961  RNA_def_struct_name_property(srna, prop);
2962  RNA_def_property_string_funcs(prop, NULL, NULL, "rna_MeshVertexLayer_name_set");
2963  RNA_def_property_ui_text(prop, "Name", "Name of skin layer");
2964  RNA_def_property_update(prop, 0, "rna_Mesh_update_data_legacy_deg_tag_all");
2965 
2966  prop = RNA_def_property(srna, "data", PROP_COLLECTION, PROP_NONE);
2967  RNA_def_property_struct_type(prop, "MeshSkinVertex");
2968  RNA_def_property_ui_text(prop, "Data", "");
2970  "rna_MeshSkinVertexLayer_data_begin",
2971  "rna_iterator_array_next",
2972  "rna_iterator_array_end",
2973  "rna_iterator_array_get",
2974  "rna_MeshSkinVertexLayer_data_length",
2975  NULL,
2976  NULL,
2977  NULL);
2978 
2979  /* SkinVertex struct */
2980  srna = RNA_def_struct(brna, "MeshSkinVertex", NULL);
2981  RNA_def_struct_sdna(srna, "MVertSkin");
2983  srna, "Skin Vertex", "Per-vertex skin data for use with the Skin modifier");
2984  RNA_def_struct_path_func(srna, "rna_MeshSkinVertex_path");
2985 
2986  prop = RNA_def_property(srna, "radius", PROP_FLOAT, PROP_UNSIGNED);
2987  RNA_def_property_array(prop, 2);
2988  RNA_def_property_ui_range(prop, 0.001, 100.0, 1, 3);
2989  RNA_def_property_ui_text(prop, "Radius", "Radius of the skin");
2990  RNA_def_property_update(prop, 0, "rna_Mesh_update_data_legacy_deg_tag_all");
2991 
2992  /* Flags */
2993 
2994  prop = RNA_def_property(srna, "use_root", PROP_BOOLEAN, PROP_NONE);
2997  "Root",
2998  "Vertex is a root for rotation calculations and armature generation, "
2999  "setting this flag does not clear other roots in the same mesh island");
3000  RNA_def_property_update(prop, 0, "rna_Mesh_update_data_legacy_deg_tag_all");
3001 
3002  prop = RNA_def_property(srna, "use_loose", PROP_BOOLEAN, PROP_NONE);
3005  prop, "Loose", "If vertex has multiple adjacent edges, it is hulled to them directly");
3006  RNA_def_property_update(prop, 0, "rna_Mesh_update_data_legacy_deg_tag_all");
3007 }
3008 
3010 {
3011  StructRNA *srna;
3012  PropertyRNA *prop;
3013 
3014  srna = RNA_def_struct(brna, "MeshVertexCreaseLayer", NULL);
3015  RNA_def_struct_ui_text(srna, "Mesh Vertex Crease Layer", "Per-vertex crease");
3016  RNA_def_struct_sdna(srna, "CustomDataLayer");
3017  RNA_def_struct_path_func(srna, "rna_MeshVertexCreaseLayer_path");
3018 
3019  prop = RNA_def_property(srna, "data", PROP_COLLECTION, PROP_NONE);
3020  RNA_def_property_struct_type(prop, "MeshVertexCrease");
3021  RNA_def_property_ui_text(prop, "Data", "");
3023  "rna_MeshVertexCreaseLayer_data_begin",
3024  "rna_iterator_array_next",
3025  "rna_iterator_array_end",
3026  "rna_iterator_array_get",
3027  "rna_MeshVertexCreaseLayer_data_length",
3028  NULL,
3029  NULL,
3030  NULL);
3031 
3032  /* VertexCrease struct */
3033  srna = RNA_def_struct(brna, "MeshVertexCrease", NULL);
3034  RNA_def_struct_sdna(srna, "MFloatProperty");
3035  RNA_def_struct_ui_text(srna, "Float Property", "");
3036 
3037  prop = RNA_def_property(srna, "value", PROP_FLOAT, PROP_NONE);
3038  RNA_def_property_float_sdna(prop, NULL, "f");
3039  RNA_def_property_ui_text(prop, "Value", "");
3040  RNA_def_property_update(prop, 0, "rna_Mesh_update_data_legacy_deg_tag_all");
3041 }
3042 
3044 {
3045  StructRNA *srna;
3046  PropertyRNA *prop;
3047 
3048  srna = RNA_def_struct(brna, "MeshPaintMaskLayer", NULL);
3049  RNA_def_struct_ui_text(srna, "Mesh Paint Mask Layer", "Per-vertex paint mask data");
3050  RNA_def_struct_sdna(srna, "CustomDataLayer");
3051  RNA_def_struct_path_func(srna, "rna_MeshPaintMaskLayer_path");
3052 
3053  prop = RNA_def_property(srna, "data", PROP_COLLECTION, PROP_NONE);
3054  RNA_def_property_struct_type(prop, "MeshPaintMaskProperty");
3055  RNA_def_property_ui_text(prop, "Data", "");
3056 
3058  "rna_MeshPaintMaskLayer_data_begin",
3059  "rna_iterator_array_next",
3060  "rna_iterator_array_end",
3061  "rna_iterator_array_get",
3062  "rna_MeshPaintMaskLayer_data_length",
3063  NULL,
3064  NULL,
3065  NULL);
3066 
3067  srna = RNA_def_struct(brna, "MeshPaintMaskProperty", NULL);
3068  RNA_def_struct_sdna(srna, "MFloatProperty");
3069  RNA_def_struct_ui_text(srna, "Mesh Paint Mask Property", "Floating-point paint mask value");
3070  RNA_def_struct_path_func(srna, "rna_MeshPaintMask_path");
3071 
3072  prop = RNA_def_property(srna, "value", PROP_FLOAT, PROP_NONE);
3073  RNA_def_property_float_sdna(prop, NULL, "f");
3074  RNA_def_property_ui_text(prop, "Value", "");
3075  RNA_def_property_update(prop, 0, "rna_Mesh_update_data_legacy_deg_tag_all");
3076 }
3077 
3078 static void rna_def_face_map(BlenderRNA *brna)
3079 {
3080  StructRNA *srna;
3081  PropertyRNA *prop;
3082 
3083  srna = RNA_def_struct(brna, "MeshFaceMapLayer", NULL);
3084  RNA_def_struct_ui_text(srna, "Mesh Face Map Layer", "Per-face map index");
3085  RNA_def_struct_sdna(srna, "CustomDataLayer");
3086  RNA_def_struct_path_func(srna, "rna_MeshFaceMapLayer_path");
3087 
3088  prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
3089  RNA_def_struct_name_property(srna, prop);
3090  RNA_def_property_string_funcs(prop, NULL, NULL, "rna_MeshPolyLayer_name_set");
3091  RNA_def_property_ui_text(prop, "Name", "Name of face map layer");
3092  RNA_def_property_update(prop, 0, "rna_Mesh_update_data_legacy_deg_tag_all");
3093 
3094  prop = RNA_def_property(srna, "data", PROP_COLLECTION, PROP_NONE);
3095  RNA_def_property_struct_type(prop, "MeshFaceMap");
3096  RNA_def_property_ui_text(prop, "Data", "");
3098  "rna_MeshFaceMapLayer_data_begin",
3099  "rna_iterator_array_next",
3100  "rna_iterator_array_end",
3101  "rna_iterator_array_get",
3102  "rna_MeshFaceMapLayer_data_length",
3103  NULL,
3104  NULL,
3105  NULL);
3106 
3107  /* FaceMap struct */
3108  srna = RNA_def_struct(brna, "MeshFaceMap", NULL);
3109  RNA_def_struct_sdna(srna, "MIntProperty");
3110  RNA_def_struct_ui_text(srna, "Int Property", "");
3111  RNA_def_struct_path_func(srna, "rna_MeshFaceMap_path");
3112 
3113  prop = RNA_def_property(srna, "value", PROP_INT, PROP_NONE);
3114  RNA_def_property_int_sdna(prop, NULL, "i");
3115  RNA_def_property_ui_text(prop, "Value", "");
3116  RNA_def_property_update(prop, 0, "rna_Mesh_update_data_legacy_deg_tag_all");
3117 }
3118 
3119 static void rna_def_face_maps(BlenderRNA *brna, PropertyRNA *cprop)
3120 {
3121  StructRNA *srna;
3122  PropertyRNA *prop;
3123 
3124  RNA_def_property_srna(cprop, "MeshFaceMapLayers");
3125  srna = RNA_def_struct(brna, "MeshFaceMapLayers", NULL);
3126  RNA_def_struct_ui_text(srna, "Mesh Face Map Layer", "Per-face map index");
3127  RNA_def_struct_sdna(srna, "Mesh");
3128  RNA_def_struct_ui_text(srna, "Mesh Face Maps", "Collection of mesh face maps");
3129 
3130  /* add this since we only ever have one layer anyway, don't bother with active_index */
3131  prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
3132  RNA_def_property_struct_type(prop, "MeshFaceMapLayer");
3133  RNA_def_property_pointer_funcs(prop, "rna_Mesh_face_map_active_get", NULL, NULL, NULL);
3134  RNA_def_property_ui_text(prop, "Active Face Map Layer", "");
3135  RNA_def_property_update(prop, 0, "rna_Mesh_update_data_legacy_deg_tag_all");
3136 
3137  FunctionRNA *func;
3138  PropertyRNA *parm;
3139 
3140  func = RNA_def_function(srna, "new", "rna_Mesh_face_map_new");
3142  RNA_def_function_ui_description(func, "Add a float property layer to Mesh");
3143  RNA_def_string(func, "name", "Face Map", 0, "", "Face map name");
3144  parm = RNA_def_pointer(func, "layer", "MeshFaceMapLayer", "", "The newly created layer");
3146  RNA_def_function_return(func, parm);
3147 
3148  func = RNA_def_function(srna, "remove", "rna_Mesh_face_map_remove");
3149  RNA_def_function_ui_description(func, "Remove a face map layer");
3151  parm = RNA_def_pointer(func, "layer", "MeshFaceMapLayer", "", "The layer to remove");
3154 }
3155 
3156 static void rna_def_mesh(BlenderRNA *brna)
3157 {
3158  StructRNA *srna;
3159  PropertyRNA *prop;
3160 
3161  srna = RNA_def_struct(brna, "Mesh", "ID");
3162  RNA_def_struct_ui_text(srna, "Mesh", "Mesh data-block defining geometric surfaces");
3163  RNA_def_struct_ui_icon(srna, ICON_MESH_DATA);
3164 
3165  prop = RNA_def_property(srna, "vertices", PROP_COLLECTION, PROP_NONE);
3166  RNA_def_property_collection_sdna(prop, NULL, "mvert", "totvert");
3167  RNA_def_property_struct_type(prop, "MeshVertex");
3169  RNA_def_property_ui_text(prop, "Vertices", "Vertices of the mesh");
3170  rna_def_mesh_vertices(brna, prop);
3171 
3172  prop = RNA_def_property(srna, "edges", PROP_COLLECTION, PROP_NONE);
3173  RNA_def_property_collection_sdna(prop, NULL, "medge", "totedge");
3174  RNA_def_property_struct_type(prop, "MeshEdge");
3176  RNA_def_property_ui_text(prop, "Edges", "Edges of the mesh");
3177  rna_def_mesh_edges(brna, prop);
3178 
3179  prop = RNA_def_property(srna, "loops", PROP_COLLECTION, PROP_NONE);
3180  RNA_def_property_collection_sdna(prop, NULL, "mloop", "totloop");
3181  RNA_def_property_struct_type(prop, "MeshLoop");
3183  RNA_def_property_ui_text(prop, "Loops", "Loops of the mesh (polygon corners)");
3184  rna_def_mesh_loops(brna, prop);
3185 
3186  prop = RNA_def_property(srna, "polygons", PROP_COLLECTION, PROP_NONE);
3187  RNA_def_property_collection_sdna(prop, NULL, "mpoly", "totpoly");
3188  RNA_def_property_struct_type(prop, "MeshPolygon");
3190  RNA_def_property_ui_text(prop, "Polygons", "Polygons of the mesh");
3191  rna_def_mesh_polygons(brna, prop);
3192 
3194 
3195  prop = RNA_def_property(srna, "vertex_normals", PROP_COLLECTION, PROP_NONE);
3196  RNA_def_property_struct_type(prop, "MeshNormalValue");
3199  "Vertex Normals",
3200  "The normal direction of each vertex, defined as the average of the "
3201  "surrounding face normals");
3203  "rna_Mesh_vertex_normals_begin",
3204  "rna_iterator_array_next",
3205  "rna_iterator_array_end",
3206  "rna_iterator_array_get",
3207  "rna_Mesh_vertex_normals_length",
3208  NULL,
3209  NULL,
3210  NULL);
3211 
3212  prop = RNA_def_property(srna, "polygon_normals", PROP_COLLECTION, PROP_NONE);
3213  RNA_def_property_struct_type(prop, "MeshNormalValue");
3216  "Polygon Normals",
3217  "The normal direction of each polygon, defined by the winding order "
3218  "and position of its vertices");
3220  "rna_Mesh_poly_normals_begin",
3221  "rna_iterator_array_next",
3222  "rna_iterator_array_end",
3223  "rna_iterator_array_get",
3224  "rna_Mesh_poly_normals_length",
3225  NULL,
3226  NULL,
3227  NULL);
3228 
3229  prop = RNA_def_property(srna, "loop_triangles", PROP_COLLECTION, PROP_NONE);
3230  RNA_def_property_collection_sdna(prop, NULL, "runtime.looptris.array", "runtime.looptris.len");
3231  RNA_def_property_struct_type(prop, "MeshLoopTriangle");
3233  RNA_def_property_ui_text(prop, "Loop Triangles", "Tessellation of mesh polygons into triangles");
3234  rna_def_mesh_looptris(brna, prop);
3235 
3236  /* TODO: should this be allowed to be itself? */
3237  prop = RNA_def_property(srna, "texture_mesh", PROP_POINTER, PROP_NONE);
3238  RNA_def_property_pointer_sdna(prop, NULL, "texcomesh");
3242  prop,
3243  "Texture Mesh",
3244  "Use another mesh for texture indices (vertex indices must be aligned)");
3245 
3246  /* UV loop layers */
3247  prop = RNA_def_property(srna, "uv_layers", PROP_COLLECTION, PROP_NONE);
3248  RNA_def_property_collection_sdna(prop, NULL, "ldata.layers", "ldata.totlayer");
3250  "rna_Mesh_uv_layers_begin",
3251  NULL,
3252  NULL,
3253  NULL,
3254  "rna_Mesh_uv_layers_length",
3255  NULL,
3256  NULL,
3257  NULL);
3258  RNA_def_property_struct_type(prop, "MeshUVLoopLayer");
3260  RNA_def_property_ui_text(prop, "UV Loop Layers", "All UV loop layers");
3261  rna_def_uv_layers(brna, prop);
3262 
3263  prop = RNA_def_property(srna, "uv_layer_clone", PROP_POINTER, PROP_NONE);
3264  RNA_def_property_struct_type(prop, "MeshUVLoopLayer");
3266  prop, "rna_Mesh_uv_layer_clone_get", "rna_Mesh_uv_layer_clone_set", NULL, NULL);
3270  prop, "Clone UV Loop Layer", "UV loop layer to be used as cloning source");
3271 
3272  prop = RNA_def_property(srna, "uv_layer_clone_index", PROP_INT, PROP_UNSIGNED);
3274  "rna_Mesh_uv_layer_clone_index_get",
3275  "rna_Mesh_uv_layer_clone_index_set",
3276  "rna_Mesh_uv_layer_index_range");
3277  RNA_def_property_ui_text(prop, "Clone UV Loop Layer Index", "Clone UV loop layer index");
3278 
3279  prop = RNA_def_property(srna, "uv_layer_stencil", PROP_POINTER, PROP_NONE);
3280  RNA_def_property_struct_type(prop, "MeshUVLoopLayer");
3282  prop, "rna_Mesh_uv_layer_stencil_get", "rna_Mesh_uv_layer_stencil_set", NULL, NULL);
3285  RNA_def_property_ui_text(prop, "Mask UV Loop Layer", "UV loop layer to mask the painted area");
3286 
3287  prop = RNA_def_property(srna, "uv_layer_stencil_index", PROP_INT, PROP_UNSIGNED);
3289  "rna_Mesh_uv_layer_stencil_index_get",
3290  "rna_Mesh_uv_layer_stencil_index_set",
3291  "rna_Mesh_uv_layer_index_range");
3292  RNA_def_property_ui_text(prop, "Mask UV Loop Layer Index", "Mask UV loop layer index");
3293  RNA_def_property_update(prop, 0, "rna_Mesh_update_data_legacy_deg_tag_all");
3294 
3295  /* Vertex colors */
3296 
3297  prop = RNA_def_property(srna, "vertex_colors", PROP_COLLECTION, PROP_NONE);
3298  RNA_def_property_collection_sdna(prop, NULL, "ldata.layers", "ldata.totlayer");
3300  "rna_Mesh_vertex_colors_begin",
3301  NULL,
3302  NULL,
3303  NULL,
3304  "rna_Mesh_vertex_colors_length",
3305  NULL,
3306  NULL,
3307  NULL);
3308  RNA_def_property_struct_type(prop, "MeshLoopColorLayer");
3311  "Vertex Colors",
3312  "Legacy vertex color layers. Deprecated, use color attributes instead");
3313  rna_def_loop_colors(brna, prop);
3314 
3315  /* Sculpt Vertex colors */
3316 
3317  prop = RNA_def_property(srna, "sculpt_vertex_colors", PROP_COLLECTION, PROP_NONE);
3318  RNA_def_property_collection_sdna(prop, NULL, "vdata.layers", "vdata.totlayer");
3320  "rna_Mesh_sculpt_vertex_colors_begin",
3321  NULL,
3322  NULL,
3323  NULL,
3324  "rna_Mesh_sculpt_vertex_colors_length",
3325  NULL,
3326  NULL,
3327  NULL);
3328  RNA_def_property_struct_type(prop, "MeshVertColorLayer");
3331  "Sculpt Vertex Colors",
3332  "Sculpt vertex color layers. Deprecated, use color attributes instead");
3333  rna_def_vert_colors(brna, prop);
3334 
3335  /* TODO: edge customdata layers (bmesh py api can access already). */
3336  prop = RNA_def_property(srna, "vertex_layers_float", PROP_COLLECTION, PROP_NONE);
3337  RNA_def_property_collection_sdna(prop, NULL, "vdata.layers", "vdata.totlayer");
3339  "rna_Mesh_vertex_float_layers_begin",
3340  NULL,
3341  NULL,
3342  NULL,
3343  "rna_Mesh_vertex_float_layers_length",
3344  NULL,
3345  NULL,
3346  NULL);
3347  RNA_def_property_struct_type(prop, "MeshVertexFloatPropertyLayer");
3349  RNA_def_property_ui_text(prop, "Float Property Layers", "");
3350  rna_def_vertex_float_layers(brna, prop);
3351 
3352  prop = RNA_def_property(srna, "vertex_layers_int", PROP_COLLECTION, PROP_NONE);
3353  RNA_def_property_collection_sdna(prop, NULL, "vdata.layers", "vdata.totlayer");
3355  "rna_Mesh_vertex_int_layers_begin",
3356  NULL,
3357  NULL,
3358  NULL,
3359  "rna_Mesh_vertex_int_layers_length",
3360  NULL,
3361  NULL,
3362  NULL);
3363  RNA_def_property_struct_type(prop, "MeshVertexIntPropertyLayer");
3365  RNA_def_property_ui_text(prop, "Int Property Layers", "");
3366  rna_def_vertex_int_layers(brna, prop);
3367 
3368  prop = RNA_def_property(srna, "vertex_layers_string", PROP_COLLECTION, PROP_NONE);
3369  RNA_def_property_collection_sdna(prop, NULL, "vdata.layers", "vdata.totlayer");
3371  "rna_Mesh_vertex_string_layers_begin",
3372  NULL,
3373  NULL,
3374  NULL,
3375  "rna_Mesh_vertex_string_layers_length",
3376  NULL,
3377  NULL,
3378  NULL);
3379  RNA_def_property_struct_type(prop, "MeshVertexStringPropertyLayer");
3381  RNA_def_property_ui_text(prop, "String Property Layers", "");
3382  rna_def_vertex_string_layers(brna, prop);
3383 
3384  prop = RNA_def_property(srna, "polygon_layers_float", PROP_COLLECTION, PROP_NONE);
3385  RNA_def_property_collection_sdna(prop, NULL, "pdata.layers", "pdata.totlayer");
3387  "rna_Mesh_polygon_float_layers_begin",
3388  NULL,
3389  NULL,
3390  NULL,
3391  "rna_Mesh_polygon_float_layers_length",
3392  NULL,
3393  NULL,
3394  NULL);
3395  RNA_def_property_struct_type(prop, "MeshPolygonFloatPropertyLayer");
3397  RNA_def_property_ui_text(prop, "Float Property Layers", "");
3398  rna_def_polygon_float_layers(brna, prop);
3399 
3400  prop = RNA_def_property(srna, "polygon_layers_int", PROP_COLLECTION, PROP_NONE);
3401  RNA_def_property_collection_sdna(prop, NULL, "pdata.layers", "pdata.totlayer");
3403  "rna_Mesh_polygon_int_layers_begin",
3404  NULL,
3405  NULL,
3406  NULL,
3407  "rna_Mesh_polygon_int_layers_length",
3408  NULL,
3409  NULL,
3410  NULL);
3411  RNA_def_property_struct_type(prop, "MeshPolygonIntPropertyLayer");
3413  RNA_def_property_ui_text(prop, "Int Property Layers", "");
3414  rna_def_polygon_int_layers(brna, prop);
3415 
3416  prop = RNA_def_property(srna, "polygon_layers_string", PROP_COLLECTION, PROP_NONE);
3417  RNA_def_property_collection_sdna(prop, NULL, "pdata.layers", "pdata.totlayer");
3419  "rna_Mesh_polygon_string_layers_begin",
3420  NULL,
3421  NULL,
3422  NULL,
3423  "rna_Mesh_polygon_string_layers_length",
3424  NULL,
3425  NULL,
3426  NULL);
3427  RNA_def_property_struct_type(prop, "MeshPolygonStringPropertyLayer");
3429  RNA_def_property_ui_text(prop, "String Property Layers", "");
3430  rna_def_polygon_string_layers(brna, prop);
3431 
3432  /* face-maps */
3433  prop = RNA_def_property(srna, "face_maps", PROP_COLLECTION, PROP_NONE);
3434  RNA_def_property_collection_sdna(prop, NULL, "pdata.layers", "pdata.totlayer");
3436  "rna_Mesh_face_maps_begin",
3437  NULL,
3438  NULL,
3439  NULL,
3440  "rna_Mesh_face_maps_length",
3441  NULL,
3442  NULL,
3443  NULL);
3444  RNA_def_property_struct_type(prop, "MeshFaceMapLayer");
3446  RNA_def_property_ui_text(prop, "Face Map", "");
3447  rna_def_face_maps(brna, prop);
3448 
3449  /* Skin vertices */
3450  prop = RNA_def_property(srna, "skin_vertices", PROP_COLLECTION, PROP_NONE);
3451  RNA_def_property_collection_sdna(prop, NULL, "vdata.layers", "vdata.totlayer");
3453  "rna_Mesh_skin_vertices_begin",
3454  NULL,
3455  NULL,
3456  NULL,
3457  "rna_Mesh_skin_vertices_length",
3458  NULL,
3459  NULL,
3460  NULL);
3461  RNA_def_property_struct_type(prop, "MeshSkinVertexLayer");
3463  RNA_def_property_ui_text(prop, "Skin Vertices", "All skin vertices");
3464  rna_def_skin_vertices(brna, prop);
3465  /* End skin vertices */
3466 
3467  /* Vertex Crease */
3468  prop = RNA_def_property(srna, "vertex_creases", PROP_COLLECTION, PROP_NONE);
3469  RNA_def_property_struct_type(prop, "MeshVertexCreaseLayer");
3470  RNA_def_property_collection_sdna(prop, NULL, "vdata.layers", "vdata.totlayer");
3472  "rna_Mesh_vertex_creases_begin",
3473  NULL,
3474  NULL,
3475  NULL,
3476  "rna_Mesh_vertex_creases_length",
3477  NULL,
3478  NULL,
3479  NULL);
3481  RNA_def_property_ui_text(prop, "Vertex Creases", "Sharpness of the vertices");
3482  rna_def_vertex_creases(brna);
3483  /* End vertex crease */
3484 
3485  /* Paint mask */
3486  prop = RNA_def_property(srna, "vertex_paint_masks", PROP_COLLECTION, PROP_NONE);
3487  RNA_def_property_collection_sdna(prop, NULL, "vdata.layers", "vdata.totlayer");
3489  "rna_Mesh_vertex_paint_masks_begin",
3490  NULL,
3491  NULL,
3492  NULL,
3493  "rna_Mesh_vertex_paint_masks_length",
3494  NULL,
3495  NULL,
3496  NULL);
3497  RNA_def_property_struct_type(prop, "MeshPaintMaskLayer");
3499  RNA_def_property_ui_text(prop, "Vertex Paint Mask", "Vertex paint mask");
3500  rna_def_paint_mask(brna, prop);
3501  /* End paint mask */
3502 
3503  /* Attributes */
3505 
3506  /* Remesh */
3507  prop = RNA_def_property(srna, "remesh_voxel_size", PROP_FLOAT, PROP_DISTANCE);
3508  RNA_def_property_float_sdna(prop, NULL, "remesh_voxel_size");
3509  RNA_def_property_range(prop, 0.0001f, FLT_MAX);
3510  RNA_def_property_ui_range(prop, 0.0001f, FLT_MAX, 0.01, 4);
3512  "Voxel Size",
3513  "Size of the voxel in object space used for volume evaluation. Lower "
3514  "values preserve finer details");
3515  RNA_def_property_update(prop, 0, "rna_Mesh_update_draw");
3516 
3517  prop = RNA_def_property(srna, "remesh_voxel_adaptivity", PROP_FLOAT, PROP_DISTANCE);
3518  RNA_def_property_float_sdna(prop, NULL, "remesh_voxel_adaptivity");
3519  RNA_def_property_range(prop, 0.0f, 1.0f);
3520  RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.01, 4);
3522  prop,
3523  "Adaptivity",
3524  "Reduces the final face count by simplifying geometry where detail is not needed, "
3525  "generating triangles. A value greater than 0 disables Fix Poles");
3526  RNA_def_property_update(prop, 0, "rna_Mesh_update_draw");
3527 
3528  prop = RNA_def_property(srna, "use_remesh_fix_poles", PROP_BOOLEAN, PROP_NONE);
3530  RNA_def_property_ui_text(prop, "Fix Poles", "Produces less poles and a better topology flow");
3531  RNA_def_property_update(prop, 0, "rna_Mesh_update_draw");
3532 
3533  prop = RNA_def_property(srna, "use_remesh_preserve_volume", PROP_BOOLEAN, PROP_NONE);
3536  prop,
3537  "Preserve Volume",
3538  "Projects the mesh to preserve the volume and details of the original mesh");
3539  RNA_def_property_update(prop, 0, "rna_Mesh_update_draw");
3540 
3541  prop = RNA_def_property(srna, "use_remesh_preserve_paint_mask", PROP_BOOLEAN, PROP_NONE);
3543  RNA_def_property_ui_text(prop, "Preserve Paint Mask", "Keep the current mask on the new mesh");
3544  RNA_def_property_update(prop, 0, "rna_Mesh_update_draw");
3545 
3546  prop = RNA_def_property(srna, "use_remesh_preserve_sculpt_face_sets", PROP_BOOLEAN, PROP_NONE);
3549  prop, "Preserve Face Sets", "Keep the current Face Sets on the new mesh");
3550  RNA_def_property_update(prop, 0, "rna_Mesh_update_draw");
3551 
3552  prop = RNA_def_property(srna, "use_remesh_preserve_vertex_colors", PROP_BOOLEAN, PROP_NONE);
3555  prop, "Preserve Vertex Colors", "Keep the current vertex colors on the new mesh");
3556  RNA_def_property_update(prop, 0, "rna_Mesh_update_draw");
3557 
3558  prop = RNA_def_property(srna, "remesh_mode", PROP_ENUM, PROP_NONE);
3559  RNA_def_property_enum_sdna(prop, NULL, "remesh_mode");
3561  RNA_def_property_ui_text(prop, "Remesh Mode", "");
3562  RNA_def_property_update(prop, 0, "rna_Mesh_update_draw");
3563 
3564  /* End remesh */
3565 
3566  /* Symmetry */
3567  prop = RNA_def_property(srna, "use_mirror_x", PROP_BOOLEAN, PROP_NONE);
3568  RNA_def_property_boolean_sdna(prop, NULL, "symmetry", ME_SYMMETRY_X);
3569  RNA_def_property_ui_text(prop, "X", "Enable symmetry in the X axis");
3570  RNA_def_property_update(prop, 0, "rna_Mesh_update_draw");
3571 
3572  prop = RNA_def_property(srna, "use_mirror_y", PROP_BOOLEAN, PROP_NONE);
3573  RNA_def_property_boolean_sdna(prop, NULL, "symmetry", ME_SYMMETRY_Y);
3574  RNA_def_property_ui_text(prop, "Y", "Enable symmetry in the Y axis");
3575  RNA_def_property_update(prop, 0, "rna_Mesh_update_draw");
3576 
3577  prop = RNA_def_property(srna, "use_mirror_z", PROP_BOOLEAN, PROP_NONE);
3578  RNA_def_property_boolean_sdna(prop, NULL, "symmetry", ME_SYMMETRY_Z);
3579  RNA_def_property_ui_text(prop, "Z", "Enable symmetry in the Z axis");
3580  RNA_def_property_update(prop, 0, "rna_Mesh_update_draw");
3581 
3582  prop = RNA_def_property(srna, "use_mirror_vertex_groups", PROP_BOOLEAN, PROP_NONE);
3585  "Mirror Vertex Groups",
3586  "Mirror the left/right vertex groups when painting. The symmetry axis "
3587  "is determined by the symmetry settings");
3588  RNA_def_property_update(prop, 0, "rna_Mesh_update_draw");
3589  /* End Symmetry */
3590 
3591  prop = RNA_def_property(srna, "use_auto_smooth", PROP_BOOLEAN, PROP_NONE);
3594  prop,
3595  "Auto Smooth",
3596  "Auto smooth (based on smooth/sharp faces/edges and angle between faces), "
3597  "or use custom split normals data if available");
3598  RNA_def_property_update(prop, 0, "rna_Mesh_update_geom_and_params");
3599 
3600  prop = RNA_def_property(srna, "auto_smooth_angle", PROP_FLOAT, PROP_ANGLE);
3601  RNA_def_property_float_sdna(prop, NULL, "smoothresh");
3602  RNA_def_property_range(prop, 0.0f, DEG2RADF(180.0f));
3604  "Auto Smooth Angle",
3605  "Maximum angle between face normals that will be considered as smooth "
3606  "(unused if custom split normals data are available)");
3607  RNA_def_property_update(prop, 0, "rna_Mesh_update_geom_and_params");
3608 
3609  RNA_define_verify_sdna(false);
3610  prop = RNA_def_property(srna, "has_custom_normals", PROP_BOOLEAN, PROP_NONE);
3611  RNA_def_property_boolean_sdna(prop, NULL, "", 0);
3614  prop, "Has Custom Normals", "True if there are custom split normals data in this mesh");
3615  RNA_def_property_boolean_funcs(prop, "rna_Mesh_has_custom_normals_get", NULL);
3616  RNA_define_verify_sdna(true);
3617 
3618  prop = RNA_def_property(srna, "texco_mesh", PROP_POINTER, PROP_NONE);
3619  RNA_def_property_pointer_sdna(prop, NULL, "texcomesh");
3623  prop, "Texture Space Mesh", "Derive texture coordinates from another mesh");
3624 
3625  prop = RNA_def_property(srna, "shape_keys", PROP_POINTER, PROP_NONE);
3626  RNA_def_property_pointer_sdna(prop, NULL, "key");
3629  RNA_def_property_ui_text(prop, "Shape Keys", "");
3630 
3631  /* texture space */
3632  prop = RNA_def_property(srna, "use_auto_texspace", PROP_BOOLEAN, PROP_NONE);
3633  RNA_def_property_boolean_sdna(prop, NULL, "texflag", ME_AUTOSPACE);
3635  prop,
3636  "Auto Texture Space",
3637  "Adjust active object's texture space automatically when transforming object");
3638  RNA_def_property_update(prop, 0, "rna_Mesh_update_geom_and_params");
3639 
3640 # if 0
3641  prop = RNA_def_property(srna, "texspace_location", PROP_FLOAT, PROP_TRANSLATION);
3642  RNA_def_property_array(prop, 3);
3643  RNA_def_property_ui_text(prop, "Texture Space Location", "Texture space location");
3644  RNA_def_property_editable_func(prop, "rna_Mesh_texspace_editable");
3646  prop, "rna_Mesh_texspace_loc_get", "rna_Mesh_texspace_loc_set", NULL);
3647  RNA_def_property_update(prop, 0, "rna_Mesh_update_draw");
3648 # endif
3649 
3650  /* editflag */
3651  prop = RNA_def_property(srna, "use_mirror_topology", PROP_BOOLEAN, PROP_NONE);
3654  "Topology Mirror",
3655  "Use topology based mirroring "
3656  "(for when both sides of mesh have matching, unique topology)");
3657 
3658  prop = RNA_def_property(srna, "use_paint_mask", PROP_BOOLEAN, PROP_NONE);
3660  RNA_def_property_ui_text(prop, "Paint Mask", "Face selection masking for painting");
3661  RNA_def_property_ui_icon(prop, ICON_FACESEL, 0);
3662  RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, "rna_Mesh_update_facemask");
3663 
3664  prop = RNA_def_property(srna, "use_paint_mask_vertex", PROP_BOOLEAN, PROP_NONE);
3666  RNA_def_property_ui_text(prop, "Vertex Selection", "Vertex selection masking for painting");
3667  RNA_def_property_ui_icon(prop, ICON_VERTEXSEL, 0);
3668  RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, "rna_Mesh_update_vertmask");
3669 
3670  /* customdata flags */
3671  prop = RNA_def_property(srna, "use_customdata_vertex_bevel", PROP_BOOLEAN, PROP_NONE);
3673  RNA_def_property_ui_text(prop, "Store Vertex Bevel Weight", "");
3674 
3675  prop = RNA_def_property(srna, "use_customdata_edge_bevel", PROP_BOOLEAN, PROP_NONE);
3677  RNA_def_property_ui_text(prop, "Store Edge Bevel Weight", "");
3678 
3679  prop = RNA_def_property(srna, "use_customdata_vertex_crease", PROP_BOOLEAN, PROP_NONE);
3681  RNA_def_property_ui_text(prop, "Store Vertex Crease", "");
3682 
3683  prop = RNA_def_property(srna, "use_customdata_edge_crease", PROP_BOOLEAN, PROP_NONE);
3685  RNA_def_property_ui_text(prop, "Store Edge Crease", "");
3686 
3687  /* readonly editmesh info - use for extrude menu */
3688  prop = RNA_def_property(srna, "total_vert_sel", PROP_INT, PROP_UNSIGNED);
3689  RNA_def_property_int_funcs(prop, "rna_Mesh_tot_vert_get", NULL, NULL);
3690  RNA_def_property_ui_text(prop, "Selected Vertex Total", "Selected vertex count in editmode");
3692 
3693  prop = RNA_def_property(srna, "total_edge_sel", PROP_INT, PROP_UNSIGNED);
3694  RNA_def_property_int_funcs(prop, "rna_Mesh_tot_edge_get", NULL, NULL);
3695  RNA_def_property_ui_text(prop, "Selected Edge Total", "Selected edge count in editmode");
3697 
3698  prop = RNA_def_property(srna, "total_face_sel", PROP_INT, PROP_UNSIGNED);
3699  RNA_def_property_int_funcs(prop, "rna_Mesh_tot_face_get", NULL, NULL);
3700  RNA_def_property_ui_text(prop, "Selected Face Total", "Selected face count in editmode");
3702 
3703  prop = RNA_def_property(srna, "is_editmode", PROP_BOOLEAN, PROP_NONE);
3704  RNA_def_property_boolean_funcs(prop, "rna_Mesh_is_editmode_get", NULL);
3706  RNA_def_property_ui_text(prop, "Is Editmode", "True when used in editmode");
3707 
3708  /* pointers */
3710  rna_def_texmat_common(srna, "rna_Mesh_texspace_editable");
3711 
3712  RNA_api_mesh(srna);
3713 }
3714 
3716 {
3717  rna_def_mesh(brna);
3718  rna_def_mvert(brna);
3719  rna_def_mvert_group(brna);
3720  rna_def_medge(brna);
3721  rna_def_mlooptri(brna);
3722  rna_def_mloop(brna);
3723  rna_def_mpolygon(brna);
3724  rna_def_mloopuv(brna);
3725  rna_def_mloopcol(brna);
3726  rna_def_MPropCol(brna);
3727  rna_def_mproperties(brna);
3728  rna_def_face_map(brna);
3729 }
3730 
3731 #endif
3732 
typedef float(TangentPoint)[2]
Generic geometry attributes built on CustomData.
bool BKE_id_attribute_rename(struct ID *id, const char *old_name, const char *new_name, struct ReportList *reports)
Definition: attribute.cc:143
CustomData interface, see also DNA_customdata_types.h.
int CustomData_get_active_layer_index(const struct CustomData *data, int type)
int CustomData_number_of_layers(const struct CustomData *data, int type)
void CustomData_set_layer_active(struct CustomData *data, int type, int n)
Definition: customdata.cc:2542
@ CD_CALLOC
int CustomData_get_render_layer_index(const struct CustomData *data, int type)
void CustomData_set_layer_unique_name(struct CustomData *data, int index)
Definition: customdata.cc:4343
int CustomData_get_layer_index_n(const struct CustomData *data, int type, int n)
void CustomData_set_layer_render(struct CustomData *data, int type, int n)
Definition: customdata.cc:2551
void CustomData_set_layer_clone_index(struct CustomData *data, int type, int n)
Definition: customdata.cc:2602
int CustomData_get_layer_index(const struct CustomData *data, int type)
void * CustomData_get_layer(const struct CustomData *data, int type)
int CustomData_sizeof(int type)
Definition: customdata.cc:4268
int CustomData_get_clone_layer_index(const struct CustomData *data, int type)
void * CustomData_add_layer(struct CustomData *data, int type, eCDAllocType alloctype, void *layer, int totelem)
Definition: customdata.cc:2776
void * CustomData_get(const struct CustomData *data, int index, int type)
#define CD_TYPE_AS_MASK(_type)
void id_us_min(struct ID *id)
Definition: lib_id.c:313
void id_us_plus(struct ID *id)
Definition: lib_id.c:305
const float(* BKE_mesh_poly_normals_ensure(const struct Mesh *mesh))[3]
bool BKE_mesh_clear_facemap_customdata(struct Mesh *me)
Definition: mesh.cc:838
void BKE_mesh_tessface_clear(struct Mesh *mesh)
Definition: mesh.cc:1654
bool BKE_mesh_has_custom_loop_normals(struct Mesh *me)
Definition: mesh.cc:894
void BKE_mesh_calc_poly_center(const struct MPoly *mpoly, const struct MLoop *loopstart, const struct MVert *mvarray, float r_cent[3])
const float(* BKE_mesh_vertex_normals_ensure(const struct Mesh *mesh))[3]
bool BKE_mesh_ensure_facemap_customdata(struct Mesh *me)
Definition: mesh.cc:819
void BKE_mesh_update_customdata_pointers(struct Mesh *me, bool do_ensure_tess_cd)
Definition: mesh.cc:874
void BKE_mesh_calc_poly_normal(const struct MPoly *mpoly, const struct MLoop *loopstart, const struct MVert *mvarray, float r_no[3])
void BKE_mesh_batch_cache_dirty_tag(struct Mesh *me, eMeshBatchDirtyMode mode)
void BKE_mesh_texspace_ensure(struct Mesh *me)
Definition: mesh.cc:1268
void BKE_mesh_normals_tag_dirty(struct Mesh *mesh)
Definition: mesh_normals.cc:95
void BKE_mesh_texspace_get(struct Mesh *me, float r_loc[3], float r_size[3])
Definition: mesh.cc:1275
void BKE_mesh_tag_coords_changed(struct Mesh *mesh)
float BKE_mesh_calc_poly_area(const struct MPoly *mpoly, const struct MLoop *loopstart, const struct MVert *mvarray)
void BKE_mesh_polygon_flip(struct MPoly *mpoly, struct MLoop *mloop, struct CustomData *ldata)
void BKE_mesh_runtime_clear_geometry(struct Mesh *mesh)
@ BKE_MESH_BATCH_DIRTY_ALL
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.c:83
#define BLI_assert(a)
Definition: BLI_assert.h:46
#define BLI_assert_msg(a, msg)
Definition: BLI_assert.h:53
MINLINE int max_ii(int a, int b)
MINLINE unsigned char round_fl_to_uchar_clamp(float a)
float area_tri_v3(const float v1[3], const float v2[3], const float v3[3])
Definition: math_geom.c:92
float normal_tri_v3(float n[3], const float v1[3], const float v2[3], const float v3[3])
Definition: math_geom.c:33
#define DEG2RADF(_deg)
MINLINE void madd_v3_v3v3v3(float r[3], const float a[3], const float b[3], const float c[3])
MINLINE void mul_v3_fl(float r[3], float f)
MINLINE void copy_v3_v3(float r[3], const float a[3])
MINLINE void cross_v3_v3v3(float r[3], const float a[3], const float b[3])
MINLINE float normalize_v3_v3(float r[3], const float a[3])
MINLINE void zero_v3(float r[3])
size_t size_t char * BLI_sprintfN(const char *__restrict format,...) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1) ATTR_MALLOC ATTR_PRINTF_FORMAT(1
char * BLI_strncpy(char *__restrict dst, const char *__restrict src, size_t maxncpy) ATTR_NONNULL()
Definition: string.c:64
size_t size_t char size_t BLI_str_escape(char *__restrict dst, const char *__restrict src, size_t dst_maxncpy) ATTR_NONNULL()
Definition: string.c:250
char * BLI_strncpy_utf8(char *__restrict dst, const char *__restrict src, size_t maxncpy) ATTR_NONNULL(1
#define UNUSED_FUNCTION(x)
#define ARRAY_HAS_ITEM(arr_item, arr_start, arr_len)
#define UNUSED_VARS_NDEBUG(...)
#define UNUSED(x)
void DEG_id_tag_update(struct ID *id, int flag)
@ ID_RECALC_PARAMETERS
Definition: DNA_ID.h:854
@ ID_RECALC_GEOMETRY
Definition: DNA_ID.h:791
@ IDOVERRIDE_LIBRARY_OP_REPLACE
Definition: DNA_ID.h:220
#define CD_MASK_PROP_ALL
@ CD_PROP_BYTE_COLOR
@ CD_FACEMAP
@ CD_MLOOPTANGENT
@ CD_PAINT_MASK
@ CD_MVERT_SKIN
@ CD_PROP_FLOAT
@ CD_PROP_COLOR
@ CD_PROP_INT32
@ CD_FREESTYLE_EDGE
@ CD_FREESTYLE_FACE
@ CD_PROP_STRING
@ CD_MLOOPUV
@ REMESH_QUAD
@ REMESH_VOXEL
@ ME_EDIT_MIRROR_VERTEX_GROUPS
@ ME_EDIT_PAINT_VERT_SEL
@ ME_EDIT_PAINT_FACE_SEL
@ ME_EDIT_MIRROR_TOPO
@ ME_REMESH_REPROJECT_VOLUME
@ ME_REMESH_REPROJECT_VERTEX_COLORS
@ ME_REMESH_REPROJECT_SCULPT_FACE_SETS
@ ME_AUTOSMOOTH
@ ME_REMESH_FIX_POLES
@ ME_REMESH_REPROJECT_PAINT_MASK
@ ME_SYMMETRY_X
@ ME_SYMMETRY_Y
@ ME_SYMMETRY_Z
@ ME_AUTOSPACE
@ ME_CDFLAG_VERT_CREASE
@ ME_CDFLAG_EDGE_CREASE
@ ME_CDFLAG_VERT_BWEIGHT
@ ME_CDFLAG_EDGE_BWEIGHT
@ ME_HIDE
@ FREESTYLE_EDGE_MARK
@ ME_SMOOTH
@ ME_FACE_SEL
@ MVERT_SKIN_LOOSE
@ MVERT_SKIN_ROOT
@ MLOOPUV_PINNED
@ MLOOPUV_VERTSEL
@ MLOOPUV_EDGESEL
@ FREESTYLE_FACE_MARK
@ ME_SEAM
@ ME_LOOSEEDGE
@ ME_SHARP
Object is a sort of wrapper for general info.
bool ED_mesh_sculpt_color_remove_named(struct Mesh *me, const char *name)
Definition: mesh_data.cc:605
int ED_mesh_sculpt_color_add(struct Mesh *me, const char *name, bool active_set, bool do_init, struct ReportList *reports)
bool ED_mesh_uv_remove_named(struct Mesh *me, const char *name)
Definition: mesh_data.cc:361
int ED_mesh_color_add(struct Mesh *me, const char *name, bool active_set, bool do_init, struct ReportList *reports)
int ED_mesh_uv_add(struct Mesh *me, const char *name, bool active_set, bool do_init, struct ReportList *reports)
Definition: mesh_data.cc:244
bool ED_mesh_color_remove_named(struct Mesh *me, const char *name)
Definition: mesh_data.cc:470
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum type
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble GLdouble GLdouble zFar _GL_VOID_RET _GL_UINT GLdouble *equation _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLenum GLfloat *v _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLfloat *values _GL_VOID_RET _GL_VOID GLushort *values _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLenum GLdouble *params _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_BOOL GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLushort pattern _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint GLdouble v1
Read Guarded memory(de)allocation.
#define RNA_MAX_ARRAY_DIMENSION
Definition: RNA_define.h:28
@ PARM_RNAPTR
Definition: RNA_types.h:354
@ PARM_REQUIRED
Definition: RNA_types.h:352
@ FUNC_USE_REPORTS
Definition: RNA_types.h:663
@ FUNC_USE_SELF_ID
Definition: RNA_types.h:650
@ PROP_FLOAT
Definition: RNA_types.h:61
@ PROP_BOOLEAN
Definition: RNA_types.h:59
@ PROP_ENUM
Definition: RNA_types.h:63
@ PROP_INT
Definition: RNA_types.h:60
@ PROP_STRING
Definition: RNA_types.h:62
@ PROP_POINTER
Definition: RNA_types.h:64
@ PROP_COLLECTION
Definition: RNA_types.h:65
@ PROPOVERRIDE_OVERRIDABLE_LIBRARY
Definition: RNA_types.h:312
@ PROPOVERRIDE_IGNORE
Definition: RNA_types.h:332
@ PROP_THICK_WRAP
Definition: RNA_types.h:285
@ PROP_DYNAMIC
Definition: RNA_types.h:290
@ PROP_PROPORTIONAL
Definition: RNA_types.h:223
@ PROP_NEVER_UNLINK
Definition: RNA_types.h:246
@ PROP_EDITABLE
Definition: RNA_types.h:189
@ PROP_NEVER_NULL
Definition: RNA_types.h:239
@ PROP_PTR_NO_OWNERSHIP
Definition: RNA_types.h:257
@ PROP_ID_SELF_CHECK
Definition: RNA_types.h:232
@ PROP_DIRECTION
Definition: RNA_types.h:155
@ PROP_XYZ
Definition: RNA_types.h:162
@ PROP_DISTANCE
Definition: RNA_types.h:149
@ PROP_COLOR
Definition: RNA_types.h:153
@ PROP_ANGLE
Definition: RNA_types.h:145
@ PROP_NONE
Definition: RNA_types.h:126
@ PROP_TRANSLATION
Definition: RNA_types.h:154
@ PROP_UNSIGNED
Definition: RNA_types.h:142
#define NC_GEOM
Definition: WM_types.h:343
#define ND_DATA
Definition: WM_types.h:456
#define ND_SELECT
Definition: WM_types.h:455
#define ND_SPACE_VIEW3D
Definition: WM_types.h:471
#define NC_SPACE
Definition: WM_types.h:342
@ BMO_DELIM_NORMAL
@ BMO_DELIM_MATERIAL
@ BMO_DELIM_SEAM
@ BMO_DELIM_SHARP
@ BMO_DELIM_UV
return(oflags[bm->toolflag_index].f &oflag) !=0
ATTR_WARN_UNUSED_RESULT const BMVert * v2
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
Definition: btDbvt.cpp:52
#define SELECT
Scene scene
SyclQueue void void size_t num_bytes void
define("MAT_AOV_SUPPORT") .image_array_out(6
uint nor
static unsigned a[3]
Definition: RandGen.cpp:78
bool active
all scheduled work for the GPU.
T length(const vec_base< T, Size > &a)
static const pxr::TfToken b("b", pxr::TfToken::Immortal)
MutableSpan< float3 > normals
void RNA_pointer_create(ID *id, StructRNA *type, void *data, PointerRNA *r_ptr)
Definition: rna_access.c:136
const PointerRNA PointerRNA_NULL
Definition: rna_access.c:61
void rna_iterator_array_begin(CollectionPropertyIterator *iter, void *ptr, int itemsize, int length, bool free_ptr, IteratorSkipFunc skip)
Definition: rna_access.c:4781
void RNA_property_update_main(Main *bmain, Scene *scene, PointerRNA *ptr, PropertyRNA *prop)
Definition: rna_access.c:2143
void rna_def_animdata_common(StructRNA *srna)
void rna_def_attributes_common(StructRNA *srna)
void RNA_def_property_pointer_sdna(PropertyRNA *prop, const char *structname, const char *propname)
Definition: rna_define.c:2740
void RNA_def_struct_path_func(StructRNA *srna, const char *path)
Definition: rna_define.c:1193
PropertyRNA * RNA_def_boolean(StructOrFunctionRNA *cont_, const char *identifier, bool default_value, const char *ui_name, const char *ui_description)
Definition: rna_define.c:3493
PropertyRNA * RNA_def_pointer(StructOrFunctionRNA *cont_, const char *identifier, const char *type, const char *ui_name, const char *ui_description)
Definition: rna_define.c:4170
void RNA_def_property_boolean_sdna(PropertyRNA *prop, const char *structname, const char *propname, int64_t bit)
Definition: rna_define.c:2236
void RNA_def_property_string_funcs(PropertyRNA *prop, const char *get, const char *length, const char *set)
Definition: rna_define.c:3285
void RNA_def_function_return(FunctionRNA *func, PropertyRNA *ret)
Definition: rna_define.c:4312
void RNA_def_property_float_funcs(PropertyRNA *prop, const char *get, const char *set, const char *range)
Definition: rna_define.c:3126
void RNA_define_verify_sdna(bool verify)
Definition: rna_define.c:737
void RNA_def_property_ui_text(PropertyRNA *prop, const char *name, const char *description)
Definition: rna_define.c:1645
void RNA_def_property_ui_icon(PropertyRNA *prop, int icon, int consecutive)
Definition: rna_define.c:1653
FunctionRNA * RNA_def_function(StructRNA *srna, const char *identifier, const char *call)
Definition: rna_define.c:4273
void RNA_def_property_srna(PropertyRNA *prop, const char *type)
Definition: rna_define.c:3474
void RNA_def_property_collection_funcs(PropertyRNA *prop, const char *begin, const char *next, const char *end, const char *get, const char *length, const char *lookupint, const char *lookupstring, const char *assignint)
Definition: rna_define.c:3420
void RNA_def_struct_ui_text(StructRNA *srna, const char *name, const char *description)
Definition: rna_define.c:1237
void RNA_def_property_boolean_funcs(PropertyRNA *prop, const char *get, const char *set)
Definition: rna_define.c:2944
void RNA_def_property_dynamic_array_funcs(PropertyRNA *prop, const char *getlength)
Definition: rna_define.c:2926
void RNA_def_property_multi_array(PropertyRNA *prop, int dimension, const int length[])
Definition: rna_define.c:1598
void RNA_def_property_enum_items(PropertyRNA *prop, const EnumPropertyItem *item)
Definition: rna_define.c:1872
void RNA_def_struct_sdna(StructRNA *srna, const char *structname)
Definition: rna_define.c:1048
void RNA_def_property_array(PropertyRNA *prop, int length)
Definition: rna_define.c:1539
void RNA_def_property_range(PropertyRNA *prop, double min, double max)
Definition: rna_define.c:1737
void RNA_def_property_struct_type(PropertyRNA *prop, const char *type)
Definition: rna_define.c:1772
void RNA_def_property_collection_sdna(PropertyRNA *prop, const char *structname, const char *propname, const char *lengthpropname)
Definition: rna_define.c:2769
void RNA_def_function_ui_description(FunctionRNA *func, const char *description)
Definition: rna_define.c:4347
void RNA_def_property_update(PropertyRNA *prop, int noteflag, const char *func)
Definition: rna_define.c:2900
void RNA_def_property_editable_func(PropertyRNA *prop, const char *editable)
Definition: rna_define.c:2855
PropertyRNA * RNA_def_property(StructOrFunctionRNA *cont_, const char *identifier, int type, int subtype)
Definition: rna_define.c:1257
void RNA_def_struct_name_property(struct StructRNA *srna, struct PropertyRNA *prop)
Definition: rna_define.c:1103
void RNA_def_function_flag(FunctionRNA *func, int flag)
Definition: rna_define.c:4342
void RNA_def_property_clear_flag(PropertyRNA *prop, PropertyFlag flag)
Definition: rna_define.c:1495
void RNA_def_property_pointer_funcs(PropertyRNA *prop, const char *get, const char *set, const char *type_fn, const char *poll)
Definition: rna_define.c:3385
StructRNA * RNA_def_struct(BlenderRNA *brna, const char *identifier, const char *from)
Definition: rna_define.c:1028
void RNA_def_property_enum_sdna(PropertyRNA *prop, const char *structname, const char *propname)
Definition: rna_define.c:2601
void RNA_def_property_int_funcs(PropertyRNA *prop, const char *get, const char *set, const char *range)
Definition: rna_define.c:3028
void RNA_def_struct_ui_icon(StructRNA *srna, int icon)
Definition: rna_define.c:1245
PropertyRNA * RNA_def_string(StructOrFunctionRNA *cont_, const char *identifier, const char *default_value, int maxlen, const char *ui_name, const char *ui_description)
Definition: rna_define.c:3687
void RNA_def_property_override_funcs(PropertyRNA *prop, const char *diff, const char *store, const char *apply)
Definition: rna_define.c:2879
void RNA_def_property_flag(PropertyRNA *prop, PropertyFlag flag)
Definition: rna_define.c:1490
PropertyRNA * RNA_def_int(StructOrFunctionRNA *cont_, const char *identifier, int default_value, int hardmin, int hardmax, const char *ui_name, const char *ui_description, int softmin, int softmax)
Definition: rna_define.c:3597
void RNA_def_property_float_sdna(PropertyRNA *prop, const char *structname, const char *propname)
Definition: rna_define.c:2493
void RNA_def_property_ui_range(PropertyRNA *prop, double min, double max, double step, int precision)
Definition: rna_define.c:1664
void RNA_def_property_int_sdna(PropertyRNA *prop, const char *structname, const char *propname)
Definition: rna_define.c:2343
void RNA_def_property_override_flag(PropertyRNA *prop, PropertyOverrideFlag flag)
Definition: rna_define.c:1503
void RNA_def_parameter_flags(PropertyRNA *prop, PropertyFlag flag_property, ParameterFlag flag_parameter)
Definition: rna_define.c:1518
void rna_Mesh_update_draw(struct Main *bmain, struct Scene *scene, struct PointerRNA *ptr)
void RNA_api_mesh(struct StructRNA *srna)
Definition: rna_mesh_api.c:201
void rna_def_texmat_common(StructRNA *srna, const char *texspace_editable)
Definition: rna_mesh.c:2498
#define MESH_INT_PROPERTY_LAYER(elemname)
static void rna_def_mesh_edges(BlenderRNA *brna, PropertyRNA *cprop)
Definition: rna_mesh.c:2565
static void rna_def_mvert(BlenderRNA *brna)
Definition: rna_mesh.c:1810
#define MESH_STRING_PROPERTY_LAYER(elemname)
static void rna_def_mloopuv(BlenderRNA *brna)
Definition: rna_mesh.c:2171
static void rna_def_mlooptri(BlenderRNA *brna)
Definition: rna_mesh.c:1943
static void rna_def_uv_layers(BlenderRNA *brna, PropertyRNA *cprop)
Definition: rna_mesh.c:2767
static void rna_def_normal_layer_value(BlenderRNA *brna)
Definition: rna_mesh.c:2649
static void rna_def_mpolygon(BlenderRNA *brna)
Definition: rna_mesh.c:2079
static void rna_def_mesh_looptris(BlenderRNA *brna, PropertyRNA *cprop)
Definition: rna_mesh.c:2590
static void rna_def_face_map(BlenderRNA *brna)
Definition: rna_mesh.c:3078
static void rna_def_mesh_vertices(BlenderRNA *brna, PropertyRNA *cprop)
Definition: rna_mesh.c:2539
static void rna_def_vertex_int_layers(BlenderRNA *brna, PropertyRNA *cprop)
Definition: rna_mesh.c:2840
static void rna_def_polygon_string_layers(BlenderRNA *brna, PropertyRNA *cprop)
Definition: rna_mesh.c:2928
static void rna_def_mesh_polygons(BlenderRNA *brna, PropertyRNA *cprop)
Definition: rna_mesh.c:2623
#define MESH_FLOAT_PROPERTY_LAYER(elemname)
static void rna_def_mloopcol(BlenderRNA *brna)
Definition: rna_mesh.c:2238
static void rna_def_polygon_float_layers(BlenderRNA *brna, PropertyRNA *cprop)
Definition: rna_mesh.c:2884
void RNA_def_mesh(BlenderRNA *brna)
Definition: rna_mesh.c:3715
static void rna_def_vertex_float_layers(BlenderRNA *brna, PropertyRNA *cprop)
Definition: rna_mesh.c:2818
static void rna_def_vertex_string_layers(BlenderRNA *brna, PropertyRNA *cprop)
Definition: rna_mesh.c:2862
static void rna_def_paint_mask(BlenderRNA *brna, PropertyRNA *UNUSED(cprop))
Definition: rna_mesh.c:3043
static void rna_def_loop_colors(BlenderRNA *brna, PropertyRNA *cprop)
Definition: rna_mesh.c:2662
static void rna_def_MPropCol(BlenderRNA *brna)
Definition: rna_mesh.c:2297
const EnumPropertyItem rna_enum_mesh_delimit_mode_items[]
Definition: rna_mesh.c:36
static void rna_def_vert_colors(BlenderRNA *brna, PropertyRNA *cprop)
Definition: rna_mesh.c:2712
static void rna_def_face_maps(BlenderRNA *brna, PropertyRNA *cprop)
Definition: rna_mesh.c:3119
static void rna_def_mproperties(BlenderRNA *brna)
Definition: rna_mesh.c:2356
static void rna_def_mesh(BlenderRNA *brna)
Definition: rna_mesh.c:3156
static void rna_def_mvert_group(BlenderRNA *brna)
Definition: rna_mesh.c:1784
static void rna_def_vertex_creases(BlenderRNA *brna)
Definition: rna_mesh.c:3009
static void rna_def_polygon_int_layers(BlenderRNA *brna, PropertyRNA *cprop)
Definition: rna_mesh.c:2906
static void rna_def_skin_vertices(BlenderRNA *brna, PropertyRNA *UNUSED(cprop))
Definition: rna_mesh.c:2949
static const EnumPropertyItem rna_enum_mesh_remesh_mode_items[]
Definition: rna_mesh.c:45
static void rna_def_medge(BlenderRNA *brna)
Definition: rna_mesh.c:1878
static void rna_def_mloop(BlenderRNA *brna)
Definition: rna_mesh.c:2012
static void rna_def_mesh_loops(BlenderRNA *brna, PropertyRNA *cprop)
Definition: rna_mesh.c:2602
#define DEFINE_CUSTOMDATA_LAYER_COLLECTION(collection_name, customdata_type, layer_type)
#define DEFINE_CUSTOMDATA_LAYER_COLLECTION_ACTIVEITEM(collection_name, customdata_type, layer_type, active_type, layer_rna_type)
#define min(a, b)
Definition: sort.c:35
struct BMesh * bm
Definition: BKE_editmesh.h:40
int totfacesel
Definition: bmesh_class.h:298
CustomData vdata
Definition: bmesh_class.h:337
CustomData edata
Definition: bmesh_class.h:337
int totvertsel
Definition: bmesh_class.h:298
int totedgesel
Definition: bmesh_class.h:298
CustomData pdata
Definition: bmesh_class.h:337
CustomData ldata
Definition: bmesh_class.h:337
CustomDataLayer * layers
Definition: DNA_ID.h:368
int us
Definition: DNA_ID.h:388
unsigned char a
unsigned char b
unsigned char r
unsigned char g
struct MLoopTri * array
unsigned int poly
unsigned int tri[3]
unsigned int v
short mat_nr
float co[3]
Definition: BKE_main.h:121
struct MLoopTri_Store looptris
struct MEdge * medge
struct BMEditMesh * edit_mesh
CustomData vdata
struct Mesh * texcomesh
struct MVert * mvert
float size[3]
struct Material ** mat
struct MDeformVert * dvert
int totedge
char editflag
int totvert
struct MLoop * mloop
Mesh_Runtime runtime
CustomData pdata
CustomData fdata
int totpoly
short totcol
char texflag
CustomData edata
int totloop
struct MPoly * mpoly
CustomData ldata
float loc[3]
struct StructRNA * type
Definition: RNA_types.h:37
void * data
Definition: RNA_types.h:38
struct ID * owner_id
Definition: RNA_types.h:36
float max
void WM_main_add_notifier(unsigned int type, void *reference)
PointerRNA * ptr
Definition: wm_files.c:3480