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 --- .../blender/editors/geometry/geometry_attributes.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) (limited to 'source/blender/editors/geometry') diff --git a/source/blender/editors/geometry/geometry_attributes.c b/source/blender/editors/geometry/geometry_attributes.c index b2ecee90a57..9b034d82a51 100644 --- a/source/blender/editors/geometry/geometry_attributes.c +++ b/source/blender/editors/geometry/geometry_attributes.c @@ -108,14 +108,6 @@ void GEOMETRY_OT_attribute_add(wmOperatorType *ot) prop = RNA_def_string(ot->srna, "name", "Attribute", MAX_NAME, "Name", "Name of new attribute"); RNA_def_property_flag(prop, PROP_SKIP_SAVE); - prop = RNA_def_enum(ot->srna, - "data_type", - rna_enum_attribute_type_items, - CD_PROP_FLOAT, - "Data Type", - "Type of data stored in attribute"); - RNA_def_property_flag(prop, PROP_SKIP_SAVE); - prop = RNA_def_enum(ot->srna, "domain", rna_enum_attribute_domain_items, @@ -124,6 +116,14 @@ void GEOMETRY_OT_attribute_add(wmOperatorType *ot) "Type of element that attribute is stored on"); RNA_def_enum_funcs(prop, geometry_attribute_domain_itemf); RNA_def_property_flag(prop, PROP_SKIP_SAVE); + + prop = RNA_def_enum(ot->srna, + "data_type", + rna_enum_attribute_type_items, + CD_PROP_FLOAT, + "Data Type", + "Type of data stored in attribute"); + RNA_def_property_flag(prop, PROP_SKIP_SAVE); } static int geometry_attribute_remove_exec(bContext *C, wmOperator *op) @@ -140,6 +140,11 @@ static int geometry_attribute_remove_exec(bContext *C, wmOperator *op) return OPERATOR_CANCELLED; } + int *active_index = BKE_id_attributes_active_index_p(id); + if (*active_index > 0) { + *active_index -= 1; + } + DEG_id_tag_update(id, ID_RECALC_GEOMETRY); WM_main_add_notifier(NC_GEOM | ND_DATA, id); -- cgit v1.2.3