comparison pyink/MBScene.py @ 1190:a4df892fb4e5

Use meaningful name for scene, scene group, and layer group
author Thinker K.F. Li <thinker@codemud.net>
date Sun, 02 Jan 2011 09:53:19 +0800
parents 9cf183faf89f
children 6442fb198418
comparison
equal deleted inserted replaced
1189:9cf183faf89f 1190:a4df892fb4e5
43 # 43 #
44 44
45 class Layer: 45 class Layer:
46 def __init__(self,node): 46 def __init__(self,node):
47 self.scenes = [] 47 self.scenes = []
48 self.node = node 48 self.group = node
49 self.nodes=[]
50 pass 49 pass
51 pass 50 pass
52 51
53 class Scene: 52 class Scene:
54 def __init__(self, node, start,end,typ): 53 def __init__(self, node, start,end,typ):
319 self.dump(n, l+1) 318 self.dump(n, l+1)
320 pass 319 pass
321 print " " * l * 2,"/>" 320 print " " * l * 2,"/>"
322 pass 321 pass
323 322
324 def _parse_one_scene(self, scene): 323 def _parse_one_scene(self, scene_node):
325 assert scene.name() == 'ns0:scene' 324 assert scene_node.name() == 'ns0:scene'
326 325
327 start = int(scene.getAttribute("start")) 326 start = int(scene_node.getAttribute("start"))
328 try: 327 try:
329 end = int(scene.getAttribute("end")) 328 end = int(scene_node.getAttribute("end"))
330 except: 329 except:
331 end = start 330 end = start
332 pass 331 pass
333 332
334 try: 333 try:
335 scene_type = scene.getAttribute('type') 334 scene_type = scene_node.getAttribute('type')
336 if scene_type == None: 335 if scene_type == None:
337 scene_type = 'normal' 336 scene_type = 'normal'
338 pass 337 pass
339 except: 338 except:
340 scene_type = 'normal' 339 scene_type = 'normal'
341 pass 340 pass
342 341
343 return start, end, scene_type 342 return start, end, scene_type
344 343
345 def _parse_one_scenes(self, scenes): 344 def _parse_one_scenes(self, scenes_node):
346 self.scenemap = {} 345 self.scenemap = {}
347 try: 346 try:
348 cur = int(n.getAttribute("current")) 347 cur = int(n.getAttribute("current"))
349 except: 348 except:
350 cur = 1 349 cur = 1
351 pass 350 pass
352 self.current = cur 351 self.current = cur
353 352
354 for scene in scenes.childList(): 353 for scene_node in scenes_node.childList():
355 if scene.name() != 'ns0:scene': 354 if scene_node.name() != 'ns0:scene':
356 continue 355 continue
357 356
358 try: 357 try:
359 start, end, scene_type = self._parse_one_scene(scene) 358 start, end, scene_type = self._parse_one_scene(scene_node)
360 except: 359 except:
361 continue 360 continue
362 361
363 if end > self.maxframe: 362 if end > self.maxframe:
364 self.maxframe = end 363 self.maxframe = end
365 pass 364 pass
366 365
367 link = scene.getAttribute("ref") 366 link = scene_node.getAttribute("ref")
368 self.scenemap[link] = (start, end, scene_type) 367 self.scenemap[link] = (start, end, scene_type)
369 if cur >= start and cur <= end: 368 if cur >= start and cur <= end:
370 self.currentscene = link 369 self.currentscene = link
371 pass 370 pass
372 pass 371 pass
386 break 385 break
387 pass 386 pass
388 else: 387 else:
389 ns = "http://madbutterfly.sourceforge.net/DTD/madbutterfly.dtd" 388 ns = "http://madbutterfly.sourceforge.net/DTD/madbutterfly.dtd"
390 self._root.setAttribute("xmlns:ns0", ns) 389 self._root.setAttribute("xmlns:ns0", ns)
391 scenes = self._doc.createElement("ns0:scenes") 390 scenes_node = self._doc.createElement("ns0:scenes")
392 node.appendChild(scenes) 391 node.appendChild(scenes_node)
393 pass 392 pass
394 pass 393 pass
395 394
396 def insertKeyScene(self, line, frame): 395 def insertKeyScene(self, line, frame):
397 """ 396 """
403 402
404 """ 403 """
405 rdoc = self._doc 404 rdoc = self._doc
406 scene_group = rdoc.createElement("svg:g") 405 scene_group = rdoc.createElement("svg:g")
407 found = False 406 found = False
408 for node in line.node.childList(): 407 for node in line.layer_group.childList():
409 try: 408 try:
410 label = node.getAttribute("inkscape:label") 409 label = node.getAttribute("inkscape:label")
411 except: 410 except:
412 continue 411 continue
413 if label == "dup": 412 if label == "dup":
429 txt.setAttribute("width","100") 428 txt.setAttribute("width","100")
430 txt.setAttribute("height","100") 429 txt.setAttribute("height","100")
431 txt.setAttribute("style","fill:#ff00") 430 txt.setAttribute("style","fill:#ff00")
432 scene_group.appendChild(txt) 431 scene_group.appendChild(txt)
433 432
434 gid = line.node.getAttribute('inkscape:label')+self.new_id() 433 gid = line.layer_group.getAttribute('inkscape:label')+self.new_id()
435 scene_group.setAttribute("id",gid) 434 scene_group.setAttribute("id",gid)
436 scene_group.setAttribute("inkscape:groupmode","layer") 435 scene_group.setAttribute("inkscape:groupmode","layer")
437 line.node.appendChild(scene_group) 436 line.layer_group.appendChild(scene_group)
438 line.add_keyframe(frame, scene_group) 437 line.add_keyframe(frame, scene_group)
439 self.update_scenes_of_dom() 438 self.update_scenes_of_dom()
440 pass 439 pass
441 440
442 def add_scene_on_dom(self, frameline, scenes_node): 441 def add_scene_on_dom(self, frameline, scenes_node):
443 doc = self._doc 442 doc = self._doc
444 for start_idx, stop_idx, tween_type in frameline.get_frame_blocks(): 443 for start_idx, stop_idx, tween_type in frameline.get_frame_blocks():
445 ref = frameline.get_frame_data(start_idx) 444 scene_node = frameline.get_frame_data(start_idx)
446 tween_type_idx = self._frameline_tween_types.index(tween_type) 445 tween_type_idx = self._frameline_tween_types.index(tween_type)
447 tween_type_name = self._tween_type_names[tween_type_idx] 446 tween_type_name = self._tween_type_names[tween_type_idx]
448 447
449 scene_node = doc.createElement("ns0:scene") 448 scene_node = doc.createElement("ns0:scene")
450 scenes_node.appendChild(scene_node) 449 scenes_node.appendChild(scene_node)
451 scene_node.setAttribute("start", str(start_idx + 1)) 450 scene_node.setAttribute("start", str(start_idx + 1))
452 if start_idx != stop_idx: 451 if start_idx != stop_idx:
453 scene_node.setAttribute("end", str(stop_idx + 1)) 452 scene_node.setAttribute("end", str(stop_idx + 1))
454 pass 453 pass
455 scene_node.setAttribute("ref", ref.getAttribute("id")) 454 scene_node.setAttribute("ref", scene_node.getAttribute("id"))
456 scene_node.setAttribute("type", tween_type_name) 455 scene_node.setAttribute("type", tween_type_name)
457 pass 456 pass
458 pass 457 pass
459 458
460 def update_scenes_of_dom(self): 459 def update_scenes_of_dom(self):
463 for node in doc.childList(): 462 for node in doc.childList():
464 if node.name() == 'svg:metadata': 463 if node.name() == 'svg:metadata':
465 for t in node.childList(): 464 for t in node.childList():
466 if t.name() == "ns0:scenes": 465 if t.name() == "ns0:scenes":
467 node.removeChild(t) 466 node.removeChild(t)
468 scenes = rdoc.createElement("ns0:scenes") 467 scenes_node = rdoc.createElement("ns0:scenes")
469 node.appendChild(scenes) 468 node.appendChild(scenes_node)
470 for layer in range(0, len(self._framelines)): 469 for layer in range(0, len(self._framelines)):
471 lobj = self._framelines[layer] 470 lobj = self._framelines[layer]
472 self.add_scene_on_dom(lobj, scenes) 471 self.add_scene_on_dom(lobj, scenes_node)
473 pass 472 pass
474 pass 473 pass
475 pass 474 pass
476 pass 475 pass
477 pass 476 pass
503 for node in doc.childList(): 502 for node in doc.childList():
504 if node.name() == 'svg:g': 503 if node.name() == 'svg:g':
505 oldscene = None 504 oldscene = None
506 lyobj = Layer(node) 505 lyobj = Layer(node)
507 self.layers.append(lyobj) 506 self.layers.append(lyobj)
508 lyobj.current_scene = [] 507 for scene_group in node.childList():
509 for scene in node.childList(): 508 if scene_group.name() != 'svg:g':
510 print scene.getCenter() 509 continue
511 if scene.name() == 'svg:g': 510
512 try: 511 try:
513 label = scene.getAttribute('inkscape:label') 512 label = scene.getAttribute('inkscape:label')
514 if label == 'dup': 513 if label == 'dup':
515 # TODO: remove this since this functio is for 514 # TODO: remove this since this functio is for
516 # parsing. Why do this here? 515 # parsing. Why do this here?
517 node.removeChild(scene) 516 node.removeChild(scene_group)
518 except:
519 pass 517 pass
520 518 except:
521 try:
522 scene_id = scene.getAttribute('id')
523 scene = self.get_scene(scene_id)
524 start, stop, tween_type = \
525 self._parse_one_scene(scene)
526 except:
527 lyobj.current_scene.append(scene)
528 continue
529
530 lyobj.scenes.append(Scene(scene, start, stop,
531 tween_type))
532 pass 519 pass
533 else: 520
534 lyobj.current_scene.append(scene) 521 try:
535 pass 522 scene_group_id = scene_group.getAttribute('id')
523 scene_node = self.get_scene(scene_group_id)
524 start, stop, tween_type = \
525 self._parse_one_scene(scene_node)
526 except:
527 continue
528
529 lyobj.scenes.append(Scene(scene_node, start, stop,
530 tween_type))
536 pass 531 pass
537 pass 532 pass
538 pass 533 pass
539 pass 534 pass
540 535
541 def getLayer(self, layer): 536 def getLayer(self, layer):
542 for l in self.layers: 537 for l in self.layers:
543 if l.node.getAttribute('id') == layer: 538 if l.group.getAttribute('id') == layer:
544 return l 539 return l
545 pass 540 pass
546 return None 541 return None
547 pass 542 pass
548 543
637 i = i + 1 632 i = i + 1
638 pass 633 pass
639 pass 634 pass
640 635
641 def extendScene(self): 636 def extendScene(self):
642 nth = self.last_frame 637 frame_idx = self.last_frame
643 layer = self.last_line 638 frameline = self.last_line
644 i = 0 639 i = 0
645 while i < len(layer._keys): 640 while i < len(frameline._keys):
646 s = layer._keys[i] 641 s = frameline._keys[i]
647 if s.right_tween: 642 if s.right_tween:
648 if nth > s.idx: 643 if frame_idx > s.idx:
649 if nth <= layer._keys[i+1].idx: 644 if frame_idx <= frameline._keys[i+1].idx:
650 return 645 return
651 try: 646 try:
652 if nth <= layer._keys[i+2].idx: 647 if frame_idx <= frameline._keys[i+2].idx:
653 layer._keys[i+1].idx = nth 648 frameline._keys[i+1].idx = frame_idx
654 layer.draw_all_frames() 649 frameline.draw_all_frames()
655 self.update_scenes_of_dom() 650 self.update_scenes_of_dom()
656 self.setCurrentScene(nth) 651 self.setCurrentScene(frame_idx)
657 self.last_line.update() 652 self.last_line.update()
658 return 653 return
659 else: 654 else:
660 # We may in the next scene 655 # We may in the next scene
661 i = i + 2 656 i = i + 2
662 pass 657 pass
663 except: 658 except:
664 # This is the last keyframe, extend the keyframe by 659 # This is the last keyframe, extend the keyframe by
665 # relocate the location of the keyframe 660 # relocate the location of the keyframe
666 layer._keys[i+1].idx = nth 661 frameline._keys[i+1].idx = frame_idx
667 layer._draw_all_frames() 662 frameline._draw_all_frames()
668 self.update_scenes_of_dom() 663 self.update_scenes_of_dom()
669 self.last_line.update() 664 self.last_line.update()
670 self.setCurrentScene(nth) 665 self.setCurrentScene(frame_idx)
671 return 666 return
672 else: 667 else:
673 # We are in the front of all keyframes 668 # We are in the front of all keyframes
674 return 669 return
675 else: 670 else:
676 # This is a single keyframe 671 # This is a single keyframe
677 if nth < s.idx: 672 if frame_idx < s.idx:
678 return 673 return
679 if nth == s.idx: 674 if frame_idx == s.idx:
680 return 675 return
681 try: 676 try:
682 if nth < layer._keys[i+1].idx: 677 if frame_idx < frameline._keys[i+1].idx:
683 # We are after a single keyframe and no scene is 678 # We are after a single keyframe and no scene is
684 # available here. Create a new tween here 679 # available here. Create a new tween here
685 idx = layer._keys[i].idx 680 idx = frameline._keys[i].idx
686 layer.add_keyframe(nth,layer._keys[i].ref) 681 scene_node = frameline._keys[i].ref
687 layer.tween(idx) 682 frameline.add_keyframe(frame_idx, scene_node)
688 layer._draw_all_frames() 683 frameline.tween(idx)
684 frameline._draw_all_frames()
689 self.update_scenes_of_dom() 685 self.update_scenes_of_dom()
690 self.setCurrentScene(nth) 686 self.setCurrentScene(frame_idx)
691 self.last_line.update() 687 self.last_line.update()
692 return 688 return
693 else: 689 else:
694 # We may in the next scene 690 # We may in the next scene
695 i = i + 1 691 i = i + 1
696 pass 692 pass
697 pass 693 pass
698 except: 694 except:
699 # This is the last scene, create a new one 695 # This is the last scene, create a new one
700 idx = layer._keys[i].idx 696 idx = frameline._keys[i].idx
701 layer.add_keyframe(nth,layer._keys[i].ref) 697 scene_node = frameline._keys[i].ref
702 layer.tween(idx) 698 frameline.add_keyframe(frame_idx, scene_node)
703 layer._draw_all_frames() 699 frameline.tween(idx)
700 frameline._draw_all_frames()
704 self.update_scenes_of_dom() 701 self.update_scenes_of_dom()
705 self.setCurrentScene(nth) 702 self.setCurrentScene(frame_idx)
706 self.last_line.update() 703 self.last_line.update()
707 return 704 return
708 pass 705 pass
709 pass 706 pass
710 pass 707 pass
729 available. 726 available.
730 """ 727 """
731 self.current = nth 728 self.current = nth
732 self.tween.updateMapping() 729 self.tween.updateMapping()
733 idx = nth - 1 730 idx = nth - 1
734 for layer in self._framelines: 731 for frameline in self._framelines:
735 i=0 732 i=0
736 733
737 # Check the duplicated scene group and create it if it is not available 734 # Check the duplicated scene group and create it if it is not available
738 try: 735 try:
739 layer.duplicateGroup.setAttribute("style","display:none") 736 frameline.duplicateGroup.setAttribute("style","display:none")
740 except: 737 except:
741 print "*"*40 738 print "*"*40
742 layer.duplicateGroup = self.document.createElement("svg:g") 739 frameline.duplicateGroup = self.document.createElement("svg:g")
743 layer.duplicateGroup.setAttribute("inkscape:label","dup") 740 frameline.duplicateGroup.setAttribute("inkscape:label","dup")
744 layer.duplicateGroup.setAttribute("sodipodi:insensitive","1") 741 frameline.duplicateGroup.setAttribute("sodipodi:insensitive","1")
745 layer.duplicateGroup.setAttribute("style","") 742 frameline.duplicateGroup.setAttribute("style","")
746 layer.layer.node.appendChild(layer.duplicateGroup) 743 frameline.layer.group.appendChild(frameline.duplicateGroup)
747 pass 744 pass
748 # Create a new group 745 # Create a new group
749 for start_idx, stop_idx, tween_type in layer.get_frame_blocks(): 746 for start_idx, stop_idx, tween_type in frameline.get_frame_blocks():
750 if start_idx == stop_idx: 747 if start_idx == stop_idx:
751 scene_group = layer.get_frame_data(start_idx) 748 scene_node = frameline.get_frame_data(start_idx)
752 if idx == start_idx: 749 if idx == start_idx:
753 scene_group.setAttribute('style', '') 750 scene_node.setAttribute('style', '')
754 else: 751 else:
755 scene_group.setAttribute('style', 'display: none') 752 scene_node.setAttribute('style', 'display: none')
756 pass 753 pass
757 elif idx == start_idx: 754 elif idx == start_idx:
758 layer.duplicateGroup.setAttribute("style","display:none") 755 frameline.duplicateGroup.setAttribute("style","display:none")
759 scene_group = layer.get_frame_data(start_idx) 756 scene_node = frameline.get_frame_data(start_idx)
760 scene_group.setAttribute("style","") 757 scene_node.setAttribute("style","")
761 elif start_idx <= idx and stop_idx >= idx: 758 elif start_idx <= idx and stop_idx >= idx:
762 scene_group = layer.get_frame_data(start_idx) 759 scene_node = frameline.get_frame_data(start_idx)
763 scene_group.setAttribute("style","display:none") 760 scene_node.setAttribute("style","display:none")
764 layer.duplicateGroup.setAttribute("style","") 761 frameline.duplicateGroup.setAttribute("style","")
765 tween_type_idx = \ 762 tween_type_idx = \
766 self._frameline_tween_types.index(tween_type) 763 self._frameline_tween_types.index(tween_type)
767 tween_obj_tween_type = \ 764 tween_obj_tween_type = \
768 self._tween_obj_tween_types[tween_type_idx] 765 self._tween_obj_tween_types[tween_type_idx]
769 766
770 try: 767 try:
771 next_idx, next_stop_idx, next_tween_type = \ 768 next_idx, next_stop_idx, next_tween_type = \
772 layer.get_frame_block(stop_idx + 1) 769 frameline.get_frame_block(stop_idx + 1)
773 except: 770 except:
774 next_scene_group = scene_group 771 next_scene_node = scene_node
775 else: 772 else:
776 next_scene_group = layer.get_frame_data(next_idx) 773 next_scene_node = frameline.get_frame_data(next_idx)
777 pass 774 pass
778 775
779 nframes = stop_idx - start_idx + 1 776 nframes = stop_idx - start_idx + 1
780 percent = float(idx - start_idx) / nframes 777 percent = float(idx - start_idx) / nframes
781 self.tween.updateTweenContent(layer.duplicateGroup, 778 self.tween.updateTweenContent(frameline.duplicateGroup,
782 tween_obj_tween_type, 779 tween_obj_tween_type,
783 scene_group, 780 scene_node,
784 next_scene_group, 781 next_scene_node,
785 percent) 782 percent)
786 else: 783 else:
787 scene_group = layer.get_frame_data(start_idx) 784 scene_node = frameline.get_frame_data(start_idx)
788 scene_group.setAttribute("style","display:none") 785 scene_node.setAttribute("style","display:none")
789 pass 786 pass
790 pass 787 pass
791 pass 788 pass
792 pass 789 pass
793 790
794 def enterGroup(self,obj): 791 def enterGroup(self,obj):
795 for l in self.layers: 792 for l in self.layers:
796 for s in l.node.childList(): 793 for s in l.group.childList():
797 if s.getAttribute('id') == obj.getAttribute("id"): 794 if s.getAttribute('id') == obj.getAttribute("id"):
798 self.desktop.setCurrentLayer(s.spitem) 795 self.desktop.setCurrentLayer(s.spitem)
799 pass 796 pass
800 pass 797 pass
801 pass 798 pass
805 try: 802 try:
806 start, stop, tween_type = frameline.get_frame_block(frame_idx) 803 start, stop, tween_type = frameline.get_frame_block(frame_idx)
807 except: 804 except:
808 return 805 return
809 806
810 scene_group = frameline.get_frame_data(start) 807 scene_node = frameline.get_frame_data(start)
811 self.enterGroup(scene_group) 808 self.enterGroup(scene_node)
812 self.setTweenType(tween_type) 809 self.setTweenType(tween_type)
813 pass 810 pass
814 811
815 def setTweenType(self, tween_type): 812 def setTweenType(self, tween_type):
816 sel_type = MBScene._frameline_tween_types.index(tween_type) 813 sel_type = MBScene._frameline_tween_types.index(tween_type)
882 # 879 #
883 self._framelines = [] 880 self._framelines = []
884 for i in range(len(self.layers)-1,-1,-1): 881 for i in range(len(self.layers)-1,-1,-1):
885 line = frameline(nframes) 882 line = frameline(nframes)
886 hbox = gtk.HBox() 883 hbox = gtk.HBox()
887 label = gtk.Label(self.layers[i].node.getAttribute("inkscape:label")) 884 label = gtk.Label(self.layers[i].group.getAttribute("inkscape:label"))
888 label.set_size_request(100,0) 885 label.set_size_request(100,0)
889 hbox.pack_start(label,expand=False,fill=True) 886 hbox.pack_start(label,expand=False,fill=True)
890 hbox.pack_start(line) 887 hbox.pack_start(line)
891 line.set_size_request(nframes * 10, 20) 888 line.set_size_request(nframes * 10, 20)
892 vbox.pack_start(hbox, False) 889 vbox.pack_start(hbox, False)
893 line.label = label 890 line.label = label
894 self._framelines.append(line) 891 self._framelines.append(line)
895 line.connect(line.FRAME_BUT_PRESS, self.onCellClick) 892 line.connect(line.FRAME_BUT_PRESS, self.onCellClick)
896 line.nLayer = i 893 line.nLayer = i
897 line.node = self.layers[i].node 894 line.layer_group = self.layers[i].group
898 line.layer = self.layers[i] 895 line.layer = self.layers[i]
899 line.connect('motion-notify-event', self._remove_active_frame) 896 line.connect('motion-notify-event', self._remove_active_frame)
900 pass 897 pass
901 vbox.show_all() 898 vbox.show_all()
902 pass 899 pass
904 ## \brief Update conetent of frameliens according layers. 901 ## \brief Update conetent of frameliens according layers.
905 # 902 #
906 def _update_framelines(self): 903 def _update_framelines(self):
907 for frameline in self._framelines: 904 for frameline in self._framelines:
908 layer = frameline.layer 905 layer = frameline.layer
909 if frameline.node.getAttribute("inkscape:label")==None: 906 if frameline.layer_group.getAttribute("inkscape:label")==None:
910 frameline.label.set_text('???') 907 frameline.label.set_text('???')
911 else: 908 else:
912 frameline.label.set_text(frameline.node.getAttribute("inkscape:label")) 909 frameline.label.set_text(frameline.layer_group.getAttribute("inkscape:label"))
913 last_scene = None 910 last_scene = None
914 for scene in layer.scenes: 911 for scene in layer.scenes:
915 if last_scene and last_scene.end == scene.start: 912 if last_scene and last_scene.end == scene.start:
916 frameline.setRightTween(last_scene.end) 913 frameline.setRightTween(last_scene.end)
917 else: 914 else:
918 frameline.add_keyframe(scene.start-1,scene.node) 915 frameline.add_keyframe(scene.start-1, scene.node)
919 last_scene = scene 916 last_scene = scene
920 if scene.start != scene.end: 917 if scene.start != scene.end:
921 frameline.add_keyframe(scene.end-1,scene.node) 918 frameline.add_keyframe(scene.end-1, scene.node)
922 tween_type_idx = self._tween_type_names.index(scene.type) 919 tween_type_idx = self._tween_type_names.index(scene.type)
923 tween_type = self._frameline_tween_types[tween_type_idx] 920 tween_type = self._frameline_tween_types[tween_type_idx]
924 frameline.tween(scene.start-1, tween_type) 921 frameline.tween(scene.start-1, tween_type)
925 pass 922 pass
926 pass 923 pass
975 pass 972 pass
976 pass 973 pass
977 pass 974 pass
978 if orig == None: 975 if orig == None:
979 return None 976 return None
980 ns = orig.duplicate(rdoc) 977 scene_group = orig.duplicate(rdoc)
981 978
982 old_nodes = _travel_DOM(orig) 979 old_nodes = _travel_DOM(orig)
983 new_nodes = _travel_DOM(ns) 980 new_nodes = _travel_DOM(scene_group)
984 for old_node in old_nodes: 981 for old_node in old_nodes:
985 print old_node 982 print old_node
986 old_node_id = old_node.getAttribute('id') 983 old_node_id = old_node.getAttribute('id')
987 new_node = new_nodes.next() 984 new_node = new_nodes.next()
988 new_node.setAttribute('ns0:duplicate-src', old_node_id) 985 new_node.setAttribute('ns0:duplicate-src', old_node_id)
989 pass 986 pass
990 987
991 gid = self.last_line.node.getAttribute("inkscape:label")+self.new_id() 988 gid = self.last_line.layer_group.getAttribute("inkscape:label")+self.new_id()
992 ns.setAttribute("id",gid) 989 scene_group.setAttribute("id",gid)
993 ns.setAttribute("inkscape:groupmode","layer") 990 scene_group.setAttribute("inkscape:groupmode","layer")
994 self.last_line.node.appendChild(ns) 991 self.last_line.layer_group.appendChild(scene_group)
995 return ns 992 return ns
996 993
997 def doEditScene(self, w): 994 def doEditScene(self, w):
998 self.setCurrentScene(self.last_frame+1) 995 self.setCurrentScene(self.last_frame+1)
999 self.selectSceneObject(self.last_line, self.last_frame) 996 self.selectSceneObject(self.last_line, self.last_frame)