Mercurial > MadButterfly
comparison 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 |
comparison
equal
deleted
inserted
replaced
1238:2febe4a301fa | 1239:447cd3359cf2 |
---|---|
231 origin and destination scene group. | 231 origin and destination scene group. |
232 | 232 |
233 We will parse the transform matrix of the @s and @d and then | 233 We will parse the transform matrix of the @s and @d and then |
234 generate the matrix which is (1-p) of @s and p percent of @d. | 234 generate the matrix which is (1-p) of @s and p percent of @d. |
235 """ | 235 """ |
236 if newobj and not newobj.firstChild(): | |
237 # newobj is not with expect structure. | |
238 # | |
239 # When a user change tween type of a scene, the structure | |
240 # of dup group created by old tween type may not satisfy | |
241 # the requirement of current tween type. | |
242 newobj.parent().removeChild(newobj) | |
243 newobj = None | |
244 pass | |
245 | |
236 if newobj == None: | 246 if newobj == None: |
237 newobj = s.duplicate(self.document) | 247 newobj = s.duplicate(self.document) |
238 top = self.document.createElement("svg:g") | 248 top = self.document.createElement("svg:g") |
239 top.setAttribute("ref",s.getAttribute("id")) | 249 top.setAttribute("ref",s.getAttribute("id")) |
240 top.appendChild(newobj) | 250 top.appendChild(newobj) |
241 obj.appendChild(top) | 251 obj.appendChild(top) |
242 else: | 252 else: |
243 top = newobj | 253 top = newobj |
244 newobj = top.firstChild() | 254 newobj = newobj.firstChild() |
255 pass | |
245 | 256 |
246 if s.name() == 'svg:g': | 257 if s.name() == 'svg:g': |
247 # Parse the translate or matrix | 258 # Parse the translate or matrix |
248 # | 259 # |
249 # D = B inv(A) | 260 # D = B inv(A) |