Blender  V3.3
geometry_attributes.cc
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later
2  * Copyright 2020 Blender Foundation. All rights reserved. */
3 
8 #include "MEM_guardedalloc.h"
9 
10 #include "DNA_mesh_types.h"
11 #include "DNA_meshdata_types.h"
12 #include "DNA_scene_types.h"
13 
14 #include "BKE_attribute.h"
15 #include "BKE_context.h"
16 #include "BKE_deform.h"
17 #include "BKE_geometry_set.hh"
18 #include "BKE_lib_id.h"
19 #include "BKE_mesh.h"
20 #include "BKE_object_deform.h"
21 #include "BKE_paint.h"
22 #include "BKE_report.h"
23 
24 #include "RNA_access.h"
25 #include "RNA_define.h"
26 #include "RNA_enum_types.h"
27 
28 #include "DEG_depsgraph.h"
29 
30 #include "WM_api.h"
31 #include "WM_types.h"
32 
33 #include "UI_interface.h"
34 #include "UI_resources.h"
35 
36 #include "ED_geometry.h"
37 #include "ED_object.h"
38 
39 #include "geometry_intern.hh"
40 
42 
43 /*********************** Attribute Operators ************************/
44 
46 {
47  const Object *ob = ED_object_context(C);
48  const Main *bmain = CTX_data_main(C);
49  const ID *data = (ob) ? static_cast<ID *>(ob->data) : nullptr;
50  return (ob && BKE_id_is_editable(bmain, &ob->id) && data && BKE_id_is_editable(bmain, data)) &&
52 }
53 
55 {
57  return false;
58  }
59 
60  Object *ob = ED_object_context(C);
61  ID *data = (ob) ? static_cast<ID *>(ob->data) : nullptr;
62  if (BKE_id_attributes_active_get(data) != nullptr) {
63  return true;
64  }
65 
66  return false;
67 }
68 
71  PropertyRNA *UNUSED(prop),
72  bool *r_free)
73 {
74  if (C == nullptr) {
75  return DummyRNA_NULL_items;
76  }
77 
78  Object *ob = ED_object_context(C);
79  if (ob == nullptr) {
80  return DummyRNA_NULL_items;
81  }
82 
83  return rna_enum_attribute_domain_itemf(static_cast<ID *>(ob->data), false, r_free);
84 }
85 
87 {
88  Object *ob = ED_object_context(C);
89  ID *id = static_cast<ID *>(ob->data);
90 
91  char name[MAX_NAME];
92  RNA_string_get(op->ptr, "name", name);
94  eAttrDomain domain = (eAttrDomain)RNA_enum_get(op->ptr, "domain");
95  CustomDataLayer *layer = BKE_id_attribute_new(id, name, type, domain, op->reports);
96 
97  if (layer == nullptr) {
98  return OPERATOR_CANCELLED;
99  }
100 
101  BKE_id_attributes_active_set(id, layer);
102 
105 
106  return OPERATOR_FINISHED;
107 }
108 
109 static void next_color_attribute(ID *id, CustomDataLayer *layer, bool is_render)
110 {
112 
113  index++;
114 
116 
117  if (!layer) {
118  index = 0;
120  }
121 
122  if (layer) {
123  if (is_render) {
125  }
126  else {
128  }
129  }
130 }
131 
132 static void next_color_attributes(ID *id, CustomDataLayer *layer)
133 {
134  next_color_attribute(id, layer, false); /* active */
135  next_color_attribute(id, layer, true); /* render */
136 }
137 
139 {
140  /* identifiers */
141  ot->name = "Add Attribute";
142  ot->description = "Add attribute to geometry";
143  ot->idname = "GEOMETRY_OT_attribute_add";
144 
145  /* api callbacks */
149 
150  /* flags */
152 
153  /* properties */
154  PropertyRNA *prop;
155 
156  prop = RNA_def_string(ot->srna, "name", "Attribute", MAX_NAME, "Name", "Name of new attribute");
158 
159  prop = RNA_def_enum(ot->srna,
160  "domain",
163  "Domain",
164  "Type of element that attribute is stored on");
167 
168  prop = RNA_def_enum(ot->srna,
169  "data_type",
172  "Data Type",
173  "Type of data stored in attribute");
175 }
176 
178 {
179  Object *ob = ED_object_context(C);
180  ID *id = static_cast<ID *>(ob->data);
182 
183  next_color_attributes(id, layer);
184 
185  if (!BKE_id_attribute_remove(id, layer->name, op->reports)) {
186  return OPERATOR_CANCELLED;
187  }
188 
189  int *active_index = BKE_id_attributes_active_index_p(id);
190  if (*active_index > 0) {
191  *active_index -= 1;
192  }
193 
196 
197  return OPERATOR_FINISHED;
198 }
199 
201 {
202  /* identifiers */
203  ot->name = "Remove Attribute";
204  ot->description = "Remove attribute from geometry";
205  ot->idname = "GEOMETRY_OT_attribute_remove";
206 
207  /* api callbacks */
210 
211  /* flags */
213 }
214 
216 {
217  Object *ob = ED_object_context(C);
218  ID *id = static_cast<ID *>(ob->data);
219 
220  char name[MAX_NAME];
221  RNA_string_get(op->ptr, "name", name);
222  eCustomDataType type = (eCustomDataType)RNA_enum_get(op->ptr, "data_type");
223  eAttrDomain domain = (eAttrDomain)RNA_enum_get(op->ptr, "domain");
224  CustomDataLayer *layer = BKE_id_attribute_new(id, name, type, domain, op->reports);
225 
226  float color[4];
227  RNA_float_get_array(op->ptr, "color", color);
228 
229  if (layer == nullptr) {
230  return OPERATOR_CANCELLED;
231  }
232 
234 
237  }
238 
240 
243 
244  return OPERATOR_FINISHED;
245 }
246 
248  Generic,
249  UVMap,
250  VertexGroup,
251 };
252 
254 {
255  if (!geometry_attributes_poll(C)) {
256  return false;
257  }
258 
259  Object *ob = ED_object_context(C);
260  ID *data = static_cast<ID *>(ob->data);
261  if (GS(data->name) != ID_ME) {
262  return false;
263  }
264  if (CTX_data_edit_object(C) != nullptr) {
265  CTX_wm_operator_poll_msg_set(C, "Operation is not allowed in edit mode");
266  return false;
267  }
268  if (BKE_id_attributes_active_get(data) == nullptr) {
269  return false;
270  }
271  return true;
272 }
273 
275 {
276  Object *ob = ED_object_context(C);
277  ID *ob_data = static_cast<ID *>(ob->data);
279  const std::string name = layer->name;
280 
281  const ConvertAttributeMode mode = static_cast<ConvertAttributeMode>(
282  RNA_enum_get(op->ptr, "mode"));
283 
284  Mesh *mesh = reinterpret_cast<Mesh *>(ob_data);
286 
287  /* General conversion steps are always the same:
288  * 1. Convert old data to right domain and data type.
289  * 2. Copy the data into a new array so that it does not depend on the old attribute anymore.
290  * 3. Delete the old attribute.
291  * 4. Create a new attribute based on the previously copied data. */
292  switch (mode) {
294  const eAttrDomain dst_domain = static_cast<eAttrDomain>(RNA_enum_get(op->ptr, "domain"));
295  const eCustomDataType dst_type = static_cast<eCustomDataType>(
296  RNA_enum_get(op->ptr, "data_type"));
297 
298  if (ELEM(dst_type, CD_PROP_STRING)) {
299  BKE_report(op->reports, RPT_ERROR, "Cannot convert to the selected type");
300  return OPERATOR_CANCELLED;
301  }
302 
303  GVArray src_varray = attributes.lookup_or_default(name, dst_domain, dst_type);
304  const CPPType &cpp_type = src_varray.type();
305  void *new_data = MEM_malloc_arrayN(src_varray.size(), cpp_type.size(), __func__);
306  src_varray.materialize_to_uninitialized(new_data);
307  attributes.remove(name);
308  attributes.add(name, dst_domain, dst_type, blender::bke::AttributeInitMove(new_data));
309  break;
310  }
312  MLoopUV *dst_uvs = static_cast<MLoopUV *>(
313  MEM_calloc_arrayN(mesh->totloop, sizeof(MLoopUV), __func__));
314  VArray<float2> src_varray = attributes.lookup_or_default<float2>(
315  name, ATTR_DOMAIN_CORNER, {0.0f, 0.0f});
316  for (const int i : IndexRange(mesh->totloop)) {
317  copy_v2_v2(dst_uvs[i].uv, src_varray[i]);
318  }
319  attributes.remove(name);
321  &mesh->ldata, CD_MLOOPUV, CD_ASSIGN, dst_uvs, mesh->totloop, name.c_str());
322  break;
323  }
325  Array<float> src_weights(mesh->totvert);
326  VArray<float> src_varray = attributes.lookup_or_default<float>(
327  name, ATTR_DOMAIN_POINT, 0.0f);
328  src_varray.materialize(src_weights);
329  attributes.remove(name);
330 
331  bDeformGroup *defgroup = BKE_object_defgroup_new(ob, name.c_str());
332  const int defgroup_index = BLI_findindex(BKE_id_defgroup_list_get(&mesh->id), defgroup);
334  for (const int i : IndexRange(mesh->totvert)) {
335  const float weight = src_weights[i];
336  if (weight > 0.0f) {
337  BKE_defvert_add_index_notest(dverts + i, defgroup_index, weight);
338  }
339  }
340  break;
341  }
342  }
343 
344  int *active_index = BKE_id_attributes_active_index_p(&mesh->id);
345  if (*active_index > 0) {
346  *active_index -= 1;
347  }
348 
351 
352  return OPERATOR_FINISHED;
353 }
354 
356 {
357  uiLayout *layout = op->layout;
358  uiLayoutSetPropSep(layout, true);
359  uiLayoutSetPropDecorate(layout, false);
360 
361  uiItemR(layout, op->ptr, "name", 0, nullptr, ICON_NONE);
362  uiItemR(layout, op->ptr, "domain", UI_ITEM_R_EXPAND, nullptr, ICON_NONE);
363  uiItemR(layout, op->ptr, "data_type", UI_ITEM_R_EXPAND, nullptr, ICON_NONE);
364  uiItemR(layout, op->ptr, "color", 0, nullptr, ICON_NONE);
365 }
366 
368 {
369  /* identifiers */
370  ot->name = "Add Color Attribute";
371  ot->description = "Add color attribute to geometry";
372  ot->idname = "GEOMETRY_OT_color_attribute_add";
373 
374  /* api callbacks */
379 
380  /* flags */
382 
383  /* properties */
384  PropertyRNA *prop;
385 
386  prop = RNA_def_string(
387  ot->srna, "name", "Color", MAX_NAME, "Name", "Name of new color attribute");
389 
390  prop = RNA_def_enum(ot->srna,
391  "domain",
394  "Domain",
395  "Type of element that attribute is stored on");
396 
397  prop = RNA_def_enum(ot->srna,
398  "data_type",
401  "Data Type",
402  "Type of data stored in attribute");
403 
404  static float default_color[4] = {0.0f, 0.0f, 0.0f, 1.0f};
405 
406  prop = RNA_def_float_color(
407  ot->srna, "color", 4, nullptr, 0.0f, FLT_MAX, "Color", "Default fill color", 0.0f, 1.0f);
409  RNA_def_property_float_array_default(prop, default_color);
410 }
411 
413 {
414  Object *ob = ED_object_context(C);
415  ID *id = static_cast<ID *>(ob->data);
416 
417  char name[MAX_NAME];
418  RNA_string_get(op->ptr, "name", name);
419 
421  layer = !layer ? BKE_id_attribute_find(id, name, CD_PROP_BYTE_COLOR, ATTR_DOMAIN_POINT) : layer;
422  layer = !layer ? BKE_id_attribute_find(id, name, CD_PROP_COLOR, ATTR_DOMAIN_CORNER) : layer;
423  layer = !layer ? BKE_id_attribute_find(id, name, CD_PROP_BYTE_COLOR, ATTR_DOMAIN_CORNER) : layer;
424 
425  if (layer) {
427 
430 
431  return OPERATOR_FINISHED;
432  }
433 
434  return OPERATOR_CANCELLED;
435 }
436 
438 {
439  /* identifiers */
440  ot->name = "Set Render Color";
441  ot->description = "Set default color attribute used for rendering";
442  ot->idname = "GEOMETRY_OT_color_attribute_render_set";
443 
444  /* api callbacks */
447 
448  /* flags */
450 
451  /* properties */
452  PropertyRNA *prop;
453 
454  prop = RNA_def_string(ot->srna, "name", "Color", MAX_NAME, "Name", "Name of color attribute");
456 }
457 
459 {
460  Object *ob = ED_object_context(C);
461  ID *id = static_cast<ID *>(ob->data);
463 
464  if (layer == nullptr) {
465  return OPERATOR_CANCELLED;
466  }
467 
468  next_color_attributes(id, layer);
469 
470  if (!BKE_id_attribute_remove(id, layer->name, op->reports)) {
471  return OPERATOR_CANCELLED;
472  }
473 
474  if (GS(id->name) == ID_ME) {
475  Mesh *me = static_cast<Mesh *>(ob->data);
477  }
478 
481 
482  return OPERATOR_FINISHED;
483 }
484 
486 {
487  if (!geometry_attributes_poll(C)) {
488  return false;
489  }
490 
491  Object *ob = ED_object_context(C);
492  ID *data = ob ? static_cast<ID *>(ob->data) : nullptr;
493 
494  if (BKE_id_attributes_active_color_get(data) != nullptr) {
495  return true;
496  }
497 
498  return false;
499 }
500 
502 {
503  /* identifiers */
504  ot->name = "Remove Color Attribute";
505  ot->description = "Remove color attribute from geometry";
506  ot->idname = "GEOMETRY_OT_color_attribute_remove";
507 
508  /* api callbacks */
511 
512  /* flags */
514 }
515 
517 {
518  Object *ob = ED_object_context(C);
519  ID *id = static_cast<ID *>(ob->data);
521 
522  if (layer == nullptr) {
523  return OPERATOR_CANCELLED;
524  }
525 
526  CustomDataLayer *new_layer = BKE_id_attribute_duplicate(id, layer->name, op->reports);
527  if (new_layer == nullptr) {
528  return OPERATOR_CANCELLED;
529  }
530 
531  BKE_id_attributes_active_color_set(id, new_layer);
532 
535 
536  return OPERATOR_FINISHED;
537 }
538 
540 {
541  if (!geometry_attributes_poll(C)) {
542  return false;
543  }
544  if (CTX_data_edit_object(C) != nullptr) {
545  CTX_wm_operator_poll_msg_set(C, "Operation is not allowed in edit mode");
546  return false;
547  }
548 
549  Object *ob = ED_object_context(C);
550  ID *data = ob ? static_cast<ID *>(ob->data) : nullptr;
551 
552  if (BKE_id_attributes_active_color_get(data) != nullptr) {
553  return true;
554  }
555 
556  return false;
557 }
558 
560 {
561  /* identifiers */
562  ot->name = "Duplicate Color Attribute";
563  ot->description = "Duplicate color attribute";
564  ot->idname = "GEOMETRY_OT_color_attribute_duplicate";
565 
566  /* api callbacks */
569 
570  /* flags */
572 }
573 
575 {
576  uiLayout *layout = op->layout;
577  uiLayoutSetPropSep(layout, true);
578  uiLayoutSetPropDecorate(layout, false);
579 
580  uiItemR(layout, op->ptr, "mode", 0, nullptr, ICON_NONE);
581 
582  const ConvertAttributeMode mode = static_cast<ConvertAttributeMode>(
583  RNA_enum_get(op->ptr, "mode"));
584 
585  if (mode == ConvertAttributeMode::Generic) {
586  uiItemR(layout, op->ptr, "domain", 0, nullptr, ICON_NONE);
587  uiItemR(layout, op->ptr, "data_type", 0, nullptr, ICON_NONE);
588  }
589 }
590 
592  wmOperator *op,
593  const wmEvent *UNUSED(event))
594 {
595  return WM_operator_props_dialog_popup(C, op, 300);
596 }
597 
599 {
600  ot->name = "Convert Attribute";
601  ot->description = "Change how the attribute is stored";
602  ot->idname = "GEOMETRY_OT_attribute_convert";
603 
608 
610 
611  static EnumPropertyItem mode_items[] = {
612  {int(ConvertAttributeMode::Generic), "GENERIC", 0, "Generic", ""},
613  {int(ConvertAttributeMode::UVMap), "UV_MAP", 0, "UV Map", ""},
614  {int(ConvertAttributeMode::VertexGroup), "VERTEX_GROUP", 0, "Vertex Group", ""},
615  {0, nullptr, 0, nullptr, nullptr},
616  };
617 
618  PropertyRNA *prop;
619 
620  RNA_def_enum(
621  ot->srna, "mode", mode_items, static_cast<int>(ConvertAttributeMode::Generic), "Mode", "");
622 
623  prop = RNA_def_enum(ot->srna,
624  "domain",
627  "Domain",
628  "Which geometry element to move the attribute to");
630 
631  RNA_def_enum(
632  ot->srna, "data_type", rna_enum_attribute_type_items, CD_PROP_FLOAT, "Data Type", "");
633 }
634 
635 } // namespace blender::ed::geometry
636 
637 using blender::CPPType;
638 using blender::GVArray;
639 
641  const char *layer_name,
642  eCustomDataType old_type,
643  eAttrDomain old_domain,
644  eCustomDataType new_type,
645  eAttrDomain new_domain)
646 {
647  CustomDataLayer *layer = BKE_id_attribute_find(&mesh->id, layer_name, old_type, old_domain);
648  const std::string name = layer->name;
649 
650  if (!layer) {
651  return false;
652  }
653 
655  *mesh);
656 
657  GVArray src_varray = attributes.lookup_or_default(name, new_domain, new_type);
658 
659  const CPPType &cpp_type = src_varray.type();
660  void *new_data = MEM_malloc_arrayN(src_varray.size(), cpp_type.size(), __func__);
661  src_varray.materialize_to_uninitialized(new_data);
662  attributes.remove(name);
663  attributes.add(name, new_domain, new_type, blender::bke::AttributeInitMove(new_data));
664 
665  int *active_index = BKE_id_attributes_active_index_p(&mesh->id);
666  if (*active_index > 0) {
667  *active_index -= 1;
668  }
669 
670  return true;
671 }
Generic geometry attributes built on CustomData.
void BKE_id_attributes_active_color_set(struct ID *id, struct CustomDataLayer *active_layer)
Definition: attribute.cc:715
eAttrDomain
Definition: BKE_attribute.h:25
@ ATTR_DOMAIN_POINT
Definition: BKE_attribute.h:27
@ ATTR_DOMAIN_CORNER
Definition: BKE_attribute.h:30
bool BKE_id_attribute_remove(struct ID *id, const char *name, struct ReportList *reports)
Definition: attribute.cc:288
struct CustomDataLayer * BKE_id_attributes_active_get(struct ID *id)
Definition: attribute.cc:458
bool BKE_id_attributes_supported(const struct ID *id)
struct CustomDataLayer * BKE_id_attribute_find(const struct ID *id, const char *name, int type, eAttrDomain domain)
int * BKE_id_attributes_active_index_p(struct ID *id)
Definition: attribute.cc:512
void BKE_id_attributes_render_color_set(struct ID *id, struct CustomDataLayer *active_layer)
Definition: attribute.cc:727
struct CustomDataLayer * BKE_id_attributes_active_color_get(const struct ID *id)
struct CustomDataLayer * BKE_id_attribute_new(struct ID *id, const char *name, int type, eAttrDomain domain, struct ReportList *reports)
Definition: attribute.cc:220
void BKE_id_attributes_active_set(struct ID *id, struct CustomDataLayer *layer)
Definition: attribute.cc:488
int BKE_id_attribute_to_index(const struct ID *id, const CustomDataLayer *layer, eAttrDomainMask domain_mask, eCustomDataMask layer_mask)
struct CustomDataLayer * BKE_id_attributes_render_color_get(const struct ID *id)
CustomDataLayer * BKE_id_attribute_from_index(struct ID *id, int lookup_index, eAttrDomainMask domain_mask, eCustomDataMask layer_mask)
Definition: attribute.cc:551
struct CustomDataLayer * BKE_id_attribute_duplicate(struct ID *id, const char *name, struct ReportList *reports)
Definition: attribute.cc:256
#define ATTR_DOMAIN_MASK_COLOR
Definition: BKE_attribute.h:48
struct Object * CTX_data_edit_object(const bContext *C)
Definition: context.c:1370
void CTX_wm_operator_poll_msg_set(struct bContext *C, const char *msg)
Definition: context.c:1042
struct Main * CTX_data_main(const bContext *C)
Definition: context.c:1074
@ CD_ASSIGN
void * CustomData_add_layer_named(struct CustomData *data, int type, eCDAllocType alloctype, void *layer, int totelem, const char *name)
Definition: customdata.cc:2792
support for deformation groups and hooks.
const struct ListBase * BKE_id_defgroup_list_get(const struct ID *id)
struct bDeformGroup * BKE_object_defgroup_new(struct Object *ob, const char *name)
Definition: deform.c:43
void BKE_defvert_add_index_notest(struct MDeformVert *dv, int defgroup, float weight)
Definition: deform.c:779
bool BKE_id_is_editable(const struct Main *bmain, const struct ID *id)
void BKE_mesh_update_customdata_pointers(struct Mesh *me, bool do_ensure_tess_cd)
Definition: mesh.cc:874
Functions for dealing with objects and deform verts, used by painting and tools.
struct MDeformVert * BKE_object_defgroup_data_create(struct ID *id)
bool BKE_object_attributes_active_color_fill(struct Object *ob, const float fill_color[4], bool only_selected)
void BKE_report(ReportList *reports, eReportType type, const char *message)
Definition: report.c:83
int BLI_findindex(const struct ListBase *listbase, const void *vlink) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
MINLINE void copy_v2_v2(float r[2], const float a[2])
#define UNUSED(x)
#define ELEM(...)
void DEG_id_tag_update(struct ID *id, int flag)
@ ID_RECALC_GEOMETRY
Definition: DNA_ID.h:791
@ ID_ME
Definition: DNA_ID_enums.h:48
#define CD_MASK_COLOR_ALL
eCustomDataType
@ CD_PROP_BYTE_COLOR
@ CD_PROP_FLOAT
@ CD_PROP_COLOR
@ CD_PROP_STRING
@ CD_MLOOPUV
#define MAX_NAME
Definition: DNA_defs.h:48
@ OPERATOR_CANCELLED
@ OPERATOR_FINISHED
struct Object * ED_object_context(const struct bContext *C)
_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
Read Guarded memory(de)allocation.
Group Output data from inside of a node group A color picker Mix two input colors RGB to Convert a color s luminance to a grayscale value Generate a normal vector and a dot product Bright Control the brightness and contrast of the input color Vector Map an input vectors to used to fine tune the interpolation of the input Camera Retrieve information about the camera and how it relates to the current shading point s position Clamp a value between a minimum and a maximum Vector Perform vector math operation Invert a color
const EnumPropertyItem * rna_enum_attribute_domain_itemf(struct ID *id, bool include_instances, bool *r_free)
@ PROP_SKIP_SAVE
Definition: RNA_types.h:218
@ PROP_COLOR
Definition: RNA_types.h:153
#define C
Definition: RandGen.cpp:25
void uiLayoutSetPropSep(uiLayout *layout, bool is_sep)
@ UI_ITEM_R_EXPAND
void uiItemR(uiLayout *layout, struct PointerRNA *ptr, const char *propname, int flag, const char *name, int icon)
void uiLayoutSetPropDecorate(uiLayout *layout, bool is_sep)
@ OPTYPE_INTERNAL
Definition: WM_types.h:168
@ OPTYPE_UNDO
Definition: WM_types.h:148
@ OPTYPE_REGISTER
Definition: WM_types.h:146
#define NC_GEOM
Definition: WM_types.h:343
#define ND_DATA
Definition: WM_types.h:456
int64_t size() const
const CPPType & type() const
void materialize_to_uninitialized(void *dst) const
void materialize(MutableSpan< T > r_span) const
GVArray lookup_or_default(const AttributeIDRef &attribute_id, const eAttrDomain domain, const eCustomDataType data_type, const void *default_value=nullptr) const
bool add(const AttributeIDRef &attribute_id, const eAttrDomain domain, const eCustomDataType data_type, const AttributeInit &initializer)
bool remove(const AttributeIDRef &attribute_id)
bool ED_geometry_attribute_convert(Mesh *mesh, const char *layer_name, eCustomDataType old_type, eAttrDomain old_domain, eCustomDataType new_type, eAttrDomain new_domain)
#define GS(x)
Definition: iris.c:225
void *(* MEM_malloc_arrayN)(size_t len, size_t size, const char *str)
Definition: mallocn.c:34
void *(* MEM_calloc_arrayN)(size_t len, size_t size, const char *str)
Definition: mallocn.c:32
MutableAttributeAccessor mesh_attributes_for_write(Mesh &mesh)
static bool geometry_attributes_poll(bContext *C)
void GEOMETRY_OT_attribute_add(wmOperatorType *ot)
static int geometry_attribute_convert_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
static int geometry_attribute_add_exec(bContext *C, wmOperator *op)
void GEOMETRY_OT_color_attribute_add(wmOperatorType *ot)
void GEOMETRY_OT_attribute_convert(wmOperatorType *ot)
void GEOMETRY_OT_color_attribute_duplicate(wmOperatorType *ot)
static void geometry_color_attribute_add_ui(bContext *UNUSED(C), wmOperator *op)
static const EnumPropertyItem * geometry_attribute_domain_itemf(bContext *C, PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), bool *r_free)
static int geometry_attribute_remove_exec(bContext *C, wmOperator *op)
static bool geometry_attributes_remove_poll(bContext *C)
static void geometry_attribute_convert_ui(bContext *UNUSED(C), wmOperator *op)
void GEOMETRY_OT_attribute_remove(wmOperatorType *ot)
void GEOMETRY_OT_color_attribute_render_set(wmOperatorType *ot)
static int geometry_color_attribute_add_exec(bContext *C, wmOperator *op)
static bool geometry_color_attributes_remove_poll(bContext *C)
static bool geometry_attribute_convert_poll(bContext *C)
static int geometry_color_attribute_duplicate_exec(bContext *C, wmOperator *op)
static int geometry_color_attribute_set_render_exec(bContext *C, wmOperator *op)
static int geometry_attribute_convert_exec(bContext *C, wmOperator *op)
static int geometry_color_attribute_remove_exec(bContext *C, wmOperator *op)
static bool geometry_color_attributes_duplicate_poll(bContext *C)
static void next_color_attributes(ID *id, CustomDataLayer *layer)
void GEOMETRY_OT_color_attribute_remove(wmOperatorType *ot)
static void next_color_attribute(ID *id, CustomDataLayer *layer, bool is_render)
static const EnumPropertyItem mode_items[]
Definition: paint_mask.c:59
void RNA_float_get_array(PointerRNA *ptr, const char *name, float *values)
Definition: rna_access.c:4980
void RNA_string_get(PointerRNA *ptr, const char *name, char *value)
Definition: rna_access.c:5116
int RNA_enum_get(PointerRNA *ptr, const char *name)
Definition: rna_access.c:5004
const EnumPropertyItem rna_enum_color_attribute_domain_items[]
const EnumPropertyItem rna_enum_attribute_domain_items[]
Definition: rna_attribute.c:70
const EnumPropertyItem rna_enum_attribute_type_items[]
Definition: rna_attribute.c:26
const EnumPropertyItem rna_enum_color_attribute_type_items[]
Definition: rna_attribute.c:43
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
PropertyRNA * RNA_def_float_color(StructOrFunctionRNA *cont_, const char *identifier, int len, const float *default_value, float hardmin, float hardmax, const char *ui_name, const char *ui_description, float softmin, float softmax)
Definition: rna_define.c:3922
void RNA_def_property_flag(PropertyRNA *prop, PropertyFlag flag)
Definition: rna_define.c:1490
void RNA_def_enum_funcs(PropertyRNA *prop, EnumPropertyItemFunc itemfunc)
Definition: rna_define.c:3830
void RNA_def_property_subtype(PropertyRNA *prop, PropertySubType subtype)
Definition: rna_define.c:1534
PropertyRNA * RNA_def_enum(StructOrFunctionRNA *cont_, const char *identifier, const EnumPropertyItem *items, int default_value, const char *ui_name, const char *ui_description)
Definition: rna_define.c:3783
void RNA_def_property_float_array_default(PropertyRNA *prop, const float *array)
Definition: rna_define.c:2043
const EnumPropertyItem DummyRNA_NULL_items[]
Definition: rna_rna.c:26
Definition: DNA_ID.h:368
char name[66]
Definition: DNA_ID.h:378
Definition: BKE_main.h:121
int totvert
int totloop
CustomData ldata
void * data
int(* invoke)(struct bContext *, struct wmOperator *, const struct wmEvent *) ATTR_WARN_UNUSED_RESULT
Definition: WM_types.h:919
const char * name
Definition: WM_types.h:888
const char * idname
Definition: WM_types.h:890
bool(* poll)(struct bContext *) ATTR_WARN_UNUSED_RESULT
Definition: WM_types.h:943
struct StructRNA * srna
Definition: WM_types.h:969
const char * description
Definition: WM_types.h:893
void(* ui)(struct bContext *, struct wmOperator *)
Definition: WM_types.h:954
int(* exec)(struct bContext *, struct wmOperator *) ATTR_WARN_UNUSED_RESULT
Definition: WM_types.h:903
struct ReportList * reports
struct uiLayout * layout
struct PointerRNA * ptr
void WM_main_add_notifier(unsigned int type, void *reference)
PointerRNA * ptr
Definition: wm_files.c:3480
wmOperatorType * ot
Definition: wm_files.c:3479
int WM_operator_props_popup_confirm(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
int WM_operator_props_dialog_popup(bContext *C, wmOperator *op, int width)