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:
authorAaron Carlisle <carlisle.b3d@gmail.com>2022-01-09 08:59:34 +0300
committerAaron Carlisle <carlisle.b3d@gmail.com>2022-01-09 08:59:34 +0300
commite17ac8dc58c7108cfb3a784a595912c063e09cf4 (patch)
tree3a0a30fce007550c2743e423dd5f5017a0ca7753 /source/blender/nodes/shader/nodes/node_shader_clamp.cc
parented1ced24848824a4acbaaf7aa7ccb34441f6a8f4 (diff)
Cleanup: Nodes: Begin splitting shader node buttons into individual files
Currently, most node buttons are defined in `drawnode.cc` however, this is inconvenient because it requires editing many files when adding new nodes. The goal is to minimize the number of files needed to add or update a node. This commit moves most of the node layout functions for shader nodes into their respected source/blender/nodes/shader/nodes file. In the future, these functions will be simplified to node_layout. Some nodes were left in `drawnode.cc` as this would require duplicating code while this is likely fine it is best to leave that to a seperate commit.
Diffstat (limited to 'source/blender/nodes/shader/nodes/node_shader_clamp.cc')
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_clamp.cc9
1 files changed, 9 insertions, 0 deletions
diff --git a/source/blender/nodes/shader/nodes/node_shader_clamp.cc b/source/blender/nodes/shader/nodes/node_shader_clamp.cc
index f4c72f0616f..4d9cfc372ab 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)
@@ -34,6 +37,11 @@ static void sh_node_clamp_declare(NodeDeclarationBuilder &b)
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)
{
node->custom1 = NODE_CLAMP_MINMAX; /* clamp type */
@@ -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;