Mercurial > MadButterfly
diff pyink/domview.py @ 1265:ca301f6abef7
Support undo for insert key frame/rm keyframe. We will refresh all layers and scenes since it is not feasible to collect these changes and update the layers and scenes. We may scan two level only in the future to improve the performance.
author | wycc |
---|---|
date | Wed, 12 Jan 2011 15:01:14 +0800 |
parents | 2f861eea1214 |
children | 97302d2a0a1d |
line wrap: on
line diff
--- a/pyink/domview.py Wed Jan 12 12:25:45 2011 +0800 +++ b/pyink/domview.py Wed Jan 12 15:01:14 2011 +0800 @@ -72,7 +72,7 @@ except: pass pass - pass + pass def _find_maxframe(self, scenes_node): maxframe = 0 @@ -104,8 +104,7 @@ pass else: if child_id not in self._id2node: - raise ValueError, \ - 'remove a node that is never known (%s)' % (child_id) + return del self._id2node[child_id] pass @@ -189,7 +188,7 @@ def _parse_one_scene(self, scene_node): assert scene_node.name() == 'ns0:scene' - + start = int(scene_node.getAttribute("start")) try: end = int(scene_node.getAttribute("end")) @@ -221,6 +220,7 @@ continue try: + ref = scene_node.getAttribute('ref') start, end, scene_type = self._parse_one_scene(scene_node) except: continue @@ -349,6 +349,10 @@ self._init_metadata() self._parse_all_layers() pass + + def reset(self): + self.handle_doc_root( self._doc, self._root) + pass def dumpattr(self, n): s = "" @@ -665,6 +669,12 @@ pass pass + ## \brief add the current position to the undo buffer + # + def mark_undo(self, msg): + self._doc.done("none", msg) + pass + ## \brief Remove frames # # - Scenes covered by removing range were removed.