Mercurial > MadButterfly
comparison pyink/frameline.py @ 1535:9aff42a7e2b9 tip
Fix issue of add/remove a frame at a scene before all key frames of a layer.
When you added or removed a frame at a scene before all key frames of
a layer, frameline was not updated correctly. It seems nothing
happened, but domview is updated. This changeset fix this issue by
correcting logic for boundary case.
author | Thinker K.F. Li <thinker@codemud.net> |
---|---|
date | Fri, 30 Sep 2011 22:07:28 +0800 |
parents | 45e9566ea5c0 |
children |
comparison
equal
deleted
inserted
replaced
1534:199ba528fd4a | 1535:9aff42a7e2b9 |
---|---|
692 if key.idx == idx: | 692 if key.idx == idx: |
693 self.unmark_keyframe(idx) | 693 self.unmark_keyframe(idx) |
694 else: | 694 else: |
695 pos = pos + 1 | 695 pos = pos + 1 |
696 pass | 696 pass |
697 | 697 pass |
698 while pos < len(self._keys): | 698 else: |
699 key = self._keys[pos] | 699 pos = 0 |
700 key.idx = key.idx - 1 | 700 pass |
701 pos = pos + 1 | 701 |
702 pass | 702 while pos < len(self._keys): |
703 key = self._keys[pos] | |
704 key.idx = key.idx - 1 | |
705 pos = pos + 1 | |
703 pass | 706 pass |
704 | 707 |
705 self._draw_all_frames() | 708 self._draw_all_frames() |
706 self._draw_active_frame() | 709 self._draw_active_frame() |
707 pass | 710 pass |
708 | 711 |
709 ## \brief Inser a frame before given frame. | 712 ## \brief Insert a frame before given frame. |
710 # | 713 # |
711 # All frame at and after given frame position move to tail in one position. | 714 # All frame at and after given frame position move to tail in one position. |
712 # It means to add one to positions of all key frames at/after given frame. | 715 # It means to add one to positions of all key frames at/after given frame. |
713 # | 716 # |
714 def add_frame(self,idx): | 717 def add_frame(self,idx): |
716 if pos != -1: | 719 if pos != -1: |
717 key = self._keys[pos] | 720 key = self._keys[pos] |
718 if key.idx != idx: | 721 if key.idx != idx: |
719 pos = pos + 1 | 722 pos = pos + 1 |
720 pass | 723 pass |
721 | 724 pass |
722 while pos < len(self._keys): | 725 else: |
723 key = self._keys[pos] | 726 pos = 0 |
724 key.idx = key.idx + 1 | 727 pass |
725 pos = pos + 1 | 728 |
726 pass | 729 while pos < len(self._keys): |
730 key = self._keys[pos] | |
731 key.idx = key.idx + 1 | |
732 pos = pos + 1 | |
727 pass | 733 pass |
728 | 734 |
729 self._draw_all_frames() | 735 self._draw_all_frames() |
730 self._draw_active_frame() | 736 self._draw_active_frame() |
731 pass | 737 pass |