.. | .. |
---|
43 | 43 | |
---|
44 | 44 | static ObjEditor theFrame; |
---|
45 | 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 | + } |
---|
| 74 | + |
---|
| 75 | + public Composite CreateCameras() |
---|
| 76 | + { |
---|
| 77 | + Composite cams = new cTemplate(); |
---|
| 78 | + cams.name = "Cameras"; |
---|
| 79 | + copy.insertElementAt(cams, 0); |
---|
| 80 | + |
---|
| 81 | + cams.addChild(new Camera()); |
---|
| 82 | + cams.addChild(new Camera(1)); |
---|
| 83 | + cams.addChild(new Camera(2)); |
---|
| 84 | + cams.addChild(new Camera(3)); |
---|
| 85 | + cams.addChild(new Camera(4)); |
---|
| 86 | + |
---|
| 87 | + return cams; |
---|
| 88 | + } |
---|
| 89 | + |
---|
46 | 90 | public cGridBag GetSeparator() |
---|
47 | 91 | { |
---|
48 | 92 | cGridBag separator = new cGridBag(); |
---|
.. | .. |
---|
54 | 98 | cButton GetButton(String name, boolean border) |
---|
55 | 99 | { |
---|
56 | 100 | ImageIcon icon = GetIcon(name); |
---|
57 | | - return new cButton(icon, border); |
---|
| 101 | + if (icon != null || name.contains("/")) |
---|
| 102 | + return new cButton(icon, border); |
---|
| 103 | + else |
---|
| 104 | + return new cButton(name, border); |
---|
58 | 105 | } |
---|
59 | 106 | |
---|
60 | 107 | cLabel GetLabel(String name, boolean border) |
---|
.. | .. |
---|
75 | 122 | return new cCheckBox(icon, border); |
---|
76 | 123 | } |
---|
77 | 124 | |
---|
78 | | - ImageIcon GetIcon(String name) |
---|
| 125 | + static java.util.Hashtable<String, javax.swing.ImageIcon> icons = new java.util.Hashtable<String, javax.swing.ImageIcon>(); |
---|
| 126 | + |
---|
| 127 | + static ImageIcon GetIcon(String name) |
---|
79 | 128 | { |
---|
| 129 | + javax.swing.ImageIcon iconCache = icons.get(name); |
---|
| 130 | + if (iconCache != null) |
---|
| 131 | + { |
---|
| 132 | + return iconCache; |
---|
| 133 | + } |
---|
| 134 | + |
---|
80 | 135 | try |
---|
81 | 136 | { |
---|
82 | | - BufferedImage image = javax.imageio.ImageIO.read(getClass().getClassLoader().getResourceAsStream(name)); |
---|
| 137 | + BufferedImage image = javax.imageio.ImageIO.read(ObjEditor.class.getClassLoader().getResourceAsStream(name)); |
---|
83 | 138 | |
---|
84 | 139 | // if (image.getWidth() > 48 && image.getHeight() > 48) |
---|
85 | 140 | // { |
---|
.. | .. |
---|
94 | 149 | // } |
---|
95 | 150 | |
---|
96 | 151 | javax.swing.ImageIcon icon = new javax.swing.ImageIcon(image); |
---|
| 152 | + |
---|
| 153 | + icons.put(name, icon); |
---|
| 154 | + |
---|
97 | 155 | return icon; |
---|
98 | 156 | } |
---|
99 | 157 | catch (Exception e) |
---|
100 | 158 | { |
---|
| 159 | + //icons.put(name, null); |
---|
101 | 160 | return null; |
---|
102 | 161 | } |
---|
103 | 162 | } |
---|
.. | .. |
---|
347 | 406 | //parent = p; |
---|
348 | 407 | |
---|
349 | 408 | GraphicsDevice gd = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice(); |
---|
350 | | - System.out.println("getFullScreenWindow? " + gd.getFullScreenWindow()); |
---|
| 409 | + if (Globals.DEBUG) |
---|
| 410 | + System.out.println("getFullScreenWindow? " + gd.getFullScreenWindow()); |
---|
351 | 411 | //gd.setFullScreenWindow(this); |
---|
352 | 412 | //setResizable(false); |
---|
353 | 413 | //if (!isDisplayable()) |
---|
.. | .. |
---|
384 | 444 | |
---|
385 | 445 | static java.util.Vector<Object3D> listUI = new java.util.Vector<Object3D>(); |
---|
386 | 446 | |
---|
| 447 | + // This is to refresh the UI of the material panel. |
---|
| 448 | + boolean patchMaterial; |
---|
| 449 | + |
---|
387 | 450 | void SetupMenu() |
---|
388 | 451 | { |
---|
389 | 452 | frame.setMenuBar(menuBar = new MenuBar()); |
---|
.. | .. |
---|
433 | 496 | |
---|
434 | 497 | ChangeListener changeListener = new ChangeListener() |
---|
435 | 498 | { |
---|
| 499 | + //String name; |
---|
| 500 | + |
---|
436 | 501 | public void stateChanged(ChangeEvent changeEvent) |
---|
437 | 502 | { |
---|
438 | 503 | // if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Material") && !materialFlushed) |
---|
.. | .. |
---|
451 | 516 | // EditSelection(false); |
---|
452 | 517 | // } |
---|
453 | 518 | |
---|
| 519 | +// if (objectPanel.getSelectedIndex() == 4) |
---|
| 520 | +// { |
---|
| 521 | +// name = copy.skyboxname; |
---|
| 522 | +// |
---|
| 523 | +// if (name == null) |
---|
| 524 | +// { |
---|
| 525 | +// name = ""; |
---|
| 526 | +// } |
---|
| 527 | +// |
---|
| 528 | +// copy.skyboxname = "cubemaps/default-skyboxes/rgb"; |
---|
| 529 | +// copy.skyboxext = "jpg"; |
---|
| 530 | +// } |
---|
| 531 | +// else |
---|
| 532 | +// { |
---|
| 533 | +// if (name != null) |
---|
| 534 | +// { |
---|
| 535 | +// if (name.equals("")) |
---|
| 536 | +// { |
---|
| 537 | +// copy.skyboxname = null; |
---|
| 538 | +// copy.skyboxext = null; |
---|
| 539 | +// } |
---|
| 540 | +// else |
---|
| 541 | +// { |
---|
| 542 | +// copy.skyboxname = name; |
---|
| 543 | +// } |
---|
| 544 | +// } |
---|
| 545 | +// } |
---|
| 546 | + cameraView.transformMode = objectPanel.getSelectedIndex() == 4; |
---|
| 547 | + |
---|
454 | 548 | // refreshContents(false); // To refresh Info tab |
---|
| 549 | + cameraView.repaint(); |
---|
455 | 550 | } |
---|
456 | 551 | }; |
---|
457 | 552 | objectPanel.addChangeListener(changeListener); |
---|
.. | .. |
---|
877 | 972 | boolean temp = CameraPane.SWITCH; |
---|
878 | 973 | CameraPane.SWITCH = false; |
---|
879 | 974 | |
---|
880 | | - object.ExtractBigData(versiontable); |
---|
| 975 | + if (Grafreed.grafreed.universe.versiontable == null) |
---|
| 976 | + Grafreed.grafreed.universe.versiontable = new java.util.Hashtable<java.util.UUID, Object3D>(); |
---|
| 977 | + |
---|
| 978 | + object.ExtractBigData(Grafreed.grafreed.universe.versiontable); |
---|
881 | 979 | // if (copy == client) |
---|
882 | 980 | |
---|
883 | 981 | Object3D versions[] = object.versionlist; |
---|
| 982 | + java.util.Hashtable<java.util.UUID, Object3D> versiontable = object.versiontable; // if Grafreed.grafreed.universe |
---|
884 | 983 | object.versionlist = null; |
---|
| 984 | + object.versiontable = null; |
---|
| 985 | + |
---|
| 986 | + Object3D parent = object.parent; |
---|
| 987 | + object.parent = null; |
---|
885 | 988 | |
---|
886 | 989 | //byte[] compress = Compress(copy); |
---|
887 | 990 | Object3D compress = (Object3D)Grafreed.clone(object); |
---|
888 | 991 | |
---|
889 | | - object.versionlist = versions; |
---|
| 992 | + object.parent = parent; |
---|
890 | 993 | |
---|
891 | | - object.RestoreBigData(versiontable); |
---|
| 994 | + object.versionlist = versions; |
---|
| 995 | + object.versiontable = versiontable; // if Grafreed.grafreed.universe |
---|
| 996 | + |
---|
| 997 | + object.RestoreBigData(Grafreed.grafreed.universe.versiontable); |
---|
892 | 998 | |
---|
893 | 999 | CameraPane.SWITCH = temp; |
---|
894 | 1000 | |
---|
.. | .. |
---|
1227 | 1333 | |
---|
1228 | 1334 | //if (copy.pinned) |
---|
1229 | 1335 | { |
---|
1230 | | - pinButton = GetToggleButton("icons/pin.png", !Grafreed.NIMBUSLAF); |
---|
| 1336 | + pinButton = GetToggleButton("icons/pin.png", !Globals.NIMBUSLAF); |
---|
1231 | 1337 | pinButton.setSelected(copy.pinned); |
---|
1232 | 1338 | cGridBag t = new cGridBag(); |
---|
1233 | 1339 | t.preferredWidth = 2; |
---|
.. | .. |
---|
1250 | 1356 | |
---|
1251 | 1357 | liveCB = AddCheckBox(setupPanel, "Live", copy.live); |
---|
1252 | 1358 | liveCB.setToolTipText("Animate object"); |
---|
| 1359 | + markCB = AddCheckBox(setupPanel, "Anim", copy.marked); |
---|
| 1360 | + markCB.setToolTipText("Set target transform"); |
---|
1253 | 1361 | selectableCB = AddCheckBox(setupPanel, "Select", !copy.dontselect); |
---|
1254 | 1362 | selectableCB.setToolTipText("Make object selectable"); |
---|
1255 | 1363 | // Return(); |
---|
1256 | 1364 | |
---|
1257 | 1365 | hideCB = AddCheckBox(setupPanel, "Hide", copy.hide); |
---|
1258 | 1366 | hideCB.setToolTipText("Hide object"); |
---|
1259 | | - markCB = AddCheckBox(setupPanel, "Mark", copy.marked); |
---|
1260 | | - markCB.setToolTipText("As animation target transform"); |
---|
1261 | 1367 | |
---|
1262 | 1368 | ToolTipManager.sharedInstance().setLightWeightPopupEnabled(false); |
---|
1263 | 1369 | |
---|
.. | .. |
---|
1459 | 1565 | |
---|
1460 | 1566 | if (cam == null || !(copy.get(0) instanceof cGroup)) |
---|
1461 | 1567 | { |
---|
1462 | | - System.out.println("CREATE CAMERAS"); |
---|
1463 | | - cams = new cTemplate(); |
---|
1464 | | - cams.name = "Cameras"; |
---|
1465 | | - copy.insertElementAt(cams, 0); |
---|
1466 | | - //cams.parent = copy; |
---|
1467 | | - |
---|
1468 | | - cam = new Camera(); // LA.newVector(3, 2, 1)); |
---|
1469 | | - cams.addChild(cam); |
---|
1470 | | - cam = new Camera(1); |
---|
1471 | | - cams.addChild(cam); |
---|
1472 | | - cam = new Camera(2); |
---|
1473 | | - cams.addChild(cam); |
---|
1474 | | - cam = new Camera(3); |
---|
1475 | | - cams.addChild(cam); |
---|
1476 | | - cam = new Camera(4); // Light |
---|
1477 | | - cams.addChild(cam); |
---|
| 1568 | + if (Globals.DEBUG) |
---|
| 1569 | + System.out.println("CREATE CAMERAS"); |
---|
| 1570 | + cams = CreateCameras(); |
---|
1478 | 1571 | } else |
---|
1479 | 1572 | { |
---|
1480 | 1573 | cams = (cGroup) copy.get(0); |
---|
.. | .. |
---|
1540 | 1633 | //frontView.object = copy; |
---|
1541 | 1634 | //sideView.object = copy; |
---|
1542 | 1635 | |
---|
| 1636 | + transformPanel = new cGridBag().setVertical(true); |
---|
| 1637 | + |
---|
| 1638 | + cGridBag resetTransformPanel = new cGridBag(); |
---|
| 1639 | + |
---|
| 1640 | + resetTransformPanel.preferredHeight = 2; |
---|
| 1641 | + |
---|
| 1642 | + cButton resetTransform = GetButton("Reset all", !Globals.NIMBUSLAF); |
---|
| 1643 | + resetTransform.setToolTipText("Reset Translation, Rotation and Scale"); |
---|
| 1644 | + resetTransform.addMouseListener(new MouseAdapter() |
---|
| 1645 | + { |
---|
| 1646 | + public void mouseClicked(MouseEvent e) |
---|
| 1647 | + { |
---|
| 1648 | + ResetTransform(); |
---|
| 1649 | + } |
---|
| 1650 | + }); |
---|
| 1651 | + resetTransformPanel.add(resetTransform); |
---|
| 1652 | + |
---|
| 1653 | + resetTransform = GetButton("T only", !Globals.NIMBUSLAF); |
---|
| 1654 | + resetTransform.setToolTipText("Reset Translation only"); |
---|
| 1655 | + resetTransform.addMouseListener(new MouseAdapter() |
---|
| 1656 | + { |
---|
| 1657 | + public void mouseClicked(MouseEvent e) |
---|
| 1658 | + { |
---|
| 1659 | + ResetTransform(1); |
---|
| 1660 | + } |
---|
| 1661 | + }); |
---|
| 1662 | + resetTransformPanel.add(resetTransform); |
---|
| 1663 | + |
---|
| 1664 | + resetTransform = GetButton("RS only", !Globals.NIMBUSLAF); |
---|
| 1665 | + resetTransform.setToolTipText("Reset Rotation and Scale only"); |
---|
| 1666 | + resetTransform.addMouseListener(new MouseAdapter() |
---|
| 1667 | + { |
---|
| 1668 | + public void mouseClicked(MouseEvent e) |
---|
| 1669 | + { |
---|
| 1670 | + ResetTransform(2); |
---|
| 1671 | + } |
---|
| 1672 | + }); |
---|
| 1673 | + resetTransformPanel.add(resetTransform); |
---|
| 1674 | + |
---|
1543 | 1675 | XYZPanel = new cGridBag().setVertical(true); |
---|
1544 | 1676 | //XYZPanel.setLayout(new GridLayout(3, 1, 5, 5)); |
---|
1545 | 1677 | |
---|
.. | .. |
---|
1549 | 1681 | XYZPanel.addComponent(/*BorderLayout.NORTH,*/topView); // Scroll); |
---|
1550 | 1682 | //XYZPanel.setName("XYZ"); |
---|
1551 | 1683 | |
---|
| 1684 | + transformPanel.add(resetTransformPanel); |
---|
| 1685 | + transformPanel.add(XYZPanel); |
---|
| 1686 | + |
---|
1552 | 1687 | /* |
---|
1553 | 1688 | gridPanel = new JPanel(); //new BorderLayout()); |
---|
1554 | 1689 | gridPanel.setLayout(new GridLayout(1, 2)); |
---|
.. | .. |
---|
1556 | 1691 | gridPanel.add(cameraView); |
---|
1557 | 1692 | gridPanel.add(XYZPanel); |
---|
1558 | 1693 | */ |
---|
1559 | | - gridPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, centralPanel, XYZPanel); //new BorderLayout()); |
---|
1560 | | - gridPanel.setContinuousLayout(true); |
---|
1561 | | - gridPanel.setOneTouchExpandable(true); |
---|
1562 | | - gridPanel.setDividerLocation(1.0); |
---|
1563 | | - gridPanel.setDividerSize(9); |
---|
1564 | | - gridPanel.setResizeWeight(0.85); |
---|
| 1694 | +// gridPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, centralPanel, XYZPanel); //new BorderLayout()); |
---|
| 1695 | +// gridPanel.setContinuousLayout(true); |
---|
| 1696 | +// gridPanel.setOneTouchExpandable(true); |
---|
| 1697 | +// gridPanel.setDividerLocation(1.0); |
---|
| 1698 | +// gridPanel.setDividerSize(9); |
---|
| 1699 | +// gridPanel.setResizeWeight(0.85); |
---|
1565 | 1700 | |
---|
1566 | 1701 | // aConstraints.weighty = 0; |
---|
1567 | 1702 | //System.out.println("THIS = " + this); |
---|
.. | .. |
---|
1584 | 1719 | |
---|
1585 | 1720 | //JScrollPane tmp = new JScrollPane(ctrlPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); |
---|
1586 | 1721 | //tmp.setName("Edit"); |
---|
1587 | | - objectPanel.add(materialPanel); |
---|
1588 | | - objectPanel.setIconAt(0, GetIcon("icons/material.png")); |
---|
1589 | | - objectPanel.setToolTipTextAt(0, "Material"); |
---|
1590 | | - |
---|
| 1722 | + objectPanel.add(skyboxPanel); |
---|
| 1723 | + objectPanel.setIconAt(0, GetIcon("icons/skybox.jpg")); |
---|
| 1724 | + objectPanel.setToolTipTextAt(0, "Backgrounds"); |
---|
| 1725 | + |
---|
1591 | 1726 | objectPanel.add(toolboxPanel); |
---|
1592 | 1727 | objectPanel.setIconAt(1, GetIcon("icons/primitives.png")); |
---|
1593 | 1728 | objectPanel.setToolTipTextAt(1, "Objects & textures"); |
---|
1594 | 1729 | |
---|
1595 | | - objectPanel.add(skyboxPanel); |
---|
1596 | | - objectPanel.setIconAt(2, GetIcon("icons/skybox.jpg")); |
---|
1597 | | - objectPanel.setToolTipTextAt(2, "Backgrounds"); |
---|
1598 | | - |
---|
| 1730 | + objectPanel.add(materialPanel); |
---|
| 1731 | + objectPanel.setIconAt(2, GetIcon("icons/material.png")); |
---|
| 1732 | + objectPanel.setToolTipTextAt(2, "Material"); |
---|
| 1733 | + |
---|
1599 | 1734 | // JPanel north = new JPanel(new BorderLayout()); |
---|
1600 | 1735 | // north.setName("Edit"); |
---|
1601 | 1736 | // north.add(ctrlPanel, BorderLayout.NORTH); |
---|
1602 | 1737 | // objectPanel.add(north); |
---|
1603 | 1738 | objectPanel.add(editPanel); |
---|
1604 | | - objectPanel.setIconAt(3, GetIcon("icons/write.png")); |
---|
| 1739 | + objectPanel.setIconAt(3, GetIcon("icons/writewhite.png")); |
---|
1605 | 1740 | objectPanel.setToolTipTextAt(3, "Edit controls"); |
---|
1606 | 1741 | |
---|
1607 | | - objectPanel.add(XYZPanel); |
---|
| 1742 | + objectPanel.add(transformPanel); |
---|
1608 | 1743 | objectPanel.setIconAt(4, GetIcon("icons/XYZ.png")); |
---|
1609 | | - objectPanel.setToolTipTextAt(4, "XYZ/RGB transform"); |
---|
| 1744 | + objectPanel.setToolTipTextAt(4, "TRS transform"); |
---|
1610 | 1745 | |
---|
| 1746 | + patchMaterial = true; |
---|
| 1747 | + cameraView.patchMaterial = this; |
---|
| 1748 | + objectPanel.setSelectedIndex(2); |
---|
| 1749 | + |
---|
1611 | 1750 | /* |
---|
1612 | 1751 | aConstraints.gridx = 0; |
---|
1613 | 1752 | aConstraints.gridwidth = 1; |
---|
.. | .. |
---|
1627 | 1766 | scrollpane.addMouseWheelListener(this); // Default not fast enough |
---|
1628 | 1767 | |
---|
1629 | 1768 | /*JTabbedPane*/ scenePanel = new cGridBag(); |
---|
1630 | | - scenePanel.preferredWidth = 5; |
---|
| 1769 | + scenePanel.preferredWidth = 6; |
---|
1631 | 1770 | |
---|
1632 | 1771 | JTabbedPane tabbedPane = new JTabbedPane(); |
---|
1633 | 1772 | tabbedPane.add(scrollpane); |
---|
.. | .. |
---|
1638 | 1777 | |
---|
1639 | 1778 | AddOptions(optionsPanel); //, aConstraints); |
---|
1640 | 1779 | |
---|
1641 | | - tabbedPane.add(optionsPanel); |
---|
1642 | | - |
---|
1643 | 1780 | tabbedPane.add(FSPane = new cFileSystemPane(this)); |
---|
1644 | 1781 | |
---|
| 1782 | + tabbedPane.add(optionsPanel); |
---|
| 1783 | + |
---|
1645 | 1784 | scenePanel.add(tabbedPane); |
---|
1646 | 1785 | |
---|
1647 | | - //if (Globals.ADVANCED) |
---|
1648 | | - tabbedPane.add(infoPanel); |
---|
1649 | | - tabbedPane.setIconAt(3, GetIcon("icons/info.png")); |
---|
1650 | | - tabbedPane.setToolTipTextAt(3, "Information"); |
---|
| 1786 | + cGridBag creditsPanel = new cGridBag().setVertical(true); |
---|
| 1787 | + creditsPanel.setName("Credits"); |
---|
1651 | 1788 | |
---|
| 1789 | + cLabel ogaLabel = new cLabel(" Most Skyboxes courtesy of OpenGameArt!", !Globals.NIMBUSLAF); |
---|
| 1790 | + creditsPanel.add(ogaLabel); |
---|
| 1791 | + |
---|
| 1792 | + cButton opengameartButton; |
---|
| 1793 | + creditsPanel.add(opengameartButton = GetButton("icons/sara-logo.png", !Globals.NIMBUSLAF)); |
---|
| 1794 | + opengameartButton.setToolTipText("https://opengameart.org"); |
---|
| 1795 | + |
---|
| 1796 | + opengameartButton.addMouseListener(new MouseAdapter() |
---|
| 1797 | + { |
---|
| 1798 | + public void mouseClicked(MouseEvent e) |
---|
| 1799 | + { |
---|
| 1800 | + try |
---|
| 1801 | + { |
---|
| 1802 | + Desktop.getDesktop().browse(new java.net.URI("https://opengameart.org/")); |
---|
| 1803 | + } catch (Exception e1) |
---|
| 1804 | +// } catch (java.io.IOException | java.net.URISyntaxException e1) |
---|
| 1805 | + { |
---|
| 1806 | + e1.printStackTrace(); |
---|
| 1807 | + } |
---|
| 1808 | + } |
---|
| 1809 | + }); |
---|
| 1810 | + |
---|
| 1811 | + for (int i=10; --i>=0;) |
---|
| 1812 | + { |
---|
| 1813 | + creditsPanel.add(new cGridBag()); |
---|
| 1814 | + } |
---|
| 1815 | + |
---|
| 1816 | + tabbedPane.add(creditsPanel); |
---|
| 1817 | + tabbedPane.setToolTipTextAt(3, "Credits"); |
---|
| 1818 | + |
---|
| 1819 | + if (Globals.ADVANCED) |
---|
| 1820 | + { |
---|
| 1821 | + tabbedPane.add(infoPanel); |
---|
| 1822 | + tabbedPane.setIconAt(4, GetIcon("icons/info.png")); |
---|
| 1823 | + tabbedPane.setToolTipTextAt(4, "Information"); |
---|
| 1824 | + } |
---|
| 1825 | + |
---|
1652 | 1826 | /* |
---|
1653 | 1827 | cTree jTree = new cTree(null); |
---|
1654 | 1828 | ToolTipManager.sharedInstance().registerComponent(jTree); |
---|
.. | .. |
---|
1669 | 1843 | jtp.add(tree); |
---|
1670 | 1844 | */ |
---|
1671 | 1845 | |
---|
1672 | | - bigPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, scenePanel, gridPanel); |
---|
1673 | | - bigPanel.setContinuousLayout(true); |
---|
1674 | | - bigPanel.setOneTouchExpandable(true); |
---|
1675 | | - bigPanel.setDividerLocation(0.8); |
---|
1676 | | - bigPanel.setDividerSize(15); |
---|
1677 | | - bigPanel.setResizeWeight(0.15); |
---|
1678 | | - bigPanel.setName("Scene"); |
---|
| 1846 | +// bigPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, scenePanel, gridPanel); |
---|
| 1847 | +// bigPanel.setContinuousLayout(true); |
---|
| 1848 | +// bigPanel.setOneTouchExpandable(true); |
---|
| 1849 | +// bigPanel.setDividerLocation(0.8); |
---|
| 1850 | +// bigPanel.setDividerSize(15); |
---|
| 1851 | +// bigPanel.setResizeWeight(0.15); |
---|
| 1852 | +// bigPanel.setName("Scene"); |
---|
1679 | 1853 | |
---|
1680 | 1854 | //bigPanel.setLayout(new BorderLayout()); |
---|
1681 | 1855 | //bigPanel.setSize(new Dimension(10,10)); |
---|
.. | .. |
---|
1745 | 1919 | |
---|
1746 | 1920 | frame.getContentPane().setLayout(new BorderLayout()); |
---|
1747 | 1921 | /**/ |
---|
1748 | | - JTabbedPane worldPane = new JTabbedPane(); |
---|
| 1922 | + //JTabbedPane worldPane = new JTabbedPane(); |
---|
1749 | 1923 | //worldPane.add(bigPanel); |
---|
1750 | 1924 | //worldPane.add(worldPanel); |
---|
1751 | 1925 | /**/ |
---|
.. | .. |
---|
1759 | 1933 | |
---|
1760 | 1934 | cameraView.requestFocusInWindow(); |
---|
1761 | 1935 | |
---|
1762 | | - gridPanel.setDividerLocation(1.0); |
---|
| 1936 | +// gridPanel.setDividerLocation(1.0); |
---|
1763 | 1937 | |
---|
1764 | 1938 | frame.validate(); |
---|
1765 | 1939 | |
---|
.. | .. |
---|
1794 | 1968 | { |
---|
1795 | 1969 | cGridBag presetpanel = new cGridBag().setVertical(true); |
---|
1796 | 1970 | |
---|
1797 | | - cLabel skin = GetLabel("icons/shadericons/shadericon00000.png", !Grafreed.NIMBUSLAF); |
---|
| 1971 | + cLabel skin = GetLabel("icons/shadericons/shadericon00000.png", !Globals.NIMBUSLAF); |
---|
1798 | 1972 | skin.setToolTipText("Skin"); |
---|
1799 | 1973 | skin.addMouseListener(new MouseAdapter() |
---|
1800 | 1974 | { |
---|
.. | .. |
---|
1805 | 1979 | |
---|
1806 | 1980 | // Skin |
---|
1807 | 1981 | colorField.setFloat(material.color); |
---|
1808 | | - saturationField.setFloat(material.modulation); |
---|
| 1982 | + float saturation = material.modulation; |
---|
| 1983 | + |
---|
| 1984 | + if (!cameraView.Skinshader) |
---|
| 1985 | + { |
---|
| 1986 | + saturation /= 1.5; |
---|
| 1987 | + } |
---|
| 1988 | + |
---|
| 1989 | + saturationField.setFloat(saturation); |
---|
| 1990 | + |
---|
1809 | 1991 | subsurfaceField.setFloat(material.subsurface); |
---|
1810 | 1992 | selfshadowField.setFloat(material.diffuseness); |
---|
1811 | 1993 | diffusenessField.setFloat(material.factor); |
---|
.. | .. |
---|
1824 | 2006 | }); |
---|
1825 | 2007 | presetpanel.add(skin); |
---|
1826 | 2008 | |
---|
1827 | | - cLabel lambert = GetLabel("icons/shadericons/shadericon00002.png", !Grafreed.NIMBUSLAF); |
---|
| 2009 | + cLabel lambert = GetLabel("icons/shadericons/shadericon00002.png", !Globals.NIMBUSLAF); |
---|
1828 | 2010 | lambert.setToolTipText("Diffuse"); |
---|
1829 | 2011 | lambert.addMouseListener(new MouseAdapter() |
---|
1830 | 2012 | { |
---|
.. | .. |
---|
1842 | 2024 | }); |
---|
1843 | 2025 | presetpanel.add(lambert); |
---|
1844 | 2026 | |
---|
1845 | | - cLabel diffuse2 = GetLabel("icons/shadericons/shadericon00003.png", !Grafreed.NIMBUSLAF); |
---|
| 2027 | + cLabel diffuse2 = GetLabel("icons/shadericons/shadericon00003.png", !Globals.NIMBUSLAF); |
---|
1846 | 2028 | diffuse2.setToolTipText("Diffuse2"); |
---|
1847 | 2029 | diffuse2.addMouseListener(new MouseAdapter() |
---|
1848 | 2030 | { |
---|
.. | .. |
---|
1860 | 2042 | }); |
---|
1861 | 2043 | presetpanel.add(diffuse2); |
---|
1862 | 2044 | |
---|
1863 | | - cLabel diffusemoon = GetLabel("icons/shadericons/shadericon00004.png", !Grafreed.NIMBUSLAF); |
---|
| 2045 | + cLabel diffusemoon = GetLabel("icons/shadericons/shadericon00004.png", !Globals.NIMBUSLAF); |
---|
1864 | 2046 | diffusemoon.setToolTipText("Moon"); |
---|
1865 | 2047 | diffusemoon.addMouseListener(new MouseAdapter() |
---|
1866 | 2048 | { |
---|
.. | .. |
---|
1878 | 2060 | }); |
---|
1879 | 2061 | presetpanel.add(diffusemoon); |
---|
1880 | 2062 | |
---|
1881 | | - cLabel diffusemoon2 = GetLabel("icons/shadericons/shadericon00005.png", !Grafreed.NIMBUSLAF); |
---|
| 2063 | + cLabel diffusemoon2 = GetLabel("icons/shadericons/shadericon00005.png", !Globals.NIMBUSLAF); |
---|
1882 | 2064 | diffusemoon2.setToolTipText("Moon2"); |
---|
1883 | 2065 | diffusemoon2.addMouseListener(new MouseAdapter() |
---|
1884 | 2066 | { |
---|
.. | .. |
---|
1896 | 2078 | }); |
---|
1897 | 2079 | presetpanel.add(diffusemoon2); |
---|
1898 | 2080 | |
---|
1899 | | - cLabel diffusemoon3 = GetLabel("icons/shadericons/shadericon00006.png", !Grafreed.NIMBUSLAF); |
---|
| 2081 | + cLabel diffusemoon3 = GetLabel("icons/shadericons/shadericon00006.png", !Globals.NIMBUSLAF); |
---|
1900 | 2082 | diffusemoon3.setToolTipText("Moon3"); |
---|
1901 | 2083 | diffusemoon3.addMouseListener(new MouseAdapter() |
---|
1902 | 2084 | { |
---|
.. | .. |
---|
1914 | 2096 | }); |
---|
1915 | 2097 | presetpanel.add(diffusemoon3); |
---|
1916 | 2098 | |
---|
1917 | | - cLabel diffusesheen = GetLabel("icons/shadericons/shadericon00007.png", !Grafreed.NIMBUSLAF); |
---|
| 2099 | + cLabel diffusesheen = GetLabel("icons/shadericons/shadericon00007.png", !Globals.NIMBUSLAF); |
---|
1918 | 2100 | diffusesheen.setToolTipText("Sheen"); |
---|
1919 | 2101 | diffusesheen.addMouseListener(new MouseAdapter() |
---|
1920 | 2102 | { |
---|
.. | .. |
---|
1931 | 2113 | }); |
---|
1932 | 2114 | presetpanel.add(diffusesheen); |
---|
1933 | 2115 | |
---|
1934 | | - cLabel rough = GetLabel("icons/shadericons/shadericon00001.png", !Grafreed.NIMBUSLAF); |
---|
| 2116 | + cLabel rough = GetLabel("icons/shadericons/shadericon00001.png", !Globals.NIMBUSLAF); |
---|
1935 | 2117 | rough.setToolTipText("Rough metal"); |
---|
1936 | 2118 | rough.addMouseListener(new MouseAdapter() |
---|
1937 | 2119 | { |
---|
.. | .. |
---|
1949 | 2131 | }); |
---|
1950 | 2132 | presetpanel.add(rough); |
---|
1951 | 2133 | |
---|
1952 | | - cLabel rough2 = GetLabel("icons/shadericons/shadericon00013.png", !Grafreed.NIMBUSLAF); |
---|
| 2134 | + cLabel rough2 = GetLabel("icons/shadericons/shadericon00013.png", !Globals.NIMBUSLAF); |
---|
1953 | 2135 | rough2.setToolTipText("Medium metal"); |
---|
1954 | 2136 | rough2.addMouseListener(new MouseAdapter() |
---|
1955 | 2137 | { |
---|
.. | .. |
---|
1967 | 2149 | }); |
---|
1968 | 2150 | presetpanel.add(rough2); |
---|
1969 | 2151 | |
---|
1970 | | - cLabel shini0 = GetLabel("icons/shadericons/shadericon00014.png", !Grafreed.NIMBUSLAF); |
---|
| 2152 | + cLabel shini0 = GetLabel("icons/shadericons/shadericon00014.png", !Globals.NIMBUSLAF); |
---|
1971 | 2153 | shini0.setToolTipText("Shiny"); |
---|
1972 | 2154 | shini0.addMouseListener(new MouseAdapter() |
---|
1973 | 2155 | { |
---|
.. | .. |
---|
1985 | 2167 | }); |
---|
1986 | 2168 | presetpanel.add(shini0); |
---|
1987 | 2169 | |
---|
1988 | | - cLabel shini1 = GetLabel("icons/shadericons/shadericon00011.png", !Grafreed.NIMBUSLAF); |
---|
| 2170 | + cLabel shini1 = GetLabel("icons/shadericons/shadericon00011.png", !Globals.NIMBUSLAF); |
---|
1989 | 2171 | shini1.setToolTipText("Shiny2"); |
---|
1990 | 2172 | shini1.addMouseListener(new MouseAdapter() |
---|
1991 | 2173 | { |
---|
.. | .. |
---|
2003 | 2185 | }); |
---|
2004 | 2186 | presetpanel.add(shini1); |
---|
2005 | 2187 | |
---|
2006 | | - cLabel shini2 = GetLabel("icons/shadericons/shadericon00012.png", !Grafreed.NIMBUSLAF); |
---|
| 2188 | + cLabel shini2 = GetLabel("icons/shadericons/shadericon00012.png", !Globals.NIMBUSLAF); |
---|
2007 | 2189 | shini2.setToolTipText("Shiny3"); |
---|
2008 | 2190 | shini2.addMouseListener(new MouseAdapter() |
---|
2009 | 2191 | { |
---|
.. | .. |
---|
2021 | 2203 | }); |
---|
2022 | 2204 | presetpanel.add(shini2); |
---|
2023 | 2205 | |
---|
2024 | | - cLabel aniso = GetLabel("icons/shadericons/shadericon00008.png", !Grafreed.NIMBUSLAF); |
---|
| 2206 | + cLabel aniso = GetLabel("icons/shadericons/shadericon00008.png", !Globals.NIMBUSLAF); |
---|
2025 | 2207 | aniso.setToolTipText("AnisoU"); |
---|
2026 | 2208 | aniso.addMouseListener(new MouseAdapter() |
---|
2027 | 2209 | { |
---|
.. | .. |
---|
2039 | 2221 | }); |
---|
2040 | 2222 | presetpanel.add(aniso); |
---|
2041 | 2223 | |
---|
2042 | | - cLabel aniso2 = GetLabel("icons/shadericons/shadericon00009.png", !Grafreed.NIMBUSLAF); |
---|
| 2224 | + cLabel aniso2 = GetLabel("icons/shadericons/shadericon00009.png", !Globals.NIMBUSLAF); |
---|
2043 | 2225 | aniso2.setToolTipText("AnisoV"); |
---|
2044 | 2226 | aniso2.addMouseListener(new MouseAdapter() |
---|
2045 | 2227 | { |
---|
.. | .. |
---|
2057 | 2239 | }); |
---|
2058 | 2240 | presetpanel.add(aniso2); |
---|
2059 | 2241 | |
---|
2060 | | - cLabel aniso3 = GetLabel("icons/shadericons/shadericon00010.png", !Grafreed.NIMBUSLAF); |
---|
| 2242 | + cLabel aniso3 = GetLabel("icons/shadericons/shadericon00010.png", !Globals.NIMBUSLAF); |
---|
2061 | 2243 | aniso3.setToolTipText("AnisoUV"); |
---|
2062 | 2244 | aniso3.addMouseListener(new MouseAdapter() |
---|
2063 | 2245 | { |
---|
.. | .. |
---|
2075 | 2257 | }); |
---|
2076 | 2258 | presetpanel.add(aniso3); |
---|
2077 | 2259 | |
---|
2078 | | - cLabel velvet0 = GetLabel("icons/shadericons/shadericon00015.png", !Grafreed.NIMBUSLAF); |
---|
| 2260 | + cLabel velvet0 = GetLabel("icons/shadericons/shadericon00015.png", !Globals.NIMBUSLAF); |
---|
2079 | 2261 | velvet0.setToolTipText("Velvet"); |
---|
2080 | 2262 | velvet0.addMouseListener(new MouseAdapter() |
---|
2081 | 2263 | { |
---|
.. | .. |
---|
2097 | 2279 | }); |
---|
2098 | 2280 | presetpanel.add(velvet0); |
---|
2099 | 2281 | |
---|
2100 | | - cLabel bump0 = GetLabel("icons/shadericons/shadericon00016.png", !Grafreed.NIMBUSLAF); |
---|
| 2282 | + cLabel bump0 = GetLabel("icons/shadericons/shadericon00016.png", !Globals.NIMBUSLAF); |
---|
2101 | 2283 | bump0.setToolTipText("Bump texture"); |
---|
2102 | 2284 | bump0.addMouseListener(new MouseAdapter() |
---|
2103 | 2285 | { |
---|
.. | .. |
---|
2116 | 2298 | }); |
---|
2117 | 2299 | presetpanel.add(bump0); |
---|
2118 | 2300 | |
---|
2119 | | - cLabel halo = GetLabel("icons/shadericons/shadericon00017.png", !Grafreed.NIMBUSLAF); |
---|
| 2301 | + cLabel borderShader = GetLabel("icons/shadericons/borderfade.jpg", !Globals.NIMBUSLAF); |
---|
| 2302 | + borderShader.setToolTipText("Border fade"); |
---|
| 2303 | + borderShader.addMouseListener(new MouseAdapter() |
---|
| 2304 | + { |
---|
| 2305 | + public void mouseClicked(MouseEvent e) |
---|
| 2306 | + { |
---|
| 2307 | + borderfadeField.setFloat(0.5); |
---|
| 2308 | + opacityField.setFloat(0.75); |
---|
| 2309 | + |
---|
| 2310 | + materialtouched = true; |
---|
| 2311 | + applySelf(); |
---|
| 2312 | + } |
---|
| 2313 | + }); |
---|
| 2314 | + presetpanel.add(borderShader); |
---|
| 2315 | + |
---|
| 2316 | + cLabel halo = GetLabel("icons/shadericons/shadericon00017.png", !Globals.NIMBUSLAF); |
---|
2120 | 2317 | halo.setToolTipText("Halo"); |
---|
2121 | 2318 | halo.addMouseListener(new MouseAdapter() |
---|
2122 | 2319 | { |
---|
.. | .. |
---|
2133 | 2330 | }); |
---|
2134 | 2331 | presetpanel.add(halo); |
---|
2135 | 2332 | |
---|
2136 | | - cLabel candle = GetLabel("icons/shadericons/shadericon00018.png", !Grafreed.NIMBUSLAF); |
---|
| 2333 | + cLabel candle = GetLabel("icons/shadericons/shadericon00018.png", !Globals.NIMBUSLAF); |
---|
2137 | 2334 | candle.setToolTipText("Candle"); |
---|
2138 | 2335 | candle.addMouseListener(new MouseAdapter() |
---|
2139 | 2336 | { |
---|
.. | .. |
---|
2155 | 2352 | }); |
---|
2156 | 2353 | presetpanel.add(candle); |
---|
2157 | 2354 | |
---|
2158 | | - cLabel shadowShader = GetLabel("icons/shadericons/shadow.png", !Grafreed.NIMBUSLAF); |
---|
| 2355 | + cLabel shadowShader = GetLabel("icons/shadericons/shadow.png", !Globals.NIMBUSLAF); |
---|
2159 | 2356 | shadowShader.setToolTipText("Shadow"); |
---|
2160 | 2357 | shadowShader.addMouseListener(new MouseAdapter() |
---|
2161 | 2358 | { |
---|
.. | .. |
---|
2190 | 2387 | |
---|
2191 | 2388 | cGridBag editBar = new cGridBag().setVertical(false); |
---|
2192 | 2389 | |
---|
2193 | | - editBar.add(createMaterialButton = new cButton("Create", !Grafreed.NIMBUSLAF)); // , aConstraints); |
---|
| 2390 | + editBar.add(createMaterialButton = new cButton("Create", !Globals.NIMBUSLAF)); // , aConstraints); |
---|
2194 | 2391 | createMaterialButton.setToolTipText("Create material"); |
---|
2195 | 2392 | |
---|
2196 | 2393 | /* |
---|
2197 | 2394 | ctrlPanel.add(resetSlidersButton = new cButton("Reset All"), aConstraints); |
---|
2198 | 2395 | */ |
---|
2199 | 2396 | |
---|
2200 | | - editBar.add(clearMaterialButton = new cButton("Clear", !Grafreed.NIMBUSLAF)); // , aConstraints); |
---|
| 2397 | + editBar.add(clearMaterialButton = new cButton("Clear", !Globals.NIMBUSLAF)); // , aConstraints); |
---|
2201 | 2398 | clearMaterialButton.setToolTipText("Clear material"); |
---|
2202 | 2399 | |
---|
2203 | 2400 | if (Globals.ADVANCED) |
---|
2204 | 2401 | { |
---|
2205 | | - editBar.add(resetSlidersButton = new cButton("Reset", !Grafreed.NIMBUSLAF)); // , aConstraints); |
---|
| 2402 | + editBar.add(resetSlidersButton = new cButton("Reset", !Globals.NIMBUSLAF)); // , aConstraints); |
---|
2206 | 2403 | editBar.add(propagateToggle = new cCheckBox("Prop", propagate)); // , aConstraints); |
---|
2207 | 2404 | editBar.add(multiplyToggle = new cCheckBox("Mult", false)); // , aConstraints); |
---|
2208 | 2405 | } |
---|
.. | .. |
---|
2223 | 2420 | |
---|
2224 | 2421 | cGridBag huepanel = new cGridBag(); |
---|
2225 | 2422 | cGridBag huelabel = new cGridBag(); |
---|
2226 | | - skin = GetLabel("icons/hue.png", false); |
---|
2227 | | - skin.fit = true; |
---|
2228 | | - huelabel.add(skin); |
---|
| 2423 | + cLabel hue = GetLabel("icons/hue.png", false); |
---|
| 2424 | + hue.fit = true; |
---|
| 2425 | + |
---|
| 2426 | + hue.addMouseListener(new MouseAdapter() |
---|
| 2427 | + { |
---|
| 2428 | + public void mousePressed(MouseEvent e) |
---|
| 2429 | + { |
---|
| 2430 | + int x = e.getX(); |
---|
| 2431 | + |
---|
| 2432 | + colorField.setFloat((double)x / ((cLabel)e.getSource()).getWidth()); |
---|
| 2433 | + } |
---|
| 2434 | + }); |
---|
| 2435 | + |
---|
| 2436 | + huelabel.add(hue); |
---|
2229 | 2437 | huelabel.preferredWidth = 20; |
---|
2230 | 2438 | huepanel.add(new cGridBag()); // Label |
---|
2231 | 2439 | huepanel.add(huelabel); // Field/slider |
---|
.. | .. |
---|
3501 | 3709 | |
---|
3502 | 3710 | if (multiplyToggle != null) |
---|
3503 | 3711 | multiplyToggle.setSelected(mat.multiply); |
---|
3504 | | - |
---|
3505 | | - assert (object.projectedVertices != null); |
---|
3506 | | - |
---|
3507 | | - if (object.projectedVertices.length <= 2) |
---|
3508 | | - { |
---|
3509 | | - // Side effect... |
---|
3510 | | - Object3D.cVector2[] keep = object.projectedVertices; |
---|
3511 | | - object.projectedVertices = new Object3D.cVector2[3]; |
---|
3512 | | - for (int i = 0; i < 3; i++) |
---|
3513 | | - { |
---|
3514 | | - if (i < keep.length) |
---|
3515 | | - { |
---|
3516 | | - object.projectedVertices[i] = keep[i]; |
---|
3517 | | - } else |
---|
3518 | | - { |
---|
3519 | | - object.projectedVertices[i] = new Object3D.cVector2(); |
---|
3520 | | - } |
---|
3521 | | - /* |
---|
3522 | | - if(keep.length == 0) |
---|
3523 | | - object.projectedVertices[0] = new Object3D.cVector2(); |
---|
3524 | | - else |
---|
3525 | | - object.projectedVertices[0] = keep[0]; |
---|
3526 | | - object.projectedVertices[1] = new Object3D.cVector2(); |
---|
3527 | | - */ |
---|
3528 | | - } |
---|
3529 | | - } |
---|
| 3712 | + |
---|
| 3713 | + AllocProjectedVertices(object); |
---|
3530 | 3714 | |
---|
3531 | 3715 | SetMaterial(mat, object.projectedVertices); |
---|
3532 | 3716 | } |
---|
.. | .. |
---|
3836 | 4020 | //System.out.println("ObjEditor " + event); |
---|
3837 | 4021 | applySelf0(true); |
---|
3838 | 4022 | //parent.applySelf(); |
---|
3839 | | - objEditor.refreshContents(); |
---|
| 4023 | + // conflicts with requestFocus objEditor.refreshContents(); |
---|
3840 | 4024 | } else if (source == resetButton) |
---|
3841 | 4025 | { |
---|
3842 | 4026 | CameraPane.fullreset = true; |
---|
.. | .. |
---|
4016 | 4200 | |
---|
4017 | 4201 | void New() |
---|
4018 | 4202 | { |
---|
4019 | | - while (copy.Size() > 1) |
---|
| 4203 | + while (copy.Size() > 0) |
---|
4020 | 4204 | { |
---|
4021 | | - copy.remove(1); |
---|
| 4205 | + copy.remove(0); |
---|
4022 | 4206 | } |
---|
4023 | 4207 | |
---|
| 4208 | + copy.selection.clear(); |
---|
| 4209 | + |
---|
| 4210 | + if (copy == Grafreed.grafreed.universe) |
---|
| 4211 | + { |
---|
| 4212 | + CreateCameras(); |
---|
| 4213 | + cameraView.SetCamera(GetCamera(copy, 0)); |
---|
| 4214 | + } |
---|
4024 | 4215 | ResetModel(); |
---|
4025 | 4216 | objEditor.refreshContents(); |
---|
4026 | 4217 | } |
---|
.. | .. |
---|
4148 | 4339 | return true; |
---|
4149 | 4340 | } |
---|
4150 | 4341 | |
---|
4151 | | - java.util.Hashtable<java.util.UUID, Object3D> versiontable = new java.util.Hashtable<java.util.UUID, Object3D>(); |
---|
4152 | | - |
---|
4153 | 4342 | void DeleteVersion() |
---|
4154 | 4343 | { |
---|
4155 | 4344 | for (int i = copy.versionindex; i < copy.versionlist.length-1; i++) |
---|
.. | .. |
---|
4157 | 4346 | copy.versionlist[i] = copy.versionlist[i+1]; |
---|
4158 | 4347 | } |
---|
4159 | 4348 | |
---|
4160 | | - CopyChanged(); |
---|
| 4349 | + if (copy.versionlist[copy.versionindex] == null) |
---|
| 4350 | + copy.versionindex -= 1; |
---|
| 4351 | + |
---|
| 4352 | + if (copy.versionindex != -1) |
---|
| 4353 | + CopyChanged(); |
---|
4161 | 4354 | |
---|
4162 | 4355 | SetVersionStates(); |
---|
4163 | 4356 | } |
---|
.. | .. |
---|
4270 | 4463 | boolean temp = CameraPane.SWITCH; |
---|
4271 | 4464 | CameraPane.SWITCH = false; |
---|
4272 | 4465 | |
---|
4273 | | - copy.ExtractBigData(versiontable); |
---|
| 4466 | + copy.ExtractBigData(Grafreed.grafreed.universe.versiontable); |
---|
4274 | 4467 | |
---|
4275 | 4468 | copy.clear(); |
---|
4276 | 4469 | |
---|
.. | .. |
---|
4282 | 4475 | copy.add(obj.get(i)); |
---|
4283 | 4476 | } |
---|
4284 | 4477 | |
---|
4285 | | - copy.RestoreBigData(versiontable); |
---|
| 4478 | + copy.RestoreBigData(Grafreed.grafreed.universe.versiontable); |
---|
4286 | 4479 | |
---|
4287 | 4480 | CameraPane.SWITCH = temp; |
---|
4288 | 4481 | |
---|
.. | .. |
---|
4332 | 4525 | return count; |
---|
4333 | 4526 | } |
---|
4334 | 4527 | |
---|
| 4528 | + public cGridBag versionSliderPane; |
---|
| 4529 | + |
---|
4335 | 4530 | void SetVersionStates() |
---|
4336 | 4531 | { |
---|
4337 | 4532 | //if (true) |
---|
.. | .. |
---|
4339 | 4534 | |
---|
4340 | 4535 | //cRadio tab = GetCurrentTab(); |
---|
4341 | 4536 | |
---|
4342 | | - restoreButton.setEnabled(copy.versionindex != -1); |
---|
4343 | | - replaceButton.setEnabled(copy.versionindex != -1); |
---|
4344 | | - |
---|
4345 | | - previousVersionButton.setEnabled(copy.versionindex > 0); |
---|
4346 | | - nextVersionButton.setEnabled(copy.versionlist[copy.versionindex + 1] != null); |
---|
4347 | | - |
---|
4348 | | - deleteVersionButton.setEnabled(//copy.versionindex > 0 && |
---|
4349 | | - copy.versionlist[copy.versionindex + 1] != null); |
---|
4350 | | - |
---|
4351 | | - muteSlider = true; |
---|
4352 | | - versionSlider.setMinimum(0); |
---|
4353 | | - versionSlider.setMaximum(VersionCount() - 1); |
---|
4354 | | - versionSlider.setInteger(copy.versionindex); |
---|
4355 | | - versionSlider.setEnabled(copy.versionindex != -1); |
---|
4356 | | - muteSlider = false; |
---|
| 4537 | + if (copy.versionlist == null) |
---|
| 4538 | + { |
---|
| 4539 | + saveVersionButton.setEnabled(false); |
---|
| 4540 | + restoreButton.setEnabled(false); |
---|
| 4541 | + replaceButton.setEnabled(false); |
---|
| 4542 | + previousVersionButton.setEnabled(false); |
---|
| 4543 | + nextVersionButton.setEnabled(false); |
---|
| 4544 | + deleteVersionButton.setEnabled(false); |
---|
| 4545 | + versionSliderPane.setVisible(false); |
---|
| 4546 | + } |
---|
| 4547 | + else |
---|
| 4548 | + { |
---|
| 4549 | + restoreButton.setEnabled(copy.versionindex != -1); |
---|
| 4550 | + replaceButton.setEnabled(copy.versionindex != -1); |
---|
| 4551 | + |
---|
| 4552 | + previousVersionButton.setEnabled(copy.versionindex > 0); |
---|
| 4553 | + nextVersionButton.setEnabled(copy.versionlist[copy.versionindex + 1] != null); |
---|
| 4554 | + |
---|
| 4555 | + deleteVersionButton.setEnabled(copy.versionindex != -1); |
---|
| 4556 | + //copy.versionlist[copy.versionindex + 1] != null); |
---|
| 4557 | + |
---|
| 4558 | + muteSlider = true; |
---|
| 4559 | + versionSlider.setMinimum(0); |
---|
| 4560 | + versionSlider.setMaximum(VersionCount() - 1); |
---|
| 4561 | + versionSlider.setInteger(copy.versionindex); |
---|
| 4562 | + versionSlider.setEnabled(copy.versionindex != -1); |
---|
| 4563 | + muteSlider = false; |
---|
| 4564 | + |
---|
| 4565 | + versionSliderPane.setVisible(true); |
---|
| 4566 | + } |
---|
4357 | 4567 | } |
---|
4358 | 4568 | |
---|
4359 | 4569 | public boolean PreviousVersion() |
---|
.. | .. |
---|
4411 | 4621 | |
---|
4412 | 4622 | public boolean Replace() |
---|
4413 | 4623 | { |
---|
4414 | | - System.err.println("Replace"); |
---|
| 4624 | + //System.err.println("Replace"); |
---|
4415 | 4625 | |
---|
4416 | 4626 | //cRadio tab = GetCurrentTab(); |
---|
4417 | 4627 | |
---|
.. | .. |
---|
4638 | 4848 | // else |
---|
4639 | 4849 | // applySelf(true); |
---|
4640 | 4850 | // } |
---|
| 4851 | + |
---|
| 4852 | + boolean Equal(double a, double b) |
---|
| 4853 | + { |
---|
| 4854 | + return Math.abs(a - b) < 0.001; |
---|
| 4855 | + } |
---|
| 4856 | + |
---|
4641 | 4857 | void applySelf0(boolean name) |
---|
4642 | 4858 | { |
---|
4643 | 4859 | if (name) |
---|
.. | .. |
---|
4687 | 4903 | { |
---|
4688 | 4904 | cMaterial mat = copy.material; |
---|
4689 | 4905 | |
---|
4690 | | - colorField.SetToolTipValue((mat.color)); |
---|
4691 | | - saturationField.SetToolTipValue((mat.modulation)); |
---|
4692 | | - metalnessField.SetToolTipValue((mat.metalness)); |
---|
4693 | | - diffuseField.SetToolTipValue((mat.diffuse)); |
---|
4694 | | - specularField.SetToolTipValue((mat.specular)); |
---|
4695 | | - shininessField.SetToolTipValue((mat.shininess)); |
---|
4696 | | - shiftField.SetToolTipValue((mat.shift)); |
---|
4697 | | - ambientField.SetToolTipValue((mat.ambient)); |
---|
4698 | | - lightareaField.SetToolTipValue((mat.lightarea)); |
---|
4699 | | - diffusenessField.SetToolTipValue((mat.factor)); |
---|
4700 | | - velvetField.SetToolTipValue((mat.velvet)); |
---|
4701 | | - sheenField.SetToolTipValue((mat.sheen)); |
---|
4702 | | - subsurfaceField.SetToolTipValue((mat.subsurface)); |
---|
4703 | | - backlitField.SetToolTipValue((mat.bump)); |
---|
4704 | | - anisoField.SetToolTipValue((mat.aniso)); |
---|
4705 | | - anisoVField.SetToolTipValue((mat.anisoV)); |
---|
4706 | | - cameraField.SetToolTipValue((mat.cameralight)); |
---|
4707 | | - selfshadowField.SetToolTipValue((mat.diffuseness)); |
---|
4708 | | - shadowField.SetToolTipValue((mat.shadow)); |
---|
4709 | | - textureField.SetToolTipValue((mat.texture)); |
---|
4710 | | - opacityField.SetToolTipValue((mat.opacity)); |
---|
4711 | | - fakedepthField.SetToolTipValue((mat.fakedepth)); |
---|
4712 | | - shadowbiasField.SetToolTipValue((mat.shadowbias)); |
---|
| 4906 | + if (!Equal(colorField.getFloat(), mat.color)) |
---|
| 4907 | + colorField.SetToolTipValue((mat.color)); |
---|
| 4908 | + if (!Equal(saturationField.getFloat(), mat.modulation)) |
---|
| 4909 | + saturationField.SetToolTipValue((mat.modulation)); |
---|
| 4910 | + if (!Equal(metalnessField.getFloat(), mat.metalness)) |
---|
| 4911 | + metalnessField.SetToolTipValue((mat.metalness)); |
---|
| 4912 | + if (!Equal(diffuseField.getFloat(), mat.diffuse)) |
---|
| 4913 | + diffuseField.SetToolTipValue((mat.diffuse)); |
---|
| 4914 | + if (!Equal(specularField.getFloat(), mat.specular)) |
---|
| 4915 | + specularField.SetToolTipValue((mat.specular)); |
---|
| 4916 | + if (!Equal(shininessField.getFloat(), mat.shininess)) |
---|
| 4917 | + shininessField.SetToolTipValue((mat.shininess)); |
---|
| 4918 | + if (!Equal(shiftField.getFloat(), mat.shift)) |
---|
| 4919 | + shiftField.SetToolTipValue((mat.shift)); |
---|
| 4920 | + if (!Equal(ambientField.getFloat(), mat.ambient)) |
---|
| 4921 | + ambientField.SetToolTipValue((mat.ambient)); |
---|
| 4922 | + if (!Equal(lightareaField.getFloat(), mat.lightarea)) |
---|
| 4923 | + lightareaField.SetToolTipValue((mat.lightarea)); |
---|
| 4924 | + if (!Equal(diffusenessField.getFloat(), mat.factor)) |
---|
| 4925 | + diffusenessField.SetToolTipValue((mat.factor)); |
---|
| 4926 | + if (!Equal(velvetField.getFloat(), mat.velvet)) |
---|
| 4927 | + velvetField.SetToolTipValue((mat.velvet)); |
---|
| 4928 | + if (!Equal(sheenField.getFloat(), mat.sheen)) |
---|
| 4929 | + sheenField.SetToolTipValue((mat.sheen)); |
---|
| 4930 | + if (!Equal(subsurfaceField.getFloat(), mat.subsurface)) |
---|
| 4931 | + subsurfaceField.SetToolTipValue((mat.subsurface)); |
---|
| 4932 | + if (!Equal(backlitField.getFloat(), mat.bump)) |
---|
| 4933 | + backlitField.SetToolTipValue((mat.bump)); |
---|
| 4934 | + if (!Equal(anisoField.getFloat(), mat.aniso)) |
---|
| 4935 | + anisoField.SetToolTipValue((mat.aniso)); |
---|
| 4936 | + if (!Equal(anisoVField.getFloat(), mat.anisoV)) |
---|
| 4937 | + anisoVField.SetToolTipValue((mat.anisoV)); |
---|
| 4938 | + if (!Equal(cameraField.getFloat(), mat.cameralight)) |
---|
| 4939 | + cameraField.SetToolTipValue((mat.cameralight)); |
---|
| 4940 | + if (!Equal(selfshadowField.getFloat(), mat.diffuseness)) |
---|
| 4941 | + selfshadowField.SetToolTipValue((mat.diffuseness)); |
---|
| 4942 | + if (!Equal(shadowField.getFloat(), mat.shadow)) |
---|
| 4943 | + shadowField.SetToolTipValue((mat.shadow)); |
---|
| 4944 | + if (!Equal(textureField.getFloat(), mat.texture)) |
---|
| 4945 | + textureField.SetToolTipValue((mat.texture)); |
---|
| 4946 | + if (!Equal(opacityField.getFloat(), mat.opacity)) |
---|
| 4947 | + opacityField.SetToolTipValue((mat.opacity)); |
---|
| 4948 | + if (!Equal(fakedepthField.getFloat(), mat.fakedepth)) |
---|
| 4949 | + fakedepthField.SetToolTipValue((mat.fakedepth)); |
---|
| 4950 | + if (!Equal(shadowbiasField.getFloat(), mat.shadowbias)) |
---|
| 4951 | + shadowbiasField.SetToolTipValue((mat.shadowbias)); |
---|
4713 | 4952 | } |
---|
4714 | 4953 | |
---|
4715 | 4954 | if (copy.material != null && copy.projectedVertices.length > 0 && copy.projectedVertices[0] != null) |
---|
.. | .. |
---|
4744 | 4983 | |
---|
4745 | 4984 | public void stateChanged(ChangeEvent e) |
---|
4746 | 4985 | { |
---|
4747 | | - // assert(false); |
---|
| 4986 | + // assert(false); |
---|
4748 | 4987 | if (e.getSource() == versionSlider) |
---|
4749 | 4988 | { |
---|
4750 | 4989 | if (muteSlider) |
---|
4751 | 4990 | return; |
---|
| 4991 | + |
---|
| 4992 | + Replace(); |
---|
4752 | 4993 | |
---|
4753 | 4994 | int version = versionSlider.getInteger(); |
---|
4754 | 4995 | |
---|
.. | .. |
---|
5112 | 5353 | |
---|
5113 | 5354 | if (previousVersionButton != null && copy.versionlist != null) |
---|
5114 | 5355 | SetVersionStates(); |
---|
| 5356 | + |
---|
| 5357 | + cameraView.requestFocusInWindow(); |
---|
5115 | 5358 | } |
---|
5116 | 5359 | |
---|
5117 | 5360 | static TweenManager tweenManager = new TweenManager(); |
---|
.. | .. |
---|
5143 | 5386 | // group = (Composite) group.get(0); |
---|
5144 | 5387 | // } |
---|
5145 | 5388 | |
---|
5146 | | - System.out.println("makeSomething of " + thing); |
---|
| 5389 | + //System.out.println("makeSomething of " + thing); |
---|
5147 | 5390 | |
---|
5148 | 5391 | /* |
---|
5149 | 5392 | if (deselect && jList != null) |
---|
.. | .. |
---|
5497 | 5740 | |
---|
5498 | 5741 | copy.versionlist = readobj.versionlist; |
---|
5499 | 5742 | copy.versionindex = readobj.versionindex; |
---|
| 5743 | + copy.versiontable = readobj.versiontable; |
---|
5500 | 5744 | |
---|
5501 | 5745 | if (copy.versionlist == null) |
---|
5502 | 5746 | { |
---|
.. | .. |
---|
5504 | 5748 | copy.versionlist = new Object3D[100]; |
---|
5505 | 5749 | copy.versionindex = -1; |
---|
5506 | 5750 | |
---|
5507 | | - Save(true); |
---|
| 5751 | + //Save(true); |
---|
5508 | 5752 | } |
---|
5509 | 5753 | |
---|
5510 | 5754 | //? SetUndoStates(); |
---|
.. | .. |
---|
5852 | 6096 | boolean materialFlushed; |
---|
5853 | 6097 | Object3D latestObject; |
---|
5854 | 6098 | |
---|
| 6099 | + cGridBag transformPanel; |
---|
5855 | 6100 | cGridBag XYZPanel; |
---|
5856 | 6101 | |
---|
5857 | 6102 | JSplitPane gridPanel; |
---|