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
This commit is contained in:
parent
52c3214776
commit
9de35e396b
Notes:
blender-bot
2023-02-14 00:44:02 +01:00
Referenced by issue #99125, Curve Mapping UI Template: All points disappear when two points gets too close
|
@ -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);
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Reference in New Issue