.. | .. |
---|
15 | 15 | //import javax.swing.plaf.ColorUIResource; |
---|
16 | 16 | //import javax.swing.plaf.metal.DefaultMetalTheme; |
---|
17 | 17 | |
---|
| 18 | +import javax.swing.plaf.basic.BasicSplitPaneDivider; |
---|
| 19 | +import javax.swing.plaf.basic.BasicSplitPaneUI; |
---|
| 20 | + |
---|
18 | 21 | //import javax.media.opengl.GLCanvas; |
---|
19 | 22 | |
---|
20 | 23 | import //weka.core. |
---|
.. | .. |
---|
279 | 282 | client = inClient; |
---|
280 | 283 | copy = client; |
---|
281 | 284 | |
---|
| 285 | + if (copy.versions == null) |
---|
| 286 | + { |
---|
| 287 | + copy.versions = new byte[100][]; |
---|
| 288 | + copy.versionindex = -1; |
---|
| 289 | + } |
---|
| 290 | + |
---|
282 | 291 | // "this" is not called: SetupUI2(objEditor); |
---|
283 | 292 | } |
---|
284 | 293 | |
---|
.. | .. |
---|
292 | 301 | client = inClient; |
---|
293 | 302 | copy = client; |
---|
294 | 303 | |
---|
| 304 | + if (copy.versions == null) |
---|
| 305 | + { |
---|
| 306 | + copy.versions = new byte[100][]; |
---|
| 307 | + copy.versionindex = -1; |
---|
| 308 | + } |
---|
| 309 | + |
---|
295 | 310 | SetupUI2(callee.GetEditor()); |
---|
296 | 311 | } |
---|
297 | 312 | |
---|
.. | .. |
---|
306 | 321 | //localCopy.parent = null; |
---|
307 | 322 | |
---|
308 | 323 | frame = new JFrame(); |
---|
309 | | - frame.setUndecorated(true); |
---|
| 324 | + frame.setUndecorated(false); |
---|
310 | 325 | objEditor = this; |
---|
311 | 326 | this.callee = callee; |
---|
312 | 327 | |
---|
.. | .. |
---|
324 | 339 | copy = localCopy; |
---|
325 | 340 | copy.editWindow = this; |
---|
326 | 341 | |
---|
| 342 | + if (copy.versions == null) |
---|
| 343 | + { |
---|
| 344 | + copy.versions = new byte[100][]; |
---|
| 345 | + copy.versionindex = -1; |
---|
| 346 | + } |
---|
| 347 | + |
---|
327 | 348 | SetupMenu(); |
---|
328 | 349 | |
---|
329 | 350 | //SetupName(objEditor); // new |
---|
.. | .. |
---|
347 | 368 | frame.setMenuBar(menuBar = new MenuBar()); |
---|
348 | 369 | menuBar.add(fileMenu = new Menu("File")); |
---|
349 | 370 | fileMenu.add(newItem = new MenuItem("New")); |
---|
350 | | - fileMenu.add(loadItem = new MenuItem("Open...")); |
---|
| 371 | + fileMenu.add(openItem = new MenuItem("Open...")); |
---|
351 | 372 | |
---|
352 | 373 | //oe.menuBar.add(menu = new Menu("Include")); |
---|
353 | 374 | Menu menu = new Menu("Import"); |
---|
.. | .. |
---|
379 | 400 | } |
---|
380 | 401 | |
---|
381 | 402 | newItem.addActionListener(this); |
---|
382 | | - loadItem.addActionListener(this); |
---|
| 403 | + openItem.addActionListener(this); |
---|
383 | 404 | saveItem.addActionListener(this); |
---|
384 | 405 | saveAsItem.addActionListener(this); |
---|
385 | 406 | exportAsItem.addActionListener(this); |
---|
.. | .. |
---|
446 | 467 | // TEXTAREA infoarea.setLineWrap(true); |
---|
447 | 468 | // TEXTAREA infoarea.setWrapStyleWord(true); |
---|
448 | 469 | infoPanel = new JScrollPane(infoarea, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); //AS_NEEDED); |
---|
449 | | - infoPanel.setPreferredSize(new Dimension(50, 200)); |
---|
| 470 | + infoPanel.setPreferredSize(new Dimension(1, 1)); |
---|
450 | 471 | infoPanel.setName("Info"); |
---|
451 | 472 | //infoPanel.setLayout(new BorderLayout()); |
---|
452 | 473 | //infoPanel.add(createTextPane()); |
---|
.. | .. |
---|
458 | 479 | mainPanel.setDividerSize(9); |
---|
459 | 480 | mainPanel.setDividerLocation(0.5); //1.0); |
---|
460 | 481 | mainPanel.setResizeWeight(0.5); |
---|
461 | | - |
---|
| 482 | + |
---|
| 483 | +//mainPanel.setDividerSize((int) (mainPanel.getDividerSize() * 1.5)); |
---|
| 484 | + BasicSplitPaneDivider divider = ( (BasicSplitPaneUI) mainPanel.getUI()).getDivider(); |
---|
| 485 | + divider.setDividerSize(15); |
---|
| 486 | + divider.setBorder(BorderFactory.createTitledBorder(divider.getBorder(), "Custom border title -- gets rid of the one-touch arrows!")); |
---|
| 487 | + |
---|
| 488 | + mainPanel.setUI(new BasicSplitPaneUI()); |
---|
| 489 | + |
---|
462 | 490 | //ctrlPanel.setLayout(new GridLayout(4, 1, 5, 5)); |
---|
463 | 491 | //mainPanel.setLayout(new GridBagLayout()); |
---|
464 | 492 | toolbarPanel.setLayout(new FlowLayout(FlowLayout.LEFT)); |
---|
.. | .. |
---|
689 | 717 | } |
---|
690 | 718 | } |
---|
691 | 719 | |
---|
692 | | -static GraphicsDevice device = GraphicsEnvironment |
---|
693 | | - .getLocalGraphicsEnvironment().getScreenDevices()[0]; |
---|
| 720 | +//static GraphicsDevice device = GraphicsEnvironment |
---|
| 721 | +// .getLocalGraphicsEnvironment().getScreenDevices()[0]; |
---|
694 | 722 | |
---|
695 | 723 | Rectangle keeprect; |
---|
696 | 724 | cRadio radio; |
---|
.. | .. |
---|
711 | 739 | void Minimize() |
---|
712 | 740 | { |
---|
713 | 741 | frame.setState(Frame.ICONIFIED); |
---|
| 742 | + frame.validate(); |
---|
714 | 743 | } |
---|
715 | 744 | |
---|
| 745 | +// artifactURI=null, type=0, property=${file.reference.jfxrt.jar}, object=org.netbeans.modules.java.api.common.classpath.ClassPathSupport$RelativePath@6767876f, broken=false, additional={} |
---|
| 746 | +// artifactURI=null, type=0, property=${file.reference.mac-ui.jar}, object=org.netbeans.modules.java.api.common.classpath.ClassPathSupport$RelativePath@16bdc817, broken=false, additional={} |
---|
| 747 | +// artifactURI=null, type=0, property=${file.reference.classes.jar}, object=org.netbeans.modules.java.api.common.classpath.ClassPathSupport$RelativePath@9daa9c17, broken=false, additional={} |
---|
716 | 748 | void Maximize() |
---|
717 | 749 | { |
---|
| 750 | + if (CameraPane.FULLSCREEN) |
---|
| 751 | + { |
---|
| 752 | + ToggleFullScreen(); |
---|
| 753 | + } |
---|
| 754 | + |
---|
718 | 755 | if (maximized) |
---|
719 | 756 | { |
---|
720 | 757 | frame.setBounds(keeprect.x, keeprect.y, keeprect.width, keeprect.height); |
---|
.. | .. |
---|
722 | 759 | else |
---|
723 | 760 | { |
---|
724 | 761 | keeprect = frame.getBounds(); |
---|
725 | | - Rectangle rect = GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds(); |
---|
726 | | - Dimension rect2 = frame.getToolkit().getScreenSize(); |
---|
727 | | - frame.setBounds(0, rect2.height - rect.height, rect.width, rect.height); |
---|
| 762 | +// Rectangle rect = GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds(); |
---|
| 763 | +// Dimension rect2 = frame.getToolkit().getScreenSize(); |
---|
| 764 | +// frame.setBounds(0, rect2.height - rect.height, rect.width, rect.height); |
---|
728 | 765 | // frame.setState(Frame.MAXIMIZED_BOTH); |
---|
| 766 | + frame.setBounds(frame.getGraphicsConfiguration().getBounds()); |
---|
729 | 767 | } |
---|
730 | 768 | |
---|
731 | 769 | maximized ^= true; |
---|
| 770 | + |
---|
| 771 | + frame.validate(); |
---|
732 | 772 | } |
---|
| 773 | + |
---|
| 774 | + cButton minButton; |
---|
| 775 | + cButton maxButton; |
---|
| 776 | + cButton fullButton; |
---|
733 | 777 | |
---|
734 | 778 | void ToggleFullScreen() |
---|
735 | 779 | { |
---|
| 780 | +GraphicsDevice device = frame.getGraphicsConfiguration().getDevice(); |
---|
| 781 | + |
---|
736 | 782 | cameraView.ToggleFullScreen(); |
---|
737 | 783 | |
---|
738 | 784 | if (!CameraPane.FULLSCREEN) |
---|
739 | 785 | { |
---|
740 | 786 | device.setFullScreenWindow(null); |
---|
| 787 | + frame.dispose(); |
---|
| 788 | + frame.setUndecorated(false); |
---|
| 789 | + frame.validate(); |
---|
| 790 | + frame.setVisible(true); |
---|
| 791 | + |
---|
741 | 792 | //frame.setVisible(false); |
---|
742 | 793 | // frame.removeNotify(); |
---|
743 | 794 | // frame.setUndecorated(false); |
---|
.. | .. |
---|
747 | 798 | // X frame.getContentPane().remove(/*"Center",*/bigThree); |
---|
748 | 799 | // X framePanel.add(bigThree); |
---|
749 | 800 | // X frame.getContentPane().add(/*"Center",*/framePanel); |
---|
750 | | - framePanel.setDividerLocation(1); |
---|
| 801 | + framePanel.setDividerLocation(46); |
---|
751 | 802 | |
---|
752 | 803 | //frame.setVisible(true); |
---|
753 | 804 | radio.layout = keepButton; |
---|
.. | .. |
---|
762 | 813 | // frame.setBounds(0, 0, frame.getToolkit().getScreenSize().width, |
---|
763 | 814 | // frame.getToolkit().getScreenSize().height); |
---|
764 | 815 | //frame.setVisible(false); |
---|
| 816 | + |
---|
| 817 | + frame.dispose(); |
---|
| 818 | + frame.setUndecorated(true); |
---|
765 | 819 | device.setFullScreenWindow(frame); |
---|
| 820 | + frame.validate(); |
---|
| 821 | + frame.setVisible(true); |
---|
766 | 822 | // frame.removeNotify(); |
---|
767 | 823 | // frame.setUndecorated(true); |
---|
768 | 824 | // frame.addNotify(); |
---|
.. | .. |
---|
775 | 831 | radio.layout.doClick(); |
---|
776 | 832 | //frame.setVisible(true); |
---|
777 | 833 | } |
---|
| 834 | + frame.validate(); |
---|
778 | 835 | } |
---|
| 836 | + |
---|
| 837 | + private byte[] CompressCopy() |
---|
| 838 | + { |
---|
| 839 | + boolean temp = CameraPane.SWITCH; |
---|
| 840 | + CameraPane.SWITCH = false; |
---|
| 841 | + |
---|
| 842 | + copy.ExtractBigData(versiontable); |
---|
| 843 | + // if (copy == client) |
---|
| 844 | + |
---|
| 845 | + byte[] versions[] = copy.versions; |
---|
| 846 | + copy.versions = null; |
---|
| 847 | + |
---|
| 848 | + byte[] compress = Compress(copy); |
---|
| 849 | + |
---|
| 850 | + copy.versions = versions; |
---|
| 851 | + |
---|
| 852 | + copy.RestoreBigData(versiontable); |
---|
| 853 | + |
---|
| 854 | + CameraPane.SWITCH = temp; |
---|
| 855 | + |
---|
| 856 | + return compress; |
---|
| 857 | + } |
---|
779 | 858 | |
---|
780 | 859 | private JTextPane createTextPane() |
---|
781 | 860 | { |
---|
.. | .. |
---|
1107 | 1186 | namePanel = new cGridBag(); |
---|
1108 | 1187 | |
---|
1109 | 1188 | nameField = AddText(namePanel, copy.GetName()); |
---|
1110 | | - namePanel.add(nameField); |
---|
| 1189 | + namePanel.add(new JScrollPane(nameField, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER)); |
---|
1111 | 1190 | oe.ctrlPanel.add(namePanel); |
---|
1112 | 1191 | |
---|
1113 | 1192 | oe.ctrlPanel.Return(); |
---|
.. | .. |
---|
1125 | 1204 | hideCB = AddCheckBox(setupPanel, "Hide", copy.hide); |
---|
1126 | 1205 | hideCB.setToolTipText("Hide object"); |
---|
1127 | 1206 | markCB = AddCheckBox(setupPanel, "Mark", copy.marked); |
---|
1128 | | - markCB.setToolTipText("Set the animation target transform"); |
---|
| 1207 | + markCB.setToolTipText("As animation target transform"); |
---|
1129 | 1208 | |
---|
1130 | 1209 | setupPanel2 = new cGridBag().setVertical(false); |
---|
1131 | 1210 | |
---|
1132 | 1211 | rewindCB = AddCheckBox(setupPanel2, "Rewind", copy.rewind); |
---|
1133 | 1212 | rewindCB.setToolTipText("Rewind animation"); |
---|
1134 | 1213 | |
---|
1135 | | - randomCB = AddCheckBox(setupPanel2, "Rand", copy.random); |
---|
1136 | | - randomCB.setToolTipText("Randomly Rewind or Go back and forth"); |
---|
| 1214 | + randomCB = AddCheckBox(setupPanel2, "Random", copy.random); |
---|
| 1215 | + randomCB.setToolTipText("Randomly Rewind (or Go back and forth)"); |
---|
1137 | 1216 | |
---|
| 1217 | + link2masterCB = AddCheckBox(setupPanel2, "Support", copy.link2master); |
---|
| 1218 | + link2masterCB.setToolTipText("Attach to support"); |
---|
| 1219 | + |
---|
1138 | 1220 | if (Globals.ADVANCED) |
---|
1139 | 1221 | { |
---|
1140 | | - link2masterCB = AddCheckBox(setupPanel2, "Supp", copy.link2master); |
---|
1141 | | - link2masterCB.setToolTipText("Attach to support"); |
---|
1142 | 1222 | speedupCB = AddCheckBox(setupPanel2, "Speed", copy.speedup); |
---|
1143 | 1223 | speedupCB.setToolTipText("Option motion capture"); |
---|
1144 | 1224 | } |
---|
.. | .. |
---|
1454 | 1534 | // north.add(ctrlPanel, BorderLayout.NORTH); |
---|
1455 | 1535 | // objectPanel.add(north); |
---|
1456 | 1536 | objectPanel.add(editPanel); |
---|
1457 | | - objectPanel.add(infoPanel); |
---|
| 1537 | + |
---|
| 1538 | + //if (Globals.ADVANCED) |
---|
| 1539 | + objectPanel.add(infoPanel); |
---|
| 1540 | + |
---|
1458 | 1541 | objectPanel.add(toolboxPanel); |
---|
1459 | 1542 | |
---|
1460 | 1543 | /* |
---|
.. | .. |
---|
1563 | 1646 | // aConstraints.gridheight = 1; |
---|
1564 | 1647 | |
---|
1565 | 1648 | framePanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, toolbarPanel, bigThree); |
---|
1566 | | - framePanel.setContinuousLayout(true); |
---|
1567 | | - framePanel.setOneTouchExpandable(true); |
---|
1568 | | - framePanel.setDividerLocation(0.8); |
---|
| 1649 | + framePanel.setContinuousLayout(false); |
---|
| 1650 | + framePanel.setOneTouchExpandable(false); |
---|
| 1651 | + //.setDividerLocation(0.8); |
---|
1569 | 1652 | //framePanel.setDividerSize(15); |
---|
1570 | 1653 | //framePanel.setResizeWeight(0.15); |
---|
1571 | 1654 | framePanel.setName("Frame"); |
---|
.. | .. |
---|
1584 | 1667 | |
---|
1585 | 1668 | frame.setSize(1280, 860); |
---|
1586 | 1669 | |
---|
1587 | | - frame.validate(); |
---|
1588 | | - frame.setVisible(true); |
---|
1589 | | - |
---|
1590 | 1670 | cameraView.requestFocusInWindow(); |
---|
1591 | 1671 | |
---|
1592 | 1672 | gridPanel.setDividerLocation(1.0); |
---|
| 1673 | + |
---|
| 1674 | + frame.validate(); |
---|
| 1675 | + |
---|
| 1676 | + frame.setVisible(true); |
---|
1593 | 1677 | |
---|
1594 | 1678 | frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); |
---|
1595 | 1679 | frame.addWindowListener(new WindowAdapter() |
---|
.. | .. |
---|
1676 | 1760 | texture.add(textureField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
1677 | 1761 | colorSection.add(texture); |
---|
1678 | 1762 | |
---|
1679 | | - cGridBag anisoU = new cGridBag(); |
---|
1680 | | - anisoU.add(anisoLabel = new JLabel("AnisoU")); // , aConstraints); |
---|
1681 | | - anisoLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1682 | | - anisoU.add(anisoField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
1683 | | - colorSection.add(anisoU); |
---|
1684 | | - |
---|
1685 | | - cGridBag anisoV = new cGridBag(); |
---|
1686 | | - anisoV.add(anisoVLabel = new JLabel("AnisoV")); // , aConstraints); |
---|
1687 | | - anisoVLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1688 | | - anisoV.add(anisoVField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
1689 | | - colorSection.add(anisoV); |
---|
1690 | | - |
---|
1691 | | - cGridBag shadowbias = new cGridBag(); |
---|
1692 | | - shadowbias.add(shadowbiasLabel = new JLabel("Shadowbias")); // , aConstraints); |
---|
1693 | | - shadowbiasLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1694 | | - shadowbias.add(shadowbiasField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
1695 | | - colorSection.add(shadowbias); |
---|
1696 | | - |
---|
1697 | 1763 | panel.add(new JSeparator()); |
---|
1698 | 1764 | |
---|
1699 | 1765 | panel.add(colorSection); |
---|
.. | .. |
---|
1743 | 1809 | fakedepthLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1744 | 1810 | fakedepth.add(fakedepthField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
1745 | 1811 | diffuseSection.add(fakedepth); |
---|
| 1812 | + |
---|
| 1813 | + cGridBag shadowbias = new cGridBag(); |
---|
| 1814 | + shadowbias.add(shadowbiasLabel = new JLabel("Shadowbias")); // , aConstraints); |
---|
| 1815 | + shadowbiasLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 1816 | + shadowbias.add(shadowbiasField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
| 1817 | + diffuseSection.add(shadowbias); |
---|
1746 | 1818 | |
---|
1747 | 1819 | panel.add(new JSeparator()); |
---|
1748 | 1820 | |
---|
.. | .. |
---|
1794 | 1866 | // aConstraints.gridy += 1; |
---|
1795 | 1867 | // aConstraints.gridwidth = 1; |
---|
1796 | 1868 | |
---|
| 1869 | + cGridBag anisoU = new cGridBag(); |
---|
| 1870 | + anisoU.add(anisoLabel = new JLabel("AnisoU")); // , aConstraints); |
---|
| 1871 | + anisoLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 1872 | + anisoU.add(anisoField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
| 1873 | + specularSection.add(anisoU); |
---|
| 1874 | + |
---|
| 1875 | + cGridBag anisoV = new cGridBag(); |
---|
| 1876 | + anisoV.add(anisoVLabel = new JLabel("AnisoV")); // , aConstraints); |
---|
| 1877 | + anisoVLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 1878 | + anisoV.add(anisoVField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
| 1879 | + specularSection.add(anisoV); |
---|
| 1880 | + |
---|
1797 | 1881 | |
---|
1798 | 1882 | panel.add(new JSeparator()); |
---|
1799 | 1883 | |
---|
.. | .. |
---|
1801 | 1885 | |
---|
1802 | 1886 | //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints); |
---|
1803 | 1887 | |
---|
1804 | | - cGridBag globalSection = new cGridBag().setVertical(true); |
---|
| 1888 | + //cGridBag globalSection = new cGridBag().setVertical(true); |
---|
1805 | 1889 | |
---|
1806 | 1890 | cGridBag camera = new cGridBag(); |
---|
1807 | 1891 | camera.add(cameraLabel = new JLabel("GlobalLight")); // , aConstraints); |
---|
1808 | 1892 | cameraLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1809 | 1893 | camera.add(cameraField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
1810 | | - globalSection.add(camera); |
---|
| 1894 | + colorSection.add(camera); |
---|
1811 | 1895 | |
---|
1812 | 1896 | cGridBag ambient = new cGridBag(); |
---|
1813 | 1897 | ambient.add(ambientLabel = new JLabel("Ambient")); // , aConstraints); |
---|
1814 | 1898 | ambientLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1815 | 1899 | ambient.add(ambientField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
1816 | | - globalSection.add(ambient); |
---|
| 1900 | + colorSection.add(ambient); |
---|
1817 | 1901 | |
---|
1818 | 1902 | cGridBag backlit = new cGridBag(); |
---|
1819 | 1903 | backlit.add(backlitLabel = new JLabel("Backlit")); // , aConstraints); |
---|
1820 | 1904 | backlitLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1821 | 1905 | backlit.add(backlitField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
1822 | | - globalSection.add(backlit); |
---|
| 1906 | + colorSection.add(backlit); |
---|
1823 | 1907 | |
---|
1824 | 1908 | cGridBag opacity = new cGridBag(); |
---|
1825 | 1909 | opacity.add(opacityLabel = new JLabel("Opacity")); // , aConstraints); |
---|
1826 | 1910 | opacityLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1827 | 1911 | opacity.add(opacityField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
1828 | | - globalSection.add(opacity); |
---|
| 1912 | + colorSection.add(opacity); |
---|
1829 | 1913 | |
---|
1830 | | - panel.add(new JSeparator()); |
---|
| 1914 | + //panel.add(new JSeparator()); |
---|
1831 | 1915 | |
---|
1832 | | - panel.add(globalSection); |
---|
| 1916 | + //panel.add(globalSection); |
---|
1833 | 1917 | |
---|
1834 | 1918 | //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints); |
---|
1835 | 1919 | |
---|
.. | .. |
---|
1936 | 2020 | // 3D models |
---|
1937 | 2021 | if (filename.endsWith(".3ds") || filename.endsWith(".3DS")) |
---|
1938 | 2022 | { |
---|
1939 | | - lastConverter = new com.jmex.model.converters.MaxToJme(); |
---|
1940 | | - LoadFile(filename, lastConverter); |
---|
| 2023 | + //lastConverter = new com.jmex.model.converters.MaxToJme(); |
---|
| 2024 | + //LoadFile(filename, lastConverter); |
---|
| 2025 | + LoadObjFile(filename); // New 3ds loader |
---|
1941 | 2026 | continue; |
---|
1942 | 2027 | } |
---|
1943 | 2028 | if (filename.endsWith(".dae") || filename.endsWith(".DAE")) |
---|
.. | .. |
---|
2663 | 2748 | LA.matXRotate(((Object3D) group.get(group.size() - 1)).toParent, -Math.PI / 2); |
---|
2664 | 2749 | LA.matXRotate(((Object3D) group.get(group.size() - 1)).fromParent, Math.PI / 2); |
---|
2665 | 2750 | } |
---|
| 2751 | + |
---|
2666 | 2752 | //cJME.count++; |
---|
2667 | 2753 | //cJME.count %= 12; |
---|
2668 | 2754 | if (gc) |
---|
.. | .. |
---|
2846 | 2932 | } |
---|
2847 | 2933 | } |
---|
2848 | 2934 | } |
---|
| 2935 | + |
---|
2849 | 2936 | cFileSystemPane FSPane; |
---|
2850 | 2937 | |
---|
2851 | 2938 | void SetMaterial(cMaterial mat, Object3D.cVector2[] others) |
---|
.. | .. |
---|
2899 | 2986 | } |
---|
2900 | 2987 | } |
---|
2901 | 2988 | } |
---|
| 2989 | + |
---|
2902 | 2990 | freezematerial = false; |
---|
2903 | 2991 | } |
---|
2904 | 2992 | |
---|
.. | .. |
---|
3017 | 3105 | // } |
---|
3018 | 3106 | |
---|
3019 | 3107 | /**/ |
---|
3020 | | - if (deselect) |
---|
| 3108 | + if (deselect || child == null) |
---|
3021 | 3109 | { |
---|
3022 | 3110 | //group.deselectAll(); |
---|
3023 | 3111 | //freeze = true; |
---|
3024 | 3112 | GetTree().clearSelection(); |
---|
3025 | 3113 | //freeze = false; |
---|
| 3114 | + |
---|
| 3115 | + if (child == null) |
---|
| 3116 | + { |
---|
| 3117 | + return; |
---|
| 3118 | + } |
---|
3026 | 3119 | } |
---|
3027 | 3120 | |
---|
3028 | 3121 | //group.addSelectee(child); |
---|
.. | .. |
---|
3346 | 3439 | { |
---|
3347 | 3440 | Close(); |
---|
3348 | 3441 | //return true; |
---|
3349 | | - } else if (source == loadItem) |
---|
| 3442 | + } else if (source == openItem) |
---|
3350 | 3443 | { |
---|
3351 | | - load(); |
---|
| 3444 | + Open(); |
---|
3352 | 3445 | //return true; |
---|
3353 | 3446 | } else if (source == newItem) |
---|
3354 | 3447 | { |
---|
.. | .. |
---|
3373 | 3466 | { |
---|
3374 | 3467 | generatePOV(); |
---|
3375 | 3468 | //return true; |
---|
| 3469 | + } else if (event.getSource() == archiveItem) |
---|
| 3470 | + { |
---|
| 3471 | + cTools.Archive(frame); |
---|
| 3472 | + return; |
---|
3376 | 3473 | } else if (source == zBufferItem) |
---|
3377 | 3474 | { |
---|
3378 | 3475 | try |
---|
.. | .. |
---|
3424 | 3521 | try |
---|
3425 | 3522 | { |
---|
3426 | 3523 | ByteArrayOutputStream baos = new ByteArrayOutputStream(); |
---|
3427 | | - java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(baos); |
---|
3428 | | - ObjectOutputStream out = new ObjectOutputStream(zstream); |
---|
| 3524 | +// java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(baos); |
---|
| 3525 | + ObjectOutputStream out = new ObjectOutputStream(baos); //zstream); |
---|
3429 | 3526 | |
---|
3430 | 3527 | Object3D parent = o.parent; |
---|
3431 | 3528 | o.parent = null; |
---|
.. | .. |
---|
3436 | 3533 | |
---|
3437 | 3534 | out.flush(); |
---|
3438 | 3535 | |
---|
3439 | | - zstream.close(); |
---|
| 3536 | + baos //zstream |
---|
| 3537 | + .close(); |
---|
3440 | 3538 | out.close(); |
---|
3441 | 3539 | |
---|
3442 | | - return baos.toByteArray(); |
---|
| 3540 | + byte[] bytes = baos.toByteArray(); |
---|
| 3541 | + |
---|
| 3542 | + System.out.println("save #bytes = " + bytes.length); |
---|
| 3543 | + return bytes; |
---|
3443 | 3544 | } catch (Exception e) |
---|
3444 | 3545 | { |
---|
3445 | 3546 | System.err.println(e); |
---|
.. | .. |
---|
3449 | 3550 | |
---|
3450 | 3551 | static public Object Uncompress(byte[] bytes) |
---|
3451 | 3552 | { |
---|
3452 | | - System.out.println("#bytes = " + bytes.length); |
---|
| 3553 | + System.out.println("restore #bytes = " + bytes.length); |
---|
3453 | 3554 | try |
---|
3454 | 3555 | { |
---|
3455 | 3556 | ByteArrayInputStream bais = new ByteArrayInputStream(bytes); |
---|
3456 | | - java.util.zip.GZIPInputStream istream = new java.util.zip.GZIPInputStream(bais); |
---|
3457 | | - ObjectInputStream in = new ObjectInputStream(istream); |
---|
| 3557 | + //java.util.zip.GZIPInputStream istream = new java.util.zip.GZIPInputStream(bais); |
---|
| 3558 | + ObjectInputStream in = new ObjectInputStream(bais); // istream); |
---|
3458 | 3559 | Object obj = in.readObject(); |
---|
| 3560 | + |
---|
| 3561 | + bais //istream |
---|
| 3562 | + .close(); |
---|
3459 | 3563 | in.close(); |
---|
3460 | 3564 | |
---|
3461 | 3565 | return obj; |
---|
.. | .. |
---|
3510 | 3614 | return null; |
---|
3511 | 3615 | } |
---|
3512 | 3616 | |
---|
3513 | | - java.util.Hashtable<java.util.UUID, Object3D> hashtable = new java.util.Hashtable<java.util.UUID, Object3D>(); |
---|
3514 | 3617 | |
---|
3515 | 3618 | public void Save() |
---|
| 3619 | + { |
---|
| 3620 | + //Save(true); |
---|
| 3621 | + Replace(); |
---|
| 3622 | + } |
---|
| 3623 | + |
---|
| 3624 | + private boolean Equal(byte[] compress, byte[] name) |
---|
| 3625 | + { |
---|
| 3626 | + if (compress.length != name.length) |
---|
| 3627 | + { |
---|
| 3628 | + return false; |
---|
| 3629 | + } |
---|
| 3630 | + |
---|
| 3631 | + for (int i=compress.length; --i>=0;) |
---|
| 3632 | + { |
---|
| 3633 | + if (compress[i] != name[i]) |
---|
| 3634 | + return false; |
---|
| 3635 | + } |
---|
| 3636 | + |
---|
| 3637 | + return true; |
---|
| 3638 | + } |
---|
| 3639 | + |
---|
| 3640 | + java.util.Hashtable<java.util.UUID, Object3D> versiontable = new java.util.Hashtable<java.util.UUID, Object3D>(); |
---|
| 3641 | + |
---|
| 3642 | + public boolean Save(boolean user) |
---|
3516 | 3643 | { |
---|
3517 | 3644 | System.err.println("Save"); |
---|
3518 | 3645 | |
---|
3519 | 3646 | cRadio tab = GetCurrentTab(); |
---|
3520 | 3647 | |
---|
3521 | | - boolean temp = CameraPane.SWITCH; |
---|
3522 | | - CameraPane.SWITCH = false; |
---|
| 3648 | + byte[] compress = CompressCopy(); |
---|
3523 | 3649 | |
---|
3524 | | - copy.ExtractBigData(hashtable); |
---|
| 3650 | + boolean thesame = false; |
---|
| 3651 | + |
---|
| 3652 | + // Quick heuristic using length. Works only when stream is compressed. |
---|
| 3653 | + if (copy.versionindex > 0 && copy.versions[copy.versionindex-1] != null && Equal(compress, copy.versions[copy.versionindex-1])) |
---|
| 3654 | + { |
---|
| 3655 | + thesame = true; |
---|
| 3656 | + } |
---|
3525 | 3657 | |
---|
3526 | 3658 | //EditorFrame.m_MainFrame.requestFocusInWindow(); |
---|
3527 | | - tab.graphs[tab.undoindex++] = Compress(copy); |
---|
| 3659 | + if (!thesame) |
---|
| 3660 | + { |
---|
| 3661 | + //tab.user[tab.versionindex] = user; |
---|
| 3662 | + //boolean increment = true; // tab.graphs[tab.versionindex] == null; |
---|
| 3663 | + |
---|
| 3664 | + copy.versions[++copy.versionindex] = compress; |
---|
| 3665 | + |
---|
| 3666 | + // if (increment) |
---|
| 3667 | + // tab.versionindex++; |
---|
| 3668 | + } |
---|
3528 | 3669 | |
---|
3529 | | - copy.RestoreBigData(hashtable); |
---|
| 3670 | + //copy.RestoreBigData(versiontable); |
---|
3530 | 3671 | |
---|
3531 | | - CameraPane.SWITCH = temp; |
---|
3532 | | - |
---|
3533 | 3672 | //assert(hashtable.isEmpty()); |
---|
3534 | 3673 | |
---|
3535 | | - for (int i = tab.undoindex; i < tab.graphs.length; i++) |
---|
| 3674 | + for (int i = copy.versionindex+1; i < copy.versions.length; i++) |
---|
3536 | 3675 | { |
---|
3537 | | - tab.graphs[i] = null; |
---|
| 3676 | + //tab.user[i] = false; |
---|
| 3677 | + copy.versions[i] = null; |
---|
3538 | 3678 | } |
---|
3539 | 3679 | |
---|
3540 | 3680 | SetUndoStates(); |
---|
.. | .. |
---|
3544 | 3684 | { |
---|
3545 | 3685 | try |
---|
3546 | 3686 | { |
---|
3547 | | - FileOutputStream ostream = new FileOutputStream("save" + tab.undoindex); |
---|
| 3687 | + FileOutputStream ostream = new FileOutputStream("save" + copy.versionindex); |
---|
3548 | 3688 | ObjectOutputStream p = new ObjectOutputStream(ostream); |
---|
3549 | 3689 | |
---|
3550 | 3690 | p.writeObject(copy); |
---|
.. | .. |
---|
3557 | 3697 | e.printStackTrace(); |
---|
3558 | 3698 | } |
---|
3559 | 3699 | } |
---|
| 3700 | + |
---|
| 3701 | + return !thesame; |
---|
3560 | 3702 | } |
---|
3561 | 3703 | |
---|
3562 | 3704 | void CopyChanged(Object3D obj) |
---|
.. | .. |
---|
3566 | 3708 | boolean temp = CameraPane.SWITCH; |
---|
3567 | 3709 | CameraPane.SWITCH = false; |
---|
3568 | 3710 | |
---|
3569 | | - copy.ExtractBigData(hashtable); |
---|
| 3711 | + copy.ExtractBigData(versiontable); |
---|
3570 | 3712 | |
---|
3571 | 3713 | copy.clear(); |
---|
3572 | 3714 | |
---|
.. | .. |
---|
3575 | 3717 | copy.add(obj.get(i)); |
---|
3576 | 3718 | } |
---|
3577 | 3719 | |
---|
3578 | | - copy.RestoreBigData(hashtable); |
---|
| 3720 | + copy.RestoreBigData(versiontable); |
---|
3579 | 3721 | |
---|
3580 | 3722 | CameraPane.SWITCH = temp; |
---|
3581 | 3723 | |
---|
.. | .. |
---|
3603 | 3745 | } |
---|
3604 | 3746 | |
---|
3605 | 3747 | cButton undoButton; |
---|
| 3748 | + cButton restoreButton; |
---|
| 3749 | + cButton replaceButton; |
---|
3606 | 3750 | cButton redoButton; |
---|
3607 | 3751 | |
---|
| 3752 | + boolean muteSlider; |
---|
| 3753 | + |
---|
| 3754 | + int VersionCount() |
---|
| 3755 | + { |
---|
| 3756 | + int count = 0; |
---|
| 3757 | + |
---|
| 3758 | + for (int i = copy.versions.length; --i >= 0;) |
---|
| 3759 | + { |
---|
| 3760 | + if (copy.versions[i] != null) |
---|
| 3761 | + count++; |
---|
| 3762 | + } |
---|
| 3763 | + |
---|
| 3764 | + return count; |
---|
| 3765 | + } |
---|
| 3766 | + |
---|
3608 | 3767 | void SetUndoStates() |
---|
3609 | 3768 | { |
---|
3610 | 3769 | cRadio tab = GetCurrentTab(); |
---|
3611 | 3770 | |
---|
3612 | | - undoButton.setEnabled(tab.undoindex > 0); |
---|
3613 | | - redoButton.setEnabled(tab.graphs[tab.undoindex + 1] != null); |
---|
| 3771 | + restoreButton.setEnabled(copy.versionindex != -1); |
---|
| 3772 | + replaceButton.setEnabled(copy.versionindex != -1); |
---|
| 3773 | + |
---|
| 3774 | + undoButton.setEnabled(copy.versionindex > 0); |
---|
| 3775 | + redoButton.setEnabled(copy.versions[copy.versionindex + 1] != null); |
---|
| 3776 | + |
---|
| 3777 | + muteSlider = true; |
---|
| 3778 | + versionSlider.setMaximum(VersionCount() - 1); |
---|
| 3779 | + versionSlider.setInteger(copy.versionindex); |
---|
| 3780 | + muteSlider = false; |
---|
3614 | 3781 | } |
---|
3615 | 3782 | |
---|
3616 | | - public void Undo() |
---|
| 3783 | + public boolean Undo() |
---|
3617 | 3784 | { |
---|
| 3785 | + // Option? |
---|
| 3786 | + Replace(); |
---|
| 3787 | + |
---|
3618 | 3788 | System.err.println("Undo"); |
---|
3619 | 3789 | |
---|
3620 | 3790 | cRadio tab = GetCurrentTab(); |
---|
3621 | 3791 | |
---|
3622 | | - if (tab.undoindex == 0) |
---|
| 3792 | + if (copy.versionindex == 0) |
---|
3623 | 3793 | { |
---|
3624 | 3794 | java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
3625 | | - return; |
---|
| 3795 | + return false; |
---|
3626 | 3796 | } |
---|
3627 | 3797 | |
---|
3628 | | - if (tab.graphs[tab.undoindex] == null) |
---|
| 3798 | +// if (tab.graphs[tab.versionindex] == null) // || !tab.user[tab.versionindex]) |
---|
| 3799 | +// { |
---|
| 3800 | +// if (Save(false)) |
---|
| 3801 | +// tab.versionindex -= 1; |
---|
| 3802 | +// else |
---|
| 3803 | +// { |
---|
| 3804 | +// if (tab.versionindex <= 0) |
---|
| 3805 | +// return false; |
---|
| 3806 | +// else |
---|
| 3807 | +// tab.versionindex -= 1; |
---|
| 3808 | +// } |
---|
| 3809 | +// } |
---|
| 3810 | + |
---|
| 3811 | + copy.versionindex -= 1; |
---|
| 3812 | + |
---|
| 3813 | + CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex])); |
---|
| 3814 | + |
---|
| 3815 | + return true; |
---|
| 3816 | + } |
---|
| 3817 | + |
---|
| 3818 | + public boolean Restore() |
---|
| 3819 | + { |
---|
| 3820 | + System.err.println("Restore"); |
---|
| 3821 | + |
---|
| 3822 | + cRadio tab = GetCurrentTab(); |
---|
| 3823 | + |
---|
| 3824 | + if (copy.versionindex == -1 || copy.versions[copy.versionindex] == null) |
---|
3629 | 3825 | { |
---|
3630 | | - Save(); |
---|
3631 | | - tab.undoindex -= 1; |
---|
| 3826 | + java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
| 3827 | + return false; |
---|
3632 | 3828 | } |
---|
3633 | 3829 | |
---|
3634 | | - tab.undoindex -= 1; |
---|
| 3830 | + CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex])); |
---|
| 3831 | + |
---|
| 3832 | + return true; |
---|
| 3833 | + } |
---|
3635 | 3834 | |
---|
3636 | | - CopyChanged((Object3D)Uncompress(tab.graphs[tab.undoindex])); |
---|
| 3835 | + public boolean Replace() |
---|
| 3836 | + { |
---|
| 3837 | + System.err.println("Replace"); |
---|
| 3838 | + |
---|
| 3839 | + cRadio tab = GetCurrentTab(); |
---|
| 3840 | + |
---|
| 3841 | + if (copy.versionindex == -1 || copy.versions[copy.versionindex] == null) |
---|
| 3842 | + { |
---|
| 3843 | + // No version yet. OK. java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
| 3844 | + return false; |
---|
| 3845 | + } |
---|
| 3846 | + |
---|
| 3847 | + copy.versions[copy.versionindex] = CompressCopy(); |
---|
| 3848 | + |
---|
| 3849 | + return true; |
---|
3637 | 3850 | } |
---|
3638 | 3851 | |
---|
3639 | 3852 | public void Redo() |
---|
3640 | 3853 | { |
---|
| 3854 | + // Option? |
---|
| 3855 | + Replace(); |
---|
| 3856 | + |
---|
3641 | 3857 | cRadio tab = GetCurrentTab(); |
---|
3642 | 3858 | |
---|
3643 | | - if (tab.graphs[tab.undoindex + 1] == null) |
---|
| 3859 | + if (copy.versions[copy.versionindex + 1] == null) |
---|
3644 | 3860 | { |
---|
3645 | 3861 | java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
3646 | 3862 | return; |
---|
3647 | 3863 | } |
---|
3648 | 3864 | |
---|
3649 | | - tab.undoindex += 1; |
---|
| 3865 | + copy.versionindex += 1; |
---|
3650 | 3866 | |
---|
3651 | | - CopyChanged((Object3D)Uncompress(tab.graphs[tab.undoindex])); |
---|
| 3867 | + CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex])); |
---|
| 3868 | + |
---|
| 3869 | + //if (!tab.user[tab.versionindex]) |
---|
| 3870 | + // tab.graphs[tab.versionindex] = null; |
---|
3652 | 3871 | } |
---|
3653 | 3872 | |
---|
3654 | 3873 | void ImportGFD() |
---|
.. | .. |
---|
3944 | 4163 | //copy.Touch(); |
---|
3945 | 4164 | } |
---|
3946 | 4165 | |
---|
| 4166 | + cNumberSlider versionSlider; |
---|
| 4167 | + |
---|
3947 | 4168 | public void stateChanged(ChangeEvent e) |
---|
3948 | 4169 | { |
---|
3949 | 4170 | // assert(false); |
---|
| 4171 | + if (e.getSource() == versionSlider) |
---|
| 4172 | + { |
---|
| 4173 | + if (muteSlider) |
---|
| 4174 | + return; |
---|
| 4175 | + |
---|
| 4176 | + int version = versionSlider.getInteger(); |
---|
| 4177 | + |
---|
| 4178 | + if (copy.versions[version] != null) |
---|
| 4179 | + { |
---|
| 4180 | + CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex = version])); |
---|
| 4181 | + } |
---|
| 4182 | + |
---|
| 4183 | + return; |
---|
| 4184 | + } |
---|
3950 | 4185 | |
---|
3951 | 4186 | if (freezematerial) |
---|
3952 | 4187 | { |
---|
.. | .. |
---|
4295 | 4530 | |
---|
4296 | 4531 | void makeSomething(Object3D thing, boolean resetmodel) // deselect) |
---|
4297 | 4532 | { |
---|
4298 | | - if (Globals.SAVEONMAKE) // && resetmodel) |
---|
| 4533 | + if (Globals.REPLACEONMAKE) // && resetmodel) |
---|
4299 | 4534 | Save(); |
---|
4300 | 4535 | //Tween.set(thing, 0).target(1).start(tweenManager); |
---|
4301 | 4536 | //Tween.to(thing, 0, 0.5f).target(0).start(tweenManager); |
---|
.. | .. |
---|
4611 | 4846 | |
---|
4612 | 4847 | if (readobj != null) |
---|
4613 | 4848 | { |
---|
4614 | | - if (Globals.SAVEONMAKE) |
---|
4615 | | - Save(); |
---|
| 4849 | + //if (Globals.SAVEONMAKE) // A new object cannot share meshes |
---|
| 4850 | + // Save(); |
---|
4616 | 4851 | try |
---|
4617 | 4852 | { |
---|
4618 | 4853 | //readobj.deepCopySelf(copy); |
---|
.. | .. |
---|
4667 | 4902 | c.addChild(csg); |
---|
4668 | 4903 | } |
---|
4669 | 4904 | |
---|
| 4905 | + copy.versions = readobj.versions; |
---|
| 4906 | + copy.versionindex = readobj.versionindex; |
---|
| 4907 | + |
---|
| 4908 | + if (copy.versions == null) |
---|
| 4909 | + { |
---|
| 4910 | + copy.versions = new byte[100][]; |
---|
| 4911 | + copy.versionindex = -1; |
---|
| 4912 | + } |
---|
| 4913 | + |
---|
| 4914 | + //? SetUndoStates(); |
---|
| 4915 | + |
---|
4670 | 4916 | ResetModel(); |
---|
4671 | 4917 | copy.HardTouch(); // recompile? |
---|
4672 | 4918 | refreshContents(); |
---|
4673 | 4919 | } |
---|
4674 | 4920 | } |
---|
4675 | 4921 | |
---|
4676 | | - void load() // throws ClassNotFoundException |
---|
| 4922 | + void Open() // throws ClassNotFoundException |
---|
4677 | 4923 | { |
---|
4678 | 4924 | if (Grafreed.standAlone) |
---|
4679 | 4925 | { |
---|
.. | .. |
---|
4958 | 5204 | MenuBar menuBar; |
---|
4959 | 5205 | Menu fileMenu; |
---|
4960 | 5206 | MenuItem newItem; |
---|
4961 | | - MenuItem loadItem; |
---|
| 5207 | + MenuItem openItem; |
---|
4962 | 5208 | MenuItem saveItem; |
---|
4963 | 5209 | MenuItem saveAsItem; |
---|
4964 | 5210 | MenuItem exportAsItem; |
---|
.. | .. |
---|
4981 | 5227 | CheckboxMenuItem toggleSwitchItem; |
---|
4982 | 5228 | CheckboxMenuItem toggleRootItem; |
---|
4983 | 5229 | CheckboxMenuItem animationItem; |
---|
| 5230 | + MenuItem archiveItem; |
---|
4984 | 5231 | CheckboxMenuItem toggleHandleItem; |
---|
4985 | 5232 | CheckboxMenuItem togglePaintItem; |
---|
4986 | 5233 | JSplitPane mainPanel; |
---|