diff options
author | Jacques Lucke <jacques@blender.org> | 2022-01-21 14:47:35 +0300 |
---|---|---|
committer | Jacques Lucke <jacques@blender.org> | 2022-01-21 14:47:35 +0300 |
commit | f6888b530ac81abbe61755971449ad6b42b93c82 (patch) | |
tree | d5234ec992f73046f031e71d62cc47efe5cbcc64 /source/blender/makesrna/intern/rna_attribute.c | |
parent | 36c40760a5a38db733e20c948b2170ab78bb2607 (diff) |
Attributes: add operator to convert generic attributes to other types
Editing of generic attributes on the original objects in edit modes is
still very limited. However, when applying a geometry nodes modifier
that generates new attributes. These attributes will show up in the
Attributes panel.
Currently, our exporters are not capable of exporting generic attributes.
Therefore, for the time being, a work around is to apply geometry nodes
and then convert a generic attribute to a task specific attribute like a
uv map, vertex group or vertex color layer. Once more parts of Blender
support generic attributes, this will become less important.
Currently, only meshes are supported by the operator. However, it would
be relatively easy to extend it to other geometry types.
Differential Revision: https://developer.blender.org/D13838
Diffstat (limited to 'source/blender/makesrna/intern/rna_attribute.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_attribute.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/source/blender/makesrna/intern/rna_attribute.c b/source/blender/makesrna/intern/rna_attribute.c index 78c15444308..35da353a043 100644 --- a/source/blender/makesrna/intern/rna_attribute.c +++ b/source/blender/makesrna/intern/rna_attribute.c @@ -166,7 +166,9 @@ static int rna_Attribute_type_get(PointerRNA *ptr) return layer->type; } -const EnumPropertyItem *rna_enum_attribute_domain_itemf(ID *id, bool *r_free) +const EnumPropertyItem *rna_enum_attribute_domain_itemf(ID *id, + bool include_instances, + bool *r_free) { EnumPropertyItem *item = NULL; const EnumPropertyItem *domain_item = NULL; @@ -188,6 +190,9 @@ const EnumPropertyItem *rna_enum_attribute_domain_itemf(ID *id, bool *r_free) if (id_type == ID_ME && ELEM(domain_item->value, ATTR_DOMAIN_CURVE)) { continue; } + if (!include_instances && domain_item->value == ATTR_DOMAIN_INSTANCE) { + continue; + } if (domain_item->value == ATTR_DOMAIN_POINT && id_type == ID_ME) { RNA_enum_item_add(&item, &totitem, &mesh_vertex_domain_item); @@ -207,7 +212,7 @@ static const EnumPropertyItem *rna_Attribute_domain_itemf(bContext *UNUSED(C), PropertyRNA *UNUSED(prop), bool *r_free) { - return rna_enum_attribute_domain_itemf(ptr->owner_id, r_free); + return rna_enum_attribute_domain_itemf(ptr->owner_id, true, r_free); } static int rna_Attribute_domain_get(PointerRNA *ptr) |