.. | .. |
---|
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 | | - try |
---|
48 | | - { |
---|
49 | | - ImageIcon icon = GetIcon(name); |
---|
50 | | - return new cButton(icon, border); |
---|
51 | | - } |
---|
52 | | - catch (Exception e) |
---|
53 | | - { |
---|
54 | | - return new cButton(name, border); |
---|
55 | | - } |
---|
| 85 | + ImageIcon icon = GetIcon(name); |
---|
| 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); |
---|
56 | 93 | } |
---|
57 | 94 | |
---|
58 | 95 | cToggleButton GetToggleButton(String name, boolean border) |
---|
59 | 96 | { |
---|
60 | | - try |
---|
61 | | - { |
---|
62 | | - ImageIcon icon = GetIcon(name); |
---|
63 | | - return new cToggleButton(icon, border); |
---|
64 | | - } |
---|
65 | | - catch (Exception e) |
---|
66 | | - { |
---|
67 | | - return new cToggleButton(name, border); |
---|
68 | | - } |
---|
| 97 | + ImageIcon icon = GetIcon(name); |
---|
| 98 | + return new cToggleButton(icon, border); |
---|
69 | 99 | } |
---|
70 | 100 | |
---|
71 | 101 | cCheckBox GetCheckBox(String name, boolean border) |
---|
72 | 102 | { |
---|
| 103 | + ImageIcon icon = GetIcon(name); |
---|
| 104 | + return new cCheckBox(icon, border); |
---|
| 105 | + } |
---|
| 106 | + |
---|
| 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 | + |
---|
73 | 117 | try |
---|
74 | 118 | { |
---|
75 | | - ImageIcon icon = GetIcon(name); |
---|
76 | | - return new cCheckBox(icon, border); |
---|
| 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; |
---|
77 | 138 | } |
---|
78 | 139 | catch (Exception e) |
---|
79 | 140 | { |
---|
80 | | - return new cCheckBox(name, border); |
---|
| 141 | + //icons.put(name, null); |
---|
| 142 | + return null; |
---|
81 | 143 | } |
---|
82 | 144 | } |
---|
83 | | - |
---|
84 | | - private ImageIcon GetIcon(String name) throws IOException |
---|
| 145 | + |
---|
| 146 | + BufferedImage GetImage(String name) |
---|
85 | 147 | { |
---|
86 | | - BufferedImage image = javax.imageio.ImageIO.read(getClass().getClassLoader().getResourceAsStream(name)); |
---|
87 | | - |
---|
88 | | - if (image.getWidth() != 24 && image.getHeight() != 24) |
---|
| 148 | + try |
---|
89 | 149 | { |
---|
90 | | - BufferedImage resized = new BufferedImage(24, 24, image.getType()); |
---|
91 | | - Graphics2D g = resized.createGraphics(); |
---|
92 | | - g.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR); |
---|
93 | | - //g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); |
---|
94 | | - g.drawImage(image, 0, 0, 24, 24, 0, 0, image.getWidth(), image.getHeight(), null); |
---|
95 | | - g.dispose(); |
---|
96 | | - |
---|
97 | | - image = resized; |
---|
| 150 | + BufferedImage image = javax.imageio.ImageIO.read(getClass().getClassLoader().getResourceAsStream(name)); |
---|
| 151 | + |
---|
| 152 | + return image; |
---|
98 | 153 | } |
---|
99 | | - |
---|
100 | | - javax.swing.ImageIcon icon = new javax.swing.ImageIcon(image); |
---|
101 | | - return icon; |
---|
| 154 | + catch (Exception e) |
---|
| 155 | + { |
---|
| 156 | + return null; |
---|
| 157 | + } |
---|
102 | 158 | } |
---|
103 | 159 | |
---|
104 | 160 | // SCRIPT |
---|
.. | .. |
---|
282 | 338 | client = inClient; |
---|
283 | 339 | copy = client; |
---|
284 | 340 | |
---|
285 | | - if (copy.versions == null) |
---|
286 | | - { |
---|
287 | | - copy.versions = new byte[100][]; |
---|
288 | | - copy.versionindex = -1; |
---|
289 | | - } |
---|
| 341 | +// if (copy.versionlist == null) |
---|
| 342 | +// { |
---|
| 343 | +// copy.versionlist = new Object3D[100]; |
---|
| 344 | +// copy.versionindex = -1; |
---|
| 345 | +// |
---|
| 346 | +// callee.Save(true); |
---|
| 347 | +// } |
---|
290 | 348 | |
---|
291 | 349 | // "this" is not called: SetupUI2(objEditor); |
---|
292 | 350 | } |
---|
.. | .. |
---|
301 | 359 | client = inClient; |
---|
302 | 360 | copy = client; |
---|
303 | 361 | |
---|
304 | | - if (copy.versions == null) |
---|
| 362 | + if (copy.versionlist == null) |
---|
305 | 363 | { |
---|
306 | | - copy.versions = new byte[100][]; |
---|
| 364 | + copy.versionlist = new Object3D[100]; |
---|
307 | 365 | copy.versionindex = -1; |
---|
| 366 | + |
---|
| 367 | +// Save(true); |
---|
308 | 368 | } |
---|
309 | 369 | |
---|
310 | 370 | SetupUI2(callee.GetEditor()); |
---|
.. | .. |
---|
328 | 388 | //parent = p; |
---|
329 | 389 | |
---|
330 | 390 | GraphicsDevice gd = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice(); |
---|
331 | | - System.out.println("getFullScreenWindow? " + gd.getFullScreenWindow()); |
---|
| 391 | + if (Globals.DEBUG) |
---|
| 392 | + System.out.println("getFullScreenWindow? " + gd.getFullScreenWindow()); |
---|
332 | 393 | //gd.setFullScreenWindow(this); |
---|
333 | 394 | //setResizable(false); |
---|
334 | 395 | //if (!isDisplayable()) |
---|
.. | .. |
---|
339 | 400 | copy = localCopy; |
---|
340 | 401 | copy.editWindow = this; |
---|
341 | 402 | |
---|
342 | | - if (copy.versions == null) |
---|
343 | | - { |
---|
344 | | - copy.versions = new byte[100][]; |
---|
345 | | - copy.versionindex = -1; |
---|
346 | | - } |
---|
| 403 | +// if (copy.versionlist == null) |
---|
| 404 | +// { |
---|
| 405 | +// copy.versionlist = new Object3D[100]; |
---|
| 406 | +// copy.versionindex = -1; |
---|
| 407 | +// |
---|
| 408 | +// Save(true); |
---|
| 409 | +// } |
---|
347 | 410 | |
---|
348 | 411 | SetupMenu(); |
---|
349 | 412 | |
---|
.. | .. |
---|
412 | 475 | |
---|
413 | 476 | ChangeListener changeListener = new ChangeListener() |
---|
414 | 477 | { |
---|
| 478 | + //String name; |
---|
| 479 | + |
---|
415 | 480 | public void stateChanged(ChangeEvent changeEvent) |
---|
416 | 481 | { |
---|
417 | 482 | // if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Material") && !materialFlushed) |
---|
.. | .. |
---|
430 | 495 | // EditSelection(false); |
---|
431 | 496 | // } |
---|
432 | 497 | |
---|
433 | | - refreshContents(false); // To refresh Info tab |
---|
| 498 | +// if (objectPanel.getSelectedIndex() == 4) |
---|
| 499 | +// { |
---|
| 500 | +// name = copy.skyboxname; |
---|
| 501 | +// |
---|
| 502 | +// if (name == null) |
---|
| 503 | +// { |
---|
| 504 | +// name = ""; |
---|
| 505 | +// } |
---|
| 506 | +// |
---|
| 507 | +// copy.skyboxname = "cubemaps/default-skyboxes/rgb"; |
---|
| 508 | +// copy.skyboxext = "jpg"; |
---|
| 509 | +// } |
---|
| 510 | +// else |
---|
| 511 | +// { |
---|
| 512 | +// if (name != null) |
---|
| 513 | +// { |
---|
| 514 | +// if (name.equals("")) |
---|
| 515 | +// { |
---|
| 516 | +// copy.skyboxname = null; |
---|
| 517 | +// copy.skyboxext = null; |
---|
| 518 | +// } |
---|
| 519 | +// else |
---|
| 520 | +// { |
---|
| 521 | +// copy.skyboxname = name; |
---|
| 522 | +// } |
---|
| 523 | +// } |
---|
| 524 | +// } |
---|
| 525 | + cameraView.transformMode = objectPanel.getSelectedIndex() == 4; |
---|
| 526 | + |
---|
| 527 | +// refreshContents(false); // To refresh Info tab |
---|
| 528 | + cameraView.repaint(); |
---|
434 | 529 | } |
---|
435 | 530 | }; |
---|
436 | 531 | objectPanel.addChangeListener(changeListener); |
---|
437 | 532 | |
---|
438 | 533 | toolbarPanel = new JPanel(); |
---|
439 | 534 | toolbarPanel.setName("Toolbar"); |
---|
| 535 | + |
---|
440 | 536 | treePanel = new cGridBag(); |
---|
441 | 537 | treePanel.setName("Tree"); |
---|
442 | 538 | |
---|
443 | 539 | editPanel = new cGridBag().setVertical(true); |
---|
444 | | - editPanel.setName("Edit"); |
---|
| 540 | + //editPanel.setName("Edit"); |
---|
445 | 541 | |
---|
446 | 542 | ctrlPanel = new cGridBag().setVertical(false); // new GridBagLayout()); |
---|
447 | 543 | |
---|
.. | .. |
---|
449 | 545 | editPanel.add(editCommandsPanel); |
---|
450 | 546 | editPanel.add(ctrlPanel); |
---|
451 | 547 | |
---|
452 | | - toolboxPanel = new cGridBag().setVertical(false); |
---|
453 | | - toolboxPanel.setName("Toolbox"); |
---|
| 548 | + toolboxPanel = new cGridBag().setVertical(true); |
---|
| 549 | + //toolboxPanel.setName("Toolbox"); |
---|
454 | 550 | |
---|
455 | | - materialPanel = new cGridBag().setVertical(true); |
---|
456 | | - materialPanel.setName("Material"); |
---|
| 551 | + skyboxPanel = new cGridBag().setVertical(true); |
---|
| 552 | + |
---|
| 553 | + materialPanel = new cGridBag().setVertical(false); |
---|
| 554 | + //materialPanel.setName("Material"); |
---|
457 | 555 | |
---|
458 | 556 | /*JTextPane*/ |
---|
459 | 557 | infoarea = createTextPane(); |
---|
.. | .. |
---|
461 | 559 | |
---|
462 | 560 | infoarea.setEditable(true); |
---|
463 | 561 | SetText(); |
---|
| 562 | + |
---|
464 | 563 | // infoarea.setFont(infoarea.getFont().deriveFont(10, 14f)); |
---|
465 | 564 | // infoarea.setOpaque(false); |
---|
466 | 565 | // //infoarea.setForeground(textcolor); |
---|
.. | .. |
---|
468 | 567 | // TEXTAREA infoarea.setWrapStyleWord(true); |
---|
469 | 568 | infoPanel = new JScrollPane(infoarea, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); //AS_NEEDED); |
---|
470 | 569 | infoPanel.setPreferredSize(new Dimension(1, 1)); |
---|
471 | | - infoPanel.setName("Info"); |
---|
| 570 | + //infoPanel.setName("Info"); |
---|
472 | 571 | //infoPanel.setLayout(new BorderLayout()); |
---|
473 | 572 | //infoPanel.add(createTextPane()); |
---|
474 | 573 | |
---|
.. | .. |
---|
735 | 834 | boolean maximized; |
---|
736 | 835 | |
---|
737 | 836 | cButton fullscreenLayout; |
---|
| 837 | + cButton expandedLayout; |
---|
738 | 838 | |
---|
739 | 839 | void Minimize() |
---|
740 | 840 | { |
---|
.. | .. |
---|
774 | 874 | cButton minButton; |
---|
775 | 875 | cButton maxButton; |
---|
776 | 876 | cButton fullButton; |
---|
| 877 | + cButton collapseButton; |
---|
| 878 | + cButton maximize3DButton; |
---|
777 | 879 | |
---|
778 | 880 | void ToggleFullScreen() |
---|
779 | 881 | { |
---|
780 | | -GraphicsDevice device = frame.getGraphicsConfiguration().getDevice(); |
---|
| 882 | + GraphicsDevice device = frame.getGraphicsConfiguration().getDevice(); |
---|
781 | 883 | |
---|
782 | 884 | cameraView.ToggleFullScreen(); |
---|
783 | 885 | |
---|
.. | .. |
---|
798 | 900 | // X frame.getContentPane().remove(/*"Center",*/bigThree); |
---|
799 | 901 | // X framePanel.add(bigThree); |
---|
800 | 902 | // X frame.getContentPane().add(/*"Center",*/framePanel); |
---|
801 | | - framePanel.setDividerLocation(46); |
---|
| 903 | +// framePanel.setDividerLocation(46); // icons are 24x24 |
---|
802 | 904 | |
---|
803 | 905 | //frame.setVisible(true); |
---|
804 | | - radio.layout = keepButton; |
---|
| 906 | +// radio.layout = keepButton; |
---|
805 | 907 | //theFrame = null; |
---|
806 | 908 | keepButton = null; |
---|
807 | | - radio.layout.doClick(); |
---|
| 909 | +// radio.layout.doClick(); |
---|
808 | 910 | |
---|
809 | 911 | } else |
---|
810 | 912 | { |
---|
.. | .. |
---|
825 | 927 | // X frame.getContentPane().remove(/*"Center",*/framePanel); |
---|
826 | 928 | // X framePanel.remove(bigThree); |
---|
827 | 929 | // X frame.getContentPane().add(/*"Center",*/bigThree); |
---|
828 | | - framePanel.setDividerLocation(0); |
---|
| 930 | +// framePanel.setDividerLocation(0); |
---|
829 | 931 | |
---|
830 | | - radio.layout = fullscreenLayout; |
---|
831 | | - radio.layout.doClick(); |
---|
| 932 | +// radio.layout = fullscreenLayout; |
---|
| 933 | +// radio.layout.doClick(); |
---|
832 | 934 | //frame.setVisible(true); |
---|
833 | 935 | } |
---|
834 | 936 | frame.validate(); |
---|
| 937 | + |
---|
| 938 | + cameraView.requestFocusInWindow(); |
---|
835 | 939 | } |
---|
836 | 940 | |
---|
837 | | - private byte[] CompressCopy() |
---|
| 941 | + void CollapseToolbar() |
---|
| 942 | + { |
---|
| 943 | + framePanel.setDividerLocation(0); |
---|
| 944 | + //frame.validate(); |
---|
| 945 | + |
---|
| 946 | + cameraView.requestFocusInWindow(); |
---|
| 947 | + } |
---|
| 948 | + |
---|
| 949 | + private Object3D Duplicate(Object3D object) |
---|
838 | 950 | { |
---|
839 | 951 | boolean temp = CameraPane.SWITCH; |
---|
840 | 952 | CameraPane.SWITCH = false; |
---|
841 | 953 | |
---|
842 | | - copy.ExtractBigData(versiontable); |
---|
| 954 | + if (Grafreed.grafreed.universe.versiontable == null) |
---|
| 955 | + Grafreed.grafreed.universe.versiontable = new java.util.Hashtable<java.util.UUID, Object3D>(); |
---|
| 956 | + |
---|
| 957 | + object.ExtractBigData(Grafreed.grafreed.universe.versiontable); |
---|
843 | 958 | // if (copy == client) |
---|
844 | 959 | |
---|
845 | | - byte[] versions[] = copy.versions; |
---|
846 | | - copy.versions = null; |
---|
| 960 | + Object3D versions[] = object.versionlist; |
---|
| 961 | + java.util.Hashtable<java.util.UUID, Object3D> versiontable = object.versiontable; // if Grafreed.grafreed.universe |
---|
| 962 | + object.versionlist = null; |
---|
| 963 | + object.versiontable = null; |
---|
847 | 964 | |
---|
848 | | - byte[] compress = Compress(copy); |
---|
| 965 | + //byte[] compress = Compress(copy); |
---|
| 966 | + Object3D compress = (Object3D)Grafreed.clone(object); |
---|
849 | 967 | |
---|
850 | | - copy.versions = versions; |
---|
| 968 | + object.versionlist = versions; |
---|
| 969 | + object.versiontable = versiontable; // if Grafreed.grafreed.universe |
---|
851 | 970 | |
---|
852 | | - copy.RestoreBigData(versiontable); |
---|
| 971 | + object.RestoreBigData(Grafreed.grafreed.universe.versiontable); |
---|
853 | 972 | |
---|
854 | 973 | CameraPane.SWITCH = temp; |
---|
855 | 974 | |
---|
.. | .. |
---|
977 | 1096 | { |
---|
978 | 1097 | SetupMaterial(materialPanel); |
---|
979 | 1098 | } |
---|
| 1099 | + |
---|
980 | 1100 | //SetupName(); |
---|
981 | 1101 | //SetupViews(); |
---|
982 | 1102 | } |
---|
.. | .. |
---|
986 | 1106 | // NumberSlider vDivsField; |
---|
987 | 1107 | // JCheckBox endcaps; |
---|
988 | 1108 | JCheckBox liveCB; |
---|
989 | | - JCheckBox selectCB; |
---|
| 1109 | + JCheckBox selectableCB; |
---|
990 | 1110 | JCheckBox hideCB; |
---|
991 | 1111 | JCheckBox link2masterCB; |
---|
992 | 1112 | JCheckBox markCB; |
---|
.. | .. |
---|
1185 | 1305 | |
---|
1186 | 1306 | namePanel = new cGridBag(); |
---|
1187 | 1307 | |
---|
| 1308 | + //if (copy.pinned) |
---|
| 1309 | + { |
---|
| 1310 | + pinButton = GetToggleButton("icons/pin.png", !Grafreed.NIMBUSLAF); |
---|
| 1311 | + pinButton.setSelected(copy.pinned); |
---|
| 1312 | + cGridBag t = new cGridBag(); |
---|
| 1313 | + t.preferredWidth = 2; |
---|
| 1314 | + t.add(pinButton); |
---|
| 1315 | + namePanel.add(t); |
---|
| 1316 | + |
---|
| 1317 | + pinButton.addItemListener(this); |
---|
| 1318 | + } |
---|
| 1319 | + |
---|
1188 | 1320 | nameField = AddText(namePanel, copy.GetName()); |
---|
1189 | 1321 | namePanel.add(new JScrollPane(nameField, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER)); |
---|
1190 | 1322 | oe.ctrlPanel.add(namePanel); |
---|
.. | .. |
---|
1198 | 1330 | |
---|
1199 | 1331 | liveCB = AddCheckBox(setupPanel, "Live", copy.live); |
---|
1200 | 1332 | liveCB.setToolTipText("Animate object"); |
---|
1201 | | - selectCB = AddCheckBox(setupPanel, "Select", !copy.dontselect); |
---|
1202 | | - selectCB.setToolTipText("Make object selectable"); |
---|
| 1333 | + markCB = AddCheckBox(setupPanel, "Anim", copy.marked); |
---|
| 1334 | + markCB.setToolTipText("Set target transform"); |
---|
| 1335 | + selectableCB = AddCheckBox(setupPanel, "Select", !copy.dontselect); |
---|
| 1336 | + selectableCB.setToolTipText("Make object selectable"); |
---|
1203 | 1337 | // Return(); |
---|
| 1338 | + |
---|
1204 | 1339 | hideCB = AddCheckBox(setupPanel, "Hide", copy.hide); |
---|
1205 | 1340 | hideCB.setToolTipText("Hide object"); |
---|
1206 | | - markCB = AddCheckBox(setupPanel, "Mark", copy.marked); |
---|
1207 | | - markCB.setToolTipText("As animation target transform"); |
---|
| 1341 | + |
---|
| 1342 | + ToolTipManager.sharedInstance().setLightWeightPopupEnabled(false); |
---|
1208 | 1343 | |
---|
1209 | 1344 | setupPanel2 = new cGridBag().setVertical(false); |
---|
1210 | 1345 | |
---|
.. | .. |
---|
1404 | 1539 | |
---|
1405 | 1540 | if (cam == null || !(copy.get(0) instanceof cGroup)) |
---|
1406 | 1541 | { |
---|
| 1542 | + if (Globals.DEBUG) |
---|
1407 | 1543 | System.out.println("CREATE CAMERAS"); |
---|
1408 | 1544 | cams = new cTemplate(); |
---|
1409 | 1545 | cams.name = "Cameras"; |
---|
.. | .. |
---|
1492 | 1628 | XYZPanel.addComponent(/*BorderLayout.SOUTH,*/sideView); // Scroll); |
---|
1493 | 1629 | XYZPanel.addComponent(/*BorderLayout.CENTER,*/frontView); // Scroll); |
---|
1494 | 1630 | XYZPanel.addComponent(/*BorderLayout.NORTH,*/topView); // Scroll); |
---|
| 1631 | + //XYZPanel.setName("XYZ"); |
---|
1495 | 1632 | |
---|
1496 | 1633 | /* |
---|
1497 | 1634 | gridPanel = new JPanel(); //new BorderLayout()); |
---|
.. | .. |
---|
1528 | 1665 | |
---|
1529 | 1666 | //JScrollPane tmp = new JScrollPane(ctrlPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); |
---|
1530 | 1667 | //tmp.setName("Edit"); |
---|
| 1668 | + objectPanel.add(toolboxPanel); |
---|
| 1669 | + objectPanel.setIconAt(0, GetIcon("icons/primitives.png")); |
---|
| 1670 | + objectPanel.setToolTipTextAt(0, "Objects & textures"); |
---|
| 1671 | + |
---|
1531 | 1672 | objectPanel.add(materialPanel); |
---|
| 1673 | + objectPanel.setIconAt(1, GetIcon("icons/material.png")); |
---|
| 1674 | + objectPanel.setToolTipTextAt(1, "Material"); |
---|
| 1675 | + |
---|
| 1676 | + objectPanel.add(skyboxPanel); |
---|
| 1677 | + objectPanel.setIconAt(2, GetIcon("icons/skybox.jpg")); |
---|
| 1678 | + objectPanel.setToolTipTextAt(2, "Backgrounds"); |
---|
| 1679 | + |
---|
1532 | 1680 | // JPanel north = new JPanel(new BorderLayout()); |
---|
1533 | 1681 | // north.setName("Edit"); |
---|
1534 | 1682 | // north.add(ctrlPanel, BorderLayout.NORTH); |
---|
1535 | 1683 | // objectPanel.add(north); |
---|
1536 | 1684 | objectPanel.add(editPanel); |
---|
| 1685 | + objectPanel.setIconAt(3, GetIcon("icons/write.png")); |
---|
| 1686 | + objectPanel.setToolTipTextAt(3, "Edit controls"); |
---|
1537 | 1687 | |
---|
1538 | | - //if (Globals.ADVANCED) |
---|
1539 | | - objectPanel.add(infoPanel); |
---|
| 1688 | + objectPanel.add(XYZPanel); |
---|
| 1689 | + objectPanel.setIconAt(4, GetIcon("icons/XYZ.png")); |
---|
| 1690 | + objectPanel.setToolTipTextAt(4, "XYZ/RGB transform"); |
---|
1540 | 1691 | |
---|
1541 | | - objectPanel.add(toolboxPanel); |
---|
1542 | | - |
---|
1543 | 1692 | /* |
---|
1544 | 1693 | aConstraints.gridx = 0; |
---|
1545 | 1694 | aConstraints.gridwidth = 1; |
---|
.. | .. |
---|
1559 | 1708 | scrollpane.addMouseWheelListener(this); // Default not fast enough |
---|
1560 | 1709 | |
---|
1561 | 1710 | /*JTabbedPane*/ scenePanel = new cGridBag(); |
---|
1562 | | - scenePanel.preferredWidth = 6; |
---|
| 1711 | + scenePanel.preferredWidth = 5; |
---|
1563 | 1712 | |
---|
1564 | 1713 | JTabbedPane tabbedPane = new JTabbedPane(); |
---|
1565 | 1714 | tabbedPane.add(scrollpane); |
---|
.. | .. |
---|
1576 | 1725 | |
---|
1577 | 1726 | scenePanel.add(tabbedPane); |
---|
1578 | 1727 | |
---|
| 1728 | + //if (Globals.ADVANCED) |
---|
| 1729 | +// tabbedPane.add(infoPanel); |
---|
| 1730 | +// tabbedPane.setIconAt(3, GetIcon("icons/info.png")); |
---|
| 1731 | +// tabbedPane.setToolTipTextAt(3, "Information"); |
---|
| 1732 | + |
---|
1579 | 1733 | /* |
---|
1580 | 1734 | cTree jTree = new cTree(null); |
---|
1581 | 1735 | ToolTipManager.sharedInstance().registerComponent(jTree); |
---|
.. | .. |
---|
1637 | 1791 | bigThree = new cGridBag(); |
---|
1638 | 1792 | bigThree.addComponent(scenePanel); |
---|
1639 | 1793 | bigThree.addComponent(centralPanel); |
---|
1640 | | - bigThree.addComponent(XYZPanel); |
---|
| 1794 | + //bigThree.addComponent(XYZPanel); |
---|
1641 | 1795 | |
---|
1642 | 1796 | // // SIDE EFFECT!!! |
---|
1643 | 1797 | // aConstraints.gridx = 0; |
---|
.. | .. |
---|
1646 | 1800 | // aConstraints.gridheight = 1; |
---|
1647 | 1801 | |
---|
1648 | 1802 | framePanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, toolbarPanel, bigThree); |
---|
| 1803 | + |
---|
| 1804 | + framePanel.addPropertyChangeListener(JSplitPane.DIVIDER_LOCATION_PROPERTY, |
---|
| 1805 | + new java.beans.PropertyChangeListener() |
---|
| 1806 | + { |
---|
| 1807 | + public void propertyChange(java.beans.PropertyChangeEvent pce) |
---|
| 1808 | + { |
---|
| 1809 | + if ((Integer)pce.getOldValue() == 1) |
---|
| 1810 | + { |
---|
| 1811 | + if (radio.layout != expandedLayout) |
---|
| 1812 | + { |
---|
| 1813 | + radio.layout = expandedLayout; |
---|
| 1814 | + radio.layout.doClick(); |
---|
| 1815 | + } |
---|
| 1816 | + } |
---|
| 1817 | + } |
---|
| 1818 | + }); |
---|
| 1819 | + |
---|
1649 | 1820 | framePanel.setContinuousLayout(false); |
---|
1650 | 1821 | framePanel.setOneTouchExpandable(false); |
---|
1651 | 1822 | //.setDividerLocation(0.8); |
---|
.. | .. |
---|
1655 | 1826 | |
---|
1656 | 1827 | frame.getContentPane().setLayout(new BorderLayout()); |
---|
1657 | 1828 | /**/ |
---|
1658 | | - JTabbedPane worldPane = new JTabbedPane(); |
---|
| 1829 | + //JTabbedPane worldPane = new JTabbedPane(); |
---|
1659 | 1830 | //worldPane.add(bigPanel); |
---|
1660 | 1831 | //worldPane.add(worldPanel); |
---|
1661 | 1832 | /**/ |
---|
.. | .. |
---|
1678 | 1849 | frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); |
---|
1679 | 1850 | frame.addWindowListener(new WindowAdapter() |
---|
1680 | 1851 | { |
---|
1681 | | - |
---|
1682 | 1852 | public void windowClosing(WindowEvent e) |
---|
1683 | 1853 | { |
---|
1684 | 1854 | Close(); |
---|
.. | .. |
---|
1701 | 1871 | ctrlPanel.removeAll(); |
---|
1702 | 1872 | } |
---|
1703 | 1873 | |
---|
1704 | | - void SetupMaterial(cGridBag panel) |
---|
| 1874 | + void SetupMaterial(cGridBag materialpanel) |
---|
1705 | 1875 | { |
---|
1706 | | - /* |
---|
| 1876 | + cGridBag presetpanel = new cGridBag().setVertical(true); |
---|
| 1877 | + |
---|
| 1878 | + cLabel skin = GetLabel("icons/shadericons/shadericon00000.png", !Grafreed.NIMBUSLAF); |
---|
| 1879 | + skin.setToolTipText("Skin"); |
---|
| 1880 | + skin.addMouseListener(new MouseAdapter() |
---|
| 1881 | + { |
---|
| 1882 | + public void mouseClicked(MouseEvent e) |
---|
| 1883 | + { |
---|
| 1884 | + Object3D object = Grafreed.materials.versionlist[0].get(0); |
---|
| 1885 | + cMaterial material = object.material; |
---|
| 1886 | + |
---|
| 1887 | + // Skin |
---|
| 1888 | + colorField.setFloat(material.color); |
---|
| 1889 | + saturationField.setFloat(material.modulation); |
---|
| 1890 | + subsurfaceField.setFloat(material.subsurface); |
---|
| 1891 | + selfshadowField.setFloat(material.diffuseness); |
---|
| 1892 | + diffusenessField.setFloat(material.factor); |
---|
| 1893 | + shininessField.setFloat(material.shininess); |
---|
| 1894 | + shadowbiasField.setFloat(material.shadowbias); |
---|
| 1895 | + diffuseField.setFloat(material.diffuse); |
---|
| 1896 | + specularField.setFloat(material.specular); |
---|
| 1897 | + |
---|
| 1898 | + bumpField.setFloat(object.projectedVertices[0].x / 1000.0); |
---|
| 1899 | + noiseField.setFloat(object.projectedVertices[0].y / 1000.0); |
---|
| 1900 | + powerField.setFloat(object.projectedVertices[2].x / 1000.0); |
---|
| 1901 | + |
---|
| 1902 | + materialtouched = true; |
---|
| 1903 | + applySelf(); |
---|
| 1904 | + } |
---|
| 1905 | + }); |
---|
| 1906 | + presetpanel.add(skin); |
---|
| 1907 | + |
---|
| 1908 | + cLabel lambert = GetLabel("icons/shadericons/shadericon00002.png", !Grafreed.NIMBUSLAF); |
---|
| 1909 | + lambert.setToolTipText("Diffuse"); |
---|
| 1910 | + lambert.addMouseListener(new MouseAdapter() |
---|
| 1911 | + { |
---|
| 1912 | + public void mouseClicked(MouseEvent e) |
---|
| 1913 | + { |
---|
| 1914 | + Object3D object = Grafreed.materials.versionlist[2].get(0); |
---|
| 1915 | + cMaterial material = object.material; |
---|
| 1916 | + |
---|
| 1917 | + diffusenessField.setFloat(material.factor); |
---|
| 1918 | + selfshadowField.setFloat(material.diffuseness); |
---|
| 1919 | + |
---|
| 1920 | + materialtouched = true; |
---|
| 1921 | + applySelf(); |
---|
| 1922 | + } |
---|
| 1923 | + }); |
---|
| 1924 | + presetpanel.add(lambert); |
---|
| 1925 | + |
---|
| 1926 | + cLabel diffuse2 = GetLabel("icons/shadericons/shadericon00003.png", !Grafreed.NIMBUSLAF); |
---|
| 1927 | + diffuse2.setToolTipText("Diffuse2"); |
---|
| 1928 | + diffuse2.addMouseListener(new MouseAdapter() |
---|
| 1929 | + { |
---|
| 1930 | + public void mouseClicked(MouseEvent e) |
---|
| 1931 | + { |
---|
| 1932 | + Object3D object = Grafreed.materials.versionlist[3].get(0); |
---|
| 1933 | + cMaterial material = object.material; |
---|
| 1934 | + |
---|
| 1935 | + diffusenessField.setFloat(material.factor); |
---|
| 1936 | + selfshadowField.setFloat(material.diffuseness); |
---|
| 1937 | + |
---|
| 1938 | + materialtouched = true; |
---|
| 1939 | + applySelf(); |
---|
| 1940 | + } |
---|
| 1941 | + }); |
---|
| 1942 | + presetpanel.add(diffuse2); |
---|
| 1943 | + |
---|
| 1944 | + cLabel diffusemoon = GetLabel("icons/shadericons/shadericon00004.png", !Grafreed.NIMBUSLAF); |
---|
| 1945 | + diffusemoon.setToolTipText("Moon"); |
---|
| 1946 | + diffusemoon.addMouseListener(new MouseAdapter() |
---|
| 1947 | + { |
---|
| 1948 | + public void mouseClicked(MouseEvent e) |
---|
| 1949 | + { |
---|
| 1950 | + Object3D object = Grafreed.materials.versionlist[4].get(0); |
---|
| 1951 | + cMaterial material = object.material; |
---|
| 1952 | + |
---|
| 1953 | + diffusenessField.setFloat(material.factor); |
---|
| 1954 | + selfshadowField.setFloat(material.diffuseness); |
---|
| 1955 | + |
---|
| 1956 | + materialtouched = true; |
---|
| 1957 | + applySelf(); |
---|
| 1958 | + } |
---|
| 1959 | + }); |
---|
| 1960 | + presetpanel.add(diffusemoon); |
---|
| 1961 | + |
---|
| 1962 | + cLabel diffusemoon2 = GetLabel("icons/shadericons/shadericon00005.png", !Grafreed.NIMBUSLAF); |
---|
| 1963 | + diffusemoon2.setToolTipText("Moon2"); |
---|
| 1964 | + diffusemoon2.addMouseListener(new MouseAdapter() |
---|
| 1965 | + { |
---|
| 1966 | + public void mouseClicked(MouseEvent e) |
---|
| 1967 | + { |
---|
| 1968 | + Object3D object = Grafreed.materials.versionlist[5].get(0); |
---|
| 1969 | + cMaterial material = object.material; |
---|
| 1970 | + |
---|
| 1971 | + diffusenessField.setFloat(material.factor); |
---|
| 1972 | + selfshadowField.setFloat(material.diffuseness); |
---|
| 1973 | + |
---|
| 1974 | + materialtouched = true; |
---|
| 1975 | + applySelf(); |
---|
| 1976 | + } |
---|
| 1977 | + }); |
---|
| 1978 | + presetpanel.add(diffusemoon2); |
---|
| 1979 | + |
---|
| 1980 | + cLabel diffusemoon3 = GetLabel("icons/shadericons/shadericon00006.png", !Grafreed.NIMBUSLAF); |
---|
| 1981 | + diffusemoon3.setToolTipText("Moon3"); |
---|
| 1982 | + diffusemoon3.addMouseListener(new MouseAdapter() |
---|
| 1983 | + { |
---|
| 1984 | + public void mouseClicked(MouseEvent e) |
---|
| 1985 | + { |
---|
| 1986 | + Object3D object = Grafreed.materials.versionlist[6].get(0); |
---|
| 1987 | + cMaterial material = object.material; |
---|
| 1988 | + |
---|
| 1989 | + diffusenessField.setFloat(material.factor); |
---|
| 1990 | + selfshadowField.setFloat(material.diffuseness); |
---|
| 1991 | + |
---|
| 1992 | + materialtouched = true; |
---|
| 1993 | + applySelf(); |
---|
| 1994 | + } |
---|
| 1995 | + }); |
---|
| 1996 | + presetpanel.add(diffusemoon3); |
---|
| 1997 | + |
---|
| 1998 | + cLabel diffusesheen = GetLabel("icons/shadericons/shadericon00007.png", !Grafreed.NIMBUSLAF); |
---|
| 1999 | + diffusesheen.setToolTipText("Sheen"); |
---|
| 2000 | + diffusesheen.addMouseListener(new MouseAdapter() |
---|
| 2001 | + { |
---|
| 2002 | + public void mouseClicked(MouseEvent e) |
---|
| 2003 | + { |
---|
| 2004 | + Object3D object = Grafreed.materials.versionlist[7].get(0); |
---|
| 2005 | + cMaterial material = object.material; |
---|
| 2006 | + |
---|
| 2007 | + sheenField.setFloat(material.sheen); |
---|
| 2008 | + |
---|
| 2009 | + materialtouched = true; |
---|
| 2010 | + applySelf(); |
---|
| 2011 | + } |
---|
| 2012 | + }); |
---|
| 2013 | + presetpanel.add(diffusesheen); |
---|
| 2014 | + |
---|
| 2015 | + cLabel rough = GetLabel("icons/shadericons/shadericon00001.png", !Grafreed.NIMBUSLAF); |
---|
| 2016 | + rough.setToolTipText("Rough metal"); |
---|
| 2017 | + rough.addMouseListener(new MouseAdapter() |
---|
| 2018 | + { |
---|
| 2019 | + public void mouseClicked(MouseEvent e) |
---|
| 2020 | + { |
---|
| 2021 | + Object3D object = Grafreed.materials.versionlist[1].get(0); |
---|
| 2022 | + cMaterial material = object.material; |
---|
| 2023 | + |
---|
| 2024 | + shininessField.setFloat(material.shininess); |
---|
| 2025 | + velvetField.setFloat(material.velvet); |
---|
| 2026 | + |
---|
| 2027 | + materialtouched = true; |
---|
| 2028 | + applySelf(); |
---|
| 2029 | + } |
---|
| 2030 | + }); |
---|
| 2031 | + presetpanel.add(rough); |
---|
| 2032 | + |
---|
| 2033 | + cLabel rough2 = GetLabel("icons/shadericons/shadericon00013.png", !Grafreed.NIMBUSLAF); |
---|
| 2034 | + rough2.setToolTipText("Medium metal"); |
---|
| 2035 | + rough2.addMouseListener(new MouseAdapter() |
---|
| 2036 | + { |
---|
| 2037 | + public void mouseClicked(MouseEvent e) |
---|
| 2038 | + { |
---|
| 2039 | + Object3D object = Grafreed.materials.versionlist[13].get(0); |
---|
| 2040 | + cMaterial material = object.material; |
---|
| 2041 | + |
---|
| 2042 | + shininessField.setFloat(material.shininess); |
---|
| 2043 | + lightareaField.setFloat(material.lightarea); |
---|
| 2044 | + |
---|
| 2045 | + materialtouched = true; |
---|
| 2046 | + applySelf(); |
---|
| 2047 | + } |
---|
| 2048 | + }); |
---|
| 2049 | + presetpanel.add(rough2); |
---|
| 2050 | + |
---|
| 2051 | + cLabel shini0 = GetLabel("icons/shadericons/shadericon00014.png", !Grafreed.NIMBUSLAF); |
---|
| 2052 | + shini0.setToolTipText("Shiny"); |
---|
| 2053 | + shini0.addMouseListener(new MouseAdapter() |
---|
| 2054 | + { |
---|
| 2055 | + public void mouseClicked(MouseEvent e) |
---|
| 2056 | + { |
---|
| 2057 | + Object3D object = Grafreed.materials.versionlist[14].get(0); |
---|
| 2058 | + cMaterial material = object.material; |
---|
| 2059 | + |
---|
| 2060 | + shininessField.setFloat(material.shininess); |
---|
| 2061 | + lightareaField.setFloat(material.lightarea); |
---|
| 2062 | + |
---|
| 2063 | + materialtouched = true; |
---|
| 2064 | + applySelf(); |
---|
| 2065 | + } |
---|
| 2066 | + }); |
---|
| 2067 | + presetpanel.add(shini0); |
---|
| 2068 | + |
---|
| 2069 | + cLabel shini1 = GetLabel("icons/shadericons/shadericon00011.png", !Grafreed.NIMBUSLAF); |
---|
| 2070 | + shini1.setToolTipText("Shiny2"); |
---|
| 2071 | + shini1.addMouseListener(new MouseAdapter() |
---|
| 2072 | + { |
---|
| 2073 | + public void mouseClicked(MouseEvent e) |
---|
| 2074 | + { |
---|
| 2075 | + Object3D object = Grafreed.materials.versionlist[11].get(0); |
---|
| 2076 | + cMaterial material = object.material; |
---|
| 2077 | + |
---|
| 2078 | + shininessField.setFloat(material.shininess); |
---|
| 2079 | + lightareaField.setFloat(material.lightarea); |
---|
| 2080 | + |
---|
| 2081 | + materialtouched = true; |
---|
| 2082 | + applySelf(); |
---|
| 2083 | + } |
---|
| 2084 | + }); |
---|
| 2085 | + presetpanel.add(shini1); |
---|
| 2086 | + |
---|
| 2087 | + cLabel shini2 = GetLabel("icons/shadericons/shadericon00012.png", !Grafreed.NIMBUSLAF); |
---|
| 2088 | + shini2.setToolTipText("Shiny3"); |
---|
| 2089 | + shini2.addMouseListener(new MouseAdapter() |
---|
| 2090 | + { |
---|
| 2091 | + public void mouseClicked(MouseEvent e) |
---|
| 2092 | + { |
---|
| 2093 | + Object3D object = Grafreed.materials.versionlist[12].get(0); |
---|
| 2094 | + cMaterial material = object.material; |
---|
| 2095 | + |
---|
| 2096 | + shininessField.setFloat(material.shininess); |
---|
| 2097 | + lightareaField.setFloat(material.lightarea); |
---|
| 2098 | + |
---|
| 2099 | + materialtouched = true; |
---|
| 2100 | + applySelf(); |
---|
| 2101 | + } |
---|
| 2102 | + }); |
---|
| 2103 | + presetpanel.add(shini2); |
---|
| 2104 | + |
---|
| 2105 | + cLabel aniso = GetLabel("icons/shadericons/shadericon00008.png", !Grafreed.NIMBUSLAF); |
---|
| 2106 | + aniso.setToolTipText("AnisoU"); |
---|
| 2107 | + aniso.addMouseListener(new MouseAdapter() |
---|
| 2108 | + { |
---|
| 2109 | + public void mouseClicked(MouseEvent e) |
---|
| 2110 | + { |
---|
| 2111 | + Object3D object = Grafreed.materials.versionlist[8].get(0); |
---|
| 2112 | + cMaterial material = object.material; |
---|
| 2113 | + |
---|
| 2114 | + anisoField.setFloat(material.aniso); |
---|
| 2115 | + anisoVField.setFloat(material.anisoV); |
---|
| 2116 | + |
---|
| 2117 | + materialtouched = true; |
---|
| 2118 | + applySelf(); |
---|
| 2119 | + } |
---|
| 2120 | + }); |
---|
| 2121 | + presetpanel.add(aniso); |
---|
| 2122 | + |
---|
| 2123 | + cLabel aniso2 = GetLabel("icons/shadericons/shadericon00009.png", !Grafreed.NIMBUSLAF); |
---|
| 2124 | + aniso2.setToolTipText("AnisoV"); |
---|
| 2125 | + aniso2.addMouseListener(new MouseAdapter() |
---|
| 2126 | + { |
---|
| 2127 | + public void mouseClicked(MouseEvent e) |
---|
| 2128 | + { |
---|
| 2129 | + Object3D object = Grafreed.materials.versionlist[9].get(0); |
---|
| 2130 | + cMaterial material = object.material; |
---|
| 2131 | + |
---|
| 2132 | + anisoField.setFloat(material.aniso); |
---|
| 2133 | + anisoVField.setFloat(material.anisoV); |
---|
| 2134 | + |
---|
| 2135 | + materialtouched = true; |
---|
| 2136 | + applySelf(); |
---|
| 2137 | + } |
---|
| 2138 | + }); |
---|
| 2139 | + presetpanel.add(aniso2); |
---|
| 2140 | + |
---|
| 2141 | + cLabel aniso3 = GetLabel("icons/shadericons/shadericon00010.png", !Grafreed.NIMBUSLAF); |
---|
| 2142 | + aniso3.setToolTipText("AnisoUV"); |
---|
| 2143 | + aniso3.addMouseListener(new MouseAdapter() |
---|
| 2144 | + { |
---|
| 2145 | + public void mouseClicked(MouseEvent e) |
---|
| 2146 | + { |
---|
| 2147 | + Object3D object = Grafreed.materials.versionlist[10].get(0); |
---|
| 2148 | + cMaterial material = object.material; |
---|
| 2149 | + |
---|
| 2150 | + anisoField.setFloat(material.aniso); |
---|
| 2151 | + anisoVField.setFloat(material.anisoV); |
---|
| 2152 | + |
---|
| 2153 | + materialtouched = true; |
---|
| 2154 | + applySelf(); |
---|
| 2155 | + } |
---|
| 2156 | + }); |
---|
| 2157 | + presetpanel.add(aniso3); |
---|
| 2158 | + |
---|
| 2159 | + cLabel velvet0 = GetLabel("icons/shadericons/shadericon00015.png", !Grafreed.NIMBUSLAF); |
---|
| 2160 | + velvet0.setToolTipText("Velvet"); |
---|
| 2161 | + velvet0.addMouseListener(new MouseAdapter() |
---|
| 2162 | + { |
---|
| 2163 | + public void mouseClicked(MouseEvent e) |
---|
| 2164 | + { |
---|
| 2165 | + Object3D object = Grafreed.materials.versionlist[15].get(0); |
---|
| 2166 | + cMaterial material = object.material; |
---|
| 2167 | + |
---|
| 2168 | + diffusenessField.setFloat(material.factor); |
---|
| 2169 | + selfshadowField.setFloat(material.diffuseness); |
---|
| 2170 | + sheenField.setFloat(material.sheen); |
---|
| 2171 | + shininessField.setFloat(material.shininess); |
---|
| 2172 | + velvetField.setFloat(material.velvet); |
---|
| 2173 | + shiftField.setFloat(material.shift); |
---|
| 2174 | + |
---|
| 2175 | + materialtouched = true; |
---|
| 2176 | + applySelf(); |
---|
| 2177 | + } |
---|
| 2178 | + }); |
---|
| 2179 | + presetpanel.add(velvet0); |
---|
| 2180 | + |
---|
| 2181 | + cLabel bump0 = GetLabel("icons/shadericons/shadericon00016.png", !Grafreed.NIMBUSLAF); |
---|
| 2182 | + bump0.setToolTipText("Bump texture"); |
---|
| 2183 | + bump0.addMouseListener(new MouseAdapter() |
---|
| 2184 | + { |
---|
| 2185 | + public void mouseClicked(MouseEvent e) |
---|
| 2186 | + { |
---|
| 2187 | + Object3D object = Grafreed.materials.versionlist[16].get(0); |
---|
| 2188 | + cMaterial material = object.material; |
---|
| 2189 | + |
---|
| 2190 | + bumpField.setFloat(object.projectedVertices[0].x / 1000.0); |
---|
| 2191 | + noiseField.setFloat(object.projectedVertices[0].y / 1000.0); |
---|
| 2192 | + powerField.setFloat(object.projectedVertices[2].x / 1000.0); |
---|
| 2193 | + |
---|
| 2194 | + materialtouched = true; |
---|
| 2195 | + applySelf(); |
---|
| 2196 | + } |
---|
| 2197 | + }); |
---|
| 2198 | + presetpanel.add(bump0); |
---|
| 2199 | + |
---|
| 2200 | + cLabel borderShader = GetLabel("icons/shadericons/borderfade.jpg", !Grafreed.NIMBUSLAF); |
---|
| 2201 | + borderShader.setToolTipText("Border fade"); |
---|
| 2202 | + borderShader.addMouseListener(new MouseAdapter() |
---|
| 2203 | + { |
---|
| 2204 | + public void mouseClicked(MouseEvent e) |
---|
| 2205 | + { |
---|
| 2206 | + borderfadeField.setFloat(0.5); |
---|
| 2207 | + opacityField.setFloat(0.75); |
---|
| 2208 | + |
---|
| 2209 | + materialtouched = true; |
---|
| 2210 | + applySelf(); |
---|
| 2211 | + } |
---|
| 2212 | + }); |
---|
| 2213 | + presetpanel.add(borderShader); |
---|
| 2214 | + |
---|
| 2215 | + cLabel halo = GetLabel("icons/shadericons/shadericon00017.png", !Grafreed.NIMBUSLAF); |
---|
| 2216 | + halo.setToolTipText("Halo"); |
---|
| 2217 | + halo.addMouseListener(new MouseAdapter() |
---|
| 2218 | + { |
---|
| 2219 | + public void mouseClicked(MouseEvent e) |
---|
| 2220 | + { |
---|
| 2221 | + Object3D object = Grafreed.materials.versionlist[17].get(0); |
---|
| 2222 | + cMaterial material = object.material; |
---|
| 2223 | + |
---|
| 2224 | + opacityPowerField.setFloat(object.projectedVertices[2].y / 1000.0); |
---|
| 2225 | + |
---|
| 2226 | + materialtouched = true; |
---|
| 2227 | + applySelf(); |
---|
| 2228 | + } |
---|
| 2229 | + }); |
---|
| 2230 | + presetpanel.add(halo); |
---|
| 2231 | + |
---|
| 2232 | + cLabel candle = GetLabel("icons/shadericons/shadericon00018.png", !Grafreed.NIMBUSLAF); |
---|
| 2233 | + candle.setToolTipText("Candle"); |
---|
| 2234 | + candle.addMouseListener(new MouseAdapter() |
---|
| 2235 | + { |
---|
| 2236 | + public void mouseClicked(MouseEvent e) |
---|
| 2237 | + { |
---|
| 2238 | + Object3D object = Grafreed.materials.versionlist[18].get(0); |
---|
| 2239 | + cMaterial material = object.material; |
---|
| 2240 | + |
---|
| 2241 | + subsurfaceField.setFloat(material.subsurface); |
---|
| 2242 | + shadowbiasField.setFloat(material.shadowbias); |
---|
| 2243 | + ambientField.setFloat(material.ambient); |
---|
| 2244 | + specularField.setFloat(material.specular); |
---|
| 2245 | + lightareaField.setFloat(material.lightarea); |
---|
| 2246 | + shininessField.setFloat(material.shininess); |
---|
| 2247 | + |
---|
| 2248 | + materialtouched = true; |
---|
| 2249 | + applySelf(); |
---|
| 2250 | + } |
---|
| 2251 | + }); |
---|
| 2252 | + presetpanel.add(candle); |
---|
| 2253 | + |
---|
| 2254 | + cLabel shadowShader = GetLabel("icons/shadericons/shadow.png", !Grafreed.NIMBUSLAF); |
---|
| 2255 | + shadowShader.setToolTipText("Shadow"); |
---|
| 2256 | + shadowShader.addMouseListener(new MouseAdapter() |
---|
| 2257 | + { |
---|
| 2258 | + public void mouseClicked(MouseEvent e) |
---|
| 2259 | + { |
---|
| 2260 | + diffuseField.setFloat(0.001); |
---|
| 2261 | + ambientField.setFloat(0.001); |
---|
| 2262 | + cameraField.setFloat(0.001); |
---|
| 2263 | + specularField.setFloat(0.001); |
---|
| 2264 | + fakedepthField.setFloat(0.001); |
---|
| 2265 | + opacityField.setFloat(0.6); |
---|
| 2266 | + |
---|
| 2267 | + materialtouched = true; |
---|
| 2268 | + applySelf(); |
---|
| 2269 | + } |
---|
| 2270 | + }); |
---|
| 2271 | + presetpanel.add(shadowShader); |
---|
| 2272 | + |
---|
| 2273 | + cGridBag panel = new cGridBag().setVertical(true); |
---|
| 2274 | + |
---|
| 2275 | + presetpanel.preferredWidth = 1; |
---|
| 2276 | + |
---|
| 2277 | + materialpanel.add(presetpanel); |
---|
| 2278 | + materialpanel.add(panel); |
---|
| 2279 | + |
---|
| 2280 | + panel.preferredWidth = 8; |
---|
| 2281 | + |
---|
| 2282 | + /* |
---|
1707 | 2283 | ctrlPanel.add(materialLabel = new JLabel("MATERIAL : "), aConstraints); |
---|
1708 | 2284 | materialLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1709 | | - */ |
---|
| 2285 | + */ |
---|
1710 | 2286 | |
---|
1711 | 2287 | cGridBag editBar = new cGridBag().setVertical(false); |
---|
1712 | 2288 | |
---|
.. | .. |
---|
1740 | 2316 | //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints); |
---|
1741 | 2317 | |
---|
1742 | 2318 | cGridBag colorSection = new cGridBag().setVertical(true); |
---|
| 2319 | + |
---|
| 2320 | + cGridBag huepanel = new cGridBag(); |
---|
| 2321 | + cGridBag huelabel = new cGridBag(); |
---|
| 2322 | + cLabel hue = GetLabel("icons/hue.png", false); |
---|
| 2323 | + hue.fit = true; |
---|
| 2324 | + |
---|
| 2325 | + hue.addMouseListener(new MouseAdapter() |
---|
| 2326 | + { |
---|
| 2327 | + public void mousePressed(MouseEvent e) |
---|
| 2328 | + { |
---|
| 2329 | + int x = e.getX(); |
---|
| 2330 | + |
---|
| 2331 | + colorField.setFloat((double)x / ((cLabel)e.getSource()).getWidth()); |
---|
| 2332 | + } |
---|
| 2333 | + }); |
---|
| 2334 | + |
---|
| 2335 | + huelabel.add(hue); |
---|
| 2336 | + huelabel.preferredWidth = 20; |
---|
| 2337 | + huepanel.add(new cGridBag()); // Label |
---|
| 2338 | + huepanel.add(huelabel); // Field/slider |
---|
| 2339 | + |
---|
| 2340 | + huepanel.preferredHeight = 7; |
---|
| 2341 | + |
---|
| 2342 | + colorSection.add(huepanel); |
---|
1743 | 2343 | |
---|
1744 | 2344 | cGridBag color = new cGridBag(); |
---|
1745 | | - color.add(colorLabel = new JLabel("Color/hue")); // , aConstraints); |
---|
1746 | | - colorLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1747 | | - color.add(colorField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
| 2345 | + |
---|
| 2346 | + color.add(colorLabel = new JLabel("Color/hue")); // , aConstraints); |
---|
| 2347 | + colorLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 2348 | + color.add(colorField = new cNumberSlider(this, 0.001, 1)); // , aConstraints); |
---|
| 2349 | + |
---|
1748 | 2350 | //colorField.preferredWidth = 200; |
---|
1749 | 2351 | colorSection.add(color); |
---|
1750 | 2352 | |
---|
1751 | 2353 | cGridBag modulation = new cGridBag(); |
---|
1752 | 2354 | modulation.add(modulationLabel = new JLabel("Saturation")); // , aConstraints); |
---|
1753 | 2355 | modulationLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1754 | | - modulation.add(modulationField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
| 2356 | + modulation.add(saturationField = new cNumberSlider(this, 0.001, 1)); // , aConstraints); |
---|
1755 | 2357 | colorSection.add(modulation); |
---|
1756 | 2358 | |
---|
| 2359 | + cGridBag opacity = new cGridBag(); |
---|
| 2360 | + opacity.add(opacityLabel = new JLabel("Opacity")); // , aConstraints); |
---|
| 2361 | + opacityLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 2362 | + opacity.add(opacityField = new cNumberSlider(this, 0.001, 1)); // , aConstraints); |
---|
| 2363 | + colorSection.add(opacity); |
---|
| 2364 | + |
---|
| 2365 | + colorSection.add(GetSeparator()); |
---|
| 2366 | + |
---|
1757 | 2367 | cGridBag texture = new cGridBag(); |
---|
1758 | 2368 | texture.add(textureLabel = new JLabel("Texture")); // , aConstraints); |
---|
1759 | 2369 | textureLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1760 | 2370 | texture.add(textureField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
1761 | 2371 | colorSection.add(texture); |
---|
1762 | 2372 | |
---|
1763 | | - panel.add(new JSeparator()); |
---|
| 2373 | + panel.add(GetSeparator()); |
---|
1764 | 2374 | |
---|
1765 | 2375 | panel.add(colorSection); |
---|
1766 | 2376 | |
---|
.. | .. |
---|
1816 | 2426 | shadowbias.add(shadowbiasField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
1817 | 2427 | diffuseSection.add(shadowbias); |
---|
1818 | 2428 | |
---|
1819 | | - panel.add(new JSeparator()); |
---|
| 2429 | + panel.add(GetSeparator()); |
---|
1820 | 2430 | |
---|
1821 | 2431 | panel.add(diffuseSection); |
---|
1822 | 2432 | |
---|
.. | .. |
---|
1879 | 2489 | specularSection.add(anisoV); |
---|
1880 | 2490 | |
---|
1881 | 2491 | |
---|
1882 | | - panel.add(new JSeparator()); |
---|
| 2492 | + panel.add(GetSeparator()); |
---|
1883 | 2493 | |
---|
1884 | 2494 | panel.add(specularSection); |
---|
1885 | 2495 | |
---|
.. | .. |
---|
1904 | 2514 | backlitLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1905 | 2515 | backlit.add(backlitField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
1906 | 2516 | colorSection.add(backlit); |
---|
1907 | | - |
---|
1908 | | - cGridBag opacity = new cGridBag(); |
---|
1909 | | - opacity.add(opacityLabel = new JLabel("Opacity")); // , aConstraints); |
---|
1910 | | - opacityLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1911 | | - opacity.add(opacityField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
1912 | | - colorSection.add(opacity); |
---|
1913 | 2517 | |
---|
1914 | 2518 | //panel.add(new JSeparator()); |
---|
1915 | 2519 | |
---|
.. | .. |
---|
1955 | 2559 | opacityPower.add(opacityPowerField = new cNumberSlider(this, 0.0, 10 /*10 dec 2013*/)); // , aConstraints); |
---|
1956 | 2560 | textureSection.add(opacityPower); |
---|
1957 | 2561 | |
---|
1958 | | - panel.add(new JSeparator()); |
---|
| 2562 | + panel.add(GetSeparator()); |
---|
1959 | 2563 | |
---|
1960 | 2564 | panel.add(textureSection); |
---|
1961 | 2565 | |
---|
.. | .. |
---|
2942 | 3546 | |
---|
2943 | 3547 | freezematerial = true; |
---|
2944 | 3548 | colorField.setFloat(mat.color); |
---|
2945 | | - modulationField.setFloat(mat.modulation); |
---|
| 3549 | + saturationField.setFloat(mat.modulation); |
---|
2946 | 3550 | metalnessField.setFloat(mat.metalness); |
---|
2947 | 3551 | diffuseField.setFloat(mat.diffuse); |
---|
2948 | 3552 | specularField.setFloat(mat.specular); |
---|
.. | .. |
---|
3004 | 3608 | |
---|
3005 | 3609 | if (multiplyToggle != null) |
---|
3006 | 3610 | multiplyToggle.setSelected(mat.multiply); |
---|
3007 | | - |
---|
3008 | | - assert (object.projectedVertices != null); |
---|
3009 | | - |
---|
3010 | | - if (object.projectedVertices.length <= 2) |
---|
3011 | | - { |
---|
3012 | | - // Side effect... |
---|
3013 | | - Object3D.cVector2[] keep = object.projectedVertices; |
---|
3014 | | - object.projectedVertices = new Object3D.cVector2[3]; |
---|
3015 | | - for (int i = 0; i < 3; i++) |
---|
3016 | | - { |
---|
3017 | | - if (i < keep.length) |
---|
3018 | | - { |
---|
3019 | | - object.projectedVertices[i] = keep[i]; |
---|
3020 | | - } else |
---|
3021 | | - { |
---|
3022 | | - object.projectedVertices[i] = new Object3D.cVector2(); |
---|
3023 | | - } |
---|
3024 | | - /* |
---|
3025 | | - if(keep.length == 0) |
---|
3026 | | - object.projectedVertices[0] = new Object3D.cVector2(); |
---|
3027 | | - else |
---|
3028 | | - object.projectedVertices[0] = keep[0]; |
---|
3029 | | - object.projectedVertices[1] = new Object3D.cVector2(); |
---|
3030 | | - */ |
---|
3031 | | - } |
---|
3032 | | - } |
---|
| 3611 | + |
---|
| 3612 | + AllocProjectedVertices(object); |
---|
3033 | 3613 | |
---|
3034 | 3614 | SetMaterial(mat, object.projectedVertices); |
---|
3035 | 3615 | } |
---|
.. | .. |
---|
3149 | 3729 | public void itemStateChanged(ItemEvent event) |
---|
3150 | 3730 | { |
---|
3151 | 3731 | // System.out.println("Propagate = " + propagate); |
---|
| 3732 | + if (event.getSource() == pinButton) |
---|
| 3733 | + { |
---|
| 3734 | + copy.pinned ^= true; |
---|
| 3735 | + if (!copy.pinned && !copy.editWindow.copy.selection.contains(copy)) |
---|
| 3736 | + { |
---|
| 3737 | + ((GroupEditor)copy.editWindow).listUI.remove(copy); |
---|
| 3738 | + copy.CloseUI(); |
---|
| 3739 | + //copy.editWindow.refreshContents(); |
---|
| 3740 | + } |
---|
| 3741 | + } |
---|
| 3742 | + else |
---|
3152 | 3743 | if (event.getSource() == propagateToggle) |
---|
3153 | 3744 | { |
---|
3154 | 3745 | propagate ^= true; |
---|
.. | .. |
---|
3253 | 3844 | } else if (event.getSource() == liveCB) |
---|
3254 | 3845 | { |
---|
3255 | 3846 | copy.live ^= true; |
---|
| 3847 | + objEditor.refreshContents(true); // To show item colors |
---|
3256 | 3848 | return; |
---|
3257 | | - } else if (event.getSource() == selectCB) |
---|
| 3849 | + } else if (event.getSource() == selectableCB) |
---|
3258 | 3850 | { |
---|
3259 | 3851 | copy.dontselect ^= true; |
---|
3260 | 3852 | return; |
---|
.. | .. |
---|
3262 | 3854 | { |
---|
3263 | 3855 | copy.hide ^= true; |
---|
3264 | 3856 | copy.Touch(); // display list issue |
---|
3265 | | - objEditor.refreshContents(); |
---|
| 3857 | + objEditor.refreshContents(true); // To show item colors |
---|
3266 | 3858 | return; |
---|
3267 | 3859 | } else if (event.getSource() == link2masterCB) |
---|
3268 | 3860 | { |
---|
.. | .. |
---|
3327 | 3919 | //System.out.println("ObjEditor " + event); |
---|
3328 | 3920 | applySelf0(true); |
---|
3329 | 3921 | //parent.applySelf(); |
---|
3330 | | - objEditor.refreshContents(); |
---|
| 3922 | + // conflicts with requestFocus objEditor.refreshContents(); |
---|
3331 | 3923 | } else if (source == resetButton) |
---|
3332 | 3924 | { |
---|
3333 | 3925 | CameraPane.fullreset = true; |
---|
.. | .. |
---|
3518 | 4110 | |
---|
3519 | 4111 | static public byte[] Compress(Object3D o) |
---|
3520 | 4112 | { |
---|
| 4113 | + // Slower to actually compress. |
---|
3521 | 4114 | try |
---|
3522 | 4115 | { |
---|
3523 | 4116 | ByteArrayOutputStream baos = new ByteArrayOutputStream(); |
---|
.. | .. |
---|
3619 | 4212 | { |
---|
3620 | 4213 | //Save(true); |
---|
3621 | 4214 | Replace(); |
---|
| 4215 | + SetVersionStates(); |
---|
3622 | 4216 | } |
---|
3623 | 4217 | |
---|
3624 | 4218 | private boolean Equal(byte[] compress, byte[] name) |
---|
.. | .. |
---|
3637 | 4231 | return true; |
---|
3638 | 4232 | } |
---|
3639 | 4233 | |
---|
3640 | | - java.util.Hashtable<java.util.UUID, Object3D> versiontable = new java.util.Hashtable<java.util.UUID, Object3D>(); |
---|
| 4234 | + void DeleteVersion() |
---|
| 4235 | + { |
---|
| 4236 | + for (int i = copy.versionindex; i < copy.versionlist.length-1; i++) |
---|
| 4237 | + { |
---|
| 4238 | + copy.versionlist[i] = copy.versionlist[i+1]; |
---|
| 4239 | + } |
---|
| 4240 | + |
---|
| 4241 | + if (copy.versionlist[copy.versionindex] == null) |
---|
| 4242 | + copy.versionindex -= 1; |
---|
| 4243 | + |
---|
| 4244 | + if (copy.versionindex != -1) |
---|
| 4245 | + CopyChanged(); |
---|
| 4246 | + |
---|
| 4247 | + SetVersionStates(); |
---|
| 4248 | + } |
---|
3641 | 4249 | |
---|
3642 | 4250 | public boolean Save(boolean user) |
---|
3643 | 4251 | { |
---|
3644 | 4252 | System.err.println("Save"); |
---|
| 4253 | + Replace(); |
---|
3645 | 4254 | |
---|
3646 | | - cRadio tab = GetCurrentTab(); |
---|
| 4255 | + //cRadio tab = GetCurrentTab(); |
---|
3647 | 4256 | |
---|
3648 | | - byte[] compress = CompressCopy(); |
---|
| 4257 | + Object3D compress = Duplicate(copy); // Saved version. No need for "Replace"? |
---|
3649 | 4258 | |
---|
3650 | 4259 | boolean thesame = false; |
---|
3651 | 4260 | |
---|
3652 | | - // Quick heuristic using length. Works only when stream is compressed. |
---|
3653 | | - if (copy.versionindex > 0 && copy.versions[copy.versionindex-1] != null && Equal(compress, copy.versions[copy.versionindex-1])) |
---|
3654 | | - { |
---|
3655 | | - thesame = true; |
---|
3656 | | - } |
---|
| 4261 | +// if (copy.versionindex > 0 && copy.versions[copy.versionindex-1] != null && Equal(compress, copy.versions[copy.versionindex-1])) |
---|
| 4262 | +// { |
---|
| 4263 | +// thesame = true; |
---|
| 4264 | +// } |
---|
3657 | 4265 | |
---|
3658 | 4266 | //EditorFrame.m_MainFrame.requestFocusInWindow(); |
---|
3659 | 4267 | if (!thesame) |
---|
3660 | 4268 | { |
---|
| 4269 | + for (int i = copy.versionlist.length; --i > copy.versionindex+1;) |
---|
| 4270 | + { |
---|
| 4271 | + copy.versionlist[i] = copy.versionlist[i-1]; |
---|
| 4272 | + } |
---|
| 4273 | + |
---|
3661 | 4274 | //tab.user[tab.versionindex] = user; |
---|
3662 | 4275 | //boolean increment = true; // tab.graphs[tab.versionindex] == null; |
---|
3663 | 4276 | |
---|
3664 | | - copy.versions[++copy.versionindex] = compress; |
---|
| 4277 | + copy.versionlist[++copy.versionindex] = compress; |
---|
3665 | 4278 | |
---|
3666 | 4279 | // if (increment) |
---|
3667 | 4280 | // tab.versionindex++; |
---|
.. | .. |
---|
3671 | 4284 | |
---|
3672 | 4285 | //assert(hashtable.isEmpty()); |
---|
3673 | 4286 | |
---|
3674 | | - for (int i = copy.versionindex+1; i < copy.versions.length; i++) |
---|
3675 | | - { |
---|
3676 | | - //tab.user[i] = false; |
---|
3677 | | - copy.versions[i] = null; |
---|
3678 | | - } |
---|
| 4287 | +// for (int i = copy.versionindex+1; i < copy.versionlist.length; i++) |
---|
| 4288 | +// { |
---|
| 4289 | +// //tab.user[i] = false; |
---|
| 4290 | +// copy.versionlist[i] = null; |
---|
| 4291 | +// } |
---|
3679 | 4292 | |
---|
3680 | | - SetUndoStates(); |
---|
| 4293 | + SetVersionStates(); |
---|
3681 | 4294 | |
---|
3682 | 4295 | // test save |
---|
3683 | 4296 | if (false) |
---|
.. | .. |
---|
3700 | 4313 | |
---|
3701 | 4314 | return !thesame; |
---|
3702 | 4315 | } |
---|
3703 | | - |
---|
3704 | | - void CopyChanged(Object3D obj) |
---|
| 4316 | + |
---|
| 4317 | + boolean flashIt = true; |
---|
| 4318 | + |
---|
| 4319 | + void RefreshSelection() |
---|
3705 | 4320 | { |
---|
3706 | | - SetUndoStates(); |
---|
| 4321 | + Object3D selection = new Object3D(); |
---|
| 4322 | + |
---|
| 4323 | + for (int i = 0; i < copy.selection.size(); i++) |
---|
| 4324 | + { |
---|
| 4325 | + Object3D elem = copy.selection.elementAt(i); |
---|
| 4326 | + |
---|
| 4327 | + Object3D obj = copy.GetObject(elem.GetUUID()); |
---|
| 4328 | + |
---|
| 4329 | + if (obj == null) |
---|
| 4330 | + { |
---|
| 4331 | + copy.selection.remove(i--); |
---|
| 4332 | + } |
---|
| 4333 | + else |
---|
| 4334 | + { |
---|
| 4335 | + selection.add(obj); |
---|
| 4336 | + copy.selection.setElementAt(obj, i); |
---|
| 4337 | + } |
---|
| 4338 | + } |
---|
| 4339 | + |
---|
| 4340 | + flashIt = false; |
---|
| 4341 | + GetTree().clearSelection(); |
---|
| 4342 | + for (int i = 0; i < selection.size(); i++) |
---|
| 4343 | + GetTree().addSelectionPath(selection.elementAt(i).GetTreePath().GetTreePath()); |
---|
| 4344 | + flashIt = true; |
---|
| 4345 | + |
---|
| 4346 | + //refreshContents(false); |
---|
| 4347 | + } |
---|
| 4348 | + |
---|
| 4349 | + void CopyChanged() |
---|
| 4350 | + { |
---|
| 4351 | + Object3D obj = (Object3D)Grafreed.clone(copy.versionlist[copy.versionindex]); |
---|
| 4352 | + |
---|
| 4353 | + SetVersionStates(); |
---|
3707 | 4354 | |
---|
3708 | 4355 | boolean temp = CameraPane.SWITCH; |
---|
3709 | 4356 | CameraPane.SWITCH = false; |
---|
3710 | 4357 | |
---|
3711 | | - copy.ExtractBigData(versiontable); |
---|
| 4358 | + copy.ExtractBigData(Grafreed.grafreed.universe.versiontable); |
---|
3712 | 4359 | |
---|
3713 | 4360 | copy.clear(); |
---|
3714 | 4361 | |
---|
| 4362 | + copy.skyboxname = obj.skyboxname; |
---|
| 4363 | + copy.skyboxext = obj.skyboxext; |
---|
| 4364 | + |
---|
3715 | 4365 | for (int i=0; i<obj.Size(); i++) |
---|
3716 | 4366 | { |
---|
3717 | 4367 | copy.add(obj.get(i)); |
---|
3718 | 4368 | } |
---|
3719 | 4369 | |
---|
3720 | | - copy.RestoreBigData(versiontable); |
---|
| 4370 | + copy.RestoreBigData(Grafreed.grafreed.universe.versiontable); |
---|
3721 | 4371 | |
---|
3722 | 4372 | CameraPane.SWITCH = temp; |
---|
3723 | 4373 | |
---|
| 4374 | + RefreshSelection(); |
---|
3724 | 4375 | //assert(hashtable.isEmpty()); |
---|
3725 | 4376 | |
---|
3726 | 4377 | copy.Touch(); |
---|
.. | .. |
---|
3741 | 4392 | } |
---|
3742 | 4393 | } |
---|
3743 | 4394 | |
---|
3744 | | - refreshContents(); |
---|
| 4395 | + refreshContents(true); |
---|
3745 | 4396 | } |
---|
3746 | 4397 | |
---|
3747 | | - cButton undoButton; |
---|
| 4398 | + cButton previousVersionButton; |
---|
3748 | 4399 | cButton restoreButton; |
---|
3749 | 4400 | cButton replaceButton; |
---|
3750 | | - cButton redoButton; |
---|
| 4401 | + cButton nextVersionButton; |
---|
| 4402 | + cButton saveVersionButton; |
---|
| 4403 | + cButton deleteVersionButton; |
---|
3751 | 4404 | |
---|
3752 | 4405 | boolean muteSlider; |
---|
3753 | 4406 | |
---|
.. | .. |
---|
3755 | 4408 | { |
---|
3756 | 4409 | int count = 0; |
---|
3757 | 4410 | |
---|
3758 | | - for (int i = copy.versions.length; --i >= 0;) |
---|
| 4411 | + for (int i = copy.versionlist.length; --i >= 0;) |
---|
3759 | 4412 | { |
---|
3760 | | - if (copy.versions[i] != null) |
---|
| 4413 | + if (copy.versionlist[i] != null) |
---|
3761 | 4414 | count++; |
---|
3762 | 4415 | } |
---|
3763 | 4416 | |
---|
3764 | 4417 | return count; |
---|
3765 | 4418 | } |
---|
3766 | 4419 | |
---|
3767 | | - void SetUndoStates() |
---|
| 4420 | + void SetVersionStates() |
---|
3768 | 4421 | { |
---|
3769 | | - cRadio tab = GetCurrentTab(); |
---|
| 4422 | + //if (true) |
---|
| 4423 | + // return; |
---|
| 4424 | + |
---|
| 4425 | + //cRadio tab = GetCurrentTab(); |
---|
3770 | 4426 | |
---|
3771 | 4427 | restoreButton.setEnabled(copy.versionindex != -1); |
---|
3772 | 4428 | replaceButton.setEnabled(copy.versionindex != -1); |
---|
3773 | 4429 | |
---|
3774 | | - undoButton.setEnabled(copy.versionindex > 0); |
---|
3775 | | - redoButton.setEnabled(copy.versions[copy.versionindex + 1] != null); |
---|
| 4430 | + previousVersionButton.setEnabled(copy.versionindex > 0); |
---|
| 4431 | + nextVersionButton.setEnabled(copy.versionlist[copy.versionindex + 1] != null); |
---|
| 4432 | + |
---|
| 4433 | + deleteVersionButton.setEnabled(copy.versionindex != -1); |
---|
| 4434 | + //copy.versionlist[copy.versionindex + 1] != null); |
---|
3776 | 4435 | |
---|
3777 | 4436 | muteSlider = true; |
---|
| 4437 | + versionSlider.setMinimum(0); |
---|
3778 | 4438 | versionSlider.setMaximum(VersionCount() - 1); |
---|
3779 | 4439 | versionSlider.setInteger(copy.versionindex); |
---|
| 4440 | + versionSlider.setEnabled(copy.versionindex != -1); |
---|
3780 | 4441 | muteSlider = false; |
---|
3781 | 4442 | } |
---|
3782 | 4443 | |
---|
3783 | | - public boolean Undo() |
---|
| 4444 | + public boolean PreviousVersion() |
---|
3784 | 4445 | { |
---|
3785 | 4446 | // Option? |
---|
3786 | 4447 | Replace(); |
---|
3787 | 4448 | |
---|
3788 | 4449 | System.err.println("Undo"); |
---|
3789 | 4450 | |
---|
3790 | | - cRadio tab = GetCurrentTab(); |
---|
| 4451 | + //cRadio tab = GetCurrentTab(); |
---|
3791 | 4452 | |
---|
3792 | 4453 | if (copy.versionindex == 0) |
---|
3793 | 4454 | { |
---|
.. | .. |
---|
3810 | 4471 | |
---|
3811 | 4472 | copy.versionindex -= 1; |
---|
3812 | 4473 | |
---|
3813 | | - CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex])); |
---|
| 4474 | + CopyChanged(); |
---|
3814 | 4475 | |
---|
3815 | 4476 | return true; |
---|
3816 | 4477 | } |
---|
.. | .. |
---|
3819 | 4480 | { |
---|
3820 | 4481 | System.err.println("Restore"); |
---|
3821 | 4482 | |
---|
3822 | | - cRadio tab = GetCurrentTab(); |
---|
| 4483 | + //cRadio tab = GetCurrentTab(); |
---|
3823 | 4484 | |
---|
3824 | | - if (copy.versionindex == -1 || copy.versions[copy.versionindex] == null) |
---|
| 4485 | + if (copy.versionindex == -1 || copy.versionlist[copy.versionindex] == null) |
---|
3825 | 4486 | { |
---|
3826 | 4487 | java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
3827 | 4488 | return false; |
---|
3828 | 4489 | } |
---|
3829 | 4490 | |
---|
3830 | | - CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex])); |
---|
| 4491 | + //CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex])); |
---|
| 4492 | + CopyChanged(); |
---|
3831 | 4493 | |
---|
3832 | 4494 | return true; |
---|
3833 | 4495 | } |
---|
3834 | 4496 | |
---|
3835 | 4497 | public boolean Replace() |
---|
3836 | 4498 | { |
---|
3837 | | - System.err.println("Replace"); |
---|
| 4499 | + //System.err.println("Replace"); |
---|
3838 | 4500 | |
---|
3839 | | - cRadio tab = GetCurrentTab(); |
---|
| 4501 | + //cRadio tab = GetCurrentTab(); |
---|
3840 | 4502 | |
---|
3841 | | - if (copy.versionindex == -1 || copy.versions[copy.versionindex] == null) |
---|
| 4503 | + if (copy.versionindex == -1 || copy.versionlist[copy.versionindex] == null) |
---|
3842 | 4504 | { |
---|
3843 | 4505 | // No version yet. OK. java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
3844 | 4506 | return false; |
---|
3845 | 4507 | } |
---|
3846 | 4508 | |
---|
3847 | | - copy.versions[copy.versionindex] = CompressCopy(); |
---|
| 4509 | + copy.versionlist[copy.versionindex] = Duplicate(copy); |
---|
3848 | 4510 | |
---|
3849 | 4511 | return true; |
---|
3850 | 4512 | } |
---|
3851 | 4513 | |
---|
3852 | | - public void Redo() |
---|
| 4514 | + public void NextVersion() |
---|
3853 | 4515 | { |
---|
3854 | 4516 | // Option? |
---|
3855 | 4517 | Replace(); |
---|
3856 | 4518 | |
---|
3857 | | - cRadio tab = GetCurrentTab(); |
---|
| 4519 | + //cRadio tab = GetCurrentTab(); |
---|
3858 | 4520 | |
---|
3859 | | - if (copy.versions[copy.versionindex + 1] == null) |
---|
| 4521 | + if (copy.versionlist[copy.versionindex + 1] == null) |
---|
3860 | 4522 | { |
---|
3861 | 4523 | java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
3862 | 4524 | return; |
---|
.. | .. |
---|
3864 | 4526 | |
---|
3865 | 4527 | copy.versionindex += 1; |
---|
3866 | 4528 | |
---|
3867 | | - CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex])); |
---|
| 4529 | + CopyChanged(); |
---|
3868 | 4530 | |
---|
3869 | 4531 | //if (!tab.user[tab.versionindex]) |
---|
3870 | 4532 | // tab.graphs[tab.versionindex] = null; |
---|
.. | .. |
---|
4078 | 4740 | //copy.material = new cMaterial(copy.GetMaterial()); |
---|
4079 | 4741 | |
---|
4080 | 4742 | current.color = (float) colorField.getFloat(); |
---|
4081 | | - current.modulation = (float) modulationField.getFloat(); |
---|
| 4743 | + current.modulation = (float) saturationField.getFloat(); |
---|
4082 | 4744 | current.metalness = (float) metalnessField.getFloat(); |
---|
4083 | 4745 | current.diffuse = (float) diffuseField.getFloat(); |
---|
4084 | 4746 | current.specular = (float) specularField.getFloat(); |
---|
.. | .. |
---|
4111 | 4773 | cMaterial mat = copy.material; |
---|
4112 | 4774 | |
---|
4113 | 4775 | colorField.SetToolTipValue((mat.color)); |
---|
4114 | | - modulationField.SetToolTipValue((mat.modulation)); |
---|
| 4776 | + saturationField.SetToolTipValue((mat.modulation)); |
---|
4115 | 4777 | metalnessField.SetToolTipValue((mat.metalness)); |
---|
4116 | 4778 | diffuseField.SetToolTipValue((mat.diffuse)); |
---|
4117 | 4779 | specularField.SetToolTipValue((mat.specular)); |
---|
.. | .. |
---|
4173 | 4835 | if (muteSlider) |
---|
4174 | 4836 | return; |
---|
4175 | 4837 | |
---|
| 4838 | + Replace(); |
---|
| 4839 | + |
---|
4176 | 4840 | int version = versionSlider.getInteger(); |
---|
4177 | 4841 | |
---|
4178 | | - if (copy.versions[version] != null) |
---|
| 4842 | + if (version != -1 && copy.versionlist[version] != null) |
---|
4179 | 4843 | { |
---|
4180 | | - CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex = version])); |
---|
| 4844 | + copy.versionindex = version; |
---|
| 4845 | + CopyChanged(); |
---|
4181 | 4846 | } |
---|
4182 | 4847 | |
---|
4183 | 4848 | return; |
---|
.. | .. |
---|
4217 | 4882 | { |
---|
4218 | 4883 | //System.out.println("stateChanged = " + this); |
---|
4219 | 4884 | materialtouched = true; |
---|
| 4885 | + |
---|
| 4886 | + if (Globals.AUTOSATURATE && e.getSource() == colorField && saturationField.getFloat() == 0.001) |
---|
| 4887 | + { |
---|
| 4888 | + saturationField.setFloat(1); |
---|
| 4889 | + } |
---|
| 4890 | + |
---|
4220 | 4891 | applySelf(); |
---|
4221 | 4892 | //System.out.println("this = " + this); |
---|
4222 | 4893 | //System.out.println("PARENT = " + parent); |
---|
.. | .. |
---|
4516 | 5187 | { |
---|
4517 | 5188 | if (GetTree() != null) |
---|
4518 | 5189 | { |
---|
| 5190 | + GetTree().revalidate(); |
---|
4519 | 5191 | GetTree().repaint(); |
---|
4520 | 5192 | } |
---|
4521 | 5193 | |
---|
.. | .. |
---|
4524 | 5196 | ctrlPanel.validate(); // ? new |
---|
4525 | 5197 | ctrlPanel.repaint(); |
---|
4526 | 5198 | } |
---|
| 5199 | + |
---|
| 5200 | + if (previousVersionButton != null && copy.versionlist != null) |
---|
| 5201 | + SetVersionStates(); |
---|
| 5202 | + |
---|
| 5203 | + cameraView.requestFocusInWindow(); |
---|
4527 | 5204 | } |
---|
4528 | 5205 | |
---|
4529 | 5206 | static TweenManager tweenManager = new TweenManager(); |
---|
.. | .. |
---|
4555 | 5232 | // group = (Composite) group.get(0); |
---|
4556 | 5233 | // } |
---|
4557 | 5234 | |
---|
4558 | | - System.out.println("makeSomething of " + thing); |
---|
| 5235 | + //System.out.println("makeSomething of " + thing); |
---|
4559 | 5236 | |
---|
4560 | 5237 | /* |
---|
4561 | 5238 | if (deselect && jList != null) |
---|
.. | .. |
---|
4772 | 5449 | readobj.ResetDisplayList(); |
---|
4773 | 5450 | } catch (Exception e) |
---|
4774 | 5451 | { |
---|
4775 | | - //e.printStackTrace(); |
---|
| 5452 | + if (!e.toString().contains("GZIP")) |
---|
| 5453 | + e.printStackTrace(); |
---|
| 5454 | + |
---|
4776 | 5455 | try |
---|
4777 | 5456 | { |
---|
4778 | 5457 | java.io.FileInputStream istream = new java.io.FileInputStream(fullname); |
---|
.. | .. |
---|
4852 | 5531 | { |
---|
4853 | 5532 | //readobj.deepCopySelf(copy); |
---|
4854 | 5533 | copy.clear(); // june 2014 |
---|
| 5534 | + copy.skyboxname = readobj.skyboxname; |
---|
| 5535 | + copy.skyboxext = readobj.skyboxext; |
---|
4855 | 5536 | for (int i = 0; i < readobj.size(); i++) |
---|
4856 | 5537 | { |
---|
4857 | 5538 | Object3D child = readobj.get(i); // reserve(i); |
---|
.. | .. |
---|
4892 | 5573 | } |
---|
4893 | 5574 | } catch (ClassCastException e) |
---|
4894 | 5575 | { |
---|
| 5576 | + e.printStackTrace(); |
---|
4895 | 5577 | assert (false); |
---|
4896 | 5578 | Composite c = (Composite) copy; |
---|
4897 | 5579 | c.children.clear(); |
---|
.. | .. |
---|
4902 | 5584 | c.addChild(csg); |
---|
4903 | 5585 | } |
---|
4904 | 5586 | |
---|
4905 | | - copy.versions = readobj.versions; |
---|
| 5587 | + copy.versionlist = readobj.versionlist; |
---|
4906 | 5588 | copy.versionindex = readobj.versionindex; |
---|
| 5589 | + copy.versiontable = readobj.versiontable; |
---|
4907 | 5590 | |
---|
4908 | | - if (copy.versions == null) |
---|
| 5591 | + if (copy.versionlist == null) |
---|
4909 | 5592 | { |
---|
4910 | | - copy.versions = new byte[100][]; |
---|
| 5593 | + // Backward compatibility |
---|
| 5594 | + copy.versionlist = new Object3D[100]; |
---|
4911 | 5595 | copy.versionindex = -1; |
---|
| 5596 | + |
---|
| 5597 | + //Save(true); |
---|
4912 | 5598 | } |
---|
4913 | 5599 | |
---|
4914 | 5600 | //? SetUndoStates(); |
---|
.. | .. |
---|
4923 | 5609 | { |
---|
4924 | 5610 | if (Grafreed.standAlone) |
---|
4925 | 5611 | { |
---|
4926 | | - FileDialog browser = new FileDialog(frame, "Load", FileDialog.LOAD); |
---|
| 5612 | + FileDialog browser = new FileDialog(frame, "Open", FileDialog.LOAD); |
---|
4927 | 5613 | browser.show(); |
---|
4928 | 5614 | String filename = browser.getFile(); |
---|
4929 | 5615 | if (filename != null && filename.length() > 0) |
---|
.. | .. |
---|
5000 | 5686 | |
---|
5001 | 5687 | void save() |
---|
5002 | 5688 | { |
---|
| 5689 | + Replace(); |
---|
| 5690 | + |
---|
5003 | 5691 | if (lastname == null) |
---|
5004 | 5692 | { |
---|
5005 | 5693 | return; |
---|
.. | .. |
---|
5022 | 5710 | //ps.print(buffer.toString()); |
---|
5023 | 5711 | } catch (IOException e) |
---|
5024 | 5712 | { |
---|
| 5713 | + e.printStackTrace(); |
---|
5025 | 5714 | } |
---|
5026 | 5715 | } |
---|
5027 | 5716 | |
---|
.. | .. |
---|
5241 | 5930 | ButtonGroup buttonGroup; |
---|
5242 | 5931 | |
---|
5243 | 5932 | cGridBag toolboxPanel; |
---|
| 5933 | + cGridBag skyboxPanel; |
---|
5244 | 5934 | cGridBag materialPanel; |
---|
5245 | 5935 | cGridBag ctrlPanel; |
---|
5246 | 5936 | |
---|
.. | .. |
---|
5314 | 6004 | JLabel colorLabel; |
---|
5315 | 6005 | cNumberSlider colorField; |
---|
5316 | 6006 | JLabel modulationLabel; |
---|
5317 | | - cNumberSlider modulationField; |
---|
| 6007 | + cNumberSlider saturationField; |
---|
5318 | 6008 | JLabel metalnessLabel; |
---|
5319 | 6009 | cNumberSlider metalnessField; |
---|
5320 | 6010 | JLabel diffuseLabel; |
---|
.. | .. |
---|
5345 | 6035 | cNumberSlider anisoField; |
---|
5346 | 6036 | JLabel anisoVLabel; |
---|
5347 | 6037 | cNumberSlider anisoVField; |
---|
| 6038 | + |
---|
5348 | 6039 | JLabel cameraLabel; |
---|
5349 | 6040 | cNumberSlider cameraField; |
---|
5350 | 6041 | JLabel selfshadowLabel; |
---|
.. | .. |
---|
5359 | 6050 | cNumberSlider fakedepthField; |
---|
5360 | 6051 | JLabel shadowbiasLabel; |
---|
5361 | 6052 | cNumberSlider shadowbiasField; |
---|
| 6053 | + |
---|
5362 | 6054 | JLabel bumpLabel; |
---|
5363 | 6055 | cNumberSlider bumpField; |
---|
5364 | 6056 | JLabel noiseLabel; |
---|