diff options
author | mano-wii <germano.costa@ig.com.br> | 2018-11-19 13:54:49 +0300 |
---|---|---|
committer | mano-wii <germano.costa@ig.com.br> | 2018-11-19 14:05:20 +0300 |
commit | 24677cf77bbd97827bb5789bc1e4d883732a59da (patch) | |
tree | 9831c80837f733937d494481cbb3c6f85e559981 /source/blender/blenkernel/intern/displist.c | |
parent | de231887b44fd867a5ee2de1a6a0c58635d71abf (diff) |
BKE object: Correct bound box of bezier curve objects not matching the object viewed.
Diffstat (limited to 'source/blender/blenkernel/intern/displist.c')
-rw-r--r-- | source/blender/blenkernel/intern/displist.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/displist.c b/source/blender/blenkernel/intern/displist.c index 8d49521831f..3339118f8e3 100644 --- a/source/blender/blenkernel/intern/displist.c +++ b/source/blender/blenkernel/intern/displist.c @@ -65,10 +65,13 @@ #include "BKE_modifier.h" #include "BLI_sys_types.h" // for intptr_t support +#include "BLI_threads.h" #include "DEG_depsgraph.h" #include "DEG_depsgraph_query.h" +static ThreadRWMutex cache_rwlock = BLI_RWLOCK_INITIALIZER; + static void boundbox_displist_object(Object *ob); void BKE_displist_elem_free(DispList *dl) @@ -1798,6 +1801,7 @@ void BKE_displist_make_curveTypes(Depsgraph *depsgraph, Scene *scene, Object *ob if (!ELEM(ob->type, OB_SURF, OB_CURVE, OB_FONT)) return; + BLI_rw_mutex_lock(&cache_rwlock, THREAD_LOCK_WRITE); BKE_object_free_derived_caches(ob); if (!ob->runtime.curve_cache) { @@ -1809,6 +1813,7 @@ void BKE_displist_make_curveTypes(Depsgraph *depsgraph, Scene *scene, Object *ob do_makeDispListCurveTypes(depsgraph, scene, ob, dispbase, &ob->runtime.mesh_eval, 0, for_orco, 0); boundbox_displist_object(ob); + BLI_rw_mutex_unlock(&cache_rwlock); } void BKE_displist_make_curveTypes_forRender( @@ -1882,3 +1887,16 @@ static void boundbox_displist_object(Object *ob) } } } + +BoundBox *BKE_displist_boundbox_get(struct Object *ob) +{ + BLI_rw_mutex_lock(&cache_rwlock, THREAD_LOCK_READ); + if ((ob->bb == NULL) || (ob->bb->flag & BOUNDBOX_DIRTY)) { + /* This should always only be called with evaluated objects, but currently RNA is a problem here... */ + if (ob->runtime.curve_cache != NULL) { + boundbox_displist_object(ob); + } + } + BLI_rw_mutex_unlock(&cache_rwlock); + return ob->bb; +} |