[Bf-blender-cvs] [a8865f34025] master: Fix: Missing initialization curves bounds in set origin operator

Hans Goudey noreply at git.blender.org
Sun Nov 6 10:26:41 CET 2022


Commit: a8865f3402544808e0d89faa661b463058960bbd
Author: Hans Goudey
Date:   Sun Nov 6 10:22:05 2022 +0100
Branches: master
https://developer.blender.org/rBa8865f3402544808e0d89faa661b463058960bbd

Fix: Missing initialization curves bounds in set origin operator

It could be changed, but currently curves.bounds_min_max
relies on the initial value of its arguments. Split from D16331.

===================================================================

M	source/blender/editors/object/object_transform.cc

===================================================================

diff --git a/source/blender/editors/object/object_transform.cc b/source/blender/editors/object/object_transform.cc
index 0c2aca8b97b..7d0b62db827 100644
--- a/source/blender/editors/object/object_transform.cc
+++ b/source/blender/editors/object/object_transform.cc
@@ -7,6 +7,7 @@
 
 #include <cstdlib>
 #include <cstring>
+#include <limits>
 #include <numeric>
 
 #include "DNA_anim_types.h"
@@ -1643,8 +1644,8 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
         /* done */
       }
       else if (around == V3D_AROUND_CENTER_BOUNDS) {
-        float3 min;
-        float3 max;
+        float3 min(std::numeric_limits<float>::max());
+        float3 max(-std::numeric_limits<float>::max());
         if (curves.bounds_min_max(min, max)) {
           cent = math::midpoint(min, max);
         }



More information about the Bf-blender-cvs mailing list