changeset 1535:9aff42a7e2b9 tip

Fix issue of add/remove a frame at a scene before all key frames of a layer. When you added or removed a frame at a scene before all key frames of a layer, frameline was not updated correctly. It seems nothing happened, but domview is updated. This changeset fix this issue by correcting logic for boundary case.
author Thinker K.F. Li <thinker@codemud.net>
date Fri, 30 Sep 2011 22:07:28 +0800
parents 199ba528fd4a
children
files pyink/frameline.py
diffstat 1 files changed, 19 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/pyink/frameline.py	Fri Sep 30 14:17:35 2011 +0800
+++ b/pyink/frameline.py	Fri Sep 30 22:07:28 2011 +0800
@@ -694,19 +694,22 @@
 	    else:
 		pos = pos + 1
 		pass
-
-	    while pos < len(self._keys):
-		key = self._keys[pos]
-		key.idx = key.idx - 1
-		pos = pos + 1
-		pass
+	    pass
+	else:
+	    pos = 0
+	    pass
+	
+	while pos < len(self._keys):
+	    key = self._keys[pos]
+	    key.idx = key.idx - 1
+	    pos = pos + 1
 	    pass
 
 	self._draw_all_frames()
 	self._draw_active_frame()
 	pass
 
-    ## \brief Inser a frame before given frame.
+    ## \brief Insert a frame before given frame.
     #
     # All frame at and after given frame position move to tail in one position.
     # It means to add one to positions of all key frames at/after given frame.
@@ -718,12 +721,15 @@
 	    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
+	else:
+	    pos = 0
+	    pass
+	
+	while pos < len(self._keys):
+	    key = self._keys[pos]
+	    key.idx = key.idx + 1
+	    pos = pos + 1
 	    pass
 
 	self._draw_all_frames()