diff options
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r-- | source/blender/blenkernel/BKE_group.h | 1 | ||||
-rw-r--r-- | source/blender/blenkernel/BKE_object.h | 9 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/group.c | 12 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/object.c | 116 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/object_update.c | 52 |
5 files changed, 98 insertions, 92 deletions
diff --git a/source/blender/blenkernel/BKE_group.h b/source/blender/blenkernel/BKE_group.h index 9aab6950496..1d35e6ab9fc 100644 --- a/source/blender/blenkernel/BKE_group.h +++ b/source/blender/blenkernel/BKE_group.h @@ -52,7 +52,6 @@ bool BKE_group_object_exists(struct Group *group, struct Object *ob); bool BKE_group_object_cyclic_check(struct Main *bmain, struct Object *object, struct Group *group); bool BKE_group_is_animated(struct Group *group, struct Object *parent); -void BKE_group_tag_recalc(struct Group *group); void BKE_group_handle_recalc_and_update(const struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *parent, struct Group *group); #endif /* __BKE_GROUP_H__ */ diff --git a/source/blender/blenkernel/BKE_object.h b/source/blender/blenkernel/BKE_object.h index 31125545670..2b183906f57 100644 --- a/source/blender/blenkernel/BKE_object.h +++ b/source/blender/blenkernel/BKE_object.h @@ -184,7 +184,6 @@ void BKE_object_tfm_protected_restore(struct Object *ob, /* Dependency graph evaluation callbacks. */ void BKE_object_eval_local_transform(const struct EvaluationContext *eval_ctx, - struct Scene *scene, struct Object *ob); void BKE_object_eval_parent(const struct EvaluationContext *eval_ctx, struct Scene *scene, @@ -194,8 +193,9 @@ void BKE_object_eval_constraints(const struct EvaluationContext *eval_ctx, struct Object *ob); void BKE_object_eval_done(const struct EvaluationContext *eval_ctx, struct Object *ob); +bool BKE_object_eval_proxy_copy(const struct EvaluationContext *eval_ct, + struct Object *object); void BKE_object_eval_uber_transform(const struct EvaluationContext *eval_ctx, - struct Scene *scene, struct Object *ob); void BKE_object_eval_uber_data(const struct EvaluationContext *eval_ctx, struct Scene *scene, @@ -205,6 +205,10 @@ void BKE_object_eval_cloth(const struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *object); +void BKE_object_eval_transform_all(const struct EvaluationContext *eval_ctx, + struct Scene *scene, + struct Object *object); + void BKE_object_eval_update_shading(const struct EvaluationContext *eval_ctx, struct Object *object); void BKE_object_data_select_update(const struct EvaluationContext *eval_ctx, @@ -226,6 +230,7 @@ void BKE_object_handle_update_ex( struct Scene *scene, struct Object *ob, struct RigidBodyWorld *rbw, const bool do_proxy_update); + void BKE_object_sculpt_modifiers_changed(struct Object *ob); int BKE_object_obdata_texspace_get(struct Object *ob, short **r_texflag, float **r_loc, float **r_size, float **r_rot); diff --git a/source/blender/blenkernel/intern/group.c b/source/blender/blenkernel/intern/group.c index 5e5f8114ead..0fd6685242f 100644 --- a/source/blender/blenkernel/intern/group.c +++ b/source/blender/blenkernel/intern/group.c @@ -253,18 +253,6 @@ Group *BKE_group_object_find(Group *group, Object *ob) return NULL; } -void BKE_group_tag_recalc(Group *group) -{ - GroupObject *go; - - if (group == NULL) return; - - for (go = group->gobject.first; go; go = go->next) { - if (go->ob) - go->ob->recalc = go->recalc; - } -} - bool BKE_group_is_animated(Group *group, Object *UNUSED(parent)) { GroupObject *go; diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index 3795e1bbf0e..f58a0d76b6a 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -2664,6 +2664,28 @@ bool BKE_object_parent_loop_check(const Object *par, const Object *ob) return BKE_object_parent_loop_check(par->parent, ob); } +static void object_handle_update_proxy(const EvaluationContext *eval_ctx, + Scene *scene, + Object *object, + const bool do_proxy_update) +{ + /* The case when this is a group proxy, object_update is called in group.c */ + if (object->proxy == NULL) { + return; + } + /* set pointer in library proxy target, for copying, but restore it */ + object->proxy->proxy_from = object; + // printf("set proxy pointer for later group stuff %s\n", ob->id.name); + + /* the no-group proxy case, we call update */ + if (object->proxy_group == NULL) { + if (do_proxy_update) { + // printf("call update, lib ob %s proxy %s\n", ob->proxy->id.name, ob->id.name); + BKE_object_handle_update(eval_ctx, scene, object->proxy); + } + } +} + /* proxy rule: lib_object->proxy_from == the one we borrow from, only set temporal and cleared here */ /* local_object->proxy == pointer to library object, saved in files and read */ @@ -2677,75 +2699,49 @@ void BKE_object_handle_update_ex(const EvaluationContext *eval_ctx, RigidBodyWorld *rbw, const bool do_proxy_update) { - if (ob->recalc & OB_RECALC_ALL) { - /* speed optimization for animation lookups */ - if (ob->pose) { - BKE_pose_channels_hash_make(ob->pose); - if (ob->pose->flag & POSE_CONSTRAINTS_NEED_UPDATE_FLAGS) { - BKE_pose_update_constraint_flags(ob->pose); - } + if ((ob->recalc & OB_RECALC_ALL) == 0) { + object_handle_update_proxy(eval_ctx, scene, ob, do_proxy_update); + return; + } + /* Speed optimization for animation lookups. */ + if (ob->pose != NULL) { + BKE_pose_channels_hash_make(ob->pose); + if (ob->pose->flag & POSE_CONSTRAINTS_NEED_UPDATE_FLAGS) { + BKE_pose_update_constraint_flags(ob->pose); } - - if (ob->recalc & OB_RECALC_DATA) { - if (ob->type == OB_ARMATURE) { - /* this happens for reading old files and to match library armatures - * with poses we do it ahead of BKE_object_where_is_calc to ensure animation - * is evaluated on the rebuilt pose, otherwise we get incorrect poses - * on file load */ - if (ob->pose == NULL || (ob->pose->flag & POSE_RECALC)) - BKE_pose_rebuild(ob, ob->data); - } + } + if (ob->recalc & OB_RECALC_DATA) { + if (ob->type == OB_ARMATURE) { + /* this happens for reading old files and to match library armatures + * with poses we do it ahead of BKE_object_where_is_calc to ensure animation + * is evaluated on the rebuilt pose, otherwise we get incorrect poses + * on file load */ + if (ob->pose == NULL || (ob->pose->flag & POSE_RECALC)) + BKE_pose_rebuild(ob, ob->data); } - - /* XXX new animsys warning: depsgraph tag OB_RECALC_DATA should not skip drivers, - * which is only in BKE_object_where_is_calc now */ - /* XXX: should this case be OB_RECALC_OB instead? */ - if (ob->recalc & OB_RECALC_ALL) { - - if (G.debug & G_DEBUG_DEPSGRAPH) - printf("recalcob %s\n", ob->id.name + 2); - - /* handle proxy copy for target */ - if (ID_IS_LINKED(ob) && ob->proxy_from) { - // printf("ob proxy copy, lib ob %s proxy %s\n", ob->id.name, ob->proxy_from->id.name); - if (ob->proxy_from->proxy_group) { /* transform proxy into group space */ - Object *obg = ob->proxy_from->proxy_group; - float imat[4][4]; - invert_m4_m4(imat, obg->obmat); - mul_m4_m4m4(ob->obmat, imat, ob->proxy_from->obmat); - if (obg->dup_group) { /* should always be true */ - add_v3_v3(ob->obmat[3], obg->dup_group->dupli_ofs); - } - } - else - copy_m4_m4(ob->obmat, ob->proxy_from->obmat); - } - else - BKE_object_where_is_calc_ex(eval_ctx, scene, rbw, ob, NULL); + } + /* XXX new animsys warning: depsgraph tag OB_RECALC_DATA should not skip drivers, + * which is only in BKE_object_where_is_calc now */ + /* XXX: should this case be OB_RECALC_OB instead? */ + if (ob->recalc & OB_RECALC_ALL) { + if (G.debug & G_DEBUG_DEPSGRAPH) { + printf("recalcob %s\n", ob->id.name + 2); } - - if (ob->recalc & OB_RECALC_DATA) { - BKE_object_handle_data_update(eval_ctx, scene, ob); + /* Handle proxy copy for target. */ + if (!BKE_object_eval_proxy_copy(eval_ctx, ob)) { + BKE_object_where_is_calc_ex(eval_ctx, scene, rbw, ob, NULL); } + } - ob->recalc &= ~OB_RECALC_ALL; + if (ob->recalc & OB_RECALC_DATA) { + BKE_object_handle_data_update(eval_ctx, scene, ob); } - /* the case when this is a group proxy, object_update is called in group.c */ - if (ob->proxy) { - /* set pointer in library proxy target, for copying, but restore it */ - ob->proxy->proxy_from = ob; - // printf("set proxy pointer for later group stuff %s\n", ob->id.name); + ob->recalc &= ~OB_RECALC_ALL; - /* the no-group proxy case, we call update */ - if (ob->proxy_group == NULL) { - if (do_proxy_update) { - // printf("call update, lib ob %s proxy %s\n", ob->proxy->id.name, ob->id.name); - BKE_object_handle_update(eval_ctx, scene, ob->proxy); - } - } - } + object_handle_update_proxy(eval_ctx, scene, ob, do_proxy_update); } + /* WARNING: "scene" here may not be the scene object actually resides in. * When dealing with background-sets, "scene" is actually the active scene. * e.g. "scene" <-- set 1 <-- set 2 ("ob" lives here) <-- set 3 <-- ... <-- set n diff --git a/source/blender/blenkernel/intern/object_update.c b/source/blender/blenkernel/intern/object_update.c index 1e8de416ea9..f5f521e119d 100644 --- a/source/blender/blenkernel/intern/object_update.c +++ b/source/blender/blenkernel/intern/object_update.c @@ -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,6 +393,22 @@ 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(const 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); +} + void BKE_object_eval_update_shading(const EvaluationContext *UNUSED(eval_ctx), Object *object) { |