.. | .. |
---|
34 | 34 | iSendInfo |
---|
35 | 35 | //KeyListener |
---|
36 | 36 | { |
---|
| 37 | + public cToggleButton pinButton; |
---|
37 | 38 | boolean timeline; |
---|
38 | 39 | boolean wasFullScreen; |
---|
39 | 40 | |
---|
.. | .. |
---|
41 | 42 | JFrame frame; |
---|
42 | 43 | |
---|
43 | 44 | static ObjEditor theFrame; |
---|
| 45 | + |
---|
| 46 | + public cGridBag GetSeparator() |
---|
| 47 | + { |
---|
| 48 | + cGridBag separator = new cGridBag(); |
---|
| 49 | + separator.add(new JSeparator()); |
---|
| 50 | + separator.preferredHeight = 5; |
---|
| 51 | + return separator; |
---|
| 52 | + } |
---|
44 | 53 | |
---|
45 | 54 | cButton GetButton(String name, boolean border) |
---|
46 | 55 | { |
---|
47 | 56 | ImageIcon icon = GetIcon(name); |
---|
48 | 57 | return new cButton(icon, border); |
---|
| 58 | + } |
---|
| 59 | + |
---|
| 60 | + cLabel GetLabel(String name, boolean border) |
---|
| 61 | + { |
---|
| 62 | + //ImageIcon icon = GetIcon(name); |
---|
| 63 | + return new cLabel(GetImage(name), border); |
---|
49 | 64 | } |
---|
50 | 65 | |
---|
51 | 66 | cToggleButton GetToggleButton(String name, boolean border) |
---|
.. | .. |
---|
60 | 75 | return new cCheckBox(icon, border); |
---|
61 | 76 | } |
---|
62 | 77 | |
---|
63 | | - private ImageIcon GetIcon(String name) |
---|
| 78 | + ImageIcon GetIcon(String name) |
---|
64 | 79 | { |
---|
65 | 80 | try |
---|
66 | 81 | { |
---|
67 | 82 | BufferedImage image = javax.imageio.ImageIO.read(getClass().getClassLoader().getResourceAsStream(name)); |
---|
68 | 83 | |
---|
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 | | - } |
---|
| 84 | +// if (image.getWidth() > 48 && image.getHeight() > 48) |
---|
| 85 | +// { |
---|
| 86 | +// BufferedImage resized = new BufferedImage(48, 48, image.getType()); |
---|
| 87 | +// Graphics2D g = resized.createGraphics(); |
---|
| 88 | +// g.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR); |
---|
| 89 | +// //g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); |
---|
| 90 | +// g.drawImage(image, 0, 0, 48, 48, 0, 0, image.getWidth(), image.getHeight(), null); |
---|
| 91 | +// g.dispose(); |
---|
| 92 | +// |
---|
| 93 | +// image = resized; |
---|
| 94 | +// } |
---|
80 | 95 | |
---|
81 | 96 | javax.swing.ImageIcon icon = new javax.swing.ImageIcon(image); |
---|
82 | 97 | return icon; |
---|
| 98 | + } |
---|
| 99 | + catch (Exception e) |
---|
| 100 | + { |
---|
| 101 | + return null; |
---|
| 102 | + } |
---|
| 103 | + } |
---|
| 104 | + |
---|
| 105 | + BufferedImage GetImage(String name) |
---|
| 106 | + { |
---|
| 107 | + try |
---|
| 108 | + { |
---|
| 109 | + BufferedImage image = javax.imageio.ImageIO.read(getClass().getClassLoader().getResourceAsStream(name)); |
---|
| 110 | + |
---|
| 111 | + return image; |
---|
83 | 112 | } |
---|
84 | 113 | catch (Exception e) |
---|
85 | 114 | { |
---|
.. | .. |
---|
268 | 297 | client = inClient; |
---|
269 | 298 | copy = client; |
---|
270 | 299 | |
---|
271 | | - if (copy.versions == null) |
---|
| 300 | + if (copy.versionlist == null) |
---|
272 | 301 | { |
---|
273 | | - copy.versions = new byte[100][]; |
---|
| 302 | + copy.versionlist = new Object3D[100]; |
---|
274 | 303 | copy.versionindex = -1; |
---|
275 | 304 | } |
---|
276 | 305 | |
---|
.. | .. |
---|
287 | 316 | client = inClient; |
---|
288 | 317 | copy = client; |
---|
289 | 318 | |
---|
290 | | - if (copy.versions == null) |
---|
| 319 | + if (copy.versionlist == null) |
---|
291 | 320 | { |
---|
292 | | - copy.versions = new byte[100][]; |
---|
| 321 | + copy.versionlist = new Object3D[100]; |
---|
293 | 322 | copy.versionindex = -1; |
---|
294 | 323 | } |
---|
295 | 324 | |
---|
.. | .. |
---|
325 | 354 | copy = localCopy; |
---|
326 | 355 | copy.editWindow = this; |
---|
327 | 356 | |
---|
328 | | - if (copy.versions == null) |
---|
| 357 | + if (copy.versionlist == null) |
---|
329 | 358 | { |
---|
330 | 359 | // copy.versions = new byte[100][]; |
---|
331 | 360 | // copy.versionindex = -1; |
---|
.. | .. |
---|
436 | 465 | editPanel.add(editCommandsPanel); |
---|
437 | 466 | editPanel.add(ctrlPanel); |
---|
438 | 467 | |
---|
439 | | - toolboxPanel = new cGridBag().setVertical(false); |
---|
| 468 | + toolboxPanel = new cGridBag().setVertical(true); |
---|
440 | 469 | //toolboxPanel.setName("Toolbox"); |
---|
441 | 470 | |
---|
442 | | - materialPanel = new cGridBag().setVertical(true); |
---|
| 471 | + skyboxPanel = new cGridBag().setVertical(true); |
---|
| 472 | + |
---|
| 473 | + materialPanel = new cGridBag().setVertical(false); |
---|
443 | 474 | //materialPanel.setName("Material"); |
---|
444 | 475 | |
---|
445 | 476 | /*JTextPane*/ |
---|
.. | .. |
---|
820 | 851 | //frame.setVisible(true); |
---|
821 | 852 | } |
---|
822 | 853 | frame.validate(); |
---|
| 854 | + |
---|
| 855 | + cameraView.requestFocusInWindow(); |
---|
823 | 856 | } |
---|
824 | 857 | |
---|
825 | | - private byte[] CompressCopy() |
---|
| 858 | + private Object3D CompressCopy() |
---|
826 | 859 | { |
---|
827 | 860 | boolean temp = CameraPane.SWITCH; |
---|
828 | 861 | CameraPane.SWITCH = false; |
---|
.. | .. |
---|
830 | 863 | copy.ExtractBigData(versiontable); |
---|
831 | 864 | // if (copy == client) |
---|
832 | 865 | |
---|
833 | | - byte[] versions[] = copy.versions; |
---|
834 | | - copy.versions = null; |
---|
| 866 | + Object3D versions[] = copy.versionlist; |
---|
| 867 | + copy.versionlist = null; |
---|
835 | 868 | |
---|
836 | | - byte[] compress = Compress(copy); |
---|
| 869 | + //byte[] compress = Compress(copy); |
---|
| 870 | + Object3D compress = (Object3D)Grafreed.clone(copy); |
---|
837 | 871 | |
---|
838 | | - copy.versions = versions; |
---|
| 872 | + copy.versionlist = versions; |
---|
839 | 873 | |
---|
840 | 874 | copy.RestoreBigData(versiontable); |
---|
841 | 875 | |
---|
.. | .. |
---|
965 | 999 | { |
---|
966 | 1000 | SetupMaterial(materialPanel); |
---|
967 | 1001 | } |
---|
| 1002 | + |
---|
968 | 1003 | //SetupName(); |
---|
969 | 1004 | //SetupViews(); |
---|
970 | 1005 | } |
---|
.. | .. |
---|
1173 | 1208 | |
---|
1174 | 1209 | namePanel = new cGridBag(); |
---|
1175 | 1210 | |
---|
| 1211 | + //if (copy.pinned) |
---|
| 1212 | + { |
---|
| 1213 | + pinButton = GetToggleButton("icons/pin.png", !Grafreed.NIMBUSLAF); |
---|
| 1214 | + pinButton.setSelected(copy.pinned); |
---|
| 1215 | + cGridBag t = new cGridBag(); |
---|
| 1216 | + t.preferredWidth = 2; |
---|
| 1217 | + t.add(pinButton); |
---|
| 1218 | + namePanel.add(t); |
---|
| 1219 | + |
---|
| 1220 | + pinButton.addItemListener(this); |
---|
| 1221 | + } |
---|
| 1222 | + |
---|
1176 | 1223 | nameField = AddText(namePanel, copy.GetName()); |
---|
1177 | 1224 | namePanel.add(new JScrollPane(nameField, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER)); |
---|
1178 | 1225 | oe.ctrlPanel.add(namePanel); |
---|
.. | .. |
---|
1194 | 1241 | hideCB.setToolTipText("Hide object"); |
---|
1195 | 1242 | markCB = AddCheckBox(setupPanel, "Mark", copy.marked); |
---|
1196 | 1243 | markCB.setToolTipText("As animation target transform"); |
---|
| 1244 | + |
---|
| 1245 | + ToolTipManager.sharedInstance().setLightWeightPopupEnabled(false); |
---|
1197 | 1246 | |
---|
1198 | 1247 | setupPanel2 = new cGridBag().setVertical(false); |
---|
1199 | 1248 | |
---|
.. | .. |
---|
1520 | 1569 | //tmp.setName("Edit"); |
---|
1521 | 1570 | objectPanel.add(materialPanel); |
---|
1522 | 1571 | objectPanel.setIconAt(0, GetIcon("icons/material.png")); |
---|
| 1572 | + objectPanel.setToolTipTextAt(0, "Material"); |
---|
| 1573 | + |
---|
| 1574 | + objectPanel.add(toolboxPanel); |
---|
| 1575 | + objectPanel.setIconAt(1, GetIcon("icons/primitives.png")); |
---|
| 1576 | + objectPanel.setToolTipTextAt(1, "Objects & textures"); |
---|
| 1577 | + |
---|
| 1578 | + objectPanel.add(skyboxPanel); |
---|
| 1579 | + objectPanel.setIconAt(2, GetIcon("icons/skybox.jpg")); |
---|
| 1580 | + objectPanel.setToolTipTextAt(2, "Backgrounds"); |
---|
| 1581 | + |
---|
1523 | 1582 | // JPanel north = new JPanel(new BorderLayout()); |
---|
1524 | 1583 | // north.setName("Edit"); |
---|
1525 | 1584 | // north.add(ctrlPanel, BorderLayout.NORTH); |
---|
1526 | 1585 | // objectPanel.add(north); |
---|
1527 | 1586 | objectPanel.add(editPanel); |
---|
1528 | | - objectPanel.setIconAt(1, GetIcon("icons/write.png")); |
---|
1529 | | - |
---|
1530 | | - //if (Globals.ADVANCED) |
---|
1531 | | - objectPanel.add(infoPanel); |
---|
1532 | | - objectPanel.setIconAt(2, GetIcon("icons/info.png")); |
---|
| 1587 | + objectPanel.setIconAt(3, GetIcon("icons/write.png")); |
---|
| 1588 | + objectPanel.setToolTipTextAt(3, "Edit controls"); |
---|
1533 | 1589 | |
---|
1534 | 1590 | objectPanel.add(XYZPanel); |
---|
1535 | | - objectPanel.setIconAt(3, GetIcon("icons/XYZ.png")); |
---|
| 1591 | + objectPanel.setIconAt(4, GetIcon("icons/XYZ.png")); |
---|
| 1592 | + objectPanel.setToolTipTextAt(4, "XYZ/RGB transform"); |
---|
1536 | 1593 | |
---|
1537 | | - objectPanel.add(toolboxPanel); |
---|
1538 | | - objectPanel.setIconAt(4, GetIcon("icons/primitives.png")); |
---|
1539 | | - |
---|
1540 | 1594 | /* |
---|
1541 | 1595 | aConstraints.gridx = 0; |
---|
1542 | 1596 | aConstraints.gridwidth = 1; |
---|
.. | .. |
---|
1573 | 1627 | |
---|
1574 | 1628 | scenePanel.add(tabbedPane); |
---|
1575 | 1629 | |
---|
| 1630 | + //if (Globals.ADVANCED) |
---|
| 1631 | + tabbedPane.add(infoPanel); |
---|
| 1632 | + tabbedPane.setIconAt(3, GetIcon("icons/info.png")); |
---|
| 1633 | + tabbedPane.setToolTipTextAt(3, "Information"); |
---|
| 1634 | + |
---|
1576 | 1635 | /* |
---|
1577 | 1636 | cTree jTree = new cTree(null); |
---|
1578 | 1637 | ToolTipManager.sharedInstance().registerComponent(jTree); |
---|
.. | .. |
---|
1675 | 1734 | frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); |
---|
1676 | 1735 | frame.addWindowListener(new WindowAdapter() |
---|
1677 | 1736 | { |
---|
1678 | | - |
---|
1679 | 1737 | public void windowClosing(WindowEvent e) |
---|
1680 | 1738 | { |
---|
1681 | 1739 | Close(); |
---|
.. | .. |
---|
1698 | 1756 | ctrlPanel.removeAll(); |
---|
1699 | 1757 | } |
---|
1700 | 1758 | |
---|
1701 | | - void SetupMaterial(cGridBag panel) |
---|
| 1759 | + void SetupMaterial(cGridBag materialpanel) |
---|
1702 | 1760 | { |
---|
1703 | | - /* |
---|
| 1761 | + cGridBag presetpanel = new cGridBag().setVertical(true); |
---|
| 1762 | + |
---|
| 1763 | + cLabel skin = GetLabel("icons/shadericons/shadericon00000.png", !Grafreed.NIMBUSLAF); |
---|
| 1764 | + skin.setToolTipText("Skin"); |
---|
| 1765 | + skin.addMouseListener(new MouseAdapter() |
---|
| 1766 | + { |
---|
| 1767 | + public void mouseClicked(MouseEvent e) |
---|
| 1768 | + { |
---|
| 1769 | + Object3D object = Grafreed.materials.versionlist[0].get(0); |
---|
| 1770 | + cMaterial material = object.material; |
---|
| 1771 | + |
---|
| 1772 | + // Skin |
---|
| 1773 | + colorField.setFloat(material.color); |
---|
| 1774 | + saturationField.setFloat(material.modulation); |
---|
| 1775 | + subsurfaceField.setFloat(material.subsurface); |
---|
| 1776 | + selfshadowField.setFloat(material.diffuseness); |
---|
| 1777 | + diffusenessField.setFloat(material.factor); |
---|
| 1778 | + shininessField.setFloat(material.shininess); |
---|
| 1779 | + shadowbiasField.setFloat(material.shadowbias); |
---|
| 1780 | + diffuseField.setFloat(material.diffuse); |
---|
| 1781 | + specularField.setFloat(material.specular); |
---|
| 1782 | + |
---|
| 1783 | + bumpField.setFloat(object.projectedVertices[0].x / 1000.0); |
---|
| 1784 | + noiseField.setFloat(object.projectedVertices[0].y / 1000.0); |
---|
| 1785 | + powerField.setFloat(object.projectedVertices[2].x / 1000.0); |
---|
| 1786 | + |
---|
| 1787 | + materialtouched = true; |
---|
| 1788 | + applySelf(); |
---|
| 1789 | + } |
---|
| 1790 | + }); |
---|
| 1791 | + presetpanel.add(skin); |
---|
| 1792 | + |
---|
| 1793 | + cLabel lambert = GetLabel("icons/shadericons/shadericon00002.png", !Grafreed.NIMBUSLAF); |
---|
| 1794 | + lambert.setToolTipText("Diffuse"); |
---|
| 1795 | + lambert.addMouseListener(new MouseAdapter() |
---|
| 1796 | + { |
---|
| 1797 | + public void mouseClicked(MouseEvent e) |
---|
| 1798 | + { |
---|
| 1799 | + Object3D object = Grafreed.materials.versionlist[2].get(0); |
---|
| 1800 | + cMaterial material = object.material; |
---|
| 1801 | + |
---|
| 1802 | + diffusenessField.setFloat(material.factor); |
---|
| 1803 | + selfshadowField.setFloat(material.diffuseness); |
---|
| 1804 | + |
---|
| 1805 | + materialtouched = true; |
---|
| 1806 | + applySelf(); |
---|
| 1807 | + } |
---|
| 1808 | + }); |
---|
| 1809 | + presetpanel.add(lambert); |
---|
| 1810 | + |
---|
| 1811 | + cLabel diffuse2 = GetLabel("icons/shadericons/shadericon00003.png", !Grafreed.NIMBUSLAF); |
---|
| 1812 | + diffuse2.setToolTipText("Diffuse2"); |
---|
| 1813 | + diffuse2.addMouseListener(new MouseAdapter() |
---|
| 1814 | + { |
---|
| 1815 | + public void mouseClicked(MouseEvent e) |
---|
| 1816 | + { |
---|
| 1817 | + Object3D object = Grafreed.materials.versionlist[3].get(0); |
---|
| 1818 | + cMaterial material = object.material; |
---|
| 1819 | + |
---|
| 1820 | + diffusenessField.setFloat(material.factor); |
---|
| 1821 | + selfshadowField.setFloat(material.diffuseness); |
---|
| 1822 | + |
---|
| 1823 | + materialtouched = true; |
---|
| 1824 | + applySelf(); |
---|
| 1825 | + } |
---|
| 1826 | + }); |
---|
| 1827 | + presetpanel.add(diffuse2); |
---|
| 1828 | + |
---|
| 1829 | + cLabel diffusemoon = GetLabel("icons/shadericons/shadericon00004.png", !Grafreed.NIMBUSLAF); |
---|
| 1830 | + diffusemoon.setToolTipText("Moon"); |
---|
| 1831 | + diffusemoon.addMouseListener(new MouseAdapter() |
---|
| 1832 | + { |
---|
| 1833 | + public void mouseClicked(MouseEvent e) |
---|
| 1834 | + { |
---|
| 1835 | + Object3D object = Grafreed.materials.versionlist[4].get(0); |
---|
| 1836 | + cMaterial material = object.material; |
---|
| 1837 | + |
---|
| 1838 | + diffusenessField.setFloat(material.factor); |
---|
| 1839 | + selfshadowField.setFloat(material.diffuseness); |
---|
| 1840 | + |
---|
| 1841 | + materialtouched = true; |
---|
| 1842 | + applySelf(); |
---|
| 1843 | + } |
---|
| 1844 | + }); |
---|
| 1845 | + presetpanel.add(diffusemoon); |
---|
| 1846 | + |
---|
| 1847 | + cLabel diffusemoon2 = GetLabel("icons/shadericons/shadericon00005.png", !Grafreed.NIMBUSLAF); |
---|
| 1848 | + diffusemoon2.setToolTipText("Moon2"); |
---|
| 1849 | + diffusemoon2.addMouseListener(new MouseAdapter() |
---|
| 1850 | + { |
---|
| 1851 | + public void mouseClicked(MouseEvent e) |
---|
| 1852 | + { |
---|
| 1853 | + Object3D object = Grafreed.materials.versionlist[5].get(0); |
---|
| 1854 | + cMaterial material = object.material; |
---|
| 1855 | + |
---|
| 1856 | + diffusenessField.setFloat(material.factor); |
---|
| 1857 | + selfshadowField.setFloat(material.diffuseness); |
---|
| 1858 | + |
---|
| 1859 | + materialtouched = true; |
---|
| 1860 | + applySelf(); |
---|
| 1861 | + } |
---|
| 1862 | + }); |
---|
| 1863 | + presetpanel.add(diffusemoon2); |
---|
| 1864 | + |
---|
| 1865 | + cLabel diffusemoon3 = GetLabel("icons/shadericons/shadericon00006.png", !Grafreed.NIMBUSLAF); |
---|
| 1866 | + diffusemoon3.setToolTipText("Moon3"); |
---|
| 1867 | + diffusemoon3.addMouseListener(new MouseAdapter() |
---|
| 1868 | + { |
---|
| 1869 | + public void mouseClicked(MouseEvent e) |
---|
| 1870 | + { |
---|
| 1871 | + Object3D object = Grafreed.materials.versionlist[6].get(0); |
---|
| 1872 | + cMaterial material = object.material; |
---|
| 1873 | + |
---|
| 1874 | + diffusenessField.setFloat(material.factor); |
---|
| 1875 | + selfshadowField.setFloat(material.diffuseness); |
---|
| 1876 | + |
---|
| 1877 | + materialtouched = true; |
---|
| 1878 | + applySelf(); |
---|
| 1879 | + } |
---|
| 1880 | + }); |
---|
| 1881 | + presetpanel.add(diffusemoon3); |
---|
| 1882 | + |
---|
| 1883 | + cLabel diffusesheen = GetLabel("icons/shadericons/shadericon00007.png", !Grafreed.NIMBUSLAF); |
---|
| 1884 | + diffusesheen.setToolTipText("Sheen"); |
---|
| 1885 | + diffusesheen.addMouseListener(new MouseAdapter() |
---|
| 1886 | + { |
---|
| 1887 | + public void mouseClicked(MouseEvent e) |
---|
| 1888 | + { |
---|
| 1889 | + Object3D object = Grafreed.materials.versionlist[7].get(0); |
---|
| 1890 | + cMaterial material = object.material; |
---|
| 1891 | + |
---|
| 1892 | + sheenField.setFloat(material.sheen); |
---|
| 1893 | + |
---|
| 1894 | + materialtouched = true; |
---|
| 1895 | + applySelf(); |
---|
| 1896 | + } |
---|
| 1897 | + }); |
---|
| 1898 | + presetpanel.add(diffusesheen); |
---|
| 1899 | + |
---|
| 1900 | + cLabel rough = GetLabel("icons/shadericons/shadericon00001.png", !Grafreed.NIMBUSLAF); |
---|
| 1901 | + rough.setToolTipText("Rough metal"); |
---|
| 1902 | + rough.addMouseListener(new MouseAdapter() |
---|
| 1903 | + { |
---|
| 1904 | + public void mouseClicked(MouseEvent e) |
---|
| 1905 | + { |
---|
| 1906 | + Object3D object = Grafreed.materials.versionlist[1].get(0); |
---|
| 1907 | + cMaterial material = object.material; |
---|
| 1908 | + |
---|
| 1909 | + shininessField.setFloat(material.shininess); |
---|
| 1910 | + velvetField.setFloat(material.velvet); |
---|
| 1911 | + |
---|
| 1912 | + materialtouched = true; |
---|
| 1913 | + applySelf(); |
---|
| 1914 | + } |
---|
| 1915 | + }); |
---|
| 1916 | + presetpanel.add(rough); |
---|
| 1917 | + |
---|
| 1918 | + cLabel rough2 = GetLabel("icons/shadericons/shadericon00013.png", !Grafreed.NIMBUSLAF); |
---|
| 1919 | + rough2.setToolTipText("Medium metal"); |
---|
| 1920 | + rough2.addMouseListener(new MouseAdapter() |
---|
| 1921 | + { |
---|
| 1922 | + public void mouseClicked(MouseEvent e) |
---|
| 1923 | + { |
---|
| 1924 | + Object3D object = Grafreed.materials.versionlist[13].get(0); |
---|
| 1925 | + cMaterial material = object.material; |
---|
| 1926 | + |
---|
| 1927 | + shininessField.setFloat(material.shininess); |
---|
| 1928 | + lightareaField.setFloat(material.lightarea); |
---|
| 1929 | + |
---|
| 1930 | + materialtouched = true; |
---|
| 1931 | + applySelf(); |
---|
| 1932 | + } |
---|
| 1933 | + }); |
---|
| 1934 | + presetpanel.add(rough2); |
---|
| 1935 | + |
---|
| 1936 | + cLabel shini0 = GetLabel("icons/shadericons/shadericon00014.png", !Grafreed.NIMBUSLAF); |
---|
| 1937 | + shini0.setToolTipText("Shiny"); |
---|
| 1938 | + shini0.addMouseListener(new MouseAdapter() |
---|
| 1939 | + { |
---|
| 1940 | + public void mouseClicked(MouseEvent e) |
---|
| 1941 | + { |
---|
| 1942 | + Object3D object = Grafreed.materials.versionlist[14].get(0); |
---|
| 1943 | + cMaterial material = object.material; |
---|
| 1944 | + |
---|
| 1945 | + shininessField.setFloat(material.shininess); |
---|
| 1946 | + lightareaField.setFloat(material.lightarea); |
---|
| 1947 | + |
---|
| 1948 | + materialtouched = true; |
---|
| 1949 | + applySelf(); |
---|
| 1950 | + } |
---|
| 1951 | + }); |
---|
| 1952 | + presetpanel.add(shini0); |
---|
| 1953 | + |
---|
| 1954 | + cLabel shini1 = GetLabel("icons/shadericons/shadericon00011.png", !Grafreed.NIMBUSLAF); |
---|
| 1955 | + shini1.setToolTipText("Shiny2"); |
---|
| 1956 | + shini1.addMouseListener(new MouseAdapter() |
---|
| 1957 | + { |
---|
| 1958 | + public void mouseClicked(MouseEvent e) |
---|
| 1959 | + { |
---|
| 1960 | + Object3D object = Grafreed.materials.versionlist[11].get(0); |
---|
| 1961 | + cMaterial material = object.material; |
---|
| 1962 | + |
---|
| 1963 | + shininessField.setFloat(material.shininess); |
---|
| 1964 | + lightareaField.setFloat(material.lightarea); |
---|
| 1965 | + |
---|
| 1966 | + materialtouched = true; |
---|
| 1967 | + applySelf(); |
---|
| 1968 | + } |
---|
| 1969 | + }); |
---|
| 1970 | + presetpanel.add(shini1); |
---|
| 1971 | + |
---|
| 1972 | + cLabel shini2 = GetLabel("icons/shadericons/shadericon00012.png", !Grafreed.NIMBUSLAF); |
---|
| 1973 | + shini2.setToolTipText("Shiny3"); |
---|
| 1974 | + shini2.addMouseListener(new MouseAdapter() |
---|
| 1975 | + { |
---|
| 1976 | + public void mouseClicked(MouseEvent e) |
---|
| 1977 | + { |
---|
| 1978 | + Object3D object = Grafreed.materials.versionlist[12].get(0); |
---|
| 1979 | + cMaterial material = object.material; |
---|
| 1980 | + |
---|
| 1981 | + shininessField.setFloat(material.shininess); |
---|
| 1982 | + lightareaField.setFloat(material.lightarea); |
---|
| 1983 | + |
---|
| 1984 | + materialtouched = true; |
---|
| 1985 | + applySelf(); |
---|
| 1986 | + } |
---|
| 1987 | + }); |
---|
| 1988 | + presetpanel.add(shini2); |
---|
| 1989 | + |
---|
| 1990 | + cLabel aniso = GetLabel("icons/shadericons/shadericon00008.png", !Grafreed.NIMBUSLAF); |
---|
| 1991 | + aniso.setToolTipText("AnisoU"); |
---|
| 1992 | + aniso.addMouseListener(new MouseAdapter() |
---|
| 1993 | + { |
---|
| 1994 | + public void mouseClicked(MouseEvent e) |
---|
| 1995 | + { |
---|
| 1996 | + Object3D object = Grafreed.materials.versionlist[8].get(0); |
---|
| 1997 | + cMaterial material = object.material; |
---|
| 1998 | + |
---|
| 1999 | + anisoField.setFloat(material.aniso); |
---|
| 2000 | + anisoVField.setFloat(material.anisoV); |
---|
| 2001 | + |
---|
| 2002 | + materialtouched = true; |
---|
| 2003 | + applySelf(); |
---|
| 2004 | + } |
---|
| 2005 | + }); |
---|
| 2006 | + presetpanel.add(aniso); |
---|
| 2007 | + |
---|
| 2008 | + cLabel aniso2 = GetLabel("icons/shadericons/shadericon00009.png", !Grafreed.NIMBUSLAF); |
---|
| 2009 | + aniso2.setToolTipText("AnisoV"); |
---|
| 2010 | + aniso2.addMouseListener(new MouseAdapter() |
---|
| 2011 | + { |
---|
| 2012 | + public void mouseClicked(MouseEvent e) |
---|
| 2013 | + { |
---|
| 2014 | + Object3D object = Grafreed.materials.versionlist[9].get(0); |
---|
| 2015 | + cMaterial material = object.material; |
---|
| 2016 | + |
---|
| 2017 | + anisoField.setFloat(material.aniso); |
---|
| 2018 | + anisoVField.setFloat(material.anisoV); |
---|
| 2019 | + |
---|
| 2020 | + materialtouched = true; |
---|
| 2021 | + applySelf(); |
---|
| 2022 | + } |
---|
| 2023 | + }); |
---|
| 2024 | + presetpanel.add(aniso2); |
---|
| 2025 | + |
---|
| 2026 | + cLabel aniso3 = GetLabel("icons/shadericons/shadericon00010.png", !Grafreed.NIMBUSLAF); |
---|
| 2027 | + aniso3.setToolTipText("AnisoUV"); |
---|
| 2028 | + aniso3.addMouseListener(new MouseAdapter() |
---|
| 2029 | + { |
---|
| 2030 | + public void mouseClicked(MouseEvent e) |
---|
| 2031 | + { |
---|
| 2032 | + Object3D object = Grafreed.materials.versionlist[10].get(0); |
---|
| 2033 | + cMaterial material = object.material; |
---|
| 2034 | + |
---|
| 2035 | + anisoField.setFloat(material.aniso); |
---|
| 2036 | + anisoVField.setFloat(material.anisoV); |
---|
| 2037 | + |
---|
| 2038 | + materialtouched = true; |
---|
| 2039 | + applySelf(); |
---|
| 2040 | + } |
---|
| 2041 | + }); |
---|
| 2042 | + presetpanel.add(aniso3); |
---|
| 2043 | + |
---|
| 2044 | + cLabel velvet0 = GetLabel("icons/shadericons/shadericon00015.png", !Grafreed.NIMBUSLAF); |
---|
| 2045 | + velvet0.setToolTipText("Velvet"); |
---|
| 2046 | + velvet0.addMouseListener(new MouseAdapter() |
---|
| 2047 | + { |
---|
| 2048 | + public void mouseClicked(MouseEvent e) |
---|
| 2049 | + { |
---|
| 2050 | + Object3D object = Grafreed.materials.versionlist[15].get(0); |
---|
| 2051 | + cMaterial material = object.material; |
---|
| 2052 | + |
---|
| 2053 | + diffusenessField.setFloat(material.factor); |
---|
| 2054 | + selfshadowField.setFloat(material.diffuseness); |
---|
| 2055 | + sheenField.setFloat(material.sheen); |
---|
| 2056 | + shininessField.setFloat(material.shininess); |
---|
| 2057 | + velvetField.setFloat(material.velvet); |
---|
| 2058 | + shiftField.setFloat(material.shift); |
---|
| 2059 | + |
---|
| 2060 | + materialtouched = true; |
---|
| 2061 | + applySelf(); |
---|
| 2062 | + } |
---|
| 2063 | + }); |
---|
| 2064 | + presetpanel.add(velvet0); |
---|
| 2065 | + |
---|
| 2066 | + cLabel bump0 = GetLabel("icons/shadericons/shadericon00016.png", !Grafreed.NIMBUSLAF); |
---|
| 2067 | + bump0.setToolTipText("Bump texture"); |
---|
| 2068 | + bump0.addMouseListener(new MouseAdapter() |
---|
| 2069 | + { |
---|
| 2070 | + public void mouseClicked(MouseEvent e) |
---|
| 2071 | + { |
---|
| 2072 | + Object3D object = Grafreed.materials.versionlist[16].get(0); |
---|
| 2073 | + cMaterial material = object.material; |
---|
| 2074 | + |
---|
| 2075 | + bumpField.setFloat(object.projectedVertices[0].x / 1000.0); |
---|
| 2076 | + noiseField.setFloat(object.projectedVertices[0].y / 1000.0); |
---|
| 2077 | + powerField.setFloat(object.projectedVertices[2].x / 1000.0); |
---|
| 2078 | + |
---|
| 2079 | + materialtouched = true; |
---|
| 2080 | + applySelf(); |
---|
| 2081 | + } |
---|
| 2082 | + }); |
---|
| 2083 | + presetpanel.add(bump0); |
---|
| 2084 | + |
---|
| 2085 | + cLabel halo = GetLabel("icons/shadericons/shadericon00017.png", !Grafreed.NIMBUSLAF); |
---|
| 2086 | + halo.setToolTipText("Halo"); |
---|
| 2087 | + halo.addMouseListener(new MouseAdapter() |
---|
| 2088 | + { |
---|
| 2089 | + public void mouseClicked(MouseEvent e) |
---|
| 2090 | + { |
---|
| 2091 | + Object3D object = Grafreed.materials.versionlist[17].get(0); |
---|
| 2092 | + cMaterial material = object.material; |
---|
| 2093 | + |
---|
| 2094 | + opacityPowerField.setFloat(object.projectedVertices[2].y / 1000.0); |
---|
| 2095 | + |
---|
| 2096 | + materialtouched = true; |
---|
| 2097 | + applySelf(); |
---|
| 2098 | + } |
---|
| 2099 | + }); |
---|
| 2100 | + presetpanel.add(halo); |
---|
| 2101 | + |
---|
| 2102 | + cLabel candle = GetLabel("icons/shadericons/shadericon00018.png", !Grafreed.NIMBUSLAF); |
---|
| 2103 | + candle.setToolTipText("Candle"); |
---|
| 2104 | + candle.addMouseListener(new MouseAdapter() |
---|
| 2105 | + { |
---|
| 2106 | + public void mouseClicked(MouseEvent e) |
---|
| 2107 | + { |
---|
| 2108 | + Object3D object = Grafreed.materials.versionlist[18].get(0); |
---|
| 2109 | + cMaterial material = object.material; |
---|
| 2110 | + |
---|
| 2111 | + subsurfaceField.setFloat(material.subsurface); |
---|
| 2112 | + shadowbiasField.setFloat(material.shadowbias); |
---|
| 2113 | + ambientField.setFloat(material.ambient); |
---|
| 2114 | + specularField.setFloat(material.specular); |
---|
| 2115 | + lightareaField.setFloat(material.lightarea); |
---|
| 2116 | + shininessField.setFloat(material.shininess); |
---|
| 2117 | + |
---|
| 2118 | + materialtouched = true; |
---|
| 2119 | + applySelf(); |
---|
| 2120 | + } |
---|
| 2121 | + }); |
---|
| 2122 | + presetpanel.add(candle); |
---|
| 2123 | + |
---|
| 2124 | + cGridBag panel = new cGridBag().setVertical(true); |
---|
| 2125 | + |
---|
| 2126 | + presetpanel.preferredWidth = 1; |
---|
| 2127 | + |
---|
| 2128 | + materialpanel.add(presetpanel); |
---|
| 2129 | + materialpanel.add(panel); |
---|
| 2130 | + |
---|
| 2131 | + panel.preferredWidth = 8; |
---|
| 2132 | + |
---|
| 2133 | + /* |
---|
1704 | 2134 | ctrlPanel.add(materialLabel = new JLabel("MATERIAL : "), aConstraints); |
---|
1705 | 2135 | materialLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1706 | | - */ |
---|
| 2136 | + */ |
---|
1707 | 2137 | |
---|
1708 | 2138 | cGridBag editBar = new cGridBag().setVertical(false); |
---|
1709 | 2139 | |
---|
.. | .. |
---|
1737 | 2167 | //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints); |
---|
1738 | 2168 | |
---|
1739 | 2169 | cGridBag colorSection = new cGridBag().setVertical(true); |
---|
| 2170 | + |
---|
| 2171 | + cGridBag huepanel = new cGridBag(); |
---|
| 2172 | + cGridBag huelabel = new cGridBag(); |
---|
| 2173 | + skin = GetLabel("icons/hue.png", false); |
---|
| 2174 | + skin.fit = true; |
---|
| 2175 | + huelabel.add(skin); |
---|
| 2176 | + huelabel.preferredWidth = 20; |
---|
| 2177 | + huepanel.add(new cGridBag()); // Label |
---|
| 2178 | + huepanel.add(huelabel); // Field/slider |
---|
| 2179 | + |
---|
| 2180 | + huepanel.preferredHeight = 7; |
---|
| 2181 | + |
---|
| 2182 | + colorSection.add(huepanel); |
---|
1740 | 2183 | |
---|
1741 | 2184 | 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); |
---|
| 2185 | + |
---|
| 2186 | + color.add(colorLabel = new JLabel("Color/hue")); // , aConstraints); |
---|
| 2187 | + colorLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 2188 | + color.add(colorField = new cNumberSlider(this, 0.001, 1)); // , aConstraints); |
---|
| 2189 | + |
---|
1745 | 2190 | //colorField.preferredWidth = 200; |
---|
1746 | 2191 | colorSection.add(color); |
---|
1747 | 2192 | |
---|
1748 | 2193 | cGridBag modulation = new cGridBag(); |
---|
1749 | 2194 | modulation.add(modulationLabel = new JLabel("Saturation")); // , aConstraints); |
---|
1750 | 2195 | modulationLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1751 | | - modulation.add(modulationField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
| 2196 | + modulation.add(saturationField = new cNumberSlider(this, 0.001, 1)); // , aConstraints); |
---|
1752 | 2197 | colorSection.add(modulation); |
---|
1753 | 2198 | |
---|
| 2199 | + cGridBag opacity = new cGridBag(); |
---|
| 2200 | + opacity.add(opacityLabel = new JLabel("Opacity")); // , aConstraints); |
---|
| 2201 | + opacityLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 2202 | + opacity.add(opacityField = new cNumberSlider(this, 0.001, 1)); // , aConstraints); |
---|
| 2203 | + colorSection.add(opacity); |
---|
| 2204 | + |
---|
| 2205 | + colorSection.add(GetSeparator()); |
---|
| 2206 | + |
---|
1754 | 2207 | cGridBag texture = new cGridBag(); |
---|
1755 | 2208 | texture.add(textureLabel = new JLabel("Texture")); // , aConstraints); |
---|
1756 | 2209 | textureLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1757 | 2210 | texture.add(textureField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
1758 | 2211 | colorSection.add(texture); |
---|
1759 | 2212 | |
---|
1760 | | - panel.add(new JSeparator()); |
---|
| 2213 | + panel.add(GetSeparator()); |
---|
1761 | 2214 | |
---|
1762 | 2215 | panel.add(colorSection); |
---|
1763 | 2216 | |
---|
.. | .. |
---|
1813 | 2266 | shadowbias.add(shadowbiasField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
1814 | 2267 | diffuseSection.add(shadowbias); |
---|
1815 | 2268 | |
---|
1816 | | - panel.add(new JSeparator()); |
---|
| 2269 | + panel.add(GetSeparator()); |
---|
1817 | 2270 | |
---|
1818 | 2271 | panel.add(diffuseSection); |
---|
1819 | 2272 | |
---|
.. | .. |
---|
1876 | 2329 | specularSection.add(anisoV); |
---|
1877 | 2330 | |
---|
1878 | 2331 | |
---|
1879 | | - panel.add(new JSeparator()); |
---|
| 2332 | + panel.add(GetSeparator()); |
---|
1880 | 2333 | |
---|
1881 | 2334 | panel.add(specularSection); |
---|
1882 | 2335 | |
---|
.. | .. |
---|
1901 | 2354 | backlitLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1902 | 2355 | backlit.add(backlitField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
1903 | 2356 | 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 | 2357 | |
---|
1911 | 2358 | //panel.add(new JSeparator()); |
---|
1912 | 2359 | |
---|
.. | .. |
---|
1952 | 2399 | opacityPower.add(opacityPowerField = new cNumberSlider(this, 0.0, 10 /*10 dec 2013*/)); // , aConstraints); |
---|
1953 | 2400 | textureSection.add(opacityPower); |
---|
1954 | 2401 | |
---|
1955 | | - panel.add(new JSeparator()); |
---|
| 2402 | + panel.add(GetSeparator()); |
---|
1956 | 2403 | |
---|
1957 | 2404 | panel.add(textureSection); |
---|
1958 | 2405 | |
---|
.. | .. |
---|
2939 | 3386 | |
---|
2940 | 3387 | freezematerial = true; |
---|
2941 | 3388 | colorField.setFloat(mat.color); |
---|
2942 | | - modulationField.setFloat(mat.modulation); |
---|
| 3389 | + saturationField.setFloat(mat.modulation); |
---|
2943 | 3390 | metalnessField.setFloat(mat.metalness); |
---|
2944 | 3391 | diffuseField.setFloat(mat.diffuse); |
---|
2945 | 3392 | specularField.setFloat(mat.specular); |
---|
.. | .. |
---|
3146 | 3593 | public void itemStateChanged(ItemEvent event) |
---|
3147 | 3594 | { |
---|
3148 | 3595 | // System.out.println("Propagate = " + propagate); |
---|
| 3596 | + if (event.getSource() == pinButton) |
---|
| 3597 | + { |
---|
| 3598 | + copy.pinned ^= true; |
---|
| 3599 | + if (!copy.pinned && !copy.editWindow.copy.selection.contains(copy)) |
---|
| 3600 | + { |
---|
| 3601 | + ((GroupEditor)copy.editWindow).listUI.remove(copy); |
---|
| 3602 | + copy.CloseUI(); |
---|
| 3603 | + //copy.editWindow.refreshContents(); |
---|
| 3604 | + } |
---|
| 3605 | + } |
---|
| 3606 | + else |
---|
3149 | 3607 | if (event.getSource() == propagateToggle) |
---|
3150 | 3608 | { |
---|
3151 | 3609 | propagate ^= true; |
---|
.. | .. |
---|
3250 | 3708 | } else if (event.getSource() == liveCB) |
---|
3251 | 3709 | { |
---|
3252 | 3710 | copy.live ^= true; |
---|
| 3711 | + objEditor.refreshContents(true); // To show item colors |
---|
3253 | 3712 | return; |
---|
3254 | 3713 | } else if (event.getSource() == selectableCB) |
---|
3255 | 3714 | { |
---|
.. | .. |
---|
3259 | 3718 | { |
---|
3260 | 3719 | copy.hide ^= true; |
---|
3261 | 3720 | copy.Touch(); // display list issue |
---|
3262 | | - objEditor.refreshContents(); |
---|
| 3721 | + objEditor.refreshContents(true); // To show item colors |
---|
3263 | 3722 | return; |
---|
3264 | 3723 | } else if (event.getSource() == link2masterCB) |
---|
3265 | 3724 | { |
---|
.. | .. |
---|
3515 | 3974 | |
---|
3516 | 3975 | static public byte[] Compress(Object3D o) |
---|
3517 | 3976 | { |
---|
| 3977 | + // Slower to actually compress. |
---|
3518 | 3978 | try |
---|
3519 | 3979 | { |
---|
3520 | 3980 | ByteArrayOutputStream baos = new ByteArrayOutputStream(); |
---|
.. | .. |
---|
3616 | 4076 | { |
---|
3617 | 4077 | //Save(true); |
---|
3618 | 4078 | Replace(); |
---|
| 4079 | + SetUndoStates(); |
---|
3619 | 4080 | } |
---|
3620 | 4081 | |
---|
3621 | 4082 | private boolean Equal(byte[] compress, byte[] name) |
---|
.. | .. |
---|
3636 | 4097 | |
---|
3637 | 4098 | java.util.Hashtable<java.util.UUID, Object3D> versiontable = new java.util.Hashtable<java.util.UUID, Object3D>(); |
---|
3638 | 4099 | |
---|
| 4100 | + void DeleteVersion() |
---|
| 4101 | + { |
---|
| 4102 | + for (int i = copy.versionindex; i < copy.versionlist.length-1; i++) |
---|
| 4103 | + { |
---|
| 4104 | + copy.versionlist[i] = copy.versionlist[i+1]; |
---|
| 4105 | + } |
---|
| 4106 | + |
---|
| 4107 | + CopyChanged(); |
---|
| 4108 | + |
---|
| 4109 | + SetUndoStates(); |
---|
| 4110 | + } |
---|
| 4111 | + |
---|
3639 | 4112 | public boolean Save(boolean user) |
---|
3640 | 4113 | { |
---|
3641 | 4114 | System.err.println("Save"); |
---|
| 4115 | + //Replace(); |
---|
3642 | 4116 | |
---|
3643 | 4117 | cRadio tab = GetCurrentTab(); |
---|
3644 | 4118 | |
---|
3645 | | - byte[] compress = CompressCopy(); |
---|
| 4119 | + Object3D compress = CompressCopy(); // Saved version. No need for "Replace"? |
---|
3646 | 4120 | |
---|
3647 | 4121 | boolean thesame = false; |
---|
3648 | 4122 | |
---|
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 | | - } |
---|
| 4123 | +// if (copy.versionindex > 0 && copy.versions[copy.versionindex-1] != null && Equal(compress, copy.versions[copy.versionindex-1])) |
---|
| 4124 | +// { |
---|
| 4125 | +// thesame = true; |
---|
| 4126 | +// } |
---|
3654 | 4127 | |
---|
3655 | 4128 | //EditorFrame.m_MainFrame.requestFocusInWindow(); |
---|
3656 | 4129 | if (!thesame) |
---|
3657 | 4130 | { |
---|
| 4131 | + for (int i = copy.versionlist.length; --i > copy.versionindex+1;) |
---|
| 4132 | + { |
---|
| 4133 | + copy.versionlist[i] = copy.versionlist[i-1]; |
---|
| 4134 | + } |
---|
| 4135 | + |
---|
3658 | 4136 | //tab.user[tab.versionindex] = user; |
---|
3659 | 4137 | //boolean increment = true; // tab.graphs[tab.versionindex] == null; |
---|
3660 | 4138 | |
---|
3661 | | - copy.versions[++copy.versionindex] = compress; |
---|
| 4139 | + copy.versionlist[++copy.versionindex] = compress; |
---|
3662 | 4140 | |
---|
3663 | 4141 | // if (increment) |
---|
3664 | 4142 | // tab.versionindex++; |
---|
.. | .. |
---|
3668 | 4146 | |
---|
3669 | 4147 | //assert(hashtable.isEmpty()); |
---|
3670 | 4148 | |
---|
3671 | | - for (int i = copy.versionindex+1; i < copy.versions.length; i++) |
---|
3672 | | - { |
---|
3673 | | - //tab.user[i] = false; |
---|
3674 | | - copy.versions[i] = null; |
---|
3675 | | - } |
---|
| 4149 | +// for (int i = copy.versionindex+1; i < copy.versionlist.length; i++) |
---|
| 4150 | +// { |
---|
| 4151 | +// //tab.user[i] = false; |
---|
| 4152 | +// copy.versionlist[i] = null; |
---|
| 4153 | +// } |
---|
3676 | 4154 | |
---|
3677 | 4155 | SetUndoStates(); |
---|
3678 | 4156 | |
---|
.. | .. |
---|
3697 | 4175 | |
---|
3698 | 4176 | return !thesame; |
---|
3699 | 4177 | } |
---|
3700 | | - |
---|
3701 | | - void CopyChanged(Object3D obj) |
---|
| 4178 | + |
---|
| 4179 | + boolean flashIt = true; |
---|
| 4180 | + |
---|
| 4181 | + void RefreshSelection() |
---|
3702 | 4182 | { |
---|
| 4183 | + Object3D selection = new Object3D(); |
---|
| 4184 | + |
---|
| 4185 | + for (int i = 0; i < copy.selection.size(); i++) |
---|
| 4186 | + { |
---|
| 4187 | + Object3D elem = copy.selection.elementAt(i); |
---|
| 4188 | + |
---|
| 4189 | + Object3D obj = copy.GetObject(elem.GetUUID()); |
---|
| 4190 | + |
---|
| 4191 | + if (obj == null) |
---|
| 4192 | + { |
---|
| 4193 | + copy.selection.remove(i--); |
---|
| 4194 | + } |
---|
| 4195 | + else |
---|
| 4196 | + { |
---|
| 4197 | + selection.add(obj); |
---|
| 4198 | + copy.selection.setElementAt(obj, i); |
---|
| 4199 | + } |
---|
| 4200 | + } |
---|
| 4201 | + |
---|
| 4202 | + flashIt = false; |
---|
| 4203 | + GetTree().clearSelection(); |
---|
| 4204 | + for (int i = 0; i < selection.size(); i++) |
---|
| 4205 | + GetTree().addSelectionPath(selection.elementAt(i).GetTreePath().GetTreePath()); |
---|
| 4206 | + flashIt = true; |
---|
| 4207 | + |
---|
| 4208 | + //refreshContents(false); |
---|
| 4209 | + } |
---|
| 4210 | + |
---|
| 4211 | + void CopyChanged() |
---|
| 4212 | + { |
---|
| 4213 | + Object3D obj = copy.versionlist[copy.versionindex]; |
---|
| 4214 | + |
---|
3703 | 4215 | SetUndoStates(); |
---|
3704 | 4216 | |
---|
3705 | 4217 | boolean temp = CameraPane.SWITCH; |
---|
.. | .. |
---|
3709 | 4221 | |
---|
3710 | 4222 | copy.clear(); |
---|
3711 | 4223 | |
---|
| 4224 | + copy.skyboxname = obj.skyboxname; |
---|
| 4225 | + copy.skyboxext = obj.skyboxext; |
---|
| 4226 | + |
---|
3712 | 4227 | for (int i=0; i<obj.Size(); i++) |
---|
3713 | 4228 | { |
---|
3714 | 4229 | copy.add(obj.get(i)); |
---|
.. | .. |
---|
3718 | 4233 | |
---|
3719 | 4234 | CameraPane.SWITCH = temp; |
---|
3720 | 4235 | |
---|
| 4236 | + RefreshSelection(); |
---|
3721 | 4237 | //assert(hashtable.isEmpty()); |
---|
3722 | 4238 | |
---|
3723 | 4239 | copy.Touch(); |
---|
.. | .. |
---|
3738 | 4254 | } |
---|
3739 | 4255 | } |
---|
3740 | 4256 | |
---|
3741 | | - refreshContents(); |
---|
| 4257 | + refreshContents(true); |
---|
3742 | 4258 | } |
---|
3743 | 4259 | |
---|
3744 | | - cButton undoButton; |
---|
| 4260 | + cButton previousVersionButton; |
---|
3745 | 4261 | cButton restoreButton; |
---|
3746 | 4262 | cButton replaceButton; |
---|
3747 | | - cButton redoButton; |
---|
| 4263 | + cButton nextVersionButton; |
---|
| 4264 | + cButton saveVersionButton; |
---|
| 4265 | + cButton deleteVersionButton; |
---|
3748 | 4266 | |
---|
3749 | 4267 | boolean muteSlider; |
---|
3750 | 4268 | |
---|
.. | .. |
---|
3752 | 4270 | { |
---|
3753 | 4271 | int count = 0; |
---|
3754 | 4272 | |
---|
3755 | | - for (int i = copy.versions.length; --i >= 0;) |
---|
| 4273 | + for (int i = copy.versionlist.length; --i >= 0;) |
---|
3756 | 4274 | { |
---|
3757 | | - if (copy.versions[i] != null) |
---|
| 4275 | + if (copy.versionlist[i] != null) |
---|
3758 | 4276 | count++; |
---|
3759 | 4277 | } |
---|
3760 | 4278 | |
---|
.. | .. |
---|
3765 | 4283 | { |
---|
3766 | 4284 | cRadio tab = GetCurrentTab(); |
---|
3767 | 4285 | |
---|
3768 | | - restoreButton.setEnabled(copy.versionindex != -1); |
---|
3769 | | - replaceButton.setEnabled(copy.versionindex != -1); |
---|
| 4286 | + restoreButton.setEnabled(true); // copy.versionindex != -1); |
---|
| 4287 | + replaceButton.setEnabled(true); // copy.versionindex != -1); |
---|
3770 | 4288 | |
---|
3771 | | - undoButton.setEnabled(copy.versionindex > 0); |
---|
3772 | | - redoButton.setEnabled(copy.versions[copy.versionindex + 1] != null); |
---|
| 4289 | + previousVersionButton.setEnabled(copy.versionindex > 0); |
---|
| 4290 | + nextVersionButton.setEnabled(copy.versionlist[copy.versionindex + 1] != null); |
---|
| 4291 | + |
---|
| 4292 | + deleteVersionButton.setEnabled(//copy.versionindex > 0 && |
---|
| 4293 | + copy.versionlist[copy.versionindex + 1] != null); |
---|
3773 | 4294 | |
---|
3774 | 4295 | muteSlider = true; |
---|
3775 | 4296 | versionSlider.setMaximum(VersionCount() - 1); |
---|
.. | .. |
---|
3777 | 4298 | muteSlider = false; |
---|
3778 | 4299 | } |
---|
3779 | 4300 | |
---|
3780 | | - public boolean Undo() |
---|
| 4301 | + public boolean PreviousVersion() |
---|
3781 | 4302 | { |
---|
3782 | 4303 | // Option? |
---|
3783 | 4304 | Replace(); |
---|
.. | .. |
---|
3807 | 4328 | |
---|
3808 | 4329 | copy.versionindex -= 1; |
---|
3809 | 4330 | |
---|
3810 | | - CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex])); |
---|
| 4331 | + CopyChanged(); |
---|
3811 | 4332 | |
---|
3812 | 4333 | return true; |
---|
3813 | 4334 | } |
---|
.. | .. |
---|
3818 | 4339 | |
---|
3819 | 4340 | cRadio tab = GetCurrentTab(); |
---|
3820 | 4341 | |
---|
3821 | | - if (copy.versionindex == -1 || copy.versions[copy.versionindex] == null) |
---|
| 4342 | + if (copy.versionindex == -1 || copy.versionlist[copy.versionindex] == null) |
---|
3822 | 4343 | { |
---|
3823 | 4344 | java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
3824 | 4345 | return false; |
---|
3825 | 4346 | } |
---|
3826 | 4347 | |
---|
3827 | | - CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex])); |
---|
| 4348 | + //CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex])); |
---|
| 4349 | + CopyChanged(); |
---|
3828 | 4350 | |
---|
3829 | 4351 | return true; |
---|
3830 | 4352 | } |
---|
.. | .. |
---|
3835 | 4357 | |
---|
3836 | 4358 | cRadio tab = GetCurrentTab(); |
---|
3837 | 4359 | |
---|
3838 | | - if (copy.versionindex == -1 || copy.versions[copy.versionindex] == null) |
---|
| 4360 | + if (copy.versionindex == -1 || copy.versionlist[copy.versionindex] == null) |
---|
3839 | 4361 | { |
---|
3840 | 4362 | // No version yet. OK. java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
3841 | 4363 | return false; |
---|
3842 | 4364 | } |
---|
3843 | 4365 | |
---|
3844 | | - copy.versions[copy.versionindex] = CompressCopy(); |
---|
| 4366 | + copy.versionlist[copy.versionindex] = CompressCopy(); |
---|
3845 | 4367 | |
---|
3846 | 4368 | return true; |
---|
3847 | 4369 | } |
---|
3848 | 4370 | |
---|
3849 | | - public void Redo() |
---|
| 4371 | + public void NextVersion() |
---|
3850 | 4372 | { |
---|
3851 | 4373 | // Option? |
---|
3852 | 4374 | Replace(); |
---|
3853 | 4375 | |
---|
3854 | 4376 | cRadio tab = GetCurrentTab(); |
---|
3855 | 4377 | |
---|
3856 | | - if (copy.versions[copy.versionindex + 1] == null) |
---|
| 4378 | + if (copy.versionlist[copy.versionindex + 1] == null) |
---|
3857 | 4379 | { |
---|
3858 | 4380 | java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
3859 | 4381 | return; |
---|
.. | .. |
---|
3861 | 4383 | |
---|
3862 | 4384 | copy.versionindex += 1; |
---|
3863 | 4385 | |
---|
3864 | | - CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex])); |
---|
| 4386 | + CopyChanged(); |
---|
3865 | 4387 | |
---|
3866 | 4388 | //if (!tab.user[tab.versionindex]) |
---|
3867 | 4389 | // tab.graphs[tab.versionindex] = null; |
---|
.. | .. |
---|
4075 | 4597 | //copy.material = new cMaterial(copy.GetMaterial()); |
---|
4076 | 4598 | |
---|
4077 | 4599 | current.color = (float) colorField.getFloat(); |
---|
4078 | | - current.modulation = (float) modulationField.getFloat(); |
---|
| 4600 | + current.modulation = (float) saturationField.getFloat(); |
---|
4079 | 4601 | current.metalness = (float) metalnessField.getFloat(); |
---|
4080 | 4602 | current.diffuse = (float) diffuseField.getFloat(); |
---|
4081 | 4603 | current.specular = (float) specularField.getFloat(); |
---|
.. | .. |
---|
4108 | 4630 | cMaterial mat = copy.material; |
---|
4109 | 4631 | |
---|
4110 | 4632 | colorField.SetToolTipValue((mat.color)); |
---|
4111 | | - modulationField.SetToolTipValue((mat.modulation)); |
---|
| 4633 | + saturationField.SetToolTipValue((mat.modulation)); |
---|
4112 | 4634 | metalnessField.SetToolTipValue((mat.metalness)); |
---|
4113 | 4635 | diffuseField.SetToolTipValue((mat.diffuse)); |
---|
4114 | 4636 | specularField.SetToolTipValue((mat.specular)); |
---|
.. | .. |
---|
4172 | 4694 | |
---|
4173 | 4695 | int version = versionSlider.getInteger(); |
---|
4174 | 4696 | |
---|
4175 | | - if (copy.versions[version] != null) |
---|
| 4697 | + if (copy.versionlist[version] != null) |
---|
4176 | 4698 | { |
---|
4177 | | - CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex = version])); |
---|
| 4699 | + copy.versionindex = version; |
---|
| 4700 | + CopyChanged(); |
---|
4178 | 4701 | } |
---|
4179 | 4702 | |
---|
4180 | 4703 | return; |
---|
.. | .. |
---|
4214 | 4737 | { |
---|
4215 | 4738 | //System.out.println("stateChanged = " + this); |
---|
4216 | 4739 | materialtouched = true; |
---|
| 4740 | + |
---|
| 4741 | + if (e.getSource() == colorField && saturationField.getFloat() == 0.001) |
---|
| 4742 | + { |
---|
| 4743 | + saturationField.setFloat(1); |
---|
| 4744 | + } |
---|
| 4745 | + |
---|
4217 | 4746 | applySelf(); |
---|
4218 | 4747 | //System.out.println("this = " + this); |
---|
4219 | 4748 | //System.out.println("PARENT = " + parent); |
---|
.. | .. |
---|
4513 | 5042 | { |
---|
4514 | 5043 | if (GetTree() != null) |
---|
4515 | 5044 | { |
---|
| 5045 | + GetTree().revalidate(); |
---|
4516 | 5046 | GetTree().repaint(); |
---|
4517 | 5047 | } |
---|
4518 | 5048 | |
---|
.. | .. |
---|
4521 | 5051 | ctrlPanel.validate(); // ? new |
---|
4522 | 5052 | ctrlPanel.repaint(); |
---|
4523 | 5053 | } |
---|
| 5054 | + |
---|
| 5055 | + if (previousVersionButton != null && copy.versionlist != null) |
---|
| 5056 | + SetUndoStates(); |
---|
4524 | 5057 | } |
---|
4525 | 5058 | |
---|
4526 | 5059 | static TweenManager tweenManager = new TweenManager(); |
---|
.. | .. |
---|
4769 | 5302 | readobj.ResetDisplayList(); |
---|
4770 | 5303 | } catch (Exception e) |
---|
4771 | 5304 | { |
---|
4772 | | - //e.printStackTrace(); |
---|
| 5305 | + if (!e.toString().contains("GZIP")) |
---|
| 5306 | + e.printStackTrace(); |
---|
| 5307 | + |
---|
4773 | 5308 | try |
---|
4774 | 5309 | { |
---|
4775 | 5310 | java.io.FileInputStream istream = new java.io.FileInputStream(fullname); |
---|
.. | .. |
---|
4849 | 5384 | { |
---|
4850 | 5385 | //readobj.deepCopySelf(copy); |
---|
4851 | 5386 | copy.clear(); // june 2014 |
---|
| 5387 | + copy.skyboxname = readobj.skyboxname; |
---|
| 5388 | + copy.skyboxext = readobj.skyboxext; |
---|
4852 | 5389 | for (int i = 0; i < readobj.size(); i++) |
---|
4853 | 5390 | { |
---|
4854 | 5391 | Object3D child = readobj.get(i); // reserve(i); |
---|
.. | .. |
---|
4889 | 5426 | } |
---|
4890 | 5427 | } catch (ClassCastException e) |
---|
4891 | 5428 | { |
---|
| 5429 | + e.printStackTrace(); |
---|
4892 | 5430 | assert (false); |
---|
4893 | 5431 | Composite c = (Composite) copy; |
---|
4894 | 5432 | c.children.clear(); |
---|
.. | .. |
---|
4899 | 5437 | c.addChild(csg); |
---|
4900 | 5438 | } |
---|
4901 | 5439 | |
---|
4902 | | - copy.versions = readobj.versions; |
---|
| 5440 | + copy.versionlist = readobj.versionlist; |
---|
4903 | 5441 | copy.versionindex = readobj.versionindex; |
---|
4904 | 5442 | |
---|
4905 | | - if (copy.versions == null) |
---|
| 5443 | + if (copy.versionlist == null) |
---|
4906 | 5444 | { |
---|
4907 | | - copy.versions = new byte[100][]; |
---|
| 5445 | + copy.versionlist = new Object3D[100]; |
---|
4908 | 5446 | copy.versionindex = -1; |
---|
4909 | 5447 | } |
---|
4910 | 5448 | |
---|
.. | .. |
---|
4920 | 5458 | { |
---|
4921 | 5459 | if (Grafreed.standAlone) |
---|
4922 | 5460 | { |
---|
4923 | | - FileDialog browser = new FileDialog(frame, "Load", FileDialog.LOAD); |
---|
| 5461 | + FileDialog browser = new FileDialog(frame, "Open", FileDialog.LOAD); |
---|
4924 | 5462 | browser.show(); |
---|
4925 | 5463 | String filename = browser.getFile(); |
---|
4926 | 5464 | if (filename != null && filename.length() > 0) |
---|
.. | .. |
---|
5019 | 5557 | //ps.print(buffer.toString()); |
---|
5020 | 5558 | } catch (IOException e) |
---|
5021 | 5559 | { |
---|
| 5560 | + e.printStackTrace(); |
---|
5022 | 5561 | } |
---|
5023 | 5562 | } |
---|
5024 | 5563 | |
---|
.. | .. |
---|
5238 | 5777 | ButtonGroup buttonGroup; |
---|
5239 | 5778 | |
---|
5240 | 5779 | cGridBag toolboxPanel; |
---|
| 5780 | + cGridBag skyboxPanel; |
---|
5241 | 5781 | cGridBag materialPanel; |
---|
5242 | 5782 | cGridBag ctrlPanel; |
---|
5243 | 5783 | |
---|
.. | .. |
---|
5311 | 5851 | JLabel colorLabel; |
---|
5312 | 5852 | cNumberSlider colorField; |
---|
5313 | 5853 | JLabel modulationLabel; |
---|
5314 | | - cNumberSlider modulationField; |
---|
| 5854 | + cNumberSlider saturationField; |
---|
5315 | 5855 | JLabel metalnessLabel; |
---|
5316 | 5856 | cNumberSlider metalnessField; |
---|
5317 | 5857 | JLabel diffuseLabel; |
---|