35 {
CD_PROP_BOOL,
"BOOLEAN", 0,
"Boolean",
"True or false"},
36 {
CD_PROP_FLOAT3,
"FLOAT_VECTOR", 0,
"Vector",
"3D vector with floating-point values"},
37 {
CD_PROP_COLOR,
"FLOAT_COLOR", 0,
"Color",
"RGBA color with 32-bit floating-point values"},
38 {
CD_PROP_QUATERNION,
"QUATERNION", 0,
"Quaternion",
"Floating point quaternion rotation"},
41 {
CD_PROP_INT8,
"INT8", 0,
"8-Bit Integer",
"Smaller integer with a range from -128 to 127"},
42 {
CD_PROP_INT16_2D,
"INT16_2D", 0,
"2D 16-Bit Integer Vector",
"16-bit signed integer vector"},
43 {
CD_PROP_INT32_2D,
"INT32_2D", 0,
"2D Integer Vector",
"32-bit signed integer vector"},
44 {
CD_PROP_FLOAT2,
"FLOAT2", 0,
"2D Vector",
"2D vector with floating-point values"},
45 {
CD_PROP_FLOAT4,
"FLOAT4", 0,
"4D Vector",
"4D vector with floating-point values"},
50 "RGBA color with 8-bit positive integer values"},
51 {0,
nullptr, 0,
nullptr,
nullptr},
62 "3D vector with floating-point values"},
67 "RGBA color with 32-bit floating-point values"},
72 "Floating point quaternion rotation"},
79 "Smaller integer with a range from -128 to 127"},
83 "2D 16-Bit Integer Vector",
84 "16-bit signed integer vector"},
89 "32-bit signed integer vector"},
96 "RGBA color with 8-bit positive integer values"},
97 {0,
nullptr, 0,
nullptr,
nullptr},
101 {
CD_PROP_COLOR,
"FLOAT_COLOR", 0,
"Color",
"RGBA color 32-bit floating-point values"},
106 "RGBA color with 8-bit positive integer values"},
107 {0,
nullptr, 0,
nullptr,
nullptr}};
111 {
CD_PROP_FLOAT,
"FLOAT", 0,
"Float",
"Floating-point value"},
113 {
CD_PROP_BOOL,
"BOOLEAN", 0,
"Boolean",
"True or false"},
114 {
CD_PROP_FLOAT3,
"FLOAT_VECTOR", 0,
"Vector",
"3D vector with floating-point values"},
115 {
CD_PROP_COLOR,
"FLOAT_COLOR", 0,
"Color",
"RGBA color with 32-bit floating-point values"},
116 {
CD_PROP_QUATERNION,
"QUATERNION", 0,
"Quaternion",
"Floating point quaternion rotation"},
119 {
CD_PROP_INT8,
"INT8", 0,
"8-Bit Integer",
"Smaller integer with a range from -128 to 127"},
120 {
CD_PROP_INT16_2D,
"INT16_2D", 0,
"2D 16-Bit Integer Vector",
"16-bit signed integer vector"},
121 {
CD_PROP_INT32_2D,
"INT32_2D", 0,
"2D Integer Vector",
"32-bit signed integer vector"},
122 {
CD_PROP_FLOAT2,
"FLOAT2", 0,
"2D Vector",
"2D vector with floating-point values"},
123 {
CD_PROP_FLOAT4,
"FLOAT4", 0,
"4D Vector",
"4D vector with floating-point values"},
128 "RGBA color with 8-bit positive integer values"},
129 {0,
nullptr, 0,
nullptr,
nullptr},
138 "Store a single value for the entire domain"},
139 {0,
nullptr, 0,
nullptr,
nullptr},
145 int(AttrDomain::Point),
"POINT", ICON_VERTEXSEL,
"Point",
"Vertex or point"};
147 int(AttrDomain::Edge),
"EDGE", ICON_EDGESEL,
"Edge",
"Mesh edge"};
149 int(AttrDomain::Face),
"FACE", ICON_FACESEL,
"Face",
"Mesh face"};
151 int(AttrDomain::Corner),
"CORNER", ICON_FACE_CORNER,
"Face Corner",
"Mesh face corner"};
153 int(AttrDomain::Curve),
"CURVE", ICON_CURVE_DATA,
"Spline",
""};
155 int(AttrDomain::Instance),
"INSTANCE", ICON_EMPTY_AXIS,
"Instance",
""};
157 int(AttrDomain::Layer),
"LAYER", ICON_OUTLINER_DATA_GP_LAYER,
"Layer",
"Grease Pencil layer"};
251# include <fmt/format.h>
286 return &attr_iter == &attr;
292 ID *owner_id = ptr->owner_id;
295 if (
GS(owner_id->name) ==
ID_GP) {
300 if (find_attr_with_pointer(grease_pencil->attribute_storage.wrap(), *attr)) {
309 if (find_attr_with_pointer(
curves.attribute_storage.wrap(), *attr)) {
322 if (ptr->type == RNA_GreasePencilDrawing) {
328static std::optional<std::string> rna_Attribute_path(
const PointerRNA *ptr)
337 return RNA_FloatAttribute;
339 return RNA_IntAttribute;
341 return RNA_FloatVectorAttribute;
343 return RNA_Float4Attribute;
345 return RNA_FloatColorAttribute;
347 return RNA_ByteColorAttribute;
349 return RNA_StringAttribute;
351 return RNA_BoolAttribute;
353 return RNA_Float2Attribute;
355 return RNA_ByteIntAttribute;
357 return RNA_Short2Attribute;
359 return RNA_Int2Attribute;
361 return RNA_QuaternionAttribute;
363 return RNA_Float4x4Attribute;
373 return RNA_FloatAttributeValue;
375 return RNA_IntAttributeValue;
377 return RNA_FloatVectorAttributeValue;
379 return RNA_FloatColorAttributeValue;
381 return RNA_ByteColorAttributeValue;
383 return RNA_StringAttributeValue;
385 return RNA_BoolAttributeValue;
387 return RNA_Float2AttributeValue;
389 return RNA_ByteIntAttributeValue;
391 return RNA_Short2AttributeValue;
393 return RNA_Int2AttributeValue;
395 return RNA_QuaternionAttributeValue;
397 return RNA_Float4x4AttributeValue;
399 return RNA_Float4AttributeValue;
407 if (
GS(ptr->owner_id->name) ==
ID_ME) {
408 const Mesh *
mesh = blender::id_cast<const Mesh *>(ptr->owner_id);
409 if (
mesh->runtime->edit_mesh) {
416 return srna_by_custom_data_layer_type(data_type);
424 ID *owner_id = ptr.owner_id;
427 const Mesh *
mesh = owner.get_mesh();
428 if (
mesh->runtime->edit_mesh) {
451 const Mesh *
mesh = owner.get_mesh();
452 if (
mesh->runtime->edit_mesh) {
463static int rna_Attribute_name_editable(
const PointerRNA *ptr,
const char **r_info)
467 const Mesh *
mesh = owner.get_mesh();
468 if (
mesh->runtime->edit_mesh) {
471 *r_info =
N_(
"Cannot modify name of required geometry attribute");
480 *r_info =
N_(
"Cannot modify name of required geometry attribute");
486static int rna_Attribute_type_get(
PointerRNA *ptr)
490 const Mesh *
mesh = owner.get_mesh();
491 if (
mesh->runtime->edit_mesh) {
500static int rna_Attribute_storage_type_get(
PointerRNA *ptr)
504 const Mesh *
mesh = owner.get_mesh();
505 if (
mesh->runtime->edit_mesh) {
510 return int(attr->storage_type());
514 bool include_instances,
525 N_(
"Attribute per point/vertex")};
531 !
ELEM(domain_item->value,
int(AttrDomain::Point)))
536 !
ELEM(domain_item->value,
int(AttrDomain::Point),
int(AttrDomain::Curve)))
541 int(AttrDomain::Point),
542 int(AttrDomain::Edge),
543 int(AttrDomain::Face),
544 int(AttrDomain::Corner)))
549 !
ELEM(domain_item->value,
int(AttrDomain::Layer)))
553 if (!include_instances && domain_item->value ==
int(AttrDomain::Instance)) {
579static int rna_Attribute_domain_get(
PointerRNA *ptr)
583 const Mesh *
mesh = owner.get_mesh();
590 return int(attr->domain());
593static bool rna_Attribute_is_internal_get(
PointerRNA *ptr)
598static bool rna_Attribute_is_required_get(
PointerRNA *ptr)
608 const Mesh *
mesh = owner.get_mesh();
609 if (
mesh->runtime->edit_mesh) {
618 const int domain_size = accessor.domain_size(attr->domain());
621 auto begin_array = [&]() {
622 const auto &
data = std::get<bke::Attribute::ArrayData>(attr->data_for_write());
625 switch (attr->storage_type()) {
632 const auto &
data = std::get<bke::Attribute::SingleData>(attr->data());
648 const Mesh *
mesh = owner.get_mesh();
649 if (
mesh->runtime->edit_mesh) {
669 if (index < 0 || index >=
internal->length) {
678 StructRNA *type = srna_value_by_custom_data_layer_type(data_type);
688static void tag_any_attribute_changed(
ID *
id)
690 switch (
GS(
id->name)) {
693 curves->geometry.wrap().tag_topology_changed();
698 mesh->tag_topology_changed();
702 PointCloud *pointcloud = id_cast<PointCloud *>(
id);
703 pointcloud->tag_positions_changed();
704 pointcloud->tag_radii_changed();
708 GreasePencil *grease_pencil = id_cast<GreasePencil *>(
id);
713 drawing.tag_topology_changed();
726 ID *
id = ptr->owner_id;
730 tag_any_attribute_changed(
id);
738static void rna_ByteColorAttributeValue_color_get(
PointerRNA *ptr,
float *values)
745static void rna_ByteColorAttributeValue_color_set(
PointerRNA *ptr,
const float *values)
750 rec709[3] = values[3];
754static void rna_ByteColorAttributeValue_color_srgb_get(
PointerRNA *ptr,
float *values)
757 values[0] = col->
r / 255.0f;
758 values[1] = col->g / 255.0f;
759 values[2] = col->b / 255.0f;
760 values[3] = col->a / 255.0f;
763static void rna_ByteColorAttributeValue_color_srgb_set(
PointerRNA *ptr,
const float *values)
772static void rna_FloatColorAttributeValue_color_srgb_get(
PointerRNA *ptr,
float *values)
776 values[3] = col->color[3];
779static void rna_FloatColorAttributeValue_color_srgb_set(
PointerRNA *ptr,
const float *values)
783 col->color[3] = values[3];
788static void rna_StringAttributeValue_s_get(
PointerRNA *ptr,
char *value)
791 const int len = std::min<int>(mstring->s_len,
sizeof(mstring->s) - 1);
792 memcpy(value, mstring->s,
len);
797static int rna_StringAttributeValue_s_length(
PointerRNA *ptr)
800 const int len = std::min<int>(mstring->s_len,
sizeof(mstring->s) - 1);
804static void rna_StringAttributeValue_s_set(
PointerRNA *ptr,
const char *value)
811 memcpy(mstring->s, value, mstring->s_len);
817 ID *
id,
ReportList *reports,
const char *name,
const int type,
const int domain)
832 if (!
mesh->active_color_attribute) {
835 if (!
mesh->default_color_attribute) {
840 if (
mesh->active_uv_map_name().is_empty()) {
843 if (
mesh->default_uv_map_name().is_empty()) {
858 if (!accessor.domain_supported(
AttrDomain(domain))) {
875 if (!
mesh->active_color_attribute) {
878 if (!
mesh->default_color_attribute) {
883 if (
mesh->active_uv_map_name().is_empty()) {
884 mesh->uv_maps_active_set(attr.name());
886 if (
mesh->default_uv_map_name().is_empty()) {
887 mesh->uv_maps_default_set(attr.name());
902 const Mesh *
mesh = owner.get_mesh();
903 if (
mesh->runtime->edit_mesh) {
906 attribute_ptr->invalidate();
921 accessor.
remove(attr->name());
922 attribute_ptr->invalidate();
932 const bool include_anonymous)
934 memset(&iter->internal.array, 0,
sizeof(iter->internal.array));
948 layers.append(&
layer);
982 attributes.append(&attr);
999 if (
mesh->runtime->edit_mesh) {
1002 if (type ==
nullptr) {
1011 StructRNA *type = srna_by_custom_data_layer_type(data_type);
1039 const Mesh *
mesh = owner.get_mesh();
1080static int rna_AttributeGroupID_active_index_get(
PointerRNA *ptr)
1096static void rna_AttributeGroupID_active_set(
PointerRNA *ptr,
1102 const Mesh *
mesh = owner.get_mesh();
1103 if (
mesh->runtime->edit_mesh) {
1124static void rna_AttributeGroupID_active_index_set(
PointerRNA *ptr,
int value)
1130static void rna_AttributeGroupID_active_index_range(
1142 rna_Attribute_update_data(bmain, scene, ptr);
1145static void rna_AttributeGroup_update_active_color(
Main * ,
1149 ID *
id = ptr->owner_id;
1158static int rna_AttributeGroupID_domain_size(
ID *
id,
const int domain)
1162 const Mesh *
mesh = owner.get_mesh();
1163 if (
mesh->runtime->edit_mesh) {
1181static void rna_AttributeGroupMesh_active_color_set(
PointerRNA *ptr,
1185 if (!attribute_ptr) {
1192static int rna_AttributeGroupMesh_active_color_index_get(
PointerRNA *ptr)
1201static void rna_AttributeGroupMesh_active_color_index_set(
PointerRNA *ptr,
int value)
1207 fprintf(stderr,
"%s: error setting active color index to %d\n", __func__, value);
1213static void rna_AttributeGroupMesh_active_color_index_range(
1224static int rna_AttributeGroupMesh_render_color_index_get(
PointerRNA *ptr)
1233static void rna_AttributeGroupMesh_render_color_index_set(
PointerRNA *ptr,
int value)
1239 fprintf(stderr,
"%s: error setting render color index to %d\n", __func__, value);
1245static void rna_AttributeGroupMesh_render_color_index_range(
1256static void rna_AttributeGroupMesh_default_color_name_get(
PointerRNA *ptr,
char *value)
1258 const ID *
id = ptr->owner_id;
1260 name.copy_unsafe(value);
1263static int rna_AttributeGroupMesh_default_color_name_length(
PointerRNA *ptr)
1265 const ID *
id = ptr->owner_id;
1270static void rna_AttributeGroupMesh_default_color_name_set(
PointerRNA *ptr,
const char *value)
1272 ID *
id = ptr->owner_id;
1275 MEM_SAFE_DELETE(
mesh->default_color_attribute);
1282static void rna_AttributeGroupMesh_active_color_name_get(
PointerRNA *ptr,
char *value)
1284 const ID *
id = ptr->owner_id;
1286 name.copy_unsafe(value);
1289static int rna_AttributeGroupMesh_active_color_name_length(
PointerRNA *ptr)
1291 const ID *
id = ptr->owner_id;
1296static void rna_AttributeGroupMesh_active_color_name_set(
PointerRNA *ptr,
const char *value)
1298 ID *
id = ptr->owner_id;
1301 MEM_SAFE_DELETE(
mesh->active_color_attribute);
1308static PointerRNA rna_AttributeGroupGreasePencilDrawing_new(
ID *grease_pencil_id,
1317 if (!accessor.domain_supported(
AttrDomain(domain))) {
1326 attributes.unique_name_calc(name),
1337static void rna_AttributeGroupGreasePencilDrawing_remove(
ID *grease_pencil_id,
1350 accessor.
remove(attr->name());
1351 attribute_ptr->invalidate();
1370static void rna_AttributeGroupGreasePencilDrawing_active_set(
PointerRNA *ptr,
1376 if (!attribute_ptr) {
1383static bool rna_AttributeGroupGreasePencilDrawing_active_poll(
PointerRNA *ptr,
1391static int rna_AttributeGroupGreasePencilDrawing_active_index_get(
PointerRNA *ptr)
1398static void rna_AttributeGroupGreasePencilDrawing_active_index_set(
PointerRNA *ptr,
int value)
1405static void rna_AttributeGroupGreasePencilDrawing_active_index_range(
1411 *
max = owner.get_storage()->count();
1437 srna,
"Float Attribute",
"Geometry attribute that stores floating-point values");
1443 "rna_Attribute_data_begin",
1444 "rna_iterator_array_next",
1445 "rna_iterator_array_end",
1446 "rna_iterator_array_get",
1447 "rna_Attribute_data_length",
1448 "rna_Attribute_data_lookup_int",
1456 srna,
"Float Attribute Value",
"Floating-point value in geometry attribute");
1468 srna =
RNA_def_struct(brna,
"FloatVectorAttribute",
"Attribute");
1470 srna,
"Float Vector Attribute",
"Geometry attribute that stores floating-point 3D vectors");
1476 "rna_Attribute_data_begin",
1477 "rna_iterator_array_next",
1478 "rna_iterator_array_end",
1479 "rna_iterator_array_get",
1480 "rna_Attribute_data_length",
1481 "rna_Attribute_data_lookup_int",
1487 srna =
RNA_def_struct(brna,
"FloatVectorAttributeValue",
nullptr);
1490 srna,
"Float Vector Attribute Value",
"Vector value in geometry attribute");
1507 "Float Color Attribute",
1508 "Geometry attribute that stores RGBA colors as floating-point values "
1509 "using 32-bits per channel");
1515 "rna_Attribute_data_begin",
1516 "rna_iterator_array_next",
1517 "rna_iterator_array_end",
1518 "rna_iterator_array_get",
1519 "rna_Attribute_data_length",
1520 "rna_Attribute_data_lookup_int",
1526 srna =
RNA_def_struct(brna,
"FloatColorAttributeValue",
nullptr);
1541 "rna_FloatColorAttributeValue_color_srgb_get",
1542 "rna_FloatColorAttributeValue_color_srgb_set",
1555 "Byte Color Attribute",
1556 "Geometry attribute that stores RGBA colors as positive integer values "
1557 "using 8-bits per channel");
1563 "rna_Attribute_data_begin",
1564 "rna_iterator_array_next",
1565 "rna_iterator_array_end",
1566 "rna_iterator_array_get",
1567 "rna_Attribute_data_length",
1568 "rna_Attribute_data_lookup_int",
1582 "rna_ByteColorAttributeValue_color_get",
1583 "rna_ByteColorAttributeValue_color_set",
1592 "rna_ByteColorAttributeValue_color_srgb_get",
1593 "rna_ByteColorAttributeValue_color_srgb_set",
1606 srna,
"Integer Attribute",
"Geometry attribute that stores integer values");
1612 "rna_Attribute_data_begin",
1613 "rna_iterator_array_next",
1614 "rna_iterator_array_end",
1615 "rna_iterator_array_get",
1616 "rna_Attribute_data_length",
1617 "rna_Attribute_data_lookup_int",
1642 "rna_Attribute_data_begin",
1643 "rna_iterator_array_next",
1644 "rna_iterator_array_end",
1645 "rna_iterator_array_get",
1646 "rna_Attribute_data_length",
1647 "rna_Attribute_data_lookup_int",
1658 "rna_StringAttributeValue_s_get",
1659 "rna_StringAttributeValue_s_length",
1660 "rna_StringAttributeValue_s_set");
1676 "rna_Attribute_data_begin",
1677 "rna_iterator_array_next",
1678 "rna_iterator_array_end",
1679 "rna_iterator_array_get",
1680 "rna_Attribute_data_length",
1681 "rna_Attribute_data_lookup_int",
1701 srna,
"8-bit Integer Attribute",
"Geometry attribute that stores 8-bit integers");
1707 "rna_Attribute_data_begin",
1708 "rna_iterator_array_next",
1709 "rna_iterator_array_end",
1710 "rna_iterator_array_get",
1711 "rna_Attribute_data_length",
1712 "rna_Attribute_data_lookup_int",
1720 srna,
"8-bit Integer Attribute Value",
"8-bit value in geometry attribute");
1733 "2D 16-Bit Integer Vector Attribute",
1734 "Geometry attribute that stores 2D integer vectors");
1740 "rna_Attribute_data_begin",
1741 "rna_iterator_array_next",
1742 "rna_iterator_array_end",
1743 "rna_iterator_array_get",
1744 "rna_Attribute_data_length",
1745 "rna_Attribute_data_lookup_int",
1753 srna,
"2D 16-Bit Integer Vector Attribute Value",
"2D value in geometry attribute");
1769 srna,
"2D Integer Vector Attribute",
"Geometry attribute that stores 2D integer vectors");
1775 "rna_Attribute_data_begin",
1776 "rna_iterator_array_next",
1777 "rna_iterator_array_end",
1778 "rna_iterator_array_get",
1779 "rna_Attribute_data_length",
1780 "rna_Attribute_data_lookup_int",
1788 srna,
"2D Integer Vector Attribute Value",
"2D value in geometry attribute");
1809 "rna_Attribute_data_begin",
1810 "rna_iterator_array_next",
1811 "rna_iterator_array_end",
1812 "rna_iterator_array_get",
1813 "rna_Attribute_data_length",
1814 "rna_Attribute_data_lookup_int",
1819 srna =
RNA_def_struct(brna,
"QuaternionAttributeValue",
nullptr);
1822 srna,
"Quaternion Attribute Value",
"Rotation value in geometry attribute");
1838 srna,
"4x4 Matrix Attribute",
"Geometry attribute that stores a 4 by 4 float matrix");
1844 "rna_Attribute_data_begin",
1845 "rna_iterator_array_next",
1846 "rna_iterator_array_end",
1847 "rna_iterator_array_get",
1848 "rna_Attribute_data_length",
1849 "rna_Attribute_data_lookup_int",
1873 srna,
"Float2 Attribute",
"Geometry attribute that stores floating-point 2D vectors");
1879 "rna_Attribute_data_begin",
1880 "rna_iterator_array_next",
1881 "rna_iterator_array_end",
1882 "rna_iterator_array_get",
1883 "rna_Attribute_data_length",
1884 "rna_Attribute_data_lookup_int",
1909 srna,
"Float4 Attribute",
"Geometry attribute that stores floating-point 4D vectors");
1915 "rna_Attribute_data_begin",
1916 "rna_iterator_array_next",
1917 "rna_iterator_array_end",
1918 "rna_iterator_array_get",
1919 "rna_Attribute_data_length",
1920 "rna_Attribute_data_lookup_int",
1949 prop,
"rna_Attribute_name_get",
"rna_Attribute_name_length",
"rna_Attribute_name_set");
1970 prop,
"rna_Attribute_domain_get",
nullptr,
"rna_Attribute_domain_itemf");
1977 prop,
"Is Internal",
"The attribute is meant for internal use by Blender");
2012 parm =
RNA_def_string(func,
"name",
"Attribute", 0,
"Name",
"Name of geometry attribute");
2022 int(AttrDomain::Point),
2024 "Type of element that attribute is stored on");
2027 parm =
RNA_def_pointer(func,
"attribute",
"Attribute",
"",
"New geometry attribute");
2034 parm =
RNA_def_pointer(func,
"attribute",
"Attribute",
"",
"Geometry Attribute");
2043 "rna_AttributeGroupID_active_get",
2044 "rna_AttributeGroupID_active_set",
2052 prop,
"Active Attribute Index",
"Active attribute index or -1 when none are active");
2056 "rna_AttributeGroupID_active_index_get",
2057 "rna_AttributeGroupID_active_index_set",
2058 "rna_AttributeGroupID_active_index_range");
2062 func =
RNA_def_function(srna,
"domain_size",
"rna_AttributeGroupID_domain_size");
2067 int(AttrDomain::Point),
2069 "Type of element that attribute is stored on");
2092 "rna_AttributeGroupMesh_active_color_get",
2093 "rna_AttributeGroupMesh_active_color_set",
2103 "rna_AttributeGroupMesh_active_color_index_get",
2104 "rna_AttributeGroupMesh_active_color_index_set",
2105 "rna_AttributeGroupMesh_active_color_index_range");
2110 "Active Render Color Index",
2111 "The index of the color attribute used as a fallback for rendering");
2114 "rna_AttributeGroupMesh_render_color_index_get",
2115 "rna_AttributeGroupMesh_render_color_index_set",
2116 "rna_AttributeGroupMesh_render_color_index_range");
2122 "rna_AttributeGroupMesh_default_color_name_get",
2123 "rna_AttributeGroupMesh_default_color_name_length",
2124 "rna_AttributeGroupMesh_default_color_name_set");
2127 "Default Color Attribute",
2128 "The name of the default color attribute used as a fallback for rendering");
2133 "rna_AttributeGroupMesh_active_color_name_get",
2134 "rna_AttributeGroupMesh_active_color_name_length",
2135 "rna_AttributeGroupMesh_active_color_name_set");
2137 "Active Color Attribute",
2138 "The name of the active color attribute for display and editing");
2145 srna =
RNA_def_struct(brna,
"AttributeGroupPointCloud",
nullptr);
2167 srna =
RNA_def_struct(brna,
"AttributeGroupGreasePencil",
nullptr);
2181 srna =
RNA_def_struct(brna,
"AttributeGroupGreasePencilDrawing",
nullptr);
2186 func =
RNA_def_function(srna,
"new",
"rna_AttributeGroupGreasePencilDrawing_new");
2189 parm =
RNA_def_string(func,
"name",
"Attribute", 0,
"Name",
"Name of geometry attribute");
2199 int(AttrDomain::Point),
2201 "Type of element that attribute is stored on");
2204 parm =
RNA_def_pointer(func,
"attribute",
"Attribute",
"",
"New geometry attribute");
2208 func =
RNA_def_function(srna,
"remove",
"rna_AttributeGroupGreasePencilDrawing_remove");
2211 parm =
RNA_def_pointer(func,
"attribute",
"Attribute",
"",
"Geometry Attribute");
2220 "rna_AttributeGroupGreasePencilDrawing_active_get",
2221 "rna_AttributeGroupGreasePencilDrawing_active_set",
2223 "rna_AttributeGroupGreasePencilDrawing_active_poll");
2229 prop,
"Active Attribute Index",
"Active attribute index or -1 when none are active");
2233 "rna_AttributeGroupGreasePencilDrawing_active_index_get",
2234 "rna_AttributeGroupGreasePencilDrawing_active_index_set",
2235 "rna_AttributeGroupGreasePencilDrawing_active_index_range");
2240 srna,
"domain_size",
"rna_AttributeGroupGreasePencilDrawing_domain_size");
2245 int(AttrDomain::Point),
2247 "Type of element that attribute is stored on");
2260 "rna_AttributeGroup_iterator_begin",
2261 "rna_iterator_array_next",
2262 "rna_iterator_array_end",
2263 "rna_AttributeGroup_iterator_get",
2264 "rna_AttributeGroup_length",
2266 "rna_AttributeGroup_lookup_string",
2290 "rna_AttributeGroup_color_iterator_begin",
2291 "rna_iterator_array_next",
2292 "rna_iterator_array_end",
2293 "rna_AttributeGroup_iterator_get",
2294 "rna_AttributeGroup_color_length",
Generic geometry attributes built on CustomData.
#define ATTR_DOMAIN_MASK_COLOR
#define ATTR_DOMAIN_AS_MASK(domain)
Low-level operations for curves.
CustomData interface, see also DNA_customdata_types.h.
Low-level operations for grease pencil.
#define BLT_I18NCONTEXT_AMOUNT
#define CD_MASK_COLOR_ALL
#define MAX_CUSTOMDATA_LAYER_NAME_NO_PREFIX
static AttributeOwner from_id(ID *id)
constexpr MutableSpan()=default
int domain_size(const AttrDomain domain) const
StringRefNull name() const
bool remove(const StringRef name)
constexpr int64_t size() const
void copy_unsafe(char *dst) const
#define storage(slot, qualifiers)
ccl_device_inline dual1 len(const ccl_private dual< T > &a)
std::optional< eCustomDataType > attr_type_to_custom_data_type(AttrType attr_type)
bool attribute_name_is_anonymous(const StringRef name)
const CPPType * custom_data_type_to_cpp_type(eCustomDataType type)
bool allow_procedural_attribute_access(StringRef attribute_name)
std::optional< AttrType > custom_data_type_to_attr_type(eCustomDataType data_type)
const CPPType & attribute_type_to_cpp_type(AttrType type)
BLI_INLINE Texture * wrap(MTLTexture *texture)
void WM_main_add_notifier(uint type, void *reference)
std::optional< StringRefNull > BKE_attributes_active_name_get(AttributeOwner &owner)
static void rna_def_attribute_float4x4(BlenderRNA *brna)
void RNA_def_property_srna(PropertyRNA *prop, const char *type)
int rna_AttributeGroup_color_length(PointerRNA *ptr)
void RNA_def_struct_ui_text(StructRNA *srna, const char *name, const char *description)
const EnumPropertyItem rna_enum_attribute_curves_domain_items[]
void rna_AttributeGroup_color_iterator_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
static EnumPropertyItem domain_item_edge
const EnumPropertyItem rna_enum_attribute_domain_edge_face_items[]
int * BKE_attributes_active_index_p(AttributeOwner &owner)
void RNA_def_property_editable_func(PropertyRNA *prop, const char *editable)
bool BKE_attribute_remove(AttributeOwner &owner, StringRef name, struct ReportList *reports)
void RNA_enum_item_add(EnumPropertyItem **items, int *totitem, const EnumPropertyItem *item)
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)
PropertyRNA * RNA_def_string(StructOrFunctionRNA *cont_, const char *identifier, const char *default_value, const int maxlen, const char *ui_name, const char *ui_description)
const EnumPropertyItem rna_enum_attribute_domain_only_mesh_no_edge_items[]
static void rna_def_attribute_float2(BlenderRNA *brna)
void BKE_id_attributes_default_color_set(struct ID *id, std::optional< StringRef > name)
void BKE_id_attributes_active_color_clear(struct ID *id)
BMesh * BKE_editmesh_bmesh_get_for_write(Mesh *mesh)
std::optional< StringRef > BKE_id_attributes_default_color_name(const struct ID *id)
const EnumPropertyItem rna_enum_attribute_type_with_auto_items[]
void rna_iterator_array_end(CollectionPropertyIterator *iter)
void RNA_def_property_float_funcs(PropertyRNA *prop, const char *get, const char *set, const char *range)
void rna_Attribute_name_set(PointerRNA *ptr, const char *value)
static EnumPropertyItem domain_item_auto
void RNA_def_property_pointer_funcs(PropertyRNA *prop, const char *get, const char *set, const char *type_fn, const char *poll)
void RNA_def_struct_refine_func(StructRNA *srna, const char *refine)
static EnumPropertyItem domain_item_layer
static EnumPropertyItem domain_item_corner
MINLINE void srgb_to_linearrgb_uchar4(float linear[4], const unsigned char srgb[4])
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[])
std::optional< StringRef > BKE_id_attributes_active_color_name(const struct ID *id)
void RNA_def_function_ui_description(FunctionRNA *func, const char *description)
static void rna_def_attribute_string(BlenderRNA *brna)
StringRefNull rna_Attribute_name_get(const PointerRNA &ptr)
PropertyRNA * RNA_def_enum(StructOrFunctionRNA *cont_, const char *identifier, const EnumPropertyItem *items, const int default_value, const char *ui_name, const char *ui_description)
PropertyRNA * RNA_def_pointer(StructOrFunctionRNA *cont_, const char *identifier, const char *type, const char *ui_name, const char *ui_description)
static void rna_def_attribute_int2(BlenderRNA *brna)
void rna_pointer_create_with_ancestors(const PointerRNA &parent, StructRNA *type, void *data, PointerRNA &r_ptr)
int BKE_attributes_length(const AttributeOwner &owner, AttrDomainMask domain_mask, eCustomDataMask mask, bool include_anonymous=true)
void RNA_def_property_struct_type(PropertyRNA *prop, const char *type)
void BKE_attributes_active_set(AttributeOwner &owner, StringRef name)
const EnumPropertyItem rna_enum_attribute_domain_only_mesh_items[]
std::string BKE_attribute_calc_unique_name(const AttributeOwner &owner, StringRef name)
const EnumPropertyItem rna_enum_attribute_domain_only_mesh_no_corner_items[]
static void rna_def_attribute_group_mesh(BlenderRNA *brna)
void RNA_def_property_string_maxlength(PropertyRNA *prop, int maxlength)
static EnumPropertyItem domain_item_face
bool BKE_attribute_rename(AttributeOwner &owner, StringRef old_name, StringRef new_name, struct ReportList *reports)
void RNA_def_property_float_sdna(PropertyRNA *prop, const char *structname, const char *propname)
void rna_Attribute_data_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
static void rna_def_attribute_float4(BlenderRNA *brna)
static EnumPropertyItem domain_item_point
PropertyRNA * RNA_def_property(StructOrFunctionRNA *cont_, const char *identifier_c_str, int type, int subtype)
static void rna_def_attribute_group_id_common(StructRNA *srna)
void RNA_def_struct_sdna(StructRNA *srna, const char *structname)
void RNA_def_parameter_clear_flags(PropertyRNA *prop, PropertyFlag flag_property, ParameterFlag flag_parameter)
void RNA_def_property_enum_items(PropertyRNA *prop, const EnumPropertyItem *item)
const EnumPropertyItem rna_enum_attribute_domain_without_corner_items[]
void RNA_def_parameter_flags(PropertyRNA *prop, PropertyFlag flag_property, ParameterFlag flag_parameter)
void RNA_def_attribute(BlenderRNA *brna)
BLI_INLINE void IMB_colormanagement_rec709_to_scene_linear(float scene_linear[3], const float rec709[3])
static void rna_def_attribute_int8(BlenderRNA *brna)
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_property_int_funcs(PropertyRNA *prop, const char *get, const char *set, const char *range)
static void rna_def_attribute_short2(BlenderRNA *brna)
void DEG_id_tag_update(ID *id, unsigned int flags)
static void rna_def_attribute_group_curves(BlenderRNA *brna)
void BKE_report(ReportList *reports, eReportType type, const char *message)
BMesh const char void * data
void RNA_def_property_override_flag(PropertyRNA *prop, PropertyOverrideFlag flag)
const EnumPropertyItem rna_enum_attribute_domain_point_edge_face_curve_items[]
const EnumPropertyItem rna_enum_attribute_domain_with_auto_items[]
static void rna_def_attribute_group_grease_pencil(BlenderRNA *brna)
int rna_Attribute_data_length(PointerRNA *ptr)
void RNA_def_property_boolean_sdna(PropertyRNA *prop, const char *structname, const char *propname, int64_t booleanbit)
void RNA_def_property_range(PropertyRNA *prop, double min, double max)
static void rna_def_attribute(BlenderRNA *brna)
char char size_t BLI_str_escape(char *__restrict dst, StringRef src, size_t dst_maxncpy) ATTR_NONNULL(1)
BLI_INLINE void IMB_colormanagement_srgb_to_scene_linear_v3(float scene_linear[3], const float srgb[3])
const EnumPropertyItem rna_enum_attr_storage_type_items[]
void RNA_def_struct_path_func(StructRNA *srna, const char *path)
const EnumPropertyItem rna_enum_attribute_type_items[]
void RNA_def_function_return(FunctionRNA *func, PropertyRNA *ret)
int char char int int int int size_t BLI_strnlen(const char *str, size_t maxlen) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
BLI_INLINE void IMB_colormanagement_scene_linear_to_rec709(float rec709[3], const float scene_linear[3])
static void rna_def_attribute_quaternion(BlenderRNA *brna)
PointerRNA RNA_pointer_create_discrete(ID *id, StructRNA *type, void *data)
BMDataLayerLookup BM_data_layer_lookup(const BMesh &bm, const StringRef name)
eCustomDataMask CD_TYPE_AS_MASK(eCustomDataType type)
void RNA_enum_item_end(EnumPropertyItem **items, int *totitem)
void RNA_def_property_enum_funcs(PropertyRNA *prop, const char *get, const char *set, const char *item)
int rna_AttributeGroup_length(PointerRNA *ptr)
FunctionRNA * RNA_def_function(StructRNA *srna, const char *identifier_c_str, const char *call)
std::optional< StringRef > BKE_attribute_from_index(AttributeOwner &owner, int lookup_index, AttrDomainMask domain_mask, eCustomDataMask layer_mask, bool include_anonymous=true)
bool BKE_attribute_required(const AttributeOwner &owner, StringRef name)
void * rna_iterator_array_get(CollectionPropertyIterator *iter)
static void rna_def_attribute_group_pointcloud(BlenderRNA *brna)
PointerRNA rna_AttributeGroup_iterator_get(CollectionPropertyIterator *iter)
void RNA_def_property_translation_context(PropertyRNA *prop, const char *context)
void RNA_def_property_clear_flag(PropertyRNA *prop, PropertyFlag flag)
bke::AttrDomain BKE_attribute_domain(const Mesh &mesh, const BMesh &bm, const struct CustomDataLayer *layer)
int BKE_attribute_domain_size(const AttributeOwner &owner, int domain)
void rna_AttributeGroup_iterator_begin(CollectionPropertyIterator *iter, PointerRNA *ptr, AttrDomainMask domain_mask, eCustomDataMask cd_type_mask, bool include_anonymous)
static void rna_def_attribute_bool(BlenderRNA *brna)
void RNA_def_function_flag(FunctionRNA *func, FunctionFlag flag)
void RNA_def_property_flag(PropertyRNA *prop, PropertyFlag flag)
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)
static void rna_def_attribute_group_grease_pencil_drawing(BlenderRNA *brna)
@ ATTR_DOMAIN_MASK_CORNER
char * BLI_strdup(const char *str) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1) ATTR_MALLOC
int BKE_attribute_to_index(const AttributeOwner &owner, const StringRef name, AttrDomainMask domain_mask, eCustomDataMask layer_mask, bool include_anonymous=true)
StructRNA * RNA_def_struct(BlenderRNA *brna, const char *identifier, const char *from)
void BKE_id_attributes_active_color_set(struct ID *id, std::optional< StringRef > name)
ID_Type GS(const char *name)
void RNA_def_property_int_sdna(PropertyRNA *prop, const char *structname, const char *propname)
const EnumPropertyItem rna_enum_color_attribute_domain_items[]
static EnumPropertyItem domain_item_curve
const BMesh * BKE_editmesh_bmesh_get(const Object *ob)
MINLINE unsigned char round_fl_to_uchar_clamp(float a)
void RNA_def_property_update(PropertyRNA *prop, int noteflag, const char *func)
PointerRNA RNA_pointer_create_with_parent(const PointerRNA &parent, StructRNA *type, void *data)
const EnumPropertyItem rna_enum_attrtype_items[]
int rna_Attribute_name_length(PointerRNA *ptr)
bool rna_Attribute_data_lookup_int(PointerRNA *ptr, int index, PointerRNA *r_ptr)
void RNA_def_property_string_funcs(PropertyRNA *prop, const char *get, const char *length, const char *set)
static void rna_def_attribute_float_color(BlenderRNA *brna)
BLI_INLINE void IMB_colormanagement_scene_linear_to_srgb_v3(float srgb[3], const float scene_linear[3])
const EnumPropertyItem * rna_enum_attribute_domain_itemf(const AttributeOwner &owner, bool include_instances, bool *r_free)
static EnumPropertyItem domain_item_instance
void BKE_attributes_active_clear(AttributeOwner &owner)
const EnumPropertyItem rna_enum_attribute_domain_point_face_curve_items[]
MINLINE void linearrgb_to_srgb_uchar4(unsigned char srgb[4], const float linear[4])
void RNA_def_struct_name_property(StructRNA *srna, PropertyRNA *prop, const bool allow_replace)
static void rna_def_attribute_float_vector(BlenderRNA *brna)
static void rna_def_attribute_byte_color(BlenderRNA *brna)
void RNA_def_property_array(PropertyRNA *prop, int length)
const int rna_matrix_dimsize_4x4[]
PointerRNA rna_AttributeGroup_lookup_string(const PointerRNA &ptr, const StringRef key, AttrDomainMask domain_mask, eCustomDataMask cd_type_mask)
void rna_iterator_array_begin(CollectionPropertyIterator *iter, PointerRNA *ptr, void *data, size_t itemsize, int64_t length, bool free_ptr, IteratorSkipFunc skip)
const EnumPropertyItem rna_enum_attribute_domain_items[]
const EnumPropertyItem rna_enum_color_attribute_type_items[]
static void rna_def_attribute_int(BlenderRNA *brna)
struct CustomDataLayer * BKE_attribute_new(Mesh &mesh, BMesh &bm, StringRef name, eCustomDataType type, bke::AttrDomain domain, struct ReportList *reports)
void rna_def_attributes_common(StructRNA *srna, const AttributeOwnerType type)
static void rna_def_attribute_float(BlenderRNA *brna)
static ArrayData from_default_value(const CPPType &type, int64_t domain_size)
static ArrayData from_value(const GPointer &value, int64_t domain_size)