.. | .. |
---|
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 | { |
---|
.. | .. |
---|
53 | 83 | cButton GetButton(String name, boolean border) |
---|
54 | 84 | { |
---|
55 | 85 | ImageIcon icon = GetIcon(name); |
---|
56 | | - return new cButton(icon, border); |
---|
| 86 | + if (icon != null) |
---|
| 87 | + return new cButton(icon, border); |
---|
| 88 | + else |
---|
| 89 | + return new cButton(name, border); |
---|
57 | 90 | } |
---|
58 | 91 | |
---|
59 | 92 | cLabel GetLabel(String name, boolean border) |
---|
.. | .. |
---|
74 | 107 | return new cCheckBox(icon, border); |
---|
75 | 108 | } |
---|
76 | 109 | |
---|
77 | | - ImageIcon GetIcon(String name) |
---|
| 110 | + static java.util.Hashtable<String, javax.swing.ImageIcon> icons = new java.util.Hashtable<String, javax.swing.ImageIcon>(); |
---|
| 111 | + |
---|
| 112 | + static ImageIcon GetIcon(String name) |
---|
78 | 113 | { |
---|
| 114 | + javax.swing.ImageIcon iconCache = icons.get(name); |
---|
| 115 | + if (iconCache != null) |
---|
| 116 | + { |
---|
| 117 | + return iconCache; |
---|
| 118 | + } |
---|
| 119 | + |
---|
79 | 120 | try |
---|
80 | 121 | { |
---|
81 | | - BufferedImage image = javax.imageio.ImageIO.read(getClass().getClassLoader().getResourceAsStream(name)); |
---|
| 122 | + BufferedImage image = javax.imageio.ImageIO.read(ObjEditor.class.getClassLoader().getResourceAsStream(name)); |
---|
82 | 123 | |
---|
83 | 124 | // if (image.getWidth() > 48 && image.getHeight() > 48) |
---|
84 | 125 | // { |
---|
.. | .. |
---|
93 | 134 | // } |
---|
94 | 135 | |
---|
95 | 136 | javax.swing.ImageIcon icon = new javax.swing.ImageIcon(image); |
---|
| 137 | + |
---|
| 138 | + icons.put(name, icon); |
---|
| 139 | + |
---|
96 | 140 | return icon; |
---|
97 | 141 | } |
---|
98 | 142 | catch (Exception e) |
---|
99 | 143 | { |
---|
| 144 | + //icons.put(name, null); |
---|
100 | 145 | return null; |
---|
101 | 146 | } |
---|
102 | 147 | } |
---|
.. | .. |
---|
296 | 341 | client = inClient; |
---|
297 | 342 | copy = client; |
---|
298 | 343 | |
---|
299 | | - if (copy.versionlist == null) |
---|
300 | | - { |
---|
301 | | - copy.versionlist = new Object3D[100]; |
---|
302 | | - copy.versionindex = -1; |
---|
303 | | - } |
---|
| 344 | +// if (copy.versionlist == null) |
---|
| 345 | +// { |
---|
| 346 | +// copy.versionlist = new Object3D[100]; |
---|
| 347 | +// copy.versionindex = -1; |
---|
| 348 | +// |
---|
| 349 | +// callee.Save(true); |
---|
| 350 | +// } |
---|
304 | 351 | |
---|
305 | 352 | // "this" is not called: SetupUI2(objEditor); |
---|
306 | 353 | } |
---|
.. | .. |
---|
319 | 366 | { |
---|
320 | 367 | copy.versionlist = new Object3D[100]; |
---|
321 | 368 | copy.versionindex = -1; |
---|
| 369 | + |
---|
| 370 | +// Save(true); |
---|
322 | 371 | } |
---|
323 | 372 | |
---|
324 | 373 | SetupUI2(callee.GetEditor()); |
---|
.. | .. |
---|
342 | 391 | //parent = p; |
---|
343 | 392 | |
---|
344 | 393 | GraphicsDevice gd = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice(); |
---|
345 | | - System.out.println("getFullScreenWindow? " + gd.getFullScreenWindow()); |
---|
| 394 | + if (Globals.DEBUG) |
---|
| 395 | + System.out.println("getFullScreenWindow? " + gd.getFullScreenWindow()); |
---|
346 | 396 | //gd.setFullScreenWindow(this); |
---|
347 | 397 | //setResizable(false); |
---|
348 | 398 | //if (!isDisplayable()) |
---|
.. | .. |
---|
353 | 403 | copy = localCopy; |
---|
354 | 404 | copy.editWindow = this; |
---|
355 | 405 | |
---|
356 | | - if (copy.versionlist == null) |
---|
357 | | - { |
---|
358 | | -// copy.versions = new byte[100][]; |
---|
| 406 | +// if (copy.versionlist == null) |
---|
| 407 | +// { |
---|
| 408 | +// copy.versionlist = new Object3D[100]; |
---|
359 | 409 | // copy.versionindex = -1; |
---|
360 | | - } |
---|
| 410 | +// |
---|
| 411 | +// Save(true); |
---|
| 412 | +// } |
---|
361 | 413 | |
---|
362 | 414 | SetupMenu(); |
---|
363 | 415 | |
---|
.. | .. |
---|
377 | 429 | |
---|
378 | 430 | static java.util.Vector<Object3D> listUI = new java.util.Vector<Object3D>(); |
---|
379 | 431 | |
---|
| 432 | + // This is to refresh the UI of the material panel. |
---|
| 433 | + boolean patchMaterial; |
---|
| 434 | + |
---|
380 | 435 | void SetupMenu() |
---|
381 | 436 | { |
---|
382 | 437 | frame.setMenuBar(menuBar = new MenuBar()); |
---|
.. | .. |
---|
426 | 481 | |
---|
427 | 482 | ChangeListener changeListener = new ChangeListener() |
---|
428 | 483 | { |
---|
| 484 | + //String name; |
---|
| 485 | + |
---|
429 | 486 | public void stateChanged(ChangeEvent changeEvent) |
---|
430 | 487 | { |
---|
431 | 488 | // if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Material") && !materialFlushed) |
---|
.. | .. |
---|
444 | 501 | // EditSelection(false); |
---|
445 | 502 | // } |
---|
446 | 503 | |
---|
447 | | - refreshContents(false); // To refresh Info tab |
---|
| 504 | +// if (objectPanel.getSelectedIndex() == 4) |
---|
| 505 | +// { |
---|
| 506 | +// name = copy.skyboxname; |
---|
| 507 | +// |
---|
| 508 | +// if (name == null) |
---|
| 509 | +// { |
---|
| 510 | +// name = ""; |
---|
| 511 | +// } |
---|
| 512 | +// |
---|
| 513 | +// copy.skyboxname = "cubemaps/default-skyboxes/rgb"; |
---|
| 514 | +// copy.skyboxext = "jpg"; |
---|
| 515 | +// } |
---|
| 516 | +// else |
---|
| 517 | +// { |
---|
| 518 | +// if (name != null) |
---|
| 519 | +// { |
---|
| 520 | +// if (name.equals("")) |
---|
| 521 | +// { |
---|
| 522 | +// copy.skyboxname = null; |
---|
| 523 | +// copy.skyboxext = null; |
---|
| 524 | +// } |
---|
| 525 | +// else |
---|
| 526 | +// { |
---|
| 527 | +// copy.skyboxname = name; |
---|
| 528 | +// } |
---|
| 529 | +// } |
---|
| 530 | +// } |
---|
| 531 | + cameraView.transformMode = objectPanel.getSelectedIndex() == 4; |
---|
| 532 | + |
---|
| 533 | +// refreshContents(false); // To refresh Info tab |
---|
| 534 | + cameraView.repaint(); |
---|
448 | 535 | } |
---|
449 | 536 | }; |
---|
450 | 537 | objectPanel.addChangeListener(changeListener); |
---|
.. | .. |
---|
466 | 553 | |
---|
467 | 554 | toolboxPanel = new cGridBag().setVertical(true); |
---|
468 | 555 | //toolboxPanel.setName("Toolbox"); |
---|
| 556 | + |
---|
| 557 | + skyboxPanel = new cGridBag().setVertical(true); |
---|
469 | 558 | |
---|
470 | 559 | materialPanel = new cGridBag().setVertical(false); |
---|
471 | 560 | //materialPanel.setName("Material"); |
---|
.. | .. |
---|
751 | 840 | boolean maximized; |
---|
752 | 841 | |
---|
753 | 842 | cButton fullscreenLayout; |
---|
| 843 | + cButton expandedLayout; |
---|
754 | 844 | |
---|
755 | 845 | void Minimize() |
---|
756 | 846 | { |
---|
.. | .. |
---|
790 | 880 | cButton minButton; |
---|
791 | 881 | cButton maxButton; |
---|
792 | 882 | cButton fullButton; |
---|
| 883 | + cButton collapseButton; |
---|
| 884 | + cButton maximize3DButton; |
---|
793 | 885 | |
---|
794 | 886 | void ToggleFullScreen() |
---|
795 | 887 | { |
---|
796 | | -GraphicsDevice device = frame.getGraphicsConfiguration().getDevice(); |
---|
| 888 | + GraphicsDevice device = frame.getGraphicsConfiguration().getDevice(); |
---|
797 | 889 | |
---|
798 | 890 | cameraView.ToggleFullScreen(); |
---|
799 | 891 | |
---|
.. | .. |
---|
814 | 906 | // X frame.getContentPane().remove(/*"Center",*/bigThree); |
---|
815 | 907 | // X framePanel.add(bigThree); |
---|
816 | 908 | // X frame.getContentPane().add(/*"Center",*/framePanel); |
---|
817 | | - framePanel.setDividerLocation(46); |
---|
| 909 | +// framePanel.setDividerLocation(46); // icons are 24x24 |
---|
818 | 910 | |
---|
819 | 911 | //frame.setVisible(true); |
---|
820 | | - radio.layout = keepButton; |
---|
| 912 | +// radio.layout = keepButton; |
---|
821 | 913 | //theFrame = null; |
---|
822 | 914 | keepButton = null; |
---|
823 | | - radio.layout.doClick(); |
---|
| 915 | +// radio.layout.doClick(); |
---|
824 | 916 | |
---|
825 | 917 | } else |
---|
826 | 918 | { |
---|
.. | .. |
---|
841 | 933 | // X frame.getContentPane().remove(/*"Center",*/framePanel); |
---|
842 | 934 | // X framePanel.remove(bigThree); |
---|
843 | 935 | // X frame.getContentPane().add(/*"Center",*/bigThree); |
---|
844 | | - framePanel.setDividerLocation(0); |
---|
| 936 | +// framePanel.setDividerLocation(0); |
---|
845 | 937 | |
---|
846 | | - radio.layout = fullscreenLayout; |
---|
847 | | - radio.layout.doClick(); |
---|
| 938 | +// radio.layout = fullscreenLayout; |
---|
| 939 | +// radio.layout.doClick(); |
---|
848 | 940 | //frame.setVisible(true); |
---|
849 | 941 | } |
---|
850 | 942 | frame.validate(); |
---|
| 943 | + |
---|
| 944 | + cameraView.requestFocusInWindow(); |
---|
851 | 945 | } |
---|
852 | 946 | |
---|
853 | | - private Object3D CompressCopy() |
---|
| 947 | + void CollapseToolbar() |
---|
| 948 | + { |
---|
| 949 | + framePanel.setDividerLocation(0); |
---|
| 950 | + //frame.validate(); |
---|
| 951 | + |
---|
| 952 | + cameraView.requestFocusInWindow(); |
---|
| 953 | + } |
---|
| 954 | + |
---|
| 955 | + private Object3D Duplicate(Object3D object) |
---|
854 | 956 | { |
---|
855 | 957 | boolean temp = CameraPane.SWITCH; |
---|
856 | 958 | CameraPane.SWITCH = false; |
---|
857 | 959 | |
---|
858 | | - copy.ExtractBigData(versiontable); |
---|
| 960 | + if (Grafreed.grafreed.universe.versiontable == null) |
---|
| 961 | + Grafreed.grafreed.universe.versiontable = new java.util.Hashtable<java.util.UUID, Object3D>(); |
---|
| 962 | + |
---|
| 963 | + object.ExtractBigData(Grafreed.grafreed.universe.versiontable); |
---|
859 | 964 | // if (copy == client) |
---|
860 | 965 | |
---|
861 | | - Object3D versions[] = copy.versionlist; |
---|
862 | | - copy.versionlist = null; |
---|
| 966 | + Object3D versions[] = object.versionlist; |
---|
| 967 | + java.util.Hashtable<java.util.UUID, Object3D> versiontable = object.versiontable; // if Grafreed.grafreed.universe |
---|
| 968 | + object.versionlist = null; |
---|
| 969 | + object.versiontable = null; |
---|
| 970 | + |
---|
| 971 | + Object3D parent = object.parent; |
---|
| 972 | + object.parent = null; |
---|
863 | 973 | |
---|
864 | 974 | //byte[] compress = Compress(copy); |
---|
865 | | - Object3D compress = (Object3D)Grafreed.clone(copy); |
---|
| 975 | + Object3D compress = (Object3D)Grafreed.clone(object); |
---|
866 | 976 | |
---|
867 | | - copy.versionlist = versions; |
---|
| 977 | + object.parent = parent; |
---|
868 | 978 | |
---|
869 | | - copy.RestoreBigData(versiontable); |
---|
| 979 | + object.versionlist = versions; |
---|
| 980 | + object.versiontable = versiontable; // if Grafreed.grafreed.universe |
---|
| 981 | + |
---|
| 982 | + object.RestoreBigData(Grafreed.grafreed.universe.versiontable); |
---|
870 | 983 | |
---|
871 | 984 | CameraPane.SWITCH = temp; |
---|
872 | 985 | |
---|
.. | .. |
---|
1203 | 1316 | |
---|
1204 | 1317 | namePanel = new cGridBag(); |
---|
1205 | 1318 | |
---|
| 1319 | + //if (copy.pinned) |
---|
| 1320 | + { |
---|
| 1321 | + pinButton = GetToggleButton("icons/pin.png", !Grafreed.NIMBUSLAF); |
---|
| 1322 | + pinButton.setSelected(copy.pinned); |
---|
| 1323 | + cGridBag t = new cGridBag(); |
---|
| 1324 | + t.preferredWidth = 2; |
---|
| 1325 | + t.add(pinButton); |
---|
| 1326 | + namePanel.add(t); |
---|
| 1327 | + |
---|
| 1328 | + pinButton.addItemListener(this); |
---|
| 1329 | + } |
---|
| 1330 | + |
---|
1206 | 1331 | nameField = AddText(namePanel, copy.GetName()); |
---|
1207 | 1332 | namePanel.add(new JScrollPane(nameField, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER)); |
---|
1208 | 1333 | oe.ctrlPanel.add(namePanel); |
---|
.. | .. |
---|
1216 | 1341 | |
---|
1217 | 1342 | liveCB = AddCheckBox(setupPanel, "Live", copy.live); |
---|
1218 | 1343 | liveCB.setToolTipText("Animate object"); |
---|
| 1344 | + markCB = AddCheckBox(setupPanel, "Anim", copy.marked); |
---|
| 1345 | + markCB.setToolTipText("Set target transform"); |
---|
1219 | 1346 | selectableCB = AddCheckBox(setupPanel, "Select", !copy.dontselect); |
---|
1220 | 1347 | selectableCB.setToolTipText("Make object selectable"); |
---|
1221 | 1348 | // Return(); |
---|
1222 | 1349 | |
---|
1223 | 1350 | hideCB = AddCheckBox(setupPanel, "Hide", copy.hide); |
---|
1224 | 1351 | hideCB.setToolTipText("Hide object"); |
---|
1225 | | - markCB = AddCheckBox(setupPanel, "Mark", copy.marked); |
---|
1226 | | - markCB.setToolTipText("As animation target transform"); |
---|
1227 | 1352 | |
---|
1228 | 1353 | ToolTipManager.sharedInstance().setLightWeightPopupEnabled(false); |
---|
1229 | 1354 | |
---|
.. | .. |
---|
1425 | 1550 | |
---|
1426 | 1551 | if (cam == null || !(copy.get(0) instanceof cGroup)) |
---|
1427 | 1552 | { |
---|
| 1553 | + if (Globals.DEBUG) |
---|
1428 | 1554 | System.out.println("CREATE CAMERAS"); |
---|
1429 | 1555 | cams = new cTemplate(); |
---|
1430 | 1556 | cams.name = "Cameras"; |
---|
.. | .. |
---|
1506 | 1632 | //frontView.object = copy; |
---|
1507 | 1633 | //sideView.object = copy; |
---|
1508 | 1634 | |
---|
| 1635 | + transformPanel = new cGridBag().setVertical(true); |
---|
| 1636 | + |
---|
| 1637 | + cGridBag resetTransformPanel = new cGridBag(); |
---|
| 1638 | + |
---|
| 1639 | + resetTransformPanel.preferredHeight = 2; |
---|
| 1640 | + |
---|
| 1641 | + cButton resetTransform = GetButton("Reset all", !Grafreed.NIMBUSLAF); |
---|
| 1642 | + resetTransform.addMouseListener(new MouseAdapter() |
---|
| 1643 | + { |
---|
| 1644 | + public void mouseClicked(MouseEvent e) |
---|
| 1645 | + { |
---|
| 1646 | + ResetTransform(); |
---|
| 1647 | + } |
---|
| 1648 | + }); |
---|
| 1649 | + resetTransformPanel.add(resetTransform); |
---|
| 1650 | + |
---|
| 1651 | + resetTransform = GetButton("T only", !Grafreed.NIMBUSLAF); |
---|
| 1652 | + resetTransform.addMouseListener(new MouseAdapter() |
---|
| 1653 | + { |
---|
| 1654 | + public void mouseClicked(MouseEvent e) |
---|
| 1655 | + { |
---|
| 1656 | + ResetTransform(1); |
---|
| 1657 | + } |
---|
| 1658 | + }); |
---|
| 1659 | + resetTransformPanel.add(resetTransform); |
---|
| 1660 | + |
---|
| 1661 | + resetTransform = GetButton("RS only", !Grafreed.NIMBUSLAF); |
---|
| 1662 | + resetTransform.addMouseListener(new MouseAdapter() |
---|
| 1663 | + { |
---|
| 1664 | + public void mouseClicked(MouseEvent e) |
---|
| 1665 | + { |
---|
| 1666 | + ResetTransform(2); |
---|
| 1667 | + } |
---|
| 1668 | + }); |
---|
| 1669 | + resetTransformPanel.add(resetTransform); |
---|
| 1670 | + |
---|
1509 | 1671 | XYZPanel = new cGridBag().setVertical(true); |
---|
1510 | 1672 | //XYZPanel.setLayout(new GridLayout(3, 1, 5, 5)); |
---|
1511 | 1673 | |
---|
.. | .. |
---|
1515 | 1677 | XYZPanel.addComponent(/*BorderLayout.NORTH,*/topView); // Scroll); |
---|
1516 | 1678 | //XYZPanel.setName("XYZ"); |
---|
1517 | 1679 | |
---|
| 1680 | + transformPanel.add(resetTransformPanel); |
---|
| 1681 | + transformPanel.add(XYZPanel); |
---|
| 1682 | + |
---|
1518 | 1683 | /* |
---|
1519 | 1684 | gridPanel = new JPanel(); //new BorderLayout()); |
---|
1520 | 1685 | gridPanel.setLayout(new GridLayout(1, 2)); |
---|
.. | .. |
---|
1522 | 1687 | gridPanel.add(cameraView); |
---|
1523 | 1688 | gridPanel.add(XYZPanel); |
---|
1524 | 1689 | */ |
---|
1525 | | - gridPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, centralPanel, XYZPanel); //new BorderLayout()); |
---|
1526 | | - gridPanel.setContinuousLayout(true); |
---|
1527 | | - gridPanel.setOneTouchExpandable(true); |
---|
1528 | | - gridPanel.setDividerLocation(1.0); |
---|
1529 | | - gridPanel.setDividerSize(9); |
---|
1530 | | - gridPanel.setResizeWeight(0.85); |
---|
| 1690 | +// gridPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, centralPanel, XYZPanel); //new BorderLayout()); |
---|
| 1691 | +// gridPanel.setContinuousLayout(true); |
---|
| 1692 | +// gridPanel.setOneTouchExpandable(true); |
---|
| 1693 | +// gridPanel.setDividerLocation(1.0); |
---|
| 1694 | +// gridPanel.setDividerSize(9); |
---|
| 1695 | +// gridPanel.setResizeWeight(0.85); |
---|
1531 | 1696 | |
---|
1532 | 1697 | // aConstraints.weighty = 0; |
---|
1533 | 1698 | //System.out.println("THIS = " + this); |
---|
.. | .. |
---|
1550 | 1715 | |
---|
1551 | 1716 | //JScrollPane tmp = new JScrollPane(ctrlPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); |
---|
1552 | 1717 | //tmp.setName("Edit"); |
---|
| 1718 | + objectPanel.add(toolboxPanel); |
---|
| 1719 | + objectPanel.setIconAt(0, GetIcon("icons/primitives.png")); |
---|
| 1720 | + objectPanel.setToolTipTextAt(0, "Objects & textures"); |
---|
| 1721 | + |
---|
1553 | 1722 | objectPanel.add(materialPanel); |
---|
1554 | | - objectPanel.setIconAt(0, GetIcon("icons/material.png")); |
---|
1555 | | - objectPanel.setToolTipTextAt(0, "Material"); |
---|
| 1723 | + objectPanel.setIconAt(1, GetIcon("icons/material.png")); |
---|
| 1724 | + objectPanel.setToolTipTextAt(1, "Material"); |
---|
1556 | 1725 | |
---|
| 1726 | + objectPanel.add(skyboxPanel); |
---|
| 1727 | + objectPanel.setIconAt(2, GetIcon("icons/skybox.jpg")); |
---|
| 1728 | + objectPanel.setToolTipTextAt(2, "Backgrounds"); |
---|
| 1729 | + |
---|
1557 | 1730 | // JPanel north = new JPanel(new BorderLayout()); |
---|
1558 | 1731 | // north.setName("Edit"); |
---|
1559 | 1732 | // north.add(ctrlPanel, BorderLayout.NORTH); |
---|
1560 | 1733 | // objectPanel.add(north); |
---|
1561 | 1734 | objectPanel.add(editPanel); |
---|
1562 | | - objectPanel.setIconAt(1, GetIcon("icons/write.png")); |
---|
1563 | | - objectPanel.setToolTipTextAt(1, "Edit controls"); |
---|
| 1735 | + objectPanel.setIconAt(3, GetIcon("icons/write.png")); |
---|
| 1736 | + objectPanel.setToolTipTextAt(3, "Edit controls"); |
---|
1564 | 1737 | |
---|
1565 | | - //if (Globals.ADVANCED) |
---|
1566 | | - objectPanel.add(infoPanel); |
---|
1567 | | - objectPanel.setIconAt(2, GetIcon("icons/info.png")); |
---|
1568 | | - objectPanel.setToolTipTextAt(2, "Information"); |
---|
| 1738 | + objectPanel.add(transformPanel); |
---|
| 1739 | + objectPanel.setIconAt(4, GetIcon("icons/XYZ.png")); |
---|
| 1740 | + objectPanel.setToolTipTextAt(4, "TRS transform"); |
---|
1569 | 1741 | |
---|
1570 | | - objectPanel.add(XYZPanel); |
---|
1571 | | - objectPanel.setIconAt(3, GetIcon("icons/XYZ.png")); |
---|
1572 | | - objectPanel.setToolTipTextAt(3, "XYZ/RGB transform"); |
---|
1573 | | - |
---|
1574 | | - objectPanel.add(toolboxPanel); |
---|
1575 | | - objectPanel.setIconAt(4, GetIcon("icons/primitives.png")); |
---|
1576 | | - objectPanel.setToolTipTextAt(4, "Objects & backgrounds"); |
---|
1577 | | - |
---|
| 1742 | + patchMaterial = true; |
---|
| 1743 | + cameraView.patchMaterial = this; |
---|
| 1744 | + objectPanel.setSelectedIndex(1); |
---|
| 1745 | + |
---|
1578 | 1746 | /* |
---|
1579 | 1747 | aConstraints.gridx = 0; |
---|
1580 | 1748 | aConstraints.gridwidth = 1; |
---|
.. | .. |
---|
1594 | 1762 | scrollpane.addMouseWheelListener(this); // Default not fast enough |
---|
1595 | 1763 | |
---|
1596 | 1764 | /*JTabbedPane*/ scenePanel = new cGridBag(); |
---|
1597 | | - scenePanel.preferredWidth = 5; |
---|
| 1765 | + scenePanel.preferredWidth = 6; |
---|
1598 | 1766 | |
---|
1599 | 1767 | JTabbedPane tabbedPane = new JTabbedPane(); |
---|
1600 | 1768 | tabbedPane.add(scrollpane); |
---|
.. | .. |
---|
1611 | 1779 | |
---|
1612 | 1780 | scenePanel.add(tabbedPane); |
---|
1613 | 1781 | |
---|
| 1782 | + //if (Globals.ADVANCED) |
---|
| 1783 | +// tabbedPane.add(infoPanel); |
---|
| 1784 | +// tabbedPane.setIconAt(3, GetIcon("icons/info.png")); |
---|
| 1785 | +// tabbedPane.setToolTipTextAt(3, "Information"); |
---|
| 1786 | + |
---|
1614 | 1787 | /* |
---|
1615 | 1788 | cTree jTree = new cTree(null); |
---|
1616 | 1789 | ToolTipManager.sharedInstance().registerComponent(jTree); |
---|
.. | .. |
---|
1631 | 1804 | jtp.add(tree); |
---|
1632 | 1805 | */ |
---|
1633 | 1806 | |
---|
1634 | | - bigPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, scenePanel, gridPanel); |
---|
1635 | | - bigPanel.setContinuousLayout(true); |
---|
1636 | | - bigPanel.setOneTouchExpandable(true); |
---|
1637 | | - bigPanel.setDividerLocation(0.8); |
---|
1638 | | - bigPanel.setDividerSize(15); |
---|
1639 | | - bigPanel.setResizeWeight(0.15); |
---|
1640 | | - bigPanel.setName("Scene"); |
---|
| 1807 | +// bigPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, scenePanel, gridPanel); |
---|
| 1808 | +// bigPanel.setContinuousLayout(true); |
---|
| 1809 | +// bigPanel.setOneTouchExpandable(true); |
---|
| 1810 | +// bigPanel.setDividerLocation(0.8); |
---|
| 1811 | +// bigPanel.setDividerSize(15); |
---|
| 1812 | +// bigPanel.setResizeWeight(0.15); |
---|
| 1813 | +// bigPanel.setName("Scene"); |
---|
1641 | 1814 | |
---|
1642 | 1815 | //bigPanel.setLayout(new BorderLayout()); |
---|
1643 | 1816 | //bigPanel.setSize(new Dimension(10,10)); |
---|
.. | .. |
---|
1681 | 1854 | // aConstraints.gridheight = 1; |
---|
1682 | 1855 | |
---|
1683 | 1856 | framePanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, toolbarPanel, bigThree); |
---|
| 1857 | + |
---|
| 1858 | + framePanel.addPropertyChangeListener(JSplitPane.DIVIDER_LOCATION_PROPERTY, |
---|
| 1859 | + new java.beans.PropertyChangeListener() |
---|
| 1860 | + { |
---|
| 1861 | + public void propertyChange(java.beans.PropertyChangeEvent pce) |
---|
| 1862 | + { |
---|
| 1863 | + if ((Integer)pce.getOldValue() == 1) |
---|
| 1864 | + { |
---|
| 1865 | + if (radio.layout != expandedLayout) |
---|
| 1866 | + { |
---|
| 1867 | + radio.layout = expandedLayout; |
---|
| 1868 | + radio.layout.doClick(); |
---|
| 1869 | + } |
---|
| 1870 | + } |
---|
| 1871 | + } |
---|
| 1872 | + }); |
---|
| 1873 | + |
---|
1684 | 1874 | framePanel.setContinuousLayout(false); |
---|
1685 | 1875 | framePanel.setOneTouchExpandable(false); |
---|
1686 | 1876 | //.setDividerLocation(0.8); |
---|
.. | .. |
---|
1690 | 1880 | |
---|
1691 | 1881 | frame.getContentPane().setLayout(new BorderLayout()); |
---|
1692 | 1882 | /**/ |
---|
1693 | | - JTabbedPane worldPane = new JTabbedPane(); |
---|
| 1883 | + //JTabbedPane worldPane = new JTabbedPane(); |
---|
1694 | 1884 | //worldPane.add(bigPanel); |
---|
1695 | 1885 | //worldPane.add(worldPanel); |
---|
1696 | 1886 | /**/ |
---|
.. | .. |
---|
1704 | 1894 | |
---|
1705 | 1895 | cameraView.requestFocusInWindow(); |
---|
1706 | 1896 | |
---|
1707 | | - gridPanel.setDividerLocation(1.0); |
---|
| 1897 | +// gridPanel.setDividerLocation(1.0); |
---|
1708 | 1898 | |
---|
1709 | 1899 | frame.validate(); |
---|
1710 | 1900 | |
---|
.. | .. |
---|
1738 | 1928 | void SetupMaterial(cGridBag materialpanel) |
---|
1739 | 1929 | { |
---|
1740 | 1930 | cGridBag presetpanel = new cGridBag().setVertical(true); |
---|
1741 | | - cLabel label = GetLabel("icons/shadericons/shadericon00000.png", !Grafreed.NIMBUSLAF); |
---|
1742 | | - label.addMouseListener(new MouseAdapter() |
---|
| 1931 | + |
---|
| 1932 | + cLabel skin = GetLabel("icons/shadericons/shadericon00000.png", !Grafreed.NIMBUSLAF); |
---|
| 1933 | + skin.setToolTipText("Skin"); |
---|
| 1934 | + skin.addMouseListener(new MouseAdapter() |
---|
1743 | 1935 | { |
---|
1744 | 1936 | public void mouseClicked(MouseEvent e) |
---|
1745 | 1937 | { |
---|
1746 | | - colorField.setFloat(0); |
---|
1747 | | - saturationField.setFloat(1); |
---|
| 1938 | + Object3D object = Grafreed.materials.versionlist[0].get(0); |
---|
| 1939 | + cMaterial material = object.material; |
---|
| 1940 | + |
---|
| 1941 | + // Skin |
---|
| 1942 | + colorField.setFloat(material.color); |
---|
| 1943 | + float saturation = material.modulation; |
---|
| 1944 | + |
---|
| 1945 | + if (!cameraView.Skinshader) |
---|
| 1946 | + { |
---|
| 1947 | + saturation /= 1.5; |
---|
| 1948 | + } |
---|
| 1949 | + |
---|
| 1950 | + saturationField.setFloat(saturation); |
---|
| 1951 | + |
---|
| 1952 | + subsurfaceField.setFloat(material.subsurface); |
---|
| 1953 | + selfshadowField.setFloat(material.diffuseness); |
---|
| 1954 | + diffusenessField.setFloat(material.factor); |
---|
| 1955 | + shininessField.setFloat(material.shininess); |
---|
| 1956 | + shadowbiasField.setFloat(material.shadowbias); |
---|
| 1957 | + diffuseField.setFloat(material.diffuse); |
---|
| 1958 | + specularField.setFloat(material.specular); |
---|
| 1959 | + |
---|
| 1960 | + bumpField.setFloat(object.projectedVertices[0].x / 1000.0); |
---|
| 1961 | + noiseField.setFloat(object.projectedVertices[0].y / 1000.0); |
---|
| 1962 | + powerField.setFloat(object.projectedVertices[2].x / 1000.0); |
---|
| 1963 | + |
---|
1748 | 1964 | materialtouched = true; |
---|
1749 | 1965 | applySelf(); |
---|
1750 | 1966 | } |
---|
1751 | 1967 | }); |
---|
1752 | | - presetpanel.add(label); |
---|
| 1968 | + presetpanel.add(skin); |
---|
1753 | 1969 | |
---|
1754 | | - presetpanel.add(GetLabel("icons/shadericons/shadericon00001.png", !Grafreed.NIMBUSLAF)); |
---|
1755 | | - presetpanel.add(GetLabel("icons/shadericons/shadericon00002.png", !Grafreed.NIMBUSLAF)); |
---|
1756 | | - presetpanel.add(GetLabel("icons/shadericons/shadericon00003.png", !Grafreed.NIMBUSLAF)); |
---|
1757 | | - presetpanel.add(GetLabel("icons/shadericons/shadericon00004.png", !Grafreed.NIMBUSLAF)); |
---|
1758 | | - presetpanel.add(GetLabel("icons/shadericons/shadericon00005.png", !Grafreed.NIMBUSLAF)); |
---|
1759 | | - presetpanel.add(GetLabel("icons/shadericons/shadericon00006.png", !Grafreed.NIMBUSLAF)); |
---|
1760 | | - presetpanel.add(GetLabel("icons/shadericons/shadericon00007.png", !Grafreed.NIMBUSLAF)); |
---|
1761 | | - presetpanel.add(GetLabel("icons/shadericons/shadericon00008.png", !Grafreed.NIMBUSLAF)); |
---|
1762 | | - presetpanel.add(GetLabel("icons/shadericons/shadericon00009.png", !Grafreed.NIMBUSLAF)); |
---|
1763 | | - presetpanel.add(GetLabel("icons/shadericons/shadericon00010.png", !Grafreed.NIMBUSLAF)); |
---|
1764 | | - presetpanel.add(GetLabel("icons/shadericons/shadericon00011.png", !Grafreed.NIMBUSLAF)); |
---|
1765 | | - presetpanel.add(GetLabel("icons/shadericons/shadericon00012.png", !Grafreed.NIMBUSLAF)); |
---|
1766 | | - presetpanel.add(GetLabel("icons/shadericons/shadericon00013.png", !Grafreed.NIMBUSLAF)); |
---|
1767 | | - presetpanel.add(GetLabel("icons/shadericons/shadericon00014.png", !Grafreed.NIMBUSLAF)); |
---|
1768 | | - presetpanel.add(GetLabel("icons/shadericons/shadericon00015.png", !Grafreed.NIMBUSLAF)); |
---|
1769 | | - presetpanel.add(GetLabel("icons/shadericons/shadericon00016.png", !Grafreed.NIMBUSLAF)); |
---|
1770 | | - presetpanel.add(GetLabel("icons/shadericons/shadericon00017.png", !Grafreed.NIMBUSLAF)); |
---|
1771 | | - presetpanel.add(GetLabel("icons/shadericons/shadericon00018.png", !Grafreed.NIMBUSLAF)); |
---|
1772 | | - presetpanel.add(GetLabel("icons/shadericons/shadericon00019.png", !Grafreed.NIMBUSLAF)); |
---|
1773 | | - presetpanel.add(GetLabel("icons/shadericons/shadericon00020.png", !Grafreed.NIMBUSLAF)); |
---|
| 1970 | + cLabel lambert = GetLabel("icons/shadericons/shadericon00002.png", !Grafreed.NIMBUSLAF); |
---|
| 1971 | + lambert.setToolTipText("Diffuse"); |
---|
| 1972 | + lambert.addMouseListener(new MouseAdapter() |
---|
| 1973 | + { |
---|
| 1974 | + public void mouseClicked(MouseEvent e) |
---|
| 1975 | + { |
---|
| 1976 | + Object3D object = Grafreed.materials.versionlist[2].get(0); |
---|
| 1977 | + cMaterial material = object.material; |
---|
| 1978 | + |
---|
| 1979 | + diffusenessField.setFloat(material.factor); |
---|
| 1980 | + selfshadowField.setFloat(material.diffuseness); |
---|
| 1981 | + |
---|
| 1982 | + materialtouched = true; |
---|
| 1983 | + applySelf(); |
---|
| 1984 | + } |
---|
| 1985 | + }); |
---|
| 1986 | + presetpanel.add(lambert); |
---|
| 1987 | + |
---|
| 1988 | + cLabel diffuse2 = GetLabel("icons/shadericons/shadericon00003.png", !Grafreed.NIMBUSLAF); |
---|
| 1989 | + diffuse2.setToolTipText("Diffuse2"); |
---|
| 1990 | + diffuse2.addMouseListener(new MouseAdapter() |
---|
| 1991 | + { |
---|
| 1992 | + public void mouseClicked(MouseEvent e) |
---|
| 1993 | + { |
---|
| 1994 | + Object3D object = Grafreed.materials.versionlist[3].get(0); |
---|
| 1995 | + cMaterial material = object.material; |
---|
| 1996 | + |
---|
| 1997 | + diffusenessField.setFloat(material.factor); |
---|
| 1998 | + selfshadowField.setFloat(material.diffuseness); |
---|
| 1999 | + |
---|
| 2000 | + materialtouched = true; |
---|
| 2001 | + applySelf(); |
---|
| 2002 | + } |
---|
| 2003 | + }); |
---|
| 2004 | + presetpanel.add(diffuse2); |
---|
| 2005 | + |
---|
| 2006 | + cLabel diffusemoon = GetLabel("icons/shadericons/shadericon00004.png", !Grafreed.NIMBUSLAF); |
---|
| 2007 | + diffusemoon.setToolTipText("Moon"); |
---|
| 2008 | + diffusemoon.addMouseListener(new MouseAdapter() |
---|
| 2009 | + { |
---|
| 2010 | + public void mouseClicked(MouseEvent e) |
---|
| 2011 | + { |
---|
| 2012 | + Object3D object = Grafreed.materials.versionlist[4].get(0); |
---|
| 2013 | + cMaterial material = object.material; |
---|
| 2014 | + |
---|
| 2015 | + diffusenessField.setFloat(material.factor); |
---|
| 2016 | + selfshadowField.setFloat(material.diffuseness); |
---|
| 2017 | + |
---|
| 2018 | + materialtouched = true; |
---|
| 2019 | + applySelf(); |
---|
| 2020 | + } |
---|
| 2021 | + }); |
---|
| 2022 | + presetpanel.add(diffusemoon); |
---|
| 2023 | + |
---|
| 2024 | + cLabel diffusemoon2 = GetLabel("icons/shadericons/shadericon00005.png", !Grafreed.NIMBUSLAF); |
---|
| 2025 | + diffusemoon2.setToolTipText("Moon2"); |
---|
| 2026 | + diffusemoon2.addMouseListener(new MouseAdapter() |
---|
| 2027 | + { |
---|
| 2028 | + public void mouseClicked(MouseEvent e) |
---|
| 2029 | + { |
---|
| 2030 | + Object3D object = Grafreed.materials.versionlist[5].get(0); |
---|
| 2031 | + cMaterial material = object.material; |
---|
| 2032 | + |
---|
| 2033 | + diffusenessField.setFloat(material.factor); |
---|
| 2034 | + selfshadowField.setFloat(material.diffuseness); |
---|
| 2035 | + |
---|
| 2036 | + materialtouched = true; |
---|
| 2037 | + applySelf(); |
---|
| 2038 | + } |
---|
| 2039 | + }); |
---|
| 2040 | + presetpanel.add(diffusemoon2); |
---|
| 2041 | + |
---|
| 2042 | + cLabel diffusemoon3 = GetLabel("icons/shadericons/shadericon00006.png", !Grafreed.NIMBUSLAF); |
---|
| 2043 | + diffusemoon3.setToolTipText("Moon3"); |
---|
| 2044 | + diffusemoon3.addMouseListener(new MouseAdapter() |
---|
| 2045 | + { |
---|
| 2046 | + public void mouseClicked(MouseEvent e) |
---|
| 2047 | + { |
---|
| 2048 | + Object3D object = Grafreed.materials.versionlist[6].get(0); |
---|
| 2049 | + cMaterial material = object.material; |
---|
| 2050 | + |
---|
| 2051 | + diffusenessField.setFloat(material.factor); |
---|
| 2052 | + selfshadowField.setFloat(material.diffuseness); |
---|
| 2053 | + |
---|
| 2054 | + materialtouched = true; |
---|
| 2055 | + applySelf(); |
---|
| 2056 | + } |
---|
| 2057 | + }); |
---|
| 2058 | + presetpanel.add(diffusemoon3); |
---|
| 2059 | + |
---|
| 2060 | + cLabel diffusesheen = GetLabel("icons/shadericons/shadericon00007.png", !Grafreed.NIMBUSLAF); |
---|
| 2061 | + diffusesheen.setToolTipText("Sheen"); |
---|
| 2062 | + diffusesheen.addMouseListener(new MouseAdapter() |
---|
| 2063 | + { |
---|
| 2064 | + public void mouseClicked(MouseEvent e) |
---|
| 2065 | + { |
---|
| 2066 | + Object3D object = Grafreed.materials.versionlist[7].get(0); |
---|
| 2067 | + cMaterial material = object.material; |
---|
| 2068 | + |
---|
| 2069 | + sheenField.setFloat(material.sheen); |
---|
| 2070 | + |
---|
| 2071 | + materialtouched = true; |
---|
| 2072 | + applySelf(); |
---|
| 2073 | + } |
---|
| 2074 | + }); |
---|
| 2075 | + presetpanel.add(diffusesheen); |
---|
| 2076 | + |
---|
| 2077 | + cLabel rough = GetLabel("icons/shadericons/shadericon00001.png", !Grafreed.NIMBUSLAF); |
---|
| 2078 | + rough.setToolTipText("Rough metal"); |
---|
| 2079 | + rough.addMouseListener(new MouseAdapter() |
---|
| 2080 | + { |
---|
| 2081 | + public void mouseClicked(MouseEvent e) |
---|
| 2082 | + { |
---|
| 2083 | + Object3D object = Grafreed.materials.versionlist[1].get(0); |
---|
| 2084 | + cMaterial material = object.material; |
---|
| 2085 | + |
---|
| 2086 | + shininessField.setFloat(material.shininess); |
---|
| 2087 | + velvetField.setFloat(material.velvet); |
---|
| 2088 | + |
---|
| 2089 | + materialtouched = true; |
---|
| 2090 | + applySelf(); |
---|
| 2091 | + } |
---|
| 2092 | + }); |
---|
| 2093 | + presetpanel.add(rough); |
---|
| 2094 | + |
---|
| 2095 | + cLabel rough2 = GetLabel("icons/shadericons/shadericon00013.png", !Grafreed.NIMBUSLAF); |
---|
| 2096 | + rough2.setToolTipText("Medium metal"); |
---|
| 2097 | + rough2.addMouseListener(new MouseAdapter() |
---|
| 2098 | + { |
---|
| 2099 | + public void mouseClicked(MouseEvent e) |
---|
| 2100 | + { |
---|
| 2101 | + Object3D object = Grafreed.materials.versionlist[13].get(0); |
---|
| 2102 | + cMaterial material = object.material; |
---|
| 2103 | + |
---|
| 2104 | + shininessField.setFloat(material.shininess); |
---|
| 2105 | + lightareaField.setFloat(material.lightarea); |
---|
| 2106 | + |
---|
| 2107 | + materialtouched = true; |
---|
| 2108 | + applySelf(); |
---|
| 2109 | + } |
---|
| 2110 | + }); |
---|
| 2111 | + presetpanel.add(rough2); |
---|
| 2112 | + |
---|
| 2113 | + cLabel shini0 = GetLabel("icons/shadericons/shadericon00014.png", !Grafreed.NIMBUSLAF); |
---|
| 2114 | + shini0.setToolTipText("Shiny"); |
---|
| 2115 | + shini0.addMouseListener(new MouseAdapter() |
---|
| 2116 | + { |
---|
| 2117 | + public void mouseClicked(MouseEvent e) |
---|
| 2118 | + { |
---|
| 2119 | + Object3D object = Grafreed.materials.versionlist[14].get(0); |
---|
| 2120 | + cMaterial material = object.material; |
---|
| 2121 | + |
---|
| 2122 | + shininessField.setFloat(material.shininess); |
---|
| 2123 | + lightareaField.setFloat(material.lightarea); |
---|
| 2124 | + |
---|
| 2125 | + materialtouched = true; |
---|
| 2126 | + applySelf(); |
---|
| 2127 | + } |
---|
| 2128 | + }); |
---|
| 2129 | + presetpanel.add(shini0); |
---|
| 2130 | + |
---|
| 2131 | + cLabel shini1 = GetLabel("icons/shadericons/shadericon00011.png", !Grafreed.NIMBUSLAF); |
---|
| 2132 | + shini1.setToolTipText("Shiny2"); |
---|
| 2133 | + shini1.addMouseListener(new MouseAdapter() |
---|
| 2134 | + { |
---|
| 2135 | + public void mouseClicked(MouseEvent e) |
---|
| 2136 | + { |
---|
| 2137 | + Object3D object = Grafreed.materials.versionlist[11].get(0); |
---|
| 2138 | + cMaterial material = object.material; |
---|
| 2139 | + |
---|
| 2140 | + shininessField.setFloat(material.shininess); |
---|
| 2141 | + lightareaField.setFloat(material.lightarea); |
---|
| 2142 | + |
---|
| 2143 | + materialtouched = true; |
---|
| 2144 | + applySelf(); |
---|
| 2145 | + } |
---|
| 2146 | + }); |
---|
| 2147 | + presetpanel.add(shini1); |
---|
| 2148 | + |
---|
| 2149 | + cLabel shini2 = GetLabel("icons/shadericons/shadericon00012.png", !Grafreed.NIMBUSLAF); |
---|
| 2150 | + shini2.setToolTipText("Shiny3"); |
---|
| 2151 | + shini2.addMouseListener(new MouseAdapter() |
---|
| 2152 | + { |
---|
| 2153 | + public void mouseClicked(MouseEvent e) |
---|
| 2154 | + { |
---|
| 2155 | + Object3D object = Grafreed.materials.versionlist[12].get(0); |
---|
| 2156 | + cMaterial material = object.material; |
---|
| 2157 | + |
---|
| 2158 | + shininessField.setFloat(material.shininess); |
---|
| 2159 | + lightareaField.setFloat(material.lightarea); |
---|
| 2160 | + |
---|
| 2161 | + materialtouched = true; |
---|
| 2162 | + applySelf(); |
---|
| 2163 | + } |
---|
| 2164 | + }); |
---|
| 2165 | + presetpanel.add(shini2); |
---|
| 2166 | + |
---|
| 2167 | + cLabel aniso = GetLabel("icons/shadericons/shadericon00008.png", !Grafreed.NIMBUSLAF); |
---|
| 2168 | + aniso.setToolTipText("AnisoU"); |
---|
| 2169 | + aniso.addMouseListener(new MouseAdapter() |
---|
| 2170 | + { |
---|
| 2171 | + public void mouseClicked(MouseEvent e) |
---|
| 2172 | + { |
---|
| 2173 | + Object3D object = Grafreed.materials.versionlist[8].get(0); |
---|
| 2174 | + cMaterial material = object.material; |
---|
| 2175 | + |
---|
| 2176 | + anisoField.setFloat(material.aniso); |
---|
| 2177 | + anisoVField.setFloat(material.anisoV); |
---|
| 2178 | + |
---|
| 2179 | + materialtouched = true; |
---|
| 2180 | + applySelf(); |
---|
| 2181 | + } |
---|
| 2182 | + }); |
---|
| 2183 | + presetpanel.add(aniso); |
---|
| 2184 | + |
---|
| 2185 | + cLabel aniso2 = GetLabel("icons/shadericons/shadericon00009.png", !Grafreed.NIMBUSLAF); |
---|
| 2186 | + aniso2.setToolTipText("AnisoV"); |
---|
| 2187 | + aniso2.addMouseListener(new MouseAdapter() |
---|
| 2188 | + { |
---|
| 2189 | + public void mouseClicked(MouseEvent e) |
---|
| 2190 | + { |
---|
| 2191 | + Object3D object = Grafreed.materials.versionlist[9].get(0); |
---|
| 2192 | + cMaterial material = object.material; |
---|
| 2193 | + |
---|
| 2194 | + anisoField.setFloat(material.aniso); |
---|
| 2195 | + anisoVField.setFloat(material.anisoV); |
---|
| 2196 | + |
---|
| 2197 | + materialtouched = true; |
---|
| 2198 | + applySelf(); |
---|
| 2199 | + } |
---|
| 2200 | + }); |
---|
| 2201 | + presetpanel.add(aniso2); |
---|
| 2202 | + |
---|
| 2203 | + cLabel aniso3 = GetLabel("icons/shadericons/shadericon00010.png", !Grafreed.NIMBUSLAF); |
---|
| 2204 | + aniso3.setToolTipText("AnisoUV"); |
---|
| 2205 | + aniso3.addMouseListener(new MouseAdapter() |
---|
| 2206 | + { |
---|
| 2207 | + public void mouseClicked(MouseEvent e) |
---|
| 2208 | + { |
---|
| 2209 | + Object3D object = Grafreed.materials.versionlist[10].get(0); |
---|
| 2210 | + cMaterial material = object.material; |
---|
| 2211 | + |
---|
| 2212 | + anisoField.setFloat(material.aniso); |
---|
| 2213 | + anisoVField.setFloat(material.anisoV); |
---|
| 2214 | + |
---|
| 2215 | + materialtouched = true; |
---|
| 2216 | + applySelf(); |
---|
| 2217 | + } |
---|
| 2218 | + }); |
---|
| 2219 | + presetpanel.add(aniso3); |
---|
| 2220 | + |
---|
| 2221 | + cLabel velvet0 = GetLabel("icons/shadericons/shadericon00015.png", !Grafreed.NIMBUSLAF); |
---|
| 2222 | + velvet0.setToolTipText("Velvet"); |
---|
| 2223 | + velvet0.addMouseListener(new MouseAdapter() |
---|
| 2224 | + { |
---|
| 2225 | + public void mouseClicked(MouseEvent e) |
---|
| 2226 | + { |
---|
| 2227 | + Object3D object = Grafreed.materials.versionlist[15].get(0); |
---|
| 2228 | + cMaterial material = object.material; |
---|
| 2229 | + |
---|
| 2230 | + diffusenessField.setFloat(material.factor); |
---|
| 2231 | + selfshadowField.setFloat(material.diffuseness); |
---|
| 2232 | + sheenField.setFloat(material.sheen); |
---|
| 2233 | + shininessField.setFloat(material.shininess); |
---|
| 2234 | + velvetField.setFloat(material.velvet); |
---|
| 2235 | + shiftField.setFloat(material.shift); |
---|
| 2236 | + |
---|
| 2237 | + materialtouched = true; |
---|
| 2238 | + applySelf(); |
---|
| 2239 | + } |
---|
| 2240 | + }); |
---|
| 2241 | + presetpanel.add(velvet0); |
---|
| 2242 | + |
---|
| 2243 | + cLabel bump0 = GetLabel("icons/shadericons/shadericon00016.png", !Grafreed.NIMBUSLAF); |
---|
| 2244 | + bump0.setToolTipText("Bump texture"); |
---|
| 2245 | + bump0.addMouseListener(new MouseAdapter() |
---|
| 2246 | + { |
---|
| 2247 | + public void mouseClicked(MouseEvent e) |
---|
| 2248 | + { |
---|
| 2249 | + Object3D object = Grafreed.materials.versionlist[16].get(0); |
---|
| 2250 | + cMaterial material = object.material; |
---|
| 2251 | + |
---|
| 2252 | + bumpField.setFloat(object.projectedVertices[0].x / 1000.0); |
---|
| 2253 | + noiseField.setFloat(object.projectedVertices[0].y / 1000.0); |
---|
| 2254 | + powerField.setFloat(object.projectedVertices[2].x / 1000.0); |
---|
| 2255 | + |
---|
| 2256 | + materialtouched = true; |
---|
| 2257 | + applySelf(); |
---|
| 2258 | + } |
---|
| 2259 | + }); |
---|
| 2260 | + presetpanel.add(bump0); |
---|
| 2261 | + |
---|
| 2262 | + cLabel borderShader = GetLabel("icons/shadericons/borderfade.jpg", !Grafreed.NIMBUSLAF); |
---|
| 2263 | + borderShader.setToolTipText("Border fade"); |
---|
| 2264 | + borderShader.addMouseListener(new MouseAdapter() |
---|
| 2265 | + { |
---|
| 2266 | + public void mouseClicked(MouseEvent e) |
---|
| 2267 | + { |
---|
| 2268 | + borderfadeField.setFloat(0.5); |
---|
| 2269 | + opacityField.setFloat(0.75); |
---|
| 2270 | + |
---|
| 2271 | + materialtouched = true; |
---|
| 2272 | + applySelf(); |
---|
| 2273 | + } |
---|
| 2274 | + }); |
---|
| 2275 | + presetpanel.add(borderShader); |
---|
| 2276 | + |
---|
| 2277 | + cLabel halo = GetLabel("icons/shadericons/shadericon00017.png", !Grafreed.NIMBUSLAF); |
---|
| 2278 | + halo.setToolTipText("Halo"); |
---|
| 2279 | + halo.addMouseListener(new MouseAdapter() |
---|
| 2280 | + { |
---|
| 2281 | + public void mouseClicked(MouseEvent e) |
---|
| 2282 | + { |
---|
| 2283 | + Object3D object = Grafreed.materials.versionlist[17].get(0); |
---|
| 2284 | + cMaterial material = object.material; |
---|
| 2285 | + |
---|
| 2286 | + opacityPowerField.setFloat(object.projectedVertices[2].y / 1000.0); |
---|
| 2287 | + |
---|
| 2288 | + materialtouched = true; |
---|
| 2289 | + applySelf(); |
---|
| 2290 | + } |
---|
| 2291 | + }); |
---|
| 2292 | + presetpanel.add(halo); |
---|
| 2293 | + |
---|
| 2294 | + cLabel candle = GetLabel("icons/shadericons/shadericon00018.png", !Grafreed.NIMBUSLAF); |
---|
| 2295 | + candle.setToolTipText("Candle"); |
---|
| 2296 | + candle.addMouseListener(new MouseAdapter() |
---|
| 2297 | + { |
---|
| 2298 | + public void mouseClicked(MouseEvent e) |
---|
| 2299 | + { |
---|
| 2300 | + Object3D object = Grafreed.materials.versionlist[18].get(0); |
---|
| 2301 | + cMaterial material = object.material; |
---|
| 2302 | + |
---|
| 2303 | + subsurfaceField.setFloat(material.subsurface); |
---|
| 2304 | + shadowbiasField.setFloat(material.shadowbias); |
---|
| 2305 | + ambientField.setFloat(material.ambient); |
---|
| 2306 | + specularField.setFloat(material.specular); |
---|
| 2307 | + lightareaField.setFloat(material.lightarea); |
---|
| 2308 | + shininessField.setFloat(material.shininess); |
---|
| 2309 | + |
---|
| 2310 | + materialtouched = true; |
---|
| 2311 | + applySelf(); |
---|
| 2312 | + } |
---|
| 2313 | + }); |
---|
| 2314 | + presetpanel.add(candle); |
---|
| 2315 | + |
---|
| 2316 | + cLabel shadowShader = GetLabel("icons/shadericons/shadow.png", !Grafreed.NIMBUSLAF); |
---|
| 2317 | + shadowShader.setToolTipText("Shadow"); |
---|
| 2318 | + shadowShader.addMouseListener(new MouseAdapter() |
---|
| 2319 | + { |
---|
| 2320 | + public void mouseClicked(MouseEvent e) |
---|
| 2321 | + { |
---|
| 2322 | + diffuseField.setFloat(0.001); |
---|
| 2323 | + ambientField.setFloat(0.001); |
---|
| 2324 | + cameraField.setFloat(0.001); |
---|
| 2325 | + specularField.setFloat(0.001); |
---|
| 2326 | + fakedepthField.setFloat(0.001); |
---|
| 2327 | + opacityField.setFloat(0.6); |
---|
| 2328 | + |
---|
| 2329 | + materialtouched = true; |
---|
| 2330 | + applySelf(); |
---|
| 2331 | + } |
---|
| 2332 | + }); |
---|
| 2333 | + presetpanel.add(shadowShader); |
---|
1774 | 2334 | |
---|
1775 | 2335 | cGridBag panel = new cGridBag().setVertical(true); |
---|
1776 | 2336 | |
---|
1777 | 2337 | presetpanel.preferredWidth = 1; |
---|
1778 | 2338 | |
---|
1779 | | - materialpanel.add(panel); |
---|
1780 | 2339 | materialpanel.add(presetpanel); |
---|
| 2340 | + materialpanel.add(panel); |
---|
1781 | 2341 | |
---|
1782 | 2342 | panel.preferredWidth = 8; |
---|
1783 | 2343 | |
---|
.. | .. |
---|
1821 | 2381 | |
---|
1822 | 2382 | cGridBag huepanel = new cGridBag(); |
---|
1823 | 2383 | cGridBag huelabel = new cGridBag(); |
---|
1824 | | - label = GetLabel("icons/hue.png", false); |
---|
1825 | | - label.fit = true; |
---|
1826 | | - huelabel.add(label); |
---|
| 2384 | + cLabel hue = GetLabel("icons/hue.png", false); |
---|
| 2385 | + hue.fit = true; |
---|
| 2386 | + |
---|
| 2387 | + hue.addMouseListener(new MouseAdapter() |
---|
| 2388 | + { |
---|
| 2389 | + public void mousePressed(MouseEvent e) |
---|
| 2390 | + { |
---|
| 2391 | + int x = e.getX(); |
---|
| 2392 | + |
---|
| 2393 | + colorField.setFloat((double)x / ((cLabel)e.getSource()).getWidth()); |
---|
| 2394 | + } |
---|
| 2395 | + }); |
---|
| 2396 | + |
---|
| 2397 | + huelabel.add(hue); |
---|
1827 | 2398 | huelabel.preferredWidth = 20; |
---|
1828 | 2399 | huepanel.add(new cGridBag()); // Label |
---|
1829 | 2400 | huepanel.add(huelabel); // Field/slider |
---|
.. | .. |
---|
3099 | 3670 | |
---|
3100 | 3671 | if (multiplyToggle != null) |
---|
3101 | 3672 | multiplyToggle.setSelected(mat.multiply); |
---|
3102 | | - |
---|
3103 | | - assert (object.projectedVertices != null); |
---|
3104 | | - |
---|
3105 | | - if (object.projectedVertices.length <= 2) |
---|
3106 | | - { |
---|
3107 | | - // Side effect... |
---|
3108 | | - Object3D.cVector2[] keep = object.projectedVertices; |
---|
3109 | | - object.projectedVertices = new Object3D.cVector2[3]; |
---|
3110 | | - for (int i = 0; i < 3; i++) |
---|
3111 | | - { |
---|
3112 | | - if (i < keep.length) |
---|
3113 | | - { |
---|
3114 | | - object.projectedVertices[i] = keep[i]; |
---|
3115 | | - } else |
---|
3116 | | - { |
---|
3117 | | - object.projectedVertices[i] = new Object3D.cVector2(); |
---|
3118 | | - } |
---|
3119 | | - /* |
---|
3120 | | - if(keep.length == 0) |
---|
3121 | | - object.projectedVertices[0] = new Object3D.cVector2(); |
---|
3122 | | - else |
---|
3123 | | - object.projectedVertices[0] = keep[0]; |
---|
3124 | | - object.projectedVertices[1] = new Object3D.cVector2(); |
---|
3125 | | - */ |
---|
3126 | | - } |
---|
3127 | | - } |
---|
| 3673 | + |
---|
| 3674 | + AllocProjectedVertices(object); |
---|
3128 | 3675 | |
---|
3129 | 3676 | SetMaterial(mat, object.projectedVertices); |
---|
3130 | 3677 | } |
---|
.. | .. |
---|
3244 | 3791 | public void itemStateChanged(ItemEvent event) |
---|
3245 | 3792 | { |
---|
3246 | 3793 | // System.out.println("Propagate = " + propagate); |
---|
| 3794 | + if (event.getSource() == pinButton) |
---|
| 3795 | + { |
---|
| 3796 | + copy.pinned ^= true; |
---|
| 3797 | + if (!copy.pinned && !copy.editWindow.copy.selection.contains(copy)) |
---|
| 3798 | + { |
---|
| 3799 | + ((GroupEditor)copy.editWindow).listUI.remove(copy); |
---|
| 3800 | + copy.CloseUI(); |
---|
| 3801 | + //copy.editWindow.refreshContents(); |
---|
| 3802 | + } |
---|
| 3803 | + } |
---|
| 3804 | + else |
---|
3247 | 3805 | if (event.getSource() == propagateToggle) |
---|
3248 | 3806 | { |
---|
3249 | 3807 | propagate ^= true; |
---|
.. | .. |
---|
3423 | 3981 | //System.out.println("ObjEditor " + event); |
---|
3424 | 3982 | applySelf0(true); |
---|
3425 | 3983 | //parent.applySelf(); |
---|
3426 | | - objEditor.refreshContents(); |
---|
| 3984 | + // conflicts with requestFocus objEditor.refreshContents(); |
---|
3427 | 3985 | } else if (source == resetButton) |
---|
3428 | 3986 | { |
---|
3429 | 3987 | CameraPane.fullreset = true; |
---|
.. | .. |
---|
3716 | 4274 | { |
---|
3717 | 4275 | //Save(true); |
---|
3718 | 4276 | Replace(); |
---|
3719 | | - SetUndoStates(); |
---|
| 4277 | + SetVersionStates(); |
---|
3720 | 4278 | } |
---|
3721 | 4279 | |
---|
3722 | 4280 | private boolean Equal(byte[] compress, byte[] name) |
---|
.. | .. |
---|
3735 | 4293 | return true; |
---|
3736 | 4294 | } |
---|
3737 | 4295 | |
---|
3738 | | - java.util.Hashtable<java.util.UUID, Object3D> versiontable = new java.util.Hashtable<java.util.UUID, Object3D>(); |
---|
| 4296 | + void DeleteVersion() |
---|
| 4297 | + { |
---|
| 4298 | + for (int i = copy.versionindex; i < copy.versionlist.length-1; i++) |
---|
| 4299 | + { |
---|
| 4300 | + copy.versionlist[i] = copy.versionlist[i+1]; |
---|
| 4301 | + } |
---|
| 4302 | + |
---|
| 4303 | + if (copy.versionlist[copy.versionindex] == null) |
---|
| 4304 | + copy.versionindex -= 1; |
---|
| 4305 | + |
---|
| 4306 | + if (copy.versionindex != -1) |
---|
| 4307 | + CopyChanged(); |
---|
| 4308 | + |
---|
| 4309 | + SetVersionStates(); |
---|
| 4310 | + } |
---|
3739 | 4311 | |
---|
3740 | 4312 | public boolean Save(boolean user) |
---|
3741 | 4313 | { |
---|
3742 | 4314 | System.err.println("Save"); |
---|
3743 | 4315 | Replace(); |
---|
3744 | 4316 | |
---|
3745 | | - cRadio tab = GetCurrentTab(); |
---|
| 4317 | + //cRadio tab = GetCurrentTab(); |
---|
3746 | 4318 | |
---|
3747 | | - Object3D compress = CompressCopy(); // Saved version. No need for "Replace". |
---|
| 4319 | + Object3D compress = Duplicate(copy); // Saved version. No need for "Replace"? |
---|
3748 | 4320 | |
---|
3749 | 4321 | boolean thesame = false; |
---|
3750 | 4322 | |
---|
.. | .. |
---|
3756 | 4328 | //EditorFrame.m_MainFrame.requestFocusInWindow(); |
---|
3757 | 4329 | if (!thesame) |
---|
3758 | 4330 | { |
---|
| 4331 | + for (int i = copy.versionlist.length; --i > copy.versionindex+1;) |
---|
| 4332 | + { |
---|
| 4333 | + copy.versionlist[i] = copy.versionlist[i-1]; |
---|
| 4334 | + } |
---|
| 4335 | + |
---|
3759 | 4336 | //tab.user[tab.versionindex] = user; |
---|
3760 | 4337 | //boolean increment = true; // tab.graphs[tab.versionindex] == null; |
---|
3761 | 4338 | |
---|
.. | .. |
---|
3769 | 4346 | |
---|
3770 | 4347 | //assert(hashtable.isEmpty()); |
---|
3771 | 4348 | |
---|
3772 | | - for (int i = copy.versionindex+1; i < copy.versionlist.length; i++) |
---|
3773 | | - { |
---|
3774 | | - //tab.user[i] = false; |
---|
3775 | | - copy.versionlist[i] = null; |
---|
3776 | | - } |
---|
| 4349 | +// for (int i = copy.versionindex+1; i < copy.versionlist.length; i++) |
---|
| 4350 | +// { |
---|
| 4351 | +// //tab.user[i] = false; |
---|
| 4352 | +// copy.versionlist[i] = null; |
---|
| 4353 | +// } |
---|
3777 | 4354 | |
---|
3778 | | - SetUndoStates(); |
---|
| 4355 | + SetVersionStates(); |
---|
3779 | 4356 | |
---|
3780 | 4357 | // test save |
---|
3781 | 4358 | if (false) |
---|
.. | .. |
---|
3828 | 4405 | GetTree().addSelectionPath(selection.elementAt(i).GetTreePath().GetTreePath()); |
---|
3829 | 4406 | flashIt = true; |
---|
3830 | 4407 | |
---|
3831 | | - refreshContents(false); |
---|
| 4408 | + //refreshContents(false); |
---|
3832 | 4409 | } |
---|
3833 | 4410 | |
---|
3834 | | - void CopyChanged(Object3D obj) |
---|
| 4411 | + void CopyChanged() |
---|
3835 | 4412 | { |
---|
3836 | | - SetUndoStates(); |
---|
| 4413 | + Object3D obj = (Object3D)Grafreed.clone(copy.versionlist[copy.versionindex]); |
---|
| 4414 | + |
---|
| 4415 | + SetVersionStates(); |
---|
3837 | 4416 | |
---|
3838 | 4417 | boolean temp = CameraPane.SWITCH; |
---|
3839 | 4418 | CameraPane.SWITCH = false; |
---|
3840 | 4419 | |
---|
3841 | | - copy.ExtractBigData(versiontable); |
---|
| 4420 | + copy.ExtractBigData(Grafreed.grafreed.universe.versiontable); |
---|
3842 | 4421 | |
---|
3843 | 4422 | copy.clear(); |
---|
3844 | 4423 | |
---|
.. | .. |
---|
3850 | 4429 | copy.add(obj.get(i)); |
---|
3851 | 4430 | } |
---|
3852 | 4431 | |
---|
3853 | | - copy.RestoreBigData(versiontable); |
---|
| 4432 | + copy.RestoreBigData(Grafreed.grafreed.universe.versiontable); |
---|
3854 | 4433 | |
---|
3855 | 4434 | CameraPane.SWITCH = temp; |
---|
3856 | 4435 | |
---|
.. | .. |
---|
3875 | 4454 | } |
---|
3876 | 4455 | } |
---|
3877 | 4456 | |
---|
3878 | | - refreshContents(); |
---|
| 4457 | + refreshContents(true); |
---|
3879 | 4458 | } |
---|
3880 | 4459 | |
---|
3881 | | - cButton undoButton; |
---|
| 4460 | + cButton previousVersionButton; |
---|
3882 | 4461 | cButton restoreButton; |
---|
3883 | 4462 | cButton replaceButton; |
---|
3884 | | - cButton redoButton; |
---|
| 4463 | + cButton nextVersionButton; |
---|
| 4464 | + cButton saveVersionButton; |
---|
| 4465 | + cButton deleteVersionButton; |
---|
3885 | 4466 | |
---|
3886 | 4467 | boolean muteSlider; |
---|
3887 | 4468 | |
---|
.. | .. |
---|
3898 | 4479 | return count; |
---|
3899 | 4480 | } |
---|
3900 | 4481 | |
---|
3901 | | - void SetUndoStates() |
---|
| 4482 | + public cGridBag versionSliderPane; |
---|
| 4483 | + |
---|
| 4484 | + void SetVersionStates() |
---|
3902 | 4485 | { |
---|
3903 | | - cRadio tab = GetCurrentTab(); |
---|
| 4486 | + //if (true) |
---|
| 4487 | + // return; |
---|
| 4488 | + |
---|
| 4489 | + //cRadio tab = GetCurrentTab(); |
---|
3904 | 4490 | |
---|
3905 | | - restoreButton.setEnabled(copy.versionindex != -1); |
---|
3906 | | - replaceButton.setEnabled(copy.versionindex != -1); |
---|
3907 | | - |
---|
3908 | | - undoButton.setEnabled(copy.versionindex > 0); |
---|
3909 | | - redoButton.setEnabled(copy.versionlist[copy.versionindex + 1] != null); |
---|
3910 | | - |
---|
3911 | | - muteSlider = true; |
---|
3912 | | - versionSlider.setMaximum(VersionCount() - 1); |
---|
3913 | | - versionSlider.setInteger(copy.versionindex); |
---|
3914 | | - muteSlider = false; |
---|
| 4491 | + if (copy.versionlist == null) |
---|
| 4492 | + { |
---|
| 4493 | + saveVersionButton.setEnabled(false); |
---|
| 4494 | + restoreButton.setEnabled(false); |
---|
| 4495 | + replaceButton.setEnabled(false); |
---|
| 4496 | + previousVersionButton.setEnabled(false); |
---|
| 4497 | + nextVersionButton.setEnabled(false); |
---|
| 4498 | + deleteVersionButton.setEnabled(false); |
---|
| 4499 | + versionSliderPane.setVisible(false); |
---|
| 4500 | + } |
---|
| 4501 | + else |
---|
| 4502 | + { |
---|
| 4503 | + restoreButton.setEnabled(copy.versionindex != -1); |
---|
| 4504 | + replaceButton.setEnabled(copy.versionindex != -1); |
---|
| 4505 | + |
---|
| 4506 | + previousVersionButton.setEnabled(copy.versionindex > 0); |
---|
| 4507 | + nextVersionButton.setEnabled(copy.versionlist[copy.versionindex + 1] != null); |
---|
| 4508 | + |
---|
| 4509 | + deleteVersionButton.setEnabled(copy.versionindex != -1); |
---|
| 4510 | + //copy.versionlist[copy.versionindex + 1] != null); |
---|
| 4511 | + |
---|
| 4512 | + muteSlider = true; |
---|
| 4513 | + versionSlider.setMinimum(0); |
---|
| 4514 | + versionSlider.setMaximum(VersionCount() - 1); |
---|
| 4515 | + versionSlider.setInteger(copy.versionindex); |
---|
| 4516 | + versionSlider.setEnabled(copy.versionindex != -1); |
---|
| 4517 | + muteSlider = false; |
---|
| 4518 | + |
---|
| 4519 | + versionSliderPane.setVisible(true); |
---|
| 4520 | + } |
---|
3915 | 4521 | } |
---|
3916 | 4522 | |
---|
3917 | | - public boolean Undo() |
---|
| 4523 | + public boolean PreviousVersion() |
---|
3918 | 4524 | { |
---|
3919 | 4525 | // Option? |
---|
3920 | 4526 | Replace(); |
---|
3921 | 4527 | |
---|
3922 | 4528 | System.err.println("Undo"); |
---|
3923 | 4529 | |
---|
3924 | | - cRadio tab = GetCurrentTab(); |
---|
| 4530 | + //cRadio tab = GetCurrentTab(); |
---|
3925 | 4531 | |
---|
3926 | 4532 | if (copy.versionindex == 0) |
---|
3927 | 4533 | { |
---|
.. | .. |
---|
3944 | 4550 | |
---|
3945 | 4551 | copy.versionindex -= 1; |
---|
3946 | 4552 | |
---|
3947 | | - CopyChanged((Object3D)copy.versionlist[copy.versionindex]); |
---|
| 4553 | + CopyChanged(); |
---|
3948 | 4554 | |
---|
3949 | 4555 | return true; |
---|
3950 | 4556 | } |
---|
.. | .. |
---|
3953 | 4559 | { |
---|
3954 | 4560 | System.err.println("Restore"); |
---|
3955 | 4561 | |
---|
3956 | | - cRadio tab = GetCurrentTab(); |
---|
| 4562 | + //cRadio tab = GetCurrentTab(); |
---|
3957 | 4563 | |
---|
3958 | 4564 | if (copy.versionindex == -1 || copy.versionlist[copy.versionindex] == null) |
---|
3959 | 4565 | { |
---|
.. | .. |
---|
3962 | 4568 | } |
---|
3963 | 4569 | |
---|
3964 | 4570 | //CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex])); |
---|
3965 | | - CopyChanged(copy.versionlist[copy.versionindex]); |
---|
| 4571 | + CopyChanged(); |
---|
3966 | 4572 | |
---|
3967 | 4573 | return true; |
---|
3968 | 4574 | } |
---|
3969 | 4575 | |
---|
3970 | 4576 | public boolean Replace() |
---|
3971 | 4577 | { |
---|
3972 | | - System.err.println("Replace"); |
---|
| 4578 | + //System.err.println("Replace"); |
---|
3973 | 4579 | |
---|
3974 | | - cRadio tab = GetCurrentTab(); |
---|
| 4580 | + //cRadio tab = GetCurrentTab(); |
---|
3975 | 4581 | |
---|
3976 | 4582 | if (copy.versionindex == -1 || copy.versionlist[copy.versionindex] == null) |
---|
3977 | 4583 | { |
---|
.. | .. |
---|
3979 | 4585 | return false; |
---|
3980 | 4586 | } |
---|
3981 | 4587 | |
---|
3982 | | - copy.versionlist[copy.versionindex] = CompressCopy(); |
---|
| 4588 | + copy.versionlist[copy.versionindex] = Duplicate(copy); |
---|
3983 | 4589 | |
---|
3984 | 4590 | return true; |
---|
3985 | 4591 | } |
---|
3986 | 4592 | |
---|
3987 | | - public void Redo() |
---|
| 4593 | + public void NextVersion() |
---|
3988 | 4594 | { |
---|
3989 | 4595 | // Option? |
---|
3990 | 4596 | Replace(); |
---|
3991 | 4597 | |
---|
3992 | | - cRadio tab = GetCurrentTab(); |
---|
| 4598 | + //cRadio tab = GetCurrentTab(); |
---|
3993 | 4599 | |
---|
3994 | 4600 | if (copy.versionlist[copy.versionindex + 1] == null) |
---|
3995 | 4601 | { |
---|
.. | .. |
---|
3999 | 4605 | |
---|
4000 | 4606 | copy.versionindex += 1; |
---|
4001 | 4607 | |
---|
4002 | | - CopyChanged(copy.versionlist[copy.versionindex]); |
---|
| 4608 | + CopyChanged(); |
---|
4003 | 4609 | |
---|
4004 | 4610 | //if (!tab.user[tab.versionindex]) |
---|
4005 | 4611 | // tab.graphs[tab.versionindex] = null; |
---|
.. | .. |
---|
4196 | 4802 | // else |
---|
4197 | 4803 | // applySelf(true); |
---|
4198 | 4804 | // } |
---|
| 4805 | + |
---|
| 4806 | + boolean Equal(double a, double b) |
---|
| 4807 | + { |
---|
| 4808 | + return Math.abs(a - b) < 0.001; |
---|
| 4809 | + } |
---|
| 4810 | + |
---|
4199 | 4811 | void applySelf0(boolean name) |
---|
4200 | 4812 | { |
---|
4201 | 4813 | if (name) |
---|
.. | .. |
---|
4245 | 4857 | { |
---|
4246 | 4858 | cMaterial mat = copy.material; |
---|
4247 | 4859 | |
---|
4248 | | - colorField.SetToolTipValue((mat.color)); |
---|
4249 | | - saturationField.SetToolTipValue((mat.modulation)); |
---|
4250 | | - metalnessField.SetToolTipValue((mat.metalness)); |
---|
4251 | | - diffuseField.SetToolTipValue((mat.diffuse)); |
---|
4252 | | - specularField.SetToolTipValue((mat.specular)); |
---|
4253 | | - shininessField.SetToolTipValue((mat.shininess)); |
---|
4254 | | - shiftField.SetToolTipValue((mat.shift)); |
---|
4255 | | - ambientField.SetToolTipValue((mat.ambient)); |
---|
4256 | | - lightareaField.SetToolTipValue((mat.lightarea)); |
---|
4257 | | - diffusenessField.SetToolTipValue((mat.factor)); |
---|
4258 | | - velvetField.SetToolTipValue((mat.velvet)); |
---|
4259 | | - sheenField.SetToolTipValue((mat.sheen)); |
---|
4260 | | - subsurfaceField.SetToolTipValue((mat.subsurface)); |
---|
4261 | | - backlitField.SetToolTipValue((mat.bump)); |
---|
4262 | | - anisoField.SetToolTipValue((mat.aniso)); |
---|
4263 | | - anisoVField.SetToolTipValue((mat.anisoV)); |
---|
4264 | | - cameraField.SetToolTipValue((mat.cameralight)); |
---|
4265 | | - selfshadowField.SetToolTipValue((mat.diffuseness)); |
---|
4266 | | - shadowField.SetToolTipValue((mat.shadow)); |
---|
4267 | | - textureField.SetToolTipValue((mat.texture)); |
---|
4268 | | - opacityField.SetToolTipValue((mat.opacity)); |
---|
4269 | | - fakedepthField.SetToolTipValue((mat.fakedepth)); |
---|
4270 | | - shadowbiasField.SetToolTipValue((mat.shadowbias)); |
---|
| 4860 | + if (!Equal(colorField.getFloat(), mat.color)) |
---|
| 4861 | + colorField.SetToolTipValue((mat.color)); |
---|
| 4862 | + if (!Equal(saturationField.getFloat(), mat.modulation)) |
---|
| 4863 | + saturationField.SetToolTipValue((mat.modulation)); |
---|
| 4864 | + if (!Equal(metalnessField.getFloat(), mat.metalness)) |
---|
| 4865 | + metalnessField.SetToolTipValue((mat.metalness)); |
---|
| 4866 | + if (!Equal(diffuseField.getFloat(), mat.diffuse)) |
---|
| 4867 | + diffuseField.SetToolTipValue((mat.diffuse)); |
---|
| 4868 | + if (!Equal(specularField.getFloat(), mat.specular)) |
---|
| 4869 | + specularField.SetToolTipValue((mat.specular)); |
---|
| 4870 | + if (!Equal(shininessField.getFloat(), mat.shininess)) |
---|
| 4871 | + shininessField.SetToolTipValue((mat.shininess)); |
---|
| 4872 | + if (!Equal(shiftField.getFloat(), mat.shift)) |
---|
| 4873 | + shiftField.SetToolTipValue((mat.shift)); |
---|
| 4874 | + if (!Equal(ambientField.getFloat(), mat.ambient)) |
---|
| 4875 | + ambientField.SetToolTipValue((mat.ambient)); |
---|
| 4876 | + if (!Equal(lightareaField.getFloat(), mat.lightarea)) |
---|
| 4877 | + lightareaField.SetToolTipValue((mat.lightarea)); |
---|
| 4878 | + if (!Equal(diffusenessField.getFloat(), mat.factor)) |
---|
| 4879 | + diffusenessField.SetToolTipValue((mat.factor)); |
---|
| 4880 | + if (!Equal(velvetField.getFloat(), mat.velvet)) |
---|
| 4881 | + velvetField.SetToolTipValue((mat.velvet)); |
---|
| 4882 | + if (!Equal(sheenField.getFloat(), mat.sheen)) |
---|
| 4883 | + sheenField.SetToolTipValue((mat.sheen)); |
---|
| 4884 | + if (!Equal(subsurfaceField.getFloat(), mat.subsurface)) |
---|
| 4885 | + subsurfaceField.SetToolTipValue((mat.subsurface)); |
---|
| 4886 | + if (!Equal(backlitField.getFloat(), mat.bump)) |
---|
| 4887 | + backlitField.SetToolTipValue((mat.bump)); |
---|
| 4888 | + if (!Equal(anisoField.getFloat(), mat.aniso)) |
---|
| 4889 | + anisoField.SetToolTipValue((mat.aniso)); |
---|
| 4890 | + if (!Equal(anisoVField.getFloat(), mat.anisoV)) |
---|
| 4891 | + anisoVField.SetToolTipValue((mat.anisoV)); |
---|
| 4892 | + if (!Equal(cameraField.getFloat(), mat.cameralight)) |
---|
| 4893 | + cameraField.SetToolTipValue((mat.cameralight)); |
---|
| 4894 | + if (!Equal(selfshadowField.getFloat(), mat.diffuseness)) |
---|
| 4895 | + selfshadowField.SetToolTipValue((mat.diffuseness)); |
---|
| 4896 | + if (!Equal(shadowField.getFloat(), mat.shadow)) |
---|
| 4897 | + shadowField.SetToolTipValue((mat.shadow)); |
---|
| 4898 | + if (!Equal(textureField.getFloat(), mat.texture)) |
---|
| 4899 | + textureField.SetToolTipValue((mat.texture)); |
---|
| 4900 | + if (!Equal(opacityField.getFloat(), mat.opacity)) |
---|
| 4901 | + opacityField.SetToolTipValue((mat.opacity)); |
---|
| 4902 | + if (!Equal(fakedepthField.getFloat(), mat.fakedepth)) |
---|
| 4903 | + fakedepthField.SetToolTipValue((mat.fakedepth)); |
---|
| 4904 | + if (!Equal(shadowbiasField.getFloat(), mat.shadowbias)) |
---|
| 4905 | + shadowbiasField.SetToolTipValue((mat.shadowbias)); |
---|
4271 | 4906 | } |
---|
4272 | 4907 | |
---|
4273 | 4908 | if (copy.material != null && copy.projectedVertices.length > 0 && copy.projectedVertices[0] != null) |
---|
.. | .. |
---|
4302 | 4937 | |
---|
4303 | 4938 | public void stateChanged(ChangeEvent e) |
---|
4304 | 4939 | { |
---|
4305 | | - // assert(false); |
---|
| 4940 | + // assert(false); |
---|
4306 | 4941 | if (e.getSource() == versionSlider) |
---|
4307 | 4942 | { |
---|
4308 | 4943 | if (muteSlider) |
---|
4309 | 4944 | return; |
---|
4310 | 4945 | |
---|
| 4946 | + Replace(); |
---|
| 4947 | + |
---|
4311 | 4948 | int version = versionSlider.getInteger(); |
---|
4312 | 4949 | |
---|
4313 | | - if (copy.versionlist[version] != null) |
---|
| 4950 | + if (version != -1 && copy.versionlist[version] != null) |
---|
4314 | 4951 | { |
---|
4315 | | - CopyChanged(copy.versionlist[copy.versionindex = version]); |
---|
| 4952 | + copy.versionindex = version; |
---|
| 4953 | + CopyChanged(); |
---|
4316 | 4954 | } |
---|
4317 | 4955 | |
---|
4318 | 4956 | return; |
---|
.. | .. |
---|
4353 | 4991 | //System.out.println("stateChanged = " + this); |
---|
4354 | 4992 | materialtouched = true; |
---|
4355 | 4993 | |
---|
4356 | | - if (e.getSource() == colorField && saturationField.getFloat() == 0.001) |
---|
| 4994 | + if (Globals.AUTOSATURATE && e.getSource() == colorField && saturationField.getFloat() == 0.001) |
---|
4357 | 4995 | { |
---|
4358 | 4996 | saturationField.setFloat(1); |
---|
4359 | 4997 | } |
---|
.. | .. |
---|
4666 | 5304 | ctrlPanel.validate(); // ? new |
---|
4667 | 5305 | ctrlPanel.repaint(); |
---|
4668 | 5306 | } |
---|
| 5307 | + |
---|
| 5308 | + if (previousVersionButton != null && copy.versionlist != null) |
---|
| 5309 | + SetVersionStates(); |
---|
| 5310 | + |
---|
| 5311 | + cameraView.requestFocusInWindow(); |
---|
4669 | 5312 | } |
---|
4670 | 5313 | |
---|
4671 | 5314 | static TweenManager tweenManager = new TweenManager(); |
---|
.. | .. |
---|
4697 | 5340 | // group = (Composite) group.get(0); |
---|
4698 | 5341 | // } |
---|
4699 | 5342 | |
---|
4700 | | - System.out.println("makeSomething of " + thing); |
---|
| 5343 | + //System.out.println("makeSomething of " + thing); |
---|
4701 | 5344 | |
---|
4702 | 5345 | /* |
---|
4703 | 5346 | if (deselect && jList != null) |
---|
.. | .. |
---|
5051 | 5694 | |
---|
5052 | 5695 | copy.versionlist = readobj.versionlist; |
---|
5053 | 5696 | copy.versionindex = readobj.versionindex; |
---|
| 5697 | + copy.versiontable = readobj.versiontable; |
---|
5054 | 5698 | |
---|
5055 | 5699 | if (copy.versionlist == null) |
---|
5056 | 5700 | { |
---|
| 5701 | + // Backward compatibility |
---|
5057 | 5702 | copy.versionlist = new Object3D[100]; |
---|
5058 | 5703 | copy.versionindex = -1; |
---|
| 5704 | + |
---|
| 5705 | + //Save(true); |
---|
5059 | 5706 | } |
---|
5060 | 5707 | |
---|
5061 | 5708 | //? SetUndoStates(); |
---|
.. | .. |
---|
5070 | 5717 | { |
---|
5071 | 5718 | if (Grafreed.standAlone) |
---|
5072 | 5719 | { |
---|
5073 | | - FileDialog browser = new FileDialog(frame, "Load", FileDialog.LOAD); |
---|
| 5720 | + FileDialog browser = new FileDialog(frame, "Open", FileDialog.LOAD); |
---|
5074 | 5721 | browser.show(); |
---|
5075 | 5722 | String filename = browser.getFile(); |
---|
5076 | 5723 | if (filename != null && filename.length() > 0) |
---|
.. | .. |
---|
5147 | 5794 | |
---|
5148 | 5795 | void save() |
---|
5149 | 5796 | { |
---|
| 5797 | + Replace(); |
---|
| 5798 | + |
---|
5150 | 5799 | if (lastname == null) |
---|
5151 | 5800 | { |
---|
5152 | 5801 | return; |
---|
.. | .. |
---|
5389 | 6038 | ButtonGroup buttonGroup; |
---|
5390 | 6039 | |
---|
5391 | 6040 | cGridBag toolboxPanel; |
---|
| 6041 | + cGridBag skyboxPanel; |
---|
5392 | 6042 | cGridBag materialPanel; |
---|
5393 | 6043 | cGridBag ctrlPanel; |
---|
5394 | 6044 | |
---|
.. | .. |
---|
5400 | 6050 | boolean materialFlushed; |
---|
5401 | 6051 | Object3D latestObject; |
---|
5402 | 6052 | |
---|
| 6053 | + cGridBag transformPanel; |
---|
5403 | 6054 | cGridBag XYZPanel; |
---|
5404 | 6055 | |
---|
5405 | 6056 | JSplitPane gridPanel; |
---|
.. | .. |
---|
5493 | 6144 | cNumberSlider anisoField; |
---|
5494 | 6145 | JLabel anisoVLabel; |
---|
5495 | 6146 | cNumberSlider anisoVField; |
---|
| 6147 | + |
---|
5496 | 6148 | JLabel cameraLabel; |
---|
5497 | 6149 | cNumberSlider cameraField; |
---|
5498 | 6150 | JLabel selfshadowLabel; |
---|
.. | .. |
---|
5507 | 6159 | cNumberSlider fakedepthField; |
---|
5508 | 6160 | JLabel shadowbiasLabel; |
---|
5509 | 6161 | cNumberSlider shadowbiasField; |
---|
| 6162 | + |
---|
5510 | 6163 | JLabel bumpLabel; |
---|
5511 | 6164 | cNumberSlider bumpField; |
---|
5512 | 6165 | JLabel noiseLabel; |
---|