diff options
author | Hans Goudey <h.goudey@me.com> | 2022-02-08 03:42:58 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2022-02-08 03:42:58 +0300 |
commit | e5fc579073a4c15fe2c5aa74604ec16dcbc618ff (patch) | |
tree | c16bc7833e1535a920589d9681a81dc152b0ade0 | |
parent | 770793e545a42cff0ccc5d67a9f79a3a845e650f (diff) | |
parent | b76918717dbfd8363f4cf114619861dac0110e52 (diff) |
Merge branch 'blender-v3.1-release'
-rw-r--r-- | source/blender/blenkernel/intern/curve.cc | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/source/blender/blenkernel/intern/curve.cc b/source/blender/blenkernel/intern/curve.cc index dda2b5076a8..f83a672b2ee 100644 --- a/source/blender/blenkernel/intern/curve.cc +++ b/source/blender/blenkernel/intern/curve.cc @@ -32,6 +32,7 @@ #include "BLI_ghash.h" #include "BLI_index_range.hh" #include "BLI_math.h" +#include "BLI_math_vec_types.hh" #include "BLI_utildefines.h" #include "BLT_translation.h" @@ -59,6 +60,7 @@ #include "BKE_lib_query.h" #include "BKE_main.h" #include "BKE_object.h" +#include "BKE_spline.hh" #include "BKE_vfont.h" #include "DEG_depsgraph.h" @@ -68,6 +70,7 @@ #include "BLO_read_write.h" +using blender::float3; using blender::IndexRange; /* globals */ @@ -503,7 +506,10 @@ BoundBox *BKE_curve_boundbox_get(Object *ob) float min[3], max[3]; INIT_MINMAX(min, max); - BKE_curve_minmax(cu, true, min, max); + if (!BKE_curve_minmax(cu, true, min, max)) { + copy_v3_fl(min, -1.0f); + copy_v3_fl(max, 1.0f); + } if (ob->runtime.bb == nullptr) { ob->runtime.bb = (BoundBox *)MEM_mallocN(sizeof(*ob->runtime.bb), __func__); @@ -5066,6 +5072,16 @@ void BKE_curve_nurb_vert_active_validate(Curve *cu) bool BKE_curve_minmax(Curve *cu, bool use_radius, float min[3], float max[3]) { + if (cu->curve_eval != nullptr) { + float3 eval_min(FLT_MAX); + float3 eval_max(-FLT_MAX); + if (cu->curve_eval->bounds_min_max(eval_min, eval_max, false)) { + copy_v3_v3(min, eval_min); + copy_v3_v3(max, eval_max); + return true; + } + } + ListBase *nurb_lb = BKE_curve_nurbs_get(cu); ListBase temp_nurb_lb = {nullptr, nullptr}; const bool is_font = (BLI_listbase_is_empty(nurb_lb)) && (cu->len != 0); |