From 6ce4d39e6bd585257845e29a3de4eb278b941fd3 Mon Sep 17 00:00:00 2001 From: Jacques Lucke Date: Mon, 28 Jun 2021 16:52:49 +0200 Subject: Geometry Nodes: initial attribute list for meshes This adds a new Attributes panel in the mesh properties editor. It shows a list of all the generic attributes on the mesh. In the future, we want to show built-in and other attributes in the list as well. Related technical design tasks: T88460, T89054. There is also a new simple name collision check that warns the user when there are multiple attributes with the same name. This can be problematic when the attribute is supposed to be used in geometry nodes or during rendering. Differential Revision: https://developer.blender.org/D11276 --- source/blender/makesrna/intern/rna_attribute.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'source/blender/makesrna/intern/rna_attribute.c') diff --git a/source/blender/makesrna/intern/rna_attribute.c b/source/blender/makesrna/intern/rna_attribute.c index a256002ffc1..b4ea70c33ab 100644 --- a/source/blender/makesrna/intern/rna_attribute.c +++ b/source/blender/makesrna/intern/rna_attribute.c @@ -162,6 +162,9 @@ const EnumPropertyItem *rna_enum_attribute_domain_itemf(ID *id, bool *r_free) const ID_Type id_type = GS(id->name); int totitem = 0, a; + static EnumPropertyItem mesh_vertex_domain_item = { + ATTR_DOMAIN_POINT, "POINT", 0, "Vertex", "Attribute per point/vertex"}; + for (a = 0; rna_enum_attribute_domain_items[a].identifier; a++) { domain_item = &rna_enum_attribute_domain_items[a]; @@ -175,7 +178,12 @@ const EnumPropertyItem *rna_enum_attribute_domain_itemf(ID *id, bool *r_free) continue; } - RNA_enum_item_add(&item, &totitem, domain_item); + if (domain_item->value == ATTR_DOMAIN_POINT && id_type == ID_ME) { + RNA_enum_item_add(&item, &totitem, &mesh_vertex_domain_item); + } + else { + RNA_enum_item_add(&item, &totitem, domain_item); + } } RNA_enum_item_end(&item, &totitem); -- cgit v1.2.3