Skip to content

Commit 5f7766e

Browse files
committed
Keyframe::RemovePoint() only set needs_update if a point was removed
1 parent 6226e9d commit 5f7766e

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

src/KeyFrame.cpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -550,9 +550,6 @@ int64_t Keyframe::GetCount() {
550550

551551
// Remove a point by matching a coordinate
552552
void Keyframe::RemovePoint(Point p) {
553-
// mark as dirty
554-
needs_update = true;
555-
556553
// loop through points, and find a matching coordinate
557554
for (int64_t x = 0; x < Points.size(); x++) {
558555
// Get each point
@@ -562,6 +559,8 @@ void Keyframe::RemovePoint(Point p) {
562559
if (p.co.X == existing_point.co.X && p.co.Y == existing_point.co.Y) {
563560
// Remove the matching point, and break out of loop
564561
Points.erase(Points.begin() + x);
562+
// mark as dirty
563+
needs_update = true;
565564
return;
566565
}
567566
}
@@ -572,12 +571,11 @@ void Keyframe::RemovePoint(Point p) {
572571

573572
// Remove a point by index
574573
void Keyframe::RemovePoint(int64_t index) {
575-
// mark as dirty
576-
needs_update = true;
577-
578574
// Is index a valid point?
579575
if (index >= 0 && index < Points.size())
580576
{
577+
// mark as dirty
578+
needs_update = true;
581579
// Remove a specific point by index
582580
Points.erase(Points.begin() + index);
583581
}

0 commit comments

Comments
 (0)