Fix #31236: linking a socket of a different type to an existing node group output
authorBrecht Van Lommel <brechtvanlommel@pandora.be>
Wed, 2 May 2012 15:47:15 +0000 (15:47 +0000)
committerBrecht Van Lommel <brechtvanlommel@pandora.be>
Wed, 2 May 2012 15:47:15 +0000 (15:47 +0000)
would crash, did not convert default value storage correctly.

source/blender/editors/space_node/node_edit.c
source/blender/nodes/intern/node_common.c

index c0817f9c8952f661db2c8d4d7bb1474134be3c65..4bbba419613a226af396af1dc53a9d7907a70469 100644 (file)
@@ -2412,7 +2412,8 @@ static int node_link_modal(bContext *C, wmOperator *op, wmEvent *event)
                                /* when linking to group outputs, update the socket type */
                                /* XXX this should all be part of a generic update system */
                                if (!link->tonode) {
-                                       link->tosock->type = link->fromsock->type;
+                                       if(link->tosock->type != link->fromsock->type)
+                                               nodeSocketSetType(link->tosock, link->fromsock->type);
                                }
                        }
                        else if (outside_group_rect(snode) && (link->tonode || link->fromnode)) {
index 13882d631d80d54bac4e674234d4dc0e4a8f43f2..3aadcef4c8201346569b4cbe38bbf2b0e4e6e583 100644 (file)
@@ -551,7 +551,8 @@ static bNodeSocket *group_verify_socket(bNodeTree *ntree, ListBase *lb, int in_o
                sock->groupsock = gsock;
                
                BLI_strncpy(sock->name, gsock->name, sizeof(sock->name));
-               sock->type= gsock->type;
+               if(gsock->type != sock->type)
+                       nodeSocketSetType(sock, gsock->type);
                
                /* XXX hack: group socket input/output roles are inverted internally,
                 * need to change the limit value when making actual node sockets from them.