comparison pyink/frameline.py @ 1163:c23593881507

Merge. Fix a bug to select the tween without key frame after it.
author wycc
date Tue, 28 Dec 2010 22:26:11 +0800
parents a7faab54e8f8
children 2cb5047d8f2b
comparison
equal deleted inserted replaced
1162:64c54ef39480 1163:c23593881507
368 first_tween_key = self._keys[first_tween_pos] 368 first_tween_key = self._keys[first_tween_pos]
369 last_tween_key = self._keys[last_tween_pos] 369 last_tween_key = self._keys[last_tween_pos]
370 self._draw_tween(first_tween_key.idx, last_tween_key.idx, 370 self._draw_tween(first_tween_key.idx, last_tween_key.idx,
371 first_tween_key.right_tween_type) 371 first_tween_key.right_tween_type)
372 last_tween_key = self._keys[last_tween_pos] 372 last_tween_key = self._keys[last_tween_pos]
373 key_pos = last_tween_pos + 1
374 try:
375 key = self._keys[key_pos]
376 except:
377 key = keyframe(self._num_frames)
378 pass
373 i = last_tween_key.idx + 1 379 i = last_tween_key.idx + 1
374 else: 380 else:
375 self._draw_normal_frame(i) 381 self._draw_normal_frame(i)
376 if key.idx == i: 382 if key.idx == i:
377 key_pos = key_pos+1 383 key_pos = key_pos+1
702 if key.right_tween: 708 if key.right_tween:
703 next_key = self._keys[pos + 1] 709 next_key = self._keys[pos + 1]
704 block = (key.idx, next_key.idx, key.right_tween_type) 710 block = (key.idx, next_key.idx, key.right_tween_type)
705 elif not key.left_tween: 711 elif not key.left_tween:
706 block = (key.idx, key.idx, 0) 712 block = (key.idx, key.idx, 0)
707 pass 713 else:
714 continue
708 blocks.append(block) 715 blocks.append(block)
709 pass 716 pass
710 return blocks 717 return blocks
711 718
712 def get_frame_block(self, idx): 719 def get_frame_block(self, idx):
713 pos = self._find_keyframe_floor(idx) 720 pos = self._find_keyframe_floor(idx)
714 if pos != -1: 721 if pos != -1:
715 key = self._keys[pos] 722 key = self._keys[pos]
723 print key.right_tween, key.left_tween
716 if key.idx == idx: 724 if key.idx == idx:
717 return key.idx, key.idx, 0 725 return key.idx, key.idx, 0
718 elif key.right_tween: 726 elif key.right_tween:
719 next_key = self._keys[pos + 1] 727 next_key = self._keys[pos + 1]
720 return key.idx, next_key.idx, key.right_tween_type 728 return key.idx, next_key.idx, key.right_tween_type
729 else:
730 return -1,-1,-1
721 pass 731 pass
722 raise ValueError, \ 732 raise ValueError, \
723 'the frame specified by idx is not in any tween or a key frame' 733 'the frame specified by idx is not in any tween or a key frame'
724 734
725 def get_frame_data(self, idx): 735 def get_frame_data(self, idx):