[Bf-blender-cvs] [3e2cdb7643c] temp-geometry-nodes-mix-attributes: support changing b input

Jacques Lucke noreply at git.blender.org
Wed Dec 9 15:03:30 CET 2020


Commit: 3e2cdb7643cf96fa573fad10e435572c4cc0e0c9
Author: Jacques Lucke
Date:   Wed Dec 9 13:24:20 2020 +0100
Branches: temp-geometry-nodes-mix-attributes
https://developer.blender.org/rB3e2cdb7643cf96fa573fad10e435572c4cc0e0c9

support changing b input

===================================================================

M	source/blender/editors/space_node/drawnode.c
M	source/blender/makesrna/intern/rna_nodetree.c
M	source/blender/nodes/geometry/nodes/node_geo_attribute_mix.cc

===================================================================

diff --git a/source/blender/editors/space_node/drawnode.c b/source/blender/editors/space_node/drawnode.c
index 65b084faff9..6315c7c067a 100644
--- a/source/blender/editors/space_node/drawnode.c
+++ b/source/blender/editors/space_node/drawnode.c
@@ -3187,7 +3187,10 @@ static void node_geometry_buts_attribute_mix(uiLayout *layout,
                                              PointerRNA *ptr)
 {
   uiItemR(layout, ptr, "blend_type", DEFAULT_FLAGS, "", ICON_NONE);
-  uiItemR(layout, ptr, "input_type_factor", DEFAULT_FLAGS, "Factor", ICON_NONE);
+  uiLayout *col = uiLayoutColumn(layout, false);
+  uiItemR(col, ptr, "input_type_factor", DEFAULT_FLAGS, IFACE_("Type Factor"), ICON_NONE);
+  uiItemR(col, ptr, "input_type_a", DEFAULT_FLAGS, IFACE_("Type A"), ICON_NONE);
+  uiItemR(col, ptr, "input_type_b", DEFAULT_FLAGS, IFACE_("Type B"), ICON_NONE);
 }
 
 static void node_geometry_set_butfunc(bNodeType *ntype)
diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c
index 9cf96c28960..e413902cbc3 100644
--- a/source/blender/makesrna/intern/rna_nodetree.c
+++ b/source/blender/makesrna/intern/rna_nodetree.c
@@ -435,6 +435,12 @@ static const EnumPropertyItem rna_node_geometry_attribute_input_b_items[] = {
     {0, NULL, 0, NULL, NULL},
 };
 
+static const EnumPropertyItem rna_node_geometry_attribute_factor_input_type_items[] = {
+    {GEO_NODE_ATTRIBUTE_INPUT__ATTRIBUTE, "ATTRIBUTE", 0, "Attribute", ""},
+    {GEO_NODE_ATTRIBUTE_INPUT__CONSTANT_FLOAT, "FLOAT", 0, "Float", ""},
+    {0, NULL, 0, NULL, NULL},
+};
+
 static const EnumPropertyItem rna_node_geometry_attribute_input_type_items[] = {
     {GEO_NODE_ATTRIBUTE_INPUT__ATTRIBUTE, "ATTRIBUTE", 0, "Attribute", ""},
     {GEO_NODE_ATTRIBUTE_INPUT__CONSTANT_FLOAT, "FLOAT", 0, "Float", ""},
@@ -8389,9 +8395,19 @@ static void def_geo_attribute_mix(StructRNA *srna)
   RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
 
   prop = RNA_def_property(srna, "input_type_factor", PROP_ENUM, PROP_NONE);
-  RNA_def_property_enum_items(prop, rna_node_geometry_attribute_input_type_items);
+  RNA_def_property_enum_items(prop, rna_node_geometry_attribute_factor_input_type_items);
   RNA_def_property_ui_text(prop, "Input Type Factor", "");
   RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
+
+  prop = RNA_def_property(srna, "input_type_a", PROP_ENUM, PROP_NONE);
+  RNA_def_property_enum_items(prop, rna_node_geometry_attribute_input_type_items);
+  RNA_def_property_ui_text(prop, "Input Type A", "");
+  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
+
+  prop = RNA_def_property(srna, "input_type_b", PROP_ENUM, PROP_NONE);
+  RNA_def_property_enum_items(prop, rna_node_geometry_attribute_input_type_items);
+  RNA_def_property_ui_text(prop, "Input Type B", "");
+  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
 }
 
 /* -------------------------------------------------------------------------- */
diff --git a/source/blender/nodes/geometry/nodes/node_geo_attribute_mix.cc b/source/blender/nodes/geometry/nodes/node_geo_attribute_mix.cc
index 33c4e9ef8e7..d4817b45873 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_attribute_mix.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_attribute_mix.cc
@@ -27,6 +27,9 @@ static bNodeSocketTemplate geo_node_attribute_mix_in[] = {
     {SOCK_VECTOR, N_("Attribute A"), 0.0, 0.0, 0.0, 0.0, -FLT_MAX, FLT_MAX},
     {SOCK_RGBA, N_("Attribute A"), 0.5, 0.5, 0.5, 1.0},
     {SOCK_STRING, N_("Attribute B")},
+    {SOCK_FLOAT, N_("Attribute B"), 0.0, 0.0, 0.0, 0.0, -FLT_MAX, FLT_MAX},
+    {SOCK_VECTOR, N_("Attribute B"), 0.0, 0.0, 0.0, 0.0, -FLT_MAX, FLT_MAX},
+    {SOCK_RGBA, N_("Attribute B"), 0.5, 0.5, 0.5, 1.0},
     {SOCK_STRING, N_("Result")},
     {-1, ""},
 };
@@ -205,6 +208,7 @@ static void geo_node_attribute_mix_update(bNodeTree *UNUSED(ntree), bNode *node)
   NodeAttributeMix *node_storage = (NodeAttributeMix *)node->storage;
   update_attribute_input_socket_availabilities(*node, "Factor", node_storage->input_type_factor);
   update_attribute_input_socket_availabilities(*node, "Attribute A", node_storage->input_type_a);
+  update_attribute_input_socket_availabilities(*node, "Attribute B", node_storage->input_type_b);
 }
 
 }  // namespace blender::nodes



More information about the Bf-blender-cvs mailing list