svn merge ^/trunk/blender -r43294:43338
[blender.git] / source / blender / blenloader / intern / readfile.c
index 162d3102cb6da28343b7cafd0c13e0a9d72eaf85..0328be060cc4832920f2d185d6114faf6f040da1 100644 (file)
@@ -6639,14 +6639,14 @@ static void customdata_version_242(Mesh *me)
                if (layer->type == CD_MTFACE) {
                        if (layer->name[0] == 0) {
                                if (mtfacen == 0) strcpy(layer->name, "UVMap");
-                               else sprintf(layer->name, "UVMap.%.3d", mtfacen);
+                               else BLI_snprintf(layer->name, sizeof(layer->name), "UVMap.%.3d", mtfacen);
                        }
                        mtfacen++;
                }
                else if (layer->type == CD_MCOL) {
                        if (layer->name[0] == 0) {
                                if (mcoln == 0) strcpy(layer->name, "Col");
-                               else sprintf(layer->name, "Col.%.3d", mcoln);
+                               else BLI_snprintf(layer->name, sizeof(layer->name), "Col.%.3d", mcoln);
                        }
                        mcoln++;
                }
@@ -7626,6 +7626,32 @@ static void do_versions_nodetree_socket_use_flags_2_62(bNodeTree *ntree)
        }
 }
 
+/* set the SOCK_AUTO_HIDDEN flag on collapsed nodes */
+static void do_versions_nodetree_socket_auto_hidden_flags_2_62(bNodeTree *ntree)
+{
+       bNode *node;
+       bNodeSocket *sock;
+       
+       for (node=ntree->nodes.first; node; node=node->next) {
+               if (node->flag & NODE_HIDDEN) {
+                       for (sock=node->inputs.first; sock; sock=sock->next) {
+                               if (sock->link==NULL)
+                                       sock->flag |= SOCK_AUTO_HIDDEN;
+                       }
+                       for(sock=node->outputs.first; sock; sock= sock->next) {
+                               if(nodeCountSocketLinks(ntree, sock)==0)
+                                       sock->flag |= SOCK_AUTO_HIDDEN;
+                       }
+               }
+               else {
+                       for(sock=node->inputs.first; sock; sock= sock->next)
+                               sock->flag &= ~SOCK_AUTO_HIDDEN;
+                       for(sock=node->outputs.first; sock; sock= sock->next)
+                               sock->flag &= ~SOCK_AUTO_HIDDEN;
+               }
+       }
+}
+
 static void do_versions(FileData *fd, Library *lib, Main *main)
 {
        /* WATCH IT!!!: pointers from libdata have not been converted */
@@ -9115,8 +9141,9 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
                                                        strcpy(kb->name, "Basis");
                                        }
                                        else {
-                                               if(kb->name[0]==0)
-                                                       sprintf(kb->name, "Key %d", index);
+                                               if (kb->name[0]==0) {
+                                                       BLI_snprintf(kb->name, sizeof(kb->name), "Key %d", index);
+                                               }
                                                kb->adrcode= index++;
                                        }
                                }
@@ -10109,7 +10136,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
                                BLI_addtail(&ob->particlesystem, psys);
 
                                md= modifier_new(eModifierType_ParticleSystem);
-                               sprintf(md->name, "ParticleSystem %i", BLI_countlist(&ob->particlesystem));
+                               BLI_snprintf(md->name, sizeof(md->name), "ParticleSystem %i", BLI_countlist(&ob->particlesystem));
                                psmd= (ParticleSystemModifierData*) md;
                                psmd->psys=psys;
                                BLI_addtail(&ob->modifiers, md);
@@ -10956,7 +10983,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
                        sce->gm.dome.warptext = sce->r.dometext;
 
                        //Stand Alone
-                       sce->gm.fullscreen = sce->r.fullscreen;
+                       sce->gm.playerflag |= (sce->r.fullscreen?GAME_PLAYER_FULLSCREEN:0);
                        sce->gm.xplay = sce->r.xplay;
                        sce->gm.yplay = sce->r.yplay;
                        sce->gm.freqplay = sce->r.freqplay;
@@ -12327,7 +12354,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
                Mesh *me;
 
                for(me= main->mesh.first; me; me= me->id.next)
-                       mesh_calc_tessface_normals(me->mvert, me->totvert, me->mface, me->totface, NULL);
+                       mesh_calc_normals_tessface(me->mvert, me->totvert, me->mface, me->totface, NULL);
        }
 
        if (main->versionfile < 256 || (main->versionfile == 256 && main->subversionfile < 2)){
@@ -12858,7 +12885,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
                }
        }
 
-       /* put compatibility code here until next subversion bump */
+       if (main->versionfile < 261 || (main->versionfile == 261 && main->subversionfile < 1))
        {
                {
                        /* update use flags for node sockets (was only temporary before) */
@@ -12958,6 +12985,77 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
                                }
                        }
                }
+               {
+                       /* set the SOCK_AUTO_HIDDEN flag on collapsed nodes */
+                       Scene *sce;
+                       Material *mat;
+                       Tex *tex;
+                       Lamp *lamp;
+                       World *world;
+                       bNodeTree *ntree;
+
+                       for (sce=main->scene.first; sce; sce=sce->id.next)
+                               if (sce->nodetree)
+                                       do_versions_nodetree_socket_auto_hidden_flags_2_62(sce->nodetree);
+
+                       for (mat=main->mat.first; mat; mat=mat->id.next)
+                               if (mat->nodetree)
+                                       do_versions_nodetree_socket_auto_hidden_flags_2_62(mat->nodetree);
+
+                       for (tex=main->tex.first; tex; tex=tex->id.next)
+                               if (tex->nodetree)
+                                       do_versions_nodetree_socket_auto_hidden_flags_2_62(tex->nodetree);
+
+                       for (lamp=main->lamp.first; lamp; lamp=lamp->id.next)
+                               if (lamp->nodetree)
+                                       do_versions_nodetree_socket_auto_hidden_flags_2_62(lamp->nodetree);
+
+                       for (world=main->world.first; world; world=world->id.next)
+                               if (world->nodetree)
+                                       do_versions_nodetree_socket_auto_hidden_flags_2_62(world->nodetree);
+
+                       for (ntree=main->nodetree.first; ntree; ntree=ntree->id.next)
+                               do_versions_nodetree_socket_auto_hidden_flags_2_62(ntree);
+               }
+       }
+
+       if (main->versionfile < 261 || (main->versionfile == 261 && main->subversionfile < 2))
+       {
+               {
+                       /* convert Camera Actuator values to defines */
+                       Object *ob;
+                       bActuator *act;
+                       for(ob = main->object.first; ob; ob= ob->id.next) {
+                               for(act= ob->actuators.first; act; act= act->next) {
+                                       if (act->type == ACT_CAMERA) {
+                                               bCameraActuator *ba= act->data;
+
+                                               if(ba->axis==(float) 'x') ba->axis=OB_POSX;
+                                               else if (ba->axis==(float)'y') ba->axis=OB_POSY;
+                                               /* don't do an if/else to avoid imediate subversion bump*/
+//                                     ba->axis=((ba->axis == (float) 'x')?OB_POSX_X:OB_POSY);
+                                       }
+                               }
+                       }
+               }
+
+               {
+                       /* convert deprecated sculpt_paint_unified_* fields to
+                          UnifiedPaintSettings */
+                       Scene *scene;
+                       for(scene= main->scene.first; scene; scene= scene->id.next) {
+                               ToolSettings *ts= scene->toolsettings;
+                               UnifiedPaintSettings *ups= &ts->unified_paint_settings;
+                               ups->size= ts->sculpt_paint_unified_size;
+                               ups->unprojected_radius= ts->sculpt_paint_unified_unprojected_radius;
+                               ups->alpha= ts->sculpt_paint_unified_alpha;
+                               ups->flag= ts->sculpt_paint_settings;
+                       }
+               }
+       }
+       
+       /* put compatibility code here until next subversion bump */
+       {
        }
 
        /* WATCH IT!!!: pointers from libdata have not been converted yet here! */