[Bf-blender-cvs] [f379bb368bf] master: BLI: fix float3 in-place operators

Jacques Lucke noreply at git.blender.org
Fri Jul 31 11:17:42 CEST 2020


Commit: f379bb368bf57b97eb6b10a009ecb80cbc57159f
Author: Jacques Lucke
Date:   Fri Jul 31 11:17:21 2020 +0200
Branches: master
https://developer.blender.org/rBf379bb368bf57b97eb6b10a009ecb80cbc57159f

BLI: fix float3 in-place operators

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

M	source/blender/blenlib/BLI_float3.hh

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

diff --git a/source/blender/blenlib/BLI_float3.hh b/source/blender/blenlib/BLI_float3.hh
index a0979bc75bd..6acf4716525 100644
--- a/source/blender/blenlib/BLI_float3.hh
+++ b/source/blender/blenlib/BLI_float3.hh
@@ -63,11 +63,12 @@ struct float3 {
     return {a.x + b.x, a.y + b.y, a.z + b.z};
   }
 
-  void operator+=(const float3 &b)
+  float3 &operator+=(const float3 &b)
   {
     this->x += b.x;
     this->y += b.y;
     this->z += b.z;
+    return *this;
   }
 
   friend float3 operator-(const float3 &a, const float3 &b)
@@ -80,25 +81,28 @@ struct float3 {
     return {-a.x, -a.y, -a.z};
   }
 
-  void operator-=(const float3 &b)
+  float3 &operator-=(const float3 &b)
   {
     this->x -= b.x;
     this->y -= b.y;
     this->z -= b.z;
+    return *this;
   }
 
-  void operator*=(float scalar)
+  float3 &operator*=(float scalar)
   {
     this->x *= scalar;
     this->y *= scalar;
     this->z *= scalar;
+    return *this;
   }
 
-  void operator*=(const float3 &other)
+  float3 &operator*=(const float3 &other)
   {
     this->x *= other.x;
     this->y *= other.y;
     this->z *= other.z;
+    return *this;
   }
 
   friend float3 operator*(const float3 &a, const float3 &b)



More information about the Bf-blender-cvs mailing list