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:
authorInes Almeida <britalmeida@gmail.com>2018-01-08 00:29:25 +0300
committerInes Almeida <britalmeida@gmail.com>2018-01-08 00:29:25 +0300
commit87607254d6d3f9ca5ebbc696a4066bf0c8fbbed4 (patch)
tree0fd4aedc48f05c87e722250e2c00dca04cac1974 /source/blender/nodes
parentadd580beeea0e1d5bd8be2336c8a5b25bc8c601a (diff)
(Nodes) Display image name if any in the Image and Texture Image node title
Diffstat (limited to 'source/blender/nodes')
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_image.c1
-rw-r--r--source/blender/nodes/intern/node_util.c6
-rw-r--r--source/blender/nodes/intern/node_util.h1
-rw-r--r--source/blender/nodes/texture/nodes/node_texture_image.c3
4 files changed, 10 insertions, 1 deletions
diff --git a/source/blender/nodes/composite/nodes/node_composite_image.c b/source/blender/nodes/composite/nodes/node_composite_image.c
index a95c3233132..1e240c2f84b 100644
--- a/source/blender/nodes/composite/nodes/node_composite_image.c
+++ b/source/blender/nodes/composite/nodes/node_composite_image.c
@@ -340,6 +340,7 @@ void register_node_type_cmp_image(void)
node_type_init(&ntype, node_composit_init_image);
node_type_storage(&ntype, "ImageUser", node_composit_free_image, node_composit_copy_image);
node_type_update(&ntype, cmp_node_image_update, NULL);
+ node_type_label(&ntype, node_image_label);
nodeRegisterType(&ntype);
}
diff --git a/source/blender/nodes/intern/node_util.c b/source/blender/nodes/intern/node_util.c
index dd5715891d5..43d4136d556 100644
--- a/source/blender/nodes/intern/node_util.c
+++ b/source/blender/nodes/intern/node_util.c
@@ -91,6 +91,12 @@ void node_blend_label(bNodeTree *UNUSED(ntree), bNode *node, char *label, int ma
BLI_strncpy(label, IFACE_(name), maxlen);
}
+void node_image_label(bNodeTree *UNUSED(ntree), bNode *node, char *label, int maxlen)
+{
+ /* if there is no loaded image, return an empty string, and let nodeLabel() fill in the proper type translation. */
+ BLI_strncpy(label, (node->id) ? node->id->name + 2 : "", maxlen);
+}
+
void node_math_label(bNodeTree *UNUSED(ntree), bNode *node, char *label, int maxlen)
{
const char *name;
diff --git a/source/blender/nodes/intern/node_util.h b/source/blender/nodes/intern/node_util.h
index 2e20a8e79d4..b4437dfcb78 100644
--- a/source/blender/nodes/intern/node_util.h
+++ b/source/blender/nodes/intern/node_util.h
@@ -72,6 +72,7 @@ extern void *node_initexec_curves(struct bNodeExecContext *context, struct bNode
/**** Labels ****/
void node_blend_label(struct bNodeTree *ntree, struct bNode *node, char *label, int maxlen);
+void node_image_label(struct bNodeTree *ntree, struct bNode *node, char *label, int maxlen);
void node_math_label(struct bNodeTree *ntree, struct bNode *node, char *label, int maxlen);
void node_vect_math_label(struct bNodeTree *ntree, struct bNode *node, char *label, int maxlen);
void node_filter_label(struct bNodeTree *ntree, struct bNode *node, char *label, int maxlen);
diff --git a/source/blender/nodes/texture/nodes/node_texture_image.c b/source/blender/nodes/texture/nodes/node_texture_image.c
index 9b13589f3e1..8e9821c0fcb 100644
--- a/source/blender/nodes/texture/nodes/node_texture_image.c
+++ b/source/blender/nodes/texture/nodes/node_texture_image.c
@@ -106,6 +106,7 @@ void register_node_type_tex_image(void)
node_type_init(&ntype, init);
node_type_storage(&ntype, "ImageUser", node_free_standard_storage, node_copy_standard_storage);
node_type_exec(&ntype, NULL, NULL, exec);
-
+ node_type_label(&ntype, node_image_label);
+
nodeRegisterType(&ntype);
}