Merge branch 'master' into blender2.8
[blender.git] / source / blender / blenkernel / intern / object_update.c
index 4d2cf0c5dc61cbb2603944afb858fdbb59cb5362..f5f521e119dd7667cd83c38d36e6e23198c4b73a 100644 (file)
@@ -68,7 +68,6 @@
 #define DEBUG_PRINT if (G.debug & G_DEBUG_DEPSGRAPH) printf
 
 void BKE_object_eval_local_transform(const EvaluationContext *UNUSED(eval_ctx),
-                                     Scene *UNUSED(scene),
                                      Object *ob)
 {
        DEBUG_PRINT("%s on %s (%p)\n", __func__, ob->id.name, ob);
@@ -273,33 +272,36 @@ void BKE_object_handle_data_update(
        /* quick cache removed */
 }
 
-void BKE_object_eval_uber_transform(const EvaluationContext *UNUSED(eval_ctx),
-                                    Scene *UNUSED(scene),
-                                    Object *ob)
+bool BKE_object_eval_proxy_copy(const EvaluationContext *UNUSED(eval_ctx),
+                                Object *object)
 {
-       /* TODO(sergey): Currently it's a duplicate of logic in BKE_object_handle_update_ex(). */
-       // XXX: it's almost redundant now...
-
        /* Handle proxy copy for target, */
-       if (ID_IS_LINKED(ob) && ob->proxy_from) {
-               if (ob->proxy_from->proxy_group) {
+       if (ID_IS_LINKED(object) && object->proxy_from) {
+               if (object->proxy_from->proxy_group) {
                        /* Transform proxy into group space. */
-                       Object *obg = ob->proxy_from->proxy_group;
+                       Object *obg = object->proxy_from->proxy_group;
                        float imat[4][4];
                        invert_m4_m4(imat, obg->obmat);
-                       mul_m4_m4m4(ob->obmat, imat, ob->proxy_from->obmat);
+                       mul_m4_m4m4(object->obmat, imat, object->proxy_from->obmat);
                        /* Should always be true. */
                        if (obg->dup_group) {
-                               add_v3_v3(ob->obmat[3], obg->dup_group->dupli_ofs);
+                               add_v3_v3(object->obmat[3], obg->dup_group->dupli_ofs);
                        }
                }
-               else
-                       copy_m4_m4(ob->obmat, ob->proxy_from->obmat);
+               else {
+                       copy_m4_m4(object->obmat, object->proxy_from->obmat);
+               }
+               return true;
        }
+       return false;
+}
 
-       ob->recalc &= ~(OB_RECALC_OB | OB_RECALC_TIME);
-       if (ob->data == NULL) {
-               ob->recalc &= ~OB_RECALC_DATA;
+void BKE_object_eval_uber_transform(const EvaluationContext *eval_ctx, Object *object)
+{
+       BKE_object_eval_proxy_copy(eval_ctx, object);
+       object->recalc &= ~(OB_RECALC_OB | OB_RECALC_TIME);
+       if (object->data == NULL) {
+               object->recalc &= ~OB_RECALC_DATA;
        }
 }
 
@@ -391,19 +393,19 @@ void BKE_object_eval_cloth(const EvaluationContext *UNUSED(eval_ctx),
        BKE_ptcache_object_reset(scene, object, PTCACHE_RESET_DEPSGRAPH);
 }
 
-void BKE_object_eval_transform_all(EvaluationContext *eval_ctx,
+void BKE_object_eval_transform_all(const EvaluationContext *eval_ctx,
                                    Scene *scene,
                                    Object *object)
 {
        /* This mimics full transform update chain from new depsgraph. */
-       BKE_object_eval_local_transform(eval_ctx, scene, object);
+       BKE_object_eval_local_transform(eval_ctx, object);
        if (object->parent != NULL) {
                BKE_object_eval_parent(eval_ctx, scene, object);
        }
        if (!BLI_listbase_is_empty(&object->constraints)) {
                BKE_object_eval_constraints(eval_ctx, scene, object);
        }
-       BKE_object_eval_uber_transform(eval_ctx, scene, object);
+       BKE_object_eval_uber_transform(eval_ctx, object);
        BKE_object_eval_done(eval_ctx, object);
 }