[Bf-blender-cvs] [b9a5f375a0a] 2d: wip

Johnny Matthews noreply at git.blender.org
Wed Feb 2 19:04:56 CET 2022


Commit: b9a5f375a0a6ae4436d3140c8a685f1416983182
Author: Johnny Matthews
Date:   Tue Feb 1 15:33:17 2022 -0600
Branches: 2d
https://developer.blender.org/rBb9a5f375a0a6ae4436d3140c8a685f1416983182

wip

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

M	source/blender/editors/space_node/drawnode.cc
M	source/blender/editors/space_node/node_templates.cc
M	source/blender/makesdna/DNA_node_types.h
M	source/blender/makesrna/intern/rna_attribute.c
M	source/blender/makesrna/intern/rna_nodetree.c
M	source/blender/nodes/geometry/node_geometry_util.cc
M	source/blender/nodes/geometry/nodes/node_geo_accumulate_field.cc
D	source/blender/nodes/geometry/nodes/node_geo_input_uv.cc
M	source/blender/nodes/geometry/nodes/node_geo_viewer.cc

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

diff --git a/source/blender/editors/space_node/drawnode.cc b/source/blender/editors/space_node/drawnode.cc
index 6b5c00ed5bb..59d535e1525 100644
--- a/source/blender/editors/space_node/drawnode.cc
+++ b/source/blender/editors/space_node/drawnode.cc
@@ -1166,7 +1166,7 @@ static const float std_node_socket_colors[][4] = {
     {0.96, 0.96, 0.96, 1.0}, /* SOCK_COLLECTION */
     {0.62, 0.31, 0.64, 1.0}, /* SOCK_TEXTURE */
     {0.92, 0.46, 0.51, 1.0}, /* SOCK_MATERIAL */
-    {0.49, 0.49, 0.88, 1.0}, /* SOCK_VECTOR2D */
+    {0.59, 0.59, 0.98, 1.0}, /* SOCK_VECTOR2D */
 };
 
 /* common color callbacks for standard types */
diff --git a/source/blender/editors/space_node/node_templates.cc b/source/blender/editors/space_node/node_templates.cc
index 113e2bd3bb3..91cdaa6b98e 100644
--- a/source/blender/editors/space_node/node_templates.cc
+++ b/source/blender/editors/space_node/node_templates.cc
@@ -394,6 +394,9 @@ static Vector<NodeLinkItem> ui_node_link_items(NodeLinkArg *arg,
       else if (dynamic_cast<const decl::Vector *>(&socket_decl)) {
         item.socket_type = SOCK_VECTOR;
       }
+      else if (dynamic_cast<const decl::Vector2d *>(&socket_decl)) {
+        item.socket_type = SOCK_VECTOR2D;
+      }
       else if (dynamic_cast<const decl::Color *>(&socket_decl)) {
         item.socket_type = SOCK_RGBA;
       }
@@ -882,6 +885,12 @@ static void ui_node_draw_input(
             sub = uiLayoutColumn(row, true);
           }
           ATTR_FALLTHROUGH;
+        case SOCK_VECTOR2D:
+          if (input->type == SOCK_VECTOR2D) {
+            uiItemS(row);
+            sub = uiLayoutColumn(row, true);
+          }
+          ATTR_FALLTHROUGH;
         case SOCK_FLOAT:
         case SOCK_INT:
         case SOCK_BOOLEAN:
diff --git a/source/blender/makesdna/DNA_node_types.h b/source/blender/makesdna/DNA_node_types.h
index 7b65db18c5a..5142143b0a3 100644
--- a/source/blender/makesdna/DNA_node_types.h
+++ b/source/blender/makesdna/DNA_node_types.h
@@ -2163,6 +2163,7 @@ typedef enum GeometryNodeAttributeInputMode {
   GEO_NODE_ATTRIBUTE_INPUT_COLOR = 3,
   GEO_NODE_ATTRIBUTE_INPUT_BOOLEAN = 4,
   GEO_NODE_ATTRIBUTE_INPUT_INTEGER = 5,
+  GEO_NODE_ATTRIBUTE_INPUT_VECTOR2D = 6,
 } GeometryNodeAttributeInputMode;
 
 typedef enum GeometryNodePointDistributeMode {
diff --git a/source/blender/makesrna/intern/rna_attribute.c b/source/blender/makesrna/intern/rna_attribute.c
index 1ea9b9ecbd1..8a5b5d5b992 100644
--- a/source/blender/makesrna/intern/rna_attribute.c
+++ b/source/blender/makesrna/intern/rna_attribute.c
@@ -41,11 +41,11 @@ const EnumPropertyItem rna_enum_attribute_type_items[] = {
     {CD_PROP_FLOAT, "FLOAT", 0, "Float", "Floating-point value"},
     {CD_PROP_INT32, "INT", 0, "Integer", "32-bit integer"},
     {CD_PROP_FLOAT3, "FLOAT_VECTOR", 0, "Vector", "3D vector with floating-point values"},
+    {CD_PROP_FLOAT2, "FLOAT2", 0, "2D Vector", "2D vector with floating-point values"},
     {CD_PROP_COLOR, "FLOAT_COLOR", 0, "Color", "RGBA color with floating-point values"},
     {CD_MLOOPCOL, "BYTE_COLOR", 0, "Byte Color", "RGBA color with 8-bit values"},
     {CD_PROP_STRING, "STRING", 0, "String", "Text string"},
     {CD_PROP_BOOL, "BOOLEAN", 0, "Boolean", "True or false"},
-    {CD_PROP_FLOAT2, "FLOAT2", 0, "2D Vector", "2D vector with floating-point values"},
     {0, NULL, 0, NULL, NULL},
 };
 
@@ -54,11 +54,11 @@ const EnumPropertyItem rna_enum_attribute_type_with_auto_items[] = {
     {CD_PROP_FLOAT, "FLOAT", 0, "Float", "Floating-point value"},
     {CD_PROP_INT32, "INT", 0, "Integer", "32-bit integer"},
     {CD_PROP_FLOAT3, "FLOAT_VECTOR", 0, "Vector", "3D vector with floating-point values"},
+    {CD_PROP_FLOAT2, "FLOAT2", 0, "2D Vector", "2D vector with floating-point values"},
     {CD_PROP_COLOR, "FLOAT_COLOR", 0, "Color", "RGBA color with floating-point values"},
     {CD_MLOOPCOL, "BYTE_COLOR", 0, "Byte Color", "RGBA color with 8-bit values"},
     {CD_PROP_STRING, "STRING", 0, "String", "Text string"},
     {CD_PROP_BOOL, "BOOLEAN", 0, "Boolean", "True or false"},
-    {CD_PROP_FLOAT2, "FLOAT2", 0, "2D Vector", "2D vector with floating-point values"},
     {0, NULL, 0, NULL, NULL},
 };
 
diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c
index 27a3d5eb483..1d76e2ea248 100644
--- a/source/blender/makesrna/intern/rna_nodetree.c
+++ b/source/blender/makesrna/intern/rna_nodetree.c
@@ -574,6 +574,10 @@ static EnumPropertyItem rna_node_geometry_mesh_circle_fill_type_items[] = {
   { \
     GEO_NODE_ATTRIBUTE_INPUT_VECTOR, "VECTOR", 0, "Vector", "" \
   }
+#define ITEM_VECTOR2D \
+  { \
+    GEO_NODE_ATTRIBUTE_INPUT_VECTOR2D, "VECTOR2D", 0, "Vector2d", "" \
+  }
 #define ITEM_COLOR \
   { \
     GEO_NODE_ATTRIBUTE_INPUT_COLOR, "COLOR", 0, "Color", "" \
diff --git a/source/blender/nodes/geometry/node_geometry_util.cc b/source/blender/nodes/geometry/node_geometry_util.cc
index aaa03d3ddc8..29faae4770e 100644
--- a/source/blender/nodes/geometry/node_geometry_util.cc
+++ b/source/blender/nodes/geometry/node_geometry_util.cc
@@ -45,7 +45,7 @@ void update_attribute_input_socket_availabilities(bNodeTree &ntree,
            (socket->type == SOCK_FLOAT && mode_ == GEO_NODE_ATTRIBUTE_INPUT_FLOAT) ||
            (socket->type == SOCK_INT && mode_ == GEO_NODE_ATTRIBUTE_INPUT_INTEGER) ||
            (socket->type == SOCK_VECTOR && mode_ == GEO_NODE_ATTRIBUTE_INPUT_VECTOR) ||
-           (socket->type == SOCK_VECTOR2D && mode_ == GEO_NODE_ATTRIBUTE_INPUT_VECTOR) ||
+           (socket->type == SOCK_VECTOR2D && mode_ == GEO_NODE_ATTRIBUTE_INPUT_VECTOR2D) ||
            (socket->type == SOCK_RGBA && mode_ == GEO_NODE_ATTRIBUTE_INPUT_COLOR));
       nodeSetSocketAvailability(&ntree, socket, socket_is_available);
     }
diff --git a/source/blender/nodes/geometry/nodes/node_geo_accumulate_field.cc b/source/blender/nodes/geometry/nodes/node_geo_accumulate_field.cc
index 3bbc9012202..6c2e72cf14f 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_accumulate_field.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_accumulate_field.cc
@@ -148,8 +148,6 @@ static std::optional<CustomDataType> node_type_from_other_socket(const bNodeSock
     case SOCK_VECTOR:
     case SOCK_RGBA:
       return CD_PROP_FLOAT3;
-    case SOCK_VECTOR2D:
-      return CD_PROP_FLOAT2;
     default:
       return {};
   }
diff --git a/source/blender/nodes/geometry/nodes/node_geo_input_uv.cc b/source/blender/nodes/geometry/nodes/node_geo_input_uv.cc
deleted file mode 100644
index beb528d2fd8..00000000000
--- a/source/blender/nodes/geometry/nodes/node_geo_input_uv.cc
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-#include "node_geometry_util.hh"
-
-namespace blender::nodes::node_geo_input_position_cc {
-
-static void node_declare(NodeDeclarationBuilder &b)
-{
-  b.add_output<decl::Vector>(N_("Position")).field_source();
-}
-
-static void node_geo_exec(GeoNodeExecParams params)
-{
-  Field<float3> position_field{AttributeFieldInput::Create<float3>("position")};
-  params.set_output("Position", std::move(position_field));
-}
-
-}  // namespace blender::nodes::node_geo_input_position_cc
-
-void register_node_type_geo_input_position()
-{
-  namespace file_ns = blender::nodes::node_geo_input_position_cc;
-
-  static bNodeType ntype;
-
-  geo_node_type_base(&ntype, GEO_NODE_INPUT_POSITION, "Position", NODE_CLASS_INPUT);
-  ntype.geometry_node_execute = file_ns::node_geo_exec;
-  ntype.declare = file_ns::node_declare;
-  nodeRegisterType(&ntype);
-}
diff --git a/source/blender/nodes/geometry/nodes/node_geo_viewer.cc b/source/blender/nodes/geometry/nodes/node_geo_viewer.cc
index 562ee892212..9eae2fa5730 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_viewer.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_viewer.cc
@@ -38,6 +38,7 @@ static void node_declare(NodeDeclarationBuilder &b)
   b.add_input<decl::Color>(N_("Value"), "Value_002").supports_field().hide_value();
   b.add_input<decl::Int>(N_("Value"), "Value_003").supports_field().hide_value();
   b.add_input<decl::Bool>(N_("Value"), "Value_004").supports_field().hide_value();
+  b.add_input<decl::Vector2d>(N_("Value"), "Value_005").supports_field().hide_value();
 }
 
 static void node_init(bNodeTree *UNUSED(tree), bNode *node)



More information about the Bf-blender-cvs mailing list