Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans Goudey <h.goudey@me.com>2022-06-08 11:42:21 +0300
committerHans Goudey <h.goudey@me.com>2022-06-08 11:48:19 +0300
commit6eea5f70e3b79e3c6683b7bc0e3e2998b67955d6 (patch)
tree94cce89b472021d174349477303a3faeab9cb73d /source/blender/makesrna/intern/rna_attribute.c
parent1af652d42eb917e257d0f4f2773258f4f6ad2a45 (diff)
Attributes: Use names instead of layers for some functions
This mirrors the C++ attribute API better, separates the implementation of attributes from CustomData slightly, and makes functions simpler, clearer, and safer. Also fix an issue with removing an attribute caused by 97712b018df71c meant the first attribute with the given type was removed instead of the attribute with the given name.
Diffstat (limited to 'source/blender/makesrna/intern/rna_attribute.c')
-rw-r--r--source/blender/makesrna/intern/rna_attribute.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/source/blender/makesrna/intern/rna_attribute.c b/source/blender/makesrna/intern/rna_attribute.c
index 2670e75d057..5e17f22ecf5 100644
--- a/source/blender/makesrna/intern/rna_attribute.c
+++ b/source/blender/makesrna/intern/rna_attribute.c
@@ -163,13 +163,14 @@ static StructRNA *rna_Attribute_refine(PointerRNA *ptr)
static void rna_Attribute_name_set(PointerRNA *ptr, const char *value)
{
- BKE_id_attribute_rename(ptr->owner_id, ptr->data, value, NULL);
+ const CustomDataLayer *layer = (const CustomDataLayer *)ptr->data;
+ BKE_id_attribute_rename(ptr->owner_id, layer->name, value, NULL);
}
static int rna_Attribute_name_editable(PointerRNA *ptr, const char **r_info)
{
CustomDataLayer *layer = ptr->data;
- if (BKE_id_attribute_required(ptr->owner_id, layer)) {
+ if (BKE_id_attribute_required(ptr->owner_id, layer->name)) {
*r_info = N_("Cannot modify name of required geometry attribute");
return false;
}
@@ -358,8 +359,8 @@ static PointerRNA rna_AttributeGroup_new(
static void rna_AttributeGroup_remove(ID *id, ReportList *reports, PointerRNA *attribute_ptr)
{
- CustomDataLayer *layer = (CustomDataLayer *)attribute_ptr->data;
- BKE_id_attribute_remove(id, layer, reports);
+ const CustomDataLayer *layer = (const CustomDataLayer *)attribute_ptr->data;
+ BKE_id_attribute_remove(id, layer->name, reports);
RNA_POINTER_INVALIDATE(attribute_ptr);
DEG_id_tag_update(id, ID_RECALC_GEOMETRY);