[Bf-blender-cvs] [cf2933c38a3] master: Add 'foreach_nodeclass' for geometry nodetrees

Philipp Oeser noreply at git.blender.org
Wed Mar 10 17:04:45 CET 2021


Commit: cf2933c38a34b16bf00f7e888374a8f51d10a1ee
Author: Philipp Oeser
Date:   Tue Mar 9 18:33:33 2021 +0100
Branches: master
https://developer.blender.org/rBcf2933c38a34b16bf00f7e888374a8f51d10a1ee

Add 'foreach_nodeclass' for geometry nodetrees

This way we get a choice when we click on node links in the Properties
Editor.

This also changes some of the more permissive poll functions on some
nodes back to being "shading-only" (these were made permissive in
rBb78f2675d7e5 for simulation nodes, but have not found their way into
geometry nodes yet).

ref b279fef85d1a / T86416 / D10671

Maniphest Tasks: T86416

Differential Revision: https://developer.blender.org/D10673

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

M	source/blender/nodes/geometry/node_geometry_tree.cc
M	source/blender/nodes/shader/nodes/node_shader_brightness.c
M	source/blender/nodes/shader/nodes/node_shader_gamma.c
M	source/blender/nodes/shader/nodes/node_shader_hueSatVal.c
M	source/blender/nodes/shader/nodes/node_shader_invert.c
M	source/blender/nodes/shader/nodes/node_shader_mixRgb.c
M	source/blender/nodes/shader/nodes/node_shader_sepcombHSV.c
M	source/blender/nodes/shader/nodes/node_shader_tex_noise.c
M	source/blender/nodes/shader/nodes/node_shader_tex_white_noise.c
M	source/blender/nodes/shader/nodes/node_shader_value.cc

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

diff --git a/source/blender/nodes/geometry/node_geometry_tree.cc b/source/blender/nodes/geometry/node_geometry_tree.cc
index 87178c52ab9..2c4c7da64cc 100644
--- a/source/blender/nodes/geometry/node_geometry_tree.cc
+++ b/source/blender/nodes/geometry/node_geometry_tree.cc
@@ -71,6 +71,17 @@ static void geometry_node_tree_update(bNodeTree *ntree)
   ntree_update_reroute_nodes(ntree);
 }
 
+static void foreach_nodeclass(Scene *UNUSED(scene), void *calldata, bNodeClassCallback func)
+{
+  func(calldata, NODE_CLASS_INPUT, N_("Input"));
+  func(calldata, NODE_CLASS_GEOMETRY, N_("Geometry"));
+  func(calldata, NODE_CLASS_ATTRIBUTE, N_("Attribute"));
+  func(calldata, NODE_CLASS_OP_COLOR, N_("Color"));
+  func(calldata, NODE_CLASS_OP_VECTOR, N_("Vector"));
+  func(calldata, NODE_CLASS_CONVERTOR, N_("Convertor"));
+  func(calldata, NODE_CLASS_LAYOUT, N_("Layout"));
+}
+
 void register_node_tree_type_geo(void)
 {
   bNodeTreeType *tt = ntreeType_Geometry = static_cast<bNodeTreeType *>(
@@ -83,6 +94,7 @@ void register_node_tree_type_geo(void)
   tt->rna_ext.srna = &RNA_GeometryNodeTree;
   tt->update = geometry_node_tree_update;
   tt->get_from_context = geometry_node_tree_get_from_context;
+  tt->foreach_nodeclass = foreach_nodeclass;
 
   ntreeTypeAdd(tt);
 }
diff --git a/source/blender/nodes/shader/nodes/node_shader_brightness.c b/source/blender/nodes/shader/nodes/node_shader_brightness.c
index cc1968cb1b1..d8f560277f2 100644
--- a/source/blender/nodes/shader/nodes/node_shader_brightness.c
+++ b/source/blender/nodes/shader/nodes/node_shader_brightness.c
@@ -46,7 +46,7 @@ void register_node_type_sh_brightcontrast(void)
 {
   static bNodeType ntype;
 
-  sh_fn_node_type_base(&ntype, SH_NODE_BRIGHTCONTRAST, "Bright/Contrast", NODE_CLASS_OP_COLOR, 0);
+  sh_node_type_base(&ntype, SH_NODE_BRIGHTCONTRAST, "Bright/Contrast", NODE_CLASS_OP_COLOR, 0);
   node_type_socket_templates(&ntype, sh_node_brightcontrast_in, sh_node_brightcontrast_out);
   node_type_init(&ntype, NULL);
   node_type_storage(&ntype, "", NULL, NULL);
diff --git a/source/blender/nodes/shader/nodes/node_shader_gamma.c b/source/blender/nodes/shader/nodes/node_shader_gamma.c
index 747979522d1..b48838e5f56 100644
--- a/source/blender/nodes/shader/nodes/node_shader_gamma.c
+++ b/source/blender/nodes/shader/nodes/node_shader_gamma.c
@@ -62,7 +62,7 @@ void register_node_type_sh_gamma(void)
 {
   static bNodeType ntype;
 
-  sh_fn_node_type_base(&ntype, SH_NODE_GAMMA, "Gamma", NODE_CLASS_OP_COLOR, 0);
+  sh_node_type_base(&ntype, SH_NODE_GAMMA, "Gamma", NODE_CLASS_OP_COLOR, 0);
   node_type_socket_templates(&ntype, sh_node_gamma_in, sh_node_gamma_out);
   node_type_init(&ntype, NULL);
   node_type_storage(&ntype, "", NULL, NULL);
diff --git a/source/blender/nodes/shader/nodes/node_shader_hueSatVal.c b/source/blender/nodes/shader/nodes/node_shader_hueSatVal.c
index 57ef51c65f6..7a05fc95eec 100644
--- a/source/blender/nodes/shader/nodes/node_shader_hueSatVal.c
+++ b/source/blender/nodes/shader/nodes/node_shader_hueSatVal.c
@@ -89,7 +89,7 @@ void register_node_type_sh_hue_sat(void)
 {
   static bNodeType ntype;
 
-  sh_fn_node_type_base(&ntype, SH_NODE_HUE_SAT, "Hue Saturation Value", NODE_CLASS_OP_COLOR, 0);
+  sh_node_type_base(&ntype, SH_NODE_HUE_SAT, "Hue Saturation Value", NODE_CLASS_OP_COLOR, 0);
   node_type_socket_templates(&ntype, sh_node_hue_sat_in, sh_node_hue_sat_out);
   node_type_size_preset(&ntype, NODE_SIZE_MIDDLE);
   node_type_exec(&ntype, NULL, NULL, node_shader_exec_hue_sat);
diff --git a/source/blender/nodes/shader/nodes/node_shader_invert.c b/source/blender/nodes/shader/nodes/node_shader_invert.c
index 19fa0b0309d..0d6709a1968 100644
--- a/source/blender/nodes/shader/nodes/node_shader_invert.c
+++ b/source/blender/nodes/shader/nodes/node_shader_invert.c
@@ -69,7 +69,7 @@ void register_node_type_sh_invert(void)
 {
   static bNodeType ntype;
 
-  sh_fn_node_type_base(&ntype, SH_NODE_INVERT, "Invert", NODE_CLASS_OP_COLOR, 0);
+  sh_node_type_base(&ntype, SH_NODE_INVERT, "Invert", NODE_CLASS_OP_COLOR, 0);
   node_type_socket_templates(&ntype, sh_node_invert_in, sh_node_invert_out);
   node_type_exec(&ntype, NULL, NULL, node_shader_exec_invert);
   node_type_gpu(&ntype, gpu_shader_invert);
diff --git a/source/blender/nodes/shader/nodes/node_shader_mixRgb.c b/source/blender/nodes/shader/nodes/node_shader_mixRgb.c
index 8725122b12c..090c6216224 100644
--- a/source/blender/nodes/shader/nodes/node_shader_mixRgb.c
+++ b/source/blender/nodes/shader/nodes/node_shader_mixRgb.c
@@ -106,7 +106,7 @@ void register_node_type_sh_mix_rgb(void)
 {
   static bNodeType ntype;
 
-  sh_fn_node_type_base(&ntype, SH_NODE_MIX_RGB, "Mix", NODE_CLASS_OP_COLOR, 0);
+  sh_node_type_base(&ntype, SH_NODE_MIX_RGB, "Mix", NODE_CLASS_OP_COLOR, 0);
   node_type_socket_templates(&ntype, sh_node_mix_rgb_in, sh_node_mix_rgb_out);
   node_type_label(&ntype, node_blend_label);
   node_type_exec(&ntype, NULL, NULL, node_shader_exec_mix_rgb);
diff --git a/source/blender/nodes/shader/nodes/node_shader_sepcombHSV.c b/source/blender/nodes/shader/nodes/node_shader_sepcombHSV.c
index 2c9b77530a2..951755be4f3 100644
--- a/source/blender/nodes/shader/nodes/node_shader_sepcombHSV.c
+++ b/source/blender/nodes/shader/nodes/node_shader_sepcombHSV.c
@@ -61,7 +61,7 @@ void register_node_type_sh_sephsv(void)
 {
   static bNodeType ntype;
 
-  sh_fn_node_type_base(&ntype, SH_NODE_SEPHSV, "Separate HSV", NODE_CLASS_CONVERTOR, 0);
+  sh_node_type_base(&ntype, SH_NODE_SEPHSV, "Separate HSV", NODE_CLASS_CONVERTOR, 0);
   node_type_socket_templates(&ntype, sh_node_sephsv_in, sh_node_sephsv_out);
   node_type_exec(&ntype, NULL, NULL, node_shader_exec_sephsv);
   node_type_gpu(&ntype, gpu_shader_sephsv);
@@ -109,7 +109,7 @@ void register_node_type_sh_combhsv(void)
 {
   static bNodeType ntype;
 
-  sh_fn_node_type_base(&ntype, SH_NODE_COMBHSV, "Combine HSV", NODE_CLASS_CONVERTOR, 0);
+  sh_node_type_base(&ntype, SH_NODE_COMBHSV, "Combine HSV", NODE_CLASS_CONVERTOR, 0);
   node_type_socket_templates(&ntype, sh_node_combhsv_in, sh_node_combhsv_out);
   node_type_exec(&ntype, NULL, NULL, node_shader_exec_combhsv);
   node_type_gpu(&ntype, gpu_shader_combhsv);
diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_noise.c b/source/blender/nodes/shader/nodes/node_shader_tex_noise.c
index 67268c102c5..7b67c2d1f2e 100644
--- a/source/blender/nodes/shader/nodes/node_shader_tex_noise.c
+++ b/source/blender/nodes/shader/nodes/node_shader_tex_noise.c
@@ -91,7 +91,7 @@ void register_node_type_sh_tex_noise(void)
 {
   static bNodeType ntype;
 
-  sh_fn_node_type_base(&ntype, SH_NODE_TEX_NOISE, "Noise Texture", NODE_CLASS_TEXTURE, 0);
+  sh_node_type_base(&ntype, SH_NODE_TEX_NOISE, "Noise Texture", NODE_CLASS_TEXTURE, 0);
   node_type_socket_templates(&ntype, sh_node_tex_noise_in, sh_node_tex_noise_out);
   node_type_init(&ntype, node_shader_init_tex_noise);
   node_type_storage(
diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_white_noise.c b/source/blender/nodes/shader/nodes/node_shader_tex_white_noise.c
index 56ecb6d4476..60a3392c761 100644
--- a/source/blender/nodes/shader/nodes/node_shader_tex_white_noise.c
+++ b/source/blender/nodes/shader/nodes/node_shader_tex_white_noise.c
@@ -71,8 +71,7 @@ void register_node_type_sh_tex_white_noise(void)
 {
   static bNodeType ntype;
 
-  sh_fn_node_type_base(
-      &ntype, SH_NODE_TEX_WHITE_NOISE, "White Noise Texture", NODE_CLASS_TEXTURE, 0);
+  sh_node_type_base(&ntype, SH_NODE_TEX_WHITE_NOISE, "White Noise Texture", NODE_CLASS_TEXTURE, 0);
   node_type_socket_templates(&ntype, sh_node_tex_white_noise_in, sh_node_tex_white_noise_out);
   node_type_init(&ntype, node_shader_init_tex_white_noise);
   node_type_gpu(&ntype, gpu_shader_tex_white_noise);
diff --git a/source/blender/nodes/shader/nodes/node_shader_value.cc b/source/blender/nodes/shader/nodes/node_shader_value.cc
index 495c8d12824..a1ef65a5655 100644
--- a/source/blender/nodes/shader/nodes/node_shader_value.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_value.cc
@@ -50,7 +50,7 @@ void register_node_type_sh_value(void)
 {
   static bNodeType ntype;
 
-  sh_fn_node_type_base(&ntype, SH_NODE_VALUE, "Value", NODE_CLASS_INPUT, 0);
+  sh_node_type_base(&ntype, SH_NODE_VALUE, "Value", NODE_CLASS_INPUT, 0);
   node_type_socket_templates(&ntype, nullptr, sh_node_value_out);
   node_type_gpu(&ntype, gpu_shader_value);
   ntype.expand_in_mf_network = sh_node_value_expand_in_mf_network;



More information about the Bf-blender-cvs mailing list