.. | .. |
---|
41 | 41 | JFrame frame; |
---|
42 | 42 | |
---|
43 | 43 | static ObjEditor theFrame; |
---|
| 44 | + |
---|
| 45 | + public cGridBag GetSeparator() |
---|
| 46 | + { |
---|
| 47 | + cGridBag separator = new cGridBag(); |
---|
| 48 | + separator.add(new JSeparator()); |
---|
| 49 | + separator.preferredHeight = 5; |
---|
| 50 | + return separator; |
---|
| 51 | + } |
---|
44 | 52 | |
---|
45 | 53 | cButton GetButton(String name, boolean border) |
---|
46 | 54 | { |
---|
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 | | - } |
---|
| 55 | + ImageIcon icon = GetIcon(name); |
---|
| 56 | + return new cButton(icon, border); |
---|
| 57 | + } |
---|
| 58 | + |
---|
| 59 | + cLabel GetLabel(String name, boolean border) |
---|
| 60 | + { |
---|
| 61 | + //ImageIcon icon = GetIcon(name); |
---|
| 62 | + return new cLabel(GetImage(name), border); |
---|
56 | 63 | } |
---|
57 | 64 | |
---|
58 | 65 | cToggleButton GetToggleButton(String name, boolean border) |
---|
59 | 66 | { |
---|
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 | | - } |
---|
| 67 | + ImageIcon icon = GetIcon(name); |
---|
| 68 | + return new cToggleButton(icon, border); |
---|
69 | 69 | } |
---|
70 | 70 | |
---|
71 | 71 | cCheckBox GetCheckBox(String name, boolean border) |
---|
72 | 72 | { |
---|
| 73 | + ImageIcon icon = GetIcon(name); |
---|
| 74 | + return new cCheckBox(icon, border); |
---|
| 75 | + } |
---|
| 76 | + |
---|
| 77 | + ImageIcon GetIcon(String name) |
---|
| 78 | + { |
---|
73 | 79 | try |
---|
74 | 80 | { |
---|
75 | | - ImageIcon icon = GetIcon(name); |
---|
76 | | - return new cCheckBox(icon, border); |
---|
| 81 | + BufferedImage image = javax.imageio.ImageIO.read(getClass().getClassLoader().getResourceAsStream(name)); |
---|
| 82 | + |
---|
| 83 | +// if (image.getWidth() > 48 && image.getHeight() > 48) |
---|
| 84 | +// { |
---|
| 85 | +// BufferedImage resized = new BufferedImage(48, 48, image.getType()); |
---|
| 86 | +// Graphics2D g = resized.createGraphics(); |
---|
| 87 | +// g.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR); |
---|
| 88 | +// //g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); |
---|
| 89 | +// g.drawImage(image, 0, 0, 48, 48, 0, 0, image.getWidth(), image.getHeight(), null); |
---|
| 90 | +// g.dispose(); |
---|
| 91 | +// |
---|
| 92 | +// image = resized; |
---|
| 93 | +// } |
---|
| 94 | + |
---|
| 95 | + javax.swing.ImageIcon icon = new javax.swing.ImageIcon(image); |
---|
| 96 | + return icon; |
---|
77 | 97 | } |
---|
78 | 98 | catch (Exception e) |
---|
79 | 99 | { |
---|
80 | | - return new cCheckBox(name, border); |
---|
| 100 | + return null; |
---|
81 | 101 | } |
---|
82 | 102 | } |
---|
83 | | - |
---|
84 | | - private ImageIcon GetIcon(String name) throws IOException |
---|
| 103 | + |
---|
| 104 | + BufferedImage GetImage(String name) |
---|
85 | 105 | { |
---|
86 | | - BufferedImage image = javax.imageio.ImageIO.read(getClass().getClassLoader().getResourceAsStream(name)); |
---|
87 | | - |
---|
88 | | - if (image.getWidth() != 24 && image.getHeight() != 24) |
---|
| 106 | + try |
---|
89 | 107 | { |
---|
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; |
---|
| 108 | + BufferedImage image = javax.imageio.ImageIO.read(getClass().getClassLoader().getResourceAsStream(name)); |
---|
| 109 | + |
---|
| 110 | + return image; |
---|
98 | 111 | } |
---|
99 | | - |
---|
100 | | - javax.swing.ImageIcon icon = new javax.swing.ImageIcon(image); |
---|
101 | | - return icon; |
---|
| 112 | + catch (Exception e) |
---|
| 113 | + { |
---|
| 114 | + return null; |
---|
| 115 | + } |
---|
102 | 116 | } |
---|
103 | 117 | |
---|
104 | 118 | // SCRIPT |
---|
.. | .. |
---|
282 | 296 | client = inClient; |
---|
283 | 297 | copy = client; |
---|
284 | 298 | |
---|
| 299 | + if (copy.versions == null) |
---|
| 300 | + { |
---|
| 301 | + copy.versions = new byte[100][]; |
---|
| 302 | + copy.versionindex = -1; |
---|
| 303 | + } |
---|
| 304 | + |
---|
285 | 305 | // "this" is not called: SetupUI2(objEditor); |
---|
286 | 306 | } |
---|
287 | 307 | |
---|
.. | .. |
---|
295 | 315 | client = inClient; |
---|
296 | 316 | copy = client; |
---|
297 | 317 | |
---|
| 318 | + if (copy.versions == null) |
---|
| 319 | + { |
---|
| 320 | + copy.versions = new byte[100][]; |
---|
| 321 | + copy.versionindex = -1; |
---|
| 322 | + } |
---|
| 323 | + |
---|
298 | 324 | SetupUI2(callee.GetEditor()); |
---|
299 | 325 | } |
---|
300 | 326 | |
---|
.. | .. |
---|
327 | 353 | copy = localCopy; |
---|
328 | 354 | copy.editWindow = this; |
---|
329 | 355 | |
---|
| 356 | + if (copy.versions == null) |
---|
| 357 | + { |
---|
| 358 | +// copy.versions = new byte[100][]; |
---|
| 359 | +// copy.versionindex = -1; |
---|
| 360 | + } |
---|
| 361 | + |
---|
330 | 362 | SetupMenu(); |
---|
331 | 363 | |
---|
332 | 364 | //SetupName(objEditor); // new |
---|
.. | .. |
---|
350 | 382 | frame.setMenuBar(menuBar = new MenuBar()); |
---|
351 | 383 | menuBar.add(fileMenu = new Menu("File")); |
---|
352 | 384 | fileMenu.add(newItem = new MenuItem("New")); |
---|
353 | | - fileMenu.add(loadItem = new MenuItem("Open...")); |
---|
| 385 | + fileMenu.add(openItem = new MenuItem("Open...")); |
---|
354 | 386 | |
---|
355 | 387 | //oe.menuBar.add(menu = new Menu("Include")); |
---|
356 | 388 | Menu menu = new Menu("Import"); |
---|
.. | .. |
---|
382 | 414 | } |
---|
383 | 415 | |
---|
384 | 416 | newItem.addActionListener(this); |
---|
385 | | - loadItem.addActionListener(this); |
---|
| 417 | + openItem.addActionListener(this); |
---|
386 | 418 | saveItem.addActionListener(this); |
---|
387 | 419 | saveAsItem.addActionListener(this); |
---|
388 | 420 | exportAsItem.addActionListener(this); |
---|
.. | .. |
---|
419 | 451 | |
---|
420 | 452 | toolbarPanel = new JPanel(); |
---|
421 | 453 | toolbarPanel.setName("Toolbar"); |
---|
| 454 | + |
---|
422 | 455 | treePanel = new cGridBag(); |
---|
423 | 456 | treePanel.setName("Tree"); |
---|
424 | 457 | |
---|
425 | 458 | editPanel = new cGridBag().setVertical(true); |
---|
426 | | - editPanel.setName("Edit"); |
---|
| 459 | + //editPanel.setName("Edit"); |
---|
427 | 460 | |
---|
428 | 461 | ctrlPanel = new cGridBag().setVertical(false); // new GridBagLayout()); |
---|
429 | 462 | |
---|
.. | .. |
---|
431 | 464 | editPanel.add(editCommandsPanel); |
---|
432 | 465 | editPanel.add(ctrlPanel); |
---|
433 | 466 | |
---|
434 | | - toolboxPanel = new cGridBag().setVertical(false); |
---|
435 | | - toolboxPanel.setName("Toolbox"); |
---|
| 467 | + toolboxPanel = new cGridBag().setVertical(true); |
---|
| 468 | + //toolboxPanel.setName("Toolbox"); |
---|
436 | 469 | |
---|
437 | 470 | materialPanel = new cGridBag().setVertical(true); |
---|
438 | | - materialPanel.setName("Material"); |
---|
| 471 | + //materialPanel.setName("Material"); |
---|
439 | 472 | |
---|
440 | 473 | /*JTextPane*/ |
---|
441 | 474 | infoarea = createTextPane(); |
---|
.. | .. |
---|
443 | 476 | |
---|
444 | 477 | infoarea.setEditable(true); |
---|
445 | 478 | SetText(); |
---|
| 479 | + |
---|
446 | 480 | // infoarea.setFont(infoarea.getFont().deriveFont(10, 14f)); |
---|
447 | 481 | // infoarea.setOpaque(false); |
---|
448 | 482 | // //infoarea.setForeground(textcolor); |
---|
449 | 483 | // TEXTAREA infoarea.setLineWrap(true); |
---|
450 | 484 | // TEXTAREA infoarea.setWrapStyleWord(true); |
---|
451 | 485 | infoPanel = new JScrollPane(infoarea, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); //AS_NEEDED); |
---|
452 | | - //infoPanel.setPreferredSize(new Dimension(50, 200)); |
---|
453 | | - infoPanel.setName("Info"); |
---|
| 486 | + infoPanel.setPreferredSize(new Dimension(1, 1)); |
---|
| 487 | + //infoPanel.setName("Info"); |
---|
454 | 488 | //infoPanel.setLayout(new BorderLayout()); |
---|
455 | 489 | //infoPanel.add(createTextPane()); |
---|
456 | 490 | |
---|
.. | .. |
---|
780 | 814 | // X frame.getContentPane().remove(/*"Center",*/bigThree); |
---|
781 | 815 | // X framePanel.add(bigThree); |
---|
782 | 816 | // X frame.getContentPane().add(/*"Center",*/framePanel); |
---|
783 | | - framePanel.setDividerLocation(1); |
---|
| 817 | + framePanel.setDividerLocation(46); |
---|
784 | 818 | |
---|
785 | 819 | //frame.setVisible(true); |
---|
786 | 820 | radio.layout = keepButton; |
---|
.. | .. |
---|
815 | 849 | } |
---|
816 | 850 | frame.validate(); |
---|
817 | 851 | } |
---|
| 852 | + |
---|
| 853 | + private byte[] CompressCopy() |
---|
| 854 | + { |
---|
| 855 | + boolean temp = CameraPane.SWITCH; |
---|
| 856 | + CameraPane.SWITCH = false; |
---|
| 857 | + |
---|
| 858 | + copy.ExtractBigData(versiontable); |
---|
| 859 | + // if (copy == client) |
---|
| 860 | + |
---|
| 861 | + byte[] versions[] = copy.versions; |
---|
| 862 | + copy.versions = null; |
---|
| 863 | + |
---|
| 864 | + byte[] compress = Compress(copy); |
---|
| 865 | + |
---|
| 866 | + copy.versions = versions; |
---|
| 867 | + |
---|
| 868 | + copy.RestoreBigData(versiontable); |
---|
| 869 | + |
---|
| 870 | + CameraPane.SWITCH = temp; |
---|
| 871 | + |
---|
| 872 | + return compress; |
---|
| 873 | + } |
---|
818 | 874 | |
---|
819 | 875 | private JTextPane createTextPane() |
---|
820 | 876 | { |
---|
.. | .. |
---|
946 | 1002 | // NumberSlider vDivsField; |
---|
947 | 1003 | // JCheckBox endcaps; |
---|
948 | 1004 | JCheckBox liveCB; |
---|
949 | | - JCheckBox selectCB; |
---|
| 1005 | + JCheckBox selectableCB; |
---|
950 | 1006 | JCheckBox hideCB; |
---|
951 | 1007 | JCheckBox link2masterCB; |
---|
952 | 1008 | JCheckBox markCB; |
---|
.. | .. |
---|
1158 | 1214 | |
---|
1159 | 1215 | liveCB = AddCheckBox(setupPanel, "Live", copy.live); |
---|
1160 | 1216 | liveCB.setToolTipText("Animate object"); |
---|
1161 | | - selectCB = AddCheckBox(setupPanel, "Select", !copy.dontselect); |
---|
1162 | | - selectCB.setToolTipText("Make object selectable"); |
---|
| 1217 | + selectableCB = AddCheckBox(setupPanel, "Select", !copy.dontselect); |
---|
| 1218 | + selectableCB.setToolTipText("Make object selectable"); |
---|
1163 | 1219 | // Return(); |
---|
| 1220 | + |
---|
1164 | 1221 | hideCB = AddCheckBox(setupPanel, "Hide", copy.hide); |
---|
1165 | 1222 | hideCB.setToolTipText("Hide object"); |
---|
1166 | 1223 | markCB = AddCheckBox(setupPanel, "Mark", copy.marked); |
---|
1167 | 1224 | markCB.setToolTipText("As animation target transform"); |
---|
| 1225 | + |
---|
| 1226 | + ToolTipManager.sharedInstance().setLightWeightPopupEnabled(false); |
---|
1168 | 1227 | |
---|
1169 | 1228 | setupPanel2 = new cGridBag().setVertical(false); |
---|
1170 | 1229 | |
---|
.. | .. |
---|
1174 | 1233 | randomCB = AddCheckBox(setupPanel2, "Random", copy.random); |
---|
1175 | 1234 | randomCB.setToolTipText("Randomly Rewind (or Go back and forth)"); |
---|
1176 | 1235 | |
---|
| 1236 | + link2masterCB = AddCheckBox(setupPanel2, "Support", copy.link2master); |
---|
| 1237 | + link2masterCB.setToolTipText("Attach to support"); |
---|
| 1238 | + |
---|
1177 | 1239 | if (Globals.ADVANCED) |
---|
1178 | 1240 | { |
---|
1179 | | - link2masterCB = AddCheckBox(setupPanel2, "Supp", copy.link2master); |
---|
1180 | | - link2masterCB.setToolTipText("Attach to support"); |
---|
1181 | 1241 | speedupCB = AddCheckBox(setupPanel2, "Speed", copy.speedup); |
---|
1182 | 1242 | speedupCB.setToolTipText("Option motion capture"); |
---|
1183 | 1243 | } |
---|
.. | .. |
---|
1451 | 1511 | XYZPanel.addComponent(/*BorderLayout.SOUTH,*/sideView); // Scroll); |
---|
1452 | 1512 | XYZPanel.addComponent(/*BorderLayout.CENTER,*/frontView); // Scroll); |
---|
1453 | 1513 | XYZPanel.addComponent(/*BorderLayout.NORTH,*/topView); // Scroll); |
---|
| 1514 | + //XYZPanel.setName("XYZ"); |
---|
1454 | 1515 | |
---|
1455 | 1516 | /* |
---|
1456 | 1517 | gridPanel = new JPanel(); //new BorderLayout()); |
---|
.. | .. |
---|
1488 | 1549 | //JScrollPane tmp = new JScrollPane(ctrlPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); |
---|
1489 | 1550 | //tmp.setName("Edit"); |
---|
1490 | 1551 | objectPanel.add(materialPanel); |
---|
| 1552 | + objectPanel.setIconAt(0, GetIcon("icons/material.png")); |
---|
| 1553 | + objectPanel.setToolTipTextAt(0, "Material panel"); |
---|
| 1554 | + |
---|
1491 | 1555 | // JPanel north = new JPanel(new BorderLayout()); |
---|
1492 | 1556 | // north.setName("Edit"); |
---|
1493 | 1557 | // north.add(ctrlPanel, BorderLayout.NORTH); |
---|
1494 | 1558 | // objectPanel.add(north); |
---|
1495 | 1559 | objectPanel.add(editPanel); |
---|
1496 | | - objectPanel.add(infoPanel); |
---|
| 1560 | + objectPanel.setIconAt(1, GetIcon("icons/write.png")); |
---|
| 1561 | + objectPanel.setToolTipTextAt(1, "Edit panel"); |
---|
| 1562 | + |
---|
| 1563 | + //if (Globals.ADVANCED) |
---|
| 1564 | + objectPanel.add(infoPanel); |
---|
| 1565 | + objectPanel.setIconAt(2, GetIcon("icons/info.png")); |
---|
| 1566 | + objectPanel.setToolTipTextAt(2, "Info panel"); |
---|
| 1567 | + |
---|
| 1568 | + objectPanel.add(XYZPanel); |
---|
| 1569 | + objectPanel.setIconAt(3, GetIcon("icons/XYZ.png")); |
---|
| 1570 | + objectPanel.setToolTipTextAt(3, "XYZ/RGB panel"); |
---|
| 1571 | + |
---|
1497 | 1572 | objectPanel.add(toolboxPanel); |
---|
| 1573 | + objectPanel.setIconAt(4, GetIcon("icons/primitives.png")); |
---|
| 1574 | + objectPanel.setToolTipTextAt(4, "Objects/backgrounds panel"); |
---|
1498 | 1575 | |
---|
1499 | 1576 | /* |
---|
1500 | 1577 | aConstraints.gridx = 0; |
---|
.. | .. |
---|
1515 | 1592 | scrollpane.addMouseWheelListener(this); // Default not fast enough |
---|
1516 | 1593 | |
---|
1517 | 1594 | /*JTabbedPane*/ scenePanel = new cGridBag(); |
---|
1518 | | - scenePanel.preferredWidth = 6; |
---|
| 1595 | + scenePanel.preferredWidth = 5; |
---|
1519 | 1596 | |
---|
1520 | 1597 | JTabbedPane tabbedPane = new JTabbedPane(); |
---|
1521 | 1598 | tabbedPane.add(scrollpane); |
---|
.. | .. |
---|
1593 | 1670 | bigThree = new cGridBag(); |
---|
1594 | 1671 | bigThree.addComponent(scenePanel); |
---|
1595 | 1672 | bigThree.addComponent(centralPanel); |
---|
1596 | | - bigThree.addComponent(XYZPanel); |
---|
| 1673 | + //bigThree.addComponent(XYZPanel); |
---|
1597 | 1674 | |
---|
1598 | 1675 | // // SIDE EFFECT!!! |
---|
1599 | 1676 | // aConstraints.gridx = 0; |
---|
.. | .. |
---|
1602 | 1679 | // aConstraints.gridheight = 1; |
---|
1603 | 1680 | |
---|
1604 | 1681 | framePanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, toolbarPanel, bigThree); |
---|
1605 | | - framePanel.setContinuousLayout(true); |
---|
1606 | | - framePanel.setOneTouchExpandable(true); |
---|
1607 | | - framePanel.setDividerLocation(0.8); |
---|
| 1682 | + framePanel.setContinuousLayout(false); |
---|
| 1683 | + framePanel.setOneTouchExpandable(false); |
---|
| 1684 | + //.setDividerLocation(0.8); |
---|
1608 | 1685 | //framePanel.setDividerSize(15); |
---|
1609 | 1686 | //framePanel.setResizeWeight(0.15); |
---|
1610 | 1687 | framePanel.setName("Frame"); |
---|
.. | .. |
---|
1634 | 1711 | frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); |
---|
1635 | 1712 | frame.addWindowListener(new WindowAdapter() |
---|
1636 | 1713 | { |
---|
1637 | | - |
---|
1638 | 1714 | public void windowClosing(WindowEvent e) |
---|
1639 | 1715 | { |
---|
1640 | 1716 | Close(); |
---|
.. | .. |
---|
1696 | 1772 | //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints); |
---|
1697 | 1773 | |
---|
1698 | 1774 | cGridBag colorSection = new cGridBag().setVertical(true); |
---|
| 1775 | + |
---|
| 1776 | + cGridBag huepanel = new cGridBag(); |
---|
| 1777 | + cGridBag huelabel = new cGridBag(); |
---|
| 1778 | + huelabel.add(GetLabel("icons/hue.png", false)); |
---|
| 1779 | + huelabel.preferredWidth = 20; |
---|
| 1780 | + huepanel.add(new cGridBag()); // Label |
---|
| 1781 | + huepanel.add(huelabel); // Field/slider |
---|
| 1782 | + |
---|
| 1783 | + huepanel.preferredHeight = 7; |
---|
| 1784 | + |
---|
| 1785 | + colorSection.add(huepanel); |
---|
1699 | 1786 | |
---|
1700 | 1787 | cGridBag color = new cGridBag(); |
---|
1701 | | - color.add(colorLabel = new JLabel("Color/hue")); // , aConstraints); |
---|
1702 | | - colorLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1703 | | - color.add(colorField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
| 1788 | + |
---|
| 1789 | + color.add(colorLabel = new JLabel("Color/hue")); // , aConstraints); |
---|
| 1790 | + colorLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 1791 | + color.add(colorField = new cNumberSlider(this, 0.001, 1)); // , aConstraints); |
---|
| 1792 | + |
---|
1704 | 1793 | //colorField.preferredWidth = 200; |
---|
1705 | 1794 | colorSection.add(color); |
---|
1706 | 1795 | |
---|
1707 | 1796 | cGridBag modulation = new cGridBag(); |
---|
1708 | 1797 | modulation.add(modulationLabel = new JLabel("Saturation")); // , aConstraints); |
---|
1709 | 1798 | modulationLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1710 | | - modulation.add(modulationField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
| 1799 | + modulation.add(modulationField = new cNumberSlider(this, 0.001, 1)); // , aConstraints); |
---|
1711 | 1800 | colorSection.add(modulation); |
---|
1712 | 1801 | |
---|
| 1802 | + cGridBag opacity = new cGridBag(); |
---|
| 1803 | + opacity.add(opacityLabel = new JLabel("Opacity")); // , aConstraints); |
---|
| 1804 | + opacityLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 1805 | + opacity.add(opacityField = new cNumberSlider(this, 0.001, 1)); // , aConstraints); |
---|
| 1806 | + colorSection.add(opacity); |
---|
| 1807 | + |
---|
| 1808 | + colorSection.add(GetSeparator()); |
---|
| 1809 | + |
---|
1713 | 1810 | cGridBag texture = new cGridBag(); |
---|
1714 | 1811 | texture.add(textureLabel = new JLabel("Texture")); // , aConstraints); |
---|
1715 | 1812 | textureLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1716 | 1813 | texture.add(textureField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
1717 | 1814 | colorSection.add(texture); |
---|
1718 | 1815 | |
---|
1719 | | - panel.add(new JSeparator()); |
---|
| 1816 | + panel.add(GetSeparator()); |
---|
1720 | 1817 | |
---|
1721 | 1818 | panel.add(colorSection); |
---|
1722 | 1819 | |
---|
.. | .. |
---|
1772 | 1869 | shadowbias.add(shadowbiasField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
1773 | 1870 | diffuseSection.add(shadowbias); |
---|
1774 | 1871 | |
---|
1775 | | - panel.add(new JSeparator()); |
---|
| 1872 | + panel.add(GetSeparator()); |
---|
1776 | 1873 | |
---|
1777 | 1874 | panel.add(diffuseSection); |
---|
1778 | 1875 | |
---|
.. | .. |
---|
1835 | 1932 | specularSection.add(anisoV); |
---|
1836 | 1933 | |
---|
1837 | 1934 | |
---|
1838 | | - panel.add(new JSeparator()); |
---|
| 1935 | + panel.add(GetSeparator()); |
---|
1839 | 1936 | |
---|
1840 | 1937 | panel.add(specularSection); |
---|
1841 | 1938 | |
---|
.. | .. |
---|
1860 | 1957 | backlitLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1861 | 1958 | backlit.add(backlitField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
1862 | 1959 | colorSection.add(backlit); |
---|
1863 | | - |
---|
1864 | | - cGridBag opacity = new cGridBag(); |
---|
1865 | | - opacity.add(opacityLabel = new JLabel("Opacity")); // , aConstraints); |
---|
1866 | | - opacityLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1867 | | - opacity.add(opacityField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
1868 | | - colorSection.add(opacity); |
---|
1869 | 1960 | |
---|
1870 | 1961 | //panel.add(new JSeparator()); |
---|
1871 | 1962 | |
---|
.. | .. |
---|
1911 | 2002 | opacityPower.add(opacityPowerField = new cNumberSlider(this, 0.0, 10 /*10 dec 2013*/)); // , aConstraints); |
---|
1912 | 2003 | textureSection.add(opacityPower); |
---|
1913 | 2004 | |
---|
1914 | | - panel.add(new JSeparator()); |
---|
| 2005 | + panel.add(GetSeparator()); |
---|
1915 | 2006 | |
---|
1916 | 2007 | panel.add(textureSection); |
---|
1917 | 2008 | |
---|
.. | .. |
---|
1976 | 2067 | // 3D models |
---|
1977 | 2068 | if (filename.endsWith(".3ds") || filename.endsWith(".3DS")) |
---|
1978 | 2069 | { |
---|
1979 | | - lastConverter = new com.jmex.model.converters.MaxToJme(); |
---|
1980 | | - LoadFile(filename, lastConverter); |
---|
| 2070 | + //lastConverter = new com.jmex.model.converters.MaxToJme(); |
---|
| 2071 | + //LoadFile(filename, lastConverter); |
---|
| 2072 | + LoadObjFile(filename); // New 3ds loader |
---|
1981 | 2073 | continue; |
---|
1982 | 2074 | } |
---|
1983 | 2075 | if (filename.endsWith(".dae") || filename.endsWith(".DAE")) |
---|
.. | .. |
---|
2703 | 2795 | LA.matXRotate(((Object3D) group.get(group.size() - 1)).toParent, -Math.PI / 2); |
---|
2704 | 2796 | LA.matXRotate(((Object3D) group.get(group.size() - 1)).fromParent, Math.PI / 2); |
---|
2705 | 2797 | } |
---|
| 2798 | + |
---|
2706 | 2799 | //cJME.count++; |
---|
2707 | 2800 | //cJME.count %= 12; |
---|
2708 | 2801 | if (gc) |
---|
.. | .. |
---|
2886 | 2979 | } |
---|
2887 | 2980 | } |
---|
2888 | 2981 | } |
---|
| 2982 | + |
---|
2889 | 2983 | cFileSystemPane FSPane; |
---|
2890 | 2984 | |
---|
2891 | 2985 | void SetMaterial(cMaterial mat, Object3D.cVector2[] others) |
---|
.. | .. |
---|
2939 | 3033 | } |
---|
2940 | 3034 | } |
---|
2941 | 3035 | } |
---|
| 3036 | + |
---|
2942 | 3037 | freezematerial = false; |
---|
2943 | 3038 | } |
---|
2944 | 3039 | |
---|
.. | .. |
---|
3206 | 3301 | { |
---|
3207 | 3302 | copy.live ^= true; |
---|
3208 | 3303 | return; |
---|
3209 | | - } else if (event.getSource() == selectCB) |
---|
| 3304 | + } else if (event.getSource() == selectableCB) |
---|
3210 | 3305 | { |
---|
3211 | 3306 | copy.dontselect ^= true; |
---|
3212 | 3307 | return; |
---|
.. | .. |
---|
3391 | 3486 | { |
---|
3392 | 3487 | Close(); |
---|
3393 | 3488 | //return true; |
---|
3394 | | - } else if (source == loadItem) |
---|
| 3489 | + } else if (source == openItem) |
---|
3395 | 3490 | { |
---|
3396 | | - load(); |
---|
| 3491 | + Open(); |
---|
3397 | 3492 | //return true; |
---|
3398 | 3493 | } else if (source == newItem) |
---|
3399 | 3494 | { |
---|
.. | .. |
---|
3418 | 3513 | { |
---|
3419 | 3514 | generatePOV(); |
---|
3420 | 3515 | //return true; |
---|
| 3516 | + } else if (event.getSource() == archiveItem) |
---|
| 3517 | + { |
---|
| 3518 | + cTools.Archive(frame); |
---|
| 3519 | + return; |
---|
3421 | 3520 | } else if (source == zBufferItem) |
---|
3422 | 3521 | { |
---|
3423 | 3522 | try |
---|
.. | .. |
---|
3469 | 3568 | try |
---|
3470 | 3569 | { |
---|
3471 | 3570 | ByteArrayOutputStream baos = new ByteArrayOutputStream(); |
---|
3472 | | - java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(baos); |
---|
3473 | | - ObjectOutputStream out = new ObjectOutputStream(zstream); |
---|
| 3571 | +// java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(baos); |
---|
| 3572 | + ObjectOutputStream out = new ObjectOutputStream(baos); //zstream); |
---|
3474 | 3573 | |
---|
3475 | 3574 | Object3D parent = o.parent; |
---|
3476 | 3575 | o.parent = null; |
---|
.. | .. |
---|
3481 | 3580 | |
---|
3482 | 3581 | out.flush(); |
---|
3483 | 3582 | |
---|
3484 | | - zstream.close(); |
---|
| 3583 | + baos //zstream |
---|
| 3584 | + .close(); |
---|
3485 | 3585 | out.close(); |
---|
3486 | 3586 | |
---|
3487 | | - return baos.toByteArray(); |
---|
| 3587 | + byte[] bytes = baos.toByteArray(); |
---|
| 3588 | + |
---|
| 3589 | + System.out.println("save #bytes = " + bytes.length); |
---|
| 3590 | + return bytes; |
---|
3488 | 3591 | } catch (Exception e) |
---|
3489 | 3592 | { |
---|
3490 | 3593 | System.err.println(e); |
---|
.. | .. |
---|
3494 | 3597 | |
---|
3495 | 3598 | static public Object Uncompress(byte[] bytes) |
---|
3496 | 3599 | { |
---|
3497 | | - System.out.println("#bytes = " + bytes.length); |
---|
| 3600 | + System.out.println("restore #bytes = " + bytes.length); |
---|
3498 | 3601 | try |
---|
3499 | 3602 | { |
---|
3500 | 3603 | ByteArrayInputStream bais = new ByteArrayInputStream(bytes); |
---|
3501 | | - java.util.zip.GZIPInputStream istream = new java.util.zip.GZIPInputStream(bais); |
---|
3502 | | - ObjectInputStream in = new ObjectInputStream(istream); |
---|
| 3604 | + //java.util.zip.GZIPInputStream istream = new java.util.zip.GZIPInputStream(bais); |
---|
| 3605 | + ObjectInputStream in = new ObjectInputStream(bais); // istream); |
---|
3503 | 3606 | Object obj = in.readObject(); |
---|
| 3607 | + |
---|
| 3608 | + bais //istream |
---|
| 3609 | + .close(); |
---|
3504 | 3610 | in.close(); |
---|
3505 | 3611 | |
---|
3506 | 3612 | return obj; |
---|
.. | .. |
---|
3555 | 3661 | return null; |
---|
3556 | 3662 | } |
---|
3557 | 3663 | |
---|
3558 | | - java.util.Hashtable<java.util.UUID, Object3D> hashtable = new java.util.Hashtable<java.util.UUID, Object3D>(); |
---|
3559 | 3664 | |
---|
3560 | 3665 | public void Save() |
---|
| 3666 | + { |
---|
| 3667 | + //Save(true); |
---|
| 3668 | + Replace(); |
---|
| 3669 | + } |
---|
| 3670 | + |
---|
| 3671 | + private boolean Equal(byte[] compress, byte[] name) |
---|
| 3672 | + { |
---|
| 3673 | + if (compress.length != name.length) |
---|
| 3674 | + { |
---|
| 3675 | + return false; |
---|
| 3676 | + } |
---|
| 3677 | + |
---|
| 3678 | + for (int i=compress.length; --i>=0;) |
---|
| 3679 | + { |
---|
| 3680 | + if (compress[i] != name[i]) |
---|
| 3681 | + return false; |
---|
| 3682 | + } |
---|
| 3683 | + |
---|
| 3684 | + return true; |
---|
| 3685 | + } |
---|
| 3686 | + |
---|
| 3687 | + java.util.Hashtable<java.util.UUID, Object3D> versiontable = new java.util.Hashtable<java.util.UUID, Object3D>(); |
---|
| 3688 | + |
---|
| 3689 | + public boolean Save(boolean user) |
---|
3561 | 3690 | { |
---|
3562 | 3691 | System.err.println("Save"); |
---|
3563 | 3692 | |
---|
3564 | 3693 | cRadio tab = GetCurrentTab(); |
---|
3565 | 3694 | |
---|
3566 | | - boolean temp = CameraPane.SWITCH; |
---|
3567 | | - CameraPane.SWITCH = false; |
---|
| 3695 | + byte[] compress = CompressCopy(); // Saved version. No need for "Replace". |
---|
3568 | 3696 | |
---|
3569 | | - copy.ExtractBigData(hashtable); |
---|
| 3697 | + boolean thesame = false; |
---|
3570 | 3698 | |
---|
3571 | | - byte[] compress = Compress(copy); |
---|
| 3699 | + // Quick heuristic using length. Works only when stream is compressed. |
---|
| 3700 | + if (copy.versionindex > 0 && copy.versions[copy.versionindex-1] != null && Equal(compress, copy.versions[copy.versionindex-1])) |
---|
| 3701 | + { |
---|
| 3702 | + thesame = true; |
---|
| 3703 | + } |
---|
3572 | 3704 | |
---|
3573 | 3705 | //EditorFrame.m_MainFrame.requestFocusInWindow(); |
---|
3574 | | - tab.graphs[tab.undoindex++] = compress; |
---|
| 3706 | + if (!thesame) |
---|
| 3707 | + { |
---|
| 3708 | + //tab.user[tab.versionindex] = user; |
---|
| 3709 | + //boolean increment = true; // tab.graphs[tab.versionindex] == null; |
---|
| 3710 | + |
---|
| 3711 | + copy.versions[++copy.versionindex] = compress; |
---|
| 3712 | + |
---|
| 3713 | + // if (increment) |
---|
| 3714 | + // tab.versionindex++; |
---|
| 3715 | + } |
---|
3575 | 3716 | |
---|
3576 | | - copy.RestoreBigData(hashtable); |
---|
| 3717 | + //copy.RestoreBigData(versiontable); |
---|
3577 | 3718 | |
---|
3578 | | - CameraPane.SWITCH = temp; |
---|
3579 | | - |
---|
3580 | 3719 | //assert(hashtable.isEmpty()); |
---|
3581 | 3720 | |
---|
3582 | | - for (int i = tab.undoindex; i < tab.graphs.length; i++) |
---|
| 3721 | + for (int i = copy.versionindex+1; i < copy.versions.length; i++) |
---|
3583 | 3722 | { |
---|
3584 | | - tab.graphs[i] = null; |
---|
| 3723 | + //tab.user[i] = false; |
---|
| 3724 | + copy.versions[i] = null; |
---|
3585 | 3725 | } |
---|
3586 | 3726 | |
---|
3587 | 3727 | SetUndoStates(); |
---|
.. | .. |
---|
3591 | 3731 | { |
---|
3592 | 3732 | try |
---|
3593 | 3733 | { |
---|
3594 | | - FileOutputStream ostream = new FileOutputStream("save" + tab.undoindex); |
---|
| 3734 | + FileOutputStream ostream = new FileOutputStream("save" + copy.versionindex); |
---|
3595 | 3735 | ObjectOutputStream p = new ObjectOutputStream(ostream); |
---|
3596 | 3736 | |
---|
3597 | 3737 | p.writeObject(copy); |
---|
.. | .. |
---|
3604 | 3744 | e.printStackTrace(); |
---|
3605 | 3745 | } |
---|
3606 | 3746 | } |
---|
| 3747 | + |
---|
| 3748 | + return !thesame; |
---|
3607 | 3749 | } |
---|
3608 | 3750 | |
---|
3609 | 3751 | void CopyChanged(Object3D obj) |
---|
.. | .. |
---|
3613 | 3755 | boolean temp = CameraPane.SWITCH; |
---|
3614 | 3756 | CameraPane.SWITCH = false; |
---|
3615 | 3757 | |
---|
3616 | | - copy.ExtractBigData(hashtable); |
---|
| 3758 | + copy.ExtractBigData(versiontable); |
---|
3617 | 3759 | |
---|
3618 | 3760 | copy.clear(); |
---|
3619 | 3761 | |
---|
| 3762 | + copy.skyboxname = obj.skyboxname; |
---|
| 3763 | + copy.skyboxext = obj.skyboxext; |
---|
| 3764 | + |
---|
3620 | 3765 | for (int i=0; i<obj.Size(); i++) |
---|
3621 | 3766 | { |
---|
3622 | 3767 | copy.add(obj.get(i)); |
---|
3623 | 3768 | } |
---|
3624 | 3769 | |
---|
3625 | | - copy.RestoreBigData(hashtable); |
---|
| 3770 | + copy.RestoreBigData(versiontable); |
---|
3626 | 3771 | |
---|
3627 | 3772 | CameraPane.SWITCH = temp; |
---|
3628 | 3773 | |
---|
.. | .. |
---|
3650 | 3795 | } |
---|
3651 | 3796 | |
---|
3652 | 3797 | cButton undoButton; |
---|
| 3798 | + cButton restoreButton; |
---|
| 3799 | + cButton replaceButton; |
---|
3653 | 3800 | cButton redoButton; |
---|
3654 | 3801 | |
---|
| 3802 | + boolean muteSlider; |
---|
| 3803 | + |
---|
| 3804 | + int VersionCount() |
---|
| 3805 | + { |
---|
| 3806 | + int count = 0; |
---|
| 3807 | + |
---|
| 3808 | + for (int i = copy.versions.length; --i >= 0;) |
---|
| 3809 | + { |
---|
| 3810 | + if (copy.versions[i] != null) |
---|
| 3811 | + count++; |
---|
| 3812 | + } |
---|
| 3813 | + |
---|
| 3814 | + return count; |
---|
| 3815 | + } |
---|
| 3816 | + |
---|
3655 | 3817 | void SetUndoStates() |
---|
3656 | 3818 | { |
---|
3657 | 3819 | cRadio tab = GetCurrentTab(); |
---|
3658 | 3820 | |
---|
3659 | | - undoButton.setEnabled(tab.undoindex > 0); |
---|
3660 | | - redoButton.setEnabled(tab.graphs[tab.undoindex + 1] != null); |
---|
| 3821 | + restoreButton.setEnabled(copy.versionindex != -1); |
---|
| 3822 | + replaceButton.setEnabled(copy.versionindex != -1); |
---|
| 3823 | + |
---|
| 3824 | + undoButton.setEnabled(copy.versionindex > 0); |
---|
| 3825 | + redoButton.setEnabled(copy.versions[copy.versionindex + 1] != null); |
---|
| 3826 | + |
---|
| 3827 | + muteSlider = true; |
---|
| 3828 | + versionSlider.setMaximum(VersionCount() - 1); |
---|
| 3829 | + versionSlider.setInteger(copy.versionindex); |
---|
| 3830 | + muteSlider = false; |
---|
3661 | 3831 | } |
---|
3662 | 3832 | |
---|
3663 | | - public void Undo() |
---|
| 3833 | + public boolean Undo() |
---|
3664 | 3834 | { |
---|
| 3835 | + // Option? |
---|
| 3836 | + Replace(); |
---|
| 3837 | + |
---|
3665 | 3838 | System.err.println("Undo"); |
---|
3666 | 3839 | |
---|
3667 | 3840 | cRadio tab = GetCurrentTab(); |
---|
3668 | 3841 | |
---|
3669 | | - if (tab.undoindex == 0) |
---|
| 3842 | + if (copy.versionindex == 0) |
---|
3670 | 3843 | { |
---|
3671 | 3844 | java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
3672 | | - return; |
---|
| 3845 | + return false; |
---|
3673 | 3846 | } |
---|
3674 | 3847 | |
---|
3675 | | - if (tab.graphs[tab.undoindex] == null) |
---|
| 3848 | +// if (tab.graphs[tab.versionindex] == null) // || !tab.user[tab.versionindex]) |
---|
| 3849 | +// { |
---|
| 3850 | +// if (Save(false)) |
---|
| 3851 | +// tab.versionindex -= 1; |
---|
| 3852 | +// else |
---|
| 3853 | +// { |
---|
| 3854 | +// if (tab.versionindex <= 0) |
---|
| 3855 | +// return false; |
---|
| 3856 | +// else |
---|
| 3857 | +// tab.versionindex -= 1; |
---|
| 3858 | +// } |
---|
| 3859 | +// } |
---|
| 3860 | + |
---|
| 3861 | + copy.versionindex -= 1; |
---|
| 3862 | + |
---|
| 3863 | + CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex])); |
---|
| 3864 | + |
---|
| 3865 | + return true; |
---|
| 3866 | + } |
---|
| 3867 | + |
---|
| 3868 | + public boolean Restore() |
---|
| 3869 | + { |
---|
| 3870 | + System.err.println("Restore"); |
---|
| 3871 | + |
---|
| 3872 | + cRadio tab = GetCurrentTab(); |
---|
| 3873 | + |
---|
| 3874 | + if (copy.versionindex == -1 || copy.versions[copy.versionindex] == null) |
---|
3676 | 3875 | { |
---|
3677 | | - Save(); |
---|
3678 | | - tab.undoindex -= 1; |
---|
| 3876 | + java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
| 3877 | + return false; |
---|
3679 | 3878 | } |
---|
3680 | 3879 | |
---|
3681 | | - tab.undoindex -= 1; |
---|
| 3880 | + CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex])); |
---|
| 3881 | + |
---|
| 3882 | + return true; |
---|
| 3883 | + } |
---|
3682 | 3884 | |
---|
3683 | | - CopyChanged((Object3D)Uncompress(tab.graphs[tab.undoindex])); |
---|
| 3885 | + public boolean Replace() |
---|
| 3886 | + { |
---|
| 3887 | + System.err.println("Replace"); |
---|
| 3888 | + |
---|
| 3889 | + cRadio tab = GetCurrentTab(); |
---|
| 3890 | + |
---|
| 3891 | + if (copy.versionindex == -1 || copy.versions[copy.versionindex] == null) |
---|
| 3892 | + { |
---|
| 3893 | + // No version yet. OK. java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
| 3894 | + return false; |
---|
| 3895 | + } |
---|
| 3896 | + |
---|
| 3897 | + copy.versions[copy.versionindex] = CompressCopy(); |
---|
| 3898 | + |
---|
| 3899 | + return true; |
---|
3684 | 3900 | } |
---|
3685 | 3901 | |
---|
3686 | 3902 | public void Redo() |
---|
3687 | 3903 | { |
---|
| 3904 | + // Option? |
---|
| 3905 | + Replace(); |
---|
| 3906 | + |
---|
3688 | 3907 | cRadio tab = GetCurrentTab(); |
---|
3689 | 3908 | |
---|
3690 | | - if (tab.graphs[tab.undoindex + 1] == null) |
---|
| 3909 | + if (copy.versions[copy.versionindex + 1] == null) |
---|
3691 | 3910 | { |
---|
3692 | 3911 | java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
3693 | 3912 | return; |
---|
3694 | 3913 | } |
---|
3695 | 3914 | |
---|
3696 | | - tab.undoindex += 1; |
---|
| 3915 | + copy.versionindex += 1; |
---|
3697 | 3916 | |
---|
3698 | | - CopyChanged((Object3D)Uncompress(tab.graphs[tab.undoindex])); |
---|
| 3917 | + CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex])); |
---|
| 3918 | + |
---|
| 3919 | + //if (!tab.user[tab.versionindex]) |
---|
| 3920 | + // tab.graphs[tab.versionindex] = null; |
---|
3699 | 3921 | } |
---|
3700 | 3922 | |
---|
3701 | 3923 | void ImportGFD() |
---|
.. | .. |
---|
3991 | 4213 | //copy.Touch(); |
---|
3992 | 4214 | } |
---|
3993 | 4215 | |
---|
| 4216 | + cNumberSlider versionSlider; |
---|
| 4217 | + |
---|
3994 | 4218 | public void stateChanged(ChangeEvent e) |
---|
3995 | 4219 | { |
---|
3996 | 4220 | // assert(false); |
---|
| 4221 | + if (e.getSource() == versionSlider) |
---|
| 4222 | + { |
---|
| 4223 | + if (muteSlider) |
---|
| 4224 | + return; |
---|
| 4225 | + |
---|
| 4226 | + int version = versionSlider.getInteger(); |
---|
| 4227 | + |
---|
| 4228 | + if (copy.versions[version] != null) |
---|
| 4229 | + { |
---|
| 4230 | + CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex = version])); |
---|
| 4231 | + } |
---|
| 4232 | + |
---|
| 4233 | + return; |
---|
| 4234 | + } |
---|
3997 | 4235 | |
---|
3998 | 4236 | if (freezematerial) |
---|
3999 | 4237 | { |
---|
.. | .. |
---|
4342 | 4580 | |
---|
4343 | 4581 | void makeSomething(Object3D thing, boolean resetmodel) // deselect) |
---|
4344 | 4582 | { |
---|
4345 | | - if (Globals.SAVEONMAKE) // && resetmodel) |
---|
| 4583 | + if (Globals.REPLACEONMAKE) // && resetmodel) |
---|
4346 | 4584 | Save(); |
---|
4347 | 4585 | //Tween.set(thing, 0).target(1).start(tweenManager); |
---|
4348 | 4586 | //Tween.to(thing, 0, 0.5f).target(0).start(tweenManager); |
---|
.. | .. |
---|
4584 | 4822 | readobj.ResetDisplayList(); |
---|
4585 | 4823 | } catch (Exception e) |
---|
4586 | 4824 | { |
---|
4587 | | - //e.printStackTrace(); |
---|
| 4825 | + if (!e.toString().contains("GZIP")) |
---|
| 4826 | + e.printStackTrace(); |
---|
| 4827 | + |
---|
4588 | 4828 | try |
---|
4589 | 4829 | { |
---|
4590 | 4830 | java.io.FileInputStream istream = new java.io.FileInputStream(fullname); |
---|
.. | .. |
---|
4658 | 4898 | |
---|
4659 | 4899 | if (readobj != null) |
---|
4660 | 4900 | { |
---|
4661 | | - if (Globals.SAVEONMAKE) |
---|
4662 | | - Save(); |
---|
| 4901 | + //if (Globals.SAVEONMAKE) // A new object cannot share meshes |
---|
| 4902 | + // Save(); |
---|
4663 | 4903 | try |
---|
4664 | 4904 | { |
---|
4665 | 4905 | //readobj.deepCopySelf(copy); |
---|
4666 | 4906 | copy.clear(); // june 2014 |
---|
| 4907 | + copy.skyboxname = readobj.skyboxname; |
---|
| 4908 | + copy.skyboxext = readobj.skyboxext; |
---|
4667 | 4909 | for (int i = 0; i < readobj.size(); i++) |
---|
4668 | 4910 | { |
---|
4669 | 4911 | Object3D child = readobj.get(i); // reserve(i); |
---|
.. | .. |
---|
4704 | 4946 | } |
---|
4705 | 4947 | } catch (ClassCastException e) |
---|
4706 | 4948 | { |
---|
| 4949 | + e.printStackTrace(); |
---|
4707 | 4950 | assert (false); |
---|
4708 | 4951 | Composite c = (Composite) copy; |
---|
4709 | 4952 | c.children.clear(); |
---|
.. | .. |
---|
4714 | 4957 | c.addChild(csg); |
---|
4715 | 4958 | } |
---|
4716 | 4959 | |
---|
| 4960 | + copy.versions = readobj.versions; |
---|
| 4961 | + copy.versionindex = readobj.versionindex; |
---|
| 4962 | + |
---|
| 4963 | + if (copy.versions == null) |
---|
| 4964 | + { |
---|
| 4965 | + copy.versions = new byte[100][]; |
---|
| 4966 | + copy.versionindex = -1; |
---|
| 4967 | + } |
---|
| 4968 | + |
---|
| 4969 | + //? SetUndoStates(); |
---|
| 4970 | + |
---|
4717 | 4971 | ResetModel(); |
---|
4718 | 4972 | copy.HardTouch(); // recompile? |
---|
4719 | 4973 | refreshContents(); |
---|
4720 | 4974 | } |
---|
4721 | 4975 | } |
---|
4722 | 4976 | |
---|
4723 | | - void load() // throws ClassNotFoundException |
---|
| 4977 | + void Open() // throws ClassNotFoundException |
---|
4724 | 4978 | { |
---|
4725 | 4979 | if (Grafreed.standAlone) |
---|
4726 | 4980 | { |
---|
.. | .. |
---|
4823 | 5077 | //ps.print(buffer.toString()); |
---|
4824 | 5078 | } catch (IOException e) |
---|
4825 | 5079 | { |
---|
| 5080 | + e.printStackTrace(); |
---|
4826 | 5081 | } |
---|
4827 | 5082 | } |
---|
4828 | 5083 | |
---|
.. | .. |
---|
5005 | 5260 | MenuBar menuBar; |
---|
5006 | 5261 | Menu fileMenu; |
---|
5007 | 5262 | MenuItem newItem; |
---|
5008 | | - MenuItem loadItem; |
---|
| 5263 | + MenuItem openItem; |
---|
5009 | 5264 | MenuItem saveItem; |
---|
5010 | 5265 | MenuItem saveAsItem; |
---|
5011 | 5266 | MenuItem exportAsItem; |
---|
.. | .. |
---|
5028 | 5283 | CheckboxMenuItem toggleSwitchItem; |
---|
5029 | 5284 | CheckboxMenuItem toggleRootItem; |
---|
5030 | 5285 | CheckboxMenuItem animationItem; |
---|
| 5286 | + MenuItem archiveItem; |
---|
5031 | 5287 | CheckboxMenuItem toggleHandleItem; |
---|
5032 | 5288 | CheckboxMenuItem togglePaintItem; |
---|
5033 | 5289 | JSplitPane mainPanel; |
---|