423 {
424 int flag, res, removed = 0;
425 KeyframeEntry entry;
426
427
428 for (entry = _keyRoot.
_next.
_next; entry != _keyRoot; entry = entry.
_next)
429 {
430 flag = res = 0;
431
432 if (entry._prev == _keyRoot)
433 {
434 if (entry._next != _keyRoot)
435 {
436 flag = 1;
437 }
438 }
439 else if (entry._next == _keyRoot)
440 {
441 flag = 2;
442 }
443 else
444 {
445 flag = 3;
446 }
447
448 if ((flag & 1) != 0)
449 {
450 res |= Math.Abs(entry._next._value - entry._value) <= _cleanDistance ? 1 : 0;
451 }
452
453 if ((flag & 2) != 0)
454 {
455 res |= Math.Abs(entry._prev._value - entry._value) <= _cleanDistance ? 2 : 0;
456 }
457
458 if (flag == res && res != 0)
459 {
460 entry = entry._prev;
461 entry._next.Remove();
462
463 entry.GenerateTangent();
464 entry._next.GenerateTangent();
465 entry._prev.GenerateTangent();
466
467 _keyCount--;
468 removed++;
469 }
470 }
471
472 return removed;
473 }
KeyframeEntry _next
Definition: KeyframeCollection.cs:195