.. | .. |
---|
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 | { |
---|
.. | .. |
---|
270 | 298 | |
---|
271 | 299 | if (copy.versions == null) |
---|
272 | 300 | { |
---|
273 | | - copy.versions = new byte[100][]; |
---|
| 301 | + copy.versions = new Object3D[100]; |
---|
274 | 302 | copy.versionindex = -1; |
---|
275 | 303 | } |
---|
276 | 304 | |
---|
.. | .. |
---|
289 | 317 | |
---|
290 | 318 | if (copy.versions == null) |
---|
291 | 319 | { |
---|
292 | | - copy.versions = new byte[100][]; |
---|
| 320 | + copy.versions = new Object3D[100]; |
---|
293 | 321 | copy.versionindex = -1; |
---|
294 | 322 | } |
---|
295 | 323 | |
---|
.. | .. |
---|
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); |
---|
.. | .. |
---|
822 | 850 | frame.validate(); |
---|
823 | 851 | } |
---|
824 | 852 | |
---|
825 | | - private byte[] CompressCopy() |
---|
| 853 | + private Object3D CompressCopy() |
---|
826 | 854 | { |
---|
827 | 855 | boolean temp = CameraPane.SWITCH; |
---|
828 | 856 | CameraPane.SWITCH = false; |
---|
.. | .. |
---|
830 | 858 | copy.ExtractBigData(versiontable); |
---|
831 | 859 | // if (copy == client) |
---|
832 | 860 | |
---|
833 | | - byte[] versions[] = copy.versions; |
---|
| 861 | + Object3D versions[] = copy.versions; |
---|
834 | 862 | copy.versions = null; |
---|
835 | 863 | |
---|
836 | | - byte[] compress = Compress(copy); |
---|
| 864 | + //byte[] compress = Compress(copy); |
---|
| 865 | + Object3D compress = (Object3D)Grafreed.clone(copy); |
---|
837 | 866 | |
---|
838 | 867 | copy.versions = versions; |
---|
839 | 868 | |
---|
.. | .. |
---|
1195 | 1224 | markCB = AddCheckBox(setupPanel, "Mark", copy.marked); |
---|
1196 | 1225 | markCB.setToolTipText("As animation target transform"); |
---|
1197 | 1226 | |
---|
| 1227 | + ToolTipManager.sharedInstance().setLightWeightPopupEnabled(false); |
---|
| 1228 | + |
---|
1198 | 1229 | setupPanel2 = new cGridBag().setVertical(false); |
---|
1199 | 1230 | |
---|
1200 | 1231 | rewindCB = AddCheckBox(setupPanel2, "Rewind", copy.rewind); |
---|
.. | .. |
---|
1520 | 1551 | //tmp.setName("Edit"); |
---|
1521 | 1552 | objectPanel.add(materialPanel); |
---|
1522 | 1553 | objectPanel.setIconAt(0, GetIcon("icons/material.png")); |
---|
| 1554 | + objectPanel.setToolTipTextAt(0, "Material panel"); |
---|
| 1555 | + |
---|
1523 | 1556 | // JPanel north = new JPanel(new BorderLayout()); |
---|
1524 | 1557 | // north.setName("Edit"); |
---|
1525 | 1558 | // north.add(ctrlPanel, BorderLayout.NORTH); |
---|
1526 | 1559 | // objectPanel.add(north); |
---|
1527 | 1560 | objectPanel.add(editPanel); |
---|
1528 | 1561 | objectPanel.setIconAt(1, GetIcon("icons/write.png")); |
---|
| 1562 | + objectPanel.setToolTipTextAt(1, "Edit panel"); |
---|
1529 | 1563 | |
---|
1530 | 1564 | //if (Globals.ADVANCED) |
---|
1531 | 1565 | objectPanel.add(infoPanel); |
---|
1532 | 1566 | objectPanel.setIconAt(2, GetIcon("icons/info.png")); |
---|
| 1567 | + objectPanel.setToolTipTextAt(2, "Info panel"); |
---|
1533 | 1568 | |
---|
1534 | 1569 | objectPanel.add(XYZPanel); |
---|
1535 | 1570 | objectPanel.setIconAt(3, GetIcon("icons/XYZ.png")); |
---|
| 1571 | + objectPanel.setToolTipTextAt(3, "XYZ/RGB panel"); |
---|
1536 | 1572 | |
---|
1537 | 1573 | objectPanel.add(toolboxPanel); |
---|
1538 | 1574 | objectPanel.setIconAt(4, GetIcon("icons/primitives.png")); |
---|
| 1575 | + objectPanel.setToolTipTextAt(4, "Objects/backgrounds panel"); |
---|
1539 | 1576 | |
---|
1540 | 1577 | /* |
---|
1541 | 1578 | aConstraints.gridx = 0; |
---|
.. | .. |
---|
1632 | 1669 | /**/ |
---|
1633 | 1670 | |
---|
1634 | 1671 | bigThree = new cGridBag(); |
---|
1635 | | - bigThree.addComponent(centralPanel); |
---|
1636 | 1672 | bigThree.addComponent(scenePanel); |
---|
| 1673 | + bigThree.addComponent(centralPanel); |
---|
1637 | 1674 | //bigThree.addComponent(XYZPanel); |
---|
1638 | 1675 | |
---|
1639 | 1676 | // // SIDE EFFECT!!! |
---|
.. | .. |
---|
1675 | 1712 | frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); |
---|
1676 | 1713 | frame.addWindowListener(new WindowAdapter() |
---|
1677 | 1714 | { |
---|
1678 | | - |
---|
1679 | 1715 | public void windowClosing(WindowEvent e) |
---|
1680 | 1716 | { |
---|
1681 | 1717 | Close(); |
---|
.. | .. |
---|
1737 | 1773 | //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints); |
---|
1738 | 1774 | |
---|
1739 | 1775 | cGridBag colorSection = new cGridBag().setVertical(true); |
---|
| 1776 | + |
---|
| 1777 | + cGridBag huepanel = new cGridBag(); |
---|
| 1778 | + cGridBag huelabel = new cGridBag(); |
---|
| 1779 | + huelabel.add(GetLabel("icons/hue.png", false)); |
---|
| 1780 | + huelabel.preferredWidth = 20; |
---|
| 1781 | + huepanel.add(new cGridBag()); // Label |
---|
| 1782 | + huepanel.add(huelabel); // Field/slider |
---|
| 1783 | + |
---|
| 1784 | + huepanel.preferredHeight = 7; |
---|
| 1785 | + |
---|
| 1786 | + colorSection.add(huepanel); |
---|
1740 | 1787 | |
---|
1741 | 1788 | cGridBag color = new cGridBag(); |
---|
1742 | | - color.add(colorLabel = new JLabel("Color/hue")); // , aConstraints); |
---|
1743 | | - colorLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1744 | | - color.add(colorField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
| 1789 | + |
---|
| 1790 | + color.add(colorLabel = new JLabel("Color/hue")); // , aConstraints); |
---|
| 1791 | + colorLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 1792 | + color.add(colorField = new cNumberSlider(this, 0.001, 1)); // , aConstraints); |
---|
| 1793 | + |
---|
1745 | 1794 | //colorField.preferredWidth = 200; |
---|
1746 | 1795 | colorSection.add(color); |
---|
1747 | 1796 | |
---|
1748 | 1797 | cGridBag modulation = new cGridBag(); |
---|
1749 | 1798 | modulation.add(modulationLabel = new JLabel("Saturation")); // , aConstraints); |
---|
1750 | 1799 | modulationLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1751 | | - modulation.add(modulationField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
| 1800 | + modulation.add(modulationField = new cNumberSlider(this, 0.001, 1)); // , aConstraints); |
---|
1752 | 1801 | colorSection.add(modulation); |
---|
1753 | 1802 | |
---|
| 1803 | + cGridBag opacity = new cGridBag(); |
---|
| 1804 | + opacity.add(opacityLabel = new JLabel("Opacity")); // , aConstraints); |
---|
| 1805 | + opacityLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 1806 | + opacity.add(opacityField = new cNumberSlider(this, 0.001, 1)); // , aConstraints); |
---|
| 1807 | + colorSection.add(opacity); |
---|
| 1808 | + |
---|
| 1809 | + colorSection.add(GetSeparator()); |
---|
| 1810 | + |
---|
1754 | 1811 | cGridBag texture = new cGridBag(); |
---|
1755 | 1812 | texture.add(textureLabel = new JLabel("Texture")); // , aConstraints); |
---|
1756 | 1813 | textureLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1757 | 1814 | texture.add(textureField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
1758 | 1815 | colorSection.add(texture); |
---|
1759 | 1816 | |
---|
1760 | | - panel.add(new JSeparator()); |
---|
| 1817 | + panel.add(GetSeparator()); |
---|
1761 | 1818 | |
---|
1762 | 1819 | panel.add(colorSection); |
---|
1763 | 1820 | |
---|
.. | .. |
---|
1813 | 1870 | shadowbias.add(shadowbiasField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
1814 | 1871 | diffuseSection.add(shadowbias); |
---|
1815 | 1872 | |
---|
1816 | | - panel.add(new JSeparator()); |
---|
| 1873 | + panel.add(GetSeparator()); |
---|
1817 | 1874 | |
---|
1818 | 1875 | panel.add(diffuseSection); |
---|
1819 | 1876 | |
---|
.. | .. |
---|
1876 | 1933 | specularSection.add(anisoV); |
---|
1877 | 1934 | |
---|
1878 | 1935 | |
---|
1879 | | - panel.add(new JSeparator()); |
---|
| 1936 | + panel.add(GetSeparator()); |
---|
1880 | 1937 | |
---|
1881 | 1938 | panel.add(specularSection); |
---|
1882 | 1939 | |
---|
.. | .. |
---|
1901 | 1958 | backlitLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1902 | 1959 | backlit.add(backlitField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
1903 | 1960 | colorSection.add(backlit); |
---|
1904 | | - |
---|
1905 | | - cGridBag opacity = new cGridBag(); |
---|
1906 | | - opacity.add(opacityLabel = new JLabel("Opacity")); // , aConstraints); |
---|
1907 | | - opacityLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1908 | | - opacity.add(opacityField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
1909 | | - colorSection.add(opacity); |
---|
1910 | 1961 | |
---|
1911 | 1962 | //panel.add(new JSeparator()); |
---|
1912 | 1963 | |
---|
.. | .. |
---|
1952 | 2003 | opacityPower.add(opacityPowerField = new cNumberSlider(this, 0.0, 10 /*10 dec 2013*/)); // , aConstraints); |
---|
1953 | 2004 | textureSection.add(opacityPower); |
---|
1954 | 2005 | |
---|
1955 | | - panel.add(new JSeparator()); |
---|
| 2006 | + panel.add(GetSeparator()); |
---|
1956 | 2007 | |
---|
1957 | 2008 | panel.add(textureSection); |
---|
1958 | 2009 | |
---|
.. | .. |
---|
3515 | 3566 | |
---|
3516 | 3567 | static public byte[] Compress(Object3D o) |
---|
3517 | 3568 | { |
---|
| 3569 | + // Slower to actually compress. |
---|
3518 | 3570 | try |
---|
3519 | 3571 | { |
---|
3520 | 3572 | ByteArrayOutputStream baos = new ByteArrayOutputStream(); |
---|
.. | .. |
---|
3642 | 3694 | |
---|
3643 | 3695 | cRadio tab = GetCurrentTab(); |
---|
3644 | 3696 | |
---|
3645 | | - byte[] compress = CompressCopy(); |
---|
| 3697 | + Object3D compress = CompressCopy(); // Saved version. No need for "Replace". |
---|
3646 | 3698 | |
---|
3647 | 3699 | boolean thesame = false; |
---|
3648 | 3700 | |
---|
3649 | | - // Quick heuristic using length. Works only when stream is compressed. |
---|
3650 | | - if (copy.versionindex > 0 && copy.versions[copy.versionindex-1] != null && Equal(compress, copy.versions[copy.versionindex-1])) |
---|
3651 | | - { |
---|
3652 | | - thesame = true; |
---|
3653 | | - } |
---|
| 3701 | +// if (copy.versionindex > 0 && copy.versions[copy.versionindex-1] != null && Equal(compress, copy.versions[copy.versionindex-1])) |
---|
| 3702 | +// { |
---|
| 3703 | +// thesame = true; |
---|
| 3704 | +// } |
---|
3654 | 3705 | |
---|
3655 | 3706 | //EditorFrame.m_MainFrame.requestFocusInWindow(); |
---|
3656 | 3707 | if (!thesame) |
---|
.. | .. |
---|
3709 | 3760 | |
---|
3710 | 3761 | copy.clear(); |
---|
3711 | 3762 | |
---|
| 3763 | + copy.skyboxname = obj.skyboxname; |
---|
| 3764 | + copy.skyboxext = obj.skyboxext; |
---|
| 3765 | + |
---|
3712 | 3766 | for (int i=0; i<obj.Size(); i++) |
---|
3713 | 3767 | { |
---|
3714 | 3768 | copy.add(obj.get(i)); |
---|
.. | .. |
---|
3807 | 3861 | |
---|
3808 | 3862 | copy.versionindex -= 1; |
---|
3809 | 3863 | |
---|
3810 | | - CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex])); |
---|
| 3864 | + CopyChanged((Object3D)copy.versions[copy.versionindex]); |
---|
3811 | 3865 | |
---|
3812 | 3866 | return true; |
---|
3813 | 3867 | } |
---|
.. | .. |
---|
3824 | 3878 | return false; |
---|
3825 | 3879 | } |
---|
3826 | 3880 | |
---|
3827 | | - CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex])); |
---|
| 3881 | + //CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex])); |
---|
| 3882 | + CopyChanged(copy.versions[copy.versionindex]); |
---|
3828 | 3883 | |
---|
3829 | 3884 | return true; |
---|
3830 | 3885 | } |
---|
.. | .. |
---|
3861 | 3916 | |
---|
3862 | 3917 | copy.versionindex += 1; |
---|
3863 | 3918 | |
---|
3864 | | - CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex])); |
---|
| 3919 | + CopyChanged(copy.versions[copy.versionindex]); |
---|
3865 | 3920 | |
---|
3866 | 3921 | //if (!tab.user[tab.versionindex]) |
---|
3867 | 3922 | // tab.graphs[tab.versionindex] = null; |
---|
.. | .. |
---|
4174 | 4229 | |
---|
4175 | 4230 | if (copy.versions[version] != null) |
---|
4176 | 4231 | { |
---|
4177 | | - CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex = version])); |
---|
| 4232 | + CopyChanged(copy.versions[copy.versionindex = version]); |
---|
4178 | 4233 | } |
---|
4179 | 4234 | |
---|
4180 | 4235 | return; |
---|
.. | .. |
---|
4851 | 4906 | { |
---|
4852 | 4907 | //readobj.deepCopySelf(copy); |
---|
4853 | 4908 | copy.clear(); // june 2014 |
---|
| 4909 | + copy.skyboxname = readobj.skyboxname; |
---|
| 4910 | + copy.skyboxext = readobj.skyboxext; |
---|
4854 | 4911 | for (int i = 0; i < readobj.size(); i++) |
---|
4855 | 4912 | { |
---|
4856 | 4913 | Object3D child = readobj.get(i); // reserve(i); |
---|
.. | .. |
---|
4907 | 4964 | |
---|
4908 | 4965 | if (copy.versions == null) |
---|
4909 | 4966 | { |
---|
4910 | | - copy.versions = new byte[100][]; |
---|
| 4967 | + copy.versions = new Object3D[100]; |
---|
4911 | 4968 | copy.versionindex = -1; |
---|
4912 | 4969 | } |
---|
4913 | 4970 | |
---|