[Bf-blender-cvs] [8d77973dd76] master: Fix T99125: Curve mapping widget removes all vector points

Leon Schittek noreply at git.blender.org
Thu Nov 17 22:00:46 CET 2022


Commit: 8d77973dd76c4913ae394eedb633c9d307a92851
Author: Leon Schittek
Date:   Thu Nov 17 21:54:30 2022 +0100
Branches: master
https://developer.blender.org/rB8d77973dd76c4913ae394eedb633c9d307a92851

Fix T99125: Curve mapping widget removes all vector points

Add a new flag value `CUMA_REMOVE` to explicitly tag duplicate points
for removal. This prevents a bug where all curve points with vector
handles were deleted, when removing duplicate curve points while
updating the widget. This happened, because the flag value used to tag
points for removal was the same as the value of `CUMA_HANDLE_VECTOR`
used to store the handle type of the curve point.

Reviewed By: Hans Goudey

Differential Revision: http://developer.blender.org/D16463

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

M	source/blender/blenkernel/intern/colortools.c
M	source/blender/makesdna/DNA_color_types.h

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

diff --git a/source/blender/blenkernel/intern/colortools.c b/source/blender/blenkernel/intern/colortools.c
index 837eb892056..882abe6cc8d 100644
--- a/source/blender/blenkernel/intern/colortools.c
+++ b/source/blender/blenkernel/intern/colortools.c
@@ -908,13 +908,13 @@ void BKE_curvemapping_changed(CurveMapping *cumap, const bool rem_doubles)
       dy = cmp[a].y - cmp[a + 1].y;
       if (sqrtf(dx * dx + dy * dy) < thresh) {
         if (a == 0) {
-          cmp[a + 1].flag |= CUMA_HANDLE_VECTOR;
+          cmp[a + 1].flag |= CUMA_REMOVE;
           if (cmp[a + 1].flag & CUMA_SELECT) {
             cmp[a].flag |= CUMA_SELECT;
           }
         }
         else {
-          cmp[a].flag |= CUMA_HANDLE_VECTOR;
+          cmp[a].flag |= CUMA_REMOVE;
           if (cmp[a].flag & CUMA_SELECT) {
             cmp[a + 1].flag |= CUMA_SELECT;
           }
@@ -923,7 +923,7 @@ void BKE_curvemapping_changed(CurveMapping *cumap, const bool rem_doubles)
       }
     }
     if (a != cuma->totpoint - 1) {
-      BKE_curvemap_remove(cuma, 2);
+      BKE_curvemap_remove(cuma, CUMA_REMOVE);
     }
   }
   curvemap_make_table(cumap, cuma);
diff --git a/source/blender/makesdna/DNA_color_types.h b/source/blender/makesdna/DNA_color_types.h
index 4eb64290032..d3b7c37ab0e 100644
--- a/source/blender/makesdna/DNA_color_types.h
+++ b/source/blender/makesdna/DNA_color_types.h
@@ -35,6 +35,8 @@ enum {
   CUMA_SELECT = (1 << 0),
   CUMA_HANDLE_VECTOR = (1 << 1),
   CUMA_HANDLE_AUTO_ANIM = (1 << 2),
+  /** Temporary tag for point deletion. */
+  CUMA_REMOVE = (1 << 3),
 };
 
 typedef struct CurveMap {



More information about the Bf-blender-cvs mailing list