Mercurial > MadButterfly
diff pyink/tween.py @ 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 | 983442b2698c |
children | ccbf0c5d01d1 |
line wrap: on
line diff
--- 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