From ba1e97f1c6cd0c614a13eb1b5d7050b7c301d03e Mon Sep 17 00:00:00 2001 From: Hans Goudey Date: Sat, 25 Jun 2022 11:23:19 -0500 Subject: Geometry Nodes: Field on Domain Node As described in T98943, this commit adds a node that can evaluate a field on a separate domain in a larger field context. This is potentially useful in many cases, to avoid relying on a separate capture attribute node, which can make it easier to build reusable fields that don't need geometry inputs. Internally, the node just evaluates the input field in the larger field context and then uses the generic domain interpolation, so the code is simple. One future optimization might be using the input selection to only evaluate part of the input field, but then the selection has to be interpolated as well, and that might not always be worth it. Differential Revision: https://developer.blender.org/D15289 --- source/blender/makesrna/intern/rna_nodetree.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'source/blender/makesrna/intern/rna_nodetree.c') diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c index 65a8d8bf24a..1a8f47605a3 100644 --- a/source/blender/makesrna/intern/rna_nodetree.c +++ b/source/blender/makesrna/intern/rna_nodetree.c @@ -10702,6 +10702,25 @@ static void def_geo_field_at_index(StructRNA *srna) RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_GeometryNode_socket_update"); } +static void def_geo_field_on_domain(StructRNA *srna) +{ + PropertyRNA *prop; + + prop = RNA_def_property(srna, "domain", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "custom1"); + RNA_def_property_enum_items(prop, rna_enum_attribute_domain_items); + RNA_def_property_ui_text(prop, "Domain", "Domain the field is evaluated in"); + RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_GeometryNode_socket_update"); + + prop = RNA_def_property(srna, "data_type", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "custom2"); + RNA_def_property_enum_items(prop, rna_enum_attribute_type_items); + RNA_def_property_enum_funcs( + prop, NULL, NULL, "rna_GeometryNodeAttributeType_type_with_socket_itemf"); + RNA_def_property_ui_text(prop, "Data Type", ""); + RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_GeometryNode_socket_update"); +} + static void def_geo_scale_elements(StructRNA *srna) { PropertyRNA *prop; -- cgit v1.2.3