[Bf-blender-cvs] [be5f911e2af] temp-attribute-processor: add rna for group inputs
Jacques Lucke
noreply at git.blender.org
Thu May 27 12:51:42 CEST 2021
Commit: be5f911e2af2773575b44b020a663d7b8b55f728
Author: Jacques Lucke
Date: Tue May 25 09:52:57 2021 +0200
Branches: temp-attribute-processor
https://developer.blender.org/rBbe5f911e2af2773575b44b020a663d7b8b55f728
add rna for group inputs
===================================================================
M source/blender/blenkernel/intern/node.cc
M source/blender/makesdna/DNA_node_types.h
M source/blender/makesrna/intern/rna_nodetree.c
M source/blender/nodes/geometry/nodes/node_geo_attribute_processor.cc
===================================================================
diff --git a/source/blender/blenkernel/intern/node.cc b/source/blender/blenkernel/intern/node.cc
index dbe0874ec2e..181e0a74d78 100644
--- a/source/blender/blenkernel/intern/node.cc
+++ b/source/blender/blenkernel/intern/node.cc
@@ -582,12 +582,12 @@ void ntreeBlendWrite(BlendWriter *writer, bNodeTree *ntree)
else if (node->type == GEO_NODE_ATTRIBUTE_PROCESSOR) {
NodeGeometryAttributeProcessor *storage = (NodeGeometryAttributeProcessor *)node->storage;
BLO_write_struct(writer, NodeGeometryAttributeProcessor, storage);
- BLO_write_struct_list(writer, AttributeProcessorInput, &storage->inputs);
- BLO_write_struct_list(writer, AttributeProcessorOutput, &storage->outputs);
- LISTBASE_FOREACH (AttributeProcessorInput *, input, &storage->inputs) {
+ BLO_write_struct_list(writer, AttributeProcessorInput, &storage->group_inputs);
+ BLO_write_struct_list(writer, AttributeProcessorOutput, &storage->group_outputs);
+ LISTBASE_FOREACH (AttributeProcessorInput *, input, &storage->group_inputs) {
BLO_write_string(writer, input->identifier);
}
- LISTBASE_FOREACH (AttributeProcessorOutput *, output, &storage->outputs) {
+ LISTBASE_FOREACH (AttributeProcessorOutput *, output, &storage->group_outputs) {
BLO_write_string(writer, output->identifier);
}
}
@@ -775,12 +775,12 @@ void ntreeBlendReadData(BlendDataReader *reader, bNodeTree *ntree)
case GEO_NODE_ATTRIBUTE_PROCESSOR: {
NodeGeometryAttributeProcessor *storage = (NodeGeometryAttributeProcessor *)
node->storage;
- BLO_read_list(reader, &storage->inputs);
- BLO_read_list(reader, &storage->outputs);
- LISTBASE_FOREACH (AttributeProcessorInput *, input, &storage->inputs) {
+ BLO_read_list(reader, &storage->group_inputs);
+ BLO_read_list(reader, &storage->group_outputs);
+ LISTBASE_FOREACH (AttributeProcessorInput *, input, &storage->group_inputs) {
BLO_read_data_address(reader, &input->identifier);
}
- LISTBASE_FOREACH (AttributeProcessorOutput *, output, &storage->outputs) {
+ LISTBASE_FOREACH (AttributeProcessorOutput *, output, &storage->group_outputs) {
BLO_read_data_address(reader, &output->identifier);
}
break;
diff --git a/source/blender/makesdna/DNA_node_types.h b/source/blender/makesdna/DNA_node_types.h
index 418375830f1..6a747211249 100644
--- a/source/blender/makesdna/DNA_node_types.h
+++ b/source/blender/makesdna/DNA_node_types.h
@@ -1383,9 +1383,9 @@ typedef struct NodeGeometryAttributeProcessor {
int8_t domain;
char _pad[7];
/* List of AttributeProcessorInput. */
- ListBase inputs;
+ ListBase group_inputs;
/* List of AttributeProcessorOutput. */
- ListBase outputs;
+ ListBase group_outputs;
} NodeGeometryAttributeProcessor;
/* script node mode */
@@ -1901,13 +1901,14 @@ typedef enum GeometryNodeAttributeTransferMapMode {
} GeometryNodeAttributeTransferMapMode;
typedef enum GeometryNodeAttributeProcessorInputMode {
- GEO_NODE_ATTRIBUTE_PROCESSOR_INPUT_MODE_VALUE = 0,
- GEO_NODE_ATTRIBUTE_PROCESSOR_INPUT_MODE_ATTRIBUTE = 1,
+ GEO_NODE_ATTRIBUTE_PROCESSOR_INPUT_MODE_DEFAULT = 0,
+ GEO_NODE_ATTRIBUTE_PROCESSOR_INPUT_MODE_CUSTOM_ATTRIBUTE = 1,
+ GEO_NODE_ATTRIBUTE_PROCESSOR_INPUT_MODE_CUSTOM_VALUE = 2,
} GeometryNodeAttributeProcessorInputMode;
typedef enum GeometryNodeAttributeProcessorOutputMode {
- GEO_NODE_ATTRIBUTE_PROCESSOR_OUTPUT_MODE_GIVEN_NAME = 0,
- GEO_NODE_ATTRIBUTE_PROCESSOR_OUTPUT_MODE_CUSTOM_NAME = 1,
+ GEO_NODE_ATTRIBUTE_PROCESSOR_OUTPUT_MODE_DEFAULT = 0,
+ GEO_NODE_ATTRIBUTE_PROCESSOR_OUTPUT_MODE_CUSTOM = 1,
} GeometryNodeAttributeProcessorOutputMode;
#ifdef __cplusplus
diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c
index b5088510a3d..bbcd1d80cc5 100644
--- a/source/blender/makesrna/intern/rna_nodetree.c
+++ b/source/blender/makesrna/intern/rna_nodetree.c
@@ -9878,6 +9878,73 @@ static void def_geo_input_material(StructRNA *srna)
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
}
+static void def_geo_attribute_processor_group_input(BlenderRNA *brna)
+{
+ static EnumPropertyItem input_mode_items[] = {
+ {GEO_NODE_ATTRIBUTE_PROCESSOR_INPUT_MODE_DEFAULT,
+ "DEFAULT",
+ 0,
+ "Default",
+ "Use the default value or attribute used by the group"},
+ {GEO_NODE_ATTRIBUTE_PROCESSOR_INPUT_MODE_CUSTOM_ATTRIBUTE,
+ "CUSTOM_ATTRIBUTE",
+ 0,
+ "Custom Attribute",
+ "Pass a custom attribute name into the group"},
+ {GEO_NODE_ATTRIBUTE_PROCESSOR_INPUT_MODE_CUSTOM_VALUE,
+ "CUSTOM_VALUE",
+ 0,
+ "Custom Value",
+ "Pass a custom value into the group"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "AttributeProcessorInput", NULL);
+ RNA_def_struct_ui_text(srna, "Attribute Processor Input", "");
+
+ prop = RNA_def_property(srna, "identifier", PROP_STRING, PROP_NONE);
+ RNA_def_property_ui_text(prop, "identifier", "Identifier of the matching socket in the group");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+
+ prop = RNA_def_property(srna, "input_mode", PROP_ENUM, PROP_NONE);
+ RNA_def_property_ui_text(prop, "Input Mode", "How the group input is provided");
+ RNA_def_property_enum_items(prop, input_mode_items);
+}
+
+static void def_geo_attribute_processor_group_output(BlenderRNA *brna)
+{
+ static EnumPropertyItem output_mode_items[] = {
+ {GEO_NODE_ATTRIBUTE_PROCESSOR_OUTPUT_MODE_DEFAULT,
+ "DEFAULT",
+ 0,
+ "Default",
+ "Use the name of the output that is used in the group"},
+ {GEO_NODE_ATTRIBUTE_PROCESSOR_OUTPUT_MODE_CUSTOM,
+ "CUSTOM",
+ 0,
+ "Custom Name",
+ "Use a custom name for the output attribute"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "AttributeProcessorOutput", NULL);
+ RNA_def_struct_ui_text(srna, "Attribute Processor Output", "");
+
+ prop = RNA_def_property(srna, "identifier", PROP_STRING, PROP_NONE);
+ RNA_def_property_ui_text(prop, "identifier", "Identifier of the matching socket in the group");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+
+ prop = RNA_def_property(srna, "output_mode", PROP_ENUM, PROP_NONE);
+ RNA_def_property_ui_text(prop, "Output Mode", "How group output name is determined");
+ RNA_def_property_enum_items(prop, output_mode_items);
+}
+
static void def_geo_attribute_processor(StructRNA *srna)
{
PropertyRNA *prop;
@@ -9900,6 +9967,14 @@ static void def_geo_attribute_processor(StructRNA *srna)
RNA_def_property_enum_default(prop, ATTR_DOMAIN_POINT);
RNA_def_property_ui_text(prop, "Domain", "The geometry domain to process attributes in");
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "group_inputs", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_struct_type(prop, "AttributeProcessorInput");
+ RNA_def_property_ui_text(prop, "Group Inputs", "");
+
+ prop = RNA_def_property(srna, "group_outputs", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_struct_type(prop, "AttributeProcessorOutput");
+ RNA_def_property_ui_text(prop, "Group Outputs", "");
}
/* -------------------------------------------------------------------------- */
@@ -11899,6 +11974,9 @@ void RNA_def_nodetree(BlenderRNA *brna)
rna_def_geometry_nodetree(brna);
rna_def_attribute_nodetree(brna);
+ def_geo_attribute_processor_group_input(brna);
+ def_geo_attribute_processor_group_output(brna);
+
# define DefNode(Category, ID, DefFunc, EnumName, StructName, UIName, UIDesc) \
{ \
srna = define_specific_node( \
diff --git a/source/blender/nodes/geometry/nodes/node_geo_attribute_processor.cc b/source/blender/nodes/geometry/nodes/node_geo_attribute_processor.cc
index 8ac747a2de8..19f8a77dff2 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_attribute_processor.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_attribute_processor.cc
@@ -89,16 +89,16 @@ static void geo_node_attribute_processor_storage_free(bNode *node)
{
NodeGeometryAttributeProcessor *storage = (NodeGeometryAttributeProcessor *)node->storage;
- LISTBASE_FOREACH_MUTABLE (AttributeProcessorInput *, input, &storage->inputs) {
+ LISTBASE_FOREACH_MUTABLE (AttributeProcessorInput *, input, &storage->group_inputs) {
MEM_freeN(input->identifier);
MEM_freeN(input);
}
- BLI_listbase_clear(&storage->inputs);
- LISTBASE_FOREACH_MUTABLE (AttributeProcessorOutput *, output, &storage->outputs) {
+ BLI_listbase_clear(&storage->group_inputs);
+ LISTBASE_FOREACH_MUTABLE (AttributeProcessorOutput *, output, &storage->group_outputs) {
MEM_freeN(output->identifier);
MEM_freeN(output);
}
- BLI_listbase_clear(&storage->outputs);
+ BLI_listbase_clear(&storage->group_outputs);
MEM_freeN(storage);
}
@@ -113,22 +113,22 @@ static void geo_node_attribute_processor_storage_copy(bNodeTree *UNUSED(dest_ntr
*dst_storage = *src_storage;
- BLI_listbase_clear(&dst_storage->inputs);
- LISTBASE_FOREACH (const AttributeProcessorInput *, src_input, &src_storage->inputs) {
+ BLI_listbase_clear(&dst_storage->group_inputs);
+ LISTBASE_FOREACH (const AttributeProcessorInput *, src_input, &src_storage->group_inputs) {
AttributeProcessorInput *dst_input = (AttributeProcessorInput *)MEM_callocN(
sizeof(AttributeProcessorInput), __func__);
*dst_input = *src_input;
dst_input->identifier = BLI_strdup(src_input->identifier);
- BLI_addtail(&dst_storage->inputs, dst_input);
+ BLI_addtail(&dst_storage->group_inputs, dst_input);
}
- BLI_listbase_clear(&dst_storage->outputs);
- LISTBASE_FOREACH (const AttributeProcessorOutput *, src_output, &src_storage->outputs) {
+ BLI_listbase_clear(&dst_storage->group_outputs);
+ LISTBASE_FOREACH (const AttributeProcessorOutput *, src_output, &src_storage->group_outputs) {
AttributePr
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list