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:
authorBrecht Van Lommel <brecht@blender.org>2020-08-04 13:52:04 +0300
committerBrecht Van Lommel <brecht@blender.org>2020-09-09 18:01:17 +0300
commita1397a3cc69382a64ab97bb71e4769fc0add0791 (patch)
tree3ed860ff99a6a2469e6a11bc5de9304284d502d8 /source/blender/makesrna/intern/rna_attribute.c
parent565510bd7fd87ae146cabafb27f1dfd550450f58 (diff)
Geometry: use generic attributes for Hair and Point Clouds
Instead of custom data layer with special types, using general Vector and Float attributes. Ref T76659 Differential Revision: https://developer.blender.org/D8635
Diffstat (limited to 'source/blender/makesrna/intern/rna_attribute.c')
-rw-r--r--source/blender/makesrna/intern/rna_attribute.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/source/blender/makesrna/intern/rna_attribute.c b/source/blender/makesrna/intern/rna_attribute.c
index a0bb5f67a08..baa6e6135de 100644
--- a/source/blender/makesrna/intern/rna_attribute.c
+++ b/source/blender/makesrna/intern/rna_attribute.c
@@ -67,6 +67,8 @@ static const EnumPropertyItem rna_enum_attribute_domain_items[] = {
# include "DEG_depsgraph.h"
+# include "BLT_translation.h"
+
# include "WM_api.h"
/* Attribute */
@@ -82,6 +84,17 @@ static void rna_Attribute_name_set(PointerRNA *ptr, const char *value)
BKE_id_attribute_rename(ptr->owner_id, ptr->data, 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)) {
+ *r_info = N_("Can't modify name of required geometry attribute");
+ return false;
+ }
+
+ return true;
+}
+
static int rna_Attribute_type_get(PointerRNA *ptr)
{
CustomDataLayer *layer = ptr->data;
@@ -551,6 +564,7 @@ static void rna_def_attribute(BlenderRNA *brna)
prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
RNA_def_struct_name_property(srna, prop);
RNA_def_property_string_funcs(prop, NULL, NULL, "rna_Attribute_name_set");
+ RNA_def_property_editable_func(prop, "rna_Attribute_name_editable");
RNA_def_property_ui_text(prop, "Name", "Name of the Attribute");
RNA_def_struct_name_property(srna, prop);