# HG changeset patch # User Thinker K.F. Li # Date 1294631113 -28800 # Node ID 447cd3359cf23be488df5d4551dac7c88be5109d # Parent 2febe4a301fa2e91aa5959ec56355bcf1225ef82 Fix bug of mal-structured dup group - When a user changes tween type of a tween, the structure of dup group may not satisfy the requirement of new type. - It causes unexpected behavior. - It is fixed by checking structure and remove mal-structured ones. diff -r 2febe4a301fa -r 447cd3359cf2 pyink/MBScene.py --- a/pyink/MBScene.py Mon Jan 10 11:45:13 2011 +0800 +++ b/pyink/MBScene.py Mon Jan 10 11:45:13 2011 +0800 @@ -479,7 +479,7 @@ def rm_scene_node_n_group(self, scene_node): scene_group_id = scene_node.getAttribute('ref') scene_group_node = self.get_node(scene_group_id) - scene_group_node.parent.removeChild(scene_group_node) + scene_group_node.parent().removeChild(scene_group_node) self._scenes_node.removeChild(scene_node) pass @@ -543,9 +543,9 @@ for scene_node in layer.scenes: scene_group_id = scene_node.getAttribute('ref') scene_group_node = self.get_node(scene_group_id) - scene_group_node.parent.removeChild(scene_group_node) + scene_group_node.parent().removeChild(scene_group_node) - scene_node.parent.removeChild(scene_node) + scene_node.parent().removeChild(scene_node) pass pass diff -r 2febe4a301fa -r 447cd3359cf2 pyink/tween.py --- a/pyink/tween.py Mon Jan 10 11:45:13 2011 +0800 +++ b/pyink/tween.py Mon Jan 10 11:45:13 2011 +0800 @@ -233,6 +233,16 @@ We will parse the transform matrix of the @s and @d and then generate the matrix which is (1-p) of @s and p percent of @d. """ + if newobj and not newobj.firstChild(): + # newobj is not with expect structure. + # + # When a user change tween type of a scene, the structure + # of dup group created by old tween type may not satisfy + # the requirement of current tween type. + newobj.parent().removeChild(newobj) + newobj = None + pass + if newobj == None: newobj = s.duplicate(self.document) top = self.document.createElement("svg:g") @@ -241,7 +251,8 @@ obj.appendChild(top) else: top = newobj - newobj = top.firstChild() + newobj = newobj.firstChild() + pass if s.name() == 'svg:g': # Parse the translate or matrix