Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClément Foucault <foucault.clem@gmail.com>2022-01-10 15:59:53 +0300
committerClément Foucault <foucault.clem@gmail.com>2022-01-10 15:59:53 +0300
commita6fcfe5174ccba9600afdd4b15f434157072e418 (patch)
treebbad5f570038b08dd4227c797b05e86ebaabb581 /source/blender/nodes/shader
parentd55eaefa8f065b210ca8ccef56ff4f3f47d9c2aa (diff)
parentfaeab8367c68356c1defa7db78cb841c087faa45 (diff)
Merge branch 'master' into tmp-vector-template
# Conflicts: # source/blender/blenlib/BLI_float2.hh # source/blender/blenlib/BLI_float3.hh # source/blender/blenlib/BLI_float4.hh
Diffstat (limited to 'source/blender/nodes/shader')
-rw-r--r--source/blender/nodes/shader/node_shader_tree.cc4
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_ambient_occlusion.cc13
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_attribute.cc30
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_background.cc21
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_bevel.cc27
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_brightness.cc23
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_bsdf_anisotropic.cc44
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_bsdf_diffuse.cc27
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_bsdf_glass.cc29
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_bsdf_glossy.cc27
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_bsdf_hair.cc46
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_bsdf_hair_principled.cc96
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_bsdf_principled.cc163
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_bsdf_refraction.cc29
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_bsdf_toon.cc40
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_bsdf_translucent.cc21
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_bsdf_transparent.cc19
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_bsdf_velvet.cc27
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_bump.cc9
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_clamp.cc11
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_color_ramp.cc2
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_common.cc1
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_curves.cc6
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_eevee_specular.cc71
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_emission.cc20
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_fresnel.cc19
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_hair_info.cc22
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_hueSatVal.cc24
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_ies_light.cc37
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_invert.cc15
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_layer_weight.cc23
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_light_falloff.cc27
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_light_path.cc36
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_map_range.cc17
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_mapping.cc45
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_math.cc2
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_mix_rgb.cc2
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_mix_shader.cc2
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_normal.cc27
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_normal_map.cc42
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_output_aov.cc11
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_output_light.cc2
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_output_linestyle.cc16
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_output_material.cc2
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_output_world.cc2
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_particle_info.cc2
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_rgb_to_bw.cc2
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_script.cc37
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_sepcomb_hsv.cc40
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_sepcomb_rgb.cc4
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_sepcomb_xyz.cc4
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_shader_to_rgb.cc2
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_squeeze.cc17
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_subsurface_scattering.cc46
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_tangent.cc34
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_tex_brick.cc26
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_tex_checker.cc2
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_tex_coord.cc36
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_tex_environment.cc19
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_tex_gradient.cc11
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_tex_image.cc2
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_tex_magic.cc11
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_tex_musgrave.cc12
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_tex_noise.cc11
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_tex_pointdensity.cc67
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_tex_sky.cc61
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_tex_voronoi.cc17
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_tex_wave.cc20
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_tex_white_noise.cc11
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_uv_along_stroke.cc9
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_uvmap.cc20
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_value.cc2
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_vector_math.cc11
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_vector_rotate.cc12
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_vector_transform.cc33
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_vertex_color.cc26
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_volume_absorption.cc21
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_volume_principled.cc49
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_wireframe.cc9
79 files changed, 1191 insertions, 674 deletions
diff --git a/source/blender/nodes/shader/node_shader_tree.cc b/source/blender/nodes/shader/node_shader_tree.cc
index 0fa977aa63c..8f1bb1dcd9a 100644
--- a/source/blender/nodes/shader/node_shader_tree.cc
+++ b/source/blender/nodes/shader/node_shader_tree.cc
@@ -665,8 +665,8 @@ static bNode *ntree_shader_copy_branch(bNodeTree *ntree,
LISTBASE_FOREACH (bNode *, node, &ntree->nodes) {
if (node->tmp_flag >= 0) {
int id = node->tmp_flag;
- nodes_copy[id] = BKE_node_copy(
- ntree, node, LIB_ID_CREATE_NO_USER_REFCOUNT | LIB_ID_CREATE_NO_MAIN, false);
+ nodes_copy[id] = blender::bke::node_copy(
+ ntree, *node, LIB_ID_CREATE_NO_USER_REFCOUNT | LIB_ID_CREATE_NO_MAIN, false);
nodes_copy[id]->tmp_flag = -2; /* Copy */
/* Make sure to clear all sockets links as they are invalid. */
LISTBASE_FOREACH (bNodeSocket *, sock, &nodes_copy[id]->inputs) {
diff --git a/source/blender/nodes/shader/nodes/node_shader_ambient_occlusion.cc b/source/blender/nodes/shader/nodes/node_shader_ambient_occlusion.cc
index 73f0e515a46..9c64594aab8 100644
--- a/source/blender/nodes/shader/nodes/node_shader_ambient_occlusion.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_ambient_occlusion.cc
@@ -19,6 +19,9 @@
#include "node_shader_util.hh"
+#include "UI_interface.h"
+#include "UI_resources.h"
+
namespace blender::nodes::node_shader_ambient_occlusion_cc {
static void node_declare(NodeDeclarationBuilder &b)
@@ -30,6 +33,15 @@ static void node_declare(NodeDeclarationBuilder &b)
b.add_output<decl::Float>(N_("AO"));
}
+static void node_shader_buts_ambient_occlusion(uiLayout *layout,
+ bContext *UNUSED(C),
+ PointerRNA *ptr)
+{
+ uiItemR(layout, ptr, "samples", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE);
+ uiItemR(layout, ptr, "inside", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE);
+ uiItemR(layout, ptr, "only_local", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE);
+}
+
static int node_shader_gpu_ambient_occlusion(GPUMaterial *mat,
bNode *node,
bNodeExecData *UNUSED(execdata),
@@ -71,6 +83,7 @@ void register_node_type_sh_ambient_occlusion()
sh_node_type_base(&ntype, SH_NODE_AMBIENT_OCCLUSION, "Ambient Occlusion", NODE_CLASS_INPUT);
ntype.declare = file_ns::node_declare;
+ ntype.draw_buttons = file_ns::node_shader_buts_ambient_occlusion;
node_type_init(&ntype, file_ns::node_shader_init_ambient_occlusion);
node_type_gpu(&ntype, file_ns::node_shader_gpu_ambient_occlusion);
diff --git a/source/blender/nodes/shader/nodes/node_shader_attribute.cc b/source/blender/nodes/shader/nodes/node_shader_attribute.cc
index 780d0a72ef8..cf1b49ba29c 100644
--- a/source/blender/nodes/shader/nodes/node_shader_attribute.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_attribute.cc
@@ -19,17 +19,24 @@
#include "node_shader_util.hh"
+#include "UI_interface.h"
+#include "UI_resources.h"
+
namespace blender::nodes::node_shader_attribute_cc {
-/* **************** OUTPUT ******************** */
+static void node_declare(NodeDeclarationBuilder &b)
+{
+ b.add_output<decl::Color>(N_("Color"));
+ b.add_output<decl::Vector>(N_("Vector"));
+ b.add_output<decl::Float>(N_("Fac"));
+ b.add_output<decl::Float>(N_("Alpha"));
+}
-static bNodeSocketTemplate sh_node_attribute_out[] = {
- {SOCK_RGBA, N_("Color")},
- {SOCK_VECTOR, N_("Vector"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
- {SOCK_FLOAT, N_("Fac"), 0.0f, 0.0f, 0.0f, 0.0f, -FLT_MAX, FLT_MAX, PROP_FACTOR},
- {SOCK_FLOAT, N_("Alpha"), 0.0f, 0.0f, 0.0f, 0.0f, -FLT_MAX, FLT_MAX, PROP_FACTOR},
- {-1, ""},
-};
+static void node_shader_buts_attribute(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
+{
+ uiItemR(layout, ptr, "attribute_type", UI_ITEM_R_SPLIT_EMPTY_NAME, IFACE_("Type"), ICON_NONE);
+ uiItemR(layout, ptr, "attribute_name", UI_ITEM_R_SPLIT_EMPTY_NAME, IFACE_("Name"), ICON_NONE);
+}
static void node_shader_init_attribute(bNodeTree *UNUSED(ntree), bNode *node)
{
@@ -75,8 +82,8 @@ static int node_shader_gpu_attribute(GPUMaterial *mat,
GPU_stack_link(mat, node, "node_attribute", in, out, cd_attr);
- /* for each output. */
- for (int i = 0; sh_node_attribute_out[i].type != -1; i++) {
+ int i;
+ LISTBASE_FOREACH_INDEX (bNodeSocket *, sock, &node->outputs, i) {
node_shader_gpu_bump_tex_coord(mat, node, &out[i].link);
}
@@ -93,7 +100,8 @@ void register_node_type_sh_attribute()
static bNodeType ntype;
sh_node_type_base(&ntype, SH_NODE_ATTRIBUTE, "Attribute", NODE_CLASS_INPUT);
- node_type_socket_templates(&ntype, nullptr, file_ns::sh_node_attribute_out);
+ ntype.declare = file_ns::node_declare;
+ ntype.draw_buttons = file_ns::node_shader_buts_attribute;
node_type_init(&ntype, file_ns::node_shader_init_attribute);
node_type_storage(
&ntype, "NodeShaderAttribute", node_free_standard_storage, node_copy_standard_storage);
diff --git a/source/blender/nodes/shader/nodes/node_shader_background.cc b/source/blender/nodes/shader/nodes/node_shader_background.cc
index 39858e36fd1..3b9e71cf842 100644
--- a/source/blender/nodes/shader/nodes/node_shader_background.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_background.cc
@@ -21,18 +21,12 @@
namespace blender::nodes::node_shader_background_cc {
-/* **************** OUTPUT ******************** */
-
-static bNodeSocketTemplate sh_node_background_in[] = {
- {SOCK_RGBA, N_("Color"), 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f},
- {SOCK_FLOAT, N_("Strength"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1000000.0f},
- {-1, ""},
-};
-
-static bNodeSocketTemplate sh_node_background_out[] = {
- {SOCK_SHADER, N_("Background")},
- {-1, ""},
-};
+static void node_declare(NodeDeclarationBuilder &b)
+{
+ b.add_input<decl::Color>(N_("Color")).default_value({0.8f, 0.8f, 0.8f, 1.0f});
+ b.add_input<decl::Float>(N_("Strength")).default_value(1.0f).min(0.0f).max(1000000.0f);
+ b.add_output<decl::Shader>(N_("Background"));
+}
static int node_shader_gpu_background(GPUMaterial *mat,
bNode *node,
@@ -53,8 +47,7 @@ void register_node_type_sh_background()
static bNodeType ntype;
sh_node_type_base(&ntype, SH_NODE_BACKGROUND, "Background", NODE_CLASS_SHADER);
- node_type_socket_templates(
- &ntype, file_ns::sh_node_background_in, file_ns::sh_node_background_out);
+ ntype.declare = file_ns::node_declare;
node_type_gpu(&ntype, file_ns::node_shader_gpu_background);
nodeRegisterType(&ntype);
diff --git a/source/blender/nodes/shader/nodes/node_shader_bevel.cc b/source/blender/nodes/shader/nodes/node_shader_bevel.cc
index a3063358556..c4fa61753f5 100644
--- a/source/blender/nodes/shader/nodes/node_shader_bevel.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_bevel.cc
@@ -19,20 +19,22 @@
#include "node_shader_util.hh"
-namespace blender::nodes::node_shader_bevel_cc {
+#include "UI_interface.h"
+#include "UI_resources.h"
-/* **************** OUTPUT ******************** */
+namespace blender::nodes::node_shader_bevel_cc {
-static bNodeSocketTemplate sh_node_bevel_in[] = {
- {SOCK_FLOAT, N_("Radius"), 0.05f, 0.0f, 0.0f, 0.0f, 0.0f, 1000.0f},
- {SOCK_VECTOR, N_("Normal"), 0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE},
- {-1, ""},
-};
+static void node_declare(NodeDeclarationBuilder &b)
+{
+ b.add_input<decl::Float>(N_("Radius")).default_value(0.05f).min(0.0f).max(1000.0f);
+ b.add_input<decl::Vector>(N_("Normal")).hide_value();
+ b.add_output<decl::Vector>(N_("Normal"));
+}
-static bNodeSocketTemplate sh_node_bevel_out[] = {
- {SOCK_VECTOR, N_("Normal"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
- {-1, ""},
-};
+static void node_shader_buts_bevel(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
+{
+ uiItemR(layout, ptr, "samples", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE);
+}
static void node_shader_init_bevel(bNodeTree *UNUSED(ntree), bNode *node)
{
@@ -66,7 +68,8 @@ void register_node_type_sh_bevel()
static bNodeType ntype;
sh_node_type_base(&ntype, SH_NODE_BEVEL, "Bevel", NODE_CLASS_INPUT);
- node_type_socket_templates(&ntype, file_ns::sh_node_bevel_in, file_ns::sh_node_bevel_out);
+ ntype.declare = file_ns::node_declare;
+ ntype.draw_buttons = file_ns::node_shader_buts_bevel;
node_type_init(&ntype, file_ns::node_shader_init_bevel);
node_type_gpu(&ntype, file_ns::gpu_shader_bevel);
diff --git a/source/blender/nodes/shader/nodes/node_shader_brightness.cc b/source/blender/nodes/shader/nodes/node_shader_brightness.cc
index e6328c4972a..66bfaba2785 100644
--- a/source/blender/nodes/shader/nodes/node_shader_brightness.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_brightness.cc
@@ -21,19 +21,13 @@
namespace blender::nodes::node_shader_brightness_cc {
-/* **************** Bright and contrast ******************** */
-
-static bNodeSocketTemplate sh_node_brightcontrast_in[] = {
- {SOCK_RGBA, N_("Color"), 1.0f, 1.0f, 1.0f, 1.0f},
- {SOCK_FLOAT, N_("Bright"), 0.0f, 0.0f, 0.0f, 0.0f, -100.0f, 100.0f, PROP_NONE},
- {SOCK_FLOAT, N_("Contrast"), 0.0f, 0.0f, 0.0f, 0.0f, -100.0f, 100.0f, PROP_NONE},
- {-1, ""},
-};
-
-static bNodeSocketTemplate sh_node_brightcontrast_out[] = {
- {SOCK_RGBA, N_("Color")},
- {-1, ""},
-};
+static void node_declare(NodeDeclarationBuilder &b)
+{
+ b.add_input<decl::Color>(N_("Color")).default_value({1.0f, 1.0f, 1.0f, 1.0f});
+ b.add_input<decl::Float>(N_("Bright")).default_value(0.0f).min(-100.0f).max(100.0f);
+ b.add_input<decl::Float>(N_("Contrast")).default_value(0.0f).min(-100.0f).max(100.0f);
+ b.add_output<decl::Color>(N_("Color"));
+}
static int gpu_shader_brightcontrast(GPUMaterial *mat,
bNode *node,
@@ -53,8 +47,7 @@ void register_node_type_sh_brightcontrast()
static bNodeType ntype;
sh_node_type_base(&ntype, SH_NODE_BRIGHTCONTRAST, "Bright/Contrast", NODE_CLASS_OP_COLOR);
- node_type_socket_templates(
- &ntype, file_ns::sh_node_brightcontrast_in, file_ns::sh_node_brightcontrast_out);
+ ntype.declare = file_ns::node_declare;
node_type_gpu(&ntype, file_ns::gpu_shader_brightcontrast);
nodeRegisterType(&ntype);
diff --git a/source/blender/nodes/shader/nodes/node_shader_bsdf_anisotropic.cc b/source/blender/nodes/shader/nodes/node_shader_bsdf_anisotropic.cc
index 2e698aeb4d7..3f0749ab2af 100644
--- a/source/blender/nodes/shader/nodes/node_shader_bsdf_anisotropic.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_bsdf_anisotropic.cc
@@ -19,24 +19,34 @@
#include "node_shader_util.hh"
-namespace blender::nodes::node_shader_bsdf_anisotropic_cc {
+#include "UI_interface.h"
+#include "UI_resources.h"
-/* **************** OUTPUT ******************** */
+namespace blender::nodes::node_shader_bsdf_anisotropic_cc {
-static bNodeSocketTemplate sh_node_bsdf_anisotropic_in[] = {
- {SOCK_RGBA, N_("Color"), 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f},
- {SOCK_FLOAT, N_("Roughness"), 0.5f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR},
- {SOCK_FLOAT, N_("Anisotropy"), 0.5f, 0.0f, 0.0f, 0.0f, -1.0f, 1.0f},
- {SOCK_FLOAT, N_("Rotation"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR},
- {SOCK_VECTOR, N_("Normal"), 0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE},
- {SOCK_VECTOR, N_("Tangent"), 0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE},
- {-1, ""},
-};
+static void node_declare(NodeDeclarationBuilder &b)
+{
+ b.add_input<decl::Color>(N_("Color")).default_value({0.8f, 0.8f, 0.8f, 1.0f});
+ b.add_input<decl::Float>(N_("Roughness"))
+ .default_value(0.5f)
+ .min(0.0f)
+ .max(1.0f)
+ .subtype(PROP_FACTOR);
+ b.add_input<decl::Float>(N_("Anisotropy")).default_value(0.5f).min(-1.0f).max(1.0f);
+ b.add_input<decl::Float>(N_("Rotation"))
+ .default_value(0.0f)
+ .min(0.0f)
+ .max(1.0f)
+ .subtype(PROP_FACTOR);
+ b.add_input<decl::Vector>(N_("Normal")).hide_value();
+ b.add_input<decl::Vector>(N_("Tangent")).hide_value();
+ b.add_output<decl::Shader>(N_("BSDF"));
+}
-static bNodeSocketTemplate sh_node_bsdf_anisotropic_out[] = {
- {SOCK_SHADER, N_("BSDF")},
- {-1, ""},
-};
+static void node_shader_buts_anisotropic(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
+{
+ uiItemR(layout, ptr, "distribution", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE);
+}
static void node_shader_init_anisotropic(bNodeTree *UNUSED(ntree), bNode *node)
{
@@ -76,8 +86,8 @@ void register_node_type_sh_bsdf_anisotropic()
static bNodeType ntype;
sh_node_type_base(&ntype, SH_NODE_BSDF_ANISOTROPIC, "Anisotropic BSDF", NODE_CLASS_SHADER);
- node_type_socket_templates(
- &ntype, file_ns::sh_node_bsdf_anisotropic_in, file_ns::sh_node_bsdf_anisotropic_out);
+ ntype.declare = file_ns::node_declare;
+ ntype.draw_buttons = file_ns::node_shader_buts_anisotropic;
node_type_size_preset(&ntype, NODE_SIZE_MIDDLE);
node_type_init(&ntype, file_ns::node_shader_init_anisotropic);
node_type_gpu(&ntype, file_ns::node_shader_gpu_bsdf_anisotropic);
diff --git a/source/blender/nodes/shader/nodes/node_shader_bsdf_diffuse.cc b/source/blender/nodes/shader/nodes/node_shader_bsdf_diffuse.cc
index 3719227f46c..5848ca76cdd 100644
--- a/source/blender/nodes/shader/nodes/node_shader_bsdf_diffuse.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_bsdf_diffuse.cc
@@ -21,19 +21,17 @@
namespace blender::nodes::node_shader_bsdf_diffuse_cc {
-/* **************** OUTPUT ******************** */
-
-static bNodeSocketTemplate sh_node_bsdf_diffuse_in[] = {
- {SOCK_RGBA, N_("Color"), 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f},
- {SOCK_FLOAT, N_("Roughness"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR},
- {SOCK_VECTOR, N_("Normal"), 0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE},
- {-1, ""},
-};
-
-static bNodeSocketTemplate sh_node_bsdf_diffuse_out[] = {
- {SOCK_SHADER, N_("BSDF")},
- {-1, ""},
-};
+static void node_declare(NodeDeclarationBuilder &b)
+{
+ b.add_input<decl::Color>(N_("Color")).default_value({0.8f, 0.8f, 0.8f, 1.0f});
+ b.add_input<decl::Float>(N_("Roughness"))
+ .default_value(0.0f)
+ .min(0.0f)
+ .max(1.0f)
+ .subtype(PROP_FACTOR);
+ b.add_input<decl::Vector>(N_("Normal")).hide_value();
+ b.add_output<decl::Shader>(N_("BSDF"));
+}
static int node_shader_gpu_bsdf_diffuse(GPUMaterial *mat,
bNode *node,
@@ -60,8 +58,7 @@ void register_node_type_sh_bsdf_diffuse()
static bNodeType ntype;
sh_node_type_base(&ntype, SH_NODE_BSDF_DIFFUSE, "Diffuse BSDF", NODE_CLASS_SHADER);
- node_type_socket_templates(
- &ntype, file_ns::sh_node_bsdf_diffuse_in, file_ns::sh_node_bsdf_diffuse_out);
+ ntype.declare = file_ns::node_declare;
node_type_size_preset(&ntype, NODE_SIZE_MIDDLE);
node_type_gpu(&ntype, file_ns::node_shader_gpu_bsdf_diffuse);
diff --git a/source/blender/nodes/shader/nodes/node_shader_bsdf_glass.cc b/source/blender/nodes/shader/nodes/node_shader_bsdf_glass.cc
index 2cea42146fd..47d4b87198b 100644
--- a/source/blender/nodes/shader/nodes/node_shader_bsdf_glass.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_bsdf_glass.cc
@@ -21,20 +21,18 @@
namespace blender::nodes::node_shader_bsdf_glass_cc {
-/* **************** OUTPUT ******************** */
-
-static bNodeSocketTemplate sh_node_bsdf_glass_in[] = {
- {SOCK_RGBA, N_("Color"), 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f},
- {SOCK_FLOAT, N_("Roughness"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR},
- {SOCK_FLOAT, N_("IOR"), 1.45f, 0.0f, 0.0f, 0.0f, 0.0f, 1000.0f},
- {SOCK_VECTOR, N_("Normal"), 0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE},
- {-1, ""},
-};
-
-static bNodeSocketTemplate sh_node_bsdf_glass_out[] = {
- {SOCK_SHADER, N_("BSDF")},
- {-1, ""},
-};
+static void node_declare(NodeDeclarationBuilder &b)
+{
+ b.add_input<decl::Color>(N_("Color")).default_value({1.0f, 1.0f, 1.0f, 1.0f});
+ b.add_input<decl::Float>(N_("Roughness"))
+ .default_value(0.0f)
+ .min(0.0f)
+ .max(1.0f)
+ .subtype(PROP_FACTOR);
+ b.add_input<decl::Float>(N_("IOR")).default_value(1.45f).min(0.0f).max(1000.0f);
+ b.add_input<decl::Vector>(N_("Normal")).hide_value();
+ b.add_output<decl::Shader>(N_("BSDF"));
+}
static void node_shader_init_glass(bNodeTree *UNUSED(ntree), bNode *node)
{
@@ -78,8 +76,7 @@ void register_node_type_sh_bsdf_glass()
static bNodeType ntype;
sh_node_type_base(&ntype, SH_NODE_BSDF_GLASS, "Glass BSDF", NODE_CLASS_SHADER);
- node_type_socket_templates(
- &ntype, file_ns::sh_node_bsdf_glass_in, file_ns::sh_node_bsdf_glass_out);
+ ntype.declare = file_ns::node_declare;
node_type_size_preset(&ntype, NODE_SIZE_MIDDLE);
node_type_init(&ntype, file_ns::node_shader_init_glass);
node_type_gpu(&ntype, file_ns::node_shader_gpu_bsdf_glass);
diff --git a/source/blender/nodes/shader/nodes/node_shader_bsdf_glossy.cc b/source/blender/nodes/shader/nodes/node_shader_bsdf_glossy.cc
index 1227d79af93..03a3e634f56 100644
--- a/source/blender/nodes/shader/nodes/node_shader_bsdf_glossy.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_bsdf_glossy.cc
@@ -21,19 +21,17 @@
namespace blender::nodes::node_shader_bsdf_glossy_cc {
-/* **************** OUTPUT ******************** */
-
-static bNodeSocketTemplate sh_node_bsdf_glossy_in[] = {
- {SOCK_RGBA, N_("Color"), 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f},
- {SOCK_FLOAT, N_("Roughness"), 0.5f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR},
- {SOCK_VECTOR, N_("Normal"), 0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE},
- {-1, ""},
-};
-
-static bNodeSocketTemplate sh_node_bsdf_glossy_out[] = {
- {SOCK_SHADER, N_("BSDF")},
- {-1, ""},
-};
+static void node_declare(NodeDeclarationBuilder &b)
+{
+ b.add_input<decl::Color>(N_("Color")).default_value({0.8f, 0.8f, 0.8f, 1.0f});
+ b.add_input<decl::Float>(N_("Roughness"))
+ .default_value(0.5f)
+ .min(0.0f)
+ .max(1.0f)
+ .subtype(PROP_FACTOR);
+ b.add_input<decl::Vector>(N_("Normal")).hide_value();
+ b.add_output<decl::Shader>(N_("BSDF"));
+}
static void node_shader_init_glossy(bNodeTree *UNUSED(ntree), bNode *node)
{
@@ -77,8 +75,7 @@ void register_node_type_sh_bsdf_glossy()
static bNodeType ntype;
sh_node_type_base(&ntype, SH_NODE_BSDF_GLOSSY, "Glossy BSDF", NODE_CLASS_SHADER);
- node_type_socket_templates(
- &ntype, file_ns::sh_node_bsdf_glossy_in, file_ns::sh_node_bsdf_glossy_out);
+ ntype.declare = file_ns::node_declare;
node_type_size_preset(&ntype, NODE_SIZE_MIDDLE);
node_type_init(&ntype, file_ns::node_shader_init_glossy);
node_type_gpu(&ntype, file_ns::node_shader_gpu_bsdf_glossy);
diff --git a/source/blender/nodes/shader/nodes/node_shader_bsdf_hair.cc b/source/blender/nodes/shader/nodes/node_shader_bsdf_hair.cc
index 56282d1c991..3be2bd22f60 100644
--- a/source/blender/nodes/shader/nodes/node_shader_bsdf_hair.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_bsdf_hair.cc
@@ -19,23 +19,37 @@
#include "node_shader_util.hh"
-namespace blender::nodes::node_shader_bsdf_hair_cc {
+#include "UI_interface.h"
+#include "UI_resources.h"
-/* **************** OUTPUT ******************** */
+namespace blender::nodes::node_shader_bsdf_hair_cc {
-static bNodeSocketTemplate sh_node_bsdf_hair_in[] = {
- {SOCK_RGBA, N_("Color"), 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f},
- {SOCK_FLOAT, N_("Offset"), 0.0f, 0.0f, 0.0f, 0.0f, -M_PI_2, M_PI_2, PROP_ANGLE},
- {SOCK_FLOAT, N_("RoughnessU"), 0.1f, 0.1f, 0.1f, 0.0f, 0.0f, 1.0f, PROP_FACTOR},
- {SOCK_FLOAT, N_("RoughnessV"), 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR},
- {SOCK_VECTOR, N_("Tangent"), 0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE},
- {-1, ""},
-};
+static void node_declare(NodeDeclarationBuilder &b)
+{
+ b.add_input<decl::Color>(N_("Color")).default_value({0.8f, 0.8f, 0.8f, 1.0f});
+ b.add_input<decl::Float>(N_("Offset"))
+ .default_value(0.0f)
+ .min(-M_PI_2)
+ .max(M_PI_2)
+ .subtype(PROP_ANGLE);
+ b.add_input<decl::Float>(N_("RoughnessU"))
+ .default_value(0.1f)
+ .min(0.0f)
+ .max(1.0f)
+ .subtype(PROP_FACTOR);
+ b.add_input<decl::Float>(N_("RoughnessV"))
+ .default_value(1.0f)
+ .min(0.0f)
+ .max(1.0f)
+ .subtype(PROP_FACTOR);
+ b.add_input<decl::Vector>(N_("Tangent")).hide_value();
+ b.add_output<decl::Shader>(N_("BSDF"));
+}
-static bNodeSocketTemplate sh_node_bsdf_hair_out[] = {
- {SOCK_SHADER, N_("BSDF")},
- {-1, ""},
-};
+static void node_shader_buts_hair(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
+{
+ uiItemR(layout, ptr, "component", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE);
+}
static int node_shader_gpu_bsdf_hair(GPUMaterial *mat,
bNode *node,
@@ -56,8 +70,8 @@ void register_node_type_sh_bsdf_hair()
static bNodeType ntype;
sh_node_type_base(&ntype, SH_NODE_BSDF_HAIR, "Hair BSDF", NODE_CLASS_SHADER);
- node_type_socket_templates(
- &ntype, file_ns::sh_node_bsdf_hair_in, file_ns::sh_node_bsdf_hair_out);
+ ntype.declare = file_ns::node_declare;
+ ntype.draw_buttons = file_ns::node_shader_buts_hair;
node_type_size(&ntype, 150, 60, 200);
node_type_gpu(&ntype, file_ns::node_shader_gpu_bsdf_hair);
diff --git a/source/blender/nodes/shader/nodes/node_shader_bsdf_hair_principled.cc b/source/blender/nodes/shader/nodes/node_shader_bsdf_hair_principled.cc
index 16d48144578..7062888b5fb 100644
--- a/source/blender/nodes/shader/nodes/node_shader_bsdf_hair_principled.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_bsdf_hair_principled.cc
@@ -19,40 +19,72 @@
#include "node_shader_util.hh"
-namespace blender::nodes::node_shader_bsdf_hair_principled_cc {
+#include "UI_interface.h"
+#include "UI_resources.h"
-/* **************** OUTPUT ******************** */
+namespace blender::nodes::node_shader_bsdf_hair_principled_cc {
/* Color, melanin and absorption coefficient default to approximately same brownish hair. */
-static bNodeSocketTemplate sh_node_bsdf_hair_principled_in[] = {
- {SOCK_RGBA, N_("Color"), 0.017513f, 0.005763f, 0.002059f, 1.0f, 0.0f, 1.0f},
- {SOCK_FLOAT, N_("Melanin"), 0.8f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR},
- {SOCK_FLOAT, N_("Melanin Redness"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR},
- {SOCK_RGBA, N_("Tint"), 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f},
- {SOCK_VECTOR, N_("Absorption Coefficient"), 0.245531f, 0.52f, 1.365f, 0.0f, 0.0f, 1000.0f},
- {SOCK_FLOAT, N_("Roughness"), 0.3f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR},
- {SOCK_FLOAT, N_("Radial Roughness"), 0.3f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR},
- {SOCK_FLOAT, N_("Coat"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR},
- {SOCK_FLOAT, N_("IOR"), 1.55f, 0.0f, 0.0f, 0.0f, 0.0f, 1000.0f},
- {SOCK_FLOAT,
- N_("Offset"),
- 2.0f * ((float)M_PI) / 180.0f,
- 0.0f,
- 0.0f,
- 0.0f,
- -M_PI_2,
- M_PI_2,
- PROP_ANGLE},
- {SOCK_FLOAT, N_("Random Color"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR},
- {SOCK_FLOAT, N_("Random Roughness"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR},
- {SOCK_FLOAT, N_("Random"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE},
- {-1, ""},
-};
+static void node_declare(NodeDeclarationBuilder &b)
+{
+ b.add_input<decl::Color>(N_("Color")).default_value({0.017513f, 0.005763f, 0.002059f, 1.0f});
+ b.add_input<decl::Float>(N_("Melanin"))
+ .default_value(0.8f)
+ .min(0.0f)
+ .max(1.0f)
+ .subtype(PROP_FACTOR);
+ b.add_input<decl::Float>(N_("Melanin Redness"))
+ .default_value(1.0f)
+ .min(0.0f)
+ .max(1.0f)
+ .subtype(PROP_FACTOR);
+ b.add_input<decl::Color>(N_("Tint")).default_value({1.0f, 1.0f, 1.0f, 1.0f});
+ b.add_input<decl::Vector>(N_("Absorption Coefficient"))
+ .default_value({0.245531f, 0.52f, 1.365f})
+ .min(0.0f)
+ .max(1000.0f);
+ b.add_input<decl::Float>(N_("Roughness"))
+ .default_value(0.3f)
+ .min(0.0f)
+ .max(1.0f)
+ .subtype(PROP_FACTOR);
+ b.add_input<decl::Float>(N_("Radial Roughness"))
+ .default_value(0.3f)
+ .min(0.0f)
+ .max(1.0f)
+ .subtype(PROP_FACTOR);
+ b.add_input<decl::Float>(N_("Coat"))
+ .default_value(0.0f)
+ .min(0.0f)
+ .max(1.0f)
+ .subtype(PROP_FACTOR);
+ b.add_input<decl::Float>(N_("IOR")).default_value(1.55f).min(0.0f).max(1000.0f).subtype(
+ PROP_FACTOR);
+ b.add_input<decl::Float>(N_("Offset"))
+ .default_value(2.0f * ((float)M_PI) / 180.0f)
+ .min(-M_PI_2)
+ .max(M_PI_2)
+ .subtype(PROP_ANGLE);
+ b.add_input<decl::Float>(N_("Random Color"))
+ .default_value(0.0f)
+ .min(0.0f)
+ .max(1.0f)
+ .subtype(PROP_FACTOR);
+ b.add_input<decl::Float>(N_("Random Roughness"))
+ .default_value(0.0f)
+ .min(0.0f)
+ .max(1.0f)
+ .subtype(PROP_FACTOR);
+ b.add_input<decl::Float>(N_("Random")).hide_value();
+ b.add_output<decl::Shader>(N_("BSDF"));
+}
-static bNodeSocketTemplate sh_node_bsdf_hair_principled_out[] = {
- {SOCK_SHADER, N_("BSDF")},
- {-1, ""},
-};
+static void node_shader_buts_principled_hair(uiLayout *layout,
+ bContext *UNUSED(C),
+ PointerRNA *ptr)
+{
+ uiItemR(layout, ptr, "parametrization", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE);
+}
/* Initialize the custom Parametrization property to Color. */
static void node_shader_init_hair_principled(bNodeTree *UNUSED(ntree), bNode *node)
@@ -103,8 +135,8 @@ void register_node_type_sh_bsdf_hair_principled()
sh_node_type_base(
&ntype, SH_NODE_BSDF_HAIR_PRINCIPLED, "Principled Hair BSDF", NODE_CLASS_SHADER);
- node_type_socket_templates(
- &ntype, file_ns::sh_node_bsdf_hair_principled_in, file_ns::sh_node_bsdf_hair_principled_out);
+ ntype.declare = file_ns::node_declare;
+ ntype.draw_buttons = file_ns::node_shader_buts_principled_hair;
node_type_size_preset(&ntype, NODE_SIZE_LARGE);
node_type_init(&ntype, file_ns::node_shader_init_hair_principled);
node_type_update(&ntype, file_ns::node_shader_update_hair_principled);
diff --git a/source/blender/nodes/shader/nodes/node_shader_bsdf_principled.cc b/source/blender/nodes/shader/nodes/node_shader_bsdf_principled.cc
index 72b2c278635..4c378d9bc09 100644
--- a/source/blender/nodes/shader/nodes/node_shader_bsdf_principled.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_bsdf_principled.cc
@@ -19,61 +19,114 @@
#include "node_shader_util.hh"
+#include "UI_interface.h"
+#include "UI_resources.h"
+
namespace blender::nodes::node_shader_bsdf_principled_cc {
-/* **************** OUTPUT ******************** */
-
-static bNodeSocketTemplate sh_node_bsdf_principled_in[] = {
- {SOCK_RGBA, N_("Base Color"), 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f},
- {SOCK_FLOAT, N_("Subsurface"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR},
- {SOCK_VECTOR,
- N_("Subsurface Radius"),
- 1.0f,
- 0.2f,
- 0.1f,
- 0.0f,
- 0.0f,
- 100.0f,
- PROP_NONE,
- SOCK_COMPACT},
- {SOCK_RGBA, N_("Subsurface Color"), 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f},
- {SOCK_FLOAT, N_("Subsurface IOR"), 1.4f, 0.0f, 0.0f, 0.0f, 1.01f, 3.8f, PROP_FACTOR},
- {SOCK_FLOAT, N_("Subsurface Anisotropy"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR},
- {SOCK_FLOAT, N_("Metallic"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR},
- {SOCK_FLOAT, N_("Specular"), 0.5f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR},
- {SOCK_FLOAT, N_("Specular Tint"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR},
- {SOCK_FLOAT, N_("Roughness"), 0.5f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR},
- {SOCK_FLOAT, N_("Anisotropic"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR},
- {SOCK_FLOAT, N_("Anisotropic Rotation"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR},
- {SOCK_FLOAT, N_("Sheen"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR},
- {SOCK_FLOAT, N_("Sheen Tint"), 0.5f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR},
- {SOCK_FLOAT, N_("Clearcoat"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR},
- {SOCK_FLOAT, N_("Clearcoat Roughness"), 0.03f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR},
- {SOCK_FLOAT, N_("IOR"), 1.45f, 0.0f, 0.0f, 0.0f, 0.0f, 1000.0f},
- {SOCK_FLOAT, N_("Transmission"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR},
- {SOCK_FLOAT, N_("Transmission Roughness"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR},
- {SOCK_RGBA, N_("Emission"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
- {SOCK_FLOAT, N_("Emission Strength"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1000000.0f},
- {SOCK_FLOAT, N_("Alpha"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR},
- {SOCK_VECTOR, N_("Normal"), 0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE},
- {SOCK_VECTOR,
- N_("Clearcoat Normal"),
- 0.0f,
- 0.0f,
- 0.0f,
- 1.0f,
- -1.0f,
- 1.0f,
- PROP_NONE,
- SOCK_HIDE_VALUE},
- {SOCK_VECTOR, N_("Tangent"), 0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE},
- {-1, ""},
-};
-
-static bNodeSocketTemplate sh_node_bsdf_principled_out[] = {
- {SOCK_SHADER, N_("BSDF")},
- {-1, ""},
-};
+static void node_declare(NodeDeclarationBuilder &b)
+{
+ b.add_input<decl::Color>(N_("Base Color")).default_value({0.8f, 0.8f, 0.8f, 1.0f});
+ b.add_input<decl::Float>(N_("Subsurface"))
+ .default_value(0.0f)
+ .min(0.0f)
+ .max(1.0f)
+ .subtype(PROP_FACTOR);
+ b.add_input<decl::Vector>(N_("Subsurface Radius"))
+ .default_value({1.0f, 0.2f, 0.1f})
+ .min(0.0f)
+ .max(100.0f)
+ .compact();
+ b.add_input<decl::Color>(N_("Subsurface Color")).default_value({0.8f, 0.8f, 0.8f, 1.0f});
+ b.add_input<decl::Float>(N_("Subsurface IOR"))
+ .default_value(1.4f)
+ .min(1.01f)
+ .max(3.8f)
+ .subtype(PROP_FACTOR);
+ b.add_input<decl::Float>(N_("Subsurface Anisotropy"))
+ .default_value(0.0f)
+ .min(0.0f)
+ .max(1.0f)
+ .subtype(PROP_FACTOR);
+ b.add_input<decl::Float>(N_("Metallic"))
+ .default_value(0.0f)
+ .min(0.0f)
+ .max(1.0f)
+ .subtype(PROP_FACTOR);
+ b.add_input<decl::Float>(N_("Specular"))
+ .default_value(0.5f)
+ .min(0.0f)
+ .max(1.0f)
+ .subtype(PROP_FACTOR);
+ b.add_input<decl::Float>(N_("Specular Tint"))
+ .default_value(0.5f)
+ .min(0.0f)
+ .max(1.0f)
+ .subtype(PROP_FACTOR);
+ b.add_input<decl::Float>(N_("Roughness"))
+ .default_value(0.5f)
+ .min(0.0f)
+ .max(1.0f)
+ .subtype(PROP_FACTOR);
+ b.add_input<decl::Float>(N_("Anisotropic"))
+ .default_value(0.0f)
+ .min(0.0f)
+ .max(1.0f)
+ .subtype(PROP_FACTOR);
+ b.add_input<decl::Float>(N_("Anisotropic Rotation"))
+ .default_value(0.0f)
+ .min(0.0f)
+ .max(1.0f)
+ .subtype(PROP_FACTOR);
+ b.add_input<decl::Float>(N_("Sheen"))
+ .default_value(0.0f)
+ .min(0.0f)
+ .max(1.0f)
+ .subtype(PROP_FACTOR);
+ b.add_input<decl::Float>(N_("Sheen Tint"))
+ .default_value(0.5f)
+ .min(0.0f)
+ .max(1.0f)
+ .subtype(PROP_FACTOR);
+ b.add_input<decl::Float>(N_("Clearcoat"))
+ .default_value(0.0f)
+ .min(0.0f)
+ .max(1.0f)
+ .subtype(PROP_FACTOR);
+ b.add_input<decl::Float>(N_("Clearcoat Roughness"))
+ .default_value(0.03f)
+ .min(0.0f)
+ .max(1.0f)
+ .subtype(PROP_FACTOR);
+ b.add_input<decl::Float>(N_("IOR")).default_value(1.45f).min(0.0f).max(1000.0f);
+ b.add_input<decl::Float>(N_("Transmission"))
+ .default_value(0.0f)
+ .min(0.0f)
+ .max(1.0f)
+ .subtype(PROP_FACTOR);
+ b.add_input<decl::Float>(N_("Transmission Roughness"))
+ .default_value(0.0f)
+ .min(0.0f)
+ .max(1.0f)
+ .subtype(PROP_FACTOR);
+ b.add_input<decl::Color>(N_("Emission")).default_value({0.0f, 0.0f, 0.0f, 1.0f});
+ b.add_input<decl::Float>(N_("Emission Strength")).default_value(1.0).min(0.0f).max(1000000.0f);
+ b.add_input<decl::Float>(N_("Alpha"))
+ .default_value(1.0f)
+ .min(0.0f)
+ .max(1.0f)
+ .subtype(PROP_FACTOR);
+ b.add_input<decl::Vector>(N_("Normal")).hide_value();
+ b.add_input<decl::Vector>(N_("Clearcoat Normal")).hide_value();
+ b.add_input<decl::Vector>(N_("Tangent")).hide_value();
+ b.add_output<decl::Shader>(N_("BSDF"));
+}
+
+static void node_shader_buts_principled(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
+{
+ uiItemR(layout, ptr, "distribution", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE);
+ uiItemR(layout, ptr, "subsurface_method", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE);
+}
static void node_shader_init_principled(bNodeTree *UNUSED(ntree), bNode *node)
{
@@ -195,8 +248,8 @@ void register_node_type_sh_bsdf_principled()
static bNodeType ntype;
sh_node_type_base(&ntype, SH_NODE_BSDF_PRINCIPLED, "Principled BSDF", NODE_CLASS_SHADER);
- node_type_socket_templates(
- &ntype, file_ns::sh_node_bsdf_principled_in, file_ns::sh_node_bsdf_principled_out);
+ ntype.declare = file_ns::node_declare;
+ ntype.draw_buttons = file_ns::node_shader_buts_principled;
node_type_size_preset(&ntype, NODE_SIZE_LARGE);
node_type_init(&ntype, file_ns::node_shader_init_principled);
node_type_gpu(&ntype, file_ns::node_shader_gpu_bsdf_principled);
diff --git a/source/blender/nodes/shader/nodes/node_shader_bsdf_refraction.cc b/source/blender/nodes/shader/nodes/node_shader_bsdf_refraction.cc
index 63bca201898..0d588c82869 100644
--- a/source/blender/nodes/shader/nodes/node_shader_bsdf_refraction.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_bsdf_refraction.cc
@@ -21,20 +21,18 @@
namespace blender::nodes::node_shader_bsdf_refraction_cc {
-/* **************** OUTPUT ******************** */
-
-static bNodeSocketTemplate sh_node_bsdf_refraction_in[] = {
- {SOCK_RGBA, N_("Color"), 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f},
- {SOCK_FLOAT, N_("Roughness"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR},
- {SOCK_FLOAT, N_("IOR"), 1.45f, 0.0f, 0.0f, 0.0f, 0.0f, 1000.0f},
- {SOCK_VECTOR, N_("Normal"), 0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE},
- {-1, ""},
-};
-
-static bNodeSocketTemplate sh_node_bsdf_refraction_out[] = {
- {SOCK_SHADER, N_("BSDF")},
- {-1, ""},
-};
+static void node_declare(NodeDeclarationBuilder &b)
+{
+ b.add_input<decl::Color>(N_("Color")).default_value({1.0f, 1.0f, 1.0f, 1.0f});
+ b.add_input<decl::Float>(N_("Roughness"))
+ .default_value(0.0f)
+ .min(0.0f)
+ .max(1.0f)
+ .subtype(PROP_FACTOR);
+ b.add_input<decl::Float>(N_("IOR")).default_value(1.45f).min(0.0f).max(1000.0f);
+ b.add_input<decl::Vector>(N_("Normal")).hide_value();
+ b.add_output<decl::Shader>(N_("BSDF"));
+}
static void node_shader_init_refraction(bNodeTree *UNUSED(ntree), bNode *node)
{
@@ -70,8 +68,7 @@ void register_node_type_sh_bsdf_refraction()
static bNodeType ntype;
sh_node_type_base(&ntype, SH_NODE_BSDF_REFRACTION, "Refraction BSDF", NODE_CLASS_SHADER);
- node_type_socket_templates(
- &ntype, file_ns::sh_node_bsdf_refraction_in, file_ns::sh_node_bsdf_refraction_out);
+ ntype.declare = file_ns::node_declare;
node_type_size_preset(&ntype, NODE_SIZE_MIDDLE);
node_type_init(&ntype, file_ns::node_shader_init_refraction);
node_type_gpu(&ntype, file_ns::node_shader_gpu_bsdf_refraction);
diff --git a/source/blender/nodes/shader/nodes/node_shader_bsdf_toon.cc b/source/blender/nodes/shader/nodes/node_shader_bsdf_toon.cc
index 270288c3ce0..5093b896764 100644
--- a/source/blender/nodes/shader/nodes/node_shader_bsdf_toon.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_bsdf_toon.cc
@@ -19,22 +19,32 @@
#include "node_shader_util.hh"
-namespace blender::nodes::node_shader_bsdf_toon_cc {
+#include "UI_interface.h"
+#include "UI_resources.h"
-/* **************** OUTPUT ******************** */
+namespace blender::nodes::node_shader_bsdf_toon_cc {
-static bNodeSocketTemplate sh_node_bsdf_toon_in[] = {
- {SOCK_RGBA, N_("Color"), 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f},
- {SOCK_FLOAT, N_("Size"), 0.5f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR},
- {SOCK_FLOAT, N_("Smooth"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR},
- {SOCK_VECTOR, N_("Normal"), 0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE},
- {-1, ""},
-};
+static void node_declare(NodeDeclarationBuilder &b)
+{
+ b.add_input<decl::Color>(N_("Color")).default_value({0.8f, 0.8f, 0.8f, 1.0f});
+ b.add_input<decl::Float>(N_("Size"))
+ .default_value(0.5f)
+ .min(0.0f)
+ .max(1.0f)
+ .subtype(PROP_FACTOR);
+ b.add_input<decl::Float>(N_("Smooth"))
+ .default_value(0.0f)
+ .min(0.0f)
+ .max(1.0f)
+ .subtype(PROP_FACTOR);
+ b.add_input<decl::Vector>(N_("Normal")).hide_value();
+ b.add_output<decl::Shader>(N_("BSDF"));
+}
-static bNodeSocketTemplate sh_node_bsdf_toon_out[] = {
- {SOCK_SHADER, N_("BSDF")},
- {-1, ""},
-};
+static void node_shader_buts_toon(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
+{
+ uiItemR(layout, ptr, "component", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE);
+}
static int node_shader_gpu_bsdf_toon(GPUMaterial *mat,
bNode *node,
@@ -61,8 +71,8 @@ void register_node_type_sh_bsdf_toon()
static bNodeType ntype;
sh_node_type_base(&ntype, SH_NODE_BSDF_TOON, "Toon BSDF", NODE_CLASS_SHADER);
- node_type_socket_templates(
- &ntype, file_ns::sh_node_bsdf_toon_in, file_ns::sh_node_bsdf_toon_out);
+ ntype.declare = file_ns::node_declare;
+ ntype.draw_buttons = file_ns::node_shader_buts_toon;
node_type_size_preset(&ntype, NODE_SIZE_MIDDLE);
node_type_gpu(&ntype, file_ns::node_shader_gpu_bsdf_toon);
diff --git a/source/blender/nodes/shader/nodes/node_shader_bsdf_translucent.cc b/source/blender/nodes/shader/nodes/node_shader_bsdf_translucent.cc
index 421c7c16032..22891738299 100644
--- a/source/blender/nodes/shader/nodes/node_shader_bsdf_translucent.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_bsdf_translucent.cc
@@ -21,18 +21,12 @@
namespace blender::nodes::node_shader_bsdf_translucent_cc {
-/* **************** OUTPUT ******************** */
-
-static bNodeSocketTemplate sh_node_bsdf_translucent_in[] = {
- {SOCK_RGBA, N_("Color"), 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f},
- {SOCK_VECTOR, N_("Normal"), 0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE},
- {-1, ""},
-};
-
-static bNodeSocketTemplate sh_node_bsdf_translucent_out[] = {
- {SOCK_SHADER, N_("BSDF")},
- {-1, ""},
-};
+static void node_declare(NodeDeclarationBuilder &b)
+{
+ b.add_input<decl::Color>(N_("Color")).default_value({0.8f, 0.8f, 0.8f, 1.0f});
+ b.add_input<decl::Vector>(N_("Normal")).hide_value();
+ b.add_output<decl::Shader>(N_("BSDF"));
+}
static int node_shader_gpu_bsdf_translucent(GPUMaterial *mat,
bNode *node,
@@ -59,8 +53,7 @@ void register_node_type_sh_bsdf_translucent()
static bNodeType ntype;
sh_node_type_base(&ntype, SH_NODE_BSDF_TRANSLUCENT, "Translucent BSDF", NODE_CLASS_SHADER);
- node_type_socket_templates(
- &ntype, file_ns::sh_node_bsdf_translucent_in, file_ns::sh_node_bsdf_translucent_out);
+ ntype.declare = file_ns::node_declare;
node_type_gpu(&ntype, file_ns::node_shader_gpu_bsdf_translucent);
nodeRegisterType(&ntype);
diff --git a/source/blender/nodes/shader/nodes/node_shader_bsdf_transparent.cc b/source/blender/nodes/shader/nodes/node_shader_bsdf_transparent.cc
index d1dc1856863..d764f4dd76b 100644
--- a/source/blender/nodes/shader/nodes/node_shader_bsdf_transparent.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_bsdf_transparent.cc
@@ -21,17 +21,11 @@
namespace blender::nodes::node_shader_bsdf_transparent_cc {
-/* **************** OUTPUT ******************** */
-
-static bNodeSocketTemplate sh_node_bsdf_transparent_in[] = {
- {SOCK_RGBA, N_("Color"), 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f},
- {-1, ""},
-};
-
-static bNodeSocketTemplate sh_node_bsdf_transparent_out[] = {
- {SOCK_SHADER, N_("BSDF")},
- {-1, ""},
-};
+static void node_declare(NodeDeclarationBuilder &b)
+{
+ b.add_input<decl::Color>(N_("Color")).default_value({1.0f, 1.0f, 1.0f, 1.0f});
+ b.add_output<decl::Shader>(N_("BSDF"));
+}
static int node_shader_gpu_bsdf_transparent(GPUMaterial *mat,
bNode *node,
@@ -52,8 +46,7 @@ void register_node_type_sh_bsdf_transparent()
static bNodeType ntype;
sh_node_type_base(&ntype, SH_NODE_BSDF_TRANSPARENT, "Transparent BSDF", NODE_CLASS_SHADER);
- node_type_socket_templates(
- &ntype, file_ns::sh_node_bsdf_transparent_in, file_ns::sh_node_bsdf_transparent_out);
+ ntype.declare = file_ns::node_declare;
node_type_gpu(&ntype, file_ns::node_shader_gpu_bsdf_transparent);
nodeRegisterType(&ntype);
diff --git a/source/blender/nodes/shader/nodes/node_shader_bsdf_velvet.cc b/source/blender/nodes/shader/nodes/node_shader_bsdf_velvet.cc
index 6293f38d792..dd090236c08 100644
--- a/source/blender/nodes/shader/nodes/node_shader_bsdf_velvet.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_bsdf_velvet.cc
@@ -21,19 +21,17 @@
namespace blender::nodes::node_shader_bsdf_velvet_cc {
-/* **************** OUTPUT ******************** */
-
-static bNodeSocketTemplate sh_node_bsdf_velvet_in[] = {
- {SOCK_RGBA, N_("Color"), 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f},
- {SOCK_FLOAT, N_("Sigma"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR},
- {SOCK_VECTOR, N_("Normal"), 0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE},
- {-1, ""},
-};
-
-static bNodeSocketTemplate sh_node_bsdf_velvet_out[] = {
- {SOCK_SHADER, N_("BSDF")},
- {-1, ""},
-};
+static void node_declare(NodeDeclarationBuilder &b)
+{
+ b.add_input<decl::Color>(N_("Color")).default_value({0.8f, 0.8f, 0.8f, 1.0f});
+ b.add_input<decl::Float>(N_("Sigma"))
+ .default_value(1.0f)
+ .min(0.0f)
+ .max(1.0f)
+ .subtype(PROP_FACTOR);
+ b.add_input<decl::Vector>(N_("Normal")).hide_value();
+ b.add_output<decl::Shader>(N_("BSDF"));
+}
static int node_shader_gpu_bsdf_velvet(GPUMaterial *mat,
bNode *node,
@@ -60,8 +58,7 @@ void register_node_type_sh_bsdf_velvet()
static bNodeType ntype;
sh_node_type_base(&ntype, SH_NODE_BSDF_VELVET, "Velvet BSDF", NODE_CLASS_SHADER);
- node_type_socket_templates(
- &ntype, file_ns::sh_node_bsdf_velvet_in, file_ns::sh_node_bsdf_velvet_out);
+ ntype.declare = file_ns::node_declare;
node_type_gpu(&ntype, file_ns::node_shader_gpu_bsdf_velvet);
nodeRegisterType(&ntype);
diff --git a/source/blender/nodes/shader/nodes/node_shader_bump.cc b/source/blender/nodes/shader/nodes/node_shader_bump.cc
index 7718b21af52..252abd02ad7 100644
--- a/source/blender/nodes/shader/nodes/node_shader_bump.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_bump.cc
@@ -23,6 +23,9 @@
#include "node_shader_util.hh"
+#include "UI_interface.h"
+#include "UI_resources.h"
+
/* **************** BUMP ******************** */
namespace blender::nodes::node_shader_bump_cc {
@@ -46,6 +49,11 @@ static void node_declare(NodeDeclarationBuilder &b)
b.add_output<decl::Vector>(N_("Normal"));
}
+static void node_shader_buts_bump(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
+{
+ uiItemR(layout, ptr, "invert", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, 0);
+}
+
static int gpu_shader_bump(GPUMaterial *mat,
bNode *node,
bNodeExecData *UNUSED(execdata),
@@ -73,6 +81,7 @@ void register_node_type_sh_bump()
sh_node_type_base(&ntype, SH_NODE_BUMP, "Bump", NODE_CLASS_OP_VECTOR);
ntype.declare = file_ns::node_declare;
+ ntype.draw_buttons = file_ns::node_shader_buts_bump;
node_type_gpu(&ntype, file_ns::gpu_shader_bump);
nodeRegisterType(&ntype);
diff --git a/source/blender/nodes/shader/nodes/node_shader_clamp.cc b/source/blender/nodes/shader/nodes/node_shader_clamp.cc
index f4c72f0616f..cd0f1b3c44d 100644
--- a/source/blender/nodes/shader/nodes/node_shader_clamp.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_clamp.cc
@@ -23,6 +23,9 @@
#include "node_shader_util.hh"
+#include "UI_interface.h"
+#include "UI_resources.h"
+
namespace blender::nodes::node_shader_clamp_cc {
static void sh_node_clamp_declare(NodeDeclarationBuilder &b)
@@ -32,7 +35,12 @@ static void sh_node_clamp_declare(NodeDeclarationBuilder &b)
b.add_input<decl::Float>(N_("Min")).default_value(0.0f).min(-10000.0f).max(10000.0f);
b.add_input<decl::Float>(N_("Max")).default_value(1.0f).min(-10000.0f).max(10000.0f);
b.add_output<decl::Float>(N_("Result"));
-};
+}
+
+static void node_shader_buts_clamp(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
+{
+ uiItemR(layout, ptr, "clamp_type", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE);
+}
static void node_shader_init_clamp(bNodeTree *UNUSED(ntree), bNode *node)
{
@@ -83,6 +91,7 @@ void register_node_type_sh_clamp()
sh_fn_node_type_base(&ntype, SH_NODE_CLAMP, "Clamp", NODE_CLASS_CONVERTER);
ntype.declare = file_ns::sh_node_clamp_declare;
+ ntype.draw_buttons = file_ns::node_shader_buts_clamp;
node_type_init(&ntype, file_ns::node_shader_init_clamp);
node_type_gpu(&ntype, file_ns::gpu_shader_clamp);
ntype.build_multi_function = file_ns::sh_node_clamp_build_multi_function;
diff --git a/source/blender/nodes/shader/nodes/node_shader_color_ramp.cc b/source/blender/nodes/shader/nodes/node_shader_color_ramp.cc
index 353cbf4ca15..d8c43e1d66b 100644
--- a/source/blender/nodes/shader/nodes/node_shader_color_ramp.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_color_ramp.cc
@@ -35,7 +35,7 @@ static void sh_node_valtorgb_declare(NodeDeclarationBuilder &b)
b.add_input<decl::Float>(N_("Fac")).default_value(0.5f).min(0.0f).max(1.0f).subtype(PROP_FACTOR);
b.add_output<decl::Color>(N_("Color"));
b.add_output<decl::Float>(N_("Alpha"));
-};
+}
static void node_shader_init_valtorgb(bNodeTree *UNUSED(ntree), bNode *node)
{
diff --git a/source/blender/nodes/shader/nodes/node_shader_common.cc b/source/blender/nodes/shader/nodes/node_shader_common.cc
index 6f300890f7f..3f0fff34533 100644
--- a/source/blender/nodes/shader/nodes/node_shader_common.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_common.cc
@@ -108,7 +108,6 @@ void register_node_type_sh_group()
BLI_assert(ntype.rna_ext.srna != nullptr);
RNA_struct_blender_type_set(ntype.rna_ext.srna, &ntype);
- node_type_socket_templates(&ntype, nullptr, nullptr);
node_type_size(&ntype, 140, 60, 400);
ntype.labelfunc = node_group_label;
node_type_group_update(&ntype, node_group_update);
diff --git a/source/blender/nodes/shader/nodes/node_shader_curves.cc b/source/blender/nodes/shader/nodes/node_shader_curves.cc
index 67095561caf..bce59a60033 100644
--- a/source/blender/nodes/shader/nodes/node_shader_curves.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_curves.cc
@@ -31,7 +31,7 @@ static void sh_node_curve_vec_declare(NodeDeclarationBuilder &b)
b.add_input<decl::Float>(N_("Fac")).min(0.0f).max(1.0f).default_value(1.0f).subtype(PROP_FACTOR);
b.add_input<decl::Vector>(N_("Vector")).min(-1.0f).max(1.0f);
b.add_output<decl::Vector>(N_("Vector"));
-};
+}
static void node_shader_init_curve_vec(bNodeTree *UNUSED(ntree), bNode *node)
{
@@ -164,7 +164,7 @@ static void sh_node_curve_rgb_declare(NodeDeclarationBuilder &b)
b.add_input<decl::Float>(N_("Fac")).min(0.0f).max(1.0f).default_value(1.0f).subtype(PROP_FACTOR);
b.add_input<decl::Color>(N_("Color")).default_value({1.0f, 1.0f, 1.0f, 1.0f});
b.add_output<decl::Color>(N_("Color"));
-};
+}
static void node_shader_init_curve_rgb(bNodeTree *UNUSED(ntree), bNode *node)
{
@@ -326,7 +326,7 @@ static void sh_node_curve_float_declare(NodeDeclarationBuilder &b)
.subtype(PROP_FACTOR);
b.add_input<decl::Float>(N_("Value")).default_value(1.0f).is_default_link_socket();
b.add_output<decl::Float>(N_("Value"));
-};
+}
static void node_shader_init_curve_float(bNodeTree *UNUSED(ntree), bNode *node)
{
diff --git a/source/blender/nodes/shader/nodes/node_shader_eevee_specular.cc b/source/blender/nodes/shader/nodes/node_shader_eevee_specular.cc
index aa34ba225a2..e4c80725c8e 100644
--- a/source/blender/nodes/shader/nodes/node_shader_eevee_specular.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_eevee_specular.cc
@@ -21,44 +21,36 @@
namespace blender::nodes::node_shader_eevee_specular_cc {
-/* **************** OUTPUT ******************** */
-
-static bNodeSocketTemplate sh_node_eevee_specular_in[] = {
- {SOCK_RGBA, N_("Base Color"), 0.8f, 0.8f, 0.8f, 1.0f},
- {SOCK_RGBA, N_("Specular"), 0.03f, 0.03f, 0.03f, 1.0f},
- {SOCK_FLOAT, N_("Roughness"), 0.2f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR},
- {SOCK_RGBA, N_("Emissive Color"), 0.0f, 0.0f, 0.0f, 1.0f},
- {SOCK_FLOAT, N_("Transparency"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR},
- {SOCK_VECTOR, N_("Normal"), 0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE},
- {SOCK_FLOAT, N_("Clear Coat"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR},
- {SOCK_FLOAT, N_("Clear Coat Roughness"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR},
- {SOCK_VECTOR,
- N_("Clear Coat Normal"),
- 0.0f,
- 0.0f,
- 0.0f,
- 0.0f,
- 0.0f,
- 1.0f,
- PROP_NONE,
- SOCK_HIDE_VALUE},
- {SOCK_FLOAT,
- N_("Ambient Occlusion"),
- 1.0f,
- 0.0f,
- 0.0f,
- 0.0f,
- 0.0f,
- 1.0f,
- PROP_NONE,
- SOCK_HIDE_VALUE},
- {-1, ""},
-};
-
-static bNodeSocketTemplate sh_node_eevee_specular_out[] = {
- {SOCK_SHADER, N_("BSDF")},
- {-1, ""},
-};
+static void node_declare(NodeDeclarationBuilder &b)
+{
+ b.add_input<decl::Color>(N_("Base Color")).default_value({0.8f, 0.8f, 0.8f, 1.0f});
+ b.add_input<decl::Color>(N_("Specular")).default_value({0.03f, 0.03f, 0.03f, 1.0f});
+ b.add_input<decl::Float>(N_("Roughness"))
+ .default_value(0.2f)
+ .min(0.0f)
+ .max(1.0f)
+ .subtype(PROP_FACTOR);
+ b.add_input<decl::Color>(N_("Emissive Color")).default_value({0.0f, 0.0f, 0.0f, 1.0f});
+ b.add_input<decl::Float>(N_("Transparency"))
+ .default_value(0.0f)
+ .min(0.0f)
+ .max(1.0f)
+ .subtype(PROP_FACTOR);
+ b.add_input<decl::Vector>(N_("Normal")).hide_value();
+ b.add_input<decl::Float>(N_("Clear Coat"))
+ .default_value(0.0f)
+ .min(0.0f)
+ .max(1.0f)
+ .subtype(PROP_FACTOR);
+ b.add_input<decl::Float>(N_("Clear Coat Roughness"))
+ .default_value(0.0f)
+ .min(0.0f)
+ .max(1.0f)
+ .subtype(PROP_FACTOR);
+ b.add_input<decl::Vector>(N_("Clear Coat Normal")).hide_value();
+ b.add_input<decl::Float>(N_("Ambient Occlusion")).hide_value();
+ b.add_output<decl::Shader>(N_("BSDF"));
+}
static int node_shader_gpu_eevee_specular(GPUMaterial *mat,
bNode *node,
@@ -98,8 +90,7 @@ void register_node_type_sh_eevee_specular()
static bNodeType ntype;
sh_node_type_base(&ntype, SH_NODE_EEVEE_SPECULAR, "Specular BSDF", NODE_CLASS_SHADER);
- node_type_socket_templates(
- &ntype, file_ns::sh_node_eevee_specular_in, file_ns::sh_node_eevee_specular_out);
+ ntype.declare = file_ns::node_declare;
node_type_gpu(&ntype, file_ns::node_shader_gpu_eevee_specular);
nodeRegisterType(&ntype);
diff --git a/source/blender/nodes/shader/nodes/node_shader_emission.cc b/source/blender/nodes/shader/nodes/node_shader_emission.cc
index 47e4d3ad399..ea36763578f 100644
--- a/source/blender/nodes/shader/nodes/node_shader_emission.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_emission.cc
@@ -21,18 +21,12 @@
namespace blender::nodes::node_shader_emission_cc {
-/* **************** OUTPUT ******************** */
-
-static bNodeSocketTemplate sh_node_emission_in[] = {
- {SOCK_RGBA, N_("Color"), 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f},
- {SOCK_FLOAT, N_("Strength"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1000000.0f},
- {-1, ""},
-};
-
-static bNodeSocketTemplate sh_node_emission_out[] = {
- {SOCK_SHADER, N_("Emission")},
- {-1, ""},
-};
+static void node_declare(NodeDeclarationBuilder &b)
+{
+ b.add_input<decl::Color>(N_("Color")).default_value({1.0f, 1.0f, 1.0f, 1.0f});
+ b.add_input<decl::Float>(N_("Strength")).default_value(1.0f).min(0.0f).max(1000000.0f);
+ b.add_output<decl::Shader>(N_("Emission"));
+}
static int node_shader_gpu_emission(GPUMaterial *mat,
bNode *node,
@@ -53,7 +47,7 @@ void register_node_type_sh_emission()
static bNodeType ntype;
sh_node_type_base(&ntype, SH_NODE_EMISSION, "Emission", NODE_CLASS_SHADER);
- node_type_socket_templates(&ntype, file_ns::sh_node_emission_in, file_ns::sh_node_emission_out);
+ ntype.declare = file_ns::node_declare;
node_type_gpu(&ntype, file_ns::node_shader_gpu_emission);
nodeRegisterType(&ntype);
diff --git a/source/blender/nodes/shader/nodes/node_shader_fresnel.cc b/source/blender/nodes/shader/nodes/node_shader_fresnel.cc
index 2abfb57a364..5dba42fcc30 100644
--- a/source/blender/nodes/shader/nodes/node_shader_fresnel.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_fresnel.cc
@@ -21,17 +21,12 @@
namespace blender::nodes::node_shader_fresnel_cc {
-/* **************** Fresnel ******************** */
-static bNodeSocketTemplate sh_node_fresnel_in[] = {
- {SOCK_FLOAT, N_("IOR"), 1.45f, 0.0f, 0.0f, 0.0f, 0.0f, 1000.0f},
- {SOCK_VECTOR, N_("Normal"), 0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE},
- {-1, ""},
-};
-
-static bNodeSocketTemplate sh_node_fresnel_out[] = {
- {SOCK_FLOAT, N_("Fac"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR},
- {-1, ""},
-};
+static void node_declare(NodeDeclarationBuilder &b)
+{
+ b.add_input<decl::Float>(N_("IOR")).default_value(1.45f).min(0.0f).max(1000.0f);
+ b.add_input<decl::Vector>(N_("Normal")).hide_value();
+ b.add_output<decl::Float>(N_("Fac"));
+}
static int node_shader_gpu_fresnel(GPUMaterial *mat,
bNode *node,
@@ -60,7 +55,7 @@ void register_node_type_sh_fresnel()
static bNodeType ntype;
sh_node_type_base(&ntype, SH_NODE_FRESNEL, "Fresnel", NODE_CLASS_INPUT);
- node_type_socket_templates(&ntype, file_ns::sh_node_fresnel_in, file_ns::sh_node_fresnel_out);
+ ntype.declare = file_ns::node_declare;
node_type_gpu(&ntype, file_ns::node_shader_gpu_fresnel);
nodeRegisterType(&ntype);
diff --git a/source/blender/nodes/shader/nodes/node_shader_hair_info.cc b/source/blender/nodes/shader/nodes/node_shader_hair_info.cc
index c5af7e16201..e22a825c066 100644
--- a/source/blender/nodes/shader/nodes/node_shader_hair_info.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_hair_info.cc
@@ -21,16 +21,16 @@
namespace blender::nodes::node_shader_hair_info_cc {
-static bNodeSocketTemplate outputs[] = {
- {SOCK_FLOAT, N_("Is Strand"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
- {SOCK_FLOAT, N_("Intercept"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
- {SOCK_FLOAT, N_("Length"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
- {SOCK_FLOAT, N_("Thickness"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
- {SOCK_VECTOR, N_("Tangent Normal"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
- // { SOCK_FLOAT, 0, N_("Fade"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
- {SOCK_FLOAT, N_("Random")},
- {-1, ""},
-};
+static void node_declare(NodeDeclarationBuilder &b)
+{
+ b.add_output<decl::Float>(N_("Is Strand"));
+ b.add_output<decl::Float>(N_("Intercept"));
+ b.add_output<decl::Float>(N_("Length"));
+ b.add_output<decl::Float>(N_("Thickness"));
+ b.add_output<decl::Vector>(N_("Tangent Normal"));
+ // b.add_output<decl::Float>(N_("Fade"));
+ b.add_output<decl::Float>(N_("Random"));
+}
static int node_shader_gpu_hair_info(GPUMaterial *mat,
bNode *node,
@@ -55,7 +55,7 @@ void register_node_type_sh_hair_info()
static bNodeType ntype;
sh_node_type_base(&ntype, SH_NODE_HAIR_INFO, "Hair Info", NODE_CLASS_INPUT);
- node_type_socket_templates(&ntype, nullptr, file_ns::outputs);
+ ntype.declare = file_ns::node_declare;
node_type_gpu(&ntype, file_ns::node_shader_gpu_hair_info);
nodeRegisterType(&ntype);
diff --git a/source/blender/nodes/shader/nodes/node_shader_hueSatVal.cc b/source/blender/nodes/shader/nodes/node_shader_hueSatVal.cc
index 75e1b372601..94b9a61c602 100644
--- a/source/blender/nodes/shader/nodes/node_shader_hueSatVal.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_hueSatVal.cc
@@ -25,19 +25,15 @@
namespace blender::nodes::node_shader_hueSatVal_cc {
-/* **************** Hue Saturation ******************** */
-static bNodeSocketTemplate sh_node_hue_sat_in[] = {
- {SOCK_FLOAT, N_("Hue"), 0.5f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE},
- {SOCK_FLOAT, N_("Saturation"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 2.0f, PROP_NONE},
- {SOCK_FLOAT, N_("Value"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 2.0f, PROP_NONE},
- {SOCK_FLOAT, N_("Fac"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR},
- {SOCK_RGBA, N_("Color"), 0.8f, 0.8f, 0.8f, 1.0f},
- {-1, ""},
-};
-static bNodeSocketTemplate sh_node_hue_sat_out[] = {
- {SOCK_RGBA, N_("Color")},
- {-1, ""},
-};
+static void node_declare(NodeDeclarationBuilder &b)
+{
+ b.add_input<decl::Float>(N_("Hue")).default_value(0.5f).min(0.0f).max(1.0f);
+ b.add_input<decl::Float>(N_("Saturation")).default_value(1.0f).min(0.0f).max(2.0f);
+ b.add_input<decl::Float>(N_("Value")).default_value(1.0f).min(0.0f).max(2.0f);
+ b.add_input<decl::Float>(N_("Fac")).default_value(1.0f).min(0.0f).max(1.0f).subtype(PROP_FACTOR);
+ b.add_input<decl::Color>(N_("Color")).default_value({0.8f, 0.8f, 0.8f, 1.0f});
+ b.add_output<decl::Color>(N_("Color"));
+}
static int gpu_shader_hue_sat(GPUMaterial *mat,
bNode *node,
@@ -57,7 +53,7 @@ void register_node_type_sh_hue_sat()
static bNodeType ntype;
sh_node_type_base(&ntype, SH_NODE_HUE_SAT, "Hue Saturation Value", NODE_CLASS_OP_COLOR);
- node_type_socket_templates(&ntype, file_ns::sh_node_hue_sat_in, file_ns::sh_node_hue_sat_out);
+ ntype.declare = file_ns::node_declare;
node_type_size_preset(&ntype, NODE_SIZE_MIDDLE);
node_type_gpu(&ntype, file_ns::gpu_shader_hue_sat);
diff --git a/source/blender/nodes/shader/nodes/node_shader_ies_light.cc b/source/blender/nodes/shader/nodes/node_shader_ies_light.cc
index a107fd83b0e..82f0a3045c9 100644
--- a/source/blender/nodes/shader/nodes/node_shader_ies_light.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_ies_light.cc
@@ -19,20 +19,34 @@
#include "node_shader_util.hh"
+#include "UI_interface.h"
+#include "UI_resources.h"
+
namespace blender::nodes::node_shader_ies_light_cc {
-/* **************** IES Light ******************** */
+static void node_declare(NodeDeclarationBuilder &b)
+{
+ b.add_input<decl::Vector>(N_("Vector")).hide_value();
+ b.add_input<decl::Float>(N_("Strength")).default_value(1.0f).min(0.0f).max(1000000.0f);
+ b.add_output<decl::Float>(N_("Fac"));
+}
-static bNodeSocketTemplate sh_node_tex_ies_in[] = {
- {SOCK_VECTOR, N_("Vector"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE},
- {SOCK_FLOAT, N_("Strength"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1000000.0f, PROP_NONE},
- {-1, ""},
-};
+static void node_shader_buts_ies(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
+{
+ uiLayout *row;
-static bNodeSocketTemplate sh_node_tex_ies_out[] = {
- {SOCK_FLOAT, N_("Fac")},
- {-1, ""},
-};
+ row = uiLayoutRow(layout, false);
+ uiItemR(row, ptr, "mode", UI_ITEM_R_SPLIT_EMPTY_NAME | UI_ITEM_R_EXPAND, nullptr, ICON_NONE);
+
+ row = uiLayoutRow(layout, true);
+
+ if (RNA_enum_get(ptr, "mode") == NODE_IES_INTERNAL) {
+ uiItemR(row, ptr, "ies", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE);
+ }
+ else {
+ uiItemR(row, ptr, "filepath", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE);
+ }
+}
static void node_shader_init_tex_ies(bNodeTree *UNUSED(ntree), bNode *node)
{
@@ -50,7 +64,8 @@ void register_node_type_sh_tex_ies()
static bNodeType ntype;
sh_node_type_base(&ntype, SH_NODE_TEX_IES, "IES Texture", NODE_CLASS_TEXTURE);
- node_type_socket_templates(&ntype, file_ns::sh_node_tex_ies_in, file_ns::sh_node_tex_ies_out);
+ ntype.declare = file_ns::node_declare;
+ ntype.draw_buttons = file_ns::node_shader_buts_ies;
node_type_init(&ntype, file_ns::node_shader_init_tex_ies);
node_type_storage(
&ntype, "NodeShaderTexIES", node_free_standard_storage, node_copy_standard_storage);
diff --git a/source/blender/nodes/shader/nodes/node_shader_invert.cc b/source/blender/nodes/shader/nodes/node_shader_invert.cc
index bcdb7ca7b00..3b5f4cb1d38 100644
--- a/source/blender/nodes/shader/nodes/node_shader_invert.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_invert.cc
@@ -25,13 +25,12 @@
namespace blender::nodes::node_shader_invert_cc {
-/* **************** INVERT ******************** */
-static bNodeSocketTemplate sh_node_invert_in[] = {
- {SOCK_FLOAT, N_("Fac"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR},
- {SOCK_RGBA, N_("Color"), 0.0f, 0.0f, 0.0f, 1.0f},
- {-1, ""}};
-
-static bNodeSocketTemplate sh_node_invert_out[] = {{SOCK_RGBA, N_("Color")}, {-1, ""}};
+static void node_declare(NodeDeclarationBuilder &b)
+{
+ b.add_input<decl::Float>(N_("Fac")).default_value(1.0f).min(0.0f).max(1.0f).subtype(PROP_FACTOR);
+ b.add_input<decl::Color>(N_("Color")).default_value({0.0f, 0.0f, 0.0f, 1.0f});
+ b.add_output<decl::Color>(N_("Color"));
+}
static int gpu_shader_invert(GPUMaterial *mat,
bNode *node,
@@ -51,7 +50,7 @@ void register_node_type_sh_invert()
static bNodeType ntype;
sh_node_type_base(&ntype, SH_NODE_INVERT, "Invert", NODE_CLASS_OP_COLOR);
- node_type_socket_templates(&ntype, file_ns::sh_node_invert_in, file_ns::sh_node_invert_out);
+ ntype.declare = file_ns::node_declare;
node_type_gpu(&ntype, file_ns::gpu_shader_invert);
nodeRegisterType(&ntype);
diff --git a/source/blender/nodes/shader/nodes/node_shader_layer_weight.cc b/source/blender/nodes/shader/nodes/node_shader_layer_weight.cc
index f78bbcaacaa..b4210ce154c 100644
--- a/source/blender/nodes/shader/nodes/node_shader_layer_weight.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_layer_weight.cc
@@ -21,19 +21,13 @@
namespace blender::nodes::node_shader_layer_weight_cc {
-/* **************** Layer Weight ******************** */
-
-static bNodeSocketTemplate sh_node_layer_weight_in[] = {
- {SOCK_FLOAT, N_("Blend"), 0.5f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
- {SOCK_VECTOR, N_("Normal"), 0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE},
- {-1, ""},
-};
-
-static bNodeSocketTemplate sh_node_layer_weight_out[] = {
- {SOCK_FLOAT, N_("Fresnel"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
- {SOCK_FLOAT, N_("Facing"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
- {-1, ""},
-};
+static void node_declare(NodeDeclarationBuilder &b)
+{
+ b.add_input<decl::Float>(N_("Blend")).default_value(0.5f).min(0.0f).max(1.0f);
+ b.add_input<decl::Vector>(N_("Normal")).hide_value();
+ b.add_output<decl::Float>(N_("Fresnel"));
+ b.add_output<decl::Float>(N_("Facing"));
+}
static int node_shader_gpu_layer_weight(GPUMaterial *mat,
bNode *node,
@@ -62,8 +56,7 @@ void register_node_type_sh_layer_weight()
static bNodeType ntype;
sh_node_type_base(&ntype, SH_NODE_LAYER_WEIGHT, "Layer Weight", NODE_CLASS_INPUT);
- node_type_socket_templates(
- &ntype, file_ns::sh_node_layer_weight_in, file_ns::sh_node_layer_weight_out);
+ ntype.declare = file_ns::node_declare;
node_type_gpu(&ntype, file_ns::node_shader_gpu_layer_weight);
nodeRegisterType(&ntype);
diff --git a/source/blender/nodes/shader/nodes/node_shader_light_falloff.cc b/source/blender/nodes/shader/nodes/node_shader_light_falloff.cc
index 6c2baa01e54..50eea2b3643 100644
--- a/source/blender/nodes/shader/nodes/node_shader_light_falloff.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_light_falloff.cc
@@ -21,22 +21,14 @@
namespace blender::nodes::node_shader_light_falloff_cc {
-/* **************** INPUT ********************* */
-
-static bNodeSocketTemplate sh_node_light_falloff_in[] = {
- {SOCK_FLOAT, N_("Strength"), 100.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1000000.0f},
- {SOCK_FLOAT, N_("Smooth"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1000.0f},
- {-1, ""},
-};
-
-/* **************** OUTPUT ******************** */
-
-static bNodeSocketTemplate sh_node_light_falloff_out[] = {
- {SOCK_FLOAT, N_("Quadratic"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
- {SOCK_FLOAT, N_("Linear"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
- {SOCK_FLOAT, N_("Constant"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
- {-1, ""},
-};
+static void node_declare(NodeDeclarationBuilder &b)
+{
+ b.add_input<decl::Float>(N_("Strength")).default_value(100.0f).min(0.0f).max(1000000.0f);
+ b.add_input<decl::Float>(N_("Smooth")).default_value(0.0f).min(0.0f).max(1000.0f);
+ b.add_output<decl::Float>(N_("Quadratic"));
+ b.add_output<decl::Float>(N_("Linear"));
+ b.add_output<decl::Float>(N_("Constant"));
+}
static int node_shader_gpu_light_falloff(GPUMaterial *mat,
bNode *node,
@@ -57,8 +49,7 @@ void register_node_type_sh_light_falloff()
static bNodeType ntype;
sh_node_type_base(&ntype, SH_NODE_LIGHT_FALLOFF, "Light Falloff", NODE_CLASS_OP_COLOR);
- node_type_socket_templates(
- &ntype, file_ns::sh_node_light_falloff_in, file_ns::sh_node_light_falloff_out);
+ ntype.declare = file_ns::node_declare;
node_type_size_preset(&ntype, NODE_SIZE_MIDDLE);
node_type_gpu(&ntype, file_ns::node_shader_gpu_light_falloff);
diff --git a/source/blender/nodes/shader/nodes/node_shader_light_path.cc b/source/blender/nodes/shader/nodes/node_shader_light_path.cc
index 9f8e6502ce5..6fbd5751886 100644
--- a/source/blender/nodes/shader/nodes/node_shader_light_path.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_light_path.cc
@@ -21,24 +21,22 @@
namespace blender::nodes::node_shader_light_path_cc {
-/* **************** OUTPUT ******************** */
-
-static bNodeSocketTemplate sh_node_light_path_out[] = {
- {SOCK_FLOAT, N_("Is Camera Ray"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
- {SOCK_FLOAT, N_("Is Shadow Ray"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
- {SOCK_FLOAT, N_("Is Diffuse Ray"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
- {SOCK_FLOAT, N_("Is Glossy Ray"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
- {SOCK_FLOAT, N_("Is Singular Ray"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
- {SOCK_FLOAT, N_("Is Reflection Ray"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
- {SOCK_FLOAT, N_("Is Transmission Ray"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
- {SOCK_FLOAT, N_("Ray Length"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
- {SOCK_FLOAT, N_("Ray Depth"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
- {SOCK_FLOAT, N_("Diffuse Depth"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
- {SOCK_FLOAT, N_("Glossy Depth"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
- {SOCK_FLOAT, N_("Transparent Depth"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
- {SOCK_FLOAT, N_("Transmission Depth"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
- {-1, ""},
-};
+static void node_declare(NodeDeclarationBuilder &b)
+{
+ b.add_output<decl::Float>(N_("Is Camera Ray"));
+ b.add_output<decl::Float>(N_("Is Shadow Ray"));
+ b.add_output<decl::Float>(N_("Is Diffuse Ray"));
+ b.add_output<decl::Float>(N_("Is Glossy Ray"));
+ b.add_output<decl::Float>(N_("Is Singular Ray"));
+ b.add_output<decl::Float>(N_("Is Reflection Ray"));
+ b.add_output<decl::Float>(N_("Is Transmission Ray"));
+ b.add_output<decl::Float>(N_("Ray Length"));
+ b.add_output<decl::Float>(N_("Ray Depth"));
+ b.add_output<decl::Float>(N_("Diffuse Depth"));
+ b.add_output<decl::Float>(N_("Glossy Depth"));
+ b.add_output<decl::Float>(N_("Transparent Depth"));
+ b.add_output<decl::Float>(N_("Transmission Depth"));
+}
static int node_shader_gpu_light_path(GPUMaterial *mat,
bNode *node,
@@ -59,7 +57,7 @@ void register_node_type_sh_light_path()
static bNodeType ntype;
sh_node_type_base(&ntype, SH_NODE_LIGHT_PATH, "Light Path", NODE_CLASS_INPUT);
- node_type_socket_templates(&ntype, nullptr, file_ns::sh_node_light_path_out);
+ ntype.declare = file_ns::node_declare;
node_type_gpu(&ntype, file_ns::node_shader_gpu_light_path);
nodeRegisterType(&ntype);
diff --git a/source/blender/nodes/shader/nodes/node_shader_map_range.cc b/source/blender/nodes/shader/nodes/node_shader_map_range.cc
index 161da714770..bc7ca661a77 100644
--- a/source/blender/nodes/shader/nodes/node_shader_map_range.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_map_range.cc
@@ -29,6 +29,9 @@
#include "NOD_socket_search_link.hh"
+#include "UI_interface.h"
+#include "UI_resources.h"
+
namespace blender::nodes::node_shader_map_range_cc {
NODE_STORAGE_FUNCS(NodeMapRange)
@@ -50,7 +53,18 @@ static void sh_node_map_range_declare(NodeDeclarationBuilder &b)
b.add_input<decl::Vector>(N_("Steps"), "Steps_FLOAT3").default_value(float3(4.0f));
b.add_output<decl::Float>(N_("Result"));
b.add_output<decl::Vector>(N_("Vector"));
-};
+}
+
+static void node_shader_buts_map_range(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
+{
+ uiItemR(layout, ptr, "data_type", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE);
+ uiItemR(layout, ptr, "interpolation_type", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE);
+ if (!ELEM(RNA_enum_get(ptr, "interpolation_type"),
+ NODE_MAP_RANGE_SMOOTHSTEP,
+ NODE_MAP_RANGE_SMOOTHERSTEP)) {
+ uiItemR(layout, ptr, "clamp", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE);
+ }
+}
static void node_shader_update_map_range(bNodeTree *ntree, bNode *node)
{
@@ -650,6 +664,7 @@ void register_node_type_sh_map_range()
sh_fn_node_type_base(&ntype, SH_NODE_MAP_RANGE, "Map Range", NODE_CLASS_CONVERTER);
ntype.declare = file_ns::sh_node_map_range_declare;
+ ntype.draw_buttons = file_ns::node_shader_buts_map_range;
node_type_init(&ntype, file_ns::node_shader_init_map_range);
node_type_storage(
&ntype, "NodeMapRange", node_free_standard_storage, node_copy_standard_storage);
diff --git a/source/blender/nodes/shader/nodes/node_shader_mapping.cc b/source/blender/nodes/shader/nodes/node_shader_mapping.cc
index 758b675f9d6..19c3a26796e 100644
--- a/source/blender/nodes/shader/nodes/node_shader_mapping.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_mapping.cc
@@ -23,21 +23,39 @@
#include "node_shader_util.hh"
+#include "UI_interface.h"
+#include "UI_resources.h"
+
namespace blender::nodes::node_shader_mapping_cc {
-/* **************** MAPPING ******************** */
-static bNodeSocketTemplate sh_node_mapping_in[] = {
- {SOCK_VECTOR, N_("Vector"), 0.0f, 0.0f, 0.0f, 1.0f, -FLT_MAX, FLT_MAX, PROP_NONE},
- {SOCK_VECTOR, N_("Location"), 0.0f, 0.0f, 0.0f, 1.0f, -FLT_MAX, FLT_MAX, PROP_TRANSLATION},
- {SOCK_VECTOR, N_("Rotation"), 0.0f, 0.0f, 0.0f, 1.0f, -FLT_MAX, FLT_MAX, PROP_EULER},
- {SOCK_VECTOR, N_("Scale"), 1.0f, 1.0f, 1.0f, 1.0f, -FLT_MAX, FLT_MAX, PROP_XYZ},
- {-1, ""},
-};
+static void node_declare(NodeDeclarationBuilder &b)
+{
+ b.add_input<decl::Vector>(N_("Vector"))
+ .default_value({0.0f, 0.0f, 0.0f})
+ .min(-FLT_MAX)
+ .max(FLT_MAX);
+ b.add_input<decl::Vector>(N_("Location"))
+ .default_value({0.0f, 0.0f, 0.0f})
+ .min(-FLT_MAX)
+ .max(FLT_MAX)
+ .subtype(PROP_TRANSLATION);
+ b.add_input<decl::Vector>(N_("Rotation"))
+ .default_value({0.0f, 0.0f, 0.0f})
+ .min(-FLT_MAX)
+ .max(FLT_MAX)
+ .subtype(PROP_EULER);
+ b.add_input<decl::Vector>(N_("Scale"))
+ .default_value({1.0f, 1.0f, 1.0f})
+ .min(-FLT_MAX)
+ .max(FLT_MAX)
+ .subtype(PROP_XYZ);
+ b.add_output<decl::Vector>(N_("Vector"));
+}
-static bNodeSocketTemplate sh_node_mapping_out[] = {
- {SOCK_VECTOR, N_("Vector")},
- {-1, ""},
-};
+static void node_shader_buts_mapping(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
+{
+ uiItemR(layout, ptr, "vector_type", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE);
+}
static const char *gpu_shader_get_name(int mode)
{
@@ -83,7 +101,8 @@ void register_node_type_sh_mapping()
static bNodeType ntype;
sh_node_type_base(&ntype, SH_NODE_MAPPING, "Mapping", NODE_CLASS_OP_VECTOR);
- node_type_socket_templates(&ntype, file_ns::sh_node_mapping_in, file_ns::sh_node_mapping_out);
+ ntype.declare = file_ns::node_declare;
+ ntype.draw_buttons = file_ns::node_shader_buts_mapping;
node_type_gpu(&ntype, file_ns::gpu_shader_mapping);
node_type_update(&ntype, file_ns::node_shader_update_mapping);
diff --git a/source/blender/nodes/shader/nodes/node_shader_math.cc b/source/blender/nodes/shader/nodes/node_shader_math.cc
index ca30b16f7ff..50585405cbf 100644
--- a/source/blender/nodes/shader/nodes/node_shader_math.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_math.cc
@@ -45,7 +45,7 @@ static void sh_node_math_declare(NodeDeclarationBuilder &b)
.min(-10000.0f)
.max(10000.0f);
b.add_output<decl::Float>(N_("Value"));
-};
+}
class SocketSearchOp {
public:
diff --git a/source/blender/nodes/shader/nodes/node_shader_mix_rgb.cc b/source/blender/nodes/shader/nodes/node_shader_mix_rgb.cc
index 7f9dc8424cf..9678e86d289 100644
--- a/source/blender/nodes/shader/nodes/node_shader_mix_rgb.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_mix_rgb.cc
@@ -32,7 +32,7 @@ static void sh_node_mix_rgb_declare(NodeDeclarationBuilder &b)
b.add_input<decl::Color>(N_("Color1")).default_value({0.5f, 0.5f, 0.5f, 1.0f});
b.add_input<decl::Color>(N_("Color2")).default_value({0.5f, 0.5f, 0.5f, 1.0f});
b.add_output<decl::Color>(N_("Color"));
-};
+}
static const char *gpu_shader_get_name(int mode)
{
diff --git a/source/blender/nodes/shader/nodes/node_shader_mix_shader.cc b/source/blender/nodes/shader/nodes/node_shader_mix_shader.cc
index c320fafa2ef..d9aa906e451 100644
--- a/source/blender/nodes/shader/nodes/node_shader_mix_shader.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_mix_shader.cc
@@ -27,7 +27,7 @@ static void node_declare(NodeDeclarationBuilder &b)
b.add_input<decl::Shader>(N_("Shader"));
b.add_input<decl::Shader>(N_("Shader"), "Shader_001");
b.add_output<decl::Shader>(N_("Shader"));
-};
+}
static int node_shader_gpu_mix_shader(GPUMaterial *mat,
bNode *node,
diff --git a/source/blender/nodes/shader/nodes/node_shader_normal.cc b/source/blender/nodes/shader/nodes/node_shader_normal.cc
index d6caa4219f9..e677f36e425 100644
--- a/source/blender/nodes/shader/nodes/node_shader_normal.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_normal.cc
@@ -25,17 +25,20 @@
namespace blender::nodes::node_shader_normal_cc {
-/* **************** NORMAL ******************** */
-static bNodeSocketTemplate sh_node_normal_in[] = {
- {SOCK_VECTOR, N_("Normal"), 0.0f, 0.0f, 1.0f, 0.0f, -1.0f, 1.0f, PROP_DIRECTION},
- {-1, ""},
-};
-
-static bNodeSocketTemplate sh_node_normal_out[] = {
- {SOCK_VECTOR, N_("Normal"), 0.0f, 0.0f, 1.0f, 0.0f, -1.0f, 1.0f, PROP_DIRECTION},
- {SOCK_FLOAT, N_("Dot")},
- {-1, ""},
-};
+static void node_declare(NodeDeclarationBuilder &b)
+{
+ b.add_input<decl::Vector>(N_("Normal"))
+ .default_value({0.0f, 0.0f, 1.0f})
+ .min(-1.0f)
+ .max(1.0f)
+ .subtype(PROP_DIRECTION);
+ b.add_output<decl::Vector>(N_("Normal"))
+ .default_value({0.0f, 0.0f, 1.0f})
+ .min(-1.0f)
+ .max(1.0f)
+ .subtype(PROP_DIRECTION);
+ b.add_output<decl::Float>(N_("Dot"));
+}
static int gpu_shader_normal(GPUMaterial *mat,
bNode *node,
@@ -56,7 +59,7 @@ void register_node_type_sh_normal()
static bNodeType ntype;
sh_node_type_base(&ntype, SH_NODE_NORMAL, "Normal", NODE_CLASS_OP_VECTOR);
- node_type_socket_templates(&ntype, file_ns::sh_node_normal_in, file_ns::sh_node_normal_out);
+ ntype.declare = file_ns::node_declare;
node_type_gpu(&ntype, file_ns::gpu_shader_normal);
nodeRegisterType(&ntype);
diff --git a/source/blender/nodes/shader/nodes/node_shader_normal_map.cc b/source/blender/nodes/shader/nodes/node_shader_normal_map.cc
index ca75a29e6fe..338b4c62a3a 100644
--- a/source/blender/nodes/shader/nodes/node_shader_normal_map.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_normal_map.cc
@@ -19,20 +19,36 @@
#include "node_shader_util.hh"
-namespace blender::nodes::node_shader_normal_map_cc {
+#include "BKE_context.h"
+
+#include "UI_interface.h"
+#include "UI_resources.h"
-/* **************** OUTPUT ******************** */
+namespace blender::nodes::node_shader_normal_map_cc {
-static bNodeSocketTemplate sh_node_normal_map_in[] = {
- {SOCK_FLOAT, N_("Strength"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 10.0f},
- {SOCK_RGBA, N_("Color"), 0.5f, 0.5f, 1.0f, 1.0f, 0.0f, 1.0f},
- {-1, ""},
-};
+static void node_declare(NodeDeclarationBuilder &b)
+{
+ b.add_input<decl::Float>(N_("Strength")).default_value(1.0f).min(0.0f).max(10.0f);
+ b.add_input<decl::Color>(N_("Color")).default_value({0.5f, 0.5f, 1.0f, 1.0f});
+ b.add_output<decl::Vector>(N_("Normal"));
+}
-static bNodeSocketTemplate sh_node_normal_map_out[] = {
- {SOCK_VECTOR, N_("Normal"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
- {-1, ""},
-};
+static void node_shader_buts_normal_map(uiLayout *layout, bContext *C, PointerRNA *ptr)
+{
+ uiItemR(layout, ptr, "space", UI_ITEM_R_SPLIT_EMPTY_NAME, "", 0);
+
+ if (RNA_enum_get(ptr, "space") == SHD_SPACE_TANGENT) {
+ PointerRNA obptr = CTX_data_pointer_get(C, "active_object");
+
+ if (obptr.data && RNA_enum_get(&obptr, "type") == OB_MESH) {
+ PointerRNA dataptr = RNA_pointer_get(&obptr, "data");
+ uiItemPointerR(layout, ptr, "uv_map", &dataptr, "uv_layers", "", ICON_NONE);
+ }
+ else {
+ uiItemR(layout, ptr, "uv_map", UI_ITEM_R_SPLIT_EMPTY_NAME, "", 0);
+ }
+ }
+}
static void node_shader_init_normal_map(bNodeTree *UNUSED(ntree), bNode *node)
{
@@ -118,8 +134,8 @@ void register_node_type_sh_normal_map()
static bNodeType ntype;
sh_node_type_base(&ntype, SH_NODE_NORMAL_MAP, "Normal Map", NODE_CLASS_OP_VECTOR);
- node_type_socket_templates(
- &ntype, file_ns::sh_node_normal_map_in, file_ns::sh_node_normal_map_out);
+ ntype.declare = file_ns::node_declare;
+ ntype.draw_buttons = file_ns::node_shader_buts_normal_map;
node_type_size_preset(&ntype, NODE_SIZE_MIDDLE);
node_type_init(&ntype, file_ns::node_shader_init_normal_map);
node_type_storage(
diff --git a/source/blender/nodes/shader/nodes/node_shader_output_aov.cc b/source/blender/nodes/shader/nodes/node_shader_output_aov.cc
index 58a075e9e05..6ffd763b0d1 100644
--- a/source/blender/nodes/shader/nodes/node_shader_output_aov.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_output_aov.cc
@@ -21,13 +21,21 @@
#include "BLI_hash.h"
+#include "UI_interface.h"
+#include "UI_resources.h"
+
namespace blender::nodes::node_shader_output_aov_cc {
static void node_declare(NodeDeclarationBuilder &b)
{
b.add_input<decl::Color>(N_("Color")).default_value({0.0f, 0.0f, 0.0f, 1.0f});
b.add_input<decl::Float>(N_("Value")).default_value(0.0f).min(0.0f).max(1.0f);
-};
+}
+
+static void node_shader_buts_output_aov(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
+{
+ uiItemR(layout, ptr, "name", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE);
+}
static void node_shader_init_output_aov(bNodeTree *UNUSED(ntree), bNode *node)
{
@@ -63,6 +71,7 @@ void register_node_type_sh_output_aov()
sh_node_type_base(&ntype, SH_NODE_OUTPUT_AOV, "AOV Output", NODE_CLASS_OUTPUT);
ntype.declare = file_ns::node_declare;
+ ntype.draw_buttons = file_ns::node_shader_buts_output_aov;
node_type_init(&ntype, file_ns::node_shader_init_output_aov);
node_type_storage(
&ntype, "NodeShaderOutputAOV", node_free_standard_storage, node_copy_standard_storage);
diff --git a/source/blender/nodes/shader/nodes/node_shader_output_light.cc b/source/blender/nodes/shader/nodes/node_shader_output_light.cc
index 05eec40e020..0c8288f801b 100644
--- a/source/blender/nodes/shader/nodes/node_shader_output_light.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_output_light.cc
@@ -24,7 +24,7 @@ namespace blender::nodes::node_shader_output_light_cc {
static void node_declare(NodeDeclarationBuilder &b)
{
b.add_input<decl::Shader>(N_("Surface"));
-};
+}
} // namespace blender::nodes::node_shader_output_light_cc
diff --git a/source/blender/nodes/shader/nodes/node_shader_output_linestyle.cc b/source/blender/nodes/shader/nodes/node_shader_output_linestyle.cc
index c866b1e336f..9b6c3292e75 100644
--- a/source/blender/nodes/shader/nodes/node_shader_output_linestyle.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_output_linestyle.cc
@@ -19,6 +19,9 @@
#include "node_shader_util.hh"
+#include "UI_interface.h"
+#include "UI_resources.h"
+
namespace blender::nodes::node_shader_output_linestyle_cc {
static void node_declare(NodeDeclarationBuilder &b)
@@ -39,7 +42,17 @@ static void node_declare(NodeDeclarationBuilder &b)
.min(0.0f)
.max(1.0f)
.subtype(PROP_FACTOR);
-};
+}
+
+static void node_buts_output_linestyle(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
+{
+ uiLayout *row, *col;
+
+ col = uiLayoutColumn(layout, false);
+ row = uiLayoutRow(col, true);
+ uiItemR(row, ptr, "blend_type", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE);
+ uiItemR(col, ptr, "use_clamp", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE);
+}
} // namespace blender::nodes::node_shader_output_linestyle_cc
@@ -52,6 +65,7 @@ void register_node_type_sh_output_linestyle()
sh_node_type_base(&ntype, SH_NODE_OUTPUT_LINESTYLE, "Line Style Output", NODE_CLASS_OUTPUT);
ntype.declare = file_ns::node_declare;
+ ntype.draw_buttons = file_ns::node_buts_output_linestyle;
ntype.no_muting = true;
nodeRegisterType(&ntype);
diff --git a/source/blender/nodes/shader/nodes/node_shader_output_material.cc b/source/blender/nodes/shader/nodes/node_shader_output_material.cc
index 7d46e8e28fc..5fc95b92e3f 100644
--- a/source/blender/nodes/shader/nodes/node_shader_output_material.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_output_material.cc
@@ -28,7 +28,7 @@ static void node_declare(NodeDeclarationBuilder &b)
b.add_input<decl::Shader>(N_("Surface"));
b.add_input<decl::Shader>(N_("Volume"));
b.add_input<decl::Vector>(N_("Displacement")).hide_value();
-};
+}
static int node_shader_gpu_output_material(GPUMaterial *mat,
bNode *node,
diff --git a/source/blender/nodes/shader/nodes/node_shader_output_world.cc b/source/blender/nodes/shader/nodes/node_shader_output_world.cc
index 9ea325bbf78..501dc088cbe 100644
--- a/source/blender/nodes/shader/nodes/node_shader_output_world.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_output_world.cc
@@ -25,7 +25,7 @@ static void node_declare(NodeDeclarationBuilder &b)
{
b.add_input<decl::Shader>(N_("Surface"));
b.add_input<decl::Shader>(N_("Volume"));
-};
+}
static int node_shader_gpu_output_world(GPUMaterial *mat,
bNode *node,
diff --git a/source/blender/nodes/shader/nodes/node_shader_particle_info.cc b/source/blender/nodes/shader/nodes/node_shader_particle_info.cc
index 163a5d6ebfe..d68d0fe0d72 100644
--- a/source/blender/nodes/shader/nodes/node_shader_particle_info.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_particle_info.cc
@@ -36,7 +36,7 @@ static void node_declare(NodeDeclarationBuilder &b)
b.add_output<decl::Float>(N_("Size"));
b.add_output<decl::Vector>(N_("Velocity"));
b.add_output<decl::Vector>(N_("Angular Velocity"));
-};
+}
static int gpu_shader_particle_info(GPUMaterial *mat,
bNode *node,
diff --git a/source/blender/nodes/shader/nodes/node_shader_rgb_to_bw.cc b/source/blender/nodes/shader/nodes/node_shader_rgb_to_bw.cc
index d93c2326490..13ba056d9ee 100644
--- a/source/blender/nodes/shader/nodes/node_shader_rgb_to_bw.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_rgb_to_bw.cc
@@ -31,7 +31,7 @@ static void sh_node_rgbtobw_declare(NodeDeclarationBuilder &b)
{
b.add_input<decl::Color>(N_("Color")).default_value({0.5f, 0.5f, 0.5f, 1.0f});
b.add_output<decl::Float>(N_("Val"));
-};
+}
static int gpu_shader_rgbtobw(GPUMaterial *mat,
bNode *node,
diff --git a/source/blender/nodes/shader/nodes/node_shader_script.cc b/source/blender/nodes/shader/nodes/node_shader_script.cc
index 6c6578cf6c1..e6af90fa588 100644
--- a/source/blender/nodes/shader/nodes/node_shader_script.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_script.cc
@@ -23,9 +23,42 @@
#include "node_shader_util.hh"
+#include "UI_interface.h"
+#include "UI_resources.h"
+
namespace blender::nodes::node_shader_script_cc {
-/* **************** Script ******************** */
+static void node_shader_buts_script(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
+{
+ uiLayout *row;
+
+ row = uiLayoutRow(layout, false);
+ uiItemR(row, ptr, "mode", UI_ITEM_R_SPLIT_EMPTY_NAME | UI_ITEM_R_EXPAND, nullptr, ICON_NONE);
+
+ row = uiLayoutRow(layout, true);
+
+ if (RNA_enum_get(ptr, "mode") == NODE_SCRIPT_INTERNAL) {
+ uiItemR(row, ptr, "script", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE);
+ }
+ else {
+ uiItemR(row, ptr, "filepath", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE);
+ }
+
+ uiItemO(row, "", ICON_FILE_REFRESH, "node.shader_script_update");
+}
+
+static void node_shader_buts_script_ex(uiLayout *layout, bContext *C, PointerRNA *ptr)
+{
+ uiItemS(layout);
+
+ node_shader_buts_script(layout, C, ptr);
+
+#if 0 /* not implemented yet */
+ if (RNA_enum_get(ptr, "mode") == NODE_SCRIPT_EXTERNAL) {
+ uiItemR(layout, ptr, "use_auto_update", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE);
+ }
+#endif
+}
static void init(bNodeTree *UNUSED(ntree), bNode *node)
{
@@ -69,6 +102,8 @@ void register_node_type_sh_script()
static bNodeType ntype;
sh_node_type_base(&ntype, SH_NODE_SCRIPT, "Script", NODE_CLASS_SCRIPT);
+ ntype.draw_buttons = file_ns::node_shader_buts_script;
+ ntype.draw_buttons_ex = file_ns::node_shader_buts_script_ex;
node_type_init(&ntype, file_ns::init);
node_type_storage(
&ntype, "NodeShaderScript", file_ns::node_free_script, file_ns::node_copy_script);
diff --git a/source/blender/nodes/shader/nodes/node_shader_sepcomb_hsv.cc b/source/blender/nodes/shader/nodes/node_shader_sepcomb_hsv.cc
index 44cdc5cd402..700e4ce3667 100644
--- a/source/blender/nodes/shader/nodes/node_shader_sepcomb_hsv.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_sepcomb_hsv.cc
@@ -26,16 +26,14 @@
namespace blender::nodes::node_shader_sepcomb_hsv_cc {
/* **************** SEPARATE HSV ******************** */
-static bNodeSocketTemplate sh_node_sephsv_in[] = {
- {SOCK_RGBA, N_("Color"), 0.8f, 0.8f, 0.8f, 1.0f},
- {-1, ""},
-};
-static bNodeSocketTemplate sh_node_sephsv_out[] = {
- {SOCK_FLOAT, N_("H")},
- {SOCK_FLOAT, N_("S")},
- {SOCK_FLOAT, N_("V")},
- {-1, ""},
-};
+
+static void node_declare_sephsv(NodeDeclarationBuilder &b)
+{
+ b.add_input<decl::Color>(N_("Color")).default_value({0.8f, 0.8f, 0.8f, 1.0});
+ b.add_output<decl::Float>(N_("H"));
+ b.add_output<decl::Float>(N_("S"));
+ b.add_output<decl::Float>(N_("V"));
+}
static int gpu_shader_sephsv(GPUMaterial *mat,
bNode *node,
@@ -55,7 +53,7 @@ void register_node_type_sh_sephsv()
static bNodeType ntype;
sh_node_type_base(&ntype, SH_NODE_SEPHSV, "Separate HSV", NODE_CLASS_CONVERTER);
- node_type_socket_templates(&ntype, file_ns::sh_node_sephsv_in, file_ns::sh_node_sephsv_out);
+ ntype.declare = file_ns::node_declare_sephsv;
node_type_gpu(&ntype, file_ns::gpu_shader_sephsv);
nodeRegisterType(&ntype);
@@ -64,16 +62,14 @@ void register_node_type_sh_sephsv()
namespace blender::nodes::node_shader_sepcomb_hsv_cc {
/* **************** COMBINE HSV ******************** */
-static bNodeSocketTemplate sh_node_combhsv_in[] = {
- {SOCK_FLOAT, N_("H"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_UNSIGNED},
- {SOCK_FLOAT, N_("S"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_UNSIGNED},
- {SOCK_FLOAT, N_("V"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_UNSIGNED},
- {-1, ""},
-};
-static bNodeSocketTemplate sh_node_combhsv_out[] = {
- {SOCK_RGBA, N_("Color")},
- {-1, ""},
-};
+
+static void node_declare_combhsv(NodeDeclarationBuilder &b)
+{
+ b.add_input<decl::Float>(N_("H")).default_value(0.0f).min(0.0f).max(1.0f).subtype(PROP_UNSIGNED);
+ b.add_input<decl::Float>(N_("S")).default_value(0.0f).min(0.0f).max(1.0f).subtype(PROP_UNSIGNED);
+ b.add_input<decl::Float>(N_("V")).default_value(0.0f).min(0.0f).max(1.0f).subtype(PROP_UNSIGNED);
+ b.add_output<decl::Color>(N_("Color"));
+}
static int gpu_shader_combhsv(GPUMaterial *mat,
bNode *node,
@@ -93,7 +89,7 @@ void register_node_type_sh_combhsv()
static bNodeType ntype;
sh_node_type_base(&ntype, SH_NODE_COMBHSV, "Combine HSV", NODE_CLASS_CONVERTER);
- node_type_socket_templates(&ntype, file_ns::sh_node_combhsv_in, file_ns::sh_node_combhsv_out);
+ ntype.declare = file_ns::node_declare_combhsv;
node_type_gpu(&ntype, file_ns::gpu_shader_combhsv);
nodeRegisterType(&ntype);
diff --git a/source/blender/nodes/shader/nodes/node_shader_sepcomb_rgb.cc b/source/blender/nodes/shader/nodes/node_shader_sepcomb_rgb.cc
index 5ca2d4e2f68..d4be0bd14dc 100644
--- a/source/blender/nodes/shader/nodes/node_shader_sepcomb_rgb.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_sepcomb_rgb.cc
@@ -32,7 +32,7 @@ static void sh_node_seprgb_declare(NodeDeclarationBuilder &b)
b.add_output<decl::Float>(N_("R"));
b.add_output<decl::Float>(N_("G"));
b.add_output<decl::Float>(N_("B"));
-};
+}
static int gpu_shader_seprgb(GPUMaterial *mat,
bNode *node,
@@ -111,7 +111,7 @@ static void sh_node_combrgb_declare(NodeDeclarationBuilder &b)
b.add_input<decl::Float>(N_("G")).min(0.0f).max(1.0f);
b.add_input<decl::Float>(N_("B")).min(0.0f).max(1.0f);
b.add_output<decl::Color>(N_("Image"));
-};
+}
static int gpu_shader_combrgb(GPUMaterial *mat,
bNode *node,
diff --git a/source/blender/nodes/shader/nodes/node_shader_sepcomb_xyz.cc b/source/blender/nodes/shader/nodes/node_shader_sepcomb_xyz.cc
index 57eef716e88..f8064eb192a 100644
--- a/source/blender/nodes/shader/nodes/node_shader_sepcomb_xyz.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_sepcomb_xyz.cc
@@ -32,7 +32,7 @@ static void sh_node_sepxyz_declare(NodeDeclarationBuilder &b)
b.add_output<decl::Float>(N_("X"));
b.add_output<decl::Float>(N_("Y"));
b.add_output<decl::Float>(N_("Z"));
-};
+}
static int gpu_shader_sepxyz(GPUMaterial *mat,
bNode *node,
@@ -111,7 +111,7 @@ static void sh_node_combxyz_declare(NodeDeclarationBuilder &b)
b.add_input<decl::Float>(N_("Y")).min(-10000.0f).max(10000.0f);
b.add_input<decl::Float>(N_("Z")).min(-10000.0f).max(10000.0f);
b.add_output<decl::Vector>(N_("Vector"));
-};
+}
static int gpu_shader_combxyz(GPUMaterial *mat,
bNode *node,
diff --git a/source/blender/nodes/shader/nodes/node_shader_shader_to_rgb.cc b/source/blender/nodes/shader/nodes/node_shader_shader_to_rgb.cc
index 2e0ba3f1a36..153b1abfbca 100644
--- a/source/blender/nodes/shader/nodes/node_shader_shader_to_rgb.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_shader_to_rgb.cc
@@ -26,7 +26,7 @@ static void node_declare(NodeDeclarationBuilder &b)
b.add_input<decl::Shader>(N_("Shader"));
b.add_output<decl::Color>(N_("Color"));
b.add_output<decl::Float>(N_("Alpha"));
-};
+}
static int node_shader_gpu_shadertorgb(GPUMaterial *mat,
bNode *node,
diff --git a/source/blender/nodes/shader/nodes/node_shader_squeeze.cc b/source/blender/nodes/shader/nodes/node_shader_squeeze.cc
index f71b6a3e4e5..83965160019 100644
--- a/source/blender/nodes/shader/nodes/node_shader_squeeze.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_squeeze.cc
@@ -25,14 +25,13 @@
namespace blender::nodes::node_shader_squeeze_cc {
-/* **************** VALUE SQUEEZE ******************** */
-static bNodeSocketTemplate sh_node_squeeze_in[] = {
- {SOCK_FLOAT, N_("Value"), 0.0f, 0.0f, 0.0f, 0.0f, -100.0f, 100.0f, PROP_NONE},
- {SOCK_FLOAT, N_("Width"), 1.0f, 0.0f, 0.0f, 0.0f, -100.0f, 100.0f, PROP_NONE},
- {SOCK_FLOAT, N_("Center"), 0.0f, 0.0f, 0.0f, 0.0f, -100.0f, 100.0f, PROP_NONE},
- {-1, ""}};
-
-static bNodeSocketTemplate sh_node_squeeze_out[] = {{SOCK_FLOAT, N_("Value")}, {-1, ""}};
+static void node_declare(NodeDeclarationBuilder &b)
+{
+ b.add_input<decl::Float>(N_("Value")).default_value(0.0f).min(-100.0f).max(100.0f);
+ b.add_input<decl::Float>(N_("Width")).default_value(1.0f).min(-100.0f).max(100.0f);
+ b.add_input<decl::Float>(N_("Center")).default_value(0.0f).min(-100.0f).max(100.0f);
+ b.add_output<decl::Float>(N_("Value"));
+}
static int gpu_shader_squeeze(GPUMaterial *mat,
bNode *node,
@@ -52,7 +51,7 @@ void register_node_type_sh_squeeze()
static bNodeType ntype;
sh_node_type_base(&ntype, SH_NODE_SQUEEZE, "Squeeze Value", NODE_CLASS_CONVERTER);
- node_type_socket_templates(&ntype, file_ns::sh_node_squeeze_in, file_ns::sh_node_squeeze_out);
+ ntype.declare = file_ns::node_declare;
node_type_gpu(&ntype, file_ns::gpu_shader_squeeze);
nodeRegisterType(&ntype);
diff --git a/source/blender/nodes/shader/nodes/node_shader_subsurface_scattering.cc b/source/blender/nodes/shader/nodes/node_shader_subsurface_scattering.cc
index a5820aef194..f60db81b4a9 100644
--- a/source/blender/nodes/shader/nodes/node_shader_subsurface_scattering.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_subsurface_scattering.cc
@@ -19,24 +19,35 @@
#include "node_shader_util.hh"
-namespace blender::nodes::node_shader_subsurface_scattering_cc {
+#include "UI_interface.h"
+#include "UI_resources.h"
-/* **************** OUTPUT ******************** */
+namespace blender::nodes::node_shader_subsurface_scattering_cc {
-static bNodeSocketTemplate sh_node_subsurface_scattering_in[] = {
- {SOCK_RGBA, N_("Color"), 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f},
- {SOCK_FLOAT, N_("Scale"), 1.0, 0.0f, 0.0f, 0.0f, 0.0f, 1000.0f},
- {SOCK_VECTOR, N_("Radius"), 1.0f, 0.2f, 0.1f, 0.0f, 0.0f, 100.0f, PROP_NONE, SOCK_COMPACT},
- {SOCK_FLOAT, N_("IOR"), 1.4f, 0.0f, 0.0f, 0.0f, 1.01f, 3.8f, PROP_FACTOR},
- {SOCK_FLOAT, N_("Anisotropy"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR},
- {SOCK_VECTOR, N_("Normal"), 0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE},
- {-1, ""},
-};
+static void node_declare(NodeDeclarationBuilder &b)
+{
+ b.add_input<decl::Color>(N_("Color")).default_value({0.8f, 0.8f, 0.8f, 1.0f});
+ b.add_input<decl::Float>(N_("Scale")).default_value(1.0f).min(0.0f).max(1000.0f);
+ b.add_input<decl::Vector>(N_("Radius"))
+ .default_value({1.0f, 0.2f, 0.1f})
+ .min(0.0f)
+ .max(100.0f)
+ .compact();
+ b.add_input<decl::Float>(N_("IOR")).default_value(1.4f).min(1.01f).max(3.8f).subtype(
+ PROP_FACTOR);
+ b.add_input<decl::Float>(N_("Anisotropy"))
+ .default_value(0.0f)
+ .min(0.0f)
+ .max(1.0f)
+ .subtype(PROP_FACTOR);
+ b.add_input<decl::Vector>(N_("Normal")).hide_value();
+ b.add_output<decl::Shader>(N_("BSSRDF"));
+}
-static bNodeSocketTemplate sh_node_subsurface_scattering_out[] = {
- {SOCK_SHADER, N_("BSSRDF")},
- {-1, ""},
-};
+static void node_shader_buts_subsurface(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
+{
+ uiItemR(layout, ptr, "falloff", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE);
+}
static void node_shader_init_subsurface_scattering(bNodeTree *UNUSED(ntree), bNode *node)
{
@@ -91,9 +102,8 @@ void register_node_type_sh_subsurface_scattering()
sh_node_type_base(
&ntype, SH_NODE_SUBSURFACE_SCATTERING, "Subsurface Scattering", NODE_CLASS_SHADER);
- node_type_socket_templates(&ntype,
- file_ns::sh_node_subsurface_scattering_in,
- file_ns::sh_node_subsurface_scattering_out);
+ ntype.declare = file_ns::node_declare;
+ ntype.draw_buttons = file_ns::node_shader_buts_subsurface;
node_type_size_preset(&ntype, NODE_SIZE_MIDDLE);
node_type_init(&ntype, file_ns::node_shader_init_subsurface_scattering);
node_type_gpu(&ntype, file_ns::node_shader_gpu_subsurface_scattering);
diff --git a/source/blender/nodes/shader/nodes/node_shader_tangent.cc b/source/blender/nodes/shader/nodes/node_shader_tangent.cc
index 55eec96ce81..c4e5660b9f8 100644
--- a/source/blender/nodes/shader/nodes/node_shader_tangent.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_tangent.cc
@@ -19,12 +19,43 @@
#include "node_shader_util.hh"
+#include "BKE_context.h"
+
+#include "UI_interface.h"
+#include "UI_resources.h"
+
namespace blender::nodes::node_shader_tangent_cc {
static void node_declare(NodeDeclarationBuilder &b)
{
b.add_output<decl::Vector>(N_("Tangent"));
-};
+}
+
+static void node_shader_buts_tangent(uiLayout *layout, bContext *C, PointerRNA *ptr)
+{
+ uiLayout *split, *row;
+
+ split = uiLayoutSplit(layout, 0.0f, false);
+
+ uiItemR(split, ptr, "direction_type", UI_ITEM_R_SPLIT_EMPTY_NAME, "", 0);
+
+ row = uiLayoutRow(split, false);
+
+ if (RNA_enum_get(ptr, "direction_type") == SHD_TANGENT_UVMAP) {
+ PointerRNA obptr = CTX_data_pointer_get(C, "active_object");
+
+ if (obptr.data && RNA_enum_get(&obptr, "type") == OB_MESH) {
+ PointerRNA dataptr = RNA_pointer_get(&obptr, "data");
+ uiItemPointerR(row, ptr, "uv_map", &dataptr, "uv_layers", "", ICON_NONE);
+ }
+ else {
+ uiItemR(row, ptr, "uv_map", UI_ITEM_R_SPLIT_EMPTY_NAME, "", 0);
+ }
+ }
+ else {
+ uiItemR(row, ptr, "axis", UI_ITEM_R_SPLIT_EMPTY_NAME | UI_ITEM_R_EXPAND, nullptr, 0);
+ }
+}
static void node_shader_init_tangent(bNodeTree *UNUSED(ntree), bNode *node)
{
@@ -79,6 +110,7 @@ void register_node_type_sh_tangent()
sh_node_type_base(&ntype, SH_NODE_TANGENT, "Tangent", NODE_CLASS_INPUT);
ntype.declare = file_ns::node_declare;
+ ntype.draw_buttons = file_ns::node_shader_buts_tangent;
node_type_size_preset(&ntype, NODE_SIZE_MIDDLE);
node_type_init(&ntype, file_ns::node_shader_init_tangent);
node_type_gpu(&ntype, file_ns::node_shader_gpu_tangent);
diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_brick.cc b/source/blender/nodes/shader/nodes/node_shader_tex_brick.cc
index 6a4a131a315..61b1613c11a 100644
--- a/source/blender/nodes/shader/nodes/node_shader_tex_brick.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_tex_brick.cc
@@ -22,6 +22,9 @@
#include "BLI_float2.hh"
#include "BLI_float4.hh"
+#include "UI_interface.h"
+#include "UI_resources.h"
+
namespace blender::nodes::node_shader_tex_brick_cc {
static void sh_node_tex_brick_declare(NodeDeclarationBuilder &b)
@@ -55,7 +58,27 @@ static void sh_node_tex_brick_declare(NodeDeclarationBuilder &b)
.no_muted_links();
b.add_output<decl::Color>(N_("Color"));
b.add_output<decl::Float>(N_("Fac"));
-};
+}
+
+static void node_shader_buts_tex_brick(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
+{
+ uiLayout *col;
+
+ col = uiLayoutColumn(layout, true);
+ uiItemR(col,
+ ptr,
+ "offset",
+ UI_ITEM_R_SPLIT_EMPTY_NAME | UI_ITEM_R_SLIDER,
+ IFACE_("Offset"),
+ ICON_NONE);
+ uiItemR(
+ col, ptr, "offset_frequency", UI_ITEM_R_SPLIT_EMPTY_NAME, IFACE_("Frequency"), ICON_NONE);
+
+ col = uiLayoutColumn(layout, true);
+ uiItemR(col, ptr, "squash", UI_ITEM_R_SPLIT_EMPTY_NAME, IFACE_("Squash"), ICON_NONE);
+ uiItemR(
+ col, ptr, "squash_frequency", UI_ITEM_R_SPLIT_EMPTY_NAME, IFACE_("Frequency"), ICON_NONE);
+}
static void node_shader_init_tex_brick(bNodeTree *UNUSED(ntree), bNode *node)
{
@@ -272,6 +295,7 @@ void register_node_type_sh_tex_brick()
sh_fn_node_type_base(&ntype, SH_NODE_TEX_BRICK, "Brick Texture", NODE_CLASS_TEXTURE);
ntype.declare = file_ns::sh_node_tex_brick_declare;
+ ntype.draw_buttons = file_ns::node_shader_buts_tex_brick;
node_type_size_preset(&ntype, NODE_SIZE_MIDDLE);
node_type_init(&ntype, file_ns::node_shader_init_tex_brick);
node_type_storage(
diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_checker.cc b/source/blender/nodes/shader/nodes/node_shader_tex_checker.cc
index f22af9f4963..6022f13821a 100644
--- a/source/blender/nodes/shader/nodes/node_shader_tex_checker.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_tex_checker.cc
@@ -34,7 +34,7 @@ static void sh_node_tex_checker_declare(NodeDeclarationBuilder &b)
.no_muted_links();
b.add_output<decl::Color>(N_("Color"));
b.add_output<decl::Float>(N_("Fac"));
-};
+}
static void node_shader_init_tex_checker(bNodeTree *UNUSED(ntree), bNode *node)
{
diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_coord.cc b/source/blender/nodes/shader/nodes/node_shader_tex_coord.cc
index 9372d29456d..1bbaed88ea5 100644
--- a/source/blender/nodes/shader/nodes/node_shader_tex_coord.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_tex_coord.cc
@@ -21,20 +21,27 @@
#include "DNA_customdata_types.h"
+#include "UI_interface.h"
+#include "UI_resources.h"
+
namespace blender::nodes::node_shader_tex_coord_cc {
-/* **************** OUTPUT ******************** */
+static void node_declare(NodeDeclarationBuilder &b)
+{
+ b.add_output<decl::Vector>(N_("Generated"));
+ b.add_output<decl::Vector>(N_("Normal"));
+ b.add_output<decl::Vector>(N_("UV"));
+ b.add_output<decl::Vector>(N_("Object"));
+ b.add_output<decl::Vector>(N_("Camera"));
+ b.add_output<decl::Vector>(N_("Window"));
+ b.add_output<decl::Vector>(N_("Reflection"));
+}
-static bNodeSocketTemplate sh_node_tex_coord_out[] = {
- {SOCK_VECTOR, N_("Generated"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
- {SOCK_VECTOR, N_("Normal"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
- {SOCK_VECTOR, N_("UV"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
- {SOCK_VECTOR, N_("Object"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
- {SOCK_VECTOR, N_("Camera"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
- {SOCK_VECTOR, N_("Window"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
- {SOCK_VECTOR, N_("Reflection"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
- {-1, ""},
-};
+static void node_shader_buts_tex_coord(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
+{
+ uiItemR(layout, ptr, "object", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, 0);
+ uiItemR(layout, ptr, "from_instancer", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, 0);
+}
static int node_shader_gpu_tex_coord(GPUMaterial *mat,
bNode *node,
@@ -63,8 +70,8 @@ static int node_shader_gpu_tex_coord(GPUMaterial *mat,
GPU_stack_link(
mat, node, "node_tex_coord", in, out, viewpos, worldnor, inv_obmat, texcofacs, orco, mtface);
- /* for each output. */
- for (int i = 0; sh_node_tex_coord_out[i].type != -1; i++) {
+ int i;
+ LISTBASE_FOREACH_INDEX (bNodeSocket *, sock, &node->outputs, i) {
node_shader_gpu_bump_tex_coord(mat, node, &out[i].link);
/* Normalize some vectors after dFdx/dFdy offsets.
* This is the case for interpolated, non linear functions.
@@ -95,7 +102,8 @@ void register_node_type_sh_tex_coord()
static bNodeType ntype;
sh_node_type_base(&ntype, SH_NODE_TEX_COORD, "Texture Coordinate", NODE_CLASS_INPUT);
- node_type_socket_templates(&ntype, nullptr, file_ns::sh_node_tex_coord_out);
+ ntype.declare = file_ns::node_declare;
+ ntype.draw_buttons = file_ns::node_shader_buts_tex_coord;
node_type_gpu(&ntype, file_ns::node_shader_gpu_tex_coord);
nodeRegisterType(&ntype);
diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_environment.cc b/source/blender/nodes/shader/nodes/node_shader_tex_environment.cc
index aa96d075f7f..7b947392084 100644
--- a/source/blender/nodes/shader/nodes/node_shader_tex_environment.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_tex_environment.cc
@@ -21,17 +21,11 @@
namespace blender::nodes::node_shader_tex_environment_cc {
-/* **************** OUTPUT ******************** */
-
-static bNodeSocketTemplate sh_node_tex_environment_in[] = {
- {SOCK_VECTOR, N_("Vector"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE},
- {-1, ""},
-};
-
-static bNodeSocketTemplate sh_node_tex_environment_out[] = {
- {SOCK_RGBA, N_("Color"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE, SOCK_NO_INTERNAL_LINK},
- {-1, ""},
-};
+static void node_declare(NodeDeclarationBuilder &b)
+{
+ b.add_input<decl::Vector>(N_("Vector")).hide_value();
+ b.add_output<decl::Color>(N_("Color")).no_muted_links();
+}
static void node_shader_init_tex_environment(bNodeTree *UNUSED(ntree), bNode *node)
{
@@ -144,8 +138,7 @@ void register_node_type_sh_tex_environment()
static bNodeType ntype;
sh_node_type_base(&ntype, SH_NODE_TEX_ENVIRONMENT, "Environment Texture", NODE_CLASS_TEXTURE);
- node_type_socket_templates(
- &ntype, file_ns::sh_node_tex_environment_in, file_ns::sh_node_tex_environment_out);
+ ntype.declare = file_ns::node_declare;
node_type_init(&ntype, file_ns::node_shader_init_tex_environment);
node_type_storage(
&ntype, "NodeTexEnvironment", node_free_standard_storage, node_copy_standard_storage);
diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_gradient.cc b/source/blender/nodes/shader/nodes/node_shader_tex_gradient.cc
index 29031f9ea81..53be5bc09d9 100644
--- a/source/blender/nodes/shader/nodes/node_shader_tex_gradient.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_tex_gradient.cc
@@ -19,6 +19,9 @@
#include "node_shader_util.hh"
+#include "UI_interface.h"
+#include "UI_resources.h"
+
namespace blender::nodes::node_shader_tex_gradient_cc {
static void sh_node_tex_gradient_declare(NodeDeclarationBuilder &b)
@@ -27,7 +30,12 @@ static void sh_node_tex_gradient_declare(NodeDeclarationBuilder &b)
b.add_input<decl::Vector>(N_("Vector")).hide_value().implicit_field();
b.add_output<decl::Color>(N_("Color")).no_muted_links();
b.add_output<decl::Float>(N_("Fac")).no_muted_links();
-};
+}
+
+static void node_shader_buts_tex_gradient(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
+{
+ uiItemR(layout, ptr, "gradient_type", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE);
+}
static void node_shader_init_tex_gradient(bNodeTree *UNUSED(ntree), bNode *node)
{
@@ -163,6 +171,7 @@ void register_node_type_sh_tex_gradient()
sh_fn_node_type_base(&ntype, SH_NODE_TEX_GRADIENT, "Gradient Texture", NODE_CLASS_TEXTURE);
ntype.declare = file_ns::sh_node_tex_gradient_declare;
+ ntype.draw_buttons = file_ns::node_shader_buts_tex_gradient;
node_type_init(&ntype, file_ns::node_shader_init_tex_gradient);
node_type_storage(
&ntype, "NodeTexGradient", node_free_standard_storage, node_copy_standard_storage);
diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_image.cc b/source/blender/nodes/shader/nodes/node_shader_tex_image.cc
index 745121691ac..d5479f46a35 100644
--- a/source/blender/nodes/shader/nodes/node_shader_tex_image.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_tex_image.cc
@@ -27,7 +27,7 @@ static void sh_node_tex_image_declare(NodeDeclarationBuilder &b)
b.add_input<decl::Vector>(N_("Vector")).implicit_field();
b.add_output<decl::Color>(N_("Color")).no_muted_links();
b.add_output<decl::Float>(N_("Alpha")).no_muted_links();
-};
+}
static void node_shader_init_tex_image(bNodeTree *UNUSED(ntree), bNode *node)
{
diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_magic.cc b/source/blender/nodes/shader/nodes/node_shader_tex_magic.cc
index b388f1a3172..e40914783b6 100644
--- a/source/blender/nodes/shader/nodes/node_shader_tex_magic.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_tex_magic.cc
@@ -19,6 +19,9 @@
#include "node_shader_util.hh"
+#include "UI_interface.h"
+#include "UI_resources.h"
+
namespace blender::nodes::node_shader_tex_magic_cc {
static void sh_node_tex_magic_declare(NodeDeclarationBuilder &b)
@@ -29,7 +32,12 @@ static void sh_node_tex_magic_declare(NodeDeclarationBuilder &b)
b.add_input<decl::Float>(N_("Distortion")).min(-1000.0f).max(1000.0f).default_value(1.0f);
b.add_output<decl::Color>(N_("Color")).no_muted_links();
b.add_output<decl::Float>(N_("Fac")).no_muted_links();
-};
+}
+
+static void node_shader_buts_tex_magic(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
+{
+ uiItemR(layout, ptr, "turbulence_depth", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE);
+}
static void node_shader_init_tex_magic(bNodeTree *UNUSED(ntree), bNode *node)
{
@@ -185,6 +193,7 @@ void register_node_type_sh_tex_magic()
sh_fn_node_type_base(&ntype, SH_NODE_TEX_MAGIC, "Magic Texture", NODE_CLASS_TEXTURE);
ntype.declare = file_ns::sh_node_tex_magic_declare;
+ ntype.draw_buttons = file_ns::node_shader_buts_tex_magic;
node_type_init(&ntype, file_ns::node_shader_init_tex_magic);
node_type_storage(
&ntype, "NodeTexMagic", node_free_standard_storage, node_copy_standard_storage);
diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_musgrave.cc b/source/blender/nodes/shader/nodes/node_shader_tex_musgrave.cc
index 94713ad24ba..45c2a83c178 100644
--- a/source/blender/nodes/shader/nodes/node_shader_tex_musgrave.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_tex_musgrave.cc
@@ -21,6 +21,9 @@
#include "BLI_noise.hh"
+#include "UI_interface.h"
+#include "UI_resources.h"
+
namespace blender::nodes::node_shader_tex_musgrave_cc {
NODE_STORAGE_FUNCS(NodeTexMusgrave)
@@ -40,7 +43,13 @@ static void sh_node_tex_musgrave_declare(NodeDeclarationBuilder &b)
b.add_input<decl::Float>(N_("Offset")).min(-1000.0f).max(1000.0f);
b.add_input<decl::Float>(N_("Gain")).min(0.0f).max(1000.0f).default_value(1.0f);
b.add_output<decl::Float>(N_("Fac")).no_muted_links();
-};
+}
+
+static void node_shader_buts_tex_musgrave(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
+{
+ uiItemR(layout, ptr, "musgrave_dimensions", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE);
+ uiItemR(layout, ptr, "musgrave_type", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE);
+}
static void node_shader_init_tex_musgrave(bNodeTree *UNUSED(ntree), bNode *node)
{
@@ -539,6 +548,7 @@ void register_node_type_sh_tex_musgrave()
sh_fn_node_type_base(&ntype, SH_NODE_TEX_MUSGRAVE, "Musgrave Texture", NODE_CLASS_TEXTURE);
ntype.declare = file_ns::sh_node_tex_musgrave_declare;
+ ntype.draw_buttons = file_ns::node_shader_buts_tex_musgrave;
node_type_size_preset(&ntype, NODE_SIZE_MIDDLE);
node_type_init(&ntype, file_ns::node_shader_init_tex_musgrave);
node_type_storage(
diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_noise.cc b/source/blender/nodes/shader/nodes/node_shader_tex_noise.cc
index 07714dba3f0..1c703313edf 100644
--- a/source/blender/nodes/shader/nodes/node_shader_tex_noise.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_tex_noise.cc
@@ -21,6 +21,9 @@
#include "BLI_noise.hh"
+#include "UI_interface.h"
+#include "UI_resources.h"
+
namespace blender::nodes::node_shader_tex_noise_cc {
NODE_STORAGE_FUNCS(NodeTexNoise)
@@ -43,7 +46,12 @@ static void sh_node_tex_noise_declare(NodeDeclarationBuilder &b)
b.add_input<decl::Float>(N_("Distortion")).min(-1000.0f).max(1000.0f).default_value(0.0f);
b.add_output<decl::Float>(N_("Fac")).no_muted_links();
b.add_output<decl::Color>(N_("Color")).no_muted_links();
-};
+}
+
+static void node_shader_buts_tex_noise(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
+{
+ uiItemR(layout, ptr, "noise_dimensions", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE);
+}
static void node_shader_init_tex_noise(bNodeTree *UNUSED(ntree), bNode *node)
{
@@ -256,6 +264,7 @@ void register_node_type_sh_tex_noise()
sh_fn_node_type_base(&ntype, SH_NODE_TEX_NOISE, "Noise Texture", NODE_CLASS_TEXTURE);
ntype.declare = file_ns::sh_node_tex_noise_declare;
+ ntype.draw_buttons = file_ns::node_shader_buts_tex_noise;
node_type_init(&ntype, file_ns::node_shader_init_tex_noise);
node_type_storage(
&ntype, "NodeTexNoise", node_free_standard_storage, node_copy_standard_storage);
diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_pointdensity.cc b/source/blender/nodes/shader/nodes/node_shader_tex_pointdensity.cc
index 31d14d09963..1a4cf70565f 100644
--- a/source/blender/nodes/shader/nodes/node_shader_tex_pointdensity.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_tex_pointdensity.cc
@@ -21,20 +21,63 @@
#include "RE_texture.h"
+#include "UI_interface.h"
+#include "UI_resources.h"
+
namespace blender::nodes::node_shader_tex_pointdensity_cc {
-/* **************** OUTPUT ******************** */
+static void node_declare(NodeDeclarationBuilder &b)
+{
+ b.add_input<decl::Vector>(N_("Vector")).hide_value();
+ b.add_output<decl::Color>(N_("Color"));
+ b.add_output<decl::Float>(N_("Density"));
+}
+
+static void node_shader_buts_tex_pointdensity(uiLayout *layout,
+ bContext *UNUSED(C),
+ PointerRNA *ptr)
+{
+ bNode *node = (bNode *)ptr->data;
+ NodeShaderTexPointDensity *shader_point_density = (NodeShaderTexPointDensity *)node->storage;
+ Object *ob = (Object *)node->id;
+
+ PointerRNA ob_ptr, obdata_ptr;
+ RNA_id_pointer_create((ID *)ob, &ob_ptr);
+ RNA_id_pointer_create(ob ? (ID *)ob->data : nullptr, &obdata_ptr);
-static bNodeSocketTemplate sh_node_tex_pointdensity_in[] = {
- {SOCK_VECTOR, N_("Vector"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE},
- {-1, ""},
-};
+ uiItemR(layout, ptr, "point_source", UI_ITEM_R_EXPAND, nullptr, ICON_NONE);
+ uiItemR(layout, ptr, "object", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE);
-static bNodeSocketTemplate sh_node_tex_pointdensity_out[] = {
- {SOCK_RGBA, N_("Color"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
- {SOCK_FLOAT, N_("Density"), 0.0f, 0.0f, 0.0f, 0.0f, -10000.0f, 10000.0f},
- {-1, ""},
-};
+ if (node->id && shader_point_density->point_source == SHD_POINTDENSITY_SOURCE_PSYS) {
+ PointerRNA dataptr;
+ RNA_id_pointer_create((ID *)node->id, &dataptr);
+ uiItemPointerR(
+ layout, ptr, "particle_system", &dataptr, "particle_systems", nullptr, ICON_NONE);
+ }
+
+ uiItemR(layout, ptr, "space", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE);
+ uiItemR(layout, ptr, "radius", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE);
+ uiItemR(layout, ptr, "interpolation", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE);
+ uiItemR(layout, ptr, "resolution", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE);
+ if (shader_point_density->point_source == SHD_POINTDENSITY_SOURCE_PSYS) {
+ uiItemR(layout, ptr, "particle_color_source", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE);
+ }
+ else {
+ uiItemR(layout, ptr, "vertex_color_source", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE);
+ if (shader_point_density->ob_color_source == SHD_POINTDENSITY_COLOR_VERTWEIGHT) {
+ if (ob_ptr.data) {
+ uiItemPointerR(
+ layout, ptr, "vertex_attribute_name", &ob_ptr, "vertex_groups", "", ICON_NONE);
+ }
+ }
+ if (shader_point_density->ob_color_source == SHD_POINTDENSITY_COLOR_VERTCOL) {
+ if (obdata_ptr.data) {
+ uiItemPointerR(
+ layout, ptr, "vertex_attribute_name", &obdata_ptr, "vertex_colors", "", ICON_NONE);
+ }
+ }
+ }
+}
static void node_shader_init_tex_pointdensity(bNodeTree *UNUSED(ntree), bNode *node)
{
@@ -76,8 +119,8 @@ void register_node_type_sh_tex_pointdensity()
static bNodeType ntype;
sh_node_type_base(&ntype, SH_NODE_TEX_POINTDENSITY, "Point Density", NODE_CLASS_TEXTURE);
- node_type_socket_templates(
- &ntype, file_ns::sh_node_tex_pointdensity_in, file_ns::sh_node_tex_pointdensity_out);
+ ntype.declare = file_ns::node_declare;
+ ntype.draw_buttons = file_ns::node_shader_buts_tex_pointdensity;
node_type_init(&ntype, file_ns::node_shader_init_tex_pointdensity);
node_type_storage(&ntype,
"NodeShaderTexPointDensity",
diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_sky.cc b/source/blender/nodes/shader/nodes/node_shader_tex_sky.cc
index 30ec746c2d0..b8728d69bba 100644
--- a/source/blender/nodes/shader/nodes/node_shader_tex_sky.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_tex_sky.cc
@@ -20,19 +20,59 @@
#include "node_shader_util.hh"
#include "sky_model.h"
+#include "BKE_context.h"
+#include "BKE_scene.h"
+
+#include "UI_interface.h"
+#include "UI_resources.h"
+
namespace blender::nodes::node_shader_tex_sky_cc {
-/* **************** OUTPUT ******************** */
+static void node_declare(NodeDeclarationBuilder &b)
+{
+ b.add_input<decl::Vector>(N_("Vector")).hide_value();
+ b.add_output<decl::Color>(N_("Color")).no_muted_links();
+}
-static bNodeSocketTemplate sh_node_tex_sky_in[] = {
- {SOCK_VECTOR, N_("Vector"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE},
- {-1, ""},
-};
+static void node_shader_buts_tex_sky(uiLayout *layout, bContext *C, PointerRNA *ptr)
+{
+ uiItemR(layout, ptr, "sky_type", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE);
-static bNodeSocketTemplate sh_node_tex_sky_out[] = {
- {SOCK_RGBA, N_("Color"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE, SOCK_NO_INTERNAL_LINK},
- {-1, ""},
-};
+ if (RNA_enum_get(ptr, "sky_type") == SHD_SKY_PREETHAM) {
+ uiItemR(layout, ptr, "sun_direction", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE);
+ uiItemR(layout, ptr, "turbidity", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE);
+ }
+ if (RNA_enum_get(ptr, "sky_type") == SHD_SKY_HOSEK) {
+ uiItemR(layout, ptr, "sun_direction", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE);
+ uiItemR(layout, ptr, "turbidity", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE);
+ uiItemR(layout, ptr, "ground_albedo", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE);
+ }
+ if (RNA_enum_get(ptr, "sky_type") == SHD_SKY_NISHITA) {
+ Scene *scene = CTX_data_scene(C);
+ if (BKE_scene_uses_blender_eevee(scene)) {
+ uiItemL(layout, TIP_("Nishita not available in Eevee"), ICON_ERROR);
+ }
+ uiItemR(layout, ptr, "sun_disc", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, 0);
+
+ uiLayout *col;
+ if (RNA_boolean_get(ptr, "sun_disc")) {
+ col = uiLayoutColumn(layout, true);
+ uiItemR(col, ptr, "sun_size", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE);
+ uiItemR(col, ptr, "sun_intensity", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE);
+ }
+
+ col = uiLayoutColumn(layout, true);
+ uiItemR(col, ptr, "sun_elevation", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE);
+ uiItemR(col, ptr, "sun_rotation", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE);
+
+ uiItemR(layout, ptr, "altitude", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE);
+
+ col = uiLayoutColumn(layout, true);
+ uiItemR(col, ptr, "air_density", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE);
+ uiItemR(col, ptr, "dust_density", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE);
+ uiItemR(col, ptr, "ozone_density", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE);
+ }
+}
static void node_shader_init_tex_sky(bNodeTree *UNUSED(ntree), bNode *node)
{
@@ -215,7 +255,8 @@ void register_node_type_sh_tex_sky()
static bNodeType ntype;
sh_node_type_base(&ntype, SH_NODE_TEX_SKY, "Sky Texture", NODE_CLASS_TEXTURE);
- node_type_socket_templates(&ntype, file_ns::sh_node_tex_sky_in, file_ns::sh_node_tex_sky_out);
+ ntype.declare = file_ns::node_declare;
+ ntype.draw_buttons = file_ns::node_shader_buts_tex_sky;
node_type_size_preset(&ntype, NODE_SIZE_MIDDLE);
node_type_init(&ntype, file_ns::node_shader_init_tex_sky);
node_type_storage(&ntype, "NodeTexSky", node_free_standard_storage, node_copy_standard_storage);
diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_voronoi.cc b/source/blender/nodes/shader/nodes/node_shader_tex_voronoi.cc
index 6e6f719af2c..209f96449cd 100644
--- a/source/blender/nodes/shader/nodes/node_shader_tex_voronoi.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_tex_voronoi.cc
@@ -21,6 +21,9 @@
#include "BLI_noise.hh"
+#include "UI_interface.h"
+#include "UI_resources.h"
+
namespace blender::nodes::node_shader_tex_voronoi_cc {
NODE_STORAGE_FUNCS(NodeTexVoronoi)
@@ -60,7 +63,18 @@ static void sh_node_tex_voronoi_declare(NodeDeclarationBuilder &b)
b.add_output<decl::Float>(N_("Radius")).no_muted_links().make_available([](bNode &node) {
node_storage(node).feature = SHD_VORONOI_N_SPHERE_RADIUS;
});
-};
+}
+
+static void node_shader_buts_tex_voronoi(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
+{
+ uiItemR(layout, ptr, "voronoi_dimensions", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE);
+ uiItemR(layout, ptr, "feature", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE);
+ int feature = RNA_enum_get(ptr, "feature");
+ if (!ELEM(feature, SHD_VORONOI_DISTANCE_TO_EDGE, SHD_VORONOI_N_SPHERE_RADIUS) &&
+ RNA_enum_get(ptr, "voronoi_dimensions") != 1) {
+ uiItemR(layout, ptr, "distance", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE);
+ }
+}
static void node_shader_init_tex_voronoi(bNodeTree *UNUSED(ntree), bNode *node)
{
@@ -1346,6 +1360,7 @@ void register_node_type_sh_tex_voronoi()
sh_fn_node_type_base(&ntype, SH_NODE_TEX_VORONOI, "Voronoi Texture", NODE_CLASS_TEXTURE);
ntype.declare = file_ns::sh_node_tex_voronoi_declare;
+ ntype.draw_buttons = file_ns::node_shader_buts_tex_voronoi;
node_type_init(&ntype, file_ns::node_shader_init_tex_voronoi);
node_type_storage(
&ntype, "NodeTexVoronoi", node_free_standard_storage, node_copy_standard_storage);
diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_wave.cc b/source/blender/nodes/shader/nodes/node_shader_tex_wave.cc
index 9a3e214333b..fc6c66061ff 100644
--- a/source/blender/nodes/shader/nodes/node_shader_tex_wave.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_tex_wave.cc
@@ -21,6 +21,9 @@
#include "BLI_noise.hh"
+#include "UI_interface.h"
+#include "UI_resources.h"
+
namespace blender::nodes::node_shader_tex_wave_cc {
static void sh_node_tex_wave_declare(NodeDeclarationBuilder &b)
@@ -39,7 +42,21 @@ static void sh_node_tex_wave_declare(NodeDeclarationBuilder &b)
b.add_input<decl::Float>(N_("Phase Offset")).min(-1000.0f).max(1000.0f).default_value(0.0f);
b.add_output<decl::Color>(N_("Color")).no_muted_links();
b.add_output<decl::Float>(N_("Fac")).no_muted_links();
-};
+}
+
+static void node_shader_buts_tex_wave(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
+{
+ uiItemR(layout, ptr, "wave_type", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE);
+ int type = RNA_enum_get(ptr, "wave_type");
+ if (type == SHD_WAVE_BANDS) {
+ uiItemR(layout, ptr, "bands_direction", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE);
+ }
+ else { /* SHD_WAVE_RINGS */
+ uiItemR(layout, ptr, "rings_direction", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE);
+ }
+
+ uiItemR(layout, ptr, "wave_profile", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE);
+}
static void node_shader_init_tex_wave(bNodeTree *UNUSED(ntree), bNode *node)
{
@@ -222,6 +239,7 @@ void register_node_type_sh_tex_wave()
sh_fn_node_type_base(&ntype, SH_NODE_TEX_WAVE, "Wave Texture", NODE_CLASS_TEXTURE);
ntype.declare = file_ns::sh_node_tex_wave_declare;
+ ntype.draw_buttons = file_ns::node_shader_buts_tex_wave;
node_type_size_preset(&ntype, NODE_SIZE_MIDDLE);
node_type_init(&ntype, file_ns::node_shader_init_tex_wave);
node_type_storage(&ntype, "NodeTexWave", node_free_standard_storage, node_copy_standard_storage);
diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_white_noise.cc b/source/blender/nodes/shader/nodes/node_shader_tex_white_noise.cc
index 96d45d7c53b..3a5bc98896c 100644
--- a/source/blender/nodes/shader/nodes/node_shader_tex_white_noise.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_tex_white_noise.cc
@@ -21,6 +21,9 @@
#include "BLI_noise.hh"
+#include "UI_interface.h"
+#include "UI_resources.h"
+
namespace blender::nodes::node_shader_tex_white_noise_cc {
static void sh_node_tex_white_noise_declare(NodeDeclarationBuilder &b)
@@ -33,7 +36,12 @@ static void sh_node_tex_white_noise_declare(NodeDeclarationBuilder &b)
});
b.add_output<decl::Float>(N_("Value"));
b.add_output<decl::Color>(N_("Color"));
-};
+}
+
+static void node_shader_buts_white_noise(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
+{
+ uiItemR(layout, ptr, "noise_dimensions", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE);
+}
static void node_shader_init_tex_white_noise(bNodeTree *UNUSED(ntree), bNode *node)
{
@@ -198,6 +206,7 @@ void register_node_type_sh_tex_white_noise()
sh_fn_node_type_base(&ntype, SH_NODE_TEX_WHITE_NOISE, "White Noise Texture", NODE_CLASS_TEXTURE);
ntype.declare = file_ns::sh_node_tex_white_noise_declare;
+ ntype.draw_buttons = file_ns::node_shader_buts_white_noise;
node_type_init(&ntype, file_ns::node_shader_init_tex_white_noise);
node_type_gpu(&ntype, file_ns::gpu_shader_tex_white_noise);
node_type_update(&ntype, file_ns::node_shader_update_tex_white_noise);
diff --git a/source/blender/nodes/shader/nodes/node_shader_uv_along_stroke.cc b/source/blender/nodes/shader/nodes/node_shader_uv_along_stroke.cc
index 18bea5c1ec6..382a0f16ecd 100644
--- a/source/blender/nodes/shader/nodes/node_shader_uv_along_stroke.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_uv_along_stroke.cc
@@ -19,6 +19,9 @@
#include "node_shader_util.hh"
+#include "UI_interface.h"
+#include "UI_resources.h"
+
namespace blender::nodes::node_shader_uv_along_stroke_cc {
static void node_declare(NodeDeclarationBuilder &b)
@@ -26,6 +29,11 @@ static void node_declare(NodeDeclarationBuilder &b)
b.add_output<decl::Vector>(N_("UV"));
}
+static void node_shader_buts_uvalongstroke(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
+{
+ uiItemR(layout, ptr, "use_tips", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, 0);
+}
+
} // namespace blender::nodes::node_shader_uv_along_stroke_cc
/* node type definition */
@@ -37,6 +45,7 @@ void register_node_type_sh_uvalongstroke()
sh_node_type_base(&ntype, SH_NODE_UVALONGSTROKE, "UV Along Stroke", NODE_CLASS_INPUT);
ntype.declare = file_ns::node_declare;
+ ntype.draw_buttons = file_ns::node_shader_buts_uvalongstroke;
nodeRegisterType(&ntype);
}
diff --git a/source/blender/nodes/shader/nodes/node_shader_uvmap.cc b/source/blender/nodes/shader/nodes/node_shader_uvmap.cc
index 70fde996dc3..b004be75188 100644
--- a/source/blender/nodes/shader/nodes/node_shader_uvmap.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_uvmap.cc
@@ -19,8 +19,13 @@
#include "node_shader_util.hh"
+#include "BKE_context.h"
+
#include "DNA_customdata_types.h"
+#include "UI_interface.h"
+#include "UI_resources.h"
+
namespace blender::nodes::node_shader_uvmap_cc {
static void node_declare(NodeDeclarationBuilder &b)
@@ -28,6 +33,20 @@ static void node_declare(NodeDeclarationBuilder &b)
b.add_output<decl::Vector>(N_("UV"));
}
+static void node_shader_buts_uvmap(uiLayout *layout, bContext *C, PointerRNA *ptr)
+{
+ uiItemR(layout, ptr, "from_instancer", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, 0);
+
+ if (!RNA_boolean_get(ptr, "from_instancer")) {
+ PointerRNA obptr = CTX_data_pointer_get(C, "active_object");
+
+ if (obptr.data && RNA_enum_get(&obptr, "type") == OB_MESH) {
+ PointerRNA dataptr = RNA_pointer_get(&obptr, "data");
+ uiItemPointerR(layout, ptr, "uv_map", &dataptr, "uv_layers", "", ICON_NONE);
+ }
+ }
+}
+
static void node_shader_init_uvmap(bNodeTree *UNUSED(ntree), bNode *node)
{
NodeShaderUVMap *attr = MEM_cnew<NodeShaderUVMap>("NodeShaderUVMap");
@@ -61,6 +80,7 @@ void register_node_type_sh_uvmap()
sh_node_type_base(&ntype, SH_NODE_UVMAP, "UV Map", NODE_CLASS_INPUT);
ntype.declare = file_ns::node_declare;
+ ntype.draw_buttons = file_ns::node_shader_buts_uvmap;
node_type_size_preset(&ntype, NODE_SIZE_MIDDLE);
node_type_init(&ntype, file_ns::node_shader_init_uvmap);
node_type_storage(
diff --git a/source/blender/nodes/shader/nodes/node_shader_value.cc b/source/blender/nodes/shader/nodes/node_shader_value.cc
index 21f2e072990..265f03e6e88 100644
--- a/source/blender/nodes/shader/nodes/node_shader_value.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_value.cc
@@ -28,7 +28,7 @@ namespace blender::nodes::node_shader_value_cc {
static void sh_node_value_declare(NodeDeclarationBuilder &b)
{
b.add_output<decl::Float>(N_("Value"));
-};
+}
static int gpu_shader_value(GPUMaterial *mat,
bNode *node,
diff --git a/source/blender/nodes/shader/nodes/node_shader_vector_math.cc b/source/blender/nodes/shader/nodes/node_shader_vector_math.cc
index 1276592e2af..591734c7dd6 100644
--- a/source/blender/nodes/shader/nodes/node_shader_vector_math.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_vector_math.cc
@@ -28,6 +28,9 @@
#include "RNA_enum_types.h"
+#include "UI_interface.h"
+#include "UI_resources.h"
+
namespace blender::nodes::node_shader_vector_math_cc {
static void sh_node_vector_math_declare(NodeDeclarationBuilder &b)
@@ -39,7 +42,12 @@ static void sh_node_vector_math_declare(NodeDeclarationBuilder &b)
b.add_input<decl::Float>(N_("Scale")).default_value(1.0f).min(-10000.0f).max(10000.0f);
b.add_output<decl::Vector>(N_("Vector"));
b.add_output<decl::Float>(N_("Value"));
-};
+}
+
+static void node_shader_buts_vect_math(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
+{
+ uiItemR(layout, ptr, "operation", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE);
+}
class SocketSearchOp {
public:
@@ -331,6 +339,7 @@ void register_node_type_sh_vect_math()
sh_fn_node_type_base(&ntype, SH_NODE_VECTOR_MATH, "Vector Math", NODE_CLASS_OP_VECTOR);
ntype.declare = file_ns::sh_node_vector_math_declare;
+ ntype.draw_buttons = file_ns::node_shader_buts_vect_math;
ntype.labelfunc = node_vector_math_label;
node_type_gpu(&ntype, file_ns::gpu_shader_vector_math);
node_type_update(&ntype, file_ns::node_shader_update_vector_math);
diff --git a/source/blender/nodes/shader/nodes/node_shader_vector_rotate.cc b/source/blender/nodes/shader/nodes/node_shader_vector_rotate.cc
index bb7a81ef5d8..d8dcd028c56 100644
--- a/source/blender/nodes/shader/nodes/node_shader_vector_rotate.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_vector_rotate.cc
@@ -23,6 +23,9 @@
#include "node_shader_util.hh"
+#include "UI_interface.h"
+#include "UI_resources.h"
+
namespace blender::nodes::node_shader_vector_rotate_cc {
static void sh_node_vector_rotate_declare(NodeDeclarationBuilder &b)
@@ -34,7 +37,13 @@ static void sh_node_vector_rotate_declare(NodeDeclarationBuilder &b)
b.add_input<decl::Float>(N_("Angle")).subtype(PROP_ANGLE);
b.add_input<decl::Vector>(N_("Rotation")).subtype(PROP_EULER);
b.add_output<decl::Vector>(N_("Vector"));
-};
+}
+
+static void node_shader_buts_vector_rotate(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
+{
+ uiItemR(layout, ptr, "rotation_type", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE);
+ uiItemR(layout, ptr, "invert", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, 0);
+}
static const char *gpu_shader_get_name(int mode)
{
@@ -213,6 +222,7 @@ void register_node_type_sh_vector_rotate()
sh_fn_node_type_base(&ntype, SH_NODE_VECTOR_ROTATE, "Vector Rotate", NODE_CLASS_OP_VECTOR);
ntype.declare = file_ns::sh_node_vector_rotate_declare;
+ ntype.draw_buttons = file_ns::node_shader_buts_vector_rotate;
node_type_gpu(&ntype, file_ns::gpu_shader_vector_rotate);
node_type_update(&ntype, file_ns::node_shader_update_vector_rotate);
ntype.build_multi_function = file_ns::sh_node_vector_rotate_build_multi_function;
diff --git a/source/blender/nodes/shader/nodes/node_shader_vector_transform.cc b/source/blender/nodes/shader/nodes/node_shader_vector_transform.cc
index 30bc3f020b1..a8a6902e30c 100644
--- a/source/blender/nodes/shader/nodes/node_shader_vector_transform.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_vector_transform.cc
@@ -23,16 +23,31 @@
#include "node_shader_util.hh"
+#include "UI_interface.h"
+#include "UI_resources.h"
+
namespace blender::nodes::node_shader_vector_transform_cc {
-/* **************** Vector Transform ******************** */
-static bNodeSocketTemplate sh_node_vect_transform_in[] = {
- {SOCK_VECTOR, N_("Vector"), 0.5f, 0.5f, 0.5f, 1.0f, -10000.0f, 10000.0f, PROP_NONE}, {-1, ""}};
+static void node_declare(NodeDeclarationBuilder &b)
+{
+ b.add_input<decl::Vector>(N_("Vector"))
+ .default_value({0.5f, 0.5f, 0.5f})
+ .min(-10000.0f)
+ .max(10000.0f);
+ b.add_output<decl::Vector>(N_("Vector"));
+}
-static bNodeSocketTemplate sh_node_vect_transform_out[] = {
- {SOCK_VECTOR, N_("Vector")},
- {-1, ""},
-};
+static void node_shader_buts_vect_transform(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
+{
+ uiItemR(layout,
+ ptr,
+ "vector_type",
+ UI_ITEM_R_SPLIT_EMPTY_NAME | UI_ITEM_R_EXPAND,
+ nullptr,
+ ICON_NONE);
+ uiItemR(layout, ptr, "convert_from", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE);
+ uiItemR(layout, ptr, "convert_to", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE);
+}
static void node_shader_init_vect_transform(bNodeTree *UNUSED(ntree), bNode *node)
{
@@ -138,9 +153,9 @@ void register_node_type_sh_vect_transform()
static bNodeType ntype;
sh_node_type_base(&ntype, SH_NODE_VECT_TRANSFORM, "Vector Transform", NODE_CLASS_OP_VECTOR);
+ ntype.declare = file_ns::node_declare;
+ ntype.draw_buttons = file_ns::node_shader_buts_vect_transform;
node_type_init(&ntype, file_ns::node_shader_init_vect_transform);
- node_type_socket_templates(
- &ntype, file_ns::sh_node_vect_transform_in, file_ns::sh_node_vect_transform_out);
node_type_storage(
&ntype, "NodeShaderVectTransform", node_free_standard_storage, node_copy_standard_storage);
node_type_gpu(&ntype, file_ns::gpu_shader_vect_transform);
diff --git a/source/blender/nodes/shader/nodes/node_shader_vertex_color.cc b/source/blender/nodes/shader/nodes/node_shader_vertex_color.cc
index 0d3f047f54e..6501527ef5d 100644
--- a/source/blender/nodes/shader/nodes/node_shader_vertex_color.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_vertex_color.cc
@@ -19,6 +19,11 @@
#include "node_shader_util.hh"
+#include "BKE_context.h"
+
+#include "UI_interface.h"
+#include "UI_resources.h"
+
namespace blender::nodes::node_shader_vertex_color_cc {
static void node_declare(NodeDeclarationBuilder &b)
@@ -27,6 +32,26 @@ static void node_declare(NodeDeclarationBuilder &b)
b.add_output<decl::Float>(N_("Alpha"));
}
+static void node_shader_buts_vertex_color(uiLayout *layout, bContext *C, PointerRNA *ptr)
+{
+ PointerRNA obptr = CTX_data_pointer_get(C, "active_object");
+ if (obptr.data && RNA_enum_get(&obptr, "type") == OB_MESH) {
+ PointerRNA dataptr = RNA_pointer_get(&obptr, "data");
+
+ if (U.experimental.use_sculpt_vertex_colors &&
+ RNA_collection_length(&dataptr, "sculpt_vertex_colors")) {
+ uiItemPointerR(
+ layout, ptr, "layer_name", &dataptr, "sculpt_vertex_colors", "", ICON_GROUP_VCOL);
+ }
+ else {
+ uiItemPointerR(layout, ptr, "layer_name", &dataptr, "vertex_colors", "", ICON_GROUP_VCOL);
+ }
+ }
+ else {
+ uiItemL(layout, TIP_("No mesh in active object"), ICON_ERROR);
+ }
+}
+
static void node_shader_init_vertex_color(bNodeTree *UNUSED(ntree), bNode *node)
{
NodeShaderVertexColor *vertexColor = MEM_cnew<NodeShaderVertexColor>("NodeShaderVertexColor");
@@ -58,6 +83,7 @@ void register_node_type_sh_vertex_color()
sh_node_type_base(&ntype, SH_NODE_VERTEX_COLOR, "Vertex Color", NODE_CLASS_INPUT);
ntype.declare = file_ns::node_declare;
+ ntype.draw_buttons = file_ns::node_shader_buts_vertex_color;
node_type_init(&ntype, file_ns::node_shader_init_vertex_color);
node_type_storage(
&ntype, "NodeShaderVertexColor", node_free_standard_storage, node_copy_standard_storage);
diff --git a/source/blender/nodes/shader/nodes/node_shader_volume_absorption.cc b/source/blender/nodes/shader/nodes/node_shader_volume_absorption.cc
index cd697c96d66..a31bfdb6543 100644
--- a/source/blender/nodes/shader/nodes/node_shader_volume_absorption.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_volume_absorption.cc
@@ -21,18 +21,12 @@
namespace blender::nodes::node_shader_volume_absorption_cc {
-/* **************** OUTPUT ******************** */
-
-static bNodeSocketTemplate sh_node_volume_absorption_in[] = {
- {SOCK_RGBA, N_("Color"), 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f},
- {SOCK_FLOAT, N_("Density"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1000.0f},
- {-1, ""},
-};
-
-static bNodeSocketTemplate sh_node_volume_absorption_out[] = {
- {SOCK_SHADER, N_("Volume")},
- {-1, ""},
-};
+static void node_declare(NodeDeclarationBuilder &b)
+{
+ b.add_input<decl::Color>(N_("Color")).default_value({0.8f, 0.8f, 0.8f, 1.0f});
+ b.add_input<decl::Float>(N_("Density")).default_value(1.0f).min(0.0f).max(1000.0f);
+ b.add_output<decl::Shader>(N_("Volume"));
+}
static int node_shader_gpu_volume_absorption(GPUMaterial *mat,
bNode *node,
@@ -53,8 +47,7 @@ void register_node_type_sh_volume_absorption()
static bNodeType ntype;
sh_node_type_base(&ntype, SH_NODE_VOLUME_ABSORPTION, "Volume Absorption", NODE_CLASS_SHADER);
- node_type_socket_templates(
- &ntype, file_ns::sh_node_volume_absorption_in, file_ns::sh_node_volume_absorption_out);
+ ntype.declare = file_ns::node_declare;
node_type_gpu(&ntype, file_ns::node_shader_gpu_volume_absorption);
nodeRegisterType(&ntype);
diff --git a/source/blender/nodes/shader/nodes/node_shader_volume_principled.cc b/source/blender/nodes/shader/nodes/node_shader_volume_principled.cc
index 3acf8c35ac1..54e92eafcf6 100644
--- a/source/blender/nodes/shader/nodes/node_shader_volume_principled.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_volume_principled.cc
@@ -21,28 +21,30 @@
namespace blender::nodes::node_shader_volume_principled_cc {
-/* **************** OUTPUT ******************** */
-
-static bNodeSocketTemplate sh_node_volume_principled_in[] = {
- {SOCK_RGBA, N_("Color"), 0.5f, 0.5f, 0.5f, 1.0f, 0.0f, 1.0f},
- {SOCK_STRING, N_("Color Attribute"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
- {SOCK_FLOAT, N_("Density"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1000.0f},
- {SOCK_STRING, N_("Density Attribute"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
- {SOCK_FLOAT, N_("Anisotropy"), 0.0f, 0.0f, 0.0f, 0.0f, -1.0f, 1.0f, PROP_FACTOR},
- {SOCK_RGBA, N_("Absorption Color"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
- {SOCK_FLOAT, N_("Emission Strength"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1000.0f},
- {SOCK_RGBA, N_("Emission Color"), 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f},
- {SOCK_FLOAT, N_("Blackbody Intensity"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR},
- {SOCK_RGBA, N_("Blackbody Tint"), 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f},
- {SOCK_FLOAT, N_("Temperature"), 1000.0f, 0.0f, 0.0f, 0.0f, 0.0f, 6500.0f},
- {SOCK_STRING, N_("Temperature Attribute"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
- {-1, ""},
-};
-
-static bNodeSocketTemplate sh_node_volume_principled_out[] = {
- {SOCK_SHADER, N_("Volume")},
- {-1, ""},
-};
+static void node_declare(NodeDeclarationBuilder &b)
+{
+ b.add_input<decl::Color>(N_("Color")).default_value({0.5f, 0.5f, 0.5f, 1.0f});
+ b.add_input<decl::String>(N_("Color Attribute"));
+ b.add_input<decl::Float>(N_("Density")).default_value(1.0f).min(0.0f).max(1000.0f);
+ b.add_input<decl::String>(N_("Density Attribute"));
+ b.add_input<decl::Float>(N_("Anisotropy"))
+ .default_value(0.0f)
+ .min(-1.0f)
+ .max(1.0f)
+ .subtype(PROP_FACTOR);
+ b.add_input<decl::Color>(N_("Absorption Color")).default_value({0.0f, 0.0f, 0.0f, 1.0f});
+ b.add_input<decl::Float>(N_("Emission Strength")).default_value(0.0f).min(0.0f).max(1000.0f);
+ b.add_input<decl::Color>(N_("Emission Color")).default_value({1.0f, 1.0f, 1.0f, 1.0f});
+ b.add_input<decl::Float>(N_("Blackbody Intensity"))
+ .default_value(0.0f)
+ .min(0.0f)
+ .max(1.0f)
+ .subtype(PROP_FACTOR);
+ b.add_input<decl::Color>(N_("Blackbody Tint")).default_value({1.0f, 1.0f, 1.0f, 1.0f});
+ b.add_input<decl::Float>(N_("Temperature")).default_value(1000.0f).min(0.0f).max(6500.0f);
+ b.add_input<decl::String>(N_("Temperature Attribute"));
+ b.add_output<decl::Shader>(N_("Volume"));
+}
static void node_shader_init_volume_principled(bNodeTree *UNUSED(ntree), bNode *node)
{
@@ -138,8 +140,7 @@ void register_node_type_sh_volume_principled()
static bNodeType ntype;
sh_node_type_base(&ntype, SH_NODE_VOLUME_PRINCIPLED, "Principled Volume", NODE_CLASS_SHADER);
- node_type_socket_templates(
- &ntype, file_ns::sh_node_volume_principled_in, file_ns::sh_node_volume_principled_out);
+ ntype.declare = file_ns::node_declare;
node_type_size_preset(&ntype, NODE_SIZE_LARGE);
node_type_init(&ntype, file_ns::node_shader_init_volume_principled);
node_type_gpu(&ntype, file_ns::node_shader_gpu_volume_principled);
diff --git a/source/blender/nodes/shader/nodes/node_shader_wireframe.cc b/source/blender/nodes/shader/nodes/node_shader_wireframe.cc
index a23887e9721..1ba2391a09d 100644
--- a/source/blender/nodes/shader/nodes/node_shader_wireframe.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_wireframe.cc
@@ -19,6 +19,9 @@
#include "node_shader_util.hh"
+#include "UI_interface.h"
+#include "UI_resources.h"
+
namespace blender::nodes::node_shader_wireframe_cc {
static void node_declare(NodeDeclarationBuilder &b)
@@ -27,6 +30,11 @@ static void node_declare(NodeDeclarationBuilder &b)
b.add_output<decl::Float>(N_("Fac"));
}
+static void node_shader_buts_wireframe(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
+{
+ uiItemR(layout, ptr, "use_pixel_size", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, 0);
+}
+
static int node_shader_gpu_wireframe(GPUMaterial *mat,
bNode *node,
bNodeExecData *UNUSED(execdata),
@@ -60,6 +68,7 @@ void register_node_type_sh_wireframe()
sh_node_type_base(&ntype, SH_NODE_WIREFRAME, "Wireframe", NODE_CLASS_INPUT);
ntype.declare = file_ns::node_declare;
+ ntype.draw_buttons = file_ns::node_shader_buts_wireframe;
node_type_gpu(&ntype, file_ns::node_shader_gpu_wireframe);
nodeRegisterType(&ntype);