.. | .. |
---|
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 | + } |
---|
| 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 | + } |
---|
44 | 89 | |
---|
45 | 90 | public cGridBag GetSeparator() |
---|
46 | 91 | { |
---|
.. | .. |
---|
53 | 98 | cButton GetButton(String name, boolean border) |
---|
54 | 99 | { |
---|
55 | 100 | ImageIcon icon = GetIcon(name); |
---|
56 | | - 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); |
---|
57 | 105 | } |
---|
58 | 106 | |
---|
59 | 107 | cLabel GetLabel(String name, boolean border) |
---|
.. | .. |
---|
74 | 122 | return new cCheckBox(icon, border); |
---|
75 | 123 | } |
---|
76 | 124 | |
---|
77 | | - 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) |
---|
78 | 128 | { |
---|
| 129 | + javax.swing.ImageIcon iconCache = icons.get(name); |
---|
| 130 | + if (iconCache != null) |
---|
| 131 | + { |
---|
| 132 | + return iconCache; |
---|
| 133 | + } |
---|
| 134 | + |
---|
79 | 135 | try |
---|
80 | 136 | { |
---|
81 | | - BufferedImage image = javax.imageio.ImageIO.read(getClass().getClassLoader().getResourceAsStream(name)); |
---|
| 137 | + BufferedImage image = javax.imageio.ImageIO.read(ObjEditor.class.getClassLoader().getResourceAsStream(name)); |
---|
82 | 138 | |
---|
83 | 139 | // if (image.getWidth() > 48 && image.getHeight() > 48) |
---|
84 | 140 | // { |
---|
.. | .. |
---|
93 | 149 | // } |
---|
94 | 150 | |
---|
95 | 151 | javax.swing.ImageIcon icon = new javax.swing.ImageIcon(image); |
---|
| 152 | + |
---|
| 153 | + icons.put(name, icon); |
---|
| 154 | + |
---|
96 | 155 | return icon; |
---|
97 | 156 | } |
---|
98 | 157 | catch (Exception e) |
---|
99 | 158 | { |
---|
| 159 | + //icons.put(name, null); |
---|
100 | 160 | return null; |
---|
101 | 161 | } |
---|
102 | 162 | } |
---|
.. | .. |
---|
296 | 356 | client = inClient; |
---|
297 | 357 | copy = client; |
---|
298 | 358 | |
---|
299 | | - if (copy.versionlist == null) |
---|
300 | | - { |
---|
301 | | - copy.versionlist = new Object3D[100]; |
---|
302 | | - copy.versionindex = -1; |
---|
303 | | - } |
---|
| 359 | +// if (copy.versionlist == null) |
---|
| 360 | +// { |
---|
| 361 | +// copy.versionlist = new Object3D[100]; |
---|
| 362 | +// copy.versionindex = -1; |
---|
| 363 | +// |
---|
| 364 | +// callee.Save(true); |
---|
| 365 | +// } |
---|
304 | 366 | |
---|
305 | 367 | // "this" is not called: SetupUI2(objEditor); |
---|
306 | 368 | } |
---|
.. | .. |
---|
319 | 381 | { |
---|
320 | 382 | copy.versionlist = new Object3D[100]; |
---|
321 | 383 | copy.versionindex = -1; |
---|
| 384 | + |
---|
| 385 | +// Save(true); |
---|
322 | 386 | } |
---|
323 | 387 | |
---|
324 | 388 | SetupUI2(callee.GetEditor()); |
---|
.. | .. |
---|
342 | 406 | //parent = p; |
---|
343 | 407 | |
---|
344 | 408 | GraphicsDevice gd = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice(); |
---|
345 | | - System.out.println("getFullScreenWindow? " + gd.getFullScreenWindow()); |
---|
| 409 | + if (Globals.DEBUG) |
---|
| 410 | + System.out.println("getFullScreenWindow? " + gd.getFullScreenWindow()); |
---|
346 | 411 | //gd.setFullScreenWindow(this); |
---|
347 | 412 | //setResizable(false); |
---|
348 | 413 | //if (!isDisplayable()) |
---|
.. | .. |
---|
353 | 418 | copy = localCopy; |
---|
354 | 419 | copy.editWindow = this; |
---|
355 | 420 | |
---|
356 | | - if (copy.versionlist == null) |
---|
357 | | - { |
---|
358 | | -// copy.versions = new byte[100][]; |
---|
| 421 | +// if (copy.versionlist == null) |
---|
| 422 | +// { |
---|
| 423 | +// copy.versionlist = new Object3D[100]; |
---|
359 | 424 | // copy.versionindex = -1; |
---|
360 | | - } |
---|
| 425 | +// |
---|
| 426 | +// Save(true); |
---|
| 427 | +// } |
---|
361 | 428 | |
---|
362 | 429 | SetupMenu(); |
---|
363 | 430 | |
---|
.. | .. |
---|
377 | 444 | |
---|
378 | 445 | static java.util.Vector<Object3D> listUI = new java.util.Vector<Object3D>(); |
---|
379 | 446 | |
---|
| 447 | + // This is to refresh the UI of the material panel. |
---|
| 448 | + boolean patchMaterial; |
---|
| 449 | + |
---|
380 | 450 | void SetupMenu() |
---|
381 | 451 | { |
---|
382 | 452 | frame.setMenuBar(menuBar = new MenuBar()); |
---|
.. | .. |
---|
426 | 496 | |
---|
427 | 497 | ChangeListener changeListener = new ChangeListener() |
---|
428 | 498 | { |
---|
| 499 | + //String name; |
---|
| 500 | + |
---|
429 | 501 | public void stateChanged(ChangeEvent changeEvent) |
---|
430 | 502 | { |
---|
431 | 503 | // if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Material") && !materialFlushed) |
---|
.. | .. |
---|
444 | 516 | // EditSelection(false); |
---|
445 | 517 | // } |
---|
446 | 518 | |
---|
447 | | - refreshContents(false); // To refresh Info tab |
---|
| 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 | + |
---|
| 548 | +// refreshContents(false); // To refresh Info tab |
---|
| 549 | + cameraView.repaint(); |
---|
448 | 550 | } |
---|
449 | 551 | }; |
---|
450 | 552 | objectPanel.addChangeListener(changeListener); |
---|
.. | .. |
---|
466 | 568 | |
---|
467 | 569 | toolboxPanel = new cGridBag().setVertical(true); |
---|
468 | 570 | //toolboxPanel.setName("Toolbox"); |
---|
| 571 | + |
---|
| 572 | + skyboxPanel = new cGridBag().setVertical(true); |
---|
469 | 573 | |
---|
470 | 574 | materialPanel = new cGridBag().setVertical(false); |
---|
471 | 575 | //materialPanel.setName("Material"); |
---|
.. | .. |
---|
751 | 855 | boolean maximized; |
---|
752 | 856 | |
---|
753 | 857 | cButton fullscreenLayout; |
---|
| 858 | + cButton expandedLayout; |
---|
754 | 859 | |
---|
755 | 860 | void Minimize() |
---|
756 | 861 | { |
---|
.. | .. |
---|
790 | 895 | cButton minButton; |
---|
791 | 896 | cButton maxButton; |
---|
792 | 897 | cButton fullButton; |
---|
| 898 | + cButton collapseButton; |
---|
| 899 | + cButton maximize3DButton; |
---|
793 | 900 | |
---|
794 | 901 | void ToggleFullScreen() |
---|
795 | 902 | { |
---|
796 | | -GraphicsDevice device = frame.getGraphicsConfiguration().getDevice(); |
---|
| 903 | + GraphicsDevice device = frame.getGraphicsConfiguration().getDevice(); |
---|
797 | 904 | |
---|
798 | 905 | cameraView.ToggleFullScreen(); |
---|
799 | 906 | |
---|
.. | .. |
---|
814 | 921 | // X frame.getContentPane().remove(/*"Center",*/bigThree); |
---|
815 | 922 | // X framePanel.add(bigThree); |
---|
816 | 923 | // X frame.getContentPane().add(/*"Center",*/framePanel); |
---|
817 | | - framePanel.setDividerLocation(46); |
---|
| 924 | +// framePanel.setDividerLocation(46); // icons are 24x24 |
---|
818 | 925 | |
---|
819 | 926 | //frame.setVisible(true); |
---|
820 | | - radio.layout = keepButton; |
---|
| 927 | +// radio.layout = keepButton; |
---|
821 | 928 | //theFrame = null; |
---|
822 | 929 | keepButton = null; |
---|
823 | | - radio.layout.doClick(); |
---|
| 930 | +// radio.layout.doClick(); |
---|
824 | 931 | |
---|
825 | 932 | } else |
---|
826 | 933 | { |
---|
.. | .. |
---|
841 | 948 | // X frame.getContentPane().remove(/*"Center",*/framePanel); |
---|
842 | 949 | // X framePanel.remove(bigThree); |
---|
843 | 950 | // X frame.getContentPane().add(/*"Center",*/bigThree); |
---|
844 | | - framePanel.setDividerLocation(0); |
---|
| 951 | +// framePanel.setDividerLocation(0); |
---|
845 | 952 | |
---|
846 | | - radio.layout = fullscreenLayout; |
---|
847 | | - radio.layout.doClick(); |
---|
| 953 | +// radio.layout = fullscreenLayout; |
---|
| 954 | +// radio.layout.doClick(); |
---|
848 | 955 | //frame.setVisible(true); |
---|
849 | 956 | } |
---|
850 | 957 | frame.validate(); |
---|
| 958 | + |
---|
| 959 | + cameraView.requestFocusInWindow(); |
---|
851 | 960 | } |
---|
852 | 961 | |
---|
853 | | - private Object3D CompressCopy() |
---|
| 962 | + void CollapseToolbar() |
---|
| 963 | + { |
---|
| 964 | + framePanel.setDividerLocation(0); |
---|
| 965 | + //frame.validate(); |
---|
| 966 | + |
---|
| 967 | + cameraView.requestFocusInWindow(); |
---|
| 968 | + } |
---|
| 969 | + |
---|
| 970 | + private Object3D Duplicate(Object3D object) |
---|
854 | 971 | { |
---|
855 | 972 | boolean temp = CameraPane.SWITCH; |
---|
856 | 973 | CameraPane.SWITCH = false; |
---|
857 | 974 | |
---|
858 | | - copy.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); |
---|
859 | 979 | // if (copy == client) |
---|
860 | 980 | |
---|
861 | | - Object3D versions[] = copy.versionlist; |
---|
862 | | - copy.versionlist = null; |
---|
| 981 | + Object3D versions[] = object.versionlist; |
---|
| 982 | + java.util.Hashtable<java.util.UUID, Object3D> versiontable = object.versiontable; // if Grafreed.grafreed.universe |
---|
| 983 | + object.versionlist = null; |
---|
| 984 | + object.versiontable = null; |
---|
| 985 | + |
---|
| 986 | + Object3D parent = object.parent; |
---|
| 987 | + object.parent = null; |
---|
863 | 988 | |
---|
864 | 989 | //byte[] compress = Compress(copy); |
---|
865 | | - Object3D compress = (Object3D)Grafreed.clone(copy); |
---|
| 990 | + Object3D compress = (Object3D)Grafreed.clone(object); |
---|
866 | 991 | |
---|
867 | | - copy.versionlist = versions; |
---|
| 992 | + object.parent = parent; |
---|
868 | 993 | |
---|
869 | | - copy.RestoreBigData(versiontable); |
---|
| 994 | + object.versionlist = versions; |
---|
| 995 | + object.versiontable = versiontable; // if Grafreed.grafreed.universe |
---|
| 996 | + |
---|
| 997 | + object.RestoreBigData(Grafreed.grafreed.universe.versiontable); |
---|
870 | 998 | |
---|
871 | 999 | CameraPane.SWITCH = temp; |
---|
872 | 1000 | |
---|
.. | .. |
---|
1203 | 1331 | |
---|
1204 | 1332 | namePanel = new cGridBag(); |
---|
1205 | 1333 | |
---|
| 1334 | + //if (copy.pinned) |
---|
| 1335 | + { |
---|
| 1336 | + pinButton = GetToggleButton("icons/pin.png", !Globals.NIMBUSLAF); |
---|
| 1337 | + pinButton.setSelected(copy.pinned); |
---|
| 1338 | + cGridBag t = new cGridBag(); |
---|
| 1339 | + t.preferredWidth = 2; |
---|
| 1340 | + t.add(pinButton); |
---|
| 1341 | + namePanel.add(t); |
---|
| 1342 | + |
---|
| 1343 | + pinButton.addItemListener(this); |
---|
| 1344 | + } |
---|
| 1345 | + |
---|
1206 | 1346 | nameField = AddText(namePanel, copy.GetName()); |
---|
1207 | 1347 | namePanel.add(new JScrollPane(nameField, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER)); |
---|
1208 | 1348 | oe.ctrlPanel.add(namePanel); |
---|
.. | .. |
---|
1216 | 1356 | |
---|
1217 | 1357 | liveCB = AddCheckBox(setupPanel, "Live", copy.live); |
---|
1218 | 1358 | liveCB.setToolTipText("Animate object"); |
---|
| 1359 | + markCB = AddCheckBox(setupPanel, "Anim", copy.marked); |
---|
| 1360 | + markCB.setToolTipText("Set target transform"); |
---|
1219 | 1361 | selectableCB = AddCheckBox(setupPanel, "Select", !copy.dontselect); |
---|
1220 | 1362 | selectableCB.setToolTipText("Make object selectable"); |
---|
1221 | 1363 | // Return(); |
---|
1222 | 1364 | |
---|
1223 | 1365 | hideCB = AddCheckBox(setupPanel, "Hide", copy.hide); |
---|
1224 | 1366 | hideCB.setToolTipText("Hide object"); |
---|
1225 | | - markCB = AddCheckBox(setupPanel, "Mark", copy.marked); |
---|
1226 | | - markCB.setToolTipText("As animation target transform"); |
---|
1227 | 1367 | |
---|
1228 | 1368 | ToolTipManager.sharedInstance().setLightWeightPopupEnabled(false); |
---|
1229 | 1369 | |
---|
.. | .. |
---|
1425 | 1565 | |
---|
1426 | 1566 | if (cam == null || !(copy.get(0) instanceof cGroup)) |
---|
1427 | 1567 | { |
---|
1428 | | - System.out.println("CREATE CAMERAS"); |
---|
1429 | | - cams = new cTemplate(); |
---|
1430 | | - cams.name = "Cameras"; |
---|
1431 | | - copy.insertElementAt(cams, 0); |
---|
1432 | | - //cams.parent = copy; |
---|
1433 | | - |
---|
1434 | | - cam = new Camera(); // LA.newVector(3, 2, 1)); |
---|
1435 | | - cams.addChild(cam); |
---|
1436 | | - cam = new Camera(1); |
---|
1437 | | - cams.addChild(cam); |
---|
1438 | | - cam = new Camera(2); |
---|
1439 | | - cams.addChild(cam); |
---|
1440 | | - cam = new Camera(3); |
---|
1441 | | - cams.addChild(cam); |
---|
1442 | | - cam = new Camera(4); // Light |
---|
1443 | | - cams.addChild(cam); |
---|
| 1568 | + if (Globals.DEBUG) |
---|
| 1569 | + System.out.println("CREATE CAMERAS"); |
---|
| 1570 | + cams = CreateCameras(); |
---|
1444 | 1571 | } else |
---|
1445 | 1572 | { |
---|
1446 | 1573 | cams = (cGroup) copy.get(0); |
---|
.. | .. |
---|
1506 | 1633 | //frontView.object = copy; |
---|
1507 | 1634 | //sideView.object = copy; |
---|
1508 | 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 | + |
---|
1509 | 1675 | XYZPanel = new cGridBag().setVertical(true); |
---|
1510 | 1676 | //XYZPanel.setLayout(new GridLayout(3, 1, 5, 5)); |
---|
1511 | 1677 | |
---|
.. | .. |
---|
1515 | 1681 | XYZPanel.addComponent(/*BorderLayout.NORTH,*/topView); // Scroll); |
---|
1516 | 1682 | //XYZPanel.setName("XYZ"); |
---|
1517 | 1683 | |
---|
| 1684 | + transformPanel.add(resetTransformPanel); |
---|
| 1685 | + transformPanel.add(XYZPanel); |
---|
| 1686 | + |
---|
1518 | 1687 | /* |
---|
1519 | 1688 | gridPanel = new JPanel(); //new BorderLayout()); |
---|
1520 | 1689 | gridPanel.setLayout(new GridLayout(1, 2)); |
---|
.. | .. |
---|
1522 | 1691 | gridPanel.add(cameraView); |
---|
1523 | 1692 | gridPanel.add(XYZPanel); |
---|
1524 | 1693 | */ |
---|
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); |
---|
| 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); |
---|
1531 | 1700 | |
---|
1532 | 1701 | // aConstraints.weighty = 0; |
---|
1533 | 1702 | //System.out.println("THIS = " + this); |
---|
.. | .. |
---|
1550 | 1719 | |
---|
1551 | 1720 | //JScrollPane tmp = new JScrollPane(ctrlPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); |
---|
1552 | 1721 | //tmp.setName("Edit"); |
---|
| 1722 | + objectPanel.add(skyboxPanel); |
---|
| 1723 | + objectPanel.setIconAt(0, GetIcon("icons/skybox.jpg")); |
---|
| 1724 | + objectPanel.setToolTipTextAt(0, "Backgrounds"); |
---|
| 1725 | + |
---|
| 1726 | + objectPanel.add(toolboxPanel); |
---|
| 1727 | + objectPanel.setIconAt(1, GetIcon("icons/primitives.png")); |
---|
| 1728 | + objectPanel.setToolTipTextAt(1, "Objects & textures"); |
---|
| 1729 | + |
---|
1553 | 1730 | objectPanel.add(materialPanel); |
---|
1554 | | - objectPanel.setIconAt(0, GetIcon("icons/material.png")); |
---|
1555 | | - objectPanel.setToolTipTextAt(0, "Material"); |
---|
| 1731 | + objectPanel.setIconAt(2, GetIcon("icons/material.png")); |
---|
| 1732 | + objectPanel.setToolTipTextAt(2, "Material"); |
---|
1556 | 1733 | |
---|
1557 | 1734 | // JPanel north = new JPanel(new BorderLayout()); |
---|
1558 | 1735 | // north.setName("Edit"); |
---|
1559 | 1736 | // north.add(ctrlPanel, BorderLayout.NORTH); |
---|
1560 | 1737 | // objectPanel.add(north); |
---|
1561 | 1738 | objectPanel.add(editPanel); |
---|
1562 | | - objectPanel.setIconAt(1, GetIcon("icons/write.png")); |
---|
1563 | | - objectPanel.setToolTipTextAt(1, "Edit controls"); |
---|
| 1739 | + objectPanel.setIconAt(3, GetIcon("icons/writewhite.png")); |
---|
| 1740 | + objectPanel.setToolTipTextAt(3, "Edit controls"); |
---|
1564 | 1741 | |
---|
1565 | | - //if (Globals.ADVANCED) |
---|
1566 | | - objectPanel.add(infoPanel); |
---|
1567 | | - objectPanel.setIconAt(2, GetIcon("icons/info.png")); |
---|
1568 | | - objectPanel.setToolTipTextAt(2, "Information"); |
---|
| 1742 | + objectPanel.add(transformPanel); |
---|
| 1743 | + objectPanel.setIconAt(4, GetIcon("icons/XYZ.png")); |
---|
| 1744 | + objectPanel.setToolTipTextAt(4, "TRS transform"); |
---|
1569 | 1745 | |
---|
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 | | - |
---|
| 1746 | + patchMaterial = true; |
---|
| 1747 | + cameraView.patchMaterial = this; |
---|
| 1748 | + objectPanel.setSelectedIndex(2); |
---|
| 1749 | + |
---|
1578 | 1750 | /* |
---|
1579 | 1751 | aConstraints.gridx = 0; |
---|
1580 | 1752 | aConstraints.gridwidth = 1; |
---|
.. | .. |
---|
1594 | 1766 | scrollpane.addMouseWheelListener(this); // Default not fast enough |
---|
1595 | 1767 | |
---|
1596 | 1768 | /*JTabbedPane*/ scenePanel = new cGridBag(); |
---|
1597 | | - scenePanel.preferredWidth = 5; |
---|
| 1769 | + scenePanel.preferredWidth = 6; |
---|
1598 | 1770 | |
---|
1599 | 1771 | JTabbedPane tabbedPane = new JTabbedPane(); |
---|
1600 | 1772 | tabbedPane.add(scrollpane); |
---|
.. | .. |
---|
1605 | 1777 | |
---|
1606 | 1778 | AddOptions(optionsPanel); //, aConstraints); |
---|
1607 | 1779 | |
---|
1608 | | - tabbedPane.add(optionsPanel); |
---|
1609 | | - |
---|
1610 | 1780 | tabbedPane.add(FSPane = new cFileSystemPane(this)); |
---|
1611 | 1781 | |
---|
| 1782 | + tabbedPane.add(optionsPanel); |
---|
| 1783 | + |
---|
1612 | 1784 | scenePanel.add(tabbedPane); |
---|
| 1785 | + |
---|
| 1786 | + cGridBag creditsPanel = new cGridBag().setVertical(true); |
---|
| 1787 | + creditsPanel.setName("Credits"); |
---|
| 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 | + } |
---|
1613 | 1825 | |
---|
1614 | 1826 | /* |
---|
1615 | 1827 | cTree jTree = new cTree(null); |
---|
.. | .. |
---|
1631 | 1843 | jtp.add(tree); |
---|
1632 | 1844 | */ |
---|
1633 | 1845 | |
---|
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"); |
---|
| 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"); |
---|
1641 | 1853 | |
---|
1642 | 1854 | //bigPanel.setLayout(new BorderLayout()); |
---|
1643 | 1855 | //bigPanel.setSize(new Dimension(10,10)); |
---|
.. | .. |
---|
1681 | 1893 | // aConstraints.gridheight = 1; |
---|
1682 | 1894 | |
---|
1683 | 1895 | framePanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, toolbarPanel, bigThree); |
---|
| 1896 | + |
---|
| 1897 | + framePanel.addPropertyChangeListener(JSplitPane.DIVIDER_LOCATION_PROPERTY, |
---|
| 1898 | + new java.beans.PropertyChangeListener() |
---|
| 1899 | + { |
---|
| 1900 | + public void propertyChange(java.beans.PropertyChangeEvent pce) |
---|
| 1901 | + { |
---|
| 1902 | + if ((Integer)pce.getOldValue() == 1) |
---|
| 1903 | + { |
---|
| 1904 | + if (radio.layout != expandedLayout) |
---|
| 1905 | + { |
---|
| 1906 | + radio.layout = expandedLayout; |
---|
| 1907 | + radio.layout.doClick(); |
---|
| 1908 | + } |
---|
| 1909 | + } |
---|
| 1910 | + } |
---|
| 1911 | + }); |
---|
| 1912 | + |
---|
1684 | 1913 | framePanel.setContinuousLayout(false); |
---|
1685 | 1914 | framePanel.setOneTouchExpandable(false); |
---|
1686 | 1915 | //.setDividerLocation(0.8); |
---|
.. | .. |
---|
1690 | 1919 | |
---|
1691 | 1920 | frame.getContentPane().setLayout(new BorderLayout()); |
---|
1692 | 1921 | /**/ |
---|
1693 | | - JTabbedPane worldPane = new JTabbedPane(); |
---|
| 1922 | + //JTabbedPane worldPane = new JTabbedPane(); |
---|
1694 | 1923 | //worldPane.add(bigPanel); |
---|
1695 | 1924 | //worldPane.add(worldPanel); |
---|
1696 | 1925 | /**/ |
---|
.. | .. |
---|
1704 | 1933 | |
---|
1705 | 1934 | cameraView.requestFocusInWindow(); |
---|
1706 | 1935 | |
---|
1707 | | - gridPanel.setDividerLocation(1.0); |
---|
| 1936 | +// gridPanel.setDividerLocation(1.0); |
---|
1708 | 1937 | |
---|
1709 | 1938 | frame.validate(); |
---|
1710 | 1939 | |
---|
.. | .. |
---|
1738 | 1967 | void SetupMaterial(cGridBag materialpanel) |
---|
1739 | 1968 | { |
---|
1740 | 1969 | cGridBag presetpanel = new cGridBag().setVertical(true); |
---|
1741 | | - cLabel label = GetLabel("icons/shadericons/shadericon00000.png", !Grafreed.NIMBUSLAF); |
---|
1742 | | - label.addMouseListener(new MouseAdapter() |
---|
| 1970 | + |
---|
| 1971 | + cLabel skin = GetLabel("icons/shadericons/shadericon00000.png", !Globals.NIMBUSLAF); |
---|
| 1972 | + skin.setToolTipText("Skin"); |
---|
| 1973 | + skin.addMouseListener(new MouseAdapter() |
---|
1743 | 1974 | { |
---|
1744 | 1975 | public void mouseClicked(MouseEvent e) |
---|
1745 | 1976 | { |
---|
1746 | | - colorField.setFloat(0); |
---|
1747 | | - saturationField.setFloat(1); |
---|
| 1977 | + Object3D object = Grafreed.materials.versionlist[0].get(0); |
---|
| 1978 | + cMaterial material = object.material; |
---|
| 1979 | + |
---|
| 1980 | + // Skin |
---|
| 1981 | + colorField.setFloat(material.color); |
---|
| 1982 | + float saturation = material.modulation; |
---|
| 1983 | + |
---|
| 1984 | + if (!cameraView.Skinshader) |
---|
| 1985 | + { |
---|
| 1986 | + saturation /= 1.5; |
---|
| 1987 | + } |
---|
| 1988 | + |
---|
| 1989 | + saturationField.setFloat(saturation); |
---|
| 1990 | + |
---|
| 1991 | + subsurfaceField.setFloat(material.subsurface); |
---|
| 1992 | + selfshadowField.setFloat(material.diffuseness); |
---|
| 1993 | + diffusenessField.setFloat(material.factor); |
---|
| 1994 | + shininessField.setFloat(material.shininess); |
---|
| 1995 | + shadowbiasField.setFloat(material.shadowbias); |
---|
| 1996 | + diffuseField.setFloat(material.diffuse); |
---|
| 1997 | + specularField.setFloat(material.specular); |
---|
| 1998 | + |
---|
| 1999 | + bumpField.setFloat(object.projectedVertices[0].x / 1000.0); |
---|
| 2000 | + noiseField.setFloat(object.projectedVertices[0].y / 1000.0); |
---|
| 2001 | + powerField.setFloat(object.projectedVertices[2].x / 1000.0); |
---|
| 2002 | + |
---|
1748 | 2003 | materialtouched = true; |
---|
1749 | 2004 | applySelf(); |
---|
1750 | 2005 | } |
---|
1751 | 2006 | }); |
---|
1752 | | - presetpanel.add(label); |
---|
| 2007 | + presetpanel.add(skin); |
---|
1753 | 2008 | |
---|
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)); |
---|
| 2009 | + cLabel lambert = GetLabel("icons/shadericons/shadericon00002.png", !Globals.NIMBUSLAF); |
---|
| 2010 | + lambert.setToolTipText("Diffuse"); |
---|
| 2011 | + lambert.addMouseListener(new MouseAdapter() |
---|
| 2012 | + { |
---|
| 2013 | + public void mouseClicked(MouseEvent e) |
---|
| 2014 | + { |
---|
| 2015 | + Object3D object = Grafreed.materials.versionlist[2].get(0); |
---|
| 2016 | + cMaterial material = object.material; |
---|
| 2017 | + |
---|
| 2018 | + diffusenessField.setFloat(material.factor); |
---|
| 2019 | + selfshadowField.setFloat(material.diffuseness); |
---|
| 2020 | + |
---|
| 2021 | + materialtouched = true; |
---|
| 2022 | + applySelf(); |
---|
| 2023 | + } |
---|
| 2024 | + }); |
---|
| 2025 | + presetpanel.add(lambert); |
---|
| 2026 | + |
---|
| 2027 | + cLabel diffuse2 = GetLabel("icons/shadericons/shadericon00003.png", !Globals.NIMBUSLAF); |
---|
| 2028 | + diffuse2.setToolTipText("Diffuse2"); |
---|
| 2029 | + diffuse2.addMouseListener(new MouseAdapter() |
---|
| 2030 | + { |
---|
| 2031 | + public void mouseClicked(MouseEvent e) |
---|
| 2032 | + { |
---|
| 2033 | + Object3D object = Grafreed.materials.versionlist[3].get(0); |
---|
| 2034 | + cMaterial material = object.material; |
---|
| 2035 | + |
---|
| 2036 | + diffusenessField.setFloat(material.factor); |
---|
| 2037 | + selfshadowField.setFloat(material.diffuseness); |
---|
| 2038 | + |
---|
| 2039 | + materialtouched = true; |
---|
| 2040 | + applySelf(); |
---|
| 2041 | + } |
---|
| 2042 | + }); |
---|
| 2043 | + presetpanel.add(diffuse2); |
---|
| 2044 | + |
---|
| 2045 | + cLabel diffusemoon = GetLabel("icons/shadericons/shadericon00004.png", !Globals.NIMBUSLAF); |
---|
| 2046 | + diffusemoon.setToolTipText("Moon"); |
---|
| 2047 | + diffusemoon.addMouseListener(new MouseAdapter() |
---|
| 2048 | + { |
---|
| 2049 | + public void mouseClicked(MouseEvent e) |
---|
| 2050 | + { |
---|
| 2051 | + Object3D object = Grafreed.materials.versionlist[4].get(0); |
---|
| 2052 | + cMaterial material = object.material; |
---|
| 2053 | + |
---|
| 2054 | + diffusenessField.setFloat(material.factor); |
---|
| 2055 | + selfshadowField.setFloat(material.diffuseness); |
---|
| 2056 | + |
---|
| 2057 | + materialtouched = true; |
---|
| 2058 | + applySelf(); |
---|
| 2059 | + } |
---|
| 2060 | + }); |
---|
| 2061 | + presetpanel.add(diffusemoon); |
---|
| 2062 | + |
---|
| 2063 | + cLabel diffusemoon2 = GetLabel("icons/shadericons/shadericon00005.png", !Globals.NIMBUSLAF); |
---|
| 2064 | + diffusemoon2.setToolTipText("Moon2"); |
---|
| 2065 | + diffusemoon2.addMouseListener(new MouseAdapter() |
---|
| 2066 | + { |
---|
| 2067 | + public void mouseClicked(MouseEvent e) |
---|
| 2068 | + { |
---|
| 2069 | + Object3D object = Grafreed.materials.versionlist[5].get(0); |
---|
| 2070 | + cMaterial material = object.material; |
---|
| 2071 | + |
---|
| 2072 | + diffusenessField.setFloat(material.factor); |
---|
| 2073 | + selfshadowField.setFloat(material.diffuseness); |
---|
| 2074 | + |
---|
| 2075 | + materialtouched = true; |
---|
| 2076 | + applySelf(); |
---|
| 2077 | + } |
---|
| 2078 | + }); |
---|
| 2079 | + presetpanel.add(diffusemoon2); |
---|
| 2080 | + |
---|
| 2081 | + cLabel diffusemoon3 = GetLabel("icons/shadericons/shadericon00006.png", !Globals.NIMBUSLAF); |
---|
| 2082 | + diffusemoon3.setToolTipText("Moon3"); |
---|
| 2083 | + diffusemoon3.addMouseListener(new MouseAdapter() |
---|
| 2084 | + { |
---|
| 2085 | + public void mouseClicked(MouseEvent e) |
---|
| 2086 | + { |
---|
| 2087 | + Object3D object = Grafreed.materials.versionlist[6].get(0); |
---|
| 2088 | + cMaterial material = object.material; |
---|
| 2089 | + |
---|
| 2090 | + diffusenessField.setFloat(material.factor); |
---|
| 2091 | + selfshadowField.setFloat(material.diffuseness); |
---|
| 2092 | + |
---|
| 2093 | + materialtouched = true; |
---|
| 2094 | + applySelf(); |
---|
| 2095 | + } |
---|
| 2096 | + }); |
---|
| 2097 | + presetpanel.add(diffusemoon3); |
---|
| 2098 | + |
---|
| 2099 | + cLabel diffusesheen = GetLabel("icons/shadericons/shadericon00007.png", !Globals.NIMBUSLAF); |
---|
| 2100 | + diffusesheen.setToolTipText("Sheen"); |
---|
| 2101 | + diffusesheen.addMouseListener(new MouseAdapter() |
---|
| 2102 | + { |
---|
| 2103 | + public void mouseClicked(MouseEvent e) |
---|
| 2104 | + { |
---|
| 2105 | + Object3D object = Grafreed.materials.versionlist[7].get(0); |
---|
| 2106 | + cMaterial material = object.material; |
---|
| 2107 | + |
---|
| 2108 | + sheenField.setFloat(material.sheen); |
---|
| 2109 | + |
---|
| 2110 | + materialtouched = true; |
---|
| 2111 | + applySelf(); |
---|
| 2112 | + } |
---|
| 2113 | + }); |
---|
| 2114 | + presetpanel.add(diffusesheen); |
---|
| 2115 | + |
---|
| 2116 | + cLabel rough = GetLabel("icons/shadericons/shadericon00001.png", !Globals.NIMBUSLAF); |
---|
| 2117 | + rough.setToolTipText("Rough metal"); |
---|
| 2118 | + rough.addMouseListener(new MouseAdapter() |
---|
| 2119 | + { |
---|
| 2120 | + public void mouseClicked(MouseEvent e) |
---|
| 2121 | + { |
---|
| 2122 | + Object3D object = Grafreed.materials.versionlist[1].get(0); |
---|
| 2123 | + cMaterial material = object.material; |
---|
| 2124 | + |
---|
| 2125 | + shininessField.setFloat(material.shininess); |
---|
| 2126 | + velvetField.setFloat(material.velvet); |
---|
| 2127 | + |
---|
| 2128 | + materialtouched = true; |
---|
| 2129 | + applySelf(); |
---|
| 2130 | + } |
---|
| 2131 | + }); |
---|
| 2132 | + presetpanel.add(rough); |
---|
| 2133 | + |
---|
| 2134 | + cLabel rough2 = GetLabel("icons/shadericons/shadericon00013.png", !Globals.NIMBUSLAF); |
---|
| 2135 | + rough2.setToolTipText("Medium metal"); |
---|
| 2136 | + rough2.addMouseListener(new MouseAdapter() |
---|
| 2137 | + { |
---|
| 2138 | + public void mouseClicked(MouseEvent e) |
---|
| 2139 | + { |
---|
| 2140 | + Object3D object = Grafreed.materials.versionlist[13].get(0); |
---|
| 2141 | + cMaterial material = object.material; |
---|
| 2142 | + |
---|
| 2143 | + shininessField.setFloat(material.shininess); |
---|
| 2144 | + lightareaField.setFloat(material.lightarea); |
---|
| 2145 | + |
---|
| 2146 | + materialtouched = true; |
---|
| 2147 | + applySelf(); |
---|
| 2148 | + } |
---|
| 2149 | + }); |
---|
| 2150 | + presetpanel.add(rough2); |
---|
| 2151 | + |
---|
| 2152 | + cLabel shini0 = GetLabel("icons/shadericons/shadericon00014.png", !Globals.NIMBUSLAF); |
---|
| 2153 | + shini0.setToolTipText("Shiny"); |
---|
| 2154 | + shini0.addMouseListener(new MouseAdapter() |
---|
| 2155 | + { |
---|
| 2156 | + public void mouseClicked(MouseEvent e) |
---|
| 2157 | + { |
---|
| 2158 | + Object3D object = Grafreed.materials.versionlist[14].get(0); |
---|
| 2159 | + cMaterial material = object.material; |
---|
| 2160 | + |
---|
| 2161 | + shininessField.setFloat(material.shininess); |
---|
| 2162 | + lightareaField.setFloat(material.lightarea); |
---|
| 2163 | + |
---|
| 2164 | + materialtouched = true; |
---|
| 2165 | + applySelf(); |
---|
| 2166 | + } |
---|
| 2167 | + }); |
---|
| 2168 | + presetpanel.add(shini0); |
---|
| 2169 | + |
---|
| 2170 | + cLabel shini1 = GetLabel("icons/shadericons/shadericon00011.png", !Globals.NIMBUSLAF); |
---|
| 2171 | + shini1.setToolTipText("Shiny2"); |
---|
| 2172 | + shini1.addMouseListener(new MouseAdapter() |
---|
| 2173 | + { |
---|
| 2174 | + public void mouseClicked(MouseEvent e) |
---|
| 2175 | + { |
---|
| 2176 | + Object3D object = Grafreed.materials.versionlist[11].get(0); |
---|
| 2177 | + cMaterial material = object.material; |
---|
| 2178 | + |
---|
| 2179 | + shininessField.setFloat(material.shininess); |
---|
| 2180 | + lightareaField.setFloat(material.lightarea); |
---|
| 2181 | + |
---|
| 2182 | + materialtouched = true; |
---|
| 2183 | + applySelf(); |
---|
| 2184 | + } |
---|
| 2185 | + }); |
---|
| 2186 | + presetpanel.add(shini1); |
---|
| 2187 | + |
---|
| 2188 | + cLabel shini2 = GetLabel("icons/shadericons/shadericon00012.png", !Globals.NIMBUSLAF); |
---|
| 2189 | + shini2.setToolTipText("Shiny3"); |
---|
| 2190 | + shini2.addMouseListener(new MouseAdapter() |
---|
| 2191 | + { |
---|
| 2192 | + public void mouseClicked(MouseEvent e) |
---|
| 2193 | + { |
---|
| 2194 | + Object3D object = Grafreed.materials.versionlist[12].get(0); |
---|
| 2195 | + cMaterial material = object.material; |
---|
| 2196 | + |
---|
| 2197 | + shininessField.setFloat(material.shininess); |
---|
| 2198 | + lightareaField.setFloat(material.lightarea); |
---|
| 2199 | + |
---|
| 2200 | + materialtouched = true; |
---|
| 2201 | + applySelf(); |
---|
| 2202 | + } |
---|
| 2203 | + }); |
---|
| 2204 | + presetpanel.add(shini2); |
---|
| 2205 | + |
---|
| 2206 | + cLabel aniso = GetLabel("icons/shadericons/shadericon00008.png", !Globals.NIMBUSLAF); |
---|
| 2207 | + aniso.setToolTipText("AnisoU"); |
---|
| 2208 | + aniso.addMouseListener(new MouseAdapter() |
---|
| 2209 | + { |
---|
| 2210 | + public void mouseClicked(MouseEvent e) |
---|
| 2211 | + { |
---|
| 2212 | + Object3D object = Grafreed.materials.versionlist[8].get(0); |
---|
| 2213 | + cMaterial material = object.material; |
---|
| 2214 | + |
---|
| 2215 | + anisoField.setFloat(material.aniso); |
---|
| 2216 | + anisoVField.setFloat(material.anisoV); |
---|
| 2217 | + |
---|
| 2218 | + materialtouched = true; |
---|
| 2219 | + applySelf(); |
---|
| 2220 | + } |
---|
| 2221 | + }); |
---|
| 2222 | + presetpanel.add(aniso); |
---|
| 2223 | + |
---|
| 2224 | + cLabel aniso2 = GetLabel("icons/shadericons/shadericon00009.png", !Globals.NIMBUSLAF); |
---|
| 2225 | + aniso2.setToolTipText("AnisoV"); |
---|
| 2226 | + aniso2.addMouseListener(new MouseAdapter() |
---|
| 2227 | + { |
---|
| 2228 | + public void mouseClicked(MouseEvent e) |
---|
| 2229 | + { |
---|
| 2230 | + Object3D object = Grafreed.materials.versionlist[9].get(0); |
---|
| 2231 | + cMaterial material = object.material; |
---|
| 2232 | + |
---|
| 2233 | + anisoField.setFloat(material.aniso); |
---|
| 2234 | + anisoVField.setFloat(material.anisoV); |
---|
| 2235 | + |
---|
| 2236 | + materialtouched = true; |
---|
| 2237 | + applySelf(); |
---|
| 2238 | + } |
---|
| 2239 | + }); |
---|
| 2240 | + presetpanel.add(aniso2); |
---|
| 2241 | + |
---|
| 2242 | + cLabel aniso3 = GetLabel("icons/shadericons/shadericon00010.png", !Globals.NIMBUSLAF); |
---|
| 2243 | + aniso3.setToolTipText("AnisoUV"); |
---|
| 2244 | + aniso3.addMouseListener(new MouseAdapter() |
---|
| 2245 | + { |
---|
| 2246 | + public void mouseClicked(MouseEvent e) |
---|
| 2247 | + { |
---|
| 2248 | + Object3D object = Grafreed.materials.versionlist[10].get(0); |
---|
| 2249 | + cMaterial material = object.material; |
---|
| 2250 | + |
---|
| 2251 | + anisoField.setFloat(material.aniso); |
---|
| 2252 | + anisoVField.setFloat(material.anisoV); |
---|
| 2253 | + |
---|
| 2254 | + materialtouched = true; |
---|
| 2255 | + applySelf(); |
---|
| 2256 | + } |
---|
| 2257 | + }); |
---|
| 2258 | + presetpanel.add(aniso3); |
---|
| 2259 | + |
---|
| 2260 | + cLabel velvet0 = GetLabel("icons/shadericons/shadericon00015.png", !Globals.NIMBUSLAF); |
---|
| 2261 | + velvet0.setToolTipText("Velvet"); |
---|
| 2262 | + velvet0.addMouseListener(new MouseAdapter() |
---|
| 2263 | + { |
---|
| 2264 | + public void mouseClicked(MouseEvent e) |
---|
| 2265 | + { |
---|
| 2266 | + Object3D object = Grafreed.materials.versionlist[15].get(0); |
---|
| 2267 | + cMaterial material = object.material; |
---|
| 2268 | + |
---|
| 2269 | + diffusenessField.setFloat(material.factor); |
---|
| 2270 | + selfshadowField.setFloat(material.diffuseness); |
---|
| 2271 | + sheenField.setFloat(material.sheen); |
---|
| 2272 | + shininessField.setFloat(material.shininess); |
---|
| 2273 | + velvetField.setFloat(material.velvet); |
---|
| 2274 | + shiftField.setFloat(material.shift); |
---|
| 2275 | + |
---|
| 2276 | + materialtouched = true; |
---|
| 2277 | + applySelf(); |
---|
| 2278 | + } |
---|
| 2279 | + }); |
---|
| 2280 | + presetpanel.add(velvet0); |
---|
| 2281 | + |
---|
| 2282 | + cLabel bump0 = GetLabel("icons/shadericons/shadericon00016.png", !Globals.NIMBUSLAF); |
---|
| 2283 | + bump0.setToolTipText("Bump texture"); |
---|
| 2284 | + bump0.addMouseListener(new MouseAdapter() |
---|
| 2285 | + { |
---|
| 2286 | + public void mouseClicked(MouseEvent e) |
---|
| 2287 | + { |
---|
| 2288 | + Object3D object = Grafreed.materials.versionlist[16].get(0); |
---|
| 2289 | + cMaterial material = object.material; |
---|
| 2290 | + |
---|
| 2291 | + bumpField.setFloat(object.projectedVertices[0].x / 1000.0); |
---|
| 2292 | + noiseField.setFloat(object.projectedVertices[0].y / 1000.0); |
---|
| 2293 | + powerField.setFloat(object.projectedVertices[2].x / 1000.0); |
---|
| 2294 | + |
---|
| 2295 | + materialtouched = true; |
---|
| 2296 | + applySelf(); |
---|
| 2297 | + } |
---|
| 2298 | + }); |
---|
| 2299 | + presetpanel.add(bump0); |
---|
| 2300 | + |
---|
| 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); |
---|
| 2317 | + halo.setToolTipText("Halo"); |
---|
| 2318 | + halo.addMouseListener(new MouseAdapter() |
---|
| 2319 | + { |
---|
| 2320 | + public void mouseClicked(MouseEvent e) |
---|
| 2321 | + { |
---|
| 2322 | + Object3D object = Grafreed.materials.versionlist[17].get(0); |
---|
| 2323 | + cMaterial material = object.material; |
---|
| 2324 | + |
---|
| 2325 | + opacityPowerField.setFloat(object.projectedVertices[2].y / 1000.0); |
---|
| 2326 | + |
---|
| 2327 | + materialtouched = true; |
---|
| 2328 | + applySelf(); |
---|
| 2329 | + } |
---|
| 2330 | + }); |
---|
| 2331 | + presetpanel.add(halo); |
---|
| 2332 | + |
---|
| 2333 | + cLabel candle = GetLabel("icons/shadericons/shadericon00018.png", !Globals.NIMBUSLAF); |
---|
| 2334 | + candle.setToolTipText("Candle"); |
---|
| 2335 | + candle.addMouseListener(new MouseAdapter() |
---|
| 2336 | + { |
---|
| 2337 | + public void mouseClicked(MouseEvent e) |
---|
| 2338 | + { |
---|
| 2339 | + Object3D object = Grafreed.materials.versionlist[18].get(0); |
---|
| 2340 | + cMaterial material = object.material; |
---|
| 2341 | + |
---|
| 2342 | + subsurfaceField.setFloat(material.subsurface); |
---|
| 2343 | + shadowbiasField.setFloat(material.shadowbias); |
---|
| 2344 | + ambientField.setFloat(material.ambient); |
---|
| 2345 | + specularField.setFloat(material.specular); |
---|
| 2346 | + lightareaField.setFloat(material.lightarea); |
---|
| 2347 | + shininessField.setFloat(material.shininess); |
---|
| 2348 | + |
---|
| 2349 | + materialtouched = true; |
---|
| 2350 | + applySelf(); |
---|
| 2351 | + } |
---|
| 2352 | + }); |
---|
| 2353 | + presetpanel.add(candle); |
---|
| 2354 | + |
---|
| 2355 | + cLabel shadowShader = GetLabel("icons/shadericons/shadow.png", !Globals.NIMBUSLAF); |
---|
| 2356 | + shadowShader.setToolTipText("Shadow"); |
---|
| 2357 | + shadowShader.addMouseListener(new MouseAdapter() |
---|
| 2358 | + { |
---|
| 2359 | + public void mouseClicked(MouseEvent e) |
---|
| 2360 | + { |
---|
| 2361 | + diffuseField.setFloat(0.001); |
---|
| 2362 | + ambientField.setFloat(0.001); |
---|
| 2363 | + cameraField.setFloat(0.001); |
---|
| 2364 | + specularField.setFloat(0.001); |
---|
| 2365 | + fakedepthField.setFloat(0.001); |
---|
| 2366 | + opacityField.setFloat(0.6); |
---|
| 2367 | + |
---|
| 2368 | + materialtouched = true; |
---|
| 2369 | + applySelf(); |
---|
| 2370 | + } |
---|
| 2371 | + }); |
---|
| 2372 | + presetpanel.add(shadowShader); |
---|
1774 | 2373 | |
---|
1775 | 2374 | cGridBag panel = new cGridBag().setVertical(true); |
---|
1776 | 2375 | |
---|
1777 | 2376 | presetpanel.preferredWidth = 1; |
---|
1778 | 2377 | |
---|
1779 | | - materialpanel.add(panel); |
---|
1780 | 2378 | materialpanel.add(presetpanel); |
---|
| 2379 | + materialpanel.add(panel); |
---|
1781 | 2380 | |
---|
1782 | 2381 | panel.preferredWidth = 8; |
---|
1783 | 2382 | |
---|
.. | .. |
---|
1788 | 2387 | |
---|
1789 | 2388 | cGridBag editBar = new cGridBag().setVertical(false); |
---|
1790 | 2389 | |
---|
1791 | | - editBar.add(createMaterialButton = new cButton("Create", !Grafreed.NIMBUSLAF)); // , aConstraints); |
---|
| 2390 | + editBar.add(createMaterialButton = new cButton("Create", !Globals.NIMBUSLAF)); // , aConstraints); |
---|
1792 | 2391 | createMaterialButton.setToolTipText("Create material"); |
---|
1793 | 2392 | |
---|
1794 | 2393 | /* |
---|
1795 | 2394 | ctrlPanel.add(resetSlidersButton = new cButton("Reset All"), aConstraints); |
---|
1796 | 2395 | */ |
---|
1797 | 2396 | |
---|
1798 | | - editBar.add(clearMaterialButton = new cButton("Clear", !Grafreed.NIMBUSLAF)); // , aConstraints); |
---|
| 2397 | + editBar.add(clearMaterialButton = new cButton("Clear", !Globals.NIMBUSLAF)); // , aConstraints); |
---|
1799 | 2398 | clearMaterialButton.setToolTipText("Clear material"); |
---|
1800 | 2399 | |
---|
1801 | 2400 | if (Globals.ADVANCED) |
---|
1802 | 2401 | { |
---|
1803 | | - editBar.add(resetSlidersButton = new cButton("Reset", !Grafreed.NIMBUSLAF)); // , aConstraints); |
---|
| 2402 | + editBar.add(resetSlidersButton = new cButton("Reset", !Globals.NIMBUSLAF)); // , aConstraints); |
---|
1804 | 2403 | editBar.add(propagateToggle = new cCheckBox("Prop", propagate)); // , aConstraints); |
---|
1805 | 2404 | editBar.add(multiplyToggle = new cCheckBox("Mult", false)); // , aConstraints); |
---|
1806 | 2405 | } |
---|
.. | .. |
---|
1821 | 2420 | |
---|
1822 | 2421 | cGridBag huepanel = new cGridBag(); |
---|
1823 | 2422 | cGridBag huelabel = new cGridBag(); |
---|
1824 | | - label = GetLabel("icons/hue.png", false); |
---|
1825 | | - label.fit = true; |
---|
1826 | | - huelabel.add(label); |
---|
| 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); |
---|
1827 | 2437 | huelabel.preferredWidth = 20; |
---|
1828 | 2438 | huepanel.add(new cGridBag()); // Label |
---|
1829 | 2439 | huepanel.add(huelabel); // Field/slider |
---|
.. | .. |
---|
3099 | 3709 | |
---|
3100 | 3710 | if (multiplyToggle != null) |
---|
3101 | 3711 | 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 | | - } |
---|
| 3712 | + |
---|
| 3713 | + AllocProjectedVertices(object); |
---|
3128 | 3714 | |
---|
3129 | 3715 | SetMaterial(mat, object.projectedVertices); |
---|
3130 | 3716 | } |
---|
.. | .. |
---|
3244 | 3830 | public void itemStateChanged(ItemEvent event) |
---|
3245 | 3831 | { |
---|
3246 | 3832 | // System.out.println("Propagate = " + propagate); |
---|
| 3833 | + if (event.getSource() == pinButton) |
---|
| 3834 | + { |
---|
| 3835 | + copy.pinned ^= true; |
---|
| 3836 | + if (!copy.pinned && !copy.editWindow.copy.selection.contains(copy)) |
---|
| 3837 | + { |
---|
| 3838 | + ((GroupEditor)copy.editWindow).listUI.remove(copy); |
---|
| 3839 | + copy.CloseUI(); |
---|
| 3840 | + //copy.editWindow.refreshContents(); |
---|
| 3841 | + } |
---|
| 3842 | + } |
---|
| 3843 | + else |
---|
3247 | 3844 | if (event.getSource() == propagateToggle) |
---|
3248 | 3845 | { |
---|
3249 | 3846 | propagate ^= true; |
---|
.. | .. |
---|
3423 | 4020 | //System.out.println("ObjEditor " + event); |
---|
3424 | 4021 | applySelf0(true); |
---|
3425 | 4022 | //parent.applySelf(); |
---|
3426 | | - objEditor.refreshContents(); |
---|
| 4023 | + // conflicts with requestFocus objEditor.refreshContents(); |
---|
3427 | 4024 | } else if (source == resetButton) |
---|
3428 | 4025 | { |
---|
3429 | 4026 | CameraPane.fullreset = true; |
---|
.. | .. |
---|
3603 | 4200 | |
---|
3604 | 4201 | void New() |
---|
3605 | 4202 | { |
---|
3606 | | - while (copy.Size() > 1) |
---|
| 4203 | + while (copy.Size() > 0) |
---|
3607 | 4204 | { |
---|
3608 | | - copy.remove(1); |
---|
| 4205 | + copy.remove(0); |
---|
3609 | 4206 | } |
---|
3610 | 4207 | |
---|
| 4208 | + copy.selection.clear(); |
---|
| 4209 | + |
---|
| 4210 | + if (copy == Grafreed.grafreed.universe) |
---|
| 4211 | + { |
---|
| 4212 | + CreateCameras(); |
---|
| 4213 | + cameraView.SetCamera(GetCamera(copy, 0)); |
---|
| 4214 | + } |
---|
3611 | 4215 | ResetModel(); |
---|
3612 | 4216 | objEditor.refreshContents(); |
---|
3613 | 4217 | } |
---|
.. | .. |
---|
3716 | 4320 | { |
---|
3717 | 4321 | //Save(true); |
---|
3718 | 4322 | Replace(); |
---|
3719 | | - SetUndoStates(); |
---|
| 4323 | + SetVersionStates(); |
---|
3720 | 4324 | } |
---|
3721 | 4325 | |
---|
3722 | 4326 | private boolean Equal(byte[] compress, byte[] name) |
---|
.. | .. |
---|
3735 | 4339 | return true; |
---|
3736 | 4340 | } |
---|
3737 | 4341 | |
---|
3738 | | - java.util.Hashtable<java.util.UUID, Object3D> versiontable = new java.util.Hashtable<java.util.UUID, Object3D>(); |
---|
| 4342 | + void DeleteVersion() |
---|
| 4343 | + { |
---|
| 4344 | + for (int i = copy.versionindex; i < copy.versionlist.length-1; i++) |
---|
| 4345 | + { |
---|
| 4346 | + copy.versionlist[i] = copy.versionlist[i+1]; |
---|
| 4347 | + } |
---|
| 4348 | + |
---|
| 4349 | + if (copy.versionlist[copy.versionindex] == null) |
---|
| 4350 | + copy.versionindex -= 1; |
---|
| 4351 | + |
---|
| 4352 | + if (copy.versionindex != -1) |
---|
| 4353 | + CopyChanged(); |
---|
| 4354 | + |
---|
| 4355 | + SetVersionStates(); |
---|
| 4356 | + } |
---|
3739 | 4357 | |
---|
3740 | 4358 | public boolean Save(boolean user) |
---|
3741 | 4359 | { |
---|
3742 | 4360 | System.err.println("Save"); |
---|
3743 | 4361 | Replace(); |
---|
3744 | 4362 | |
---|
3745 | | - cRadio tab = GetCurrentTab(); |
---|
| 4363 | + //cRadio tab = GetCurrentTab(); |
---|
3746 | 4364 | |
---|
3747 | | - Object3D compress = CompressCopy(); // Saved version. No need for "Replace". |
---|
| 4365 | + Object3D compress = Duplicate(copy); // Saved version. No need for "Replace"? |
---|
3748 | 4366 | |
---|
3749 | 4367 | boolean thesame = false; |
---|
3750 | 4368 | |
---|
.. | .. |
---|
3756 | 4374 | //EditorFrame.m_MainFrame.requestFocusInWindow(); |
---|
3757 | 4375 | if (!thesame) |
---|
3758 | 4376 | { |
---|
| 4377 | + for (int i = copy.versionlist.length; --i > copy.versionindex+1;) |
---|
| 4378 | + { |
---|
| 4379 | + copy.versionlist[i] = copy.versionlist[i-1]; |
---|
| 4380 | + } |
---|
| 4381 | + |
---|
3759 | 4382 | //tab.user[tab.versionindex] = user; |
---|
3760 | 4383 | //boolean increment = true; // tab.graphs[tab.versionindex] == null; |
---|
3761 | 4384 | |
---|
.. | .. |
---|
3769 | 4392 | |
---|
3770 | 4393 | //assert(hashtable.isEmpty()); |
---|
3771 | 4394 | |
---|
3772 | | - for (int i = copy.versionindex+1; i < copy.versionlist.length; i++) |
---|
3773 | | - { |
---|
3774 | | - //tab.user[i] = false; |
---|
3775 | | - copy.versionlist[i] = null; |
---|
3776 | | - } |
---|
| 4395 | +// for (int i = copy.versionindex+1; i < copy.versionlist.length; i++) |
---|
| 4396 | +// { |
---|
| 4397 | +// //tab.user[i] = false; |
---|
| 4398 | +// copy.versionlist[i] = null; |
---|
| 4399 | +// } |
---|
3777 | 4400 | |
---|
3778 | | - SetUndoStates(); |
---|
| 4401 | + SetVersionStates(); |
---|
3779 | 4402 | |
---|
3780 | 4403 | // test save |
---|
3781 | 4404 | if (false) |
---|
.. | .. |
---|
3828 | 4451 | GetTree().addSelectionPath(selection.elementAt(i).GetTreePath().GetTreePath()); |
---|
3829 | 4452 | flashIt = true; |
---|
3830 | 4453 | |
---|
3831 | | - refreshContents(false); |
---|
| 4454 | + //refreshContents(false); |
---|
3832 | 4455 | } |
---|
3833 | 4456 | |
---|
3834 | | - void CopyChanged(Object3D obj) |
---|
| 4457 | + void CopyChanged() |
---|
3835 | 4458 | { |
---|
3836 | | - SetUndoStates(); |
---|
| 4459 | + Object3D obj = (Object3D)Grafreed.clone(copy.versionlist[copy.versionindex]); |
---|
| 4460 | + |
---|
| 4461 | + SetVersionStates(); |
---|
3837 | 4462 | |
---|
3838 | 4463 | boolean temp = CameraPane.SWITCH; |
---|
3839 | 4464 | CameraPane.SWITCH = false; |
---|
3840 | 4465 | |
---|
3841 | | - copy.ExtractBigData(versiontable); |
---|
| 4466 | + copy.ExtractBigData(Grafreed.grafreed.universe.versiontable); |
---|
3842 | 4467 | |
---|
3843 | 4468 | copy.clear(); |
---|
3844 | 4469 | |
---|
.. | .. |
---|
3850 | 4475 | copy.add(obj.get(i)); |
---|
3851 | 4476 | } |
---|
3852 | 4477 | |
---|
3853 | | - copy.RestoreBigData(versiontable); |
---|
| 4478 | + copy.RestoreBigData(Grafreed.grafreed.universe.versiontable); |
---|
3854 | 4479 | |
---|
3855 | 4480 | CameraPane.SWITCH = temp; |
---|
3856 | 4481 | |
---|
.. | .. |
---|
3875 | 4500 | } |
---|
3876 | 4501 | } |
---|
3877 | 4502 | |
---|
3878 | | - refreshContents(); |
---|
| 4503 | + refreshContents(true); |
---|
3879 | 4504 | } |
---|
3880 | 4505 | |
---|
3881 | | - cButton undoButton; |
---|
| 4506 | + cButton previousVersionButton; |
---|
3882 | 4507 | cButton restoreButton; |
---|
3883 | 4508 | cButton replaceButton; |
---|
3884 | | - cButton redoButton; |
---|
| 4509 | + cButton nextVersionButton; |
---|
| 4510 | + cButton saveVersionButton; |
---|
| 4511 | + cButton deleteVersionButton; |
---|
3885 | 4512 | |
---|
3886 | 4513 | boolean muteSlider; |
---|
3887 | 4514 | |
---|
.. | .. |
---|
3898 | 4525 | return count; |
---|
3899 | 4526 | } |
---|
3900 | 4527 | |
---|
3901 | | - void SetUndoStates() |
---|
| 4528 | + public cGridBag versionSliderPane; |
---|
| 4529 | + |
---|
| 4530 | + void SetVersionStates() |
---|
3902 | 4531 | { |
---|
3903 | | - cRadio tab = GetCurrentTab(); |
---|
| 4532 | + //if (true) |
---|
| 4533 | + // return; |
---|
| 4534 | + |
---|
| 4535 | + //cRadio tab = GetCurrentTab(); |
---|
3904 | 4536 | |
---|
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; |
---|
| 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 | + } |
---|
3915 | 4567 | } |
---|
3916 | 4568 | |
---|
3917 | | - public boolean Undo() |
---|
| 4569 | + public boolean PreviousVersion() |
---|
3918 | 4570 | { |
---|
3919 | 4571 | // Option? |
---|
3920 | 4572 | Replace(); |
---|
3921 | 4573 | |
---|
3922 | 4574 | System.err.println("Undo"); |
---|
3923 | 4575 | |
---|
3924 | | - cRadio tab = GetCurrentTab(); |
---|
| 4576 | + //cRadio tab = GetCurrentTab(); |
---|
3925 | 4577 | |
---|
3926 | 4578 | if (copy.versionindex == 0) |
---|
3927 | 4579 | { |
---|
.. | .. |
---|
3944 | 4596 | |
---|
3945 | 4597 | copy.versionindex -= 1; |
---|
3946 | 4598 | |
---|
3947 | | - CopyChanged((Object3D)copy.versionlist[copy.versionindex]); |
---|
| 4599 | + CopyChanged(); |
---|
3948 | 4600 | |
---|
3949 | 4601 | return true; |
---|
3950 | 4602 | } |
---|
.. | .. |
---|
3953 | 4605 | { |
---|
3954 | 4606 | System.err.println("Restore"); |
---|
3955 | 4607 | |
---|
3956 | | - cRadio tab = GetCurrentTab(); |
---|
| 4608 | + //cRadio tab = GetCurrentTab(); |
---|
3957 | 4609 | |
---|
3958 | 4610 | if (copy.versionindex == -1 || copy.versionlist[copy.versionindex] == null) |
---|
3959 | 4611 | { |
---|
.. | .. |
---|
3962 | 4614 | } |
---|
3963 | 4615 | |
---|
3964 | 4616 | //CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex])); |
---|
3965 | | - CopyChanged(copy.versionlist[copy.versionindex]); |
---|
| 4617 | + CopyChanged(); |
---|
3966 | 4618 | |
---|
3967 | 4619 | return true; |
---|
3968 | 4620 | } |
---|
3969 | 4621 | |
---|
3970 | 4622 | public boolean Replace() |
---|
3971 | 4623 | { |
---|
3972 | | - System.err.println("Replace"); |
---|
| 4624 | + //System.err.println("Replace"); |
---|
3973 | 4625 | |
---|
3974 | | - cRadio tab = GetCurrentTab(); |
---|
| 4626 | + //cRadio tab = GetCurrentTab(); |
---|
3975 | 4627 | |
---|
3976 | 4628 | if (copy.versionindex == -1 || copy.versionlist[copy.versionindex] == null) |
---|
3977 | 4629 | { |
---|
.. | .. |
---|
3979 | 4631 | return false; |
---|
3980 | 4632 | } |
---|
3981 | 4633 | |
---|
3982 | | - copy.versionlist[copy.versionindex] = CompressCopy(); |
---|
| 4634 | + copy.versionlist[copy.versionindex] = Duplicate(copy); |
---|
3983 | 4635 | |
---|
3984 | 4636 | return true; |
---|
3985 | 4637 | } |
---|
3986 | 4638 | |
---|
3987 | | - public void Redo() |
---|
| 4639 | + public void NextVersion() |
---|
3988 | 4640 | { |
---|
3989 | 4641 | // Option? |
---|
3990 | 4642 | Replace(); |
---|
3991 | 4643 | |
---|
3992 | | - cRadio tab = GetCurrentTab(); |
---|
| 4644 | + //cRadio tab = GetCurrentTab(); |
---|
3993 | 4645 | |
---|
3994 | 4646 | if (copy.versionlist[copy.versionindex + 1] == null) |
---|
3995 | 4647 | { |
---|
.. | .. |
---|
3999 | 4651 | |
---|
4000 | 4652 | copy.versionindex += 1; |
---|
4001 | 4653 | |
---|
4002 | | - CopyChanged(copy.versionlist[copy.versionindex]); |
---|
| 4654 | + CopyChanged(); |
---|
4003 | 4655 | |
---|
4004 | 4656 | //if (!tab.user[tab.versionindex]) |
---|
4005 | 4657 | // tab.graphs[tab.versionindex] = null; |
---|
.. | .. |
---|
4196 | 4848 | // else |
---|
4197 | 4849 | // applySelf(true); |
---|
4198 | 4850 | // } |
---|
| 4851 | + |
---|
| 4852 | + boolean Equal(double a, double b) |
---|
| 4853 | + { |
---|
| 4854 | + return Math.abs(a - b) < 0.001; |
---|
| 4855 | + } |
---|
| 4856 | + |
---|
4199 | 4857 | void applySelf0(boolean name) |
---|
4200 | 4858 | { |
---|
4201 | 4859 | if (name) |
---|
.. | .. |
---|
4245 | 4903 | { |
---|
4246 | 4904 | cMaterial mat = copy.material; |
---|
4247 | 4905 | |
---|
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)); |
---|
| 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)); |
---|
4271 | 4952 | } |
---|
4272 | 4953 | |
---|
4273 | 4954 | if (copy.material != null && copy.projectedVertices.length > 0 && copy.projectedVertices[0] != null) |
---|
.. | .. |
---|
4302 | 4983 | |
---|
4303 | 4984 | public void stateChanged(ChangeEvent e) |
---|
4304 | 4985 | { |
---|
4305 | | - // assert(false); |
---|
| 4986 | + // assert(false); |
---|
4306 | 4987 | if (e.getSource() == versionSlider) |
---|
4307 | 4988 | { |
---|
4308 | 4989 | if (muteSlider) |
---|
4309 | 4990 | return; |
---|
4310 | 4991 | |
---|
| 4992 | + Replace(); |
---|
| 4993 | + |
---|
4311 | 4994 | int version = versionSlider.getInteger(); |
---|
4312 | 4995 | |
---|
4313 | | - if (copy.versionlist[version] != null) |
---|
| 4996 | + if (version != -1 && copy.versionlist[version] != null) |
---|
4314 | 4997 | { |
---|
4315 | | - CopyChanged(copy.versionlist[copy.versionindex = version]); |
---|
| 4998 | + copy.versionindex = version; |
---|
| 4999 | + CopyChanged(); |
---|
4316 | 5000 | } |
---|
4317 | 5001 | |
---|
4318 | 5002 | return; |
---|
.. | .. |
---|
4353 | 5037 | //System.out.println("stateChanged = " + this); |
---|
4354 | 5038 | materialtouched = true; |
---|
4355 | 5039 | |
---|
4356 | | - if (e.getSource() == colorField && saturationField.getFloat() == 0.001) |
---|
| 5040 | + if (Globals.AUTOSATURATE && e.getSource() == colorField && saturationField.getFloat() == 0.001) |
---|
4357 | 5041 | { |
---|
4358 | 5042 | saturationField.setFloat(1); |
---|
4359 | 5043 | } |
---|
.. | .. |
---|
4666 | 5350 | ctrlPanel.validate(); // ? new |
---|
4667 | 5351 | ctrlPanel.repaint(); |
---|
4668 | 5352 | } |
---|
| 5353 | + |
---|
| 5354 | + if (previousVersionButton != null && copy.versionlist != null) |
---|
| 5355 | + SetVersionStates(); |
---|
| 5356 | + |
---|
| 5357 | + cameraView.requestFocusInWindow(); |
---|
4669 | 5358 | } |
---|
4670 | 5359 | |
---|
4671 | 5360 | static TweenManager tweenManager = new TweenManager(); |
---|
.. | .. |
---|
4697 | 5386 | // group = (Composite) group.get(0); |
---|
4698 | 5387 | // } |
---|
4699 | 5388 | |
---|
4700 | | - System.out.println("makeSomething of " + thing); |
---|
| 5389 | + //System.out.println("makeSomething of " + thing); |
---|
4701 | 5390 | |
---|
4702 | 5391 | /* |
---|
4703 | 5392 | if (deselect && jList != null) |
---|
.. | .. |
---|
5051 | 5740 | |
---|
5052 | 5741 | copy.versionlist = readobj.versionlist; |
---|
5053 | 5742 | copy.versionindex = readobj.versionindex; |
---|
| 5743 | + copy.versiontable = readobj.versiontable; |
---|
5054 | 5744 | |
---|
5055 | 5745 | if (copy.versionlist == null) |
---|
5056 | 5746 | { |
---|
| 5747 | + // Backward compatibility |
---|
5057 | 5748 | copy.versionlist = new Object3D[100]; |
---|
5058 | 5749 | copy.versionindex = -1; |
---|
| 5750 | + |
---|
| 5751 | + //Save(true); |
---|
5059 | 5752 | } |
---|
5060 | 5753 | |
---|
5061 | 5754 | //? SetUndoStates(); |
---|
.. | .. |
---|
5070 | 5763 | { |
---|
5071 | 5764 | if (Grafreed.standAlone) |
---|
5072 | 5765 | { |
---|
5073 | | - FileDialog browser = new FileDialog(frame, "Load", FileDialog.LOAD); |
---|
| 5766 | + FileDialog browser = new FileDialog(frame, "Open", FileDialog.LOAD); |
---|
5074 | 5767 | browser.show(); |
---|
5075 | 5768 | String filename = browser.getFile(); |
---|
5076 | 5769 | if (filename != null && filename.length() > 0) |
---|
.. | .. |
---|
5147 | 5840 | |
---|
5148 | 5841 | void save() |
---|
5149 | 5842 | { |
---|
| 5843 | + Replace(); |
---|
| 5844 | + |
---|
5150 | 5845 | if (lastname == null) |
---|
5151 | 5846 | { |
---|
5152 | 5847 | return; |
---|
.. | .. |
---|
5389 | 6084 | ButtonGroup buttonGroup; |
---|
5390 | 6085 | |
---|
5391 | 6086 | cGridBag toolboxPanel; |
---|
| 6087 | + cGridBag skyboxPanel; |
---|
5392 | 6088 | cGridBag materialPanel; |
---|
5393 | 6089 | cGridBag ctrlPanel; |
---|
5394 | 6090 | |
---|
.. | .. |
---|
5400 | 6096 | boolean materialFlushed; |
---|
5401 | 6097 | Object3D latestObject; |
---|
5402 | 6098 | |
---|
| 6099 | + cGridBag transformPanel; |
---|
5403 | 6100 | cGridBag XYZPanel; |
---|
5404 | 6101 | |
---|
5405 | 6102 | JSplitPane gridPanel; |
---|
.. | .. |
---|
5493 | 6190 | cNumberSlider anisoField; |
---|
5494 | 6191 | JLabel anisoVLabel; |
---|
5495 | 6192 | cNumberSlider anisoVField; |
---|
| 6193 | + |
---|
5496 | 6194 | JLabel cameraLabel; |
---|
5497 | 6195 | cNumberSlider cameraField; |
---|
5498 | 6196 | JLabel selfshadowLabel; |
---|
.. | .. |
---|
5507 | 6205 | cNumberSlider fakedepthField; |
---|
5508 | 6206 | JLabel shadowbiasLabel; |
---|
5509 | 6207 | cNumberSlider shadowbiasField; |
---|
| 6208 | + |
---|
5510 | 6209 | JLabel bumpLabel; |
---|
5511 | 6210 | cNumberSlider bumpField; |
---|
5512 | 6211 | JLabel noiseLabel; |
---|