diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2018-11-21 17:02:36 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2018-11-21 17:04:18 +0300 |
commit | 5e4ed2793b9bec3b45830106f83c5bfffa810453 (patch) | |
tree | f34299646fbb0d146aa0f70002366fab7a4aa4d6 /source/blender/blenkernel/intern/object_update.c | |
parent | b6693f1f544a97fa2325c142d05e82fa60b63b27 (diff) |
Depsgraph: Move boundbox sync to the post-geometry evaluation
Boundbox does not depend on transform and only need geometry
component.
This change solves possible race condition accessing geometry
data and allocating/assigning pointers.
Based on disacussion in IRC with @mano-wii and @brecht.
Diffstat (limited to 'source/blender/blenkernel/intern/object_update.c')
-rw-r--r-- | source/blender/blenkernel/intern/object_update.c | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/source/blender/blenkernel/intern/object_update.c b/source/blender/blenkernel/intern/object_update.c index ea6466bf80e..dc144f48b05 100644 --- a/source/blender/blenkernel/intern/object_update.c +++ b/source/blender/blenkernel/intern/object_update.c @@ -149,14 +149,6 @@ void BKE_object_eval_transform_final(Depsgraph *depsgraph, Object *ob) copy_m4_m4(ob_orig->constinv, ob->constinv); ob_orig->transflag = ob->transflag; ob_orig->flag = ob->flag; - - BoundBox *bb = BKE_object_boundbox_get(ob); - if (bb != NULL) { - if (ob_orig->bb == NULL) { - ob_orig->bb = MEM_mallocN(sizeof(*ob_orig->bb), __func__); - } - *ob_orig->bb = *bb; - } } } @@ -276,8 +268,22 @@ void BKE_object_handle_data_update( psys = psys->next; } } + BKE_object_eval_boundbox(depsgraph, ob); +} - /* quick cache removed */ +void BKE_object_eval_boundbox(Depsgraph *depsgraph, Object *object) +{ + if (!DEG_is_active(depsgraph)) { + return; + } + Object *ob_orig = DEG_get_original_object(object); + BoundBox *bb = BKE_object_boundbox_get(object); + if (bb != NULL) { + if (ob_orig->bb == NULL) { + ob_orig->bb = MEM_mallocN(sizeof(*ob_orig->bb), __func__); + } + *ob_orig->bb = *bb; + } } bool BKE_object_eval_proxy_copy(Depsgraph *depsgraph, |