Mercurial > MadButterfly
comparison pyink/frameline.py @ 1193:0e3a65b7b00c
Simplify extendScened()
author | Thinker K.F. Li <thinker@codemud.net> |
---|---|
date | Sun, 02 Jan 2011 18:26:30 +0800 |
parents | bfd7d466a022 |
children | 8c5492b096f1 |
comparison
equal
deleted
inserted
replaced
1192:79a3f82edaac | 1193:0e3a65b7b00c |
---|---|
788 # - If the index frame is in a tween, it returns the range of the tween. | 788 # - If the index frame is in a tween, it returns the range of the tween. |
789 # | 789 # |
790 # - If the indexed frame is a key frame with no right_tween, returns the | 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. | 791 # range that start and stop are both equivalent to idx. |
792 # | 792 # |
793 # - If both earlier two are not meat, the previesou keyframe or tween is | |
794 # returned. | |
795 # | |
793 # - Otherwise, raise an exception. | 796 # - Otherwise, raise an exception. |
794 # | 797 # |
795 # \param idx is the index number of a frame. | 798 # \param idx is the index number of a frame. |
796 # \return A tuple of (start, stop, tween_type) | 799 # \return A tuple of (start, stop, tween_type) |
797 # | 800 # |
798 def get_frame_block(self, idx): | 801 def get_frame_block_floor(self, idx): |
799 pos = self._find_keyframe_floor(idx) | 802 pos = self._find_keyframe_floor(idx) |
800 if pos != -1: | 803 if pos != -1: |
801 key = self._keys[pos] | 804 key = self._keys[pos] |
802 if key.right_tween: | 805 if key.right_tween: |
803 next_key = self._keys[pos + 1] | 806 next_key = self._keys[pos + 1] |
804 return key.idx, next_key.idx, key.right_tween_type | 807 return key.idx, next_key.idx, key.right_tween_type |
805 elif key.idx == idx: | 808 if key.left_tween: |
806 return key.idx, key.idx, 0 | 809 prev_key = self._keys[pos - 1] |
807 pass | 810 return prev_key.idx, key.idx, prev_key.right_tween_type |
811 return key.idx, key.idx, 0 | |
808 raise ValueError, \ | 812 raise ValueError, \ |
809 'the frame specified by idx is not in any tween or a key frame' | 813 'the frame specified by idx is not in any tween or a key frame' |
814 | |
815 ## \brief Return the range of a block of consequence frames (tween). | |
816 # | |
817 # - If the index frame is in a tween, it returns the range of the tween. | |
818 # | |
819 # - If the indexed frame is a key frame with no right_tween, returns the | |
820 # range that start and stop are both equivalent to idx. | |
821 # | |
822 # - Otherwise, raise an exception. | |
823 # | |
824 # \param idx is the index number of a frame. | |
825 # \return A tuple of (start, stop, tween_type) | |
826 # | |
827 def get_frame_block(self, idx): | |
828 start, stop, tween_type = self.get_frame_block_floor(idx) | |
829 if stop < idx: | |
830 raise ValueError, \ | |
831 'the frame specified by idx is not in any tween or a key frame' | |
832 return start, stop, tween_type | |
810 | 833 |
811 def get_frame_data(self, idx): | 834 def get_frame_data(self, idx): |
812 pos = self._find_keyframe(idx) | 835 pos = self._find_keyframe(idx) |
813 key = self._keys[pos] | 836 key = self._keys[pos] |
814 return key.ref | 837 return key.ref |