Change startup defaults
[blender.git] / source / blender / blenloader / intern / versioning_defaults.c
index 4767ba4e734fef1a2e5b10e6964662ec4b74ada3..fbc68f40a0ebd7a5bca6e8ef3cab509845576eba 100644 (file)
 #include "BLI_math.h"
 #include "BLI_string.h"
 
+#include "DNA_camera_types.h"
 #include "DNA_brush_types.h"
 #include "DNA_freestyle_types.h"
+#include "DNA_lamp_types.h"
 #include "DNA_linestyle_types.h"
 #include "DNA_scene_types.h"
 #include "DNA_screen_types.h"
@@ -347,5 +349,55 @@ void BLO_update_defaults_startup_blend(Main *bmain)
                        br->flag |= BRUSH_ACCUMULATE;
                }
        }
+
+       /* Defaults from T54943. */
+       {
+               for (Scene *scene = bmain->scene.first; scene; scene = scene->id.next) {
+                       scene->r.displaymode = R_OUTPUT_WINDOW;
+                       scene->r.size = 100;
+                       scene->unit.system = USER_UNIT_METRIC;
+                       STRNCPY(scene->view_settings.view_transform, "Filmic");
+               }
+
+               for (bScreen *sc = bmain->screen.first; sc; sc = sc->id.next) {
+                       for (ScrArea *sa = sc->areabase.first; sa; sa = sa->next) {
+                               for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) {
+                                       switch (sl->spacetype) {
+                                               case SPACE_VIEW3D:
+                                               {
+                                                       View3D *v3d = (View3D *)sl;
+                                                       v3d->lens = 50;
+                                                       break;
+                                               }
+                                               case SPACE_BUTS:
+                                               {
+                                                       SpaceButs *sbuts = (SpaceButs *)sl;
+                                                       sbuts->mainb = sbuts->mainbuser = BCONTEXT_OBJECT;
+                                                       break;
+                                               }
+                                       }
+
+                                       ListBase *lb = (sl == sa->spacedata.first) ? &sa->regionbase : &sl->regionbase;
+                                       for (ARegion *ar = lb->first; ar; ar = ar->next) {
+                                               if (ar->regiontype == RGN_TYPE_HEADER) {
+                                                       if (sl->spacetype != SPACE_ACTION) {
+                                                               ar->alignment = RGN_ALIGN_TOP;
+                                                       }
+                                               }
+                                       }
+                               }
+                       }
+               }
+
+               for (Camera *ca = bmain->camera.first; ca; ca = ca->id.next) {
+                       ca->lens = 50;
+                       ca->sensor_x = DEFAULT_SENSOR_WIDTH;
+                       ca->sensor_y = DEFAULT_SENSOR_HEIGHT;
+               }
+
+               for (Lamp *la = bmain->lamp.first; la; la = la->id.next) {
+                       la->energy = 10.0;
+               }
+       }
 }