.. | .. |
---|
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 | + } |
---|
| 89 | + |
---|
| 90 | + public cGridBag GetSeparator() |
---|
| 91 | + { |
---|
| 92 | + cGridBag separator = new cGridBag(); |
---|
| 93 | + separator.add(new JSeparator()); |
---|
| 94 | + separator.preferredHeight = 5; |
---|
| 95 | + return separator; |
---|
| 96 | + } |
---|
44 | 97 | |
---|
45 | 98 | cButton GetButton(String name, boolean border) |
---|
46 | 99 | { |
---|
47 | 100 | ImageIcon icon = GetIcon(name); |
---|
48 | | - 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); |
---|
| 105 | + } |
---|
| 106 | + |
---|
| 107 | + cLabel GetLabel(String name, boolean border) |
---|
| 108 | + { |
---|
| 109 | + //ImageIcon icon = GetIcon(name); |
---|
| 110 | + return new cLabel(GetImage(name), border); |
---|
49 | 111 | } |
---|
50 | 112 | |
---|
51 | 113 | cToggleButton GetToggleButton(String name, boolean border) |
---|
.. | .. |
---|
60 | 122 | return new cCheckBox(icon, border); |
---|
61 | 123 | } |
---|
62 | 124 | |
---|
63 | | - private 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) |
---|
| 128 | + { |
---|
| 129 | + javax.swing.ImageIcon iconCache = icons.get(name); |
---|
| 130 | + if (iconCache != null) |
---|
| 131 | + { |
---|
| 132 | + return iconCache; |
---|
| 133 | + } |
---|
| 134 | + |
---|
| 135 | + try |
---|
| 136 | + { |
---|
| 137 | + BufferedImage image = javax.imageio.ImageIO.read(ObjEditor.class.getClassLoader().getResourceAsStream(name)); |
---|
| 138 | + |
---|
| 139 | +// if (image.getWidth() > 48 && image.getHeight() > 48) |
---|
| 140 | +// { |
---|
| 141 | +// BufferedImage resized = new BufferedImage(48, 48, image.getType()); |
---|
| 142 | +// Graphics2D g = resized.createGraphics(); |
---|
| 143 | +// g.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR); |
---|
| 144 | +// //g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); |
---|
| 145 | +// g.drawImage(image, 0, 0, 48, 48, 0, 0, image.getWidth(), image.getHeight(), null); |
---|
| 146 | +// g.dispose(); |
---|
| 147 | +// |
---|
| 148 | +// image = resized; |
---|
| 149 | +// } |
---|
| 150 | + |
---|
| 151 | + javax.swing.ImageIcon icon = new javax.swing.ImageIcon(image); |
---|
| 152 | + |
---|
| 153 | + icons.put(name, icon); |
---|
| 154 | + |
---|
| 155 | + return icon; |
---|
| 156 | + } |
---|
| 157 | + catch (Exception e) |
---|
| 158 | + { |
---|
| 159 | + //icons.put(name, null); |
---|
| 160 | + return null; |
---|
| 161 | + } |
---|
| 162 | + } |
---|
| 163 | + |
---|
| 164 | + BufferedImage GetImage(String name) |
---|
64 | 165 | { |
---|
65 | 166 | try |
---|
66 | 167 | { |
---|
67 | 168 | BufferedImage image = javax.imageio.ImageIO.read(getClass().getClassLoader().getResourceAsStream(name)); |
---|
68 | 169 | |
---|
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; |
---|
| 170 | + return image; |
---|
83 | 171 | } |
---|
84 | 172 | catch (Exception e) |
---|
85 | 173 | { |
---|
.. | .. |
---|
268 | 356 | client = inClient; |
---|
269 | 357 | copy = client; |
---|
270 | 358 | |
---|
271 | | - if (copy.versions == null) |
---|
272 | | - { |
---|
273 | | - copy.versions = new byte[100][]; |
---|
274 | | - copy.versionindex = -1; |
---|
275 | | - } |
---|
| 359 | +// if (copy.versionlist == null) |
---|
| 360 | +// { |
---|
| 361 | +// copy.versionlist = new Object3D[100]; |
---|
| 362 | +// copy.versionindex = -1; |
---|
| 363 | +// |
---|
| 364 | +// callee.Save(true); |
---|
| 365 | +// } |
---|
276 | 366 | |
---|
277 | 367 | // "this" is not called: SetupUI2(objEditor); |
---|
278 | 368 | } |
---|
.. | .. |
---|
287 | 377 | client = inClient; |
---|
288 | 378 | copy = client; |
---|
289 | 379 | |
---|
290 | | - if (copy.versions == null) |
---|
| 380 | + if (copy.versionlist == null) |
---|
291 | 381 | { |
---|
292 | | - copy.versions = new byte[100][]; |
---|
| 382 | + copy.versionlist = new Object3D[100]; |
---|
293 | 383 | copy.versionindex = -1; |
---|
| 384 | + |
---|
| 385 | +// Save(true); |
---|
294 | 386 | } |
---|
295 | 387 | |
---|
296 | 388 | SetupUI2(callee.GetEditor()); |
---|
.. | .. |
---|
314 | 406 | //parent = p; |
---|
315 | 407 | |
---|
316 | 408 | GraphicsDevice gd = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice(); |
---|
317 | | - System.out.println("getFullScreenWindow? " + gd.getFullScreenWindow()); |
---|
| 409 | + if (Globals.DEBUG) |
---|
| 410 | + System.out.println("getFullScreenWindow? " + gd.getFullScreenWindow()); |
---|
318 | 411 | //gd.setFullScreenWindow(this); |
---|
319 | 412 | //setResizable(false); |
---|
320 | 413 | //if (!isDisplayable()) |
---|
.. | .. |
---|
325 | 418 | copy = localCopy; |
---|
326 | 419 | copy.editWindow = this; |
---|
327 | 420 | |
---|
328 | | - if (copy.versions == null) |
---|
329 | | - { |
---|
330 | | -// copy.versions = new byte[100][]; |
---|
| 421 | +// if (copy.versionlist == null) |
---|
| 422 | +// { |
---|
| 423 | +// copy.versionlist = new Object3D[100]; |
---|
331 | 424 | // copy.versionindex = -1; |
---|
332 | | - } |
---|
| 425 | +// |
---|
| 426 | +// Save(true); |
---|
| 427 | +// } |
---|
333 | 428 | |
---|
334 | 429 | SetupMenu(); |
---|
335 | 430 | |
---|
.. | .. |
---|
349 | 444 | |
---|
350 | 445 | static java.util.Vector<Object3D> listUI = new java.util.Vector<Object3D>(); |
---|
351 | 446 | |
---|
| 447 | + // This is to refresh the UI of the material panel. |
---|
| 448 | + boolean patchMaterial; |
---|
| 449 | + |
---|
352 | 450 | void SetupMenu() |
---|
353 | 451 | { |
---|
354 | 452 | frame.setMenuBar(menuBar = new MenuBar()); |
---|
.. | .. |
---|
362 | 460 | importOBJItem.addActionListener(this); |
---|
363 | 461 | import3DSItem = menu.add(new MenuItem("3DS file...")); |
---|
364 | 462 | import3DSItem.addActionListener(this); |
---|
| 463 | + if (Globals.ADVANCED) |
---|
| 464 | + { |
---|
365 | 465 | importVRMLX3DItem = menu.add(new MenuItem("VRML/X3D file...")); |
---|
366 | 466 | importVRMLX3DItem.addActionListener(this); |
---|
| 467 | + } |
---|
367 | 468 | menu.add("-"); |
---|
368 | 469 | importGFDItem = menu.add(new MenuItem("Grafreed file...")); |
---|
369 | 470 | importGFDItem.addActionListener(this); |
---|
.. | .. |
---|
398 | 499 | |
---|
399 | 500 | ChangeListener changeListener = new ChangeListener() |
---|
400 | 501 | { |
---|
| 502 | + //String name; |
---|
| 503 | + |
---|
401 | 504 | public void stateChanged(ChangeEvent changeEvent) |
---|
402 | 505 | { |
---|
403 | 506 | // if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Material") && !materialFlushed) |
---|
.. | .. |
---|
416 | 519 | // EditSelection(false); |
---|
417 | 520 | // } |
---|
418 | 521 | |
---|
419 | | - refreshContents(false); // To refresh Info tab |
---|
| 522 | +// if (objectPanel.getSelectedIndex() == 4) |
---|
| 523 | +// { |
---|
| 524 | +// name = copy.skyboxname; |
---|
| 525 | +// |
---|
| 526 | +// if (name == null) |
---|
| 527 | +// { |
---|
| 528 | +// name = ""; |
---|
| 529 | +// } |
---|
| 530 | +// |
---|
| 531 | +// copy.skyboxname = "cubemaps/default-skyboxes/rgb"; |
---|
| 532 | +// copy.skyboxext = "jpg"; |
---|
| 533 | +// } |
---|
| 534 | +// else |
---|
| 535 | +// { |
---|
| 536 | +// if (name != null) |
---|
| 537 | +// { |
---|
| 538 | +// if (name.equals("")) |
---|
| 539 | +// { |
---|
| 540 | +// copy.skyboxname = null; |
---|
| 541 | +// copy.skyboxext = null; |
---|
| 542 | +// } |
---|
| 543 | +// else |
---|
| 544 | +// { |
---|
| 545 | +// copy.skyboxname = name; |
---|
| 546 | +// } |
---|
| 547 | +// } |
---|
| 548 | +// } |
---|
| 549 | + cameraView.transformMode = objectPanel.getSelectedIndex() == 4; |
---|
| 550 | + |
---|
| 551 | +// refreshContents(false); // To refresh Info tab |
---|
| 552 | + cameraView.repaint(); |
---|
420 | 553 | } |
---|
421 | 554 | }; |
---|
422 | 555 | objectPanel.addChangeListener(changeListener); |
---|
.. | .. |
---|
436 | 569 | editPanel.add(editCommandsPanel); |
---|
437 | 570 | editPanel.add(ctrlPanel); |
---|
438 | 571 | |
---|
439 | | - toolboxPanel = new cGridBag().setVertical(false); |
---|
| 572 | + toolboxPanel = new cGridBag().setVertical(true); |
---|
440 | 573 | //toolboxPanel.setName("Toolbox"); |
---|
441 | 574 | |
---|
442 | | - materialPanel = new cGridBag().setVertical(true); |
---|
| 575 | + skyboxPanel = new cGridBag().setVertical(true); |
---|
| 576 | + |
---|
| 577 | + materialPanel = new cGridBag().setVertical(false); |
---|
443 | 578 | //materialPanel.setName("Material"); |
---|
444 | 579 | |
---|
445 | 580 | /*JTextPane*/ |
---|
.. | .. |
---|
723 | 858 | boolean maximized; |
---|
724 | 859 | |
---|
725 | 860 | cButton fullscreenLayout; |
---|
| 861 | + cButton expandedLayout; |
---|
726 | 862 | |
---|
727 | 863 | void Minimize() |
---|
728 | 864 | { |
---|
.. | .. |
---|
762 | 898 | cButton minButton; |
---|
763 | 899 | cButton maxButton; |
---|
764 | 900 | cButton fullButton; |
---|
| 901 | + cButton collapseButton; |
---|
| 902 | + cButton maximize3DButton; |
---|
765 | 903 | |
---|
766 | 904 | void ToggleFullScreen() |
---|
767 | 905 | { |
---|
768 | | -GraphicsDevice device = frame.getGraphicsConfiguration().getDevice(); |
---|
| 906 | + GraphicsDevice device = frame.getGraphicsConfiguration().getDevice(); |
---|
769 | 907 | |
---|
770 | 908 | cameraView.ToggleFullScreen(); |
---|
771 | 909 | |
---|
.. | .. |
---|
786 | 924 | // X frame.getContentPane().remove(/*"Center",*/bigThree); |
---|
787 | 925 | // X framePanel.add(bigThree); |
---|
788 | 926 | // X frame.getContentPane().add(/*"Center",*/framePanel); |
---|
789 | | - framePanel.setDividerLocation(46); |
---|
| 927 | +// framePanel.setDividerLocation(46); // icons are 24x24 |
---|
790 | 928 | |
---|
791 | 929 | //frame.setVisible(true); |
---|
792 | | - radio.layout = keepButton; |
---|
| 930 | +// radio.layout = keepButton; |
---|
793 | 931 | //theFrame = null; |
---|
794 | 932 | keepButton = null; |
---|
795 | | - radio.layout.doClick(); |
---|
| 933 | +// radio.layout.doClick(); |
---|
796 | 934 | |
---|
797 | 935 | } else |
---|
798 | 936 | { |
---|
.. | .. |
---|
813 | 951 | // X frame.getContentPane().remove(/*"Center",*/framePanel); |
---|
814 | 952 | // X framePanel.remove(bigThree); |
---|
815 | 953 | // X frame.getContentPane().add(/*"Center",*/bigThree); |
---|
816 | | - framePanel.setDividerLocation(0); |
---|
| 954 | +// framePanel.setDividerLocation(0); |
---|
817 | 955 | |
---|
818 | | - radio.layout = fullscreenLayout; |
---|
819 | | - radio.layout.doClick(); |
---|
| 956 | +// radio.layout = fullscreenLayout; |
---|
| 957 | +// radio.layout.doClick(); |
---|
820 | 958 | //frame.setVisible(true); |
---|
821 | 959 | } |
---|
822 | 960 | frame.validate(); |
---|
| 961 | + |
---|
| 962 | + cameraView.requestFocusInWindow(); |
---|
823 | 963 | } |
---|
824 | 964 | |
---|
825 | | - private byte[] CompressCopy() |
---|
| 965 | + void CollapseToolbar() |
---|
| 966 | + { |
---|
| 967 | + framePanel.setDividerLocation(0); |
---|
| 968 | + //frame.validate(); |
---|
| 969 | + |
---|
| 970 | + cameraView.requestFocusInWindow(); |
---|
| 971 | + } |
---|
| 972 | + |
---|
| 973 | + private Object3D Duplicate(Object3D object) |
---|
826 | 974 | { |
---|
827 | 975 | boolean temp = CameraPane.SWITCH; |
---|
828 | 976 | CameraPane.SWITCH = false; |
---|
829 | 977 | |
---|
830 | | - copy.ExtractBigData(versiontable); |
---|
| 978 | + if (Grafreed.grafreed.universe.versiontable == null) |
---|
| 979 | + Grafreed.grafreed.universe.versiontable = new java.util.Hashtable<java.util.UUID, Object3D>(); |
---|
| 980 | + |
---|
| 981 | + object.ExtractBigData(Grafreed.grafreed.universe.versiontable); |
---|
831 | 982 | // if (copy == client) |
---|
832 | 983 | |
---|
833 | | - byte[] versions[] = copy.versions; |
---|
834 | | - copy.versions = null; |
---|
| 984 | + Object3D versions[] = object.versionlist; |
---|
| 985 | + java.util.Hashtable<java.util.UUID, Object3D> versiontable = object.versiontable; // if Grafreed.grafreed.universe |
---|
| 986 | + object.versionlist = null; |
---|
| 987 | + object.versiontable = null; |
---|
835 | 988 | |
---|
836 | | - byte[] compress = Compress(copy); |
---|
| 989 | + Object3D parent = object.parent; |
---|
| 990 | + object.parent = null; |
---|
837 | 991 | |
---|
838 | | - copy.versions = versions; |
---|
| 992 | + //byte[] compress = Compress(copy); |
---|
| 993 | + Object3D compress = (Object3D)Grafreed.clone(object); |
---|
839 | 994 | |
---|
840 | | - copy.RestoreBigData(versiontable); |
---|
| 995 | + object.parent = parent; |
---|
| 996 | + |
---|
| 997 | + object.versionlist = versions; |
---|
| 998 | + object.versiontable = versiontable; // if Grafreed.grafreed.universe |
---|
| 999 | + |
---|
| 1000 | + object.RestoreBigData(Grafreed.grafreed.universe.versiontable); |
---|
841 | 1001 | |
---|
842 | 1002 | CameraPane.SWITCH = temp; |
---|
843 | 1003 | |
---|
.. | .. |
---|
965 | 1125 | { |
---|
966 | 1126 | SetupMaterial(materialPanel); |
---|
967 | 1127 | } |
---|
| 1128 | + |
---|
968 | 1129 | //SetupName(); |
---|
969 | 1130 | //SetupViews(); |
---|
970 | 1131 | } |
---|
.. | .. |
---|
1173 | 1334 | |
---|
1174 | 1335 | namePanel = new cGridBag(); |
---|
1175 | 1336 | |
---|
| 1337 | + //if (copy.pinned) |
---|
| 1338 | + { |
---|
| 1339 | + pinButton = GetToggleButton("icons/pin.png", !Globals.NIMBUSLAF); |
---|
| 1340 | + pinButton.setSelected(copy.pinned); |
---|
| 1341 | + cGridBag t = new cGridBag(); |
---|
| 1342 | + t.preferredWidth = 2; |
---|
| 1343 | + t.add(pinButton); |
---|
| 1344 | + namePanel.add(t); |
---|
| 1345 | + |
---|
| 1346 | + pinButton.addItemListener(this); |
---|
| 1347 | + } |
---|
| 1348 | + |
---|
1176 | 1349 | nameField = AddText(namePanel, copy.GetName()); |
---|
1177 | 1350 | namePanel.add(new JScrollPane(nameField, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER)); |
---|
1178 | 1351 | oe.ctrlPanel.add(namePanel); |
---|
.. | .. |
---|
1186 | 1359 | |
---|
1187 | 1360 | liveCB = AddCheckBox(setupPanel, "Live", copy.live); |
---|
1188 | 1361 | liveCB.setToolTipText("Animate object"); |
---|
| 1362 | + markCB = AddCheckBox(setupPanel, "Anim", copy.marked); |
---|
| 1363 | + markCB.setToolTipText("Set target transform"); |
---|
1189 | 1364 | selectableCB = AddCheckBox(setupPanel, "Select", !copy.dontselect); |
---|
1190 | 1365 | selectableCB.setToolTipText("Make object selectable"); |
---|
1191 | 1366 | // Return(); |
---|
1192 | 1367 | |
---|
1193 | 1368 | hideCB = AddCheckBox(setupPanel, "Hide", copy.hide); |
---|
1194 | 1369 | hideCB.setToolTipText("Hide object"); |
---|
1195 | | - markCB = AddCheckBox(setupPanel, "Mark", copy.marked); |
---|
1196 | | - markCB.setToolTipText("As animation target transform"); |
---|
| 1370 | + |
---|
| 1371 | + ToolTipManager.sharedInstance().setLightWeightPopupEnabled(false); |
---|
1197 | 1372 | |
---|
1198 | 1373 | setupPanel2 = new cGridBag().setVertical(false); |
---|
1199 | 1374 | |
---|
.. | .. |
---|
1393 | 1568 | |
---|
1394 | 1569 | if (cam == null || !(copy.get(0) instanceof cGroup)) |
---|
1395 | 1570 | { |
---|
1396 | | - System.out.println("CREATE CAMERAS"); |
---|
1397 | | - cams = new cTemplate(); |
---|
1398 | | - cams.name = "Cameras"; |
---|
1399 | | - copy.insertElementAt(cams, 0); |
---|
1400 | | - //cams.parent = copy; |
---|
1401 | | - |
---|
1402 | | - cam = new Camera(); // LA.newVector(3, 2, 1)); |
---|
1403 | | - cams.addChild(cam); |
---|
1404 | | - cam = new Camera(1); |
---|
1405 | | - cams.addChild(cam); |
---|
1406 | | - cam = new Camera(2); |
---|
1407 | | - cams.addChild(cam); |
---|
1408 | | - cam = new Camera(3); |
---|
1409 | | - cams.addChild(cam); |
---|
1410 | | - cam = new Camera(4); // Light |
---|
1411 | | - cams.addChild(cam); |
---|
| 1571 | + if (Globals.DEBUG) |
---|
| 1572 | + System.out.println("CREATE CAMERAS"); |
---|
| 1573 | + cams = CreateCameras(); |
---|
1412 | 1574 | } else |
---|
1413 | 1575 | { |
---|
1414 | 1576 | cams = (cGroup) copy.get(0); |
---|
.. | .. |
---|
1474 | 1636 | //frontView.object = copy; |
---|
1475 | 1637 | //sideView.object = copy; |
---|
1476 | 1638 | |
---|
| 1639 | + transformPanel = new cGridBag().setVertical(true); |
---|
| 1640 | + |
---|
| 1641 | + cGridBag resetTransformPanel = new cGridBag(); |
---|
| 1642 | + |
---|
| 1643 | + resetTransformPanel.preferredHeight = 2; |
---|
| 1644 | + |
---|
| 1645 | + cButton resetTransform = GetButton("Reset all", !Globals.NIMBUSLAF); |
---|
| 1646 | + resetTransform.setToolTipText("Reset Translation, Rotation and Scale"); |
---|
| 1647 | + resetTransform.addMouseListener(new MouseAdapter() |
---|
| 1648 | + { |
---|
| 1649 | + public void mouseClicked(MouseEvent e) |
---|
| 1650 | + { |
---|
| 1651 | + ResetTransform(); |
---|
| 1652 | + } |
---|
| 1653 | + }); |
---|
| 1654 | + resetTransformPanel.add(resetTransform); |
---|
| 1655 | + |
---|
| 1656 | + resetTransform = GetButton("T only", !Globals.NIMBUSLAF); |
---|
| 1657 | + resetTransform.setToolTipText("Reset Translation only"); |
---|
| 1658 | + resetTransform.addMouseListener(new MouseAdapter() |
---|
| 1659 | + { |
---|
| 1660 | + public void mouseClicked(MouseEvent e) |
---|
| 1661 | + { |
---|
| 1662 | + ResetTransform(1); |
---|
| 1663 | + } |
---|
| 1664 | + }); |
---|
| 1665 | + resetTransformPanel.add(resetTransform); |
---|
| 1666 | + |
---|
| 1667 | + resetTransform = GetButton("RS only", !Globals.NIMBUSLAF); |
---|
| 1668 | + resetTransform.setToolTipText("Reset Rotation and Scale only"); |
---|
| 1669 | + resetTransform.addMouseListener(new MouseAdapter() |
---|
| 1670 | + { |
---|
| 1671 | + public void mouseClicked(MouseEvent e) |
---|
| 1672 | + { |
---|
| 1673 | + ResetTransform(2); |
---|
| 1674 | + } |
---|
| 1675 | + }); |
---|
| 1676 | + resetTransformPanel.add(resetTransform); |
---|
| 1677 | + |
---|
1477 | 1678 | XYZPanel = new cGridBag().setVertical(true); |
---|
1478 | 1679 | //XYZPanel.setLayout(new GridLayout(3, 1, 5, 5)); |
---|
1479 | 1680 | |
---|
.. | .. |
---|
1483 | 1684 | XYZPanel.addComponent(/*BorderLayout.NORTH,*/topView); // Scroll); |
---|
1484 | 1685 | //XYZPanel.setName("XYZ"); |
---|
1485 | 1686 | |
---|
| 1687 | + transformPanel.add(resetTransformPanel); |
---|
| 1688 | + transformPanel.add(XYZPanel); |
---|
| 1689 | + |
---|
1486 | 1690 | /* |
---|
1487 | 1691 | gridPanel = new JPanel(); //new BorderLayout()); |
---|
1488 | 1692 | gridPanel.setLayout(new GridLayout(1, 2)); |
---|
.. | .. |
---|
1490 | 1694 | gridPanel.add(cameraView); |
---|
1491 | 1695 | gridPanel.add(XYZPanel); |
---|
1492 | 1696 | */ |
---|
1493 | | - gridPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, centralPanel, XYZPanel); //new BorderLayout()); |
---|
1494 | | - gridPanel.setContinuousLayout(true); |
---|
1495 | | - gridPanel.setOneTouchExpandable(true); |
---|
1496 | | - gridPanel.setDividerLocation(1.0); |
---|
1497 | | - gridPanel.setDividerSize(9); |
---|
1498 | | - gridPanel.setResizeWeight(0.85); |
---|
| 1697 | +// gridPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, centralPanel, XYZPanel); //new BorderLayout()); |
---|
| 1698 | +// gridPanel.setContinuousLayout(true); |
---|
| 1699 | +// gridPanel.setOneTouchExpandable(true); |
---|
| 1700 | +// gridPanel.setDividerLocation(1.0); |
---|
| 1701 | +// gridPanel.setDividerSize(9); |
---|
| 1702 | +// gridPanel.setResizeWeight(0.85); |
---|
1499 | 1703 | |
---|
1500 | 1704 | // aConstraints.weighty = 0; |
---|
1501 | 1705 | //System.out.println("THIS = " + this); |
---|
.. | .. |
---|
1518 | 1722 | |
---|
1519 | 1723 | //JScrollPane tmp = new JScrollPane(ctrlPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); |
---|
1520 | 1724 | //tmp.setName("Edit"); |
---|
| 1725 | + objectPanel.add(skyboxPanel); |
---|
| 1726 | + objectPanel.setIconAt(0, GetIcon("icons/skybox.jpg")); |
---|
| 1727 | + objectPanel.setToolTipTextAt(0, "Backgrounds"); |
---|
| 1728 | + |
---|
| 1729 | + objectPanel.add(toolboxPanel); |
---|
| 1730 | + objectPanel.setIconAt(1, GetIcon("icons/primitives.png")); |
---|
| 1731 | + objectPanel.setToolTipTextAt(1, "Objects & textures"); |
---|
| 1732 | + |
---|
1521 | 1733 | objectPanel.add(materialPanel); |
---|
1522 | | - objectPanel.setIconAt(0, GetIcon("icons/material.png")); |
---|
| 1734 | + objectPanel.setIconAt(2, GetIcon("icons/material.png")); |
---|
| 1735 | + objectPanel.setToolTipTextAt(2, "Material"); |
---|
| 1736 | + |
---|
1523 | 1737 | // JPanel north = new JPanel(new BorderLayout()); |
---|
1524 | 1738 | // north.setName("Edit"); |
---|
1525 | 1739 | // north.add(ctrlPanel, BorderLayout.NORTH); |
---|
1526 | 1740 | // objectPanel.add(north); |
---|
1527 | 1741 | objectPanel.add(editPanel); |
---|
1528 | | - objectPanel.setIconAt(1, GetIcon("icons/write.png")); |
---|
| 1742 | + objectPanel.setIconAt(3, GetIcon("icons/writewhite.png")); |
---|
| 1743 | + objectPanel.setToolTipTextAt(3, "Edit controls"); |
---|
1529 | 1744 | |
---|
1530 | | - //if (Globals.ADVANCED) |
---|
1531 | | - objectPanel.add(infoPanel); |
---|
1532 | | - objectPanel.setIconAt(2, GetIcon("icons/info.png")); |
---|
| 1745 | + objectPanel.add(transformPanel); |
---|
| 1746 | + objectPanel.setIconAt(4, GetIcon("icons/XYZ.png")); |
---|
| 1747 | + objectPanel.setToolTipTextAt(4, "TRS transform"); |
---|
1533 | 1748 | |
---|
1534 | | - objectPanel.add(XYZPanel); |
---|
1535 | | - objectPanel.setIconAt(3, GetIcon("icons/XYZ.png")); |
---|
1536 | | - |
---|
1537 | | - objectPanel.add(toolboxPanel); |
---|
1538 | | - objectPanel.setIconAt(4, GetIcon("icons/primitives.png")); |
---|
1539 | | - |
---|
| 1749 | + patchMaterial = true; |
---|
| 1750 | + cameraView.patchMaterial = this; |
---|
| 1751 | + objectPanel.setSelectedIndex(2); |
---|
| 1752 | + |
---|
1540 | 1753 | /* |
---|
1541 | 1754 | aConstraints.gridx = 0; |
---|
1542 | 1755 | aConstraints.gridwidth = 1; |
---|
.. | .. |
---|
1556 | 1769 | scrollpane.addMouseWheelListener(this); // Default not fast enough |
---|
1557 | 1770 | |
---|
1558 | 1771 | /*JTabbedPane*/ scenePanel = new cGridBag(); |
---|
1559 | | - scenePanel.preferredWidth = 5; |
---|
| 1772 | + scenePanel.preferredWidth = 6; |
---|
1560 | 1773 | |
---|
1561 | 1774 | JTabbedPane tabbedPane = new JTabbedPane(); |
---|
1562 | 1775 | tabbedPane.add(scrollpane); |
---|
.. | .. |
---|
1567 | 1780 | |
---|
1568 | 1781 | AddOptions(optionsPanel); //, aConstraints); |
---|
1569 | 1782 | |
---|
1570 | | - tabbedPane.add(optionsPanel); |
---|
1571 | | - |
---|
1572 | 1783 | tabbedPane.add(FSPane = new cFileSystemPane(this)); |
---|
1573 | 1784 | |
---|
| 1785 | + tabbedPane.add(optionsPanel); |
---|
| 1786 | + |
---|
1574 | 1787 | scenePanel.add(tabbedPane); |
---|
| 1788 | + |
---|
| 1789 | + cGridBag creditsPanel = new cGridBag().setVertical(true); |
---|
| 1790 | + creditsPanel.setName("Credits"); |
---|
| 1791 | + |
---|
| 1792 | + cLabel ogaLabel = new cLabel(" Most Skyboxes courtesy of OpenGameArt!", !Globals.NIMBUSLAF); |
---|
| 1793 | + creditsPanel.add(ogaLabel); |
---|
| 1794 | + |
---|
| 1795 | + cButton creditButton; |
---|
| 1796 | + creditsPanel.add(creditButton = GetButton("icons/sara-logo.png", !Globals.NIMBUSLAF)); |
---|
| 1797 | + creditButton.setToolTipText("https://opengameart.org"); |
---|
| 1798 | + |
---|
| 1799 | + creditButton.addMouseListener(new MouseAdapter() |
---|
| 1800 | + { |
---|
| 1801 | + public void mouseClicked(MouseEvent e) |
---|
| 1802 | + { |
---|
| 1803 | + try |
---|
| 1804 | + { |
---|
| 1805 | + Desktop.getDesktop().browse(new java.net.URI("https://opengameart.org/")); |
---|
| 1806 | + } catch (Exception e1) |
---|
| 1807 | +// } catch (java.io.IOException | java.net.URISyntaxException e1) |
---|
| 1808 | + { |
---|
| 1809 | + e1.printStackTrace(); |
---|
| 1810 | + } |
---|
| 1811 | + } |
---|
| 1812 | + }); |
---|
| 1813 | + |
---|
| 1814 | + ogaLabel = new cLabel(" Download 3D models! (.3ds and .obj only)", !Globals.NIMBUSLAF); |
---|
| 1815 | + creditsPanel.add(ogaLabel); |
---|
| 1816 | + |
---|
| 1817 | + creditsPanel.add(creditButton = GetButton("icons/3delicious.png", !Globals.NIMBUSLAF)); |
---|
| 1818 | + creditButton.setToolTipText("https://3delicious.net"); |
---|
| 1819 | + |
---|
| 1820 | + creditButton.addMouseListener(new MouseAdapter() |
---|
| 1821 | + { |
---|
| 1822 | + public void mouseClicked(MouseEvent e) |
---|
| 1823 | + { |
---|
| 1824 | + try |
---|
| 1825 | + { |
---|
| 1826 | + Desktop.getDesktop().browse(new java.net.URI("https://3delicious.net")); |
---|
| 1827 | + } catch (Exception e1) |
---|
| 1828 | +// } catch (java.io.IOException | java.net.URISyntaxException e1) |
---|
| 1829 | + { |
---|
| 1830 | + e1.printStackTrace(); |
---|
| 1831 | + } |
---|
| 1832 | + } |
---|
| 1833 | + }); |
---|
| 1834 | + |
---|
| 1835 | + creditsPanel.add(creditButton = GetButton("icons/archive3d.png", !Globals.NIMBUSLAF)); |
---|
| 1836 | + creditButton.setToolTipText("https://archive3d.net"); |
---|
| 1837 | + |
---|
| 1838 | + creditButton.addMouseListener(new MouseAdapter() |
---|
| 1839 | + { |
---|
| 1840 | + public void mouseClicked(MouseEvent e) |
---|
| 1841 | + { |
---|
| 1842 | + try |
---|
| 1843 | + { |
---|
| 1844 | + Desktop.getDesktop().browse(new java.net.URI("https://archive3d.net")); |
---|
| 1845 | + } catch (Exception e1) |
---|
| 1846 | +// } catch (java.io.IOException | java.net.URISyntaxException e1) |
---|
| 1847 | + { |
---|
| 1848 | + e1.printStackTrace(); |
---|
| 1849 | + } |
---|
| 1850 | + } |
---|
| 1851 | + }); |
---|
| 1852 | + |
---|
| 1853 | + creditsPanel.add(creditButton = GetButton("icons/turbosquid.png", !Globals.NIMBUSLAF)); |
---|
| 1854 | + creditButton.setToolTipText("https://turbosquid.com"); |
---|
| 1855 | + |
---|
| 1856 | + creditButton.addMouseListener(new MouseAdapter() |
---|
| 1857 | + { |
---|
| 1858 | + public void mouseClicked(MouseEvent e) |
---|
| 1859 | + { |
---|
| 1860 | + try |
---|
| 1861 | + { |
---|
| 1862 | + Desktop.getDesktop().browse(new java.net.URI("https://www.turbosquid.com/Search/3D-Models/free")); |
---|
| 1863 | + } catch (Exception e1) |
---|
| 1864 | +// } catch (java.io.IOException | java.net.URISyntaxException e1) |
---|
| 1865 | + { |
---|
| 1866 | + e1.printStackTrace(); |
---|
| 1867 | + } |
---|
| 1868 | + } |
---|
| 1869 | + }); |
---|
| 1870 | + |
---|
| 1871 | + for (int i=6; --i>=0;) |
---|
| 1872 | + { |
---|
| 1873 | + creditsPanel.add(new cGridBag()); |
---|
| 1874 | + } |
---|
| 1875 | + |
---|
| 1876 | + tabbedPane.add(creditsPanel); |
---|
| 1877 | + tabbedPane.setToolTipTextAt(3, "Credits"); |
---|
| 1878 | + |
---|
| 1879 | + if (Globals.ADVANCED) |
---|
| 1880 | + { |
---|
| 1881 | + tabbedPane.add(infoPanel); |
---|
| 1882 | + tabbedPane.setIconAt(4, GetIcon("icons/info.png")); |
---|
| 1883 | + tabbedPane.setToolTipTextAt(4, "Information"); |
---|
| 1884 | + } |
---|
1575 | 1885 | |
---|
1576 | 1886 | /* |
---|
1577 | 1887 | cTree jTree = new cTree(null); |
---|
.. | .. |
---|
1593 | 1903 | jtp.add(tree); |
---|
1594 | 1904 | */ |
---|
1595 | 1905 | |
---|
1596 | | - bigPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, scenePanel, gridPanel); |
---|
1597 | | - bigPanel.setContinuousLayout(true); |
---|
1598 | | - bigPanel.setOneTouchExpandable(true); |
---|
1599 | | - bigPanel.setDividerLocation(0.8); |
---|
1600 | | - bigPanel.setDividerSize(15); |
---|
1601 | | - bigPanel.setResizeWeight(0.15); |
---|
1602 | | - bigPanel.setName("Scene"); |
---|
| 1906 | +// bigPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, scenePanel, gridPanel); |
---|
| 1907 | +// bigPanel.setContinuousLayout(true); |
---|
| 1908 | +// bigPanel.setOneTouchExpandable(true); |
---|
| 1909 | +// bigPanel.setDividerLocation(0.8); |
---|
| 1910 | +// bigPanel.setDividerSize(15); |
---|
| 1911 | +// bigPanel.setResizeWeight(0.15); |
---|
| 1912 | +// bigPanel.setName("Scene"); |
---|
1603 | 1913 | |
---|
1604 | 1914 | //bigPanel.setLayout(new BorderLayout()); |
---|
1605 | 1915 | //bigPanel.setSize(new Dimension(10,10)); |
---|
.. | .. |
---|
1643 | 1953 | // aConstraints.gridheight = 1; |
---|
1644 | 1954 | |
---|
1645 | 1955 | framePanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, toolbarPanel, bigThree); |
---|
| 1956 | + |
---|
| 1957 | + framePanel.addPropertyChangeListener(JSplitPane.DIVIDER_LOCATION_PROPERTY, |
---|
| 1958 | + new java.beans.PropertyChangeListener() |
---|
| 1959 | + { |
---|
| 1960 | + public void propertyChange(java.beans.PropertyChangeEvent pce) |
---|
| 1961 | + { |
---|
| 1962 | + if ((Integer)pce.getOldValue() == 1) |
---|
| 1963 | + { |
---|
| 1964 | + if (radio.layout != expandedLayout) |
---|
| 1965 | + { |
---|
| 1966 | + radio.layout = expandedLayout; |
---|
| 1967 | + radio.layout.doClick(); |
---|
| 1968 | + } |
---|
| 1969 | + } |
---|
| 1970 | + } |
---|
| 1971 | + }); |
---|
| 1972 | + |
---|
1646 | 1973 | framePanel.setContinuousLayout(false); |
---|
1647 | 1974 | framePanel.setOneTouchExpandable(false); |
---|
1648 | 1975 | //.setDividerLocation(0.8); |
---|
.. | .. |
---|
1652 | 1979 | |
---|
1653 | 1980 | frame.getContentPane().setLayout(new BorderLayout()); |
---|
1654 | 1981 | /**/ |
---|
1655 | | - JTabbedPane worldPane = new JTabbedPane(); |
---|
| 1982 | + //JTabbedPane worldPane = new JTabbedPane(); |
---|
1656 | 1983 | //worldPane.add(bigPanel); |
---|
1657 | 1984 | //worldPane.add(worldPanel); |
---|
1658 | 1985 | /**/ |
---|
.. | .. |
---|
1666 | 1993 | |
---|
1667 | 1994 | cameraView.requestFocusInWindow(); |
---|
1668 | 1995 | |
---|
1669 | | - gridPanel.setDividerLocation(1.0); |
---|
| 1996 | +// gridPanel.setDividerLocation(1.0); |
---|
1670 | 1997 | |
---|
1671 | 1998 | frame.validate(); |
---|
1672 | 1999 | |
---|
.. | .. |
---|
1675 | 2002 | frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); |
---|
1676 | 2003 | frame.addWindowListener(new WindowAdapter() |
---|
1677 | 2004 | { |
---|
1678 | | - |
---|
1679 | 2005 | public void windowClosing(WindowEvent e) |
---|
1680 | 2006 | { |
---|
1681 | 2007 | Close(); |
---|
.. | .. |
---|
1698 | 2024 | ctrlPanel.removeAll(); |
---|
1699 | 2025 | } |
---|
1700 | 2026 | |
---|
1701 | | - void SetupMaterial(cGridBag panel) |
---|
| 2027 | + void SetupMaterial(cGridBag materialpanel) |
---|
1702 | 2028 | { |
---|
1703 | | - /* |
---|
| 2029 | + cGridBag presetpanel = new cGridBag().setVertical(true); |
---|
| 2030 | + |
---|
| 2031 | + cLabel skin = GetLabel("icons/shadericons/shadericon00000.png", !Globals.NIMBUSLAF); |
---|
| 2032 | + skin.setToolTipText("Skin"); |
---|
| 2033 | + skin.addMouseListener(new MouseAdapter() |
---|
| 2034 | + { |
---|
| 2035 | + public void mouseClicked(MouseEvent e) |
---|
| 2036 | + { |
---|
| 2037 | + Object3D object = Grafreed.materials.versionlist[0].get(0); |
---|
| 2038 | + cMaterial material = object.material; |
---|
| 2039 | + |
---|
| 2040 | + // Skin |
---|
| 2041 | + colorField.setFloat(material.color); |
---|
| 2042 | + float saturation = material.modulation; |
---|
| 2043 | + |
---|
| 2044 | + if (!cameraView.Skinshader) |
---|
| 2045 | + { |
---|
| 2046 | + saturation /= 1.5; |
---|
| 2047 | + } |
---|
| 2048 | + |
---|
| 2049 | + saturationField.setFloat(saturation); |
---|
| 2050 | + |
---|
| 2051 | + subsurfaceField.setFloat(material.subsurface); |
---|
| 2052 | + selfshadowField.setFloat(material.diffuseness); |
---|
| 2053 | + diffusenessField.setFloat(material.factor); |
---|
| 2054 | + shininessField.setFloat(material.shininess); |
---|
| 2055 | + shadowbiasField.setFloat(material.shadowbias); |
---|
| 2056 | + diffuseField.setFloat(material.diffuse); |
---|
| 2057 | + specularField.setFloat(material.specular); |
---|
| 2058 | + |
---|
| 2059 | + bumpField.setFloat(object.projectedVertices[0].x / 1000.0); |
---|
| 2060 | + noiseField.setFloat(object.projectedVertices[0].y / 1000.0); |
---|
| 2061 | + powerField.setFloat(object.projectedVertices[2].x / 1000.0); |
---|
| 2062 | + |
---|
| 2063 | + materialtouched = true; |
---|
| 2064 | + applySelf(); |
---|
| 2065 | + } |
---|
| 2066 | + }); |
---|
| 2067 | + presetpanel.add(skin); |
---|
| 2068 | + |
---|
| 2069 | + cLabel lambert = GetLabel("icons/shadericons/shadericon00002.png", !Globals.NIMBUSLAF); |
---|
| 2070 | + lambert.setToolTipText("Diffuse"); |
---|
| 2071 | + lambert.addMouseListener(new MouseAdapter() |
---|
| 2072 | + { |
---|
| 2073 | + public void mouseClicked(MouseEvent e) |
---|
| 2074 | + { |
---|
| 2075 | + Object3D object = Grafreed.materials.versionlist[2].get(0); |
---|
| 2076 | + cMaterial material = object.material; |
---|
| 2077 | + |
---|
| 2078 | + diffusenessField.setFloat(material.factor); |
---|
| 2079 | + selfshadowField.setFloat(material.diffuseness); |
---|
| 2080 | + |
---|
| 2081 | + materialtouched = true; |
---|
| 2082 | + applySelf(); |
---|
| 2083 | + } |
---|
| 2084 | + }); |
---|
| 2085 | + presetpanel.add(lambert); |
---|
| 2086 | + |
---|
| 2087 | + cLabel diffuse2 = GetLabel("icons/shadericons/shadericon00003.png", !Globals.NIMBUSLAF); |
---|
| 2088 | + diffuse2.setToolTipText("Diffuse2"); |
---|
| 2089 | + diffuse2.addMouseListener(new MouseAdapter() |
---|
| 2090 | + { |
---|
| 2091 | + public void mouseClicked(MouseEvent e) |
---|
| 2092 | + { |
---|
| 2093 | + Object3D object = Grafreed.materials.versionlist[3].get(0); |
---|
| 2094 | + cMaterial material = object.material; |
---|
| 2095 | + |
---|
| 2096 | + diffusenessField.setFloat(material.factor); |
---|
| 2097 | + selfshadowField.setFloat(material.diffuseness); |
---|
| 2098 | + |
---|
| 2099 | + materialtouched = true; |
---|
| 2100 | + applySelf(); |
---|
| 2101 | + } |
---|
| 2102 | + }); |
---|
| 2103 | + presetpanel.add(diffuse2); |
---|
| 2104 | + |
---|
| 2105 | + cLabel diffusemoon = GetLabel("icons/shadericons/shadericon00004.png", !Globals.NIMBUSLAF); |
---|
| 2106 | + diffusemoon.setToolTipText("Moon"); |
---|
| 2107 | + diffusemoon.addMouseListener(new MouseAdapter() |
---|
| 2108 | + { |
---|
| 2109 | + public void mouseClicked(MouseEvent e) |
---|
| 2110 | + { |
---|
| 2111 | + Object3D object = Grafreed.materials.versionlist[4].get(0); |
---|
| 2112 | + cMaterial material = object.material; |
---|
| 2113 | + |
---|
| 2114 | + diffusenessField.setFloat(material.factor); |
---|
| 2115 | + selfshadowField.setFloat(material.diffuseness); |
---|
| 2116 | + |
---|
| 2117 | + materialtouched = true; |
---|
| 2118 | + applySelf(); |
---|
| 2119 | + } |
---|
| 2120 | + }); |
---|
| 2121 | + presetpanel.add(diffusemoon); |
---|
| 2122 | + |
---|
| 2123 | + cLabel diffusemoon2 = GetLabel("icons/shadericons/shadericon00005.png", !Globals.NIMBUSLAF); |
---|
| 2124 | + diffusemoon2.setToolTipText("Moon2"); |
---|
| 2125 | + diffusemoon2.addMouseListener(new MouseAdapter() |
---|
| 2126 | + { |
---|
| 2127 | + public void mouseClicked(MouseEvent e) |
---|
| 2128 | + { |
---|
| 2129 | + Object3D object = Grafreed.materials.versionlist[5].get(0); |
---|
| 2130 | + cMaterial material = object.material; |
---|
| 2131 | + |
---|
| 2132 | + diffusenessField.setFloat(material.factor); |
---|
| 2133 | + selfshadowField.setFloat(material.diffuseness); |
---|
| 2134 | + |
---|
| 2135 | + materialtouched = true; |
---|
| 2136 | + applySelf(); |
---|
| 2137 | + } |
---|
| 2138 | + }); |
---|
| 2139 | + presetpanel.add(diffusemoon2); |
---|
| 2140 | + |
---|
| 2141 | + cLabel diffusemoon3 = GetLabel("icons/shadericons/shadericon00006.png", !Globals.NIMBUSLAF); |
---|
| 2142 | + diffusemoon3.setToolTipText("Moon3"); |
---|
| 2143 | + diffusemoon3.addMouseListener(new MouseAdapter() |
---|
| 2144 | + { |
---|
| 2145 | + public void mouseClicked(MouseEvent e) |
---|
| 2146 | + { |
---|
| 2147 | + Object3D object = Grafreed.materials.versionlist[6].get(0); |
---|
| 2148 | + cMaterial material = object.material; |
---|
| 2149 | + |
---|
| 2150 | + diffusenessField.setFloat(material.factor); |
---|
| 2151 | + selfshadowField.setFloat(material.diffuseness); |
---|
| 2152 | + |
---|
| 2153 | + materialtouched = true; |
---|
| 2154 | + applySelf(); |
---|
| 2155 | + } |
---|
| 2156 | + }); |
---|
| 2157 | + presetpanel.add(diffusemoon3); |
---|
| 2158 | + |
---|
| 2159 | + cLabel diffusesheen = GetLabel("icons/shadericons/shadericon00007.png", !Globals.NIMBUSLAF); |
---|
| 2160 | + diffusesheen.setToolTipText("Sheen"); |
---|
| 2161 | + diffusesheen.addMouseListener(new MouseAdapter() |
---|
| 2162 | + { |
---|
| 2163 | + public void mouseClicked(MouseEvent e) |
---|
| 2164 | + { |
---|
| 2165 | + Object3D object = Grafreed.materials.versionlist[7].get(0); |
---|
| 2166 | + cMaterial material = object.material; |
---|
| 2167 | + |
---|
| 2168 | + sheenField.setFloat(material.sheen); |
---|
| 2169 | + |
---|
| 2170 | + materialtouched = true; |
---|
| 2171 | + applySelf(); |
---|
| 2172 | + } |
---|
| 2173 | + }); |
---|
| 2174 | + presetpanel.add(diffusesheen); |
---|
| 2175 | + |
---|
| 2176 | + cLabel rough = GetLabel("icons/shadericons/shadericon00001.png", !Globals.NIMBUSLAF); |
---|
| 2177 | + rough.setToolTipText("Rough metal"); |
---|
| 2178 | + rough.addMouseListener(new MouseAdapter() |
---|
| 2179 | + { |
---|
| 2180 | + public void mouseClicked(MouseEvent e) |
---|
| 2181 | + { |
---|
| 2182 | + Object3D object = Grafreed.materials.versionlist[1].get(0); |
---|
| 2183 | + cMaterial material = object.material; |
---|
| 2184 | + |
---|
| 2185 | + shininessField.setFloat(material.shininess); |
---|
| 2186 | + velvetField.setFloat(material.velvet); |
---|
| 2187 | + |
---|
| 2188 | + materialtouched = true; |
---|
| 2189 | + applySelf(); |
---|
| 2190 | + } |
---|
| 2191 | + }); |
---|
| 2192 | + presetpanel.add(rough); |
---|
| 2193 | + |
---|
| 2194 | + cLabel rough2 = GetLabel("icons/shadericons/shadericon00013.png", !Globals.NIMBUSLAF); |
---|
| 2195 | + rough2.setToolTipText("Medium metal"); |
---|
| 2196 | + rough2.addMouseListener(new MouseAdapter() |
---|
| 2197 | + { |
---|
| 2198 | + public void mouseClicked(MouseEvent e) |
---|
| 2199 | + { |
---|
| 2200 | + Object3D object = Grafreed.materials.versionlist[13].get(0); |
---|
| 2201 | + cMaterial material = object.material; |
---|
| 2202 | + |
---|
| 2203 | + shininessField.setFloat(material.shininess); |
---|
| 2204 | + lightareaField.setFloat(material.lightarea); |
---|
| 2205 | + |
---|
| 2206 | + materialtouched = true; |
---|
| 2207 | + applySelf(); |
---|
| 2208 | + } |
---|
| 2209 | + }); |
---|
| 2210 | + presetpanel.add(rough2); |
---|
| 2211 | + |
---|
| 2212 | + cLabel shini0 = GetLabel("icons/shadericons/shadericon00014.png", !Globals.NIMBUSLAF); |
---|
| 2213 | + shini0.setToolTipText("Shiny"); |
---|
| 2214 | + shini0.addMouseListener(new MouseAdapter() |
---|
| 2215 | + { |
---|
| 2216 | + public void mouseClicked(MouseEvent e) |
---|
| 2217 | + { |
---|
| 2218 | + Object3D object = Grafreed.materials.versionlist[14].get(0); |
---|
| 2219 | + cMaterial material = object.material; |
---|
| 2220 | + |
---|
| 2221 | + shininessField.setFloat(material.shininess); |
---|
| 2222 | + lightareaField.setFloat(material.lightarea); |
---|
| 2223 | + |
---|
| 2224 | + materialtouched = true; |
---|
| 2225 | + applySelf(); |
---|
| 2226 | + } |
---|
| 2227 | + }); |
---|
| 2228 | + presetpanel.add(shini0); |
---|
| 2229 | + |
---|
| 2230 | + cLabel shini1 = GetLabel("icons/shadericons/shadericon00011.png", !Globals.NIMBUSLAF); |
---|
| 2231 | + shini1.setToolTipText("Shiny2"); |
---|
| 2232 | + shini1.addMouseListener(new MouseAdapter() |
---|
| 2233 | + { |
---|
| 2234 | + public void mouseClicked(MouseEvent e) |
---|
| 2235 | + { |
---|
| 2236 | + Object3D object = Grafreed.materials.versionlist[11].get(0); |
---|
| 2237 | + cMaterial material = object.material; |
---|
| 2238 | + |
---|
| 2239 | + shininessField.setFloat(material.shininess); |
---|
| 2240 | + lightareaField.setFloat(material.lightarea); |
---|
| 2241 | + |
---|
| 2242 | + materialtouched = true; |
---|
| 2243 | + applySelf(); |
---|
| 2244 | + } |
---|
| 2245 | + }); |
---|
| 2246 | + presetpanel.add(shini1); |
---|
| 2247 | + |
---|
| 2248 | + cLabel shini2 = GetLabel("icons/shadericons/shadericon00012.png", !Globals.NIMBUSLAF); |
---|
| 2249 | + shini2.setToolTipText("Shiny3"); |
---|
| 2250 | + shini2.addMouseListener(new MouseAdapter() |
---|
| 2251 | + { |
---|
| 2252 | + public void mouseClicked(MouseEvent e) |
---|
| 2253 | + { |
---|
| 2254 | + Object3D object = Grafreed.materials.versionlist[12].get(0); |
---|
| 2255 | + cMaterial material = object.material; |
---|
| 2256 | + |
---|
| 2257 | + shininessField.setFloat(material.shininess); |
---|
| 2258 | + lightareaField.setFloat(material.lightarea); |
---|
| 2259 | + |
---|
| 2260 | + materialtouched = true; |
---|
| 2261 | + applySelf(); |
---|
| 2262 | + } |
---|
| 2263 | + }); |
---|
| 2264 | + presetpanel.add(shini2); |
---|
| 2265 | + |
---|
| 2266 | + cLabel aniso = GetLabel("icons/shadericons/shadericon00008.png", !Globals.NIMBUSLAF); |
---|
| 2267 | + aniso.setToolTipText("AnisoU"); |
---|
| 2268 | + aniso.addMouseListener(new MouseAdapter() |
---|
| 2269 | + { |
---|
| 2270 | + public void mouseClicked(MouseEvent e) |
---|
| 2271 | + { |
---|
| 2272 | + Object3D object = Grafreed.materials.versionlist[8].get(0); |
---|
| 2273 | + cMaterial material = object.material; |
---|
| 2274 | + |
---|
| 2275 | + anisoField.setFloat(material.aniso); |
---|
| 2276 | + anisoVField.setFloat(material.anisoV); |
---|
| 2277 | + |
---|
| 2278 | + materialtouched = true; |
---|
| 2279 | + applySelf(); |
---|
| 2280 | + } |
---|
| 2281 | + }); |
---|
| 2282 | + presetpanel.add(aniso); |
---|
| 2283 | + |
---|
| 2284 | + cLabel aniso2 = GetLabel("icons/shadericons/shadericon00009.png", !Globals.NIMBUSLAF); |
---|
| 2285 | + aniso2.setToolTipText("AnisoV"); |
---|
| 2286 | + aniso2.addMouseListener(new MouseAdapter() |
---|
| 2287 | + { |
---|
| 2288 | + public void mouseClicked(MouseEvent e) |
---|
| 2289 | + { |
---|
| 2290 | + Object3D object = Grafreed.materials.versionlist[9].get(0); |
---|
| 2291 | + cMaterial material = object.material; |
---|
| 2292 | + |
---|
| 2293 | + anisoField.setFloat(material.aniso); |
---|
| 2294 | + anisoVField.setFloat(material.anisoV); |
---|
| 2295 | + |
---|
| 2296 | + materialtouched = true; |
---|
| 2297 | + applySelf(); |
---|
| 2298 | + } |
---|
| 2299 | + }); |
---|
| 2300 | + presetpanel.add(aniso2); |
---|
| 2301 | + |
---|
| 2302 | + cLabel aniso3 = GetLabel("icons/shadericons/shadericon00010.png", !Globals.NIMBUSLAF); |
---|
| 2303 | + aniso3.setToolTipText("AnisoUV"); |
---|
| 2304 | + aniso3.addMouseListener(new MouseAdapter() |
---|
| 2305 | + { |
---|
| 2306 | + public void mouseClicked(MouseEvent e) |
---|
| 2307 | + { |
---|
| 2308 | + Object3D object = Grafreed.materials.versionlist[10].get(0); |
---|
| 2309 | + cMaterial material = object.material; |
---|
| 2310 | + |
---|
| 2311 | + anisoField.setFloat(material.aniso); |
---|
| 2312 | + anisoVField.setFloat(material.anisoV); |
---|
| 2313 | + |
---|
| 2314 | + materialtouched = true; |
---|
| 2315 | + applySelf(); |
---|
| 2316 | + } |
---|
| 2317 | + }); |
---|
| 2318 | + presetpanel.add(aniso3); |
---|
| 2319 | + |
---|
| 2320 | + cLabel velvet0 = GetLabel("icons/shadericons/shadericon00015.png", !Globals.NIMBUSLAF); |
---|
| 2321 | + velvet0.setToolTipText("Velvet"); |
---|
| 2322 | + velvet0.addMouseListener(new MouseAdapter() |
---|
| 2323 | + { |
---|
| 2324 | + public void mouseClicked(MouseEvent e) |
---|
| 2325 | + { |
---|
| 2326 | + Object3D object = Grafreed.materials.versionlist[15].get(0); |
---|
| 2327 | + cMaterial material = object.material; |
---|
| 2328 | + |
---|
| 2329 | + diffusenessField.setFloat(material.factor); |
---|
| 2330 | + selfshadowField.setFloat(material.diffuseness); |
---|
| 2331 | + sheenField.setFloat(material.sheen); |
---|
| 2332 | + shininessField.setFloat(material.shininess); |
---|
| 2333 | + velvetField.setFloat(material.velvet); |
---|
| 2334 | + shiftField.setFloat(material.shift); |
---|
| 2335 | + |
---|
| 2336 | + materialtouched = true; |
---|
| 2337 | + applySelf(); |
---|
| 2338 | + } |
---|
| 2339 | + }); |
---|
| 2340 | + presetpanel.add(velvet0); |
---|
| 2341 | + |
---|
| 2342 | + cLabel bump0 = GetLabel("icons/shadericons/shadericon00016.png", !Globals.NIMBUSLAF); |
---|
| 2343 | + bump0.setToolTipText("Bump texture"); |
---|
| 2344 | + bump0.addMouseListener(new MouseAdapter() |
---|
| 2345 | + { |
---|
| 2346 | + public void mouseClicked(MouseEvent e) |
---|
| 2347 | + { |
---|
| 2348 | + Object3D object = Grafreed.materials.versionlist[16].get(0); |
---|
| 2349 | + cMaterial material = object.material; |
---|
| 2350 | + |
---|
| 2351 | + bumpField.setFloat(object.projectedVertices[0].x / 1000.0); |
---|
| 2352 | + noiseField.setFloat(object.projectedVertices[0].y / 1000.0); |
---|
| 2353 | + powerField.setFloat(object.projectedVertices[2].x / 1000.0); |
---|
| 2354 | + |
---|
| 2355 | + materialtouched = true; |
---|
| 2356 | + applySelf(); |
---|
| 2357 | + } |
---|
| 2358 | + }); |
---|
| 2359 | + presetpanel.add(bump0); |
---|
| 2360 | + |
---|
| 2361 | + cLabel borderShader = GetLabel("icons/shadericons/borderfade.jpg", !Globals.NIMBUSLAF); |
---|
| 2362 | + borderShader.setToolTipText("Border fade"); |
---|
| 2363 | + borderShader.addMouseListener(new MouseAdapter() |
---|
| 2364 | + { |
---|
| 2365 | + public void mouseClicked(MouseEvent e) |
---|
| 2366 | + { |
---|
| 2367 | + borderfadeField.setFloat(0.5); |
---|
| 2368 | + opacityField.setFloat(0.75); |
---|
| 2369 | + |
---|
| 2370 | + materialtouched = true; |
---|
| 2371 | + applySelf(); |
---|
| 2372 | + } |
---|
| 2373 | + }); |
---|
| 2374 | + presetpanel.add(borderShader); |
---|
| 2375 | + |
---|
| 2376 | + cLabel halo = GetLabel("icons/shadericons/shadericon00017.png", !Globals.NIMBUSLAF); |
---|
| 2377 | + halo.setToolTipText("Halo"); |
---|
| 2378 | + halo.addMouseListener(new MouseAdapter() |
---|
| 2379 | + { |
---|
| 2380 | + public void mouseClicked(MouseEvent e) |
---|
| 2381 | + { |
---|
| 2382 | + Object3D object = Grafreed.materials.versionlist[17].get(0); |
---|
| 2383 | + cMaterial material = object.material; |
---|
| 2384 | + |
---|
| 2385 | + opacityPowerField.setFloat(object.projectedVertices[2].y / 1000.0); |
---|
| 2386 | + |
---|
| 2387 | + materialtouched = true; |
---|
| 2388 | + applySelf(); |
---|
| 2389 | + } |
---|
| 2390 | + }); |
---|
| 2391 | + presetpanel.add(halo); |
---|
| 2392 | + |
---|
| 2393 | + cLabel candle = GetLabel("icons/shadericons/shadericon00018.png", !Globals.NIMBUSLAF); |
---|
| 2394 | + candle.setToolTipText("Candle"); |
---|
| 2395 | + candle.addMouseListener(new MouseAdapter() |
---|
| 2396 | + { |
---|
| 2397 | + public void mouseClicked(MouseEvent e) |
---|
| 2398 | + { |
---|
| 2399 | + Object3D object = Grafreed.materials.versionlist[18].get(0); |
---|
| 2400 | + cMaterial material = object.material; |
---|
| 2401 | + |
---|
| 2402 | + subsurfaceField.setFloat(material.subsurface); |
---|
| 2403 | + shadowbiasField.setFloat(material.shadowbias); |
---|
| 2404 | + ambientField.setFloat(material.ambient); |
---|
| 2405 | + specularField.setFloat(material.specular); |
---|
| 2406 | + lightareaField.setFloat(material.lightarea); |
---|
| 2407 | + shininessField.setFloat(material.shininess); |
---|
| 2408 | + |
---|
| 2409 | + materialtouched = true; |
---|
| 2410 | + applySelf(); |
---|
| 2411 | + } |
---|
| 2412 | + }); |
---|
| 2413 | + presetpanel.add(candle); |
---|
| 2414 | + |
---|
| 2415 | + cLabel shadowShader = GetLabel("icons/shadericons/shadow.png", !Globals.NIMBUSLAF); |
---|
| 2416 | + shadowShader.setToolTipText("Shadow"); |
---|
| 2417 | + shadowShader.addMouseListener(new MouseAdapter() |
---|
| 2418 | + { |
---|
| 2419 | + public void mouseClicked(MouseEvent e) |
---|
| 2420 | + { |
---|
| 2421 | + diffuseField.setFloat(0.001); |
---|
| 2422 | + ambientField.setFloat(0.001); |
---|
| 2423 | + cameraField.setFloat(0.001); |
---|
| 2424 | + specularField.setFloat(0.001); |
---|
| 2425 | + fakedepthField.setFloat(0.001); |
---|
| 2426 | + opacityField.setFloat(0.6); |
---|
| 2427 | + |
---|
| 2428 | + materialtouched = true; |
---|
| 2429 | + applySelf(); |
---|
| 2430 | + } |
---|
| 2431 | + }); |
---|
| 2432 | + presetpanel.add(shadowShader); |
---|
| 2433 | + |
---|
| 2434 | + cGridBag panel = new cGridBag().setVertical(true); |
---|
| 2435 | + |
---|
| 2436 | + presetpanel.preferredWidth = 1; |
---|
| 2437 | + |
---|
| 2438 | + materialpanel.add(presetpanel); |
---|
| 2439 | + materialpanel.add(panel); |
---|
| 2440 | + |
---|
| 2441 | + panel.preferredWidth = 8; |
---|
| 2442 | + |
---|
| 2443 | + /* |
---|
1704 | 2444 | ctrlPanel.add(materialLabel = new JLabel("MATERIAL : "), aConstraints); |
---|
1705 | 2445 | materialLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1706 | | - */ |
---|
| 2446 | + */ |
---|
1707 | 2447 | |
---|
1708 | 2448 | cGridBag editBar = new cGridBag().setVertical(false); |
---|
1709 | 2449 | |
---|
1710 | | - editBar.add(createMaterialButton = new cButton("Create", !Grafreed.NIMBUSLAF)); // , aConstraints); |
---|
| 2450 | + editBar.add(createMaterialButton = new cButton("Create", !Globals.NIMBUSLAF)); // , aConstraints); |
---|
1711 | 2451 | createMaterialButton.setToolTipText("Create material"); |
---|
1712 | 2452 | |
---|
1713 | 2453 | /* |
---|
1714 | 2454 | ctrlPanel.add(resetSlidersButton = new cButton("Reset All"), aConstraints); |
---|
1715 | 2455 | */ |
---|
1716 | 2456 | |
---|
1717 | | - editBar.add(clearMaterialButton = new cButton("Clear", !Grafreed.NIMBUSLAF)); // , aConstraints); |
---|
| 2457 | + editBar.add(clearMaterialButton = new cButton("Clear", !Globals.NIMBUSLAF)); // , aConstraints); |
---|
1718 | 2458 | clearMaterialButton.setToolTipText("Clear material"); |
---|
1719 | 2459 | |
---|
1720 | 2460 | if (Globals.ADVANCED) |
---|
1721 | 2461 | { |
---|
1722 | | - editBar.add(resetSlidersButton = new cButton("Reset", !Grafreed.NIMBUSLAF)); // , aConstraints); |
---|
| 2462 | + editBar.add(resetSlidersButton = new cButton("Reset", !Globals.NIMBUSLAF)); // , aConstraints); |
---|
1723 | 2463 | editBar.add(propagateToggle = new cCheckBox("Prop", propagate)); // , aConstraints); |
---|
1724 | 2464 | editBar.add(multiplyToggle = new cCheckBox("Mult", false)); // , aConstraints); |
---|
1725 | 2465 | } |
---|
.. | .. |
---|
1737 | 2477 | //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints); |
---|
1738 | 2478 | |
---|
1739 | 2479 | cGridBag colorSection = new cGridBag().setVertical(true); |
---|
| 2480 | + |
---|
| 2481 | + cGridBag huepanel = new cGridBag(); |
---|
| 2482 | + cGridBag huelabel = new cGridBag(); |
---|
| 2483 | + cLabel hue = GetLabel("icons/hue.png", false); |
---|
| 2484 | + hue.fit = true; |
---|
| 2485 | + |
---|
| 2486 | + hue.addMouseListener(new MouseAdapter() |
---|
| 2487 | + { |
---|
| 2488 | + public void mousePressed(MouseEvent e) |
---|
| 2489 | + { |
---|
| 2490 | + int x = e.getX(); |
---|
| 2491 | + |
---|
| 2492 | + colorField.setFloat((double)x / ((cLabel)e.getSource()).getWidth()); |
---|
| 2493 | + } |
---|
| 2494 | + }); |
---|
| 2495 | + |
---|
| 2496 | + huelabel.add(hue); |
---|
| 2497 | + huelabel.preferredWidth = 20; |
---|
| 2498 | + huepanel.add(new cGridBag()); // Label |
---|
| 2499 | + huepanel.add(huelabel); // Field/slider |
---|
| 2500 | + |
---|
| 2501 | + huepanel.preferredHeight = 7; |
---|
| 2502 | + |
---|
| 2503 | + colorSection.add(huepanel); |
---|
1740 | 2504 | |
---|
1741 | 2505 | 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); |
---|
| 2506 | + |
---|
| 2507 | + color.add(colorLabel = new JLabel("Color/hue")); // , aConstraints); |
---|
| 2508 | + colorLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 2509 | + color.add(colorField = new cNumberSlider(this, 0.001, 1)); // , aConstraints); |
---|
| 2510 | + |
---|
1745 | 2511 | //colorField.preferredWidth = 200; |
---|
1746 | 2512 | colorSection.add(color); |
---|
1747 | 2513 | |
---|
1748 | 2514 | cGridBag modulation = new cGridBag(); |
---|
1749 | 2515 | modulation.add(modulationLabel = new JLabel("Saturation")); // , aConstraints); |
---|
1750 | 2516 | modulationLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1751 | | - modulation.add(modulationField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
| 2517 | + modulation.add(saturationField = new cNumberSlider(this, 0.001, 1)); // , aConstraints); |
---|
1752 | 2518 | colorSection.add(modulation); |
---|
1753 | 2519 | |
---|
| 2520 | + cGridBag opacity = new cGridBag(); |
---|
| 2521 | + opacity.add(opacityLabel = new JLabel("Opacity")); // , aConstraints); |
---|
| 2522 | + opacityLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 2523 | + opacity.add(opacityField = new cNumberSlider(this, 0.001, 1)); // , aConstraints); |
---|
| 2524 | + colorSection.add(opacity); |
---|
| 2525 | + |
---|
| 2526 | + colorSection.add(GetSeparator()); |
---|
| 2527 | + |
---|
1754 | 2528 | cGridBag texture = new cGridBag(); |
---|
1755 | 2529 | texture.add(textureLabel = new JLabel("Texture")); // , aConstraints); |
---|
1756 | 2530 | textureLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1757 | 2531 | texture.add(textureField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
1758 | 2532 | colorSection.add(texture); |
---|
1759 | 2533 | |
---|
1760 | | - panel.add(new JSeparator()); |
---|
| 2534 | + panel.add(GetSeparator()); |
---|
1761 | 2535 | |
---|
1762 | 2536 | panel.add(colorSection); |
---|
1763 | 2537 | |
---|
.. | .. |
---|
1813 | 2587 | shadowbias.add(shadowbiasField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
1814 | 2588 | diffuseSection.add(shadowbias); |
---|
1815 | 2589 | |
---|
1816 | | - panel.add(new JSeparator()); |
---|
| 2590 | + panel.add(GetSeparator()); |
---|
1817 | 2591 | |
---|
1818 | 2592 | panel.add(diffuseSection); |
---|
1819 | 2593 | |
---|
.. | .. |
---|
1876 | 2650 | specularSection.add(anisoV); |
---|
1877 | 2651 | |
---|
1878 | 2652 | |
---|
1879 | | - panel.add(new JSeparator()); |
---|
| 2653 | + panel.add(GetSeparator()); |
---|
1880 | 2654 | |
---|
1881 | 2655 | panel.add(specularSection); |
---|
1882 | 2656 | |
---|
.. | .. |
---|
1901 | 2675 | backlitLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1902 | 2676 | backlit.add(backlitField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
1903 | 2677 | 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 | 2678 | |
---|
1911 | 2679 | //panel.add(new JSeparator()); |
---|
1912 | 2680 | |
---|
.. | .. |
---|
1952 | 2720 | opacityPower.add(opacityPowerField = new cNumberSlider(this, 0.0, 10 /*10 dec 2013*/)); // , aConstraints); |
---|
1953 | 2721 | textureSection.add(opacityPower); |
---|
1954 | 2722 | |
---|
1955 | | - panel.add(new JSeparator()); |
---|
| 2723 | + panel.add(GetSeparator()); |
---|
1956 | 2724 | |
---|
1957 | 2725 | panel.add(textureSection); |
---|
1958 | 2726 | |
---|
.. | .. |
---|
2939 | 3707 | |
---|
2940 | 3708 | freezematerial = true; |
---|
2941 | 3709 | colorField.setFloat(mat.color); |
---|
2942 | | - modulationField.setFloat(mat.modulation); |
---|
| 3710 | + saturationField.setFloat(mat.modulation); |
---|
2943 | 3711 | metalnessField.setFloat(mat.metalness); |
---|
2944 | 3712 | diffuseField.setFloat(mat.diffuse); |
---|
2945 | 3713 | specularField.setFloat(mat.specular); |
---|
.. | .. |
---|
3001 | 3769 | |
---|
3002 | 3770 | if (multiplyToggle != null) |
---|
3003 | 3771 | 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 | | - } |
---|
| 3772 | + |
---|
| 3773 | + AllocProjectedVertices(object); |
---|
3030 | 3774 | |
---|
3031 | 3775 | SetMaterial(mat, object.projectedVertices); |
---|
3032 | 3776 | } |
---|
.. | .. |
---|
3146 | 3890 | public void itemStateChanged(ItemEvent event) |
---|
3147 | 3891 | { |
---|
3148 | 3892 | // System.out.println("Propagate = " + propagate); |
---|
| 3893 | + if (event.getSource() == pinButton) |
---|
| 3894 | + { |
---|
| 3895 | + copy.pinned ^= true; |
---|
| 3896 | + if (!copy.pinned && !copy.editWindow.copy.selection.contains(copy)) |
---|
| 3897 | + { |
---|
| 3898 | + ((GroupEditor)copy.editWindow).listUI.remove(copy); |
---|
| 3899 | + copy.CloseUI(); |
---|
| 3900 | + //copy.editWindow.refreshContents(); |
---|
| 3901 | + } |
---|
| 3902 | + } |
---|
| 3903 | + else |
---|
3149 | 3904 | if (event.getSource() == propagateToggle) |
---|
3150 | 3905 | { |
---|
3151 | 3906 | propagate ^= true; |
---|
.. | .. |
---|
3250 | 4005 | } else if (event.getSource() == liveCB) |
---|
3251 | 4006 | { |
---|
3252 | 4007 | copy.live ^= true; |
---|
| 4008 | + objEditor.refreshContents(true); // To show item colors |
---|
3253 | 4009 | return; |
---|
3254 | 4010 | } else if (event.getSource() == selectableCB) |
---|
3255 | 4011 | { |
---|
.. | .. |
---|
3259 | 4015 | { |
---|
3260 | 4016 | copy.hide ^= true; |
---|
3261 | 4017 | copy.Touch(); // display list issue |
---|
3262 | | - objEditor.refreshContents(); |
---|
| 4018 | + objEditor.refreshContents(true); // To show item colors |
---|
3263 | 4019 | return; |
---|
3264 | 4020 | } else if (event.getSource() == link2masterCB) |
---|
3265 | 4021 | { |
---|
.. | .. |
---|
3324 | 4080 | //System.out.println("ObjEditor " + event); |
---|
3325 | 4081 | applySelf0(true); |
---|
3326 | 4082 | //parent.applySelf(); |
---|
3327 | | - objEditor.refreshContents(); |
---|
| 4083 | + // conflicts with requestFocus objEditor.refreshContents(); |
---|
3328 | 4084 | } else if (source == resetButton) |
---|
3329 | 4085 | { |
---|
3330 | 4086 | CameraPane.fullreset = true; |
---|
.. | .. |
---|
3504 | 4260 | |
---|
3505 | 4261 | void New() |
---|
3506 | 4262 | { |
---|
3507 | | - while (copy.Size() > 1) |
---|
| 4263 | + while (copy.Size() > 0) |
---|
3508 | 4264 | { |
---|
3509 | | - copy.remove(1); |
---|
| 4265 | + copy.remove(0); |
---|
3510 | 4266 | } |
---|
3511 | 4267 | |
---|
| 4268 | + copy.selection.clear(); |
---|
| 4269 | + |
---|
| 4270 | + if (copy == Grafreed.grafreed.universe) |
---|
| 4271 | + { |
---|
| 4272 | + CreateCameras(); |
---|
| 4273 | + cameraView.SetCamera(GetCamera(copy, 0)); |
---|
| 4274 | + } |
---|
3512 | 4275 | ResetModel(); |
---|
3513 | 4276 | objEditor.refreshContents(); |
---|
3514 | 4277 | } |
---|
3515 | 4278 | |
---|
3516 | 4279 | static public byte[] Compress(Object3D o) |
---|
3517 | 4280 | { |
---|
| 4281 | + // Slower to actually compress. |
---|
3518 | 4282 | try |
---|
3519 | 4283 | { |
---|
3520 | 4284 | ByteArrayOutputStream baos = new ByteArrayOutputStream(); |
---|
.. | .. |
---|
3616 | 4380 | { |
---|
3617 | 4381 | //Save(true); |
---|
3618 | 4382 | Replace(); |
---|
| 4383 | + SetVersionStates(); |
---|
3619 | 4384 | } |
---|
3620 | 4385 | |
---|
3621 | 4386 | private boolean Equal(byte[] compress, byte[] name) |
---|
.. | .. |
---|
3634 | 4399 | return true; |
---|
3635 | 4400 | } |
---|
3636 | 4401 | |
---|
3637 | | - java.util.Hashtable<java.util.UUID, Object3D> versiontable = new java.util.Hashtable<java.util.UUID, Object3D>(); |
---|
| 4402 | + void DeleteVersion() |
---|
| 4403 | + { |
---|
| 4404 | + for (int i = copy.versionindex; i < copy.versionlist.length-1; i++) |
---|
| 4405 | + { |
---|
| 4406 | + copy.versionlist[i] = copy.versionlist[i+1]; |
---|
| 4407 | + } |
---|
| 4408 | + |
---|
| 4409 | + if (copy.versionlist[copy.versionindex] == null) |
---|
| 4410 | + copy.versionindex -= 1; |
---|
| 4411 | + |
---|
| 4412 | + if (copy.versionindex != -1) |
---|
| 4413 | + CopyChanged(); |
---|
| 4414 | + |
---|
| 4415 | + SetVersionStates(); |
---|
| 4416 | + } |
---|
3638 | 4417 | |
---|
3639 | 4418 | public boolean Save(boolean user) |
---|
3640 | 4419 | { |
---|
3641 | 4420 | System.err.println("Save"); |
---|
| 4421 | + Replace(); |
---|
3642 | 4422 | |
---|
3643 | | - cRadio tab = GetCurrentTab(); |
---|
| 4423 | + //cRadio tab = GetCurrentTab(); |
---|
3644 | 4424 | |
---|
3645 | | - byte[] compress = CompressCopy(); |
---|
| 4425 | + Object3D compress = Duplicate(copy); // Saved version. No need for "Replace"? |
---|
3646 | 4426 | |
---|
3647 | 4427 | boolean thesame = false; |
---|
3648 | 4428 | |
---|
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 | | - } |
---|
| 4429 | +// if (copy.versionindex > 0 && copy.versions[copy.versionindex-1] != null && Equal(compress, copy.versions[copy.versionindex-1])) |
---|
| 4430 | +// { |
---|
| 4431 | +// thesame = true; |
---|
| 4432 | +// } |
---|
3654 | 4433 | |
---|
3655 | 4434 | //EditorFrame.m_MainFrame.requestFocusInWindow(); |
---|
3656 | 4435 | if (!thesame) |
---|
3657 | 4436 | { |
---|
| 4437 | + for (int i = copy.versionlist.length; --i > copy.versionindex+1;) |
---|
| 4438 | + { |
---|
| 4439 | + copy.versionlist[i] = copy.versionlist[i-1]; |
---|
| 4440 | + } |
---|
| 4441 | + |
---|
3658 | 4442 | //tab.user[tab.versionindex] = user; |
---|
3659 | 4443 | //boolean increment = true; // tab.graphs[tab.versionindex] == null; |
---|
3660 | 4444 | |
---|
3661 | | - copy.versions[++copy.versionindex] = compress; |
---|
| 4445 | + copy.versionlist[++copy.versionindex] = compress; |
---|
3662 | 4446 | |
---|
3663 | 4447 | // if (increment) |
---|
3664 | 4448 | // tab.versionindex++; |
---|
.. | .. |
---|
3668 | 4452 | |
---|
3669 | 4453 | //assert(hashtable.isEmpty()); |
---|
3670 | 4454 | |
---|
3671 | | - for (int i = copy.versionindex+1; i < copy.versions.length; i++) |
---|
3672 | | - { |
---|
3673 | | - //tab.user[i] = false; |
---|
3674 | | - copy.versions[i] = null; |
---|
3675 | | - } |
---|
| 4455 | +// for (int i = copy.versionindex+1; i < copy.versionlist.length; i++) |
---|
| 4456 | +// { |
---|
| 4457 | +// //tab.user[i] = false; |
---|
| 4458 | +// copy.versionlist[i] = null; |
---|
| 4459 | +// } |
---|
3676 | 4460 | |
---|
3677 | | - SetUndoStates(); |
---|
| 4461 | + SetVersionStates(); |
---|
3678 | 4462 | |
---|
3679 | 4463 | // test save |
---|
3680 | 4464 | if (false) |
---|
.. | .. |
---|
3697 | 4481 | |
---|
3698 | 4482 | return !thesame; |
---|
3699 | 4483 | } |
---|
3700 | | - |
---|
3701 | | - void CopyChanged(Object3D obj) |
---|
| 4484 | + |
---|
| 4485 | + boolean flashIt = true; |
---|
| 4486 | + |
---|
| 4487 | + void RefreshSelection() |
---|
3702 | 4488 | { |
---|
3703 | | - SetUndoStates(); |
---|
| 4489 | + Object3D selection = new Object3D(); |
---|
| 4490 | + |
---|
| 4491 | + for (int i = 0; i < copy.selection.size(); i++) |
---|
| 4492 | + { |
---|
| 4493 | + Object3D elem = copy.selection.elementAt(i); |
---|
| 4494 | + |
---|
| 4495 | + Object3D obj = copy.GetObject(elem.GetUUID()); |
---|
| 4496 | + |
---|
| 4497 | + if (obj == null) |
---|
| 4498 | + { |
---|
| 4499 | + copy.selection.remove(i--); |
---|
| 4500 | + } |
---|
| 4501 | + else |
---|
| 4502 | + { |
---|
| 4503 | + selection.add(obj); |
---|
| 4504 | + copy.selection.setElementAt(obj, i); |
---|
| 4505 | + } |
---|
| 4506 | + } |
---|
| 4507 | + |
---|
| 4508 | + flashIt = false; |
---|
| 4509 | + GetTree().clearSelection(); |
---|
| 4510 | + for (int i = 0; i < selection.size(); i++) |
---|
| 4511 | + GetTree().addSelectionPath(selection.elementAt(i).GetTreePath().GetTreePath()); |
---|
| 4512 | + flashIt = true; |
---|
| 4513 | + |
---|
| 4514 | + //refreshContents(false); |
---|
| 4515 | + } |
---|
| 4516 | + |
---|
| 4517 | + void CopyChanged() |
---|
| 4518 | + { |
---|
| 4519 | + Object3D obj = (Object3D)Grafreed.clone(copy.versionlist[copy.versionindex]); |
---|
| 4520 | + |
---|
| 4521 | + SetVersionStates(); |
---|
3704 | 4522 | |
---|
3705 | 4523 | boolean temp = CameraPane.SWITCH; |
---|
3706 | 4524 | CameraPane.SWITCH = false; |
---|
3707 | 4525 | |
---|
3708 | | - copy.ExtractBigData(versiontable); |
---|
| 4526 | + copy.ExtractBigData(Grafreed.grafreed.universe.versiontable); |
---|
3709 | 4527 | |
---|
3710 | 4528 | copy.clear(); |
---|
3711 | 4529 | |
---|
| 4530 | + copy.skyboxname = obj.skyboxname; |
---|
| 4531 | + copy.skyboxext = obj.skyboxext; |
---|
| 4532 | + |
---|
3712 | 4533 | for (int i=0; i<obj.Size(); i++) |
---|
3713 | 4534 | { |
---|
3714 | 4535 | copy.add(obj.get(i)); |
---|
3715 | 4536 | } |
---|
3716 | 4537 | |
---|
3717 | | - copy.RestoreBigData(versiontable); |
---|
| 4538 | + copy.RestoreBigData(Grafreed.grafreed.universe.versiontable); |
---|
3718 | 4539 | |
---|
3719 | 4540 | CameraPane.SWITCH = temp; |
---|
3720 | 4541 | |
---|
| 4542 | + RefreshSelection(); |
---|
3721 | 4543 | //assert(hashtable.isEmpty()); |
---|
3722 | 4544 | |
---|
3723 | 4545 | copy.Touch(); |
---|
.. | .. |
---|
3738 | 4560 | } |
---|
3739 | 4561 | } |
---|
3740 | 4562 | |
---|
3741 | | - refreshContents(); |
---|
| 4563 | + refreshContents(true); |
---|
3742 | 4564 | } |
---|
3743 | 4565 | |
---|
3744 | | - cButton undoButton; |
---|
| 4566 | + cButton previousVersionButton; |
---|
3745 | 4567 | cButton restoreButton; |
---|
3746 | 4568 | cButton replaceButton; |
---|
3747 | | - cButton redoButton; |
---|
| 4569 | + cButton nextVersionButton; |
---|
| 4570 | + cButton saveVersionButton; |
---|
| 4571 | + cButton deleteVersionButton; |
---|
3748 | 4572 | |
---|
3749 | 4573 | boolean muteSlider; |
---|
3750 | 4574 | |
---|
.. | .. |
---|
3752 | 4576 | { |
---|
3753 | 4577 | int count = 0; |
---|
3754 | 4578 | |
---|
3755 | | - for (int i = copy.versions.length; --i >= 0;) |
---|
| 4579 | + for (int i = copy.versionlist.length; --i >= 0;) |
---|
3756 | 4580 | { |
---|
3757 | | - if (copy.versions[i] != null) |
---|
| 4581 | + if (copy.versionlist[i] != null) |
---|
3758 | 4582 | count++; |
---|
3759 | 4583 | } |
---|
3760 | 4584 | |
---|
3761 | 4585 | return count; |
---|
3762 | 4586 | } |
---|
3763 | 4587 | |
---|
3764 | | - void SetUndoStates() |
---|
| 4588 | + public cGridBag versionSliderPane; |
---|
| 4589 | + |
---|
| 4590 | + void SetVersionStates() |
---|
3765 | 4591 | { |
---|
3766 | | - cRadio tab = GetCurrentTab(); |
---|
| 4592 | + //if (true) |
---|
| 4593 | + // return; |
---|
| 4594 | + |
---|
| 4595 | + //cRadio tab = GetCurrentTab(); |
---|
3767 | 4596 | |
---|
3768 | | - restoreButton.setEnabled(copy.versionindex != -1); |
---|
3769 | | - replaceButton.setEnabled(copy.versionindex != -1); |
---|
3770 | | - |
---|
3771 | | - undoButton.setEnabled(copy.versionindex > 0); |
---|
3772 | | - redoButton.setEnabled(copy.versions[copy.versionindex + 1] != null); |
---|
3773 | | - |
---|
3774 | | - muteSlider = true; |
---|
3775 | | - versionSlider.setMaximum(VersionCount() - 1); |
---|
3776 | | - versionSlider.setInteger(copy.versionindex); |
---|
3777 | | - muteSlider = false; |
---|
| 4597 | + if (copy.versionlist == null) |
---|
| 4598 | + { |
---|
| 4599 | + saveVersionButton.setEnabled(false); |
---|
| 4600 | + restoreButton.setEnabled(false); |
---|
| 4601 | + replaceButton.setEnabled(false); |
---|
| 4602 | + previousVersionButton.setEnabled(false); |
---|
| 4603 | + nextVersionButton.setEnabled(false); |
---|
| 4604 | + deleteVersionButton.setEnabled(false); |
---|
| 4605 | + versionSliderPane.setVisible(false); |
---|
| 4606 | + } |
---|
| 4607 | + else |
---|
| 4608 | + { |
---|
| 4609 | + restoreButton.setEnabled(copy.versionindex != -1); |
---|
| 4610 | + replaceButton.setEnabled(copy.versionindex != -1); |
---|
| 4611 | + |
---|
| 4612 | + previousVersionButton.setEnabled(copy.versionindex > 0); |
---|
| 4613 | + nextVersionButton.setEnabled(copy.versionlist[copy.versionindex + 1] != null); |
---|
| 4614 | + |
---|
| 4615 | + deleteVersionButton.setEnabled(copy.versionindex != -1); |
---|
| 4616 | + //copy.versionlist[copy.versionindex + 1] != null); |
---|
| 4617 | + |
---|
| 4618 | + muteSlider = true; |
---|
| 4619 | + versionSlider.setMinimum(0); |
---|
| 4620 | + versionSlider.setMaximum(VersionCount() - 1); |
---|
| 4621 | + versionSlider.setInteger(copy.versionindex); |
---|
| 4622 | + versionSlider.setEnabled(copy.versionindex != -1); |
---|
| 4623 | + muteSlider = false; |
---|
| 4624 | + |
---|
| 4625 | + versionSliderPane.setVisible(true); |
---|
| 4626 | + } |
---|
3778 | 4627 | } |
---|
3779 | 4628 | |
---|
3780 | | - public boolean Undo() |
---|
| 4629 | + public boolean PreviousVersion() |
---|
3781 | 4630 | { |
---|
3782 | 4631 | // Option? |
---|
3783 | 4632 | Replace(); |
---|
3784 | 4633 | |
---|
3785 | 4634 | System.err.println("Undo"); |
---|
3786 | 4635 | |
---|
3787 | | - cRadio tab = GetCurrentTab(); |
---|
| 4636 | + //cRadio tab = GetCurrentTab(); |
---|
3788 | 4637 | |
---|
3789 | 4638 | if (copy.versionindex == 0) |
---|
3790 | 4639 | { |
---|
.. | .. |
---|
3807 | 4656 | |
---|
3808 | 4657 | copy.versionindex -= 1; |
---|
3809 | 4658 | |
---|
3810 | | - CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex])); |
---|
| 4659 | + CopyChanged(); |
---|
3811 | 4660 | |
---|
3812 | 4661 | return true; |
---|
3813 | 4662 | } |
---|
.. | .. |
---|
3816 | 4665 | { |
---|
3817 | 4666 | System.err.println("Restore"); |
---|
3818 | 4667 | |
---|
3819 | | - cRadio tab = GetCurrentTab(); |
---|
| 4668 | + //cRadio tab = GetCurrentTab(); |
---|
3820 | 4669 | |
---|
3821 | | - if (copy.versionindex == -1 || copy.versions[copy.versionindex] == null) |
---|
| 4670 | + if (copy.versionindex == -1 || copy.versionlist[copy.versionindex] == null) |
---|
3822 | 4671 | { |
---|
3823 | 4672 | java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
3824 | 4673 | return false; |
---|
3825 | 4674 | } |
---|
3826 | 4675 | |
---|
3827 | | - CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex])); |
---|
| 4676 | + //CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex])); |
---|
| 4677 | + CopyChanged(); |
---|
3828 | 4678 | |
---|
3829 | 4679 | return true; |
---|
3830 | 4680 | } |
---|
3831 | 4681 | |
---|
3832 | 4682 | public boolean Replace() |
---|
3833 | 4683 | { |
---|
3834 | | - System.err.println("Replace"); |
---|
| 4684 | + //System.err.println("Replace"); |
---|
3835 | 4685 | |
---|
3836 | | - cRadio tab = GetCurrentTab(); |
---|
| 4686 | + //cRadio tab = GetCurrentTab(); |
---|
3837 | 4687 | |
---|
3838 | | - if (copy.versionindex == -1 || copy.versions[copy.versionindex] == null) |
---|
| 4688 | + if (copy.versionindex == -1 || copy.versionlist[copy.versionindex] == null) |
---|
3839 | 4689 | { |
---|
3840 | 4690 | // No version yet. OK. java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
3841 | 4691 | return false; |
---|
3842 | 4692 | } |
---|
3843 | 4693 | |
---|
3844 | | - copy.versions[copy.versionindex] = CompressCopy(); |
---|
| 4694 | + copy.versionlist[copy.versionindex] = Duplicate(copy); |
---|
3845 | 4695 | |
---|
3846 | 4696 | return true; |
---|
3847 | 4697 | } |
---|
3848 | 4698 | |
---|
3849 | | - public void Redo() |
---|
| 4699 | + public void NextVersion() |
---|
3850 | 4700 | { |
---|
3851 | 4701 | // Option? |
---|
3852 | 4702 | Replace(); |
---|
3853 | 4703 | |
---|
3854 | | - cRadio tab = GetCurrentTab(); |
---|
| 4704 | + //cRadio tab = GetCurrentTab(); |
---|
3855 | 4705 | |
---|
3856 | | - if (copy.versions[copy.versionindex + 1] == null) |
---|
| 4706 | + if (copy.versionlist[copy.versionindex + 1] == null) |
---|
3857 | 4707 | { |
---|
3858 | 4708 | java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
3859 | 4709 | return; |
---|
.. | .. |
---|
3861 | 4711 | |
---|
3862 | 4712 | copy.versionindex += 1; |
---|
3863 | 4713 | |
---|
3864 | | - CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex])); |
---|
| 4714 | + CopyChanged(); |
---|
3865 | 4715 | |
---|
3866 | 4716 | //if (!tab.user[tab.versionindex]) |
---|
3867 | 4717 | // tab.graphs[tab.versionindex] = null; |
---|
.. | .. |
---|
4058 | 4908 | // else |
---|
4059 | 4909 | // applySelf(true); |
---|
4060 | 4910 | // } |
---|
| 4911 | + |
---|
| 4912 | + boolean Equal(double a, double b) |
---|
| 4913 | + { |
---|
| 4914 | + return Math.abs(a - b) < 0.001; |
---|
| 4915 | + } |
---|
| 4916 | + |
---|
4061 | 4917 | void applySelf0(boolean name) |
---|
4062 | 4918 | { |
---|
4063 | 4919 | if (name) |
---|
.. | .. |
---|
4075 | 4931 | //copy.material = new cMaterial(copy.GetMaterial()); |
---|
4076 | 4932 | |
---|
4077 | 4933 | current.color = (float) colorField.getFloat(); |
---|
4078 | | - current.modulation = (float) modulationField.getFloat(); |
---|
| 4934 | + current.modulation = (float) saturationField.getFloat(); |
---|
4079 | 4935 | current.metalness = (float) metalnessField.getFloat(); |
---|
4080 | 4936 | current.diffuse = (float) diffuseField.getFloat(); |
---|
4081 | 4937 | current.specular = (float) specularField.getFloat(); |
---|
.. | .. |
---|
4107 | 4963 | { |
---|
4108 | 4964 | cMaterial mat = copy.material; |
---|
4109 | 4965 | |
---|
4110 | | - colorField.SetToolTipValue((mat.color)); |
---|
4111 | | - modulationField.SetToolTipValue((mat.modulation)); |
---|
4112 | | - metalnessField.SetToolTipValue((mat.metalness)); |
---|
4113 | | - diffuseField.SetToolTipValue((mat.diffuse)); |
---|
4114 | | - specularField.SetToolTipValue((mat.specular)); |
---|
4115 | | - shininessField.SetToolTipValue((mat.shininess)); |
---|
4116 | | - shiftField.SetToolTipValue((mat.shift)); |
---|
4117 | | - ambientField.SetToolTipValue((mat.ambient)); |
---|
4118 | | - lightareaField.SetToolTipValue((mat.lightarea)); |
---|
4119 | | - diffusenessField.SetToolTipValue((mat.factor)); |
---|
4120 | | - velvetField.SetToolTipValue((mat.velvet)); |
---|
4121 | | - sheenField.SetToolTipValue((mat.sheen)); |
---|
4122 | | - subsurfaceField.SetToolTipValue((mat.subsurface)); |
---|
4123 | | - backlitField.SetToolTipValue((mat.bump)); |
---|
4124 | | - anisoField.SetToolTipValue((mat.aniso)); |
---|
4125 | | - anisoVField.SetToolTipValue((mat.anisoV)); |
---|
4126 | | - cameraField.SetToolTipValue((mat.cameralight)); |
---|
4127 | | - selfshadowField.SetToolTipValue((mat.diffuseness)); |
---|
4128 | | - shadowField.SetToolTipValue((mat.shadow)); |
---|
4129 | | - textureField.SetToolTipValue((mat.texture)); |
---|
4130 | | - opacityField.SetToolTipValue((mat.opacity)); |
---|
4131 | | - fakedepthField.SetToolTipValue((mat.fakedepth)); |
---|
4132 | | - shadowbiasField.SetToolTipValue((mat.shadowbias)); |
---|
| 4966 | + if (!Equal(colorField.getFloat(), mat.color)) |
---|
| 4967 | + colorField.SetToolTipValue((mat.color)); |
---|
| 4968 | + if (!Equal(saturationField.getFloat(), mat.modulation)) |
---|
| 4969 | + saturationField.SetToolTipValue((mat.modulation)); |
---|
| 4970 | + if (!Equal(metalnessField.getFloat(), mat.metalness)) |
---|
| 4971 | + metalnessField.SetToolTipValue((mat.metalness)); |
---|
| 4972 | + if (!Equal(diffuseField.getFloat(), mat.diffuse)) |
---|
| 4973 | + diffuseField.SetToolTipValue((mat.diffuse)); |
---|
| 4974 | + if (!Equal(specularField.getFloat(), mat.specular)) |
---|
| 4975 | + specularField.SetToolTipValue((mat.specular)); |
---|
| 4976 | + if (!Equal(shininessField.getFloat(), mat.shininess)) |
---|
| 4977 | + shininessField.SetToolTipValue((mat.shininess)); |
---|
| 4978 | + if (!Equal(shiftField.getFloat(), mat.shift)) |
---|
| 4979 | + shiftField.SetToolTipValue((mat.shift)); |
---|
| 4980 | + if (!Equal(ambientField.getFloat(), mat.ambient)) |
---|
| 4981 | + ambientField.SetToolTipValue((mat.ambient)); |
---|
| 4982 | + if (!Equal(lightareaField.getFloat(), mat.lightarea)) |
---|
| 4983 | + lightareaField.SetToolTipValue((mat.lightarea)); |
---|
| 4984 | + if (!Equal(diffusenessField.getFloat(), mat.factor)) |
---|
| 4985 | + diffusenessField.SetToolTipValue((mat.factor)); |
---|
| 4986 | + if (!Equal(velvetField.getFloat(), mat.velvet)) |
---|
| 4987 | + velvetField.SetToolTipValue((mat.velvet)); |
---|
| 4988 | + if (!Equal(sheenField.getFloat(), mat.sheen)) |
---|
| 4989 | + sheenField.SetToolTipValue((mat.sheen)); |
---|
| 4990 | + if (!Equal(subsurfaceField.getFloat(), mat.subsurface)) |
---|
| 4991 | + subsurfaceField.SetToolTipValue((mat.subsurface)); |
---|
| 4992 | + if (!Equal(backlitField.getFloat(), mat.bump)) |
---|
| 4993 | + backlitField.SetToolTipValue((mat.bump)); |
---|
| 4994 | + if (!Equal(anisoField.getFloat(), mat.aniso)) |
---|
| 4995 | + anisoField.SetToolTipValue((mat.aniso)); |
---|
| 4996 | + if (!Equal(anisoVField.getFloat(), mat.anisoV)) |
---|
| 4997 | + anisoVField.SetToolTipValue((mat.anisoV)); |
---|
| 4998 | + if (!Equal(cameraField.getFloat(), mat.cameralight)) |
---|
| 4999 | + cameraField.SetToolTipValue((mat.cameralight)); |
---|
| 5000 | + if (!Equal(selfshadowField.getFloat(), mat.diffuseness)) |
---|
| 5001 | + selfshadowField.SetToolTipValue((mat.diffuseness)); |
---|
| 5002 | + if (!Equal(shadowField.getFloat(), mat.shadow)) |
---|
| 5003 | + shadowField.SetToolTipValue((mat.shadow)); |
---|
| 5004 | + if (!Equal(textureField.getFloat(), mat.texture)) |
---|
| 5005 | + textureField.SetToolTipValue((mat.texture)); |
---|
| 5006 | + if (!Equal(opacityField.getFloat(), mat.opacity)) |
---|
| 5007 | + opacityField.SetToolTipValue((mat.opacity)); |
---|
| 5008 | + if (!Equal(fakedepthField.getFloat(), mat.fakedepth)) |
---|
| 5009 | + fakedepthField.SetToolTipValue((mat.fakedepth)); |
---|
| 5010 | + if (!Equal(shadowbiasField.getFloat(), mat.shadowbias)) |
---|
| 5011 | + shadowbiasField.SetToolTipValue((mat.shadowbias)); |
---|
4133 | 5012 | } |
---|
4134 | 5013 | |
---|
4135 | 5014 | if (copy.material != null && copy.projectedVertices.length > 0 && copy.projectedVertices[0] != null) |
---|
.. | .. |
---|
4164 | 5043 | |
---|
4165 | 5044 | public void stateChanged(ChangeEvent e) |
---|
4166 | 5045 | { |
---|
4167 | | - // assert(false); |
---|
| 5046 | + // assert(false); |
---|
4168 | 5047 | if (e.getSource() == versionSlider) |
---|
4169 | 5048 | { |
---|
4170 | 5049 | if (muteSlider) |
---|
4171 | 5050 | return; |
---|
4172 | 5051 | |
---|
| 5052 | + Replace(); |
---|
| 5053 | + |
---|
4173 | 5054 | int version = versionSlider.getInteger(); |
---|
4174 | 5055 | |
---|
4175 | | - if (copy.versions[version] != null) |
---|
| 5056 | + if (version != -1 && copy.versionlist[version] != null) |
---|
4176 | 5057 | { |
---|
4177 | | - CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex = version])); |
---|
| 5058 | + copy.versionindex = version; |
---|
| 5059 | + CopyChanged(); |
---|
4178 | 5060 | } |
---|
4179 | 5061 | |
---|
4180 | 5062 | return; |
---|
.. | .. |
---|
4214 | 5096 | { |
---|
4215 | 5097 | //System.out.println("stateChanged = " + this); |
---|
4216 | 5098 | materialtouched = true; |
---|
| 5099 | + |
---|
| 5100 | + if (Globals.AUTOSATURATE && e.getSource() == colorField && saturationField.getFloat() == 0.001) |
---|
| 5101 | + { |
---|
| 5102 | + saturationField.setFloat(1); |
---|
| 5103 | + } |
---|
| 5104 | + |
---|
4217 | 5105 | applySelf(); |
---|
4218 | 5106 | //System.out.println("this = " + this); |
---|
4219 | 5107 | //System.out.println("PARENT = " + parent); |
---|
.. | .. |
---|
4513 | 5401 | { |
---|
4514 | 5402 | if (GetTree() != null) |
---|
4515 | 5403 | { |
---|
| 5404 | + GetTree().revalidate(); |
---|
4516 | 5405 | GetTree().repaint(); |
---|
4517 | 5406 | } |
---|
4518 | 5407 | |
---|
.. | .. |
---|
4521 | 5410 | ctrlPanel.validate(); // ? new |
---|
4522 | 5411 | ctrlPanel.repaint(); |
---|
4523 | 5412 | } |
---|
| 5413 | + |
---|
| 5414 | + if (previousVersionButton != null && copy.versionlist != null) |
---|
| 5415 | + SetVersionStates(); |
---|
| 5416 | + |
---|
| 5417 | + cameraView.requestFocusInWindow(); |
---|
4524 | 5418 | } |
---|
4525 | 5419 | |
---|
4526 | 5420 | static TweenManager tweenManager = new TweenManager(); |
---|
.. | .. |
---|
4552 | 5446 | // group = (Composite) group.get(0); |
---|
4553 | 5447 | // } |
---|
4554 | 5448 | |
---|
4555 | | - System.out.println("makeSomething of " + thing); |
---|
| 5449 | + //System.out.println("makeSomething of " + thing); |
---|
4556 | 5450 | |
---|
4557 | 5451 | /* |
---|
4558 | 5452 | if (deselect && jList != null) |
---|
.. | .. |
---|
4769 | 5663 | readobj.ResetDisplayList(); |
---|
4770 | 5664 | } catch (Exception e) |
---|
4771 | 5665 | { |
---|
4772 | | - e.printStackTrace(); |
---|
| 5666 | + if (!e.toString().contains("GZIP")) |
---|
| 5667 | + e.printStackTrace(); |
---|
| 5668 | + |
---|
4773 | 5669 | try |
---|
4774 | 5670 | { |
---|
4775 | 5671 | java.io.FileInputStream istream = new java.io.FileInputStream(fullname); |
---|
.. | .. |
---|
4849 | 5745 | { |
---|
4850 | 5746 | //readobj.deepCopySelf(copy); |
---|
4851 | 5747 | copy.clear(); // june 2014 |
---|
| 5748 | + copy.skyboxname = readobj.skyboxname; |
---|
| 5749 | + copy.skyboxext = readobj.skyboxext; |
---|
4852 | 5750 | for (int i = 0; i < readobj.size(); i++) |
---|
4853 | 5751 | { |
---|
4854 | 5752 | Object3D child = readobj.get(i); // reserve(i); |
---|
.. | .. |
---|
4900 | 5798 | c.addChild(csg); |
---|
4901 | 5799 | } |
---|
4902 | 5800 | |
---|
4903 | | - copy.versions = readobj.versions; |
---|
| 5801 | + copy.versionlist = readobj.versionlist; |
---|
4904 | 5802 | copy.versionindex = readobj.versionindex; |
---|
| 5803 | + copy.versiontable = readobj.versiontable; |
---|
4905 | 5804 | |
---|
4906 | | - if (copy.versions == null) |
---|
| 5805 | + if (copy.versionlist == null) |
---|
4907 | 5806 | { |
---|
4908 | | - copy.versions = new byte[100][]; |
---|
| 5807 | + // Backward compatibility |
---|
| 5808 | + copy.versionlist = new Object3D[100]; |
---|
4909 | 5809 | copy.versionindex = -1; |
---|
| 5810 | + |
---|
| 5811 | + //Save(true); |
---|
4910 | 5812 | } |
---|
4911 | 5813 | |
---|
4912 | 5814 | //? SetUndoStates(); |
---|
.. | .. |
---|
4921 | 5823 | { |
---|
4922 | 5824 | if (Grafreed.standAlone) |
---|
4923 | 5825 | { |
---|
4924 | | - FileDialog browser = new FileDialog(frame, "Load", FileDialog.LOAD); |
---|
| 5826 | + FileDialog browser = new FileDialog(frame, "Open", FileDialog.LOAD); |
---|
4925 | 5827 | browser.show(); |
---|
4926 | 5828 | String filename = browser.getFile(); |
---|
4927 | 5829 | if (filename != null && filename.length() > 0) |
---|
.. | .. |
---|
4998 | 5900 | |
---|
4999 | 5901 | void save() |
---|
5000 | 5902 | { |
---|
| 5903 | + Replace(); |
---|
| 5904 | + |
---|
5001 | 5905 | if (lastname == null) |
---|
5002 | 5906 | { |
---|
5003 | 5907 | return; |
---|
.. | .. |
---|
5240 | 6144 | ButtonGroup buttonGroup; |
---|
5241 | 6145 | |
---|
5242 | 6146 | cGridBag toolboxPanel; |
---|
| 6147 | + cGridBag skyboxPanel; |
---|
5243 | 6148 | cGridBag materialPanel; |
---|
5244 | 6149 | cGridBag ctrlPanel; |
---|
5245 | 6150 | |
---|
.. | .. |
---|
5251 | 6156 | boolean materialFlushed; |
---|
5252 | 6157 | Object3D latestObject; |
---|
5253 | 6158 | |
---|
| 6159 | + cGridBag transformPanel; |
---|
5254 | 6160 | cGridBag XYZPanel; |
---|
5255 | 6161 | |
---|
5256 | 6162 | JSplitPane gridPanel; |
---|
.. | .. |
---|
5313 | 6219 | JLabel colorLabel; |
---|
5314 | 6220 | cNumberSlider colorField; |
---|
5315 | 6221 | JLabel modulationLabel; |
---|
5316 | | - cNumberSlider modulationField; |
---|
| 6222 | + cNumberSlider saturationField; |
---|
5317 | 6223 | JLabel metalnessLabel; |
---|
5318 | 6224 | cNumberSlider metalnessField; |
---|
5319 | 6225 | JLabel diffuseLabel; |
---|
.. | .. |
---|
5344 | 6250 | cNumberSlider anisoField; |
---|
5345 | 6251 | JLabel anisoVLabel; |
---|
5346 | 6252 | cNumberSlider anisoVField; |
---|
| 6253 | + |
---|
5347 | 6254 | JLabel cameraLabel; |
---|
5348 | 6255 | cNumberSlider cameraField; |
---|
5349 | 6256 | JLabel selfshadowLabel; |
---|
.. | .. |
---|
5358 | 6265 | cNumberSlider fakedepthField; |
---|
5359 | 6266 | JLabel shadowbiasLabel; |
---|
5360 | 6267 | cNumberSlider shadowbiasField; |
---|
| 6268 | + |
---|
5361 | 6269 | JLabel bumpLabel; |
---|
5362 | 6270 | cNumberSlider bumpField; |
---|
5363 | 6271 | JLabel noiseLabel; |
---|