changeset 1294:082fff7e9604

merge
author Thinker K.F. Li <thinker@codemud.net>
date Sat, 15 Jan 2011 23:07:29 +0800
parents 10bffaffef82 (current diff) 99de83340782 (diff)
children 71118bff7d61
files pyink/MBScene.py pyink/domview.py pyink/domview_ui.py
diffstat 3 files changed, 17 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/pyink/MBScene.py	Sat Jan 15 22:41:58 2011 +0800
+++ b/pyink/MBScene.py	Sat Jan 15 23:07:29 2011 +0800
@@ -118,14 +118,19 @@
 	pass
     
     def extendScene(self):
+        # Create a tween
 	layer_idx, frame_idx = self._domviewui.get_active_layer_frame()
 	start, end, tween_type = \
 	    self._domviewui.get_left_key(layer_idx, frame_idx)
-	tween_len = frame_idx - start + 1
+	tween_len = frame_idx - start 
 	self._domviewui.tween(layer_idx, start, tween_len, tween_type)
-	
+
+	# Create a key frame which link to the previous key frame
 	scene_group = self._domviewui.get_key_group(layer_idx, start)
-	self._enterGroup(scene_group)
+	self._domviewui.mark_key(layer_idx, frame_idx)
+	self._domviewui.clone_key_group(layer_idx, start, frame_idx)
+	self._director.show_scene(frame_idx)
+	self.selectSceneObject(layer_idx, frame_idx)
 	pass
     
     def _enterGroup(self, scene_group):
@@ -153,6 +158,7 @@
     def duplicateKeyScene(self):
         # Search for the current scene
 	layer_idx, frame_idx = self._domviewui.get_active_layer_frame()
+	self.removeKeyScene(layer_idx, frame_idx)
 
 	try:
 	    left_start, left_end, left_tween_type = \
--- a/pyink/domview.py	Sat Jan 15 22:41:58 2011 +0800
+++ b/pyink/domview.py	Sat Jan 15 23:07:29 2011 +0800
@@ -771,8 +771,9 @@
             dst_child_id = self.new_id()
             
             dst_child = doc.createElement('svg:use')
+            dst_child.setAttribute('id', dst_child_id)
             dst_child.setAttribute('xlink:href', '#' + src_child_id)
-            dst_child.setAttribute('id', dst_child_id)
+            dst_child.setAttribute('ns0:duplicate-src', src_child_id)
             dst_group.append(child)
             pass
         pass
--- a/pyink/domview_ui.py	Sat Jan 15 22:41:58 2011 +0800
+++ b/pyink/domview_ui.py	Sat Jan 15 23:07:29 2011 +0800
@@ -658,6 +658,12 @@
         self._dom.copy_group_children(src_group, dst_group)
         pass
 
+    def clone_key_group(self, layer_idx, src_frame_idx, dst_frame_idx):
+        src_group = self.get_key_group(layer_idx, src_frame_idx)
+        dst_group = self.get_key_group(layer_idx, dst_frame_idx)
+        self._dom.clone_group_children(src_group, dst_group)
+        pass
+
     ## \brief Return widget showing frames and layers.
     #
     def get_frame_ui_widget(self):