diff options
author | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2018-01-20 03:04:07 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2018-01-21 00:42:59 +0300 |
commit | e53447c137291da616d1b482843d7debf60bde6a (patch) | |
tree | 871931f3b165b19adc9f6661a2d199b061adb55e /source/blender/nodes/intern | |
parent | dd35048602a3dea450192195cfbedcaaca555c21 (diff) |
Fix old files with changed node socket type not loading correctly.
This would lead to sock.default_value pointing to the wrong data type,
possibly causing crashes. Unfortunately, this bug will still exist for
older Blender versions that try to load newer files, which makes
changing the type of a node socket problematic.
Diffstat (limited to 'source/blender/nodes/intern')
-rw-r--r-- | source/blender/nodes/intern/node_socket.c | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/source/blender/nodes/intern/node_socket.c b/source/blender/nodes/intern/node_socket.c index 5b5eadc1a99..342774facd0 100644 --- a/source/blender/nodes/intern/node_socket.c +++ b/source/blender/nodes/intern/node_socket.c @@ -112,22 +112,21 @@ static bNodeSocket *verify_socket_template(bNodeTree *ntree, bNode *node, int in break; } if (sock) { - sock->type = stemp->type; + if (sock->type != stemp->type) { + nodeModifySocketType(ntree, node, sock, stemp->type, stemp->subtype); + } + sock->limit = (stemp->limit == 0 ? 0xFFF : stemp->limit); sock->flag |= stemp->flag; - - BLI_remlink(socklist, sock); - - return sock; } else { /* no socket for this template found, make a new one */ sock = node_add_socket_from_template(ntree, node, stemp, in_out); - /* remove the new socket from the node socket list first, - * will be added back after verification. - */ - BLI_remlink(socklist, sock); } + + /* remove the new socket from the node socket list first, + * will be added back after verification. */ + BLI_remlink(socklist, sock); return sock; } |