# HG changeset patch # User wycc # Date 1293681002 -28800 # Node ID 178b126edd2cdc25209c655a43c75f067bb615f0 # Parent 16ea7b81eda8c2193e8ccdab133c3e232d0399fd Implement the correct normal tween. We will duplicate the node in the start scene. Insted of deleting all nodes which is not in the stop scene, we should delete the object which is not in the start scene instead. If we delete objecvt the the stop scene, the object should appear until we reach the stop scene. diff -r 16ea7b81eda8 -r 178b126edd2c pyink/tween.py --- a/pyink/tween.py Thu Dec 30 11:32:33 2010 +0800 +++ b/pyink/tween.py Thu Dec 30 11:50:02 2010 +0800 @@ -61,14 +61,26 @@ pass node = node.next() pass + # Collect all nodes in start scene + start_nodes = {} + node = start_scene_group.firstChild() + while node: + try: + node_label = node.getAttribute("id") + start_nodes[node_label] = node + except: + pass + 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 + + # Remove duplicate nodes that is not in the set of start nodes + for node_ref in dup_nodes: + if node_ref not in start_nodes: + node = dup_nodes[node_ref] + duplicate_group.removeChild(node) + pass + pass # # Node ID of a node of start scene must be mapped to @@ -176,6 +188,7 @@ self.updateTweenObjectScale(obj,s,d,p,newobj) pass elif typ == self.TWEEN_TYPE_NORMAL: + print "newobj=",newobj if newobj == None: newobj = s.duplicate(self.document) newobj.setAttribute("ref", s.getAttribute("id")) @@ -197,7 +210,6 @@ top.setAttribute("ref",s.getAttribute("id")) top.appendChild(newobj) obj.appendChild(top) - print "aaa" else: top = newobj newobj = top.firstChild()