From 4669178fc3786e1aebb117892d8dc6a2ce4dc955 Mon Sep 17 00:00:00 2001 From: Hans Goudey Date: Tue, 31 May 2022 13:20:16 +0200 Subject: Attributes: Hide internal UI attributes and disallow procedural access This commit hides "UI attributes" described in T97452 from the UI lists in mesh, curve, and point cloud properties, and disallow accessing them in geometry nodes. Internal UI attributes like selection and hiding values should use the attribute system for simplicity and performance, but we don't want to expose those attributes in the attribute panel, which is meant for regular user interaction. Procedural access may be misleading or cause problems, as described in the design task above. These attributes are added by two upcoming patches: D14934, D14685 Differential Revision: https://developer.blender.org/D15069 --- source/blender/makesrna/intern/rna_attribute.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'source/blender/makesrna') diff --git a/source/blender/makesrna/intern/rna_attribute.c b/source/blender/makesrna/intern/rna_attribute.c index 36706c82366..0cea693cd2a 100644 --- a/source/blender/makesrna/intern/rna_attribute.c +++ b/source/blender/makesrna/intern/rna_attribute.c @@ -232,6 +232,12 @@ static int rna_Attribute_domain_get(PointerRNA *ptr) return BKE_id_attribute_domain(ptr->owner_id, ptr->data); } +static bool rna_Attribute_is_internal_get(PointerRNA *ptr) +{ + const CustomDataLayer *layer = (const CustomDataLayer *)ptr->data; + return BKE_attribute_allow_procedural_access(layer->name); +} + static void rna_Attribute_data_begin(CollectionPropertyIterator *iter, PointerRNA *ptr) { ID *id = ptr->owner_id; @@ -930,6 +936,12 @@ static void rna_def_attribute(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Domain", "Domain of the Attribute"); RNA_def_property_clear_flag(prop, PROP_EDITABLE); + prop = RNA_def_property(srna, "is_internal", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_funcs(prop, "rna_Attribute_is_internal_get", NULL); + RNA_def_property_ui_text( + prop, "Is Internal", "The attribute is meant for internal use by Blender"); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + /* types */ rna_def_attribute_float(brna); rna_def_attribute_float_vector(brna); @@ -942,7 +954,7 @@ static void rna_def_attribute(BlenderRNA *brna) rna_def_attribute_int8(brna); } -/* Mesh/PointCloud/Hair.attributes */ +/* Mesh/PointCloud/Curves.attributes */ static void rna_def_attribute_group(BlenderRNA *brna) { StructRNA *srna; -- cgit v1.2.3