.. | .. |
---|
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)); |
---|
82 | | - |
---|
| 137 | + BufferedImage image; |
---|
| 138 | + |
---|
| 139 | + if (name.endsWith("jpg")) |
---|
| 140 | + // Much faster! |
---|
| 141 | + image = new sun.awt.image.codec.JPEGImageDecoderImpl(ObjEditor.class.getClassLoader().getResourceAsStream(name)).decodeAsBufferedImage(); |
---|
| 142 | + else |
---|
| 143 | + image = javax.imageio.ImageIO.read(ObjEditor.class.getClassLoader().getResourceAsStream(name)); |
---|
| 144 | + |
---|
83 | 145 | // if (image.getWidth() > 48 && image.getHeight() > 48) |
---|
84 | 146 | // { |
---|
85 | 147 | // BufferedImage resized = new BufferedImage(48, 48, image.getType()); |
---|
.. | .. |
---|
93 | 155 | // } |
---|
94 | 156 | |
---|
95 | 157 | javax.swing.ImageIcon icon = new javax.swing.ImageIcon(image); |
---|
| 158 | + |
---|
| 159 | + icons.put(name, icon); |
---|
| 160 | + |
---|
96 | 161 | return icon; |
---|
97 | 162 | } |
---|
98 | 163 | catch (Exception e) |
---|
99 | 164 | { |
---|
| 165 | + //icons.put(name, null); |
---|
100 | 166 | return null; |
---|
101 | 167 | } |
---|
102 | 168 | } |
---|
.. | .. |
---|
296 | 362 | client = inClient; |
---|
297 | 363 | copy = client; |
---|
298 | 364 | |
---|
299 | | - if (copy.versionlist == null) |
---|
300 | | - { |
---|
301 | | - copy.versionlist = new Object3D[100]; |
---|
302 | | - copy.versionindex = -1; |
---|
303 | | - } |
---|
| 365 | +// if (copy.versionlist == null) |
---|
| 366 | +// { |
---|
| 367 | +// copy.versionlist = new Object3D[100]; |
---|
| 368 | +// copy.versionindex = -1; |
---|
| 369 | +// |
---|
| 370 | +// callee.Save(true); |
---|
| 371 | +// } |
---|
304 | 372 | |
---|
305 | 373 | // "this" is not called: SetupUI2(objEditor); |
---|
306 | 374 | } |
---|
.. | .. |
---|
315 | 383 | client = inClient; |
---|
316 | 384 | copy = client; |
---|
317 | 385 | |
---|
318 | | - if (copy.versionlist == null) |
---|
319 | | - { |
---|
320 | | - copy.versionlist = new Object3D[100]; |
---|
321 | | - copy.versionindex = -1; |
---|
322 | | - } |
---|
323 | | - |
---|
324 | 386 | SetupUI2(callee.GetEditor()); |
---|
325 | 387 | } |
---|
326 | 388 | |
---|
.. | .. |
---|
342 | 404 | //parent = p; |
---|
343 | 405 | |
---|
344 | 406 | GraphicsDevice gd = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice(); |
---|
345 | | - System.out.println("getFullScreenWindow? " + gd.getFullScreenWindow()); |
---|
| 407 | + if (Globals.DEBUG) |
---|
| 408 | + System.out.println("getFullScreenWindow? " + gd.getFullScreenWindow()); |
---|
346 | 409 | //gd.setFullScreenWindow(this); |
---|
347 | 410 | //setResizable(false); |
---|
348 | 411 | //if (!isDisplayable()) |
---|
.. | .. |
---|
353 | 416 | copy = localCopy; |
---|
354 | 417 | copy.editWindow = this; |
---|
355 | 418 | |
---|
356 | | - if (copy.versionlist == null) |
---|
357 | | - { |
---|
358 | | -// copy.versions = new byte[100][]; |
---|
| 419 | +// if (copy.versionlist == null) |
---|
| 420 | +// { |
---|
| 421 | +// copy.versionlist = new Object3D[100]; |
---|
359 | 422 | // copy.versionindex = -1; |
---|
360 | | - } |
---|
| 423 | +// |
---|
| 424 | +// Save(true); |
---|
| 425 | +// } |
---|
361 | 426 | |
---|
362 | 427 | SetupMenu(); |
---|
363 | 428 | |
---|
.. | .. |
---|
377 | 442 | |
---|
378 | 443 | static java.util.Vector<Object3D> listUI = new java.util.Vector<Object3D>(); |
---|
379 | 444 | |
---|
| 445 | + // This is to refresh the UI of the material panel. |
---|
| 446 | + boolean patchMaterial; |
---|
| 447 | + |
---|
380 | 448 | void SetupMenu() |
---|
381 | 449 | { |
---|
382 | 450 | frame.setMenuBar(menuBar = new MenuBar()); |
---|
.. | .. |
---|
390 | 458 | importOBJItem.addActionListener(this); |
---|
391 | 459 | import3DSItem = menu.add(new MenuItem("3DS file...")); |
---|
392 | 460 | import3DSItem.addActionListener(this); |
---|
| 461 | + if (Globals.ADVANCED) |
---|
| 462 | + { |
---|
393 | 463 | importVRMLX3DItem = menu.add(new MenuItem("VRML/X3D file...")); |
---|
394 | 464 | importVRMLX3DItem.addActionListener(this); |
---|
| 465 | + } |
---|
395 | 466 | menu.add("-"); |
---|
396 | 467 | importGFDItem = menu.add(new MenuItem("Grafreed file...")); |
---|
397 | 468 | importGFDItem.addActionListener(this); |
---|
.. | .. |
---|
426 | 497 | |
---|
427 | 498 | ChangeListener changeListener = new ChangeListener() |
---|
428 | 499 | { |
---|
| 500 | + //String name; |
---|
| 501 | + |
---|
429 | 502 | public void stateChanged(ChangeEvent changeEvent) |
---|
430 | 503 | { |
---|
431 | 504 | // if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Material") && !materialFlushed) |
---|
.. | .. |
---|
444 | 517 | // EditSelection(false); |
---|
445 | 518 | // } |
---|
446 | 519 | |
---|
447 | | - refreshContents(false); // To refresh Info tab |
---|
| 520 | +// if (objectPanel.getSelectedIndex() == 4) |
---|
| 521 | +// { |
---|
| 522 | +// name = copy.skyboxname; |
---|
| 523 | +// |
---|
| 524 | +// if (name == null) |
---|
| 525 | +// { |
---|
| 526 | +// name = ""; |
---|
| 527 | +// } |
---|
| 528 | +// |
---|
| 529 | +// copy.skyboxname = "cubemaps/default-skyboxes/rgb"; |
---|
| 530 | +// copy.skyboxext = "jpg"; |
---|
| 531 | +// } |
---|
| 532 | +// else |
---|
| 533 | +// { |
---|
| 534 | +// if (name != null) |
---|
| 535 | +// { |
---|
| 536 | +// if (name.equals("")) |
---|
| 537 | +// { |
---|
| 538 | +// copy.skyboxname = null; |
---|
| 539 | +// copy.skyboxext = null; |
---|
| 540 | +// } |
---|
| 541 | +// else |
---|
| 542 | +// { |
---|
| 543 | +// copy.skyboxname = name; |
---|
| 544 | +// } |
---|
| 545 | +// } |
---|
| 546 | +// } |
---|
| 547 | + cameraView.transformMode = objectPanel.getSelectedIndex() == 4; |
---|
| 548 | + |
---|
| 549 | +// refreshContents(false); // To refresh Info tab |
---|
| 550 | + cameraView.repaint(); |
---|
448 | 551 | } |
---|
449 | 552 | }; |
---|
450 | 553 | objectPanel.addChangeListener(changeListener); |
---|
.. | .. |
---|
466 | 569 | |
---|
467 | 570 | toolboxPanel = new cGridBag().setVertical(true); |
---|
468 | 571 | //toolboxPanel.setName("Toolbox"); |
---|
| 572 | + |
---|
| 573 | + skyboxPanel = new cGridBag().setVertical(true); |
---|
469 | 574 | |
---|
470 | 575 | materialPanel = new cGridBag().setVertical(false); |
---|
471 | 576 | //materialPanel.setName("Material"); |
---|
.. | .. |
---|
751 | 856 | boolean maximized; |
---|
752 | 857 | |
---|
753 | 858 | cButton fullscreenLayout; |
---|
| 859 | + cButton expandedLayout; |
---|
754 | 860 | |
---|
755 | 861 | void Minimize() |
---|
756 | 862 | { |
---|
.. | .. |
---|
790 | 896 | cButton minButton; |
---|
791 | 897 | cButton maxButton; |
---|
792 | 898 | cButton fullButton; |
---|
| 899 | + cButton collapseButton; |
---|
| 900 | + cButton maximize3DButton; |
---|
793 | 901 | |
---|
794 | 902 | void ToggleFullScreen() |
---|
795 | 903 | { |
---|
796 | | -GraphicsDevice device = frame.getGraphicsConfiguration().getDevice(); |
---|
| 904 | + GraphicsDevice device = frame.getGraphicsConfiguration().getDevice(); |
---|
797 | 905 | |
---|
798 | 906 | cameraView.ToggleFullScreen(); |
---|
799 | 907 | |
---|
.. | .. |
---|
814 | 922 | // X frame.getContentPane().remove(/*"Center",*/bigThree); |
---|
815 | 923 | // X framePanel.add(bigThree); |
---|
816 | 924 | // X frame.getContentPane().add(/*"Center",*/framePanel); |
---|
817 | | - framePanel.setDividerLocation(46); |
---|
| 925 | +// framePanel.setDividerLocation(46); // icons are 24x24 |
---|
818 | 926 | |
---|
819 | 927 | //frame.setVisible(true); |
---|
820 | | - radio.layout = keepButton; |
---|
| 928 | +// radio.layout = keepButton; |
---|
821 | 929 | //theFrame = null; |
---|
822 | 930 | keepButton = null; |
---|
823 | | - radio.layout.doClick(); |
---|
| 931 | +// radio.layout.doClick(); |
---|
824 | 932 | |
---|
825 | 933 | } else |
---|
826 | 934 | { |
---|
.. | .. |
---|
841 | 949 | // X frame.getContentPane().remove(/*"Center",*/framePanel); |
---|
842 | 950 | // X framePanel.remove(bigThree); |
---|
843 | 951 | // X frame.getContentPane().add(/*"Center",*/bigThree); |
---|
844 | | - framePanel.setDividerLocation(0); |
---|
| 952 | +// framePanel.setDividerLocation(0); |
---|
845 | 953 | |
---|
846 | | - radio.layout = fullscreenLayout; |
---|
847 | | - radio.layout.doClick(); |
---|
| 954 | +// radio.layout = fullscreenLayout; |
---|
| 955 | +// radio.layout.doClick(); |
---|
848 | 956 | //frame.setVisible(true); |
---|
849 | 957 | } |
---|
850 | 958 | frame.validate(); |
---|
| 959 | + |
---|
| 960 | + cameraView.requestFocusInWindow(); |
---|
851 | 961 | } |
---|
852 | 962 | |
---|
853 | | - private Object3D CompressCopy() |
---|
| 963 | + void CollapseToolbar() |
---|
| 964 | + { |
---|
| 965 | + framePanel.setDividerLocation(0); |
---|
| 966 | + //frame.validate(); |
---|
| 967 | + |
---|
| 968 | + cameraView.requestFocusInWindow(); |
---|
| 969 | + } |
---|
| 970 | + |
---|
| 971 | + private Object3D Duplicate(Object3D object) |
---|
854 | 972 | { |
---|
855 | 973 | boolean temp = CameraPane.SWITCH; |
---|
856 | 974 | CameraPane.SWITCH = false; |
---|
857 | 975 | |
---|
858 | | - copy.ExtractBigData(versiontable); |
---|
| 976 | + if (Grafreed.grafreed.universe.versiontable == null) |
---|
| 977 | + Grafreed.grafreed.universe.versiontable = new java.util.Hashtable<java.util.UUID, Object3D>(); |
---|
| 978 | + |
---|
| 979 | + object.ExtractBigData(Grafreed.grafreed.universe.versiontable); |
---|
859 | 980 | // if (copy == client) |
---|
860 | 981 | |
---|
861 | | - Object3D versions[] = copy.versionlist; |
---|
862 | | - copy.versionlist = null; |
---|
| 982 | + Object3D versions[] = object.versionlist; |
---|
| 983 | + java.util.Hashtable<java.util.UUID, Object3D> versiontable = object.versiontable; // if Grafreed.grafreed.universe |
---|
| 984 | + object.versionlist = null; |
---|
| 985 | + object.versiontable = null; |
---|
| 986 | + |
---|
| 987 | + Object3D parent = object.parent; |
---|
| 988 | + object.parent = null; |
---|
863 | 989 | |
---|
864 | 990 | //byte[] compress = Compress(copy); |
---|
865 | | - Object3D compress = (Object3D)Grafreed.clone(copy); |
---|
| 991 | + Object3D compress = (Object3D)Grafreed.clone(object); |
---|
866 | 992 | |
---|
867 | | - copy.versionlist = versions; |
---|
| 993 | + object.parent = parent; |
---|
868 | 994 | |
---|
869 | | - copy.RestoreBigData(versiontable); |
---|
| 995 | + object.versionlist = versions; |
---|
| 996 | + object.versiontable = versiontable; // if Grafreed.grafreed.universe |
---|
| 997 | + |
---|
| 998 | + object.RestoreBigData(Grafreed.grafreed.universe.versiontable); |
---|
870 | 999 | |
---|
871 | 1000 | CameraPane.SWITCH = temp; |
---|
872 | 1001 | |
---|
.. | .. |
---|
1203 | 1332 | |
---|
1204 | 1333 | namePanel = new cGridBag(); |
---|
1205 | 1334 | |
---|
| 1335 | + //if (copy.pinned) |
---|
| 1336 | + { |
---|
| 1337 | + pinButton = GetToggleButton("icons/pin.png", !Globals.NIMBUSLAF); |
---|
| 1338 | + pinButton.setSelected(copy.pinned); |
---|
| 1339 | + cGridBag t = new cGridBag(); |
---|
| 1340 | + t.preferredWidth = 2; |
---|
| 1341 | + t.add(pinButton); |
---|
| 1342 | + namePanel.add(t); |
---|
| 1343 | + |
---|
| 1344 | + pinButton.addItemListener(this); |
---|
| 1345 | + } |
---|
| 1346 | + |
---|
1206 | 1347 | nameField = AddText(namePanel, copy.GetName()); |
---|
1207 | 1348 | namePanel.add(new JScrollPane(nameField, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER)); |
---|
1208 | 1349 | oe.ctrlPanel.add(namePanel); |
---|
.. | .. |
---|
1216 | 1357 | |
---|
1217 | 1358 | liveCB = AddCheckBox(setupPanel, "Live", copy.live); |
---|
1218 | 1359 | liveCB.setToolTipText("Animate object"); |
---|
| 1360 | + markCB = AddCheckBox(setupPanel, "Anim", copy.marked); |
---|
| 1361 | + markCB.setToolTipText("Set target transform"); |
---|
1219 | 1362 | selectableCB = AddCheckBox(setupPanel, "Select", !copy.dontselect); |
---|
1220 | 1363 | selectableCB.setToolTipText("Make object selectable"); |
---|
1221 | 1364 | // Return(); |
---|
1222 | 1365 | |
---|
1223 | 1366 | hideCB = AddCheckBox(setupPanel, "Hide", copy.hide); |
---|
1224 | 1367 | hideCB.setToolTipText("Hide object"); |
---|
1225 | | - markCB = AddCheckBox(setupPanel, "Mark", copy.marked); |
---|
1226 | | - markCB.setToolTipText("As animation target transform"); |
---|
1227 | 1368 | |
---|
1228 | 1369 | ToolTipManager.sharedInstance().setLightWeightPopupEnabled(false); |
---|
1229 | 1370 | |
---|
.. | .. |
---|
1425 | 1566 | |
---|
1426 | 1567 | if (cam == null || !(copy.get(0) instanceof cGroup)) |
---|
1427 | 1568 | { |
---|
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); |
---|
| 1569 | + if (Globals.DEBUG) |
---|
| 1570 | + System.out.println("CREATE CAMERAS"); |
---|
| 1571 | + cams = CreateCameras(); |
---|
1444 | 1572 | } else |
---|
1445 | 1573 | { |
---|
1446 | 1574 | cams = (cGroup) copy.get(0); |
---|
.. | .. |
---|
1506 | 1634 | //frontView.object = copy; |
---|
1507 | 1635 | //sideView.object = copy; |
---|
1508 | 1636 | |
---|
| 1637 | + transformPanel = new cGridBag().setVertical(true); |
---|
| 1638 | + |
---|
| 1639 | + cGridBag resetTransformPanel = new cGridBag(); |
---|
| 1640 | + |
---|
| 1641 | + resetTransformPanel.preferredHeight = 2; |
---|
| 1642 | + |
---|
| 1643 | + cButton resetTransform = GetButton("Reset all", !Globals.NIMBUSLAF); |
---|
| 1644 | + resetTransform.setToolTipText("Reset Translation, Rotation and Scale"); |
---|
| 1645 | + resetTransform.addMouseListener(new MouseAdapter() |
---|
| 1646 | + { |
---|
| 1647 | + public void mouseClicked(MouseEvent e) |
---|
| 1648 | + { |
---|
| 1649 | + ResetTransform(); |
---|
| 1650 | + } |
---|
| 1651 | + }); |
---|
| 1652 | + resetTransformPanel.add(resetTransform); |
---|
| 1653 | + |
---|
| 1654 | + resetTransform = GetButton("T only", !Globals.NIMBUSLAF); |
---|
| 1655 | + resetTransform.setToolTipText("Reset Translation only"); |
---|
| 1656 | + resetTransform.addMouseListener(new MouseAdapter() |
---|
| 1657 | + { |
---|
| 1658 | + public void mouseClicked(MouseEvent e) |
---|
| 1659 | + { |
---|
| 1660 | + ResetTransform(1); |
---|
| 1661 | + } |
---|
| 1662 | + }); |
---|
| 1663 | + resetTransformPanel.add(resetTransform); |
---|
| 1664 | + |
---|
| 1665 | + resetTransform = GetButton("RS only", !Globals.NIMBUSLAF); |
---|
| 1666 | + resetTransform.setToolTipText("Reset Rotation and Scale only"); |
---|
| 1667 | + resetTransform.addMouseListener(new MouseAdapter() |
---|
| 1668 | + { |
---|
| 1669 | + public void mouseClicked(MouseEvent e) |
---|
| 1670 | + { |
---|
| 1671 | + ResetTransform(2); |
---|
| 1672 | + } |
---|
| 1673 | + }); |
---|
| 1674 | + resetTransformPanel.add(resetTransform); |
---|
| 1675 | + |
---|
1509 | 1676 | XYZPanel = new cGridBag().setVertical(true); |
---|
1510 | 1677 | //XYZPanel.setLayout(new GridLayout(3, 1, 5, 5)); |
---|
1511 | 1678 | |
---|
.. | .. |
---|
1515 | 1682 | XYZPanel.addComponent(/*BorderLayout.NORTH,*/topView); // Scroll); |
---|
1516 | 1683 | //XYZPanel.setName("XYZ"); |
---|
1517 | 1684 | |
---|
| 1685 | + transformPanel.add(resetTransformPanel); |
---|
| 1686 | + transformPanel.add(XYZPanel); |
---|
| 1687 | + |
---|
1518 | 1688 | /* |
---|
1519 | 1689 | gridPanel = new JPanel(); //new BorderLayout()); |
---|
1520 | 1690 | gridPanel.setLayout(new GridLayout(1, 2)); |
---|
.. | .. |
---|
1522 | 1692 | gridPanel.add(cameraView); |
---|
1523 | 1693 | gridPanel.add(XYZPanel); |
---|
1524 | 1694 | */ |
---|
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); |
---|
| 1695 | +// gridPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, centralPanel, XYZPanel); //new BorderLayout()); |
---|
| 1696 | +// gridPanel.setContinuousLayout(true); |
---|
| 1697 | +// gridPanel.setOneTouchExpandable(true); |
---|
| 1698 | +// gridPanel.setDividerLocation(1.0); |
---|
| 1699 | +// gridPanel.setDividerSize(9); |
---|
| 1700 | +// gridPanel.setResizeWeight(0.85); |
---|
1531 | 1701 | |
---|
1532 | 1702 | // aConstraints.weighty = 0; |
---|
1533 | 1703 | //System.out.println("THIS = " + this); |
---|
.. | .. |
---|
1550 | 1720 | |
---|
1551 | 1721 | //JScrollPane tmp = new JScrollPane(ctrlPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); |
---|
1552 | 1722 | //tmp.setName("Edit"); |
---|
| 1723 | + objectPanel.add(skyboxPanel); |
---|
| 1724 | + objectPanel.setIconAt(0, GetIcon("icons/skybox.jpg")); |
---|
| 1725 | + objectPanel.setToolTipTextAt(0, "Backgrounds"); |
---|
| 1726 | + |
---|
| 1727 | + objectPanel.add(toolboxPanel); |
---|
| 1728 | + objectPanel.setIconAt(1, GetIcon("icons/primitives.png")); |
---|
| 1729 | + objectPanel.setToolTipTextAt(1, "Objects & textures"); |
---|
| 1730 | + |
---|
1553 | 1731 | objectPanel.add(materialPanel); |
---|
1554 | | - objectPanel.setIconAt(0, GetIcon("icons/material.png")); |
---|
1555 | | - objectPanel.setToolTipTextAt(0, "Material"); |
---|
| 1732 | + objectPanel.setIconAt(2, GetIcon("icons/material.png")); |
---|
| 1733 | + objectPanel.setToolTipTextAt(2, "Material"); |
---|
1556 | 1734 | |
---|
1557 | 1735 | // JPanel north = new JPanel(new BorderLayout()); |
---|
1558 | 1736 | // north.setName("Edit"); |
---|
1559 | 1737 | // north.add(ctrlPanel, BorderLayout.NORTH); |
---|
1560 | 1738 | // objectPanel.add(north); |
---|
1561 | 1739 | objectPanel.add(editPanel); |
---|
1562 | | - objectPanel.setIconAt(1, GetIcon("icons/write.png")); |
---|
1563 | | - objectPanel.setToolTipTextAt(1, "Edit controls"); |
---|
| 1740 | + objectPanel.setIconAt(3, GetIcon("icons/writewhite.png")); |
---|
| 1741 | + objectPanel.setToolTipTextAt(3, "Edit controls"); |
---|
1564 | 1742 | |
---|
1565 | | - //if (Globals.ADVANCED) |
---|
1566 | | - objectPanel.add(infoPanel); |
---|
1567 | | - objectPanel.setIconAt(2, GetIcon("icons/info.png")); |
---|
1568 | | - objectPanel.setToolTipTextAt(2, "Information"); |
---|
| 1743 | + objectPanel.add(transformPanel); |
---|
| 1744 | + objectPanel.setIconAt(4, GetIcon("icons/XYZ.png")); |
---|
| 1745 | + objectPanel.setToolTipTextAt(4, "TRS transform"); |
---|
1569 | 1746 | |
---|
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 | | - |
---|
| 1747 | + patchMaterial = true; |
---|
| 1748 | + cameraView.patchMaterial = this; |
---|
| 1749 | + objectPanel.setSelectedIndex(2); |
---|
| 1750 | + |
---|
1578 | 1751 | /* |
---|
1579 | 1752 | aConstraints.gridx = 0; |
---|
1580 | 1753 | aConstraints.gridwidth = 1; |
---|
.. | .. |
---|
1605 | 1778 | |
---|
1606 | 1779 | AddOptions(optionsPanel); //, aConstraints); |
---|
1607 | 1780 | |
---|
1608 | | - tabbedPane.add(optionsPanel); |
---|
1609 | | - |
---|
1610 | 1781 | tabbedPane.add(FSPane = new cFileSystemPane(this)); |
---|
1611 | 1782 | |
---|
| 1783 | + tabbedPane.add(optionsPanel); |
---|
| 1784 | + |
---|
1612 | 1785 | scenePanel.add(tabbedPane); |
---|
| 1786 | + |
---|
| 1787 | + cGridBag creditsPanel = new cGridBag().setVertical(true); |
---|
| 1788 | + creditsPanel.setName("Credits"); |
---|
| 1789 | + |
---|
| 1790 | + cLabel ogaLabel = new cLabel(" Skyboxes courtesy of OpenGameArt!", !Globals.NIMBUSLAF); |
---|
| 1791 | + creditsPanel.add(ogaLabel); |
---|
| 1792 | + |
---|
| 1793 | + cButton creditButton; |
---|
| 1794 | + creditsPanel.add(creditButton = GetButton("icons/sara-logo.png", !Globals.NIMBUSLAF)); |
---|
| 1795 | + creditButton.setToolTipText("https://opengameart.org"); |
---|
| 1796 | + |
---|
| 1797 | + creditButton.addMouseListener(new MouseAdapter() |
---|
| 1798 | + { |
---|
| 1799 | + public void mouseClicked(MouseEvent e) |
---|
| 1800 | + { |
---|
| 1801 | + try |
---|
| 1802 | + { |
---|
| 1803 | + Desktop.getDesktop().browse(new java.net.URI("https://opengameart.org/")); |
---|
| 1804 | + } catch (Exception e1) |
---|
| 1805 | +// } catch (java.io.IOException | java.net.URISyntaxException e1) |
---|
| 1806 | + { |
---|
| 1807 | + e1.printStackTrace(); |
---|
| 1808 | + } |
---|
| 1809 | + } |
---|
| 1810 | + }); |
---|
| 1811 | + |
---|
| 1812 | + ogaLabel = new cLabel(" Download 3D models! (.3ds and .obj only)", !Globals.NIMBUSLAF); |
---|
| 1813 | + creditsPanel.add(ogaLabel); |
---|
| 1814 | + |
---|
| 1815 | + creditsPanel.add(creditButton = GetButton("icons/3delicious.png", !Globals.NIMBUSLAF)); |
---|
| 1816 | + creditButton.setToolTipText("https://3delicious.net"); |
---|
| 1817 | + |
---|
| 1818 | + creditButton.addMouseListener(new MouseAdapter() |
---|
| 1819 | + { |
---|
| 1820 | + public void mouseClicked(MouseEvent e) |
---|
| 1821 | + { |
---|
| 1822 | + try |
---|
| 1823 | + { |
---|
| 1824 | + Desktop.getDesktop().browse(new java.net.URI("https://3delicious.net")); |
---|
| 1825 | + } catch (Exception e1) |
---|
| 1826 | +// } catch (java.io.IOException | java.net.URISyntaxException e1) |
---|
| 1827 | + { |
---|
| 1828 | + e1.printStackTrace(); |
---|
| 1829 | + } |
---|
| 1830 | + } |
---|
| 1831 | + }); |
---|
| 1832 | + |
---|
| 1833 | + creditsPanel.add(creditButton = GetButton("icons/archive3d.png", !Globals.NIMBUSLAF)); |
---|
| 1834 | + creditButton.setToolTipText("https://archive3d.net"); |
---|
| 1835 | + |
---|
| 1836 | + creditButton.addMouseListener(new MouseAdapter() |
---|
| 1837 | + { |
---|
| 1838 | + public void mouseClicked(MouseEvent e) |
---|
| 1839 | + { |
---|
| 1840 | + try |
---|
| 1841 | + { |
---|
| 1842 | + Desktop.getDesktop().browse(new java.net.URI("https://archive3d.net")); |
---|
| 1843 | + } catch (Exception e1) |
---|
| 1844 | +// } catch (java.io.IOException | java.net.URISyntaxException e1) |
---|
| 1845 | + { |
---|
| 1846 | + e1.printStackTrace(); |
---|
| 1847 | + } |
---|
| 1848 | + } |
---|
| 1849 | + }); |
---|
| 1850 | + |
---|
| 1851 | + creditsPanel.add(creditButton = GetButton("icons/turbosquid.png", !Globals.NIMBUSLAF)); |
---|
| 1852 | + creditButton.setToolTipText("https://turbosquid.com"); |
---|
| 1853 | + |
---|
| 1854 | + creditButton.addMouseListener(new MouseAdapter() |
---|
| 1855 | + { |
---|
| 1856 | + public void mouseClicked(MouseEvent e) |
---|
| 1857 | + { |
---|
| 1858 | + try |
---|
| 1859 | + { |
---|
| 1860 | + Desktop.getDesktop().browse(new java.net.URI("https://www.turbosquid.com/Search/3D-Models/free")); |
---|
| 1861 | + } catch (Exception e1) |
---|
| 1862 | +// } catch (java.io.IOException | java.net.URISyntaxException e1) |
---|
| 1863 | + { |
---|
| 1864 | + e1.printStackTrace(); |
---|
| 1865 | + } |
---|
| 1866 | + } |
---|
| 1867 | + }); |
---|
| 1868 | + |
---|
| 1869 | + for (int i=6; --i>=0;) |
---|
| 1870 | + { |
---|
| 1871 | + creditsPanel.add(new cGridBag()); |
---|
| 1872 | + } |
---|
| 1873 | + |
---|
| 1874 | + tabbedPane.add(creditsPanel); |
---|
| 1875 | + tabbedPane.setToolTipTextAt(3, "Credits"); |
---|
| 1876 | + |
---|
| 1877 | + if (Globals.ADVANCED) |
---|
| 1878 | + { |
---|
| 1879 | + objectPanel.add(infoPanel); |
---|
| 1880 | + objectPanel.setIconAt(5, GetIcon("icons/info.png")); |
---|
| 1881 | + objectPanel.setToolTipTextAt(4, "Information"); |
---|
| 1882 | + } |
---|
1613 | 1883 | |
---|
1614 | 1884 | /* |
---|
1615 | 1885 | cTree jTree = new cTree(null); |
---|
.. | .. |
---|
1631 | 1901 | jtp.add(tree); |
---|
1632 | 1902 | */ |
---|
1633 | 1903 | |
---|
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"); |
---|
| 1904 | +// bigPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, scenePanel, gridPanel); |
---|
| 1905 | +// bigPanel.setContinuousLayout(true); |
---|
| 1906 | +// bigPanel.setOneTouchExpandable(true); |
---|
| 1907 | +// bigPanel.setDividerLocation(0.8); |
---|
| 1908 | +// bigPanel.setDividerSize(15); |
---|
| 1909 | +// bigPanel.setResizeWeight(0.15); |
---|
| 1910 | +// bigPanel.setName("Scene"); |
---|
1641 | 1911 | |
---|
1642 | 1912 | //bigPanel.setLayout(new BorderLayout()); |
---|
1643 | 1913 | //bigPanel.setSize(new Dimension(10,10)); |
---|
.. | .. |
---|
1681 | 1951 | // aConstraints.gridheight = 1; |
---|
1682 | 1952 | |
---|
1683 | 1953 | framePanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, toolbarPanel, bigThree); |
---|
| 1954 | + |
---|
| 1955 | + framePanel.addPropertyChangeListener(JSplitPane.DIVIDER_LOCATION_PROPERTY, |
---|
| 1956 | + new java.beans.PropertyChangeListener() |
---|
| 1957 | + { |
---|
| 1958 | + public void propertyChange(java.beans.PropertyChangeEvent pce) |
---|
| 1959 | + { |
---|
| 1960 | + if ((Integer)pce.getOldValue() == 1) |
---|
| 1961 | + { |
---|
| 1962 | + if (radio.layout != expandedLayout) |
---|
| 1963 | + { |
---|
| 1964 | + radio.layout = expandedLayout; |
---|
| 1965 | + radio.layout.doClick(); |
---|
| 1966 | + } |
---|
| 1967 | + } |
---|
| 1968 | + } |
---|
| 1969 | + }); |
---|
| 1970 | + |
---|
1684 | 1971 | framePanel.setContinuousLayout(false); |
---|
1685 | 1972 | framePanel.setOneTouchExpandable(false); |
---|
1686 | 1973 | //.setDividerLocation(0.8); |
---|
.. | .. |
---|
1690 | 1977 | |
---|
1691 | 1978 | frame.getContentPane().setLayout(new BorderLayout()); |
---|
1692 | 1979 | /**/ |
---|
1693 | | - JTabbedPane worldPane = new JTabbedPane(); |
---|
| 1980 | + //JTabbedPane worldPane = new JTabbedPane(); |
---|
1694 | 1981 | //worldPane.add(bigPanel); |
---|
1695 | 1982 | //worldPane.add(worldPanel); |
---|
1696 | 1983 | /**/ |
---|
.. | .. |
---|
1704 | 1991 | |
---|
1705 | 1992 | cameraView.requestFocusInWindow(); |
---|
1706 | 1993 | |
---|
1707 | | - gridPanel.setDividerLocation(1.0); |
---|
| 1994 | +// gridPanel.setDividerLocation(1.0); |
---|
1708 | 1995 | |
---|
1709 | 1996 | frame.validate(); |
---|
1710 | 1997 | |
---|
.. | .. |
---|
1738 | 2025 | void SetupMaterial(cGridBag materialpanel) |
---|
1739 | 2026 | { |
---|
1740 | 2027 | cGridBag presetpanel = new cGridBag().setVertical(true); |
---|
1741 | | - cLabel label = GetLabel("icons/shadericons/shadericon00000.png", !Grafreed.NIMBUSLAF); |
---|
1742 | | - label.addMouseListener(new MouseAdapter() |
---|
| 2028 | + |
---|
| 2029 | + cLabel skin = GetLabel("icons/shadericons/shadericon00000.png", !Globals.NIMBUSLAF); |
---|
| 2030 | + skin.setToolTipText("Skin"); |
---|
| 2031 | + skin.addMouseListener(new MouseAdapter() |
---|
1743 | 2032 | { |
---|
1744 | 2033 | public void mouseClicked(MouseEvent e) |
---|
1745 | 2034 | { |
---|
1746 | | - colorField.setFloat(0); |
---|
1747 | | - saturationField.setFloat(1); |
---|
| 2035 | + Object3D object = Grafreed.materials.versionlist[0].get(0); |
---|
| 2036 | + cMaterial material = object.material; |
---|
| 2037 | + |
---|
| 2038 | + // Skin |
---|
| 2039 | + colorField.setFloat(material.color); |
---|
| 2040 | + float saturation = material.modulation; |
---|
| 2041 | + |
---|
| 2042 | + if (!cameraView.Skinshader) |
---|
| 2043 | + { |
---|
| 2044 | + saturation /= 1.5; |
---|
| 2045 | + } |
---|
| 2046 | + |
---|
| 2047 | + saturationField.setFloat(saturation); |
---|
| 2048 | + |
---|
| 2049 | + subsurfaceField.setFloat(material.subsurface); |
---|
| 2050 | + selfshadowField.setFloat(material.diffuseness); |
---|
| 2051 | + diffusenessField.setFloat(material.factor); |
---|
| 2052 | + shininessField.setFloat(material.shininess); |
---|
| 2053 | + shadowbiasField.setFloat(material.shadowbias); |
---|
| 2054 | + diffuseField.setFloat(material.diffuse); |
---|
| 2055 | + specularField.setFloat(material.specular); |
---|
| 2056 | + |
---|
| 2057 | + bumpField.setFloat(object.projectedVertices[0].x / 1000.0); |
---|
| 2058 | + noiseField.setFloat(object.projectedVertices[0].y / 1000.0); |
---|
| 2059 | + powerField.setFloat(object.projectedVertices[2].x / 1000.0); |
---|
| 2060 | + |
---|
1748 | 2061 | materialtouched = true; |
---|
1749 | 2062 | applySelf(); |
---|
1750 | 2063 | } |
---|
1751 | 2064 | }); |
---|
1752 | | - presetpanel.add(label); |
---|
| 2065 | + presetpanel.add(skin); |
---|
1753 | 2066 | |
---|
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)); |
---|
| 2067 | + cLabel lambert = GetLabel("icons/shadericons/shadericon00002.png", !Globals.NIMBUSLAF); |
---|
| 2068 | + lambert.setToolTipText("Diffuse"); |
---|
| 2069 | + lambert.addMouseListener(new MouseAdapter() |
---|
| 2070 | + { |
---|
| 2071 | + public void mouseClicked(MouseEvent e) |
---|
| 2072 | + { |
---|
| 2073 | + Object3D object = Grafreed.materials.versionlist[2].get(0); |
---|
| 2074 | + cMaterial material = object.material; |
---|
| 2075 | + |
---|
| 2076 | + diffusenessField.setFloat(material.factor); |
---|
| 2077 | + selfshadowField.setFloat(material.diffuseness); |
---|
| 2078 | + |
---|
| 2079 | + materialtouched = true; |
---|
| 2080 | + applySelf(); |
---|
| 2081 | + } |
---|
| 2082 | + }); |
---|
| 2083 | + presetpanel.add(lambert); |
---|
| 2084 | + |
---|
| 2085 | + cLabel diffuse2 = GetLabel("icons/shadericons/shadericon00003.png", !Globals.NIMBUSLAF); |
---|
| 2086 | + diffuse2.setToolTipText("Diffuse2"); |
---|
| 2087 | + diffuse2.addMouseListener(new MouseAdapter() |
---|
| 2088 | + { |
---|
| 2089 | + public void mouseClicked(MouseEvent e) |
---|
| 2090 | + { |
---|
| 2091 | + Object3D object = Grafreed.materials.versionlist[3].get(0); |
---|
| 2092 | + cMaterial material = object.material; |
---|
| 2093 | + |
---|
| 2094 | + diffusenessField.setFloat(material.factor); |
---|
| 2095 | + selfshadowField.setFloat(material.diffuseness); |
---|
| 2096 | + |
---|
| 2097 | + materialtouched = true; |
---|
| 2098 | + applySelf(); |
---|
| 2099 | + } |
---|
| 2100 | + }); |
---|
| 2101 | + presetpanel.add(diffuse2); |
---|
| 2102 | + |
---|
| 2103 | + cLabel diffusemoon = GetLabel("icons/shadericons/shadericon00004.png", !Globals.NIMBUSLAF); |
---|
| 2104 | + diffusemoon.setToolTipText("Moon"); |
---|
| 2105 | + diffusemoon.addMouseListener(new MouseAdapter() |
---|
| 2106 | + { |
---|
| 2107 | + public void mouseClicked(MouseEvent e) |
---|
| 2108 | + { |
---|
| 2109 | + Object3D object = Grafreed.materials.versionlist[4].get(0); |
---|
| 2110 | + cMaterial material = object.material; |
---|
| 2111 | + |
---|
| 2112 | + diffusenessField.setFloat(material.factor); |
---|
| 2113 | + selfshadowField.setFloat(material.diffuseness); |
---|
| 2114 | + |
---|
| 2115 | + materialtouched = true; |
---|
| 2116 | + applySelf(); |
---|
| 2117 | + } |
---|
| 2118 | + }); |
---|
| 2119 | + presetpanel.add(diffusemoon); |
---|
| 2120 | + |
---|
| 2121 | + cLabel diffusemoon2 = GetLabel("icons/shadericons/shadericon00005.png", !Globals.NIMBUSLAF); |
---|
| 2122 | + diffusemoon2.setToolTipText("Moon2"); |
---|
| 2123 | + diffusemoon2.addMouseListener(new MouseAdapter() |
---|
| 2124 | + { |
---|
| 2125 | + public void mouseClicked(MouseEvent e) |
---|
| 2126 | + { |
---|
| 2127 | + Object3D object = Grafreed.materials.versionlist[5].get(0); |
---|
| 2128 | + cMaterial material = object.material; |
---|
| 2129 | + |
---|
| 2130 | + diffusenessField.setFloat(material.factor); |
---|
| 2131 | + selfshadowField.setFloat(material.diffuseness); |
---|
| 2132 | + |
---|
| 2133 | + materialtouched = true; |
---|
| 2134 | + applySelf(); |
---|
| 2135 | + } |
---|
| 2136 | + }); |
---|
| 2137 | + presetpanel.add(diffusemoon2); |
---|
| 2138 | + |
---|
| 2139 | + cLabel diffusemoon3 = GetLabel("icons/shadericons/shadericon00006.png", !Globals.NIMBUSLAF); |
---|
| 2140 | + diffusemoon3.setToolTipText("Moon3"); |
---|
| 2141 | + diffusemoon3.addMouseListener(new MouseAdapter() |
---|
| 2142 | + { |
---|
| 2143 | + public void mouseClicked(MouseEvent e) |
---|
| 2144 | + { |
---|
| 2145 | + Object3D object = Grafreed.materials.versionlist[6].get(0); |
---|
| 2146 | + cMaterial material = object.material; |
---|
| 2147 | + |
---|
| 2148 | + diffusenessField.setFloat(material.factor); |
---|
| 2149 | + selfshadowField.setFloat(material.diffuseness); |
---|
| 2150 | + |
---|
| 2151 | + materialtouched = true; |
---|
| 2152 | + applySelf(); |
---|
| 2153 | + } |
---|
| 2154 | + }); |
---|
| 2155 | + presetpanel.add(diffusemoon3); |
---|
| 2156 | + |
---|
| 2157 | + cLabel diffusesheen = GetLabel("icons/shadericons/shadericon00007.png", !Globals.NIMBUSLAF); |
---|
| 2158 | + diffusesheen.setToolTipText("Sheen"); |
---|
| 2159 | + diffusesheen.addMouseListener(new MouseAdapter() |
---|
| 2160 | + { |
---|
| 2161 | + public void mouseClicked(MouseEvent e) |
---|
| 2162 | + { |
---|
| 2163 | + Object3D object = Grafreed.materials.versionlist[7].get(0); |
---|
| 2164 | + cMaterial material = object.material; |
---|
| 2165 | + |
---|
| 2166 | + sheenField.setFloat(material.sheen); |
---|
| 2167 | + |
---|
| 2168 | + materialtouched = true; |
---|
| 2169 | + applySelf(); |
---|
| 2170 | + } |
---|
| 2171 | + }); |
---|
| 2172 | + presetpanel.add(diffusesheen); |
---|
| 2173 | + |
---|
| 2174 | + cLabel rough = GetLabel("icons/shadericons/shadericon00001.png", !Globals.NIMBUSLAF); |
---|
| 2175 | + rough.setToolTipText("Rough metal"); |
---|
| 2176 | + rough.addMouseListener(new MouseAdapter() |
---|
| 2177 | + { |
---|
| 2178 | + public void mouseClicked(MouseEvent e) |
---|
| 2179 | + { |
---|
| 2180 | + Object3D object = Grafreed.materials.versionlist[1].get(0); |
---|
| 2181 | + cMaterial material = object.material; |
---|
| 2182 | + |
---|
| 2183 | + shininessField.setFloat(material.shininess); |
---|
| 2184 | + velvetField.setFloat(material.velvet); |
---|
| 2185 | + |
---|
| 2186 | + materialtouched = true; |
---|
| 2187 | + applySelf(); |
---|
| 2188 | + } |
---|
| 2189 | + }); |
---|
| 2190 | + presetpanel.add(rough); |
---|
| 2191 | + |
---|
| 2192 | + cLabel rough2 = GetLabel("icons/shadericons/shadericon00013.png", !Globals.NIMBUSLAF); |
---|
| 2193 | + rough2.setToolTipText("Medium metal"); |
---|
| 2194 | + rough2.addMouseListener(new MouseAdapter() |
---|
| 2195 | + { |
---|
| 2196 | + public void mouseClicked(MouseEvent e) |
---|
| 2197 | + { |
---|
| 2198 | + Object3D object = Grafreed.materials.versionlist[13].get(0); |
---|
| 2199 | + cMaterial material = object.material; |
---|
| 2200 | + |
---|
| 2201 | + shininessField.setFloat(material.shininess); |
---|
| 2202 | + lightareaField.setFloat(material.lightarea); |
---|
| 2203 | + |
---|
| 2204 | + materialtouched = true; |
---|
| 2205 | + applySelf(); |
---|
| 2206 | + } |
---|
| 2207 | + }); |
---|
| 2208 | + presetpanel.add(rough2); |
---|
| 2209 | + |
---|
| 2210 | + cLabel shini0 = GetLabel("icons/shadericons/shadericon00014.png", !Globals.NIMBUSLAF); |
---|
| 2211 | + shini0.setToolTipText("Shiny"); |
---|
| 2212 | + shini0.addMouseListener(new MouseAdapter() |
---|
| 2213 | + { |
---|
| 2214 | + public void mouseClicked(MouseEvent e) |
---|
| 2215 | + { |
---|
| 2216 | + Object3D object = Grafreed.materials.versionlist[14].get(0); |
---|
| 2217 | + cMaterial material = object.material; |
---|
| 2218 | + |
---|
| 2219 | + shininessField.setFloat(material.shininess); |
---|
| 2220 | + lightareaField.setFloat(material.lightarea); |
---|
| 2221 | + |
---|
| 2222 | + materialtouched = true; |
---|
| 2223 | + applySelf(); |
---|
| 2224 | + } |
---|
| 2225 | + }); |
---|
| 2226 | + presetpanel.add(shini0); |
---|
| 2227 | + |
---|
| 2228 | + cLabel shini1 = GetLabel("icons/shadericons/shadericon00011.png", !Globals.NIMBUSLAF); |
---|
| 2229 | + shini1.setToolTipText("Shiny2"); |
---|
| 2230 | + shini1.addMouseListener(new MouseAdapter() |
---|
| 2231 | + { |
---|
| 2232 | + public void mouseClicked(MouseEvent e) |
---|
| 2233 | + { |
---|
| 2234 | + Object3D object = Grafreed.materials.versionlist[11].get(0); |
---|
| 2235 | + cMaterial material = object.material; |
---|
| 2236 | + |
---|
| 2237 | + shininessField.setFloat(material.shininess); |
---|
| 2238 | + lightareaField.setFloat(material.lightarea); |
---|
| 2239 | + |
---|
| 2240 | + materialtouched = true; |
---|
| 2241 | + applySelf(); |
---|
| 2242 | + } |
---|
| 2243 | + }); |
---|
| 2244 | + presetpanel.add(shini1); |
---|
| 2245 | + |
---|
| 2246 | + cLabel shini2 = GetLabel("icons/shadericons/shadericon00012.png", !Globals.NIMBUSLAF); |
---|
| 2247 | + shini2.setToolTipText("Shiny3"); |
---|
| 2248 | + shini2.addMouseListener(new MouseAdapter() |
---|
| 2249 | + { |
---|
| 2250 | + public void mouseClicked(MouseEvent e) |
---|
| 2251 | + { |
---|
| 2252 | + Object3D object = Grafreed.materials.versionlist[12].get(0); |
---|
| 2253 | + cMaterial material = object.material; |
---|
| 2254 | + |
---|
| 2255 | + shininessField.setFloat(material.shininess); |
---|
| 2256 | + lightareaField.setFloat(material.lightarea); |
---|
| 2257 | + |
---|
| 2258 | + materialtouched = true; |
---|
| 2259 | + applySelf(); |
---|
| 2260 | + } |
---|
| 2261 | + }); |
---|
| 2262 | + presetpanel.add(shini2); |
---|
| 2263 | + |
---|
| 2264 | + cLabel aniso = GetLabel("icons/shadericons/shadericon00008.png", !Globals.NIMBUSLAF); |
---|
| 2265 | + aniso.setToolTipText("AnisoU"); |
---|
| 2266 | + aniso.addMouseListener(new MouseAdapter() |
---|
| 2267 | + { |
---|
| 2268 | + public void mouseClicked(MouseEvent e) |
---|
| 2269 | + { |
---|
| 2270 | + Object3D object = Grafreed.materials.versionlist[8].get(0); |
---|
| 2271 | + cMaterial material = object.material; |
---|
| 2272 | + |
---|
| 2273 | + anisoField.setFloat(material.aniso); |
---|
| 2274 | + anisoVField.setFloat(material.anisoV); |
---|
| 2275 | + |
---|
| 2276 | + materialtouched = true; |
---|
| 2277 | + applySelf(); |
---|
| 2278 | + } |
---|
| 2279 | + }); |
---|
| 2280 | + presetpanel.add(aniso); |
---|
| 2281 | + |
---|
| 2282 | + cLabel aniso2 = GetLabel("icons/shadericons/shadericon00009.png", !Globals.NIMBUSLAF); |
---|
| 2283 | + aniso2.setToolTipText("AnisoV"); |
---|
| 2284 | + aniso2.addMouseListener(new MouseAdapter() |
---|
| 2285 | + { |
---|
| 2286 | + public void mouseClicked(MouseEvent e) |
---|
| 2287 | + { |
---|
| 2288 | + Object3D object = Grafreed.materials.versionlist[9].get(0); |
---|
| 2289 | + cMaterial material = object.material; |
---|
| 2290 | + |
---|
| 2291 | + anisoField.setFloat(material.aniso); |
---|
| 2292 | + anisoVField.setFloat(material.anisoV); |
---|
| 2293 | + |
---|
| 2294 | + materialtouched = true; |
---|
| 2295 | + applySelf(); |
---|
| 2296 | + } |
---|
| 2297 | + }); |
---|
| 2298 | + presetpanel.add(aniso2); |
---|
| 2299 | + |
---|
| 2300 | + cLabel aniso3 = GetLabel("icons/shadericons/shadericon00010.png", !Globals.NIMBUSLAF); |
---|
| 2301 | + aniso3.setToolTipText("AnisoUV"); |
---|
| 2302 | + aniso3.addMouseListener(new MouseAdapter() |
---|
| 2303 | + { |
---|
| 2304 | + public void mouseClicked(MouseEvent e) |
---|
| 2305 | + { |
---|
| 2306 | + Object3D object = Grafreed.materials.versionlist[10].get(0); |
---|
| 2307 | + cMaterial material = object.material; |
---|
| 2308 | + |
---|
| 2309 | + anisoField.setFloat(material.aniso); |
---|
| 2310 | + anisoVField.setFloat(material.anisoV); |
---|
| 2311 | + |
---|
| 2312 | + materialtouched = true; |
---|
| 2313 | + applySelf(); |
---|
| 2314 | + } |
---|
| 2315 | + }); |
---|
| 2316 | + presetpanel.add(aniso3); |
---|
| 2317 | + |
---|
| 2318 | + cLabel velvet0 = GetLabel("icons/shadericons/shadericon00015.png", !Globals.NIMBUSLAF); |
---|
| 2319 | + velvet0.setToolTipText("Velvet"); |
---|
| 2320 | + velvet0.addMouseListener(new MouseAdapter() |
---|
| 2321 | + { |
---|
| 2322 | + public void mouseClicked(MouseEvent e) |
---|
| 2323 | + { |
---|
| 2324 | + Object3D object = Grafreed.materials.versionlist[15].get(0); |
---|
| 2325 | + cMaterial material = object.material; |
---|
| 2326 | + |
---|
| 2327 | + diffusenessField.setFloat(material.factor); |
---|
| 2328 | + selfshadowField.setFloat(material.diffuseness); |
---|
| 2329 | + sheenField.setFloat(material.sheen); |
---|
| 2330 | + shininessField.setFloat(material.shininess); |
---|
| 2331 | + velvetField.setFloat(material.velvet); |
---|
| 2332 | + shiftField.setFloat(material.shift); |
---|
| 2333 | + |
---|
| 2334 | + materialtouched = true; |
---|
| 2335 | + applySelf(); |
---|
| 2336 | + } |
---|
| 2337 | + }); |
---|
| 2338 | + presetpanel.add(velvet0); |
---|
| 2339 | + |
---|
| 2340 | + cLabel bump0 = GetLabel("icons/shadericons/shadericon00016.png", !Globals.NIMBUSLAF); |
---|
| 2341 | + bump0.setToolTipText("Bump texture"); |
---|
| 2342 | + bump0.addMouseListener(new MouseAdapter() |
---|
| 2343 | + { |
---|
| 2344 | + public void mouseClicked(MouseEvent e) |
---|
| 2345 | + { |
---|
| 2346 | + Object3D object = Grafreed.materials.versionlist[16].get(0); |
---|
| 2347 | + cMaterial material = object.material; |
---|
| 2348 | + |
---|
| 2349 | + bumpField.setFloat(object.projectedVertices[0].x / 1000.0); |
---|
| 2350 | + noiseField.setFloat(object.projectedVertices[0].y / 1000.0); |
---|
| 2351 | + powerField.setFloat(object.projectedVertices[2].x / 1000.0); |
---|
| 2352 | + |
---|
| 2353 | + materialtouched = true; |
---|
| 2354 | + applySelf(); |
---|
| 2355 | + } |
---|
| 2356 | + }); |
---|
| 2357 | + presetpanel.add(bump0); |
---|
| 2358 | + |
---|
| 2359 | + cLabel borderShader = GetLabel("icons/shadericons/borderfade.jpg", !Globals.NIMBUSLAF); |
---|
| 2360 | + borderShader.setToolTipText("Border fade"); |
---|
| 2361 | + borderShader.addMouseListener(new MouseAdapter() |
---|
| 2362 | + { |
---|
| 2363 | + public void mouseClicked(MouseEvent e) |
---|
| 2364 | + { |
---|
| 2365 | + borderfadeField.setFloat(0.4); |
---|
| 2366 | + opacityField.setFloat(0.75); |
---|
| 2367 | + |
---|
| 2368 | + materialtouched = true; |
---|
| 2369 | + applySelf(); |
---|
| 2370 | + } |
---|
| 2371 | + }); |
---|
| 2372 | + presetpanel.add(borderShader); |
---|
| 2373 | + |
---|
| 2374 | + cLabel halo = GetLabel("icons/shadericons/shadericon00017.png", !Globals.NIMBUSLAF); |
---|
| 2375 | + halo.setToolTipText("Halo"); |
---|
| 2376 | + halo.addMouseListener(new MouseAdapter() |
---|
| 2377 | + { |
---|
| 2378 | + public void mouseClicked(MouseEvent e) |
---|
| 2379 | + { |
---|
| 2380 | + Object3D object = Grafreed.materials.versionlist[17].get(0); |
---|
| 2381 | + cMaterial material = object.material; |
---|
| 2382 | + |
---|
| 2383 | + opacityPowerField.setFloat(object.projectedVertices[2].y / 1000.0); |
---|
| 2384 | + |
---|
| 2385 | + materialtouched = true; |
---|
| 2386 | + applySelf(); |
---|
| 2387 | + } |
---|
| 2388 | + }); |
---|
| 2389 | + presetpanel.add(halo); |
---|
| 2390 | + |
---|
| 2391 | + cLabel candle = GetLabel("icons/shadericons/shadericon00018.png", !Globals.NIMBUSLAF); |
---|
| 2392 | + candle.setToolTipText("Candle"); |
---|
| 2393 | + candle.addMouseListener(new MouseAdapter() |
---|
| 2394 | + { |
---|
| 2395 | + public void mouseClicked(MouseEvent e) |
---|
| 2396 | + { |
---|
| 2397 | + Object3D object = Grafreed.materials.versionlist[18].get(0); |
---|
| 2398 | + cMaterial material = object.material; |
---|
| 2399 | + |
---|
| 2400 | + subsurfaceField.setFloat(material.subsurface); |
---|
| 2401 | + shadowbiasField.setFloat(material.shadowbias); |
---|
| 2402 | + ambientField.setFloat(material.ambient); |
---|
| 2403 | + specularField.setFloat(material.specular); |
---|
| 2404 | + lightareaField.setFloat(material.lightarea); |
---|
| 2405 | + shininessField.setFloat(material.shininess); |
---|
| 2406 | + |
---|
| 2407 | + materialtouched = true; |
---|
| 2408 | + applySelf(); |
---|
| 2409 | + } |
---|
| 2410 | + }); |
---|
| 2411 | + presetpanel.add(candle); |
---|
| 2412 | + |
---|
| 2413 | + cLabel shadowShader = GetLabel("icons/shadericons/shadow.png", !Globals.NIMBUSLAF); |
---|
| 2414 | + shadowShader.setToolTipText("Shadow"); |
---|
| 2415 | + shadowShader.addMouseListener(new MouseAdapter() |
---|
| 2416 | + { |
---|
| 2417 | + public void mouseClicked(MouseEvent e) |
---|
| 2418 | + { |
---|
| 2419 | + diffuseField.setFloat(0.001); |
---|
| 2420 | + ambientField.setFloat(0.001); |
---|
| 2421 | + cameraField.setFloat(0.001); |
---|
| 2422 | + specularField.setFloat(0.001); |
---|
| 2423 | + fakedepthField.setFloat(0.001); |
---|
| 2424 | + opacityField.setFloat(0.6); |
---|
| 2425 | + |
---|
| 2426 | + materialtouched = true; |
---|
| 2427 | + applySelf(); |
---|
| 2428 | + } |
---|
| 2429 | + }); |
---|
| 2430 | + presetpanel.add(shadowShader); |
---|
| 2431 | + |
---|
| 2432 | + cLabel para0 = GetLabel("icons/shadericons/parallax0.png", !Globals.NIMBUSLAF); |
---|
| 2433 | + para0.setToolTipText("No parallax"); |
---|
| 2434 | + para0.addMouseListener(new MouseAdapter() |
---|
| 2435 | + { |
---|
| 2436 | + public void mouseClicked(MouseEvent e) |
---|
| 2437 | + { |
---|
| 2438 | + parallaxField.setFloat(0.125); |
---|
| 2439 | + |
---|
| 2440 | + materialtouched = true; |
---|
| 2441 | + applySelf(); |
---|
| 2442 | + } |
---|
| 2443 | + }); |
---|
| 2444 | + presetpanel.add(para0); |
---|
| 2445 | + |
---|
| 2446 | + cLabel para1 = GetLabel("icons/shadericons/parallax1.png", !Globals.NIMBUSLAF); |
---|
| 2447 | + para1.setToolTipText("With parallax"); |
---|
| 2448 | + para1.addMouseListener(new MouseAdapter() |
---|
| 2449 | + { |
---|
| 2450 | + public void mouseClicked(MouseEvent e) |
---|
| 2451 | + { |
---|
| 2452 | + parallaxField.setFloat(0.13); |
---|
| 2453 | + |
---|
| 2454 | + materialtouched = true; |
---|
| 2455 | + applySelf(); |
---|
| 2456 | + } |
---|
| 2457 | + }); |
---|
| 2458 | + presetpanel.add(para1); |
---|
| 2459 | + |
---|
| 2460 | + cLabel para2 = GetLabel("icons/shadericons/parallax2.png", !Globals.NIMBUSLAF); |
---|
| 2461 | + para2.setToolTipText("Reset parallax"); |
---|
| 2462 | + para2.addMouseListener(new MouseAdapter() |
---|
| 2463 | + { |
---|
| 2464 | + public void mouseClicked(MouseEvent e) |
---|
| 2465 | + { |
---|
| 2466 | + parallaxField.setFloat(0.14); |
---|
| 2467 | + |
---|
| 2468 | + materialtouched = true; |
---|
| 2469 | + applySelf(); |
---|
| 2470 | + } |
---|
| 2471 | + }); |
---|
| 2472 | + presetpanel.add(para2); |
---|
1774 | 2473 | |
---|
1775 | 2474 | cGridBag panel = new cGridBag().setVertical(true); |
---|
1776 | 2475 | |
---|
1777 | 2476 | presetpanel.preferredWidth = 1; |
---|
1778 | 2477 | |
---|
1779 | | - materialpanel.add(panel); |
---|
1780 | 2478 | materialpanel.add(presetpanel); |
---|
| 2479 | + materialpanel.add(panel); |
---|
1781 | 2480 | |
---|
1782 | 2481 | panel.preferredWidth = 8; |
---|
1783 | 2482 | |
---|
.. | .. |
---|
1788 | 2487 | |
---|
1789 | 2488 | cGridBag editBar = new cGridBag().setVertical(false); |
---|
1790 | 2489 | |
---|
1791 | | - editBar.add(createMaterialButton = new cButton("Create", !Grafreed.NIMBUSLAF)); // , aConstraints); |
---|
| 2490 | + editBar.add(createMaterialButton = new cButton("Create", !Globals.NIMBUSLAF)); // , aConstraints); |
---|
1792 | 2491 | createMaterialButton.setToolTipText("Create material"); |
---|
1793 | 2492 | |
---|
1794 | 2493 | /* |
---|
1795 | 2494 | ctrlPanel.add(resetSlidersButton = new cButton("Reset All"), aConstraints); |
---|
1796 | 2495 | */ |
---|
1797 | 2496 | |
---|
1798 | | - editBar.add(clearMaterialButton = new cButton("Clear", !Grafreed.NIMBUSLAF)); // , aConstraints); |
---|
| 2497 | + editBar.add(clearMaterialButton = new cButton("Clear", !Globals.NIMBUSLAF)); // , aConstraints); |
---|
1799 | 2498 | clearMaterialButton.setToolTipText("Clear material"); |
---|
1800 | 2499 | |
---|
1801 | 2500 | if (Globals.ADVANCED) |
---|
1802 | 2501 | { |
---|
1803 | | - editBar.add(resetSlidersButton = new cButton("Reset", !Grafreed.NIMBUSLAF)); // , aConstraints); |
---|
| 2502 | + editBar.add(resetSlidersButton = new cButton("Reset", !Globals.NIMBUSLAF)); // , aConstraints); |
---|
1804 | 2503 | editBar.add(propagateToggle = new cCheckBox("Prop", propagate)); // , aConstraints); |
---|
1805 | 2504 | editBar.add(multiplyToggle = new cCheckBox("Mult", false)); // , aConstraints); |
---|
1806 | 2505 | } |
---|
.. | .. |
---|
1821 | 2520 | |
---|
1822 | 2521 | cGridBag huepanel = new cGridBag(); |
---|
1823 | 2522 | cGridBag huelabel = new cGridBag(); |
---|
1824 | | - label = GetLabel("icons/hue.png", false); |
---|
1825 | | - label.fit = true; |
---|
1826 | | - huelabel.add(label); |
---|
| 2523 | + cLabel hue = GetLabel("icons/hue.png", false); |
---|
| 2524 | + hue.fit = true; |
---|
| 2525 | + |
---|
| 2526 | + hue.addMouseListener(new MouseAdapter() |
---|
| 2527 | + { |
---|
| 2528 | + public void mousePressed(MouseEvent e) |
---|
| 2529 | + { |
---|
| 2530 | + int x = e.getX(); |
---|
| 2531 | + |
---|
| 2532 | + colorField.setFloat((double)x / ((cLabel)e.getSource()).getWidth()); |
---|
| 2533 | + } |
---|
| 2534 | + }); |
---|
| 2535 | + |
---|
| 2536 | + huelabel.add(hue); |
---|
1827 | 2537 | huelabel.preferredWidth = 20; |
---|
1828 | 2538 | huepanel.add(new cGridBag()); // Label |
---|
1829 | 2539 | huepanel.add(huelabel); // Field/slider |
---|
.. | .. |
---|
2006 | 2716 | backlit.add(backlitField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
2007 | 2717 | colorSection.add(backlit); |
---|
2008 | 2718 | |
---|
| 2719 | + cGridBag parallax = new cGridBag(); |
---|
| 2720 | + parallax.add(parallaxLabel = new JLabel("Parallax")); // , aConstraints); |
---|
| 2721 | + parallaxLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 2722 | + parallax.add(parallaxField = new cNumberSlider(this, 0.001, 0.25, -0.125)); // , aConstraints); |
---|
| 2723 | + colorSection.add(parallax); |
---|
| 2724 | + |
---|
2009 | 2725 | //panel.add(new JSeparator()); |
---|
2010 | 2726 | |
---|
2011 | 2727 | //panel.add(globalSection); |
---|
.. | .. |
---|
3057 | 3773 | shadowField.setFloat(mat.shadow); |
---|
3058 | 3774 | textureField.setFloat(mat.texture); |
---|
3059 | 3775 | opacityField.setFloat(mat.opacity); |
---|
| 3776 | + parallaxField.setFloat(mat.parallax + 0.125f); |
---|
3060 | 3777 | fakedepthField.setFloat(mat.fakedepth); |
---|
3061 | 3778 | shadowbiasField.setFloat(mat.shadowbias); |
---|
3062 | 3779 | bumpField.setInteger(1); // dec 2013 |
---|
.. | .. |
---|
3099 | 3816 | |
---|
3100 | 3817 | if (multiplyToggle != null) |
---|
3101 | 3818 | 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 | | - } |
---|
| 3819 | + |
---|
| 3820 | + AllocProjectedVertices(object); |
---|
3128 | 3821 | |
---|
3129 | 3822 | SetMaterial(mat, object.projectedVertices); |
---|
3130 | 3823 | } |
---|
.. | .. |
---|
3244 | 3937 | public void itemStateChanged(ItemEvent event) |
---|
3245 | 3938 | { |
---|
3246 | 3939 | // System.out.println("Propagate = " + propagate); |
---|
| 3940 | + if (event.getSource() == pinButton) |
---|
| 3941 | + { |
---|
| 3942 | + copy.pinned ^= true; |
---|
| 3943 | + if (!copy.pinned && !copy.editWindow.copy.selection.contains(copy)) |
---|
| 3944 | + { |
---|
| 3945 | + ((GroupEditor)copy.editWindow).listUI.remove(copy); |
---|
| 3946 | + copy.CloseUI(); |
---|
| 3947 | + //copy.editWindow.refreshContents(); |
---|
| 3948 | + } |
---|
| 3949 | + } |
---|
| 3950 | + else |
---|
3247 | 3951 | if (event.getSource() == propagateToggle) |
---|
3248 | 3952 | { |
---|
3249 | 3953 | propagate ^= true; |
---|
.. | .. |
---|
3423 | 4127 | //System.out.println("ObjEditor " + event); |
---|
3424 | 4128 | applySelf0(true); |
---|
3425 | 4129 | //parent.applySelf(); |
---|
3426 | | - objEditor.refreshContents(); |
---|
| 4130 | + // conflicts with requestFocus objEditor.refreshContents(); |
---|
3427 | 4131 | } else if (source == resetButton) |
---|
3428 | 4132 | { |
---|
3429 | 4133 | CameraPane.fullreset = true; |
---|
.. | .. |
---|
3603 | 4307 | |
---|
3604 | 4308 | void New() |
---|
3605 | 4309 | { |
---|
3606 | | - while (copy.Size() > 1) |
---|
| 4310 | + while (copy.Size() > 0) |
---|
3607 | 4311 | { |
---|
3608 | | - copy.remove(1); |
---|
| 4312 | + copy.remove(0); |
---|
3609 | 4313 | } |
---|
3610 | 4314 | |
---|
| 4315 | + copy.selection.clear(); |
---|
| 4316 | + |
---|
| 4317 | + if (copy == Grafreed.grafreed.universe) |
---|
| 4318 | + { |
---|
| 4319 | + CreateCameras(); |
---|
| 4320 | + cameraView.SetCamera(GetCamera(copy, 0)); |
---|
| 4321 | + } |
---|
3611 | 4322 | ResetModel(); |
---|
3612 | 4323 | objEditor.refreshContents(); |
---|
3613 | 4324 | } |
---|
.. | .. |
---|
3716 | 4427 | { |
---|
3717 | 4428 | //Save(true); |
---|
3718 | 4429 | Replace(); |
---|
3719 | | - SetUndoStates(); |
---|
| 4430 | + SetVersionStates(); |
---|
3720 | 4431 | } |
---|
3721 | 4432 | |
---|
3722 | 4433 | private boolean Equal(byte[] compress, byte[] name) |
---|
.. | .. |
---|
3735 | 4446 | return true; |
---|
3736 | 4447 | } |
---|
3737 | 4448 | |
---|
3738 | | - java.util.Hashtable<java.util.UUID, Object3D> versiontable = new java.util.Hashtable<java.util.UUID, Object3D>(); |
---|
| 4449 | + void DeleteVersion() |
---|
| 4450 | + { |
---|
| 4451 | + for (int i = copy.versionindex; i < copy.versionlist.length-1; i++) |
---|
| 4452 | + { |
---|
| 4453 | + copy.versionlist[i] = copy.versionlist[i+1]; |
---|
| 4454 | + } |
---|
| 4455 | + |
---|
| 4456 | + if (copy.versionlist[copy.versionindex] == null) |
---|
| 4457 | + copy.versionindex -= 1; |
---|
| 4458 | + |
---|
| 4459 | + if (copy.versionindex != -1) |
---|
| 4460 | + CopyChanged(); |
---|
| 4461 | + |
---|
| 4462 | + SetVersionStates(); |
---|
| 4463 | + } |
---|
3739 | 4464 | |
---|
3740 | 4465 | public boolean Save(boolean user) |
---|
3741 | 4466 | { |
---|
3742 | 4467 | System.err.println("Save"); |
---|
3743 | 4468 | Replace(); |
---|
3744 | 4469 | |
---|
3745 | | - cRadio tab = GetCurrentTab(); |
---|
| 4470 | + if (copy.versionlist == null) |
---|
| 4471 | + { |
---|
| 4472 | + copy.versionlist = new Object3D[100]; |
---|
| 4473 | + copy.versionindex = -1; |
---|
| 4474 | + } |
---|
3746 | 4475 | |
---|
3747 | | - Object3D compress = CompressCopy(); // Saved version. No need for "Replace". |
---|
| 4476 | + Object3D compress = Duplicate(copy); // Saved version. No need for "Replace"? |
---|
3748 | 4477 | |
---|
3749 | 4478 | boolean thesame = false; |
---|
3750 | 4479 | |
---|
.. | .. |
---|
3756 | 4485 | //EditorFrame.m_MainFrame.requestFocusInWindow(); |
---|
3757 | 4486 | if (!thesame) |
---|
3758 | 4487 | { |
---|
| 4488 | + for (int i = copy.versionlist.length; --i > copy.versionindex+1;) |
---|
| 4489 | + { |
---|
| 4490 | + copy.versionlist[i] = copy.versionlist[i-1]; |
---|
| 4491 | + } |
---|
| 4492 | + |
---|
3759 | 4493 | //tab.user[tab.versionindex] = user; |
---|
3760 | 4494 | //boolean increment = true; // tab.graphs[tab.versionindex] == null; |
---|
3761 | 4495 | |
---|
.. | .. |
---|
3769 | 4503 | |
---|
3770 | 4504 | //assert(hashtable.isEmpty()); |
---|
3771 | 4505 | |
---|
3772 | | - for (int i = copy.versionindex+1; i < copy.versionlist.length; i++) |
---|
3773 | | - { |
---|
3774 | | - //tab.user[i] = false; |
---|
3775 | | - copy.versionlist[i] = null; |
---|
3776 | | - } |
---|
| 4506 | +// for (int i = copy.versionindex+1; i < copy.versionlist.length; i++) |
---|
| 4507 | +// { |
---|
| 4508 | +// //tab.user[i] = false; |
---|
| 4509 | +// copy.versionlist[i] = null; |
---|
| 4510 | +// } |
---|
3777 | 4511 | |
---|
3778 | | - SetUndoStates(); |
---|
| 4512 | + SetVersionStates(); |
---|
3779 | 4513 | |
---|
3780 | 4514 | // test save |
---|
3781 | 4515 | if (false) |
---|
.. | .. |
---|
3828 | 4562 | GetTree().addSelectionPath(selection.elementAt(i).GetTreePath().GetTreePath()); |
---|
3829 | 4563 | flashIt = true; |
---|
3830 | 4564 | |
---|
3831 | | - refreshContents(false); |
---|
| 4565 | + //refreshContents(false); |
---|
3832 | 4566 | } |
---|
3833 | 4567 | |
---|
3834 | | - void CopyChanged(Object3D obj) |
---|
| 4568 | + void CopyChanged() |
---|
3835 | 4569 | { |
---|
3836 | | - SetUndoStates(); |
---|
| 4570 | + Object3D obj = (Object3D)Grafreed.clone(copy.versionlist[copy.versionindex]); |
---|
| 4571 | + |
---|
| 4572 | + SetVersionStates(); |
---|
3837 | 4573 | |
---|
3838 | 4574 | boolean temp = CameraPane.SWITCH; |
---|
3839 | 4575 | CameraPane.SWITCH = false; |
---|
3840 | 4576 | |
---|
3841 | | - copy.ExtractBigData(versiontable); |
---|
| 4577 | + copy.ExtractBigData(Grafreed.grafreed.universe.versiontable); |
---|
3842 | 4578 | |
---|
3843 | 4579 | copy.clear(); |
---|
3844 | 4580 | |
---|
.. | .. |
---|
3850 | 4586 | copy.add(obj.get(i)); |
---|
3851 | 4587 | } |
---|
3852 | 4588 | |
---|
3853 | | - copy.RestoreBigData(versiontable); |
---|
| 4589 | + copy.RestoreBigData(Grafreed.grafreed.universe.versiontable); |
---|
3854 | 4590 | |
---|
3855 | 4591 | CameraPane.SWITCH = temp; |
---|
3856 | 4592 | |
---|
.. | .. |
---|
3875 | 4611 | } |
---|
3876 | 4612 | } |
---|
3877 | 4613 | |
---|
3878 | | - refreshContents(); |
---|
| 4614 | + refreshContents(true); |
---|
3879 | 4615 | } |
---|
3880 | 4616 | |
---|
3881 | | - cButton undoButton; |
---|
| 4617 | + cButton previousVersionButton; |
---|
3882 | 4618 | cButton restoreButton; |
---|
3883 | 4619 | cButton replaceButton; |
---|
3884 | | - cButton redoButton; |
---|
| 4620 | + cButton nextVersionButton; |
---|
| 4621 | + cButton saveVersionButton; |
---|
| 4622 | + cButton deleteVersionButton; |
---|
3885 | 4623 | |
---|
3886 | 4624 | boolean muteSlider; |
---|
3887 | 4625 | |
---|
.. | .. |
---|
3898 | 4636 | return count; |
---|
3899 | 4637 | } |
---|
3900 | 4638 | |
---|
3901 | | - void SetUndoStates() |
---|
| 4639 | + public cGridBag versionSliderPane; |
---|
| 4640 | + |
---|
| 4641 | + void SetVersionStates() |
---|
3902 | 4642 | { |
---|
3903 | | - cRadio tab = GetCurrentTab(); |
---|
| 4643 | + //if (true) |
---|
| 4644 | + // return; |
---|
| 4645 | + |
---|
| 4646 | + //cRadio tab = GetCurrentTab(); |
---|
3904 | 4647 | |
---|
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; |
---|
| 4648 | + if (copy.versionindex == -2) |
---|
| 4649 | + { |
---|
| 4650 | + saveVersionButton.setEnabled(false); |
---|
| 4651 | + restoreButton.setEnabled(false); |
---|
| 4652 | + replaceButton.setEnabled(false); |
---|
| 4653 | + previousVersionButton.setEnabled(false); |
---|
| 4654 | + nextVersionButton.setEnabled(false); |
---|
| 4655 | + deleteVersionButton.setEnabled(false); |
---|
| 4656 | + versionSliderPane.setVisible(false); |
---|
| 4657 | + } |
---|
| 4658 | + else |
---|
| 4659 | + { |
---|
| 4660 | + restoreButton.setEnabled(copy.versionindex != -1); |
---|
| 4661 | + replaceButton.setEnabled(copy.versionindex != -1); |
---|
| 4662 | + |
---|
| 4663 | + previousVersionButton.setEnabled(copy.versionindex > 0); |
---|
| 4664 | + nextVersionButton.setEnabled(copy.versionlist[copy.versionindex + 1] != null); |
---|
| 4665 | + |
---|
| 4666 | + deleteVersionButton.setEnabled(copy.versionindex != -1); |
---|
| 4667 | + //copy.versionlist[copy.versionindex + 1] != null); |
---|
| 4668 | + |
---|
| 4669 | + muteSlider = true; |
---|
| 4670 | + versionSlider.setMinimum(0); |
---|
| 4671 | + versionSlider.setMaximum(VersionCount() - 1); |
---|
| 4672 | + versionSlider.setInteger(copy.versionindex); |
---|
| 4673 | + versionSlider.setEnabled(copy.versionindex != -1); |
---|
| 4674 | + muteSlider = false; |
---|
| 4675 | + |
---|
| 4676 | + versionSliderPane.setVisible(true); |
---|
| 4677 | + } |
---|
3915 | 4678 | } |
---|
3916 | 4679 | |
---|
3917 | | - public boolean Undo() |
---|
| 4680 | + public boolean PreviousVersion() |
---|
3918 | 4681 | { |
---|
3919 | 4682 | // Option? |
---|
3920 | 4683 | Replace(); |
---|
3921 | 4684 | |
---|
3922 | 4685 | System.err.println("Undo"); |
---|
3923 | 4686 | |
---|
3924 | | - cRadio tab = GetCurrentTab(); |
---|
| 4687 | + //cRadio tab = GetCurrentTab(); |
---|
3925 | 4688 | |
---|
3926 | 4689 | if (copy.versionindex == 0) |
---|
3927 | 4690 | { |
---|
.. | .. |
---|
3944 | 4707 | |
---|
3945 | 4708 | copy.versionindex -= 1; |
---|
3946 | 4709 | |
---|
3947 | | - CopyChanged((Object3D)copy.versionlist[copy.versionindex]); |
---|
| 4710 | + CopyChanged(); |
---|
3948 | 4711 | |
---|
3949 | 4712 | return true; |
---|
3950 | 4713 | } |
---|
.. | .. |
---|
3953 | 4716 | { |
---|
3954 | 4717 | System.err.println("Restore"); |
---|
3955 | 4718 | |
---|
3956 | | - cRadio tab = GetCurrentTab(); |
---|
| 4719 | + //cRadio tab = GetCurrentTab(); |
---|
3957 | 4720 | |
---|
3958 | 4721 | if (copy.versionindex == -1 || copy.versionlist[copy.versionindex] == null) |
---|
3959 | 4722 | { |
---|
.. | .. |
---|
3962 | 4725 | } |
---|
3963 | 4726 | |
---|
3964 | 4727 | //CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex])); |
---|
3965 | | - CopyChanged(copy.versionlist[copy.versionindex]); |
---|
| 4728 | + CopyChanged(); |
---|
3966 | 4729 | |
---|
3967 | 4730 | return true; |
---|
3968 | 4731 | } |
---|
3969 | 4732 | |
---|
3970 | 4733 | public boolean Replace() |
---|
3971 | 4734 | { |
---|
3972 | | - System.err.println("Replace"); |
---|
| 4735 | + //System.err.println("Replace"); |
---|
3973 | 4736 | |
---|
3974 | | - cRadio tab = GetCurrentTab(); |
---|
| 4737 | + //cRadio tab = GetCurrentTab(); |
---|
3975 | 4738 | |
---|
3976 | 4739 | if (copy.versionindex == -1 || copy.versionlist[copy.versionindex] == null) |
---|
3977 | 4740 | { |
---|
.. | .. |
---|
3979 | 4742 | return false; |
---|
3980 | 4743 | } |
---|
3981 | 4744 | |
---|
3982 | | - copy.versionlist[copy.versionindex] = CompressCopy(); |
---|
| 4745 | + copy.versionlist[copy.versionindex] = Duplicate(copy); |
---|
3983 | 4746 | |
---|
3984 | 4747 | return true; |
---|
3985 | 4748 | } |
---|
3986 | 4749 | |
---|
3987 | | - public void Redo() |
---|
| 4750 | + public void NextVersion() |
---|
3988 | 4751 | { |
---|
3989 | 4752 | // Option? |
---|
3990 | 4753 | Replace(); |
---|
3991 | 4754 | |
---|
3992 | | - cRadio tab = GetCurrentTab(); |
---|
| 4755 | + //cRadio tab = GetCurrentTab(); |
---|
3993 | 4756 | |
---|
3994 | 4757 | if (copy.versionlist[copy.versionindex + 1] == null) |
---|
3995 | 4758 | { |
---|
.. | .. |
---|
3999 | 4762 | |
---|
4000 | 4763 | copy.versionindex += 1; |
---|
4001 | 4764 | |
---|
4002 | | - CopyChanged(copy.versionlist[copy.versionindex]); |
---|
| 4765 | + CopyChanged(); |
---|
4003 | 4766 | |
---|
4004 | 4767 | //if (!tab.user[tab.versionindex]) |
---|
4005 | 4768 | // tab.graphs[tab.versionindex] = null; |
---|
.. | .. |
---|
4196 | 4959 | // else |
---|
4197 | 4960 | // applySelf(true); |
---|
4198 | 4961 | // } |
---|
| 4962 | + |
---|
| 4963 | + boolean Equal(double a, double b) |
---|
| 4964 | + { |
---|
| 4965 | + return Math.abs(a - b) < 0.001; |
---|
| 4966 | + } |
---|
| 4967 | + |
---|
4199 | 4968 | void applySelf0(boolean name) |
---|
4200 | 4969 | { |
---|
4201 | 4970 | if (name) |
---|
.. | .. |
---|
4233 | 5002 | current.shadow = (float) shadowField.getFloat(); |
---|
4234 | 5003 | current.texture = (float) textureField.getFloat(); |
---|
4235 | 5004 | current.opacity = (float) opacityField.getFloat(); |
---|
| 5005 | + current.parallax = (float) parallaxField.getFloat() - 0.125f; |
---|
4236 | 5006 | current.fakedepth = (float) fakedepthField.getFloat(); |
---|
4237 | 5007 | current.shadowbias = (float) shadowbiasField.getFloat(); |
---|
4238 | 5008 | |
---|
.. | .. |
---|
4245 | 5015 | { |
---|
4246 | 5016 | cMaterial mat = copy.material; |
---|
4247 | 5017 | |
---|
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)); |
---|
| 5018 | + if (!Equal(colorField.getFloat(), mat.color)) |
---|
| 5019 | + colorField.SetToolTipValue((mat.color)); |
---|
| 5020 | + if (!Equal(saturationField.getFloat(), mat.modulation)) |
---|
| 5021 | + saturationField.SetToolTipValue((mat.modulation)); |
---|
| 5022 | + if (!Equal(metalnessField.getFloat(), mat.metalness)) |
---|
| 5023 | + metalnessField.SetToolTipValue((mat.metalness)); |
---|
| 5024 | + if (!Equal(diffuseField.getFloat(), mat.diffuse)) |
---|
| 5025 | + diffuseField.SetToolTipValue((mat.diffuse)); |
---|
| 5026 | + if (!Equal(specularField.getFloat(), mat.specular)) |
---|
| 5027 | + specularField.SetToolTipValue((mat.specular)); |
---|
| 5028 | + if (!Equal(shininessField.getFloat(), mat.shininess)) |
---|
| 5029 | + shininessField.SetToolTipValue((mat.shininess)); |
---|
| 5030 | + if (!Equal(shiftField.getFloat(), mat.shift)) |
---|
| 5031 | + shiftField.SetToolTipValue((mat.shift)); |
---|
| 5032 | + if (!Equal(ambientField.getFloat(), mat.ambient)) |
---|
| 5033 | + ambientField.SetToolTipValue((mat.ambient)); |
---|
| 5034 | + if (!Equal(lightareaField.getFloat(), mat.lightarea)) |
---|
| 5035 | + lightareaField.SetToolTipValue((mat.lightarea)); |
---|
| 5036 | + if (!Equal(diffusenessField.getFloat(), mat.factor)) |
---|
| 5037 | + diffusenessField.SetToolTipValue((mat.factor)); |
---|
| 5038 | + if (!Equal(velvetField.getFloat(), mat.velvet)) |
---|
| 5039 | + velvetField.SetToolTipValue((mat.velvet)); |
---|
| 5040 | + if (!Equal(sheenField.getFloat(), mat.sheen)) |
---|
| 5041 | + sheenField.SetToolTipValue((mat.sheen)); |
---|
| 5042 | + if (!Equal(subsurfaceField.getFloat(), mat.subsurface)) |
---|
| 5043 | + subsurfaceField.SetToolTipValue((mat.subsurface)); |
---|
| 5044 | + if (!Equal(backlitField.getFloat(), mat.bump)) |
---|
| 5045 | + backlitField.SetToolTipValue((mat.bump)); |
---|
| 5046 | + if (!Equal(anisoField.getFloat(), mat.aniso)) |
---|
| 5047 | + anisoField.SetToolTipValue((mat.aniso)); |
---|
| 5048 | + if (!Equal(anisoVField.getFloat(), mat.anisoV)) |
---|
| 5049 | + anisoVField.SetToolTipValue((mat.anisoV)); |
---|
| 5050 | + if (!Equal(cameraField.getFloat(), mat.cameralight)) |
---|
| 5051 | + cameraField.SetToolTipValue((mat.cameralight)); |
---|
| 5052 | + if (!Equal(selfshadowField.getFloat(), mat.diffuseness)) |
---|
| 5053 | + selfshadowField.SetToolTipValue((mat.diffuseness)); |
---|
| 5054 | + if (!Equal(shadowField.getFloat(), mat.shadow)) |
---|
| 5055 | + shadowField.SetToolTipValue((mat.shadow)); |
---|
| 5056 | + if (!Equal(textureField.getFloat(), mat.texture)) |
---|
| 5057 | + textureField.SetToolTipValue((mat.texture)); |
---|
| 5058 | + if (!Equal(opacityField.getFloat(), mat.opacity)) |
---|
| 5059 | + opacityField.SetToolTipValue((mat.opacity)); |
---|
| 5060 | + //if (!Equal(parallaxField.getFloat(), mat.parallax)) |
---|
| 5061 | + parallaxField.SetToolTipValue((mat.parallax)); |
---|
| 5062 | + if (!Equal(fakedepthField.getFloat(), mat.fakedepth)) |
---|
| 5063 | + fakedepthField.SetToolTipValue((mat.fakedepth)); |
---|
| 5064 | + if (!Equal(shadowbiasField.getFloat(), mat.shadowbias)) |
---|
| 5065 | + shadowbiasField.SetToolTipValue((mat.shadowbias)); |
---|
4271 | 5066 | } |
---|
4272 | 5067 | |
---|
4273 | 5068 | if (copy.material != null && copy.projectedVertices.length > 0 && copy.projectedVertices[0] != null) |
---|
.. | .. |
---|
4302 | 5097 | |
---|
4303 | 5098 | public void stateChanged(ChangeEvent e) |
---|
4304 | 5099 | { |
---|
4305 | | - // assert(false); |
---|
| 5100 | + // assert(false); |
---|
4306 | 5101 | if (e.getSource() == versionSlider) |
---|
4307 | 5102 | { |
---|
4308 | 5103 | if (muteSlider) |
---|
4309 | 5104 | return; |
---|
4310 | 5105 | |
---|
| 5106 | + Replace(); |
---|
| 5107 | + |
---|
4311 | 5108 | int version = versionSlider.getInteger(); |
---|
4312 | 5109 | |
---|
4313 | | - if (copy.versionlist[version] != null) |
---|
| 5110 | + if (version != -1 && copy.versionlist[version] != null) |
---|
4314 | 5111 | { |
---|
4315 | | - CopyChanged(copy.versionlist[copy.versionindex = version]); |
---|
| 5112 | + copy.versionindex = version; |
---|
| 5113 | + CopyChanged(); |
---|
4316 | 5114 | } |
---|
4317 | 5115 | |
---|
4318 | 5116 | return; |
---|
.. | .. |
---|
4353 | 5151 | //System.out.println("stateChanged = " + this); |
---|
4354 | 5152 | materialtouched = true; |
---|
4355 | 5153 | |
---|
4356 | | - if (e.getSource() == colorField && saturationField.getFloat() == 0.001) |
---|
| 5154 | + if (Globals.AUTOSATURATE && e.getSource() == colorField && saturationField.getFloat() == 0.001) |
---|
4357 | 5155 | { |
---|
4358 | 5156 | saturationField.setFloat(1); |
---|
4359 | 5157 | } |
---|
.. | .. |
---|
4666 | 5464 | ctrlPanel.validate(); // ? new |
---|
4667 | 5465 | ctrlPanel.repaint(); |
---|
4668 | 5466 | } |
---|
| 5467 | + |
---|
| 5468 | + if (previousVersionButton != null && copy.versionlist != null) |
---|
| 5469 | + SetVersionStates(); |
---|
| 5470 | + |
---|
| 5471 | + cameraView.requestFocusInWindow(); |
---|
4669 | 5472 | } |
---|
4670 | 5473 | |
---|
4671 | 5474 | static TweenManager tweenManager = new TweenManager(); |
---|
.. | .. |
---|
4697 | 5500 | // group = (Composite) group.get(0); |
---|
4698 | 5501 | // } |
---|
4699 | 5502 | |
---|
4700 | | - System.out.println("makeSomething of " + thing); |
---|
| 5503 | + //System.out.println("makeSomething of " + thing); |
---|
4701 | 5504 | |
---|
4702 | 5505 | /* |
---|
4703 | 5506 | if (deselect && jList != null) |
---|
.. | .. |
---|
5051 | 5854 | |
---|
5052 | 5855 | copy.versionlist = readobj.versionlist; |
---|
5053 | 5856 | copy.versionindex = readobj.versionindex; |
---|
| 5857 | + copy.versiontable = readobj.versiontable; |
---|
5054 | 5858 | |
---|
5055 | 5859 | if (copy.versionlist == null) |
---|
5056 | 5860 | { |
---|
| 5861 | + // Backward compatibility |
---|
5057 | 5862 | copy.versionlist = new Object3D[100]; |
---|
5058 | 5863 | copy.versionindex = -1; |
---|
| 5864 | + |
---|
| 5865 | + //Save(true); |
---|
5059 | 5866 | } |
---|
5060 | 5867 | |
---|
5061 | 5868 | //? SetUndoStates(); |
---|
.. | .. |
---|
5070 | 5877 | { |
---|
5071 | 5878 | if (Grafreed.standAlone) |
---|
5072 | 5879 | { |
---|
5073 | | - FileDialog browser = new FileDialog(frame, "Load", FileDialog.LOAD); |
---|
| 5880 | + FileDialog browser = new FileDialog(frame, "Open", FileDialog.LOAD); |
---|
5074 | 5881 | browser.show(); |
---|
5075 | 5882 | String filename = browser.getFile(); |
---|
5076 | 5883 | if (filename != null && filename.length() > 0) |
---|
.. | .. |
---|
5147 | 5954 | |
---|
5148 | 5955 | void save() |
---|
5149 | 5956 | { |
---|
| 5957 | + Replace(); |
---|
| 5958 | + |
---|
5150 | 5959 | if (lastname == null) |
---|
5151 | 5960 | { |
---|
5152 | 5961 | return; |
---|
.. | .. |
---|
5389 | 6198 | ButtonGroup buttonGroup; |
---|
5390 | 6199 | |
---|
5391 | 6200 | cGridBag toolboxPanel; |
---|
| 6201 | + cGridBag skyboxPanel; |
---|
5392 | 6202 | cGridBag materialPanel; |
---|
5393 | 6203 | cGridBag ctrlPanel; |
---|
5394 | 6204 | |
---|
.. | .. |
---|
5400 | 6210 | boolean materialFlushed; |
---|
5401 | 6211 | Object3D latestObject; |
---|
5402 | 6212 | |
---|
| 6213 | + cGridBag transformPanel; |
---|
5403 | 6214 | cGridBag XYZPanel; |
---|
5404 | 6215 | |
---|
5405 | 6216 | JSplitPane gridPanel; |
---|
.. | .. |
---|
5493 | 6304 | cNumberSlider anisoField; |
---|
5494 | 6305 | JLabel anisoVLabel; |
---|
5495 | 6306 | cNumberSlider anisoVField; |
---|
| 6307 | + |
---|
5496 | 6308 | JLabel cameraLabel; |
---|
5497 | 6309 | cNumberSlider cameraField; |
---|
5498 | 6310 | JLabel selfshadowLabel; |
---|
.. | .. |
---|
5503 | 6315 | cNumberSlider textureField; |
---|
5504 | 6316 | JLabel opacityLabel; |
---|
5505 | 6317 | cNumberSlider opacityField; |
---|
| 6318 | + JLabel parallaxLabel; |
---|
| 6319 | + cNumberSlider parallaxField; |
---|
5506 | 6320 | JLabel fakedepthLabel; |
---|
5507 | 6321 | cNumberSlider fakedepthField; |
---|
5508 | 6322 | JLabel shadowbiasLabel; |
---|
5509 | 6323 | cNumberSlider shadowbiasField; |
---|
| 6324 | + |
---|
5510 | 6325 | JLabel bumpLabel; |
---|
5511 | 6326 | cNumberSlider bumpField; |
---|
5512 | 6327 | JLabel noiseLabel; |
---|