2 * ***** BEGIN GPL LICENSE BLOCK *****
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software Foundation,
16 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 * Contributor(s): Blender Foundation
20 * ***** END GPL LICENSE BLOCK *****
24 /** \file blender/blenloader/intern/versioning_270.c
28 #include "BLI_utildefines.h"
29 #include "BLI_compiler_attrs.h"
30 #include "BLI_string.h"
32 /* for MinGW32 definition of NULL, could use BLI_blenlib.h instead too */
35 /* allow readfile to use deprecated functionality */
36 #define DNA_DEPRECATED_ALLOW
38 #include "DNA_brush_types.h"
39 #include "DNA_camera_types.h"
40 #include "DNA_cloth_types.h"
41 #include "DNA_constraint_types.h"
42 #include "DNA_sdna_types.h"
43 #include "DNA_sequence_types.h"
44 #include "DNA_space_types.h"
45 #include "DNA_screen_types.h"
46 #include "DNA_object_types.h"
47 #include "DNA_mesh_types.h"
48 #include "DNA_modifier_types.h"
49 #include "DNA_particle_types.h"
50 #include "DNA_linestyle_types.h"
51 #include "DNA_actuator_types.h"
52 #include "DNA_camera_types.h"
53 #include "DNA_view3d_types.h"
55 #include "DNA_genfile.h"
58 #include "BKE_modifier.h"
60 #include "BKE_scene.h"
61 #include "BKE_sequencer.h"
62 #include "BKE_screen.h"
63 #include "BKE_sequencer.h"
66 #include "BLI_listbase.h"
67 #include "BLI_string.h"
69 #include "BLO_readfile.h"
73 #include "MEM_guardedalloc.h"
75 static void do_version_constraints_radians_degrees_270_1(ListBase *lb)
79 for (con = lb->first; con; con = con->next) {
80 if (con->type == CONSTRAINT_TYPE_TRANSFORM) {
81 bTransformConstraint *data = (bTransformConstraint *)con->data;
82 const float deg_to_rad_f = DEG2RADF(1.0f);
84 if (data->from == TRANS_ROTATION) {
85 mul_v3_fl(data->from_min, deg_to_rad_f);
86 mul_v3_fl(data->from_max, deg_to_rad_f);
89 if (data->to == TRANS_ROTATION) {
90 mul_v3_fl(data->to_min, deg_to_rad_f);
91 mul_v3_fl(data->to_max, deg_to_rad_f);
97 static void do_version_constraints_radians_degrees_270_5(ListBase *lb)
101 for (con = lb->first; con; con = con->next) {
102 if (con->type == CONSTRAINT_TYPE_TRANSFORM) {
103 bTransformConstraint *data = (bTransformConstraint *)con->data;
105 if (data->from == TRANS_ROTATION) {
106 copy_v3_v3(data->from_min_rot, data->from_min);
107 copy_v3_v3(data->from_max_rot, data->from_max);
109 else if (data->from == TRANS_SCALE) {
110 copy_v3_v3(data->from_min_scale, data->from_min);
111 copy_v3_v3(data->from_max_scale, data->from_max);
114 if (data->to == TRANS_ROTATION) {
115 copy_v3_v3(data->to_min_rot, data->to_min);
116 copy_v3_v3(data->to_max_rot, data->to_max);
118 else if (data->to == TRANS_SCALE) {
119 copy_v3_v3(data->to_min_scale, data->to_min);
120 copy_v3_v3(data->to_max_scale, data->to_max);
126 static void do_version_constraints_stretch_to_limits(ListBase *lb)
130 for (con = lb->first; con; con = con->next) {
131 if (con->type == CONSTRAINT_TYPE_STRETCHTO) {
132 bStretchToConstraint *data = (bStretchToConstraint *)con->data;
133 data->bulge_min = 1.0f;
134 data->bulge_max = 1.0f;
139 void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *main)
141 if (!MAIN_VERSION_ATLEAST(main, 270, 0)) {
143 if (!DNA_struct_elem_find(fd->filesdna, "BevelModifierData", "float", "profile")) {
146 for (ob = main->object.first; ob; ob = ob->id.next) {
148 for (md = ob->modifiers.first; md; md = md->next) {
149 if (md->type == eModifierType_Bevel) {
150 BevelModifierData *bmd = (BevelModifierData *)md;
152 bmd->val_flags = MOD_BEVEL_AMT_OFFSET;
158 /* nodes don't use fixed node->id any more, clean up */
159 FOREACH_NODETREE(main, ntree, id) {
160 if (ntree->type == NTREE_COMPOSIT) {
162 for (node = ntree->nodes.first; node; node = node->next) {
163 if (ELEM(node->type, CMP_NODE_COMPOSITE, CMP_NODE_OUTPUT_FILE)) {
168 } FOREACH_NODETREE_END
173 for (screen = main->screen.first; screen; screen = screen->id.next) {
175 for (area = screen->areabase.first; area; area = area->next) {
176 SpaceLink *space_link;
177 for (space_link = area->spacedata.first; space_link; space_link = space_link->next) {
178 if (space_link->spacetype == SPACE_CLIP) {
179 SpaceClip *space_clip = (SpaceClip *) space_link;
180 if (space_clip->mode != SC_MODE_MASKEDIT) {
181 space_clip->mode = SC_MODE_TRACKING;
189 if (!DNA_struct_elem_find(fd->filesdna, "MovieTrackingSettings", "float", "default_weight")) {
191 for (clip = main->movieclip.first; clip; clip = clip->id.next) {
192 clip->tracking.settings.default_weight = 1.0f;
197 if (!MAIN_VERSION_ATLEAST(main, 270, 1)) {
201 /* Update Transform constraint (another deg -> rad stuff). */
202 for (ob = main->object.first; ob; ob = ob->id.next) {
203 do_version_constraints_radians_degrees_270_1(&ob->constraints);
206 /* Bones constraints! */
208 for (pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next) {
209 do_version_constraints_radians_degrees_270_1(&pchan->constraints);
214 for (sce = main->scene.first; sce; sce = sce->id.next) {
215 if (sce->r.raytrace_structure == R_RAYSTRUCTURE_BLIBVH) {
216 sce->r.raytrace_structure = R_RAYSTRUCTURE_AUTO;
221 if (!MAIN_VERSION_ATLEAST(main, 270, 2)) {
224 /* Mesh smoothresh deg->rad. */
225 for (me = main->mesh.first; me; me = me->id.next) {
226 me->smoothresh = DEG2RADF(me->smoothresh);
230 if (!MAIN_VERSION_ATLEAST(main, 270, 3)) {
231 FreestyleLineStyle *linestyle;
233 for (linestyle = main->linestyle.first; linestyle; linestyle = linestyle->id.next) {
234 linestyle->flag |= LS_NO_SORTING;
235 linestyle->sort_key = LS_SORT_KEY_DISTANCE_FROM_CAMERA;
236 linestyle->integration_type = LS_INTEGRATION_MEAN;
240 if (!MAIN_VERSION_ATLEAST(main, 270, 4)) {
241 /* ui_previews were not handled correctly when copying areas, leading to corrupted files (see T39847).
242 * This will always reset situation to a valid state.
246 for (sc = main->screen.first; sc; sc = sc->id.next) {
248 for (sa = sc->areabase.first; sa; sa = sa->next) {
251 for (sl = sa->spacedata.first; sl; sl = sl->next) {
253 ListBase *lb = (sl == sa->spacedata.first) ? &sa->regionbase : &sl->regionbase;
255 for (ar = lb->first; ar; ar = ar->next) {
256 BLI_listbase_clear(&ar->ui_previews);
263 if (!MAIN_VERSION_ATLEAST(main, 270, 5)) {
266 /* Update Transform constraint (again :|). */
267 for (ob = main->object.first; ob; ob = ob->id.next) {
268 do_version_constraints_radians_degrees_270_5(&ob->constraints);
271 /* Bones constraints! */
273 for (pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next) {
274 do_version_constraints_radians_degrees_270_5(&pchan->constraints);
280 if (!MAIN_VERSION_ATLEAST(main, 271, 0)) {
281 if (!DNA_struct_elem_find(fd->filesdna, "Material", "int", "mode2")) {
284 for (ma = main->mat.first; ma; ma = ma->id.next)
285 ma->mode2 = MA_CASTSHADOW;
288 if (!DNA_struct_elem_find(fd->filesdna, "RenderData", "BakeData", "bake")) {
291 for (sce = main->scene.first; sce; sce = sce->id.next) {
292 sce->r.bake.flag = R_BAKE_CLEAR;
293 sce->r.bake.width = 512;
294 sce->r.bake.height = 512;
295 sce->r.bake.margin = 16;
296 sce->r.bake.normal_space = R_BAKE_SPACE_TANGENT;
297 sce->r.bake.normal_swizzle[0] = R_BAKE_POSX;
298 sce->r.bake.normal_swizzle[1] = R_BAKE_POSY;
299 sce->r.bake.normal_swizzle[2] = R_BAKE_POSZ;
300 BLI_strncpy(sce->r.bake.filepath, U.renderdir, sizeof(sce->r.bake.filepath));
302 sce->r.bake.im_format.planes = R_IMF_PLANES_RGBA;
303 sce->r.bake.im_format.imtype = R_IMF_IMTYPE_PNG;
304 sce->r.bake.im_format.depth = R_IMF_CHAN_DEPTH_8;
305 sce->r.bake.im_format.quality = 90;
306 sce->r.bake.im_format.compress = 15;
310 if (!DNA_struct_elem_find(fd->filesdna, "FreestyleLineStyle", "float", "texstep")) {
311 FreestyleLineStyle *linestyle;
313 for (linestyle = main->linestyle.first; linestyle; linestyle = linestyle->id.next) {
314 linestyle->flag |= LS_TEXTURE;
315 linestyle->texstep = 1.0;
321 for (scene = main->scene.first; scene; scene = scene->id.next) {
322 int num_layers = BLI_listbase_count(&scene->r.layers);
323 scene->r.actlay = min_ff(scene->r.actlay, num_layers - 1);
328 if (!MAIN_VERSION_ATLEAST(main, 271, 1)) {
329 if (!DNA_struct_elem_find(fd->filesdna, "Material", "float", "line_col[4]")) {
332 for (mat = main->mat.first; mat; mat = mat->id.next) {
333 mat->line_col[0] = mat->line_col[1] = mat->line_col[2] = 0.0f;
334 mat->line_col[3] = mat->alpha;
338 if (!DNA_struct_elem_find(fd->filesdna, "RenderData", "int", "preview_start_resolution")) {
340 for (scene = main->scene.first; scene; scene = scene->id.next) {
341 scene->r.preview_start_resolution = 64;
346 if (!MAIN_VERSION_ATLEAST(main, 271, 2)) {
347 /* init up & track axis property of trackto actuators */
350 for (ob = main->object.first; ob; ob = ob->id.next) {
352 for (act = ob->actuators.first; act; act = act->next) {
353 if (act->type == ACT_EDIT_OBJECT) {
354 bEditObjectActuator *eoact = act->data;
355 eoact->trackflag = ob->trackflag;
356 /* if trackflag is pointing +-Z axis then upflag should point Y axis.
357 * Rest of trackflag cases, upflag should be point z axis */
358 if ((ob->trackflag == OB_POSZ) || (ob->trackflag == OB_NEGZ)) {
369 if (!MAIN_VERSION_ATLEAST(main, 271, 3)) {
372 for (br = main->brush.first; br; br = br->id.next) {
373 br->fill_threshold = 0.2f;
376 if (!DNA_struct_elem_find(fd->filesdna, "BevelModifierData", "int", "mat")) {
378 for (ob = main->object.first; ob; ob = ob->id.next) {
381 for (md = ob->modifiers.first; md; md = md->next) {
382 if (md->type == eModifierType_Bevel) {
383 BevelModifierData *bmd = (BevelModifierData *)md;
391 if (!MAIN_VERSION_ATLEAST(main, 271, 6)) {
393 for (ob = main->object.first; ob; ob = ob->id.next) {
396 for (md = ob->modifiers.first; md; md = md->next) {
397 if (md->type == eModifierType_ParticleSystem) {
398 ParticleSystemModifierData *pmd = (ParticleSystemModifierData *)md;
399 if (pmd->psys && pmd->psys->clmd) {
400 pmd->psys->clmd->sim_parms->vel_damping = 1.0f;
407 if (!MAIN_VERSION_ATLEAST(main, 272, 0)) {
408 if (!DNA_struct_elem_find(fd->filesdna, "RenderData", "int", "preview_start_resolution")) {
410 for (scene = main->scene.first; scene; scene = scene->id.next) {
411 scene->r.preview_start_resolution = 64;
416 if (!MAIN_VERSION_ATLEAST(main, 272, 1)) {
418 for (br = main->brush.first; br; br = br->id.next) {
419 if ((br->ob_mode & OB_MODE_SCULPT) && ELEM(br->sculpt_tool, SCULPT_TOOL_GRAB, SCULPT_TOOL_SNAKE_HOOK))
424 if (!MAIN_VERSION_ATLEAST(main, 272, 2)) {
425 if (!DNA_struct_elem_find(fd->filesdna, "Image", "float", "gen_color")) {
427 for (image = main->image.first; image != NULL; image = image->id.next) {
428 image->gen_color[3] = 1.0f;
432 if (!DNA_struct_elem_find(fd->filesdna, "bStretchToConstraint", "float", "bulge_min")) {
435 /* Update Transform constraint (again :|). */
436 for (ob = main->object.first; ob; ob = ob->id.next) {
437 do_version_constraints_stretch_to_limits(&ob->constraints);
440 /* Bones constraints! */
442 for (pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next) {
443 do_version_constraints_stretch_to_limits(&pchan->constraints);
450 if (!MAIN_VERSION_ATLEAST(main, 273, 1)) {
451 #define BRUSH_RAKE (1 << 7)
452 #define BRUSH_RANDOM_ROTATION (1 << 25)
456 for (br = main->brush.first; br; br = br->id.next) {
457 if (br->flag & BRUSH_RAKE) {
458 br->mtex.brush_angle_mode |= MTEX_ANGLE_RAKE;
459 br->mask_mtex.brush_angle_mode |= MTEX_ANGLE_RAKE;
461 else if (br->flag & BRUSH_RANDOM_ROTATION) {
462 br->mtex.brush_angle_mode |= MTEX_ANGLE_RANDOM;
463 br->mask_mtex.brush_angle_mode |= MTEX_ANGLE_RANDOM;
465 br->mtex.random_angle = 2.0 * M_PI;
466 br->mask_mtex.random_angle = 2.0 * M_PI;
471 #undef BRUSH_RANDOM_ROTATION
473 /* Customizable Safe Areas */
474 if (!MAIN_VERSION_ATLEAST(main, 273, 2)) {
475 if (!DNA_struct_elem_find(fd->filesdna, "Scene", "DisplaySafeAreas", "safe_areas")) {
478 for (scene = main->scene.first; scene; scene = scene->id.next) {
479 copy_v2_fl2(scene->safe_areas.title, 3.5f / 100.0f, 3.5f / 100.0f);
480 copy_v2_fl2(scene->safe_areas.action, 10.0f / 100.0f, 5.0f / 100.0f);
481 copy_v2_fl2(scene->safe_areas.title_center, 17.5f / 100.0f, 5.0f / 100.0f);
482 copy_v2_fl2(scene->safe_areas.action_center, 15.0f / 100.0f, 5.0f / 100.0f);
487 if (!MAIN_VERSION_ATLEAST(main, 273, 3)) {
488 ParticleSettings *part;
489 for (part = main->particle.first; part; part = part->id.next) {
490 if (part->clumpcurve)
491 part->child_flag |= PART_CHILD_USE_CLUMP_CURVE;
492 if (part->roughcurve)
493 part->child_flag |= PART_CHILD_USE_ROUGH_CURVE;
497 if (!MAIN_VERSION_ATLEAST(main, 273, 6)) {
498 if (!DNA_struct_elem_find(fd->filesdna, "ClothSimSettings", "float", "bending_damping")) {
501 for (ob = main->object.first; ob; ob = ob->id.next) {
502 for (md = ob->modifiers.first; md; md = md->next) {
503 if (md->type == eModifierType_Cloth) {
504 ClothModifierData *clmd = (ClothModifierData *)md;
505 clmd->sim_parms->bending_damping = 0.5f;
507 else if (md->type == eModifierType_ParticleSystem) {
508 ParticleSystemModifierData *pmd = (ParticleSystemModifierData *)md;
509 if (pmd->psys->clmd) {
510 pmd->psys->clmd->sim_parms->bending_damping = 0.5f;
517 if (!DNA_struct_elem_find(fd->filesdna, "ParticleSettings", "float", "clump_noise_size")) {
518 ParticleSettings *part;
519 for (part = main->particle.first; part; part = part->id.next) {
520 part->clump_noise_size = 1.0f;
524 if (!DNA_struct_elem_find(fd->filesdna, "ParticleSettings", "int", "kink_extra_steps")) {
525 ParticleSettings *part;
526 for (part = main->particle.first; part; part = part->id.next) {
527 part->kink_extra_steps = 4;
531 if (!DNA_struct_elem_find(fd->filesdna, "MTex", "float", "kinkampfac")) {
532 ParticleSettings *part;
533 for (part = main->particle.first; part; part = part->id.next) {
535 for (a = 0; a < MAX_MTEX; a++) {
536 MTex *mtex = part->mtex[a];
538 mtex->kinkampfac = 1.0f;
544 if (!DNA_struct_elem_find(fd->filesdna, "HookModifierData", "char", "flag")) {
547 for (ob = main->object.first; ob; ob = ob->id.next) {
549 for (md = ob->modifiers.first; md; md = md->next) {
550 if (md->type == eModifierType_Hook) {
551 HookModifierData *hmd = (HookModifierData *)md;
552 hmd->falloff_type = eHook_Falloff_InvSquare;
558 if (!DNA_struct_elem_find(fd->filesdna, "NodePlaneTrackDeformData", "char", "flag")) {
559 FOREACH_NODETREE(main, ntree, id) {
560 if (ntree->type == NTREE_COMPOSIT) {
562 for (node = ntree->nodes.first; node; node = node->next) {
563 if (ELEM(node->type, CMP_NODE_PLANETRACKDEFORM)) {
564 NodePlaneTrackDeformData *data = node->storage;
566 data->motion_blur_samples = 16;
567 data->motion_blur_shutter = 0.5f;
575 if (!DNA_struct_elem_find(fd->filesdna, "Camera", "GPUDOFSettings", "gpu_dof")) {
577 for (ca = main->camera.first; ca; ca = ca->id.next) {
578 ca->gpu_dof.fstop = 128.0f;
579 ca->gpu_dof.focal_length = 1.0f;
580 ca->gpu_dof.focus_distance = 1.0f;
581 ca->gpu_dof.sensor = 1.0f;
586 if (!MAIN_VERSION_ATLEAST(main, 273, 7)) {
592 for (scr = main->screen.first; scr; scr = scr->id.next) {
593 /* Remove old deprecated region from filebrowsers */
594 for (sa = scr->areabase.first; sa; sa = sa->next) {
595 for (sl = sa->spacedata.first; sl; sl = sl->next) {
596 if (sl->spacetype == SPACE_FILE) {
597 for (ar = sl->regionbase.first; ar; ar = ar->next) {
598 if (ar->regiontype == RGN_TYPE_CHANNELS) {
604 /* Free old deprecated 'channel' region... */
605 BKE_area_region_free(NULL, ar);
606 BLI_freelinkN(&sl->regionbase, ar);
614 if (!MAIN_VERSION_ATLEAST(main, 273, 8)) {
616 for (ob = main->object.first; ob != NULL; ob = ob->id.next) {
618 for (md = ob->modifiers.last; md != NULL; md = md->prev) {
619 if (modifier_unique_name(&ob->modifiers, md)) {
620 printf("Warning: Object '%s' had several modifiers with the "
621 "same name, renamed one of them to '%s'.\n",
622 ob->id.name + 2, md->name);
628 if (!MAIN_VERSION_ATLEAST(main, 273, 9)) {
634 /* Make sure sequencer preview area limits zoom */
635 for (scr = main->screen.first; scr; scr = scr->id.next) {
636 for (sa = scr->areabase.first; sa; sa = sa->next) {
637 for (sl = sa->spacedata.first; sl; sl = sl->next) {
638 if (sl->spacetype == SPACE_SEQ) {
639 for (ar = sl->regionbase.first; ar; ar = ar->next) {
640 if (ar->regiontype == RGN_TYPE_PREVIEW) {
641 ar->v2d.keepzoom |= V2D_LIMITZOOM;
642 ar->v2d.minzoom = 0.001f;
643 ar->v2d.maxzoom = 1000.0f;
653 if (!MAIN_VERSION_ATLEAST(main, 274, 1)) {
654 /* particle systems need to be forced to redistribute for jitter mode fix */
657 ParticleSystem *psys;
658 for (ob = main->object.first; ob; ob = ob->id.next) {
659 for (psys = ob->particlesystem.first; psys; psys = psys->next) {
660 psys->recalc |= PSYS_RECALC_RESET;
665 /* hysteresis setted to 10% but not actived */
666 if (!DNA_struct_elem_find(fd->filesdna, "LodLevel", "int", "obhysteresis")) {
668 for (ob = main->object.first; ob; ob = ob->id.next) {
670 for (level = ob->lodlevels.first; level; level = level->next) {
671 level->obhysteresis = 10;
676 if (!DNA_struct_elem_find(fd->filesdna, "GameData", "int", "scehysteresis")) {
678 for (scene = main->scene.first; scene; scene = scene->id.next) {
679 scene->gm.scehysteresis = 10;
684 if (!MAIN_VERSION_ATLEAST(main, 274, 2)) {
685 FOREACH_NODETREE(main, ntree, id) {
689 for (node = ntree->nodes.first; node; node = node->next) {
690 if (node->type == SH_NODE_MATERIAL) {
691 for (sock = node->inputs.first; sock; sock = sock->next) {
692 if (STREQ(sock->name, "Refl")) {
693 BLI_strncpy(sock->name, "DiffuseIntensity", sizeof(sock->name));
697 else if (node->type == SH_NODE_MATERIAL_EXT) {
698 for (sock = node->outputs.first; sock; sock = sock->next) {
699 if (STREQ(sock->name, "Refl")) {
700 BLI_strncpy(sock->name, "DiffuseIntensity", sizeof(sock->name));
702 else if (STREQ(sock->name, "Ray Mirror")) {
703 BLI_strncpy(sock->name, "Reflectivity", sizeof(sock->name));
708 } FOREACH_NODETREE_END
711 if (!DNA_struct_elem_find(fd->filesdna, "Sequence", "char", "storage")) {
715 #define SEQ_USE_PROXY_CUSTOM_DIR (1 << 19)
716 #define SEQ_USE_PROXY_CUSTOM_FILE (1 << 21)
718 for (scene = main->scene.first; scene; scene = scene->id.next) {
719 SEQ_BEGIN (scene->ed, seq) {
720 if (seq->strip && seq->strip->proxy) {
721 if (seq->flag & SEQ_USE_PROXY_CUSTOM_DIR)
722 seq->strip->proxy->storage = SEQ_STORAGE_PROXY_CUSTOM_DIR;
723 if (seq->flag & SEQ_USE_PROXY_CUSTOM_FILE)
724 seq->strip->proxy->storage = SEQ_STORAGE_PROXY_CUSTOM_FILE;
729 #undef SEQ_USE_PROXY_CUSTOM_DIR
730 #undef SEQ_USE_PROXY_CUSTOM_FILE
733 if (!MAIN_VERSION_ATLEAST(main, 274, 4)) {
734 SceneRenderView *srv;
742 for (scene = main->scene.first; scene; scene = scene->id.next) {
745 BKE_scene_add_render_view(scene, STEREO_LEFT_NAME);
746 srv = scene->r.views.first;
747 BLI_strncpy(srv->suffix, STEREO_LEFT_SUFFIX, sizeof(srv->suffix));
749 BKE_scene_add_render_view(scene, STEREO_RIGHT_NAME);
750 srv = scene->r.views.last;
751 BLI_strncpy(srv->suffix, STEREO_RIGHT_SUFFIX, sizeof(srv->suffix));
753 SEQ_BEGIN (scene->ed, seq)
755 seq->stereo3d_format = MEM_callocN(sizeof(Stereo3dFormat), "Stereo Display 3d Format");
760 for (screen = main->screen.first; screen; screen = screen->id.next) {
762 for (sa = screen->areabase.first; sa; sa = sa->next) {
765 for (sl = sa->spacedata.first; sl; sl = sl->next) {
766 switch (sl->spacetype) {
769 View3D *v3d = (View3D *)sl;
770 v3d->stereo3d_camera = STEREO_3D_ID;
771 v3d->stereo3d_flag |= V3D_S3D_DISPPLANE;
772 v3d->stereo3d_convergence_alpha = 0.15f;
773 v3d->stereo3d_volume_alpha = 0.05f;
778 SpaceImage *sima = (SpaceImage *) sl;
779 sima->iuser.flag |= IMA_SHOW_STEREO;
780 sima->iuser.passtype = SCE_PASS_COMBINED;
788 for (cam = main->camera.first; cam; cam = cam->id.next) {
789 cam->stereo.interocular_distance = 0.065;
790 cam->stereo.convergence_distance = 30.f * 0.065;
793 for (ima = main->image.first; ima; ima = ima->id.next) {
794 ima->stereo3d_format = MEM_callocN(sizeof(Stereo3dFormat), "Image Stereo 3d Format");
796 if (ima->packedfile) {
797 ImagePackedFile *imapf = MEM_mallocN(sizeof(ImagePackedFile), "Image Packed File");
798 BLI_addtail(&ima->packedfiles, imapf);
800 imapf->packedfile = ima->packedfile;
801 BLI_strncpy(imapf->filepath, ima->name, FILE_MAX);
802 ima->packedfile = NULL;
806 for (wm = main->wm.first; wm; wm = wm->id.next) {
807 for (win = wm->windows.first; win; win = win->next) {
808 win->stereo3d_format = MEM_callocN(sizeof(Stereo3dFormat), "Stereo Display 3d Format");