.. | .. |
---|
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 | { |
---|
.. | .. |
---|
268 | 296 | client = inClient; |
---|
269 | 297 | copy = client; |
---|
270 | 298 | |
---|
271 | | - if (copy.versions == null) |
---|
| 299 | + if (copy.versionlist == null) |
---|
272 | 300 | { |
---|
273 | | - copy.versions = new byte[100][]; |
---|
| 301 | + copy.versionlist = new Object3D[100]; |
---|
274 | 302 | copy.versionindex = -1; |
---|
275 | 303 | } |
---|
276 | 304 | |
---|
.. | .. |
---|
287 | 315 | client = inClient; |
---|
288 | 316 | copy = client; |
---|
289 | 317 | |
---|
290 | | - if (copy.versions == null) |
---|
| 318 | + if (copy.versionlist == null) |
---|
291 | 319 | { |
---|
292 | | - copy.versions = new byte[100][]; |
---|
| 320 | + copy.versionlist = new Object3D[100]; |
---|
293 | 321 | copy.versionindex = -1; |
---|
294 | 322 | } |
---|
295 | 323 | |
---|
.. | .. |
---|
325 | 353 | copy = localCopy; |
---|
326 | 354 | copy.editWindow = this; |
---|
327 | 355 | |
---|
328 | | - if (copy.versions == null) |
---|
| 356 | + if (copy.versionlist == 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 | | - materialPanel = new cGridBag().setVertical(true); |
---|
| 470 | + materialPanel = new cGridBag().setVertical(false); |
---|
443 | 471 | //materialPanel.setName("Material"); |
---|
444 | 472 | |
---|
445 | 473 | /*JTextPane*/ |
---|
.. | .. |
---|
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; |
---|
834 | | - copy.versions = null; |
---|
| 861 | + Object3D versions[] = copy.versionlist; |
---|
| 862 | + copy.versionlist = null; |
---|
835 | 863 | |
---|
836 | | - byte[] compress = Compress(copy); |
---|
| 864 | + //byte[] compress = Compress(copy); |
---|
| 865 | + Object3D compress = (Object3D)Grafreed.clone(copy); |
---|
837 | 866 | |
---|
838 | | - copy.versions = versions; |
---|
| 867 | + copy.versionlist = versions; |
---|
839 | 868 | |
---|
840 | 869 | copy.RestoreBigData(versiontable); |
---|
841 | 870 | |
---|
.. | .. |
---|
965 | 994 | { |
---|
966 | 995 | SetupMaterial(materialPanel); |
---|
967 | 996 | } |
---|
| 997 | + |
---|
968 | 998 | //SetupName(); |
---|
969 | 999 | //SetupViews(); |
---|
970 | 1000 | } |
---|
.. | .. |
---|
974 | 1004 | // NumberSlider vDivsField; |
---|
975 | 1005 | // JCheckBox endcaps; |
---|
976 | 1006 | JCheckBox liveCB; |
---|
977 | | - JCheckBox selectCB; |
---|
| 1007 | + JCheckBox selectableCB; |
---|
978 | 1008 | JCheckBox hideCB; |
---|
979 | 1009 | JCheckBox link2masterCB; |
---|
980 | 1010 | JCheckBox markCB; |
---|
.. | .. |
---|
1186 | 1216 | |
---|
1187 | 1217 | liveCB = AddCheckBox(setupPanel, "Live", copy.live); |
---|
1188 | 1218 | liveCB.setToolTipText("Animate object"); |
---|
1189 | | - selectCB = AddCheckBox(setupPanel, "Select", !copy.dontselect); |
---|
1190 | | - selectCB.setToolTipText("Make object selectable"); |
---|
| 1219 | + selectableCB = AddCheckBox(setupPanel, "Select", !copy.dontselect); |
---|
| 1220 | + selectableCB.setToolTipText("Make object selectable"); |
---|
1191 | 1221 | // Return(); |
---|
| 1222 | + |
---|
1192 | 1223 | hideCB = AddCheckBox(setupPanel, "Hide", copy.hide); |
---|
1193 | 1224 | hideCB.setToolTipText("Hide object"); |
---|
1194 | 1225 | markCB = AddCheckBox(setupPanel, "Mark", copy.marked); |
---|
1195 | 1226 | markCB.setToolTipText("As animation target transform"); |
---|
| 1227 | + |
---|
| 1228 | + ToolTipManager.sharedInstance().setLightWeightPopupEnabled(false); |
---|
1196 | 1229 | |
---|
1197 | 1230 | setupPanel2 = new cGridBag().setVertical(false); |
---|
1198 | 1231 | |
---|
.. | .. |
---|
1519 | 1552 | //tmp.setName("Edit"); |
---|
1520 | 1553 | objectPanel.add(materialPanel); |
---|
1521 | 1554 | objectPanel.setIconAt(0, GetIcon("icons/material.png")); |
---|
| 1555 | + objectPanel.setToolTipTextAt(0, "Material"); |
---|
| 1556 | + |
---|
1522 | 1557 | // JPanel north = new JPanel(new BorderLayout()); |
---|
1523 | 1558 | // north.setName("Edit"); |
---|
1524 | 1559 | // north.add(ctrlPanel, BorderLayout.NORTH); |
---|
1525 | 1560 | // objectPanel.add(north); |
---|
1526 | 1561 | objectPanel.add(editPanel); |
---|
1527 | 1562 | objectPanel.setIconAt(1, GetIcon("icons/write.png")); |
---|
| 1563 | + objectPanel.setToolTipTextAt(1, "Edit controls"); |
---|
1528 | 1564 | |
---|
1529 | 1565 | //if (Globals.ADVANCED) |
---|
1530 | 1566 | objectPanel.add(infoPanel); |
---|
1531 | 1567 | objectPanel.setIconAt(2, GetIcon("icons/info.png")); |
---|
| 1568 | + objectPanel.setToolTipTextAt(2, "Information"); |
---|
1532 | 1569 | |
---|
1533 | 1570 | objectPanel.add(XYZPanel); |
---|
1534 | 1571 | objectPanel.setIconAt(3, GetIcon("icons/XYZ.png")); |
---|
| 1572 | + objectPanel.setToolTipTextAt(3, "XYZ/RGB transform"); |
---|
1535 | 1573 | |
---|
1536 | 1574 | objectPanel.add(toolboxPanel); |
---|
1537 | 1575 | objectPanel.setIconAt(4, GetIcon("icons/primitives.png")); |
---|
| 1576 | + objectPanel.setToolTipTextAt(4, "Objects & backgrounds"); |
---|
1538 | 1577 | |
---|
1539 | 1578 | /* |
---|
1540 | 1579 | aConstraints.gridx = 0; |
---|
.. | .. |
---|
1674 | 1713 | frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); |
---|
1675 | 1714 | frame.addWindowListener(new WindowAdapter() |
---|
1676 | 1715 | { |
---|
1677 | | - |
---|
1678 | 1716 | public void windowClosing(WindowEvent e) |
---|
1679 | 1717 | { |
---|
1680 | 1718 | Close(); |
---|
.. | .. |
---|
1697 | 1735 | ctrlPanel.removeAll(); |
---|
1698 | 1736 | } |
---|
1699 | 1737 | |
---|
1700 | | - void SetupMaterial(cGridBag panel) |
---|
| 1738 | + void SetupMaterial(cGridBag materialpanel) |
---|
1701 | 1739 | { |
---|
1702 | | - /* |
---|
| 1740 | + cGridBag presetpanel = new cGridBag().setVertical(true); |
---|
| 1741 | + cLabel label = GetLabel("icons/shadericons/shadericon00000.png", !Grafreed.NIMBUSLAF); |
---|
| 1742 | + label.addMouseListener(new MouseAdapter() |
---|
| 1743 | + { |
---|
| 1744 | + public void mouseClicked(MouseEvent e) |
---|
| 1745 | + { |
---|
| 1746 | + colorField.setFloat(0); |
---|
| 1747 | + saturationField.setFloat(1); |
---|
| 1748 | + materialtouched = true; |
---|
| 1749 | + applySelf(); |
---|
| 1750 | + } |
---|
| 1751 | + }); |
---|
| 1752 | + presetpanel.add(label); |
---|
| 1753 | + |
---|
| 1754 | + presetpanel.add(GetLabel("icons/shadericons/shadericon00001.png", !Grafreed.NIMBUSLAF)); |
---|
| 1755 | + presetpanel.add(GetLabel("icons/shadericons/shadericon00002.png", !Grafreed.NIMBUSLAF)); |
---|
| 1756 | + presetpanel.add(GetLabel("icons/shadericons/shadericon00003.png", !Grafreed.NIMBUSLAF)); |
---|
| 1757 | + presetpanel.add(GetLabel("icons/shadericons/shadericon00004.png", !Grafreed.NIMBUSLAF)); |
---|
| 1758 | + presetpanel.add(GetLabel("icons/shadericons/shadericon00005.png", !Grafreed.NIMBUSLAF)); |
---|
| 1759 | + presetpanel.add(GetLabel("icons/shadericons/shadericon00006.png", !Grafreed.NIMBUSLAF)); |
---|
| 1760 | + presetpanel.add(GetLabel("icons/shadericons/shadericon00007.png", !Grafreed.NIMBUSLAF)); |
---|
| 1761 | + presetpanel.add(GetLabel("icons/shadericons/shadericon00008.png", !Grafreed.NIMBUSLAF)); |
---|
| 1762 | + presetpanel.add(GetLabel("icons/shadericons/shadericon00009.png", !Grafreed.NIMBUSLAF)); |
---|
| 1763 | + presetpanel.add(GetLabel("icons/shadericons/shadericon00010.png", !Grafreed.NIMBUSLAF)); |
---|
| 1764 | + presetpanel.add(GetLabel("icons/shadericons/shadericon00011.png", !Grafreed.NIMBUSLAF)); |
---|
| 1765 | + presetpanel.add(GetLabel("icons/shadericons/shadericon00012.png", !Grafreed.NIMBUSLAF)); |
---|
| 1766 | + presetpanel.add(GetLabel("icons/shadericons/shadericon00013.png", !Grafreed.NIMBUSLAF)); |
---|
| 1767 | + presetpanel.add(GetLabel("icons/shadericons/shadericon00014.png", !Grafreed.NIMBUSLAF)); |
---|
| 1768 | + presetpanel.add(GetLabel("icons/shadericons/shadericon00015.png", !Grafreed.NIMBUSLAF)); |
---|
| 1769 | + presetpanel.add(GetLabel("icons/shadericons/shadericon00016.png", !Grafreed.NIMBUSLAF)); |
---|
| 1770 | + presetpanel.add(GetLabel("icons/shadericons/shadericon00017.png", !Grafreed.NIMBUSLAF)); |
---|
| 1771 | + presetpanel.add(GetLabel("icons/shadericons/shadericon00018.png", !Grafreed.NIMBUSLAF)); |
---|
| 1772 | + presetpanel.add(GetLabel("icons/shadericons/shadericon00019.png", !Grafreed.NIMBUSLAF)); |
---|
| 1773 | + presetpanel.add(GetLabel("icons/shadericons/shadericon00020.png", !Grafreed.NIMBUSLAF)); |
---|
| 1774 | + |
---|
| 1775 | + cGridBag panel = new cGridBag().setVertical(true); |
---|
| 1776 | + |
---|
| 1777 | + presetpanel.preferredWidth = 1; |
---|
| 1778 | + |
---|
| 1779 | + materialpanel.add(panel); |
---|
| 1780 | + materialpanel.add(presetpanel); |
---|
| 1781 | + |
---|
| 1782 | + panel.preferredWidth = 8; |
---|
| 1783 | + |
---|
| 1784 | + /* |
---|
1703 | 1785 | ctrlPanel.add(materialLabel = new JLabel("MATERIAL : "), aConstraints); |
---|
1704 | 1786 | materialLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1705 | | - */ |
---|
| 1787 | + */ |
---|
1706 | 1788 | |
---|
1707 | 1789 | cGridBag editBar = new cGridBag().setVertical(false); |
---|
1708 | 1790 | |
---|
.. | .. |
---|
1736 | 1818 | //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints); |
---|
1737 | 1819 | |
---|
1738 | 1820 | cGridBag colorSection = new cGridBag().setVertical(true); |
---|
| 1821 | + |
---|
| 1822 | + cGridBag huepanel = new cGridBag(); |
---|
| 1823 | + cGridBag huelabel = new cGridBag(); |
---|
| 1824 | + label = GetLabel("icons/hue.png", false); |
---|
| 1825 | + label.fit = true; |
---|
| 1826 | + huelabel.add(label); |
---|
| 1827 | + huelabel.preferredWidth = 20; |
---|
| 1828 | + huepanel.add(new cGridBag()); // Label |
---|
| 1829 | + huepanel.add(huelabel); // Field/slider |
---|
| 1830 | + |
---|
| 1831 | + huepanel.preferredHeight = 7; |
---|
| 1832 | + |
---|
| 1833 | + colorSection.add(huepanel); |
---|
1739 | 1834 | |
---|
1740 | 1835 | 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); |
---|
| 1836 | + |
---|
| 1837 | + color.add(colorLabel = new JLabel("Color/hue")); // , aConstraints); |
---|
| 1838 | + colorLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 1839 | + color.add(colorField = new cNumberSlider(this, 0.001, 1)); // , aConstraints); |
---|
| 1840 | + |
---|
1744 | 1841 | //colorField.preferredWidth = 200; |
---|
1745 | 1842 | colorSection.add(color); |
---|
1746 | 1843 | |
---|
1747 | 1844 | cGridBag modulation = new cGridBag(); |
---|
1748 | 1845 | modulation.add(modulationLabel = new JLabel("Saturation")); // , aConstraints); |
---|
1749 | 1846 | modulationLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1750 | | - modulation.add(modulationField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
| 1847 | + modulation.add(saturationField = new cNumberSlider(this, 0.001, 1)); // , aConstraints); |
---|
1751 | 1848 | colorSection.add(modulation); |
---|
1752 | 1849 | |
---|
| 1850 | + cGridBag opacity = new cGridBag(); |
---|
| 1851 | + opacity.add(opacityLabel = new JLabel("Opacity")); // , aConstraints); |
---|
| 1852 | + opacityLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 1853 | + opacity.add(opacityField = new cNumberSlider(this, 0.001, 1)); // , aConstraints); |
---|
| 1854 | + colorSection.add(opacity); |
---|
| 1855 | + |
---|
| 1856 | + colorSection.add(GetSeparator()); |
---|
| 1857 | + |
---|
1753 | 1858 | cGridBag texture = new cGridBag(); |
---|
1754 | 1859 | texture.add(textureLabel = new JLabel("Texture")); // , aConstraints); |
---|
1755 | 1860 | textureLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1756 | 1861 | texture.add(textureField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
1757 | 1862 | colorSection.add(texture); |
---|
1758 | 1863 | |
---|
1759 | | - panel.add(new JSeparator()); |
---|
| 1864 | + panel.add(GetSeparator()); |
---|
1760 | 1865 | |
---|
1761 | 1866 | panel.add(colorSection); |
---|
1762 | 1867 | |
---|
.. | .. |
---|
1812 | 1917 | shadowbias.add(shadowbiasField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
1813 | 1918 | diffuseSection.add(shadowbias); |
---|
1814 | 1919 | |
---|
1815 | | - panel.add(new JSeparator()); |
---|
| 1920 | + panel.add(GetSeparator()); |
---|
1816 | 1921 | |
---|
1817 | 1922 | panel.add(diffuseSection); |
---|
1818 | 1923 | |
---|
.. | .. |
---|
1875 | 1980 | specularSection.add(anisoV); |
---|
1876 | 1981 | |
---|
1877 | 1982 | |
---|
1878 | | - panel.add(new JSeparator()); |
---|
| 1983 | + panel.add(GetSeparator()); |
---|
1879 | 1984 | |
---|
1880 | 1985 | panel.add(specularSection); |
---|
1881 | 1986 | |
---|
.. | .. |
---|
1900 | 2005 | backlitLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1901 | 2006 | backlit.add(backlitField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
1902 | 2007 | 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 | 2008 | |
---|
1910 | 2009 | //panel.add(new JSeparator()); |
---|
1911 | 2010 | |
---|
.. | .. |
---|
1951 | 2050 | opacityPower.add(opacityPowerField = new cNumberSlider(this, 0.0, 10 /*10 dec 2013*/)); // , aConstraints); |
---|
1952 | 2051 | textureSection.add(opacityPower); |
---|
1953 | 2052 | |
---|
1954 | | - panel.add(new JSeparator()); |
---|
| 2053 | + panel.add(GetSeparator()); |
---|
1955 | 2054 | |
---|
1956 | 2055 | panel.add(textureSection); |
---|
1957 | 2056 | |
---|
.. | .. |
---|
2938 | 3037 | |
---|
2939 | 3038 | freezematerial = true; |
---|
2940 | 3039 | colorField.setFloat(mat.color); |
---|
2941 | | - modulationField.setFloat(mat.modulation); |
---|
| 3040 | + saturationField.setFloat(mat.modulation); |
---|
2942 | 3041 | metalnessField.setFloat(mat.metalness); |
---|
2943 | 3042 | diffuseField.setFloat(mat.diffuse); |
---|
2944 | 3043 | specularField.setFloat(mat.specular); |
---|
.. | .. |
---|
3249 | 3348 | } else if (event.getSource() == liveCB) |
---|
3250 | 3349 | { |
---|
3251 | 3350 | copy.live ^= true; |
---|
| 3351 | + objEditor.refreshContents(true); // To show item colors |
---|
3252 | 3352 | return; |
---|
3253 | | - } else if (event.getSource() == selectCB) |
---|
| 3353 | + } else if (event.getSource() == selectableCB) |
---|
3254 | 3354 | { |
---|
3255 | 3355 | copy.dontselect ^= true; |
---|
3256 | 3356 | return; |
---|
.. | .. |
---|
3258 | 3358 | { |
---|
3259 | 3359 | copy.hide ^= true; |
---|
3260 | 3360 | copy.Touch(); // display list issue |
---|
3261 | | - objEditor.refreshContents(); |
---|
| 3361 | + objEditor.refreshContents(true); // To show item colors |
---|
3262 | 3362 | return; |
---|
3263 | 3363 | } else if (event.getSource() == link2masterCB) |
---|
3264 | 3364 | { |
---|
.. | .. |
---|
3514 | 3614 | |
---|
3515 | 3615 | static public byte[] Compress(Object3D o) |
---|
3516 | 3616 | { |
---|
| 3617 | + // Slower to actually compress. |
---|
3517 | 3618 | try |
---|
3518 | 3619 | { |
---|
3519 | 3620 | ByteArrayOutputStream baos = new ByteArrayOutputStream(); |
---|
.. | .. |
---|
3615 | 3716 | { |
---|
3616 | 3717 | //Save(true); |
---|
3617 | 3718 | Replace(); |
---|
| 3719 | + SetUndoStates(); |
---|
3618 | 3720 | } |
---|
3619 | 3721 | |
---|
3620 | 3722 | private boolean Equal(byte[] compress, byte[] name) |
---|
.. | .. |
---|
3638 | 3740 | public boolean Save(boolean user) |
---|
3639 | 3741 | { |
---|
3640 | 3742 | System.err.println("Save"); |
---|
| 3743 | + Replace(); |
---|
3641 | 3744 | |
---|
3642 | 3745 | cRadio tab = GetCurrentTab(); |
---|
3643 | 3746 | |
---|
3644 | | - byte[] compress = CompressCopy(); |
---|
| 3747 | + Object3D compress = CompressCopy(); // Saved version. No need for "Replace". |
---|
3645 | 3748 | |
---|
3646 | 3749 | boolean thesame = false; |
---|
3647 | 3750 | |
---|
3648 | | - // Quick heuristic using length. Works only when stream is compressed. |
---|
3649 | | - if (copy.versionindex > 0 && copy.versions[copy.versionindex-1] != null && Equal(compress, copy.versions[copy.versionindex-1])) |
---|
3650 | | - { |
---|
3651 | | - thesame = true; |
---|
3652 | | - } |
---|
| 3751 | +// if (copy.versionindex > 0 && copy.versions[copy.versionindex-1] != null && Equal(compress, copy.versions[copy.versionindex-1])) |
---|
| 3752 | +// { |
---|
| 3753 | +// thesame = true; |
---|
| 3754 | +// } |
---|
3653 | 3755 | |
---|
3654 | 3756 | //EditorFrame.m_MainFrame.requestFocusInWindow(); |
---|
3655 | 3757 | if (!thesame) |
---|
.. | .. |
---|
3657 | 3759 | //tab.user[tab.versionindex] = user; |
---|
3658 | 3760 | //boolean increment = true; // tab.graphs[tab.versionindex] == null; |
---|
3659 | 3761 | |
---|
3660 | | - copy.versions[++copy.versionindex] = compress; |
---|
| 3762 | + copy.versionlist[++copy.versionindex] = compress; |
---|
3661 | 3763 | |
---|
3662 | 3764 | // if (increment) |
---|
3663 | 3765 | // tab.versionindex++; |
---|
.. | .. |
---|
3667 | 3769 | |
---|
3668 | 3770 | //assert(hashtable.isEmpty()); |
---|
3669 | 3771 | |
---|
3670 | | - for (int i = copy.versionindex+1; i < copy.versions.length; i++) |
---|
| 3772 | + for (int i = copy.versionindex+1; i < copy.versionlist.length; i++) |
---|
3671 | 3773 | { |
---|
3672 | 3774 | //tab.user[i] = false; |
---|
3673 | | - copy.versions[i] = null; |
---|
| 3775 | + copy.versionlist[i] = null; |
---|
3674 | 3776 | } |
---|
3675 | 3777 | |
---|
3676 | 3778 | SetUndoStates(); |
---|
.. | .. |
---|
3696 | 3798 | |
---|
3697 | 3799 | return !thesame; |
---|
3698 | 3800 | } |
---|
| 3801 | + |
---|
| 3802 | + boolean flashIt = true; |
---|
| 3803 | + |
---|
| 3804 | + void RefreshSelection() |
---|
| 3805 | + { |
---|
| 3806 | + Object3D selection = new Object3D(); |
---|
| 3807 | + |
---|
| 3808 | + for (int i = 0; i < copy.selection.size(); i++) |
---|
| 3809 | + { |
---|
| 3810 | + Object3D elem = copy.selection.elementAt(i); |
---|
| 3811 | + |
---|
| 3812 | + Object3D obj = copy.GetObject(elem.GetUUID()); |
---|
| 3813 | + |
---|
| 3814 | + if (obj == null) |
---|
| 3815 | + { |
---|
| 3816 | + copy.selection.remove(i--); |
---|
| 3817 | + } |
---|
| 3818 | + else |
---|
| 3819 | + { |
---|
| 3820 | + selection.add(obj); |
---|
| 3821 | + copy.selection.setElementAt(obj, i); |
---|
| 3822 | + } |
---|
| 3823 | + } |
---|
| 3824 | + |
---|
| 3825 | + flashIt = false; |
---|
| 3826 | + GetTree().clearSelection(); |
---|
| 3827 | + for (int i = 0; i < selection.size(); i++) |
---|
| 3828 | + GetTree().addSelectionPath(selection.elementAt(i).GetTreePath().GetTreePath()); |
---|
| 3829 | + flashIt = true; |
---|
| 3830 | + |
---|
| 3831 | + refreshContents(false); |
---|
| 3832 | + } |
---|
3699 | 3833 | |
---|
3700 | 3834 | void CopyChanged(Object3D obj) |
---|
3701 | 3835 | { |
---|
.. | .. |
---|
3708 | 3842 | |
---|
3709 | 3843 | copy.clear(); |
---|
3710 | 3844 | |
---|
| 3845 | + copy.skyboxname = obj.skyboxname; |
---|
| 3846 | + copy.skyboxext = obj.skyboxext; |
---|
| 3847 | + |
---|
3711 | 3848 | for (int i=0; i<obj.Size(); i++) |
---|
3712 | 3849 | { |
---|
3713 | 3850 | copy.add(obj.get(i)); |
---|
.. | .. |
---|
3717 | 3854 | |
---|
3718 | 3855 | CameraPane.SWITCH = temp; |
---|
3719 | 3856 | |
---|
| 3857 | + RefreshSelection(); |
---|
3720 | 3858 | //assert(hashtable.isEmpty()); |
---|
3721 | 3859 | |
---|
3722 | 3860 | copy.Touch(); |
---|
.. | .. |
---|
3751 | 3889 | { |
---|
3752 | 3890 | int count = 0; |
---|
3753 | 3891 | |
---|
3754 | | - for (int i = copy.versions.length; --i >= 0;) |
---|
| 3892 | + for (int i = copy.versionlist.length; --i >= 0;) |
---|
3755 | 3893 | { |
---|
3756 | | - if (copy.versions[i] != null) |
---|
| 3894 | + if (copy.versionlist[i] != null) |
---|
3757 | 3895 | count++; |
---|
3758 | 3896 | } |
---|
3759 | 3897 | |
---|
.. | .. |
---|
3768 | 3906 | replaceButton.setEnabled(copy.versionindex != -1); |
---|
3769 | 3907 | |
---|
3770 | 3908 | undoButton.setEnabled(copy.versionindex > 0); |
---|
3771 | | - redoButton.setEnabled(copy.versions[copy.versionindex + 1] != null); |
---|
| 3909 | + redoButton.setEnabled(copy.versionlist[copy.versionindex + 1] != null); |
---|
3772 | 3910 | |
---|
3773 | 3911 | muteSlider = true; |
---|
3774 | 3912 | versionSlider.setMaximum(VersionCount() - 1); |
---|
.. | .. |
---|
3806 | 3944 | |
---|
3807 | 3945 | copy.versionindex -= 1; |
---|
3808 | 3946 | |
---|
3809 | | - CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex])); |
---|
| 3947 | + CopyChanged((Object3D)copy.versionlist[copy.versionindex]); |
---|
3810 | 3948 | |
---|
3811 | 3949 | return true; |
---|
3812 | 3950 | } |
---|
.. | .. |
---|
3817 | 3955 | |
---|
3818 | 3956 | cRadio tab = GetCurrentTab(); |
---|
3819 | 3957 | |
---|
3820 | | - if (copy.versionindex == -1 || copy.versions[copy.versionindex] == null) |
---|
| 3958 | + if (copy.versionindex == -1 || copy.versionlist[copy.versionindex] == null) |
---|
3821 | 3959 | { |
---|
3822 | 3960 | java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
3823 | 3961 | return false; |
---|
3824 | 3962 | } |
---|
3825 | 3963 | |
---|
3826 | | - CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex])); |
---|
| 3964 | + //CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex])); |
---|
| 3965 | + CopyChanged(copy.versionlist[copy.versionindex]); |
---|
3827 | 3966 | |
---|
3828 | 3967 | return true; |
---|
3829 | 3968 | } |
---|
.. | .. |
---|
3834 | 3973 | |
---|
3835 | 3974 | cRadio tab = GetCurrentTab(); |
---|
3836 | 3975 | |
---|
3837 | | - if (copy.versionindex == -1 || copy.versions[copy.versionindex] == null) |
---|
| 3976 | + if (copy.versionindex == -1 || copy.versionlist[copy.versionindex] == null) |
---|
3838 | 3977 | { |
---|
3839 | 3978 | // No version yet. OK. java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
3840 | 3979 | return false; |
---|
3841 | 3980 | } |
---|
3842 | 3981 | |
---|
3843 | | - copy.versions[copy.versionindex] = CompressCopy(); |
---|
| 3982 | + copy.versionlist[copy.versionindex] = CompressCopy(); |
---|
3844 | 3983 | |
---|
3845 | 3984 | return true; |
---|
3846 | 3985 | } |
---|
.. | .. |
---|
3852 | 3991 | |
---|
3853 | 3992 | cRadio tab = GetCurrentTab(); |
---|
3854 | 3993 | |
---|
3855 | | - if (copy.versions[copy.versionindex + 1] == null) |
---|
| 3994 | + if (copy.versionlist[copy.versionindex + 1] == null) |
---|
3856 | 3995 | { |
---|
3857 | 3996 | java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
3858 | 3997 | return; |
---|
.. | .. |
---|
3860 | 3999 | |
---|
3861 | 4000 | copy.versionindex += 1; |
---|
3862 | 4001 | |
---|
3863 | | - CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex])); |
---|
| 4002 | + CopyChanged(copy.versionlist[copy.versionindex]); |
---|
3864 | 4003 | |
---|
3865 | 4004 | //if (!tab.user[tab.versionindex]) |
---|
3866 | 4005 | // tab.graphs[tab.versionindex] = null; |
---|
.. | .. |
---|
4074 | 4213 | //copy.material = new cMaterial(copy.GetMaterial()); |
---|
4075 | 4214 | |
---|
4076 | 4215 | current.color = (float) colorField.getFloat(); |
---|
4077 | | - current.modulation = (float) modulationField.getFloat(); |
---|
| 4216 | + current.modulation = (float) saturationField.getFloat(); |
---|
4078 | 4217 | current.metalness = (float) metalnessField.getFloat(); |
---|
4079 | 4218 | current.diffuse = (float) diffuseField.getFloat(); |
---|
4080 | 4219 | current.specular = (float) specularField.getFloat(); |
---|
.. | .. |
---|
4107 | 4246 | cMaterial mat = copy.material; |
---|
4108 | 4247 | |
---|
4109 | 4248 | colorField.SetToolTipValue((mat.color)); |
---|
4110 | | - modulationField.SetToolTipValue((mat.modulation)); |
---|
| 4249 | + saturationField.SetToolTipValue((mat.modulation)); |
---|
4111 | 4250 | metalnessField.SetToolTipValue((mat.metalness)); |
---|
4112 | 4251 | diffuseField.SetToolTipValue((mat.diffuse)); |
---|
4113 | 4252 | specularField.SetToolTipValue((mat.specular)); |
---|
.. | .. |
---|
4171 | 4310 | |
---|
4172 | 4311 | int version = versionSlider.getInteger(); |
---|
4173 | 4312 | |
---|
4174 | | - if (copy.versions[version] != null) |
---|
| 4313 | + if (copy.versionlist[version] != null) |
---|
4175 | 4314 | { |
---|
4176 | | - CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex = version])); |
---|
| 4315 | + CopyChanged(copy.versionlist[copy.versionindex = version]); |
---|
4177 | 4316 | } |
---|
4178 | 4317 | |
---|
4179 | 4318 | return; |
---|
.. | .. |
---|
4213 | 4352 | { |
---|
4214 | 4353 | //System.out.println("stateChanged = " + this); |
---|
4215 | 4354 | materialtouched = true; |
---|
| 4355 | + |
---|
| 4356 | + if (e.getSource() == colorField && saturationField.getFloat() == 0.001) |
---|
| 4357 | + { |
---|
| 4358 | + saturationField.setFloat(1); |
---|
| 4359 | + } |
---|
| 4360 | + |
---|
4216 | 4361 | applySelf(); |
---|
4217 | 4362 | //System.out.println("this = " + this); |
---|
4218 | 4363 | //System.out.println("PARENT = " + parent); |
---|
.. | .. |
---|
4512 | 4657 | { |
---|
4513 | 4658 | if (GetTree() != null) |
---|
4514 | 4659 | { |
---|
| 4660 | + GetTree().revalidate(); |
---|
4515 | 4661 | GetTree().repaint(); |
---|
4516 | 4662 | } |
---|
4517 | 4663 | |
---|
.. | .. |
---|
4768 | 4914 | readobj.ResetDisplayList(); |
---|
4769 | 4915 | } catch (Exception e) |
---|
4770 | 4916 | { |
---|
4771 | | - //e.printStackTrace(); |
---|
| 4917 | + if (!e.toString().contains("GZIP")) |
---|
| 4918 | + e.printStackTrace(); |
---|
| 4919 | + |
---|
4772 | 4920 | try |
---|
4773 | 4921 | { |
---|
4774 | 4922 | java.io.FileInputStream istream = new java.io.FileInputStream(fullname); |
---|
.. | .. |
---|
4848 | 4996 | { |
---|
4849 | 4997 | //readobj.deepCopySelf(copy); |
---|
4850 | 4998 | copy.clear(); // june 2014 |
---|
| 4999 | + copy.skyboxname = readobj.skyboxname; |
---|
| 5000 | + copy.skyboxext = readobj.skyboxext; |
---|
4851 | 5001 | for (int i = 0; i < readobj.size(); i++) |
---|
4852 | 5002 | { |
---|
4853 | 5003 | Object3D child = readobj.get(i); // reserve(i); |
---|
.. | .. |
---|
4888 | 5038 | } |
---|
4889 | 5039 | } catch (ClassCastException e) |
---|
4890 | 5040 | { |
---|
| 5041 | + e.printStackTrace(); |
---|
4891 | 5042 | assert (false); |
---|
4892 | 5043 | Composite c = (Composite) copy; |
---|
4893 | 5044 | c.children.clear(); |
---|
.. | .. |
---|
4898 | 5049 | c.addChild(csg); |
---|
4899 | 5050 | } |
---|
4900 | 5051 | |
---|
4901 | | - copy.versions = readobj.versions; |
---|
| 5052 | + copy.versionlist = readobj.versionlist; |
---|
4902 | 5053 | copy.versionindex = readobj.versionindex; |
---|
4903 | 5054 | |
---|
4904 | | - if (copy.versions == null) |
---|
| 5055 | + if (copy.versionlist == null) |
---|
4905 | 5056 | { |
---|
4906 | | - copy.versions = new byte[100][]; |
---|
| 5057 | + copy.versionlist = new Object3D[100]; |
---|
4907 | 5058 | copy.versionindex = -1; |
---|
4908 | 5059 | } |
---|
4909 | 5060 | |
---|
.. | .. |
---|
5018 | 5169 | //ps.print(buffer.toString()); |
---|
5019 | 5170 | } catch (IOException e) |
---|
5020 | 5171 | { |
---|
| 5172 | + e.printStackTrace(); |
---|
5021 | 5173 | } |
---|
5022 | 5174 | } |
---|
5023 | 5175 | |
---|
.. | .. |
---|
5310 | 5462 | JLabel colorLabel; |
---|
5311 | 5463 | cNumberSlider colorField; |
---|
5312 | 5464 | JLabel modulationLabel; |
---|
5313 | | - cNumberSlider modulationField; |
---|
| 5465 | + cNumberSlider saturationField; |
---|
5314 | 5466 | JLabel metalnessLabel; |
---|
5315 | 5467 | cNumberSlider metalnessField; |
---|
5316 | 5468 | JLabel diffuseLabel; |
---|