comparison pyink/frameline.py @ 1180:bfd7d466a022

Fix yeiling error message when select a scene. - It is caused by the buggy fixing of changeset #7d700e5f82ba for an eariler error of frameline.get_frame_block() - Fix frameline.get_frame_block() with correct logic and fix early code relied on the buggy fix.
author Thinker K.F. Li <thinker@codemud.net>
date Fri, 31 Dec 2010 11:31:18 +0800
parents 96a7abce774a
children 9d715956823a 0e3a65b7b00c
comparison
equal deleted inserted replaced
1179:b65df4f0d30a 1180:bfd7d466a022
706 self.update() 706 self.update()
707 else: 707 else:
708 return 708 return
709 pass 709 pass
710 pass 710 pass
711 pass 711
712 def rm_keyframe(self, idx): 712 def rm_keyframe(self, idx):
713 key_pos = self._find_keyframe(idx) 713 key_pos = self._find_keyframe(idx)
714 key = self._keys[key_pos] 714 key = self._keys[key_pos]
715 del self._keys[key_pos] 715 del self._keys[key_pos]
716 716
763 if key.idx == idx: 763 if key.idx == idx:
764 return key.right_tween_type 764 return key.right_tween_type
765 pass 765 pass
766 pass 766 pass
767 767
768 ## \bref Return range of blocks of conesequence frames (tweens).
769 #
770 # Return range and type of tweens and key frames that is not start or stop
771 # of a tween.
768 def get_frame_blocks(self): 772 def get_frame_blocks(self):
769 blocks = [] 773 blocks = []
770 for pos, key in enumerate(self._keys): 774 for pos, key in enumerate(self._keys):
771 if key.right_tween: 775 if key.right_tween:
772 next_key = self._keys[pos + 1] 776 next_key = self._keys[pos + 1]
777 continue 781 continue
778 blocks.append(block) 782 blocks.append(block)
779 pass 783 pass
780 return blocks 784 return blocks
781 785
786 ## \brief Return the range of a block of consequence frames (tween).
787 #
788 # - If the index frame is in a tween, it returns the range of the tween.
789 #
790 # - If the indexed frame is a key frame with no right_tween, returns the
791 # range that start and stop are both equivalent to idx.
792 #
793 # - Otherwise, raise an exception.
794 #
795 # \param idx is the index number of a frame.
796 # \return A tuple of (start, stop, tween_type)
797 #
782 def get_frame_block(self, idx): 798 def get_frame_block(self, idx):
783 pos = self._find_keyframe_floor(idx) 799 pos = self._find_keyframe_floor(idx)
784 if pos != -1: 800 if pos != -1:
785 key = self._keys[pos] 801 key = self._keys[pos]
786 print key.right_tween, key.left_tween 802 if key.right_tween:
787 if key.idx == idx:
788 return key.idx, key.idx, 0
789 elif key.right_tween:
790 next_key = self._keys[pos + 1] 803 next_key = self._keys[pos + 1]
791 return key.idx, next_key.idx, key.right_tween_type 804 return key.idx, next_key.idx, key.right_tween_type
792 else: 805 elif key.idx == idx:
793 return -1,-1,-1 806 return key.idx, key.idx, 0
794 pass 807 pass
795 raise ValueError, \ 808 raise ValueError, \
796 'the frame specified by idx is not in any tween or a key frame' 809 'the frame specified by idx is not in any tween or a key frame'
797 810
798 def get_frame_data(self, idx): 811 def get_frame_data(self, idx):