Mercurial > MadButterfly
diff pyink/MBScene.py @ 1163:c23593881507
Merge.
Fix a bug to select the tween without key frame after it.
author | wycc |
---|---|
date | Tue, 28 Dec 2010 22:26:11 +0800 |
parents | a7faab54e8f8 |
children | 2cb5047d8f2b |
line wrap: on
line diff
--- a/pyink/MBScene.py Mon Dec 27 23:20:13 2010 +0800 +++ b/pyink/MBScene.py Tue Dec 28 22:26:11 2010 +0800 @@ -86,7 +86,7 @@ if self.type == 'DOMSubtreeModified': self.func(node) def notifyAttributeChanged(self,node, name, old_value, new_value): - print 'attr',node,name,old_value,new_value + # print 'attr',node,name,old_value,new_value if self.type == 'DOMAttrModified': self.func(node,name) @@ -336,6 +336,8 @@ try: label = scene.getAttribute('inkscape:label') if label == 'dup': + # XXX: This would stop animation. + # This function is called by updateUI() node.removeChild(scene) except: pass @@ -603,9 +605,12 @@ next_idx, next_stop_idx, next_tween_type = \ layer.get_frame_block(stop_idx + 1) - next_scene_group = layer.get_frame_data(next_idx) + if next_idx == -1: + next_scene_group = scene_group + else: + next_scene_group = layer.get_frame_data(next_idx) - nframes = next_idx - start_idx + 1 + nframes = stop_idx - start_idx + 1 percent = float(idx - start_idx) / nframes self.tween.updateTweenContent(layer.duplicateGroup, tween_obj_tween_type, @@ -873,16 +878,22 @@ """ if self.btnRun.get_label() == "Run": self.btnRun.set_label("Stop") + self.lockui = True self.last_update = glib.timeout_add(1000/self.framerate,self.doRunNext) else: self.btnRun.set_label("Run") glib.source_remove(self.last_update) + self.lockui = False + pass def doRunNext(self): if self.current >= self.maxframe: self.current = 0 - print self.current,self.maxframe - self.setCurrentScene(self.current+1) + try: + self.setCurrentScene(self.current+1) + except: + traceback.print_exc() + raise self.last_update = glib.timeout_add(1000/self.framerate,self.doRunNext) @@ -917,10 +928,11 @@ if self.last_line == None: return frameline = self.last_line + idx = self.last_frame i = 0 found = -1 for start_idx, stop_idx, tween_type in frameline.get_frame_blocks(): - if start_idx < stop_idx: + if start_idx <= idx and stop_idx >= idx: n = self.tweenTypeSelector.get_active() new_tween_type = MBScene._frameline_tween_types[n] self.last_line.set_tween_type(start_idx, new_tween_type)