Mercurial > MadButterfly
changeset 1239:447cd3359cf2
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.
author | Thinker K.F. Li <thinker@codemud.net> |
---|---|
date | Mon, 10 Jan 2011 11:45:13 +0800 |
parents | 2febe4a301fa |
children | 84bcd398cccc |
files | pyink/MBScene.py pyink/tween.py |
diffstat | 2 files changed, 15 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- 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
--- 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