[Bf-blender-cvs] [587ccc24c11] temp-geometry-nodes-attribute-color-ramp: Merge branch 'master' into temp-geometry-nodes-attribute-color-ramp

Jacques Lucke noreply at git.blender.org
Tue Dec 15 12:03:03 CET 2020


Commit: 587ccc24c1118c17e7bb4e7e4da2543e27ccec0e
Author: Jacques Lucke
Date:   Tue Dec 15 11:46:19 2020 +0100
Branches: temp-geometry-nodes-attribute-color-ramp
https://developer.blender.org/rB587ccc24c1118c17e7bb4e7e4da2543e27ccec0e

Merge branch 'master' into temp-geometry-nodes-attribute-color-ramp

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



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

diff --cc release/scripts/startup/nodeitems_builtins.py
index cfbf430c4a3,f1b783f31a5..487a9d0377f
--- a/release/scripts/startup/nodeitems_builtins.py
+++ b/release/scripts/startup/nodeitems_builtins.py
@@@ -484,7 -484,7 +484,8 @@@ geometry_node_categories = 
          NodeItem("GeometryNodeRandomAttribute"),
          NodeItem("GeometryNodeAttributeMath"),
          NodeItem("GeometryNodeAttributeFill"),
+         NodeItem("GeometryNodeAttributeMix"),
 +        NodeItem("GeometryNodeAttributeColorRamp"),
      ]),
      GeometryNodeCategory("GEO_COLOR", "Color", items=[
          NodeItem("ShaderNodeValToRGB"),
diff --cc source/blender/blenkernel/BKE_node.h
index 8662a1de68b,77a1d3989b0..b65867fe982
--- a/source/blender/blenkernel/BKE_node.h
+++ b/source/blender/blenkernel/BKE_node.h
@@@ -1351,7 -1351,7 +1351,8 @@@ int ntreeTexExecTree(struct bNodeTree *
  #define GEO_NODE_ATTRIBUTE_MATH 1009
  #define GEO_NODE_JOIN_GEOMETRY 1010
  #define GEO_NODE_ATTRIBUTE_FILL 1011
 -#define GEO_NODE_ATTRIBUTE_MIX 1012
 +#define GEO_NODE_ATTRIBUTE_COLOR_RAMP 1012
++#define GEO_NODE_ATTRIBUTE_MIX 1013
  
  /** \} */
  
diff --cc source/blender/blenkernel/intern/node.c
index d383399d750,75f2fca1096..06a5a791366
--- a/source/blender/blenkernel/intern/node.c
+++ b/source/blender/blenkernel/intern/node.c
@@@ -4694,7 -4734,7 +4734,8 @@@ static void registerGeometryNodes(void
    register_node_type_geo_random_attribute();
    register_node_type_geo_attribute_math();
    register_node_type_geo_join_geometry();
+   register_node_type_geo_attribute_mix();
 +  register_node_type_geo_attribute_color_ramp();
  }
  
  static void registerFunctionNodes(void)
diff --cc source/blender/editors/space_node/drawnode.c
index 0eee8f3f9ee,f8c71791054..75a95870c67
--- a/source/blender/editors/space_node/drawnode.c
+++ b/source/blender/editors/space_node/drawnode.c
@@@ -3190,13 -3197,17 +3197,24 @@@ static void node_geometry_buts_attribut
    // uiItemR(layout, ptr, "domain", DEFAULT_FLAGS, "", ICON_NONE);
  }
  
+ static void node_geometry_buts_attribute_mix(uiLayout *layout,
+                                              bContext *UNUSED(C),
+                                              PointerRNA *ptr)
+ {
+   uiItemR(layout, ptr, "blend_type", DEFAULT_FLAGS, "", ICON_NONE);
+   uiLayout *col = uiLayoutColumn(layout, false);
+   uiItemR(col, ptr, "input_type_factor", DEFAULT_FLAGS, IFACE_("Factor"), ICON_NONE);
+   uiItemR(col, ptr, "input_type_a", DEFAULT_FLAGS, IFACE_("A"), ICON_NONE);
+   uiItemR(col, ptr, "input_type_b", DEFAULT_FLAGS, IFACE_("B"), ICON_NONE);
+ }
+ 
 +static void node_geometry_buts_attribute_color_ramp(uiLayout *layout,
 +                                                    bContext *UNUSED(C),
 +                                                    PointerRNA *ptr)
 +{
 +  uiTemplateColorRamp(layout, ptr, "color_ramp", 0);
 +}
 +
  static void node_geometry_set_butfunc(bNodeType *ntype)
  {
    switch (ntype->type) {
@@@ -3218,9 -3232,9 +3239,12 @@@
      case GEO_NODE_ATTRIBUTE_FILL:
        ntype->draw_buttons = node_geometry_buts_attribute_fill;
        break;
+     case GEO_NODE_ATTRIBUTE_MIX:
+       ntype->draw_buttons = node_geometry_buts_attribute_mix;
+       break;
 +    case GEO_NODE_ATTRIBUTE_COLOR_RAMP:
 +      ntype->draw_buttons = node_geometry_buts_attribute_color_ramp;
 +      break;
    }
  }
  
diff --cc source/blender/makesdna/DNA_node_types.h
index 8848917d66d,736ec8919b4..4d6077f1896
--- a/source/blender/makesdna/DNA_node_types.h
+++ b/source/blender/makesdna/DNA_node_types.h
@@@ -1059,10 -1074,16 +1074,20 @@@ typedef struct NodeDenoise 
    char _pad[7];
  } NodeDenoise;
  
+ typedef struct NodeAttributeMix {
+   /* e.g. MA_RAMP_BLEND. */
+   uint8_t blend_type;
+ 
+   /* GeometryNodeAttributeInputMode */
+   uint8_t input_type_factor;
+   uint8_t input_type_a;
+   uint8_t input_type_b;
+ } NodeAttributeMix;
+ 
 +typedef struct NodeAttributeColorRamp {
 +  ColorBand color_ramp;
 +} NodeAttributeColorRamp;
 +
  /* script node mode */
  #define NODE_SCRIPT_INTERNAL 0
  #define NODE_SCRIPT_EXTERNAL 1
diff --cc source/blender/makesrna/intern/rna_nodetree.c
index 3b9c2370eb8,153e2aebd22..5e7615eb3e6
--- a/source/blender/makesrna/intern/rna_nodetree.c
+++ b/source/blender/makesrna/intern/rna_nodetree.c
@@@ -8399,18 -8427,60 +8427,72 @@@ static void def_geo_attribute_math(Stru
    RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
  }
  
+ static void def_geo_point_instance(StructRNA *srna)
+ {
+   static const EnumPropertyItem instance_type_items[] = {
+       {GEO_NODE_POINT_INSTANCE_TYPE_OBJECT,
+        "OBJECT",
+        ICON_NONE,
+        "Object",
+        "Instance an individual object on all points"},
+       {GEO_NODE_POINT_INSTANCE_TYPE_COLLECTION,
+        "COLLECTION",
+        ICON_NONE,
+        "Collection",
+        "Instance an entire collection on all points"},
+       {0, NULL, 0, NULL, NULL},
+   };
+ 
+   PropertyRNA *prop;
+ 
+   prop = RNA_def_property(srna, "instance_type", PROP_ENUM, PROP_NONE);
+   RNA_def_property_enum_sdna(prop, NULL, "custom1");
+   RNA_def_property_enum_items(prop, instance_type_items);
+   RNA_def_property_enum_default(prop, GEO_NODE_POINT_INSTANCE_TYPE_OBJECT);
+   RNA_def_property_ui_text(prop, "Instance Type", "");
+   RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
+ }
+ 
+ static void def_geo_attribute_mix(StructRNA *srna)
+ {
+   PropertyRNA *prop;
+ 
+   RNA_def_struct_sdna_from(srna, "NodeAttributeMix", "storage");
+ 
+   prop = RNA_def_property(srna, "blend_type", PROP_ENUM, PROP_NONE);
+   RNA_def_property_enum_items(prop, rna_enum_ramp_blend_items);
+   RNA_def_property_enum_default(prop, MA_RAMP_BLEND);
+   RNA_def_property_ui_text(prop, "Blending Mode", "");
+   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_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");
+ }
+ 
 +static void def_geo_attribute_color_ramp(StructRNA *srna)
 +{
 +  PropertyRNA *prop;
 +
 +  RNA_def_struct_sdna_from(srna, "NodeAttributeColorRamp", "storage");
 +
 +  prop = RNA_def_property(srna, "color_ramp", PROP_POINTER, PROP_NONE);
 +  RNA_def_property_struct_type(prop, "ColorRamp");
 +  RNA_def_property_ui_text(prop, "Color Ramp", "");
 +  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
 +}
 +
  /* -------------------------------------------------------------------------- */
  
  static void rna_def_shader_node(BlenderRNA *brna)
diff --cc source/blender/nodes/CMakeLists.txt
index b1946f28baa,11852f6f723..58528d8ec7c
--- a/source/blender/nodes/CMakeLists.txt
+++ b/source/blender/nodes/CMakeLists.txt
@@@ -138,15 -138,14 +138,15 @@@ set(SR
    function/nodes/node_fn_switch.cc
    function/node_function_util.cc
  
 +  geometry/nodes/node_geo_attribute_color_ramp.cc
    geometry/nodes/node_geo_attribute_fill.cc
    geometry/nodes/node_geo_attribute_math.cc
-   geometry/nodes/node_geo_common.cc
    geometry/nodes/node_geo_boolean.cc
+   geometry/nodes/node_geo_common.cc
    geometry/nodes/node_geo_edge_split.cc
    geometry/nodes/node_geo_join_geometry.cc
+   geometry/nodes/node_geo_attribute_mix.cc
    geometry/nodes/node_geo_object_info.cc
-   geometry/nodes/node_geo_subdivision_surface.cc
    geometry/nodes/node_geo_point_distribute.cc
    geometry/nodes/node_geo_point_instance.cc
    geometry/nodes/node_geo_random_attribute.cc
diff --cc source/blender/nodes/NOD_geometry.h
index cb078d650e6,e3ec0451832..74a920b9c7b
--- a/source/blender/nodes/NOD_geometry.h
+++ b/source/blender/nodes/NOD_geometry.h
@@@ -38,7 -38,7 +38,8 @@@ void register_node_type_geo_object_info
  void register_node_type_geo_random_attribute(void);
  void register_node_type_geo_attribute_math(void);
  void register_node_type_geo_join_geometry(void);
+ void register_node_type_geo_attribute_mix(void);
 +void register_node_type_geo_attribute_color_ramp(void);
  
  #ifdef __cplusplus
  }
diff --cc source/blender/nodes/NOD_static_types.h
index cf4be5a3fbf,491f49cf425..15ea35a25a9
--- a/source/blender/nodes/NOD_static_types.h
+++ b/source/blender/nodes/NOD_static_types.h
@@@ -278,7 -278,7 +278,8 @@@ DefNode(GeometryNode, GEO_NODE_RANDOM_A
  DefNode(GeometryNode, GEO_NODE_ATTRIBUTE_MATH, def_geo_attribute_math, "ATTRIBUTE_MATH", AttributeMath, "Attribute Math", "")
  DefNode(GeometryNode, GEO_NODE_JOIN_GEOMETRY, 0, "JOIN_GEOMETRY", JoinGeometry, "Join Geometry", "")
  DefNode(GeometryNode, GEO_NODE_ATTRIBUTE_FILL, def_geo_attribute_fill, "ATTRIBUTE_FILL", AttributeFill, "Attribute Fill", "")
+ DefNode(GeometryNode, GEO_NODE_ATTRIBUTE_MIX, def_geo_attribute_mix, "ATTRIBUTE_MIX", AttributeMix, "Attribute Mix", "")
 +DefNode(GeometryNode, GEO_NODE_ATTRIBUTE_COLOR_RAMP, def_geo_attribute_color_ramp, "ATTRIBUTE_COLOR_RAMP", AttributeColorRamp, "Attribute Color Ramp", "")
  
  /* undefine macros */
  #undef DefNode



More information about the Bf-blender-cvs mailing list