Blender V5.0
rna_attribute.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2023 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
8
9#include <cstdlib>
10
11#include "RNA_define.hh"
12#include "RNA_enum_types.hh"
13
14#include "rna_internal.hh"
15
17
18#include "BKE_attribute.hh"
19
20#include "BLT_translation.hh"
21
22#include "WM_types.hh"
23
24#include "UI_resources.hh"
25
27
29 {CD_PROP_FLOAT, "FLOAT", 0, "Float", "Floating-point value"},
30 {CD_PROP_INT32, "INT", 0, "Integer", "32-bit integer"},
31 {CD_PROP_BOOL, "BOOLEAN", 0, "Boolean", "True or false"},
32 {CD_PROP_FLOAT3, "FLOAT_VECTOR", 0, "Vector", "3D vector with floating-point values"},
33 {CD_PROP_COLOR, "FLOAT_COLOR", 0, "Color", "RGBA color with 32-bit floating-point values"},
34 {CD_PROP_QUATERNION, "QUATERNION", 0, "Quaternion", "Floating point quaternion rotation"},
35 {CD_PROP_FLOAT4X4, "FLOAT4X4", 0, "4x4 Matrix", "Floating point matrix"},
36 {CD_PROP_STRING, "STRING", 0, "String", "Text string"},
37 {CD_PROP_INT8, "INT8", 0, "8-Bit Integer", "Smaller integer with a range from -128 to 127"},
38 {CD_PROP_INT16_2D, "INT16_2D", 0, "2D 16-Bit Integer Vector", "16-bit signed integer vector"},
39 {CD_PROP_INT32_2D, "INT32_2D", 0, "2D Integer Vector", "32-bit signed integer vector"},
40 {CD_PROP_FLOAT2, "FLOAT2", 0, "2D Vector", "2D vector with floating-point values"},
42 "BYTE_COLOR",
43 0,
44 "Byte Color",
45 "RGBA color with 8-bit positive integer values"},
46 {0, nullptr, 0, nullptr, nullptr},
47};
48
50 {CD_PROP_COLOR, "FLOAT_COLOR", 0, "Color", "RGBA color 32-bit floating-point values"},
52 "BYTE_COLOR",
53 0,
54 "Byte Color",
55 "RGBA color with 8-bit positive integer values"},
56 {0, nullptr, 0, nullptr, nullptr}};
57
59 {CD_AUTO_FROM_NAME, "AUTO", 0, "Auto", ""},
60 {CD_PROP_FLOAT, "FLOAT", 0, "Float", "Floating-point value"},
61 {CD_PROP_INT32, "INT", 0, "Integer", "32-bit integer"},
62 {CD_PROP_BOOL, "BOOLEAN", 0, "Boolean", "True or false"},
63 {CD_PROP_FLOAT3, "FLOAT_VECTOR", 0, "Vector", "3D vector with floating-point values"},
64 {CD_PROP_COLOR, "FLOAT_COLOR", 0, "Color", "RGBA color with 32-bit floating-point values"},
65 {CD_PROP_QUATERNION, "QUATERNION", 0, "Quaternion", "Floating point quaternion rotation"},
66 {CD_PROP_FLOAT4X4, "FLOAT4X4", 0, "4x4 Matrix", "Floating point matrix"},
67 {CD_PROP_STRING, "STRING", 0, "String", "Text string"},
68 {CD_PROP_INT8, "INT8", 0, "8-Bit Integer", "Smaller integer with a range from -128 to 127"},
69 {CD_PROP_INT16_2D, "INT16_2D", 0, "2D 16-Bit Integer Vector", "16-bit signed integer vector"},
70 {CD_PROP_INT32_2D, "INT32_2D", 0, "2D Integer Vector", "32-bit signed integer vector"},
71 {CD_PROP_FLOAT2, "FLOAT2", 0, "2D Vector", "2D vector with floating-point values"},
73 "BYTE_COLOR",
74 0,
75 "Byte Color",
76 "RGBA color with 8-bit positive integer values"},
77 {0, nullptr, 0, nullptr, nullptr},
78};
79
82 "ARRAY",
83 0,
84 "Array",
85 "Store a value for every element"},
87 "SINGLE",
88 0,
89 "Single",
90 "Store a single value for the entire domain"},
91 {0, nullptr, 0, nullptr, nullptr},
92};
93
95 /* Not implement yet */
96 // {ATTR_DOMAIN_GEOMETRY, "GEOMETRY", 0, "Geometry", "Attribute on (whole) geometry"},
97 {int(AttrDomain::Point), "POINT", 0, "Point", "Attribute on point"},
98 {int(AttrDomain::Edge), "EDGE", 0, "Edge", "Attribute on mesh edge"},
99 {int(AttrDomain::Face), "FACE", 0, "Face", "Attribute on mesh faces"},
100 {int(AttrDomain::Corner), "CORNER", 0, "Face Corner", "Attribute on mesh face corner"},
101 /* Not implement yet */
102 // {ATTR_DOMAIN_GRIDS, "GRIDS", 0, "Grids", "Attribute on mesh multires grids"},
103 {int(AttrDomain::Curve), "CURVE", 0, "Spline", "Attribute on spline"},
104 {int(AttrDomain::Instance), "INSTANCE", 0, "Instance", "Attribute on instance"},
105 {int(AttrDomain::Layer), "LAYER", 0, "Layer", "Attribute on Grease Pencil layer"},
106 {0, nullptr, 0, nullptr, nullptr},
107};
108
110 {int(AttrDomain::Point), "POINT", 0, "Point", "Attribute on point"},
111 {int(AttrDomain::Edge), "EDGE", 0, "Edge", "Attribute on mesh edge"},
112 {int(AttrDomain::Face), "FACE", 0, "Face", "Attribute on mesh faces"},
113 {int(AttrDomain::Corner), "CORNER", 0, "Face Corner", "Attribute on mesh face corner"},
114 {0, nullptr, 0, nullptr, nullptr},
115};
116
118 {int(AttrDomain::Point), "POINT", 0, "Point", "Attribute on point"},
119 {int(AttrDomain::Face), "FACE", 0, "Face", "Attribute on mesh faces"},
120 {int(AttrDomain::Corner), "CORNER", 0, "Face Corner", "Attribute on mesh face corner"},
121 {0, nullptr, 0, nullptr, nullptr},
122};
123
125 {int(AttrDomain::Point), "POINT", 0, "Point", "Attribute on point"},
126 {int(AttrDomain::Edge), "EDGE", 0, "Edge", "Attribute on mesh edge"},
127 {int(AttrDomain::Face), "FACE", 0, "Face", "Attribute on mesh faces"},
128 {0, nullptr, 0, nullptr, nullptr},
129};
130
132 {int(AttrDomain::Point), "POINT", 0, "Point", "Attribute on point"},
133 {int(AttrDomain::Face), "FACE", 0, "Face", "Attribute on mesh faces"},
134 {int(AttrDomain::Curve), "CURVE", 0, "Spline", "Attribute on spline"},
135 {0, nullptr, 0, nullptr, nullptr},
136};
137
139 {int(AttrDomain::Point), "POINT", 0, "Point", "Attribute on point"},
140 {int(AttrDomain::Edge), "EDGE", 0, "Edge", "Attribute on mesh edge"},
141 {int(AttrDomain::Face), "FACE", 0, "Face", "Attribute on mesh faces"},
142 {int(AttrDomain::Curve), "CURVE", 0, "Spline", "Attribute on spline"},
143 {0, nullptr, 0, nullptr, nullptr},
144};
145
147 {int(AttrDomain::Edge), "EDGE", 0, "Edge", "Attribute on mesh edge"},
148 {int(AttrDomain::Face), "FACE", 0, "Face", "Attribute on mesh faces"},
149 {0, nullptr, 0, nullptr, nullptr},
150};
151
153 {int(AttrDomain::Point), "POINT", 0, "Point", "Attribute on point"},
154 {int(AttrDomain::Edge), "EDGE", 0, "Edge", "Attribute on mesh edge"},
155 {int(AttrDomain::Face), "FACE", 0, "Face", "Attribute on mesh faces"},
156 {int(AttrDomain::Curve), "CURVE", 0, "Spline", "Attribute on spline"},
157 {int(AttrDomain::Instance), "INSTANCE", 0, "Instance", "Attribute on instance"},
158 {int(AttrDomain::Layer), "LAYER", 0, "Layer", "Attribute on Grease Pencil layer"},
159 {0, nullptr, 0, nullptr, nullptr},
160};
161
163 {int(AttrDomain::Auto), "AUTO", 0, "Auto", ""},
164 {int(AttrDomain::Point), "POINT", 0, "Point", "Attribute on point"},
165 {int(AttrDomain::Edge), "EDGE", 0, "Edge", "Attribute on mesh edge"},
166 {int(AttrDomain::Face), "FACE", 0, "Face", "Attribute on mesh faces"},
167 {int(AttrDomain::Corner), "CORNER", 0, "Face Corner", "Attribute on mesh face corner"},
168 {int(AttrDomain::Curve), "CURVE", 0, "Spline", "Attribute on spline"},
169 {int(AttrDomain::Instance), "INSTANCE", 0, "Instance", "Attribute on instance"},
170 {int(AttrDomain::Layer), "LAYER", 0, "Layer", "Attribute on Grease Pencil layer"},
171 {0, nullptr, 0, nullptr, nullptr},
172};
173
175 {int(AttrDomain::Point), "POINT", 0, "Vertex", ""},
176 {int(AttrDomain::Corner), "CORNER", 0, "Face Corner", ""},
177 {0, nullptr, 0, nullptr, nullptr}};
178
180 {int(AttrDomain::Point), "POINT", 0, "Control Point", ""},
181 {int(AttrDomain::Curve), "CURVE", 0, "Curve", ""},
182 {0, nullptr, 0, nullptr, nullptr}};
183
184#ifdef RNA_RUNTIME
185
186# include <fmt/format.h>
187
188# include "DNA_customdata_types.h"
190# include "DNA_mesh_types.h"
191# include "DNA_meshdata_types.h"
192# include "DNA_pointcloud_types.h"
193
194# include "BLI_math_color.h"
195# include "BLI_string.h"
196
198# include "BKE_curves.hh"
199# include "BKE_customdata.hh"
200# include "BKE_report.hh"
201
202# include "RNA_prototypes.hh"
203
204# include "DEG_depsgraph.hh"
205
206# include "BLT_translation.hh"
207
208# include "IMB_colormanagement.hh"
209
210# include "WM_api.hh"
211
213
214/* Attribute */
215
216static bool find_attr_with_pointer(const blender::bke::AttributeStorage &storage,
217 const blender::bke::Attribute &attr)
218{
219 bool found_attr = false;
220 storage.foreach_with_stop([&](const blender::bke::Attribute &attr_iter) {
221 if (&attr_iter == &attr) {
222 found_attr = true;
223 return false;
224 }
225 return true;
226 });
227 return found_attr;
228}
229
230static AttributeOwner owner_from_attribute_pointer_rna(PointerRNA *ptr)
231{
232 using namespace blender;
233 ID *owner_id = ptr->owner_id;
234 /* TODO: Because we don't know the path to the `ptr`, we need to look though all possible
235 * candidates and search for the `layer` currently. This should be just a simple lookup. */
236 if (GS(owner_id->name) == ID_GP) {
237 bke::Attribute *attr = static_cast<bke::Attribute *>(ptr->data);
238 GreasePencil *grease_pencil = reinterpret_cast<GreasePencil *>(owner_id);
239
240 /* First check the layer attributes. */
241 if (find_attr_with_pointer(grease_pencil->attribute_storage.wrap(), *attr)) {
243 }
244
245 /* Now check all the drawings. */
246 for (GreasePencilDrawingBase *base : grease_pencil->drawings()) {
247 if (base->type == GP_DRAWING) {
248 GreasePencilDrawing *drawing = reinterpret_cast<GreasePencilDrawing *>(base);
249 const bke::CurvesGeometry &curves = drawing->geometry.wrap();
250 if (find_attr_with_pointer(curves.attribute_storage.wrap(), *attr)) {
252 }
253 }
254 }
255 }
256 return AttributeOwner::from_id(owner_id);
257}
258
259static AttributeOwner owner_from_pointer_rna(PointerRNA *ptr)
260{
261 /* For non-ID attribute owners, check the `ptr->type` to derive the `AttributeOwnerType`
262 * and construct an `AttributeOwner` from that type and `ptr->data`. */
263 if (ptr->type == &RNA_GreasePencilDrawing) {
265 }
266 return AttributeOwner::from_id(ptr->owner_id);
267}
268
269static std::optional<std::string> rna_Attribute_path(const PointerRNA *ptr)
270{
271 using namespace blender;
272 if (GS(ptr->owner_id->name) != ID_ME) {
273 bke::Attribute *attr = ptr->data_as<bke::Attribute>();
274 const std::string escaped_name = BLI_str_escape(attr->name().c_str());
275 return fmt::format("attributes[\"{}\"]", escaped_name);
276 }
277
278 const CustomDataLayer *layer = static_cast<const CustomDataLayer *>(ptr->data);
279 char layer_name_esc[sizeof(layer->name) * 2];
280 BLI_str_escape(layer_name_esc, layer->name, sizeof(layer_name_esc));
281 return fmt::format("attributes[\"{}\"]", layer_name_esc);
282}
283
284static StructRNA *srna_by_custom_data_layer_type(const eCustomDataType type)
285{
286 switch (type) {
287 case CD_PROP_FLOAT:
288 return &RNA_FloatAttribute;
289 case CD_PROP_INT32:
290 return &RNA_IntAttribute;
291 case CD_PROP_FLOAT3:
292 return &RNA_FloatVectorAttribute;
293 case CD_PROP_COLOR:
294 return &RNA_FloatColorAttribute;
296 return &RNA_ByteColorAttribute;
297 case CD_PROP_STRING:
298 return &RNA_StringAttribute;
299 case CD_PROP_BOOL:
300 return &RNA_BoolAttribute;
301 case CD_PROP_FLOAT2:
302 return &RNA_Float2Attribute;
303 case CD_PROP_INT8:
304 return &RNA_ByteIntAttribute;
305 case CD_PROP_INT16_2D:
306 return &RNA_Short2Attribute;
307 case CD_PROP_INT32_2D:
308 return &RNA_Int2Attribute;
310 return &RNA_QuaternionAttribute;
311 case CD_PROP_FLOAT4X4:
312 return &RNA_Float4x4Attribute;
313 default:
314 return nullptr;
315 }
316}
317
318static StructRNA *rna_Attribute_refine(PointerRNA *ptr)
319{
320 using namespace blender;
321 if (GS(ptr->owner_id->name) != ID_ME) {
322 bke::Attribute *attr = ptr->data_as<bke::Attribute>();
324 return srna_by_custom_data_layer_type(data_type);
325 }
326
327 CustomDataLayer *layer = static_cast<CustomDataLayer *>(ptr->data);
328 return srna_by_custom_data_layer_type(eCustomDataType(layer->type));
329}
330
331static void rna_Attribute_name_get(PointerRNA *ptr, char *value)
332{
333 using namespace blender;
334 AttributeOwner owner = owner_from_attribute_pointer_rna(ptr);
335 if (owner.type() != AttributeOwnerType::Mesh) {
336 const bke::Attribute *attr = ptr->data_as<bke::Attribute>();
337 attr->name().copy_unsafe(value);
338 return;
339 }
340
341 strcpy(value, ptr->data_as<CustomDataLayer>()->name);
342}
343
344static int rna_Attribute_name_length(PointerRNA *ptr)
345{
346 using namespace blender;
347 AttributeOwner owner = owner_from_attribute_pointer_rna(ptr);
348 if (owner.type() != AttributeOwnerType::Mesh) {
349 const bke::Attribute *attr = ptr->data_as<bke::Attribute>();
350 return attr->name().size();
351 }
352
353 const CustomDataLayer *layer = ptr->data_as<CustomDataLayer>();
354 return strlen(layer->name);
355}
356
357static void rna_Attribute_name_set(PointerRNA *ptr, const char *value)
358{
359 using namespace blender;
360 AttributeOwner owner = owner_from_attribute_pointer_rna(ptr);
361 if (owner.type() != AttributeOwnerType::Mesh) {
362 const bke::Attribute *attr = ptr->data_as<bke::Attribute>();
363 BKE_attribute_rename(owner, attr->name(), value, nullptr);
364 return;
365 }
366
367 const CustomDataLayer *layer = (const CustomDataLayer *)ptr->data;
368 BKE_attribute_rename(owner, layer->name, value, nullptr);
369}
370
371static int rna_Attribute_name_editable(const PointerRNA *ptr, const char **r_info)
372{
373 using namespace blender;
374 AttributeOwner owner = owner_from_attribute_pointer_rna(const_cast<PointerRNA *>(ptr));
375 if (owner.type() != AttributeOwnerType::Mesh) {
376 bke::Attribute *attr = ptr->data_as<bke::Attribute>();
377 if (BKE_attribute_required(owner, attr->name())) {
378 *r_info = N_("Cannot modify name of required geometry attribute");
379 return false;
380 }
381 return true;
382 }
383
384 CustomDataLayer *layer = static_cast<CustomDataLayer *>(ptr->data);
385 if (BKE_attribute_required(owner, layer->name)) {
386 *r_info = N_("Cannot modify name of required geometry attribute");
387 return false;
388 }
389
390 return true;
391}
392
393static int rna_Attribute_type_get(PointerRNA *ptr)
394{
395 using namespace blender;
396 if (GS(ptr->owner_id->name) != ID_ME) {
397 const bke::Attribute *attr = static_cast<const bke::Attribute *>(ptr->data);
399 }
400
401 CustomDataLayer *layer = static_cast<CustomDataLayer *>(ptr->data);
402 return layer->type;
403}
404
405static int rna_Attribute_storage_type_get(PointerRNA *ptr)
406{
407 using namespace blender;
408 if (GS(ptr->owner_id->name) != ID_ME) {
409 const bke::Attribute *attr = static_cast<const bke::Attribute *>(ptr->data);
410 return int(attr->storage_type());
411 }
412
413 return int(bke::AttrStorageType::Array);
414}
415
417 bool include_instances,
418 bool *r_free)
419{
420 EnumPropertyItem *item = nullptr;
421 const EnumPropertyItem *domain_item = nullptr;
422 int totitem = 0, a;
423
424 static EnumPropertyItem mesh_vertex_domain_item = {
425 int(AttrDomain::Point), "POINT", 0, N_("Vertex"), N_("Attribute per point/vertex")};
426
427 for (a = 0; rna_enum_attribute_domain_items[a].identifier; a++) {
428 domain_item = &rna_enum_attribute_domain_items[a];
429
430 if (owner.type() == AttributeOwnerType::PointCloud &&
431 !ELEM(domain_item->value, int(AttrDomain::Point)))
432 {
433 continue;
434 }
435 if (owner.type() == AttributeOwnerType::Curves &&
436 !ELEM(domain_item->value, int(AttrDomain::Point), int(AttrDomain::Curve)))
437 {
438 continue;
439 }
440 if (owner.type() == AttributeOwnerType::Mesh && !ELEM(domain_item->value,
442 int(AttrDomain::Edge),
443 int(AttrDomain::Face),
444 int(AttrDomain::Corner)))
445 {
446 continue;
447 }
448 if (owner.type() == AttributeOwnerType::GreasePencil &&
449 !ELEM(domain_item->value, int(AttrDomain::Layer)))
450 {
451 continue;
452 }
453 if (!include_instances && domain_item->value == int(AttrDomain::Instance)) {
454 continue;
455 }
456
457 if (domain_item->value == int(AttrDomain::Point) && owner.type() == AttributeOwnerType::Mesh) {
458 RNA_enum_item_add(&item, &totitem, &mesh_vertex_domain_item);
459 }
460 else {
461 RNA_enum_item_add(&item, &totitem, domain_item);
462 }
463 }
464 RNA_enum_item_end(&item, &totitem);
465
466 *r_free = true;
467 return item;
468}
469
470static const EnumPropertyItem *rna_Attribute_domain_itemf(bContext * /*C*/,
472 PropertyRNA * /*prop*/,
473 bool *r_free)
474{
475 AttributeOwner owner = owner_from_attribute_pointer_rna(ptr);
476 return rna_enum_attribute_domain_itemf(owner, true, r_free);
477}
478
479static int rna_Attribute_domain_get(PointerRNA *ptr)
480{
481 using namespace blender;
482 AttributeOwner owner = owner_from_attribute_pointer_rna(ptr);
483 if (owner.type() != AttributeOwnerType::Mesh) {
484 const bke::Attribute *attr = static_cast<const bke::Attribute *>(ptr->data);
485 return int(attr->domain());
486 }
487
488 return int(BKE_attribute_domain(owner, static_cast<const CustomDataLayer *>(ptr->data)));
489}
490
491static bool rna_Attribute_is_internal_get(PointerRNA *ptr)
492{
493 using namespace blender;
494 if (GS(ptr->owner_id->name) != ID_ME) {
495 const bke::Attribute *attr = static_cast<const bke::Attribute *>(ptr->data);
497 }
498
499 const CustomDataLayer *layer = (const CustomDataLayer *)ptr->data;
501}
502
503static bool rna_Attribute_is_required_get(PointerRNA *ptr)
504{
505 using namespace blender;
506 AttributeOwner owner = owner_from_attribute_pointer_rna(ptr);
507 if (owner.type() != AttributeOwnerType::Mesh) {
508 const bke::Attribute *attr = static_cast<const bke::Attribute *>(ptr->data);
509 return BKE_attribute_required(owner, attr->name());
510 }
511
512 const CustomDataLayer *layer = (const CustomDataLayer *)ptr->data;
513 return BKE_attribute_required(owner, layer->name);
514}
515
516static void rna_Attribute_data_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
517{
518 using namespace blender;
519 AttributeOwner owner = owner_from_attribute_pointer_rna(ptr);
520 if (owner.type() != AttributeOwnerType::Mesh) {
522
523 bke::Attribute *attr = ptr->data_as<bke::Attribute>();
524 const int domain_size = accessor.domain_size(attr->domain());
526 switch (attr->storage_type()) {
528 const auto &data = std::get<bke::Attribute::ArrayData>(attr->data_for_write());
529 rna_iterator_array_begin(iter, ptr, data.data, type.size, domain_size, false, nullptr);
530 break;
531 }
533 /* TODO: Access to single values is unimplemented for now. */
534 iter->valid = false;
535 break;
536 }
537 }
538 return;
539 }
540
541 CustomDataLayer *layer = (CustomDataLayer *)ptr->data;
543 iter->valid = false;
544 }
545
546 const int length = BKE_attribute_data_length(owner, layer);
547 const size_t struct_size = CustomData_get_elem_size(layer);
549
550 rna_iterator_array_begin(iter, ptr, layer->data, struct_size, length, 0, nullptr);
551}
552
553static int rna_Attribute_data_length(PointerRNA *ptr)
554{
555 using namespace blender;
556 AttributeOwner owner = owner_from_attribute_pointer_rna(ptr);
557 if (owner.type() != AttributeOwnerType::Mesh) {
558 const bke::Attribute *attr = ptr->data_as<bke::Attribute>();
559 const bke::AttributeAccessor accessor = *owner.get_accessor();
560 return accessor.domain_size(attr->domain());
561 }
562
563 CustomDataLayer *layer = (CustomDataLayer *)ptr->data;
564 return BKE_attribute_data_length(owner, layer);
565}
566
567static void rna_Attribute_update_data(Main * /*bmain*/, Scene * /*scene*/, PointerRNA *ptr)
568{
569 ID *id = ptr->owner_id;
570
571 /* cheating way for importers to avoid slow updates */
572 if (id->us > 0) {
573 DEG_id_tag_update(id, 0);
575 }
576}
577
578/* Color Attribute */
579
580static void rna_ByteColorAttributeValue_color_get(PointerRNA *ptr, float *values)
581{
582 MLoopCol *mlcol = (MLoopCol *)ptr->data;
583 srgb_to_linearrgb_uchar4(values, &mlcol->r);
585}
586
587static void rna_ByteColorAttributeValue_color_set(PointerRNA *ptr, const float *values)
588{
589 MLoopCol *mlcol = (MLoopCol *)ptr->data;
590 float rec709[4];
592 rec709[3] = values[3];
593 linearrgb_to_srgb_uchar4(&mlcol->r, values);
594}
595
596static void rna_ByteColorAttributeValue_color_srgb_get(PointerRNA *ptr, float *values)
597{
598 MLoopCol *col = (MLoopCol *)ptr->data;
599 values[0] = col->r / 255.0f;
600 values[1] = col->g / 255.0f;
601 values[2] = col->b / 255.0f;
602 values[3] = col->a / 255.0f;
603}
604
605static void rna_ByteColorAttributeValue_color_srgb_set(PointerRNA *ptr, const float *values)
606{
607 MLoopCol *col = (MLoopCol *)ptr->data;
608 col->r = round_fl_to_uchar_clamp(values[0] * 255.0f);
609 col->g = round_fl_to_uchar_clamp(values[1] * 255.0f);
610 col->b = round_fl_to_uchar_clamp(values[2] * 255.0f);
611 col->a = round_fl_to_uchar_clamp(values[3] * 255.0f);
612}
613
614static void rna_FloatColorAttributeValue_color_srgb_get(PointerRNA *ptr, float *values)
615{
616 MPropCol *col = (MPropCol *)ptr->data;
618 values[3] = col->color[3];
619}
620
621static void rna_FloatColorAttributeValue_color_srgb_set(PointerRNA *ptr, const float *values)
622{
623 MPropCol *col = (MPropCol *)ptr->data;
625 col->color[3] = values[3];
626}
627
628/* String Attribute */
629
630static void rna_StringAttributeValue_s_get(PointerRNA *ptr, char *value)
631{
632 const MStringProperty *mstring = static_cast<const MStringProperty *>(ptr->data);
633 const int len = std::min<int>(mstring->s_len, sizeof(mstring->s) - 1);
634 memcpy(value, mstring->s, len);
635 /* RNA accessors require this. */
636 value[len] = '\0';
637}
638
639static int rna_StringAttributeValue_s_length(PointerRNA *ptr)
640{
641 const MStringProperty *mstring = static_cast<const MStringProperty *>(ptr->data);
642 const int len = std::min<int>(mstring->s_len, sizeof(mstring->s) - 1);
643 return len;
644}
645
646static void rna_StringAttributeValue_s_set(PointerRNA *ptr, const char *value)
647{
648 /* NOTE: RNA does not support byte-strings which contain null bytes.
649 * If `PROP_BYTESTRING` supported this then a value & length could be passed in
650 * and `MStringProperty` could be set with values to include null bytes. */
651 MStringProperty *mstring = static_cast<MStringProperty *>(ptr->data);
652 mstring->s_len = BLI_strnlen(value, sizeof(MStringProperty::s));
653 memcpy(mstring->s, value, mstring->s_len);
654}
655
656/* Attribute Group */
657
658static PointerRNA rna_AttributeGroupID_new(
659 ID *id, ReportList *reports, const char *name, const int type, const int domain)
660{
661 using namespace blender;
663 if (owner.type() != AttributeOwnerType::Mesh) {
664 const bke::AttributeAccessor accessor = *owner.get_accessor();
665 if (!accessor.domain_supported(AttrDomain(domain))) {
666 BKE_report(reports, RPT_ERROR, "Attribute domain not supported by this geometry type");
667 return PointerRNA_NULL;
668 }
669 const int domain_size = accessor.domain_size(AttrDomain(domain));
670
671 bke::AttributeStorage &attributes = *owner.get_storage();
673 bke::Attribute &attr = attributes.add(
674 attributes.unique_name_calc(name),
675 AttrDomain(domain),
677 bke::Attribute::ArrayData::from_default_value(cpp_type, domain_size));
678
681
682 return RNA_pointer_create_discrete(id, &RNA_Attribute, &attr);
683 }
684
686 owner, name, eCustomDataType(type), AttrDomain(domain), reports);
687
688 if (!layer) {
689 return PointerRNA_NULL;
690 }
691
692 if ((GS(id->name) == ID_ME) && ELEM(layer->type, CD_PROP_COLOR, CD_PROP_BYTE_COLOR)) {
693 Mesh *mesh = (Mesh *)id;
694 if (!mesh->active_color_attribute) {
695 mesh->active_color_attribute = BLI_strdup(layer->name);
696 }
697 if (!mesh->default_color_attribute) {
699 }
700 }
701
704
705 PointerRNA ptr = RNA_pointer_create_discrete(id, &RNA_Attribute, layer);
706 return ptr;
707}
708
709static void rna_AttributeGroupID_remove(ID *id, ReportList *reports, PointerRNA *attribute_ptr)
710{
711 using namespace blender;
713 if (owner.type() != AttributeOwnerType::Mesh) {
714 const bke::Attribute *attr = static_cast<const bke::Attribute *>(attribute_ptr->data);
715 if (BKE_attribute_required(owner, attr->name())) {
716 BKE_report(reports, RPT_ERROR, "Attribute is required and cannot be removed");
717 return;
718 }
719
721 accessor.remove(attr->name());
722 attribute_ptr->invalidate();
723
726
727 return;
728 }
729
730 const CustomDataLayer *layer = (const CustomDataLayer *)attribute_ptr->data;
731 BKE_attribute_remove(owner, layer->name, reports);
732 attribute_ptr->invalidate();
733
736}
737
738static bool rna_Attributes_layer_skip(CollectionPropertyIterator * /*iter*/, void *data)
739{
742}
743
744static bool rna_Attributes_noncolor_layer_skip(CollectionPropertyIterator *iter, void *data)
745{
747
748 /* Check valid domain here, too, keep in line with rna_AttributeGroup_color_length(). */
749 PointerRNA attribute_pointer(iter->parent.owner_id, &RNA_Attribute, data);
750 const AttributeOwner owner = owner_from_attribute_pointer_rna(&attribute_pointer);
751 const AttrDomain domain = BKE_attribute_domain(owner, layer);
753 return true;
754 }
755
757 (layer->flag & CD_FLAG_TEMPORARY);
758}
759
760/* Attributes are spread over multiple domains in separate CustomData, we use repeated
761 * array iterators to loop over all. */
762static void rna_AttributeGroup_next_domain(AttributeOwner &owner,
765 bool(skip)(CollectionPropertyIterator *iter,
766 void *data))
767{
768 do {
769 CustomDataLayer *prev_layers = (iter->internal.array.endptr == nullptr) ?
770 nullptr :
771 (CustomDataLayer *)iter->internal.array.endptr -
772 iter->internal.array.length;
773 CustomData *customdata = BKE_attributes_iterator_next_domain(owner, prev_layers);
774 if (customdata == nullptr) {
775 return;
776 }
778 iter, ptr, customdata->layers, sizeof(CustomDataLayer), customdata->totlayer, false, skip);
779 } while (!iter->valid);
780}
781
783{
784 using namespace blender;
785 memset(&iter->internal.array, 0, sizeof(iter->internal.array));
786 AttributeOwner owner = owner_from_pointer_rna(ptr);
787 if (owner.type() != AttributeOwnerType::Mesh) {
788 bke::AttributeStorage &storage = *owner.get_storage();
789 Vector<bke::Attribute *> attributes;
790 storage.foreach([&](bke::Attribute &attr) { attributes.append(&attr); });
791 VectorData data = attributes.release();
793 iter, ptr, data.data, sizeof(bke::Attribute *), data.size, true, nullptr);
794 return;
795 }
796
797 rna_AttributeGroup_next_domain(owner, iter, ptr, rna_Attributes_layer_skip);
798}
799
801{
803 AttributeOwner owner = owner_from_pointer_rna(&iter->parent);
804 if (owner.type() != AttributeOwnerType::Mesh) {
805 return;
806 }
807
808 if (!iter->valid) {
809 rna_AttributeGroup_next_domain(owner, iter, &iter->parent, rna_Attributes_layer_skip);
810 }
811}
812
814{
815 using namespace blender;
816 AttributeOwner owner = owner_from_pointer_rna(&iter->parent);
817 if (owner.type() != AttributeOwnerType::Mesh) {
818 bke::Attribute *attr = *static_cast<bke::Attribute **>(rna_iterator_array_get(iter));
820 StructRNA *type = srna_by_custom_data_layer_type(data_type);
821 return RNA_pointer_create_with_parent(iter->parent, type, attr);
822 }
823
824 CustomDataLayer *layer = static_cast<CustomDataLayer *>(rna_iterator_array_get(iter));
825 StructRNA *type = srna_by_custom_data_layer_type(eCustomDataType(layer->type));
826 if (type == nullptr) {
827 return PointerRNA_NULL;
828 }
829 return RNA_pointer_create_with_parent(iter->parent, type, layer);
830}
831
833{
834 using namespace blender;
835 AttributeOwner owner = owner_from_pointer_rna(ptr);
836 if (owner.type() != AttributeOwnerType::Mesh) {
837 bke::AttributeStorage &storage = *owner.get_storage();
838 Vector<bke::Attribute *> attributes;
839 storage.foreach([&](bke::Attribute &attr) {
841 return;
842 }
845 {
846 return;
847 }
848 attributes.append(&attr);
849 });
850 VectorData data = attributes.release();
852 iter, ptr, data.data, sizeof(bke::Attribute *), data.size, true, nullptr);
853 return;
854 }
855
856 memset(&iter->internal.array, 0, sizeof(iter->internal.array));
857 rna_AttributeGroup_next_domain(owner, iter, ptr, rna_Attributes_noncolor_layer_skip);
858}
859
861{
862 using namespace blender;
864 AttributeOwner owner = owner_from_pointer_rna(&iter->parent);
865 if (owner.type() != AttributeOwnerType::Mesh) {
866 return;
867 }
868
869 if (!iter->valid) {
870 AttributeOwner owner = owner_from_pointer_rna(&iter->parent);
871 rna_AttributeGroup_next_domain(owner, iter, &iter->parent, rna_Attributes_noncolor_layer_skip);
872 }
873}
874
876{
877 using namespace blender;
878 AttributeOwner owner = owner_from_pointer_rna(&iter->parent);
879 if (owner.type() != AttributeOwnerType::Mesh) {
880 bke::Attribute *attr = *static_cast<bke::Attribute **>(rna_iterator_array_get(iter));
882 StructRNA *type = srna_by_custom_data_layer_type(data_type);
883 return RNA_pointer_create_with_parent(iter->parent, type, attr);
884 }
885
886 CustomDataLayer *layer = static_cast<CustomDataLayer *>(rna_iterator_array_get(iter));
887 StructRNA *type = srna_by_custom_data_layer_type(eCustomDataType(layer->type));
888 if (type == nullptr) {
889 return PointerRNA_NULL;
890 }
891 return RNA_pointer_create_with_parent(iter->parent, type, layer);
892}
893
895{
896 using namespace blender;
897 AttributeOwner owner = owner_from_pointer_rna(ptr);
898 if (owner.type() != AttributeOwnerType::Mesh) {
899 bke::AttributeStorage &storage = *owner.get_storage();
900 int count = 0;
901 storage.foreach([&](bke::Attribute &attr) {
903 return;
904 }
907 {
908 return;
909 }
910 count++;
911 });
912 return count;
913 }
915}
916
918{
919 using namespace blender;
920 AttributeOwner owner = owner_from_pointer_rna(ptr);
921 if (owner.type() != AttributeOwnerType::Mesh) {
922 bke::AttributeStorage &storage = *owner.get_storage();
923 int count = 0;
924 storage.foreach([&](bke::Attribute & /*attr*/) { count++; });
925 return count;
926 }
928}
929
930bool rna_AttributeGroup_lookup_string(PointerRNA *ptr, const char *key, PointerRNA *r_ptr)
931{
932 using namespace blender;
933 AttributeOwner owner = owner_from_pointer_rna(ptr);
934 if (owner.type() != AttributeOwnerType::Mesh) {
935 bke::AttributeStorage &storage = *owner.get_storage();
936 bke::Attribute *attr = storage.lookup(key);
937 if (!attr) {
938 *r_ptr = PointerRNA_NULL;
939 return false;
940 }
941 rna_pointer_create_with_ancestors(*ptr, &RNA_Attribute, attr, *r_ptr);
942 return true;
943 }
944
947 {
948 rna_pointer_create_with_ancestors(*ptr, &RNA_Attribute, layer, *r_ptr);
949 return true;
950 }
951
952 *r_ptr = PointerRNA_NULL;
953 return false;
954}
955
956static int rna_AttributeGroupID_active_index_get(PointerRNA *ptr)
957{
958 AttributeOwner owner = AttributeOwner::from_id(ptr->owner_id);
959 return *BKE_attributes_active_index_p(owner);
960}
961
962static PointerRNA rna_AttributeGroupID_active_get(PointerRNA *ptr)
963{
964 using namespace blender;
965 AttributeOwner owner = AttributeOwner::from_id(ptr->owner_id);
966 const std::optional<blender::StringRef> name = BKE_attributes_active_name_get(owner);
967 if (!name) {
968 return PointerRNA_NULL;
969 }
970 if (owner.type() != AttributeOwnerType::Mesh) {
971 bke::AttributeStorage &storage = *owner.get_storage();
972 bke::Attribute *attr = storage.lookup(*name);
973 return RNA_pointer_create_with_parent(*ptr, &RNA_Attribute, attr);
974 }
975
978 return RNA_pointer_create_with_parent(*ptr, &RNA_Attribute, layer);
979}
980
981static void rna_AttributeGroupID_active_set(PointerRNA *ptr,
982 PointerRNA attribute_ptr,
983 ReportList * /*reports*/)
984{
985 using namespace blender;
986 AttributeOwner owner = AttributeOwner::from_id(ptr->owner_id);
987 if (owner.type() != AttributeOwnerType::Mesh) {
988 bke::Attribute *attr = attribute_ptr.data_as<bke::Attribute>();
989 BKE_attributes_active_set(owner, attr->name());
990 return;
991 }
992
993 CustomDataLayer *layer = static_cast<CustomDataLayer *>(attribute_ptr.data);
994 if (layer) {
995 BKE_attributes_active_set(owner, layer->name);
996 }
997 else {
999 }
1000}
1001
1002static void rna_AttributeGroupID_active_index_set(PointerRNA *ptr, int value)
1003{
1004 AttributeOwner owner = AttributeOwner::from_id(ptr->owner_id);
1005 *BKE_attributes_active_index_p(owner) = std::max(-1, value);
1006}
1007
1008static void rna_AttributeGroupID_active_index_range(
1009 PointerRNA *ptr, int *min, int *max, int *softmin, int *softmax)
1010{
1011 *min = -1;
1013
1014 *softmin = *min;
1015 *softmax = *max;
1016}
1017
1018static void rna_AttributeGroup_update_active(Main *bmain, Scene *scene, PointerRNA *ptr)
1019{
1020 rna_Attribute_update_data(bmain, scene, ptr);
1021}
1022
1023static void rna_AttributeGroup_update_active_color(Main * /*bmain*/,
1024 Scene * /*scene*/,
1025 PointerRNA *ptr)
1026{
1027 ID *id = ptr->owner_id;
1028
1029 /* Cheating way for importers to avoid slow updates. */
1030 if (id->us > 0) {
1031 DEG_id_tag_update(id, 0);
1033 }
1034}
1035
1036static int rna_AttributeGroupID_domain_size(ID *id, const int domain)
1037{
1038 using namespace blender;
1040 if (owner.type() != AttributeOwnerType::Mesh) {
1041 bke::AttributeAccessor attributes = *owner.get_accessor();
1042 return attributes.domain_size(bke::AttrDomain(domain));
1043 }
1044
1045 return BKE_attribute_domain_size(owner, domain);
1046}
1047
1048static PointerRNA rna_AttributeGroupMesh_active_color_get(PointerRNA *ptr)
1049{
1050 AttributeOwner owner = AttributeOwner::from_id(ptr->owner_id);
1052 owner,
1053 BKE_id_attributes_active_color_name(ptr->owner_id).value_or(""),
1056
1057 PointerRNA attribute_ptr = RNA_pointer_create_discrete(ptr->owner_id, &RNA_Attribute, layer);
1058 return attribute_ptr;
1059}
1060
1061static void rna_AttributeGroupMesh_active_color_set(PointerRNA *ptr,
1062 PointerRNA attribute_ptr,
1063 ReportList * /*reports*/)
1064{
1065 ID *id = ptr->owner_id;
1066 CustomDataLayer *layer = static_cast<CustomDataLayer *>(attribute_ptr.data);
1067 if (layer) {
1069 }
1070 else {
1072 }
1073}
1074
1075static int rna_AttributeGroupMesh_active_color_index_get(PointerRNA *ptr)
1076{
1077 AttributeOwner owner = AttributeOwner::from_id(ptr->owner_id);
1079 owner,
1080 BKE_id_attributes_active_color_name(ptr->owner_id).value_or(""),
1083
1085}
1086
1087static void rna_AttributeGroupMesh_active_color_index_set(PointerRNA *ptr, int value)
1088{
1089 AttributeOwner owner = AttributeOwner::from_id(ptr->owner_id);
1092
1093 if (!layer) {
1094 fprintf(stderr, "%s: error setting active color index to %d\n", __func__, value);
1095 return;
1096 }
1097
1098 BKE_id_attributes_active_color_set(ptr->owner_id, layer->name);
1099}
1100
1101static void rna_AttributeGroupMesh_active_color_index_range(
1102 PointerRNA *ptr, int *min, int *max, int *softmin, int *softmax)
1103{
1104 AttributeOwner owner = AttributeOwner::from_id(ptr->owner_id);
1105 *min = 0;
1107
1108 *softmin = *min;
1109 *softmax = *max;
1110}
1111
1112static int rna_AttributeGroupMesh_render_color_index_get(PointerRNA *ptr)
1113{
1114 AttributeOwner owner = AttributeOwner::from_id(ptr->owner_id);
1116 ptr->owner_id, BKE_id_attributes_default_color_name(ptr->owner_id).value_or(""));
1117
1119}
1120
1121static void rna_AttributeGroupMesh_render_color_index_set(PointerRNA *ptr, int value)
1122{
1123 AttributeOwner owner = AttributeOwner::from_id(ptr->owner_id);
1126
1127 if (!layer) {
1128 fprintf(stderr, "%s: error setting render color index to %d\n", __func__, value);
1129 return;
1130 }
1131
1132 BKE_id_attributes_default_color_set(ptr->owner_id, layer->name);
1133}
1134
1135static void rna_AttributeGroupMesh_render_color_index_range(
1136 PointerRNA *ptr, int *min, int *max, int *softmin, int *softmax)
1137{
1138 AttributeOwner owner = AttributeOwner::from_id(ptr->owner_id);
1139 *min = 0;
1141
1142 *softmin = *min;
1143 *softmax = *max;
1144}
1145
1146static void rna_AttributeGroupMesh_default_color_name_get(PointerRNA *ptr, char *value)
1147{
1148 const ID *id = ptr->owner_id;
1149 const StringRef name = BKE_id_attributes_default_color_name(id).value_or("");
1150 name.copy_unsafe(value);
1151}
1152
1153static int rna_AttributeGroupMesh_default_color_name_length(PointerRNA *ptr)
1154{
1155 const ID *id = ptr->owner_id;
1156 const StringRef name = BKE_id_attributes_default_color_name(id).value_or("");
1157 return name.size();
1158}
1159
1160static void rna_AttributeGroupMesh_default_color_name_set(PointerRNA *ptr, const char *value)
1161{
1162 ID *id = ptr->owner_id;
1163 if (GS(id->name) == ID_ME) {
1164 Mesh *mesh = (Mesh *)id;
1166 if (value[0]) {
1167 mesh->default_color_attribute = BLI_strdup(value);
1168 }
1169 }
1170}
1171
1172static void rna_AttributeGroupMesh_active_color_name_get(PointerRNA *ptr, char *value)
1173{
1174 const ID *id = ptr->owner_id;
1175 const StringRef name = BKE_id_attributes_active_color_name(id).value_or("");
1176 name.copy_unsafe(value);
1177}
1178
1179static int rna_AttributeGroupMesh_active_color_name_length(PointerRNA *ptr)
1180{
1181 const ID *id = ptr->owner_id;
1182 const StringRef name = BKE_id_attributes_active_color_name(id).value_or("");
1183 return name.size();
1184}
1185
1186static void rna_AttributeGroupMesh_active_color_name_set(PointerRNA *ptr, const char *value)
1187{
1188 ID *id = ptr->owner_id;
1189 if (GS(id->name) == ID_ME) {
1190 Mesh *mesh = (Mesh *)id;
1192 if (value[0]) {
1193 mesh->active_color_attribute = BLI_strdup(value);
1194 }
1195 }
1196}
1197
1198static PointerRNA rna_AttributeGroupGreasePencilDrawing_new(ID *grease_pencil_id,
1199 GreasePencilDrawing *drawing,
1200 ReportList *reports,
1201 const char *name,
1202 const int type,
1203 const int domain)
1204{
1205 using namespace blender;
1207 const bke::AttributeAccessor accessor = *owner.get_accessor();
1208 if (!accessor.domain_supported(AttrDomain(domain))) {
1209 BKE_report(reports, RPT_ERROR, "Attribute domain not supported by this geometry type");
1210 return PointerRNA_NULL;
1211 }
1212 const int domain_size = accessor.domain_size(AttrDomain(domain));
1213
1214 bke::AttributeStorage &attributes = *owner.get_storage();
1216 bke::Attribute &attr = attributes.add(
1217 attributes.unique_name_calc(name),
1218 AttrDomain(domain),
1220 bke::Attribute::ArrayData::from_default_value(cpp_type, domain_size));
1221
1222 DEG_id_tag_update(grease_pencil_id, ID_RECALC_GEOMETRY);
1223 WM_main_add_notifier(NC_GEOM | ND_DATA, grease_pencil_id);
1224
1225 return RNA_pointer_create_discrete(grease_pencil_id, &RNA_Attribute, &attr);
1226}
1227
1228static void rna_AttributeGroupGreasePencilDrawing_remove(ID *grease_pencil_id,
1229 GreasePencilDrawing *drawing,
1230 ReportList *reports,
1231 PointerRNA *attribute_ptr)
1232{
1233 using namespace blender;
1235 const bke::Attribute *attr = static_cast<const bke::Attribute *>(attribute_ptr->data);
1236 if (BKE_attribute_required(owner, attr->name())) {
1237 BKE_report(reports, RPT_ERROR, "Attribute is required and cannot be removed");
1238 return;
1239 }
1240
1241 bke::MutableAttributeAccessor accessor = *owner.get_accessor();
1242 accessor.remove(attr->name());
1243 attribute_ptr->invalidate();
1244
1245 DEG_id_tag_update(grease_pencil_id, ID_RECALC_GEOMETRY);
1246 WM_main_add_notifier(NC_GEOM | ND_DATA, grease_pencil_id);
1247}
1248
1249static PointerRNA rna_AttributeGroupGreasePencilDrawing_active_get(PointerRNA *ptr)
1250{
1251 using namespace blender;
1252 GreasePencilDrawing *drawing = static_cast<GreasePencilDrawing *>(ptr->data);
1254 const std::optional<blender::StringRef> name = BKE_attributes_active_name_get(owner);
1255 if (!name) {
1256 return PointerRNA_NULL;
1257 }
1258 bke::AttributeStorage &storage = *owner.get_storage();
1259 bke::Attribute *attr = storage.lookup(*name);
1260 return RNA_pointer_create_discrete(ptr->owner_id, &RNA_Attribute, attr);
1261}
1262
1263static void rna_AttributeGroupGreasePencilDrawing_active_set(PointerRNA *ptr,
1264 PointerRNA attribute_ptr,
1265 ReportList * /*reports*/)
1266{
1267 GreasePencilDrawing *drawing = static_cast<GreasePencilDrawing *>(ptr->data);
1269 CustomDataLayer *layer = static_cast<CustomDataLayer *>(attribute_ptr.data);
1270 if (layer) {
1271 BKE_attributes_active_set(owner, layer->name);
1272 }
1273 else {
1275 }
1276}
1277
1278static bool rna_AttributeGroupGreasePencilDrawing_active_poll(PointerRNA *ptr,
1279 const PointerRNA value)
1280{
1281 AttributeOwner owner = owner_from_attribute_pointer_rna(const_cast<PointerRNA *>(&value));
1282 return owner.is_valid() && owner.type() == AttributeOwnerType::GreasePencilDrawing &&
1283 owner.get_grease_pencil_drawing() == static_cast<GreasePencilDrawing *>(ptr->data);
1284}
1285
1286static int rna_AttributeGroupGreasePencilDrawing_active_index_get(PointerRNA *ptr)
1287{
1288 GreasePencilDrawing *drawing = static_cast<GreasePencilDrawing *>(ptr->data);
1290 return *BKE_attributes_active_index_p(owner);
1291}
1292
1293static void rna_AttributeGroupGreasePencilDrawing_active_index_set(PointerRNA *ptr, int value)
1294{
1295 GreasePencilDrawing *drawing = static_cast<GreasePencilDrawing *>(ptr->data);
1297 *BKE_attributes_active_index_p(owner) = std::max(-1, value);
1298}
1299
1300static void rna_AttributeGroupGreasePencilDrawing_active_index_range(
1301 PointerRNA *ptr, int *min, int *max, int *softmin, int *softmax)
1302{
1303 GreasePencilDrawing *drawing = static_cast<GreasePencilDrawing *>(ptr->data);
1305 *min = -1;
1306 *max = owner.get_storage()->count();
1307
1308 *softmin = *min;
1309 *softmax = *max;
1310}
1311
1312static int rna_AttributeGroupGreasePencilDrawing_domain_size(GreasePencilDrawing *drawing,
1313 const int domain)
1314{
1316 return owner.get_accessor()->domain_size(blender::bke::AttrDomain(domain));
1317}
1318
1319#else
1320
1322{
1323 StructRNA *srna;
1324 PropertyRNA *prop;
1325
1326 srna = RNA_def_struct(brna, "FloatAttribute", "Attribute");
1327 RNA_def_struct_sdna(srna, "CustomDataLayer");
1329 srna, "Float Attribute", "Geometry attribute that stores floating-point values");
1330
1331 prop = RNA_def_property(srna, "data", PROP_COLLECTION, PROP_NONE);
1332 RNA_def_property_struct_type(prop, "FloatAttributeValue");
1335 "rna_Attribute_data_begin",
1336 "rna_iterator_array_next",
1337 "rna_iterator_array_end",
1338 "rna_iterator_array_get",
1339 "rna_Attribute_data_length",
1340 nullptr,
1341 nullptr,
1342 nullptr);
1343 RNA_def_property_update(prop, 0, "rna_Attribute_update_data");
1344
1345 srna = RNA_def_struct(brna, "FloatAttributeValue", nullptr);
1346 RNA_def_struct_sdna(srna, "MFloatProperty");
1348 srna, "Float Attribute Value", "Floating-point value in geometry attribute");
1349 prop = RNA_def_property(srna, "value", PROP_FLOAT, PROP_NONE);
1350 RNA_def_property_float_sdna(prop, nullptr, "f");
1351 RNA_def_property_update(prop, 0, "rna_Attribute_update_data");
1352}
1353
1355{
1356 StructRNA *srna;
1357 PropertyRNA *prop;
1358
1359 /* Float Vector Attribute */
1360 srna = RNA_def_struct(brna, "FloatVectorAttribute", "Attribute");
1361 RNA_def_struct_sdna(srna, "CustomDataLayer");
1363 srna, "Float Vector Attribute", "Geometry attribute that stores floating-point 3D vectors");
1364
1365 prop = RNA_def_property(srna, "data", PROP_COLLECTION, PROP_NONE);
1366 RNA_def_property_struct_type(prop, "FloatVectorAttributeValue");
1369 "rna_Attribute_data_begin",
1370 "rna_iterator_array_next",
1371 "rna_iterator_array_end",
1372 "rna_iterator_array_get",
1373 "rna_Attribute_data_length",
1374 nullptr,
1375 nullptr,
1376 nullptr);
1377 RNA_def_property_update(prop, 0, "rna_Attribute_update_data");
1378
1379 /* Float Vector Attribute Value */
1380 srna = RNA_def_struct(brna, "FloatVectorAttributeValue", nullptr);
1381 RNA_def_struct_sdna(srna, "vec3f");
1383 srna, "Float Vector Attribute Value", "Vector value in geometry attribute");
1384
1385 prop = RNA_def_property(srna, "vector", PROP_FLOAT, PROP_DIRECTION);
1386 RNA_def_property_ui_text(prop, "Vector", "3D vector");
1387 RNA_def_property_float_sdna(prop, nullptr, "x");
1388 RNA_def_property_array(prop, 3);
1389 RNA_def_property_update(prop, 0, "rna_Attribute_update_data");
1390}
1391
1393{
1394 StructRNA *srna;
1395 PropertyRNA *prop;
1396
1397 /* Float Color Attribute */
1398 srna = RNA_def_struct(brna, "FloatColorAttribute", "Attribute");
1399 RNA_def_struct_sdna(srna, "CustomDataLayer");
1401 "Float Color Attribute",
1402 "Geometry attribute that stores RGBA colors as floating-point values "
1403 "using 32-bits per channel");
1404
1405 prop = RNA_def_property(srna, "data", PROP_COLLECTION, PROP_NONE);
1406 RNA_def_property_struct_type(prop, "FloatColorAttributeValue");
1409 "rna_Attribute_data_begin",
1410 "rna_iterator_array_next",
1411 "rna_iterator_array_end",
1412 "rna_iterator_array_get",
1413 "rna_Attribute_data_length",
1414 nullptr,
1415 nullptr,
1416 nullptr);
1417 RNA_def_property_update(prop, 0, "rna_Attribute_update_data");
1418
1419 /* Float Color Attribute Value */
1420 srna = RNA_def_struct(brna, "FloatColorAttributeValue", nullptr);
1421 RNA_def_struct_sdna(srna, "MPropCol");
1422 RNA_def_struct_ui_text(srna, "Float Color Attribute Value", "Color value in geometry attribute");
1423
1424 prop = RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR);
1425 RNA_def_property_ui_text(prop, "Color", "RGBA color in scene linear color space");
1426 RNA_def_property_float_sdna(prop, nullptr, "color");
1427 RNA_def_property_array(prop, 4);
1428 RNA_def_property_update(prop, 0, "rna_Attribute_update_data");
1429
1430 prop = RNA_def_property(srna, "color_srgb", PROP_FLOAT, PROP_COLOR);
1431 RNA_def_property_ui_text(prop, "Color", "RGBA color in sRGB color space");
1432 RNA_def_property_float_sdna(prop, nullptr, "color");
1433 RNA_def_property_array(prop, 4);
1435 "rna_FloatColorAttributeValue_color_srgb_get",
1436 "rna_FloatColorAttributeValue_color_srgb_set",
1437 nullptr);
1438 RNA_def_property_update(prop, 0, "rna_Attribute_update_data");
1439}
1440
1442{
1443 StructRNA *srna;
1444 PropertyRNA *prop;
1445
1446 /* Byte Color Attribute */
1447 srna = RNA_def_struct(brna, "ByteColorAttribute", "Attribute");
1448 RNA_def_struct_sdna(srna, "CustomDataLayer");
1450 "Byte Color Attribute",
1451 "Geometry attribute that stores RGBA colors as positive integer values "
1452 "using 8-bits per channel");
1453
1454 prop = RNA_def_property(srna, "data", PROP_COLLECTION, PROP_NONE);
1455 RNA_def_property_struct_type(prop, "ByteColorAttributeValue");
1458 "rna_Attribute_data_begin",
1459 "rna_iterator_array_next",
1460 "rna_iterator_array_end",
1461 "rna_iterator_array_get",
1462 "rna_Attribute_data_length",
1463 nullptr,
1464 nullptr,
1465 nullptr);
1466 RNA_def_property_update(prop, 0, "rna_Attribute_update_data");
1467
1468 /* Byte Color Attribute Value */
1469 srna = RNA_def_struct(brna, "ByteColorAttributeValue", nullptr);
1470 RNA_def_struct_sdna(srna, "MLoopCol");
1471 RNA_def_struct_ui_text(srna, "Byte Color Attribute Value", "Color value in geometry attribute");
1472
1473 prop = RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR);
1474 RNA_def_property_array(prop, 4);
1475 RNA_def_property_range(prop, 0.0f, 1.0f);
1477 "rna_ByteColorAttributeValue_color_get",
1478 "rna_ByteColorAttributeValue_color_set",
1479 nullptr);
1480 RNA_def_property_ui_text(prop, "Color", "RGBA color in scene linear color space");
1481 RNA_def_property_update(prop, 0, "rna_Attribute_update_data");
1482
1483 prop = RNA_def_property(srna, "color_srgb", PROP_FLOAT, PROP_COLOR);
1484 RNA_def_property_array(prop, 4);
1485 RNA_def_property_range(prop, 0.0f, 1.0f);
1487 "rna_ByteColorAttributeValue_color_srgb_get",
1488 "rna_ByteColorAttributeValue_color_srgb_set",
1489 nullptr);
1490 RNA_def_property_ui_text(prop, "Color", "RGBA color in sRGB color space");
1491 RNA_def_property_update(prop, 0, "rna_Attribute_update_data");
1492}
1493
1495{
1496 StructRNA *srna;
1497 PropertyRNA *prop;
1498
1499 srna = RNA_def_struct(brna, "IntAttribute", "Attribute");
1500 RNA_def_struct_sdna(srna, "CustomDataLayer");
1502 srna, "Integer Attribute", "Geometry attribute that stores integer values");
1503
1504 prop = RNA_def_property(srna, "data", PROP_COLLECTION, PROP_NONE);
1505 RNA_def_property_struct_type(prop, "IntAttributeValue");
1508 "rna_Attribute_data_begin",
1509 "rna_iterator_array_next",
1510 "rna_iterator_array_end",
1511 "rna_iterator_array_get",
1512 "rna_Attribute_data_length",
1513 nullptr,
1514 nullptr,
1515 nullptr);
1516 RNA_def_property_update(prop, 0, "rna_Attribute_update_data");
1517
1518 srna = RNA_def_struct(brna, "IntAttributeValue", nullptr);
1519 RNA_def_struct_sdna(srna, "MIntProperty");
1520 RNA_def_struct_ui_text(srna, "Integer Attribute Value", "Integer value in geometry attribute");
1521 prop = RNA_def_property(srna, "value", PROP_INT, PROP_NONE);
1522 RNA_def_property_int_sdna(prop, nullptr, "i");
1523 RNA_def_property_update(prop, 0, "rna_Attribute_update_data");
1524}
1525
1527{
1528 StructRNA *srna;
1529 PropertyRNA *prop;
1530
1531 srna = RNA_def_struct(brna, "StringAttribute", "Attribute");
1532 RNA_def_struct_sdna(srna, "CustomDataLayer");
1533 RNA_def_struct_ui_text(srna, "String Attribute", "Geometry attribute that stores strings");
1534
1535 prop = RNA_def_property(srna, "data", PROP_COLLECTION, PROP_NONE);
1536 RNA_def_property_struct_type(prop, "StringAttributeValue");
1539 "rna_Attribute_data_begin",
1540 "rna_iterator_array_next",
1541 "rna_iterator_array_end",
1542 "rna_iterator_array_get",
1543 "rna_Attribute_data_length",
1544 nullptr,
1545 nullptr,
1546 nullptr);
1547 RNA_def_property_update(prop, 0, "rna_Attribute_update_data");
1548
1549 srna = RNA_def_struct(brna, "StringAttributeValue", nullptr);
1550 RNA_def_struct_sdna(srna, "MStringProperty");
1551 RNA_def_struct_ui_text(srna, "String Attribute Value", "String value in geometry attribute");
1552 prop = RNA_def_property(srna, "value", PROP_STRING, PROP_BYTESTRING);
1553 RNA_def_property_string_sdna(prop, nullptr, "s");
1555 "rna_StringAttributeValue_s_get",
1556 "rna_StringAttributeValue_s_length",
1557 "rna_StringAttributeValue_s_set");
1558 RNA_def_property_update(prop, 0, "rna_Attribute_update_data");
1559}
1560
1562{
1563 StructRNA *srna;
1564 PropertyRNA *prop;
1565
1566 srna = RNA_def_struct(brna, "BoolAttribute", "Attribute");
1567 RNA_def_struct_sdna(srna, "CustomDataLayer");
1568 RNA_def_struct_ui_text(srna, "Bool Attribute", "Geometry attribute that stores booleans");
1569
1570 prop = RNA_def_property(srna, "data", PROP_COLLECTION, PROP_NONE);
1571 RNA_def_property_struct_type(prop, "BoolAttributeValue");
1574 "rna_Attribute_data_begin",
1575 "rna_iterator_array_next",
1576 "rna_iterator_array_end",
1577 "rna_iterator_array_get",
1578 "rna_Attribute_data_length",
1579 nullptr,
1580 nullptr,
1581 nullptr);
1582 RNA_def_property_update(prop, 0, "rna_Attribute_update_data");
1583
1584 srna = RNA_def_struct(brna, "BoolAttributeValue", nullptr);
1585 RNA_def_struct_sdna(srna, "MBoolProperty");
1586 RNA_def_struct_ui_text(srna, "Bool Attribute Value", "Bool value in geometry attribute");
1587 prop = RNA_def_property(srna, "value", PROP_BOOLEAN, PROP_NONE);
1588 RNA_def_property_boolean_sdna(prop, nullptr, "b", 0);
1589}
1590
1592{
1593 StructRNA *srna;
1594 PropertyRNA *prop;
1595
1596 srna = RNA_def_struct(brna, "ByteIntAttribute", "Attribute");
1597 RNA_def_struct_sdna(srna, "CustomDataLayer");
1599 srna, "8-bit Integer Attribute", "Geometry attribute that stores 8-bit integers");
1600
1601 prop = RNA_def_property(srna, "data", PROP_COLLECTION, PROP_NONE);
1602 RNA_def_property_struct_type(prop, "ByteIntAttributeValue");
1605 "rna_Attribute_data_begin",
1606 "rna_iterator_array_next",
1607 "rna_iterator_array_end",
1608 "rna_iterator_array_get",
1609 "rna_Attribute_data_length",
1610 nullptr,
1611 nullptr,
1612 nullptr);
1613 RNA_def_property_update(prop, 0, "rna_Attribute_update_data");
1614
1615 srna = RNA_def_struct(brna, "ByteIntAttributeValue", nullptr);
1616 RNA_def_struct_sdna(srna, "MInt8Property");
1618 srna, "8-bit Integer Attribute Value", "8-bit value in geometry attribute");
1619 prop = RNA_def_property(srna, "value", PROP_INT, PROP_NONE);
1620 RNA_def_property_int_sdna(prop, nullptr, "i");
1621}
1622
1624{
1625 StructRNA *srna;
1626 PropertyRNA *prop;
1627
1628 srna = RNA_def_struct(brna, "Short2Attribute", "Attribute");
1629 RNA_def_struct_sdna(srna, "CustomDataLayer");
1631 "2D 16-Bit Integer Vector Attribute",
1632 "Geometry attribute that stores 2D integer vectors");
1633
1634 prop = RNA_def_property(srna, "data", PROP_COLLECTION, PROP_NONE);
1635 RNA_def_property_struct_type(prop, "Short2AttributeValue");
1638 "rna_Attribute_data_begin",
1639 "rna_iterator_array_next",
1640 "rna_iterator_array_end",
1641 "rna_iterator_array_get",
1642 "rna_Attribute_data_length",
1643 nullptr,
1644 nullptr,
1645 nullptr);
1646 RNA_def_property_update(prop, 0, "rna_Attribute_update_data");
1647
1648 srna = RNA_def_struct(brna, "Short2AttributeValue", nullptr);
1649 RNA_def_struct_sdna(srna, "vec2s");
1651 srna, "2D 16-Bit Integer Vector Attribute Value", "2D value in geometry attribute");
1652
1653 prop = RNA_def_property(srna, "value", PROP_INT, PROP_NONE);
1654 RNA_def_property_ui_text(prop, "Vector", "2D vector");
1655 RNA_def_property_int_sdna(prop, nullptr, "x");
1656 RNA_def_property_array(prop, 2);
1657 RNA_def_property_update(prop, 0, "rna_Attribute_update_data");
1658}
1659
1661{
1662 StructRNA *srna;
1663 PropertyRNA *prop;
1664
1665 srna = RNA_def_struct(brna, "Int2Attribute", "Attribute");
1666 RNA_def_struct_sdna(srna, "CustomDataLayer");
1668 srna, "2D Integer Vector Attribute", "Geometry attribute that stores 2D integer vectors");
1669
1670 prop = RNA_def_property(srna, "data", PROP_COLLECTION, PROP_NONE);
1671 RNA_def_property_struct_type(prop, "Int2AttributeValue");
1674 "rna_Attribute_data_begin",
1675 "rna_iterator_array_next",
1676 "rna_iterator_array_end",
1677 "rna_iterator_array_get",
1678 "rna_Attribute_data_length",
1679 nullptr,
1680 nullptr,
1681 nullptr);
1682 RNA_def_property_update(prop, 0, "rna_Attribute_update_data");
1683
1684 srna = RNA_def_struct(brna, "Int2AttributeValue", nullptr);
1685 RNA_def_struct_sdna(srna, "vec2i");
1687 srna, "2D Integer Vector Attribute Value", "2D value in geometry attribute");
1688
1689 prop = RNA_def_property(srna, "value", PROP_INT, PROP_NONE);
1690 RNA_def_property_ui_text(prop, "Vector", "2D vector");
1691 RNA_def_property_int_sdna(prop, nullptr, "x");
1692 RNA_def_property_array(prop, 2);
1693 RNA_def_property_update(prop, 0, "rna_Attribute_update_data");
1694}
1695
1697{
1698 StructRNA *srna;
1699 PropertyRNA *prop;
1700
1701 srna = RNA_def_struct(brna, "QuaternionAttribute", "Attribute");
1702 RNA_def_struct_sdna(srna, "CustomDataLayer");
1703 RNA_def_struct_ui_text(srna, "Quaternion Attribute", "Geometry attribute that stores rotation");
1704
1705 prop = RNA_def_property(srna, "data", PROP_COLLECTION, PROP_NONE);
1706 RNA_def_property_struct_type(prop, "QuaternionAttributeValue");
1709 "rna_Attribute_data_begin",
1710 "rna_iterator_array_next",
1711 "rna_iterator_array_end",
1712 "rna_iterator_array_get",
1713 "rna_Attribute_data_length",
1714 nullptr,
1715 nullptr,
1716 nullptr);
1717 RNA_def_property_update(prop, 0, "rna_Attribute_update_data");
1718
1719 srna = RNA_def_struct(brna, "QuaternionAttributeValue", nullptr);
1720 RNA_def_struct_sdna(srna, "vec4f");
1722 srna, "Quaternion Attribute Value", "Rotation value in geometry attribute");
1723
1724 prop = RNA_def_property(srna, "value", PROP_FLOAT, PROP_NONE);
1725 RNA_def_property_ui_text(prop, "Value", "Quaternion");
1726 RNA_def_property_float_sdna(prop, nullptr, "x");
1727 RNA_def_property_array(prop, 4);
1728 RNA_def_property_update(prop, 0, "rna_Attribute_update_data");
1729}
1730
1732{
1733 StructRNA *srna;
1734 PropertyRNA *prop;
1735
1736 srna = RNA_def_struct(brna, "Float4x4Attribute", "Attribute");
1737 RNA_def_struct_sdna(srna, "CustomDataLayer");
1739 srna, "4x4 Matrix Attribute", "Geometry attribute that stores a 4 by 4 float matrix");
1740
1741 prop = RNA_def_property(srna, "data", PROP_COLLECTION, PROP_NONE);
1742 RNA_def_property_struct_type(prop, "Float4x4AttributeValue");
1745 "rna_Attribute_data_begin",
1746 "rna_iterator_array_next",
1747 "rna_iterator_array_end",
1748 "rna_iterator_array_get",
1749 "rna_Attribute_data_length",
1750 nullptr,
1751 nullptr,
1752 nullptr);
1753 RNA_def_property_update(prop, 0, "rna_Attribute_update_data");
1754
1755 srna = RNA_def_struct(brna, "Float4x4AttributeValue", nullptr);
1756 RNA_def_struct_sdna(srna, "mat4x4f");
1757 RNA_def_struct_ui_text(srna, "Matrix Attribute Value", "Matrix value in geometry attribute");
1758
1759 prop = RNA_def_property(srna, "value", PROP_FLOAT, PROP_MATRIX);
1760 RNA_def_property_ui_text(prop, "Value", "Matrix");
1761 RNA_def_property_float_sdna(prop, nullptr, "value");
1763 RNA_def_property_update(prop, 0, "rna_Attribute_update_data");
1764}
1765
1767{
1768 StructRNA *srna;
1769 PropertyRNA *prop;
1770
1771 /* Float2 Attribute */
1772 srna = RNA_def_struct(brna, "Float2Attribute", "Attribute");
1773 RNA_def_struct_sdna(srna, "CustomDataLayer");
1775 srna, "Float2 Attribute", "Geometry attribute that stores floating-point 2D vectors");
1776
1777 prop = RNA_def_property(srna, "data", PROP_COLLECTION, PROP_NONE);
1778 RNA_def_property_struct_type(prop, "Float2AttributeValue");
1781 "rna_Attribute_data_begin",
1782 "rna_iterator_array_next",
1783 "rna_iterator_array_end",
1784 "rna_iterator_array_get",
1785 "rna_Attribute_data_length",
1786 nullptr,
1787 nullptr,
1788 nullptr);
1789 RNA_def_property_update(prop, 0, "rna_Attribute_update_data");
1790
1791 /* Float2 Attribute Value */
1792 srna = RNA_def_struct(brna, "Float2AttributeValue", nullptr);
1793 RNA_def_struct_sdna(srna, "vec2f");
1794 RNA_def_struct_ui_text(srna, "Float2 Attribute Value", "2D Vector value in geometry attribute");
1795
1796 prop = RNA_def_property(srna, "vector", PROP_FLOAT, PROP_DIRECTION);
1797 RNA_def_property_ui_text(prop, "Vector", "2D vector");
1798 RNA_def_property_float_sdna(prop, nullptr, "x");
1799 RNA_def_property_array(prop, 2);
1800 RNA_def_property_update(prop, 0, "rna_Attribute_update_data");
1801}
1802
1804{
1805 PropertyRNA *prop;
1806 StructRNA *srna;
1807
1808 srna = RNA_def_struct(brna, "Attribute", nullptr);
1809 RNA_def_struct_ui_text(srna, "Attribute", "Geometry attribute");
1810 RNA_def_struct_path_func(srna, "rna_Attribute_path");
1811 RNA_def_struct_refine_func(srna, "rna_Attribute_refine");
1812
1813 prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
1815 prop, "rna_Attribute_name_get", "rna_Attribute_name_length", "rna_Attribute_name_set");
1816 RNA_def_property_editable_func(prop, "rna_Attribute_name_editable");
1817 RNA_def_property_ui_text(prop, "Name", "Name of the Attribute");
1818 RNA_def_struct_name_property(srna, prop);
1819
1820 prop = RNA_def_property(srna, "data_type", PROP_ENUM, PROP_NONE);
1822 RNA_def_property_enum_funcs(prop, "rna_Attribute_type_get", nullptr, nullptr);
1823 RNA_def_property_ui_text(prop, "Data Type", "Type of data stored in attribute");
1825
1826 prop = RNA_def_property(srna, "storage_type", PROP_ENUM, PROP_NONE);
1828 RNA_def_property_enum_funcs(prop, "rna_Attribute_storage_type_get", nullptr, nullptr);
1829 RNA_def_property_ui_text(prop, "Storage Type", "Method used to store the data");
1832
1833 prop = RNA_def_property(srna, "domain", PROP_ENUM, PROP_NONE);
1836 prop, "rna_Attribute_domain_get", nullptr, "rna_Attribute_domain_itemf");
1837 RNA_def_property_ui_text(prop, "Domain", "Domain of the Attribute");
1839
1840 prop = RNA_def_property(srna, "is_internal", PROP_BOOLEAN, PROP_NONE);
1841 RNA_def_property_boolean_funcs(prop, "rna_Attribute_is_internal_get", nullptr);
1843 prop, "Is Internal", "The attribute is meant for internal use by Blender");
1845
1846 prop = RNA_def_property(srna, "is_required", PROP_BOOLEAN, PROP_NONE);
1847 RNA_def_property_boolean_funcs(prop, "rna_Attribute_is_required_get", nullptr);
1848 RNA_def_property_ui_text(prop, "Is Required", "Whether the attribute can be removed or renamed");
1850
1851 /* types */
1865}
1866
1868{
1869 PropertyRNA *prop;
1870 FunctionRNA *func;
1871 PropertyRNA *parm;
1872
1873 /* API */
1874 func = RNA_def_function(srna, "new", "rna_AttributeGroupID_new");
1875 RNA_def_function_ui_description(func, "Add attribute to geometry");
1877 parm = RNA_def_string(func, "name", "Attribute", 0, "Name", "Name of geometry attribute");
1879
1880 parm = RNA_def_enum(
1881 func, "type", rna_enum_attribute_type_items, CD_PROP_FLOAT, "Type", "Attribute type");
1883
1884 parm = RNA_def_enum(func,
1885 "domain",
1887 int(AttrDomain::Point),
1888 "Domain",
1889 "Type of element that attribute is stored on");
1891
1892 parm = RNA_def_pointer(func, "attribute", "Attribute", "", "New geometry attribute");
1894 RNA_def_function_return(func, parm);
1895
1896 func = RNA_def_function(srna, "remove", "rna_AttributeGroupID_remove");
1897 RNA_def_function_ui_description(func, "Remove attribute from geometry");
1899 parm = RNA_def_pointer(func, "attribute", "Attribute", "", "Geometry Attribute");
1902
1903 /* Active */
1904 prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
1905 RNA_def_property_struct_type(prop, "Attribute");
1906 RNA_def_property_ui_text(prop, "Active Attribute", "Active attribute");
1908 "rna_AttributeGroupID_active_get",
1909 "rna_AttributeGroupID_active_set",
1910 nullptr,
1911 nullptr);
1913 RNA_def_property_update(prop, 0, "rna_AttributeGroup_update_active");
1914
1915 prop = RNA_def_property(srna, "active_index", PROP_INT, PROP_NONE);
1917 prop, "Active Attribute Index", "Active attribute index or -1 when none are active");
1918 RNA_def_property_range(prop, -1, INT_MAX);
1921 "rna_AttributeGroupID_active_index_get",
1922 "rna_AttributeGroupID_active_index_set",
1923 "rna_AttributeGroupID_active_index_range");
1924 RNA_def_property_update(prop, 0, "rna_AttributeGroup_update_active");
1925
1926 /* Domain Size */
1927 func = RNA_def_function(srna, "domain_size", "rna_AttributeGroupID_domain_size");
1928 RNA_def_function_ui_description(func, "Get the size of a given domain");
1929 parm = RNA_def_enum(func,
1930 "domain",
1932 int(AttrDomain::Point),
1933 "Domain",
1934 "Type of element that attribute is stored on");
1936 parm = RNA_def_int(func, "size", 0, 0, INT_MAX, "Size", "Size of the domain", 0, INT_MAX);
1937 RNA_def_function_return(func, parm);
1938}
1939
1941{
1942 StructRNA *srna;
1943 PropertyRNA *prop;
1944
1945 srna = RNA_def_struct(brna, "AttributeGroupMesh", nullptr);
1946 RNA_def_struct_ui_text(srna, "Attribute Group", "Group of geometry attributes");
1947 /* Define `AttributeGroupMesh` to be of type `ID` so we can reuse the generic ID `AttributeGroup`
1948 * functions. */
1949 RNA_def_struct_sdna(srna, "ID");
1950
1952
1953 prop = RNA_def_property(srna, "active_color", PROP_POINTER, PROP_NONE);
1954 RNA_def_property_struct_type(prop, "Attribute");
1955 RNA_def_property_ui_text(prop, "Active Color", "Active color attribute for display and editing");
1957 "rna_AttributeGroupMesh_active_color_get",
1958 "rna_AttributeGroupMesh_active_color_set",
1959 nullptr,
1960 nullptr);
1962 RNA_def_property_update(prop, 0, "rna_AttributeGroup_update_active_color");
1963
1964 prop = RNA_def_property(srna, "active_color_index", PROP_INT, PROP_NONE);
1965 RNA_def_property_ui_text(prop, "Active Color Index", "Active color attribute index");
1968 "rna_AttributeGroupMesh_active_color_index_get",
1969 "rna_AttributeGroupMesh_active_color_index_set",
1970 "rna_AttributeGroupMesh_active_color_index_range");
1971 RNA_def_property_update(prop, 0, "rna_AttributeGroup_update_active_color");
1972
1973 prop = RNA_def_property(srna, "render_color_index", PROP_INT, PROP_NONE);
1975 "Active Render Color Index",
1976 "The index of the color attribute used as a fallback for rendering");
1979 "rna_AttributeGroupMesh_render_color_index_get",
1980 "rna_AttributeGroupMesh_render_color_index_set",
1981 "rna_AttributeGroupMesh_render_color_index_range");
1982 RNA_def_property_update(prop, 0, "rna_AttributeGroup_update_active_color");
1983
1984 prop = RNA_def_property(srna, "default_color_name", PROP_STRING, PROP_NONE);
1987 "rna_AttributeGroupMesh_default_color_name_get",
1988 "rna_AttributeGroupMesh_default_color_name_length",
1989 "rna_AttributeGroupMesh_default_color_name_set");
1991 prop,
1992 "Default Color Attribute",
1993 "The name of the default color attribute used as a fallback for rendering");
1994
1995 prop = RNA_def_property(srna, "active_color_name", PROP_STRING, PROP_NONE);
1998 "rna_AttributeGroupMesh_active_color_name_get",
1999 "rna_AttributeGroupMesh_active_color_name_length",
2000 "rna_AttributeGroupMesh_active_color_name_set");
2002 "Active Color Attribute",
2003 "The name of the active color attribute for display and editing");
2004}
2005
2007{
2008 StructRNA *srna;
2009
2010 srna = RNA_def_struct(brna, "AttributeGroupPointCloud", nullptr);
2011 RNA_def_struct_ui_text(srna, "Attribute Group", "Group of geometry attributes");
2012 RNA_def_struct_sdna(srna, "ID");
2013
2015}
2016
2018{
2019 StructRNA *srna;
2020
2021 srna = RNA_def_struct(brna, "AttributeGroupCurves", nullptr);
2022 RNA_def_struct_ui_text(srna, "Attribute Group", "Group of geometry attributes");
2023 RNA_def_struct_sdna(srna, "ID");
2024
2026}
2027
2029{
2030 StructRNA *srna;
2031
2032 srna = RNA_def_struct(brna, "AttributeGroupGreasePencil", nullptr);
2033 RNA_def_struct_ui_text(srna, "Attribute Group", "Group of geometry attributes");
2034 RNA_def_struct_sdna(srna, "ID");
2035
2037}
2038
2040{
2041 PropertyRNA *prop;
2042 FunctionRNA *func;
2043 PropertyRNA *parm;
2044 StructRNA *srna;
2045
2046 srna = RNA_def_struct(brna, "AttributeGroupGreasePencilDrawing", nullptr);
2047 RNA_def_struct_ui_text(srna, "Attribute Group", "Group of geometry attributes");
2048 RNA_def_struct_sdna(srna, "GreasePencilDrawing");
2049
2050 /* API */
2051 func = RNA_def_function(srna, "new", "rna_AttributeGroupGreasePencilDrawing_new");
2052 RNA_def_function_ui_description(func, "Add attribute to geometry");
2054 parm = RNA_def_string(func, "name", "Attribute", 0, "Name", "Name of geometry attribute");
2056
2057 parm = RNA_def_enum(
2058 func, "type", rna_enum_attribute_type_items, CD_PROP_FLOAT, "Type", "Attribute type");
2060
2061 parm = RNA_def_enum(func,
2062 "domain",
2064 int(AttrDomain::Point),
2065 "Domain",
2066 "Type of element that attribute is stored on");
2068
2069 parm = RNA_def_pointer(func, "attribute", "Attribute", "", "New geometry attribute");
2071 RNA_def_function_return(func, parm);
2072
2073 func = RNA_def_function(srna, "remove", "rna_AttributeGroupGreasePencilDrawing_remove");
2074 RNA_def_function_ui_description(func, "Remove attribute from geometry");
2076 parm = RNA_def_pointer(func, "attribute", "Attribute", "", "Geometry Attribute");
2079
2080 /* Active */
2081 prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
2082 RNA_def_property_struct_type(prop, "Attribute");
2083 RNA_def_property_ui_text(prop, "Active Attribute", "Active attribute");
2085 "rna_AttributeGroupGreasePencilDrawing_active_get",
2086 "rna_AttributeGroupGreasePencilDrawing_active_set",
2087 nullptr,
2088 "rna_AttributeGroupGreasePencilDrawing_active_poll");
2090 RNA_def_property_update(prop, 0, "rna_AttributeGroup_update_active");
2091
2092 prop = RNA_def_property(srna, "active_index", PROP_INT, PROP_NONE);
2094 prop, "Active Attribute Index", "Active attribute index or -1 when none are active");
2095 RNA_def_property_range(prop, -1, INT_MAX);
2098 "rna_AttributeGroupGreasePencilDrawing_active_index_get",
2099 "rna_AttributeGroupGreasePencilDrawing_active_index_set",
2100 "rna_AttributeGroupGreasePencilDrawing_active_index_range");
2101 RNA_def_property_update(prop, 0, "rna_AttributeGroup_update_active");
2102
2103 /* Domain Size */
2104 func = RNA_def_function(
2105 srna, "domain_size", "rna_AttributeGroupGreasePencilDrawing_domain_size");
2106 RNA_def_function_ui_description(func, "Get the size of a given domain");
2107 parm = RNA_def_enum(func,
2108 "domain",
2110 int(AttrDomain::Point),
2111 "Domain",
2112 "Type of element that attribute is stored on");
2114 parm = RNA_def_int(func, "size", 0, 0, INT_MAX, "Size", "Size of the domain", 0, INT_MAX);
2115 RNA_def_function_return(func, parm);
2116}
2117
2119{
2120 PropertyRNA *prop;
2121
2122 /* Attributes */
2123 prop = RNA_def_property(srna, "attributes", PROP_COLLECTION, PROP_NONE);
2125 "rna_AttributeGroup_iterator_begin",
2126 "rna_AttributeGroup_iterator_next",
2127 "rna_iterator_array_end",
2128 "rna_AttributeGroup_iterator_get",
2129 "rna_AttributeGroup_length",
2130 nullptr,
2131 "rna_AttributeGroup_lookup_string",
2132 nullptr);
2133 RNA_def_property_struct_type(prop, "Attribute");
2134 RNA_def_property_ui_text(prop, "Attributes", "Geometry attributes");
2135 switch (type) {
2137 RNA_def_property_srna(prop, "AttributeGroupMesh");
2138 break;
2140 RNA_def_property_srna(prop, "AttributeGroupPointCloud");
2141 break;
2143 RNA_def_property_srna(prop, "AttributeGroupCurves");
2144 break;
2146 RNA_def_property_srna(prop, "AttributeGroupGreasePencil");
2147 break;
2149 RNA_def_property_srna(prop, "AttributeGroupGreasePencilDrawing");
2150 break;
2151 }
2152
2153 prop = RNA_def_property(srna, "color_attributes", PROP_COLLECTION, PROP_NONE);
2155 "rna_AttributeGroup_color_iterator_begin",
2156 "rna_AttributeGroup_color_iterator_next",
2157 "rna_iterator_array_end",
2158 "rna_AttributeGroup_color_iterator_get",
2159 "rna_AttributeGroup_color_length",
2160 nullptr,
2161 nullptr,
2162 nullptr);
2163 RNA_def_property_struct_type(prop, "Attribute");
2164 RNA_def_property_ui_text(prop, "Color Attributes", "Geometry color attributes");
2165 switch (type) {
2167 RNA_def_property_srna(prop, "AttributeGroupMesh");
2168 break;
2170 RNA_def_property_srna(prop, "AttributeGroupPointCloud");
2171 break;
2173 RNA_def_property_srna(prop, "AttributeGroupCurves");
2174 break;
2176 RNA_def_property_srna(prop, "AttributeGroupGreasePencil");
2177 break;
2179 RNA_def_property_srna(prop, "AttributeGroupGreasePencilDrawing");
2180 break;
2181 }
2182}
2183
2193#endif
void BKE_id_attributes_default_color_set(struct ID *id, std::optional< blender::StringRef > name)
struct CustomDataLayer * BKE_attribute_new(AttributeOwner &owner, blender::StringRef name, eCustomDataType type, blender::bke::AttrDomain domain, struct ReportList *reports)
Definition attribute.cc:382
std::optional< blender::StringRefNull > BKE_attributes_active_name_get(AttributeOwner &owner)
Definition attribute.cc:784
int BKE_attribute_to_index(const AttributeOwner &owner, const CustomDataLayer *layer, AttrDomainMask domain_mask, eCustomDataMask layer_mask)
Definition attribute.cc:931
struct CustomDataLayer * BKE_attribute_search_for_write(AttributeOwner &owner, blender::StringRef name, eCustomDataMask type, AttrDomainMask domain_mask)
Definition attribute.cc:672
blender::bke::AttrDomain BKE_attribute_domain(const AttributeOwner &owner, const struct CustomDataLayer *layer)
CustomData * BKE_attributes_iterator_next_domain(AttributeOwner &owner, struct CustomDataLayer *layers)
Definition attribute.cc:874
int BKE_attribute_domain_size(const AttributeOwner &owner, int domain)
Definition attribute.cc:733
std::optional< blender::StringRef > BKE_id_attributes_default_color_name(const struct ID *id)
CustomDataLayer * BKE_attribute_from_index(AttributeOwner &owner, int lookup_index, AttrDomainMask domain_mask, eCustomDataMask layer_mask)
Definition attribute.cc:898
bool BKE_attribute_remove(AttributeOwner &owner, blender::StringRef name, struct ReportList *reports)
Definition attribute.cc:512
void BKE_attributes_active_set(AttributeOwner &owner, blender::StringRef name)
Definition attribute.cc:830
@ ATTR_DOMAIN_MASK_ALL
const struct CustomDataLayer * BKE_attribute_search(const AttributeOwner &owner, blender::StringRef name, eCustomDataMask type, AttrDomainMask domain_mask)
Definition attribute.cc:639
const struct CustomDataLayer * BKE_id_attributes_color_find(const struct ID *id, blender::StringRef name)
int * BKE_attributes_active_index_p(AttributeOwner &owner)
Definition attribute.cc:852
AttributeOwnerType
void BKE_id_attributes_active_color_clear(struct ID *id)
bool BKE_attribute_required(const AttributeOwner &owner, blender::StringRef name)
Definition attribute.cc:767
int BKE_attribute_data_length(AttributeOwner &owner, struct CustomDataLayer *layer)
Definition attribute.cc:739
std::optional< blender::StringRef > BKE_id_attributes_active_color_name(const struct ID *id)
#define ATTR_DOMAIN_MASK_COLOR
#define ATTR_DOMAIN_AS_MASK(domain)
bool BKE_attribute_rename(AttributeOwner &owner, blender::StringRef old_name, blender::StringRef new_name, struct ReportList *reports)
Definition attribute.cc:251
int BKE_attributes_length(const AttributeOwner &owner, AttrDomainMask domain_mask, eCustomDataMask mask)
Definition attribute.cc:693
void BKE_id_attributes_active_color_set(struct ID *id, std::optional< blender::StringRef > name)
Definition attribute.cc:985
void BKE_attributes_active_clear(AttributeOwner &owner)
Definition attribute.cc:847
Low-level operations for curves.
CustomData interface, see also DNA_customdata_types.h.
eCustomDataMask CD_TYPE_AS_MASK(eCustomDataType type)
void CustomData_ensure_data_is_mutable(CustomDataLayer *layer, int totelem)
size_t CustomData_get_elem_size(const CustomDataLayer *layer)
@ RPT_ERROR
Definition BKE_report.hh:39
void BKE_report(ReportList *reports, eReportType type, const char *message)
Definition report.cc:153
MINLINE unsigned char round_fl_to_uchar_clamp(float a)
MINLINE void srgb_to_linearrgb_uchar4(float linear[4], const unsigned char srgb[4])
MINLINE void linearrgb_to_srgb_uchar4(unsigned char srgb[4], const float linear[4])
char * BLI_strdup(const char *str) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1) ATTR_MALLOC
Definition string.cc:41
int char char int int int int size_t BLI_strnlen(const char *str, size_t maxlen) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
Definition string.cc:913
size_t BLI_str_escape(char *__restrict dst, const char *__restrict src, size_t dst_maxncpy) ATTR_NONNULL(1
#define ELEM(...)
#define BLT_I18NCONTEXT_AMOUNT
void DEG_id_tag_update(ID *id, unsigned int flags)
@ ID_RECALC_GEOMETRY
Definition DNA_ID.h:1074
@ ID_ME
@ ID_GP
#define CD_MASK_PROP_ALL
#define CD_MASK_COLOR_ALL
@ CD_PROP_BYTE_COLOR
@ CD_PROP_FLOAT
@ CD_PROP_FLOAT3
@ CD_PROP_INT32_2D
@ CD_PROP_COLOR
@ CD_PROP_QUATERNION
@ CD_PROP_INT32
@ CD_PROP_FLOAT2
@ CD_PROP_INT16_2D
@ CD_PROP_STRING
@ CD_PROP_FLOAT4X4
@ CD_AUTO_FROM_NAME
@ CD_FLAG_TEMPORARY
#define MAX_CUSTOMDATA_LAYER_NAME_NO_PREFIX
BLI_INLINE void IMB_colormanagement_srgb_to_scene_linear_v3(float scene_linear[3], const float srgb[3])
BLI_INLINE void IMB_colormanagement_scene_linear_to_rec709(float rec709[3], const float scene_linear[3])
BLI_INLINE void IMB_colormanagement_rec709_to_scene_linear(float scene_linear[3], const float rec709[3])
BLI_INLINE void IMB_colormanagement_scene_linear_to_srgb_v3(float srgb[3], const float scene_linear[3])
#define MEM_SAFE_FREE(v)
const EnumPropertyItem * rna_enum_attribute_domain_itemf(const AttributeOwner &owner, bool include_instances, bool *r_free)
ParameterFlag
Definition RNA_types.hh:544
@ PARM_RNAPTR
Definition RNA_types.hh:547
@ PARM_REQUIRED
Definition RNA_types.hh:545
@ FUNC_USE_REPORTS
Definition RNA_types.hh:914
@ FUNC_USE_SELF_ID
Definition RNA_types.hh:889
@ PROP_FLOAT
Definition RNA_types.hh:164
@ PROP_BOOLEAN
Definition RNA_types.hh:162
@ PROP_ENUM
Definition RNA_types.hh:166
@ PROP_INT
Definition RNA_types.hh:163
@ PROP_STRING
Definition RNA_types.hh:165
@ PROP_POINTER
Definition RNA_types.hh:167
@ PROP_COLLECTION
Definition RNA_types.hh:168
@ PROPOVERRIDE_IGNORE
Definition RNA_types.hh:523
PropertyFlag
Definition RNA_types.hh:300
@ PROP_THICK_WRAP
Definition RNA_types.hh:423
@ PROP_ANIMATABLE
Definition RNA_types.hh:319
@ PROP_NEVER_UNLINK
Definition RNA_types.hh:384
@ PROP_EDITABLE
Definition RNA_types.hh:306
@ PROP_NEVER_NULL
Definition RNA_types.hh:377
@ PROP_MATRIX
Definition RNA_types.hh:265
@ PROP_DIRECTION
Definition RNA_types.hh:262
@ PROP_BYTESTRING
Definition RNA_types.hh:240
@ PROP_COLOR
Definition RNA_types.hh:260
@ PROP_NONE
Definition RNA_types.hh:233
#define NC_GEOM
Definition WM_types.hh:393
#define ND_DATA
Definition WM_types.hh:509
BMesh const char void * data
AttributeOwnerType type() const
Definition attribute.cc:63
std::optional< blender::bke::MutableAttributeAccessor > get_accessor() const
Definition attribute.cc:126
static AttributeOwner from_id(ID *id)
Definition attribute.cc:44
bool is_valid() const
Definition attribute.cc:68
GreasePencilDrawing * get_grease_pencil_drawing() const
Definition attribute.cc:101
blender::bke::AttributeStorage * get_storage() const
Definition attribute.cc:108
int64_t size
void append(const T &value)
VectorData< T, Allocator > release()
void copy_unsafe(char *dst) const
constexpr int64_t size() const
constexpr const char * c_str() const
bool domain_supported(const AttrDomain domain) const
int domain_size(const AttrDomain domain) const
Attribute & add(std::string name, bke::AttrDomain domain, bke::AttrType data_type, Attribute::DataVariant data)
Attribute * lookup(StringRef name)
void foreach(FunctionRef< void(Attribute &)> fn)
std::string unique_name_calc(StringRef name) const
void foreach_with_stop(FunctionRef< bool(Attribute &)> fn)
AttrStorageType storage_type() const
bool remove(const StringRef attribute_id)
#define GS(x)
uint col
float length(VecOp< float, D >) RET
int count
std::optional< eCustomDataType > attr_type_to_custom_data_type(AttrType attr_type)
bool allow_procedural_attribute_access(StringRef attribute_name)
std::optional< AttrType > custom_data_type_to_attr_type(eCustomDataType data_type)
const CPPType * custom_data_type_to_cpp_type(eCustomDataType type)
const CPPType & attribute_type_to_cpp_type(AttrType type)
uint32_t struct_size(Span< shader::ShaderCreateInfo::PushConst > push_constants)
const char * name
const PointerRNA PointerRNA_NULL
void * rna_iterator_array_get(CollectionPropertyIterator *iter)
void rna_iterator_array_begin(CollectionPropertyIterator *iter, PointerRNA *ptr, void *data, size_t itemsize, int64_t length, bool free_ptr, IteratorSkipFunc skip)
void rna_iterator_array_next(CollectionPropertyIterator *iter)
void rna_pointer_create_with_ancestors(const PointerRNA &parent, StructRNA *type, void *data, PointerRNA &r_ptr)
PointerRNA RNA_pointer_create_discrete(ID *id, StructRNA *type, void *data)
PointerRNA RNA_pointer_create_with_parent(const PointerRNA &parent, StructRNA *type, void *data)
static void rna_def_attribute_float4x4(BlenderRNA *brna)
static void rna_def_attribute_group_id_common(StructRNA *srna)
const EnumPropertyItem rna_enum_attribute_domain_only_mesh_items[]
static const EnumPropertyItem rna_enum_attr_storage_type[]
static void rna_def_attribute_short2(BlenderRNA *brna)
static void rna_def_attribute_int8(BlenderRNA *brna)
const EnumPropertyItem rna_enum_color_attribute_domain_items[]
static void rna_def_attribute_bool(BlenderRNA *brna)
static void rna_def_attribute(BlenderRNA *brna)
const EnumPropertyItem rna_enum_attribute_domain_with_auto_items[]
static void rna_def_attribute_quaternion(BlenderRNA *brna)
static void rna_def_attribute_group_grease_pencil(BlenderRNA *brna)
static void rna_def_attribute_group_mesh(BlenderRNA *brna)
const EnumPropertyItem rna_enum_attribute_domain_only_mesh_no_corner_items[]
static void rna_def_attribute_int2(BlenderRNA *brna)
const EnumPropertyItem rna_enum_attribute_domain_point_edge_face_curve_items[]
const EnumPropertyItem rna_enum_attribute_domain_edge_face_items[]
const EnumPropertyItem rna_enum_attribute_curves_domain_items[]
const EnumPropertyItem rna_enum_attribute_domain_point_face_curve_items[]
static void rna_def_attribute_float_vector(BlenderRNA *brna)
static void rna_def_attribute_group_grease_pencil_drawing(BlenderRNA *brna)
const EnumPropertyItem rna_enum_attribute_domain_only_mesh_no_edge_items[]
static void rna_def_attribute_float_color(BlenderRNA *brna)
static void rna_def_attribute_float(BlenderRNA *brna)
const EnumPropertyItem rna_enum_attribute_domain_items[]
static void rna_def_attribute_int(BlenderRNA *brna)
static void rna_def_attribute_byte_color(BlenderRNA *brna)
void RNA_def_attribute(BlenderRNA *brna)
static void rna_def_attribute_float2(BlenderRNA *brna)
void rna_def_attributes_common(StructRNA *srna, const AttributeOwnerType type)
const EnumPropertyItem rna_enum_attribute_domain_without_corner_items[]
static void rna_def_attribute_group_pointcloud(BlenderRNA *brna)
const EnumPropertyItem rna_enum_attribute_type_items[]
static void rna_def_attribute_group_curves(BlenderRNA *brna)
const EnumPropertyItem rna_enum_attribute_type_with_auto_items[]
const EnumPropertyItem rna_enum_color_attribute_type_items[]
static void rna_def_attribute_string(BlenderRNA *brna)
void RNA_def_property_boolean_sdna(PropertyRNA *prop, const char *structname, const char *propname, int64_t booleanbit)
void RNA_def_struct_name_property(StructRNA *srna, PropertyRNA *prop)
PropertyRNA * RNA_def_string(StructOrFunctionRNA *cont_, const char *identifier, const char *default_value, const int maxlen, const char *ui_name, const char *ui_description)
void RNA_def_struct_refine_func(StructRNA *srna, const char *refine)
void RNA_def_struct_path_func(StructRNA *srna, const char *path)
void RNA_def_parameter_clear_flags(PropertyRNA *prop, PropertyFlag flag_property, ParameterFlag flag_parameter)
void RNA_def_property_string_funcs(PropertyRNA *prop, const char *get, const char *length, const char *set)
void RNA_def_function_return(FunctionRNA *func, PropertyRNA *ret)
void RNA_def_property_float_funcs(PropertyRNA *prop, const char *get, const char *set, const char *range)
void RNA_def_property_ui_text(PropertyRNA *prop, const char *name, const char *description)
void RNA_def_property_string_sdna(PropertyRNA *prop, const char *structname, const char *propname)
void RNA_def_property_srna(PropertyRNA *prop, const char *type)
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)
void RNA_def_struct_ui_text(StructRNA *srna, const char *name, const char *description)
void RNA_def_property_boolean_funcs(PropertyRNA *prop, const char *get, const char *set)
void RNA_def_property_multi_array(PropertyRNA *prop, int dimension, const int length[])
PropertyRNA * RNA_def_enum(StructOrFunctionRNA *cont_, const char *identifier, const EnumPropertyItem *items, const int default_value, const char *ui_name, const char *ui_description)
void RNA_def_property_enum_items(PropertyRNA *prop, const EnumPropertyItem *item)
void RNA_def_struct_sdna(StructRNA *srna, const char *structname)
FunctionRNA * RNA_def_function(StructRNA *srna, const char *identifier, const char *call)
void RNA_def_property_array(PropertyRNA *prop, int length)
void RNA_def_property_range(PropertyRNA *prop, double min, double max)
PropertyRNA * RNA_def_pointer(StructOrFunctionRNA *cont_, const char *identifier, const char *type, const char *ui_name, const char *ui_description)
void RNA_def_property_string_maxlength(PropertyRNA *prop, int maxlength)
void RNA_def_property_struct_type(PropertyRNA *prop, const char *type)
void RNA_def_function_ui_description(FunctionRNA *func, const char *description)
void RNA_def_property_update(PropertyRNA *prop, int noteflag, const char *func)
const int rna_matrix_dimsize_4x4[]
PropertyRNA * RNA_def_property(StructOrFunctionRNA *cont_, const char *identifier, int type, int subtype)
void RNA_def_property_enum_funcs(PropertyRNA *prop, const char *get, const char *set, const char *item)
void RNA_def_property_editable_func(PropertyRNA *prop, const char *editable)
StructRNA * RNA_def_struct(BlenderRNA *brna, const char *identifier, const char *from)
void RNA_enum_item_end(EnumPropertyItem **items, int *totitem)
void RNA_def_function_flag(FunctionRNA *func, int flag)
void RNA_def_property_clear_flag(PropertyRNA *prop, PropertyFlag flag)
void RNA_def_property_pointer_funcs(PropertyRNA *prop, const char *get, const char *set, const char *type_fn, const char *poll)
void RNA_enum_item_add(EnumPropertyItem **items, int *totitem, const EnumPropertyItem *item)
void RNA_def_property_int_funcs(PropertyRNA *prop, const char *get, const char *set, const char *range)
void RNA_def_property_translation_context(PropertyRNA *prop, const char *context)
void RNA_def_property_flag(PropertyRNA *prop, PropertyFlag flag)
void RNA_def_property_float_sdna(PropertyRNA *prop, const char *structname, const char *propname)
void RNA_def_property_int_sdna(PropertyRNA *prop, const char *structname, const char *propname)
PropertyRNA * RNA_def_int(StructOrFunctionRNA *cont_, const char *identifier, const int default_value, const int hardmin, const int hardmax, const char *ui_name, const char *ui_description, const int softmin, const int softmax)
void RNA_def_property_override_flag(PropertyRNA *prop, PropertyOverrideFlag flag)
void RNA_def_parameter_flags(PropertyRNA *prop, PropertyFlag flag_property, ParameterFlag flag_parameter)
void rna_AttributeGroup_iterator_next(CollectionPropertyIterator *iter)
void rna_AttributeGroup_color_iterator_next(CollectionPropertyIterator *iter)
int rna_AttributeGroup_length(PointerRNA *ptr)
int rna_AttributeGroup_color_length(PointerRNA *ptr)
bool rna_AttributeGroup_lookup_string(PointerRNA *ptr, const char *key, PointerRNA *r_ptr)
PointerRNA rna_AttributeGroup_color_iterator_get(CollectionPropertyIterator *iter)
void rna_AttributeGroup_iterator_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
void rna_AttributeGroup_color_iterator_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
PointerRNA rna_AttributeGroup_iterator_get(CollectionPropertyIterator *iter)
#define min(a, b)
Definition sort.cc:36
union CollectionPropertyIterator::@220100362304005352221007113371015217044252346141 internal
struct AttributeStorage attribute_storage
CustomDataLayer * layers
struct AttributeStorage attribute_storage
Definition DNA_ID.h:414
char name[258]
Definition DNA_ID.h:432
int us
Definition DNA_ID.h:443
char * default_color_attribute
char * active_color_attribute
T * data_as() const
Definition RNA_types.hh:124
ID * owner_id
Definition RNA_types.hh:51
void invalidate()
Definition RNA_types.hh:110
void * data
Definition RNA_types.hh:53
static ArrayData from_default_value(const CPPType &type, int64_t domain_size)
max
Definition text_draw.cc:251
uint len
#define N_(msgid)
void WM_main_add_notifier(uint type, void *reference)
PointerRNA * ptr
Definition wm_files.cc:4238