Action Editor: Initial support for a Properties Region
[blender-staging.git] / source / blender / blenloader / intern / versioning_270.c
1 /*
2  * ***** BEGIN GPL LICENSE BLOCK *****
3  *
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.
8  *
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.
13  *
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.
17  *
18  * Contributor(s): Blender Foundation
19  *
20  * ***** END GPL LICENSE BLOCK *****
21  *
22  */
23
24 /** \file blender/blenloader/intern/versioning_270.c
25  *  \ingroup blenloader
26  */
27
28 #include "BLI_utildefines.h"
29 #include "BLI_compiler_attrs.h"
30
31 /* for MinGW32 definition of NULL, could use BLI_blenlib.h instead too */
32 #include <stddef.h>
33
34 /* allow readfile to use deprecated functionality */
35 #define DNA_DEPRECATED_ALLOW
36
37 #include "DNA_brush_types.h"
38 #include "DNA_camera_types.h"
39 #include "DNA_cloth_types.h"
40 #include "DNA_constraint_types.h"
41 #include "DNA_gpencil_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_force.h"
47 #include "DNA_object_types.h"
48 #include "DNA_mesh_types.h"
49 #include "DNA_modifier_types.h"
50 #include "DNA_particle_types.h"
51 #include "DNA_linestyle_types.h"
52 #include "DNA_actuator_types.h"
53 #include "DNA_view3d_types.h"
54
55 #include "DNA_genfile.h"
56
57 #include "BKE_colortools.h"
58 #include "BKE_library.h"
59 #include "BKE_main.h"
60 #include "BKE_modifier.h"
61 #include "BKE_node.h"
62 #include "BKE_scene.h"
63 #include "BKE_sequencer.h"
64 #include "BKE_screen.h"
65
66 #include "BLI_math.h"
67 #include "BLI_listbase.h"
68 #include "BLI_string.h"
69
70 #include "BLO_readfile.h"
71
72 #include "readfile.h"
73
74 #include "MEM_guardedalloc.h"
75
76 static void do_version_constraints_radians_degrees_270_1(ListBase *lb)
77 {
78         bConstraint *con;
79
80         for (con = lb->first; con; con = con->next) {
81                 if (con->type == CONSTRAINT_TYPE_TRANSFORM) {
82                         bTransformConstraint *data = (bTransformConstraint *)con->data;
83                         const float deg_to_rad_f = DEG2RADF(1.0f);
84
85                         if (data->from == TRANS_ROTATION) {
86                                 mul_v3_fl(data->from_min, deg_to_rad_f);
87                                 mul_v3_fl(data->from_max, deg_to_rad_f);
88                         }
89
90                         if (data->to == TRANS_ROTATION) {
91                                 mul_v3_fl(data->to_min, deg_to_rad_f);
92                                 mul_v3_fl(data->to_max, deg_to_rad_f);
93                         }
94                 }
95         }
96 }
97
98 static void do_version_constraints_radians_degrees_270_5(ListBase *lb)
99 {
100         bConstraint *con;
101
102         for (con = lb->first; con; con = con->next) {
103                 if (con->type == CONSTRAINT_TYPE_TRANSFORM) {
104                         bTransformConstraint *data = (bTransformConstraint *)con->data;
105
106                         if (data->from == TRANS_ROTATION) {
107                                 copy_v3_v3(data->from_min_rot, data->from_min);
108                                 copy_v3_v3(data->from_max_rot, data->from_max);
109                         }
110                         else if (data->from == TRANS_SCALE) {
111                                 copy_v3_v3(data->from_min_scale, data->from_min);
112                                 copy_v3_v3(data->from_max_scale, data->from_max);
113                         }
114
115                         if (data->to == TRANS_ROTATION) {
116                                 copy_v3_v3(data->to_min_rot, data->to_min);
117                                 copy_v3_v3(data->to_max_rot, data->to_max);
118                         }
119                         else if (data->to == TRANS_SCALE) {
120                                 copy_v3_v3(data->to_min_scale, data->to_min);
121                                 copy_v3_v3(data->to_max_scale, data->to_max);
122                         }
123                 }
124         }
125 }
126
127 static void do_version_constraints_stretch_to_limits(ListBase *lb)
128 {
129         bConstraint *con;
130
131         for (con = lb->first; con; con = con->next) {
132                 if (con->type == CONSTRAINT_TYPE_STRETCHTO) {
133                         bStretchToConstraint *data = (bStretchToConstraint *)con->data;
134                         data->bulge_min = 1.0f;
135                         data->bulge_max = 1.0f;
136                 }
137         }
138 }
139
140 static void do_version_action_editor_properties_region(ListBase *regionbase)
141 {
142         ARegion *ar;
143         
144         for (ar = regionbase->first; ar; ar = ar->next) {
145                 if (ar->regiontype == RGN_TYPE_UI) {
146                         /* already exists */
147                         return;
148                 }
149                 else if (ar->regiontype == RGN_TYPE_WINDOW) {
150                         /* add new region here */
151                         ARegion *arnew = MEM_callocN(sizeof(ARegion), "buttons for action");
152                         
153                         BLI_insertlinkbefore(regionbase, ar, arnew);
154                         
155                         arnew->regiontype = RGN_TYPE_UI;
156                         arnew->alignment = RGN_ALIGN_RIGHT;
157                         arnew->flag = RGN_FLAG_HIDDEN;
158                         
159                         return;
160                 }
161         }
162 }
163
164 void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *main)
165 {
166         if (!MAIN_VERSION_ATLEAST(main, 270, 0)) {
167
168                 if (!DNA_struct_elem_find(fd->filesdna, "BevelModifierData", "float", "profile")) {
169                         Object *ob;
170
171                         for (ob = main->object.first; ob; ob = ob->id.next) {
172                                 ModifierData *md;
173                                 for (md = ob->modifiers.first; md; md = md->next) {
174                                         if (md->type == eModifierType_Bevel) {
175                                                 BevelModifierData *bmd = (BevelModifierData *)md;
176                                                 bmd->profile = 0.5f;
177                                                 bmd->val_flags = MOD_BEVEL_AMT_OFFSET;
178                                         }
179                                 }
180                         }
181                 }
182
183                 /* nodes don't use fixed node->id any more, clean up */
184                 FOREACH_NODETREE(main, ntree, id) {
185                         if (ntree->type == NTREE_COMPOSIT) {
186                                 bNode *node;
187                                 for (node = ntree->nodes.first; node; node = node->next) {
188                                         if (ELEM(node->type, CMP_NODE_COMPOSITE, CMP_NODE_OUTPUT_FILE)) {
189                                                 node->id = NULL;
190                                         }
191                                 }
192                         }
193                 } FOREACH_NODETREE_END
194
195                 {
196                         bScreen *screen;
197
198                         for (screen = main->screen.first; screen; screen = screen->id.next) {
199                                 ScrArea *area;
200                                 for (area = screen->areabase.first; area; area = area->next) {
201                                         SpaceLink *space_link;
202                                         for (space_link = area->spacedata.first; space_link; space_link = space_link->next) {
203                                                 if (space_link->spacetype == SPACE_CLIP) {
204                                                         SpaceClip *space_clip = (SpaceClip *) space_link;
205                                                         if (space_clip->mode != SC_MODE_MASKEDIT) {
206                                                                 space_clip->mode = SC_MODE_TRACKING;
207                                                         }
208                                                 }
209                                         }
210                                 }
211                         }
212                 }
213
214                 if (!DNA_struct_elem_find(fd->filesdna, "MovieTrackingSettings", "float", "default_weight")) {
215                         MovieClip *clip;
216                         for (clip = main->movieclip.first; clip; clip = clip->id.next) {
217                                 clip->tracking.settings.default_weight = 1.0f;
218                         }
219                 }
220         }
221
222         if (!MAIN_VERSION_ATLEAST(main, 270, 1)) {
223                 Scene *sce;
224                 Object *ob;
225
226                 /* Update Transform constraint (another deg -> rad stuff). */
227                 for (ob = main->object.first; ob; ob = ob->id.next) {
228                         do_version_constraints_radians_degrees_270_1(&ob->constraints);
229
230                         if (ob->pose) {
231                                 /* Bones constraints! */
232                                 bPoseChannel *pchan;
233                                 for (pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next) {
234                                         do_version_constraints_radians_degrees_270_1(&pchan->constraints);
235                                 }
236                         }
237                 }
238
239                 for (sce = main->scene.first; sce; sce = sce->id.next) {
240                         if (sce->r.raytrace_structure == R_RAYSTRUCTURE_BLIBVH) {
241                                 sce->r.raytrace_structure = R_RAYSTRUCTURE_AUTO;
242                         }
243                 }
244         }
245
246         if (!MAIN_VERSION_ATLEAST(main, 270, 2)) {
247                 Mesh *me;
248
249                 /* Mesh smoothresh deg->rad. */
250                 for (me = main->mesh.first; me; me = me->id.next) {
251                         me->smoothresh = DEG2RADF(me->smoothresh);
252                 }
253         }
254
255         if (!MAIN_VERSION_ATLEAST(main, 270, 3)) {
256                 FreestyleLineStyle *linestyle;
257
258                 for (linestyle = main->linestyle.first; linestyle; linestyle = linestyle->id.next) {
259                         linestyle->flag |= LS_NO_SORTING;
260                         linestyle->sort_key = LS_SORT_KEY_DISTANCE_FROM_CAMERA;
261                         linestyle->integration_type = LS_INTEGRATION_MEAN;
262                 }
263         }
264
265         if (!MAIN_VERSION_ATLEAST(main, 270, 4)) {
266                 /* ui_previews were not handled correctly when copying areas, leading to corrupted files (see T39847).
267                  * This will always reset situation to a valid state.
268                  */
269                 bScreen *sc;
270
271                 for (sc = main->screen.first; sc; sc = sc->id.next) {
272                         ScrArea *sa;
273                         for (sa = sc->areabase.first; sa; sa = sa->next) {
274                                 SpaceLink *sl;
275
276                                 for (sl = sa->spacedata.first; sl; sl = sl->next) {
277                                         ARegion *ar;
278                                         ListBase *lb = (sl == sa->spacedata.first) ? &sa->regionbase : &sl->regionbase;
279
280                                         for (ar = lb->first; ar; ar = ar->next) {
281                                                 BLI_listbase_clear(&ar->ui_previews);
282                                         }
283                                 }
284                         }
285                 }
286         }
287
288         if (!MAIN_VERSION_ATLEAST(main, 270, 5)) {
289                 Object *ob;
290
291                 /* Update Transform constraint (again :|). */
292                 for (ob = main->object.first; ob; ob = ob->id.next) {
293                         do_version_constraints_radians_degrees_270_5(&ob->constraints);
294
295                         if (ob->pose) {
296                                 /* Bones constraints! */
297                                 bPoseChannel *pchan;
298                                 for (pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next) {
299                                         do_version_constraints_radians_degrees_270_5(&pchan->constraints);
300                                 }
301                         }
302                 }
303         }
304
305         if (!MAIN_VERSION_ATLEAST(main, 271, 0)) {
306                 if (!DNA_struct_elem_find(fd->filesdna, "Material", "int", "mode2")) {
307                         Material *ma;
308
309                         for (ma = main->mat.first; ma; ma = ma->id.next)
310                                 ma->mode2 = MA_CASTSHADOW;
311                 }
312
313                 if (!DNA_struct_elem_find(fd->filesdna, "RenderData", "BakeData", "bake")) {
314                         Scene *sce;
315
316                         for (sce = main->scene.first; sce; sce = sce->id.next) {
317                                 sce->r.bake.flag = R_BAKE_CLEAR;
318                                 sce->r.bake.width = 512;
319                                 sce->r.bake.height = 512;
320                                 sce->r.bake.margin = 16;
321                                 sce->r.bake.normal_space = R_BAKE_SPACE_TANGENT;
322                                 sce->r.bake.normal_swizzle[0] = R_BAKE_POSX;
323                                 sce->r.bake.normal_swizzle[1] = R_BAKE_POSY;
324                                 sce->r.bake.normal_swizzle[2] = R_BAKE_POSZ;
325                                 BLI_strncpy(sce->r.bake.filepath, U.renderdir, sizeof(sce->r.bake.filepath));
326
327                                 sce->r.bake.im_format.planes = R_IMF_PLANES_RGBA;
328                                 sce->r.bake.im_format.imtype = R_IMF_IMTYPE_PNG;
329                                 sce->r.bake.im_format.depth = R_IMF_CHAN_DEPTH_8;
330                                 sce->r.bake.im_format.quality = 90;
331                                 sce->r.bake.im_format.compress = 15;
332                         }
333                 }
334
335                 if (!DNA_struct_elem_find(fd->filesdna, "FreestyleLineStyle", "float", "texstep")) {
336                         FreestyleLineStyle *linestyle;
337
338                         for (linestyle = main->linestyle.first; linestyle; linestyle = linestyle->id.next) {
339                                 linestyle->flag |= LS_TEXTURE;
340                                 linestyle->texstep = 1.0;
341                         }
342                 }
343
344                 {
345                         Scene *scene;
346                         for (scene = main->scene.first; scene; scene = scene->id.next) {
347                                 int num_layers = BLI_listbase_count(&scene->r.layers);
348                                 scene->r.actlay = min_ff(scene->r.actlay, num_layers - 1);
349                         }
350                 }
351         }
352
353         if (!MAIN_VERSION_ATLEAST(main, 271, 1)) {
354                 if (!DNA_struct_elem_find(fd->filesdna, "Material", "float", "line_col[4]")) {
355                         Material *mat;
356
357                         for (mat = main->mat.first; mat; mat = mat->id.next) {
358                                 mat->line_col[0] = mat->line_col[1] = mat->line_col[2] = 0.0f;
359                                 mat->line_col[3] = mat->alpha;
360                         }
361                 }
362
363                 if (!DNA_struct_elem_find(fd->filesdna, "RenderData", "int", "preview_start_resolution")) {
364                         Scene *scene;
365                         for (scene = main->scene.first; scene; scene = scene->id.next) {
366                                 scene->r.preview_start_resolution = 64;
367                         }
368                 }
369         }
370
371         if (!MAIN_VERSION_ATLEAST(main, 271, 2)) {
372                 /* init up & track axis property of trackto actuators */
373                 Object *ob;
374
375                 for (ob = main->object.first; ob; ob = ob->id.next) {
376                         bActuator *act;
377                         for (act = ob->actuators.first; act; act = act->next) {
378                                 if (act->type == ACT_EDIT_OBJECT) {
379                                         bEditObjectActuator *eoact = act->data;
380                                         eoact->trackflag = ob->trackflag;
381                                         /* if trackflag is pointing +-Z axis then upflag should point Y axis.
382                                          * Rest of trackflag cases, upflag should be point z axis */
383                                         if ((ob->trackflag == OB_POSZ) || (ob->trackflag == OB_NEGZ)) {
384                                                 eoact->upflag = 1;
385                                         }
386                                         else {
387                                                 eoact->upflag = 2;
388                                         }
389                                 }
390                         }
391                 }
392         }
393
394         if (!MAIN_VERSION_ATLEAST(main, 271, 3)) {
395                 Brush *br;
396
397                 for (br = main->brush.first; br; br = br->id.next) {
398                         br->fill_threshold = 0.2f;
399                 }
400
401                 if (!DNA_struct_elem_find(fd->filesdna, "BevelModifierData", "int", "mat")) {
402                         Object *ob;
403                         for (ob = main->object.first; ob; ob = ob->id.next) {
404                                 ModifierData *md;
405
406                                 for (md = ob->modifiers.first; md; md = md->next) {
407                                         if (md->type == eModifierType_Bevel) {
408                                                 BevelModifierData *bmd = (BevelModifierData *)md;
409                                                 bmd->mat = -1;
410                                         }
411                                 }
412                         }
413                 }
414         }
415
416         if (!MAIN_VERSION_ATLEAST(main, 271, 6)) {
417                 Object *ob;
418                 for (ob = main->object.first; ob; ob = ob->id.next) {
419                         ModifierData *md;
420
421                         for (md = ob->modifiers.first; md; md = md->next) {
422                                 if (md->type == eModifierType_ParticleSystem) {
423                                         ParticleSystemModifierData *pmd = (ParticleSystemModifierData *)md;
424                                         if (pmd->psys && pmd->psys->clmd) {
425                                                 pmd->psys->clmd->sim_parms->vel_damping = 1.0f;
426                                         }
427                                 }
428                         }
429                 }
430         }
431
432         if (!MAIN_VERSION_ATLEAST(main, 272, 0)) {
433                 if (!DNA_struct_elem_find(fd->filesdna, "RenderData", "int", "preview_start_resolution")) {
434                         Scene *scene;
435                         for (scene = main->scene.first; scene; scene = scene->id.next) {
436                                 scene->r.preview_start_resolution = 64;
437                         }
438                 }
439         }
440
441         if (!MAIN_VERSION_ATLEAST(main, 272, 1)) {
442                 Brush *br;
443                 for (br = main->brush.first; br; br = br->id.next) {
444                         if ((br->ob_mode & OB_MODE_SCULPT) && ELEM(br->sculpt_tool, SCULPT_TOOL_GRAB, SCULPT_TOOL_SNAKE_HOOK))
445                                 br->alpha = 1.0f;
446                 }
447         }
448
449         if (!MAIN_VERSION_ATLEAST(main, 272, 2)) {
450                 if (!DNA_struct_elem_find(fd->filesdna, "Image", "float", "gen_color")) {
451                         Image *image;
452                         for (image = main->image.first; image != NULL; image = image->id.next) {
453                                 image->gen_color[3] = 1.0f;
454                         }
455                 }
456
457                 if (!DNA_struct_elem_find(fd->filesdna, "bStretchToConstraint", "float", "bulge_min")) {
458                         Object *ob;
459
460                         /* Update Transform constraint (again :|). */
461                         for (ob = main->object.first; ob; ob = ob->id.next) {
462                                 do_version_constraints_stretch_to_limits(&ob->constraints);
463
464                                 if (ob->pose) {
465                                         /* Bones constraints! */
466                                         bPoseChannel *pchan;
467                                         for (pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next) {
468                                                 do_version_constraints_stretch_to_limits(&pchan->constraints);
469                                         }
470                                 }
471                         }
472                 }
473         }
474
475         if (!MAIN_VERSION_ATLEAST(main, 273, 1)) {
476 #define BRUSH_RAKE (1 << 7)
477 #define BRUSH_RANDOM_ROTATION (1 << 25)
478
479                 Brush *br;
480
481                 for (br = main->brush.first; br; br = br->id.next) {
482                         if (br->flag & BRUSH_RAKE) {
483                                 br->mtex.brush_angle_mode |= MTEX_ANGLE_RAKE;
484                                 br->mask_mtex.brush_angle_mode |= MTEX_ANGLE_RAKE;
485                         }
486                         else if (br->flag & BRUSH_RANDOM_ROTATION) {
487                                 br->mtex.brush_angle_mode |= MTEX_ANGLE_RANDOM;
488                                 br->mask_mtex.brush_angle_mode |= MTEX_ANGLE_RANDOM;
489                         }
490                         br->mtex.random_angle = 2.0 * M_PI;
491                         br->mask_mtex.random_angle = 2.0 * M_PI;
492                 }
493         }
494
495 #undef BRUSH_RAKE
496 #undef BRUSH_RANDOM_ROTATION
497
498         /* Customizable Safe Areas */
499         if (!MAIN_VERSION_ATLEAST(main, 273, 2)) {
500                 if (!DNA_struct_elem_find(fd->filesdna, "Scene", "DisplaySafeAreas", "safe_areas")) {
501                         Scene *scene;
502
503                         for (scene = main->scene.first; scene; scene = scene->id.next) {
504                                 copy_v2_fl2(scene->safe_areas.title, 3.5f / 100.0f, 3.5f / 100.0f);
505                                 copy_v2_fl2(scene->safe_areas.action, 10.0f / 100.0f, 5.0f / 100.0f);
506                                 copy_v2_fl2(scene->safe_areas.title_center, 17.5f / 100.0f, 5.0f / 100.0f);
507                                 copy_v2_fl2(scene->safe_areas.action_center, 15.0f / 100.0f, 5.0f / 100.0f);
508                         }
509                 }
510         }
511         
512         if (!MAIN_VERSION_ATLEAST(main, 273, 3)) {
513                 ParticleSettings *part;
514                 for (part = main->particle.first; part; part = part->id.next) {
515                         if (part->clumpcurve)
516                                 part->child_flag |= PART_CHILD_USE_CLUMP_CURVE;
517                         if (part->roughcurve)
518                                 part->child_flag |= PART_CHILD_USE_ROUGH_CURVE;
519                 }
520         }
521
522         if (!MAIN_VERSION_ATLEAST(main, 273, 6)) {
523                 if (!DNA_struct_elem_find(fd->filesdna, "ClothSimSettings", "float", "bending_damping")) {
524                         Object *ob;
525                         ModifierData *md;
526                         for (ob = main->object.first; ob; ob = ob->id.next) {
527                                 for (md = ob->modifiers.first; md; md = md->next) {
528                                         if (md->type == eModifierType_Cloth) {
529                                                 ClothModifierData *clmd = (ClothModifierData *)md;
530                                                 clmd->sim_parms->bending_damping = 0.5f;
531                                         }
532                                         else if (md->type == eModifierType_ParticleSystem) {
533                                                 ParticleSystemModifierData *pmd = (ParticleSystemModifierData *)md;
534                                                 if (pmd->psys->clmd) {
535                                                         pmd->psys->clmd->sim_parms->bending_damping = 0.5f;
536                                                 }
537                                         }
538                                 }
539                         }
540                 }
541
542                 if (!DNA_struct_elem_find(fd->filesdna, "ParticleSettings", "float", "clump_noise_size")) {
543                         ParticleSettings *part;
544                         for (part = main->particle.first; part; part = part->id.next) {
545                                 part->clump_noise_size = 1.0f;
546                         }
547                 }
548
549                 if (!DNA_struct_elem_find(fd->filesdna, "ParticleSettings", "int", "kink_extra_steps")) {
550                         ParticleSettings *part;
551                         for (part = main->particle.first; part; part = part->id.next) {
552                                 part->kink_extra_steps = 4;
553                         }
554                 }
555
556                 if (!DNA_struct_elem_find(fd->filesdna, "MTex", "float", "kinkampfac")) {
557                         ParticleSettings *part;
558                         for (part = main->particle.first; part; part = part->id.next) {
559                                 int a;
560                                 for (a = 0; a < MAX_MTEX; a++) {
561                                         MTex *mtex = part->mtex[a];
562                                         if (mtex) {
563                                                 mtex->kinkampfac = 1.0f;
564                                         }
565                                 }
566                         }
567                 }
568
569                 if (!DNA_struct_elem_find(fd->filesdna, "HookModifierData", "char", "flag")) {
570                         Object *ob;
571
572                         for (ob = main->object.first; ob; ob = ob->id.next) {
573                                 ModifierData *md;
574                                 for (md = ob->modifiers.first; md; md = md->next) {
575                                         if (md->type == eModifierType_Hook) {
576                                                 HookModifierData *hmd = (HookModifierData *)md;
577                                                 hmd->falloff_type = eHook_Falloff_InvSquare;
578                                         }
579                                 }
580                         }
581                 }
582
583                 if (!DNA_struct_elem_find(fd->filesdna, "NodePlaneTrackDeformData", "char", "flag")) {
584                         FOREACH_NODETREE(main, ntree, id) {
585                                 if (ntree->type == NTREE_COMPOSIT) {
586                                         bNode *node;
587                                         for (node = ntree->nodes.first; node; node = node->next) {
588                                                 if (ELEM(node->type, CMP_NODE_PLANETRACKDEFORM)) {
589                                                         NodePlaneTrackDeformData *data = node->storage;
590                                                         data->flag = 0;
591                                                         data->motion_blur_samples = 16;
592                                                         data->motion_blur_shutter = 0.5f;
593                                                 }
594                                         }
595                                 }
596                         }
597                         FOREACH_NODETREE_END
598                 }
599
600                 if (!DNA_struct_elem_find(fd->filesdna, "Camera", "GPUDOFSettings", "gpu_dof")) {
601                         Camera *ca;
602                         for (ca = main->camera.first; ca; ca = ca->id.next) {
603                                 ca->gpu_dof.fstop = 128.0f;
604                                 ca->gpu_dof.focal_length = 1.0f;
605                                 ca->gpu_dof.focus_distance = 1.0f;
606                                 ca->gpu_dof.sensor = 1.0f;
607                         }
608                 }
609         }
610
611         if (!MAIN_VERSION_ATLEAST(main, 273, 8)) {
612                 Object *ob;
613                 for (ob = main->object.first; ob != NULL; ob = ob->id.next) {
614                         ModifierData *md;
615                         for (md = ob->modifiers.last; md != NULL; md = md->prev) {
616                                 if (modifier_unique_name(&ob->modifiers, md)) {
617                                         printf("Warning: Object '%s' had several modifiers with the "
618                                                "same name, renamed one of them to '%s'.\n",
619                                                ob->id.name + 2, md->name);
620                                 }
621                         }
622                 }
623         }
624
625         if (!MAIN_VERSION_ATLEAST(main, 273, 9)) {
626                 bScreen *scr;
627                 ScrArea *sa;
628                 SpaceLink *sl;
629                 ARegion *ar;
630
631                 /* Make sure sequencer preview area limits zoom */
632                 for (scr = main->screen.first; scr; scr = scr->id.next) {
633                         for (sa = scr->areabase.first; sa; sa = sa->next) {
634                                 for (sl = sa->spacedata.first; sl; sl = sl->next) {
635                                         if (sl->spacetype == SPACE_SEQ) {
636                                                 for (ar = sl->regionbase.first; ar; ar = ar->next) {
637                                                         if (ar->regiontype == RGN_TYPE_PREVIEW) {
638                                                                 ar->v2d.keepzoom |= V2D_LIMITZOOM;
639                                                                 ar->v2d.minzoom = 0.001f;
640                                                                 ar->v2d.maxzoom = 1000.0f;
641                                                                 break;
642                                                         }
643                                                 }
644                                         }
645                                 }
646                         }
647                 }
648         }
649
650         if (!MAIN_VERSION_ATLEAST(main, 274, 1)) {
651                 /* particle systems need to be forced to redistribute for jitter mode fix */
652                 {
653                         Object *ob;
654                         ParticleSystem *psys;
655                         for (ob = main->object.first; ob; ob = ob->id.next) {
656                                 for (psys = ob->particlesystem.first; psys; psys = psys->next) {
657                                         if ((psys->pointcache->flag & PTCACHE_BAKED) == 0) {
658                                                 psys->recalc |= PSYS_RECALC_RESET;
659                                         }
660                                 }
661                         }
662                 }
663
664                 /* hysteresis setted to 10% but not actived */
665                 if (!DNA_struct_elem_find(fd->filesdna, "LodLevel", "int", "obhysteresis")) {
666                         Object *ob;
667                         for (ob = main->object.first; ob; ob = ob->id.next) {
668                                 LodLevel *level;
669                                 for (level = ob->lodlevels.first; level; level = level->next) {
670                                         level->obhysteresis = 10;
671                                 }
672                         }
673                 }
674
675                 if (!DNA_struct_elem_find(fd->filesdna, "GameData", "int", "scehysteresis")) {
676                         Scene *scene;
677                         for (scene = main->scene.first; scene; scene = scene->id.next) {
678                                 scene->gm.scehysteresis = 10;
679                         }
680                 }
681         }
682
683         if (!MAIN_VERSION_ATLEAST(main, 274, 2)) {
684                 FOREACH_NODETREE(main, ntree, id) {
685                         bNode *node;
686                         bNodeSocket *sock;
687
688                         for (node = ntree->nodes.first; node; node = node->next) {
689                                 if (node->type == SH_NODE_MATERIAL) {
690                                         for (sock = node->inputs.first; sock; sock = sock->next) {
691                                                 if (STREQ(sock->name, "Refl")) {
692                                                         BLI_strncpy(sock->name, "DiffuseIntensity", sizeof(sock->name));
693                                                 }
694                                         }
695                                 }
696                                 else if (node->type == SH_NODE_MATERIAL_EXT) {
697                                         for (sock = node->outputs.first; sock; sock = sock->next) {
698                                                 if (STREQ(sock->name, "Refl")) {
699                                                         BLI_strncpy(sock->name, "DiffuseIntensity", sizeof(sock->name));
700                                                 }
701                                                 else if (STREQ(sock->name, "Ray Mirror")) {
702                                                         BLI_strncpy(sock->name, "Reflectivity", sizeof(sock->name));
703                                                 }
704                                         }
705                                 }
706                         }
707                 } FOREACH_NODETREE_END
708         }
709
710         if (!MAIN_VERSION_ATLEAST(main, 274, 4)) {
711                 SceneRenderView *srv;
712                 wmWindowManager *wm;
713                 bScreen *screen;
714                 wmWindow *win;
715                 Scene *scene;
716                 Camera *cam;
717                 Image *ima;
718
719                 for (scene = main->scene.first; scene; scene = scene->id.next) {
720                         Sequence *seq;
721
722                         BKE_scene_add_render_view(scene, STEREO_LEFT_NAME);
723                         srv = scene->r.views.first;
724                         BLI_strncpy(srv->suffix, STEREO_LEFT_SUFFIX, sizeof(srv->suffix));
725
726                         BKE_scene_add_render_view(scene, STEREO_RIGHT_NAME);
727                         srv = scene->r.views.last;
728                         BLI_strncpy(srv->suffix, STEREO_RIGHT_SUFFIX, sizeof(srv->suffix));
729
730                         SEQ_BEGIN (scene->ed, seq)
731                         {
732                                 seq->stereo3d_format = MEM_callocN(sizeof(Stereo3dFormat), "Stereo Display 3d Format");
733
734 #define SEQ_USE_PROXY_CUSTOM_DIR (1 << 19)
735 #define SEQ_USE_PROXY_CUSTOM_FILE (1 << 21)
736                                 if (seq->strip && seq->strip->proxy && !seq->strip->proxy->storage) {
737                                         if (seq->flag & SEQ_USE_PROXY_CUSTOM_DIR)
738                                                 seq->strip->proxy->storage = SEQ_STORAGE_PROXY_CUSTOM_DIR;
739                                         if (seq->flag & SEQ_USE_PROXY_CUSTOM_FILE)
740                                                 seq->strip->proxy->storage = SEQ_STORAGE_PROXY_CUSTOM_FILE;
741                                 }
742 #undef SEQ_USE_PROXY_CUSTOM_DIR
743 #undef SEQ_USE_PROXY_CUSTOM_FILE
744
745                         }
746                         SEQ_END
747                 }
748
749                 for (screen = main->screen.first; screen; screen = screen->id.next) {
750                         ScrArea *sa;
751                         for (sa = screen->areabase.first; sa; sa = sa->next) {
752                                 SpaceLink *sl;
753
754                                 for (sl = sa->spacedata.first; sl; sl = sl->next) {
755                                         switch (sl->spacetype) {
756                                                 case SPACE_VIEW3D:
757                                                 {
758                                                         View3D *v3d = (View3D *)sl;
759                                                         v3d->stereo3d_camera = STEREO_3D_ID;
760                                                         v3d->stereo3d_flag |= V3D_S3D_DISPPLANE;
761                                                         v3d->stereo3d_convergence_alpha = 0.15f;
762                                                         v3d->stereo3d_volume_alpha = 0.05f;
763                                                         break;
764                                                 }
765                                                 case SPACE_IMAGE:
766                                                 {
767                                                         SpaceImage *sima = (SpaceImage *) sl;
768                                                         sima->iuser.flag |= IMA_SHOW_STEREO;
769                                                         break;
770                                                 }
771                                         }
772                                 }
773                         }
774                 }
775
776                 for (cam = main->camera.first; cam; cam = cam->id.next) {
777                         cam->stereo.interocular_distance = 0.065f;
778                         cam->stereo.convergence_distance = 30.0f * 0.065f;
779                 }
780
781                 for (ima = main->image.first; ima; ima = ima->id.next) {
782                         ima->stereo3d_format = MEM_callocN(sizeof(Stereo3dFormat), "Image Stereo 3d Format");
783
784                         if (ima->packedfile) {
785                                 ImagePackedFile *imapf = MEM_mallocN(sizeof(ImagePackedFile), "Image Packed File");
786                                 BLI_addtail(&ima->packedfiles, imapf);
787
788                                 imapf->packedfile = ima->packedfile;
789                                 BLI_strncpy(imapf->filepath, ima->name, FILE_MAX);
790                                 ima->packedfile = NULL;
791                         }
792                 }
793
794                 for (wm = main->wm.first; wm; wm = wm->id.next) {
795                         for (win = wm->windows.first; win; win = win->next) {
796                                 win->stereo3d_format = MEM_callocN(sizeof(Stereo3dFormat), "Stereo Display 3d Format");
797                         }
798                 }
799         }
800
801         if (!MAIN_VERSION_ATLEAST(main, 274, 6)) {
802                 bScreen *screen;
803
804                 if (!DNA_struct_elem_find(fd->filesdna, "FileSelectParams", "int", "thumbnail_size")) {
805                         for (screen = main->screen.first; screen; screen = screen->id.next) {
806                                 ScrArea *sa;
807
808                                 for (sa = screen->areabase.first; sa; sa = sa->next) {
809                                         SpaceLink *sl;
810
811                                         for (sl = sa->spacedata.first; sl; sl = sl->next) {
812                                                 if (sl->spacetype == SPACE_FILE) {
813                                                         SpaceFile *sfile = (SpaceFile *)sl;
814
815                                                         if (sfile->params) {
816                                                                 sfile->params->thumbnail_size = 128;
817                                                         }
818                                                 }
819                                         }
820                                 }
821                         }
822                 }
823
824                 if (!DNA_struct_elem_find(fd->filesdna, "RenderData", "short", "simplify_subsurf_render")) {
825                         Scene *scene;
826                         for (scene = main->scene.first; scene != NULL; scene = scene->id.next) {
827                                 scene->r.simplify_subsurf_render = scene->r.simplify_subsurf;
828                                 scene->r.simplify_particles_render = scene->r.simplify_particles;
829                         }
830                 }
831
832                 if (!DNA_struct_elem_find(fd->filesdna, "DecimateModifierData", "float", "defgrp_factor")) {
833                         Object *ob;
834
835                         for (ob = main->object.first; ob; ob = ob->id.next) {
836                                 ModifierData *md;
837                                 for (md = ob->modifiers.first; md; md = md->next) {
838                                         if (md->type == eModifierType_Decimate) {
839                                                 DecimateModifierData *dmd = (DecimateModifierData *)md;
840                                                 dmd->defgrp_factor = 1.0f;
841                                         }
842                                 }
843                         }
844                 }
845         }
846
847         if (!MAIN_VERSION_ATLEAST(main, 275, 3)) {
848                 Brush *br;
849 #define BRUSH_TORUS (1 << 1)
850                 for (br = main->brush.first; br; br = br->id.next) {
851                         br->flag &= ~BRUSH_TORUS;
852                 }
853 #undef BRUSH_TORUS
854         }
855
856         if (!MAIN_VERSION_ATLEAST(main, 276, 2)) {
857                 if (!DNA_struct_elem_find(fd->filesdna, "bPoseChannel", "float", "custom_scale")) {
858                         Object *ob;
859
860                         for (ob = main->object.first; ob; ob = ob->id.next) {
861                                 if (ob->pose) {
862                                         bPoseChannel *pchan;
863                                         for (pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next) {
864                                                 pchan->custom_scale = 1.0f;
865                                         }
866                                 }
867                         }
868                 }
869
870                 {
871                         bScreen *screen;
872 #define RV3D_VIEW_PERSPORTHO     7
873                         for (screen = main->screen.first; screen; screen = screen->id.next) {
874                                 ScrArea *sa;
875                                 for (sa = screen->areabase.first; sa; sa = sa->next) {
876                                         SpaceLink *sl;
877                                         for (sl = sa->spacedata.first; sl; sl = sl->next) {
878                                                 if (sl->spacetype == SPACE_VIEW3D) {
879                                                         ARegion *ar;
880                                                         ListBase *lb = (sl == sa->spacedata.first) ? &sa->regionbase : &sl->regionbase;
881                                                         for (ar = lb->first; ar; ar = ar->next) {
882                                                                 if (ar->regiontype == RGN_TYPE_WINDOW) {
883                                                                         if (ar->regiondata) {
884                                                                                 RegionView3D *rv3d = ar->regiondata;
885                                                                                 if (rv3d->view == RV3D_VIEW_PERSPORTHO) {
886                                                                                         rv3d->view = RV3D_VIEW_USER;
887                                                                                 }
888                                                                         }
889                                                                 }
890                                                         }
891                                                         break;
892                                                 }
893                                         }
894                                 }
895                         }
896 #undef RV3D_VIEW_PERSPORTHO
897                 }
898
899                 {
900                         Lamp *lamp;
901 #define LA_YF_PHOTON    5
902                         for (lamp = main->lamp.first; lamp; lamp = lamp->id.next) {
903                                 if (lamp->type == LA_YF_PHOTON) {
904                                         lamp->type = LA_LOCAL;
905                                 }
906                         }
907 #undef LA_YF_PHOTON
908                 }
909
910                 {
911                         Object *ob;
912                         for (ob = main->object.first; ob; ob = ob->id.next) {
913                                 if (ob->body_type == OB_BODY_TYPE_CHARACTER && (ob->gameflag & OB_BOUNDS) && ob->collision_boundtype == OB_BOUND_TRIANGLE_MESH) {
914                                         ob->boundtype = ob->collision_boundtype = OB_BOUND_BOX;
915                                 }
916                         }
917                 }
918
919         }
920
921         if (!MAIN_VERSION_ATLEAST(main, 276, 3)) {
922                 if (!DNA_struct_elem_find(fd->filesdna, "RenderData", "CurveMapping", "mblur_shutter_curve")) {
923                         Scene *scene;
924                         for (scene = main->scene.first; scene != NULL; scene = scene->id.next) {
925                                 CurveMapping *curve_mapping = &scene->r.mblur_shutter_curve;
926                                 curvemapping_set_defaults(curve_mapping, 1, 0.0f, 0.0f, 1.0f, 1.0f);
927                                 curvemapping_initialize(curve_mapping);
928                                 curvemap_reset(curve_mapping->cm,
929                                                &curve_mapping->clipr,
930                                                CURVE_PRESET_MAX,
931                                                CURVEMAP_SLOPE_POS_NEG);
932                         }
933                 }
934         }
935
936         if (!MAIN_VERSION_ATLEAST(main, 276, 4)) {
937                 for (Scene *scene = main->scene.first; scene; scene = scene->id.next) {
938                         ToolSettings *ts = scene->toolsettings;
939                         
940                         if (ts->gp_sculpt.brush[0].size == 0) {
941                                 GP_BrushEdit_Settings *gset = &ts->gp_sculpt;
942                                 GP_EditBrush_Data *brush;
943                                 
944                                 brush = &gset->brush[GP_EDITBRUSH_TYPE_SMOOTH];
945                                 brush->size = 25;
946                                 brush->strength = 0.3f;
947                                 brush->flag = GP_EDITBRUSH_FLAG_USE_FALLOFF | GP_EDITBRUSH_FLAG_SMOOTH_PRESSURE;
948                                 
949                                 brush = &gset->brush[GP_EDITBRUSH_TYPE_THICKNESS];
950                                 brush->size = 25;
951                                 brush->strength = 0.5f;
952                                 brush->flag = GP_EDITBRUSH_FLAG_USE_FALLOFF;
953                                 
954                                 brush = &gset->brush[GP_EDITBRUSH_TYPE_GRAB];
955                                 brush->size = 50;
956                                 brush->strength = 0.3f;
957                                 brush->flag = GP_EDITBRUSH_FLAG_USE_FALLOFF;
958                                 
959                                 brush = &gset->brush[GP_EDITBRUSH_TYPE_PUSH];
960                                 brush->size = 25;
961                                 brush->strength = 0.3f;
962                                 brush->flag = GP_EDITBRUSH_FLAG_USE_FALLOFF;
963                                 
964                                 brush = &gset->brush[GP_EDITBRUSH_TYPE_TWIST];
965                                 brush->size = 50;
966                                 brush->strength = 0.3f; // XXX?
967                                 brush->flag = GP_EDITBRUSH_FLAG_USE_FALLOFF;
968                                 
969                                 brush = &gset->brush[GP_EDITBRUSH_TYPE_PINCH];
970                                 brush->size = 50;
971                                 brush->strength = 0.5f; // XXX?
972                                 brush->flag = GP_EDITBRUSH_FLAG_USE_FALLOFF;
973                                 
974                                 brush = &gset->brush[GP_EDITBRUSH_TYPE_RANDOMIZE];
975                                 brush->size = 25;
976                                 brush->strength = 0.5f;
977                                 brush->flag = GP_EDITBRUSH_FLAG_USE_FALLOFF;
978                                 
979                                 brush = &gset->brush[GP_EDITBRUSH_TYPE_CLONE];
980                                 brush->size = 50;
981                                 brush->strength = 1.0f;
982                         }
983                         
984                         if (!DNA_struct_elem_find(fd->filesdna, "ToolSettings", "char", "gpencil_v3d_align")) {
985 #if 0 /* XXX: Cannot do this, as we get random crashes... */
986                                 if (scene->gpd) {
987                                         bGPdata *gpd = scene->gpd;
988                                         
989                                         /* Copy over the settings stored in the GP datablock linked to the scene, for minimal disruption */
990                                         ts->gpencil_v3d_align = 0;
991                                         
992                                         if (gpd->flag & GP_DATA_VIEWALIGN)    ts->gpencil_v3d_align |= GP_PROJECT_VIEWSPACE;
993                                         if (gpd->flag & GP_DATA_DEPTH_VIEW)   ts->gpencil_v3d_align |= GP_PROJECT_DEPTH_VIEW;
994                                         if (gpd->flag & GP_DATA_DEPTH_STROKE) ts->gpencil_v3d_align |= GP_PROJECT_DEPTH_STROKE;
995                                         
996                                         if (gpd->flag & GP_DATA_DEPTH_STROKE_ENDPOINTS)
997                                                 ts->gpencil_v3d_align |= GP_PROJECT_DEPTH_STROKE_ENDPOINTS;
998                                 }
999                                 else {
1000                                         /* Default to cursor for all standard 3D views */
1001                                         ts->gpencil_v3d_align = GP_PROJECT_VIEWSPACE;
1002                                 }
1003 #endif
1004                                 
1005                                 ts->gpencil_v3d_align = GP_PROJECT_VIEWSPACE;
1006                                 ts->gpencil_v2d_align = GP_PROJECT_VIEWSPACE;
1007                                 ts->gpencil_seq_align = GP_PROJECT_VIEWSPACE;
1008                                 ts->gpencil_ima_align = GP_PROJECT_VIEWSPACE;
1009                         }
1010                 }
1011                 
1012                 for (bGPdata *gpd = main->gpencil.first; gpd; gpd = gpd->id.next) {
1013                         bool enabled = false;
1014                         
1015                         /* Ensure that the datablock's onionskinning toggle flag
1016                          * stays in sync with the status of the actual layers
1017                          */
1018                         for (bGPDlayer *gpl = gpd->layers.first; gpl; gpl = gpl->next) {
1019                                 if (gpl->flag & GP_LAYER_ONIONSKIN) {
1020                                         enabled = true;
1021                                 }
1022                         }
1023                         
1024                         if (enabled)
1025                                 gpd->flag |= GP_DATA_SHOW_ONIONSKINS;
1026                         else
1027                                 gpd->flag &= ~GP_DATA_SHOW_ONIONSKINS;
1028                 }
1029
1030                 if (!DNA_struct_elem_find(fd->filesdna, "Object", "unsigned char", "max_jumps")) {
1031                         for (Object *ob = main->object.first; ob; ob = ob->id.next) {
1032                                 ob->max_jumps = 1;
1033                         }
1034                 }
1035         }
1036         if (!MAIN_VERSION_ATLEAST(main, 276, 5)) {
1037                 ListBase *lbarray[MAX_LIBARRAY];
1038                 int a;
1039
1040                 /* Important to clear all non-persistent flags from older versions here, otherwise they could collide
1041                  * with any new persistent flag we may add in the future. */
1042                 a = set_listbasepointers(main, lbarray);
1043                 while (a--) {
1044                         for (ID *id = lbarray[a]->first; id; id = id->next) {
1045                                 id->flag &= LIB_FAKEUSER;
1046                         }
1047                 }
1048         }
1049
1050         if (!MAIN_VERSION_ATLEAST(main, 276, 7)) {
1051                 Scene *scene;
1052                 for (scene = main->scene.first; scene != NULL; scene = scene->id.next) {
1053                         scene->r.bake.pass_filter = R_BAKE_PASS_FILTER_ALL;
1054                 }
1055         }
1056
1057         if (!MAIN_VERSION_ATLEAST(main, 277, 1)) {
1058                 for (Scene *scene = main->scene.first; scene; scene = scene->id.next) {
1059                         ParticleEditSettings *pset = &scene->toolsettings->particle;
1060                         for (int a = 0; a < PE_TOT_BRUSH; a++) {
1061                                 if (pset->brush[a].strength > 1.0f) {
1062                                         pset->brush[a].strength *= 0.01f;
1063                                 }
1064                         }
1065                 }
1066
1067                 /* init grease pencil smooth level iterations */
1068                 for (bGPdata *gpd = main->gpencil.first; gpd; gpd = gpd->id.next) {
1069                         for (bGPDlayer *gpl = gpd->layers.first; gpl; gpl = gpl->next) {
1070                                 if (gpl->draw_smoothlvl == 0) {
1071                                         gpl->draw_smoothlvl = 1;
1072                                 }
1073                         }
1074                 }
1075
1076                 for (bScreen *screen = main->screen.first; screen; screen = screen->id.next) {
1077                         for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) {
1078                                 for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) {
1079                                         ListBase *regionbase = (sl == sa->spacedata.first) ? &sa->regionbase : &sl->regionbase;
1080                                         /* Bug: Was possible to add preview region to sequencer view by using AZones. */
1081                                         if (sl->spacetype == SPACE_SEQ) {
1082                                                 SpaceSeq *sseq = (SpaceSeq *)sl;
1083                                                 if (sseq->view == SEQ_VIEW_SEQUENCE) {
1084                                                         for (ARegion *ar = regionbase->first; ar; ar = ar->next) {
1085                                                                 /* remove preview region for sequencer-only view! */
1086                                                                 if (ar->regiontype == RGN_TYPE_PREVIEW) {
1087                                                                         ar->flag |= RGN_FLAG_HIDDEN;
1088                                                                         ar->alignment = RGN_ALIGN_NONE;
1089                                                                         break;
1090                                                                 }
1091                                                         }
1092                                                 }
1093                                         }
1094                                         /* Remove old deprecated region from filebrowsers */
1095                                         else if (sl->spacetype == SPACE_FILE) {
1096                                                 for (ARegion *ar = regionbase->first; ar; ar = ar->next) {
1097                                                         if (ar->regiontype == RGN_TYPE_CHANNELS) {
1098                                                                 /* Free old deprecated 'channel' region... */
1099                                                                 BKE_area_region_free(NULL, ar);
1100                                                                 BLI_freelinkN(regionbase, ar);
1101                                                                 break;
1102                                                         }
1103                                                 }
1104                                         }
1105                                 }
1106                         }
1107                 }
1108
1109                 for (Scene *scene = main->scene.first; scene; scene = scene->id.next) {
1110                         CurvePaintSettings *cps = &scene->toolsettings->curve_paint_settings;
1111                         if (cps->error_threshold == 0) {
1112                                 cps->curve_type = CU_BEZIER;
1113                                 cps->flag |= CURVE_PAINT_FLAG_CORNERS_DETECT;
1114                                 cps->error_threshold = 8;
1115                                 cps->radius_max = 1.0f;
1116                                 cps->corner_angle = DEG2RADF(70.0f);
1117                         }
1118                 }
1119
1120                 for (Scene *scene = main->scene.first; scene; scene = scene->id.next) {
1121                         Sequence *seq;
1122
1123                         SEQ_BEGIN (scene->ed, seq)
1124                         {
1125                                 if (seq->type == SEQ_TYPE_TEXT) {
1126                                         TextVars *data = seq->effectdata;
1127                                         if (data->color[3] == 0.0f) {
1128                                                 copy_v4_fl(data->color, 1.0f);
1129                                                 data->shadow_color[3] = 1.0f;
1130                                         }
1131                                 }
1132                         }
1133                         SEQ_END
1134                 }
1135
1136                 /* Adding "Properties" region to DopeSheet */
1137                 for (bScreen *screen = main->screen.first; screen; screen = screen->id.next) {
1138                         for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) {
1139                                 /* handle pushed-back space data first */
1140                                 for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) {
1141                                         if (sl->spacetype == SPACE_ACTION) {
1142                                                 SpaceAction *saction = (SpaceAction *)sl;
1143                                                 do_version_action_editor_properties_region(&saction->regionbase);
1144                                         }
1145                                 }
1146                                 
1147                                 /* active spacedata info must be handled too... */
1148                                 if (sa->spacetype == SPACE_ACTION) {
1149                                         do_version_action_editor_properties_region(&sa->regionbase);
1150                                 }
1151                         }
1152                 }
1153         }
1154 }