Fix #30948: add scene > copy settings did not copy settings like units, audio, game
authorBrecht Van Lommel <brechtvanlommel@pandora.be>
Sun, 15 Apr 2012 08:48:11 +0000 (08:48 +0000)
committerBrecht Van Lommel <brechtvanlommel@pandora.be>
Sun, 15 Apr 2012 08:48:11 +0000 (08:48 +0000)
data, and tool settings.

What exactly should be copied is a bit up to interpretation, but I think these make
sense, and things like audio or game data used to be part of render settings which
do get copied so at least for those it was a regression.

source/blender/blenkernel/intern/scene.c

index 7c242da9aff7492b1bbcf8800e005861dbb4a67a..c950a6ccdb59557142282d345ed00945e9bb322c 100644 (file)
@@ -123,6 +123,12 @@ Scene *copy_scene(Scene *sce, int type)
                lb= scen->r.layers;
                scen->r= sce->r;
                scen->r.layers= lb;
+               scen->unit= sce->unit;
+               scen->physics_settings= sce->physics_settings;
+               scen->gm= sce->gm;
+               scen->audio= sce->audio;
+
+               MEM_freeN(scen->toolsettings);
        }
        else {
                scen= copy_libblock(&sce->id);
@@ -137,37 +143,9 @@ Scene *copy_scene(Scene *sce, int type)
                scen->ed= NULL;
                scen->theDag= NULL;
                scen->obedit= NULL;
-               scen->toolsettings= MEM_dupallocN(sce->toolsettings);
                scen->stats= NULL;
                scen->fps_info= NULL;
 
-               ts= scen->toolsettings;
-               if (ts) {
-                       if (ts->vpaint) {
-                               ts->vpaint= MEM_dupallocN(ts->vpaint);
-                               ts->vpaint->paintcursor= NULL;
-                               ts->vpaint->vpaint_prev= NULL;
-                               ts->vpaint->wpaint_prev= NULL;
-                               copy_paint(&ts->vpaint->paint, &ts->vpaint->paint);
-                       }
-                       if (ts->wpaint) {
-                               ts->wpaint= MEM_dupallocN(ts->wpaint);
-                               ts->wpaint->paintcursor= NULL;
-                               ts->wpaint->vpaint_prev= NULL;
-                               ts->wpaint->wpaint_prev= NULL;
-                               copy_paint(&ts->wpaint->paint, &ts->wpaint->paint);
-                       }
-                       if (ts->sculpt) {
-                               ts->sculpt= MEM_dupallocN(ts->sculpt);
-                               copy_paint(&ts->sculpt->paint, &ts->sculpt->paint);
-                       }
-
-                       copy_paint(&ts->imapaint.paint, &ts->imapaint.paint);
-                       ts->imapaint.paintcursor= NULL;
-
-                       ts->particle.paintcursor= NULL;
-               }
-               
                BLI_duplicatelist(&(scen->markers), &(sce->markers));
                BLI_duplicatelist(&(scen->transform_spaces), &(sce->transform_spaces));
                BLI_duplicatelist(&(scen->r.layers), &(sce->r.layers));
@@ -188,6 +166,35 @@ Scene *copy_scene(Scene *sce, int type)
                        base= base->next;
                }
        }
+
+       /* tool settings */
+       scen->toolsettings= MEM_dupallocN(sce->toolsettings);
+
+       ts= scen->toolsettings;
+       if (ts) {
+               if (ts->vpaint) {
+                       ts->vpaint= MEM_dupallocN(ts->vpaint);
+                       ts->vpaint->paintcursor= NULL;
+                       ts->vpaint->vpaint_prev= NULL;
+                       ts->vpaint->wpaint_prev= NULL;
+                       copy_paint(&ts->vpaint->paint, &ts->vpaint->paint);
+               }
+               if (ts->wpaint) {
+                       ts->wpaint= MEM_dupallocN(ts->wpaint);
+                       ts->wpaint->paintcursor= NULL;
+                       ts->wpaint->vpaint_prev= NULL;
+                       ts->wpaint->wpaint_prev= NULL;
+                       copy_paint(&ts->wpaint->paint, &ts->wpaint->paint);
+               }
+               if (ts->sculpt) {
+                       ts->sculpt= MEM_dupallocN(ts->sculpt);
+                       copy_paint(&ts->sculpt->paint, &ts->sculpt->paint);
+               }
+
+               copy_paint(&ts->imapaint.paint, &ts->imapaint.paint);
+               ts->imapaint.paintcursor= NULL;
+               ts->particle.paintcursor= NULL;
+       }
        
        /* make a private copy of the avicodecdata */
        if (sce->r.avicodecdata) {