comparison pyink/frameline.py @ 1247:45e9566ea5c0

Fix bugs of inserting/removing frames. - tracking layer.scenes when add/remove scene nodes. - fix buggy add_frame()/rm_frame() of frameline. - change ID of nodes before inserting when copy nodes from another group.
author Thinker K.F. Li <thinker@codemud.net>
date Mon, 10 Jan 2011 22:15:16 +0800
parents e64f5bd2270c
children 9aff42a7e2b9
comparison
equal deleted inserted replaced
1246:42c4874c8d1e 1247:45e9566ea5c0
689 pos = self._find_keyframe_floor(idx) 689 pos = self._find_keyframe_floor(idx)
690 if pos != -1: 690 if pos != -1:
691 key = self._keys[pos] 691 key = self._keys[pos]
692 if key.idx == idx: 692 if key.idx == idx:
693 self.unmark_keyframe(idx) 693 self.unmark_keyframe(idx)
694 else:
695 pos = pos + 1
694 pass 696 pass
695 697
696 while pos < len(self._keys): 698 while pos < len(self._keys):
697 self._keys[pos].idx = self._keys[pos].idx - 1 699 key = self._keys[pos]
698 pos = pos+1 700 key.idx = key.idx - 1
701 pos = pos + 1
699 pass 702 pass
700 pass 703 pass
704
705 self._draw_all_frames()
706 self._draw_active_frame()
701 pass 707 pass
702 708
703 ## \brief Inser a frame before given frame. 709 ## \brief Inser a frame before given frame.
704 # 710 #
705 # All frame at and after given frame position move to tail in one position. 711 # All frame at and after given frame position move to tail in one position.
707 # 713 #
708 def add_frame(self,idx): 714 def add_frame(self,idx):
709 pos = self._find_keyframe_floor(idx) 715 pos = self._find_keyframe_floor(idx)
710 if pos != -1: 716 if pos != -1:
711 key = self._keys[pos] 717 key = self._keys[pos]
712 if key.idx == idx: 718 if key.idx != idx:
713 pos = pos + 1 719 pos = pos + 1
714 pass 720 pass
721
715 while pos < len(self._keys): 722 while pos < len(self._keys):
716 key = self._keys[pos] 723 key = self._keys[pos]
717 key.idx = key.idx + 1 724 key.idx = key.idx + 1
718 pos = pos + 1 725 pos = pos + 1
719 pass 726 pass
720 pass 727 pass
728
729 self._draw_all_frames()
730 self._draw_active_frame()
721 pass 731 pass
722 732
723 def unmark_keyframe(self, idx): 733 def unmark_keyframe(self, idx):
724 key_pos = self._find_keyframe(idx) 734 key_pos = self._find_keyframe(idx)
725 key = self._keys[key_pos] 735 key = self._keys[key_pos]