Mercurial > MadButterfly
comparison pyink/frameline.py @ 1241:e64f5bd2270c
Change naming.
- key frame should be marked/unmark, not be added/removed to/from a
layer.
- layers are inserted into the stack of layers, not be added.
author | Thinker K.F. Li <thinker@codemud.net> |
---|---|
date | Mon, 10 Jan 2011 13:37:33 +0800 |
parents | d28b1b840bfc |
children | 45e9566ea5c0 |
comparison
equal
deleted
inserted
replaced
1240:84bcd398cccc | 1241:e64f5bd2270c |
---|---|
641 | 641 |
642 ## Add a key frame | 642 ## Add a key frame |
643 # | 643 # |
644 # A key frame is the frame that user specify actions. For | 644 # A key frame is the frame that user specify actions. For |
645 # example, move a object or add new objects at the frame. | 645 # example, move a object or add new objects at the frame. |
646 def add_keyframe(self, idx, ref=None): | 646 def mark_keyframe(self, idx, ref=None): |
647 try: | 647 try: |
648 pos = self._find_keyframe(idx) # it is not already a keyframe. | 648 pos = self._find_keyframe(idx) # it is not already a keyframe. |
649 except ValueError: | 649 except ValueError: |
650 pass | 650 pass |
651 else: | 651 else: |
688 def rm_frame(self, idx): | 688 def rm_frame(self, idx): |
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.rm_keyframe(idx) | 693 self.unmark_keyframe(idx) |
694 pass | 694 pass |
695 | 695 |
696 while pos < len(self._keys): | 696 while pos < len(self._keys): |
697 self._keys[pos].idx = self._keys[pos].idx - 1 | 697 self._keys[pos].idx = self._keys[pos].idx - 1 |
698 pos = pos+1 | 698 pos = pos+1 |
718 pos = pos + 1 | 718 pos = pos + 1 |
719 pass | 719 pass |
720 pass | 720 pass |
721 pass | 721 pass |
722 | 722 |
723 def rm_keyframe(self, idx): | 723 def unmark_keyframe(self, idx): |
724 key_pos = self._find_keyframe(idx) | 724 key_pos = self._find_keyframe(idx) |
725 key = self._keys[key_pos] | 725 key = self._keys[key_pos] |
726 del self._keys[key_pos] | 726 del self._keys[key_pos] |
727 | 727 |
728 if key.right_tween ^ key.left_tween: | 728 if key.right_tween ^ key.left_tween: |
926 fr = frameruler(40) | 926 fr = frameruler(40) |
927 fr.set_size_request(300, 20) | 927 fr.set_size_request(300, 20) |
928 | 928 |
929 fl = frameline(40) | 929 fl = frameline(40) |
930 fl.set_size_request(300, 20) | 930 fl.set_size_request(300, 20) |
931 fl.add_keyframe(15) | 931 fl.mark_keyframe(15) |
932 fl.add_keyframe(3) | 932 fl.mark_keyframe(3) |
933 fl.tween(3) | 933 fl.tween(3) |
934 fl.add_keyframe(9) | 934 fl.mark_keyframe(9) |
935 fl.add_keyframe(20) | 935 fl.mark_keyframe(20) |
936 fl.tween(9) | 936 fl.tween(9) |
937 fl.active_frame(1) | 937 fl.active_frame(1) |
938 fl.rm_keyframe(15) | 938 fl.unmark_keyframe(15) |
939 print 'num of frames: %d' % (len(fl)) | 939 print 'num of frames: %d' % (len(fl)) |
940 | 940 |
941 def press_sig(fl, frame, but): | 941 def press_sig(fl, frame, but): |
942 print 'press_sig button %d for frame %d' % (but, frame) | 942 print 'press_sig button %d for frame %d' % (but, frame) |
943 pass | 943 pass |