[Bf-blender-cvs] [18e386613c3] master: Attributes: Remove asserts for DefaultMixer negative weight

Iliya Katueshenock noreply at git.blender.org
Fri Dec 2 21:47:58 CET 2022


Commit: 18e386613c31fdec3cbc238e4481ed7b548b47ec
Author: Iliya Katueshenock
Date:   Fri Dec 2 14:44:54 2022 -0600
Branches: master
https://developer.blender.org/rB18e386613c31fdec3cbc238e4481ed7b548b47ec

Attributes: Remove asserts for DefaultMixer negative weight

The attribute smoothing node asks for the ability to have a factor
outside the range of 0 and 1. The problem with this is that there is a
negative weight assertion for some of the mixers. If mixing between 0
and 1, then at a factor of 2, one of the elements will be negative.

Differential Revision: https://developer.blender.org/D16351

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

M	source/blender/blenkernel/BKE_attribute_math.hh
M	source/blender/blenkernel/intern/attribute_math.cc

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

diff --git a/source/blender/blenkernel/BKE_attribute_math.hh b/source/blender/blenkernel/BKE_attribute_math.hh
index 5c0e5f428a4..9056356da4a 100644
--- a/source/blender/blenkernel/BKE_attribute_math.hh
+++ b/source/blender/blenkernel/BKE_attribute_math.hh
@@ -285,7 +285,6 @@ template<typename T> class SimpleMixer {
    */
   void set(const int64_t index, const T &value, const float weight = 1.0f)
   {
-    BLI_assert(weight >= 0.0f);
     buffer_[index] = value * weight;
     total_weights_[index] = weight;
   }
@@ -295,7 +294,6 @@ template<typename T> class SimpleMixer {
    */
   void mix_in(const int64_t index, const T &value, const float weight = 1.0f)
   {
-    BLI_assert(weight >= 0.0f);
     buffer_[index] += value * weight;
     total_weights_[index] += weight;
   }
diff --git a/source/blender/blenkernel/intern/attribute_math.cc b/source/blender/blenkernel/intern/attribute_math.cc
index d8102b4eeb8..68f05df3ce0 100644
--- a/source/blender/blenkernel/intern/attribute_math.cc
+++ b/source/blender/blenkernel/intern/attribute_math.cc
@@ -23,7 +23,6 @@ void ColorGeometry4fMixer::set(const int64_t index,
                                const ColorGeometry4f &color,
                                const float weight)
 {
-  BLI_assert(weight >= 0.0f);
   buffer_[index].r = color.r * weight;
   buffer_[index].g = color.g * weight;
   buffer_[index].b = color.b * weight;
@@ -35,7 +34,6 @@ void ColorGeometry4fMixer::mix_in(const int64_t index,
                                   const ColorGeometry4f &color,
                                   const float weight)
 {
-  BLI_assert(weight >= 0.0f);
   ColorGeometry4f &output_color = buffer_[index];
   output_color.r += color.r * weight;
   output_color.g += color.g * weight;
@@ -89,7 +87,6 @@ void ColorGeometry4bMixer::ColorGeometry4bMixer::set(int64_t index,
                                                      const ColorGeometry4b &color,
                                                      const float weight)
 {
-  BLI_assert(weight >= 0.0f);
   accumulation_buffer_[index][0] = color.r * weight;
   accumulation_buffer_[index][1] = color.g * weight;
   accumulation_buffer_[index][2] = color.b * weight;
@@ -99,7 +96,6 @@ void ColorGeometry4bMixer::ColorGeometry4bMixer::set(int64_t index,
 
 void ColorGeometry4bMixer::mix_in(int64_t index, const ColorGeometry4b &color, float weight)
 {
-  BLI_assert(weight >= 0.0f);
   float4 &accum_value = accumulation_buffer_[index];
   accum_value[0] += color.r * weight;
   accum_value[1] += color.g * weight;



More information about the Bf-blender-cvs mailing list