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:
authorBrecht Van Lommel <brechtvanlommel@gmail.com>2018-04-06 13:07:27 +0300
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2018-04-16 20:55:33 +0300
commit34ab90f546f097cada951b2c9ca22bf271996980 (patch)
treeebcdb3d37120ac1d8fb16462b9104badd1800329 /source/blender/blenkernel/intern/object.c
parent0c495005dd83913864acb510c1d4194a2275dbb0 (diff)
Depsgraph: remove EvaluationContext, pass Depsgraph instead.
The depsgraph was always created within a fixed evaluation context. Passing both risks the depsgraph and evaluation context not matching, and it complicates the Python API where we'd have to expose both which is not so easy to understand. This also removes the global evaluation context in main, which assumed there to be a single active scene and view layer. Differential Revision: https://developer.blender.org/D3152
Diffstat (limited to 'source/blender/blenkernel/intern/object.c')
-rw-r--r--source/blender/blenkernel/intern/object.c64
1 files changed, 32 insertions, 32 deletions
diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c
index 081f9f15508..f59a942c683 100644
--- a/source/blender/blenkernel/intern/object.c
+++ b/source/blender/blenkernel/intern/object.c
@@ -1826,7 +1826,7 @@ static bool ob_parcurve(Scene *scene, Object *ob, Object *par, float mat[4][4])
if (scene == NULL) {
return false;
}
- BKE_displist_make_curveTypes(eval_ctx, scene, par, 0);
+ BKE_displist_make_curveTypes(depsgraph, scene, par, 0);
}
#endif
@@ -2210,7 +2210,7 @@ static bool 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(
- const EvaluationContext *eval_ctx, Scene *scene, Object *ob, float ctime,
+ Depsgraph *depsgraph, Scene *scene, Object *ob, float ctime,
RigidBodyWorld *rbw, float r_originmat[3][3])
{
if (ob == NULL) return;
@@ -2246,7 +2246,7 @@ void BKE_object_where_is_calc_time_ex(
if (ob->constraints.first && !(ob->transflag & OB_NO_CONSTRAINTS)) {
bConstraintOb *cob;
cob = BKE_constraints_make_evalob(scene, ob, NULL, CONSTRAINT_OBTYPE_OBJECT);
- BKE_constraints_solve(eval_ctx, &ob->constraints, cob, ctime);
+ BKE_constraints_solve(depsgraph, &ob->constraints, cob, ctime);
BKE_constraints_clear_evalob(cob);
}
@@ -2255,9 +2255,9 @@ void BKE_object_where_is_calc_time_ex(
else ob->transflag &= ~OB_NEG_SCALE;
}
-void BKE_object_where_is_calc_time(const EvaluationContext *eval_ctx, Scene *scene, Object *ob, float ctime)
+void BKE_object_where_is_calc_time(Depsgraph *depsgraph, Scene *scene, Object *ob, float ctime)
{
- BKE_object_where_is_calc_time_ex(eval_ctx, scene, ob, ctime, NULL, NULL);
+ BKE_object_where_is_calc_time_ex(depsgraph, scene, ob, ctime, NULL, NULL);
}
/* get object transformation matrix without recalculating dependencies and
@@ -2282,17 +2282,17 @@ void BKE_object_where_is_calc_mat4(Scene *scene, Object *ob, float obmat[4][4])
}
}
-void BKE_object_where_is_calc_ex(const EvaluationContext *eval_ctx, Scene *scene, RigidBodyWorld *rbw, Object *ob, float r_originmat[3][3])
+void BKE_object_where_is_calc_ex(Depsgraph *depsgraph, Scene *scene, RigidBodyWorld *rbw, Object *ob, float r_originmat[3][3])
{
- BKE_object_where_is_calc_time_ex(eval_ctx, scene, ob, BKE_scene_frame_get(scene), rbw, r_originmat);
+ BKE_object_where_is_calc_time_ex(depsgraph, scene, ob, BKE_scene_frame_get(scene), rbw, r_originmat);
}
-void BKE_object_where_is_calc(const EvaluationContext *eval_ctx, Scene *scene, Object *ob)
+void BKE_object_where_is_calc(Depsgraph *depsgraph, Scene *scene, Object *ob)
{
- BKE_object_where_is_calc_time_ex(eval_ctx, scene, ob, BKE_scene_frame_get(scene), NULL, NULL);
+ BKE_object_where_is_calc_time_ex(depsgraph, scene, ob, BKE_scene_frame_get(scene), NULL, NULL);
}
/* for calculation of the inverse parent transform, only used for editor */
-void BKE_object_workob_calc_parent(const EvaluationContext *eval_ctx, Scene *scene, Object *ob, Object *workob)
+void BKE_object_workob_calc_parent(Depsgraph *depsgraph, Scene *scene, Object *ob, Object *workob)
{
BKE_object_workob_clear(workob);
@@ -2314,7 +2314,7 @@ void BKE_object_workob_calc_parent(const EvaluationContext *eval_ctx, Scene *sce
BLI_strncpy(workob->parsubstr, ob->parsubstr, sizeof(workob->parsubstr));
- BKE_object_where_is_calc(eval_ctx, scene, workob);
+ BKE_object_where_is_calc(depsgraph, scene, workob);
}
/* see BKE_pchan_apply_mat4() for the equivalent 'pchan' function */
@@ -2570,7 +2570,7 @@ void BKE_object_empty_draw_type_set(Object *ob, const int value)
}
}
-bool BKE_object_minmax_dupli(Scene *scene, Object *ob, float r_min[3], float r_max[3], const bool use_hidden)
+bool BKE_object_minmax_dupli(Depsgraph *depsgraph, Scene *scene, Object *ob, float r_min[3], float r_max[3], const bool use_hidden)
{
bool ok = false;
if ((ob->transflag & OB_DUPLI) == 0) {
@@ -2579,7 +2579,7 @@ bool BKE_object_minmax_dupli(Scene *scene, Object *ob, float r_min[3], float r_m
else {
ListBase *lb;
DupliObject *dob;
- lb = object_duplilist(G.main->eval_ctx, scene, ob);
+ lb = object_duplilist(depsgraph, scene, ob);
for (dob = lb->first; dob; dob = dob->next) {
if ((use_hidden == false) && (dob->no_draw != 0)) {
/* pass */
@@ -2639,7 +2639,7 @@ void BKE_object_foreach_display_point(
}
void BKE_scene_foreach_display_point(
- Scene *scene, ViewLayer *view_layer,
+ Depsgraph *depsgraph, Scene *scene, ViewLayer *view_layer,
void (*func_cb)(const float[3], void *), void *user_data)
{
Base *base;
@@ -2656,7 +2656,7 @@ void BKE_scene_foreach_display_point(
ListBase *lb;
DupliObject *dob;
- lb = object_duplilist(G.main->eval_ctx, scene, ob);
+ lb = object_duplilist(depsgraph, scene, ob);
for (dob = lb->first; dob; dob = dob->next) {
if (dob->no_draw == 0) {
BKE_object_foreach_display_point(dob->ob, dob->mat, func_cb, user_data);
@@ -2736,7 +2736,7 @@ 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,
+static void object_handle_update_proxy(Depsgraph *depsgraph,
Scene *scene,
Object *object,
const bool do_proxy_update)
@@ -2753,7 +2753,7 @@ static void object_handle_update_proxy(const EvaluationContext *eval_ctx,
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);
+ BKE_object_handle_update(depsgraph, scene, object->proxy);
}
}
}
@@ -2766,7 +2766,7 @@ static void object_handle_update_proxy(const EvaluationContext *eval_ctx,
/* the main object update call, for object matrix, constraints, keys and displist (modifiers) */
/* requires flags to be set! */
/* Ideally we shouldn't have to pass the rigid body world, but need bigger restructuring to avoid id */
-void BKE_object_handle_update_ex(const EvaluationContext *eval_ctx,
+void BKE_object_handle_update_ex(Depsgraph *depsgraph,
Scene *scene, Object *ob,
RigidBodyWorld *rbw,
const bool do_proxy_update)
@@ -2777,7 +2777,7 @@ void BKE_object_handle_update_ex(const EvaluationContext *eval_ctx,
(object_data != NULL) ? ((object_data->recalc & ID_RECALC_ALL) != 0)
: 0;
if (!recalc_object && ! recalc_data) {
- object_handle_update_proxy(eval_ctx, scene, ob, do_proxy_update);
+ object_handle_update_proxy(depsgraph, scene, ob, do_proxy_update);
return;
}
/* Speed optimization for animation lookups. */
@@ -2805,18 +2805,18 @@ void BKE_object_handle_update_ex(const EvaluationContext *eval_ctx,
printf("recalcob %s\n", ob->id.name + 2);
}
/* 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);
+ if (!BKE_object_eval_proxy_copy(depsgraph, ob)) {
+ BKE_object_where_is_calc_ex(depsgraph, scene, rbw, ob, NULL);
}
}
if (recalc_data) {
- BKE_object_handle_data_update(eval_ctx, scene, ob);
+ BKE_object_handle_data_update(depsgraph, scene, ob);
}
ob->id.recalc &= ID_RECALC_ALL;
- object_handle_update_proxy(eval_ctx, scene, ob, do_proxy_update);
+ object_handle_update_proxy(depsgraph, scene, ob, do_proxy_update);
}
/* WARNING: "scene" here may not be the scene object actually resides in.
@@ -2824,9 +2824,9 @@ void BKE_object_handle_update_ex(const EvaluationContext *eval_ctx,
* e.g. "scene" <-- set 1 <-- set 2 ("ob" lives here) <-- set 3 <-- ... <-- set n
* rigid bodies depend on their world so use BKE_object_handle_update_ex() to also pass along the corrent rigid body world
*/
-void BKE_object_handle_update(const EvaluationContext *eval_ctx, Scene *scene, Object *ob)
+void BKE_object_handle_update(Depsgraph *depsgraph, Scene *scene, Object *ob)
{
- BKE_object_handle_update_ex(eval_ctx, scene, ob, NULL, true);
+ BKE_object_handle_update_ex(depsgraph, scene, ob, NULL, true);
}
void BKE_object_sculpt_modifiers_changed(Object *ob)
@@ -3744,7 +3744,7 @@ static void object_cacheIgnoreClear(Object *ob, int state)
* Avoid calling this in new code unless there is a very good reason for it!
*/
bool BKE_object_modifier_update_subframe(
- const EvaluationContext *eval_ctx, Scene *scene, Object *ob, bool update_mesh,
+ Depsgraph *depsgraph, Scene *scene, Object *ob, bool update_mesh,
int parent_recursion, float frame, int type)
{
ModifierData *md = modifiers_findByType(ob, (ModifierType)type);
@@ -3768,8 +3768,8 @@ bool BKE_object_modifier_update_subframe(
if (parent_recursion) {
int recursion = parent_recursion - 1;
bool no_update = false;
- if (ob->parent) no_update |= BKE_object_modifier_update_subframe(eval_ctx, scene, ob->parent, 0, recursion, frame, type);
- if (ob->track) no_update |= BKE_object_modifier_update_subframe(eval_ctx, scene, ob->track, 0, recursion, frame, type);
+ if (ob->parent) no_update |= BKE_object_modifier_update_subframe(depsgraph, scene, ob->parent, 0, recursion, frame, type);
+ if (ob->track) no_update |= BKE_object_modifier_update_subframe(depsgraph, scene, ob->track, 0, recursion, frame, type);
/* skip subframe if object is parented
* to vertex of a dynamic paint canvas */
@@ -3786,7 +3786,7 @@ bool BKE_object_modifier_update_subframe(
cti->get_constraint_targets(con, &targets);
for (ct = targets.first; ct; ct = ct->next) {
if (ct->tar)
- BKE_object_modifier_update_subframe(eval_ctx, scene, ct->tar, 0, recursion, frame, type);
+ BKE_object_modifier_update_subframe(depsgraph, scene, ct->tar, 0, recursion, frame, type);
}
/* free temp targets */
if (cti->flush_constraint_targets)
@@ -3803,11 +3803,11 @@ bool BKE_object_modifier_update_subframe(
/* ignore cache clear during subframe updates
* to not mess up cache validity */
object_cacheIgnoreClear(ob, 1);
- BKE_object_handle_update(G.main->eval_ctx, scene, ob);
+ BKE_object_handle_update(depsgraph, scene, ob);
object_cacheIgnoreClear(ob, 0);
}
else
- BKE_object_where_is_calc_time(eval_ctx, scene, ob, frame);
+ BKE_object_where_is_calc_time(depsgraph, scene, ob, frame);
/* for curve following objects, parented curve has to be updated too */
if (ob->type == OB_CURVE) {
@@ -3818,7 +3818,7 @@ bool BKE_object_modifier_update_subframe(
if (ob->type == OB_ARMATURE) {
bArmature *arm = ob->data;
BKE_animsys_evaluate_animdata(scene, &arm->id, arm->adt, frame, ADT_RECALC_ANIM);
- BKE_pose_where_is(eval_ctx, scene, ob);
+ BKE_pose_where_is(depsgraph, scene, ob);
}
return false;