Merge branch 'master' into blender2.8
[blender.git] / source / blender / blenloader / intern / writefile.c
index 03436f4658ace15261a93c6bab638a7cbc2045ea..d8097f1a50adb9e35eb359d32a71c2492b241b44 100644 (file)
@@ -912,20 +912,22 @@ static void write_curvemapping(WriteData *wd, CurveMapping *cumap)
 static void write_node_socket(WriteData *wd, bNodeTree *UNUSED(ntree), bNode *node, bNodeSocket *sock)
 {
 #ifdef USE_NODE_COMPAT_CUSTOMNODES
-       /* forward compatibility code, so older blenders still open */
-       sock->stack_type = 1;
-
-       if (node->type == NODE_GROUP) {
-               bNodeTree *ngroup = (bNodeTree *)node->id;
-               if (ngroup) {
-                       /* for node groups: look up the deprecated groupsock pointer */
-                       sock->groupsock = ntreeFindSocketInterface(ngroup, sock->in_out, sock->identifier);
-                       BLI_assert(sock->groupsock != NULL);
-
-                       /* node group sockets now use the generic identifier string to verify group nodes,
-                        * old blender uses the own_index.
-                        */
-                       sock->own_index = sock->groupsock->own_index;
+       /* forward compatibility code, so older blenders still open (not for undo) */
+       if (wd->current == NULL) {
+               sock->stack_type = 1;
+
+               if (node->type == NODE_GROUP) {
+                       bNodeTree *ngroup = (bNodeTree *)node->id;
+                       if (ngroup) {
+                               /* for node groups: look up the deprecated groupsock pointer */
+                               sock->groupsock = ntreeFindSocketInterface(ngroup, sock->in_out, sock->identifier);
+                               BLI_assert(sock->groupsock != NULL);
+
+                               /* node group sockets now use the generic identifier string to verify group nodes,
+                                * old blender uses the own_index.
+                                */
+                               sock->own_index = sock->groupsock->own_index;
+                       }
                }
        }
 #endif