.. | .. |
---|
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*/ |
---|
.. | .. |
---|
820 | 848 | //frame.setVisible(true); |
---|
821 | 849 | } |
---|
822 | 850 | frame.validate(); |
---|
| 851 | + |
---|
| 852 | + cameraView.requestFocusInWindow(); |
---|
823 | 853 | } |
---|
824 | 854 | |
---|
825 | | - private byte[] CompressCopy() |
---|
| 855 | + private Object3D CompressCopy() |
---|
826 | 856 | { |
---|
827 | 857 | boolean temp = CameraPane.SWITCH; |
---|
828 | 858 | CameraPane.SWITCH = false; |
---|
.. | .. |
---|
830 | 860 | copy.ExtractBigData(versiontable); |
---|
831 | 861 | // if (copy == client) |
---|
832 | 862 | |
---|
833 | | - byte[] versions[] = copy.versions; |
---|
834 | | - copy.versions = null; |
---|
| 863 | + Object3D versions[] = copy.versionlist; |
---|
| 864 | + copy.versionlist = null; |
---|
835 | 865 | |
---|
836 | | - byte[] compress = Compress(copy); |
---|
| 866 | + //byte[] compress = Compress(copy); |
---|
| 867 | + Object3D compress = (Object3D)Grafreed.clone(copy); |
---|
837 | 868 | |
---|
838 | | - copy.versions = versions; |
---|
| 869 | + copy.versionlist = versions; |
---|
839 | 870 | |
---|
840 | 871 | copy.RestoreBigData(versiontable); |
---|
841 | 872 | |
---|
.. | .. |
---|
965 | 996 | { |
---|
966 | 997 | SetupMaterial(materialPanel); |
---|
967 | 998 | } |
---|
| 999 | + |
---|
968 | 1000 | //SetupName(); |
---|
969 | 1001 | //SetupViews(); |
---|
970 | 1002 | } |
---|
.. | .. |
---|
974 | 1006 | // NumberSlider vDivsField; |
---|
975 | 1007 | // JCheckBox endcaps; |
---|
976 | 1008 | JCheckBox liveCB; |
---|
977 | | - JCheckBox selectCB; |
---|
| 1009 | + JCheckBox selectableCB; |
---|
978 | 1010 | JCheckBox hideCB; |
---|
979 | 1011 | JCheckBox link2masterCB; |
---|
980 | 1012 | JCheckBox markCB; |
---|
.. | .. |
---|
1186 | 1218 | |
---|
1187 | 1219 | liveCB = AddCheckBox(setupPanel, "Live", copy.live); |
---|
1188 | 1220 | liveCB.setToolTipText("Animate object"); |
---|
1189 | | - selectCB = AddCheckBox(setupPanel, "Select", !copy.dontselect); |
---|
1190 | | - selectCB.setToolTipText("Make object selectable"); |
---|
| 1221 | + selectableCB = AddCheckBox(setupPanel, "Select", !copy.dontselect); |
---|
| 1222 | + selectableCB.setToolTipText("Make object selectable"); |
---|
1191 | 1223 | // Return(); |
---|
| 1224 | + |
---|
1192 | 1225 | hideCB = AddCheckBox(setupPanel, "Hide", copy.hide); |
---|
1193 | 1226 | hideCB.setToolTipText("Hide object"); |
---|
1194 | 1227 | markCB = AddCheckBox(setupPanel, "Mark", copy.marked); |
---|
1195 | 1228 | markCB.setToolTipText("As animation target transform"); |
---|
| 1229 | + |
---|
| 1230 | + ToolTipManager.sharedInstance().setLightWeightPopupEnabled(false); |
---|
1196 | 1231 | |
---|
1197 | 1232 | setupPanel2 = new cGridBag().setVertical(false); |
---|
1198 | 1233 | |
---|
.. | .. |
---|
1519 | 1554 | //tmp.setName("Edit"); |
---|
1520 | 1555 | objectPanel.add(materialPanel); |
---|
1521 | 1556 | objectPanel.setIconAt(0, GetIcon("icons/material.png")); |
---|
| 1557 | + objectPanel.setToolTipTextAt(0, "Material"); |
---|
| 1558 | + |
---|
1522 | 1559 | // JPanel north = new JPanel(new BorderLayout()); |
---|
1523 | 1560 | // north.setName("Edit"); |
---|
1524 | 1561 | // north.add(ctrlPanel, BorderLayout.NORTH); |
---|
1525 | 1562 | // objectPanel.add(north); |
---|
1526 | 1563 | objectPanel.add(editPanel); |
---|
1527 | 1564 | objectPanel.setIconAt(1, GetIcon("icons/write.png")); |
---|
| 1565 | + objectPanel.setToolTipTextAt(1, "Edit controls"); |
---|
1528 | 1566 | |
---|
1529 | 1567 | //if (Globals.ADVANCED) |
---|
1530 | 1568 | objectPanel.add(infoPanel); |
---|
1531 | 1569 | objectPanel.setIconAt(2, GetIcon("icons/info.png")); |
---|
| 1570 | + objectPanel.setToolTipTextAt(2, "Information"); |
---|
1532 | 1571 | |
---|
1533 | 1572 | objectPanel.add(XYZPanel); |
---|
1534 | 1573 | objectPanel.setIconAt(3, GetIcon("icons/XYZ.png")); |
---|
| 1574 | + objectPanel.setToolTipTextAt(3, "XYZ/RGB transform"); |
---|
1535 | 1575 | |
---|
1536 | 1576 | objectPanel.add(toolboxPanel); |
---|
1537 | 1577 | objectPanel.setIconAt(4, GetIcon("icons/primitives.png")); |
---|
| 1578 | + objectPanel.setToolTipTextAt(4, "Objects & backgrounds"); |
---|
1538 | 1579 | |
---|
1539 | 1580 | /* |
---|
1540 | 1581 | aConstraints.gridx = 0; |
---|
.. | .. |
---|
1674 | 1715 | frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); |
---|
1675 | 1716 | frame.addWindowListener(new WindowAdapter() |
---|
1676 | 1717 | { |
---|
1677 | | - |
---|
1678 | 1718 | public void windowClosing(WindowEvent e) |
---|
1679 | 1719 | { |
---|
1680 | 1720 | Close(); |
---|
.. | .. |
---|
1697 | 1737 | ctrlPanel.removeAll(); |
---|
1698 | 1738 | } |
---|
1699 | 1739 | |
---|
1700 | | - void SetupMaterial(cGridBag panel) |
---|
| 1740 | + void SetupMaterial(cGridBag materialpanel) |
---|
1701 | 1741 | { |
---|
1702 | | - /* |
---|
| 1742 | + cGridBag presetpanel = new cGridBag().setVertical(true); |
---|
| 1743 | + cLabel skin = GetLabel("icons/shadericons/shadericon00000.png", !Grafreed.NIMBUSLAF); |
---|
| 1744 | + skin.addMouseListener(new MouseAdapter() |
---|
| 1745 | + { |
---|
| 1746 | + public void mouseClicked(MouseEvent e) |
---|
| 1747 | + { |
---|
| 1748 | + Object3D object = Grafreed.materials.versionlist[0].get(0); |
---|
| 1749 | + cMaterial material = object.material; |
---|
| 1750 | + |
---|
| 1751 | + // Skin |
---|
| 1752 | + colorField.setFloat(material.color); |
---|
| 1753 | + saturationField.setFloat(material.modulation); |
---|
| 1754 | + subsurfaceField.setFloat(material.subsurface); |
---|
| 1755 | + selfshadowField.setFloat(material.diffuseness); |
---|
| 1756 | + diffusenessField.setFloat(material.factor); |
---|
| 1757 | + shininessField.setFloat(material.shininess); |
---|
| 1758 | + shadowbiasField.setFloat(material.shadowbias); |
---|
| 1759 | + diffuseField.setFloat(material.diffuse); |
---|
| 1760 | + specularField.setFloat(material.specular); |
---|
| 1761 | + |
---|
| 1762 | + bumpField.setFloat(object.projectedVertices[0].x / 1000.0); |
---|
| 1763 | + noiseField.setFloat(object.projectedVertices[0].y / 1000.0); |
---|
| 1764 | + powerField.setFloat(object.projectedVertices[2].x / 1000.0); |
---|
| 1765 | + |
---|
| 1766 | + materialtouched = true; |
---|
| 1767 | + applySelf(); |
---|
| 1768 | + } |
---|
| 1769 | + }); |
---|
| 1770 | + presetpanel.add(skin); |
---|
| 1771 | + |
---|
| 1772 | + cLabel rough2 = GetLabel("icons/shadericons/shadericon00001.png", !Grafreed.NIMBUSLAF); |
---|
| 1773 | + rough2.addMouseListener(new MouseAdapter() |
---|
| 1774 | + { |
---|
| 1775 | + public void mouseClicked(MouseEvent e) |
---|
| 1776 | + { |
---|
| 1777 | + Object3D object = Grafreed.materials.versionlist[1].get(0); |
---|
| 1778 | + cMaterial material = object.material; |
---|
| 1779 | + |
---|
| 1780 | + shininessField.setFloat(material.shininess); |
---|
| 1781 | + velvetField.setFloat(material.velvet); |
---|
| 1782 | + |
---|
| 1783 | + materialtouched = true; |
---|
| 1784 | + applySelf(); |
---|
| 1785 | + } |
---|
| 1786 | + }); |
---|
| 1787 | + presetpanel.add(rough2); |
---|
| 1788 | + |
---|
| 1789 | + presetpanel.add(GetLabel("icons/shadericons/shadericon00002.png", !Grafreed.NIMBUSLAF)); |
---|
| 1790 | + presetpanel.add(GetLabel("icons/shadericons/shadericon00003.png", !Grafreed.NIMBUSLAF)); |
---|
| 1791 | + presetpanel.add(GetLabel("icons/shadericons/shadericon00004.png", !Grafreed.NIMBUSLAF)); |
---|
| 1792 | + presetpanel.add(GetLabel("icons/shadericons/shadericon00005.png", !Grafreed.NIMBUSLAF)); |
---|
| 1793 | + presetpanel.add(GetLabel("icons/shadericons/shadericon00006.png", !Grafreed.NIMBUSLAF)); |
---|
| 1794 | + presetpanel.add(GetLabel("icons/shadericons/shadericon00007.png", !Grafreed.NIMBUSLAF)); |
---|
| 1795 | + presetpanel.add(GetLabel("icons/shadericons/shadericon00008.png", !Grafreed.NIMBUSLAF)); |
---|
| 1796 | + presetpanel.add(GetLabel("icons/shadericons/shadericon00009.png", !Grafreed.NIMBUSLAF)); |
---|
| 1797 | + presetpanel.add(GetLabel("icons/shadericons/shadericon00010.png", !Grafreed.NIMBUSLAF)); |
---|
| 1798 | + presetpanel.add(GetLabel("icons/shadericons/shadericon00011.png", !Grafreed.NIMBUSLAF)); |
---|
| 1799 | + presetpanel.add(GetLabel("icons/shadericons/shadericon00012.png", !Grafreed.NIMBUSLAF)); |
---|
| 1800 | + presetpanel.add(GetLabel("icons/shadericons/shadericon00013.png", !Grafreed.NIMBUSLAF)); |
---|
| 1801 | + presetpanel.add(GetLabel("icons/shadericons/shadericon00014.png", !Grafreed.NIMBUSLAF)); |
---|
| 1802 | + presetpanel.add(GetLabel("icons/shadericons/shadericon00015.png", !Grafreed.NIMBUSLAF)); |
---|
| 1803 | + presetpanel.add(GetLabel("icons/shadericons/shadericon00016.png", !Grafreed.NIMBUSLAF)); |
---|
| 1804 | + presetpanel.add(GetLabel("icons/shadericons/shadericon00017.png", !Grafreed.NIMBUSLAF)); |
---|
| 1805 | + |
---|
| 1806 | + cGridBag panel = new cGridBag().setVertical(true); |
---|
| 1807 | + |
---|
| 1808 | + presetpanel.preferredWidth = 1; |
---|
| 1809 | + |
---|
| 1810 | + materialpanel.add(panel); |
---|
| 1811 | + materialpanel.add(presetpanel); |
---|
| 1812 | + |
---|
| 1813 | + panel.preferredWidth = 8; |
---|
| 1814 | + |
---|
| 1815 | + /* |
---|
1703 | 1816 | ctrlPanel.add(materialLabel = new JLabel("MATERIAL : "), aConstraints); |
---|
1704 | 1817 | materialLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1705 | | - */ |
---|
| 1818 | + */ |
---|
1706 | 1819 | |
---|
1707 | 1820 | cGridBag editBar = new cGridBag().setVertical(false); |
---|
1708 | 1821 | |
---|
.. | .. |
---|
1736 | 1849 | //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints); |
---|
1737 | 1850 | |
---|
1738 | 1851 | cGridBag colorSection = new cGridBag().setVertical(true); |
---|
| 1852 | + |
---|
| 1853 | + cGridBag huepanel = new cGridBag(); |
---|
| 1854 | + cGridBag huelabel = new cGridBag(); |
---|
| 1855 | + skin = GetLabel("icons/hue.png", false); |
---|
| 1856 | + skin.fit = true; |
---|
| 1857 | + huelabel.add(skin); |
---|
| 1858 | + huelabel.preferredWidth = 20; |
---|
| 1859 | + huepanel.add(new cGridBag()); // Label |
---|
| 1860 | + huepanel.add(huelabel); // Field/slider |
---|
| 1861 | + |
---|
| 1862 | + huepanel.preferredHeight = 7; |
---|
| 1863 | + |
---|
| 1864 | + colorSection.add(huepanel); |
---|
1739 | 1865 | |
---|
1740 | 1866 | 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); |
---|
| 1867 | + |
---|
| 1868 | + color.add(colorLabel = new JLabel("Color/hue")); // , aConstraints); |
---|
| 1869 | + colorLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 1870 | + color.add(colorField = new cNumberSlider(this, 0.001, 1)); // , aConstraints); |
---|
| 1871 | + |
---|
1744 | 1872 | //colorField.preferredWidth = 200; |
---|
1745 | 1873 | colorSection.add(color); |
---|
1746 | 1874 | |
---|
1747 | 1875 | cGridBag modulation = new cGridBag(); |
---|
1748 | 1876 | modulation.add(modulationLabel = new JLabel("Saturation")); // , aConstraints); |
---|
1749 | 1877 | modulationLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1750 | | - modulation.add(modulationField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
| 1878 | + modulation.add(saturationField = new cNumberSlider(this, 0.001, 1)); // , aConstraints); |
---|
1751 | 1879 | colorSection.add(modulation); |
---|
1752 | 1880 | |
---|
| 1881 | + cGridBag opacity = new cGridBag(); |
---|
| 1882 | + opacity.add(opacityLabel = new JLabel("Opacity")); // , aConstraints); |
---|
| 1883 | + opacityLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 1884 | + opacity.add(opacityField = new cNumberSlider(this, 0.001, 1)); // , aConstraints); |
---|
| 1885 | + colorSection.add(opacity); |
---|
| 1886 | + |
---|
| 1887 | + colorSection.add(GetSeparator()); |
---|
| 1888 | + |
---|
1753 | 1889 | cGridBag texture = new cGridBag(); |
---|
1754 | 1890 | texture.add(textureLabel = new JLabel("Texture")); // , aConstraints); |
---|
1755 | 1891 | textureLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1756 | 1892 | texture.add(textureField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
1757 | 1893 | colorSection.add(texture); |
---|
1758 | 1894 | |
---|
1759 | | - panel.add(new JSeparator()); |
---|
| 1895 | + panel.add(GetSeparator()); |
---|
1760 | 1896 | |
---|
1761 | 1897 | panel.add(colorSection); |
---|
1762 | 1898 | |
---|
.. | .. |
---|
1812 | 1948 | shadowbias.add(shadowbiasField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
1813 | 1949 | diffuseSection.add(shadowbias); |
---|
1814 | 1950 | |
---|
1815 | | - panel.add(new JSeparator()); |
---|
| 1951 | + panel.add(GetSeparator()); |
---|
1816 | 1952 | |
---|
1817 | 1953 | panel.add(diffuseSection); |
---|
1818 | 1954 | |
---|
.. | .. |
---|
1875 | 2011 | specularSection.add(anisoV); |
---|
1876 | 2012 | |
---|
1877 | 2013 | |
---|
1878 | | - panel.add(new JSeparator()); |
---|
| 2014 | + panel.add(GetSeparator()); |
---|
1879 | 2015 | |
---|
1880 | 2016 | panel.add(specularSection); |
---|
1881 | 2017 | |
---|
.. | .. |
---|
1900 | 2036 | backlitLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1901 | 2037 | backlit.add(backlitField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
1902 | 2038 | 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 | 2039 | |
---|
1910 | 2040 | //panel.add(new JSeparator()); |
---|
1911 | 2041 | |
---|
.. | .. |
---|
1951 | 2081 | opacityPower.add(opacityPowerField = new cNumberSlider(this, 0.0, 10 /*10 dec 2013*/)); // , aConstraints); |
---|
1952 | 2082 | textureSection.add(opacityPower); |
---|
1953 | 2083 | |
---|
1954 | | - panel.add(new JSeparator()); |
---|
| 2084 | + panel.add(GetSeparator()); |
---|
1955 | 2085 | |
---|
1956 | 2086 | panel.add(textureSection); |
---|
1957 | 2087 | |
---|
.. | .. |
---|
2938 | 3068 | |
---|
2939 | 3069 | freezematerial = true; |
---|
2940 | 3070 | colorField.setFloat(mat.color); |
---|
2941 | | - modulationField.setFloat(mat.modulation); |
---|
| 3071 | + saturationField.setFloat(mat.modulation); |
---|
2942 | 3072 | metalnessField.setFloat(mat.metalness); |
---|
2943 | 3073 | diffuseField.setFloat(mat.diffuse); |
---|
2944 | 3074 | specularField.setFloat(mat.specular); |
---|
.. | .. |
---|
3249 | 3379 | } else if (event.getSource() == liveCB) |
---|
3250 | 3380 | { |
---|
3251 | 3381 | copy.live ^= true; |
---|
| 3382 | + objEditor.refreshContents(true); // To show item colors |
---|
3252 | 3383 | return; |
---|
3253 | | - } else if (event.getSource() == selectCB) |
---|
| 3384 | + } else if (event.getSource() == selectableCB) |
---|
3254 | 3385 | { |
---|
3255 | 3386 | copy.dontselect ^= true; |
---|
3256 | 3387 | return; |
---|
.. | .. |
---|
3258 | 3389 | { |
---|
3259 | 3390 | copy.hide ^= true; |
---|
3260 | 3391 | copy.Touch(); // display list issue |
---|
3261 | | - objEditor.refreshContents(); |
---|
| 3392 | + objEditor.refreshContents(true); // To show item colors |
---|
3262 | 3393 | return; |
---|
3263 | 3394 | } else if (event.getSource() == link2masterCB) |
---|
3264 | 3395 | { |
---|
.. | .. |
---|
3514 | 3645 | |
---|
3515 | 3646 | static public byte[] Compress(Object3D o) |
---|
3516 | 3647 | { |
---|
| 3648 | + // Slower to actually compress. |
---|
3517 | 3649 | try |
---|
3518 | 3650 | { |
---|
3519 | 3651 | ByteArrayOutputStream baos = new ByteArrayOutputStream(); |
---|
.. | .. |
---|
3615 | 3747 | { |
---|
3616 | 3748 | //Save(true); |
---|
3617 | 3749 | Replace(); |
---|
| 3750 | + SetUndoStates(); |
---|
3618 | 3751 | } |
---|
3619 | 3752 | |
---|
3620 | 3753 | private boolean Equal(byte[] compress, byte[] name) |
---|
.. | .. |
---|
3635 | 3768 | |
---|
3636 | 3769 | java.util.Hashtable<java.util.UUID, Object3D> versiontable = new java.util.Hashtable<java.util.UUID, Object3D>(); |
---|
3637 | 3770 | |
---|
| 3771 | + void DeleteVersion() |
---|
| 3772 | + { |
---|
| 3773 | + for (int i = copy.versionindex; i < copy.versionlist.length-1; i++) |
---|
| 3774 | + { |
---|
| 3775 | + copy.versionlist[i] = copy.versionlist[i+1]; |
---|
| 3776 | + } |
---|
| 3777 | + |
---|
| 3778 | + CopyChanged(); |
---|
| 3779 | + |
---|
| 3780 | + SetUndoStates(); |
---|
| 3781 | + } |
---|
| 3782 | + |
---|
3638 | 3783 | public boolean Save(boolean user) |
---|
3639 | 3784 | { |
---|
3640 | 3785 | System.err.println("Save"); |
---|
| 3786 | + //Replace(); |
---|
3641 | 3787 | |
---|
3642 | 3788 | cRadio tab = GetCurrentTab(); |
---|
3643 | 3789 | |
---|
3644 | | - byte[] compress = CompressCopy(); |
---|
| 3790 | + Object3D compress = CompressCopy(); // Saved version. No need for "Replace"? |
---|
3645 | 3791 | |
---|
3646 | 3792 | boolean thesame = false; |
---|
3647 | 3793 | |
---|
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 | | - } |
---|
| 3794 | +// if (copy.versionindex > 0 && copy.versions[copy.versionindex-1] != null && Equal(compress, copy.versions[copy.versionindex-1])) |
---|
| 3795 | +// { |
---|
| 3796 | +// thesame = true; |
---|
| 3797 | +// } |
---|
3653 | 3798 | |
---|
3654 | 3799 | //EditorFrame.m_MainFrame.requestFocusInWindow(); |
---|
3655 | 3800 | if (!thesame) |
---|
3656 | 3801 | { |
---|
| 3802 | + for (int i = copy.versionlist.length; --i > copy.versionindex+1;) |
---|
| 3803 | + { |
---|
| 3804 | + copy.versionlist[i] = copy.versionlist[i-1]; |
---|
| 3805 | + } |
---|
| 3806 | + |
---|
3657 | 3807 | //tab.user[tab.versionindex] = user; |
---|
3658 | 3808 | //boolean increment = true; // tab.graphs[tab.versionindex] == null; |
---|
3659 | 3809 | |
---|
3660 | | - copy.versions[++copy.versionindex] = compress; |
---|
| 3810 | + copy.versionlist[++copy.versionindex] = compress; |
---|
3661 | 3811 | |
---|
3662 | 3812 | // if (increment) |
---|
3663 | 3813 | // tab.versionindex++; |
---|
.. | .. |
---|
3667 | 3817 | |
---|
3668 | 3818 | //assert(hashtable.isEmpty()); |
---|
3669 | 3819 | |
---|
3670 | | - for (int i = copy.versionindex+1; i < copy.versions.length; i++) |
---|
3671 | | - { |
---|
3672 | | - //tab.user[i] = false; |
---|
3673 | | - copy.versions[i] = null; |
---|
3674 | | - } |
---|
| 3820 | +// for (int i = copy.versionindex+1; i < copy.versionlist.length; i++) |
---|
| 3821 | +// { |
---|
| 3822 | +// //tab.user[i] = false; |
---|
| 3823 | +// copy.versionlist[i] = null; |
---|
| 3824 | +// } |
---|
3675 | 3825 | |
---|
3676 | 3826 | SetUndoStates(); |
---|
3677 | 3827 | |
---|
.. | .. |
---|
3696 | 3846 | |
---|
3697 | 3847 | return !thesame; |
---|
3698 | 3848 | } |
---|
3699 | | - |
---|
3700 | | - void CopyChanged(Object3D obj) |
---|
| 3849 | + |
---|
| 3850 | + boolean flashIt = true; |
---|
| 3851 | + |
---|
| 3852 | + void RefreshSelection() |
---|
3701 | 3853 | { |
---|
| 3854 | + Object3D selection = new Object3D(); |
---|
| 3855 | + |
---|
| 3856 | + for (int i = 0; i < copy.selection.size(); i++) |
---|
| 3857 | + { |
---|
| 3858 | + Object3D elem = copy.selection.elementAt(i); |
---|
| 3859 | + |
---|
| 3860 | + Object3D obj = copy.GetObject(elem.GetUUID()); |
---|
| 3861 | + |
---|
| 3862 | + if (obj == null) |
---|
| 3863 | + { |
---|
| 3864 | + copy.selection.remove(i--); |
---|
| 3865 | + } |
---|
| 3866 | + else |
---|
| 3867 | + { |
---|
| 3868 | + selection.add(obj); |
---|
| 3869 | + copy.selection.setElementAt(obj, i); |
---|
| 3870 | + } |
---|
| 3871 | + } |
---|
| 3872 | + |
---|
| 3873 | + flashIt = false; |
---|
| 3874 | + GetTree().clearSelection(); |
---|
| 3875 | + for (int i = 0; i < selection.size(); i++) |
---|
| 3876 | + GetTree().addSelectionPath(selection.elementAt(i).GetTreePath().GetTreePath()); |
---|
| 3877 | + flashIt = true; |
---|
| 3878 | + |
---|
| 3879 | + //refreshContents(false); |
---|
| 3880 | + } |
---|
| 3881 | + |
---|
| 3882 | + void CopyChanged() |
---|
| 3883 | + { |
---|
| 3884 | + Object3D obj = copy.versionlist[copy.versionindex]; |
---|
| 3885 | + |
---|
3702 | 3886 | SetUndoStates(); |
---|
3703 | 3887 | |
---|
3704 | 3888 | boolean temp = CameraPane.SWITCH; |
---|
.. | .. |
---|
3708 | 3892 | |
---|
3709 | 3893 | copy.clear(); |
---|
3710 | 3894 | |
---|
| 3895 | + copy.skyboxname = obj.skyboxname; |
---|
| 3896 | + copy.skyboxext = obj.skyboxext; |
---|
| 3897 | + |
---|
3711 | 3898 | for (int i=0; i<obj.Size(); i++) |
---|
3712 | 3899 | { |
---|
3713 | 3900 | copy.add(obj.get(i)); |
---|
.. | .. |
---|
3717 | 3904 | |
---|
3718 | 3905 | CameraPane.SWITCH = temp; |
---|
3719 | 3906 | |
---|
| 3907 | + RefreshSelection(); |
---|
3720 | 3908 | //assert(hashtable.isEmpty()); |
---|
3721 | 3909 | |
---|
3722 | 3910 | copy.Touch(); |
---|
.. | .. |
---|
3737 | 3925 | } |
---|
3738 | 3926 | } |
---|
3739 | 3927 | |
---|
3740 | | - refreshContents(); |
---|
| 3928 | + refreshContents(true); |
---|
3741 | 3929 | } |
---|
3742 | 3930 | |
---|
3743 | | - cButton undoButton; |
---|
| 3931 | + cButton previousVersionButton; |
---|
3744 | 3932 | cButton restoreButton; |
---|
3745 | 3933 | cButton replaceButton; |
---|
3746 | | - cButton redoButton; |
---|
| 3934 | + cButton nextVersionButton; |
---|
| 3935 | + cButton saveVersionButton; |
---|
| 3936 | + cButton deleteVersionButton; |
---|
3747 | 3937 | |
---|
3748 | 3938 | boolean muteSlider; |
---|
3749 | 3939 | |
---|
.. | .. |
---|
3751 | 3941 | { |
---|
3752 | 3942 | int count = 0; |
---|
3753 | 3943 | |
---|
3754 | | - for (int i = copy.versions.length; --i >= 0;) |
---|
| 3944 | + for (int i = copy.versionlist.length; --i >= 0;) |
---|
3755 | 3945 | { |
---|
3756 | | - if (copy.versions[i] != null) |
---|
| 3946 | + if (copy.versionlist[i] != null) |
---|
3757 | 3947 | count++; |
---|
3758 | 3948 | } |
---|
3759 | 3949 | |
---|
.. | .. |
---|
3764 | 3954 | { |
---|
3765 | 3955 | cRadio tab = GetCurrentTab(); |
---|
3766 | 3956 | |
---|
3767 | | - restoreButton.setEnabled(copy.versionindex != -1); |
---|
3768 | | - replaceButton.setEnabled(copy.versionindex != -1); |
---|
| 3957 | + restoreButton.setEnabled(true); // copy.versionindex != -1); |
---|
| 3958 | + replaceButton.setEnabled(true); // copy.versionindex != -1); |
---|
3769 | 3959 | |
---|
3770 | | - undoButton.setEnabled(copy.versionindex > 0); |
---|
3771 | | - redoButton.setEnabled(copy.versions[copy.versionindex + 1] != null); |
---|
| 3960 | + previousVersionButton.setEnabled(copy.versionindex > 0); |
---|
| 3961 | + nextVersionButton.setEnabled(copy.versionlist[copy.versionindex + 1] != null); |
---|
| 3962 | + |
---|
| 3963 | + deleteVersionButton.setEnabled(//copy.versionindex > 0 && |
---|
| 3964 | + copy.versionlist[copy.versionindex + 1] != null); |
---|
3772 | 3965 | |
---|
3773 | 3966 | muteSlider = true; |
---|
3774 | 3967 | versionSlider.setMaximum(VersionCount() - 1); |
---|
.. | .. |
---|
3776 | 3969 | muteSlider = false; |
---|
3777 | 3970 | } |
---|
3778 | 3971 | |
---|
3779 | | - public boolean Undo() |
---|
| 3972 | + public boolean PreviousVersion() |
---|
3780 | 3973 | { |
---|
3781 | 3974 | // Option? |
---|
3782 | 3975 | Replace(); |
---|
.. | .. |
---|
3806 | 3999 | |
---|
3807 | 4000 | copy.versionindex -= 1; |
---|
3808 | 4001 | |
---|
3809 | | - CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex])); |
---|
| 4002 | + CopyChanged(); |
---|
3810 | 4003 | |
---|
3811 | 4004 | return true; |
---|
3812 | 4005 | } |
---|
.. | .. |
---|
3817 | 4010 | |
---|
3818 | 4011 | cRadio tab = GetCurrentTab(); |
---|
3819 | 4012 | |
---|
3820 | | - if (copy.versionindex == -1 || copy.versions[copy.versionindex] == null) |
---|
| 4013 | + if (copy.versionindex == -1 || copy.versionlist[copy.versionindex] == null) |
---|
3821 | 4014 | { |
---|
3822 | 4015 | java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
3823 | 4016 | return false; |
---|
3824 | 4017 | } |
---|
3825 | 4018 | |
---|
3826 | | - CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex])); |
---|
| 4019 | + //CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex])); |
---|
| 4020 | + CopyChanged(); |
---|
3827 | 4021 | |
---|
3828 | 4022 | return true; |
---|
3829 | 4023 | } |
---|
.. | .. |
---|
3834 | 4028 | |
---|
3835 | 4029 | cRadio tab = GetCurrentTab(); |
---|
3836 | 4030 | |
---|
3837 | | - if (copy.versionindex == -1 || copy.versions[copy.versionindex] == null) |
---|
| 4031 | + if (copy.versionindex == -1 || copy.versionlist[copy.versionindex] == null) |
---|
3838 | 4032 | { |
---|
3839 | 4033 | // No version yet. OK. java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
3840 | 4034 | return false; |
---|
3841 | 4035 | } |
---|
3842 | 4036 | |
---|
3843 | | - copy.versions[copy.versionindex] = CompressCopy(); |
---|
| 4037 | + copy.versionlist[copy.versionindex] = CompressCopy(); |
---|
3844 | 4038 | |
---|
3845 | 4039 | return true; |
---|
3846 | 4040 | } |
---|
3847 | 4041 | |
---|
3848 | | - public void Redo() |
---|
| 4042 | + public void NextVersion() |
---|
3849 | 4043 | { |
---|
3850 | 4044 | // Option? |
---|
3851 | 4045 | Replace(); |
---|
3852 | 4046 | |
---|
3853 | 4047 | cRadio tab = GetCurrentTab(); |
---|
3854 | 4048 | |
---|
3855 | | - if (copy.versions[copy.versionindex + 1] == null) |
---|
| 4049 | + if (copy.versionlist[copy.versionindex + 1] == null) |
---|
3856 | 4050 | { |
---|
3857 | 4051 | java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
3858 | 4052 | return; |
---|
.. | .. |
---|
3860 | 4054 | |
---|
3861 | 4055 | copy.versionindex += 1; |
---|
3862 | 4056 | |
---|
3863 | | - CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex])); |
---|
| 4057 | + CopyChanged(); |
---|
3864 | 4058 | |
---|
3865 | 4059 | //if (!tab.user[tab.versionindex]) |
---|
3866 | 4060 | // tab.graphs[tab.versionindex] = null; |
---|
.. | .. |
---|
4074 | 4268 | //copy.material = new cMaterial(copy.GetMaterial()); |
---|
4075 | 4269 | |
---|
4076 | 4270 | current.color = (float) colorField.getFloat(); |
---|
4077 | | - current.modulation = (float) modulationField.getFloat(); |
---|
| 4271 | + current.modulation = (float) saturationField.getFloat(); |
---|
4078 | 4272 | current.metalness = (float) metalnessField.getFloat(); |
---|
4079 | 4273 | current.diffuse = (float) diffuseField.getFloat(); |
---|
4080 | 4274 | current.specular = (float) specularField.getFloat(); |
---|
.. | .. |
---|
4107 | 4301 | cMaterial mat = copy.material; |
---|
4108 | 4302 | |
---|
4109 | 4303 | colorField.SetToolTipValue((mat.color)); |
---|
4110 | | - modulationField.SetToolTipValue((mat.modulation)); |
---|
| 4304 | + saturationField.SetToolTipValue((mat.modulation)); |
---|
4111 | 4305 | metalnessField.SetToolTipValue((mat.metalness)); |
---|
4112 | 4306 | diffuseField.SetToolTipValue((mat.diffuse)); |
---|
4113 | 4307 | specularField.SetToolTipValue((mat.specular)); |
---|
.. | .. |
---|
4171 | 4365 | |
---|
4172 | 4366 | int version = versionSlider.getInteger(); |
---|
4173 | 4367 | |
---|
4174 | | - if (copy.versions[version] != null) |
---|
| 4368 | + if (copy.versionlist[version] != null) |
---|
4175 | 4369 | { |
---|
4176 | | - CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex = version])); |
---|
| 4370 | + copy.versionindex = version; |
---|
| 4371 | + CopyChanged(); |
---|
4177 | 4372 | } |
---|
4178 | 4373 | |
---|
4179 | 4374 | return; |
---|
.. | .. |
---|
4213 | 4408 | { |
---|
4214 | 4409 | //System.out.println("stateChanged = " + this); |
---|
4215 | 4410 | materialtouched = true; |
---|
| 4411 | + |
---|
| 4412 | + if (e.getSource() == colorField && saturationField.getFloat() == 0.001) |
---|
| 4413 | + { |
---|
| 4414 | + saturationField.setFloat(1); |
---|
| 4415 | + } |
---|
| 4416 | + |
---|
4216 | 4417 | applySelf(); |
---|
4217 | 4418 | //System.out.println("this = " + this); |
---|
4218 | 4419 | //System.out.println("PARENT = " + parent); |
---|
.. | .. |
---|
4512 | 4713 | { |
---|
4513 | 4714 | if (GetTree() != null) |
---|
4514 | 4715 | { |
---|
| 4716 | + GetTree().revalidate(); |
---|
4515 | 4717 | GetTree().repaint(); |
---|
4516 | 4718 | } |
---|
4517 | 4719 | |
---|
.. | .. |
---|
4520 | 4722 | ctrlPanel.validate(); // ? new |
---|
4521 | 4723 | ctrlPanel.repaint(); |
---|
4522 | 4724 | } |
---|
| 4725 | + |
---|
| 4726 | + if (previousVersionButton != null && copy.versionlist != null) |
---|
| 4727 | + SetUndoStates(); |
---|
4523 | 4728 | } |
---|
4524 | 4729 | |
---|
4525 | 4730 | static TweenManager tweenManager = new TweenManager(); |
---|
.. | .. |
---|
4768 | 4973 | readobj.ResetDisplayList(); |
---|
4769 | 4974 | } catch (Exception e) |
---|
4770 | 4975 | { |
---|
4771 | | - //e.printStackTrace(); |
---|
| 4976 | + if (!e.toString().contains("GZIP")) |
---|
| 4977 | + e.printStackTrace(); |
---|
| 4978 | + |
---|
4772 | 4979 | try |
---|
4773 | 4980 | { |
---|
4774 | 4981 | java.io.FileInputStream istream = new java.io.FileInputStream(fullname); |
---|
.. | .. |
---|
4848 | 5055 | { |
---|
4849 | 5056 | //readobj.deepCopySelf(copy); |
---|
4850 | 5057 | copy.clear(); // june 2014 |
---|
| 5058 | + copy.skyboxname = readobj.skyboxname; |
---|
| 5059 | + copy.skyboxext = readobj.skyboxext; |
---|
4851 | 5060 | for (int i = 0; i < readobj.size(); i++) |
---|
4852 | 5061 | { |
---|
4853 | 5062 | Object3D child = readobj.get(i); // reserve(i); |
---|
.. | .. |
---|
4888 | 5097 | } |
---|
4889 | 5098 | } catch (ClassCastException e) |
---|
4890 | 5099 | { |
---|
| 5100 | + e.printStackTrace(); |
---|
4891 | 5101 | assert (false); |
---|
4892 | 5102 | Composite c = (Composite) copy; |
---|
4893 | 5103 | c.children.clear(); |
---|
.. | .. |
---|
4898 | 5108 | c.addChild(csg); |
---|
4899 | 5109 | } |
---|
4900 | 5110 | |
---|
4901 | | - copy.versions = readobj.versions; |
---|
| 5111 | + copy.versionlist = readobj.versionlist; |
---|
4902 | 5112 | copy.versionindex = readobj.versionindex; |
---|
4903 | 5113 | |
---|
4904 | | - if (copy.versions == null) |
---|
| 5114 | + if (copy.versionlist == null) |
---|
4905 | 5115 | { |
---|
4906 | | - copy.versions = new byte[100][]; |
---|
| 5116 | + copy.versionlist = new Object3D[100]; |
---|
4907 | 5117 | copy.versionindex = -1; |
---|
4908 | 5118 | } |
---|
4909 | 5119 | |
---|
.. | .. |
---|
4919 | 5129 | { |
---|
4920 | 5130 | if (Grafreed.standAlone) |
---|
4921 | 5131 | { |
---|
4922 | | - FileDialog browser = new FileDialog(frame, "Load", FileDialog.LOAD); |
---|
| 5132 | + FileDialog browser = new FileDialog(frame, "Open", FileDialog.LOAD); |
---|
4923 | 5133 | browser.show(); |
---|
4924 | 5134 | String filename = browser.getFile(); |
---|
4925 | 5135 | if (filename != null && filename.length() > 0) |
---|
.. | .. |
---|
5018 | 5228 | //ps.print(buffer.toString()); |
---|
5019 | 5229 | } catch (IOException e) |
---|
5020 | 5230 | { |
---|
| 5231 | + e.printStackTrace(); |
---|
5021 | 5232 | } |
---|
5022 | 5233 | } |
---|
5023 | 5234 | |
---|
.. | .. |
---|
5310 | 5521 | JLabel colorLabel; |
---|
5311 | 5522 | cNumberSlider colorField; |
---|
5312 | 5523 | JLabel modulationLabel; |
---|
5313 | | - cNumberSlider modulationField; |
---|
| 5524 | + cNumberSlider saturationField; |
---|
5314 | 5525 | JLabel metalnessLabel; |
---|
5315 | 5526 | cNumberSlider metalnessField; |
---|
5316 | 5527 | JLabel diffuseLabel; |
---|