diff options
author | Lukas Toenne <lukas.toenne@googlemail.com> | 2012-01-20 17:27:54 +0400 |
---|---|---|
committer | Lukas Toenne <lukas.toenne@googlemail.com> | 2012-01-20 17:27:54 +0400 |
commit | 0b412e41368824f47cdd6643c86e4acaf28728e5 (patch) | |
tree | 04e346890ada996bddf9399cc6c679a919213fc3 /source/blender/editors/space_node | |
parent | 5c6413f69527e76b608f8063d99b52f3f5579d0b (diff) |
Cleanup of default_value handling in node sockets.
The structs stored in the anonymous void *default_value in bNodeSocket are now handled completely inside node_socket.c. All allocation/freeing/duplicating for this has been replaced by the appropriate calls to generic API functions (declared in NOD_socket.h).
This will make the default value handling more reliable for future node socket code. Group socket copying and value conversion has also been moved into the generic socket API file.
Diffstat (limited to 'source/blender/editors/space_node')
-rw-r--r-- | source/blender/editors/space_node/node_templates.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/source/blender/editors/space_node/node_templates.c b/source/blender/editors/space_node/node_templates.c index a733d45c20b..8d82dd3fb53 100644 --- a/source/blender/editors/space_node/node_templates.c +++ b/source/blender/editors/space_node/node_templates.c @@ -49,6 +49,8 @@ #include "RNA_access.h" +#include "NOD_socket.h" + #include "WM_api.h" #include "WM_types.h" @@ -205,12 +207,9 @@ static void node_socket_add_replace(Main *bmain, bNodeTree *ntree, bNode *node_t nodeRemLink(ntree, link); } - if(sock_prev->default_value) { - if(sock_from->default_value) - MEM_freeN(sock_from->default_value); - - sock_from->default_value = MEM_dupallocN(sock_prev->default_value); - } + node_socket_free_default_value(sock_from->type, sock_from->default_value); + sock_from->default_value = node_socket_make_default_value(sock_from->type); + node_socket_copy_default_value(sock_from->type, sock_from->default_value, sock_prev->default_value); } } } |