diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-06-22 08:54:55 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-06-22 08:55:49 +0300 |
commit | 2e80279a75bc5cdce0be52b53286688b126bcd40 (patch) | |
tree | cda8f3d27a4842ec0514888d810ca56ac4b83845 /source/blender/blenkernel/intern/object.c | |
parent | 84ae0fe3a5f5707a5ff658292fefcfc5f9cf04b8 (diff) |
Fix T55547: "Fit camera to selected" fails
Diffstat (limited to 'source/blender/blenkernel/intern/object.c')
-rw-r--r-- | source/blender/blenkernel/intern/object.c | 45 |
1 files changed, 15 insertions, 30 deletions
diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index b389e211e00..b3b7139a78c 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -2530,13 +2530,11 @@ void BKE_object_foreach_display_point( { float co[3]; - if (ob->derivedFinal) { - DerivedMesh *dm = ob->derivedFinal; - MVert *mv = dm->getVertArray(dm); - int totvert = dm->getNumVerts(dm); - int i; - - for (i = 0; i < totvert; i++, mv++) { + if (ob->runtime.mesh_eval) { + const Mesh *me = ob->runtime.mesh_eval; + const MVert *mv = me->mvert; + const int totvert = me->totvert; + for (int i = 0; i < totvert; i++, mv++) { mul_v3_m4v3(co, obmat, mv->co); func_cb(co, user_data); } @@ -2558,33 +2556,20 @@ void BKE_object_foreach_display_point( } void BKE_scene_foreach_display_point( - Depsgraph *depsgraph, Scene *scene, ViewLayer *view_layer, + Depsgraph *depsgraph, void (*func_cb)(const float[3], void *), void *user_data) { - Base *base; - Object *ob; - - for (base = FIRSTBASE(view_layer); base; base = base->next) { - if (((base->flag & BASE_VISIBLED) != 0) && ((base->flag & BASE_SELECTED) != 0)) { - ob = base->object; - - if ((ob->transflag & OB_DUPLI) == 0) { - BKE_object_foreach_display_point(ob, ob->obmat, func_cb, user_data); - } - else { - ListBase *lb; - DupliObject *dob; - - 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); - } - } - free_object_duplilist(lb); /* does restore */ - } + DEG_OBJECT_ITER_BEGIN( + depsgraph, ob, + DEG_ITER_OBJECT_FLAG_LINKED_DIRECTLY | + DEG_ITER_OBJECT_FLAG_VISIBLE | + DEG_ITER_OBJECT_FLAG_DUPLI) + { + if ((ob->base_flag & BASE_SELECTED) != 0) { + BKE_object_foreach_display_point(ob, ob->obmat, func_cb, user_data); } } + DEG_OBJECT_ITER_END; } /* copied from DNA_object_types.h */ |