.. | .. |
---|
4 | 4 | |
---|
5 | 5 | import java.awt.*; |
---|
6 | 6 | import java.awt.event.*; |
---|
| 7 | +import java.awt.image.BufferedImage; |
---|
7 | 8 | import javax.swing.*; |
---|
8 | 9 | import javax.swing.event.*; |
---|
9 | 10 | import javax.swing.text.*; |
---|
.. | .. |
---|
13 | 14 | import javax.swing.plaf.metal.MetalLookAndFeel; |
---|
14 | 15 | //import javax.swing.plaf.ColorUIResource; |
---|
15 | 16 | //import javax.swing.plaf.metal.DefaultMetalTheme; |
---|
| 17 | + |
---|
| 18 | +import javax.swing.plaf.basic.BasicSplitPaneDivider; |
---|
| 19 | +import javax.swing.plaf.basic.BasicSplitPaneUI; |
---|
16 | 20 | |
---|
17 | 21 | //import javax.media.opengl.GLCanvas; |
---|
18 | 22 | |
---|
.. | .. |
---|
37 | 41 | JFrame frame; |
---|
38 | 42 | |
---|
39 | 43 | static ObjEditor theFrame; |
---|
| 44 | + |
---|
| 45 | + cButton GetButton(String name, boolean border) |
---|
| 46 | + { |
---|
| 47 | + try |
---|
| 48 | + { |
---|
| 49 | + ImageIcon icon = GetIcon(name); |
---|
| 50 | + return new cButton(icon, border); |
---|
| 51 | + } |
---|
| 52 | + catch (Exception e) |
---|
| 53 | + { |
---|
| 54 | + return new cButton(name, border); |
---|
| 55 | + } |
---|
| 56 | + } |
---|
| 57 | + |
---|
| 58 | + cToggleButton GetToggleButton(String name, boolean border) |
---|
| 59 | + { |
---|
| 60 | + try |
---|
| 61 | + { |
---|
| 62 | + ImageIcon icon = GetIcon(name); |
---|
| 63 | + return new cToggleButton(icon, border); |
---|
| 64 | + } |
---|
| 65 | + catch (Exception e) |
---|
| 66 | + { |
---|
| 67 | + return new cToggleButton(name, border); |
---|
| 68 | + } |
---|
| 69 | + } |
---|
| 70 | + |
---|
| 71 | + cCheckBox GetCheckBox(String name, boolean border) |
---|
| 72 | + { |
---|
| 73 | + try |
---|
| 74 | + { |
---|
| 75 | + ImageIcon icon = GetIcon(name); |
---|
| 76 | + return new cCheckBox(icon, border); |
---|
| 77 | + } |
---|
| 78 | + catch (Exception e) |
---|
| 79 | + { |
---|
| 80 | + return new cCheckBox(name, border); |
---|
| 81 | + } |
---|
| 82 | + } |
---|
| 83 | + |
---|
| 84 | + private ImageIcon GetIcon(String name) throws IOException |
---|
| 85 | + { |
---|
| 86 | + BufferedImage image = javax.imageio.ImageIO.read(getClass().getClassLoader().getResourceAsStream(name)); |
---|
| 87 | + |
---|
| 88 | + if (image.getWidth() != 24 && image.getHeight() != 24) |
---|
| 89 | + { |
---|
| 90 | + BufferedImage resized = new BufferedImage(24, 24, image.getType()); |
---|
| 91 | + Graphics2D g = resized.createGraphics(); |
---|
| 92 | + g.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR); |
---|
| 93 | + //g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); |
---|
| 94 | + g.drawImage(image, 0, 0, 24, 24, 0, 0, image.getWidth(), image.getHeight(), null); |
---|
| 95 | + g.dispose(); |
---|
| 96 | + |
---|
| 97 | + image = resized; |
---|
| 98 | + } |
---|
| 99 | + |
---|
| 100 | + javax.swing.ImageIcon icon = new javax.swing.ImageIcon(image); |
---|
| 101 | + return icon; |
---|
| 102 | + } |
---|
40 | 103 | |
---|
41 | 104 | // SCRIPT |
---|
42 | 105 | |
---|
.. | .. |
---|
147 | 210 | |
---|
148 | 211 | objEditor.ctrlPanel.remove(namePanel); |
---|
149 | 212 | |
---|
150 | | - if (!GroupEditor.allparams) |
---|
| 213 | + if (!allparams) |
---|
151 | 214 | return; |
---|
152 | 215 | |
---|
153 | 216 | // objEditor.ctrlPanel.remove(liveCB); |
---|
.. | .. |
---|
171 | 234 | |
---|
172 | 235 | objEditor.ctrlPanel.remove(setupPanel); |
---|
173 | 236 | objEditor.ctrlPanel.remove(setupPanel2); |
---|
174 | | - objEditor.ctrlPanel.remove(commandsPanel); |
---|
| 237 | + objEditor.ctrlPanel.remove(objectCommandsPanel); |
---|
175 | 238 | objEditor.ctrlPanel.remove(pushPanel); |
---|
176 | 239 | //objEditor.ctrlPanel.remove(fillPanel); |
---|
177 | 240 | |
---|
.. | .. |
---|
246 | 309 | //localCopy.parent = null; |
---|
247 | 310 | |
---|
248 | 311 | frame = new JFrame(); |
---|
249 | | - frame.setUndecorated(true); |
---|
| 312 | + frame.setUndecorated(false); |
---|
250 | 313 | objEditor = this; |
---|
251 | 314 | this.callee = callee; |
---|
252 | 315 | |
---|
.. | .. |
---|
277 | 340 | return frame.action(event, obj); |
---|
278 | 341 | } |
---|
279 | 342 | |
---|
| 343 | + // Cannot work without static |
---|
| 344 | + static boolean allparams = true; |
---|
| 345 | + |
---|
| 346 | + static java.util.Vector<Object3D> listUI = new java.util.Vector<Object3D>(); |
---|
| 347 | + |
---|
280 | 348 | void SetupMenu() |
---|
281 | 349 | { |
---|
282 | 350 | frame.setMenuBar(menuBar = new MenuBar()); |
---|
283 | 351 | menuBar.add(fileMenu = new Menu("File")); |
---|
284 | 352 | fileMenu.add(newItem = new MenuItem("New")); |
---|
285 | | - fileMenu.add(loadItem = new MenuItem("Open...")); |
---|
| 353 | + fileMenu.add(openItem = new MenuItem("Open...")); |
---|
286 | 354 | |
---|
287 | 355 | //oe.menuBar.add(menu = new Menu("Include")); |
---|
288 | 356 | Menu menu = new Menu("Import"); |
---|
.. | .. |
---|
314 | 382 | } |
---|
315 | 383 | |
---|
316 | 384 | newItem.addActionListener(this); |
---|
317 | | - loadItem.addActionListener(this); |
---|
| 385 | + openItem.addActionListener(this); |
---|
318 | 386 | saveItem.addActionListener(this); |
---|
319 | 387 | saveAsItem.addActionListener(this); |
---|
320 | 388 | exportAsItem.addActionListener(this); |
---|
.. | .. |
---|
323 | 391 | closeItem.addActionListener(this); |
---|
324 | 392 | |
---|
325 | 393 | objectPanel = new JTabbedPane(); |
---|
| 394 | + |
---|
| 395 | + ChangeListener changeListener = new ChangeListener() |
---|
| 396 | + { |
---|
| 397 | + public void stateChanged(ChangeEvent changeEvent) |
---|
| 398 | + { |
---|
| 399 | +// if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Material") && !materialFlushed) |
---|
| 400 | +// { |
---|
| 401 | +// if (latestObject != null) |
---|
| 402 | +// { |
---|
| 403 | +// refreshContents(true); |
---|
| 404 | +// SetMaterial(latestObject); |
---|
| 405 | +// } |
---|
| 406 | +// |
---|
| 407 | +// materialFlushed = true; |
---|
| 408 | +// } |
---|
| 409 | +// if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Edit")) |
---|
| 410 | +// { |
---|
| 411 | +// if (listUI.size() == 0) |
---|
| 412 | +// EditSelection(false); |
---|
| 413 | +// } |
---|
| 414 | + |
---|
| 415 | + refreshContents(false); // To refresh Info tab |
---|
| 416 | + } |
---|
| 417 | + }; |
---|
| 418 | + objectPanel.addChangeListener(changeListener); |
---|
| 419 | + |
---|
326 | 420 | toolbarPanel = new JPanel(); |
---|
327 | 421 | toolbarPanel.setName("Toolbar"); |
---|
328 | 422 | treePanel = new cGridBag(); |
---|
329 | 423 | treePanel.setName("Tree"); |
---|
| 424 | + |
---|
| 425 | + editPanel = new cGridBag().setVertical(true); |
---|
| 426 | + editPanel.setName("Edit"); |
---|
| 427 | + |
---|
330 | 428 | ctrlPanel = new cGridBag().setVertical(false); // new GridBagLayout()); |
---|
331 | | - ctrlPanel.setName("Edit"); |
---|
| 429 | + |
---|
| 430 | + editCommandsPanel = new cGridBag(); |
---|
| 431 | + editPanel.add(editCommandsPanel); |
---|
| 432 | + editPanel.add(ctrlPanel); |
---|
| 433 | + |
---|
| 434 | + toolboxPanel = new cGridBag().setVertical(false); |
---|
| 435 | + toolboxPanel.setName("Toolbox"); |
---|
| 436 | + |
---|
332 | 437 | materialPanel = new cGridBag().setVertical(true); |
---|
333 | 438 | materialPanel.setName("Material"); |
---|
| 439 | + |
---|
334 | 440 | /*JTextPane*/ |
---|
335 | 441 | infoarea = createTextPane(); |
---|
336 | 442 | doc = infoarea.getStyledDocument(); |
---|
.. | .. |
---|
343 | 449 | // TEXTAREA infoarea.setLineWrap(true); |
---|
344 | 450 | // TEXTAREA infoarea.setWrapStyleWord(true); |
---|
345 | 451 | infoPanel = new JScrollPane(infoarea, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); //AS_NEEDED); |
---|
346 | | - infoPanel.setPreferredSize(new Dimension(50, 200)); |
---|
| 452 | + infoPanel.setPreferredSize(new Dimension(1, 1)); |
---|
347 | 453 | infoPanel.setName("Info"); |
---|
348 | 454 | //infoPanel.setLayout(new BorderLayout()); |
---|
349 | 455 | //infoPanel.add(createTextPane()); |
---|
.. | .. |
---|
355 | 461 | mainPanel.setDividerSize(9); |
---|
356 | 462 | mainPanel.setDividerLocation(0.5); //1.0); |
---|
357 | 463 | mainPanel.setResizeWeight(0.5); |
---|
358 | | - |
---|
| 464 | + |
---|
| 465 | +//mainPanel.setDividerSize((int) (mainPanel.getDividerSize() * 1.5)); |
---|
| 466 | + BasicSplitPaneDivider divider = ( (BasicSplitPaneUI) mainPanel.getUI()).getDivider(); |
---|
| 467 | + divider.setDividerSize(15); |
---|
| 468 | + divider.setBorder(BorderFactory.createTitledBorder(divider.getBorder(), "Custom border title -- gets rid of the one-touch arrows!")); |
---|
| 469 | + |
---|
| 470 | + mainPanel.setUI(new BasicSplitPaneUI()); |
---|
| 471 | + |
---|
359 | 472 | //ctrlPanel.setLayout(new GridLayout(4, 1, 5, 5)); |
---|
360 | 473 | //mainPanel.setLayout(new GridBagLayout()); |
---|
361 | 474 | toolbarPanel.setLayout(new FlowLayout(FlowLayout.LEFT)); |
---|
.. | .. |
---|
586 | 699 | } |
---|
587 | 700 | } |
---|
588 | 701 | |
---|
589 | | -static GraphicsDevice device = GraphicsEnvironment |
---|
590 | | - .getLocalGraphicsEnvironment().getScreenDevices()[0]; |
---|
| 702 | +//static GraphicsDevice device = GraphicsEnvironment |
---|
| 703 | +// .getLocalGraphicsEnvironment().getScreenDevices()[0]; |
---|
591 | 704 | |
---|
592 | 705 | Rectangle keeprect; |
---|
593 | 706 | cRadio radio; |
---|
.. | .. |
---|
603 | 716 | |
---|
604 | 717 | boolean maximized; |
---|
605 | 718 | |
---|
| 719 | + cButton fullscreenLayout; |
---|
| 720 | + |
---|
606 | 721 | void Minimize() |
---|
607 | 722 | { |
---|
608 | 723 | frame.setState(Frame.ICONIFIED); |
---|
| 724 | + frame.validate(); |
---|
609 | 725 | } |
---|
610 | 726 | |
---|
| 727 | +// artifactURI=null, type=0, property=${file.reference.jfxrt.jar}, object=org.netbeans.modules.java.api.common.classpath.ClassPathSupport$RelativePath@6767876f, broken=false, additional={} |
---|
| 728 | +// artifactURI=null, type=0, property=${file.reference.mac-ui.jar}, object=org.netbeans.modules.java.api.common.classpath.ClassPathSupport$RelativePath@16bdc817, broken=false, additional={} |
---|
| 729 | +// artifactURI=null, type=0, property=${file.reference.classes.jar}, object=org.netbeans.modules.java.api.common.classpath.ClassPathSupport$RelativePath@9daa9c17, broken=false, additional={} |
---|
611 | 730 | void Maximize() |
---|
612 | 731 | { |
---|
| 732 | + if (CameraPane.FULLSCREEN) |
---|
| 733 | + { |
---|
| 734 | + ToggleFullScreen(); |
---|
| 735 | + } |
---|
| 736 | + |
---|
613 | 737 | if (maximized) |
---|
614 | 738 | { |
---|
615 | 739 | frame.setBounds(keeprect.x, keeprect.y, keeprect.width, keeprect.height); |
---|
.. | .. |
---|
617 | 741 | else |
---|
618 | 742 | { |
---|
619 | 743 | keeprect = frame.getBounds(); |
---|
620 | | - Rectangle rect = GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds(); |
---|
621 | | - Dimension rect2 = frame.getToolkit().getScreenSize(); |
---|
622 | | - frame.setBounds(0, rect2.height - rect.height, rect.width, rect.height); |
---|
| 744 | +// Rectangle rect = GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds(); |
---|
| 745 | +// Dimension rect2 = frame.getToolkit().getScreenSize(); |
---|
| 746 | +// frame.setBounds(0, rect2.height - rect.height, rect.width, rect.height); |
---|
623 | 747 | // frame.setState(Frame.MAXIMIZED_BOTH); |
---|
| 748 | + frame.setBounds(frame.getGraphicsConfiguration().getBounds()); |
---|
624 | 749 | } |
---|
625 | 750 | |
---|
626 | 751 | maximized ^= true; |
---|
| 752 | + |
---|
| 753 | + frame.validate(); |
---|
627 | 754 | } |
---|
| 755 | + |
---|
| 756 | + cButton minButton; |
---|
| 757 | + cButton maxButton; |
---|
| 758 | + cButton fullButton; |
---|
628 | 759 | |
---|
629 | 760 | void ToggleFullScreen() |
---|
630 | 761 | { |
---|
631 | | - if (CameraPane.FULLSCREEN) |
---|
| 762 | +GraphicsDevice device = frame.getGraphicsConfiguration().getDevice(); |
---|
| 763 | + |
---|
| 764 | + cameraView.ToggleFullScreen(); |
---|
| 765 | + |
---|
| 766 | + if (!CameraPane.FULLSCREEN) |
---|
632 | 767 | { |
---|
633 | 768 | device.setFullScreenWindow(null); |
---|
| 769 | + frame.dispose(); |
---|
| 770 | + frame.setUndecorated(false); |
---|
| 771 | + frame.validate(); |
---|
| 772 | + frame.setVisible(true); |
---|
| 773 | + |
---|
634 | 774 | //frame.setVisible(false); |
---|
635 | 775 | // frame.removeNotify(); |
---|
636 | 776 | // frame.setUndecorated(false); |
---|
.. | .. |
---|
640 | 780 | // X frame.getContentPane().remove(/*"Center",*/bigThree); |
---|
641 | 781 | // X framePanel.add(bigThree); |
---|
642 | 782 | // X frame.getContentPane().add(/*"Center",*/framePanel); |
---|
643 | | - framePanel.setDividerLocation(1); |
---|
| 783 | + framePanel.setDividerLocation(46); |
---|
644 | 784 | |
---|
645 | 785 | //frame.setVisible(true); |
---|
646 | 786 | radio.layout = keepButton; |
---|
.. | .. |
---|
655 | 795 | // frame.setBounds(0, 0, frame.getToolkit().getScreenSize().width, |
---|
656 | 796 | // frame.getToolkit().getScreenSize().height); |
---|
657 | 797 | //frame.setVisible(false); |
---|
| 798 | + |
---|
| 799 | + frame.dispose(); |
---|
| 800 | + frame.setUndecorated(true); |
---|
658 | 801 | device.setFullScreenWindow(frame); |
---|
| 802 | + frame.validate(); |
---|
| 803 | + frame.setVisible(true); |
---|
659 | 804 | // frame.removeNotify(); |
---|
660 | 805 | // frame.setUndecorated(true); |
---|
661 | 806 | // frame.addNotify(); |
---|
.. | .. |
---|
664 | 809 | // X frame.getContentPane().add(/*"Center",*/bigThree); |
---|
665 | 810 | framePanel.setDividerLocation(0); |
---|
666 | 811 | |
---|
667 | | - radio.layout = twoButton; |
---|
| 812 | + radio.layout = fullscreenLayout; |
---|
668 | 813 | radio.layout.doClick(); |
---|
669 | 814 | //frame.setVisible(true); |
---|
670 | 815 | } |
---|
671 | | - |
---|
672 | | - cameraView.ToggleFullScreen(); |
---|
| 816 | + frame.validate(); |
---|
673 | 817 | } |
---|
| 818 | + |
---|
| 819 | + private byte[] CompressCopy() |
---|
| 820 | + { |
---|
| 821 | + boolean temp = CameraPane.SWITCH; |
---|
| 822 | + CameraPane.SWITCH = false; |
---|
| 823 | + |
---|
| 824 | + copy.ExtractBigData(versiontable); |
---|
| 825 | + // if (copy == client) |
---|
| 826 | + |
---|
| 827 | + byte[] versions[] = copy.versions; |
---|
| 828 | + copy.versions = null; |
---|
| 829 | + |
---|
| 830 | + byte[] compress = Compress(copy); |
---|
| 831 | + |
---|
| 832 | + copy.versions = versions; |
---|
| 833 | + |
---|
| 834 | + copy.RestoreBigData(versiontable); |
---|
| 835 | + |
---|
| 836 | + CameraPane.SWITCH = temp; |
---|
| 837 | + |
---|
| 838 | + return compress; |
---|
| 839 | + } |
---|
674 | 840 | |
---|
675 | 841 | private JTextPane createTextPane() |
---|
676 | 842 | { |
---|
.. | .. |
---|
810 | 976 | JCheckBox speedupCB; |
---|
811 | 977 | JCheckBox rewindCB; |
---|
812 | 978 | JCheckBox flipVCB; |
---|
| 979 | + |
---|
| 980 | + cCheckBox toggleTextureCB; |
---|
| 981 | + cCheckBox toggleSwitchCB; |
---|
| 982 | + |
---|
813 | 983 | JComboBox texresMenu; |
---|
| 984 | + |
---|
814 | 985 | JButton resetButton; |
---|
815 | 986 | JButton stepButton; |
---|
816 | 987 | JButton stepAllButton; |
---|
.. | .. |
---|
819 | 990 | JButton fasterButton; |
---|
820 | 991 | JButton remarkButton; |
---|
821 | 992 | |
---|
| 993 | + cGridBag editPanel; |
---|
| 994 | + cGridBag editCommandsPanel; |
---|
| 995 | + |
---|
822 | 996 | cGridBag namePanel; |
---|
823 | 997 | cGridBag setupPanel; |
---|
824 | 998 | cGridBag setupPanel2; |
---|
825 | | - cGridBag commandsPanel; |
---|
| 999 | + cGridBag objectCommandsPanel; |
---|
826 | 1000 | cGridBag pushPanel; |
---|
827 | 1001 | cGridBag fillPanel; |
---|
828 | 1002 | |
---|
.. | .. |
---|
994 | 1168 | namePanel = new cGridBag(); |
---|
995 | 1169 | |
---|
996 | 1170 | nameField = AddText(namePanel, copy.GetName()); |
---|
997 | | - namePanel.add(nameField); |
---|
| 1171 | + namePanel.add(new JScrollPane(nameField, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER)); |
---|
998 | 1172 | oe.ctrlPanel.add(namePanel); |
---|
999 | 1173 | |
---|
1000 | 1174 | oe.ctrlPanel.Return(); |
---|
1001 | 1175 | |
---|
1002 | | - if (!GroupEditor.allparams) |
---|
| 1176 | + if (!allparams) |
---|
1003 | 1177 | return; |
---|
1004 | 1178 | |
---|
1005 | 1179 | setupPanel = new cGridBag().setVertical(false); |
---|
.. | .. |
---|
1012 | 1186 | hideCB = AddCheckBox(setupPanel, "Hide", copy.hide); |
---|
1013 | 1187 | hideCB.setToolTipText("Hide object"); |
---|
1014 | 1188 | markCB = AddCheckBox(setupPanel, "Mark", copy.marked); |
---|
1015 | | - markCB.setToolTipText("Set the animation target transform"); |
---|
| 1189 | + markCB.setToolTipText("As animation target transform"); |
---|
1016 | 1190 | |
---|
1017 | 1191 | setupPanel2 = new cGridBag().setVertical(false); |
---|
1018 | 1192 | |
---|
1019 | 1193 | rewindCB = AddCheckBox(setupPanel2, "Rewind", copy.rewind); |
---|
1020 | 1194 | rewindCB.setToolTipText("Rewind animation"); |
---|
1021 | 1195 | |
---|
1022 | | - randomCB = AddCheckBox(setupPanel2, "Rand", copy.random); |
---|
1023 | | - randomCB.setToolTipText("Randomly Rewind or Go back and forth"); |
---|
| 1196 | + randomCB = AddCheckBox(setupPanel2, "Random", copy.random); |
---|
| 1197 | + randomCB.setToolTipText("Randomly Rewind (or Go back and forth)"); |
---|
1024 | 1198 | |
---|
| 1199 | + link2masterCB = AddCheckBox(setupPanel2, "Support", copy.link2master); |
---|
| 1200 | + link2masterCB.setToolTipText("Attach to support"); |
---|
| 1201 | + |
---|
1025 | 1202 | if (Globals.ADVANCED) |
---|
1026 | 1203 | { |
---|
1027 | | - link2masterCB = AddCheckBox(setupPanel2, "Supp", copy.link2master); |
---|
1028 | | - link2masterCB.setToolTipText("Attach to support"); |
---|
1029 | 1204 | speedupCB = AddCheckBox(setupPanel2, "Speed", copy.speedup); |
---|
1030 | 1205 | speedupCB.setToolTipText("Option motion capture"); |
---|
1031 | 1206 | } |
---|
.. | .. |
---|
1035 | 1210 | oe.ctrlPanel.add(setupPanel2); |
---|
1036 | 1211 | oe.ctrlPanel.Return(); |
---|
1037 | 1212 | |
---|
1038 | | - commandsPanel = new cGridBag().setVertical(false); |
---|
| 1213 | + objectCommandsPanel = new cGridBag().setVertical(false); |
---|
1039 | 1214 | |
---|
1040 | | - resetButton = AddButton(commandsPanel, "Reset"); |
---|
| 1215 | + resetButton = AddButton(objectCommandsPanel, "Reset"); |
---|
1041 | 1216 | resetButton.setToolTipText("Jump to frame zero"); |
---|
1042 | | - stepButton = AddButton(commandsPanel, "Step"); |
---|
| 1217 | + stepButton = AddButton(objectCommandsPanel, "Step"); |
---|
1043 | 1218 | stepButton.setToolTipText("Step one frame"); |
---|
1044 | 1219 | // resetAllButton = AddButton(oe, "Reset All"); |
---|
1045 | 1220 | // stepAllButton = AddButton(oe, "Step All"); |
---|
1046 | 1221 | // Return(); |
---|
1047 | | - slowerButton = AddButton(commandsPanel, "Slow"); |
---|
| 1222 | + slowerButton = AddButton(objectCommandsPanel, "Slow"); |
---|
1048 | 1223 | slowerButton.setToolTipText("Decrease animation speed"); |
---|
1049 | | - fasterButton = AddButton(commandsPanel, "Fast"); |
---|
| 1224 | + fasterButton = AddButton(objectCommandsPanel, "Fast"); |
---|
1050 | 1225 | fasterButton.setToolTipText("Increase animation speed"); |
---|
1051 | | - remarkButton = AddButton(commandsPanel, "Remark"); |
---|
| 1226 | + remarkButton = AddButton(objectCommandsPanel, "Remark"); |
---|
1052 | 1227 | remarkButton.setToolTipText("Set the current transform as the target"); |
---|
1053 | 1228 | |
---|
1054 | | - oe.ctrlPanel.add(commandsPanel); |
---|
| 1229 | + oe.ctrlPanel.add(objectCommandsPanel); |
---|
1055 | 1230 | oe.ctrlPanel.Return(); |
---|
1056 | 1231 | |
---|
1057 | 1232 | pushPanel = AddSlider(oe.ctrlPanel, "Push", -1, 1, copy.NORMALPUSH, 1.1); // To have the buttons |
---|
.. | .. |
---|
1340 | 1515 | // north.setName("Edit"); |
---|
1341 | 1516 | // north.add(ctrlPanel, BorderLayout.NORTH); |
---|
1342 | 1517 | // objectPanel.add(north); |
---|
1343 | | - objectPanel.add(ctrlPanel); |
---|
1344 | | - objectPanel.add(infoPanel); |
---|
| 1518 | + objectPanel.add(editPanel); |
---|
| 1519 | + |
---|
| 1520 | + //if (Globals.ADVANCED) |
---|
| 1521 | + objectPanel.add(infoPanel); |
---|
| 1522 | + |
---|
| 1523 | + objectPanel.add(toolboxPanel); |
---|
1345 | 1524 | |
---|
1346 | 1525 | /* |
---|
1347 | 1526 | aConstraints.gridx = 0; |
---|
.. | .. |
---|
1350 | 1529 | aConstraints.gridy += 1; |
---|
1351 | 1530 | aConstraints.gridwidth = 1; |
---|
1352 | 1531 | mainPanel.add(objectPanel, aConstraints); |
---|
1353 | | - */ |
---|
| 1532 | + */ |
---|
1354 | 1533 | |
---|
1355 | 1534 | scrollpane = new JScrollPane(mainPanel, ScrollPaneConstants.// VERTICAL_SCROLLBAR_ALWAYS, |
---|
1356 | 1535 | VERTICAL_SCROLLBAR_AS_NEEDED, |
---|
.. | .. |
---|
1367 | 1546 | JTabbedPane tabbedPane = new JTabbedPane(); |
---|
1368 | 1547 | tabbedPane.add(scrollpane); |
---|
1369 | 1548 | |
---|
1370 | | - tabbedPane.add(FSPane = new cFileSystemPane(this)); |
---|
1371 | | - |
---|
1372 | | - optionsPanel = new cGridBag().setVertical(true); |
---|
| 1549 | + optionsPanel = new cGridBag().setVertical(false); |
---|
1373 | 1550 | |
---|
1374 | 1551 | optionsPanel.setName("Options"); |
---|
1375 | 1552 | |
---|
.. | .. |
---|
1377 | 1554 | |
---|
1378 | 1555 | tabbedPane.add(optionsPanel); |
---|
1379 | 1556 | |
---|
| 1557 | + tabbedPane.add(FSPane = new cFileSystemPane(this)); |
---|
| 1558 | + |
---|
1380 | 1559 | scenePanel.add(tabbedPane); |
---|
1381 | 1560 | |
---|
1382 | 1561 | /* |
---|
.. | .. |
---|
1449 | 1628 | // aConstraints.gridheight = 1; |
---|
1450 | 1629 | |
---|
1451 | 1630 | framePanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, toolbarPanel, bigThree); |
---|
1452 | | - framePanel.setContinuousLayout(true); |
---|
1453 | | - framePanel.setOneTouchExpandable(true); |
---|
1454 | | - framePanel.setDividerLocation(0.8); |
---|
| 1631 | + framePanel.setContinuousLayout(false); |
---|
| 1632 | + framePanel.setOneTouchExpandable(false); |
---|
| 1633 | + //.setDividerLocation(0.8); |
---|
1455 | 1634 | //framePanel.setDividerSize(15); |
---|
1456 | 1635 | //framePanel.setResizeWeight(0.15); |
---|
1457 | 1636 | framePanel.setName("Frame"); |
---|
.. | .. |
---|
1469 | 1648 | // aConstraints = gbc; // (GridBagConstraints) GrafreeD.clone(gbc); |
---|
1470 | 1649 | |
---|
1471 | 1650 | frame.setSize(1280, 860); |
---|
1472 | | - frame.setVisible(true); |
---|
1473 | | - |
---|
| 1651 | + |
---|
1474 | 1652 | cameraView.requestFocusInWindow(); |
---|
1475 | 1653 | |
---|
1476 | 1654 | gridPanel.setDividerLocation(1.0); |
---|
| 1655 | + |
---|
| 1656 | + frame.validate(); |
---|
| 1657 | + |
---|
| 1658 | + frame.setVisible(true); |
---|
1477 | 1659 | |
---|
1478 | 1660 | frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); |
---|
1479 | 1661 | frame.addWindowListener(new WindowAdapter() |
---|
.. | .. |
---|
1560 | 1742 | texture.add(textureField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
1561 | 1743 | colorSection.add(texture); |
---|
1562 | 1744 | |
---|
1563 | | - cGridBag anisoU = new cGridBag(); |
---|
1564 | | - anisoU.add(anisoLabel = new JLabel("AnisoU")); // , aConstraints); |
---|
1565 | | - anisoLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1566 | | - anisoU.add(anisoField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
1567 | | - colorSection.add(anisoU); |
---|
1568 | | - |
---|
1569 | | - cGridBag anisoV = new cGridBag(); |
---|
1570 | | - anisoV.add(anisoVLabel = new JLabel("AnisoV")); // , aConstraints); |
---|
1571 | | - anisoVLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1572 | | - anisoV.add(anisoVField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
1573 | | - colorSection.add(anisoV); |
---|
1574 | | - |
---|
1575 | | - cGridBag shadowbias = new cGridBag(); |
---|
1576 | | - shadowbias.add(shadowbiasLabel = new JLabel("Shadowbias")); // , aConstraints); |
---|
1577 | | - shadowbiasLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1578 | | - shadowbias.add(shadowbiasField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
1579 | | - colorSection.add(shadowbias); |
---|
1580 | | - |
---|
1581 | 1745 | panel.add(new JSeparator()); |
---|
1582 | 1746 | |
---|
1583 | 1747 | panel.add(colorSection); |
---|
.. | .. |
---|
1627 | 1791 | fakedepthLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1628 | 1792 | fakedepth.add(fakedepthField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
1629 | 1793 | diffuseSection.add(fakedepth); |
---|
| 1794 | + |
---|
| 1795 | + cGridBag shadowbias = new cGridBag(); |
---|
| 1796 | + shadowbias.add(shadowbiasLabel = new JLabel("Shadowbias")); // , aConstraints); |
---|
| 1797 | + shadowbiasLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 1798 | + shadowbias.add(shadowbiasField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
| 1799 | + diffuseSection.add(shadowbias); |
---|
1630 | 1800 | |
---|
1631 | 1801 | panel.add(new JSeparator()); |
---|
1632 | 1802 | |
---|
.. | .. |
---|
1678 | 1848 | // aConstraints.gridy += 1; |
---|
1679 | 1849 | // aConstraints.gridwidth = 1; |
---|
1680 | 1850 | |
---|
| 1851 | + cGridBag anisoU = new cGridBag(); |
---|
| 1852 | + anisoU.add(anisoLabel = new JLabel("AnisoU")); // , aConstraints); |
---|
| 1853 | + anisoLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 1854 | + anisoU.add(anisoField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
| 1855 | + specularSection.add(anisoU); |
---|
| 1856 | + |
---|
| 1857 | + cGridBag anisoV = new cGridBag(); |
---|
| 1858 | + anisoV.add(anisoVLabel = new JLabel("AnisoV")); // , aConstraints); |
---|
| 1859 | + anisoVLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 1860 | + anisoV.add(anisoVField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
| 1861 | + specularSection.add(anisoV); |
---|
| 1862 | + |
---|
1681 | 1863 | |
---|
1682 | 1864 | panel.add(new JSeparator()); |
---|
1683 | 1865 | |
---|
.. | .. |
---|
1685 | 1867 | |
---|
1686 | 1868 | //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints); |
---|
1687 | 1869 | |
---|
1688 | | - cGridBag globalSection = new cGridBag().setVertical(true); |
---|
| 1870 | + //cGridBag globalSection = new cGridBag().setVertical(true); |
---|
1689 | 1871 | |
---|
1690 | 1872 | cGridBag camera = new cGridBag(); |
---|
1691 | 1873 | camera.add(cameraLabel = new JLabel("GlobalLight")); // , aConstraints); |
---|
1692 | 1874 | cameraLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1693 | 1875 | camera.add(cameraField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
1694 | | - globalSection.add(camera); |
---|
| 1876 | + colorSection.add(camera); |
---|
1695 | 1877 | |
---|
1696 | 1878 | cGridBag ambient = new cGridBag(); |
---|
1697 | 1879 | ambient.add(ambientLabel = new JLabel("Ambient")); // , aConstraints); |
---|
1698 | 1880 | ambientLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1699 | 1881 | ambient.add(ambientField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
1700 | | - globalSection.add(ambient); |
---|
| 1882 | + colorSection.add(ambient); |
---|
1701 | 1883 | |
---|
1702 | 1884 | cGridBag backlit = new cGridBag(); |
---|
1703 | 1885 | backlit.add(backlitLabel = new JLabel("Backlit")); // , aConstraints); |
---|
1704 | 1886 | backlitLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1705 | 1887 | backlit.add(backlitField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
1706 | | - globalSection.add(backlit); |
---|
| 1888 | + colorSection.add(backlit); |
---|
1707 | 1889 | |
---|
1708 | 1890 | cGridBag opacity = new cGridBag(); |
---|
1709 | 1891 | opacity.add(opacityLabel = new JLabel("Opacity")); // , aConstraints); |
---|
1710 | 1892 | opacityLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1711 | 1893 | opacity.add(opacityField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
1712 | | - globalSection.add(opacity); |
---|
| 1894 | + colorSection.add(opacity); |
---|
1713 | 1895 | |
---|
1714 | | - panel.add(new JSeparator()); |
---|
| 1896 | + //panel.add(new JSeparator()); |
---|
1715 | 1897 | |
---|
1716 | | - panel.add(globalSection); |
---|
| 1898 | + //panel.add(globalSection); |
---|
1717 | 1899 | |
---|
1718 | 1900 | //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints); |
---|
1719 | 1901 | |
---|
.. | .. |
---|
1820 | 2002 | // 3D models |
---|
1821 | 2003 | if (filename.endsWith(".3ds") || filename.endsWith(".3DS")) |
---|
1822 | 2004 | { |
---|
1823 | | - lastConverter = new com.jmex.model.converters.MaxToJme(); |
---|
1824 | | - LoadFile(filename, lastConverter); |
---|
| 2005 | + //lastConverter = new com.jmex.model.converters.MaxToJme(); |
---|
| 2006 | + //LoadFile(filename, lastConverter); |
---|
| 2007 | + LoadObjFile(filename); // New 3ds loader |
---|
1825 | 2008 | continue; |
---|
1826 | 2009 | } |
---|
1827 | 2010 | if (filename.endsWith(".dae") || filename.endsWith(".DAE")) |
---|
.. | .. |
---|
2547 | 2730 | LA.matXRotate(((Object3D) group.get(group.size() - 1)).toParent, -Math.PI / 2); |
---|
2548 | 2731 | LA.matXRotate(((Object3D) group.get(group.size() - 1)).fromParent, Math.PI / 2); |
---|
2549 | 2732 | } |
---|
| 2733 | + |
---|
2550 | 2734 | //cJME.count++; |
---|
2551 | 2735 | //cJME.count %= 12; |
---|
2552 | 2736 | if (gc) |
---|
.. | .. |
---|
2730 | 2914 | } |
---|
2731 | 2915 | } |
---|
2732 | 2916 | } |
---|
| 2917 | + |
---|
2733 | 2918 | cFileSystemPane FSPane; |
---|
2734 | 2919 | |
---|
2735 | 2920 | void SetMaterial(cMaterial mat, Object3D.cVector2[] others) |
---|
.. | .. |
---|
2783 | 2968 | } |
---|
2784 | 2969 | } |
---|
2785 | 2970 | } |
---|
| 2971 | + |
---|
2786 | 2972 | freezematerial = false; |
---|
2787 | 2973 | } |
---|
2788 | 2974 | |
---|
2789 | 2975 | void SetMaterial(Object3D object) |
---|
2790 | 2976 | { |
---|
| 2977 | + latestObject = object; |
---|
| 2978 | + |
---|
2791 | 2979 | cMaterial mat = object.material; |
---|
2792 | 2980 | |
---|
2793 | 2981 | if (mat == null) |
---|
.. | .. |
---|
2899 | 3087 | // } |
---|
2900 | 3088 | |
---|
2901 | 3089 | /**/ |
---|
2902 | | - if (deselect) |
---|
| 3090 | + if (deselect || child == null) |
---|
2903 | 3091 | { |
---|
2904 | 3092 | //group.deselectAll(); |
---|
2905 | 3093 | //freeze = true; |
---|
2906 | 3094 | GetTree().clearSelection(); |
---|
2907 | 3095 | //freeze = false; |
---|
| 3096 | + |
---|
| 3097 | + if (child == null) |
---|
| 3098 | + { |
---|
| 3099 | + return; |
---|
| 3100 | + } |
---|
2908 | 3101 | } |
---|
2909 | 3102 | |
---|
2910 | 3103 | //group.addSelectee(child); |
---|
.. | .. |
---|
2973 | 3166 | cameraView.ToggleDL(); |
---|
2974 | 3167 | cameraView.repaint(); |
---|
2975 | 3168 | return; |
---|
2976 | | - } else if (event.getSource() == toggleTextureItem) |
---|
| 3169 | + } else if (event.getSource() == toggleTextureItem || event.getSource() == toggleTextureCB) |
---|
2977 | 3170 | { |
---|
2978 | 3171 | cameraView.ToggleTexture(); |
---|
2979 | 3172 | // june 2013 copy.HardTouch(); |
---|
.. | .. |
---|
3012 | 3205 | frame.validate(); |
---|
3013 | 3206 | |
---|
3014 | 3207 | return; |
---|
3015 | | - } else if (event.getSource() == toggleSwitchItem) |
---|
| 3208 | + } else if (event.getSource() == toggleSwitchItem || event.getSource() == toggleSwitchCB) |
---|
3016 | 3209 | { |
---|
3017 | 3210 | cameraView.ToggleSwitch(); |
---|
3018 | 3211 | cameraView.repaint(); |
---|
.. | .. |
---|
3228 | 3421 | { |
---|
3229 | 3422 | Close(); |
---|
3230 | 3423 | //return true; |
---|
3231 | | - } else if (source == loadItem) |
---|
| 3424 | + } else if (source == openItem) |
---|
3232 | 3425 | { |
---|
3233 | | - load(); |
---|
| 3426 | + Open(); |
---|
3234 | 3427 | //return true; |
---|
3235 | 3428 | } else if (source == newItem) |
---|
3236 | 3429 | { |
---|
.. | .. |
---|
3255 | 3448 | { |
---|
3256 | 3449 | generatePOV(); |
---|
3257 | 3450 | //return true; |
---|
| 3451 | + } else if (event.getSource() == archiveItem) |
---|
| 3452 | + { |
---|
| 3453 | + cTools.Archive(frame); |
---|
| 3454 | + return; |
---|
3258 | 3455 | } else if (source == zBufferItem) |
---|
3259 | 3456 | { |
---|
3260 | 3457 | try |
---|
.. | .. |
---|
3306 | 3503 | try |
---|
3307 | 3504 | { |
---|
3308 | 3505 | ByteArrayOutputStream baos = new ByteArrayOutputStream(); |
---|
3309 | | - java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(baos); |
---|
3310 | | - ObjectOutputStream out = new ObjectOutputStream(zstream); |
---|
| 3506 | +// java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(baos); |
---|
| 3507 | + ObjectOutputStream out = new ObjectOutputStream(baos); //zstream); |
---|
3311 | 3508 | |
---|
3312 | 3509 | Object3D parent = o.parent; |
---|
3313 | 3510 | o.parent = null; |
---|
.. | .. |
---|
3318 | 3515 | |
---|
3319 | 3516 | out.flush(); |
---|
3320 | 3517 | |
---|
3321 | | - zstream.close(); |
---|
| 3518 | + baos //zstream |
---|
| 3519 | + .close(); |
---|
3322 | 3520 | out.close(); |
---|
3323 | 3521 | |
---|
3324 | | - return baos.toByteArray(); |
---|
| 3522 | + byte[] bytes = baos.toByteArray(); |
---|
| 3523 | + |
---|
| 3524 | + System.out.println("save #bytes = " + bytes.length); |
---|
| 3525 | + return bytes; |
---|
3325 | 3526 | } catch (Exception e) |
---|
3326 | 3527 | { |
---|
3327 | 3528 | System.err.println(e); |
---|
.. | .. |
---|
3331 | 3532 | |
---|
3332 | 3533 | static public Object Uncompress(byte[] bytes) |
---|
3333 | 3534 | { |
---|
3334 | | - System.out.println("#bytes = " + bytes.length); |
---|
| 3535 | + System.out.println("restore #bytes = " + bytes.length); |
---|
3335 | 3536 | try |
---|
3336 | 3537 | { |
---|
3337 | 3538 | ByteArrayInputStream bais = new ByteArrayInputStream(bytes); |
---|
3338 | | - java.util.zip.GZIPInputStream istream = new java.util.zip.GZIPInputStream(bais); |
---|
3339 | | - ObjectInputStream in = new ObjectInputStream(istream); |
---|
| 3539 | + //java.util.zip.GZIPInputStream istream = new java.util.zip.GZIPInputStream(bais); |
---|
| 3540 | + ObjectInputStream in = new ObjectInputStream(bais); // istream); |
---|
3340 | 3541 | Object obj = in.readObject(); |
---|
| 3542 | + |
---|
| 3543 | + bais //istream |
---|
| 3544 | + .close(); |
---|
3341 | 3545 | in.close(); |
---|
3342 | 3546 | |
---|
3343 | 3547 | return obj; |
---|
.. | .. |
---|
3392 | 3596 | return null; |
---|
3393 | 3597 | } |
---|
3394 | 3598 | |
---|
3395 | | - java.util.Hashtable<java.util.UUID, Object3D> hashtable = new java.util.Hashtable<java.util.UUID, Object3D>(); |
---|
3396 | 3599 | |
---|
3397 | 3600 | public void Save() |
---|
3398 | 3601 | { |
---|
| 3602 | + //Save(true); |
---|
| 3603 | + Replace(); |
---|
| 3604 | + } |
---|
| 3605 | + |
---|
| 3606 | + private boolean Equal(byte[] compress, byte[] name) |
---|
| 3607 | + { |
---|
| 3608 | + if (compress.length != name.length) |
---|
| 3609 | + { |
---|
| 3610 | + return false; |
---|
| 3611 | + } |
---|
| 3612 | + |
---|
| 3613 | + for (int i=compress.length; --i>=0;) |
---|
| 3614 | + { |
---|
| 3615 | + if (compress[i] != name[i]) |
---|
| 3616 | + return false; |
---|
| 3617 | + } |
---|
| 3618 | + |
---|
| 3619 | + return true; |
---|
| 3620 | + } |
---|
| 3621 | + |
---|
| 3622 | + java.util.Hashtable<java.util.UUID, Object3D> versiontable = new java.util.Hashtable<java.util.UUID, Object3D>(); |
---|
| 3623 | + |
---|
| 3624 | + public boolean Save(boolean user) |
---|
| 3625 | + { |
---|
| 3626 | + System.err.println("Save"); |
---|
| 3627 | + |
---|
3399 | 3628 | cRadio tab = GetCurrentTab(); |
---|
3400 | 3629 | |
---|
3401 | | - boolean temp = CameraPane.SWITCH; |
---|
3402 | | - CameraPane.SWITCH = false; |
---|
| 3630 | + byte[] compress = CompressCopy(); |
---|
3403 | 3631 | |
---|
3404 | | - copy.ExtractBigData(hashtable); |
---|
| 3632 | + boolean thesame = false; |
---|
| 3633 | + |
---|
| 3634 | + // Quick heuristic using length. Works only when stream is compressed. |
---|
| 3635 | + if (copy.versionindex > 0 && copy.versions[copy.versionindex-1] != null && Equal(compress, copy.versions[copy.versionindex-1])) |
---|
| 3636 | + { |
---|
| 3637 | + thesame = true; |
---|
| 3638 | + } |
---|
3405 | 3639 | |
---|
3406 | 3640 | //EditorFrame.m_MainFrame.requestFocusInWindow(); |
---|
3407 | | - tab.graphs[tab.undoindex++] = Compress(copy); |
---|
3408 | | - |
---|
3409 | | - copy.RestoreBigData(hashtable); |
---|
3410 | | - |
---|
3411 | | - CameraPane.SWITCH = temp; |
---|
3412 | | - |
---|
3413 | | - //assert(hashtable.isEmpty()); |
---|
3414 | | - |
---|
3415 | | - for (int i = tab.undoindex; i < tab.graphs.length; i++) |
---|
| 3641 | + if (!thesame) |
---|
3416 | 3642 | { |
---|
3417 | | - tab.graphs[i] = null; |
---|
| 3643 | + //tab.user[tab.versionindex] = user; |
---|
| 3644 | + //boolean increment = true; // tab.graphs[tab.versionindex] == null; |
---|
| 3645 | + |
---|
| 3646 | + copy.versions[++copy.versionindex] = compress; |
---|
| 3647 | + |
---|
| 3648 | + // if (increment) |
---|
| 3649 | + // tab.versionindex++; |
---|
3418 | 3650 | } |
---|
3419 | 3651 | |
---|
| 3652 | + //copy.RestoreBigData(versiontable); |
---|
| 3653 | + |
---|
| 3654 | + //assert(hashtable.isEmpty()); |
---|
| 3655 | + |
---|
| 3656 | + for (int i = copy.versionindex+1; i < copy.versions.length; i++) |
---|
| 3657 | + { |
---|
| 3658 | + //tab.user[i] = false; |
---|
| 3659 | + copy.versions[i] = null; |
---|
| 3660 | + } |
---|
| 3661 | + |
---|
| 3662 | + SetUndoStates(); |
---|
| 3663 | + |
---|
3420 | 3664 | // test save |
---|
3421 | 3665 | if (false) |
---|
3422 | 3666 | { |
---|
3423 | 3667 | try |
---|
3424 | 3668 | { |
---|
3425 | | - FileOutputStream ostream = new FileOutputStream("save" + tab.undoindex); |
---|
| 3669 | + FileOutputStream ostream = new FileOutputStream("save" + copy.versionindex); |
---|
3426 | 3670 | ObjectOutputStream p = new ObjectOutputStream(ostream); |
---|
3427 | 3671 | |
---|
3428 | 3672 | p.writeObject(copy); |
---|
.. | .. |
---|
3435 | 3679 | e.printStackTrace(); |
---|
3436 | 3680 | } |
---|
3437 | 3681 | } |
---|
| 3682 | + |
---|
| 3683 | + return !thesame; |
---|
3438 | 3684 | } |
---|
3439 | 3685 | |
---|
3440 | 3686 | void CopyChanged(Object3D obj) |
---|
3441 | 3687 | { |
---|
| 3688 | + SetUndoStates(); |
---|
| 3689 | + |
---|
3442 | 3690 | boolean temp = CameraPane.SWITCH; |
---|
3443 | 3691 | CameraPane.SWITCH = false; |
---|
3444 | 3692 | |
---|
3445 | | - copy.ExtractBigData(hashtable); |
---|
| 3693 | + copy.ExtractBigData(versiontable); |
---|
3446 | 3694 | |
---|
3447 | 3695 | copy.clear(); |
---|
3448 | 3696 | |
---|
.. | .. |
---|
3451 | 3699 | copy.add(obj.get(i)); |
---|
3452 | 3700 | } |
---|
3453 | 3701 | |
---|
3454 | | - copy.RestoreBigData(hashtable); |
---|
| 3702 | + copy.RestoreBigData(versiontable); |
---|
3455 | 3703 | |
---|
3456 | 3704 | CameraPane.SWITCH = temp; |
---|
3457 | 3705 | |
---|
.. | .. |
---|
3478 | 3726 | refreshContents(); |
---|
3479 | 3727 | } |
---|
3480 | 3728 | |
---|
3481 | | - public void Undo() |
---|
| 3729 | + cButton undoButton; |
---|
| 3730 | + cButton restoreButton; |
---|
| 3731 | + cButton replaceButton; |
---|
| 3732 | + cButton redoButton; |
---|
| 3733 | + |
---|
| 3734 | + void SetUndoStates() |
---|
3482 | 3735 | { |
---|
3483 | 3736 | cRadio tab = GetCurrentTab(); |
---|
3484 | 3737 | |
---|
3485 | | - if (tab.undoindex == 0) |
---|
| 3738 | + restoreButton.setEnabled(copy.versionindex != -1); |
---|
| 3739 | + replaceButton.setEnabled(copy.versionindex != -1); |
---|
| 3740 | + undoButton.setEnabled(copy.versionindex > 0); |
---|
| 3741 | + redoButton.setEnabled(copy.versions[copy.versionindex + 1] != null); |
---|
| 3742 | + } |
---|
| 3743 | + |
---|
| 3744 | + public boolean Undo() |
---|
| 3745 | + { |
---|
| 3746 | + System.err.println("Undo"); |
---|
| 3747 | + |
---|
| 3748 | + cRadio tab = GetCurrentTab(); |
---|
| 3749 | + |
---|
| 3750 | + if (copy.versionindex == 0) |
---|
3486 | 3751 | { |
---|
3487 | 3752 | java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
3488 | | - return; |
---|
| 3753 | + return false; |
---|
3489 | 3754 | } |
---|
3490 | 3755 | |
---|
3491 | | - if (tab.graphs[tab.undoindex] == null) |
---|
| 3756 | +// if (tab.graphs[tab.versionindex] == null) // || !tab.user[tab.versionindex]) |
---|
| 3757 | +// { |
---|
| 3758 | +// if (Save(false)) |
---|
| 3759 | +// tab.versionindex -= 1; |
---|
| 3760 | +// else |
---|
| 3761 | +// { |
---|
| 3762 | +// if (tab.versionindex <= 0) |
---|
| 3763 | +// return false; |
---|
| 3764 | +// else |
---|
| 3765 | +// tab.versionindex -= 1; |
---|
| 3766 | +// } |
---|
| 3767 | +// } |
---|
| 3768 | + |
---|
| 3769 | + copy.versionindex -= 1; |
---|
| 3770 | + |
---|
| 3771 | + CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex])); |
---|
| 3772 | + |
---|
| 3773 | + return true; |
---|
| 3774 | + } |
---|
| 3775 | + |
---|
| 3776 | + public boolean Restore() |
---|
| 3777 | + { |
---|
| 3778 | + System.err.println("Restore"); |
---|
| 3779 | + |
---|
| 3780 | + cRadio tab = GetCurrentTab(); |
---|
| 3781 | + |
---|
| 3782 | + if (copy.versionindex == -1 || copy.versions[copy.versionindex] == null) |
---|
3492 | 3783 | { |
---|
3493 | | - Save(); |
---|
3494 | | - tab.undoindex -= 1; |
---|
| 3784 | + java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
| 3785 | + return false; |
---|
3495 | 3786 | } |
---|
3496 | 3787 | |
---|
3497 | | - tab.undoindex -= 1; |
---|
| 3788 | + CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex])); |
---|
| 3789 | + |
---|
| 3790 | + return true; |
---|
| 3791 | + } |
---|
3498 | 3792 | |
---|
3499 | | - CopyChanged((Object3D)Uncompress(tab.graphs[tab.undoindex])); |
---|
| 3793 | + public boolean Replace() |
---|
| 3794 | + { |
---|
| 3795 | + System.err.println("Replace"); |
---|
| 3796 | + |
---|
| 3797 | + cRadio tab = GetCurrentTab(); |
---|
| 3798 | + |
---|
| 3799 | + if (copy.versionindex == -1 || copy.versions[copy.versionindex] == null) |
---|
| 3800 | + { |
---|
| 3801 | + // No version yet. OK. java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
| 3802 | + return false; |
---|
| 3803 | + } |
---|
| 3804 | + |
---|
| 3805 | + copy.versions[copy.versionindex] = CompressCopy(); |
---|
| 3806 | + |
---|
| 3807 | + return true; |
---|
3500 | 3808 | } |
---|
3501 | 3809 | |
---|
3502 | 3810 | public void Redo() |
---|
3503 | 3811 | { |
---|
3504 | 3812 | cRadio tab = GetCurrentTab(); |
---|
3505 | 3813 | |
---|
3506 | | - if (tab.graphs[tab.undoindex + 1] == null) |
---|
| 3814 | + if (copy.versions[copy.versionindex + 1] == null) |
---|
3507 | 3815 | { |
---|
3508 | 3816 | java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
3509 | 3817 | return; |
---|
3510 | 3818 | } |
---|
3511 | 3819 | |
---|
3512 | | - tab.undoindex += 1; |
---|
| 3820 | + copy.versionindex += 1; |
---|
3513 | 3821 | |
---|
3514 | | - CopyChanged((Object3D)Uncompress(tab.graphs[tab.undoindex])); |
---|
| 3822 | + CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex])); |
---|
| 3823 | + |
---|
| 3824 | + //if (!tab.user[tab.versionindex]) |
---|
| 3825 | + // tab.graphs[tab.versionindex] = null; |
---|
3515 | 3826 | } |
---|
3516 | 3827 | |
---|
3517 | 3828 | void ImportGFD() |
---|
.. | .. |
---|
3663 | 3974 | assert false; |
---|
3664 | 3975 | } |
---|
3665 | 3976 | |
---|
3666 | | - void EditSelection() |
---|
| 3977 | + void EditSelection(boolean newWindow) |
---|
3667 | 3978 | { |
---|
3668 | 3979 | } |
---|
3669 | 3980 | |
---|
.. | .. |
---|
3807 | 4118 | //copy.Touch(); |
---|
3808 | 4119 | } |
---|
3809 | 4120 | |
---|
| 4121 | + cNumberSlider versionField; |
---|
| 4122 | + |
---|
3810 | 4123 | public void stateChanged(ChangeEvent e) |
---|
3811 | 4124 | { |
---|
3812 | 4125 | // assert(false); |
---|
| 4126 | + if (e.getSource() == versionField) |
---|
| 4127 | + { |
---|
| 4128 | + int version = versionField.getInteger(); |
---|
| 4129 | + |
---|
| 4130 | + if (copy.versions[version] != null) |
---|
| 4131 | + { |
---|
| 4132 | + CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex = version])); |
---|
| 4133 | + } |
---|
| 4134 | + |
---|
| 4135 | + return; |
---|
| 4136 | + } |
---|
3813 | 4137 | |
---|
3814 | 4138 | if (freezematerial) |
---|
3815 | 4139 | { |
---|
.. | .. |
---|
4158 | 4482 | |
---|
4159 | 4483 | void makeSomething(Object3D thing, boolean resetmodel) // deselect) |
---|
4160 | 4484 | { |
---|
4161 | | - Save(); |
---|
| 4485 | + if (Globals.REPLACEONMAKE) // && resetmodel) |
---|
| 4486 | + Save(); |
---|
4162 | 4487 | //Tween.set(thing, 0).target(1).start(tweenManager); |
---|
4163 | 4488 | //Tween.to(thing, 0, 0.5f).target(0).start(tweenManager); |
---|
4164 | 4489 | // if (thing instanceof GenericJointDemo) |
---|
.. | .. |
---|
4245 | 4570 | { |
---|
4246 | 4571 | ResetModel(); |
---|
4247 | 4572 | Select(thing.GetTreePath(), true, false); // unselect... false); |
---|
| 4573 | + |
---|
| 4574 | + if (thing.Size() == 0) |
---|
| 4575 | + { |
---|
| 4576 | + //EditSelection(false); |
---|
| 4577 | + } |
---|
| 4578 | + |
---|
4248 | 4579 | refreshContents(); |
---|
4249 | 4580 | } |
---|
4250 | 4581 | |
---|
.. | .. |
---|
4467 | 4798 | |
---|
4468 | 4799 | if (readobj != null) |
---|
4469 | 4800 | { |
---|
4470 | | - Save(); |
---|
| 4801 | + //if (Globals.SAVEONMAKE) // A new object cannot share meshes |
---|
| 4802 | + // Save(); |
---|
4471 | 4803 | try |
---|
4472 | 4804 | { |
---|
4473 | 4805 | //readobj.deepCopySelf(copy); |
---|
.. | .. |
---|
4522 | 4854 | c.addChild(csg); |
---|
4523 | 4855 | } |
---|
4524 | 4856 | |
---|
| 4857 | + copy.versions = readobj.versions; |
---|
| 4858 | + copy.versionindex = readobj.versionindex; |
---|
| 4859 | + |
---|
| 4860 | + SetUndoStates(); |
---|
| 4861 | + |
---|
4525 | 4862 | ResetModel(); |
---|
4526 | 4863 | copy.HardTouch(); // recompile? |
---|
4527 | 4864 | refreshContents(); |
---|
4528 | 4865 | } |
---|
4529 | 4866 | } |
---|
4530 | 4867 | |
---|
4531 | | - void load() // throws ClassNotFoundException |
---|
| 4868 | + void Open() // throws ClassNotFoundException |
---|
4532 | 4869 | { |
---|
4533 | 4870 | if (Grafreed.standAlone) |
---|
4534 | 4871 | { |
---|
.. | .. |
---|
4645 | 4982 | String filename = browser.getFile(); |
---|
4646 | 4983 | if (filename != null && filename.length() > 0) |
---|
4647 | 4984 | { |
---|
| 4985 | + if (!filename.endsWith(".gfd")) |
---|
| 4986 | + filename += ".gfd"; |
---|
4648 | 4987 | lastname = browser.getDirectory() + filename; |
---|
4649 | 4988 | save(); |
---|
4650 | 4989 | } |
---|
.. | .. |
---|
4811 | 5150 | MenuBar menuBar; |
---|
4812 | 5151 | Menu fileMenu; |
---|
4813 | 5152 | MenuItem newItem; |
---|
4814 | | - MenuItem loadItem; |
---|
| 5153 | + MenuItem openItem; |
---|
4815 | 5154 | MenuItem saveItem; |
---|
4816 | 5155 | MenuItem saveAsItem; |
---|
4817 | 5156 | MenuItem exportAsItem; |
---|
.. | .. |
---|
4834 | 5173 | CheckboxMenuItem toggleSwitchItem; |
---|
4835 | 5174 | CheckboxMenuItem toggleRootItem; |
---|
4836 | 5175 | CheckboxMenuItem animationItem; |
---|
| 5176 | + MenuItem archiveItem; |
---|
4837 | 5177 | CheckboxMenuItem toggleHandleItem; |
---|
4838 | 5178 | CheckboxMenuItem togglePaintItem; |
---|
4839 | 5179 | JSplitPane mainPanel; |
---|
4840 | 5180 | JScrollPane scrollpane; |
---|
| 5181 | + |
---|
4841 | 5182 | JPanel toolbarPanel; |
---|
| 5183 | + |
---|
4842 | 5184 | cGridBag treePanel; |
---|
| 5185 | + |
---|
4843 | 5186 | JPanel radioPanel; |
---|
4844 | 5187 | ButtonGroup buttonGroup; |
---|
4845 | | - cGridBag ctrlPanel; |
---|
| 5188 | + |
---|
| 5189 | + cGridBag toolboxPanel; |
---|
4846 | 5190 | cGridBag materialPanel; |
---|
| 5191 | + cGridBag ctrlPanel; |
---|
| 5192 | + |
---|
4847 | 5193 | JScrollPane infoPanel; |
---|
| 5194 | + |
---|
4848 | 5195 | cGridBag optionsPanel; |
---|
| 5196 | + |
---|
4849 | 5197 | JTabbedPane objectPanel; |
---|
| 5198 | + boolean materialFlushed; |
---|
| 5199 | + Object3D latestObject; |
---|
| 5200 | + |
---|
4850 | 5201 | cGridBag XYZPanel; |
---|
| 5202 | + |
---|
4851 | 5203 | JSplitPane gridPanel; |
---|
4852 | 5204 | JSplitPane bigPanel; |
---|
| 5205 | + |
---|
4853 | 5206 | cGridBag bigThree; |
---|
4854 | 5207 | cGridBag scenePanel; |
---|
4855 | 5208 | cGridBag centralPanel; |
---|
.. | .. |
---|
4964 | 5317 | cNumberSlider fogField; |
---|
4965 | 5318 | JLabel opacityPowerLabel; |
---|
4966 | 5319 | cNumberSlider opacityPowerField; |
---|
4967 | | - JTree jTree; |
---|
| 5320 | + cTree jTree; |
---|
4968 | 5321 | //ObjectUI parent; |
---|
4969 | 5322 | |
---|
4970 | 5323 | cNumberSlider normalpushField; |
---|