Merge branch 'master' into soc-2013-depsgraph_mt
[blender.git] / source / blender / blenkernel / intern / object.c
index c069abfaf355e70ee81a20064758a95d7840cb0c..711065b0e8b2d481b88632eb4796b42cc11206e1 100644 (file)
@@ -2335,7 +2335,8 @@ static int where_is_object_parslow(Object *ob, float obmat[4][4], float slowmat[
 
 /* note, scene is the active scene while actual_scene is the scene the object resides in */
 void BKE_object_where_is_calc_time_ex(Scene *scene, Object *ob, float ctime,
-                                      RigidBodyWorld *rbw, float r_originmat[3][3])
+                                      RigidBodyWorld *rbw, bool for_render,
+                                      float r_originmat[3][3])
 {
        if (ob == NULL) return;
        
@@ -2369,7 +2370,15 @@ void BKE_object_where_is_calc_time_ex(Scene *scene, Object *ob, float ctime,
        /* solve constraints */
        if (ob->constraints.first && !(ob->transflag & OB_NO_CONSTRAINTS)) {
                bConstraintOb *cob;
-               cob = BKE_constraints_make_evalob(scene, ob, NULL, CONSTRAINT_OBTYPE_OBJECT);
+
+               (void) for_render;  /* Currently unused. */
+
+               /* TODO(sergey): Mixing viewport/render evaluation leads to conflicts because
+                *               of shared ob->obmat.
+                *               To preserve regressions for now don't use render evaluation
+                *               for now.
+                */
+               cob = BKE_constraints_make_evalob(scene, ob, NULL, CONSTRAINT_OBTYPE_OBJECT, false);
                BKE_solve_constraints(&ob->constraints, cob, ctime);
                BKE_constraints_clear_evalob(cob);
        }
@@ -2381,7 +2390,8 @@ void BKE_object_where_is_calc_time_ex(Scene *scene, Object *ob, float ctime,
 
 void BKE_object_where_is_calc_time(Scene *scene, Object *ob, float ctime)
 {
-       BKE_object_where_is_calc_time_ex(scene, ob, ctime, NULL, NULL);
+       /* TODO(sergey): We might need real for_render flag here */
+       BKE_object_where_is_calc_time_ex(scene, ob, ctime, NULL, false, NULL);
 }
 
 /* get object transformation matrix without recalculating dependencies and
@@ -2405,13 +2415,14 @@ void BKE_object_where_is_calc_mat4(Scene *scene, Object *ob, float obmat[4][4])
        }
 }
 
-void BKE_object_where_is_calc_ex(Scene *scene, RigidBodyWorld *rbw, Object *ob, float r_originmat[3][3])
+void BKE_object_where_is_calc_ex(Scene *scene, RigidBodyWorld *rbw, Object *ob, bool for_render, float r_originmat[3][3])
 {
-       BKE_object_where_is_calc_time_ex(scene, ob, BKE_scene_frame_get(scene), rbw, r_originmat);
+       BKE_object_where_is_calc_time_ex(scene, ob, BKE_scene_frame_get(scene), rbw, for_render, r_originmat);
 }
 void BKE_object_where_is_calc(Scene *scene, Object *ob)
 {
-       BKE_object_where_is_calc_time_ex(scene, ob, BKE_scene_frame_get(scene), NULL, NULL);
+       /* TODO(sergey): We might need real for_render flag here */
+       BKE_object_where_is_calc_time_ex(scene, ob, BKE_scene_frame_get(scene), NULL, false, NULL);
 }
 
 /* was written for the old game engine (until 2.04) */
@@ -2449,7 +2460,8 @@ void BKE_object_where_is_calc_simul(Scene *scene, Object *ob)
        if (ob->constraints.first) {
                bConstraintOb *cob;
                
-               cob = BKE_constraints_make_evalob(scene, ob, NULL, CONSTRAINT_OBTYPE_OBJECT);
+               /* TODO(sergey): We need a proper for_render flag here. */
+               cob = BKE_constraints_make_evalob(scene, ob, NULL, CONSTRAINT_OBTYPE_OBJECT, false);
                BKE_solve_constraints(&ob->constraints, cob, BKE_scene_frame_get(scene));
                BKE_constraints_clear_evalob(cob);
        }
@@ -2893,7 +2905,7 @@ void BKE_object_handle_update_ex(EvaluationContext *eval_ctx,
                                        copy_m4_m4(ob->obmat, ob->proxy_from->obmat);
                        }
                        else
-                               BKE_object_where_is_calc_ex(scene, rbw, ob, NULL);
+                               BKE_object_where_is_calc_ex(scene, rbw, ob, eval_ctx->for_render, NULL);
                }
                
                if (ob->recalc & OB_RECALC_DATA) {
@@ -2950,7 +2962,9 @@ void BKE_object_handle_update_ex(EvaluationContext *eval_ctx,
                                case OB_CURVE:
                                case OB_SURF:
                                case OB_FONT:
-                                       BKE_displist_make_curveTypes(scene, ob, 0);
+                                       if (eval_ctx->for_render == false) {
+                                               BKE_displist_make_curveTypes(scene, ob, 0);
+                                       }
                                        break;
                                
                                case OB_LATTICE: