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:
authorLukas Toenne <lukas.toenne@googlemail.com>2011-02-08 15:54:32 +0300
committerLukas Toenne <lukas.toenne@googlemail.com>2011-02-08 15:54:32 +0300
commit24db3d17aafd1b2027cd62afd39b2d648e8ec7d5 (patch)
tree0c27787854b73b384f0d3c46a1b8d9927a341b78 /source/blender/nodes/intern
parentcd95dd42d7d8ee6eecde8e08cf406f6fa55f66c3 (diff)
Per-type node labels and customizable names. The label displayed in the node header is now by default the node type string. A custom label callback can be implemented to display more detailed information. This is currently used by group nodes, which display their internal tree name, and math, vector math, mix and filter nodes, which use their internal operation sub-type. Also the node tree selection/naming box for groups is now displayed only on open groups, to make it clearer that this is the internal type of the group and get a cleaner main tree.
Diffstat (limited to 'source/blender/nodes/intern')
-rw-r--r--source/blender/nodes/intern/CMP_nodes/CMP_filter.c1
-rw-r--r--source/blender/nodes/intern/CMP_nodes/CMP_math.c2
-rw-r--r--source/blender/nodes/intern/CMP_nodes/CMP_mixrgb.c1
-rw-r--r--source/blender/nodes/intern/SHD_nodes/SHD_math.c2
-rw-r--r--source/blender/nodes/intern/SHD_nodes/SHD_mixRgb.c2
-rw-r--r--source/blender/nodes/intern/SHD_nodes/SHD_vectMath.c1
-rw-r--r--source/blender/nodes/intern/TEX_nodes/TEX_math.c1
-rw-r--r--source/blender/nodes/intern/TEX_nodes/TEX_mixRgb.c2
-rw-r--r--source/blender/nodes/intern/node_util.c30
-rw-r--r--source/blender/nodes/intern/node_util.h5
10 files changed, 43 insertions, 4 deletions
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_filter.c b/source/blender/nodes/intern/CMP_nodes/CMP_filter.c
index f960f44d64d..52b0fb008aa 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_filter.c
+++ b/source/blender/nodes/intern/CMP_nodes/CMP_filter.c
@@ -224,6 +224,7 @@ void register_node_type_cmp_filter(ListBase *lb)
node_type_base(&ntype, CMP_NODE_FILTER, "Filter", NODE_CLASS_OP_FILTER, NODE_PREVIEW|NODE_OPTIONS,
cmp_node_filter_in, cmp_node_filter_out);
node_type_size(&ntype, 80, 40, 120);
+ node_type_label(&ntype, node_filter_label);
node_type_exec(&ntype, node_composit_exec_filter);
nodeRegisterType(lb, &ntype);
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_math.c b/source/blender/nodes/intern/CMP_nodes/CMP_math.c
index 54ece02582d..7a8dadafb86 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_math.c
+++ b/source/blender/nodes/intern/CMP_nodes/CMP_math.c
@@ -29,7 +29,6 @@
#include "../CMP_util.h"
-
/* **************** SCALAR MATH ******************** */
static bNodeSocketType cmp_node_math_in[]= {
{ SOCK_VALUE, 1, "Value", 0.5f, 0.5f, 0.5f, 1.0f, -10000.0f, 10000.0f},
@@ -188,6 +187,7 @@ void register_node_type_cmp_math(ListBase *lb)
node_type_base(&ntype, CMP_NODE_MATH, "Math", NODE_CLASS_CONVERTOR, NODE_OPTIONS,
cmp_node_math_in, cmp_node_math_out);
node_type_size(&ntype, 120, 110, 160);
+ node_type_label(&ntype, node_math_label);
node_type_exec(&ntype, node_composit_exec_math);
nodeRegisterType(lb, &ntype);
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_mixrgb.c b/source/blender/nodes/intern/CMP_nodes/CMP_mixrgb.c
index b65296ffe10..91b8eb8b752 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_mixrgb.c
+++ b/source/blender/nodes/intern/CMP_nodes/CMP_mixrgb.c
@@ -86,6 +86,7 @@ void register_node_type_cmp_mix_rgb(ListBase *lb)
node_type_base(&ntype, CMP_NODE_MIX_RGB, "Mix", NODE_CLASS_OP_COLOR, NODE_PREVIEW|NODE_OPTIONS,
cmp_node_mix_rgb_in, cmp_node_mix_rgb_out);
node_type_size(&ntype, 110, 60, 120);
+ node_type_label(&ntype, node_blend_label);
node_type_exec(&ntype, node_composit_exec_mix_rgb);
nodeRegisterType(lb, &ntype);
diff --git a/source/blender/nodes/intern/SHD_nodes/SHD_math.c b/source/blender/nodes/intern/SHD_nodes/SHD_math.c
index 98f345a1677..ba2ee6d066a 100644
--- a/source/blender/nodes/intern/SHD_nodes/SHD_math.c
+++ b/source/blender/nodes/intern/SHD_nodes/SHD_math.c
@@ -30,7 +30,6 @@
#include "../SHD_util.h"
-
/* **************** SCALAR MATH ******************** */
static bNodeSocketType sh_node_math_in[]= {
{ SOCK_VALUE, 1, "Value", 0.5f, 0.5f, 0.5f, 1.0f, -100.0f, 100.0f},
@@ -241,6 +240,7 @@ void register_node_type_sh_math(ListBase *lb)
node_type_base(&ntype, SH_NODE_MATH, "Math", NODE_CLASS_CONVERTOR, NODE_OPTIONS,
sh_node_math_in, sh_node_math_out);
node_type_size(&ntype, 120, 110, 160);
+ node_type_label(&ntype, node_math_label);
node_type_storage(&ntype, "node_math", NULL, NULL);
node_type_exec(&ntype, node_shader_exec_math);
node_type_gpu(&ntype, gpu_shader_math);
diff --git a/source/blender/nodes/intern/SHD_nodes/SHD_mixRgb.c b/source/blender/nodes/intern/SHD_nodes/SHD_mixRgb.c
index a8dcf684400..eac3c60655a 100644
--- a/source/blender/nodes/intern/SHD_nodes/SHD_mixRgb.c
+++ b/source/blender/nodes/intern/SHD_nodes/SHD_mixRgb.c
@@ -29,7 +29,6 @@
#include "../SHD_util.h"
-
/* **************** MIX RGB ******************** */
static bNodeSocketType sh_node_mix_rgb_in[]= {
{ SOCK_VALUE, 1, "Fac", 0.5f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
@@ -78,6 +77,7 @@ void register_node_type_sh_mix_rgb(ListBase *lb)
node_type_base(&ntype, SH_NODE_MIX_RGB, "Mix", NODE_CLASS_OP_COLOR, NODE_OPTIONS,
sh_node_mix_rgb_in, sh_node_mix_rgb_out);
node_type_size(&ntype, 100, 60, 150);
+ node_type_label(&ntype, node_blend_label);
node_type_exec(&ntype, node_shader_exec_mix_rgb);
node_type_gpu(&ntype, gpu_shader_mix_rgb);
diff --git a/source/blender/nodes/intern/SHD_nodes/SHD_vectMath.c b/source/blender/nodes/intern/SHD_nodes/SHD_vectMath.c
index 43092d06630..a85022cffab 100644
--- a/source/blender/nodes/intern/SHD_nodes/SHD_vectMath.c
+++ b/source/blender/nodes/intern/SHD_nodes/SHD_vectMath.c
@@ -134,6 +134,7 @@ void register_node_type_sh_vect_math(ListBase *lb)
node_type_base(&ntype, SH_NODE_VECT_MATH, "Vector Math", NODE_CLASS_CONVERTOR, NODE_OPTIONS,
sh_node_vect_math_in, sh_node_vect_math_out);
node_type_size(&ntype, 80, 75, 140);
+ node_type_label(&ntype, node_vect_math_label);
node_type_storage(&ntype, "node_vect_math", NULL, NULL);
node_type_exec(&ntype, node_shader_exec_vect_math);
node_type_gpu(&ntype, gpu_shader_vect_math);
diff --git a/source/blender/nodes/intern/TEX_nodes/TEX_math.c b/source/blender/nodes/intern/TEX_nodes/TEX_math.c
index aee6fb663e5..7e1c54b6e47 100644
--- a/source/blender/nodes/intern/TEX_nodes/TEX_math.c
+++ b/source/blender/nodes/intern/TEX_nodes/TEX_math.c
@@ -181,6 +181,7 @@ void register_node_type_tex_math(ListBase *lb)
node_type_base(&ntype, TEX_NODE_MATH, "Math", NODE_CLASS_CONVERTOR, NODE_OPTIONS,
inputs, outputs);
node_type_size(&ntype, 120, 110, 160);
+ node_type_label(&ntype, node_math_label);
node_type_storage(&ntype, "node_math", NULL, NULL);
node_type_exec(&ntype, exec);
diff --git a/source/blender/nodes/intern/TEX_nodes/TEX_mixRgb.c b/source/blender/nodes/intern/TEX_nodes/TEX_mixRgb.c
index 565ac68c5b7..152288fcac8 100644
--- a/source/blender/nodes/intern/TEX_nodes/TEX_mixRgb.c
+++ b/source/blender/nodes/intern/TEX_nodes/TEX_mixRgb.c
@@ -28,7 +28,6 @@
#include "../TEX_util.h"
-
/* **************** MIX RGB ******************** */
static bNodeSocketType inputs[]= {
{ SOCK_VALUE, 1, "Factor", 0.5f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f },
@@ -67,6 +66,7 @@ void register_node_type_tex_mix_rgb(ListBase *lb)
node_type_base(&ntype, TEX_NODE_MIX_RGB, "Mix", NODE_CLASS_OP_COLOR, NODE_OPTIONS,
inputs, outputs);
node_type_size(&ntype, 100, 60, 150);
+ node_type_label(&ntype, node_blend_label);
node_type_exec(&ntype, exec);
nodeRegisterType(lb, &ntype);
diff --git a/source/blender/nodes/intern/node_util.c b/source/blender/nodes/intern/node_util.c
index 746b8a37f5b..baf0fc17bf7 100644
--- a/source/blender/nodes/intern/node_util.c
+++ b/source/blender/nodes/intern/node_util.c
@@ -30,6 +30,9 @@
#include "CMP_util.h"
#include "SHD_util.h"
+#include "RNA_access.h"
+#include "RNA_enum_types.h"
+
void node_free_curves(bNode *node)
{
curvemapping_free(node->storage);
@@ -50,3 +53,30 @@ void node_copy_standard_storage(bNode *orig_node, bNode *new_node)
new_node->storage= MEM_dupallocN(orig_node->storage);
}
+const char *node_blend_label(bNode *node)
+{
+ const char *name;
+ RNA_enum_name(node_blend_type_items, node->custom1, &name);
+ return name;
+}
+
+const char *node_math_label(bNode *node)
+{
+ const char *name;
+ RNA_enum_name(node_math_items, node->custom1, &name);
+ return name;
+}
+
+const char *node_vect_math_label(bNode *node)
+{
+ const char *name;
+ RNA_enum_name(node_vec_math_items, node->custom1, &name);
+ return name;
+}
+
+const char *node_filter_label(bNode *node)
+{
+ const char *name;
+ RNA_enum_name(node_filter_items, node->custom1, &name);
+ return name;
+}
diff --git a/source/blender/nodes/intern/node_util.h b/source/blender/nodes/intern/node_util.h
index 0326459ac68..c41ce3025ba 100644
--- a/source/blender/nodes/intern/node_util.h
+++ b/source/blender/nodes/intern/node_util.h
@@ -38,6 +38,11 @@ extern void node_free_standard_storage(struct bNode *node);
extern void node_copy_curves(struct bNode *orig_node, struct bNode *new_node);
extern void node_copy_standard_storage(struct bNode *orig_node, struct bNode *new_node);
+const char *node_blend_label(struct bNode *node);
+const char *node_math_label(struct bNode *node);
+const char *node_vect_math_label(struct bNode *node);
+const char *node_filter_label(struct bNode *node);
+
#endif
// this is needed for inlining behaviour