synched with trunk at revision 30597
[blender.git] / source / blender / blenkernel / intern / scene.c
index 1354648..429cbfe 100644 (file)
@@ -220,7 +220,7 @@ Scene *copy_scene(Main *bmain, Scene *sce, int type)
                if(sce->ed) {
                        scen->ed= MEM_callocN( sizeof(Editing), "addseq");
                        scen->ed->seqbasep= &scen->ed->seqbase;
-                       seqbase_dupli_recursive(sce, &scen->ed->seqbase, &sce->ed->seqbase, 0);
+                       seqbase_dupli_recursive(sce, &scen->ed->seqbase, &sce->ed->seqbase, SEQ_DUPE_ALL);
                }
        }
 
@@ -483,6 +483,23 @@ Scene *add_scene(char *name)
        sce->gm.flag = GAME_DISPLAY_LISTS;
        sce->gm.matmode = GAME_MAT_MULTITEX;
 
+       sce->gm.obstacleSimulation= OBSTSIMULATION_NONE;
+       sce->gm.levelHeight = 2.f;
+
+       sce->gm.recastData.cellsize = 0.3f;
+       sce->gm.recastData.cellheight = 0.2f;
+       sce->gm.recastData.agentmaxslope = M_PI/2;
+       sce->gm.recastData.agentmaxclimb = 0.9f;
+       sce->gm.recastData.agentheight = 2.0f;
+       sce->gm.recastData.agentradius = 0.6f;
+       sce->gm.recastData.edgemaxlen = 12.0f;
+       sce->gm.recastData.edgemaxerror = 1.3f;
+       sce->gm.recastData.regionminsize = 50.f;
+       sce->gm.recastData.regionmergesize = 20.f;
+       sce->gm.recastData.vertsperpoly = 6;
+       sce->gm.recastData.detailsampledist = 6.0f;
+       sce->gm.recastData.detailsamplemaxerror = 1.0f;
+
        sound_create_scene(sce);
 
        return sce;
@@ -593,7 +610,7 @@ void unlink_scene(Main *bmain, Scene *sce, Scene *newsce)
 /* used by metaballs
  * doesnt return the original duplicated object, only dupli's
  */
-int next_object(Scene *scene, int val, Base **base, Object **ob)
+int next_object(Scene **scene, int val, Base **base, Object **ob)
 {
        static ListBase *duplilist= NULL;
        static DupliObject *dupob;
@@ -622,17 +639,21 @@ int next_object(Scene *scene, int val, Base **base, Object **ob)
 
                        /* the first base */
                        if(fase==F_START) {
-                               *base= scene->base.first;
+                               *base= (*scene)->base.first;
                                if(*base) {
                                        *ob= (*base)->object;
                                        fase= F_SCENE;
                                }
                                else {
                                        /* exception: empty scene */
-                                       if(scene->set && scene->set->base.first) {
-                                               *base= scene->set->base.first;
-                                               *ob= (*base)->object;
-                                               fase= F_SET;
+                                       while((*scene)->set) {
+                                               (*scene)= (*scene)->set;
+                                               if((*scene)->base.first) {
+                                                       *base= (*scene)->base.first;
+                                                       *ob= (*base)->object;
+                                                       fase= F_SCENE;
+                                                       break;
+                                               }
                                        }
                                }
                        }
@@ -642,11 +663,14 @@ int next_object(Scene *scene, int val, Base **base, Object **ob)
                                        if(*base) *ob= (*base)->object;
                                        else {
                                                if(fase==F_SCENE) {
-                                                       /* scene is finished, now do the set */
-                                                       if(scene->set && scene->set->base.first) {
-                                                               *base= scene->set->base.first;
-                                                               *ob= (*base)->object;
-                                                               fase= F_SET;
+                                                       /* (*scene) is finished, now do the set */
+                                                       while((*scene)->set) {
+                                                               (*scene)= (*scene)->set;
+                                                               if((*scene)->base.first) {
+                                                                       *base= (*scene)->base.first;
+                                                                       *ob= (*base)->object;
+                                                                       break;
+                                                               }
                                                        }
                                                }
                                        }
@@ -661,7 +685,7 @@ int next_object(Scene *scene, int val, Base **base, Object **ob)
                                                this enters eternal loop because of 
                                                makeDispListMBall getting called inside of group_duplilist */
                                                if((*base)->object->dup_group == NULL) {
-                                                       duplilist= object_duplilist(scene, (*base)->object);
+                                                       duplilist= object_duplilist((*scene), (*base)->object);
                                                        
                                                        dupob= duplilist->first;
 
@@ -697,6 +721,10 @@ int next_object(Scene *scene, int val, Base **base, Object **ob)
                }
        }
        
+       /* if(ob && *ob) {
+               printf("Scene: '%s', '%s'\n", (*scene)->id.name+2, (*ob)->id.name+2);
+       } */
+
        /* reset recursion test */
        in_next_object= 0;
        
@@ -907,6 +935,9 @@ static void scene_update_tagged_recursive(Scene *scene, Scene *scene_parent)
 
                if(ob->dup_group && (ob->transflag & OB_DUPLIGROUP))
                        group_handle_recalc_and_update(scene_parent, ob, ob->dup_group);
+                       
+               /* always update layer, so that animating layers works */
+               base->lay= ob->lay;
        }
 }