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:
authorJacques Lucke <jacques@blender.org>2021-03-23 12:27:26 +0300
committerJacques Lucke <jacques@blender.org>2021-03-23 12:28:52 +0300
commit9c7492e2e0f001c785bad1a5a1d6b8b0a9394642 (patch)
tree36c4719d6e80840a546ecd7b732ac79e86e9b7e1 /source/blender/makesrna/intern
parentec97450ac6160a8892a339a746a507e40b7d2fce (diff)
Geometry Nodes: show domain in attribute fill node
Differential Revision: https://developer.blender.org/D10789
Diffstat (limited to 'source/blender/makesrna/intern')
-rw-r--r--source/blender/makesrna/intern/rna_attribute.c9
-rw-r--r--source/blender/makesrna/intern/rna_nodetree.c72
2 files changed, 26 insertions, 55 deletions
diff --git a/source/blender/makesrna/intern/rna_attribute.c b/source/blender/makesrna/intern/rna_attribute.c
index b99b6891d3d..8e3d2c9b9a2 100644
--- a/source/blender/makesrna/intern/rna_attribute.c
+++ b/source/blender/makesrna/intern/rna_attribute.c
@@ -62,6 +62,15 @@ const EnumPropertyItem rna_enum_attribute_domain_items[] = {
{0, NULL, 0, NULL, NULL},
};
+const EnumPropertyItem rna_enum_attribute_domain_with_auto_items[] = {
+ {ATTR_DOMAIN_AUTO, "AUTO", 0, "Auto", ""},
+ {ATTR_DOMAIN_POINT, "POINT", 0, "Point", "Attribute on point"},
+ {ATTR_DOMAIN_EDGE, "EDGE", 0, "Edge", "Attribute on mesh edge"},
+ {ATTR_DOMAIN_CORNER, "CORNER", 0, "Corner", "Attribute on mesh polygon corner"},
+ {ATTR_DOMAIN_POLYGON, "POLYGON", 0, "Polygon", "Attribute on mesh polygons"},
+ {0, NULL, 0, NULL, NULL},
+};
+
#ifdef RNA_RUNTIME
# include "BLI_math.h"
diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c
index a46c9a6fe40..7fa67ad351f 100644
--- a/source/blender/makesrna/intern/rna_nodetree.c
+++ b/source/blender/makesrna/intern/rna_nodetree.c
@@ -1959,17 +1959,6 @@ static const EnumPropertyItem *rna_GeometryNodeAttributeFill_type_itemf(bContext
return itemf_function_check(rna_enum_attribute_type_items, attribute_fill_type_supported);
}
-static bool attribute_fill_domain_supported(const EnumPropertyItem *item)
-{
- return item->value == ATTR_DOMAIN_POINT;
-}
-static const EnumPropertyItem *rna_GeometryNodeAttributeFill_domain_itemf(
- bContext *UNUSED(C), PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), bool *r_free)
-{
- *r_free = true;
- return itemf_function_check(rna_enum_attribute_domain_items, attribute_fill_domain_supported);
-}
-
/**
* This bit of ugly code makes sure the float / attribute option shows up instead of
* vector / attribute if the node uses an operation that uses a float for input B.
@@ -8786,37 +8775,6 @@ static void def_geo_triangulate(StructRNA *srna)
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
}
-/**
- * \note Passing the item functions as arguments here allows reusing the same
- * original list of items from Attribute RNA.
- */
-static void def_geo_attribute_create_common(StructRNA *srna,
- const char *type_items_func,
- const char *domain_items_func)
-{
- PropertyRNA *prop;
-
- prop = RNA_def_property(srna, "data_type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "custom1");
- RNA_def_property_enum_items(prop, rna_enum_attribute_type_items);
- if (type_items_func != NULL) {
- RNA_def_property_enum_funcs(prop, NULL, NULL, type_items_func);
- }
- RNA_def_property_enum_default(prop, CD_PROP_FLOAT);
- RNA_def_property_ui_text(prop, "Data Type", "Type of data stored in attribute");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_GeometryNode_socket_update");
-
- prop = RNA_def_property(srna, "domain", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "custom2");
- RNA_def_property_enum_items(prop, rna_enum_attribute_domain_items);
- if (domain_items_func != NULL) {
- RNA_def_property_enum_funcs(prop, NULL, NULL, domain_items_func);
- }
- RNA_def_property_enum_default(prop, ATTR_DOMAIN_POINT);
- RNA_def_property_ui_text(prop, "Domain", "");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-}
-
static void def_geo_attribute_randomize(StructRNA *srna)
{
PropertyRNA *prop;
@@ -8844,22 +8802,26 @@ static void def_geo_attribute_randomize(StructRNA *srna)
static void def_geo_attribute_fill(StructRNA *srna)
{
- def_geo_attribute_create_common(srna,
- "rna_GeometryNodeAttributeFill_type_itemf",
- "rna_GeometryNodeAttributeFill_domain_itemf");
+ PropertyRNA *prop;
+
+ prop = RNA_def_property(srna, "data_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "custom1");
+ RNA_def_property_enum_items(prop, rna_enum_attribute_type_items);
+ RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_GeometryNodeAttributeFill_type_itemf");
+ RNA_def_property_enum_default(prop, CD_PROP_FLOAT);
+ RNA_def_property_ui_text(prop, "Data Type", "Type of data stored in attribute");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_GeometryNode_socket_update");
+
+ prop = RNA_def_property(srna, "domain", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "custom2");
+ RNA_def_property_enum_items(prop, rna_enum_attribute_domain_with_auto_items);
+ RNA_def_property_enum_default(prop, ATTR_DOMAIN_AUTO);
+ RNA_def_property_ui_text(prop, "Domain", "");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
}
static void def_geo_attribute_convert(StructRNA *srna)
{
- static const EnumPropertyItem rna_enum_attribute_convert_domain_items[] = {
- {ATTR_DOMAIN_AUTO, "AUTO", 0, "Auto", ""},
- {ATTR_DOMAIN_POINT, "POINT", 0, "Point", "Attribute on point"},
- {ATTR_DOMAIN_EDGE, "EDGE", 0, "Edge", "Attribute on mesh edge"},
- {ATTR_DOMAIN_CORNER, "CORNER", 0, "Corner", "Attribute on mesh polygon corner"},
- {ATTR_DOMAIN_POLYGON, "POLYGON", 0, "Polygon", "Attribute on mesh polygons"},
- {0, NULL, 0, NULL, NULL},
- };
-
PropertyRNA *prop;
RNA_def_struct_sdna_from(srna, "NodeAttributeConvert", "storage");
@@ -8872,7 +8834,7 @@ static void def_geo_attribute_convert(StructRNA *srna)
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_GeometryNode_socket_update");
prop = RNA_def_property(srna, "domain", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_items(prop, rna_enum_attribute_convert_domain_items);
+ RNA_def_property_enum_items(prop, rna_enum_attribute_domain_with_auto_items);
RNA_def_property_enum_default(prop, ATTR_DOMAIN_AUTO);
RNA_def_property_ui_text(prop, "Domain", "The geometry domain to save the result attribute in");
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");