code cleanup: favor braces when blocks have mixed brace use.
[blender.git] / source / blender / blenkernel / intern / scene.c
index 9479e3e..131fb38 100644 (file)
@@ -435,7 +435,7 @@ Scene *BKE_scene_add(Main *bmain, const char *name)
        sce->r.postsat = 1.0;
 
        sce->r.bake_mode = 1;    /* prevent to include render stuff here */
-       sce->r.bake_filter = 2;
+       sce->r.bake_filter = 16;
        sce->r.bake_osa = 5;
        sce->r.bake_flag = R_BAKE_CLEAR;
        sce->r.bake_normal_space = R_BAKE_SPACE_TANGENT;
@@ -760,7 +760,9 @@ int BKE_scene_base_iter_next(Scene **scene, int val, Base **base, Object **ob)
                        else {
                                if (*base && fase != F_DUPLI) {
                                        *base = (*base)->next;
-                                       if (*base) *ob = (*base)->object;
+                                       if (*base) {
+                                               *ob = (*base)->object;
+                                       }
                                        else {
                                                if (fase == F_SCENE) {
                                                        /* (*scene) is finished, now do the set */
@@ -777,7 +779,9 @@ int BKE_scene_base_iter_next(Scene **scene, int val, Base **base, Object **ob)
                                }
                        }
                        
-                       if (*base == NULL) fase = F_START;
+                       if (*base == NULL) {
+                               fase = F_START;
+                       }
                        else {
                                if (fase != F_DUPLI) {
                                        if ( (*base)->object->transflag & OB_DUPLI) {
@@ -1081,22 +1085,22 @@ static void scene_depsgraph_hack(Scene *scene, Scene *scene_parent)
 
 }
 
-static void scene_flag_rbw_recursive(Scene *scene)
+static void scene_rebuild_rbw_recursive(Scene *scene, float ctime)
 {
        if (scene->set)
-               scene_flag_rbw_recursive(scene->set);
+               scene_rebuild_rbw_recursive(scene->set, ctime);
 
        if (BKE_scene_check_rigidbody_active(scene))
-               scene->rigidbody_world->flag |= RBW_FLAG_FRAME_UPDATE;
+               BKE_rigidbody_rebuild_world(scene, ctime);
 }
 
-static void scene_rebuild_rbw_recursive(Scene *scene, float ctime)
+static void scene_do_rb_simulation_recursive(Scene *scene, float ctime)
 {
        if (scene->set)
-               scene_rebuild_rbw_recursive(scene->set, ctime);
+               scene_do_rb_simulation_recursive(scene->set, ctime);
 
        if (BKE_scene_check_rigidbody_active(scene))
-               BKE_rigidbody_rebuild_world(scene, ctime);
+               BKE_rigidbody_do_simulation(scene, ctime);
 }
 
 static void scene_update_tagged_recursive(Main *bmain, Scene *scene, Scene *scene_parent)
@@ -1110,22 +1114,6 @@ static void scene_update_tagged_recursive(Main *bmain, Scene *scene, Scene *scen
        if (scene->set)
                scene_update_tagged_recursive(bmain, scene->set, scene_parent);
        
-       /* run rigidbody sim 
-        * - calculate/read values from cache into RBO's, to get flushed 
-        *   later when objects are evaluated (if they're tagged for eval)
-        */
-       // XXX: this position may still change, objects not being updated correctly before simulation is run
-       // NOTE: current position is so that rigidbody sim affects other objects
-       if (BKE_scene_check_rigidbody_active(scene) && scene->rigidbody_world->flag & RBW_FLAG_FRAME_UPDATE) {
-               /* we use frame time of parent (this is "scene" itself for top-level of sets recursion), 
-                * as that is the active scene controlling all timing in file at the moment
-                */
-               float ctime = BKE_scene_frame_get(scene_parent);
-
-               /* however, "scene" contains the rigidbody world needed for eval... */
-               BKE_rigidbody_do_simulation(scene, ctime);
-       }
-       
        /* scene objects */
        for (base = scene->base.first; base; base = base->next) {
                Object *ob = base->object;
@@ -1249,8 +1237,9 @@ void BKE_scene_update_for_newframe(Main *bmain, Scene *sce, unsigned int lay)
        tag_main_idcode(bmain, ID_MA, FALSE);
        tag_main_idcode(bmain, ID_LA, FALSE);
 
-       /* flag rigid body worlds for update */
-       scene_flag_rbw_recursive(sce);
+       /* run rigidbody sim */
+       /* NOTE: current position is so that rigidbody sim affects other objects, might change in the future */
+       scene_do_rb_simulation_recursive(sce, ctime);
 
        /* BKE_object_handle_update() on all objects, groups and sets */
        scene_update_tagged_recursive(bmain, sce, sce);