From fd553c5b7bdfd5bec1cc005bc67785c54916a64a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lukas=20T=C3=B6nne?= Date: Sun, 2 Mar 2014 16:04:25 +0100 Subject: Fix T37334: Better "internal links" function for muting and node disconnect. Implements a more flexible internal connect function for standard nodes (compositor, shader, texture). Allow feasible datatype connections by priority. The priorities for common datatypes in compositor, shader and texture nodes are encoded in a simple function. Certain impossible connections (e.g. color -> cycles shader) are excluded by giving them -1 priority. Priority overrides link status: If a higher priority input can be found, this will be used regardless of link status. Link status only comes into play for inputs with same priority. Reviewers: brecht CC: sebastian_k Differential Revision: https://developer.blender.org/D356 --- source/blender/makesdna/DNA_node_types.h | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) (limited to 'source/blender/makesdna') diff --git a/source/blender/makesdna/DNA_node_types.h b/source/blender/makesdna/DNA_node_types.h index 4f7c49a0ca3..c21cdfa66a2 100644 --- a/source/blender/makesdna/DNA_node_types.h +++ b/source/blender/makesdna/DNA_node_types.h @@ -128,19 +128,23 @@ typedef struct bNodeSocket { /* XXX deprecated, socket input values are stored in default_value now. kept for forward compatibility */ bNodeStack ns DNA_DEPRECATED; /* custom data for inputs, only UI writes in this */ + + /* optional: allowed inputs for internal links */ + const bool *internal_links; } bNodeSocket; /* sock->type */ -#define SOCK_CUSTOM -1 /* socket has no integer type */ -#define SOCK_FLOAT 0 -#define SOCK_VECTOR 1 -#define SOCK_RGBA 2 -#define SOCK_SHADER 3 -#define SOCK_BOOLEAN 4 -#define __SOCK_MESH 5 /* deprecated */ -#define SOCK_INT 6 -#define SOCK_STRING 7 -#define NUM_SOCKET_TYPES 8 /* must be last! */ +typedef enum eNodeSocketDatatype { + SOCK_CUSTOM = -1, /* socket has no integer type */ + SOCK_FLOAT = 0, + SOCK_VECTOR = 1, + SOCK_RGBA = 2, + SOCK_SHADER = 3, + SOCK_BOOLEAN = 4, + __SOCK_MESH = 5, /* deprecated */ + SOCK_INT = 6, + SOCK_STRING = 7 +} eNodeSocketDatatype; /* socket side (input/output) */ typedef enum eNodeSocketInOut { -- cgit v1.2.3