.. | .. |
---|
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 void AllocProjectedVertices(Object3D object) |
---|
| 47 | + { |
---|
| 48 | + assert (object.projectedVertices != null); |
---|
| 49 | + |
---|
| 50 | + if (object.projectedVertices.length <= 2) |
---|
| 51 | + { |
---|
| 52 | + // Side effect... |
---|
| 53 | + Object3D.cVector2[] keep = object.projectedVertices; |
---|
| 54 | + object.projectedVertices = new Object3D.cVector2[3]; |
---|
| 55 | + for (int i = 0; i < 3; i++) |
---|
| 56 | + { |
---|
| 57 | + if (i < keep.length) |
---|
| 58 | + { |
---|
| 59 | + object.projectedVertices[i] = keep[i]; |
---|
| 60 | + } else |
---|
| 61 | + { |
---|
| 62 | + object.projectedVertices[i] = new Object3D.cVector2(); |
---|
| 63 | + } |
---|
| 64 | + /* |
---|
| 65 | + if(keep.length == 0) |
---|
| 66 | + object.projectedVertices[0] = new Object3D.cVector2(); |
---|
| 67 | + else |
---|
| 68 | + object.projectedVertices[0] = keep[0]; |
---|
| 69 | + object.projectedVertices[1] = new Object3D.cVector2(); |
---|
| 70 | + */ |
---|
| 71 | + } |
---|
| 72 | + } |
---|
| 73 | + } |
---|
44 | 74 | |
---|
45 | 75 | public cGridBag GetSeparator() |
---|
46 | 76 | { |
---|
.. | .. |
---|
74 | 104 | return new cCheckBox(icon, border); |
---|
75 | 105 | } |
---|
76 | 106 | |
---|
| 107 | + static java.util.Hashtable<String, javax.swing.ImageIcon> icons = new java.util.Hashtable<String, javax.swing.ImageIcon>(); |
---|
| 108 | + |
---|
77 | 109 | ImageIcon GetIcon(String name) |
---|
78 | 110 | { |
---|
| 111 | + javax.swing.ImageIcon iconCache = icons.get(name); |
---|
| 112 | + if (iconCache != null) |
---|
| 113 | + { |
---|
| 114 | + return iconCache; |
---|
| 115 | + } |
---|
| 116 | + |
---|
79 | 117 | try |
---|
80 | 118 | { |
---|
81 | 119 | BufferedImage image = javax.imageio.ImageIO.read(getClass().getClassLoader().getResourceAsStream(name)); |
---|
.. | .. |
---|
93 | 131 | // } |
---|
94 | 132 | |
---|
95 | 133 | javax.swing.ImageIcon icon = new javax.swing.ImageIcon(image); |
---|
| 134 | + |
---|
| 135 | + icons.put(name, icon); |
---|
| 136 | + |
---|
96 | 137 | return icon; |
---|
97 | 138 | } |
---|
98 | 139 | catch (Exception e) |
---|
99 | 140 | { |
---|
| 141 | + //icons.put(name, null); |
---|
100 | 142 | return null; |
---|
101 | 143 | } |
---|
102 | 144 | } |
---|
.. | .. |
---|
296 | 338 | client = inClient; |
---|
297 | 339 | copy = client; |
---|
298 | 340 | |
---|
299 | | - if (copy.versionlist == null) |
---|
300 | | - { |
---|
301 | | - copy.versionlist = new Object3D[100]; |
---|
302 | | - copy.versionindex = -1; |
---|
303 | | - } |
---|
| 341 | +// if (copy.versionlist == null) |
---|
| 342 | +// { |
---|
| 343 | +// copy.versionlist = new Object3D[100]; |
---|
| 344 | +// copy.versionindex = -1; |
---|
| 345 | +// |
---|
| 346 | +// callee.Save(true); |
---|
| 347 | +// } |
---|
304 | 348 | |
---|
305 | 349 | // "this" is not called: SetupUI2(objEditor); |
---|
306 | 350 | } |
---|
.. | .. |
---|
319 | 363 | { |
---|
320 | 364 | copy.versionlist = new Object3D[100]; |
---|
321 | 365 | copy.versionindex = -1; |
---|
| 366 | + |
---|
| 367 | +// Save(true); |
---|
322 | 368 | } |
---|
323 | 369 | |
---|
324 | 370 | SetupUI2(callee.GetEditor()); |
---|
.. | .. |
---|
353 | 399 | copy = localCopy; |
---|
354 | 400 | copy.editWindow = this; |
---|
355 | 401 | |
---|
356 | | - if (copy.versionlist == null) |
---|
357 | | - { |
---|
358 | | -// copy.versions = new byte[100][]; |
---|
| 402 | +// if (copy.versionlist == null) |
---|
| 403 | +// { |
---|
| 404 | +// copy.versionlist = new Object3D[100]; |
---|
359 | 405 | // copy.versionindex = -1; |
---|
360 | | - } |
---|
| 406 | +// |
---|
| 407 | +// Save(true); |
---|
| 408 | +// } |
---|
361 | 409 | |
---|
362 | 410 | SetupMenu(); |
---|
363 | 411 | |
---|
.. | .. |
---|
426 | 474 | |
---|
427 | 475 | ChangeListener changeListener = new ChangeListener() |
---|
428 | 476 | { |
---|
| 477 | + //String name; |
---|
| 478 | + |
---|
429 | 479 | public void stateChanged(ChangeEvent changeEvent) |
---|
430 | 480 | { |
---|
431 | 481 | // if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Material") && !materialFlushed) |
---|
.. | .. |
---|
444 | 494 | // EditSelection(false); |
---|
445 | 495 | // } |
---|
446 | 496 | |
---|
447 | | - refreshContents(false); // To refresh Info tab |
---|
| 497 | +// if (objectPanel.getSelectedIndex() == 4) |
---|
| 498 | +// { |
---|
| 499 | +// name = copy.skyboxname; |
---|
| 500 | +// |
---|
| 501 | +// if (name == null) |
---|
| 502 | +// { |
---|
| 503 | +// name = ""; |
---|
| 504 | +// } |
---|
| 505 | +// |
---|
| 506 | +// copy.skyboxname = "cubemaps/default-skyboxes/rgb"; |
---|
| 507 | +// copy.skyboxext = "jpg"; |
---|
| 508 | +// } |
---|
| 509 | +// else |
---|
| 510 | +// { |
---|
| 511 | +// if (name != null) |
---|
| 512 | +// { |
---|
| 513 | +// if (name.equals("")) |
---|
| 514 | +// { |
---|
| 515 | +// copy.skyboxname = null; |
---|
| 516 | +// copy.skyboxext = null; |
---|
| 517 | +// } |
---|
| 518 | +// else |
---|
| 519 | +// { |
---|
| 520 | +// copy.skyboxname = name; |
---|
| 521 | +// } |
---|
| 522 | +// } |
---|
| 523 | +// } |
---|
| 524 | + cameraView.transformMode = objectPanel.getSelectedIndex() == 4; |
---|
| 525 | + |
---|
| 526 | +// refreshContents(false); // To refresh Info tab |
---|
| 527 | + cameraView.repaint(); |
---|
448 | 528 | } |
---|
449 | 529 | }; |
---|
450 | 530 | objectPanel.addChangeListener(changeListener); |
---|
.. | .. |
---|
466 | 546 | |
---|
467 | 547 | toolboxPanel = new cGridBag().setVertical(true); |
---|
468 | 548 | //toolboxPanel.setName("Toolbox"); |
---|
| 549 | + |
---|
| 550 | + skyboxPanel = new cGridBag().setVertical(true); |
---|
469 | 551 | |
---|
470 | 552 | materialPanel = new cGridBag().setVertical(false); |
---|
471 | 553 | //materialPanel.setName("Material"); |
---|
.. | .. |
---|
751 | 833 | boolean maximized; |
---|
752 | 834 | |
---|
753 | 835 | cButton fullscreenLayout; |
---|
| 836 | + cButton expandedLayout; |
---|
754 | 837 | |
---|
755 | 838 | void Minimize() |
---|
756 | 839 | { |
---|
.. | .. |
---|
790 | 873 | cButton minButton; |
---|
791 | 874 | cButton maxButton; |
---|
792 | 875 | cButton fullButton; |
---|
| 876 | + cButton collapseButton; |
---|
| 877 | + cButton maximize3DButton; |
---|
793 | 878 | |
---|
794 | 879 | void ToggleFullScreen() |
---|
795 | 880 | { |
---|
796 | | -GraphicsDevice device = frame.getGraphicsConfiguration().getDevice(); |
---|
| 881 | + GraphicsDevice device = frame.getGraphicsConfiguration().getDevice(); |
---|
797 | 882 | |
---|
798 | 883 | cameraView.ToggleFullScreen(); |
---|
799 | 884 | |
---|
.. | .. |
---|
814 | 899 | // X frame.getContentPane().remove(/*"Center",*/bigThree); |
---|
815 | 900 | // X framePanel.add(bigThree); |
---|
816 | 901 | // X frame.getContentPane().add(/*"Center",*/framePanel); |
---|
817 | | - framePanel.setDividerLocation(46); |
---|
| 902 | +// framePanel.setDividerLocation(46); // icons are 24x24 |
---|
818 | 903 | |
---|
819 | 904 | //frame.setVisible(true); |
---|
820 | | - radio.layout = keepButton; |
---|
| 905 | +// radio.layout = keepButton; |
---|
821 | 906 | //theFrame = null; |
---|
822 | 907 | keepButton = null; |
---|
823 | | - radio.layout.doClick(); |
---|
| 908 | +// radio.layout.doClick(); |
---|
824 | 909 | |
---|
825 | 910 | } else |
---|
826 | 911 | { |
---|
.. | .. |
---|
841 | 926 | // X frame.getContentPane().remove(/*"Center",*/framePanel); |
---|
842 | 927 | // X framePanel.remove(bigThree); |
---|
843 | 928 | // X frame.getContentPane().add(/*"Center",*/bigThree); |
---|
844 | | - framePanel.setDividerLocation(0); |
---|
| 929 | +// framePanel.setDividerLocation(0); |
---|
845 | 930 | |
---|
846 | | - radio.layout = fullscreenLayout; |
---|
847 | | - radio.layout.doClick(); |
---|
| 931 | +// radio.layout = fullscreenLayout; |
---|
| 932 | +// radio.layout.doClick(); |
---|
848 | 933 | //frame.setVisible(true); |
---|
849 | 934 | } |
---|
850 | 935 | frame.validate(); |
---|
| 936 | + |
---|
| 937 | + cameraView.requestFocusInWindow(); |
---|
851 | 938 | } |
---|
852 | 939 | |
---|
853 | | - private Object3D CompressCopy() |
---|
| 940 | + void CollapseToolbar() |
---|
| 941 | + { |
---|
| 942 | + framePanel.setDividerLocation(0); |
---|
| 943 | + //frame.validate(); |
---|
| 944 | + |
---|
| 945 | + cameraView.requestFocusInWindow(); |
---|
| 946 | + } |
---|
| 947 | + |
---|
| 948 | + private Object3D Duplicate(Object3D object) |
---|
854 | 949 | { |
---|
855 | 950 | boolean temp = CameraPane.SWITCH; |
---|
856 | 951 | CameraPane.SWITCH = false; |
---|
857 | 952 | |
---|
858 | | - copy.ExtractBigData(versiontable); |
---|
| 953 | + object.ExtractBigData(versiontable); |
---|
859 | 954 | // if (copy == client) |
---|
860 | 955 | |
---|
861 | | - Object3D versions[] = copy.versionlist; |
---|
862 | | - copy.versionlist = null; |
---|
| 956 | + Object3D versions[] = object.versionlist; |
---|
| 957 | + object.versionlist = null; |
---|
863 | 958 | |
---|
864 | 959 | //byte[] compress = Compress(copy); |
---|
865 | | - Object3D compress = (Object3D)Grafreed.clone(copy); |
---|
| 960 | + Object3D compress = (Object3D)Grafreed.clone(object); |
---|
866 | 961 | |
---|
867 | | - copy.versionlist = versions; |
---|
| 962 | + object.versionlist = versions; |
---|
868 | 963 | |
---|
869 | | - copy.RestoreBigData(versiontable); |
---|
| 964 | + object.RestoreBigData(versiontable); |
---|
870 | 965 | |
---|
871 | 966 | CameraPane.SWITCH = temp; |
---|
872 | 967 | |
---|
.. | .. |
---|
1203 | 1298 | |
---|
1204 | 1299 | namePanel = new cGridBag(); |
---|
1205 | 1300 | |
---|
| 1301 | + //if (copy.pinned) |
---|
| 1302 | + { |
---|
| 1303 | + pinButton = GetToggleButton("icons/pin.png", !Grafreed.NIMBUSLAF); |
---|
| 1304 | + pinButton.setSelected(copy.pinned); |
---|
| 1305 | + cGridBag t = new cGridBag(); |
---|
| 1306 | + t.preferredWidth = 2; |
---|
| 1307 | + t.add(pinButton); |
---|
| 1308 | + namePanel.add(t); |
---|
| 1309 | + |
---|
| 1310 | + pinButton.addItemListener(this); |
---|
| 1311 | + } |
---|
| 1312 | + |
---|
1206 | 1313 | nameField = AddText(namePanel, copy.GetName()); |
---|
1207 | 1314 | namePanel.add(new JScrollPane(nameField, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER)); |
---|
1208 | 1315 | oe.ctrlPanel.add(namePanel); |
---|
.. | .. |
---|
1554 | 1661 | objectPanel.setIconAt(0, GetIcon("icons/material.png")); |
---|
1555 | 1662 | objectPanel.setToolTipTextAt(0, "Material"); |
---|
1556 | 1663 | |
---|
| 1664 | + objectPanel.add(toolboxPanel); |
---|
| 1665 | + objectPanel.setIconAt(1, GetIcon("icons/primitives.png")); |
---|
| 1666 | + objectPanel.setToolTipTextAt(1, "Objects & textures"); |
---|
| 1667 | + |
---|
| 1668 | + objectPanel.add(skyboxPanel); |
---|
| 1669 | + objectPanel.setIconAt(2, GetIcon("icons/skybox.jpg")); |
---|
| 1670 | + objectPanel.setToolTipTextAt(2, "Backgrounds"); |
---|
| 1671 | + |
---|
1557 | 1672 | // JPanel north = new JPanel(new BorderLayout()); |
---|
1558 | 1673 | // north.setName("Edit"); |
---|
1559 | 1674 | // north.add(ctrlPanel, BorderLayout.NORTH); |
---|
1560 | 1675 | // objectPanel.add(north); |
---|
1561 | 1676 | objectPanel.add(editPanel); |
---|
1562 | | - objectPanel.setIconAt(1, GetIcon("icons/write.png")); |
---|
1563 | | - objectPanel.setToolTipTextAt(1, "Edit controls"); |
---|
1564 | | - |
---|
1565 | | - //if (Globals.ADVANCED) |
---|
1566 | | - objectPanel.add(infoPanel); |
---|
1567 | | - objectPanel.setIconAt(2, GetIcon("icons/info.png")); |
---|
1568 | | - objectPanel.setToolTipTextAt(2, "Information"); |
---|
| 1677 | + objectPanel.setIconAt(3, GetIcon("icons/write.png")); |
---|
| 1678 | + objectPanel.setToolTipTextAt(3, "Edit controls"); |
---|
1569 | 1679 | |
---|
1570 | 1680 | objectPanel.add(XYZPanel); |
---|
1571 | | - objectPanel.setIconAt(3, GetIcon("icons/XYZ.png")); |
---|
1572 | | - objectPanel.setToolTipTextAt(3, "XYZ/RGB transform"); |
---|
| 1681 | + objectPanel.setIconAt(4, GetIcon("icons/XYZ.png")); |
---|
| 1682 | + objectPanel.setToolTipTextAt(4, "XYZ/RGB transform"); |
---|
1573 | 1683 | |
---|
1574 | | - objectPanel.add(toolboxPanel); |
---|
1575 | | - objectPanel.setIconAt(4, GetIcon("icons/primitives.png")); |
---|
1576 | | - objectPanel.setToolTipTextAt(4, "Objects & backgrounds"); |
---|
1577 | | - |
---|
1578 | 1684 | /* |
---|
1579 | 1685 | aConstraints.gridx = 0; |
---|
1580 | 1686 | aConstraints.gridwidth = 1; |
---|
.. | .. |
---|
1611 | 1717 | |
---|
1612 | 1718 | scenePanel.add(tabbedPane); |
---|
1613 | 1719 | |
---|
| 1720 | + //if (Globals.ADVANCED) |
---|
| 1721 | +// tabbedPane.add(infoPanel); |
---|
| 1722 | +// tabbedPane.setIconAt(3, GetIcon("icons/info.png")); |
---|
| 1723 | +// tabbedPane.setToolTipTextAt(3, "Information"); |
---|
| 1724 | + |
---|
1614 | 1725 | /* |
---|
1615 | 1726 | cTree jTree = new cTree(null); |
---|
1616 | 1727 | ToolTipManager.sharedInstance().registerComponent(jTree); |
---|
.. | .. |
---|
1681 | 1792 | // aConstraints.gridheight = 1; |
---|
1682 | 1793 | |
---|
1683 | 1794 | framePanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, toolbarPanel, bigThree); |
---|
| 1795 | + |
---|
| 1796 | + framePanel.addPropertyChangeListener(JSplitPane.DIVIDER_LOCATION_PROPERTY, |
---|
| 1797 | + new java.beans.PropertyChangeListener() |
---|
| 1798 | + { |
---|
| 1799 | + public void propertyChange(java.beans.PropertyChangeEvent pce) |
---|
| 1800 | + { |
---|
| 1801 | + if ((Integer)pce.getOldValue() == 1) |
---|
| 1802 | + { |
---|
| 1803 | + if (radio.layout != expandedLayout) |
---|
| 1804 | + { |
---|
| 1805 | + radio.layout = expandedLayout; |
---|
| 1806 | + radio.layout.doClick(); |
---|
| 1807 | + } |
---|
| 1808 | + } |
---|
| 1809 | + } |
---|
| 1810 | + }); |
---|
| 1811 | + |
---|
1684 | 1812 | framePanel.setContinuousLayout(false); |
---|
1685 | 1813 | framePanel.setOneTouchExpandable(false); |
---|
1686 | 1814 | //.setDividerLocation(0.8); |
---|
.. | .. |
---|
1690 | 1818 | |
---|
1691 | 1819 | frame.getContentPane().setLayout(new BorderLayout()); |
---|
1692 | 1820 | /**/ |
---|
1693 | | - JTabbedPane worldPane = new JTabbedPane(); |
---|
| 1821 | + //JTabbedPane worldPane = new JTabbedPane(); |
---|
1694 | 1822 | //worldPane.add(bigPanel); |
---|
1695 | 1823 | //worldPane.add(worldPanel); |
---|
1696 | 1824 | /**/ |
---|
.. | .. |
---|
1738 | 1866 | void SetupMaterial(cGridBag materialpanel) |
---|
1739 | 1867 | { |
---|
1740 | 1868 | cGridBag presetpanel = new cGridBag().setVertical(true); |
---|
1741 | | - cLabel label = GetLabel("icons/shadericons/shadericon00000.png", !Grafreed.NIMBUSLAF); |
---|
1742 | | - label.addMouseListener(new MouseAdapter() |
---|
| 1869 | + |
---|
| 1870 | + cLabel skin = GetLabel("icons/shadericons/shadericon00000.png", !Grafreed.NIMBUSLAF); |
---|
| 1871 | + skin.setToolTipText("Skin"); |
---|
| 1872 | + skin.addMouseListener(new MouseAdapter() |
---|
1743 | 1873 | { |
---|
1744 | 1874 | public void mouseClicked(MouseEvent e) |
---|
1745 | 1875 | { |
---|
1746 | | - colorField.setFloat(0); |
---|
1747 | | - saturationField.setFloat(1); |
---|
| 1876 | + Object3D object = Grafreed.materials.versionlist[0].get(0); |
---|
| 1877 | + cMaterial material = object.material; |
---|
| 1878 | + |
---|
| 1879 | + // Skin |
---|
| 1880 | + colorField.setFloat(material.color); |
---|
| 1881 | + saturationField.setFloat(material.modulation); |
---|
| 1882 | + subsurfaceField.setFloat(material.subsurface); |
---|
| 1883 | + selfshadowField.setFloat(material.diffuseness); |
---|
| 1884 | + diffusenessField.setFloat(material.factor); |
---|
| 1885 | + shininessField.setFloat(material.shininess); |
---|
| 1886 | + shadowbiasField.setFloat(material.shadowbias); |
---|
| 1887 | + diffuseField.setFloat(material.diffuse); |
---|
| 1888 | + specularField.setFloat(material.specular); |
---|
| 1889 | + |
---|
| 1890 | + bumpField.setFloat(object.projectedVertices[0].x / 1000.0); |
---|
| 1891 | + noiseField.setFloat(object.projectedVertices[0].y / 1000.0); |
---|
| 1892 | + powerField.setFloat(object.projectedVertices[2].x / 1000.0); |
---|
| 1893 | + |
---|
1748 | 1894 | materialtouched = true; |
---|
1749 | 1895 | applySelf(); |
---|
1750 | 1896 | } |
---|
1751 | 1897 | }); |
---|
1752 | | - presetpanel.add(label); |
---|
| 1898 | + presetpanel.add(skin); |
---|
1753 | 1899 | |
---|
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)); |
---|
| 1900 | + cLabel lambert = GetLabel("icons/shadericons/shadericon00002.png", !Grafreed.NIMBUSLAF); |
---|
| 1901 | + lambert.setToolTipText("Diffuse"); |
---|
| 1902 | + lambert.addMouseListener(new MouseAdapter() |
---|
| 1903 | + { |
---|
| 1904 | + public void mouseClicked(MouseEvent e) |
---|
| 1905 | + { |
---|
| 1906 | + Object3D object = Grafreed.materials.versionlist[2].get(0); |
---|
| 1907 | + cMaterial material = object.material; |
---|
| 1908 | + |
---|
| 1909 | + diffusenessField.setFloat(material.factor); |
---|
| 1910 | + selfshadowField.setFloat(material.diffuseness); |
---|
| 1911 | + |
---|
| 1912 | + materialtouched = true; |
---|
| 1913 | + applySelf(); |
---|
| 1914 | + } |
---|
| 1915 | + }); |
---|
| 1916 | + presetpanel.add(lambert); |
---|
| 1917 | + |
---|
| 1918 | + cLabel diffuse2 = GetLabel("icons/shadericons/shadericon00003.png", !Grafreed.NIMBUSLAF); |
---|
| 1919 | + diffuse2.setToolTipText("Diffuse2"); |
---|
| 1920 | + diffuse2.addMouseListener(new MouseAdapter() |
---|
| 1921 | + { |
---|
| 1922 | + public void mouseClicked(MouseEvent e) |
---|
| 1923 | + { |
---|
| 1924 | + Object3D object = Grafreed.materials.versionlist[3].get(0); |
---|
| 1925 | + cMaterial material = object.material; |
---|
| 1926 | + |
---|
| 1927 | + diffusenessField.setFloat(material.factor); |
---|
| 1928 | + selfshadowField.setFloat(material.diffuseness); |
---|
| 1929 | + |
---|
| 1930 | + materialtouched = true; |
---|
| 1931 | + applySelf(); |
---|
| 1932 | + } |
---|
| 1933 | + }); |
---|
| 1934 | + presetpanel.add(diffuse2); |
---|
| 1935 | + |
---|
| 1936 | + cLabel diffusemoon = GetLabel("icons/shadericons/shadericon00004.png", !Grafreed.NIMBUSLAF); |
---|
| 1937 | + diffusemoon.setToolTipText("Moon"); |
---|
| 1938 | + diffusemoon.addMouseListener(new MouseAdapter() |
---|
| 1939 | + { |
---|
| 1940 | + public void mouseClicked(MouseEvent e) |
---|
| 1941 | + { |
---|
| 1942 | + Object3D object = Grafreed.materials.versionlist[4].get(0); |
---|
| 1943 | + cMaterial material = object.material; |
---|
| 1944 | + |
---|
| 1945 | + diffusenessField.setFloat(material.factor); |
---|
| 1946 | + selfshadowField.setFloat(material.diffuseness); |
---|
| 1947 | + |
---|
| 1948 | + materialtouched = true; |
---|
| 1949 | + applySelf(); |
---|
| 1950 | + } |
---|
| 1951 | + }); |
---|
| 1952 | + presetpanel.add(diffusemoon); |
---|
| 1953 | + |
---|
| 1954 | + cLabel diffusemoon2 = GetLabel("icons/shadericons/shadericon00005.png", !Grafreed.NIMBUSLAF); |
---|
| 1955 | + diffusemoon2.setToolTipText("Moon2"); |
---|
| 1956 | + diffusemoon2.addMouseListener(new MouseAdapter() |
---|
| 1957 | + { |
---|
| 1958 | + public void mouseClicked(MouseEvent e) |
---|
| 1959 | + { |
---|
| 1960 | + Object3D object = Grafreed.materials.versionlist[5].get(0); |
---|
| 1961 | + cMaterial material = object.material; |
---|
| 1962 | + |
---|
| 1963 | + diffusenessField.setFloat(material.factor); |
---|
| 1964 | + selfshadowField.setFloat(material.diffuseness); |
---|
| 1965 | + |
---|
| 1966 | + materialtouched = true; |
---|
| 1967 | + applySelf(); |
---|
| 1968 | + } |
---|
| 1969 | + }); |
---|
| 1970 | + presetpanel.add(diffusemoon2); |
---|
| 1971 | + |
---|
| 1972 | + cLabel diffusemoon3 = GetLabel("icons/shadericons/shadericon00006.png", !Grafreed.NIMBUSLAF); |
---|
| 1973 | + diffusemoon3.setToolTipText("Moon3"); |
---|
| 1974 | + diffusemoon3.addMouseListener(new MouseAdapter() |
---|
| 1975 | + { |
---|
| 1976 | + public void mouseClicked(MouseEvent e) |
---|
| 1977 | + { |
---|
| 1978 | + Object3D object = Grafreed.materials.versionlist[6].get(0); |
---|
| 1979 | + cMaterial material = object.material; |
---|
| 1980 | + |
---|
| 1981 | + diffusenessField.setFloat(material.factor); |
---|
| 1982 | + selfshadowField.setFloat(material.diffuseness); |
---|
| 1983 | + |
---|
| 1984 | + materialtouched = true; |
---|
| 1985 | + applySelf(); |
---|
| 1986 | + } |
---|
| 1987 | + }); |
---|
| 1988 | + presetpanel.add(diffusemoon3); |
---|
| 1989 | + |
---|
| 1990 | + cLabel diffusesheen = GetLabel("icons/shadericons/shadericon00007.png", !Grafreed.NIMBUSLAF); |
---|
| 1991 | + diffusesheen.setToolTipText("Sheen"); |
---|
| 1992 | + diffusesheen.addMouseListener(new MouseAdapter() |
---|
| 1993 | + { |
---|
| 1994 | + public void mouseClicked(MouseEvent e) |
---|
| 1995 | + { |
---|
| 1996 | + Object3D object = Grafreed.materials.versionlist[7].get(0); |
---|
| 1997 | + cMaterial material = object.material; |
---|
| 1998 | + |
---|
| 1999 | + sheenField.setFloat(material.sheen); |
---|
| 2000 | + |
---|
| 2001 | + materialtouched = true; |
---|
| 2002 | + applySelf(); |
---|
| 2003 | + } |
---|
| 2004 | + }); |
---|
| 2005 | + presetpanel.add(diffusesheen); |
---|
| 2006 | + |
---|
| 2007 | + cLabel rough = GetLabel("icons/shadericons/shadericon00001.png", !Grafreed.NIMBUSLAF); |
---|
| 2008 | + rough.setToolTipText("Rough metal"); |
---|
| 2009 | + rough.addMouseListener(new MouseAdapter() |
---|
| 2010 | + { |
---|
| 2011 | + public void mouseClicked(MouseEvent e) |
---|
| 2012 | + { |
---|
| 2013 | + Object3D object = Grafreed.materials.versionlist[1].get(0); |
---|
| 2014 | + cMaterial material = object.material; |
---|
| 2015 | + |
---|
| 2016 | + shininessField.setFloat(material.shininess); |
---|
| 2017 | + velvetField.setFloat(material.velvet); |
---|
| 2018 | + |
---|
| 2019 | + materialtouched = true; |
---|
| 2020 | + applySelf(); |
---|
| 2021 | + } |
---|
| 2022 | + }); |
---|
| 2023 | + presetpanel.add(rough); |
---|
| 2024 | + |
---|
| 2025 | + cLabel rough2 = GetLabel("icons/shadericons/shadericon00013.png", !Grafreed.NIMBUSLAF); |
---|
| 2026 | + rough2.setToolTipText("Medium metal"); |
---|
| 2027 | + rough2.addMouseListener(new MouseAdapter() |
---|
| 2028 | + { |
---|
| 2029 | + public void mouseClicked(MouseEvent e) |
---|
| 2030 | + { |
---|
| 2031 | + Object3D object = Grafreed.materials.versionlist[13].get(0); |
---|
| 2032 | + cMaterial material = object.material; |
---|
| 2033 | + |
---|
| 2034 | + shininessField.setFloat(material.shininess); |
---|
| 2035 | + lightareaField.setFloat(material.lightarea); |
---|
| 2036 | + |
---|
| 2037 | + materialtouched = true; |
---|
| 2038 | + applySelf(); |
---|
| 2039 | + } |
---|
| 2040 | + }); |
---|
| 2041 | + presetpanel.add(rough2); |
---|
| 2042 | + |
---|
| 2043 | + cLabel shini0 = GetLabel("icons/shadericons/shadericon00014.png", !Grafreed.NIMBUSLAF); |
---|
| 2044 | + shini0.setToolTipText("Shiny"); |
---|
| 2045 | + shini0.addMouseListener(new MouseAdapter() |
---|
| 2046 | + { |
---|
| 2047 | + public void mouseClicked(MouseEvent e) |
---|
| 2048 | + { |
---|
| 2049 | + Object3D object = Grafreed.materials.versionlist[14].get(0); |
---|
| 2050 | + cMaterial material = object.material; |
---|
| 2051 | + |
---|
| 2052 | + shininessField.setFloat(material.shininess); |
---|
| 2053 | + lightareaField.setFloat(material.lightarea); |
---|
| 2054 | + |
---|
| 2055 | + materialtouched = true; |
---|
| 2056 | + applySelf(); |
---|
| 2057 | + } |
---|
| 2058 | + }); |
---|
| 2059 | + presetpanel.add(shini0); |
---|
| 2060 | + |
---|
| 2061 | + cLabel shini1 = GetLabel("icons/shadericons/shadericon00011.png", !Grafreed.NIMBUSLAF); |
---|
| 2062 | + shini1.setToolTipText("Shiny2"); |
---|
| 2063 | + shini1.addMouseListener(new MouseAdapter() |
---|
| 2064 | + { |
---|
| 2065 | + public void mouseClicked(MouseEvent e) |
---|
| 2066 | + { |
---|
| 2067 | + Object3D object = Grafreed.materials.versionlist[11].get(0); |
---|
| 2068 | + cMaterial material = object.material; |
---|
| 2069 | + |
---|
| 2070 | + shininessField.setFloat(material.shininess); |
---|
| 2071 | + lightareaField.setFloat(material.lightarea); |
---|
| 2072 | + |
---|
| 2073 | + materialtouched = true; |
---|
| 2074 | + applySelf(); |
---|
| 2075 | + } |
---|
| 2076 | + }); |
---|
| 2077 | + presetpanel.add(shini1); |
---|
| 2078 | + |
---|
| 2079 | + cLabel shini2 = GetLabel("icons/shadericons/shadericon00012.png", !Grafreed.NIMBUSLAF); |
---|
| 2080 | + shini2.setToolTipText("Shiny3"); |
---|
| 2081 | + shini2.addMouseListener(new MouseAdapter() |
---|
| 2082 | + { |
---|
| 2083 | + public void mouseClicked(MouseEvent e) |
---|
| 2084 | + { |
---|
| 2085 | + Object3D object = Grafreed.materials.versionlist[12].get(0); |
---|
| 2086 | + cMaterial material = object.material; |
---|
| 2087 | + |
---|
| 2088 | + shininessField.setFloat(material.shininess); |
---|
| 2089 | + lightareaField.setFloat(material.lightarea); |
---|
| 2090 | + |
---|
| 2091 | + materialtouched = true; |
---|
| 2092 | + applySelf(); |
---|
| 2093 | + } |
---|
| 2094 | + }); |
---|
| 2095 | + presetpanel.add(shini2); |
---|
| 2096 | + |
---|
| 2097 | + cLabel aniso = GetLabel("icons/shadericons/shadericon00008.png", !Grafreed.NIMBUSLAF); |
---|
| 2098 | + aniso.setToolTipText("AnisoU"); |
---|
| 2099 | + aniso.addMouseListener(new MouseAdapter() |
---|
| 2100 | + { |
---|
| 2101 | + public void mouseClicked(MouseEvent e) |
---|
| 2102 | + { |
---|
| 2103 | + Object3D object = Grafreed.materials.versionlist[8].get(0); |
---|
| 2104 | + cMaterial material = object.material; |
---|
| 2105 | + |
---|
| 2106 | + anisoField.setFloat(material.aniso); |
---|
| 2107 | + anisoVField.setFloat(material.anisoV); |
---|
| 2108 | + |
---|
| 2109 | + materialtouched = true; |
---|
| 2110 | + applySelf(); |
---|
| 2111 | + } |
---|
| 2112 | + }); |
---|
| 2113 | + presetpanel.add(aniso); |
---|
| 2114 | + |
---|
| 2115 | + cLabel aniso2 = GetLabel("icons/shadericons/shadericon00009.png", !Grafreed.NIMBUSLAF); |
---|
| 2116 | + aniso2.setToolTipText("AnisoV"); |
---|
| 2117 | + aniso2.addMouseListener(new MouseAdapter() |
---|
| 2118 | + { |
---|
| 2119 | + public void mouseClicked(MouseEvent e) |
---|
| 2120 | + { |
---|
| 2121 | + Object3D object = Grafreed.materials.versionlist[9].get(0); |
---|
| 2122 | + cMaterial material = object.material; |
---|
| 2123 | + |
---|
| 2124 | + anisoField.setFloat(material.aniso); |
---|
| 2125 | + anisoVField.setFloat(material.anisoV); |
---|
| 2126 | + |
---|
| 2127 | + materialtouched = true; |
---|
| 2128 | + applySelf(); |
---|
| 2129 | + } |
---|
| 2130 | + }); |
---|
| 2131 | + presetpanel.add(aniso2); |
---|
| 2132 | + |
---|
| 2133 | + cLabel aniso3 = GetLabel("icons/shadericons/shadericon00010.png", !Grafreed.NIMBUSLAF); |
---|
| 2134 | + aniso3.setToolTipText("AnisoUV"); |
---|
| 2135 | + aniso3.addMouseListener(new MouseAdapter() |
---|
| 2136 | + { |
---|
| 2137 | + public void mouseClicked(MouseEvent e) |
---|
| 2138 | + { |
---|
| 2139 | + Object3D object = Grafreed.materials.versionlist[10].get(0); |
---|
| 2140 | + cMaterial material = object.material; |
---|
| 2141 | + |
---|
| 2142 | + anisoField.setFloat(material.aniso); |
---|
| 2143 | + anisoVField.setFloat(material.anisoV); |
---|
| 2144 | + |
---|
| 2145 | + materialtouched = true; |
---|
| 2146 | + applySelf(); |
---|
| 2147 | + } |
---|
| 2148 | + }); |
---|
| 2149 | + presetpanel.add(aniso3); |
---|
| 2150 | + |
---|
| 2151 | + cLabel velvet0 = GetLabel("icons/shadericons/shadericon00015.png", !Grafreed.NIMBUSLAF); |
---|
| 2152 | + velvet0.setToolTipText("Velvet"); |
---|
| 2153 | + velvet0.addMouseListener(new MouseAdapter() |
---|
| 2154 | + { |
---|
| 2155 | + public void mouseClicked(MouseEvent e) |
---|
| 2156 | + { |
---|
| 2157 | + Object3D object = Grafreed.materials.versionlist[15].get(0); |
---|
| 2158 | + cMaterial material = object.material; |
---|
| 2159 | + |
---|
| 2160 | + diffusenessField.setFloat(material.factor); |
---|
| 2161 | + selfshadowField.setFloat(material.diffuseness); |
---|
| 2162 | + sheenField.setFloat(material.sheen); |
---|
| 2163 | + shininessField.setFloat(material.shininess); |
---|
| 2164 | + velvetField.setFloat(material.velvet); |
---|
| 2165 | + shiftField.setFloat(material.shift); |
---|
| 2166 | + |
---|
| 2167 | + materialtouched = true; |
---|
| 2168 | + applySelf(); |
---|
| 2169 | + } |
---|
| 2170 | + }); |
---|
| 2171 | + presetpanel.add(velvet0); |
---|
| 2172 | + |
---|
| 2173 | + cLabel bump0 = GetLabel("icons/shadericons/shadericon00016.png", !Grafreed.NIMBUSLAF); |
---|
| 2174 | + bump0.setToolTipText("Bump texture"); |
---|
| 2175 | + bump0.addMouseListener(new MouseAdapter() |
---|
| 2176 | + { |
---|
| 2177 | + public void mouseClicked(MouseEvent e) |
---|
| 2178 | + { |
---|
| 2179 | + Object3D object = Grafreed.materials.versionlist[16].get(0); |
---|
| 2180 | + cMaterial material = object.material; |
---|
| 2181 | + |
---|
| 2182 | + bumpField.setFloat(object.projectedVertices[0].x / 1000.0); |
---|
| 2183 | + noiseField.setFloat(object.projectedVertices[0].y / 1000.0); |
---|
| 2184 | + powerField.setFloat(object.projectedVertices[2].x / 1000.0); |
---|
| 2185 | + |
---|
| 2186 | + materialtouched = true; |
---|
| 2187 | + applySelf(); |
---|
| 2188 | + } |
---|
| 2189 | + }); |
---|
| 2190 | + presetpanel.add(bump0); |
---|
| 2191 | + |
---|
| 2192 | + cLabel borderShader = GetLabel("icons/shadericons/borderfade.jpg", !Grafreed.NIMBUSLAF); |
---|
| 2193 | + borderShader.setToolTipText("Border fade"); |
---|
| 2194 | + borderShader.addMouseListener(new MouseAdapter() |
---|
| 2195 | + { |
---|
| 2196 | + public void mouseClicked(MouseEvent e) |
---|
| 2197 | + { |
---|
| 2198 | + borderfadeField.setFloat(0.5); |
---|
| 2199 | + opacityField.setFloat(0.6); |
---|
| 2200 | + |
---|
| 2201 | + materialtouched = true; |
---|
| 2202 | + applySelf(); |
---|
| 2203 | + } |
---|
| 2204 | + }); |
---|
| 2205 | + presetpanel.add(borderShader); |
---|
| 2206 | + |
---|
| 2207 | + cLabel halo = GetLabel("icons/shadericons/shadericon00017.png", !Grafreed.NIMBUSLAF); |
---|
| 2208 | + halo.setToolTipText("Halo"); |
---|
| 2209 | + halo.addMouseListener(new MouseAdapter() |
---|
| 2210 | + { |
---|
| 2211 | + public void mouseClicked(MouseEvent e) |
---|
| 2212 | + { |
---|
| 2213 | + Object3D object = Grafreed.materials.versionlist[17].get(0); |
---|
| 2214 | + cMaterial material = object.material; |
---|
| 2215 | + |
---|
| 2216 | + opacityPowerField.setFloat(object.projectedVertices[2].y / 1000.0); |
---|
| 2217 | + |
---|
| 2218 | + materialtouched = true; |
---|
| 2219 | + applySelf(); |
---|
| 2220 | + } |
---|
| 2221 | + }); |
---|
| 2222 | + presetpanel.add(halo); |
---|
| 2223 | + |
---|
| 2224 | + cLabel candle = GetLabel("icons/shadericons/shadericon00018.png", !Grafreed.NIMBUSLAF); |
---|
| 2225 | + candle.setToolTipText("Candle"); |
---|
| 2226 | + candle.addMouseListener(new MouseAdapter() |
---|
| 2227 | + { |
---|
| 2228 | + public void mouseClicked(MouseEvent e) |
---|
| 2229 | + { |
---|
| 2230 | + Object3D object = Grafreed.materials.versionlist[18].get(0); |
---|
| 2231 | + cMaterial material = object.material; |
---|
| 2232 | + |
---|
| 2233 | + subsurfaceField.setFloat(material.subsurface); |
---|
| 2234 | + shadowbiasField.setFloat(material.shadowbias); |
---|
| 2235 | + ambientField.setFloat(material.ambient); |
---|
| 2236 | + specularField.setFloat(material.specular); |
---|
| 2237 | + lightareaField.setFloat(material.lightarea); |
---|
| 2238 | + shininessField.setFloat(material.shininess); |
---|
| 2239 | + |
---|
| 2240 | + materialtouched = true; |
---|
| 2241 | + applySelf(); |
---|
| 2242 | + } |
---|
| 2243 | + }); |
---|
| 2244 | + presetpanel.add(candle); |
---|
| 2245 | + |
---|
| 2246 | + cLabel shadowShader = GetLabel("icons/shadericons/shadow.png", !Grafreed.NIMBUSLAF); |
---|
| 2247 | + shadowShader.setToolTipText("Shadow"); |
---|
| 2248 | + shadowShader.addMouseListener(new MouseAdapter() |
---|
| 2249 | + { |
---|
| 2250 | + public void mouseClicked(MouseEvent e) |
---|
| 2251 | + { |
---|
| 2252 | + diffuseField.setFloat(0.001); |
---|
| 2253 | + ambientField.setFloat(0.001); |
---|
| 2254 | + cameraField.setFloat(0.001); |
---|
| 2255 | + specularField.setFloat(0.001); |
---|
| 2256 | + fakedepthField.setFloat(0.001); |
---|
| 2257 | + opacityField.setFloat(0.6); |
---|
| 2258 | + |
---|
| 2259 | + materialtouched = true; |
---|
| 2260 | + applySelf(); |
---|
| 2261 | + } |
---|
| 2262 | + }); |
---|
| 2263 | + presetpanel.add(shadowShader); |
---|
1774 | 2264 | |
---|
1775 | 2265 | cGridBag panel = new cGridBag().setVertical(true); |
---|
1776 | 2266 | |
---|
1777 | 2267 | presetpanel.preferredWidth = 1; |
---|
1778 | 2268 | |
---|
1779 | | - materialpanel.add(panel); |
---|
1780 | 2269 | materialpanel.add(presetpanel); |
---|
| 2270 | + materialpanel.add(panel); |
---|
1781 | 2271 | |
---|
1782 | 2272 | panel.preferredWidth = 8; |
---|
1783 | 2273 | |
---|
.. | .. |
---|
1821 | 2311 | |
---|
1822 | 2312 | cGridBag huepanel = new cGridBag(); |
---|
1823 | 2313 | cGridBag huelabel = new cGridBag(); |
---|
1824 | | - label = GetLabel("icons/hue.png", false); |
---|
1825 | | - label.fit = true; |
---|
1826 | | - huelabel.add(label); |
---|
| 2314 | + skin = GetLabel("icons/hue.png", false); |
---|
| 2315 | + skin.fit = true; |
---|
| 2316 | + huelabel.add(skin); |
---|
1827 | 2317 | huelabel.preferredWidth = 20; |
---|
1828 | 2318 | huepanel.add(new cGridBag()); // Label |
---|
1829 | 2319 | huepanel.add(huelabel); // Field/slider |
---|
.. | .. |
---|
3099 | 3589 | |
---|
3100 | 3590 | if (multiplyToggle != null) |
---|
3101 | 3591 | multiplyToggle.setSelected(mat.multiply); |
---|
3102 | | - |
---|
3103 | | - assert (object.projectedVertices != null); |
---|
3104 | | - |
---|
3105 | | - if (object.projectedVertices.length <= 2) |
---|
3106 | | - { |
---|
3107 | | - // Side effect... |
---|
3108 | | - Object3D.cVector2[] keep = object.projectedVertices; |
---|
3109 | | - object.projectedVertices = new Object3D.cVector2[3]; |
---|
3110 | | - for (int i = 0; i < 3; i++) |
---|
3111 | | - { |
---|
3112 | | - if (i < keep.length) |
---|
3113 | | - { |
---|
3114 | | - object.projectedVertices[i] = keep[i]; |
---|
3115 | | - } else |
---|
3116 | | - { |
---|
3117 | | - object.projectedVertices[i] = new Object3D.cVector2(); |
---|
3118 | | - } |
---|
3119 | | - /* |
---|
3120 | | - if(keep.length == 0) |
---|
3121 | | - object.projectedVertices[0] = new Object3D.cVector2(); |
---|
3122 | | - else |
---|
3123 | | - object.projectedVertices[0] = keep[0]; |
---|
3124 | | - object.projectedVertices[1] = new Object3D.cVector2(); |
---|
3125 | | - */ |
---|
3126 | | - } |
---|
3127 | | - } |
---|
| 3592 | + |
---|
| 3593 | + AllocProjectedVertices(object); |
---|
3128 | 3594 | |
---|
3129 | 3595 | SetMaterial(mat, object.projectedVertices); |
---|
3130 | 3596 | } |
---|
.. | .. |
---|
3244 | 3710 | public void itemStateChanged(ItemEvent event) |
---|
3245 | 3711 | { |
---|
3246 | 3712 | // System.out.println("Propagate = " + propagate); |
---|
| 3713 | + if (event.getSource() == pinButton) |
---|
| 3714 | + { |
---|
| 3715 | + copy.pinned ^= true; |
---|
| 3716 | + if (!copy.pinned && !copy.editWindow.copy.selection.contains(copy)) |
---|
| 3717 | + { |
---|
| 3718 | + ((GroupEditor)copy.editWindow).listUI.remove(copy); |
---|
| 3719 | + copy.CloseUI(); |
---|
| 3720 | + //copy.editWindow.refreshContents(); |
---|
| 3721 | + } |
---|
| 3722 | + } |
---|
| 3723 | + else |
---|
3247 | 3724 | if (event.getSource() == propagateToggle) |
---|
3248 | 3725 | { |
---|
3249 | 3726 | propagate ^= true; |
---|
.. | .. |
---|
3716 | 4193 | { |
---|
3717 | 4194 | //Save(true); |
---|
3718 | 4195 | Replace(); |
---|
3719 | | - SetUndoStates(); |
---|
| 4196 | + SetVersionStates(); |
---|
3720 | 4197 | } |
---|
3721 | 4198 | |
---|
3722 | 4199 | private boolean Equal(byte[] compress, byte[] name) |
---|
.. | .. |
---|
3737 | 4214 | |
---|
3738 | 4215 | java.util.Hashtable<java.util.UUID, Object3D> versiontable = new java.util.Hashtable<java.util.UUID, Object3D>(); |
---|
3739 | 4216 | |
---|
| 4217 | + void DeleteVersion() |
---|
| 4218 | + { |
---|
| 4219 | + for (int i = copy.versionindex; i < copy.versionlist.length-1; i++) |
---|
| 4220 | + { |
---|
| 4221 | + copy.versionlist[i] = copy.versionlist[i+1]; |
---|
| 4222 | + } |
---|
| 4223 | + |
---|
| 4224 | + CopyChanged(); |
---|
| 4225 | + |
---|
| 4226 | + SetVersionStates(); |
---|
| 4227 | + } |
---|
| 4228 | + |
---|
3740 | 4229 | public boolean Save(boolean user) |
---|
3741 | 4230 | { |
---|
3742 | 4231 | System.err.println("Save"); |
---|
3743 | 4232 | Replace(); |
---|
3744 | 4233 | |
---|
3745 | | - cRadio tab = GetCurrentTab(); |
---|
| 4234 | + //cRadio tab = GetCurrentTab(); |
---|
3746 | 4235 | |
---|
3747 | | - Object3D compress = CompressCopy(); // Saved version. No need for "Replace". |
---|
| 4236 | + Object3D compress = Duplicate(copy); // Saved version. No need for "Replace"? |
---|
3748 | 4237 | |
---|
3749 | 4238 | boolean thesame = false; |
---|
3750 | 4239 | |
---|
.. | .. |
---|
3756 | 4245 | //EditorFrame.m_MainFrame.requestFocusInWindow(); |
---|
3757 | 4246 | if (!thesame) |
---|
3758 | 4247 | { |
---|
| 4248 | + for (int i = copy.versionlist.length; --i > copy.versionindex+1;) |
---|
| 4249 | + { |
---|
| 4250 | + copy.versionlist[i] = copy.versionlist[i-1]; |
---|
| 4251 | + } |
---|
| 4252 | + |
---|
3759 | 4253 | //tab.user[tab.versionindex] = user; |
---|
3760 | 4254 | //boolean increment = true; // tab.graphs[tab.versionindex] == null; |
---|
3761 | 4255 | |
---|
.. | .. |
---|
3769 | 4263 | |
---|
3770 | 4264 | //assert(hashtable.isEmpty()); |
---|
3771 | 4265 | |
---|
3772 | | - for (int i = copy.versionindex+1; i < copy.versionlist.length; i++) |
---|
3773 | | - { |
---|
3774 | | - //tab.user[i] = false; |
---|
3775 | | - copy.versionlist[i] = null; |
---|
3776 | | - } |
---|
| 4266 | +// for (int i = copy.versionindex+1; i < copy.versionlist.length; i++) |
---|
| 4267 | +// { |
---|
| 4268 | +// //tab.user[i] = false; |
---|
| 4269 | +// copy.versionlist[i] = null; |
---|
| 4270 | +// } |
---|
3777 | 4271 | |
---|
3778 | | - SetUndoStates(); |
---|
| 4272 | + SetVersionStates(); |
---|
3779 | 4273 | |
---|
3780 | 4274 | // test save |
---|
3781 | 4275 | if (false) |
---|
.. | .. |
---|
3828 | 4322 | GetTree().addSelectionPath(selection.elementAt(i).GetTreePath().GetTreePath()); |
---|
3829 | 4323 | flashIt = true; |
---|
3830 | 4324 | |
---|
3831 | | - refreshContents(false); |
---|
| 4325 | + //refreshContents(false); |
---|
3832 | 4326 | } |
---|
3833 | 4327 | |
---|
3834 | | - void CopyChanged(Object3D obj) |
---|
| 4328 | + void CopyChanged() |
---|
3835 | 4329 | { |
---|
3836 | | - SetUndoStates(); |
---|
| 4330 | + Object3D obj = (Object3D)Grafreed.clone(copy.versionlist[copy.versionindex]); |
---|
| 4331 | + |
---|
| 4332 | + SetVersionStates(); |
---|
3837 | 4333 | |
---|
3838 | 4334 | boolean temp = CameraPane.SWITCH; |
---|
3839 | 4335 | CameraPane.SWITCH = false; |
---|
.. | .. |
---|
3875 | 4371 | } |
---|
3876 | 4372 | } |
---|
3877 | 4373 | |
---|
3878 | | - refreshContents(); |
---|
| 4374 | + refreshContents(true); |
---|
3879 | 4375 | } |
---|
3880 | 4376 | |
---|
3881 | | - cButton undoButton; |
---|
| 4377 | + cButton previousVersionButton; |
---|
3882 | 4378 | cButton restoreButton; |
---|
3883 | 4379 | cButton replaceButton; |
---|
3884 | | - cButton redoButton; |
---|
| 4380 | + cButton nextVersionButton; |
---|
| 4381 | + cButton saveVersionButton; |
---|
| 4382 | + cButton deleteVersionButton; |
---|
3885 | 4383 | |
---|
3886 | 4384 | boolean muteSlider; |
---|
3887 | 4385 | |
---|
.. | .. |
---|
3898 | 4396 | return count; |
---|
3899 | 4397 | } |
---|
3900 | 4398 | |
---|
3901 | | - void SetUndoStates() |
---|
| 4399 | + void SetVersionStates() |
---|
3902 | 4400 | { |
---|
3903 | | - cRadio tab = GetCurrentTab(); |
---|
| 4401 | + //if (true) |
---|
| 4402 | + // return; |
---|
| 4403 | + |
---|
| 4404 | + //cRadio tab = GetCurrentTab(); |
---|
3904 | 4405 | |
---|
3905 | 4406 | restoreButton.setEnabled(copy.versionindex != -1); |
---|
3906 | 4407 | replaceButton.setEnabled(copy.versionindex != -1); |
---|
3907 | 4408 | |
---|
3908 | | - undoButton.setEnabled(copy.versionindex > 0); |
---|
3909 | | - redoButton.setEnabled(copy.versionlist[copy.versionindex + 1] != null); |
---|
| 4409 | + previousVersionButton.setEnabled(copy.versionindex > 0); |
---|
| 4410 | + nextVersionButton.setEnabled(copy.versionlist[copy.versionindex + 1] != null); |
---|
| 4411 | + |
---|
| 4412 | + deleteVersionButton.setEnabled(//copy.versionindex > 0 && |
---|
| 4413 | + copy.versionlist[copy.versionindex + 1] != null); |
---|
3910 | 4414 | |
---|
3911 | 4415 | muteSlider = true; |
---|
| 4416 | + versionSlider.setMinimum(0); |
---|
3912 | 4417 | versionSlider.setMaximum(VersionCount() - 1); |
---|
3913 | 4418 | versionSlider.setInteger(copy.versionindex); |
---|
| 4419 | + versionSlider.setEnabled(copy.versionindex != -1); |
---|
3914 | 4420 | muteSlider = false; |
---|
3915 | 4421 | } |
---|
3916 | 4422 | |
---|
3917 | | - public boolean Undo() |
---|
| 4423 | + public boolean PreviousVersion() |
---|
3918 | 4424 | { |
---|
3919 | 4425 | // Option? |
---|
3920 | 4426 | Replace(); |
---|
3921 | 4427 | |
---|
3922 | 4428 | System.err.println("Undo"); |
---|
3923 | 4429 | |
---|
3924 | | - cRadio tab = GetCurrentTab(); |
---|
| 4430 | + //cRadio tab = GetCurrentTab(); |
---|
3925 | 4431 | |
---|
3926 | 4432 | if (copy.versionindex == 0) |
---|
3927 | 4433 | { |
---|
.. | .. |
---|
3944 | 4450 | |
---|
3945 | 4451 | copy.versionindex -= 1; |
---|
3946 | 4452 | |
---|
3947 | | - CopyChanged((Object3D)copy.versionlist[copy.versionindex]); |
---|
| 4453 | + CopyChanged(); |
---|
3948 | 4454 | |
---|
3949 | 4455 | return true; |
---|
3950 | 4456 | } |
---|
.. | .. |
---|
3953 | 4459 | { |
---|
3954 | 4460 | System.err.println("Restore"); |
---|
3955 | 4461 | |
---|
3956 | | - cRadio tab = GetCurrentTab(); |
---|
| 4462 | + //cRadio tab = GetCurrentTab(); |
---|
3957 | 4463 | |
---|
3958 | 4464 | if (copy.versionindex == -1 || copy.versionlist[copy.versionindex] == null) |
---|
3959 | 4465 | { |
---|
.. | .. |
---|
3962 | 4468 | } |
---|
3963 | 4469 | |
---|
3964 | 4470 | //CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex])); |
---|
3965 | | - CopyChanged(copy.versionlist[copy.versionindex]); |
---|
| 4471 | + CopyChanged(); |
---|
3966 | 4472 | |
---|
3967 | 4473 | return true; |
---|
3968 | 4474 | } |
---|
.. | .. |
---|
3971 | 4477 | { |
---|
3972 | 4478 | System.err.println("Replace"); |
---|
3973 | 4479 | |
---|
3974 | | - cRadio tab = GetCurrentTab(); |
---|
| 4480 | + //cRadio tab = GetCurrentTab(); |
---|
3975 | 4481 | |
---|
3976 | 4482 | if (copy.versionindex == -1 || copy.versionlist[copy.versionindex] == null) |
---|
3977 | 4483 | { |
---|
.. | .. |
---|
3979 | 4485 | return false; |
---|
3980 | 4486 | } |
---|
3981 | 4487 | |
---|
3982 | | - copy.versionlist[copy.versionindex] = CompressCopy(); |
---|
| 4488 | + copy.versionlist[copy.versionindex] = Duplicate(copy); |
---|
3983 | 4489 | |
---|
3984 | 4490 | return true; |
---|
3985 | 4491 | } |
---|
3986 | 4492 | |
---|
3987 | | - public void Redo() |
---|
| 4493 | + public void NextVersion() |
---|
3988 | 4494 | { |
---|
3989 | 4495 | // Option? |
---|
3990 | 4496 | Replace(); |
---|
3991 | 4497 | |
---|
3992 | | - cRadio tab = GetCurrentTab(); |
---|
| 4498 | + //cRadio tab = GetCurrentTab(); |
---|
3993 | 4499 | |
---|
3994 | 4500 | if (copy.versionlist[copy.versionindex + 1] == null) |
---|
3995 | 4501 | { |
---|
.. | .. |
---|
3999 | 4505 | |
---|
4000 | 4506 | copy.versionindex += 1; |
---|
4001 | 4507 | |
---|
4002 | | - CopyChanged(copy.versionlist[copy.versionindex]); |
---|
| 4508 | + CopyChanged(); |
---|
4003 | 4509 | |
---|
4004 | 4510 | //if (!tab.user[tab.versionindex]) |
---|
4005 | 4511 | // tab.graphs[tab.versionindex] = null; |
---|
.. | .. |
---|
4308 | 4814 | if (muteSlider) |
---|
4309 | 4815 | return; |
---|
4310 | 4816 | |
---|
| 4817 | + Replace(); |
---|
| 4818 | + |
---|
4311 | 4819 | int version = versionSlider.getInteger(); |
---|
4312 | 4820 | |
---|
4313 | | - if (copy.versionlist[version] != null) |
---|
| 4821 | + if (version != -1 && copy.versionlist[version] != null) |
---|
4314 | 4822 | { |
---|
4315 | | - CopyChanged(copy.versionlist[copy.versionindex = version]); |
---|
| 4823 | + copy.versionindex = version; |
---|
| 4824 | + CopyChanged(); |
---|
4316 | 4825 | } |
---|
4317 | 4826 | |
---|
4318 | 4827 | return; |
---|
.. | .. |
---|
4353 | 4862 | //System.out.println("stateChanged = " + this); |
---|
4354 | 4863 | materialtouched = true; |
---|
4355 | 4864 | |
---|
4356 | | - if (e.getSource() == colorField && saturationField.getFloat() == 0.001) |
---|
| 4865 | + if (Globals.AUTOSATURATE && e.getSource() == colorField && saturationField.getFloat() == 0.001) |
---|
4357 | 4866 | { |
---|
4358 | 4867 | saturationField.setFloat(1); |
---|
4359 | 4868 | } |
---|
.. | .. |
---|
4666 | 5175 | ctrlPanel.validate(); // ? new |
---|
4667 | 5176 | ctrlPanel.repaint(); |
---|
4668 | 5177 | } |
---|
| 5178 | + |
---|
| 5179 | + if (previousVersionButton != null && copy.versionlist != null) |
---|
| 5180 | + SetVersionStates(); |
---|
4669 | 5181 | } |
---|
4670 | 5182 | |
---|
4671 | 5183 | static TweenManager tweenManager = new TweenManager(); |
---|
.. | .. |
---|
5054 | 5566 | |
---|
5055 | 5567 | if (copy.versionlist == null) |
---|
5056 | 5568 | { |
---|
| 5569 | + // Backward compatibility |
---|
5057 | 5570 | copy.versionlist = new Object3D[100]; |
---|
5058 | 5571 | copy.versionindex = -1; |
---|
| 5572 | + |
---|
| 5573 | + //Save(true); |
---|
5059 | 5574 | } |
---|
5060 | 5575 | |
---|
5061 | 5576 | //? SetUndoStates(); |
---|
.. | .. |
---|
5070 | 5585 | { |
---|
5071 | 5586 | if (Grafreed.standAlone) |
---|
5072 | 5587 | { |
---|
5073 | | - FileDialog browser = new FileDialog(frame, "Load", FileDialog.LOAD); |
---|
| 5588 | + FileDialog browser = new FileDialog(frame, "Open", FileDialog.LOAD); |
---|
5074 | 5589 | browser.show(); |
---|
5075 | 5590 | String filename = browser.getFile(); |
---|
5076 | 5591 | if (filename != null && filename.length() > 0) |
---|
.. | .. |
---|
5147 | 5662 | |
---|
5148 | 5663 | void save() |
---|
5149 | 5664 | { |
---|
| 5665 | + Replace(); |
---|
| 5666 | + |
---|
5150 | 5667 | if (lastname == null) |
---|
5151 | 5668 | { |
---|
5152 | 5669 | return; |
---|
.. | .. |
---|
5389 | 5906 | ButtonGroup buttonGroup; |
---|
5390 | 5907 | |
---|
5391 | 5908 | cGridBag toolboxPanel; |
---|
| 5909 | + cGridBag skyboxPanel; |
---|
5392 | 5910 | cGridBag materialPanel; |
---|
5393 | 5911 | cGridBag ctrlPanel; |
---|
5394 | 5912 | |
---|
.. | .. |
---|
5493 | 6011 | cNumberSlider anisoField; |
---|
5494 | 6012 | JLabel anisoVLabel; |
---|
5495 | 6013 | cNumberSlider anisoVField; |
---|
| 6014 | + |
---|
5496 | 6015 | JLabel cameraLabel; |
---|
5497 | 6016 | cNumberSlider cameraField; |
---|
5498 | 6017 | JLabel selfshadowLabel; |
---|
.. | .. |
---|
5507 | 6026 | cNumberSlider fakedepthField; |
---|
5508 | 6027 | JLabel shadowbiasLabel; |
---|
5509 | 6028 | cNumberSlider shadowbiasField; |
---|
| 6029 | + |
---|
5510 | 6030 | JLabel bumpLabel; |
---|
5511 | 6031 | cNumberSlider bumpField; |
---|
5512 | 6032 | JLabel noiseLabel; |
---|