diff 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
line wrap: on
line diff
--- a/pyink/frameline.py	Mon Jan 10 19:44:15 2011 +0800
+++ b/pyink/frameline.py	Mon Jan 10 22:15:16 2011 +0800
@@ -691,13 +691,19 @@
 	    key = self._keys[pos]
 	    if key.idx == idx:
 		self.unmark_keyframe(idx)
+	    else:
+		pos = pos + 1
 		pass
 
 	    while pos < len(self._keys):
-		self._keys[pos].idx = self._keys[pos].idx - 1
-		pos = pos+1
+		key = self._keys[pos]
+		key.idx = key.idx - 1
+		pos = pos + 1
 		pass
 	    pass
+
+	self._draw_all_frames()
+	self._draw_active_frame()
 	pass
 
     ## \brief Inser a frame before given frame.
@@ -709,15 +715,19 @@
 	pos = self._find_keyframe_floor(idx)
 	if pos != -1:
 	    key = self._keys[pos]
-	    if key.idx == idx:
+	    if key.idx != idx:
 		pos = pos + 1
 		pass
+	    
 	    while pos < len(self._keys):
 		key = self._keys[pos]
 		key.idx = key.idx + 1
 		pos = pos + 1
 		pass
 	    pass
+
+	self._draw_all_frames()
+	self._draw_active_frame()
 	pass
     
     def unmark_keyframe(self, idx):