changeset 1160:1a699dc00fa3

Fix the issue of not removing node in old scene when switching scenes. - When a timeline is playing and crossing two scenes (tween block), nodes, for the old scene, in duplicate group must be removed. But, it is not. - It is fixed by checking if nodes, in the duplicate group, are also in the key frame next to the new scene. All nodes that is not in next key frame are remove.
author Thinker K.F. Li <thinker@codemud.net>
date Tue, 28 Dec 2010 13:35:34 +0800
parents e731a0eaa35f
children a7faab54e8f8
files pyink/MBScene.py pyink/tween.py
diffstat 2 files changed, 9 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/pyink/MBScene.py	Tue Dec 28 13:35:34 2010 +0800
+++ b/pyink/MBScene.py	Tue Dec 28 13:35:34 2010 +0800
@@ -605,7 +605,7 @@
 			layer.get_frame_block(stop_idx + 1)
 		    next_scene_group = layer.get_frame_data(next_idx)
 		    
-		    nframes = next_idx - start_idx + 1
+		    nframes = stop_idx - start_idx + 1
 		    percent = float(idx - start_idx) / nframes
 		    self.tween.updateTweenContent(layer.duplicateGroup,
 						  tween_obj_tween_type,
--- a/pyink/tween.py	Tue Dec 28 13:35:34 2010 +0800
+++ b/pyink/tween.py	Tue Dec 28 13:35:34 2010 +0800
@@ -62,6 +62,14 @@
 	    node = node.next()
 	    pass
 
+	# Remove duplicate nodes that is not in the set of stop nodes
+	for node_ref in dup_nodes:
+	    if node_ref not in stop_nodes:
+		node = dup_nodes[node_ref]
+		duplicate_group.removeChild(node)
+		pass
+	    pass
+
 	#
 	# Node ID of a node of start scene must be mapped to
 	# 'ns0:duplicate-src' attribute of a node of stop scene.  The