.. | .. |
---|
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 cGridBag GetSeparator() |
---|
| 76 | + { |
---|
| 77 | + cGridBag separator = new cGridBag(); |
---|
| 78 | + separator.add(new JSeparator()); |
---|
| 79 | + separator.preferredHeight = 5; |
---|
| 80 | + return separator; |
---|
| 81 | + } |
---|
44 | 82 | |
---|
45 | 83 | cButton GetButton(String name, boolean border) |
---|
46 | 84 | { |
---|
47 | 85 | ImageIcon icon = GetIcon(name); |
---|
48 | 86 | return new cButton(icon, border); |
---|
| 87 | + } |
---|
| 88 | + |
---|
| 89 | + cLabel GetLabel(String name, boolean border) |
---|
| 90 | + { |
---|
| 91 | + //ImageIcon icon = GetIcon(name); |
---|
| 92 | + return new cLabel(GetImage(name), border); |
---|
49 | 93 | } |
---|
50 | 94 | |
---|
51 | 95 | cToggleButton GetToggleButton(String name, boolean border) |
---|
.. | .. |
---|
60 | 104 | return new cCheckBox(icon, border); |
---|
61 | 105 | } |
---|
62 | 106 | |
---|
63 | | - private ImageIcon GetIcon(String name) |
---|
| 107 | + static java.util.Hashtable<String, javax.swing.ImageIcon> icons = new java.util.Hashtable<String, javax.swing.ImageIcon>(); |
---|
| 108 | + |
---|
| 109 | + ImageIcon GetIcon(String name) |
---|
| 110 | + { |
---|
| 111 | + javax.swing.ImageIcon iconCache = icons.get(name); |
---|
| 112 | + if (iconCache != null) |
---|
| 113 | + { |
---|
| 114 | + return iconCache; |
---|
| 115 | + } |
---|
| 116 | + |
---|
| 117 | + try |
---|
| 118 | + { |
---|
| 119 | + BufferedImage image = javax.imageio.ImageIO.read(getClass().getClassLoader().getResourceAsStream(name)); |
---|
| 120 | + |
---|
| 121 | +// if (image.getWidth() > 48 && image.getHeight() > 48) |
---|
| 122 | +// { |
---|
| 123 | +// BufferedImage resized = new BufferedImage(48, 48, image.getType()); |
---|
| 124 | +// Graphics2D g = resized.createGraphics(); |
---|
| 125 | +// g.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR); |
---|
| 126 | +// //g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); |
---|
| 127 | +// g.drawImage(image, 0, 0, 48, 48, 0, 0, image.getWidth(), image.getHeight(), null); |
---|
| 128 | +// g.dispose(); |
---|
| 129 | +// |
---|
| 130 | +// image = resized; |
---|
| 131 | +// } |
---|
| 132 | + |
---|
| 133 | + javax.swing.ImageIcon icon = new javax.swing.ImageIcon(image); |
---|
| 134 | + |
---|
| 135 | + icons.put(name, icon); |
---|
| 136 | + |
---|
| 137 | + return icon; |
---|
| 138 | + } |
---|
| 139 | + catch (Exception e) |
---|
| 140 | + { |
---|
| 141 | + //icons.put(name, null); |
---|
| 142 | + return null; |
---|
| 143 | + } |
---|
| 144 | + } |
---|
| 145 | + |
---|
| 146 | + BufferedImage GetImage(String name) |
---|
64 | 147 | { |
---|
65 | 148 | try |
---|
66 | 149 | { |
---|
67 | 150 | BufferedImage image = javax.imageio.ImageIO.read(getClass().getClassLoader().getResourceAsStream(name)); |
---|
68 | 151 | |
---|
69 | | - if (image.getWidth() != 24 && image.getHeight() != 24) |
---|
70 | | - { |
---|
71 | | - BufferedImage resized = new BufferedImage(24, 24, image.getType()); |
---|
72 | | - Graphics2D g = resized.createGraphics(); |
---|
73 | | - g.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR); |
---|
74 | | - //g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); |
---|
75 | | - g.drawImage(image, 0, 0, 24, 24, 0, 0, image.getWidth(), image.getHeight(), null); |
---|
76 | | - g.dispose(); |
---|
77 | | - |
---|
78 | | - image = resized; |
---|
79 | | - } |
---|
80 | | - |
---|
81 | | - javax.swing.ImageIcon icon = new javax.swing.ImageIcon(image); |
---|
82 | | - return icon; |
---|
| 152 | + return image; |
---|
83 | 153 | } |
---|
84 | 154 | catch (Exception e) |
---|
85 | 155 | { |
---|
.. | .. |
---|
268 | 338 | client = inClient; |
---|
269 | 339 | copy = client; |
---|
270 | 340 | |
---|
271 | | - if (copy.versions == null) |
---|
272 | | - { |
---|
273 | | - copy.versions = new byte[100][]; |
---|
274 | | - copy.versionindex = -1; |
---|
275 | | - } |
---|
| 341 | +// if (copy.versionlist == null) |
---|
| 342 | +// { |
---|
| 343 | +// copy.versionlist = new Object3D[100]; |
---|
| 344 | +// copy.versionindex = -1; |
---|
| 345 | +// |
---|
| 346 | +// callee.Save(true); |
---|
| 347 | +// } |
---|
276 | 348 | |
---|
277 | 349 | // "this" is not called: SetupUI2(objEditor); |
---|
278 | 350 | } |
---|
.. | .. |
---|
287 | 359 | client = inClient; |
---|
288 | 360 | copy = client; |
---|
289 | 361 | |
---|
290 | | - if (copy.versions == null) |
---|
| 362 | + if (copy.versionlist == null) |
---|
291 | 363 | { |
---|
292 | | - copy.versions = new byte[100][]; |
---|
| 364 | + copy.versionlist = new Object3D[100]; |
---|
293 | 365 | copy.versionindex = -1; |
---|
| 366 | + |
---|
| 367 | +// Save(true); |
---|
294 | 368 | } |
---|
295 | 369 | |
---|
296 | 370 | SetupUI2(callee.GetEditor()); |
---|
.. | .. |
---|
314 | 388 | //parent = p; |
---|
315 | 389 | |
---|
316 | 390 | GraphicsDevice gd = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice(); |
---|
317 | | - System.out.println("getFullScreenWindow? " + gd.getFullScreenWindow()); |
---|
| 391 | + if (Globals.DEBUG) |
---|
| 392 | + System.out.println("getFullScreenWindow? " + gd.getFullScreenWindow()); |
---|
318 | 393 | //gd.setFullScreenWindow(this); |
---|
319 | 394 | //setResizable(false); |
---|
320 | 395 | //if (!isDisplayable()) |
---|
.. | .. |
---|
325 | 400 | copy = localCopy; |
---|
326 | 401 | copy.editWindow = this; |
---|
327 | 402 | |
---|
328 | | - if (copy.versions == null) |
---|
329 | | - { |
---|
330 | | -// copy.versions = new byte[100][]; |
---|
| 403 | +// if (copy.versionlist == null) |
---|
| 404 | +// { |
---|
| 405 | +// copy.versionlist = new Object3D[100]; |
---|
331 | 406 | // copy.versionindex = -1; |
---|
332 | | - } |
---|
| 407 | +// |
---|
| 408 | +// Save(true); |
---|
| 409 | +// } |
---|
333 | 410 | |
---|
334 | 411 | SetupMenu(); |
---|
335 | 412 | |
---|
.. | .. |
---|
349 | 426 | |
---|
350 | 427 | static java.util.Vector<Object3D> listUI = new java.util.Vector<Object3D>(); |
---|
351 | 428 | |
---|
| 429 | + // This is to refresh the UI of the material panel. |
---|
| 430 | + boolean patchMaterial; |
---|
| 431 | + |
---|
352 | 432 | void SetupMenu() |
---|
353 | 433 | { |
---|
354 | 434 | frame.setMenuBar(menuBar = new MenuBar()); |
---|
.. | .. |
---|
398 | 478 | |
---|
399 | 479 | ChangeListener changeListener = new ChangeListener() |
---|
400 | 480 | { |
---|
| 481 | + //String name; |
---|
| 482 | + |
---|
401 | 483 | public void stateChanged(ChangeEvent changeEvent) |
---|
402 | 484 | { |
---|
403 | 485 | // if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Material") && !materialFlushed) |
---|
.. | .. |
---|
416 | 498 | // EditSelection(false); |
---|
417 | 499 | // } |
---|
418 | 500 | |
---|
419 | | - refreshContents(false); // To refresh Info tab |
---|
| 501 | +// if (objectPanel.getSelectedIndex() == 4) |
---|
| 502 | +// { |
---|
| 503 | +// name = copy.skyboxname; |
---|
| 504 | +// |
---|
| 505 | +// if (name == null) |
---|
| 506 | +// { |
---|
| 507 | +// name = ""; |
---|
| 508 | +// } |
---|
| 509 | +// |
---|
| 510 | +// copy.skyboxname = "cubemaps/default-skyboxes/rgb"; |
---|
| 511 | +// copy.skyboxext = "jpg"; |
---|
| 512 | +// } |
---|
| 513 | +// else |
---|
| 514 | +// { |
---|
| 515 | +// if (name != null) |
---|
| 516 | +// { |
---|
| 517 | +// if (name.equals("")) |
---|
| 518 | +// { |
---|
| 519 | +// copy.skyboxname = null; |
---|
| 520 | +// copy.skyboxext = null; |
---|
| 521 | +// } |
---|
| 522 | +// else |
---|
| 523 | +// { |
---|
| 524 | +// copy.skyboxname = name; |
---|
| 525 | +// } |
---|
| 526 | +// } |
---|
| 527 | +// } |
---|
| 528 | + cameraView.transformMode = objectPanel.getSelectedIndex() == 4; |
---|
| 529 | + |
---|
| 530 | +// refreshContents(false); // To refresh Info tab |
---|
| 531 | + cameraView.repaint(); |
---|
420 | 532 | } |
---|
421 | 533 | }; |
---|
422 | 534 | objectPanel.addChangeListener(changeListener); |
---|
.. | .. |
---|
436 | 548 | editPanel.add(editCommandsPanel); |
---|
437 | 549 | editPanel.add(ctrlPanel); |
---|
438 | 550 | |
---|
439 | | - toolboxPanel = new cGridBag().setVertical(false); |
---|
| 551 | + toolboxPanel = new cGridBag().setVertical(true); |
---|
440 | 552 | //toolboxPanel.setName("Toolbox"); |
---|
441 | 553 | |
---|
442 | | - materialPanel = new cGridBag().setVertical(true); |
---|
| 554 | + skyboxPanel = new cGridBag().setVertical(true); |
---|
| 555 | + |
---|
| 556 | + materialPanel = new cGridBag().setVertical(false); |
---|
443 | 557 | //materialPanel.setName("Material"); |
---|
444 | 558 | |
---|
445 | 559 | /*JTextPane*/ |
---|
.. | .. |
---|
723 | 837 | boolean maximized; |
---|
724 | 838 | |
---|
725 | 839 | cButton fullscreenLayout; |
---|
| 840 | + cButton expandedLayout; |
---|
726 | 841 | |
---|
727 | 842 | void Minimize() |
---|
728 | 843 | { |
---|
.. | .. |
---|
762 | 877 | cButton minButton; |
---|
763 | 878 | cButton maxButton; |
---|
764 | 879 | cButton fullButton; |
---|
| 880 | + cButton collapseButton; |
---|
| 881 | + cButton maximize3DButton; |
---|
765 | 882 | |
---|
766 | 883 | void ToggleFullScreen() |
---|
767 | 884 | { |
---|
768 | | -GraphicsDevice device = frame.getGraphicsConfiguration().getDevice(); |
---|
| 885 | + GraphicsDevice device = frame.getGraphicsConfiguration().getDevice(); |
---|
769 | 886 | |
---|
770 | 887 | cameraView.ToggleFullScreen(); |
---|
771 | 888 | |
---|
.. | .. |
---|
786 | 903 | // X frame.getContentPane().remove(/*"Center",*/bigThree); |
---|
787 | 904 | // X framePanel.add(bigThree); |
---|
788 | 905 | // X frame.getContentPane().add(/*"Center",*/framePanel); |
---|
789 | | - framePanel.setDividerLocation(46); |
---|
| 906 | +// framePanel.setDividerLocation(46); // icons are 24x24 |
---|
790 | 907 | |
---|
791 | 908 | //frame.setVisible(true); |
---|
792 | | - radio.layout = keepButton; |
---|
| 909 | +// radio.layout = keepButton; |
---|
793 | 910 | //theFrame = null; |
---|
794 | 911 | keepButton = null; |
---|
795 | | - radio.layout.doClick(); |
---|
| 912 | +// radio.layout.doClick(); |
---|
796 | 913 | |
---|
797 | 914 | } else |
---|
798 | 915 | { |
---|
.. | .. |
---|
813 | 930 | // X frame.getContentPane().remove(/*"Center",*/framePanel); |
---|
814 | 931 | // X framePanel.remove(bigThree); |
---|
815 | 932 | // X frame.getContentPane().add(/*"Center",*/bigThree); |
---|
816 | | - framePanel.setDividerLocation(0); |
---|
| 933 | +// framePanel.setDividerLocation(0); |
---|
817 | 934 | |
---|
818 | | - radio.layout = fullscreenLayout; |
---|
819 | | - radio.layout.doClick(); |
---|
| 935 | +// radio.layout = fullscreenLayout; |
---|
| 936 | +// radio.layout.doClick(); |
---|
820 | 937 | //frame.setVisible(true); |
---|
821 | 938 | } |
---|
822 | 939 | frame.validate(); |
---|
| 940 | + |
---|
| 941 | + cameraView.requestFocusInWindow(); |
---|
823 | 942 | } |
---|
824 | 943 | |
---|
825 | | - private byte[] CompressCopy() |
---|
| 944 | + void CollapseToolbar() |
---|
| 945 | + { |
---|
| 946 | + framePanel.setDividerLocation(0); |
---|
| 947 | + //frame.validate(); |
---|
| 948 | + |
---|
| 949 | + cameraView.requestFocusInWindow(); |
---|
| 950 | + } |
---|
| 951 | + |
---|
| 952 | + private Object3D Duplicate(Object3D object) |
---|
826 | 953 | { |
---|
827 | 954 | boolean temp = CameraPane.SWITCH; |
---|
828 | 955 | CameraPane.SWITCH = false; |
---|
829 | 956 | |
---|
830 | | - copy.ExtractBigData(versiontable); |
---|
| 957 | + if (Grafreed.grafreed.universe.versiontable == null) |
---|
| 958 | + Grafreed.grafreed.universe.versiontable = new java.util.Hashtable<java.util.UUID, Object3D>(); |
---|
| 959 | + |
---|
| 960 | + object.ExtractBigData(Grafreed.grafreed.universe.versiontable); |
---|
831 | 961 | // if (copy == client) |
---|
832 | 962 | |
---|
833 | | - byte[] versions[] = copy.versions; |
---|
834 | | - copy.versions = null; |
---|
| 963 | + Object3D versions[] = object.versionlist; |
---|
| 964 | + java.util.Hashtable<java.util.UUID, Object3D> versiontable = object.versiontable; // if Grafreed.grafreed.universe |
---|
| 965 | + object.versionlist = null; |
---|
| 966 | + object.versiontable = null; |
---|
835 | 967 | |
---|
836 | | - byte[] compress = Compress(copy); |
---|
| 968 | + //byte[] compress = Compress(copy); |
---|
| 969 | + Object3D compress = (Object3D)Grafreed.clone(object); |
---|
837 | 970 | |
---|
838 | | - copy.versions = versions; |
---|
| 971 | + object.versionlist = versions; |
---|
| 972 | + object.versiontable = versiontable; // if Grafreed.grafreed.universe |
---|
839 | 973 | |
---|
840 | | - copy.RestoreBigData(versiontable); |
---|
| 974 | + object.RestoreBigData(Grafreed.grafreed.universe.versiontable); |
---|
841 | 975 | |
---|
842 | 976 | CameraPane.SWITCH = temp; |
---|
843 | 977 | |
---|
.. | .. |
---|
965 | 1099 | { |
---|
966 | 1100 | SetupMaterial(materialPanel); |
---|
967 | 1101 | } |
---|
| 1102 | + |
---|
968 | 1103 | //SetupName(); |
---|
969 | 1104 | //SetupViews(); |
---|
970 | 1105 | } |
---|
.. | .. |
---|
1173 | 1308 | |
---|
1174 | 1309 | namePanel = new cGridBag(); |
---|
1175 | 1310 | |
---|
| 1311 | + //if (copy.pinned) |
---|
| 1312 | + { |
---|
| 1313 | + pinButton = GetToggleButton("icons/pin.png", !Grafreed.NIMBUSLAF); |
---|
| 1314 | + pinButton.setSelected(copy.pinned); |
---|
| 1315 | + cGridBag t = new cGridBag(); |
---|
| 1316 | + t.preferredWidth = 2; |
---|
| 1317 | + t.add(pinButton); |
---|
| 1318 | + namePanel.add(t); |
---|
| 1319 | + |
---|
| 1320 | + pinButton.addItemListener(this); |
---|
| 1321 | + } |
---|
| 1322 | + |
---|
1176 | 1323 | nameField = AddText(namePanel, copy.GetName()); |
---|
1177 | 1324 | namePanel.add(new JScrollPane(nameField, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER)); |
---|
1178 | 1325 | oe.ctrlPanel.add(namePanel); |
---|
.. | .. |
---|
1186 | 1333 | |
---|
1187 | 1334 | liveCB = AddCheckBox(setupPanel, "Live", copy.live); |
---|
1188 | 1335 | liveCB.setToolTipText("Animate object"); |
---|
| 1336 | + markCB = AddCheckBox(setupPanel, "Anim", copy.marked); |
---|
| 1337 | + markCB.setToolTipText("Set target transform"); |
---|
1189 | 1338 | selectableCB = AddCheckBox(setupPanel, "Select", !copy.dontselect); |
---|
1190 | 1339 | selectableCB.setToolTipText("Make object selectable"); |
---|
1191 | 1340 | // Return(); |
---|
1192 | 1341 | |
---|
1193 | 1342 | hideCB = AddCheckBox(setupPanel, "Hide", copy.hide); |
---|
1194 | 1343 | hideCB.setToolTipText("Hide object"); |
---|
1195 | | - markCB = AddCheckBox(setupPanel, "Mark", copy.marked); |
---|
1196 | | - markCB.setToolTipText("As animation target transform"); |
---|
| 1344 | + |
---|
| 1345 | + ToolTipManager.sharedInstance().setLightWeightPopupEnabled(false); |
---|
1197 | 1346 | |
---|
1198 | 1347 | setupPanel2 = new cGridBag().setVertical(false); |
---|
1199 | 1348 | |
---|
.. | .. |
---|
1393 | 1542 | |
---|
1394 | 1543 | if (cam == null || !(copy.get(0) instanceof cGroup)) |
---|
1395 | 1544 | { |
---|
| 1545 | + if (Globals.DEBUG) |
---|
1396 | 1546 | System.out.println("CREATE CAMERAS"); |
---|
1397 | 1547 | cams = new cTemplate(); |
---|
1398 | 1548 | cams.name = "Cameras"; |
---|
.. | .. |
---|
1518 | 1668 | |
---|
1519 | 1669 | //JScrollPane tmp = new JScrollPane(ctrlPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); |
---|
1520 | 1670 | //tmp.setName("Edit"); |
---|
| 1671 | + objectPanel.add(toolboxPanel); |
---|
| 1672 | + objectPanel.setIconAt(0, GetIcon("icons/primitives.png")); |
---|
| 1673 | + objectPanel.setToolTipTextAt(0, "Objects & textures"); |
---|
| 1674 | + |
---|
1521 | 1675 | objectPanel.add(materialPanel); |
---|
1522 | | - objectPanel.setIconAt(0, GetIcon("icons/material.png")); |
---|
| 1676 | + objectPanel.setIconAt(1, GetIcon("icons/material.png")); |
---|
| 1677 | + objectPanel.setToolTipTextAt(1, "Material"); |
---|
| 1678 | + |
---|
| 1679 | + objectPanel.add(skyboxPanel); |
---|
| 1680 | + objectPanel.setIconAt(2, GetIcon("icons/skybox.jpg")); |
---|
| 1681 | + objectPanel.setToolTipTextAt(2, "Backgrounds"); |
---|
| 1682 | + |
---|
1523 | 1683 | // JPanel north = new JPanel(new BorderLayout()); |
---|
1524 | 1684 | // north.setName("Edit"); |
---|
1525 | 1685 | // north.add(ctrlPanel, BorderLayout.NORTH); |
---|
1526 | 1686 | // objectPanel.add(north); |
---|
1527 | 1687 | objectPanel.add(editPanel); |
---|
1528 | | - objectPanel.setIconAt(1, GetIcon("icons/write.png")); |
---|
1529 | | - |
---|
1530 | | - //if (Globals.ADVANCED) |
---|
1531 | | - objectPanel.add(infoPanel); |
---|
1532 | | - objectPanel.setIconAt(2, GetIcon("icons/info.png")); |
---|
| 1688 | + objectPanel.setIconAt(3, GetIcon("icons/write.png")); |
---|
| 1689 | + objectPanel.setToolTipTextAt(3, "Edit controls"); |
---|
1533 | 1690 | |
---|
1534 | 1691 | objectPanel.add(XYZPanel); |
---|
1535 | | - objectPanel.setIconAt(3, GetIcon("icons/XYZ.png")); |
---|
| 1692 | + objectPanel.setIconAt(4, GetIcon("icons/XYZ.png")); |
---|
| 1693 | + objectPanel.setToolTipTextAt(4, "XYZ/RGB transform"); |
---|
1536 | 1694 | |
---|
1537 | | - objectPanel.add(toolboxPanel); |
---|
1538 | | - objectPanel.setIconAt(4, GetIcon("icons/primitives.png")); |
---|
1539 | | - |
---|
| 1695 | + patchMaterial = true; |
---|
| 1696 | + cameraView.patchMaterial = this; |
---|
| 1697 | + objectPanel.setSelectedIndex(1); |
---|
| 1698 | + |
---|
1540 | 1699 | /* |
---|
1541 | 1700 | aConstraints.gridx = 0; |
---|
1542 | 1701 | aConstraints.gridwidth = 1; |
---|
.. | .. |
---|
1573 | 1732 | |
---|
1574 | 1733 | scenePanel.add(tabbedPane); |
---|
1575 | 1734 | |
---|
| 1735 | + //if (Globals.ADVANCED) |
---|
| 1736 | +// tabbedPane.add(infoPanel); |
---|
| 1737 | +// tabbedPane.setIconAt(3, GetIcon("icons/info.png")); |
---|
| 1738 | +// tabbedPane.setToolTipTextAt(3, "Information"); |
---|
| 1739 | + |
---|
1576 | 1740 | /* |
---|
1577 | 1741 | cTree jTree = new cTree(null); |
---|
1578 | 1742 | ToolTipManager.sharedInstance().registerComponent(jTree); |
---|
.. | .. |
---|
1632 | 1796 | /**/ |
---|
1633 | 1797 | |
---|
1634 | 1798 | bigThree = new cGridBag(); |
---|
1635 | | - bigThree.addComponent(centralPanel); |
---|
1636 | 1799 | bigThree.addComponent(scenePanel); |
---|
| 1800 | + bigThree.addComponent(centralPanel); |
---|
1637 | 1801 | //bigThree.addComponent(XYZPanel); |
---|
1638 | 1802 | |
---|
1639 | 1803 | // // SIDE EFFECT!!! |
---|
.. | .. |
---|
1643 | 1807 | // aConstraints.gridheight = 1; |
---|
1644 | 1808 | |
---|
1645 | 1809 | framePanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, toolbarPanel, bigThree); |
---|
| 1810 | + |
---|
| 1811 | + framePanel.addPropertyChangeListener(JSplitPane.DIVIDER_LOCATION_PROPERTY, |
---|
| 1812 | + new java.beans.PropertyChangeListener() |
---|
| 1813 | + { |
---|
| 1814 | + public void propertyChange(java.beans.PropertyChangeEvent pce) |
---|
| 1815 | + { |
---|
| 1816 | + if ((Integer)pce.getOldValue() == 1) |
---|
| 1817 | + { |
---|
| 1818 | + if (radio.layout != expandedLayout) |
---|
| 1819 | + { |
---|
| 1820 | + radio.layout = expandedLayout; |
---|
| 1821 | + radio.layout.doClick(); |
---|
| 1822 | + } |
---|
| 1823 | + } |
---|
| 1824 | + } |
---|
| 1825 | + }); |
---|
| 1826 | + |
---|
1646 | 1827 | framePanel.setContinuousLayout(false); |
---|
1647 | 1828 | framePanel.setOneTouchExpandable(false); |
---|
1648 | 1829 | //.setDividerLocation(0.8); |
---|
.. | .. |
---|
1652 | 1833 | |
---|
1653 | 1834 | frame.getContentPane().setLayout(new BorderLayout()); |
---|
1654 | 1835 | /**/ |
---|
1655 | | - JTabbedPane worldPane = new JTabbedPane(); |
---|
| 1836 | + //JTabbedPane worldPane = new JTabbedPane(); |
---|
1656 | 1837 | //worldPane.add(bigPanel); |
---|
1657 | 1838 | //worldPane.add(worldPanel); |
---|
1658 | 1839 | /**/ |
---|
.. | .. |
---|
1675 | 1856 | frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); |
---|
1676 | 1857 | frame.addWindowListener(new WindowAdapter() |
---|
1677 | 1858 | { |
---|
1678 | | - |
---|
1679 | 1859 | public void windowClosing(WindowEvent e) |
---|
1680 | 1860 | { |
---|
1681 | 1861 | Close(); |
---|
.. | .. |
---|
1698 | 1878 | ctrlPanel.removeAll(); |
---|
1699 | 1879 | } |
---|
1700 | 1880 | |
---|
1701 | | - void SetupMaterial(cGridBag panel) |
---|
| 1881 | + void SetupMaterial(cGridBag materialpanel) |
---|
1702 | 1882 | { |
---|
1703 | | - /* |
---|
| 1883 | + cGridBag presetpanel = new cGridBag().setVertical(true); |
---|
| 1884 | + |
---|
| 1885 | + cLabel skin = GetLabel("icons/shadericons/shadericon00000.png", !Grafreed.NIMBUSLAF); |
---|
| 1886 | + skin.setToolTipText("Skin"); |
---|
| 1887 | + skin.addMouseListener(new MouseAdapter() |
---|
| 1888 | + { |
---|
| 1889 | + public void mouseClicked(MouseEvent e) |
---|
| 1890 | + { |
---|
| 1891 | + Object3D object = Grafreed.materials.versionlist[0].get(0); |
---|
| 1892 | + cMaterial material = object.material; |
---|
| 1893 | + |
---|
| 1894 | + // Skin |
---|
| 1895 | + colorField.setFloat(material.color); |
---|
| 1896 | + float saturation = material.modulation; |
---|
| 1897 | + |
---|
| 1898 | + if (!cameraView.Skinshader) |
---|
| 1899 | + { |
---|
| 1900 | + saturation /= 1.5; |
---|
| 1901 | + } |
---|
| 1902 | + |
---|
| 1903 | + saturationField.setFloat(saturation); |
---|
| 1904 | + |
---|
| 1905 | + subsurfaceField.setFloat(material.subsurface); |
---|
| 1906 | + selfshadowField.setFloat(material.diffuseness); |
---|
| 1907 | + diffusenessField.setFloat(material.factor); |
---|
| 1908 | + shininessField.setFloat(material.shininess); |
---|
| 1909 | + shadowbiasField.setFloat(material.shadowbias); |
---|
| 1910 | + diffuseField.setFloat(material.diffuse); |
---|
| 1911 | + specularField.setFloat(material.specular); |
---|
| 1912 | + |
---|
| 1913 | + bumpField.setFloat(object.projectedVertices[0].x / 1000.0); |
---|
| 1914 | + noiseField.setFloat(object.projectedVertices[0].y / 1000.0); |
---|
| 1915 | + powerField.setFloat(object.projectedVertices[2].x / 1000.0); |
---|
| 1916 | + |
---|
| 1917 | + materialtouched = true; |
---|
| 1918 | + applySelf(); |
---|
| 1919 | + } |
---|
| 1920 | + }); |
---|
| 1921 | + presetpanel.add(skin); |
---|
| 1922 | + |
---|
| 1923 | + cLabel lambert = GetLabel("icons/shadericons/shadericon00002.png", !Grafreed.NIMBUSLAF); |
---|
| 1924 | + lambert.setToolTipText("Diffuse"); |
---|
| 1925 | + lambert.addMouseListener(new MouseAdapter() |
---|
| 1926 | + { |
---|
| 1927 | + public void mouseClicked(MouseEvent e) |
---|
| 1928 | + { |
---|
| 1929 | + Object3D object = Grafreed.materials.versionlist[2].get(0); |
---|
| 1930 | + cMaterial material = object.material; |
---|
| 1931 | + |
---|
| 1932 | + diffusenessField.setFloat(material.factor); |
---|
| 1933 | + selfshadowField.setFloat(material.diffuseness); |
---|
| 1934 | + |
---|
| 1935 | + materialtouched = true; |
---|
| 1936 | + applySelf(); |
---|
| 1937 | + } |
---|
| 1938 | + }); |
---|
| 1939 | + presetpanel.add(lambert); |
---|
| 1940 | + |
---|
| 1941 | + cLabel diffuse2 = GetLabel("icons/shadericons/shadericon00003.png", !Grafreed.NIMBUSLAF); |
---|
| 1942 | + diffuse2.setToolTipText("Diffuse2"); |
---|
| 1943 | + diffuse2.addMouseListener(new MouseAdapter() |
---|
| 1944 | + { |
---|
| 1945 | + public void mouseClicked(MouseEvent e) |
---|
| 1946 | + { |
---|
| 1947 | + Object3D object = Grafreed.materials.versionlist[3].get(0); |
---|
| 1948 | + cMaterial material = object.material; |
---|
| 1949 | + |
---|
| 1950 | + diffusenessField.setFloat(material.factor); |
---|
| 1951 | + selfshadowField.setFloat(material.diffuseness); |
---|
| 1952 | + |
---|
| 1953 | + materialtouched = true; |
---|
| 1954 | + applySelf(); |
---|
| 1955 | + } |
---|
| 1956 | + }); |
---|
| 1957 | + presetpanel.add(diffuse2); |
---|
| 1958 | + |
---|
| 1959 | + cLabel diffusemoon = GetLabel("icons/shadericons/shadericon00004.png", !Grafreed.NIMBUSLAF); |
---|
| 1960 | + diffusemoon.setToolTipText("Moon"); |
---|
| 1961 | + diffusemoon.addMouseListener(new MouseAdapter() |
---|
| 1962 | + { |
---|
| 1963 | + public void mouseClicked(MouseEvent e) |
---|
| 1964 | + { |
---|
| 1965 | + Object3D object = Grafreed.materials.versionlist[4].get(0); |
---|
| 1966 | + cMaterial material = object.material; |
---|
| 1967 | + |
---|
| 1968 | + diffusenessField.setFloat(material.factor); |
---|
| 1969 | + selfshadowField.setFloat(material.diffuseness); |
---|
| 1970 | + |
---|
| 1971 | + materialtouched = true; |
---|
| 1972 | + applySelf(); |
---|
| 1973 | + } |
---|
| 1974 | + }); |
---|
| 1975 | + presetpanel.add(diffusemoon); |
---|
| 1976 | + |
---|
| 1977 | + cLabel diffusemoon2 = GetLabel("icons/shadericons/shadericon00005.png", !Grafreed.NIMBUSLAF); |
---|
| 1978 | + diffusemoon2.setToolTipText("Moon2"); |
---|
| 1979 | + diffusemoon2.addMouseListener(new MouseAdapter() |
---|
| 1980 | + { |
---|
| 1981 | + public void mouseClicked(MouseEvent e) |
---|
| 1982 | + { |
---|
| 1983 | + Object3D object = Grafreed.materials.versionlist[5].get(0); |
---|
| 1984 | + cMaterial material = object.material; |
---|
| 1985 | + |
---|
| 1986 | + diffusenessField.setFloat(material.factor); |
---|
| 1987 | + selfshadowField.setFloat(material.diffuseness); |
---|
| 1988 | + |
---|
| 1989 | + materialtouched = true; |
---|
| 1990 | + applySelf(); |
---|
| 1991 | + } |
---|
| 1992 | + }); |
---|
| 1993 | + presetpanel.add(diffusemoon2); |
---|
| 1994 | + |
---|
| 1995 | + cLabel diffusemoon3 = GetLabel("icons/shadericons/shadericon00006.png", !Grafreed.NIMBUSLAF); |
---|
| 1996 | + diffusemoon3.setToolTipText("Moon3"); |
---|
| 1997 | + diffusemoon3.addMouseListener(new MouseAdapter() |
---|
| 1998 | + { |
---|
| 1999 | + public void mouseClicked(MouseEvent e) |
---|
| 2000 | + { |
---|
| 2001 | + Object3D object = Grafreed.materials.versionlist[6].get(0); |
---|
| 2002 | + cMaterial material = object.material; |
---|
| 2003 | + |
---|
| 2004 | + diffusenessField.setFloat(material.factor); |
---|
| 2005 | + selfshadowField.setFloat(material.diffuseness); |
---|
| 2006 | + |
---|
| 2007 | + materialtouched = true; |
---|
| 2008 | + applySelf(); |
---|
| 2009 | + } |
---|
| 2010 | + }); |
---|
| 2011 | + presetpanel.add(diffusemoon3); |
---|
| 2012 | + |
---|
| 2013 | + cLabel diffusesheen = GetLabel("icons/shadericons/shadericon00007.png", !Grafreed.NIMBUSLAF); |
---|
| 2014 | + diffusesheen.setToolTipText("Sheen"); |
---|
| 2015 | + diffusesheen.addMouseListener(new MouseAdapter() |
---|
| 2016 | + { |
---|
| 2017 | + public void mouseClicked(MouseEvent e) |
---|
| 2018 | + { |
---|
| 2019 | + Object3D object = Grafreed.materials.versionlist[7].get(0); |
---|
| 2020 | + cMaterial material = object.material; |
---|
| 2021 | + |
---|
| 2022 | + sheenField.setFloat(material.sheen); |
---|
| 2023 | + |
---|
| 2024 | + materialtouched = true; |
---|
| 2025 | + applySelf(); |
---|
| 2026 | + } |
---|
| 2027 | + }); |
---|
| 2028 | + presetpanel.add(diffusesheen); |
---|
| 2029 | + |
---|
| 2030 | + cLabel rough = GetLabel("icons/shadericons/shadericon00001.png", !Grafreed.NIMBUSLAF); |
---|
| 2031 | + rough.setToolTipText("Rough metal"); |
---|
| 2032 | + rough.addMouseListener(new MouseAdapter() |
---|
| 2033 | + { |
---|
| 2034 | + public void mouseClicked(MouseEvent e) |
---|
| 2035 | + { |
---|
| 2036 | + Object3D object = Grafreed.materials.versionlist[1].get(0); |
---|
| 2037 | + cMaterial material = object.material; |
---|
| 2038 | + |
---|
| 2039 | + shininessField.setFloat(material.shininess); |
---|
| 2040 | + velvetField.setFloat(material.velvet); |
---|
| 2041 | + |
---|
| 2042 | + materialtouched = true; |
---|
| 2043 | + applySelf(); |
---|
| 2044 | + } |
---|
| 2045 | + }); |
---|
| 2046 | + presetpanel.add(rough); |
---|
| 2047 | + |
---|
| 2048 | + cLabel rough2 = GetLabel("icons/shadericons/shadericon00013.png", !Grafreed.NIMBUSLAF); |
---|
| 2049 | + rough2.setToolTipText("Medium metal"); |
---|
| 2050 | + rough2.addMouseListener(new MouseAdapter() |
---|
| 2051 | + { |
---|
| 2052 | + public void mouseClicked(MouseEvent e) |
---|
| 2053 | + { |
---|
| 2054 | + Object3D object = Grafreed.materials.versionlist[13].get(0); |
---|
| 2055 | + cMaterial material = object.material; |
---|
| 2056 | + |
---|
| 2057 | + shininessField.setFloat(material.shininess); |
---|
| 2058 | + lightareaField.setFloat(material.lightarea); |
---|
| 2059 | + |
---|
| 2060 | + materialtouched = true; |
---|
| 2061 | + applySelf(); |
---|
| 2062 | + } |
---|
| 2063 | + }); |
---|
| 2064 | + presetpanel.add(rough2); |
---|
| 2065 | + |
---|
| 2066 | + cLabel shini0 = GetLabel("icons/shadericons/shadericon00014.png", !Grafreed.NIMBUSLAF); |
---|
| 2067 | + shini0.setToolTipText("Shiny"); |
---|
| 2068 | + shini0.addMouseListener(new MouseAdapter() |
---|
| 2069 | + { |
---|
| 2070 | + public void mouseClicked(MouseEvent e) |
---|
| 2071 | + { |
---|
| 2072 | + Object3D object = Grafreed.materials.versionlist[14].get(0); |
---|
| 2073 | + cMaterial material = object.material; |
---|
| 2074 | + |
---|
| 2075 | + shininessField.setFloat(material.shininess); |
---|
| 2076 | + lightareaField.setFloat(material.lightarea); |
---|
| 2077 | + |
---|
| 2078 | + materialtouched = true; |
---|
| 2079 | + applySelf(); |
---|
| 2080 | + } |
---|
| 2081 | + }); |
---|
| 2082 | + presetpanel.add(shini0); |
---|
| 2083 | + |
---|
| 2084 | + cLabel shini1 = GetLabel("icons/shadericons/shadericon00011.png", !Grafreed.NIMBUSLAF); |
---|
| 2085 | + shini1.setToolTipText("Shiny2"); |
---|
| 2086 | + shini1.addMouseListener(new MouseAdapter() |
---|
| 2087 | + { |
---|
| 2088 | + public void mouseClicked(MouseEvent e) |
---|
| 2089 | + { |
---|
| 2090 | + Object3D object = Grafreed.materials.versionlist[11].get(0); |
---|
| 2091 | + cMaterial material = object.material; |
---|
| 2092 | + |
---|
| 2093 | + shininessField.setFloat(material.shininess); |
---|
| 2094 | + lightareaField.setFloat(material.lightarea); |
---|
| 2095 | + |
---|
| 2096 | + materialtouched = true; |
---|
| 2097 | + applySelf(); |
---|
| 2098 | + } |
---|
| 2099 | + }); |
---|
| 2100 | + presetpanel.add(shini1); |
---|
| 2101 | + |
---|
| 2102 | + cLabel shini2 = GetLabel("icons/shadericons/shadericon00012.png", !Grafreed.NIMBUSLAF); |
---|
| 2103 | + shini2.setToolTipText("Shiny3"); |
---|
| 2104 | + shini2.addMouseListener(new MouseAdapter() |
---|
| 2105 | + { |
---|
| 2106 | + public void mouseClicked(MouseEvent e) |
---|
| 2107 | + { |
---|
| 2108 | + Object3D object = Grafreed.materials.versionlist[12].get(0); |
---|
| 2109 | + cMaterial material = object.material; |
---|
| 2110 | + |
---|
| 2111 | + shininessField.setFloat(material.shininess); |
---|
| 2112 | + lightareaField.setFloat(material.lightarea); |
---|
| 2113 | + |
---|
| 2114 | + materialtouched = true; |
---|
| 2115 | + applySelf(); |
---|
| 2116 | + } |
---|
| 2117 | + }); |
---|
| 2118 | + presetpanel.add(shini2); |
---|
| 2119 | + |
---|
| 2120 | + cLabel aniso = GetLabel("icons/shadericons/shadericon00008.png", !Grafreed.NIMBUSLAF); |
---|
| 2121 | + aniso.setToolTipText("AnisoU"); |
---|
| 2122 | + aniso.addMouseListener(new MouseAdapter() |
---|
| 2123 | + { |
---|
| 2124 | + public void mouseClicked(MouseEvent e) |
---|
| 2125 | + { |
---|
| 2126 | + Object3D object = Grafreed.materials.versionlist[8].get(0); |
---|
| 2127 | + cMaterial material = object.material; |
---|
| 2128 | + |
---|
| 2129 | + anisoField.setFloat(material.aniso); |
---|
| 2130 | + anisoVField.setFloat(material.anisoV); |
---|
| 2131 | + |
---|
| 2132 | + materialtouched = true; |
---|
| 2133 | + applySelf(); |
---|
| 2134 | + } |
---|
| 2135 | + }); |
---|
| 2136 | + presetpanel.add(aniso); |
---|
| 2137 | + |
---|
| 2138 | + cLabel aniso2 = GetLabel("icons/shadericons/shadericon00009.png", !Grafreed.NIMBUSLAF); |
---|
| 2139 | + aniso2.setToolTipText("AnisoV"); |
---|
| 2140 | + aniso2.addMouseListener(new MouseAdapter() |
---|
| 2141 | + { |
---|
| 2142 | + public void mouseClicked(MouseEvent e) |
---|
| 2143 | + { |
---|
| 2144 | + Object3D object = Grafreed.materials.versionlist[9].get(0); |
---|
| 2145 | + cMaterial material = object.material; |
---|
| 2146 | + |
---|
| 2147 | + anisoField.setFloat(material.aniso); |
---|
| 2148 | + anisoVField.setFloat(material.anisoV); |
---|
| 2149 | + |
---|
| 2150 | + materialtouched = true; |
---|
| 2151 | + applySelf(); |
---|
| 2152 | + } |
---|
| 2153 | + }); |
---|
| 2154 | + presetpanel.add(aniso2); |
---|
| 2155 | + |
---|
| 2156 | + cLabel aniso3 = GetLabel("icons/shadericons/shadericon00010.png", !Grafreed.NIMBUSLAF); |
---|
| 2157 | + aniso3.setToolTipText("AnisoUV"); |
---|
| 2158 | + aniso3.addMouseListener(new MouseAdapter() |
---|
| 2159 | + { |
---|
| 2160 | + public void mouseClicked(MouseEvent e) |
---|
| 2161 | + { |
---|
| 2162 | + Object3D object = Grafreed.materials.versionlist[10].get(0); |
---|
| 2163 | + cMaterial material = object.material; |
---|
| 2164 | + |
---|
| 2165 | + anisoField.setFloat(material.aniso); |
---|
| 2166 | + anisoVField.setFloat(material.anisoV); |
---|
| 2167 | + |
---|
| 2168 | + materialtouched = true; |
---|
| 2169 | + applySelf(); |
---|
| 2170 | + } |
---|
| 2171 | + }); |
---|
| 2172 | + presetpanel.add(aniso3); |
---|
| 2173 | + |
---|
| 2174 | + cLabel velvet0 = GetLabel("icons/shadericons/shadericon00015.png", !Grafreed.NIMBUSLAF); |
---|
| 2175 | + velvet0.setToolTipText("Velvet"); |
---|
| 2176 | + velvet0.addMouseListener(new MouseAdapter() |
---|
| 2177 | + { |
---|
| 2178 | + public void mouseClicked(MouseEvent e) |
---|
| 2179 | + { |
---|
| 2180 | + Object3D object = Grafreed.materials.versionlist[15].get(0); |
---|
| 2181 | + cMaterial material = object.material; |
---|
| 2182 | + |
---|
| 2183 | + diffusenessField.setFloat(material.factor); |
---|
| 2184 | + selfshadowField.setFloat(material.diffuseness); |
---|
| 2185 | + sheenField.setFloat(material.sheen); |
---|
| 2186 | + shininessField.setFloat(material.shininess); |
---|
| 2187 | + velvetField.setFloat(material.velvet); |
---|
| 2188 | + shiftField.setFloat(material.shift); |
---|
| 2189 | + |
---|
| 2190 | + materialtouched = true; |
---|
| 2191 | + applySelf(); |
---|
| 2192 | + } |
---|
| 2193 | + }); |
---|
| 2194 | + presetpanel.add(velvet0); |
---|
| 2195 | + |
---|
| 2196 | + cLabel bump0 = GetLabel("icons/shadericons/shadericon00016.png", !Grafreed.NIMBUSLAF); |
---|
| 2197 | + bump0.setToolTipText("Bump texture"); |
---|
| 2198 | + bump0.addMouseListener(new MouseAdapter() |
---|
| 2199 | + { |
---|
| 2200 | + public void mouseClicked(MouseEvent e) |
---|
| 2201 | + { |
---|
| 2202 | + Object3D object = Grafreed.materials.versionlist[16].get(0); |
---|
| 2203 | + cMaterial material = object.material; |
---|
| 2204 | + |
---|
| 2205 | + bumpField.setFloat(object.projectedVertices[0].x / 1000.0); |
---|
| 2206 | + noiseField.setFloat(object.projectedVertices[0].y / 1000.0); |
---|
| 2207 | + powerField.setFloat(object.projectedVertices[2].x / 1000.0); |
---|
| 2208 | + |
---|
| 2209 | + materialtouched = true; |
---|
| 2210 | + applySelf(); |
---|
| 2211 | + } |
---|
| 2212 | + }); |
---|
| 2213 | + presetpanel.add(bump0); |
---|
| 2214 | + |
---|
| 2215 | + cLabel borderShader = GetLabel("icons/shadericons/borderfade.jpg", !Grafreed.NIMBUSLAF); |
---|
| 2216 | + borderShader.setToolTipText("Border fade"); |
---|
| 2217 | + borderShader.addMouseListener(new MouseAdapter() |
---|
| 2218 | + { |
---|
| 2219 | + public void mouseClicked(MouseEvent e) |
---|
| 2220 | + { |
---|
| 2221 | + borderfadeField.setFloat(0.5); |
---|
| 2222 | + opacityField.setFloat(0.75); |
---|
| 2223 | + |
---|
| 2224 | + materialtouched = true; |
---|
| 2225 | + applySelf(); |
---|
| 2226 | + } |
---|
| 2227 | + }); |
---|
| 2228 | + presetpanel.add(borderShader); |
---|
| 2229 | + |
---|
| 2230 | + cLabel halo = GetLabel("icons/shadericons/shadericon00017.png", !Grafreed.NIMBUSLAF); |
---|
| 2231 | + halo.setToolTipText("Halo"); |
---|
| 2232 | + halo.addMouseListener(new MouseAdapter() |
---|
| 2233 | + { |
---|
| 2234 | + public void mouseClicked(MouseEvent e) |
---|
| 2235 | + { |
---|
| 2236 | + Object3D object = Grafreed.materials.versionlist[17].get(0); |
---|
| 2237 | + cMaterial material = object.material; |
---|
| 2238 | + |
---|
| 2239 | + opacityPowerField.setFloat(object.projectedVertices[2].y / 1000.0); |
---|
| 2240 | + |
---|
| 2241 | + materialtouched = true; |
---|
| 2242 | + applySelf(); |
---|
| 2243 | + } |
---|
| 2244 | + }); |
---|
| 2245 | + presetpanel.add(halo); |
---|
| 2246 | + |
---|
| 2247 | + cLabel candle = GetLabel("icons/shadericons/shadericon00018.png", !Grafreed.NIMBUSLAF); |
---|
| 2248 | + candle.setToolTipText("Candle"); |
---|
| 2249 | + candle.addMouseListener(new MouseAdapter() |
---|
| 2250 | + { |
---|
| 2251 | + public void mouseClicked(MouseEvent e) |
---|
| 2252 | + { |
---|
| 2253 | + Object3D object = Grafreed.materials.versionlist[18].get(0); |
---|
| 2254 | + cMaterial material = object.material; |
---|
| 2255 | + |
---|
| 2256 | + subsurfaceField.setFloat(material.subsurface); |
---|
| 2257 | + shadowbiasField.setFloat(material.shadowbias); |
---|
| 2258 | + ambientField.setFloat(material.ambient); |
---|
| 2259 | + specularField.setFloat(material.specular); |
---|
| 2260 | + lightareaField.setFloat(material.lightarea); |
---|
| 2261 | + shininessField.setFloat(material.shininess); |
---|
| 2262 | + |
---|
| 2263 | + materialtouched = true; |
---|
| 2264 | + applySelf(); |
---|
| 2265 | + } |
---|
| 2266 | + }); |
---|
| 2267 | + presetpanel.add(candle); |
---|
| 2268 | + |
---|
| 2269 | + cLabel shadowShader = GetLabel("icons/shadericons/shadow.png", !Grafreed.NIMBUSLAF); |
---|
| 2270 | + shadowShader.setToolTipText("Shadow"); |
---|
| 2271 | + shadowShader.addMouseListener(new MouseAdapter() |
---|
| 2272 | + { |
---|
| 2273 | + public void mouseClicked(MouseEvent e) |
---|
| 2274 | + { |
---|
| 2275 | + diffuseField.setFloat(0.001); |
---|
| 2276 | + ambientField.setFloat(0.001); |
---|
| 2277 | + cameraField.setFloat(0.001); |
---|
| 2278 | + specularField.setFloat(0.001); |
---|
| 2279 | + fakedepthField.setFloat(0.001); |
---|
| 2280 | + opacityField.setFloat(0.6); |
---|
| 2281 | + |
---|
| 2282 | + materialtouched = true; |
---|
| 2283 | + applySelf(); |
---|
| 2284 | + } |
---|
| 2285 | + }); |
---|
| 2286 | + presetpanel.add(shadowShader); |
---|
| 2287 | + |
---|
| 2288 | + cGridBag panel = new cGridBag().setVertical(true); |
---|
| 2289 | + |
---|
| 2290 | + presetpanel.preferredWidth = 1; |
---|
| 2291 | + |
---|
| 2292 | + materialpanel.add(presetpanel); |
---|
| 2293 | + materialpanel.add(panel); |
---|
| 2294 | + |
---|
| 2295 | + panel.preferredWidth = 8; |
---|
| 2296 | + |
---|
| 2297 | + /* |
---|
1704 | 2298 | ctrlPanel.add(materialLabel = new JLabel("MATERIAL : "), aConstraints); |
---|
1705 | 2299 | materialLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1706 | | - */ |
---|
| 2300 | + */ |
---|
1707 | 2301 | |
---|
1708 | 2302 | cGridBag editBar = new cGridBag().setVertical(false); |
---|
1709 | 2303 | |
---|
.. | .. |
---|
1737 | 2331 | //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints); |
---|
1738 | 2332 | |
---|
1739 | 2333 | cGridBag colorSection = new cGridBag().setVertical(true); |
---|
| 2334 | + |
---|
| 2335 | + cGridBag huepanel = new cGridBag(); |
---|
| 2336 | + cGridBag huelabel = new cGridBag(); |
---|
| 2337 | + cLabel hue = GetLabel("icons/hue.png", false); |
---|
| 2338 | + hue.fit = true; |
---|
| 2339 | + |
---|
| 2340 | + hue.addMouseListener(new MouseAdapter() |
---|
| 2341 | + { |
---|
| 2342 | + public void mousePressed(MouseEvent e) |
---|
| 2343 | + { |
---|
| 2344 | + int x = e.getX(); |
---|
| 2345 | + |
---|
| 2346 | + colorField.setFloat((double)x / ((cLabel)e.getSource()).getWidth()); |
---|
| 2347 | + } |
---|
| 2348 | + }); |
---|
| 2349 | + |
---|
| 2350 | + huelabel.add(hue); |
---|
| 2351 | + huelabel.preferredWidth = 20; |
---|
| 2352 | + huepanel.add(new cGridBag()); // Label |
---|
| 2353 | + huepanel.add(huelabel); // Field/slider |
---|
| 2354 | + |
---|
| 2355 | + huepanel.preferredHeight = 7; |
---|
| 2356 | + |
---|
| 2357 | + colorSection.add(huepanel); |
---|
1740 | 2358 | |
---|
1741 | 2359 | cGridBag color = new cGridBag(); |
---|
1742 | | - color.add(colorLabel = new JLabel("Color/hue")); // , aConstraints); |
---|
1743 | | - colorLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1744 | | - color.add(colorField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
| 2360 | + |
---|
| 2361 | + color.add(colorLabel = new JLabel("Color/hue")); // , aConstraints); |
---|
| 2362 | + colorLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 2363 | + color.add(colorField = new cNumberSlider(this, 0.001, 1)); // , aConstraints); |
---|
| 2364 | + |
---|
1745 | 2365 | //colorField.preferredWidth = 200; |
---|
1746 | 2366 | colorSection.add(color); |
---|
1747 | 2367 | |
---|
1748 | 2368 | cGridBag modulation = new cGridBag(); |
---|
1749 | 2369 | modulation.add(modulationLabel = new JLabel("Saturation")); // , aConstraints); |
---|
1750 | 2370 | modulationLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1751 | | - modulation.add(modulationField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
| 2371 | + modulation.add(saturationField = new cNumberSlider(this, 0.001, 1)); // , aConstraints); |
---|
1752 | 2372 | colorSection.add(modulation); |
---|
1753 | 2373 | |
---|
| 2374 | + cGridBag opacity = new cGridBag(); |
---|
| 2375 | + opacity.add(opacityLabel = new JLabel("Opacity")); // , aConstraints); |
---|
| 2376 | + opacityLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 2377 | + opacity.add(opacityField = new cNumberSlider(this, 0.001, 1)); // , aConstraints); |
---|
| 2378 | + colorSection.add(opacity); |
---|
| 2379 | + |
---|
| 2380 | + colorSection.add(GetSeparator()); |
---|
| 2381 | + |
---|
1754 | 2382 | cGridBag texture = new cGridBag(); |
---|
1755 | 2383 | texture.add(textureLabel = new JLabel("Texture")); // , aConstraints); |
---|
1756 | 2384 | textureLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1757 | 2385 | texture.add(textureField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
1758 | 2386 | colorSection.add(texture); |
---|
1759 | 2387 | |
---|
1760 | | - panel.add(new JSeparator()); |
---|
| 2388 | + panel.add(GetSeparator()); |
---|
1761 | 2389 | |
---|
1762 | 2390 | panel.add(colorSection); |
---|
1763 | 2391 | |
---|
.. | .. |
---|
1813 | 2441 | shadowbias.add(shadowbiasField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
1814 | 2442 | diffuseSection.add(shadowbias); |
---|
1815 | 2443 | |
---|
1816 | | - panel.add(new JSeparator()); |
---|
| 2444 | + panel.add(GetSeparator()); |
---|
1817 | 2445 | |
---|
1818 | 2446 | panel.add(diffuseSection); |
---|
1819 | 2447 | |
---|
.. | .. |
---|
1876 | 2504 | specularSection.add(anisoV); |
---|
1877 | 2505 | |
---|
1878 | 2506 | |
---|
1879 | | - panel.add(new JSeparator()); |
---|
| 2507 | + panel.add(GetSeparator()); |
---|
1880 | 2508 | |
---|
1881 | 2509 | panel.add(specularSection); |
---|
1882 | 2510 | |
---|
.. | .. |
---|
1901 | 2529 | backlitLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1902 | 2530 | backlit.add(backlitField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
1903 | 2531 | colorSection.add(backlit); |
---|
1904 | | - |
---|
1905 | | - cGridBag opacity = new cGridBag(); |
---|
1906 | | - opacity.add(opacityLabel = new JLabel("Opacity")); // , aConstraints); |
---|
1907 | | - opacityLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1908 | | - opacity.add(opacityField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
1909 | | - colorSection.add(opacity); |
---|
1910 | 2532 | |
---|
1911 | 2533 | //panel.add(new JSeparator()); |
---|
1912 | 2534 | |
---|
.. | .. |
---|
1952 | 2574 | opacityPower.add(opacityPowerField = new cNumberSlider(this, 0.0, 10 /*10 dec 2013*/)); // , aConstraints); |
---|
1953 | 2575 | textureSection.add(opacityPower); |
---|
1954 | 2576 | |
---|
1955 | | - panel.add(new JSeparator()); |
---|
| 2577 | + panel.add(GetSeparator()); |
---|
1956 | 2578 | |
---|
1957 | 2579 | panel.add(textureSection); |
---|
1958 | 2580 | |
---|
.. | .. |
---|
2939 | 3561 | |
---|
2940 | 3562 | freezematerial = true; |
---|
2941 | 3563 | colorField.setFloat(mat.color); |
---|
2942 | | - modulationField.setFloat(mat.modulation); |
---|
| 3564 | + saturationField.setFloat(mat.modulation); |
---|
2943 | 3565 | metalnessField.setFloat(mat.metalness); |
---|
2944 | 3566 | diffuseField.setFloat(mat.diffuse); |
---|
2945 | 3567 | specularField.setFloat(mat.specular); |
---|
.. | .. |
---|
3001 | 3623 | |
---|
3002 | 3624 | if (multiplyToggle != null) |
---|
3003 | 3625 | multiplyToggle.setSelected(mat.multiply); |
---|
3004 | | - |
---|
3005 | | - assert (object.projectedVertices != null); |
---|
3006 | | - |
---|
3007 | | - if (object.projectedVertices.length <= 2) |
---|
3008 | | - { |
---|
3009 | | - // Side effect... |
---|
3010 | | - Object3D.cVector2[] keep = object.projectedVertices; |
---|
3011 | | - object.projectedVertices = new Object3D.cVector2[3]; |
---|
3012 | | - for (int i = 0; i < 3; i++) |
---|
3013 | | - { |
---|
3014 | | - if (i < keep.length) |
---|
3015 | | - { |
---|
3016 | | - object.projectedVertices[i] = keep[i]; |
---|
3017 | | - } else |
---|
3018 | | - { |
---|
3019 | | - object.projectedVertices[i] = new Object3D.cVector2(); |
---|
3020 | | - } |
---|
3021 | | - /* |
---|
3022 | | - if(keep.length == 0) |
---|
3023 | | - object.projectedVertices[0] = new Object3D.cVector2(); |
---|
3024 | | - else |
---|
3025 | | - object.projectedVertices[0] = keep[0]; |
---|
3026 | | - object.projectedVertices[1] = new Object3D.cVector2(); |
---|
3027 | | - */ |
---|
3028 | | - } |
---|
3029 | | - } |
---|
| 3626 | + |
---|
| 3627 | + AllocProjectedVertices(object); |
---|
3030 | 3628 | |
---|
3031 | 3629 | SetMaterial(mat, object.projectedVertices); |
---|
3032 | 3630 | } |
---|
.. | .. |
---|
3146 | 3744 | public void itemStateChanged(ItemEvent event) |
---|
3147 | 3745 | { |
---|
3148 | 3746 | // System.out.println("Propagate = " + propagate); |
---|
| 3747 | + if (event.getSource() == pinButton) |
---|
| 3748 | + { |
---|
| 3749 | + copy.pinned ^= true; |
---|
| 3750 | + if (!copy.pinned && !copy.editWindow.copy.selection.contains(copy)) |
---|
| 3751 | + { |
---|
| 3752 | + ((GroupEditor)copy.editWindow).listUI.remove(copy); |
---|
| 3753 | + copy.CloseUI(); |
---|
| 3754 | + //copy.editWindow.refreshContents(); |
---|
| 3755 | + } |
---|
| 3756 | + } |
---|
| 3757 | + else |
---|
3149 | 3758 | if (event.getSource() == propagateToggle) |
---|
3150 | 3759 | { |
---|
3151 | 3760 | propagate ^= true; |
---|
.. | .. |
---|
3250 | 3859 | } else if (event.getSource() == liveCB) |
---|
3251 | 3860 | { |
---|
3252 | 3861 | copy.live ^= true; |
---|
| 3862 | + objEditor.refreshContents(true); // To show item colors |
---|
3253 | 3863 | return; |
---|
3254 | 3864 | } else if (event.getSource() == selectableCB) |
---|
3255 | 3865 | { |
---|
.. | .. |
---|
3259 | 3869 | { |
---|
3260 | 3870 | copy.hide ^= true; |
---|
3261 | 3871 | copy.Touch(); // display list issue |
---|
3262 | | - objEditor.refreshContents(); |
---|
| 3872 | + objEditor.refreshContents(true); // To show item colors |
---|
3263 | 3873 | return; |
---|
3264 | 3874 | } else if (event.getSource() == link2masterCB) |
---|
3265 | 3875 | { |
---|
.. | .. |
---|
3324 | 3934 | //System.out.println("ObjEditor " + event); |
---|
3325 | 3935 | applySelf0(true); |
---|
3326 | 3936 | //parent.applySelf(); |
---|
3327 | | - objEditor.refreshContents(); |
---|
| 3937 | + // conflicts with requestFocus objEditor.refreshContents(); |
---|
3328 | 3938 | } else if (source == resetButton) |
---|
3329 | 3939 | { |
---|
3330 | 3940 | CameraPane.fullreset = true; |
---|
.. | .. |
---|
3515 | 4125 | |
---|
3516 | 4126 | static public byte[] Compress(Object3D o) |
---|
3517 | 4127 | { |
---|
| 4128 | + // Slower to actually compress. |
---|
3518 | 4129 | try |
---|
3519 | 4130 | { |
---|
3520 | 4131 | ByteArrayOutputStream baos = new ByteArrayOutputStream(); |
---|
.. | .. |
---|
3616 | 4227 | { |
---|
3617 | 4228 | //Save(true); |
---|
3618 | 4229 | Replace(); |
---|
| 4230 | + SetVersionStates(); |
---|
3619 | 4231 | } |
---|
3620 | 4232 | |
---|
3621 | 4233 | private boolean Equal(byte[] compress, byte[] name) |
---|
.. | .. |
---|
3634 | 4246 | return true; |
---|
3635 | 4247 | } |
---|
3636 | 4248 | |
---|
3637 | | - java.util.Hashtable<java.util.UUID, Object3D> versiontable = new java.util.Hashtable<java.util.UUID, Object3D>(); |
---|
| 4249 | + void DeleteVersion() |
---|
| 4250 | + { |
---|
| 4251 | + for (int i = copy.versionindex; i < copy.versionlist.length-1; i++) |
---|
| 4252 | + { |
---|
| 4253 | + copy.versionlist[i] = copy.versionlist[i+1]; |
---|
| 4254 | + } |
---|
| 4255 | + |
---|
| 4256 | + if (copy.versionlist[copy.versionindex] == null) |
---|
| 4257 | + copy.versionindex -= 1; |
---|
| 4258 | + |
---|
| 4259 | + if (copy.versionindex != -1) |
---|
| 4260 | + CopyChanged(); |
---|
| 4261 | + |
---|
| 4262 | + SetVersionStates(); |
---|
| 4263 | + } |
---|
3638 | 4264 | |
---|
3639 | 4265 | public boolean Save(boolean user) |
---|
3640 | 4266 | { |
---|
3641 | 4267 | System.err.println("Save"); |
---|
| 4268 | + Replace(); |
---|
3642 | 4269 | |
---|
3643 | | - cRadio tab = GetCurrentTab(); |
---|
| 4270 | + //cRadio tab = GetCurrentTab(); |
---|
3644 | 4271 | |
---|
3645 | | - byte[] compress = CompressCopy(); |
---|
| 4272 | + Object3D compress = Duplicate(copy); // Saved version. No need for "Replace"? |
---|
3646 | 4273 | |
---|
3647 | 4274 | boolean thesame = false; |
---|
3648 | 4275 | |
---|
3649 | | - // Quick heuristic using length. Works only when stream is compressed. |
---|
3650 | | - if (copy.versionindex > 0 && copy.versions[copy.versionindex-1] != null && Equal(compress, copy.versions[copy.versionindex-1])) |
---|
3651 | | - { |
---|
3652 | | - thesame = true; |
---|
3653 | | - } |
---|
| 4276 | +// if (copy.versionindex > 0 && copy.versions[copy.versionindex-1] != null && Equal(compress, copy.versions[copy.versionindex-1])) |
---|
| 4277 | +// { |
---|
| 4278 | +// thesame = true; |
---|
| 4279 | +// } |
---|
3654 | 4280 | |
---|
3655 | 4281 | //EditorFrame.m_MainFrame.requestFocusInWindow(); |
---|
3656 | 4282 | if (!thesame) |
---|
3657 | 4283 | { |
---|
| 4284 | + for (int i = copy.versionlist.length; --i > copy.versionindex+1;) |
---|
| 4285 | + { |
---|
| 4286 | + copy.versionlist[i] = copy.versionlist[i-1]; |
---|
| 4287 | + } |
---|
| 4288 | + |
---|
3658 | 4289 | //tab.user[tab.versionindex] = user; |
---|
3659 | 4290 | //boolean increment = true; // tab.graphs[tab.versionindex] == null; |
---|
3660 | 4291 | |
---|
3661 | | - copy.versions[++copy.versionindex] = compress; |
---|
| 4292 | + copy.versionlist[++copy.versionindex] = compress; |
---|
3662 | 4293 | |
---|
3663 | 4294 | // if (increment) |
---|
3664 | 4295 | // tab.versionindex++; |
---|
.. | .. |
---|
3668 | 4299 | |
---|
3669 | 4300 | //assert(hashtable.isEmpty()); |
---|
3670 | 4301 | |
---|
3671 | | - for (int i = copy.versionindex+1; i < copy.versions.length; i++) |
---|
3672 | | - { |
---|
3673 | | - //tab.user[i] = false; |
---|
3674 | | - copy.versions[i] = null; |
---|
3675 | | - } |
---|
| 4302 | +// for (int i = copy.versionindex+1; i < copy.versionlist.length; i++) |
---|
| 4303 | +// { |
---|
| 4304 | +// //tab.user[i] = false; |
---|
| 4305 | +// copy.versionlist[i] = null; |
---|
| 4306 | +// } |
---|
3676 | 4307 | |
---|
3677 | | - SetUndoStates(); |
---|
| 4308 | + SetVersionStates(); |
---|
3678 | 4309 | |
---|
3679 | 4310 | // test save |
---|
3680 | 4311 | if (false) |
---|
.. | .. |
---|
3697 | 4328 | |
---|
3698 | 4329 | return !thesame; |
---|
3699 | 4330 | } |
---|
3700 | | - |
---|
3701 | | - void CopyChanged(Object3D obj) |
---|
| 4331 | + |
---|
| 4332 | + boolean flashIt = true; |
---|
| 4333 | + |
---|
| 4334 | + void RefreshSelection() |
---|
3702 | 4335 | { |
---|
3703 | | - SetUndoStates(); |
---|
| 4336 | + Object3D selection = new Object3D(); |
---|
| 4337 | + |
---|
| 4338 | + for (int i = 0; i < copy.selection.size(); i++) |
---|
| 4339 | + { |
---|
| 4340 | + Object3D elem = copy.selection.elementAt(i); |
---|
| 4341 | + |
---|
| 4342 | + Object3D obj = copy.GetObject(elem.GetUUID()); |
---|
| 4343 | + |
---|
| 4344 | + if (obj == null) |
---|
| 4345 | + { |
---|
| 4346 | + copy.selection.remove(i--); |
---|
| 4347 | + } |
---|
| 4348 | + else |
---|
| 4349 | + { |
---|
| 4350 | + selection.add(obj); |
---|
| 4351 | + copy.selection.setElementAt(obj, i); |
---|
| 4352 | + } |
---|
| 4353 | + } |
---|
| 4354 | + |
---|
| 4355 | + flashIt = false; |
---|
| 4356 | + GetTree().clearSelection(); |
---|
| 4357 | + for (int i = 0; i < selection.size(); i++) |
---|
| 4358 | + GetTree().addSelectionPath(selection.elementAt(i).GetTreePath().GetTreePath()); |
---|
| 4359 | + flashIt = true; |
---|
| 4360 | + |
---|
| 4361 | + //refreshContents(false); |
---|
| 4362 | + } |
---|
| 4363 | + |
---|
| 4364 | + void CopyChanged() |
---|
| 4365 | + { |
---|
| 4366 | + Object3D obj = (Object3D)Grafreed.clone(copy.versionlist[copy.versionindex]); |
---|
| 4367 | + |
---|
| 4368 | + SetVersionStates(); |
---|
3704 | 4369 | |
---|
3705 | 4370 | boolean temp = CameraPane.SWITCH; |
---|
3706 | 4371 | CameraPane.SWITCH = false; |
---|
3707 | 4372 | |
---|
3708 | | - copy.ExtractBigData(versiontable); |
---|
| 4373 | + copy.ExtractBigData(Grafreed.grafreed.universe.versiontable); |
---|
3709 | 4374 | |
---|
3710 | 4375 | copy.clear(); |
---|
3711 | 4376 | |
---|
| 4377 | + copy.skyboxname = obj.skyboxname; |
---|
| 4378 | + copy.skyboxext = obj.skyboxext; |
---|
| 4379 | + |
---|
3712 | 4380 | for (int i=0; i<obj.Size(); i++) |
---|
3713 | 4381 | { |
---|
3714 | 4382 | copy.add(obj.get(i)); |
---|
3715 | 4383 | } |
---|
3716 | 4384 | |
---|
3717 | | - copy.RestoreBigData(versiontable); |
---|
| 4385 | + copy.RestoreBigData(Grafreed.grafreed.universe.versiontable); |
---|
3718 | 4386 | |
---|
3719 | 4387 | CameraPane.SWITCH = temp; |
---|
3720 | 4388 | |
---|
| 4389 | + RefreshSelection(); |
---|
3721 | 4390 | //assert(hashtable.isEmpty()); |
---|
3722 | 4391 | |
---|
3723 | 4392 | copy.Touch(); |
---|
.. | .. |
---|
3738 | 4407 | } |
---|
3739 | 4408 | } |
---|
3740 | 4409 | |
---|
3741 | | - refreshContents(); |
---|
| 4410 | + refreshContents(true); |
---|
3742 | 4411 | } |
---|
3743 | 4412 | |
---|
3744 | | - cButton undoButton; |
---|
| 4413 | + cButton previousVersionButton; |
---|
3745 | 4414 | cButton restoreButton; |
---|
3746 | 4415 | cButton replaceButton; |
---|
3747 | | - cButton redoButton; |
---|
| 4416 | + cButton nextVersionButton; |
---|
| 4417 | + cButton saveVersionButton; |
---|
| 4418 | + cButton deleteVersionButton; |
---|
3748 | 4419 | |
---|
3749 | 4420 | boolean muteSlider; |
---|
3750 | 4421 | |
---|
.. | .. |
---|
3752 | 4423 | { |
---|
3753 | 4424 | int count = 0; |
---|
3754 | 4425 | |
---|
3755 | | - for (int i = copy.versions.length; --i >= 0;) |
---|
| 4426 | + for (int i = copy.versionlist.length; --i >= 0;) |
---|
3756 | 4427 | { |
---|
3757 | | - if (copy.versions[i] != null) |
---|
| 4428 | + if (copy.versionlist[i] != null) |
---|
3758 | 4429 | count++; |
---|
3759 | 4430 | } |
---|
3760 | 4431 | |
---|
3761 | 4432 | return count; |
---|
3762 | 4433 | } |
---|
3763 | 4434 | |
---|
3764 | | - void SetUndoStates() |
---|
| 4435 | + void SetVersionStates() |
---|
3765 | 4436 | { |
---|
3766 | | - cRadio tab = GetCurrentTab(); |
---|
| 4437 | + //if (true) |
---|
| 4438 | + // return; |
---|
| 4439 | + |
---|
| 4440 | + //cRadio tab = GetCurrentTab(); |
---|
3767 | 4441 | |
---|
3768 | 4442 | restoreButton.setEnabled(copy.versionindex != -1); |
---|
3769 | 4443 | replaceButton.setEnabled(copy.versionindex != -1); |
---|
3770 | 4444 | |
---|
3771 | | - undoButton.setEnabled(copy.versionindex > 0); |
---|
3772 | | - redoButton.setEnabled(copy.versions[copy.versionindex + 1] != null); |
---|
| 4445 | + previousVersionButton.setEnabled(copy.versionindex > 0); |
---|
| 4446 | + nextVersionButton.setEnabled(copy.versionlist[copy.versionindex + 1] != null); |
---|
| 4447 | + |
---|
| 4448 | + deleteVersionButton.setEnabled(copy.versionindex != -1); |
---|
| 4449 | + //copy.versionlist[copy.versionindex + 1] != null); |
---|
3773 | 4450 | |
---|
3774 | 4451 | muteSlider = true; |
---|
| 4452 | + versionSlider.setMinimum(0); |
---|
3775 | 4453 | versionSlider.setMaximum(VersionCount() - 1); |
---|
3776 | 4454 | versionSlider.setInteger(copy.versionindex); |
---|
| 4455 | + versionSlider.setEnabled(copy.versionindex != -1); |
---|
3777 | 4456 | muteSlider = false; |
---|
3778 | 4457 | } |
---|
3779 | 4458 | |
---|
3780 | | - public boolean Undo() |
---|
| 4459 | + public boolean PreviousVersion() |
---|
3781 | 4460 | { |
---|
3782 | 4461 | // Option? |
---|
3783 | 4462 | Replace(); |
---|
3784 | 4463 | |
---|
3785 | 4464 | System.err.println("Undo"); |
---|
3786 | 4465 | |
---|
3787 | | - cRadio tab = GetCurrentTab(); |
---|
| 4466 | + //cRadio tab = GetCurrentTab(); |
---|
3788 | 4467 | |
---|
3789 | 4468 | if (copy.versionindex == 0) |
---|
3790 | 4469 | { |
---|
.. | .. |
---|
3807 | 4486 | |
---|
3808 | 4487 | copy.versionindex -= 1; |
---|
3809 | 4488 | |
---|
3810 | | - CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex])); |
---|
| 4489 | + CopyChanged(); |
---|
3811 | 4490 | |
---|
3812 | 4491 | return true; |
---|
3813 | 4492 | } |
---|
.. | .. |
---|
3816 | 4495 | { |
---|
3817 | 4496 | System.err.println("Restore"); |
---|
3818 | 4497 | |
---|
3819 | | - cRadio tab = GetCurrentTab(); |
---|
| 4498 | + //cRadio tab = GetCurrentTab(); |
---|
3820 | 4499 | |
---|
3821 | | - if (copy.versionindex == -1 || copy.versions[copy.versionindex] == null) |
---|
| 4500 | + if (copy.versionindex == -1 || copy.versionlist[copy.versionindex] == null) |
---|
3822 | 4501 | { |
---|
3823 | 4502 | java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
3824 | 4503 | return false; |
---|
3825 | 4504 | } |
---|
3826 | 4505 | |
---|
3827 | | - CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex])); |
---|
| 4506 | + //CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex])); |
---|
| 4507 | + CopyChanged(); |
---|
3828 | 4508 | |
---|
3829 | 4509 | return true; |
---|
3830 | 4510 | } |
---|
3831 | 4511 | |
---|
3832 | 4512 | public boolean Replace() |
---|
3833 | 4513 | { |
---|
3834 | | - System.err.println("Replace"); |
---|
| 4514 | + //System.err.println("Replace"); |
---|
3835 | 4515 | |
---|
3836 | | - cRadio tab = GetCurrentTab(); |
---|
| 4516 | + //cRadio tab = GetCurrentTab(); |
---|
3837 | 4517 | |
---|
3838 | | - if (copy.versionindex == -1 || copy.versions[copy.versionindex] == null) |
---|
| 4518 | + if (copy.versionindex == -1 || copy.versionlist[copy.versionindex] == null) |
---|
3839 | 4519 | { |
---|
3840 | 4520 | // No version yet. OK. java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
3841 | 4521 | return false; |
---|
3842 | 4522 | } |
---|
3843 | 4523 | |
---|
3844 | | - copy.versions[copy.versionindex] = CompressCopy(); |
---|
| 4524 | + copy.versionlist[copy.versionindex] = Duplicate(copy); |
---|
3845 | 4525 | |
---|
3846 | 4526 | return true; |
---|
3847 | 4527 | } |
---|
3848 | 4528 | |
---|
3849 | | - public void Redo() |
---|
| 4529 | + public void NextVersion() |
---|
3850 | 4530 | { |
---|
3851 | 4531 | // Option? |
---|
3852 | 4532 | Replace(); |
---|
3853 | 4533 | |
---|
3854 | | - cRadio tab = GetCurrentTab(); |
---|
| 4534 | + //cRadio tab = GetCurrentTab(); |
---|
3855 | 4535 | |
---|
3856 | | - if (copy.versions[copy.versionindex + 1] == null) |
---|
| 4536 | + if (copy.versionlist[copy.versionindex + 1] == null) |
---|
3857 | 4537 | { |
---|
3858 | 4538 | java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
3859 | 4539 | return; |
---|
.. | .. |
---|
3861 | 4541 | |
---|
3862 | 4542 | copy.versionindex += 1; |
---|
3863 | 4543 | |
---|
3864 | | - CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex])); |
---|
| 4544 | + CopyChanged(); |
---|
3865 | 4545 | |
---|
3866 | 4546 | //if (!tab.user[tab.versionindex]) |
---|
3867 | 4547 | // tab.graphs[tab.versionindex] = null; |
---|
.. | .. |
---|
4075 | 4755 | //copy.material = new cMaterial(copy.GetMaterial()); |
---|
4076 | 4756 | |
---|
4077 | 4757 | current.color = (float) colorField.getFloat(); |
---|
4078 | | - current.modulation = (float) modulationField.getFloat(); |
---|
| 4758 | + current.modulation = (float) saturationField.getFloat(); |
---|
4079 | 4759 | current.metalness = (float) metalnessField.getFloat(); |
---|
4080 | 4760 | current.diffuse = (float) diffuseField.getFloat(); |
---|
4081 | 4761 | current.specular = (float) specularField.getFloat(); |
---|
.. | .. |
---|
4108 | 4788 | cMaterial mat = copy.material; |
---|
4109 | 4789 | |
---|
4110 | 4790 | colorField.SetToolTipValue((mat.color)); |
---|
4111 | | - modulationField.SetToolTipValue((mat.modulation)); |
---|
| 4791 | + saturationField.SetToolTipValue((mat.modulation)); |
---|
4112 | 4792 | metalnessField.SetToolTipValue((mat.metalness)); |
---|
4113 | 4793 | diffuseField.SetToolTipValue((mat.diffuse)); |
---|
4114 | 4794 | specularField.SetToolTipValue((mat.specular)); |
---|
.. | .. |
---|
4170 | 4850 | if (muteSlider) |
---|
4171 | 4851 | return; |
---|
4172 | 4852 | |
---|
| 4853 | + Replace(); |
---|
| 4854 | + |
---|
4173 | 4855 | int version = versionSlider.getInteger(); |
---|
4174 | 4856 | |
---|
4175 | | - if (copy.versions[version] != null) |
---|
| 4857 | + if (version != -1 && copy.versionlist[version] != null) |
---|
4176 | 4858 | { |
---|
4177 | | - CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex = version])); |
---|
| 4859 | + copy.versionindex = version; |
---|
| 4860 | + CopyChanged(); |
---|
4178 | 4861 | } |
---|
4179 | 4862 | |
---|
4180 | 4863 | return; |
---|
.. | .. |
---|
4214 | 4897 | { |
---|
4215 | 4898 | //System.out.println("stateChanged = " + this); |
---|
4216 | 4899 | materialtouched = true; |
---|
| 4900 | + |
---|
| 4901 | + if (Globals.AUTOSATURATE && e.getSource() == colorField && saturationField.getFloat() == 0.001) |
---|
| 4902 | + { |
---|
| 4903 | + saturationField.setFloat(1); |
---|
| 4904 | + } |
---|
| 4905 | + |
---|
4217 | 4906 | applySelf(); |
---|
4218 | 4907 | //System.out.println("this = " + this); |
---|
4219 | 4908 | //System.out.println("PARENT = " + parent); |
---|
.. | .. |
---|
4513 | 5202 | { |
---|
4514 | 5203 | if (GetTree() != null) |
---|
4515 | 5204 | { |
---|
| 5205 | + GetTree().revalidate(); |
---|
4516 | 5206 | GetTree().repaint(); |
---|
4517 | 5207 | } |
---|
4518 | 5208 | |
---|
.. | .. |
---|
4521 | 5211 | ctrlPanel.validate(); // ? new |
---|
4522 | 5212 | ctrlPanel.repaint(); |
---|
4523 | 5213 | } |
---|
| 5214 | + |
---|
| 5215 | + if (previousVersionButton != null && copy.versionlist != null) |
---|
| 5216 | + SetVersionStates(); |
---|
| 5217 | + |
---|
| 5218 | + cameraView.requestFocusInWindow(); |
---|
4524 | 5219 | } |
---|
4525 | 5220 | |
---|
4526 | 5221 | static TweenManager tweenManager = new TweenManager(); |
---|
.. | .. |
---|
4552 | 5247 | // group = (Composite) group.get(0); |
---|
4553 | 5248 | // } |
---|
4554 | 5249 | |
---|
4555 | | - System.out.println("makeSomething of " + thing); |
---|
| 5250 | + //System.out.println("makeSomething of " + thing); |
---|
4556 | 5251 | |
---|
4557 | 5252 | /* |
---|
4558 | 5253 | if (deselect && jList != null) |
---|
.. | .. |
---|
4851 | 5546 | { |
---|
4852 | 5547 | //readobj.deepCopySelf(copy); |
---|
4853 | 5548 | copy.clear(); // june 2014 |
---|
| 5549 | + copy.skyboxname = readobj.skyboxname; |
---|
| 5550 | + copy.skyboxext = readobj.skyboxext; |
---|
4854 | 5551 | for (int i = 0; i < readobj.size(); i++) |
---|
4855 | 5552 | { |
---|
4856 | 5553 | Object3D child = readobj.get(i); // reserve(i); |
---|
.. | .. |
---|
4902 | 5599 | c.addChild(csg); |
---|
4903 | 5600 | } |
---|
4904 | 5601 | |
---|
4905 | | - copy.versions = readobj.versions; |
---|
| 5602 | + copy.versionlist = readobj.versionlist; |
---|
4906 | 5603 | copy.versionindex = readobj.versionindex; |
---|
| 5604 | + copy.versiontable = readobj.versiontable; |
---|
4907 | 5605 | |
---|
4908 | | - if (copy.versions == null) |
---|
| 5606 | + if (copy.versionlist == null) |
---|
4909 | 5607 | { |
---|
4910 | | - copy.versions = new byte[100][]; |
---|
| 5608 | + // Backward compatibility |
---|
| 5609 | + copy.versionlist = new Object3D[100]; |
---|
4911 | 5610 | copy.versionindex = -1; |
---|
| 5611 | + |
---|
| 5612 | + //Save(true); |
---|
4912 | 5613 | } |
---|
4913 | 5614 | |
---|
4914 | 5615 | //? SetUndoStates(); |
---|
.. | .. |
---|
4923 | 5624 | { |
---|
4924 | 5625 | if (Grafreed.standAlone) |
---|
4925 | 5626 | { |
---|
4926 | | - FileDialog browser = new FileDialog(frame, "Load", FileDialog.LOAD); |
---|
| 5627 | + FileDialog browser = new FileDialog(frame, "Open", FileDialog.LOAD); |
---|
4927 | 5628 | browser.show(); |
---|
4928 | 5629 | String filename = browser.getFile(); |
---|
4929 | 5630 | if (filename != null && filename.length() > 0) |
---|
.. | .. |
---|
5000 | 5701 | |
---|
5001 | 5702 | void save() |
---|
5002 | 5703 | { |
---|
| 5704 | + Replace(); |
---|
| 5705 | + |
---|
5003 | 5706 | if (lastname == null) |
---|
5004 | 5707 | { |
---|
5005 | 5708 | return; |
---|
.. | .. |
---|
5242 | 5945 | ButtonGroup buttonGroup; |
---|
5243 | 5946 | |
---|
5244 | 5947 | cGridBag toolboxPanel; |
---|
| 5948 | + cGridBag skyboxPanel; |
---|
5245 | 5949 | cGridBag materialPanel; |
---|
5246 | 5950 | cGridBag ctrlPanel; |
---|
5247 | 5951 | |
---|
.. | .. |
---|
5315 | 6019 | JLabel colorLabel; |
---|
5316 | 6020 | cNumberSlider colorField; |
---|
5317 | 6021 | JLabel modulationLabel; |
---|
5318 | | - cNumberSlider modulationField; |
---|
| 6022 | + cNumberSlider saturationField; |
---|
5319 | 6023 | JLabel metalnessLabel; |
---|
5320 | 6024 | cNumberSlider metalnessField; |
---|
5321 | 6025 | JLabel diffuseLabel; |
---|
.. | .. |
---|
5346 | 6050 | cNumberSlider anisoField; |
---|
5347 | 6051 | JLabel anisoVLabel; |
---|
5348 | 6052 | cNumberSlider anisoVField; |
---|
| 6053 | + |
---|
5349 | 6054 | JLabel cameraLabel; |
---|
5350 | 6055 | cNumberSlider cameraField; |
---|
5351 | 6056 | JLabel selfshadowLabel; |
---|
.. | .. |
---|
5360 | 6065 | cNumberSlider fakedepthField; |
---|
5361 | 6066 | JLabel shadowbiasLabel; |
---|
5362 | 6067 | cNumberSlider shadowbiasField; |
---|
| 6068 | + |
---|
5363 | 6069 | JLabel bumpLabel; |
---|
5364 | 6070 | cNumberSlider bumpField; |
---|
5365 | 6071 | JLabel noiseLabel; |
---|