Fix hair random rotation limited to 180 degrees
[blender.git] / source / blender / blenloader / intern / versioning_270.c
index 0853c93750c435da54d54bdaa1a553ef7073f8b6..49e81b1cfff2940fcd4d8d5655d0b7af07db9e38 100644 (file)
@@ -27,6 +27,7 @@
 
 #include "BLI_utildefines.h"
 #include "BLI_compiler_attrs.h"
+#include "BLI_string.h"
 
 /* for MinGW32 definition of NULL, could use BLI_blenlib.h instead too */
 #include <stddef.h>
@@ -39,6 +40,7 @@
 #include "DNA_cloth_types.h"
 #include "DNA_constraint_types.h"
 #include "DNA_sdna_types.h"
+#include "DNA_sequence_types.h"
 #include "DNA_space_types.h"
 #include "DNA_screen_types.h"
 #include "DNA_object_types.h"
 #include "DNA_particle_types.h"
 #include "DNA_linestyle_types.h"
 #include "DNA_actuator_types.h"
+#include "DNA_camera_types.h"
+#include "DNA_view3d_types.h"
 
 #include "DNA_genfile.h"
 
 #include "BKE_main.h"
 #include "BKE_modifier.h"
 #include "BKE_node.h"
+#include "BKE_scene.h"
+#include "BKE_sequencer.h"
 #include "BKE_screen.h"
+#include "BKE_sequencer.h"
 
 #include "BLI_math.h"
 #include "BLI_listbase.h"
@@ -458,10 +465,10 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *main)
                        br->mtex.random_angle = 2.0 * M_PI;
                        br->mask_mtex.random_angle = 2.0 * M_PI;
                }
+       }
 
 #undef BRUSH_RAKE
 #undef BRUSH_RANDOM_ROTATION
-       }
 
        /* Customizable Safe Areas */
        if (!MAIN_VERSION_ATLEAST(main, 273, 2)) {
@@ -657,7 +664,7 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *main)
 
                /* hysteresis setted to 10% but not actived */
                if (!DNA_struct_elem_find(fd->filesdna, "LodLevel", "int", "obhysteresis")) {
-                       Objectob;
+                       Object *ob;
                        for (ob = main->object.first; ob; ob = ob->id.next) {
                                LodLevel *level;
                                for (level = ob->lodlevels.first; level; level = level->next) {
@@ -673,4 +680,131 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *main)
                        }
                }
        }
+
+       if (!MAIN_VERSION_ATLEAST(main, 274, 2)) {
+               FOREACH_NODETREE(main, ntree, id) {
+                       bNode *node;
+                       bNodeSocket *sock;
+
+                       for (node = ntree->nodes.first; node; node = node->next) {
+                               if (node->type == SH_NODE_MATERIAL) {
+                                       for (sock = node->inputs.first; sock; sock = sock->next) {
+                                               if (STREQ(sock->name, "Refl")) {
+                                                       BLI_strncpy(sock->name, "DiffuseIntensity", sizeof(sock->name));
+                                               }
+                                       }
+                               }
+                               else if (node->type == SH_NODE_MATERIAL_EXT) {
+                                       for (sock = node->outputs.first; sock; sock = sock->next) {
+                                               if (STREQ(sock->name, "Refl")) {
+                                                       BLI_strncpy(sock->name, "DiffuseIntensity", sizeof(sock->name));
+                                               }
+                                               else if (STREQ(sock->name, "Ray Mirror")) {
+                                                       BLI_strncpy(sock->name, "Reflectivity", sizeof(sock->name));
+                                               }
+                                       }
+                               }
+                       }
+               } FOREACH_NODETREE_END
+       }
+
+       if (!MAIN_VERSION_ATLEAST(main, 274, 4)) {
+               SceneRenderView *srv;
+               wmWindowManager *wm;
+               bScreen *screen;
+               wmWindow *win;
+               Scene *scene;
+               Camera *cam;
+               Image *ima;
+
+               for (scene = main->scene.first; scene; scene = scene->id.next) {
+                       Sequence *seq;
+
+                       BKE_scene_add_render_view(scene, STEREO_LEFT_NAME);
+                       srv = scene->r.views.first;
+                       BLI_strncpy(srv->suffix, STEREO_LEFT_SUFFIX, sizeof(srv->suffix));
+
+                       BKE_scene_add_render_view(scene, STEREO_RIGHT_NAME);
+                       srv = scene->r.views.last;
+                       BLI_strncpy(srv->suffix, STEREO_RIGHT_SUFFIX, sizeof(srv->suffix));
+
+                       SEQ_BEGIN (scene->ed, seq)
+                       {
+                               seq->stereo3d_format = MEM_callocN(sizeof(Stereo3dFormat), "Stereo Display 3d Format");
+
+#define SEQ_USE_PROXY_CUSTOM_DIR (1 << 19)
+#define SEQ_USE_PROXY_CUSTOM_FILE (1 << 21)
+                               if (seq->strip && seq->strip->proxy && !seq->strip->proxy->storage) {
+                                       if (seq->flag & SEQ_USE_PROXY_CUSTOM_DIR)
+                                               seq->strip->proxy->storage = SEQ_STORAGE_PROXY_CUSTOM_DIR;
+                                       if (seq->flag & SEQ_USE_PROXY_CUSTOM_FILE)
+                                               seq->strip->proxy->storage = SEQ_STORAGE_PROXY_CUSTOM_FILE;
+                               }
+#undef SEQ_USE_PROXY_CUSTOM_DIR
+#undef SEQ_USE_PROXY_CUSTOM_FILE
+
+                       }
+                       SEQ_END
+               }
+
+               for (screen = main->screen.first; screen; screen = screen->id.next) {
+                       ScrArea *sa;
+                       for (sa = screen->areabase.first; sa; sa = sa->next) {
+                               SpaceLink *sl;
+
+                               for (sl = sa->spacedata.first; sl; sl = sl->next) {
+                                       switch (sl->spacetype) {
+                                               case SPACE_VIEW3D:
+                                               {
+                                                       View3D *v3d = (View3D *)sl;
+                                                       v3d->stereo3d_camera = STEREO_3D_ID;
+                                                       v3d->stereo3d_flag |= V3D_S3D_DISPPLANE;
+                                                       v3d->stereo3d_convergence_alpha = 0.15f;
+                                                       v3d->stereo3d_volume_alpha = 0.05f;
+                                                       break;
+                                               }
+                                               case SPACE_IMAGE:
+                                               {
+                                                       SpaceImage *sima = (SpaceImage *) sl;
+                                                       sima->iuser.flag |= IMA_SHOW_STEREO;
+                                                       sima->iuser.passtype = SCE_PASS_COMBINED;
+                                                       break;
+                                               }
+                                       }
+                               }
+                       }
+               }
+
+               for (cam = main->camera.first; cam; cam = cam->id.next) {
+                       cam->stereo.interocular_distance = 0.065;
+                       cam->stereo.convergence_distance = 30.f * 0.065;
+               }
+
+               for (ima = main->image.first; ima; ima = ima->id.next) {
+                       ima->stereo3d_format = MEM_callocN(sizeof(Stereo3dFormat), "Image Stereo 3d Format");
+
+                       if (ima->packedfile) {
+                               ImagePackedFile *imapf = MEM_mallocN(sizeof(ImagePackedFile), "Image Packed File");
+                               BLI_addtail(&ima->packedfiles, imapf);
+
+                               imapf->packedfile = ima->packedfile;
+                               BLI_strncpy(imapf->filepath, ima->name, FILE_MAX);
+                               ima->packedfile = NULL;
+                       }
+               }
+
+               for (wm = main->wm.first; wm; wm = wm->id.next) {
+                       for (win = wm->windows.first; win; win = win->next) {
+                               win->stereo3d_format = MEM_callocN(sizeof(Stereo3dFormat), "Stereo Display 3d Format");
+                       }
+               }
+       }
+
+       if (!MAIN_VERSION_ATLEAST(main, 274, 5)) {
+               /* Particle random phase range doubled. */
+               ParticleSettings *part;
+               for (part = main->particle.first; part; part = part->id.next) {
+                       part->randphasefac *= 0.5f;
+               }
+       }
 }