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:
authorGermano Cavalcante <germano.costa@ig.com.br>2021-11-24 20:32:19 +0300
committerGermano Cavalcante <germano.costa@ig.com.br>2021-11-24 20:52:49 +0300
commit752c6d668bcb9a6b357734f7e124a6b605ac9d9b (patch)
treed71416b6e6dade5806a69705e188429af63fe7ec /source/blender/blenkernel/intern/displist.cc
parent7a7ae4df436292345748ded71b2cefaf60a39fbd (diff)
Fix T90808: wrong BoundBox after undo curve selection
There are two functions that recalculate the boundbox of an object: - One that considers the evaluated geometry - Another that only considers the object's `data`. Most of the time, the bound box is calculated on the final object (with modifiers), so it doesn't seem right to just rely on `ob->data` to recalculate the `ob->runtime.bb`. Be sure to calculate the BoundBox based on the final geometry and only use `ob->data` as a fallback Differential Revision: https://developer.blender.org/D12282
Diffstat (limited to 'source/blender/blenkernel/intern/displist.cc')
-rw-r--r--source/blender/blenkernel/intern/displist.cc33
1 files changed, 3 insertions, 30 deletions
diff --git a/source/blender/blenkernel/intern/displist.cc b/source/blender/blenkernel/intern/displist.cc
index 0bf436aa8b2..f511bb2b65e 100644
--- a/source/blender/blenkernel/intern/displist.cc
+++ b/source/blender/blenkernel/intern/displist.cc
@@ -66,8 +66,6 @@
using blender::IndexRange;
-static void boundbox_displist_object(Object *ob);
-
static void displist_elem_free(DispList *dl)
{
if (dl) {
@@ -1528,7 +1526,9 @@ void BKE_displist_make_curveTypes(Depsgraph *depsgraph,
ob->runtime.geometry_set_eval = new GeometrySet(std::move(geometry));
}
- boundbox_displist_object(ob);
+ if (ob->runtime.bb) {
+ ob->runtime.bb->flag |= BOUNDBOX_DIRTY;
+ }
}
void BKE_displist_minmax(const ListBase *dispbase, float min[3], float max[3])
@@ -1551,30 +1551,3 @@ void BKE_displist_minmax(const ListBase *dispbase, float min[3], float max[3])
zero_v3(max);
}
}
-
-/* this is confusing, there's also min_max_object, applying the obmat... */
-static void boundbox_displist_object(Object *ob)
-{
- BLI_assert(ELEM(ob->type, OB_CURVE, OB_SURF, OB_FONT));
- /* Curve's BB is already calculated as a part of modifier stack,
- * here we only calculate object BB based on final display list. */
-
- /* object's BB is calculated from final displist */
- if (ob->runtime.bb == nullptr) {
- ob->runtime.bb = (BoundBox *)MEM_callocN(sizeof(BoundBox), __func__);
- }
-
- const Mesh *mesh_eval = BKE_object_get_evaluated_mesh(ob);
- if (mesh_eval) {
- BKE_object_boundbox_calc_from_mesh(ob, mesh_eval);
- }
- else {
- float min[3], max[3];
-
- INIT_MINMAX(min, max);
- BKE_displist_minmax(&ob->runtime.curve_cache->disp, min, max);
- BKE_boundbox_init_from_minmax(ob->runtime.bb, min, max);
-
- ob->runtime.bb->flag &= ~BOUNDBOX_DIRTY;
- }
-}