Mercurial > MadButterfly
comparison pyink/MBScene.py @ 1217:93acb8568ad3
Update frameline when loading a document
author | Thinker K.F. Li <thinker@codemud.net> |
---|---|
date | Wed, 05 Jan 2011 21:49:20 +0800 |
parents | 61f1b3d424cf |
children | 35c552f33f77 b5e648a317eb |
comparison
equal
deleted
inserted
replaced
1216:61f1b3d424cf | 1217:93acb8568ad3 |
---|---|
294 start, end, scene_type = self._parse_one_scene(scene_node) | 294 start, end, scene_type = self._parse_one_scene(scene_node) |
295 except: | 295 except: |
296 continue | 296 continue |
297 | 297 |
298 group_id = scene_node.getAttribute("ref") | 298 group_id = scene_node.getAttribute("ref") |
299 self._group2scene[group_id] = (start, end, scene_type) | 299 self._group2scene[group_id] = scene_node |
300 pass | 300 pass |
301 pass | 301 pass |
302 | 302 |
303 ## \brief Parse all scenes node in svg:metadata subtree. | 303 ## \brief Parse all scenes node in svg:metadata subtree. |
304 # | 304 # |
983 | 983 |
984 layer_idx = layer_idx + 1 | 984 layer_idx = layer_idx + 1 |
985 pass | 985 pass |
986 pass | 986 pass |
987 | 987 |
988 def _add_frameline_for_layers(self): | 988 ## \brief Update content of a frameline from scenes of respective layer. |
989 # | |
990 def _update_frameline_content(self, layer_idx): | |
991 line = self._framelines[layer_idx] | |
992 layer = self._layers[layer_idx] | |
993 for scene_node in layer.scenes: | |
994 print scene_node | |
995 start, end, tween_name = self._parse_one_scene(scene_node) | |
996 | |
997 line.add_keyframe(start) | |
998 if start != end: | |
999 line.add_keyframe(end) | |
1000 tween_type_idx = self._tween_type_names.index(tween_name) | |
1001 tween_type = self._frameline_tween_types[tween_type_idx] | |
1002 line.tween(start, tween_type) | |
1003 pass | |
1004 line.set_frame_data(start, scene_node) | |
1005 pass | |
1006 pass | |
1007 | |
1008 ## \brief Add a frameline for every found layer. | |
1009 # | |
1010 # This method is called to create a frameline for every layer found when | |
1011 # loading a document. | |
1012 # | |
1013 def _add_frameline_for_every_layer(self): | |
989 for layer_idx in range(len(self._layers)): | 1014 for layer_idx in range(len(self._layers)): |
990 self._add_frameline(layer_idx) | 1015 self._add_frameline(layer_idx) |
991 line = self._framelines[layer_idx] | 1016 line = self._framelines[layer_idx] |
992 layer = self._layers[layer_idx] | 1017 layer = self._layers[layer_idx] |
993 try: | 1018 try: |
994 label = layer.group.getAttribute('inkscape:label') | 1019 label = layer.group.getAttribute('inkscape:label') |
995 except: | 1020 except: |
996 label = layer.group.getAttribute('id') | 1021 label = layer.group.getAttribute('id') |
997 pass | 1022 pass |
998 line.label.set_text(label) | 1023 line.label.set_text(label) |
1024 | |
1025 self._update_frameline_content(layer_idx) | |
999 pass | 1026 pass |
1000 pass | 1027 pass |
1001 | 1028 |
1002 def duplicateKeyScene(self): | 1029 def duplicateKeyScene(self): |
1003 # Search for the current scene | 1030 # Search for the current scene |
1223 | 1250 |
1224 self.document = self.desktop.doc().rdoc | 1251 self.document = self.desktop.doc().rdoc |
1225 self.handle_doc_root(self.document, self.root) | 1252 self.handle_doc_root(self.document, self.root) |
1226 self.tween = TweenObject(self.document, self.root) | 1253 self.tween = TweenObject(self.document, self.root) |
1227 self._init_framelines() | 1254 self._init_framelines() |
1228 self._add_frameline_for_layers() | 1255 self._add_frameline_for_every_layer() |
1229 self._show_framelines() | 1256 self._show_framelines() |
1230 | 1257 |
1231 if self.top == None: | 1258 if self.top == None: |
1232 self.top = gtk.VBox(False,0) | 1259 self.top = gtk.VBox(False,0) |
1233 toplevel = self.desktop.getToplevel() | 1260 toplevel = self.desktop.getToplevel() |