.. | .. |
---|
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 | 55 | ImageIcon icon = GetIcon(name); |
---|
48 | 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); |
---|
49 | 63 | } |
---|
50 | 64 | |
---|
51 | 65 | cToggleButton GetToggleButton(String name, boolean border) |
---|
.. | .. |
---|
60 | 74 | return new cCheckBox(icon, border); |
---|
61 | 75 | } |
---|
62 | 76 | |
---|
63 | | - private ImageIcon GetIcon(String name) |
---|
| 77 | + ImageIcon GetIcon(String name) |
---|
64 | 78 | { |
---|
65 | 79 | try |
---|
66 | 80 | { |
---|
67 | 81 | BufferedImage image = javax.imageio.ImageIO.read(getClass().getClassLoader().getResourceAsStream(name)); |
---|
68 | 82 | |
---|
69 | | - if (image.getWidth() != 24 && image.getHeight() != 24) |
---|
70 | | - { |
---|
71 | | - BufferedImage resized = new BufferedImage(24, 24, image.getType()); |
---|
72 | | - Graphics2D g = resized.createGraphics(); |
---|
73 | | - g.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR); |
---|
74 | | - //g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); |
---|
75 | | - g.drawImage(image, 0, 0, 24, 24, 0, 0, image.getWidth(), image.getHeight(), null); |
---|
76 | | - g.dispose(); |
---|
77 | | - |
---|
78 | | - image = resized; |
---|
79 | | - } |
---|
| 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 | +// } |
---|
80 | 94 | |
---|
81 | 95 | javax.swing.ImageIcon icon = new javax.swing.ImageIcon(image); |
---|
82 | 96 | return icon; |
---|
| 97 | + } |
---|
| 98 | + catch (Exception e) |
---|
| 99 | + { |
---|
| 100 | + return null; |
---|
| 101 | + } |
---|
| 102 | + } |
---|
| 103 | + |
---|
| 104 | + BufferedImage GetImage(String name) |
---|
| 105 | + { |
---|
| 106 | + try |
---|
| 107 | + { |
---|
| 108 | + BufferedImage image = javax.imageio.ImageIO.read(getClass().getClassLoader().getResourceAsStream(name)); |
---|
| 109 | + |
---|
| 110 | + return image; |
---|
83 | 111 | } |
---|
84 | 112 | catch (Exception e) |
---|
85 | 113 | { |
---|
.. | .. |
---|
327 | 355 | |
---|
328 | 356 | if (copy.versions == null) |
---|
329 | 357 | { |
---|
330 | | - copy.versions = new byte[100][]; |
---|
331 | | - copy.versionindex = -1; |
---|
| 358 | +// copy.versions = new byte[100][]; |
---|
| 359 | +// copy.versionindex = -1; |
---|
332 | 360 | } |
---|
333 | 361 | |
---|
334 | 362 | SetupMenu(); |
---|
.. | .. |
---|
436 | 464 | editPanel.add(editCommandsPanel); |
---|
437 | 465 | editPanel.add(ctrlPanel); |
---|
438 | 466 | |
---|
439 | | - toolboxPanel = new cGridBag().setVertical(false); |
---|
| 467 | + toolboxPanel = new cGridBag().setVertical(true); |
---|
440 | 468 | //toolboxPanel.setName("Toolbox"); |
---|
441 | 469 | |
---|
442 | 470 | materialPanel = new cGridBag().setVertical(true); |
---|
.. | .. |
---|
974 | 1002 | // NumberSlider vDivsField; |
---|
975 | 1003 | // JCheckBox endcaps; |
---|
976 | 1004 | JCheckBox liveCB; |
---|
977 | | - JCheckBox selectCB; |
---|
| 1005 | + JCheckBox selectableCB; |
---|
978 | 1006 | JCheckBox hideCB; |
---|
979 | 1007 | JCheckBox link2masterCB; |
---|
980 | 1008 | JCheckBox markCB; |
---|
.. | .. |
---|
1186 | 1214 | |
---|
1187 | 1215 | liveCB = AddCheckBox(setupPanel, "Live", copy.live); |
---|
1188 | 1216 | liveCB.setToolTipText("Animate object"); |
---|
1189 | | - selectCB = AddCheckBox(setupPanel, "Select", !copy.dontselect); |
---|
1190 | | - selectCB.setToolTipText("Make object selectable"); |
---|
| 1217 | + selectableCB = AddCheckBox(setupPanel, "Select", !copy.dontselect); |
---|
| 1218 | + selectableCB.setToolTipText("Make object selectable"); |
---|
1191 | 1219 | // Return(); |
---|
| 1220 | + |
---|
1192 | 1221 | hideCB = AddCheckBox(setupPanel, "Hide", copy.hide); |
---|
1193 | 1222 | hideCB.setToolTipText("Hide object"); |
---|
1194 | 1223 | markCB = AddCheckBox(setupPanel, "Mark", copy.marked); |
---|
1195 | 1224 | markCB.setToolTipText("As animation target transform"); |
---|
| 1225 | + |
---|
| 1226 | + ToolTipManager.sharedInstance().setLightWeightPopupEnabled(false); |
---|
1196 | 1227 | |
---|
1197 | 1228 | setupPanel2 = new cGridBag().setVertical(false); |
---|
1198 | 1229 | |
---|
.. | .. |
---|
1519 | 1550 | //tmp.setName("Edit"); |
---|
1520 | 1551 | objectPanel.add(materialPanel); |
---|
1521 | 1552 | objectPanel.setIconAt(0, GetIcon("icons/material.png")); |
---|
| 1553 | + objectPanel.setToolTipTextAt(0, "Material panel"); |
---|
| 1554 | + |
---|
1522 | 1555 | // JPanel north = new JPanel(new BorderLayout()); |
---|
1523 | 1556 | // north.setName("Edit"); |
---|
1524 | 1557 | // north.add(ctrlPanel, BorderLayout.NORTH); |
---|
1525 | 1558 | // objectPanel.add(north); |
---|
1526 | 1559 | objectPanel.add(editPanel); |
---|
1527 | 1560 | objectPanel.setIconAt(1, GetIcon("icons/write.png")); |
---|
| 1561 | + objectPanel.setToolTipTextAt(1, "Edit panel"); |
---|
1528 | 1562 | |
---|
1529 | 1563 | //if (Globals.ADVANCED) |
---|
1530 | 1564 | objectPanel.add(infoPanel); |
---|
1531 | 1565 | objectPanel.setIconAt(2, GetIcon("icons/info.png")); |
---|
| 1566 | + objectPanel.setToolTipTextAt(2, "Info panel"); |
---|
1532 | 1567 | |
---|
1533 | 1568 | objectPanel.add(XYZPanel); |
---|
1534 | 1569 | objectPanel.setIconAt(3, GetIcon("icons/XYZ.png")); |
---|
| 1570 | + objectPanel.setToolTipTextAt(3, "XYZ/RGB panel"); |
---|
1535 | 1571 | |
---|
1536 | 1572 | objectPanel.add(toolboxPanel); |
---|
1537 | 1573 | objectPanel.setIconAt(4, GetIcon("icons/primitives.png")); |
---|
| 1574 | + objectPanel.setToolTipTextAt(4, "Objects/backgrounds panel"); |
---|
1538 | 1575 | |
---|
1539 | 1576 | /* |
---|
1540 | 1577 | aConstraints.gridx = 0; |
---|
.. | .. |
---|
1674 | 1711 | frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); |
---|
1675 | 1712 | frame.addWindowListener(new WindowAdapter() |
---|
1676 | 1713 | { |
---|
1677 | | - |
---|
1678 | 1714 | public void windowClosing(WindowEvent e) |
---|
1679 | 1715 | { |
---|
1680 | 1716 | Close(); |
---|
.. | .. |
---|
1736 | 1772 | //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints); |
---|
1737 | 1773 | |
---|
1738 | 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); |
---|
1739 | 1786 | |
---|
1740 | 1787 | cGridBag color = new cGridBag(); |
---|
1741 | | - color.add(colorLabel = new JLabel("Color/hue")); // , aConstraints); |
---|
1742 | | - colorLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1743 | | - 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 | + |
---|
1744 | 1793 | //colorField.preferredWidth = 200; |
---|
1745 | 1794 | colorSection.add(color); |
---|
1746 | 1795 | |
---|
1747 | 1796 | cGridBag modulation = new cGridBag(); |
---|
1748 | 1797 | modulation.add(modulationLabel = new JLabel("Saturation")); // , aConstraints); |
---|
1749 | 1798 | modulationLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1750 | | - modulation.add(modulationField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
| 1799 | + modulation.add(modulationField = new cNumberSlider(this, 0.001, 1)); // , aConstraints); |
---|
1751 | 1800 | colorSection.add(modulation); |
---|
1752 | 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 | + |
---|
1753 | 1810 | cGridBag texture = new cGridBag(); |
---|
1754 | 1811 | texture.add(textureLabel = new JLabel("Texture")); // , aConstraints); |
---|
1755 | 1812 | textureLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1756 | 1813 | texture.add(textureField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
1757 | 1814 | colorSection.add(texture); |
---|
1758 | 1815 | |
---|
1759 | | - panel.add(new JSeparator()); |
---|
| 1816 | + panel.add(GetSeparator()); |
---|
1760 | 1817 | |
---|
1761 | 1818 | panel.add(colorSection); |
---|
1762 | 1819 | |
---|
.. | .. |
---|
1812 | 1869 | shadowbias.add(shadowbiasField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
1813 | 1870 | diffuseSection.add(shadowbias); |
---|
1814 | 1871 | |
---|
1815 | | - panel.add(new JSeparator()); |
---|
| 1872 | + panel.add(GetSeparator()); |
---|
1816 | 1873 | |
---|
1817 | 1874 | panel.add(diffuseSection); |
---|
1818 | 1875 | |
---|
.. | .. |
---|
1875 | 1932 | specularSection.add(anisoV); |
---|
1876 | 1933 | |
---|
1877 | 1934 | |
---|
1878 | | - panel.add(new JSeparator()); |
---|
| 1935 | + panel.add(GetSeparator()); |
---|
1879 | 1936 | |
---|
1880 | 1937 | panel.add(specularSection); |
---|
1881 | 1938 | |
---|
.. | .. |
---|
1900 | 1957 | backlitLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1901 | 1958 | backlit.add(backlitField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
1902 | 1959 | colorSection.add(backlit); |
---|
1903 | | - |
---|
1904 | | - cGridBag opacity = new cGridBag(); |
---|
1905 | | - opacity.add(opacityLabel = new JLabel("Opacity")); // , aConstraints); |
---|
1906 | | - opacityLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1907 | | - opacity.add(opacityField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
1908 | | - colorSection.add(opacity); |
---|
1909 | 1960 | |
---|
1910 | 1961 | //panel.add(new JSeparator()); |
---|
1911 | 1962 | |
---|
.. | .. |
---|
1951 | 2002 | opacityPower.add(opacityPowerField = new cNumberSlider(this, 0.0, 10 /*10 dec 2013*/)); // , aConstraints); |
---|
1952 | 2003 | textureSection.add(opacityPower); |
---|
1953 | 2004 | |
---|
1954 | | - panel.add(new JSeparator()); |
---|
| 2005 | + panel.add(GetSeparator()); |
---|
1955 | 2006 | |
---|
1956 | 2007 | panel.add(textureSection); |
---|
1957 | 2008 | |
---|
.. | .. |
---|
3250 | 3301 | { |
---|
3251 | 3302 | copy.live ^= true; |
---|
3252 | 3303 | return; |
---|
3253 | | - } else if (event.getSource() == selectCB) |
---|
| 3304 | + } else if (event.getSource() == selectableCB) |
---|
3254 | 3305 | { |
---|
3255 | 3306 | copy.dontselect ^= true; |
---|
3256 | 3307 | return; |
---|
.. | .. |
---|
3641 | 3692 | |
---|
3642 | 3693 | cRadio tab = GetCurrentTab(); |
---|
3643 | 3694 | |
---|
3644 | | - byte[] compress = CompressCopy(); |
---|
| 3695 | + byte[] compress = CompressCopy(); // Saved version. No need for "Replace". |
---|
3645 | 3696 | |
---|
3646 | 3697 | boolean thesame = false; |
---|
3647 | 3698 | |
---|
.. | .. |
---|
3708 | 3759 | |
---|
3709 | 3760 | copy.clear(); |
---|
3710 | 3761 | |
---|
| 3762 | + copy.skyboxname = obj.skyboxname; |
---|
| 3763 | + copy.skyboxext = obj.skyboxext; |
---|
| 3764 | + |
---|
3711 | 3765 | for (int i=0; i<obj.Size(); i++) |
---|
3712 | 3766 | { |
---|
3713 | 3767 | copy.add(obj.get(i)); |
---|
.. | .. |
---|
4768 | 4822 | readobj.ResetDisplayList(); |
---|
4769 | 4823 | } catch (Exception e) |
---|
4770 | 4824 | { |
---|
4771 | | - //e.printStackTrace(); |
---|
| 4825 | + if (!e.toString().contains("GZIP")) |
---|
| 4826 | + e.printStackTrace(); |
---|
| 4827 | + |
---|
4772 | 4828 | try |
---|
4773 | 4829 | { |
---|
4774 | 4830 | java.io.FileInputStream istream = new java.io.FileInputStream(fullname); |
---|
.. | .. |
---|
4848 | 4904 | { |
---|
4849 | 4905 | //readobj.deepCopySelf(copy); |
---|
4850 | 4906 | copy.clear(); // june 2014 |
---|
| 4907 | + copy.skyboxname = readobj.skyboxname; |
---|
| 4908 | + copy.skyboxext = readobj.skyboxext; |
---|
4851 | 4909 | for (int i = 0; i < readobj.size(); i++) |
---|
4852 | 4910 | { |
---|
4853 | 4911 | Object3D child = readobj.get(i); // reserve(i); |
---|
.. | .. |
---|
4888 | 4946 | } |
---|
4889 | 4947 | } catch (ClassCastException e) |
---|
4890 | 4948 | { |
---|
| 4949 | + e.printStackTrace(); |
---|
4891 | 4950 | assert (false); |
---|
4892 | 4951 | Composite c = (Composite) copy; |
---|
4893 | 4952 | c.children.clear(); |
---|
.. | .. |
---|
5018 | 5077 | //ps.print(buffer.toString()); |
---|
5019 | 5078 | } catch (IOException e) |
---|
5020 | 5079 | { |
---|
| 5080 | + e.printStackTrace(); |
---|
5021 | 5081 | } |
---|
5022 | 5082 | } |
---|
5023 | 5083 | |
---|