[Bf-blender-cvs] [2525c1c023d] geometry-nodes-simulation: Add initial "Extend" socket. Doesn't do anything yet

Hans Goudey noreply at git.blender.org
Sat Dec 10 22:12:26 CET 2022


Commit: 2525c1c023df6b79697896e0782a523914ce330d
Author: Hans Goudey
Date:   Sat Dec 10 15:12:17 2022 -0600
Branches: geometry-nodes-simulation
https://developer.blender.org/rB2525c1c023df6b79697896e0782a523914ce330d

Add initial "Extend" socket. Doesn't do anything yet

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

M	source/blender/nodes/NOD_socket_declarations.hh
M	source/blender/nodes/geometry/nodes/node_geo_simulation_input.cc
M	source/blender/nodes/geometry/nodes/node_geo_simulation_output.cc
M	source/blender/nodes/intern/node_socket_declarations.cc

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

diff --git a/source/blender/nodes/NOD_socket_declarations.hh b/source/blender/nodes/NOD_socket_declarations.hh
index 503327ac4da..231738dc667 100644
--- a/source/blender/nodes/NOD_socket_declarations.hh
+++ b/source/blender/nodes/NOD_socket_declarations.hh
@@ -223,6 +223,24 @@ class Shader : public SocketDeclaration {
 class ShaderBuilder : public SocketDeclarationBuilder<Shader> {
 };
 
+class ExtendBuilder;
+
+class Extend : public SocketDeclaration {
+ private:
+  friend ExtendBuilder;
+
+ public:
+  using Builder = ExtendBuilder;
+
+  bNodeSocket &build(bNodeTree &ntree, bNode &node) const override;
+  bool matches(const bNodeSocket &socket) const override;
+  bNodeSocket &update_or_build(bNodeTree &ntree, bNode &node, bNodeSocket &socket) const override;
+  bool can_connect(const bNodeSocket &socket) const override;
+};
+
+class ExtendBuilder : public SocketDeclarationBuilder<Extend> {
+};
+
 /* -------------------------------------------------------------------- */
 /** \name #FloatBuilder Inline Methods
  * \{ */
diff --git a/source/blender/nodes/geometry/nodes/node_geo_simulation_input.cc b/source/blender/nodes/geometry/nodes/node_geo_simulation_input.cc
index d4ca1ae22c3..5c2ef821c8a 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_simulation_input.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_simulation_input.cc
@@ -18,9 +18,11 @@ NODE_STORAGE_FUNCS(NodeGeometrySimulationInput);
 static void node_declare(NodeDeclarationBuilder &b)
 {
   b.add_input<decl::Geometry>(N_("Geometry"));
+  b.add_input<decl::Extend>("", N_("__extend__"));
 
   b.add_output<decl::Float>(N_("Delta Time"));
   b.add_output<decl::Geometry>(N_("Geometry"));
+  b.add_output<decl::Extend>("", N_("__extend__"));
 }
 
 static void node_layout(uiLayout * /*layout*/, bContext * /*C*/, PointerRNA * /*ptr*/)
diff --git a/source/blender/nodes/geometry/nodes/node_geo_simulation_output.cc b/source/blender/nodes/geometry/nodes/node_geo_simulation_output.cc
index 438a6c5f6ca..d1bdd9a0264 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_simulation_output.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_simulation_output.cc
@@ -18,7 +18,9 @@ NODE_STORAGE_FUNCS(NodeGeometrySimulationOutput);
 static void node_declare(NodeDeclarationBuilder &b)
 {
   b.add_input<decl::Geometry>(N_("Geometry"));
+  b.add_input<decl::Extend>("", N_("__extend__"));
   b.add_output<decl::Geometry>(N_("Geometry"));
+  b.add_output<decl::Extend>("", N_("__extend__"));
 }
 
 static void node_init(bNodeTree * /*tree*/, bNode *node)
diff --git a/source/blender/nodes/intern/node_socket_declarations.cc b/source/blender/nodes/intern/node_socket_declarations.cc
index a7d281bcf52..8f58f57ca1c 100644
--- a/source/blender/nodes/intern/node_socket_declarations.cc
+++ b/source/blender/nodes/intern/node_socket_declarations.cc
@@ -504,4 +504,37 @@ bool Shader::can_connect(const bNodeSocket &socket) const
 
 /** \} */
 
+/* -------------------------------------------------------------------- */
+/** \name #IDSocketDeclaration
+ * \{ */
+
+bNodeSocket &Extend::build(bNodeTree &ntree, bNode &node) const
+{
+  bNodeSocket &socket = *nodeAddSocket(
+      &ntree, &node, in_out_, "NodeSocketVirtual", identifier_.c_str(), name_.c_str());
+  this->set_common_flags(socket);
+  return socket;
+}
+
+bool Extend::matches(const bNodeSocket &socket) const
+{
+  if (!this->matches_common_data(socket)) {
+    return false;
+  }
+  return true;
+}
+
+bool Extend::can_connect(const bNodeSocket &socket) const
+{
+  return true;
+}
+
+bNodeSocket &Extend::update_or_build(bNodeTree &ntree, bNode &node, bNodeSocket &socket) const
+{
+  this->set_common_flags(socket);
+  return socket;
+}
+
+/** \} */
+
 }  // namespace blender::nodes::decl



More information about the Bf-blender-cvs mailing list