.. | .. |
---|
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 | |
---|
77 | | - ImageIcon GetIcon(String name) |
---|
| 107 | + static java.util.Hashtable<String, javax.swing.ImageIcon> icons = new java.util.Hashtable<String, javax.swing.ImageIcon>(); |
---|
| 108 | + |
---|
| 109 | + static 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 | | - BufferedImage image = javax.imageio.ImageIO.read(getClass().getClassLoader().getResourceAsStream(name)); |
---|
| 119 | + BufferedImage image = javax.imageio.ImageIO.read(ObjEditor.class.getClassLoader().getResourceAsStream(name)); |
---|
82 | 120 | |
---|
83 | 121 | // if (image.getWidth() > 48 && image.getHeight() > 48) |
---|
84 | 122 | // { |
---|
.. | .. |
---|
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.versions == null) |
---|
300 | | - { |
---|
301 | | - copy.versions = 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 | } |
---|
.. | .. |
---|
315 | 359 | client = inClient; |
---|
316 | 360 | copy = client; |
---|
317 | 361 | |
---|
318 | | - if (copy.versions == null) |
---|
| 362 | + if (copy.versionlist == null) |
---|
319 | 363 | { |
---|
320 | | - copy.versions = new Object3D[100]; |
---|
| 364 | + copy.versionlist = new Object3D[100]; |
---|
321 | 365 | copy.versionindex = -1; |
---|
| 366 | + |
---|
| 367 | +// Save(true); |
---|
322 | 368 | } |
---|
323 | 369 | |
---|
324 | 370 | SetupUI2(callee.GetEditor()); |
---|
.. | .. |
---|
342 | 388 | //parent = p; |
---|
343 | 389 | |
---|
344 | 390 | GraphicsDevice gd = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice(); |
---|
345 | | - System.out.println("getFullScreenWindow? " + gd.getFullScreenWindow()); |
---|
| 391 | + if (Globals.DEBUG) |
---|
| 392 | + System.out.println("getFullScreenWindow? " + gd.getFullScreenWindow()); |
---|
346 | 393 | //gd.setFullScreenWindow(this); |
---|
347 | 394 | //setResizable(false); |
---|
348 | 395 | //if (!isDisplayable()) |
---|
.. | .. |
---|
353 | 400 | copy = localCopy; |
---|
354 | 401 | copy.editWindow = this; |
---|
355 | 402 | |
---|
356 | | - if (copy.versions == null) |
---|
357 | | - { |
---|
358 | | -// copy.versions = new byte[100][]; |
---|
| 403 | +// if (copy.versionlist == null) |
---|
| 404 | +// { |
---|
| 405 | +// copy.versionlist = new Object3D[100]; |
---|
359 | 406 | // copy.versionindex = -1; |
---|
360 | | - } |
---|
| 407 | +// |
---|
| 408 | +// Save(true); |
---|
| 409 | +// } |
---|
361 | 410 | |
---|
362 | 411 | SetupMenu(); |
---|
363 | 412 | |
---|
.. | .. |
---|
377 | 426 | |
---|
378 | 427 | static java.util.Vector<Object3D> listUI = new java.util.Vector<Object3D>(); |
---|
379 | 428 | |
---|
| 429 | + // This is to refresh the UI of the material panel. |
---|
| 430 | + boolean patchMaterial; |
---|
| 431 | + |
---|
380 | 432 | void SetupMenu() |
---|
381 | 433 | { |
---|
382 | 434 | frame.setMenuBar(menuBar = new MenuBar()); |
---|
.. | .. |
---|
426 | 478 | |
---|
427 | 479 | ChangeListener changeListener = new ChangeListener() |
---|
428 | 480 | { |
---|
| 481 | + //String name; |
---|
| 482 | + |
---|
429 | 483 | public void stateChanged(ChangeEvent changeEvent) |
---|
430 | 484 | { |
---|
431 | 485 | // if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Material") && !materialFlushed) |
---|
.. | .. |
---|
444 | 498 | // EditSelection(false); |
---|
445 | 499 | // } |
---|
446 | 500 | |
---|
447 | | - refreshContents(false); // To refresh Info tab |
---|
| 501 | +// if (objectPanel.getSelectedIndex() == 4) |
---|
| 502 | +// { |
---|
| 503 | +// name = copy.skyboxname; |
---|
| 504 | +// |
---|
| 505 | +// if (name == null) |
---|
| 506 | +// { |
---|
| 507 | +// name = ""; |
---|
| 508 | +// } |
---|
| 509 | +// |
---|
| 510 | +// copy.skyboxname = "cubemaps/default-skyboxes/rgb"; |
---|
| 511 | +// copy.skyboxext = "jpg"; |
---|
| 512 | +// } |
---|
| 513 | +// else |
---|
| 514 | +// { |
---|
| 515 | +// if (name != null) |
---|
| 516 | +// { |
---|
| 517 | +// if (name.equals("")) |
---|
| 518 | +// { |
---|
| 519 | +// copy.skyboxname = null; |
---|
| 520 | +// copy.skyboxext = null; |
---|
| 521 | +// } |
---|
| 522 | +// else |
---|
| 523 | +// { |
---|
| 524 | +// copy.skyboxname = name; |
---|
| 525 | +// } |
---|
| 526 | +// } |
---|
| 527 | +// } |
---|
| 528 | + cameraView.transformMode = objectPanel.getSelectedIndex() == 4; |
---|
| 529 | + |
---|
| 530 | +// refreshContents(false); // To refresh Info tab |
---|
| 531 | + cameraView.repaint(); |
---|
448 | 532 | } |
---|
449 | 533 | }; |
---|
450 | 534 | objectPanel.addChangeListener(changeListener); |
---|
.. | .. |
---|
467 | 551 | toolboxPanel = new cGridBag().setVertical(true); |
---|
468 | 552 | //toolboxPanel.setName("Toolbox"); |
---|
469 | 553 | |
---|
470 | | - materialPanel = new cGridBag().setVertical(true); |
---|
| 554 | + skyboxPanel = new cGridBag().setVertical(true); |
---|
| 555 | + |
---|
| 556 | + materialPanel = new cGridBag().setVertical(false); |
---|
471 | 557 | //materialPanel.setName("Material"); |
---|
472 | 558 | |
---|
473 | 559 | /*JTextPane*/ |
---|
.. | .. |
---|
751 | 837 | boolean maximized; |
---|
752 | 838 | |
---|
753 | 839 | cButton fullscreenLayout; |
---|
| 840 | + cButton expandedLayout; |
---|
754 | 841 | |
---|
755 | 842 | void Minimize() |
---|
756 | 843 | { |
---|
.. | .. |
---|
790 | 877 | cButton minButton; |
---|
791 | 878 | cButton maxButton; |
---|
792 | 879 | cButton fullButton; |
---|
| 880 | + cButton collapseButton; |
---|
| 881 | + cButton maximize3DButton; |
---|
793 | 882 | |
---|
794 | 883 | void ToggleFullScreen() |
---|
795 | 884 | { |
---|
796 | | -GraphicsDevice device = frame.getGraphicsConfiguration().getDevice(); |
---|
| 885 | + GraphicsDevice device = frame.getGraphicsConfiguration().getDevice(); |
---|
797 | 886 | |
---|
798 | 887 | cameraView.ToggleFullScreen(); |
---|
799 | 888 | |
---|
.. | .. |
---|
814 | 903 | // X frame.getContentPane().remove(/*"Center",*/bigThree); |
---|
815 | 904 | // X framePanel.add(bigThree); |
---|
816 | 905 | // X frame.getContentPane().add(/*"Center",*/framePanel); |
---|
817 | | - framePanel.setDividerLocation(46); |
---|
| 906 | +// framePanel.setDividerLocation(46); // icons are 24x24 |
---|
818 | 907 | |
---|
819 | 908 | //frame.setVisible(true); |
---|
820 | | - radio.layout = keepButton; |
---|
| 909 | +// radio.layout = keepButton; |
---|
821 | 910 | //theFrame = null; |
---|
822 | 911 | keepButton = null; |
---|
823 | | - radio.layout.doClick(); |
---|
| 912 | +// radio.layout.doClick(); |
---|
824 | 913 | |
---|
825 | 914 | } else |
---|
826 | 915 | { |
---|
.. | .. |
---|
841 | 930 | // X frame.getContentPane().remove(/*"Center",*/framePanel); |
---|
842 | 931 | // X framePanel.remove(bigThree); |
---|
843 | 932 | // X frame.getContentPane().add(/*"Center",*/bigThree); |
---|
844 | | - framePanel.setDividerLocation(0); |
---|
| 933 | +// framePanel.setDividerLocation(0); |
---|
845 | 934 | |
---|
846 | | - radio.layout = fullscreenLayout; |
---|
847 | | - radio.layout.doClick(); |
---|
| 935 | +// radio.layout = fullscreenLayout; |
---|
| 936 | +// radio.layout.doClick(); |
---|
848 | 937 | //frame.setVisible(true); |
---|
849 | 938 | } |
---|
850 | 939 | frame.validate(); |
---|
| 940 | + |
---|
| 941 | + cameraView.requestFocusInWindow(); |
---|
851 | 942 | } |
---|
852 | 943 | |
---|
853 | | - private Object3D CompressCopy() |
---|
| 944 | + void CollapseToolbar() |
---|
| 945 | + { |
---|
| 946 | + framePanel.setDividerLocation(0); |
---|
| 947 | + //frame.validate(); |
---|
| 948 | + |
---|
| 949 | + cameraView.requestFocusInWindow(); |
---|
| 950 | + } |
---|
| 951 | + |
---|
| 952 | + private Object3D Duplicate(Object3D object) |
---|
854 | 953 | { |
---|
855 | 954 | boolean temp = CameraPane.SWITCH; |
---|
856 | 955 | CameraPane.SWITCH = false; |
---|
857 | 956 | |
---|
858 | | - copy.ExtractBigData(versiontable); |
---|
| 957 | + if (Grafreed.grafreed.universe.versiontable == null) |
---|
| 958 | + Grafreed.grafreed.universe.versiontable = new java.util.Hashtable<java.util.UUID, Object3D>(); |
---|
| 959 | + |
---|
| 960 | + object.ExtractBigData(Grafreed.grafreed.universe.versiontable); |
---|
859 | 961 | // if (copy == client) |
---|
860 | 962 | |
---|
861 | | - Object3D versions[] = copy.versions; |
---|
862 | | - copy.versions = null; |
---|
| 963 | + Object3D versions[] = object.versionlist; |
---|
| 964 | + java.util.Hashtable<java.util.UUID, Object3D> versiontable = object.versiontable; // if Grafreed.grafreed.universe |
---|
| 965 | + object.versionlist = null; |
---|
| 966 | + object.versiontable = null; |
---|
863 | 967 | |
---|
864 | 968 | //byte[] compress = Compress(copy); |
---|
865 | | - Object3D compress = (Object3D)Grafreed.clone(copy); |
---|
| 969 | + Object3D compress = (Object3D)Grafreed.clone(object); |
---|
866 | 970 | |
---|
867 | | - copy.versions = versions; |
---|
| 971 | + object.versionlist = versions; |
---|
| 972 | + object.versiontable = versiontable; // if Grafreed.grafreed.universe |
---|
868 | 973 | |
---|
869 | | - copy.RestoreBigData(versiontable); |
---|
| 974 | + object.RestoreBigData(Grafreed.grafreed.universe.versiontable); |
---|
870 | 975 | |
---|
871 | 976 | CameraPane.SWITCH = temp; |
---|
872 | 977 | |
---|
.. | .. |
---|
994 | 1099 | { |
---|
995 | 1100 | SetupMaterial(materialPanel); |
---|
996 | 1101 | } |
---|
| 1102 | + |
---|
997 | 1103 | //SetupName(); |
---|
998 | 1104 | //SetupViews(); |
---|
999 | 1105 | } |
---|
.. | .. |
---|
1202 | 1308 | |
---|
1203 | 1309 | namePanel = new cGridBag(); |
---|
1204 | 1310 | |
---|
| 1311 | + //if (copy.pinned) |
---|
| 1312 | + { |
---|
| 1313 | + pinButton = GetToggleButton("icons/pin.png", !Grafreed.NIMBUSLAF); |
---|
| 1314 | + pinButton.setSelected(copy.pinned); |
---|
| 1315 | + cGridBag t = new cGridBag(); |
---|
| 1316 | + t.preferredWidth = 2; |
---|
| 1317 | + t.add(pinButton); |
---|
| 1318 | + namePanel.add(t); |
---|
| 1319 | + |
---|
| 1320 | + pinButton.addItemListener(this); |
---|
| 1321 | + } |
---|
| 1322 | + |
---|
1205 | 1323 | nameField = AddText(namePanel, copy.GetName()); |
---|
1206 | 1324 | namePanel.add(new JScrollPane(nameField, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER)); |
---|
1207 | 1325 | oe.ctrlPanel.add(namePanel); |
---|
.. | .. |
---|
1215 | 1333 | |
---|
1216 | 1334 | liveCB = AddCheckBox(setupPanel, "Live", copy.live); |
---|
1217 | 1335 | liveCB.setToolTipText("Animate object"); |
---|
| 1336 | + markCB = AddCheckBox(setupPanel, "Anim", copy.marked); |
---|
| 1337 | + markCB.setToolTipText("Set target transform"); |
---|
1218 | 1338 | selectableCB = AddCheckBox(setupPanel, "Select", !copy.dontselect); |
---|
1219 | 1339 | selectableCB.setToolTipText("Make object selectable"); |
---|
1220 | 1340 | // Return(); |
---|
1221 | 1341 | |
---|
1222 | 1342 | hideCB = AddCheckBox(setupPanel, "Hide", copy.hide); |
---|
1223 | 1343 | hideCB.setToolTipText("Hide object"); |
---|
1224 | | - markCB = AddCheckBox(setupPanel, "Mark", copy.marked); |
---|
1225 | | - markCB.setToolTipText("As animation target transform"); |
---|
1226 | 1344 | |
---|
1227 | 1345 | ToolTipManager.sharedInstance().setLightWeightPopupEnabled(false); |
---|
1228 | 1346 | |
---|
.. | .. |
---|
1424 | 1542 | |
---|
1425 | 1543 | if (cam == null || !(copy.get(0) instanceof cGroup)) |
---|
1426 | 1544 | { |
---|
| 1545 | + if (Globals.DEBUG) |
---|
1427 | 1546 | System.out.println("CREATE CAMERAS"); |
---|
1428 | 1547 | cams = new cTemplate(); |
---|
1429 | 1548 | cams.name = "Cameras"; |
---|
.. | .. |
---|
1549 | 1668 | |
---|
1550 | 1669 | //JScrollPane tmp = new JScrollPane(ctrlPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); |
---|
1551 | 1670 | //tmp.setName("Edit"); |
---|
| 1671 | + objectPanel.add(toolboxPanel); |
---|
| 1672 | + objectPanel.setIconAt(0, GetIcon("icons/primitives.png")); |
---|
| 1673 | + objectPanel.setToolTipTextAt(0, "Objects & textures"); |
---|
| 1674 | + |
---|
1552 | 1675 | objectPanel.add(materialPanel); |
---|
1553 | | - objectPanel.setIconAt(0, GetIcon("icons/material.png")); |
---|
1554 | | - objectPanel.setToolTipTextAt(0, "Material panel"); |
---|
| 1676 | + objectPanel.setIconAt(1, GetIcon("icons/material.png")); |
---|
| 1677 | + objectPanel.setToolTipTextAt(1, "Material"); |
---|
1555 | 1678 | |
---|
| 1679 | + objectPanel.add(skyboxPanel); |
---|
| 1680 | + objectPanel.setIconAt(2, GetIcon("icons/skybox.jpg")); |
---|
| 1681 | + objectPanel.setToolTipTextAt(2, "Backgrounds"); |
---|
| 1682 | + |
---|
1556 | 1683 | // JPanel north = new JPanel(new BorderLayout()); |
---|
1557 | 1684 | // north.setName("Edit"); |
---|
1558 | 1685 | // north.add(ctrlPanel, BorderLayout.NORTH); |
---|
1559 | 1686 | // objectPanel.add(north); |
---|
1560 | 1687 | objectPanel.add(editPanel); |
---|
1561 | | - objectPanel.setIconAt(1, GetIcon("icons/write.png")); |
---|
1562 | | - objectPanel.setToolTipTextAt(1, "Edit panel"); |
---|
1563 | | - |
---|
1564 | | - //if (Globals.ADVANCED) |
---|
1565 | | - objectPanel.add(infoPanel); |
---|
1566 | | - objectPanel.setIconAt(2, GetIcon("icons/info.png")); |
---|
1567 | | - objectPanel.setToolTipTextAt(2, "Info panel"); |
---|
| 1688 | + objectPanel.setIconAt(3, GetIcon("icons/write.png")); |
---|
| 1689 | + objectPanel.setToolTipTextAt(3, "Edit controls"); |
---|
1568 | 1690 | |
---|
1569 | 1691 | objectPanel.add(XYZPanel); |
---|
1570 | | - objectPanel.setIconAt(3, GetIcon("icons/XYZ.png")); |
---|
1571 | | - objectPanel.setToolTipTextAt(3, "XYZ/RGB panel"); |
---|
| 1692 | + objectPanel.setIconAt(4, GetIcon("icons/XYZ.png")); |
---|
| 1693 | + objectPanel.setToolTipTextAt(4, "XYZ/RGB transform"); |
---|
1572 | 1694 | |
---|
1573 | | - objectPanel.add(toolboxPanel); |
---|
1574 | | - objectPanel.setIconAt(4, GetIcon("icons/primitives.png")); |
---|
1575 | | - objectPanel.setToolTipTextAt(4, "Objects/backgrounds panel"); |
---|
1576 | | - |
---|
| 1695 | + patchMaterial = true; |
---|
| 1696 | + cameraView.patchMaterial = this; |
---|
| 1697 | + objectPanel.setSelectedIndex(1); |
---|
| 1698 | + |
---|
1577 | 1699 | /* |
---|
1578 | 1700 | aConstraints.gridx = 0; |
---|
1579 | 1701 | aConstraints.gridwidth = 1; |
---|
.. | .. |
---|
1593 | 1715 | scrollpane.addMouseWheelListener(this); // Default not fast enough |
---|
1594 | 1716 | |
---|
1595 | 1717 | /*JTabbedPane*/ scenePanel = new cGridBag(); |
---|
1596 | | - scenePanel.preferredWidth = 5; |
---|
| 1718 | + scenePanel.preferredWidth = 6; |
---|
1597 | 1719 | |
---|
1598 | 1720 | JTabbedPane tabbedPane = new JTabbedPane(); |
---|
1599 | 1721 | tabbedPane.add(scrollpane); |
---|
.. | .. |
---|
1610 | 1732 | |
---|
1611 | 1733 | scenePanel.add(tabbedPane); |
---|
1612 | 1734 | |
---|
| 1735 | + //if (Globals.ADVANCED) |
---|
| 1736 | +// tabbedPane.add(infoPanel); |
---|
| 1737 | +// tabbedPane.setIconAt(3, GetIcon("icons/info.png")); |
---|
| 1738 | +// tabbedPane.setToolTipTextAt(3, "Information"); |
---|
| 1739 | + |
---|
1613 | 1740 | /* |
---|
1614 | 1741 | cTree jTree = new cTree(null); |
---|
1615 | 1742 | ToolTipManager.sharedInstance().registerComponent(jTree); |
---|
.. | .. |
---|
1680 | 1807 | // aConstraints.gridheight = 1; |
---|
1681 | 1808 | |
---|
1682 | 1809 | framePanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, toolbarPanel, bigThree); |
---|
| 1810 | + |
---|
| 1811 | + framePanel.addPropertyChangeListener(JSplitPane.DIVIDER_LOCATION_PROPERTY, |
---|
| 1812 | + new java.beans.PropertyChangeListener() |
---|
| 1813 | + { |
---|
| 1814 | + public void propertyChange(java.beans.PropertyChangeEvent pce) |
---|
| 1815 | + { |
---|
| 1816 | + if ((Integer)pce.getOldValue() == 1) |
---|
| 1817 | + { |
---|
| 1818 | + if (radio.layout != expandedLayout) |
---|
| 1819 | + { |
---|
| 1820 | + radio.layout = expandedLayout; |
---|
| 1821 | + radio.layout.doClick(); |
---|
| 1822 | + } |
---|
| 1823 | + } |
---|
| 1824 | + } |
---|
| 1825 | + }); |
---|
| 1826 | + |
---|
1683 | 1827 | framePanel.setContinuousLayout(false); |
---|
1684 | 1828 | framePanel.setOneTouchExpandable(false); |
---|
1685 | 1829 | //.setDividerLocation(0.8); |
---|
.. | .. |
---|
1689 | 1833 | |
---|
1690 | 1834 | frame.getContentPane().setLayout(new BorderLayout()); |
---|
1691 | 1835 | /**/ |
---|
1692 | | - JTabbedPane worldPane = new JTabbedPane(); |
---|
| 1836 | + //JTabbedPane worldPane = new JTabbedPane(); |
---|
1693 | 1837 | //worldPane.add(bigPanel); |
---|
1694 | 1838 | //worldPane.add(worldPanel); |
---|
1695 | 1839 | /**/ |
---|
.. | .. |
---|
1734 | 1878 | ctrlPanel.removeAll(); |
---|
1735 | 1879 | } |
---|
1736 | 1880 | |
---|
1737 | | - void SetupMaterial(cGridBag panel) |
---|
| 1881 | + void SetupMaterial(cGridBag materialpanel) |
---|
1738 | 1882 | { |
---|
1739 | | - /* |
---|
| 1883 | + cGridBag presetpanel = new cGridBag().setVertical(true); |
---|
| 1884 | + |
---|
| 1885 | + cLabel skin = GetLabel("icons/shadericons/shadericon00000.png", !Grafreed.NIMBUSLAF); |
---|
| 1886 | + skin.setToolTipText("Skin"); |
---|
| 1887 | + skin.addMouseListener(new MouseAdapter() |
---|
| 1888 | + { |
---|
| 1889 | + public void mouseClicked(MouseEvent e) |
---|
| 1890 | + { |
---|
| 1891 | + Object3D object = Grafreed.materials.versionlist[0].get(0); |
---|
| 1892 | + cMaterial material = object.material; |
---|
| 1893 | + |
---|
| 1894 | + // Skin |
---|
| 1895 | + colorField.setFloat(material.color); |
---|
| 1896 | + float saturation = material.modulation; |
---|
| 1897 | + |
---|
| 1898 | + if (!cameraView.Skinshader) |
---|
| 1899 | + { |
---|
| 1900 | + saturation /= 1.5; |
---|
| 1901 | + } |
---|
| 1902 | + |
---|
| 1903 | + saturationField.setFloat(saturation); |
---|
| 1904 | + |
---|
| 1905 | + subsurfaceField.setFloat(material.subsurface); |
---|
| 1906 | + selfshadowField.setFloat(material.diffuseness); |
---|
| 1907 | + diffusenessField.setFloat(material.factor); |
---|
| 1908 | + shininessField.setFloat(material.shininess); |
---|
| 1909 | + shadowbiasField.setFloat(material.shadowbias); |
---|
| 1910 | + diffuseField.setFloat(material.diffuse); |
---|
| 1911 | + specularField.setFloat(material.specular); |
---|
| 1912 | + |
---|
| 1913 | + bumpField.setFloat(object.projectedVertices[0].x / 1000.0); |
---|
| 1914 | + noiseField.setFloat(object.projectedVertices[0].y / 1000.0); |
---|
| 1915 | + powerField.setFloat(object.projectedVertices[2].x / 1000.0); |
---|
| 1916 | + |
---|
| 1917 | + materialtouched = true; |
---|
| 1918 | + applySelf(); |
---|
| 1919 | + } |
---|
| 1920 | + }); |
---|
| 1921 | + presetpanel.add(skin); |
---|
| 1922 | + |
---|
| 1923 | + cLabel lambert = GetLabel("icons/shadericons/shadericon00002.png", !Grafreed.NIMBUSLAF); |
---|
| 1924 | + lambert.setToolTipText("Diffuse"); |
---|
| 1925 | + lambert.addMouseListener(new MouseAdapter() |
---|
| 1926 | + { |
---|
| 1927 | + public void mouseClicked(MouseEvent e) |
---|
| 1928 | + { |
---|
| 1929 | + Object3D object = Grafreed.materials.versionlist[2].get(0); |
---|
| 1930 | + cMaterial material = object.material; |
---|
| 1931 | + |
---|
| 1932 | + diffusenessField.setFloat(material.factor); |
---|
| 1933 | + selfshadowField.setFloat(material.diffuseness); |
---|
| 1934 | + |
---|
| 1935 | + materialtouched = true; |
---|
| 1936 | + applySelf(); |
---|
| 1937 | + } |
---|
| 1938 | + }); |
---|
| 1939 | + presetpanel.add(lambert); |
---|
| 1940 | + |
---|
| 1941 | + cLabel diffuse2 = GetLabel("icons/shadericons/shadericon00003.png", !Grafreed.NIMBUSLAF); |
---|
| 1942 | + diffuse2.setToolTipText("Diffuse2"); |
---|
| 1943 | + diffuse2.addMouseListener(new MouseAdapter() |
---|
| 1944 | + { |
---|
| 1945 | + public void mouseClicked(MouseEvent e) |
---|
| 1946 | + { |
---|
| 1947 | + Object3D object = Grafreed.materials.versionlist[3].get(0); |
---|
| 1948 | + cMaterial material = object.material; |
---|
| 1949 | + |
---|
| 1950 | + diffusenessField.setFloat(material.factor); |
---|
| 1951 | + selfshadowField.setFloat(material.diffuseness); |
---|
| 1952 | + |
---|
| 1953 | + materialtouched = true; |
---|
| 1954 | + applySelf(); |
---|
| 1955 | + } |
---|
| 1956 | + }); |
---|
| 1957 | + presetpanel.add(diffuse2); |
---|
| 1958 | + |
---|
| 1959 | + cLabel diffusemoon = GetLabel("icons/shadericons/shadericon00004.png", !Grafreed.NIMBUSLAF); |
---|
| 1960 | + diffusemoon.setToolTipText("Moon"); |
---|
| 1961 | + diffusemoon.addMouseListener(new MouseAdapter() |
---|
| 1962 | + { |
---|
| 1963 | + public void mouseClicked(MouseEvent e) |
---|
| 1964 | + { |
---|
| 1965 | + Object3D object = Grafreed.materials.versionlist[4].get(0); |
---|
| 1966 | + cMaterial material = object.material; |
---|
| 1967 | + |
---|
| 1968 | + diffusenessField.setFloat(material.factor); |
---|
| 1969 | + selfshadowField.setFloat(material.diffuseness); |
---|
| 1970 | + |
---|
| 1971 | + materialtouched = true; |
---|
| 1972 | + applySelf(); |
---|
| 1973 | + } |
---|
| 1974 | + }); |
---|
| 1975 | + presetpanel.add(diffusemoon); |
---|
| 1976 | + |
---|
| 1977 | + cLabel diffusemoon2 = GetLabel("icons/shadericons/shadericon00005.png", !Grafreed.NIMBUSLAF); |
---|
| 1978 | + diffusemoon2.setToolTipText("Moon2"); |
---|
| 1979 | + diffusemoon2.addMouseListener(new MouseAdapter() |
---|
| 1980 | + { |
---|
| 1981 | + public void mouseClicked(MouseEvent e) |
---|
| 1982 | + { |
---|
| 1983 | + Object3D object = Grafreed.materials.versionlist[5].get(0); |
---|
| 1984 | + cMaterial material = object.material; |
---|
| 1985 | + |
---|
| 1986 | + diffusenessField.setFloat(material.factor); |
---|
| 1987 | + selfshadowField.setFloat(material.diffuseness); |
---|
| 1988 | + |
---|
| 1989 | + materialtouched = true; |
---|
| 1990 | + applySelf(); |
---|
| 1991 | + } |
---|
| 1992 | + }); |
---|
| 1993 | + presetpanel.add(diffusemoon2); |
---|
| 1994 | + |
---|
| 1995 | + cLabel diffusemoon3 = GetLabel("icons/shadericons/shadericon00006.png", !Grafreed.NIMBUSLAF); |
---|
| 1996 | + diffusemoon3.setToolTipText("Moon3"); |
---|
| 1997 | + diffusemoon3.addMouseListener(new MouseAdapter() |
---|
| 1998 | + { |
---|
| 1999 | + public void mouseClicked(MouseEvent e) |
---|
| 2000 | + { |
---|
| 2001 | + Object3D object = Grafreed.materials.versionlist[6].get(0); |
---|
| 2002 | + cMaterial material = object.material; |
---|
| 2003 | + |
---|
| 2004 | + diffusenessField.setFloat(material.factor); |
---|
| 2005 | + selfshadowField.setFloat(material.diffuseness); |
---|
| 2006 | + |
---|
| 2007 | + materialtouched = true; |
---|
| 2008 | + applySelf(); |
---|
| 2009 | + } |
---|
| 2010 | + }); |
---|
| 2011 | + presetpanel.add(diffusemoon3); |
---|
| 2012 | + |
---|
| 2013 | + cLabel diffusesheen = GetLabel("icons/shadericons/shadericon00007.png", !Grafreed.NIMBUSLAF); |
---|
| 2014 | + diffusesheen.setToolTipText("Sheen"); |
---|
| 2015 | + diffusesheen.addMouseListener(new MouseAdapter() |
---|
| 2016 | + { |
---|
| 2017 | + public void mouseClicked(MouseEvent e) |
---|
| 2018 | + { |
---|
| 2019 | + Object3D object = Grafreed.materials.versionlist[7].get(0); |
---|
| 2020 | + cMaterial material = object.material; |
---|
| 2021 | + |
---|
| 2022 | + sheenField.setFloat(material.sheen); |
---|
| 2023 | + |
---|
| 2024 | + materialtouched = true; |
---|
| 2025 | + applySelf(); |
---|
| 2026 | + } |
---|
| 2027 | + }); |
---|
| 2028 | + presetpanel.add(diffusesheen); |
---|
| 2029 | + |
---|
| 2030 | + cLabel rough = GetLabel("icons/shadericons/shadericon00001.png", !Grafreed.NIMBUSLAF); |
---|
| 2031 | + rough.setToolTipText("Rough metal"); |
---|
| 2032 | + rough.addMouseListener(new MouseAdapter() |
---|
| 2033 | + { |
---|
| 2034 | + public void mouseClicked(MouseEvent e) |
---|
| 2035 | + { |
---|
| 2036 | + Object3D object = Grafreed.materials.versionlist[1].get(0); |
---|
| 2037 | + cMaterial material = object.material; |
---|
| 2038 | + |
---|
| 2039 | + shininessField.setFloat(material.shininess); |
---|
| 2040 | + velvetField.setFloat(material.velvet); |
---|
| 2041 | + |
---|
| 2042 | + materialtouched = true; |
---|
| 2043 | + applySelf(); |
---|
| 2044 | + } |
---|
| 2045 | + }); |
---|
| 2046 | + presetpanel.add(rough); |
---|
| 2047 | + |
---|
| 2048 | + cLabel rough2 = GetLabel("icons/shadericons/shadericon00013.png", !Grafreed.NIMBUSLAF); |
---|
| 2049 | + rough2.setToolTipText("Medium metal"); |
---|
| 2050 | + rough2.addMouseListener(new MouseAdapter() |
---|
| 2051 | + { |
---|
| 2052 | + public void mouseClicked(MouseEvent e) |
---|
| 2053 | + { |
---|
| 2054 | + Object3D object = Grafreed.materials.versionlist[13].get(0); |
---|
| 2055 | + cMaterial material = object.material; |
---|
| 2056 | + |
---|
| 2057 | + shininessField.setFloat(material.shininess); |
---|
| 2058 | + lightareaField.setFloat(material.lightarea); |
---|
| 2059 | + |
---|
| 2060 | + materialtouched = true; |
---|
| 2061 | + applySelf(); |
---|
| 2062 | + } |
---|
| 2063 | + }); |
---|
| 2064 | + presetpanel.add(rough2); |
---|
| 2065 | + |
---|
| 2066 | + cLabel shini0 = GetLabel("icons/shadericons/shadericon00014.png", !Grafreed.NIMBUSLAF); |
---|
| 2067 | + shini0.setToolTipText("Shiny"); |
---|
| 2068 | + shini0.addMouseListener(new MouseAdapter() |
---|
| 2069 | + { |
---|
| 2070 | + public void mouseClicked(MouseEvent e) |
---|
| 2071 | + { |
---|
| 2072 | + Object3D object = Grafreed.materials.versionlist[14].get(0); |
---|
| 2073 | + cMaterial material = object.material; |
---|
| 2074 | + |
---|
| 2075 | + shininessField.setFloat(material.shininess); |
---|
| 2076 | + lightareaField.setFloat(material.lightarea); |
---|
| 2077 | + |
---|
| 2078 | + materialtouched = true; |
---|
| 2079 | + applySelf(); |
---|
| 2080 | + } |
---|
| 2081 | + }); |
---|
| 2082 | + presetpanel.add(shini0); |
---|
| 2083 | + |
---|
| 2084 | + cLabel shini1 = GetLabel("icons/shadericons/shadericon00011.png", !Grafreed.NIMBUSLAF); |
---|
| 2085 | + shini1.setToolTipText("Shiny2"); |
---|
| 2086 | + shini1.addMouseListener(new MouseAdapter() |
---|
| 2087 | + { |
---|
| 2088 | + public void mouseClicked(MouseEvent e) |
---|
| 2089 | + { |
---|
| 2090 | + Object3D object = Grafreed.materials.versionlist[11].get(0); |
---|
| 2091 | + cMaterial material = object.material; |
---|
| 2092 | + |
---|
| 2093 | + shininessField.setFloat(material.shininess); |
---|
| 2094 | + lightareaField.setFloat(material.lightarea); |
---|
| 2095 | + |
---|
| 2096 | + materialtouched = true; |
---|
| 2097 | + applySelf(); |
---|
| 2098 | + } |
---|
| 2099 | + }); |
---|
| 2100 | + presetpanel.add(shini1); |
---|
| 2101 | + |
---|
| 2102 | + cLabel shini2 = GetLabel("icons/shadericons/shadericon00012.png", !Grafreed.NIMBUSLAF); |
---|
| 2103 | + shini2.setToolTipText("Shiny3"); |
---|
| 2104 | + shini2.addMouseListener(new MouseAdapter() |
---|
| 2105 | + { |
---|
| 2106 | + public void mouseClicked(MouseEvent e) |
---|
| 2107 | + { |
---|
| 2108 | + Object3D object = Grafreed.materials.versionlist[12].get(0); |
---|
| 2109 | + cMaterial material = object.material; |
---|
| 2110 | + |
---|
| 2111 | + shininessField.setFloat(material.shininess); |
---|
| 2112 | + lightareaField.setFloat(material.lightarea); |
---|
| 2113 | + |
---|
| 2114 | + materialtouched = true; |
---|
| 2115 | + applySelf(); |
---|
| 2116 | + } |
---|
| 2117 | + }); |
---|
| 2118 | + presetpanel.add(shini2); |
---|
| 2119 | + |
---|
| 2120 | + cLabel aniso = GetLabel("icons/shadericons/shadericon00008.png", !Grafreed.NIMBUSLAF); |
---|
| 2121 | + aniso.setToolTipText("AnisoU"); |
---|
| 2122 | + aniso.addMouseListener(new MouseAdapter() |
---|
| 2123 | + { |
---|
| 2124 | + public void mouseClicked(MouseEvent e) |
---|
| 2125 | + { |
---|
| 2126 | + Object3D object = Grafreed.materials.versionlist[8].get(0); |
---|
| 2127 | + cMaterial material = object.material; |
---|
| 2128 | + |
---|
| 2129 | + anisoField.setFloat(material.aniso); |
---|
| 2130 | + anisoVField.setFloat(material.anisoV); |
---|
| 2131 | + |
---|
| 2132 | + materialtouched = true; |
---|
| 2133 | + applySelf(); |
---|
| 2134 | + } |
---|
| 2135 | + }); |
---|
| 2136 | + presetpanel.add(aniso); |
---|
| 2137 | + |
---|
| 2138 | + cLabel aniso2 = GetLabel("icons/shadericons/shadericon00009.png", !Grafreed.NIMBUSLAF); |
---|
| 2139 | + aniso2.setToolTipText("AnisoV"); |
---|
| 2140 | + aniso2.addMouseListener(new MouseAdapter() |
---|
| 2141 | + { |
---|
| 2142 | + public void mouseClicked(MouseEvent e) |
---|
| 2143 | + { |
---|
| 2144 | + Object3D object = Grafreed.materials.versionlist[9].get(0); |
---|
| 2145 | + cMaterial material = object.material; |
---|
| 2146 | + |
---|
| 2147 | + anisoField.setFloat(material.aniso); |
---|
| 2148 | + anisoVField.setFloat(material.anisoV); |
---|
| 2149 | + |
---|
| 2150 | + materialtouched = true; |
---|
| 2151 | + applySelf(); |
---|
| 2152 | + } |
---|
| 2153 | + }); |
---|
| 2154 | + presetpanel.add(aniso2); |
---|
| 2155 | + |
---|
| 2156 | + cLabel aniso3 = GetLabel("icons/shadericons/shadericon00010.png", !Grafreed.NIMBUSLAF); |
---|
| 2157 | + aniso3.setToolTipText("AnisoUV"); |
---|
| 2158 | + aniso3.addMouseListener(new MouseAdapter() |
---|
| 2159 | + { |
---|
| 2160 | + public void mouseClicked(MouseEvent e) |
---|
| 2161 | + { |
---|
| 2162 | + Object3D object = Grafreed.materials.versionlist[10].get(0); |
---|
| 2163 | + cMaterial material = object.material; |
---|
| 2164 | + |
---|
| 2165 | + anisoField.setFloat(material.aniso); |
---|
| 2166 | + anisoVField.setFloat(material.anisoV); |
---|
| 2167 | + |
---|
| 2168 | + materialtouched = true; |
---|
| 2169 | + applySelf(); |
---|
| 2170 | + } |
---|
| 2171 | + }); |
---|
| 2172 | + presetpanel.add(aniso3); |
---|
| 2173 | + |
---|
| 2174 | + cLabel velvet0 = GetLabel("icons/shadericons/shadericon00015.png", !Grafreed.NIMBUSLAF); |
---|
| 2175 | + velvet0.setToolTipText("Velvet"); |
---|
| 2176 | + velvet0.addMouseListener(new MouseAdapter() |
---|
| 2177 | + { |
---|
| 2178 | + public void mouseClicked(MouseEvent e) |
---|
| 2179 | + { |
---|
| 2180 | + Object3D object = Grafreed.materials.versionlist[15].get(0); |
---|
| 2181 | + cMaterial material = object.material; |
---|
| 2182 | + |
---|
| 2183 | + diffusenessField.setFloat(material.factor); |
---|
| 2184 | + selfshadowField.setFloat(material.diffuseness); |
---|
| 2185 | + sheenField.setFloat(material.sheen); |
---|
| 2186 | + shininessField.setFloat(material.shininess); |
---|
| 2187 | + velvetField.setFloat(material.velvet); |
---|
| 2188 | + shiftField.setFloat(material.shift); |
---|
| 2189 | + |
---|
| 2190 | + materialtouched = true; |
---|
| 2191 | + applySelf(); |
---|
| 2192 | + } |
---|
| 2193 | + }); |
---|
| 2194 | + presetpanel.add(velvet0); |
---|
| 2195 | + |
---|
| 2196 | + cLabel bump0 = GetLabel("icons/shadericons/shadericon00016.png", !Grafreed.NIMBUSLAF); |
---|
| 2197 | + bump0.setToolTipText("Bump texture"); |
---|
| 2198 | + bump0.addMouseListener(new MouseAdapter() |
---|
| 2199 | + { |
---|
| 2200 | + public void mouseClicked(MouseEvent e) |
---|
| 2201 | + { |
---|
| 2202 | + Object3D object = Grafreed.materials.versionlist[16].get(0); |
---|
| 2203 | + cMaterial material = object.material; |
---|
| 2204 | + |
---|
| 2205 | + bumpField.setFloat(object.projectedVertices[0].x / 1000.0); |
---|
| 2206 | + noiseField.setFloat(object.projectedVertices[0].y / 1000.0); |
---|
| 2207 | + powerField.setFloat(object.projectedVertices[2].x / 1000.0); |
---|
| 2208 | + |
---|
| 2209 | + materialtouched = true; |
---|
| 2210 | + applySelf(); |
---|
| 2211 | + } |
---|
| 2212 | + }); |
---|
| 2213 | + presetpanel.add(bump0); |
---|
| 2214 | + |
---|
| 2215 | + cLabel borderShader = GetLabel("icons/shadericons/borderfade.jpg", !Grafreed.NIMBUSLAF); |
---|
| 2216 | + borderShader.setToolTipText("Border fade"); |
---|
| 2217 | + borderShader.addMouseListener(new MouseAdapter() |
---|
| 2218 | + { |
---|
| 2219 | + public void mouseClicked(MouseEvent e) |
---|
| 2220 | + { |
---|
| 2221 | + borderfadeField.setFloat(0.5); |
---|
| 2222 | + opacityField.setFloat(0.75); |
---|
| 2223 | + |
---|
| 2224 | + materialtouched = true; |
---|
| 2225 | + applySelf(); |
---|
| 2226 | + } |
---|
| 2227 | + }); |
---|
| 2228 | + presetpanel.add(borderShader); |
---|
| 2229 | + |
---|
| 2230 | + cLabel halo = GetLabel("icons/shadericons/shadericon00017.png", !Grafreed.NIMBUSLAF); |
---|
| 2231 | + halo.setToolTipText("Halo"); |
---|
| 2232 | + halo.addMouseListener(new MouseAdapter() |
---|
| 2233 | + { |
---|
| 2234 | + public void mouseClicked(MouseEvent e) |
---|
| 2235 | + { |
---|
| 2236 | + Object3D object = Grafreed.materials.versionlist[17].get(0); |
---|
| 2237 | + cMaterial material = object.material; |
---|
| 2238 | + |
---|
| 2239 | + opacityPowerField.setFloat(object.projectedVertices[2].y / 1000.0); |
---|
| 2240 | + |
---|
| 2241 | + materialtouched = true; |
---|
| 2242 | + applySelf(); |
---|
| 2243 | + } |
---|
| 2244 | + }); |
---|
| 2245 | + presetpanel.add(halo); |
---|
| 2246 | + |
---|
| 2247 | + cLabel candle = GetLabel("icons/shadericons/shadericon00018.png", !Grafreed.NIMBUSLAF); |
---|
| 2248 | + candle.setToolTipText("Candle"); |
---|
| 2249 | + candle.addMouseListener(new MouseAdapter() |
---|
| 2250 | + { |
---|
| 2251 | + public void mouseClicked(MouseEvent e) |
---|
| 2252 | + { |
---|
| 2253 | + Object3D object = Grafreed.materials.versionlist[18].get(0); |
---|
| 2254 | + cMaterial material = object.material; |
---|
| 2255 | + |
---|
| 2256 | + subsurfaceField.setFloat(material.subsurface); |
---|
| 2257 | + shadowbiasField.setFloat(material.shadowbias); |
---|
| 2258 | + ambientField.setFloat(material.ambient); |
---|
| 2259 | + specularField.setFloat(material.specular); |
---|
| 2260 | + lightareaField.setFloat(material.lightarea); |
---|
| 2261 | + shininessField.setFloat(material.shininess); |
---|
| 2262 | + |
---|
| 2263 | + materialtouched = true; |
---|
| 2264 | + applySelf(); |
---|
| 2265 | + } |
---|
| 2266 | + }); |
---|
| 2267 | + presetpanel.add(candle); |
---|
| 2268 | + |
---|
| 2269 | + cLabel shadowShader = GetLabel("icons/shadericons/shadow.png", !Grafreed.NIMBUSLAF); |
---|
| 2270 | + shadowShader.setToolTipText("Shadow"); |
---|
| 2271 | + shadowShader.addMouseListener(new MouseAdapter() |
---|
| 2272 | + { |
---|
| 2273 | + public void mouseClicked(MouseEvent e) |
---|
| 2274 | + { |
---|
| 2275 | + diffuseField.setFloat(0.001); |
---|
| 2276 | + ambientField.setFloat(0.001); |
---|
| 2277 | + cameraField.setFloat(0.001); |
---|
| 2278 | + specularField.setFloat(0.001); |
---|
| 2279 | + fakedepthField.setFloat(0.001); |
---|
| 2280 | + opacityField.setFloat(0.6); |
---|
| 2281 | + |
---|
| 2282 | + materialtouched = true; |
---|
| 2283 | + applySelf(); |
---|
| 2284 | + } |
---|
| 2285 | + }); |
---|
| 2286 | + presetpanel.add(shadowShader); |
---|
| 2287 | + |
---|
| 2288 | + cGridBag panel = new cGridBag().setVertical(true); |
---|
| 2289 | + |
---|
| 2290 | + presetpanel.preferredWidth = 1; |
---|
| 2291 | + |
---|
| 2292 | + materialpanel.add(presetpanel); |
---|
| 2293 | + materialpanel.add(panel); |
---|
| 2294 | + |
---|
| 2295 | + panel.preferredWidth = 8; |
---|
| 2296 | + |
---|
| 2297 | + /* |
---|
1740 | 2298 | ctrlPanel.add(materialLabel = new JLabel("MATERIAL : "), aConstraints); |
---|
1741 | 2299 | materialLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1742 | | - */ |
---|
| 2300 | + */ |
---|
1743 | 2301 | |
---|
1744 | 2302 | cGridBag editBar = new cGridBag().setVertical(false); |
---|
1745 | 2303 | |
---|
.. | .. |
---|
1776 | 2334 | |
---|
1777 | 2335 | cGridBag huepanel = new cGridBag(); |
---|
1778 | 2336 | cGridBag huelabel = new cGridBag(); |
---|
1779 | | - huelabel.add(GetLabel("icons/hue.png", false)); |
---|
| 2337 | + cLabel hue = GetLabel("icons/hue.png", false); |
---|
| 2338 | + hue.fit = true; |
---|
| 2339 | + |
---|
| 2340 | + hue.addMouseListener(new MouseAdapter() |
---|
| 2341 | + { |
---|
| 2342 | + public void mousePressed(MouseEvent e) |
---|
| 2343 | + { |
---|
| 2344 | + int x = e.getX(); |
---|
| 2345 | + |
---|
| 2346 | + colorField.setFloat((double)x / ((cLabel)e.getSource()).getWidth()); |
---|
| 2347 | + } |
---|
| 2348 | + }); |
---|
| 2349 | + |
---|
| 2350 | + huelabel.add(hue); |
---|
1780 | 2351 | huelabel.preferredWidth = 20; |
---|
1781 | 2352 | huepanel.add(new cGridBag()); // Label |
---|
1782 | 2353 | huepanel.add(huelabel); // Field/slider |
---|
.. | .. |
---|
1797 | 2368 | cGridBag modulation = new cGridBag(); |
---|
1798 | 2369 | modulation.add(modulationLabel = new JLabel("Saturation")); // , aConstraints); |
---|
1799 | 2370 | modulationLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1800 | | - modulation.add(modulationField = new cNumberSlider(this, 0.001, 1)); // , aConstraints); |
---|
| 2371 | + modulation.add(saturationField = new cNumberSlider(this, 0.001, 1)); // , aConstraints); |
---|
1801 | 2372 | colorSection.add(modulation); |
---|
1802 | 2373 | |
---|
1803 | 2374 | cGridBag opacity = new cGridBag(); |
---|
.. | .. |
---|
2990 | 3561 | |
---|
2991 | 3562 | freezematerial = true; |
---|
2992 | 3563 | colorField.setFloat(mat.color); |
---|
2993 | | - modulationField.setFloat(mat.modulation); |
---|
| 3564 | + saturationField.setFloat(mat.modulation); |
---|
2994 | 3565 | metalnessField.setFloat(mat.metalness); |
---|
2995 | 3566 | diffuseField.setFloat(mat.diffuse); |
---|
2996 | 3567 | specularField.setFloat(mat.specular); |
---|
.. | .. |
---|
3052 | 3623 | |
---|
3053 | 3624 | if (multiplyToggle != null) |
---|
3054 | 3625 | multiplyToggle.setSelected(mat.multiply); |
---|
3055 | | - |
---|
3056 | | - assert (object.projectedVertices != null); |
---|
3057 | | - |
---|
3058 | | - if (object.projectedVertices.length <= 2) |
---|
3059 | | - { |
---|
3060 | | - // Side effect... |
---|
3061 | | - Object3D.cVector2[] keep = object.projectedVertices; |
---|
3062 | | - object.projectedVertices = new Object3D.cVector2[3]; |
---|
3063 | | - for (int i = 0; i < 3; i++) |
---|
3064 | | - { |
---|
3065 | | - if (i < keep.length) |
---|
3066 | | - { |
---|
3067 | | - object.projectedVertices[i] = keep[i]; |
---|
3068 | | - } else |
---|
3069 | | - { |
---|
3070 | | - object.projectedVertices[i] = new Object3D.cVector2(); |
---|
3071 | | - } |
---|
3072 | | - /* |
---|
3073 | | - if(keep.length == 0) |
---|
3074 | | - object.projectedVertices[0] = new Object3D.cVector2(); |
---|
3075 | | - else |
---|
3076 | | - object.projectedVertices[0] = keep[0]; |
---|
3077 | | - object.projectedVertices[1] = new Object3D.cVector2(); |
---|
3078 | | - */ |
---|
3079 | | - } |
---|
3080 | | - } |
---|
| 3626 | + |
---|
| 3627 | + AllocProjectedVertices(object); |
---|
3081 | 3628 | |
---|
3082 | 3629 | SetMaterial(mat, object.projectedVertices); |
---|
3083 | 3630 | } |
---|
.. | .. |
---|
3197 | 3744 | public void itemStateChanged(ItemEvent event) |
---|
3198 | 3745 | { |
---|
3199 | 3746 | // System.out.println("Propagate = " + propagate); |
---|
| 3747 | + if (event.getSource() == pinButton) |
---|
| 3748 | + { |
---|
| 3749 | + copy.pinned ^= true; |
---|
| 3750 | + if (!copy.pinned && !copy.editWindow.copy.selection.contains(copy)) |
---|
| 3751 | + { |
---|
| 3752 | + ((GroupEditor)copy.editWindow).listUI.remove(copy); |
---|
| 3753 | + copy.CloseUI(); |
---|
| 3754 | + //copy.editWindow.refreshContents(); |
---|
| 3755 | + } |
---|
| 3756 | + } |
---|
| 3757 | + else |
---|
3200 | 3758 | if (event.getSource() == propagateToggle) |
---|
3201 | 3759 | { |
---|
3202 | 3760 | propagate ^= true; |
---|
.. | .. |
---|
3301 | 3859 | } else if (event.getSource() == liveCB) |
---|
3302 | 3860 | { |
---|
3303 | 3861 | copy.live ^= true; |
---|
| 3862 | + objEditor.refreshContents(true); // To show item colors |
---|
3304 | 3863 | return; |
---|
3305 | 3864 | } else if (event.getSource() == selectableCB) |
---|
3306 | 3865 | { |
---|
.. | .. |
---|
3310 | 3869 | { |
---|
3311 | 3870 | copy.hide ^= true; |
---|
3312 | 3871 | copy.Touch(); // display list issue |
---|
3313 | | - objEditor.refreshContents(); |
---|
| 3872 | + objEditor.refreshContents(true); // To show item colors |
---|
3314 | 3873 | return; |
---|
3315 | 3874 | } else if (event.getSource() == link2masterCB) |
---|
3316 | 3875 | { |
---|
.. | .. |
---|
3375 | 3934 | //System.out.println("ObjEditor " + event); |
---|
3376 | 3935 | applySelf0(true); |
---|
3377 | 3936 | //parent.applySelf(); |
---|
3378 | | - objEditor.refreshContents(); |
---|
| 3937 | + // conflicts with requestFocus objEditor.refreshContents(); |
---|
3379 | 3938 | } else if (source == resetButton) |
---|
3380 | 3939 | { |
---|
3381 | 3940 | CameraPane.fullreset = true; |
---|
.. | .. |
---|
3668 | 4227 | { |
---|
3669 | 4228 | //Save(true); |
---|
3670 | 4229 | Replace(); |
---|
| 4230 | + SetVersionStates(); |
---|
3671 | 4231 | } |
---|
3672 | 4232 | |
---|
3673 | 4233 | private boolean Equal(byte[] compress, byte[] name) |
---|
.. | .. |
---|
3686 | 4246 | return true; |
---|
3687 | 4247 | } |
---|
3688 | 4248 | |
---|
3689 | | - java.util.Hashtable<java.util.UUID, Object3D> versiontable = new java.util.Hashtable<java.util.UUID, Object3D>(); |
---|
| 4249 | + void DeleteVersion() |
---|
| 4250 | + { |
---|
| 4251 | + for (int i = copy.versionindex; i < copy.versionlist.length-1; i++) |
---|
| 4252 | + { |
---|
| 4253 | + copy.versionlist[i] = copy.versionlist[i+1]; |
---|
| 4254 | + } |
---|
| 4255 | + |
---|
| 4256 | + if (copy.versionlist[copy.versionindex] == null) |
---|
| 4257 | + copy.versionindex -= 1; |
---|
| 4258 | + |
---|
| 4259 | + if (copy.versionindex != -1) |
---|
| 4260 | + CopyChanged(); |
---|
| 4261 | + |
---|
| 4262 | + SetVersionStates(); |
---|
| 4263 | + } |
---|
3690 | 4264 | |
---|
3691 | 4265 | public boolean Save(boolean user) |
---|
3692 | 4266 | { |
---|
3693 | 4267 | System.err.println("Save"); |
---|
| 4268 | + Replace(); |
---|
3694 | 4269 | |
---|
3695 | | - cRadio tab = GetCurrentTab(); |
---|
| 4270 | + //cRadio tab = GetCurrentTab(); |
---|
3696 | 4271 | |
---|
3697 | | - Object3D compress = CompressCopy(); // Saved version. No need for "Replace". |
---|
| 4272 | + Object3D compress = Duplicate(copy); // Saved version. No need for "Replace"? |
---|
3698 | 4273 | |
---|
3699 | 4274 | boolean thesame = false; |
---|
3700 | 4275 | |
---|
.. | .. |
---|
3706 | 4281 | //EditorFrame.m_MainFrame.requestFocusInWindow(); |
---|
3707 | 4282 | if (!thesame) |
---|
3708 | 4283 | { |
---|
| 4284 | + for (int i = copy.versionlist.length; --i > copy.versionindex+1;) |
---|
| 4285 | + { |
---|
| 4286 | + copy.versionlist[i] = copy.versionlist[i-1]; |
---|
| 4287 | + } |
---|
| 4288 | + |
---|
3709 | 4289 | //tab.user[tab.versionindex] = user; |
---|
3710 | 4290 | //boolean increment = true; // tab.graphs[tab.versionindex] == null; |
---|
3711 | 4291 | |
---|
3712 | | - copy.versions[++copy.versionindex] = compress; |
---|
| 4292 | + copy.versionlist[++copy.versionindex] = compress; |
---|
3713 | 4293 | |
---|
3714 | 4294 | // if (increment) |
---|
3715 | 4295 | // tab.versionindex++; |
---|
.. | .. |
---|
3719 | 4299 | |
---|
3720 | 4300 | //assert(hashtable.isEmpty()); |
---|
3721 | 4301 | |
---|
3722 | | - for (int i = copy.versionindex+1; i < copy.versions.length; i++) |
---|
3723 | | - { |
---|
3724 | | - //tab.user[i] = false; |
---|
3725 | | - copy.versions[i] = null; |
---|
3726 | | - } |
---|
| 4302 | +// for (int i = copy.versionindex+1; i < copy.versionlist.length; i++) |
---|
| 4303 | +// { |
---|
| 4304 | +// //tab.user[i] = false; |
---|
| 4305 | +// copy.versionlist[i] = null; |
---|
| 4306 | +// } |
---|
3727 | 4307 | |
---|
3728 | | - SetUndoStates(); |
---|
| 4308 | + SetVersionStates(); |
---|
3729 | 4309 | |
---|
3730 | 4310 | // test save |
---|
3731 | 4311 | if (false) |
---|
.. | .. |
---|
3748 | 4328 | |
---|
3749 | 4329 | return !thesame; |
---|
3750 | 4330 | } |
---|
3751 | | - |
---|
3752 | | - void CopyChanged(Object3D obj) |
---|
| 4331 | + |
---|
| 4332 | + boolean flashIt = true; |
---|
| 4333 | + |
---|
| 4334 | + void RefreshSelection() |
---|
3753 | 4335 | { |
---|
3754 | | - SetUndoStates(); |
---|
| 4336 | + Object3D selection = new Object3D(); |
---|
| 4337 | + |
---|
| 4338 | + for (int i = 0; i < copy.selection.size(); i++) |
---|
| 4339 | + { |
---|
| 4340 | + Object3D elem = copy.selection.elementAt(i); |
---|
| 4341 | + |
---|
| 4342 | + Object3D obj = copy.GetObject(elem.GetUUID()); |
---|
| 4343 | + |
---|
| 4344 | + if (obj == null) |
---|
| 4345 | + { |
---|
| 4346 | + copy.selection.remove(i--); |
---|
| 4347 | + } |
---|
| 4348 | + else |
---|
| 4349 | + { |
---|
| 4350 | + selection.add(obj); |
---|
| 4351 | + copy.selection.setElementAt(obj, i); |
---|
| 4352 | + } |
---|
| 4353 | + } |
---|
| 4354 | + |
---|
| 4355 | + flashIt = false; |
---|
| 4356 | + GetTree().clearSelection(); |
---|
| 4357 | + for (int i = 0; i < selection.size(); i++) |
---|
| 4358 | + GetTree().addSelectionPath(selection.elementAt(i).GetTreePath().GetTreePath()); |
---|
| 4359 | + flashIt = true; |
---|
| 4360 | + |
---|
| 4361 | + //refreshContents(false); |
---|
| 4362 | + } |
---|
| 4363 | + |
---|
| 4364 | + void CopyChanged() |
---|
| 4365 | + { |
---|
| 4366 | + Object3D obj = (Object3D)Grafreed.clone(copy.versionlist[copy.versionindex]); |
---|
| 4367 | + |
---|
| 4368 | + SetVersionStates(); |
---|
3755 | 4369 | |
---|
3756 | 4370 | boolean temp = CameraPane.SWITCH; |
---|
3757 | 4371 | CameraPane.SWITCH = false; |
---|
3758 | 4372 | |
---|
3759 | | - copy.ExtractBigData(versiontable); |
---|
| 4373 | + copy.ExtractBigData(Grafreed.grafreed.universe.versiontable); |
---|
3760 | 4374 | |
---|
3761 | 4375 | copy.clear(); |
---|
3762 | 4376 | |
---|
.. | .. |
---|
3768 | 4382 | copy.add(obj.get(i)); |
---|
3769 | 4383 | } |
---|
3770 | 4384 | |
---|
3771 | | - copy.RestoreBigData(versiontable); |
---|
| 4385 | + copy.RestoreBigData(Grafreed.grafreed.universe.versiontable); |
---|
3772 | 4386 | |
---|
3773 | 4387 | CameraPane.SWITCH = temp; |
---|
3774 | 4388 | |
---|
| 4389 | + RefreshSelection(); |
---|
3775 | 4390 | //assert(hashtable.isEmpty()); |
---|
3776 | 4391 | |
---|
3777 | 4392 | copy.Touch(); |
---|
.. | .. |
---|
3792 | 4407 | } |
---|
3793 | 4408 | } |
---|
3794 | 4409 | |
---|
3795 | | - refreshContents(); |
---|
| 4410 | + refreshContents(true); |
---|
3796 | 4411 | } |
---|
3797 | 4412 | |
---|
3798 | | - cButton undoButton; |
---|
| 4413 | + cButton previousVersionButton; |
---|
3799 | 4414 | cButton restoreButton; |
---|
3800 | 4415 | cButton replaceButton; |
---|
3801 | | - cButton redoButton; |
---|
| 4416 | + cButton nextVersionButton; |
---|
| 4417 | + cButton saveVersionButton; |
---|
| 4418 | + cButton deleteVersionButton; |
---|
3802 | 4419 | |
---|
3803 | 4420 | boolean muteSlider; |
---|
3804 | 4421 | |
---|
.. | .. |
---|
3806 | 4423 | { |
---|
3807 | 4424 | int count = 0; |
---|
3808 | 4425 | |
---|
3809 | | - for (int i = copy.versions.length; --i >= 0;) |
---|
| 4426 | + for (int i = copy.versionlist.length; --i >= 0;) |
---|
3810 | 4427 | { |
---|
3811 | | - if (copy.versions[i] != null) |
---|
| 4428 | + if (copy.versionlist[i] != null) |
---|
3812 | 4429 | count++; |
---|
3813 | 4430 | } |
---|
3814 | 4431 | |
---|
3815 | 4432 | return count; |
---|
3816 | 4433 | } |
---|
3817 | 4434 | |
---|
3818 | | - void SetUndoStates() |
---|
| 4435 | + void SetVersionStates() |
---|
3819 | 4436 | { |
---|
3820 | | - cRadio tab = GetCurrentTab(); |
---|
| 4437 | + //if (true) |
---|
| 4438 | + // return; |
---|
| 4439 | + |
---|
| 4440 | + //cRadio tab = GetCurrentTab(); |
---|
3821 | 4441 | |
---|
3822 | 4442 | restoreButton.setEnabled(copy.versionindex != -1); |
---|
3823 | 4443 | replaceButton.setEnabled(copy.versionindex != -1); |
---|
3824 | 4444 | |
---|
3825 | | - undoButton.setEnabled(copy.versionindex > 0); |
---|
3826 | | - redoButton.setEnabled(copy.versions[copy.versionindex + 1] != null); |
---|
| 4445 | + previousVersionButton.setEnabled(copy.versionindex > 0); |
---|
| 4446 | + nextVersionButton.setEnabled(copy.versionlist[copy.versionindex + 1] != null); |
---|
| 4447 | + |
---|
| 4448 | + deleteVersionButton.setEnabled(copy.versionindex != -1); |
---|
| 4449 | + //copy.versionlist[copy.versionindex + 1] != null); |
---|
3827 | 4450 | |
---|
3828 | 4451 | muteSlider = true; |
---|
| 4452 | + versionSlider.setMinimum(0); |
---|
3829 | 4453 | versionSlider.setMaximum(VersionCount() - 1); |
---|
3830 | 4454 | versionSlider.setInteger(copy.versionindex); |
---|
| 4455 | + versionSlider.setEnabled(copy.versionindex != -1); |
---|
3831 | 4456 | muteSlider = false; |
---|
3832 | 4457 | } |
---|
3833 | 4458 | |
---|
3834 | | - public boolean Undo() |
---|
| 4459 | + public boolean PreviousVersion() |
---|
3835 | 4460 | { |
---|
3836 | 4461 | // Option? |
---|
3837 | 4462 | Replace(); |
---|
3838 | 4463 | |
---|
3839 | 4464 | System.err.println("Undo"); |
---|
3840 | 4465 | |
---|
3841 | | - cRadio tab = GetCurrentTab(); |
---|
| 4466 | + //cRadio tab = GetCurrentTab(); |
---|
3842 | 4467 | |
---|
3843 | 4468 | if (copy.versionindex == 0) |
---|
3844 | 4469 | { |
---|
.. | .. |
---|
3861 | 4486 | |
---|
3862 | 4487 | copy.versionindex -= 1; |
---|
3863 | 4488 | |
---|
3864 | | - CopyChanged((Object3D)copy.versions[copy.versionindex]); |
---|
| 4489 | + CopyChanged(); |
---|
3865 | 4490 | |
---|
3866 | 4491 | return true; |
---|
3867 | 4492 | } |
---|
.. | .. |
---|
3870 | 4495 | { |
---|
3871 | 4496 | System.err.println("Restore"); |
---|
3872 | 4497 | |
---|
3873 | | - cRadio tab = GetCurrentTab(); |
---|
| 4498 | + //cRadio tab = GetCurrentTab(); |
---|
3874 | 4499 | |
---|
3875 | | - if (copy.versionindex == -1 || copy.versions[copy.versionindex] == null) |
---|
| 4500 | + if (copy.versionindex == -1 || copy.versionlist[copy.versionindex] == null) |
---|
3876 | 4501 | { |
---|
3877 | 4502 | java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
3878 | 4503 | return false; |
---|
3879 | 4504 | } |
---|
3880 | 4505 | |
---|
3881 | 4506 | //CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex])); |
---|
3882 | | - CopyChanged(copy.versions[copy.versionindex]); |
---|
| 4507 | + CopyChanged(); |
---|
3883 | 4508 | |
---|
3884 | 4509 | return true; |
---|
3885 | 4510 | } |
---|
3886 | 4511 | |
---|
3887 | 4512 | public boolean Replace() |
---|
3888 | 4513 | { |
---|
3889 | | - System.err.println("Replace"); |
---|
| 4514 | + //System.err.println("Replace"); |
---|
3890 | 4515 | |
---|
3891 | | - cRadio tab = GetCurrentTab(); |
---|
| 4516 | + //cRadio tab = GetCurrentTab(); |
---|
3892 | 4517 | |
---|
3893 | | - if (copy.versionindex == -1 || copy.versions[copy.versionindex] == null) |
---|
| 4518 | + if (copy.versionindex == -1 || copy.versionlist[copy.versionindex] == null) |
---|
3894 | 4519 | { |
---|
3895 | 4520 | // No version yet. OK. java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
3896 | 4521 | return false; |
---|
3897 | 4522 | } |
---|
3898 | 4523 | |
---|
3899 | | - copy.versions[copy.versionindex] = CompressCopy(); |
---|
| 4524 | + copy.versionlist[copy.versionindex] = Duplicate(copy); |
---|
3900 | 4525 | |
---|
3901 | 4526 | return true; |
---|
3902 | 4527 | } |
---|
3903 | 4528 | |
---|
3904 | | - public void Redo() |
---|
| 4529 | + public void NextVersion() |
---|
3905 | 4530 | { |
---|
3906 | 4531 | // Option? |
---|
3907 | 4532 | Replace(); |
---|
3908 | 4533 | |
---|
3909 | | - cRadio tab = GetCurrentTab(); |
---|
| 4534 | + //cRadio tab = GetCurrentTab(); |
---|
3910 | 4535 | |
---|
3911 | | - if (copy.versions[copy.versionindex + 1] == null) |
---|
| 4536 | + if (copy.versionlist[copy.versionindex + 1] == null) |
---|
3912 | 4537 | { |
---|
3913 | 4538 | java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
3914 | 4539 | return; |
---|
.. | .. |
---|
3916 | 4541 | |
---|
3917 | 4542 | copy.versionindex += 1; |
---|
3918 | 4543 | |
---|
3919 | | - CopyChanged(copy.versions[copy.versionindex]); |
---|
| 4544 | + CopyChanged(); |
---|
3920 | 4545 | |
---|
3921 | 4546 | //if (!tab.user[tab.versionindex]) |
---|
3922 | 4547 | // tab.graphs[tab.versionindex] = null; |
---|
.. | .. |
---|
4113 | 4738 | // else |
---|
4114 | 4739 | // applySelf(true); |
---|
4115 | 4740 | // } |
---|
| 4741 | + |
---|
| 4742 | + boolean Equal(double a, double b) |
---|
| 4743 | + { |
---|
| 4744 | + return Math.abs(a - b) < 0.001; |
---|
| 4745 | + } |
---|
| 4746 | + |
---|
4116 | 4747 | void applySelf0(boolean name) |
---|
4117 | 4748 | { |
---|
4118 | 4749 | if (name) |
---|
.. | .. |
---|
4130 | 4761 | //copy.material = new cMaterial(copy.GetMaterial()); |
---|
4131 | 4762 | |
---|
4132 | 4763 | current.color = (float) colorField.getFloat(); |
---|
4133 | | - current.modulation = (float) modulationField.getFloat(); |
---|
| 4764 | + current.modulation = (float) saturationField.getFloat(); |
---|
4134 | 4765 | current.metalness = (float) metalnessField.getFloat(); |
---|
4135 | 4766 | current.diffuse = (float) diffuseField.getFloat(); |
---|
4136 | 4767 | current.specular = (float) specularField.getFloat(); |
---|
.. | .. |
---|
4162 | 4793 | { |
---|
4163 | 4794 | cMaterial mat = copy.material; |
---|
4164 | 4795 | |
---|
4165 | | - colorField.SetToolTipValue((mat.color)); |
---|
4166 | | - modulationField.SetToolTipValue((mat.modulation)); |
---|
4167 | | - metalnessField.SetToolTipValue((mat.metalness)); |
---|
4168 | | - diffuseField.SetToolTipValue((mat.diffuse)); |
---|
4169 | | - specularField.SetToolTipValue((mat.specular)); |
---|
4170 | | - shininessField.SetToolTipValue((mat.shininess)); |
---|
4171 | | - shiftField.SetToolTipValue((mat.shift)); |
---|
4172 | | - ambientField.SetToolTipValue((mat.ambient)); |
---|
4173 | | - lightareaField.SetToolTipValue((mat.lightarea)); |
---|
4174 | | - diffusenessField.SetToolTipValue((mat.factor)); |
---|
4175 | | - velvetField.SetToolTipValue((mat.velvet)); |
---|
4176 | | - sheenField.SetToolTipValue((mat.sheen)); |
---|
4177 | | - subsurfaceField.SetToolTipValue((mat.subsurface)); |
---|
4178 | | - backlitField.SetToolTipValue((mat.bump)); |
---|
4179 | | - anisoField.SetToolTipValue((mat.aniso)); |
---|
4180 | | - anisoVField.SetToolTipValue((mat.anisoV)); |
---|
4181 | | - cameraField.SetToolTipValue((mat.cameralight)); |
---|
4182 | | - selfshadowField.SetToolTipValue((mat.diffuseness)); |
---|
4183 | | - shadowField.SetToolTipValue((mat.shadow)); |
---|
4184 | | - textureField.SetToolTipValue((mat.texture)); |
---|
4185 | | - opacityField.SetToolTipValue((mat.opacity)); |
---|
4186 | | - fakedepthField.SetToolTipValue((mat.fakedepth)); |
---|
4187 | | - shadowbiasField.SetToolTipValue((mat.shadowbias)); |
---|
| 4796 | + if (!Equal(colorField.getFloat(), mat.color)) |
---|
| 4797 | + colorField.SetToolTipValue((mat.color)); |
---|
| 4798 | + if (!Equal(saturationField.getFloat(), mat.modulation)) |
---|
| 4799 | + saturationField.SetToolTipValue((mat.modulation)); |
---|
| 4800 | + if (!Equal(metalnessField.getFloat(), mat.metalness)) |
---|
| 4801 | + metalnessField.SetToolTipValue((mat.metalness)); |
---|
| 4802 | + if (!Equal(diffuseField.getFloat(), mat.diffuse)) |
---|
| 4803 | + diffuseField.SetToolTipValue((mat.diffuse)); |
---|
| 4804 | + if (!Equal(specularField.getFloat(), mat.specular)) |
---|
| 4805 | + specularField.SetToolTipValue((mat.specular)); |
---|
| 4806 | + if (!Equal(shininessField.getFloat(), mat.shininess)) |
---|
| 4807 | + shininessField.SetToolTipValue((mat.shininess)); |
---|
| 4808 | + if (!Equal(shiftField.getFloat(), mat.shift)) |
---|
| 4809 | + shiftField.SetToolTipValue((mat.shift)); |
---|
| 4810 | + if (!Equal(ambientField.getFloat(), mat.ambient)) |
---|
| 4811 | + ambientField.SetToolTipValue((mat.ambient)); |
---|
| 4812 | + if (!Equal(lightareaField.getFloat(), mat.lightarea)) |
---|
| 4813 | + lightareaField.SetToolTipValue((mat.lightarea)); |
---|
| 4814 | + if (!Equal(diffusenessField.getFloat(), mat.factor)) |
---|
| 4815 | + diffusenessField.SetToolTipValue((mat.factor)); |
---|
| 4816 | + if (!Equal(velvetField.getFloat(), mat.velvet)) |
---|
| 4817 | + velvetField.SetToolTipValue((mat.velvet)); |
---|
| 4818 | + if (!Equal(sheenField.getFloat(), mat.sheen)) |
---|
| 4819 | + sheenField.SetToolTipValue((mat.sheen)); |
---|
| 4820 | + if (!Equal(subsurfaceField.getFloat(), mat.subsurface)) |
---|
| 4821 | + subsurfaceField.SetToolTipValue((mat.subsurface)); |
---|
| 4822 | + if (!Equal(backlitField.getFloat(), mat.bump)) |
---|
| 4823 | + backlitField.SetToolTipValue((mat.bump)); |
---|
| 4824 | + if (!Equal(anisoField.getFloat(), mat.aniso)) |
---|
| 4825 | + anisoField.SetToolTipValue((mat.aniso)); |
---|
| 4826 | + if (!Equal(anisoVField.getFloat(), mat.anisoV)) |
---|
| 4827 | + anisoVField.SetToolTipValue((mat.anisoV)); |
---|
| 4828 | + if (!Equal(cameraField.getFloat(), mat.cameralight)) |
---|
| 4829 | + cameraField.SetToolTipValue((mat.cameralight)); |
---|
| 4830 | + if (!Equal(selfshadowField.getFloat(), mat.diffuseness)) |
---|
| 4831 | + selfshadowField.SetToolTipValue((mat.diffuseness)); |
---|
| 4832 | + if (!Equal(shadowField.getFloat(), mat.shadow)) |
---|
| 4833 | + shadowField.SetToolTipValue((mat.shadow)); |
---|
| 4834 | + if (!Equal(textureField.getFloat(), mat.texture)) |
---|
| 4835 | + textureField.SetToolTipValue((mat.texture)); |
---|
| 4836 | + if (!Equal(opacityField.getFloat(), mat.opacity)) |
---|
| 4837 | + opacityField.SetToolTipValue((mat.opacity)); |
---|
| 4838 | + if (!Equal(fakedepthField.getFloat(), mat.fakedepth)) |
---|
| 4839 | + fakedepthField.SetToolTipValue((mat.fakedepth)); |
---|
| 4840 | + if (!Equal(shadowbiasField.getFloat(), mat.shadowbias)) |
---|
| 4841 | + shadowbiasField.SetToolTipValue((mat.shadowbias)); |
---|
4188 | 4842 | } |
---|
4189 | 4843 | |
---|
4190 | 4844 | if (copy.material != null && copy.projectedVertices.length > 0 && copy.projectedVertices[0] != null) |
---|
.. | .. |
---|
4225 | 4879 | if (muteSlider) |
---|
4226 | 4880 | return; |
---|
4227 | 4881 | |
---|
| 4882 | + Replace(); |
---|
| 4883 | + |
---|
4228 | 4884 | int version = versionSlider.getInteger(); |
---|
4229 | 4885 | |
---|
4230 | | - if (copy.versions[version] != null) |
---|
| 4886 | + if (version != -1 && copy.versionlist[version] != null) |
---|
4231 | 4887 | { |
---|
4232 | | - CopyChanged(copy.versions[copy.versionindex = version]); |
---|
| 4888 | + copy.versionindex = version; |
---|
| 4889 | + CopyChanged(); |
---|
4233 | 4890 | } |
---|
4234 | 4891 | |
---|
4235 | 4892 | return; |
---|
.. | .. |
---|
4269 | 4926 | { |
---|
4270 | 4927 | //System.out.println("stateChanged = " + this); |
---|
4271 | 4928 | materialtouched = true; |
---|
| 4929 | + |
---|
| 4930 | + if (Globals.AUTOSATURATE && e.getSource() == colorField && saturationField.getFloat() == 0.001) |
---|
| 4931 | + { |
---|
| 4932 | + saturationField.setFloat(1); |
---|
| 4933 | + } |
---|
| 4934 | + |
---|
4272 | 4935 | applySelf(); |
---|
4273 | 4936 | //System.out.println("this = " + this); |
---|
4274 | 4937 | //System.out.println("PARENT = " + parent); |
---|
.. | .. |
---|
4568 | 5231 | { |
---|
4569 | 5232 | if (GetTree() != null) |
---|
4570 | 5233 | { |
---|
| 5234 | + GetTree().revalidate(); |
---|
4571 | 5235 | GetTree().repaint(); |
---|
4572 | 5236 | } |
---|
4573 | 5237 | |
---|
.. | .. |
---|
4576 | 5240 | ctrlPanel.validate(); // ? new |
---|
4577 | 5241 | ctrlPanel.repaint(); |
---|
4578 | 5242 | } |
---|
| 5243 | + |
---|
| 5244 | + if (previousVersionButton != null && copy.versionlist != null) |
---|
| 5245 | + SetVersionStates(); |
---|
| 5246 | + |
---|
| 5247 | + cameraView.requestFocusInWindow(); |
---|
4579 | 5248 | } |
---|
4580 | 5249 | |
---|
4581 | 5250 | static TweenManager tweenManager = new TweenManager(); |
---|
.. | .. |
---|
4607 | 5276 | // group = (Composite) group.get(0); |
---|
4608 | 5277 | // } |
---|
4609 | 5278 | |
---|
4610 | | - System.out.println("makeSomething of " + thing); |
---|
| 5279 | + //System.out.println("makeSomething of " + thing); |
---|
4611 | 5280 | |
---|
4612 | 5281 | /* |
---|
4613 | 5282 | if (deselect && jList != null) |
---|
.. | .. |
---|
4959 | 5628 | c.addChild(csg); |
---|
4960 | 5629 | } |
---|
4961 | 5630 | |
---|
4962 | | - copy.versions = readobj.versions; |
---|
| 5631 | + copy.versionlist = readobj.versionlist; |
---|
4963 | 5632 | copy.versionindex = readobj.versionindex; |
---|
| 5633 | + copy.versiontable = readobj.versiontable; |
---|
4964 | 5634 | |
---|
4965 | | - if (copy.versions == null) |
---|
| 5635 | + if (copy.versionlist == null) |
---|
4966 | 5636 | { |
---|
4967 | | - copy.versions = new Object3D[100]; |
---|
| 5637 | + // Backward compatibility |
---|
| 5638 | + copy.versionlist = new Object3D[100]; |
---|
4968 | 5639 | copy.versionindex = -1; |
---|
| 5640 | + |
---|
| 5641 | + //Save(true); |
---|
4969 | 5642 | } |
---|
4970 | 5643 | |
---|
4971 | 5644 | //? SetUndoStates(); |
---|
.. | .. |
---|
4980 | 5653 | { |
---|
4981 | 5654 | if (Grafreed.standAlone) |
---|
4982 | 5655 | { |
---|
4983 | | - FileDialog browser = new FileDialog(frame, "Load", FileDialog.LOAD); |
---|
| 5656 | + FileDialog browser = new FileDialog(frame, "Open", FileDialog.LOAD); |
---|
4984 | 5657 | browser.show(); |
---|
4985 | 5658 | String filename = browser.getFile(); |
---|
4986 | 5659 | if (filename != null && filename.length() > 0) |
---|
.. | .. |
---|
5057 | 5730 | |
---|
5058 | 5731 | void save() |
---|
5059 | 5732 | { |
---|
| 5733 | + Replace(); |
---|
| 5734 | + |
---|
5060 | 5735 | if (lastname == null) |
---|
5061 | 5736 | { |
---|
5062 | 5737 | return; |
---|
.. | .. |
---|
5299 | 5974 | ButtonGroup buttonGroup; |
---|
5300 | 5975 | |
---|
5301 | 5976 | cGridBag toolboxPanel; |
---|
| 5977 | + cGridBag skyboxPanel; |
---|
5302 | 5978 | cGridBag materialPanel; |
---|
5303 | 5979 | cGridBag ctrlPanel; |
---|
5304 | 5980 | |
---|
.. | .. |
---|
5372 | 6048 | JLabel colorLabel; |
---|
5373 | 6049 | cNumberSlider colorField; |
---|
5374 | 6050 | JLabel modulationLabel; |
---|
5375 | | - cNumberSlider modulationField; |
---|
| 6051 | + cNumberSlider saturationField; |
---|
5376 | 6052 | JLabel metalnessLabel; |
---|
5377 | 6053 | cNumberSlider metalnessField; |
---|
5378 | 6054 | JLabel diffuseLabel; |
---|
.. | .. |
---|
5403 | 6079 | cNumberSlider anisoField; |
---|
5404 | 6080 | JLabel anisoVLabel; |
---|
5405 | 6081 | cNumberSlider anisoVField; |
---|
| 6082 | + |
---|
5406 | 6083 | JLabel cameraLabel; |
---|
5407 | 6084 | cNumberSlider cameraField; |
---|
5408 | 6085 | JLabel selfshadowLabel; |
---|
.. | .. |
---|
5417 | 6094 | cNumberSlider fakedepthField; |
---|
5418 | 6095 | JLabel shadowbiasLabel; |
---|
5419 | 6096 | cNumberSlider shadowbiasField; |
---|
| 6097 | + |
---|
5420 | 6098 | JLabel bumpLabel; |
---|
5421 | 6099 | cNumberSlider bumpField; |
---|
5422 | 6100 | JLabel noiseLabel; |
---|