svn merge -r39930:39947 https://svn.blender.org/svnroot/bf-blender/trunk/blender
[blender.git] / source / blender / blenloader / intern / writefile.c
index 5099b52..c3f51dc 100644 (file)
@@ -642,6 +642,14 @@ static void write_curvemapping(WriteData *wd, CurveMapping *cumap)
                writestruct(wd, DATA, "CurveMapPoint", cumap->cm[a].totpoint, cumap->cm[a].curve);
 }
 
+static void write_node_socket(WriteData *wd, bNodeSocket *sock)
+{
+       bNodeSocketType *stype= ntreeGetSocketType(sock->type);
+       writestruct(wd, DATA, "bNodeSocket", 1, sock);
+       if (sock->default_value)
+               writestruct(wd, DATA, stype->value_structname, 1, sock->default_value);
+}
+
 /* this is only direct data, tree itself should have been written */
 static void write_nodetree(WriteData *wd, bNodeTree *ntree)
 {
@@ -657,6 +665,12 @@ static void write_nodetree(WriteData *wd, bNodeTree *ntree)
                writestruct(wd, DATA, "bNode", 1, node);
 
        for(node= ntree->nodes.first; node; node= node->next) {
+               for(sock= node->inputs.first; sock; sock= sock->next)
+                       write_node_socket(wd, sock);
+               for(sock= node->outputs.first; sock; sock= sock->next)
+                       write_node_socket(wd, sock);
+
+               
                if(node->storage && node->type!=NODE_DYNAMIC) {
                        /* could be handlerized at some point, now only 1 exception still */
                        if(ntree->type==NTREE_SHADER && (node->type==SH_NODE_CURVE_VEC || node->type==SH_NODE_CURVE_RGB))
@@ -665,13 +679,9 @@ static void write_nodetree(WriteData *wd, bNodeTree *ntree)
                                write_curvemapping(wd, node->storage);
                        else if(ntree->type==NTREE_TEXTURE && (node->type==TEX_NODE_CURVE_RGB || node->type==TEX_NODE_CURVE_TIME) )
                                write_curvemapping(wd, node->storage);
-                       else 
+                       else
                                writestruct(wd, DATA, node->typeinfo->storagename, 1, node->storage);
                }
-               for(sock= node->inputs.first; sock; sock= sock->next)
-                       writestruct(wd, DATA, "bNodeSocket", 1, sock);
-               for(sock= node->outputs.first; sock; sock= sock->next)
-                       writestruct(wd, DATA, "bNodeSocket", 1, sock);
        }
        
        for(link= ntree->links.first; link; link= link->next)
@@ -679,9 +689,9 @@ static void write_nodetree(WriteData *wd, bNodeTree *ntree)
        
        /* external sockets */
        for(sock= ntree->inputs.first; sock; sock= sock->next)
-               writestruct(wd, DATA, "bNodeSocket", 1, sock);
+               write_node_socket(wd, sock);
        for(sock= ntree->outputs.first; sock; sock= sock->next)
-               writestruct(wd, DATA, "bNodeSocket", 1, sock);
+               write_node_socket(wd, sock);
 }
 
 static void current_screen_compat(Main *mainvar, bScreen **screen)
@@ -868,10 +878,12 @@ static void write_particlesettings(WriteData *wd, ListBase *idbase)
                        for(; dw; dw=dw->next) {
                                /* update indices */
                                dw->index = 0;
-                               go = part->dup_group->gobject.first;
-                               while(go && go->ob != dw->ob) {
-                                       go=go->next;
-                                       dw->index++;
+                               if(part->dup_group) { /* can be NULL if lining fails or set to None */
+                                       go = part->dup_group->gobject.first;
+                                       while(go && go->ob != dw->ob) {
+                                               go=go->next;
+                                               dw->index++;
+                                       }
                                }
                                writestruct(wd, DATA, "ParticleDupliWeight", 1, dw);
                        }
@@ -931,7 +943,7 @@ static void write_particlesystems(WriteData *wd, ListBase *particles)
                        writestruct(wd, DATA, "ClothSimSettings", 1, psys->clmd->sim_parms);
                        writestruct(wd, DATA, "ClothCollSettings", 1, psys->clmd->coll_parms);
                }
-               
+
                write_pointcaches(wd, &psys->ptcaches);
        }
 }
@@ -1307,6 +1319,12 @@ static void write_modifiers(WriteData *wd, ListBase *modbase)
                                write_curvemapping(wd, tmd->curfalloff);
                        }
                }
+               else if (md->type==eModifierType_WeightVGEdit) {
+                       WeightVGEditModifierData *wmd = (WeightVGEditModifierData*) md;
+
+                       if (wmd->cmap_curve)
+                               write_curvemapping(wd, wmd->cmap_curve);
+               }
        }
 }
 
@@ -1919,9 +1937,6 @@ static void write_scenes(WriteData *wd, ListBase *scebase)
                                                case SEQ_TRANSFORM:
                                                        writestruct(wd, DATA, "TransformVars", 1, seq->effectdata);
                                                        break;
-                                               case SEQ_TITLECARD:
-                                                       writestruct(wd, DATA, "TitleCardVars", 1, seq->effectdata);
-                                                       break;
                                                }
                                        }
                                        
@@ -2482,7 +2497,7 @@ static void write_global(WriteData *wd, int fileflags, Main *mainvar)
        fg.subversion= BLENDER_SUBVERSION;
        fg.minversion= BLENDER_MINVERSION;
        fg.minsubversion= BLENDER_MINSUBVERSION;
-#ifdef NAN_BUILDINFO
+#ifdef WITH_BUILDINFO
        {
                extern char build_rev[];
                fg.revision= atoi(build_rev);