[Bf-blender-cvs] [6551e57ca98] temp-geometry-nodes-sample-texture: initial boilerplate code for sample texture node

Jacques Lucke noreply at git.blender.org
Tue Dec 15 15:20:30 CET 2020


Commit: 6551e57ca98cf28939685ff109d38e9dc6e91f78
Author: Jacques Lucke
Date:   Tue Dec 15 13:45:30 2020 +0100
Branches: temp-geometry-nodes-sample-texture
https://developer.blender.org/rB6551e57ca98cf28939685ff109d38e9dc6e91f78

initial boilerplate code for sample texture node

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

M	release/scripts/startup/nodeitems_builtins.py
M	source/blender/blenkernel/BKE_node.h
M	source/blender/blenkernel/intern/node.c
M	source/blender/nodes/CMakeLists.txt
M	source/blender/nodes/NOD_geometry.h
M	source/blender/nodes/NOD_static_types.h
A	source/blender/nodes/geometry/nodes/node_geo_sample_texture.cc

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

diff --git a/release/scripts/startup/nodeitems_builtins.py b/release/scripts/startup/nodeitems_builtins.py
index f1b783f31a5..ed901658700 100644
--- a/release/scripts/startup/nodeitems_builtins.py
+++ b/release/scripts/startup/nodeitems_builtins.py
@@ -495,6 +495,7 @@ geometry_node_categories = [
         NodeItem("GeometryNodeTransform"),
         NodeItem("GeometryNodeBoolean"),
         NodeItem("GeometryNodeJoinGeometry"),
+        NodeItem("GeometryNodeSampleTexture"),
     ]),
     GeometryNodeCategory("GEO_INPUT", "Input", items=[
         NodeItem("GeometryNodeObjectInfo"),
diff --git a/source/blender/blenkernel/BKE_node.h b/source/blender/blenkernel/BKE_node.h
index 77a1d3989b0..7add346a9b4 100644
--- a/source/blender/blenkernel/BKE_node.h
+++ b/source/blender/blenkernel/BKE_node.h
@@ -1352,6 +1352,7 @@ int ntreeTexExecTree(struct bNodeTree *ntree,
 #define GEO_NODE_JOIN_GEOMETRY 1010
 #define GEO_NODE_ATTRIBUTE_FILL 1011
 #define GEO_NODE_ATTRIBUTE_MIX 1012
+#define GEO_NODE_SAMPLE_TEXTURE 1013
 
 /** \} */
 
diff --git a/source/blender/blenkernel/intern/node.c b/source/blender/blenkernel/intern/node.c
index 87997198334..f50af18c1a3 100644
--- a/source/blender/blenkernel/intern/node.c
+++ b/source/blender/blenkernel/intern/node.c
@@ -4741,6 +4741,7 @@ static void registerGeometryNodes(void)
   register_node_type_geo_attribute_math();
   register_node_type_geo_join_geometry();
   register_node_type_geo_attribute_mix();
+  register_node_type_geo_sample_texture();
 }
 
 static void registerFunctionNodes(void)
diff --git a/source/blender/nodes/CMakeLists.txt b/source/blender/nodes/CMakeLists.txt
index 11852f6f723..9412e1ced97 100644
--- a/source/blender/nodes/CMakeLists.txt
+++ b/source/blender/nodes/CMakeLists.txt
@@ -149,6 +149,7 @@ set(SRC
   geometry/nodes/node_geo_point_distribute.cc
   geometry/nodes/node_geo_point_instance.cc
   geometry/nodes/node_geo_random_attribute.cc
+  geometry/nodes/node_geo_sample_texture.cc
   geometry/nodes/node_geo_subdivision_surface.cc
   geometry/nodes/node_geo_transform.cc
   geometry/nodes/node_geo_triangulate.cc
diff --git a/source/blender/nodes/NOD_geometry.h b/source/blender/nodes/NOD_geometry.h
index e3ec0451832..aa068a7ed8f 100644
--- a/source/blender/nodes/NOD_geometry.h
+++ b/source/blender/nodes/NOD_geometry.h
@@ -39,6 +39,7 @@ 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_sample_texture(void);
 
 #ifdef __cplusplus
 }
diff --git a/source/blender/nodes/NOD_static_types.h b/source/blender/nodes/NOD_static_types.h
index 491f49cf425..346a93e4f56 100644
--- a/source/blender/nodes/NOD_static_types.h
+++ b/source/blender/nodes/NOD_static_types.h
@@ -279,6 +279,7 @@ DefNode(GeometryNode, GEO_NODE_ATTRIBUTE_MATH, def_geo_attribute_math, "ATTRIBUT
 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_SAMPLE_TEXTURE, 0, "SAMPLE_TEXTURE", SampleTexture, "Sample Texture", "")
 
 /* undefine macros */
 #undef DefNode
diff --git a/source/blender/nodes/geometry/nodes/node_geo_sample_texture.cc b/source/blender/nodes/geometry/nodes/node_geo_sample_texture.cc
new file mode 100644
index 00000000000..bd2f1ab661e
--- /dev/null
+++ b/source/blender/nodes/geometry/nodes/node_geo_sample_texture.cc
@@ -0,0 +1,47 @@
+/*
+ * 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"
+
+static bNodeSocketTemplate geo_node_sample_texture_in[] = {
+    {SOCK_GEOMETRY, N_("Geometry")},
+    {SOCK_STRING, N_("Result")},
+    {-1, ""},
+};
+
+static bNodeSocketTemplate geo_node_sample_texture_out[] = {
+    {SOCK_GEOMETRY, N_("Geometry")},
+    {-1, ""},
+};
+
+namespace blender::nodes {
+
+static void geo_node_sample_texture_exec(GeoNodeExecParams params)
+{
+  GeometrySet geometry_set = params.extract_input<GeometrySet>("Geometry");
+  params.set_output("Geometry", geometry_set);
+}
+}  // namespace blender::nodes
+
+void register_node_type_geo_sample_texture()
+{
+  static bNodeType ntype;
+
+  geo_node_type_base(&ntype, GEO_NODE_SAMPLE_TEXTURE, "Sample Texture", NODE_CLASS_GEOMETRY, 0);
+  node_type_socket_templates(&ntype, geo_node_sample_texture_in, geo_node_sample_texture_out);
+  ntype.geometry_node_execute = blender::nodes::geo_node_sample_texture_exec;
+  nodeRegisterType(&ntype);
+}



More information about the Bf-blender-cvs mailing list