Mercurial > MadButterfly
comparison pyink/tween.py @ 1170:e64b02951627
Fix the issue in the normal tween. We duplicate the object only when the object is not in the duplicated node yet.
author | wycc |
---|---|
date | Thu, 30 Dec 2010 11:30:16 +0800 |
parents | 6160e6282252 |
children | 178b126edd2c |
comparison
equal
deleted
inserted
replaced
1169:ac5f960ba6cf | 1170:e64b02951627 |
---|---|
61 pass | 61 pass |
62 node = node.next() | 62 node = node.next() |
63 pass | 63 pass |
64 | 64 |
65 # Remove duplicate nodes that is not in the set of stop nodes | 65 # Remove duplicate nodes that is not in the set of stop nodes |
66 for node_ref in dup_nodes: | 66 #for node_ref in dup_nodes: |
67 if node_ref not in stop_nodes: | 67 # if node_ref not in stop_nodes: |
68 node = dup_nodes[node_ref] | 68 # node = dup_nodes[node_ref] |
69 duplicate_group.removeChild(node) | 69 # duplicate_group.removeChild(node) |
70 pass | 70 # pass |
71 pass | 71 # pass |
72 | 72 |
73 # | 73 # |
74 # Node ID of a node of start scene must be mapped to | 74 # Node ID of a node of start scene must be mapped to |
75 # 'ns0:duplicate-src' attribute of a node of stop scene. The | 75 # 'ns0:duplicate-src' attribute of a node of stop scene. The |
76 # nodes which can not be mapped to a node of stop scene are | 76 # nodes which can not be mapped to a node of stop scene are |
85 start_node_id = start_node.getAttribute('id') | 85 start_node_id = start_node.getAttribute('id') |
86 dup_node = dup_nodes.setdefault(start_node_id, None) | 86 dup_node = dup_nodes.setdefault(start_node_id, None) |
87 try: | 87 try: |
88 stop_node = stop_nodes[start_node_id] | 88 stop_node = stop_nodes[start_node_id] |
89 except KeyError: | 89 except KeyError: |
90 #self.updateTweenObject(duplicate_group, tween_type, | 90 self.updateTweenObject(duplicate_group, tween_type, |
91 # start_node, start_node, | 91 start_node, start_node, |
92 # percent, dup_node) | 92 percent, dup_node) |
93 start_node = start_node.next() | 93 start_node = start_node.next() |
94 continue | 94 continue |
95 | 95 |
96 | 96 |
97 self.updateTweenObject(duplicate_group, tween_type, | 97 self.updateTweenObject(duplicate_group, tween_type, |
174 """ | 174 """ |
175 if typ == self.TWEEN_TYPE_SCALE: | 175 if typ == self.TWEEN_TYPE_SCALE: |
176 self.updateTweenObjectScale(obj,s,d,p,newobj) | 176 self.updateTweenObjectScale(obj,s,d,p,newobj) |
177 pass | 177 pass |
178 elif typ == self.TWEEN_TYPE_NORMAL: | 178 elif typ == self.TWEEN_TYPE_NORMAL: |
179 newobj = s.duplicate(self.document) | 179 if newobj == None: |
180 newobj.setAttribute("ref", s.getAttribute("id")) | 180 newobj = s.duplicate(self.document) |
181 top = self.document.createElement("svg:g") | 181 newobj.setAttribute("ref", s.getAttribute("id")) |
182 top.appendChild(newobj) | 182 obj.appendChild(newobj) |
183 obj.appendChild(top) | |
184 pass | 183 pass |
185 | 184 |
186 def updateTweenObjectScale(self,obj,s,d,p,newobj): | 185 def updateTweenObjectScale(self,obj,s,d,p,newobj): |
187 """ | 186 """ |
188 Generate a new group which contains the original group and then | 187 Generate a new group which contains the original group and then |
194 """ | 193 """ |
195 if newobj == None: | 194 if newobj == None: |
196 newobj = s.duplicate(self.document) | 195 newobj = s.duplicate(self.document) |
197 top = self.document.createElement("svg:g") | 196 top = self.document.createElement("svg:g") |
198 top.setAttribute("ref",s.getAttribute("id")) | 197 top.setAttribute("ref",s.getAttribute("id")) |
199 top.setAttribute("inkscape:label","dup") | |
200 top.appendChild(newobj) | 198 top.appendChild(newobj) |
201 obj.appendChild(top) | 199 obj.appendChild(top) |
200 print "aaa" | |
202 else: | 201 else: |
203 top = newobj | 202 top = newobj |
204 newobj = top.firstChild() | 203 newobj = top.firstChild() |
205 | 204 |
206 if s.name() == 'svg:g': | 205 if s.name() == 'svg:g': |