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
path: root/source
diff options
context:
space:
mode:
authorLukas Toenne <lukas.toenne@googlemail.com>2013-05-08 18:58:37 +0400
committerLukas Toenne <lukas.toenne@googlemail.com>2013-05-08 18:58:37 +0400
commit672d393517253707746d57a65ac9fa9734771be6 (patch)
tree54b0b653ec489bbe119f4435ef4ced40c07c47b8 /source
parent0ee45c9301fa100624479255b3928945ded4042e (diff)
Change to socket draw functions: instead of always only drawing the socket label for connected sockets, leave this check up to the socket draw function itself. This allows future socket types to draw buttons or other info in all cases and handle connected/unconnected state more flexibly.
The drawinputfunc/drawoutputfunc callbacks in bNodeType are pretty much empty wrappers now and should be removed at some point. This per-node differentiation should rather be implemented as a specialized socket type if necessary. The only use case for this feature that remains is the file output node in compositor, which displays shortened file format info for each socket.
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenkernel/BKE_node.h2
-rw-r--r--source/blender/editors/space_node/drawnode.c16
-rw-r--r--source/blender/editors/space_node/node_draw.c4
3 files changed, 12 insertions, 10 deletions
diff --git a/source/blender/blenkernel/BKE_node.h b/source/blender/blenkernel/BKE_node.h
index 3abca094410..206d4390f0a 100644
--- a/source/blender/blenkernel/BKE_node.h
+++ b/source/blender/blenkernel/BKE_node.h
@@ -131,7 +131,7 @@ typedef struct bNodeSocketType {
int type, subtype;
} bNodeSocketType;
-typedef void (*NodeSocketDrawFunction)(struct bContext *C, struct uiLayout *layout, struct PointerRNA *ptr, struct PointerRNA *node_ptr, int linked);
+typedef void (*NodeSocketDrawFunction)(struct bContext *C, struct uiLayout *layout, struct PointerRNA *ptr, struct PointerRNA *node_ptr);
typedef void *(*NodeInitExecFunction)(struct bNodeExecContext *context, struct bNode *node, bNodeInstanceKey key);
typedef void (*NodeFreeExecFunction)(struct bNode *node, void *nodedata);
diff --git a/source/blender/editors/space_node/drawnode.c b/source/blender/editors/space_node/drawnode.c
index aaeec9c780f..0b9e71f0e14 100644
--- a/source/blender/editors/space_node/drawnode.c
+++ b/source/blender/editors/space_node/drawnode.c
@@ -86,16 +86,13 @@ static void node_socket_button_label(bContext *UNUSED(C), uiLayout *layout, Poin
uiItemL(layout, IFACE_(sock->name), 0);
}
-static void node_draw_input_default(bContext *C, uiLayout *layout, PointerRNA *ptr, PointerRNA *node_ptr, int linked)
+static void node_draw_input_default(bContext *C, uiLayout *layout, PointerRNA *ptr, PointerRNA *node_ptr)
{
bNodeSocket *sock = (bNodeSocket *)ptr->data;
- if (linked || (sock->flag & SOCK_HIDE_VALUE))
- node_socket_button_label(C, layout, ptr, node_ptr);
- else
- sock->typeinfo->draw(C, layout, ptr, node_ptr);
+ sock->typeinfo->draw(C, layout, ptr, node_ptr);
}
-static void node_draw_output_default(bContext *C, uiLayout *layout, PointerRNA *ptr, PointerRNA *node_ptr, int UNUSED(linked))
+static void node_draw_output_default(bContext *C, uiLayout *layout, PointerRNA *ptr, PointerRNA *node_ptr)
{
node_socket_button_label(C, layout, ptr, node_ptr);
}
@@ -1518,7 +1515,7 @@ static void node_composit_buts_id_mask(uiLayout *layout, bContext *UNUSED(C), Po
}
/* draw function for file output node sockets, displays only sub-path and format, no value button */
-static void node_draw_input_file_output(bContext *C, uiLayout *layout, PointerRNA *ptr, PointerRNA *node_ptr, int UNUSED(linked))
+static void node_draw_input_file_output(bContext *C, uiLayout *layout, PointerRNA *ptr, PointerRNA *node_ptr)
{
bNodeTree *ntree = ptr->id.data;
bNodeSocket *sock = ptr->data;
@@ -2736,6 +2733,11 @@ static void std_node_socket_draw(bContext *C, uiLayout *layout, PointerRNA *ptr,
int type = sock->typeinfo->type;
/*int subtype = sock->typeinfo->subtype;*/
+ if ((sock->flag & SOCK_IN_USE) || (sock->flag & SOCK_HIDE_VALUE)) {
+ node_socket_button_label(C, layout, ptr, node_ptr);
+ return;
+ }
+
switch (type) {
case SOCK_FLOAT:
case SOCK_INT:
diff --git a/source/blender/editors/space_node/node_draw.c b/source/blender/editors/space_node/node_draw.c
index ec563c7f175..d4228ac03b7 100644
--- a/source/blender/editors/space_node/node_draw.c
+++ b/source/blender/editors/space_node/node_draw.c
@@ -351,7 +351,7 @@ static void node_update_basis(const bContext *C, bNodeTree *ntree, bNode *node)
row = uiLayoutRow(layout, 1);
uiLayoutSetAlignment(row, UI_LAYOUT_ALIGN_RIGHT);
- node->typeinfo->drawoutputfunc((bContext *)C, row, &sockptr, &nodeptr, (nsock->flag & SOCK_IN_USE));
+ node->typeinfo->drawoutputfunc((bContext *)C, row, &sockptr, &nodeptr);
uiBlockEndAlign(node->block);
uiBlockLayoutResolve(node->block, NULL, &buty);
@@ -438,7 +438,7 @@ static void node_update_basis(const bContext *C, bNodeTree *ntree, bNode *node)
uiLayoutSetContextPointer(layout, "node", &nodeptr);
uiLayoutSetContextPointer(layout, "socket", &sockptr);
- node->typeinfo->drawinputfunc((bContext *)C, layout, &sockptr, &nodeptr, (nsock->flag & SOCK_IN_USE));
+ node->typeinfo->drawinputfunc((bContext *)C, layout, &sockptr, &nodeptr);
uiBlockEndAlign(node->block);
uiBlockLayoutResolve(node->block, NULL, &buty);