.. | .. |
---|
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 | | - try |
---|
48 | | - { |
---|
49 | | - ImageIcon icon = GetIcon(name); |
---|
50 | | - return new cButton(icon, border); |
---|
51 | | - } |
---|
52 | | - catch (Exception e) |
---|
53 | | - { |
---|
54 | | - return new cButton(name, border); |
---|
55 | | - } |
---|
| 56 | + ImageIcon icon = GetIcon(name); |
---|
| 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); |
---|
56 | 64 | } |
---|
57 | 65 | |
---|
58 | 66 | cToggleButton GetToggleButton(String name, boolean border) |
---|
59 | 67 | { |
---|
60 | | - try |
---|
61 | | - { |
---|
62 | | - ImageIcon icon = GetIcon(name); |
---|
63 | | - return new cToggleButton(icon, border); |
---|
64 | | - } |
---|
65 | | - catch (Exception e) |
---|
66 | | - { |
---|
67 | | - return new cToggleButton(name, border); |
---|
68 | | - } |
---|
| 68 | + ImageIcon icon = GetIcon(name); |
---|
| 69 | + return new cToggleButton(icon, border); |
---|
69 | 70 | } |
---|
70 | 71 | |
---|
71 | 72 | cCheckBox GetCheckBox(String name, boolean border) |
---|
72 | 73 | { |
---|
| 74 | + ImageIcon icon = GetIcon(name); |
---|
| 75 | + return new cCheckBox(icon, border); |
---|
| 76 | + } |
---|
| 77 | + |
---|
| 78 | + ImageIcon GetIcon(String name) |
---|
| 79 | + { |
---|
73 | 80 | try |
---|
74 | 81 | { |
---|
75 | | - ImageIcon icon = GetIcon(name); |
---|
76 | | - return new cCheckBox(icon, border); |
---|
| 82 | + BufferedImage image = javax.imageio.ImageIO.read(getClass().getClassLoader().getResourceAsStream(name)); |
---|
| 83 | + |
---|
| 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 | +// } |
---|
| 95 | + |
---|
| 96 | + javax.swing.ImageIcon icon = new javax.swing.ImageIcon(image); |
---|
| 97 | + return icon; |
---|
77 | 98 | } |
---|
78 | 99 | catch (Exception e) |
---|
79 | 100 | { |
---|
80 | | - return new cCheckBox(name, border); |
---|
| 101 | + return null; |
---|
81 | 102 | } |
---|
82 | 103 | } |
---|
83 | | - |
---|
84 | | - private ImageIcon GetIcon(String name) throws IOException |
---|
| 104 | + |
---|
| 105 | + BufferedImage GetImage(String name) |
---|
85 | 106 | { |
---|
86 | | - BufferedImage image = javax.imageio.ImageIO.read(getClass().getClassLoader().getResourceAsStream(name)); |
---|
87 | | - |
---|
88 | | - if (image.getWidth() != 24 && image.getHeight() != 24) |
---|
| 107 | + try |
---|
89 | 108 | { |
---|
90 | | - BufferedImage resized = new BufferedImage(24, 24, image.getType()); |
---|
91 | | - Graphics2D g = resized.createGraphics(); |
---|
92 | | - g.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR); |
---|
93 | | - //g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); |
---|
94 | | - g.drawImage(image, 0, 0, 24, 24, 0, 0, image.getWidth(), image.getHeight(), null); |
---|
95 | | - g.dispose(); |
---|
96 | | - |
---|
97 | | - image = resized; |
---|
| 109 | + BufferedImage image = javax.imageio.ImageIO.read(getClass().getClassLoader().getResourceAsStream(name)); |
---|
| 110 | + |
---|
| 111 | + return image; |
---|
98 | 112 | } |
---|
99 | | - |
---|
100 | | - javax.swing.ImageIcon icon = new javax.swing.ImageIcon(image); |
---|
101 | | - return icon; |
---|
| 113 | + catch (Exception e) |
---|
| 114 | + { |
---|
| 115 | + return null; |
---|
| 116 | + } |
---|
102 | 117 | } |
---|
103 | 118 | |
---|
104 | 119 | // SCRIPT |
---|
.. | .. |
---|
282 | 297 | client = inClient; |
---|
283 | 298 | copy = client; |
---|
284 | 299 | |
---|
| 300 | + if (copy.versionlist == null) |
---|
| 301 | + { |
---|
| 302 | + copy.versionlist = new Object3D[100]; |
---|
| 303 | + copy.versionindex = -1; |
---|
| 304 | + } |
---|
| 305 | + |
---|
285 | 306 | // "this" is not called: SetupUI2(objEditor); |
---|
286 | 307 | } |
---|
287 | 308 | |
---|
.. | .. |
---|
295 | 316 | client = inClient; |
---|
296 | 317 | copy = client; |
---|
297 | 318 | |
---|
| 319 | + if (copy.versionlist == null) |
---|
| 320 | + { |
---|
| 321 | + copy.versionlist = new Object3D[100]; |
---|
| 322 | + copy.versionindex = -1; |
---|
| 323 | + } |
---|
| 324 | + |
---|
298 | 325 | SetupUI2(callee.GetEditor()); |
---|
299 | 326 | } |
---|
300 | 327 | |
---|
.. | .. |
---|
327 | 354 | copy = localCopy; |
---|
328 | 355 | copy.editWindow = this; |
---|
329 | 356 | |
---|
| 357 | + if (copy.versionlist == null) |
---|
| 358 | + { |
---|
| 359 | +// copy.versions = new byte[100][]; |
---|
| 360 | +// copy.versionindex = -1; |
---|
| 361 | + } |
---|
| 362 | + |
---|
330 | 363 | SetupMenu(); |
---|
331 | 364 | |
---|
332 | 365 | //SetupName(objEditor); // new |
---|
.. | .. |
---|
419 | 452 | |
---|
420 | 453 | toolbarPanel = new JPanel(); |
---|
421 | 454 | toolbarPanel.setName("Toolbar"); |
---|
| 455 | + |
---|
422 | 456 | treePanel = new cGridBag(); |
---|
423 | 457 | treePanel.setName("Tree"); |
---|
424 | 458 | |
---|
425 | 459 | editPanel = new cGridBag().setVertical(true); |
---|
426 | | - editPanel.setName("Edit"); |
---|
| 460 | + //editPanel.setName("Edit"); |
---|
427 | 461 | |
---|
428 | 462 | ctrlPanel = new cGridBag().setVertical(false); // new GridBagLayout()); |
---|
429 | 463 | |
---|
.. | .. |
---|
431 | 465 | editPanel.add(editCommandsPanel); |
---|
432 | 466 | editPanel.add(ctrlPanel); |
---|
433 | 467 | |
---|
434 | | - toolboxPanel = new cGridBag().setVertical(false); |
---|
435 | | - toolboxPanel.setName("Toolbox"); |
---|
| 468 | + toolboxPanel = new cGridBag().setVertical(true); |
---|
| 469 | + //toolboxPanel.setName("Toolbox"); |
---|
436 | 470 | |
---|
437 | | - materialPanel = new cGridBag().setVertical(true); |
---|
438 | | - materialPanel.setName("Material"); |
---|
| 471 | + skyboxPanel = new cGridBag().setVertical(true); |
---|
| 472 | + |
---|
| 473 | + materialPanel = new cGridBag().setVertical(false); |
---|
| 474 | + //materialPanel.setName("Material"); |
---|
439 | 475 | |
---|
440 | 476 | /*JTextPane*/ |
---|
441 | 477 | infoarea = createTextPane(); |
---|
.. | .. |
---|
443 | 479 | |
---|
444 | 480 | infoarea.setEditable(true); |
---|
445 | 481 | SetText(); |
---|
| 482 | + |
---|
446 | 483 | // infoarea.setFont(infoarea.getFont().deriveFont(10, 14f)); |
---|
447 | 484 | // infoarea.setOpaque(false); |
---|
448 | 485 | // //infoarea.setForeground(textcolor); |
---|
.. | .. |
---|
450 | 487 | // TEXTAREA infoarea.setWrapStyleWord(true); |
---|
451 | 488 | infoPanel = new JScrollPane(infoarea, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); //AS_NEEDED); |
---|
452 | 489 | infoPanel.setPreferredSize(new Dimension(1, 1)); |
---|
453 | | - infoPanel.setName("Info"); |
---|
| 490 | + //infoPanel.setName("Info"); |
---|
454 | 491 | //infoPanel.setLayout(new BorderLayout()); |
---|
455 | 492 | //infoPanel.add(createTextPane()); |
---|
456 | 493 | |
---|
.. | .. |
---|
814 | 851 | //frame.setVisible(true); |
---|
815 | 852 | } |
---|
816 | 853 | frame.validate(); |
---|
| 854 | + |
---|
| 855 | + cameraView.requestFocusInWindow(); |
---|
817 | 856 | } |
---|
| 857 | + |
---|
| 858 | + private Object3D CompressCopy() |
---|
| 859 | + { |
---|
| 860 | + boolean temp = CameraPane.SWITCH; |
---|
| 861 | + CameraPane.SWITCH = false; |
---|
| 862 | + |
---|
| 863 | + copy.ExtractBigData(versiontable); |
---|
| 864 | + // if (copy == client) |
---|
| 865 | + |
---|
| 866 | + Object3D versions[] = copy.versionlist; |
---|
| 867 | + copy.versionlist = null; |
---|
| 868 | + |
---|
| 869 | + //byte[] compress = Compress(copy); |
---|
| 870 | + Object3D compress = (Object3D)Grafreed.clone(copy); |
---|
| 871 | + |
---|
| 872 | + copy.versionlist = versions; |
---|
| 873 | + |
---|
| 874 | + copy.RestoreBigData(versiontable); |
---|
| 875 | + |
---|
| 876 | + CameraPane.SWITCH = temp; |
---|
| 877 | + |
---|
| 878 | + return compress; |
---|
| 879 | + } |
---|
818 | 880 | |
---|
819 | 881 | private JTextPane createTextPane() |
---|
820 | 882 | { |
---|
.. | .. |
---|
937 | 999 | { |
---|
938 | 1000 | SetupMaterial(materialPanel); |
---|
939 | 1001 | } |
---|
| 1002 | + |
---|
940 | 1003 | //SetupName(); |
---|
941 | 1004 | //SetupViews(); |
---|
942 | 1005 | } |
---|
.. | .. |
---|
946 | 1009 | // NumberSlider vDivsField; |
---|
947 | 1010 | // JCheckBox endcaps; |
---|
948 | 1011 | JCheckBox liveCB; |
---|
949 | | - JCheckBox selectCB; |
---|
| 1012 | + JCheckBox selectableCB; |
---|
950 | 1013 | JCheckBox hideCB; |
---|
951 | 1014 | JCheckBox link2masterCB; |
---|
952 | 1015 | JCheckBox markCB; |
---|
.. | .. |
---|
1145 | 1208 | |
---|
1146 | 1209 | namePanel = new cGridBag(); |
---|
1147 | 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 | + |
---|
1148 | 1223 | nameField = AddText(namePanel, copy.GetName()); |
---|
1149 | 1224 | namePanel.add(new JScrollPane(nameField, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER)); |
---|
1150 | 1225 | oe.ctrlPanel.add(namePanel); |
---|
.. | .. |
---|
1158 | 1233 | |
---|
1159 | 1234 | liveCB = AddCheckBox(setupPanel, "Live", copy.live); |
---|
1160 | 1235 | liveCB.setToolTipText("Animate object"); |
---|
1161 | | - selectCB = AddCheckBox(setupPanel, "Select", !copy.dontselect); |
---|
1162 | | - selectCB.setToolTipText("Make object selectable"); |
---|
| 1236 | + selectableCB = AddCheckBox(setupPanel, "Select", !copy.dontselect); |
---|
| 1237 | + selectableCB.setToolTipText("Make object selectable"); |
---|
1163 | 1238 | // Return(); |
---|
| 1239 | + |
---|
1164 | 1240 | hideCB = AddCheckBox(setupPanel, "Hide", copy.hide); |
---|
1165 | 1241 | hideCB.setToolTipText("Hide object"); |
---|
1166 | 1242 | markCB = AddCheckBox(setupPanel, "Mark", copy.marked); |
---|
1167 | 1243 | markCB.setToolTipText("As animation target transform"); |
---|
| 1244 | + |
---|
| 1245 | + ToolTipManager.sharedInstance().setLightWeightPopupEnabled(false); |
---|
1168 | 1246 | |
---|
1169 | 1247 | setupPanel2 = new cGridBag().setVertical(false); |
---|
1170 | 1248 | |
---|
.. | .. |
---|
1174 | 1252 | randomCB = AddCheckBox(setupPanel2, "Random", copy.random); |
---|
1175 | 1253 | randomCB.setToolTipText("Randomly Rewind (or Go back and forth)"); |
---|
1176 | 1254 | |
---|
| 1255 | + link2masterCB = AddCheckBox(setupPanel2, "Support", copy.link2master); |
---|
| 1256 | + link2masterCB.setToolTipText("Attach to support"); |
---|
| 1257 | + |
---|
1177 | 1258 | if (Globals.ADVANCED) |
---|
1178 | 1259 | { |
---|
1179 | | - link2masterCB = AddCheckBox(setupPanel2, "Supp", copy.link2master); |
---|
1180 | | - link2masterCB.setToolTipText("Attach to support"); |
---|
1181 | 1260 | speedupCB = AddCheckBox(setupPanel2, "Speed", copy.speedup); |
---|
1182 | 1261 | speedupCB.setToolTipText("Option motion capture"); |
---|
1183 | 1262 | } |
---|
.. | .. |
---|
1451 | 1530 | XYZPanel.addComponent(/*BorderLayout.SOUTH,*/sideView); // Scroll); |
---|
1452 | 1531 | XYZPanel.addComponent(/*BorderLayout.CENTER,*/frontView); // Scroll); |
---|
1453 | 1532 | XYZPanel.addComponent(/*BorderLayout.NORTH,*/topView); // Scroll); |
---|
| 1533 | + //XYZPanel.setName("XYZ"); |
---|
1454 | 1534 | |
---|
1455 | 1535 | /* |
---|
1456 | 1536 | gridPanel = new JPanel(); //new BorderLayout()); |
---|
.. | .. |
---|
1488 | 1568 | //JScrollPane tmp = new JScrollPane(ctrlPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); |
---|
1489 | 1569 | //tmp.setName("Edit"); |
---|
1490 | 1570 | objectPanel.add(materialPanel); |
---|
| 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 | + |
---|
1491 | 1582 | // JPanel north = new JPanel(new BorderLayout()); |
---|
1492 | 1583 | // north.setName("Edit"); |
---|
1493 | 1584 | // north.add(ctrlPanel, BorderLayout.NORTH); |
---|
1494 | 1585 | // objectPanel.add(north); |
---|
1495 | 1586 | objectPanel.add(editPanel); |
---|
| 1587 | + objectPanel.setIconAt(3, GetIcon("icons/write.png")); |
---|
| 1588 | + objectPanel.setToolTipTextAt(3, "Edit controls"); |
---|
1496 | 1589 | |
---|
1497 | | - //if (Globals.ADVANCED) |
---|
1498 | | - objectPanel.add(infoPanel); |
---|
| 1590 | + objectPanel.add(XYZPanel); |
---|
| 1591 | + objectPanel.setIconAt(4, GetIcon("icons/XYZ.png")); |
---|
| 1592 | + objectPanel.setToolTipTextAt(4, "XYZ/RGB transform"); |
---|
1499 | 1593 | |
---|
1500 | | - objectPanel.add(toolboxPanel); |
---|
1501 | | - |
---|
1502 | 1594 | /* |
---|
1503 | 1595 | aConstraints.gridx = 0; |
---|
1504 | 1596 | aConstraints.gridwidth = 1; |
---|
.. | .. |
---|
1518 | 1610 | scrollpane.addMouseWheelListener(this); // Default not fast enough |
---|
1519 | 1611 | |
---|
1520 | 1612 | /*JTabbedPane*/ scenePanel = new cGridBag(); |
---|
1521 | | - scenePanel.preferredWidth = 6; |
---|
| 1613 | + scenePanel.preferredWidth = 5; |
---|
1522 | 1614 | |
---|
1523 | 1615 | JTabbedPane tabbedPane = new JTabbedPane(); |
---|
1524 | 1616 | tabbedPane.add(scrollpane); |
---|
.. | .. |
---|
1535 | 1627 | |
---|
1536 | 1628 | scenePanel.add(tabbedPane); |
---|
1537 | 1629 | |
---|
| 1630 | + //if (Globals.ADVANCED) |
---|
| 1631 | + tabbedPane.add(infoPanel); |
---|
| 1632 | + tabbedPane.setIconAt(3, GetIcon("icons/info.png")); |
---|
| 1633 | + tabbedPane.setToolTipTextAt(3, "Information"); |
---|
| 1634 | + |
---|
1538 | 1635 | /* |
---|
1539 | 1636 | cTree jTree = new cTree(null); |
---|
1540 | 1637 | ToolTipManager.sharedInstance().registerComponent(jTree); |
---|
.. | .. |
---|
1596 | 1693 | bigThree = new cGridBag(); |
---|
1597 | 1694 | bigThree.addComponent(scenePanel); |
---|
1598 | 1695 | bigThree.addComponent(centralPanel); |
---|
1599 | | - bigThree.addComponent(XYZPanel); |
---|
| 1696 | + //bigThree.addComponent(XYZPanel); |
---|
1600 | 1697 | |
---|
1601 | 1698 | // // SIDE EFFECT!!! |
---|
1602 | 1699 | // aConstraints.gridx = 0; |
---|
.. | .. |
---|
1637 | 1734 | frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); |
---|
1638 | 1735 | frame.addWindowListener(new WindowAdapter() |
---|
1639 | 1736 | { |
---|
1640 | | - |
---|
1641 | 1737 | public void windowClosing(WindowEvent e) |
---|
1642 | 1738 | { |
---|
1643 | 1739 | Close(); |
---|
.. | .. |
---|
1660 | 1756 | ctrlPanel.removeAll(); |
---|
1661 | 1757 | } |
---|
1662 | 1758 | |
---|
1663 | | - void SetupMaterial(cGridBag panel) |
---|
| 1759 | + void SetupMaterial(cGridBag materialpanel) |
---|
1664 | 1760 | { |
---|
1665 | | - /* |
---|
| 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 | + /* |
---|
1666 | 2134 | ctrlPanel.add(materialLabel = new JLabel("MATERIAL : "), aConstraints); |
---|
1667 | 2135 | materialLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1668 | | - */ |
---|
| 2136 | + */ |
---|
1669 | 2137 | |
---|
1670 | 2138 | cGridBag editBar = new cGridBag().setVertical(false); |
---|
1671 | 2139 | |
---|
.. | .. |
---|
1699 | 2167 | //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints); |
---|
1700 | 2168 | |
---|
1701 | 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); |
---|
1702 | 2183 | |
---|
1703 | 2184 | cGridBag color = new cGridBag(); |
---|
1704 | | - color.add(colorLabel = new JLabel("Color/hue")); // , aConstraints); |
---|
1705 | | - colorLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1706 | | - 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 | + |
---|
1707 | 2190 | //colorField.preferredWidth = 200; |
---|
1708 | 2191 | colorSection.add(color); |
---|
1709 | 2192 | |
---|
1710 | 2193 | cGridBag modulation = new cGridBag(); |
---|
1711 | 2194 | modulation.add(modulationLabel = new JLabel("Saturation")); // , aConstraints); |
---|
1712 | 2195 | modulationLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1713 | | - modulation.add(modulationField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
| 2196 | + modulation.add(saturationField = new cNumberSlider(this, 0.001, 1)); // , aConstraints); |
---|
1714 | 2197 | colorSection.add(modulation); |
---|
1715 | 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 | + |
---|
1716 | 2207 | cGridBag texture = new cGridBag(); |
---|
1717 | 2208 | texture.add(textureLabel = new JLabel("Texture")); // , aConstraints); |
---|
1718 | 2209 | textureLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1719 | 2210 | texture.add(textureField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
1720 | 2211 | colorSection.add(texture); |
---|
1721 | 2212 | |
---|
1722 | | - panel.add(new JSeparator()); |
---|
| 2213 | + panel.add(GetSeparator()); |
---|
1723 | 2214 | |
---|
1724 | 2215 | panel.add(colorSection); |
---|
1725 | 2216 | |
---|
.. | .. |
---|
1775 | 2266 | shadowbias.add(shadowbiasField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
1776 | 2267 | diffuseSection.add(shadowbias); |
---|
1777 | 2268 | |
---|
1778 | | - panel.add(new JSeparator()); |
---|
| 2269 | + panel.add(GetSeparator()); |
---|
1779 | 2270 | |
---|
1780 | 2271 | panel.add(diffuseSection); |
---|
1781 | 2272 | |
---|
.. | .. |
---|
1838 | 2329 | specularSection.add(anisoV); |
---|
1839 | 2330 | |
---|
1840 | 2331 | |
---|
1841 | | - panel.add(new JSeparator()); |
---|
| 2332 | + panel.add(GetSeparator()); |
---|
1842 | 2333 | |
---|
1843 | 2334 | panel.add(specularSection); |
---|
1844 | 2335 | |
---|
.. | .. |
---|
1863 | 2354 | backlitLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1864 | 2355 | backlit.add(backlitField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
1865 | 2356 | colorSection.add(backlit); |
---|
1866 | | - |
---|
1867 | | - cGridBag opacity = new cGridBag(); |
---|
1868 | | - opacity.add(opacityLabel = new JLabel("Opacity")); // , aConstraints); |
---|
1869 | | - opacityLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1870 | | - opacity.add(opacityField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
1871 | | - colorSection.add(opacity); |
---|
1872 | 2357 | |
---|
1873 | 2358 | //panel.add(new JSeparator()); |
---|
1874 | 2359 | |
---|
.. | .. |
---|
1914 | 2399 | opacityPower.add(opacityPowerField = new cNumberSlider(this, 0.0, 10 /*10 dec 2013*/)); // , aConstraints); |
---|
1915 | 2400 | textureSection.add(opacityPower); |
---|
1916 | 2401 | |
---|
1917 | | - panel.add(new JSeparator()); |
---|
| 2402 | + panel.add(GetSeparator()); |
---|
1918 | 2403 | |
---|
1919 | 2404 | panel.add(textureSection); |
---|
1920 | 2405 | |
---|
.. | .. |
---|
2901 | 3386 | |
---|
2902 | 3387 | freezematerial = true; |
---|
2903 | 3388 | colorField.setFloat(mat.color); |
---|
2904 | | - modulationField.setFloat(mat.modulation); |
---|
| 3389 | + saturationField.setFloat(mat.modulation); |
---|
2905 | 3390 | metalnessField.setFloat(mat.metalness); |
---|
2906 | 3391 | diffuseField.setFloat(mat.diffuse); |
---|
2907 | 3392 | specularField.setFloat(mat.specular); |
---|
.. | .. |
---|
3108 | 3593 | public void itemStateChanged(ItemEvent event) |
---|
3109 | 3594 | { |
---|
3110 | 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 |
---|
3111 | 3607 | if (event.getSource() == propagateToggle) |
---|
3112 | 3608 | { |
---|
3113 | 3609 | propagate ^= true; |
---|
.. | .. |
---|
3212 | 3708 | } else if (event.getSource() == liveCB) |
---|
3213 | 3709 | { |
---|
3214 | 3710 | copy.live ^= true; |
---|
| 3711 | + objEditor.refreshContents(true); // To show item colors |
---|
3215 | 3712 | return; |
---|
3216 | | - } else if (event.getSource() == selectCB) |
---|
| 3713 | + } else if (event.getSource() == selectableCB) |
---|
3217 | 3714 | { |
---|
3218 | 3715 | copy.dontselect ^= true; |
---|
3219 | 3716 | return; |
---|
.. | .. |
---|
3221 | 3718 | { |
---|
3222 | 3719 | copy.hide ^= true; |
---|
3223 | 3720 | copy.Touch(); // display list issue |
---|
3224 | | - objEditor.refreshContents(); |
---|
| 3721 | + objEditor.refreshContents(true); // To show item colors |
---|
3225 | 3722 | return; |
---|
3226 | 3723 | } else if (event.getSource() == link2masterCB) |
---|
3227 | 3724 | { |
---|
.. | .. |
---|
3477 | 3974 | |
---|
3478 | 3975 | static public byte[] Compress(Object3D o) |
---|
3479 | 3976 | { |
---|
| 3977 | + // Slower to actually compress. |
---|
3480 | 3978 | try |
---|
3481 | 3979 | { |
---|
3482 | 3980 | ByteArrayOutputStream baos = new ByteArrayOutputStream(); |
---|
3483 | | - java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(baos); |
---|
3484 | | - ObjectOutputStream out = new ObjectOutputStream(zstream); |
---|
| 3981 | +// java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(baos); |
---|
| 3982 | + ObjectOutputStream out = new ObjectOutputStream(baos); //zstream); |
---|
3485 | 3983 | |
---|
3486 | 3984 | Object3D parent = o.parent; |
---|
3487 | 3985 | o.parent = null; |
---|
.. | .. |
---|
3492 | 3990 | |
---|
3493 | 3991 | out.flush(); |
---|
3494 | 3992 | |
---|
3495 | | - zstream.close(); |
---|
| 3993 | + baos //zstream |
---|
| 3994 | + .close(); |
---|
3496 | 3995 | out.close(); |
---|
3497 | 3996 | |
---|
3498 | | - return baos.toByteArray(); |
---|
| 3997 | + byte[] bytes = baos.toByteArray(); |
---|
| 3998 | + |
---|
| 3999 | + System.out.println("save #bytes = " + bytes.length); |
---|
| 4000 | + return bytes; |
---|
3499 | 4001 | } catch (Exception e) |
---|
3500 | 4002 | { |
---|
3501 | 4003 | System.err.println(e); |
---|
.. | .. |
---|
3505 | 4007 | |
---|
3506 | 4008 | static public Object Uncompress(byte[] bytes) |
---|
3507 | 4009 | { |
---|
3508 | | - System.out.println("#bytes = " + bytes.length); |
---|
| 4010 | + System.out.println("restore #bytes = " + bytes.length); |
---|
3509 | 4011 | try |
---|
3510 | 4012 | { |
---|
3511 | 4013 | ByteArrayInputStream bais = new ByteArrayInputStream(bytes); |
---|
3512 | | - java.util.zip.GZIPInputStream istream = new java.util.zip.GZIPInputStream(bais); |
---|
3513 | | - ObjectInputStream in = new ObjectInputStream(istream); |
---|
| 4014 | + //java.util.zip.GZIPInputStream istream = new java.util.zip.GZIPInputStream(bais); |
---|
| 4015 | + ObjectInputStream in = new ObjectInputStream(bais); // istream); |
---|
3514 | 4016 | Object obj = in.readObject(); |
---|
| 4017 | + |
---|
| 4018 | + bais //istream |
---|
| 4019 | + .close(); |
---|
3515 | 4020 | in.close(); |
---|
3516 | 4021 | |
---|
3517 | 4022 | return obj; |
---|
.. | .. |
---|
3566 | 4071 | return null; |
---|
3567 | 4072 | } |
---|
3568 | 4073 | |
---|
3569 | | - java.util.Hashtable<java.util.UUID, Object3D> hashtable = new java.util.Hashtable<java.util.UUID, Object3D>(); |
---|
3570 | 4074 | |
---|
3571 | 4075 | public void Save() |
---|
3572 | 4076 | { |
---|
3573 | | - // Default reduces the probability of heuristics errors. |
---|
3574 | | - Save(true); |
---|
| 4077 | + //Save(true); |
---|
| 4078 | + Replace(); |
---|
| 4079 | + SetUndoStates(); |
---|
3575 | 4080 | } |
---|
3576 | 4081 | |
---|
3577 | 4082 | private boolean Equal(byte[] compress, byte[] name) |
---|
.. | .. |
---|
3590 | 4095 | return true; |
---|
3591 | 4096 | } |
---|
3592 | 4097 | |
---|
| 4098 | + java.util.Hashtable<java.util.UUID, Object3D> versiontable = new java.util.Hashtable<java.util.UUID, Object3D>(); |
---|
| 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 | + |
---|
3593 | 4112 | public boolean Save(boolean user) |
---|
3594 | 4113 | { |
---|
3595 | 4114 | System.err.println("Save"); |
---|
| 4115 | + //Replace(); |
---|
3596 | 4116 | |
---|
3597 | 4117 | cRadio tab = GetCurrentTab(); |
---|
3598 | 4118 | |
---|
3599 | | - boolean temp = CameraPane.SWITCH; |
---|
3600 | | - CameraPane.SWITCH = false; |
---|
3601 | | - |
---|
3602 | | - copy.ExtractBigData(hashtable); |
---|
3603 | | - |
---|
3604 | | - byte[] compress = Compress(copy); |
---|
3605 | | - |
---|
3606 | | - CameraPane.SWITCH = temp; |
---|
| 4119 | + Object3D compress = CompressCopy(); // Saved version. No need for "Replace"? |
---|
3607 | 4120 | |
---|
3608 | 4121 | boolean thesame = false; |
---|
3609 | 4122 | |
---|
3610 | | - // Quick heuristic using length. Works only when stream is compressed. |
---|
3611 | | - if (tab.undoindex > 0 && tab.graphs[tab.undoindex-1] != null && Equal(compress, tab.graphs[tab.undoindex-1])) |
---|
3612 | | - { |
---|
3613 | | - thesame = true; |
---|
3614 | | - } |
---|
| 4123 | +// if (copy.versionindex > 0 && copy.versions[copy.versionindex-1] != null && Equal(compress, copy.versions[copy.versionindex-1])) |
---|
| 4124 | +// { |
---|
| 4125 | +// thesame = true; |
---|
| 4126 | +// } |
---|
3615 | 4127 | |
---|
3616 | 4128 | //EditorFrame.m_MainFrame.requestFocusInWindow(); |
---|
3617 | 4129 | if (!thesame) |
---|
3618 | 4130 | { |
---|
3619 | | - tab.user[tab.undoindex] = user; |
---|
3620 | | - tab.graphs[tab.undoindex++] = compress; |
---|
| 4131 | + for (int i = copy.versionlist.length; --i > copy.versionindex+1;) |
---|
| 4132 | + { |
---|
| 4133 | + copy.versionlist[i] = copy.versionlist[i-1]; |
---|
| 4134 | + } |
---|
| 4135 | + |
---|
| 4136 | + //tab.user[tab.versionindex] = user; |
---|
| 4137 | + //boolean increment = true; // tab.graphs[tab.versionindex] == null; |
---|
| 4138 | + |
---|
| 4139 | + copy.versionlist[++copy.versionindex] = compress; |
---|
| 4140 | + |
---|
| 4141 | + // if (increment) |
---|
| 4142 | + // tab.versionindex++; |
---|
3621 | 4143 | } |
---|
3622 | 4144 | |
---|
3623 | | - copy.RestoreBigData(hashtable); |
---|
| 4145 | + //copy.RestoreBigData(versiontable); |
---|
3624 | 4146 | |
---|
3625 | 4147 | //assert(hashtable.isEmpty()); |
---|
3626 | 4148 | |
---|
3627 | | - for (int i = tab.undoindex; i < tab.graphs.length; i++) |
---|
3628 | | - { |
---|
3629 | | - tab.user[i] = false; |
---|
3630 | | - tab.graphs[i] = null; |
---|
3631 | | - } |
---|
| 4149 | +// for (int i = copy.versionindex+1; i < copy.versionlist.length; i++) |
---|
| 4150 | +// { |
---|
| 4151 | +// //tab.user[i] = false; |
---|
| 4152 | +// copy.versionlist[i] = null; |
---|
| 4153 | +// } |
---|
3632 | 4154 | |
---|
3633 | 4155 | SetUndoStates(); |
---|
3634 | 4156 | |
---|
.. | .. |
---|
3637 | 4159 | { |
---|
3638 | 4160 | try |
---|
3639 | 4161 | { |
---|
3640 | | - FileOutputStream ostream = new FileOutputStream("save" + tab.undoindex); |
---|
| 4162 | + FileOutputStream ostream = new FileOutputStream("save" + copy.versionindex); |
---|
3641 | 4163 | ObjectOutputStream p = new ObjectOutputStream(ostream); |
---|
3642 | 4164 | |
---|
3643 | 4165 | p.writeObject(copy); |
---|
.. | .. |
---|
3653 | 4175 | |
---|
3654 | 4176 | return !thesame; |
---|
3655 | 4177 | } |
---|
3656 | | - |
---|
3657 | | - void CopyChanged(Object3D obj) |
---|
| 4178 | + |
---|
| 4179 | + boolean flashIt = true; |
---|
| 4180 | + |
---|
| 4181 | + void RefreshSelection() |
---|
3658 | 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 | + |
---|
3659 | 4215 | SetUndoStates(); |
---|
3660 | 4216 | |
---|
3661 | 4217 | boolean temp = CameraPane.SWITCH; |
---|
3662 | 4218 | CameraPane.SWITCH = false; |
---|
3663 | 4219 | |
---|
3664 | | - copy.ExtractBigData(hashtable); |
---|
| 4220 | + copy.ExtractBigData(versiontable); |
---|
3665 | 4221 | |
---|
3666 | 4222 | copy.clear(); |
---|
3667 | 4223 | |
---|
| 4224 | + copy.skyboxname = obj.skyboxname; |
---|
| 4225 | + copy.skyboxext = obj.skyboxext; |
---|
| 4226 | + |
---|
3668 | 4227 | for (int i=0; i<obj.Size(); i++) |
---|
3669 | 4228 | { |
---|
3670 | 4229 | copy.add(obj.get(i)); |
---|
3671 | 4230 | } |
---|
3672 | 4231 | |
---|
3673 | | - copy.RestoreBigData(hashtable); |
---|
| 4232 | + copy.RestoreBigData(versiontable); |
---|
3674 | 4233 | |
---|
3675 | 4234 | CameraPane.SWITCH = temp; |
---|
3676 | 4235 | |
---|
| 4236 | + RefreshSelection(); |
---|
3677 | 4237 | //assert(hashtable.isEmpty()); |
---|
3678 | 4238 | |
---|
3679 | 4239 | copy.Touch(); |
---|
.. | .. |
---|
3694 | 4254 | } |
---|
3695 | 4255 | } |
---|
3696 | 4256 | |
---|
3697 | | - refreshContents(); |
---|
| 4257 | + refreshContents(true); |
---|
3698 | 4258 | } |
---|
3699 | 4259 | |
---|
3700 | | - cButton undoButton; |
---|
3701 | | - cButton redoButton; |
---|
| 4260 | + cButton previousVersionButton; |
---|
| 4261 | + cButton restoreButton; |
---|
| 4262 | + cButton replaceButton; |
---|
| 4263 | + cButton nextVersionButton; |
---|
| 4264 | + cButton saveVersionButton; |
---|
| 4265 | + cButton deleteVersionButton; |
---|
3702 | 4266 | |
---|
| 4267 | + boolean muteSlider; |
---|
| 4268 | + |
---|
| 4269 | + int VersionCount() |
---|
| 4270 | + { |
---|
| 4271 | + int count = 0; |
---|
| 4272 | + |
---|
| 4273 | + for (int i = copy.versionlist.length; --i >= 0;) |
---|
| 4274 | + { |
---|
| 4275 | + if (copy.versionlist[i] != null) |
---|
| 4276 | + count++; |
---|
| 4277 | + } |
---|
| 4278 | + |
---|
| 4279 | + return count; |
---|
| 4280 | + } |
---|
| 4281 | + |
---|
3703 | 4282 | void SetUndoStates() |
---|
3704 | 4283 | { |
---|
3705 | 4284 | cRadio tab = GetCurrentTab(); |
---|
3706 | 4285 | |
---|
3707 | | - undoButton.setEnabled(tab.undoindex > 0); |
---|
3708 | | - redoButton.setEnabled(tab.graphs[tab.undoindex + 1] != null); |
---|
| 4286 | + restoreButton.setEnabled(true); // copy.versionindex != -1); |
---|
| 4287 | + replaceButton.setEnabled(true); // copy.versionindex != -1); |
---|
| 4288 | + |
---|
| 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); |
---|
| 4294 | + |
---|
| 4295 | + muteSlider = true; |
---|
| 4296 | + versionSlider.setMaximum(VersionCount() - 1); |
---|
| 4297 | + versionSlider.setInteger(copy.versionindex); |
---|
| 4298 | + muteSlider = false; |
---|
3709 | 4299 | } |
---|
3710 | 4300 | |
---|
3711 | | - public boolean Undo() |
---|
| 4301 | + public boolean PreviousVersion() |
---|
3712 | 4302 | { |
---|
| 4303 | + // Option? |
---|
| 4304 | + Replace(); |
---|
| 4305 | + |
---|
3713 | 4306 | System.err.println("Undo"); |
---|
3714 | 4307 | |
---|
3715 | 4308 | cRadio tab = GetCurrentTab(); |
---|
3716 | 4309 | |
---|
3717 | | - if (tab.undoindex == 0) |
---|
| 4310 | + if (copy.versionindex == 0) |
---|
3718 | 4311 | { |
---|
3719 | 4312 | java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
3720 | 4313 | return false; |
---|
3721 | 4314 | } |
---|
3722 | 4315 | |
---|
3723 | | - if (tab.graphs[tab.undoindex] == null || !tab.user[tab.undoindex]) |
---|
3724 | | - { |
---|
3725 | | - if (Save(false)) |
---|
3726 | | - tab.undoindex -= 1; |
---|
3727 | | - else |
---|
3728 | | - { |
---|
3729 | | - if (tab.undoindex <= 0) |
---|
3730 | | - return false; |
---|
3731 | | - else |
---|
3732 | | - tab.undoindex -= 1; |
---|
3733 | | - } |
---|
3734 | | - } |
---|
| 4316 | +// if (tab.graphs[tab.versionindex] == null) // || !tab.user[tab.versionindex]) |
---|
| 4317 | +// { |
---|
| 4318 | +// if (Save(false)) |
---|
| 4319 | +// tab.versionindex -= 1; |
---|
| 4320 | +// else |
---|
| 4321 | +// { |
---|
| 4322 | +// if (tab.versionindex <= 0) |
---|
| 4323 | +// return false; |
---|
| 4324 | +// else |
---|
| 4325 | +// tab.versionindex -= 1; |
---|
| 4326 | +// } |
---|
| 4327 | +// } |
---|
3735 | 4328 | |
---|
3736 | | - tab.undoindex -= 1; |
---|
| 4329 | + copy.versionindex -= 1; |
---|
3737 | 4330 | |
---|
3738 | | - CopyChanged((Object3D)Uncompress(tab.graphs[tab.undoindex])); |
---|
| 4331 | + CopyChanged(); |
---|
3739 | 4332 | |
---|
3740 | 4333 | return true; |
---|
3741 | 4334 | } |
---|
3742 | 4335 | |
---|
3743 | | - public void Redo() |
---|
| 4336 | + public boolean Restore() |
---|
3744 | 4337 | { |
---|
| 4338 | + System.err.println("Restore"); |
---|
| 4339 | + |
---|
3745 | 4340 | cRadio tab = GetCurrentTab(); |
---|
3746 | 4341 | |
---|
3747 | | - if (tab.graphs[tab.undoindex + 1] == null) |
---|
| 4342 | + if (copy.versionindex == -1 || copy.versionlist[copy.versionindex] == null) |
---|
| 4343 | + { |
---|
| 4344 | + java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
| 4345 | + return false; |
---|
| 4346 | + } |
---|
| 4347 | + |
---|
| 4348 | + //CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex])); |
---|
| 4349 | + CopyChanged(); |
---|
| 4350 | + |
---|
| 4351 | + return true; |
---|
| 4352 | + } |
---|
| 4353 | + |
---|
| 4354 | + public boolean Replace() |
---|
| 4355 | + { |
---|
| 4356 | + System.err.println("Replace"); |
---|
| 4357 | + |
---|
| 4358 | + cRadio tab = GetCurrentTab(); |
---|
| 4359 | + |
---|
| 4360 | + if (copy.versionindex == -1 || copy.versionlist[copy.versionindex] == null) |
---|
| 4361 | + { |
---|
| 4362 | + // No version yet. OK. java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
| 4363 | + return false; |
---|
| 4364 | + } |
---|
| 4365 | + |
---|
| 4366 | + copy.versionlist[copy.versionindex] = CompressCopy(); |
---|
| 4367 | + |
---|
| 4368 | + return true; |
---|
| 4369 | + } |
---|
| 4370 | + |
---|
| 4371 | + public void NextVersion() |
---|
| 4372 | + { |
---|
| 4373 | + // Option? |
---|
| 4374 | + Replace(); |
---|
| 4375 | + |
---|
| 4376 | + cRadio tab = GetCurrentTab(); |
---|
| 4377 | + |
---|
| 4378 | + if (copy.versionlist[copy.versionindex + 1] == null) |
---|
3748 | 4379 | { |
---|
3749 | 4380 | java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
3750 | 4381 | return; |
---|
3751 | 4382 | } |
---|
3752 | 4383 | |
---|
3753 | | - tab.undoindex += 1; |
---|
| 4384 | + copy.versionindex += 1; |
---|
3754 | 4385 | |
---|
3755 | | - CopyChanged((Object3D)Uncompress(tab.graphs[tab.undoindex])); |
---|
| 4386 | + CopyChanged(); |
---|
3756 | 4387 | |
---|
3757 | | - if (!tab.user[tab.undoindex]) |
---|
3758 | | - tab.graphs[tab.undoindex] = null; |
---|
| 4388 | + //if (!tab.user[tab.versionindex]) |
---|
| 4389 | + // tab.graphs[tab.versionindex] = null; |
---|
3759 | 4390 | } |
---|
3760 | 4391 | |
---|
3761 | 4392 | void ImportGFD() |
---|
.. | .. |
---|
3966 | 4597 | //copy.material = new cMaterial(copy.GetMaterial()); |
---|
3967 | 4598 | |
---|
3968 | 4599 | current.color = (float) colorField.getFloat(); |
---|
3969 | | - current.modulation = (float) modulationField.getFloat(); |
---|
| 4600 | + current.modulation = (float) saturationField.getFloat(); |
---|
3970 | 4601 | current.metalness = (float) metalnessField.getFloat(); |
---|
3971 | 4602 | current.diffuse = (float) diffuseField.getFloat(); |
---|
3972 | 4603 | current.specular = (float) specularField.getFloat(); |
---|
.. | .. |
---|
3999 | 4630 | cMaterial mat = copy.material; |
---|
4000 | 4631 | |
---|
4001 | 4632 | colorField.SetToolTipValue((mat.color)); |
---|
4002 | | - modulationField.SetToolTipValue((mat.modulation)); |
---|
| 4633 | + saturationField.SetToolTipValue((mat.modulation)); |
---|
4003 | 4634 | metalnessField.SetToolTipValue((mat.metalness)); |
---|
4004 | 4635 | diffuseField.SetToolTipValue((mat.diffuse)); |
---|
4005 | 4636 | specularField.SetToolTipValue((mat.specular)); |
---|
.. | .. |
---|
4051 | 4682 | //copy.Touch(); |
---|
4052 | 4683 | } |
---|
4053 | 4684 | |
---|
| 4685 | + cNumberSlider versionSlider; |
---|
| 4686 | + |
---|
4054 | 4687 | public void stateChanged(ChangeEvent e) |
---|
4055 | 4688 | { |
---|
4056 | 4689 | // assert(false); |
---|
| 4690 | + if (e.getSource() == versionSlider) |
---|
| 4691 | + { |
---|
| 4692 | + if (muteSlider) |
---|
| 4693 | + return; |
---|
| 4694 | + |
---|
| 4695 | + int version = versionSlider.getInteger(); |
---|
| 4696 | + |
---|
| 4697 | + if (copy.versionlist[version] != null) |
---|
| 4698 | + { |
---|
| 4699 | + copy.versionindex = version; |
---|
| 4700 | + CopyChanged(); |
---|
| 4701 | + } |
---|
| 4702 | + |
---|
| 4703 | + return; |
---|
| 4704 | + } |
---|
4057 | 4705 | |
---|
4058 | 4706 | if (freezematerial) |
---|
4059 | 4707 | { |
---|
.. | .. |
---|
4089 | 4737 | { |
---|
4090 | 4738 | //System.out.println("stateChanged = " + this); |
---|
4091 | 4739 | materialtouched = true; |
---|
| 4740 | + |
---|
| 4741 | + if (e.getSource() == colorField && saturationField.getFloat() == 0.001) |
---|
| 4742 | + { |
---|
| 4743 | + saturationField.setFloat(1); |
---|
| 4744 | + } |
---|
| 4745 | + |
---|
4092 | 4746 | applySelf(); |
---|
4093 | 4747 | //System.out.println("this = " + this); |
---|
4094 | 4748 | //System.out.println("PARENT = " + parent); |
---|
.. | .. |
---|
4388 | 5042 | { |
---|
4389 | 5043 | if (GetTree() != null) |
---|
4390 | 5044 | { |
---|
| 5045 | + GetTree().revalidate(); |
---|
4391 | 5046 | GetTree().repaint(); |
---|
4392 | 5047 | } |
---|
4393 | 5048 | |
---|
.. | .. |
---|
4396 | 5051 | ctrlPanel.validate(); // ? new |
---|
4397 | 5052 | ctrlPanel.repaint(); |
---|
4398 | 5053 | } |
---|
| 5054 | + |
---|
| 5055 | + if (previousVersionButton != null && copy.versionlist != null) |
---|
| 5056 | + SetUndoStates(); |
---|
4399 | 5057 | } |
---|
4400 | 5058 | |
---|
4401 | 5059 | static TweenManager tweenManager = new TweenManager(); |
---|
4402 | 5060 | |
---|
4403 | 5061 | void makeSomething(Object3D thing, boolean resetmodel) // deselect) |
---|
4404 | 5062 | { |
---|
4405 | | - if (Globals.SAVEONMAKE) // && resetmodel) |
---|
| 5063 | + if (Globals.REPLACEONMAKE) // && resetmodel) |
---|
4406 | 5064 | Save(); |
---|
4407 | 5065 | //Tween.set(thing, 0).target(1).start(tweenManager); |
---|
4408 | 5066 | //Tween.to(thing, 0, 0.5f).target(0).start(tweenManager); |
---|
.. | .. |
---|
4644 | 5302 | readobj.ResetDisplayList(); |
---|
4645 | 5303 | } catch (Exception e) |
---|
4646 | 5304 | { |
---|
4647 | | - //e.printStackTrace(); |
---|
| 5305 | + if (!e.toString().contains("GZIP")) |
---|
| 5306 | + e.printStackTrace(); |
---|
| 5307 | + |
---|
4648 | 5308 | try |
---|
4649 | 5309 | { |
---|
4650 | 5310 | java.io.FileInputStream istream = new java.io.FileInputStream(fullname); |
---|
.. | .. |
---|
4718 | 5378 | |
---|
4719 | 5379 | if (readobj != null) |
---|
4720 | 5380 | { |
---|
4721 | | - if (Globals.SAVEONMAKE) |
---|
4722 | | - Save(); |
---|
| 5381 | + //if (Globals.SAVEONMAKE) // A new object cannot share meshes |
---|
| 5382 | + // Save(); |
---|
4723 | 5383 | try |
---|
4724 | 5384 | { |
---|
4725 | 5385 | //readobj.deepCopySelf(copy); |
---|
4726 | 5386 | copy.clear(); // june 2014 |
---|
| 5387 | + copy.skyboxname = readobj.skyboxname; |
---|
| 5388 | + copy.skyboxext = readobj.skyboxext; |
---|
4727 | 5389 | for (int i = 0; i < readobj.size(); i++) |
---|
4728 | 5390 | { |
---|
4729 | 5391 | Object3D child = readobj.get(i); // reserve(i); |
---|
.. | .. |
---|
4764 | 5426 | } |
---|
4765 | 5427 | } catch (ClassCastException e) |
---|
4766 | 5428 | { |
---|
| 5429 | + e.printStackTrace(); |
---|
4767 | 5430 | assert (false); |
---|
4768 | 5431 | Composite c = (Composite) copy; |
---|
4769 | 5432 | c.children.clear(); |
---|
.. | .. |
---|
4774 | 5437 | c.addChild(csg); |
---|
4775 | 5438 | } |
---|
4776 | 5439 | |
---|
| 5440 | + copy.versionlist = readobj.versionlist; |
---|
| 5441 | + copy.versionindex = readobj.versionindex; |
---|
| 5442 | + |
---|
| 5443 | + if (copy.versionlist == null) |
---|
| 5444 | + { |
---|
| 5445 | + copy.versionlist = new Object3D[100]; |
---|
| 5446 | + copy.versionindex = -1; |
---|
| 5447 | + } |
---|
| 5448 | + |
---|
| 5449 | + //? SetUndoStates(); |
---|
| 5450 | + |
---|
4777 | 5451 | ResetModel(); |
---|
4778 | 5452 | copy.HardTouch(); // recompile? |
---|
4779 | 5453 | refreshContents(); |
---|
.. | .. |
---|
4784 | 5458 | { |
---|
4785 | 5459 | if (Grafreed.standAlone) |
---|
4786 | 5460 | { |
---|
4787 | | - FileDialog browser = new FileDialog(frame, "Load", FileDialog.LOAD); |
---|
| 5461 | + FileDialog browser = new FileDialog(frame, "Open", FileDialog.LOAD); |
---|
4788 | 5462 | browser.show(); |
---|
4789 | 5463 | String filename = browser.getFile(); |
---|
4790 | 5464 | if (filename != null && filename.length() > 0) |
---|
.. | .. |
---|
4883 | 5557 | //ps.print(buffer.toString()); |
---|
4884 | 5558 | } catch (IOException e) |
---|
4885 | 5559 | { |
---|
| 5560 | + e.printStackTrace(); |
---|
4886 | 5561 | } |
---|
4887 | 5562 | } |
---|
4888 | 5563 | |
---|
.. | .. |
---|
5102 | 5777 | ButtonGroup buttonGroup; |
---|
5103 | 5778 | |
---|
5104 | 5779 | cGridBag toolboxPanel; |
---|
| 5780 | + cGridBag skyboxPanel; |
---|
5105 | 5781 | cGridBag materialPanel; |
---|
5106 | 5782 | cGridBag ctrlPanel; |
---|
5107 | 5783 | |
---|
.. | .. |
---|
5175 | 5851 | JLabel colorLabel; |
---|
5176 | 5852 | cNumberSlider colorField; |
---|
5177 | 5853 | JLabel modulationLabel; |
---|
5178 | | - cNumberSlider modulationField; |
---|
| 5854 | + cNumberSlider saturationField; |
---|
5179 | 5855 | JLabel metalnessLabel; |
---|
5180 | 5856 | cNumberSlider metalnessField; |
---|
5181 | 5857 | JLabel diffuseLabel; |
---|