Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/blenkernel/intern/object_update.c')
-rw-r--r--source/blender/blenkernel/intern/object_update.c93
1 files changed, 51 insertions, 42 deletions
diff --git a/source/blender/blenkernel/intern/object_update.c b/source/blender/blenkernel/intern/object_update.c
index 5cb704e4737..e2e28d4b251 100644
--- a/source/blender/blenkernel/intern/object_update.c
+++ b/source/blender/blenkernel/intern/object_update.c
@@ -54,25 +54,19 @@
#include "BKE_editmesh.h"
#include "BKE_object.h"
#include "BKE_particle.h"
+#include "BKE_pointcache.h"
#include "BKE_scene.h"
#include "BKE_material.h"
#include "BKE_image.h"
#include "DEG_depsgraph.h"
-#ifdef WITH_LEGACY_DEPSGRAPH
-# define DEBUG_PRINT if (!DEG_depsgraph_use_legacy() && G.debug & G_DEBUG_DEPSGRAPH) printf
-#else
-# define DEBUG_PRINT if (G.debug & G_DEBUG_DEPSGRAPH) printf
-#endif
-
static ThreadMutex material_lock = BLI_MUTEX_INITIALIZER;
void BKE_object_eval_local_transform(EvaluationContext *UNUSED(eval_ctx),
- Scene *UNUSED(scene),
Object *ob)
{
- DEBUG_PRINT("%s on %s\n", __func__, ob->id.name);
+ DEG_debug_print_eval(__func__, ob->id.name, ob);
/* calculate local matrix */
BKE_object_to_mat4(ob, ob->obmat);
@@ -90,7 +84,7 @@ void BKE_object_eval_parent(EvaluationContext *UNUSED(eval_ctx),
float tmat[4][4];
float locmat[4][4];
- DEBUG_PRINT("%s on %s\n", __func__, ob->id.name);
+ DEG_debug_print_eval(__func__, ob->id.name, ob);
/* get local matrix (but don't calculate it, as that was done already!) */
// XXX: redundant?
@@ -119,7 +113,7 @@ void BKE_object_eval_constraints(EvaluationContext *UNUSED(eval_ctx),
bConstraintOb *cob;
float ctime = BKE_scene_frame_get(scene);
- DEBUG_PRINT("%s on %s\n", __func__, ob->id.name);
+ DEG_debug_print_eval(__func__, ob->id.name, ob);
/* evaluate constraints stack */
/* TODO: split this into:
@@ -137,25 +131,13 @@ void BKE_object_eval_constraints(EvaluationContext *UNUSED(eval_ctx),
void BKE_object_eval_done(EvaluationContext *UNUSED(eval_ctx), Object *ob)
{
- DEBUG_PRINT("%s on %s\n", __func__, ob->id.name);
+ DEG_debug_print_eval(__func__, ob->id.name, ob);
/* Set negative scale flag in object. */
if (is_negative_m4(ob->obmat)) ob->transflag |= OB_NEG_SCALE;
else ob->transflag &= ~OB_NEG_SCALE;
}
-void BKE_object_eval_modifier(struct EvaluationContext *eval_ctx,
- struct Scene *scene,
- struct Object *ob,
- struct ModifierData *md)
-{
- DEBUG_PRINT("%s on %s\n", __func__, ob->id.name);
- (void) eval_ctx; /* Ignored. */
- (void) scene; /* Ignored. */
- (void) ob; /* Ignored. */
- (void) md; /* Ignored. */
-}
-
void BKE_object_handle_data_update(EvaluationContext *eval_ctx,
Scene *scene,
Object *ob)
@@ -165,7 +147,7 @@ void BKE_object_handle_data_update(EvaluationContext *eval_ctx,
Key *key;
float ctime = BKE_scene_frame_get(scene);
- if (G.debug & G_DEBUG_DEPSGRAPH)
+ if (G.debug & G_DEBUG_DEPSGRAPH_EVAL)
printf("recalcdata %s\n", ob->id.name + 2);
/* TODO(sergey): Only used by legacy depsgraph. */
@@ -203,7 +185,7 @@ void BKE_object_handle_data_update(EvaluationContext *eval_ctx,
break;
}
case OB_ARMATURE:
- if (ID_IS_LINKED_DATABLOCK(ob) && ob->proxy_from) {
+ if (ID_IS_LINKED(ob) && ob->proxy_from) {
if (BKE_pose_copy_result(ob->pose, ob->proxy_from->pose) == false) {
printf("Proxy copy error, lib Object: %s proxy Object: %s\n",
ob->id.name + 2, ob->proxy_from->id.name + 2);
@@ -307,33 +289,36 @@ void BKE_object_handle_data_update(EvaluationContext *eval_ctx,
/* quick cache removed */
}
-void BKE_object_eval_uber_transform(EvaluationContext *UNUSED(eval_ctx),
- Scene *UNUSED(scene),
- Object *ob)
+bool BKE_object_eval_proxy_copy(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_DATABLOCK(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(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;
}
}
@@ -341,9 +326,33 @@ void BKE_object_eval_uber_data(EvaluationContext *eval_ctx,
Scene *scene,
Object *ob)
{
- DEBUG_PRINT("%s on %s\n", __func__, ob->id.name);
+ DEG_debug_print_eval(__func__, ob->id.name, ob);
BLI_assert(ob->type != OB_ARMATURE);
BKE_object_handle_data_update(eval_ctx, scene, ob);
ob->recalc &= ~(OB_RECALC_DATA | OB_RECALC_TIME);
}
+
+void BKE_object_eval_cloth(EvaluationContext *UNUSED(eval_ctx),
+ Scene *scene,
+ Object *object)
+{
+ DEG_debug_print_eval(__func__, object->id.name, object);
+ BKE_ptcache_object_reset(scene, object, PTCACHE_RESET_DEPSGRAPH);
+}
+
+void BKE_object_eval_transform_all(EvaluationContext *eval_ctx,
+ Scene *scene,
+ Object *object)
+{
+ /* This mimics full transform update chain from new depsgraph. */
+ 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, object);
+ BKE_object_eval_done(eval_ctx, object);
+}