.. | .. |
---|
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 cGridBag GetSeparator() |
---|
| 47 | + { |
---|
| 48 | + cGridBag separator = new cGridBag(); |
---|
| 49 | + separator.add(new JSeparator()); |
---|
| 50 | + separator.preferredHeight = 5; |
---|
| 51 | + return separator; |
---|
| 52 | + } |
---|
44 | 53 | |
---|
45 | 54 | cButton GetButton(String name, boolean border) |
---|
46 | 55 | { |
---|
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 | | - } |
---|
| 56 | + ImageIcon icon = GetIcon(name); |
---|
| 57 | + return new cButton(icon, border); |
---|
| 58 | + } |
---|
| 59 | + |
---|
| 60 | + cLabel GetLabel(String name, boolean border) |
---|
| 61 | + { |
---|
| 62 | + //ImageIcon icon = GetIcon(name); |
---|
| 63 | + return new cLabel(GetImage(name), border); |
---|
56 | 64 | } |
---|
57 | 65 | |
---|
58 | 66 | cToggleButton GetToggleButton(String name, boolean border) |
---|
59 | 67 | { |
---|
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 | | - } |
---|
| 68 | + ImageIcon icon = GetIcon(name); |
---|
| 69 | + return new cToggleButton(icon, border); |
---|
69 | 70 | } |
---|
70 | 71 | |
---|
71 | 72 | cCheckBox GetCheckBox(String name, boolean border) |
---|
72 | 73 | { |
---|
| 74 | + ImageIcon icon = GetIcon(name); |
---|
| 75 | + return new cCheckBox(icon, border); |
---|
| 76 | + } |
---|
| 77 | + |
---|
| 78 | + static java.util.Hashtable<String, javax.swing.ImageIcon> icons = new java.util.Hashtable<String, javax.swing.ImageIcon>(); |
---|
| 79 | + |
---|
| 80 | + ImageIcon GetIcon(String name) |
---|
| 81 | + { |
---|
| 82 | + javax.swing.ImageIcon iconCache = icons.get(name); |
---|
| 83 | + if (iconCache != null) |
---|
| 84 | + { |
---|
| 85 | + return iconCache; |
---|
| 86 | + } |
---|
| 87 | + |
---|
73 | 88 | try |
---|
74 | 89 | { |
---|
75 | | - ImageIcon icon = GetIcon(name); |
---|
76 | | - return new cCheckBox(icon, border); |
---|
| 90 | + BufferedImage image = javax.imageio.ImageIO.read(getClass().getClassLoader().getResourceAsStream(name)); |
---|
| 91 | + |
---|
| 92 | +// if (image.getWidth() > 48 && image.getHeight() > 48) |
---|
| 93 | +// { |
---|
| 94 | +// BufferedImage resized = new BufferedImage(48, 48, image.getType()); |
---|
| 95 | +// Graphics2D g = resized.createGraphics(); |
---|
| 96 | +// g.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR); |
---|
| 97 | +// //g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); |
---|
| 98 | +// g.drawImage(image, 0, 0, 48, 48, 0, 0, image.getWidth(), image.getHeight(), null); |
---|
| 99 | +// g.dispose(); |
---|
| 100 | +// |
---|
| 101 | +// image = resized; |
---|
| 102 | +// } |
---|
| 103 | + |
---|
| 104 | + javax.swing.ImageIcon icon = new javax.swing.ImageIcon(image); |
---|
| 105 | + |
---|
| 106 | + icons.put(name, icon); |
---|
| 107 | + |
---|
| 108 | + return icon; |
---|
77 | 109 | } |
---|
78 | 110 | catch (Exception e) |
---|
79 | 111 | { |
---|
80 | | - return new cCheckBox(name, border); |
---|
| 112 | + //icons.put(name, null); |
---|
| 113 | + return null; |
---|
81 | 114 | } |
---|
82 | 115 | } |
---|
83 | | - |
---|
84 | | - private ImageIcon GetIcon(String name) throws IOException |
---|
| 116 | + |
---|
| 117 | + BufferedImage GetImage(String name) |
---|
85 | 118 | { |
---|
86 | | - BufferedImage image = javax.imageio.ImageIO.read(getClass().getClassLoader().getResourceAsStream(name)); |
---|
87 | | - |
---|
88 | | - if (image.getWidth() != 24 && image.getHeight() != 24) |
---|
| 119 | + try |
---|
89 | 120 | { |
---|
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; |
---|
| 121 | + BufferedImage image = javax.imageio.ImageIO.read(getClass().getClassLoader().getResourceAsStream(name)); |
---|
| 122 | + |
---|
| 123 | + return image; |
---|
98 | 124 | } |
---|
99 | | - |
---|
100 | | - javax.swing.ImageIcon icon = new javax.swing.ImageIcon(image); |
---|
101 | | - return icon; |
---|
| 125 | + catch (Exception e) |
---|
| 126 | + { |
---|
| 127 | + return null; |
---|
| 128 | + } |
---|
102 | 129 | } |
---|
103 | 130 | |
---|
104 | 131 | // SCRIPT |
---|
.. | .. |
---|
282 | 309 | client = inClient; |
---|
283 | 310 | copy = client; |
---|
284 | 311 | |
---|
| 312 | +// if (copy.versionlist == null) |
---|
| 313 | +// { |
---|
| 314 | +// copy.versionlist = new Object3D[100]; |
---|
| 315 | +// copy.versionindex = -1; |
---|
| 316 | +// |
---|
| 317 | +// callee.Save(true); |
---|
| 318 | +// } |
---|
| 319 | + |
---|
285 | 320 | // "this" is not called: SetupUI2(objEditor); |
---|
286 | 321 | } |
---|
287 | 322 | |
---|
.. | .. |
---|
295 | 330 | client = inClient; |
---|
296 | 331 | copy = client; |
---|
297 | 332 | |
---|
| 333 | + if (copy.versionlist == null) |
---|
| 334 | + { |
---|
| 335 | + copy.versionlist = new Object3D[100]; |
---|
| 336 | + copy.versionindex = -1; |
---|
| 337 | + |
---|
| 338 | +// Save(true); |
---|
| 339 | + } |
---|
| 340 | + |
---|
298 | 341 | SetupUI2(callee.GetEditor()); |
---|
299 | 342 | } |
---|
300 | 343 | |
---|
.. | .. |
---|
327 | 370 | copy = localCopy; |
---|
328 | 371 | copy.editWindow = this; |
---|
329 | 372 | |
---|
| 373 | +// if (copy.versionlist == null) |
---|
| 374 | +// { |
---|
| 375 | +// copy.versionlist = new Object3D[100]; |
---|
| 376 | +// copy.versionindex = -1; |
---|
| 377 | +// |
---|
| 378 | +// Save(true); |
---|
| 379 | +// } |
---|
| 380 | + |
---|
330 | 381 | SetupMenu(); |
---|
331 | 382 | |
---|
332 | 383 | //SetupName(objEditor); // new |
---|
.. | .. |
---|
394 | 445 | |
---|
395 | 446 | ChangeListener changeListener = new ChangeListener() |
---|
396 | 447 | { |
---|
| 448 | + //String name; |
---|
| 449 | + |
---|
397 | 450 | public void stateChanged(ChangeEvent changeEvent) |
---|
398 | 451 | { |
---|
399 | 452 | // if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Material") && !materialFlushed) |
---|
.. | .. |
---|
412 | 465 | // EditSelection(false); |
---|
413 | 466 | // } |
---|
414 | 467 | |
---|
415 | | - refreshContents(false); // To refresh Info tab |
---|
| 468 | +// if (objectPanel.getSelectedIndex() == 4) |
---|
| 469 | +// { |
---|
| 470 | +// name = copy.skyboxname; |
---|
| 471 | +// |
---|
| 472 | +// if (name == null) |
---|
| 473 | +// { |
---|
| 474 | +// name = ""; |
---|
| 475 | +// } |
---|
| 476 | +// |
---|
| 477 | +// copy.skyboxname = "cubemaps/default-skyboxes/rgb"; |
---|
| 478 | +// copy.skyboxext = "jpg"; |
---|
| 479 | +// } |
---|
| 480 | +// else |
---|
| 481 | +// { |
---|
| 482 | +// if (name != null) |
---|
| 483 | +// { |
---|
| 484 | +// if (name.equals("")) |
---|
| 485 | +// { |
---|
| 486 | +// copy.skyboxname = null; |
---|
| 487 | +// copy.skyboxext = null; |
---|
| 488 | +// } |
---|
| 489 | +// else |
---|
| 490 | +// { |
---|
| 491 | +// copy.skyboxname = name; |
---|
| 492 | +// } |
---|
| 493 | +// } |
---|
| 494 | +// } |
---|
| 495 | + cameraView.transformMode = objectPanel.getSelectedIndex() == 4; |
---|
| 496 | + |
---|
| 497 | +// refreshContents(false); // To refresh Info tab |
---|
| 498 | + cameraView.repaint(); |
---|
416 | 499 | } |
---|
417 | 500 | }; |
---|
418 | 501 | objectPanel.addChangeListener(changeListener); |
---|
419 | 502 | |
---|
420 | 503 | toolbarPanel = new JPanel(); |
---|
421 | 504 | toolbarPanel.setName("Toolbar"); |
---|
| 505 | + |
---|
422 | 506 | treePanel = new cGridBag(); |
---|
423 | 507 | treePanel.setName("Tree"); |
---|
424 | 508 | |
---|
425 | 509 | editPanel = new cGridBag().setVertical(true); |
---|
426 | | - editPanel.setName("Edit"); |
---|
| 510 | + //editPanel.setName("Edit"); |
---|
427 | 511 | |
---|
428 | 512 | ctrlPanel = new cGridBag().setVertical(false); // new GridBagLayout()); |
---|
429 | 513 | |
---|
.. | .. |
---|
431 | 515 | editPanel.add(editCommandsPanel); |
---|
432 | 516 | editPanel.add(ctrlPanel); |
---|
433 | 517 | |
---|
434 | | - toolboxPanel = new cGridBag().setVertical(false); |
---|
435 | | - toolboxPanel.setName("Toolbox"); |
---|
| 518 | + toolboxPanel = new cGridBag().setVertical(true); |
---|
| 519 | + //toolboxPanel.setName("Toolbox"); |
---|
436 | 520 | |
---|
437 | | - materialPanel = new cGridBag().setVertical(true); |
---|
438 | | - materialPanel.setName("Material"); |
---|
| 521 | + skyboxPanel = new cGridBag().setVertical(true); |
---|
| 522 | + |
---|
| 523 | + materialPanel = new cGridBag().setVertical(false); |
---|
| 524 | + //materialPanel.setName("Material"); |
---|
439 | 525 | |
---|
440 | 526 | /*JTextPane*/ |
---|
441 | 527 | infoarea = createTextPane(); |
---|
.. | .. |
---|
443 | 529 | |
---|
444 | 530 | infoarea.setEditable(true); |
---|
445 | 531 | SetText(); |
---|
| 532 | + |
---|
446 | 533 | // infoarea.setFont(infoarea.getFont().deriveFont(10, 14f)); |
---|
447 | 534 | // infoarea.setOpaque(false); |
---|
448 | 535 | // //infoarea.setForeground(textcolor); |
---|
.. | .. |
---|
450 | 537 | // TEXTAREA infoarea.setWrapStyleWord(true); |
---|
451 | 538 | infoPanel = new JScrollPane(infoarea, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); //AS_NEEDED); |
---|
452 | 539 | infoPanel.setPreferredSize(new Dimension(1, 1)); |
---|
453 | | - infoPanel.setName("Info"); |
---|
| 540 | + //infoPanel.setName("Info"); |
---|
454 | 541 | //infoPanel.setLayout(new BorderLayout()); |
---|
455 | 542 | //infoPanel.add(createTextPane()); |
---|
456 | 543 | |
---|
.. | .. |
---|
717 | 804 | boolean maximized; |
---|
718 | 805 | |
---|
719 | 806 | cButton fullscreenLayout; |
---|
| 807 | + cButton expandedLayout; |
---|
720 | 808 | |
---|
721 | 809 | void Minimize() |
---|
722 | 810 | { |
---|
.. | .. |
---|
756 | 844 | cButton minButton; |
---|
757 | 845 | cButton maxButton; |
---|
758 | 846 | cButton fullButton; |
---|
| 847 | + cButton collapseButton; |
---|
| 848 | + cButton maximize3DButton; |
---|
759 | 849 | |
---|
760 | 850 | void ToggleFullScreen() |
---|
761 | 851 | { |
---|
762 | | -GraphicsDevice device = frame.getGraphicsConfiguration().getDevice(); |
---|
| 852 | + GraphicsDevice device = frame.getGraphicsConfiguration().getDevice(); |
---|
763 | 853 | |
---|
764 | 854 | cameraView.ToggleFullScreen(); |
---|
765 | 855 | |
---|
.. | .. |
---|
780 | 870 | // X frame.getContentPane().remove(/*"Center",*/bigThree); |
---|
781 | 871 | // X framePanel.add(bigThree); |
---|
782 | 872 | // X frame.getContentPane().add(/*"Center",*/framePanel); |
---|
783 | | - framePanel.setDividerLocation(46); |
---|
| 873 | +// framePanel.setDividerLocation(46); // icons are 24x24 |
---|
784 | 874 | |
---|
785 | 875 | //frame.setVisible(true); |
---|
786 | | - radio.layout = keepButton; |
---|
| 876 | +// radio.layout = keepButton; |
---|
787 | 877 | //theFrame = null; |
---|
788 | 878 | keepButton = null; |
---|
789 | | - radio.layout.doClick(); |
---|
| 879 | +// radio.layout.doClick(); |
---|
790 | 880 | |
---|
791 | 881 | } else |
---|
792 | 882 | { |
---|
.. | .. |
---|
807 | 897 | // X frame.getContentPane().remove(/*"Center",*/framePanel); |
---|
808 | 898 | // X framePanel.remove(bigThree); |
---|
809 | 899 | // X frame.getContentPane().add(/*"Center",*/bigThree); |
---|
810 | | - framePanel.setDividerLocation(0); |
---|
| 900 | +// framePanel.setDividerLocation(0); |
---|
811 | 901 | |
---|
812 | | - radio.layout = fullscreenLayout; |
---|
813 | | - radio.layout.doClick(); |
---|
| 902 | +// radio.layout = fullscreenLayout; |
---|
| 903 | +// radio.layout.doClick(); |
---|
814 | 904 | //frame.setVisible(true); |
---|
815 | 905 | } |
---|
816 | 906 | frame.validate(); |
---|
| 907 | + |
---|
| 908 | + cameraView.requestFocusInWindow(); |
---|
817 | 909 | } |
---|
818 | 910 | |
---|
819 | | - private byte[] CompressCopy() |
---|
| 911 | + void CollapseToolbar() |
---|
| 912 | + { |
---|
| 913 | + framePanel.setDividerLocation(0); |
---|
| 914 | + //frame.validate(); |
---|
| 915 | + |
---|
| 916 | + cameraView.requestFocusInWindow(); |
---|
| 917 | + } |
---|
| 918 | + |
---|
| 919 | + private Object3D Duplicate(Object3D object) |
---|
820 | 920 | { |
---|
821 | 921 | boolean temp = CameraPane.SWITCH; |
---|
822 | 922 | CameraPane.SWITCH = false; |
---|
823 | 923 | |
---|
824 | | - copy.ExtractBigData(versiontable); |
---|
| 924 | + object.ExtractBigData(versiontable); |
---|
825 | 925 | // if (copy == client) |
---|
826 | 926 | |
---|
827 | | - byte[] versions[] = copy.versions; |
---|
828 | | - copy.versions = null; |
---|
| 927 | + Object3D versions[] = object.versionlist; |
---|
| 928 | + object.versionlist = null; |
---|
829 | 929 | |
---|
830 | | - byte[] compress = Compress(copy); |
---|
| 930 | + //byte[] compress = Compress(copy); |
---|
| 931 | + Object3D compress = (Object3D)Grafreed.clone(object); |
---|
831 | 932 | |
---|
832 | | - copy.versions = versions; |
---|
| 933 | + object.versionlist = versions; |
---|
833 | 934 | |
---|
834 | | - copy.RestoreBigData(versiontable); |
---|
| 935 | + object.RestoreBigData(versiontable); |
---|
835 | 936 | |
---|
836 | 937 | CameraPane.SWITCH = temp; |
---|
837 | 938 | |
---|
.. | .. |
---|
959 | 1060 | { |
---|
960 | 1061 | SetupMaterial(materialPanel); |
---|
961 | 1062 | } |
---|
| 1063 | + |
---|
962 | 1064 | //SetupName(); |
---|
963 | 1065 | //SetupViews(); |
---|
964 | 1066 | } |
---|
.. | .. |
---|
968 | 1070 | // NumberSlider vDivsField; |
---|
969 | 1071 | // JCheckBox endcaps; |
---|
970 | 1072 | JCheckBox liveCB; |
---|
971 | | - JCheckBox selectCB; |
---|
| 1073 | + JCheckBox selectableCB; |
---|
972 | 1074 | JCheckBox hideCB; |
---|
973 | 1075 | JCheckBox link2masterCB; |
---|
974 | 1076 | JCheckBox markCB; |
---|
.. | .. |
---|
1167 | 1269 | |
---|
1168 | 1270 | namePanel = new cGridBag(); |
---|
1169 | 1271 | |
---|
| 1272 | + //if (copy.pinned) |
---|
| 1273 | + { |
---|
| 1274 | + pinButton = GetToggleButton("icons/pin.png", !Grafreed.NIMBUSLAF); |
---|
| 1275 | + pinButton.setSelected(copy.pinned); |
---|
| 1276 | + cGridBag t = new cGridBag(); |
---|
| 1277 | + t.preferredWidth = 2; |
---|
| 1278 | + t.add(pinButton); |
---|
| 1279 | + namePanel.add(t); |
---|
| 1280 | + |
---|
| 1281 | + pinButton.addItemListener(this); |
---|
| 1282 | + } |
---|
| 1283 | + |
---|
1170 | 1284 | nameField = AddText(namePanel, copy.GetName()); |
---|
1171 | 1285 | namePanel.add(new JScrollPane(nameField, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER)); |
---|
1172 | 1286 | oe.ctrlPanel.add(namePanel); |
---|
.. | .. |
---|
1180 | 1294 | |
---|
1181 | 1295 | liveCB = AddCheckBox(setupPanel, "Live", copy.live); |
---|
1182 | 1296 | liveCB.setToolTipText("Animate object"); |
---|
1183 | | - selectCB = AddCheckBox(setupPanel, "Select", !copy.dontselect); |
---|
1184 | | - selectCB.setToolTipText("Make object selectable"); |
---|
| 1297 | + selectableCB = AddCheckBox(setupPanel, "Select", !copy.dontselect); |
---|
| 1298 | + selectableCB.setToolTipText("Make object selectable"); |
---|
1185 | 1299 | // Return(); |
---|
| 1300 | + |
---|
1186 | 1301 | hideCB = AddCheckBox(setupPanel, "Hide", copy.hide); |
---|
1187 | 1302 | hideCB.setToolTipText("Hide object"); |
---|
1188 | 1303 | markCB = AddCheckBox(setupPanel, "Mark", copy.marked); |
---|
1189 | 1304 | markCB.setToolTipText("As animation target transform"); |
---|
| 1305 | + |
---|
| 1306 | + ToolTipManager.sharedInstance().setLightWeightPopupEnabled(false); |
---|
1190 | 1307 | |
---|
1191 | 1308 | setupPanel2 = new cGridBag().setVertical(false); |
---|
1192 | 1309 | |
---|
.. | .. |
---|
1474 | 1591 | XYZPanel.addComponent(/*BorderLayout.SOUTH,*/sideView); // Scroll); |
---|
1475 | 1592 | XYZPanel.addComponent(/*BorderLayout.CENTER,*/frontView); // Scroll); |
---|
1476 | 1593 | XYZPanel.addComponent(/*BorderLayout.NORTH,*/topView); // Scroll); |
---|
| 1594 | + //XYZPanel.setName("XYZ"); |
---|
1477 | 1595 | |
---|
1478 | 1596 | /* |
---|
1479 | 1597 | gridPanel = new JPanel(); //new BorderLayout()); |
---|
.. | .. |
---|
1511 | 1629 | //JScrollPane tmp = new JScrollPane(ctrlPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); |
---|
1512 | 1630 | //tmp.setName("Edit"); |
---|
1513 | 1631 | objectPanel.add(materialPanel); |
---|
| 1632 | + objectPanel.setIconAt(0, GetIcon("icons/material.png")); |
---|
| 1633 | + objectPanel.setToolTipTextAt(0, "Material"); |
---|
| 1634 | + |
---|
| 1635 | + objectPanel.add(toolboxPanel); |
---|
| 1636 | + objectPanel.setIconAt(1, GetIcon("icons/primitives.png")); |
---|
| 1637 | + objectPanel.setToolTipTextAt(1, "Objects & textures"); |
---|
| 1638 | + |
---|
| 1639 | + objectPanel.add(skyboxPanel); |
---|
| 1640 | + objectPanel.setIconAt(2, GetIcon("icons/skybox.jpg")); |
---|
| 1641 | + objectPanel.setToolTipTextAt(2, "Backgrounds"); |
---|
| 1642 | + |
---|
1514 | 1643 | // JPanel north = new JPanel(new BorderLayout()); |
---|
1515 | 1644 | // north.setName("Edit"); |
---|
1516 | 1645 | // north.add(ctrlPanel, BorderLayout.NORTH); |
---|
1517 | 1646 | // objectPanel.add(north); |
---|
1518 | 1647 | objectPanel.add(editPanel); |
---|
| 1648 | + objectPanel.setIconAt(3, GetIcon("icons/write.png")); |
---|
| 1649 | + objectPanel.setToolTipTextAt(3, "Edit controls"); |
---|
1519 | 1650 | |
---|
1520 | | - //if (Globals.ADVANCED) |
---|
1521 | | - objectPanel.add(infoPanel); |
---|
| 1651 | + objectPanel.add(XYZPanel); |
---|
| 1652 | + objectPanel.setIconAt(4, GetIcon("icons/XYZ.png")); |
---|
| 1653 | + objectPanel.setToolTipTextAt(4, "XYZ/RGB transform"); |
---|
1522 | 1654 | |
---|
1523 | | - objectPanel.add(toolboxPanel); |
---|
1524 | | - |
---|
1525 | 1655 | /* |
---|
1526 | 1656 | aConstraints.gridx = 0; |
---|
1527 | 1657 | aConstraints.gridwidth = 1; |
---|
.. | .. |
---|
1541 | 1671 | scrollpane.addMouseWheelListener(this); // Default not fast enough |
---|
1542 | 1672 | |
---|
1543 | 1673 | /*JTabbedPane*/ scenePanel = new cGridBag(); |
---|
1544 | | - scenePanel.preferredWidth = 6; |
---|
| 1674 | + scenePanel.preferredWidth = 5; |
---|
1545 | 1675 | |
---|
1546 | 1676 | JTabbedPane tabbedPane = new JTabbedPane(); |
---|
1547 | 1677 | tabbedPane.add(scrollpane); |
---|
.. | .. |
---|
1558 | 1688 | |
---|
1559 | 1689 | scenePanel.add(tabbedPane); |
---|
1560 | 1690 | |
---|
| 1691 | + //if (Globals.ADVANCED) |
---|
| 1692 | +// tabbedPane.add(infoPanel); |
---|
| 1693 | +// tabbedPane.setIconAt(3, GetIcon("icons/info.png")); |
---|
| 1694 | +// tabbedPane.setToolTipTextAt(3, "Information"); |
---|
| 1695 | + |
---|
1561 | 1696 | /* |
---|
1562 | 1697 | cTree jTree = new cTree(null); |
---|
1563 | 1698 | ToolTipManager.sharedInstance().registerComponent(jTree); |
---|
.. | .. |
---|
1619 | 1754 | bigThree = new cGridBag(); |
---|
1620 | 1755 | bigThree.addComponent(scenePanel); |
---|
1621 | 1756 | bigThree.addComponent(centralPanel); |
---|
1622 | | - bigThree.addComponent(XYZPanel); |
---|
| 1757 | + //bigThree.addComponent(XYZPanel); |
---|
1623 | 1758 | |
---|
1624 | 1759 | // // SIDE EFFECT!!! |
---|
1625 | 1760 | // aConstraints.gridx = 0; |
---|
.. | .. |
---|
1628 | 1763 | // aConstraints.gridheight = 1; |
---|
1629 | 1764 | |
---|
1630 | 1765 | framePanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, toolbarPanel, bigThree); |
---|
| 1766 | + |
---|
| 1767 | + framePanel.addPropertyChangeListener(JSplitPane.DIVIDER_LOCATION_PROPERTY, |
---|
| 1768 | + new java.beans.PropertyChangeListener() |
---|
| 1769 | + { |
---|
| 1770 | + public void propertyChange(java.beans.PropertyChangeEvent pce) |
---|
| 1771 | + { |
---|
| 1772 | + if ((Integer)pce.getOldValue() == 1) |
---|
| 1773 | + { |
---|
| 1774 | + if (radio.layout != expandedLayout) |
---|
| 1775 | + { |
---|
| 1776 | + radio.layout = expandedLayout; |
---|
| 1777 | + radio.layout.doClick(); |
---|
| 1778 | + } |
---|
| 1779 | + } |
---|
| 1780 | + } |
---|
| 1781 | + }); |
---|
| 1782 | + |
---|
1631 | 1783 | framePanel.setContinuousLayout(false); |
---|
1632 | 1784 | framePanel.setOneTouchExpandable(false); |
---|
1633 | 1785 | //.setDividerLocation(0.8); |
---|
.. | .. |
---|
1660 | 1812 | frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); |
---|
1661 | 1813 | frame.addWindowListener(new WindowAdapter() |
---|
1662 | 1814 | { |
---|
1663 | | - |
---|
1664 | 1815 | public void windowClosing(WindowEvent e) |
---|
1665 | 1816 | { |
---|
1666 | 1817 | Close(); |
---|
.. | .. |
---|
1683 | 1834 | ctrlPanel.removeAll(); |
---|
1684 | 1835 | } |
---|
1685 | 1836 | |
---|
1686 | | - void SetupMaterial(cGridBag panel) |
---|
| 1837 | + void SetupMaterial(cGridBag materialpanel) |
---|
1687 | 1838 | { |
---|
1688 | | - /* |
---|
| 1839 | + cGridBag presetpanel = new cGridBag().setVertical(true); |
---|
| 1840 | + |
---|
| 1841 | + cLabel skin = GetLabel("icons/shadericons/shadericon00000.png", !Grafreed.NIMBUSLAF); |
---|
| 1842 | + skin.setToolTipText("Skin"); |
---|
| 1843 | + skin.addMouseListener(new MouseAdapter() |
---|
| 1844 | + { |
---|
| 1845 | + public void mouseClicked(MouseEvent e) |
---|
| 1846 | + { |
---|
| 1847 | + Object3D object = Grafreed.materials.versionlist[0].get(0); |
---|
| 1848 | + cMaterial material = object.material; |
---|
| 1849 | + |
---|
| 1850 | + // Skin |
---|
| 1851 | + colorField.setFloat(material.color); |
---|
| 1852 | + saturationField.setFloat(material.modulation); |
---|
| 1853 | + subsurfaceField.setFloat(material.subsurface); |
---|
| 1854 | + selfshadowField.setFloat(material.diffuseness); |
---|
| 1855 | + diffusenessField.setFloat(material.factor); |
---|
| 1856 | + shininessField.setFloat(material.shininess); |
---|
| 1857 | + shadowbiasField.setFloat(material.shadowbias); |
---|
| 1858 | + diffuseField.setFloat(material.diffuse); |
---|
| 1859 | + specularField.setFloat(material.specular); |
---|
| 1860 | + |
---|
| 1861 | + bumpField.setFloat(object.projectedVertices[0].x / 1000.0); |
---|
| 1862 | + noiseField.setFloat(object.projectedVertices[0].y / 1000.0); |
---|
| 1863 | + powerField.setFloat(object.projectedVertices[2].x / 1000.0); |
---|
| 1864 | + |
---|
| 1865 | + materialtouched = true; |
---|
| 1866 | + applySelf(); |
---|
| 1867 | + } |
---|
| 1868 | + }); |
---|
| 1869 | + presetpanel.add(skin); |
---|
| 1870 | + |
---|
| 1871 | + cLabel lambert = GetLabel("icons/shadericons/shadericon00002.png", !Grafreed.NIMBUSLAF); |
---|
| 1872 | + lambert.setToolTipText("Diffuse"); |
---|
| 1873 | + lambert.addMouseListener(new MouseAdapter() |
---|
| 1874 | + { |
---|
| 1875 | + public void mouseClicked(MouseEvent e) |
---|
| 1876 | + { |
---|
| 1877 | + Object3D object = Grafreed.materials.versionlist[2].get(0); |
---|
| 1878 | + cMaterial material = object.material; |
---|
| 1879 | + |
---|
| 1880 | + diffusenessField.setFloat(material.factor); |
---|
| 1881 | + selfshadowField.setFloat(material.diffuseness); |
---|
| 1882 | + |
---|
| 1883 | + materialtouched = true; |
---|
| 1884 | + applySelf(); |
---|
| 1885 | + } |
---|
| 1886 | + }); |
---|
| 1887 | + presetpanel.add(lambert); |
---|
| 1888 | + |
---|
| 1889 | + cLabel diffuse2 = GetLabel("icons/shadericons/shadericon00003.png", !Grafreed.NIMBUSLAF); |
---|
| 1890 | + diffuse2.setToolTipText("Diffuse2"); |
---|
| 1891 | + diffuse2.addMouseListener(new MouseAdapter() |
---|
| 1892 | + { |
---|
| 1893 | + public void mouseClicked(MouseEvent e) |
---|
| 1894 | + { |
---|
| 1895 | + Object3D object = Grafreed.materials.versionlist[3].get(0); |
---|
| 1896 | + cMaterial material = object.material; |
---|
| 1897 | + |
---|
| 1898 | + diffusenessField.setFloat(material.factor); |
---|
| 1899 | + selfshadowField.setFloat(material.diffuseness); |
---|
| 1900 | + |
---|
| 1901 | + materialtouched = true; |
---|
| 1902 | + applySelf(); |
---|
| 1903 | + } |
---|
| 1904 | + }); |
---|
| 1905 | + presetpanel.add(diffuse2); |
---|
| 1906 | + |
---|
| 1907 | + cLabel diffusemoon = GetLabel("icons/shadericons/shadericon00004.png", !Grafreed.NIMBUSLAF); |
---|
| 1908 | + diffusemoon.setToolTipText("Moon"); |
---|
| 1909 | + diffusemoon.addMouseListener(new MouseAdapter() |
---|
| 1910 | + { |
---|
| 1911 | + public void mouseClicked(MouseEvent e) |
---|
| 1912 | + { |
---|
| 1913 | + Object3D object = Grafreed.materials.versionlist[4].get(0); |
---|
| 1914 | + cMaterial material = object.material; |
---|
| 1915 | + |
---|
| 1916 | + diffusenessField.setFloat(material.factor); |
---|
| 1917 | + selfshadowField.setFloat(material.diffuseness); |
---|
| 1918 | + |
---|
| 1919 | + materialtouched = true; |
---|
| 1920 | + applySelf(); |
---|
| 1921 | + } |
---|
| 1922 | + }); |
---|
| 1923 | + presetpanel.add(diffusemoon); |
---|
| 1924 | + |
---|
| 1925 | + cLabel diffusemoon2 = GetLabel("icons/shadericons/shadericon00005.png", !Grafreed.NIMBUSLAF); |
---|
| 1926 | + diffusemoon2.setToolTipText("Moon2"); |
---|
| 1927 | + diffusemoon2.addMouseListener(new MouseAdapter() |
---|
| 1928 | + { |
---|
| 1929 | + public void mouseClicked(MouseEvent e) |
---|
| 1930 | + { |
---|
| 1931 | + Object3D object = Grafreed.materials.versionlist[5].get(0); |
---|
| 1932 | + cMaterial material = object.material; |
---|
| 1933 | + |
---|
| 1934 | + diffusenessField.setFloat(material.factor); |
---|
| 1935 | + selfshadowField.setFloat(material.diffuseness); |
---|
| 1936 | + |
---|
| 1937 | + materialtouched = true; |
---|
| 1938 | + applySelf(); |
---|
| 1939 | + } |
---|
| 1940 | + }); |
---|
| 1941 | + presetpanel.add(diffusemoon2); |
---|
| 1942 | + |
---|
| 1943 | + cLabel diffusemoon3 = GetLabel("icons/shadericons/shadericon00006.png", !Grafreed.NIMBUSLAF); |
---|
| 1944 | + diffusemoon3.setToolTipText("Moon3"); |
---|
| 1945 | + diffusemoon3.addMouseListener(new MouseAdapter() |
---|
| 1946 | + { |
---|
| 1947 | + public void mouseClicked(MouseEvent e) |
---|
| 1948 | + { |
---|
| 1949 | + Object3D object = Grafreed.materials.versionlist[6].get(0); |
---|
| 1950 | + cMaterial material = object.material; |
---|
| 1951 | + |
---|
| 1952 | + diffusenessField.setFloat(material.factor); |
---|
| 1953 | + selfshadowField.setFloat(material.diffuseness); |
---|
| 1954 | + |
---|
| 1955 | + materialtouched = true; |
---|
| 1956 | + applySelf(); |
---|
| 1957 | + } |
---|
| 1958 | + }); |
---|
| 1959 | + presetpanel.add(diffusemoon3); |
---|
| 1960 | + |
---|
| 1961 | + cLabel diffusesheen = GetLabel("icons/shadericons/shadericon00007.png", !Grafreed.NIMBUSLAF); |
---|
| 1962 | + diffusesheen.setToolTipText("Sheen"); |
---|
| 1963 | + diffusesheen.addMouseListener(new MouseAdapter() |
---|
| 1964 | + { |
---|
| 1965 | + public void mouseClicked(MouseEvent e) |
---|
| 1966 | + { |
---|
| 1967 | + Object3D object = Grafreed.materials.versionlist[7].get(0); |
---|
| 1968 | + cMaterial material = object.material; |
---|
| 1969 | + |
---|
| 1970 | + sheenField.setFloat(material.sheen); |
---|
| 1971 | + |
---|
| 1972 | + materialtouched = true; |
---|
| 1973 | + applySelf(); |
---|
| 1974 | + } |
---|
| 1975 | + }); |
---|
| 1976 | + presetpanel.add(diffusesheen); |
---|
| 1977 | + |
---|
| 1978 | + cLabel rough = GetLabel("icons/shadericons/shadericon00001.png", !Grafreed.NIMBUSLAF); |
---|
| 1979 | + rough.setToolTipText("Rough metal"); |
---|
| 1980 | + rough.addMouseListener(new MouseAdapter() |
---|
| 1981 | + { |
---|
| 1982 | + public void mouseClicked(MouseEvent e) |
---|
| 1983 | + { |
---|
| 1984 | + Object3D object = Grafreed.materials.versionlist[1].get(0); |
---|
| 1985 | + cMaterial material = object.material; |
---|
| 1986 | + |
---|
| 1987 | + shininessField.setFloat(material.shininess); |
---|
| 1988 | + velvetField.setFloat(material.velvet); |
---|
| 1989 | + |
---|
| 1990 | + materialtouched = true; |
---|
| 1991 | + applySelf(); |
---|
| 1992 | + } |
---|
| 1993 | + }); |
---|
| 1994 | + presetpanel.add(rough); |
---|
| 1995 | + |
---|
| 1996 | + cLabel rough2 = GetLabel("icons/shadericons/shadericon00013.png", !Grafreed.NIMBUSLAF); |
---|
| 1997 | + rough2.setToolTipText("Medium metal"); |
---|
| 1998 | + rough2.addMouseListener(new MouseAdapter() |
---|
| 1999 | + { |
---|
| 2000 | + public void mouseClicked(MouseEvent e) |
---|
| 2001 | + { |
---|
| 2002 | + Object3D object = Grafreed.materials.versionlist[13].get(0); |
---|
| 2003 | + cMaterial material = object.material; |
---|
| 2004 | + |
---|
| 2005 | + shininessField.setFloat(material.shininess); |
---|
| 2006 | + lightareaField.setFloat(material.lightarea); |
---|
| 2007 | + |
---|
| 2008 | + materialtouched = true; |
---|
| 2009 | + applySelf(); |
---|
| 2010 | + } |
---|
| 2011 | + }); |
---|
| 2012 | + presetpanel.add(rough2); |
---|
| 2013 | + |
---|
| 2014 | + cLabel shini0 = GetLabel("icons/shadericons/shadericon00014.png", !Grafreed.NIMBUSLAF); |
---|
| 2015 | + shini0.setToolTipText("Shiny"); |
---|
| 2016 | + shini0.addMouseListener(new MouseAdapter() |
---|
| 2017 | + { |
---|
| 2018 | + public void mouseClicked(MouseEvent e) |
---|
| 2019 | + { |
---|
| 2020 | + Object3D object = Grafreed.materials.versionlist[14].get(0); |
---|
| 2021 | + cMaterial material = object.material; |
---|
| 2022 | + |
---|
| 2023 | + shininessField.setFloat(material.shininess); |
---|
| 2024 | + lightareaField.setFloat(material.lightarea); |
---|
| 2025 | + |
---|
| 2026 | + materialtouched = true; |
---|
| 2027 | + applySelf(); |
---|
| 2028 | + } |
---|
| 2029 | + }); |
---|
| 2030 | + presetpanel.add(shini0); |
---|
| 2031 | + |
---|
| 2032 | + cLabel shini1 = GetLabel("icons/shadericons/shadericon00011.png", !Grafreed.NIMBUSLAF); |
---|
| 2033 | + shini1.setToolTipText("Shiny2"); |
---|
| 2034 | + shini1.addMouseListener(new MouseAdapter() |
---|
| 2035 | + { |
---|
| 2036 | + public void mouseClicked(MouseEvent e) |
---|
| 2037 | + { |
---|
| 2038 | + Object3D object = Grafreed.materials.versionlist[11].get(0); |
---|
| 2039 | + cMaterial material = object.material; |
---|
| 2040 | + |
---|
| 2041 | + shininessField.setFloat(material.shininess); |
---|
| 2042 | + lightareaField.setFloat(material.lightarea); |
---|
| 2043 | + |
---|
| 2044 | + materialtouched = true; |
---|
| 2045 | + applySelf(); |
---|
| 2046 | + } |
---|
| 2047 | + }); |
---|
| 2048 | + presetpanel.add(shini1); |
---|
| 2049 | + |
---|
| 2050 | + cLabel shini2 = GetLabel("icons/shadericons/shadericon00012.png", !Grafreed.NIMBUSLAF); |
---|
| 2051 | + shini2.setToolTipText("Shiny3"); |
---|
| 2052 | + shini2.addMouseListener(new MouseAdapter() |
---|
| 2053 | + { |
---|
| 2054 | + public void mouseClicked(MouseEvent e) |
---|
| 2055 | + { |
---|
| 2056 | + Object3D object = Grafreed.materials.versionlist[12].get(0); |
---|
| 2057 | + cMaterial material = object.material; |
---|
| 2058 | + |
---|
| 2059 | + shininessField.setFloat(material.shininess); |
---|
| 2060 | + lightareaField.setFloat(material.lightarea); |
---|
| 2061 | + |
---|
| 2062 | + materialtouched = true; |
---|
| 2063 | + applySelf(); |
---|
| 2064 | + } |
---|
| 2065 | + }); |
---|
| 2066 | + presetpanel.add(shini2); |
---|
| 2067 | + |
---|
| 2068 | + cLabel aniso = GetLabel("icons/shadericons/shadericon00008.png", !Grafreed.NIMBUSLAF); |
---|
| 2069 | + aniso.setToolTipText("AnisoU"); |
---|
| 2070 | + aniso.addMouseListener(new MouseAdapter() |
---|
| 2071 | + { |
---|
| 2072 | + public void mouseClicked(MouseEvent e) |
---|
| 2073 | + { |
---|
| 2074 | + Object3D object = Grafreed.materials.versionlist[8].get(0); |
---|
| 2075 | + cMaterial material = object.material; |
---|
| 2076 | + |
---|
| 2077 | + anisoField.setFloat(material.aniso); |
---|
| 2078 | + anisoVField.setFloat(material.anisoV); |
---|
| 2079 | + |
---|
| 2080 | + materialtouched = true; |
---|
| 2081 | + applySelf(); |
---|
| 2082 | + } |
---|
| 2083 | + }); |
---|
| 2084 | + presetpanel.add(aniso); |
---|
| 2085 | + |
---|
| 2086 | + cLabel aniso2 = GetLabel("icons/shadericons/shadericon00009.png", !Grafreed.NIMBUSLAF); |
---|
| 2087 | + aniso2.setToolTipText("AnisoV"); |
---|
| 2088 | + aniso2.addMouseListener(new MouseAdapter() |
---|
| 2089 | + { |
---|
| 2090 | + public void mouseClicked(MouseEvent e) |
---|
| 2091 | + { |
---|
| 2092 | + Object3D object = Grafreed.materials.versionlist[9].get(0); |
---|
| 2093 | + cMaterial material = object.material; |
---|
| 2094 | + |
---|
| 2095 | + anisoField.setFloat(material.aniso); |
---|
| 2096 | + anisoVField.setFloat(material.anisoV); |
---|
| 2097 | + |
---|
| 2098 | + materialtouched = true; |
---|
| 2099 | + applySelf(); |
---|
| 2100 | + } |
---|
| 2101 | + }); |
---|
| 2102 | + presetpanel.add(aniso2); |
---|
| 2103 | + |
---|
| 2104 | + cLabel aniso3 = GetLabel("icons/shadericons/shadericon00010.png", !Grafreed.NIMBUSLAF); |
---|
| 2105 | + aniso3.setToolTipText("AnisoUV"); |
---|
| 2106 | + aniso3.addMouseListener(new MouseAdapter() |
---|
| 2107 | + { |
---|
| 2108 | + public void mouseClicked(MouseEvent e) |
---|
| 2109 | + { |
---|
| 2110 | + Object3D object = Grafreed.materials.versionlist[10].get(0); |
---|
| 2111 | + cMaterial material = object.material; |
---|
| 2112 | + |
---|
| 2113 | + anisoField.setFloat(material.aniso); |
---|
| 2114 | + anisoVField.setFloat(material.anisoV); |
---|
| 2115 | + |
---|
| 2116 | + materialtouched = true; |
---|
| 2117 | + applySelf(); |
---|
| 2118 | + } |
---|
| 2119 | + }); |
---|
| 2120 | + presetpanel.add(aniso3); |
---|
| 2121 | + |
---|
| 2122 | + cLabel velvet0 = GetLabel("icons/shadericons/shadericon00015.png", !Grafreed.NIMBUSLAF); |
---|
| 2123 | + velvet0.setToolTipText("Velvet"); |
---|
| 2124 | + velvet0.addMouseListener(new MouseAdapter() |
---|
| 2125 | + { |
---|
| 2126 | + public void mouseClicked(MouseEvent e) |
---|
| 2127 | + { |
---|
| 2128 | + Object3D object = Grafreed.materials.versionlist[15].get(0); |
---|
| 2129 | + cMaterial material = object.material; |
---|
| 2130 | + |
---|
| 2131 | + diffusenessField.setFloat(material.factor); |
---|
| 2132 | + selfshadowField.setFloat(material.diffuseness); |
---|
| 2133 | + sheenField.setFloat(material.sheen); |
---|
| 2134 | + shininessField.setFloat(material.shininess); |
---|
| 2135 | + velvetField.setFloat(material.velvet); |
---|
| 2136 | + shiftField.setFloat(material.shift); |
---|
| 2137 | + |
---|
| 2138 | + materialtouched = true; |
---|
| 2139 | + applySelf(); |
---|
| 2140 | + } |
---|
| 2141 | + }); |
---|
| 2142 | + presetpanel.add(velvet0); |
---|
| 2143 | + |
---|
| 2144 | + cLabel bump0 = GetLabel("icons/shadericons/shadericon00016.png", !Grafreed.NIMBUSLAF); |
---|
| 2145 | + bump0.setToolTipText("Bump texture"); |
---|
| 2146 | + bump0.addMouseListener(new MouseAdapter() |
---|
| 2147 | + { |
---|
| 2148 | + public void mouseClicked(MouseEvent e) |
---|
| 2149 | + { |
---|
| 2150 | + Object3D object = Grafreed.materials.versionlist[16].get(0); |
---|
| 2151 | + cMaterial material = object.material; |
---|
| 2152 | + |
---|
| 2153 | + bumpField.setFloat(object.projectedVertices[0].x / 1000.0); |
---|
| 2154 | + noiseField.setFloat(object.projectedVertices[0].y / 1000.0); |
---|
| 2155 | + powerField.setFloat(object.projectedVertices[2].x / 1000.0); |
---|
| 2156 | + |
---|
| 2157 | + materialtouched = true; |
---|
| 2158 | + applySelf(); |
---|
| 2159 | + } |
---|
| 2160 | + }); |
---|
| 2161 | + presetpanel.add(bump0); |
---|
| 2162 | + |
---|
| 2163 | + cLabel halo = GetLabel("icons/shadericons/shadericon00017.png", !Grafreed.NIMBUSLAF); |
---|
| 2164 | + halo.setToolTipText("Halo"); |
---|
| 2165 | + halo.addMouseListener(new MouseAdapter() |
---|
| 2166 | + { |
---|
| 2167 | + public void mouseClicked(MouseEvent e) |
---|
| 2168 | + { |
---|
| 2169 | + Object3D object = Grafreed.materials.versionlist[17].get(0); |
---|
| 2170 | + cMaterial material = object.material; |
---|
| 2171 | + |
---|
| 2172 | + opacityPowerField.setFloat(object.projectedVertices[2].y / 1000.0); |
---|
| 2173 | + |
---|
| 2174 | + materialtouched = true; |
---|
| 2175 | + applySelf(); |
---|
| 2176 | + } |
---|
| 2177 | + }); |
---|
| 2178 | + presetpanel.add(halo); |
---|
| 2179 | + |
---|
| 2180 | + cLabel candle = GetLabel("icons/shadericons/shadericon00018.png", !Grafreed.NIMBUSLAF); |
---|
| 2181 | + candle.setToolTipText("Candle"); |
---|
| 2182 | + candle.addMouseListener(new MouseAdapter() |
---|
| 2183 | + { |
---|
| 2184 | + public void mouseClicked(MouseEvent e) |
---|
| 2185 | + { |
---|
| 2186 | + Object3D object = Grafreed.materials.versionlist[18].get(0); |
---|
| 2187 | + cMaterial material = object.material; |
---|
| 2188 | + |
---|
| 2189 | + subsurfaceField.setFloat(material.subsurface); |
---|
| 2190 | + shadowbiasField.setFloat(material.shadowbias); |
---|
| 2191 | + ambientField.setFloat(material.ambient); |
---|
| 2192 | + specularField.setFloat(material.specular); |
---|
| 2193 | + lightareaField.setFloat(material.lightarea); |
---|
| 2194 | + shininessField.setFloat(material.shininess); |
---|
| 2195 | + |
---|
| 2196 | + materialtouched = true; |
---|
| 2197 | + applySelf(); |
---|
| 2198 | + } |
---|
| 2199 | + }); |
---|
| 2200 | + presetpanel.add(candle); |
---|
| 2201 | + |
---|
| 2202 | + cLabel shadowShader = GetLabel("icons/shadericons/shadow.png", !Grafreed.NIMBUSLAF); |
---|
| 2203 | + shadowShader.setToolTipText("Shadow"); |
---|
| 2204 | + shadowShader.addMouseListener(new MouseAdapter() |
---|
| 2205 | + { |
---|
| 2206 | + public void mouseClicked(MouseEvent e) |
---|
| 2207 | + { |
---|
| 2208 | + diffuseField.setFloat(0.001); |
---|
| 2209 | + ambientField.setFloat(0.001); |
---|
| 2210 | + cameraField.setFloat(0.001); |
---|
| 2211 | + specularField.setFloat(0.001); |
---|
| 2212 | + fakedepthField.setFloat(0.001); |
---|
| 2213 | + opacityField.setFloat(0.6); |
---|
| 2214 | + |
---|
| 2215 | + materialtouched = true; |
---|
| 2216 | + applySelf(); |
---|
| 2217 | + } |
---|
| 2218 | + }); |
---|
| 2219 | + presetpanel.add(shadowShader); |
---|
| 2220 | + |
---|
| 2221 | + cGridBag panel = new cGridBag().setVertical(true); |
---|
| 2222 | + |
---|
| 2223 | + presetpanel.preferredWidth = 1; |
---|
| 2224 | + |
---|
| 2225 | + materialpanel.add(presetpanel); |
---|
| 2226 | + materialpanel.add(panel); |
---|
| 2227 | + |
---|
| 2228 | + panel.preferredWidth = 8; |
---|
| 2229 | + |
---|
| 2230 | + /* |
---|
1689 | 2231 | ctrlPanel.add(materialLabel = new JLabel("MATERIAL : "), aConstraints); |
---|
1690 | 2232 | materialLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1691 | | - */ |
---|
| 2233 | + */ |
---|
1692 | 2234 | |
---|
1693 | 2235 | cGridBag editBar = new cGridBag().setVertical(false); |
---|
1694 | 2236 | |
---|
.. | .. |
---|
1722 | 2264 | //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints); |
---|
1723 | 2265 | |
---|
1724 | 2266 | cGridBag colorSection = new cGridBag().setVertical(true); |
---|
| 2267 | + |
---|
| 2268 | + cGridBag huepanel = new cGridBag(); |
---|
| 2269 | + cGridBag huelabel = new cGridBag(); |
---|
| 2270 | + skin = GetLabel("icons/hue.png", false); |
---|
| 2271 | + skin.fit = true; |
---|
| 2272 | + huelabel.add(skin); |
---|
| 2273 | + huelabel.preferredWidth = 20; |
---|
| 2274 | + huepanel.add(new cGridBag()); // Label |
---|
| 2275 | + huepanel.add(huelabel); // Field/slider |
---|
| 2276 | + |
---|
| 2277 | + huepanel.preferredHeight = 7; |
---|
| 2278 | + |
---|
| 2279 | + colorSection.add(huepanel); |
---|
1725 | 2280 | |
---|
1726 | 2281 | cGridBag color = new cGridBag(); |
---|
1727 | | - color.add(colorLabel = new JLabel("Color/hue")); // , aConstraints); |
---|
1728 | | - colorLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1729 | | - color.add(colorField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
| 2282 | + |
---|
| 2283 | + color.add(colorLabel = new JLabel("Color/hue")); // , aConstraints); |
---|
| 2284 | + colorLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 2285 | + color.add(colorField = new cNumberSlider(this, 0.001, 1)); // , aConstraints); |
---|
| 2286 | + |
---|
1730 | 2287 | //colorField.preferredWidth = 200; |
---|
1731 | 2288 | colorSection.add(color); |
---|
1732 | 2289 | |
---|
1733 | 2290 | cGridBag modulation = new cGridBag(); |
---|
1734 | 2291 | modulation.add(modulationLabel = new JLabel("Saturation")); // , aConstraints); |
---|
1735 | 2292 | modulationLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1736 | | - modulation.add(modulationField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
| 2293 | + modulation.add(saturationField = new cNumberSlider(this, 0.001, 1)); // , aConstraints); |
---|
1737 | 2294 | colorSection.add(modulation); |
---|
1738 | 2295 | |
---|
| 2296 | + cGridBag opacity = new cGridBag(); |
---|
| 2297 | + opacity.add(opacityLabel = new JLabel("Opacity")); // , aConstraints); |
---|
| 2298 | + opacityLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 2299 | + opacity.add(opacityField = new cNumberSlider(this, 0.001, 1)); // , aConstraints); |
---|
| 2300 | + colorSection.add(opacity); |
---|
| 2301 | + |
---|
| 2302 | + colorSection.add(GetSeparator()); |
---|
| 2303 | + |
---|
1739 | 2304 | cGridBag texture = new cGridBag(); |
---|
1740 | 2305 | texture.add(textureLabel = new JLabel("Texture")); // , aConstraints); |
---|
1741 | 2306 | textureLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1742 | 2307 | texture.add(textureField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
1743 | 2308 | colorSection.add(texture); |
---|
1744 | 2309 | |
---|
1745 | | - panel.add(new JSeparator()); |
---|
| 2310 | + panel.add(GetSeparator()); |
---|
1746 | 2311 | |
---|
1747 | 2312 | panel.add(colorSection); |
---|
1748 | 2313 | |
---|
.. | .. |
---|
1798 | 2363 | shadowbias.add(shadowbiasField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
1799 | 2364 | diffuseSection.add(shadowbias); |
---|
1800 | 2365 | |
---|
1801 | | - panel.add(new JSeparator()); |
---|
| 2366 | + panel.add(GetSeparator()); |
---|
1802 | 2367 | |
---|
1803 | 2368 | panel.add(diffuseSection); |
---|
1804 | 2369 | |
---|
.. | .. |
---|
1861 | 2426 | specularSection.add(anisoV); |
---|
1862 | 2427 | |
---|
1863 | 2428 | |
---|
1864 | | - panel.add(new JSeparator()); |
---|
| 2429 | + panel.add(GetSeparator()); |
---|
1865 | 2430 | |
---|
1866 | 2431 | panel.add(specularSection); |
---|
1867 | 2432 | |
---|
.. | .. |
---|
1886 | 2451 | backlitLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1887 | 2452 | backlit.add(backlitField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
1888 | 2453 | colorSection.add(backlit); |
---|
1889 | | - |
---|
1890 | | - cGridBag opacity = new cGridBag(); |
---|
1891 | | - opacity.add(opacityLabel = new JLabel("Opacity")); // , aConstraints); |
---|
1892 | | - opacityLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1893 | | - opacity.add(opacityField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
1894 | | - colorSection.add(opacity); |
---|
1895 | 2454 | |
---|
1896 | 2455 | //panel.add(new JSeparator()); |
---|
1897 | 2456 | |
---|
.. | .. |
---|
1937 | 2496 | opacityPower.add(opacityPowerField = new cNumberSlider(this, 0.0, 10 /*10 dec 2013*/)); // , aConstraints); |
---|
1938 | 2497 | textureSection.add(opacityPower); |
---|
1939 | 2498 | |
---|
1940 | | - panel.add(new JSeparator()); |
---|
| 2499 | + panel.add(GetSeparator()); |
---|
1941 | 2500 | |
---|
1942 | 2501 | panel.add(textureSection); |
---|
1943 | 2502 | |
---|
.. | .. |
---|
2924 | 3483 | |
---|
2925 | 3484 | freezematerial = true; |
---|
2926 | 3485 | colorField.setFloat(mat.color); |
---|
2927 | | - modulationField.setFloat(mat.modulation); |
---|
| 3486 | + saturationField.setFloat(mat.modulation); |
---|
2928 | 3487 | metalnessField.setFloat(mat.metalness); |
---|
2929 | 3488 | diffuseField.setFloat(mat.diffuse); |
---|
2930 | 3489 | specularField.setFloat(mat.specular); |
---|
.. | .. |
---|
3131 | 3690 | public void itemStateChanged(ItemEvent event) |
---|
3132 | 3691 | { |
---|
3133 | 3692 | // System.out.println("Propagate = " + propagate); |
---|
| 3693 | + if (event.getSource() == pinButton) |
---|
| 3694 | + { |
---|
| 3695 | + copy.pinned ^= true; |
---|
| 3696 | + if (!copy.pinned && !copy.editWindow.copy.selection.contains(copy)) |
---|
| 3697 | + { |
---|
| 3698 | + ((GroupEditor)copy.editWindow).listUI.remove(copy); |
---|
| 3699 | + copy.CloseUI(); |
---|
| 3700 | + //copy.editWindow.refreshContents(); |
---|
| 3701 | + } |
---|
| 3702 | + } |
---|
| 3703 | + else |
---|
3134 | 3704 | if (event.getSource() == propagateToggle) |
---|
3135 | 3705 | { |
---|
3136 | 3706 | propagate ^= true; |
---|
.. | .. |
---|
3235 | 3805 | } else if (event.getSource() == liveCB) |
---|
3236 | 3806 | { |
---|
3237 | 3807 | copy.live ^= true; |
---|
| 3808 | + objEditor.refreshContents(true); // To show item colors |
---|
3238 | 3809 | return; |
---|
3239 | | - } else if (event.getSource() == selectCB) |
---|
| 3810 | + } else if (event.getSource() == selectableCB) |
---|
3240 | 3811 | { |
---|
3241 | 3812 | copy.dontselect ^= true; |
---|
3242 | 3813 | return; |
---|
.. | .. |
---|
3244 | 3815 | { |
---|
3245 | 3816 | copy.hide ^= true; |
---|
3246 | 3817 | copy.Touch(); // display list issue |
---|
3247 | | - objEditor.refreshContents(); |
---|
| 3818 | + objEditor.refreshContents(true); // To show item colors |
---|
3248 | 3819 | return; |
---|
3249 | 3820 | } else if (event.getSource() == link2masterCB) |
---|
3250 | 3821 | { |
---|
.. | .. |
---|
3500 | 4071 | |
---|
3501 | 4072 | static public byte[] Compress(Object3D o) |
---|
3502 | 4073 | { |
---|
| 4074 | + // Slower to actually compress. |
---|
3503 | 4075 | try |
---|
3504 | 4076 | { |
---|
3505 | 4077 | ByteArrayOutputStream baos = new ByteArrayOutputStream(); |
---|
.. | .. |
---|
3601 | 4173 | { |
---|
3602 | 4174 | //Save(true); |
---|
3603 | 4175 | Replace(); |
---|
| 4176 | + SetVersionStates(); |
---|
3604 | 4177 | } |
---|
3605 | 4178 | |
---|
3606 | 4179 | private boolean Equal(byte[] compress, byte[] name) |
---|
.. | .. |
---|
3621 | 4194 | |
---|
3622 | 4195 | java.util.Hashtable<java.util.UUID, Object3D> versiontable = new java.util.Hashtable<java.util.UUID, Object3D>(); |
---|
3623 | 4196 | |
---|
| 4197 | + void DeleteVersion() |
---|
| 4198 | + { |
---|
| 4199 | + for (int i = copy.versionindex; i < copy.versionlist.length-1; i++) |
---|
| 4200 | + { |
---|
| 4201 | + copy.versionlist[i] = copy.versionlist[i+1]; |
---|
| 4202 | + } |
---|
| 4203 | + |
---|
| 4204 | + CopyChanged(); |
---|
| 4205 | + |
---|
| 4206 | + SetVersionStates(); |
---|
| 4207 | + } |
---|
| 4208 | + |
---|
3624 | 4209 | public boolean Save(boolean user) |
---|
3625 | 4210 | { |
---|
3626 | 4211 | System.err.println("Save"); |
---|
| 4212 | + Replace(); |
---|
3627 | 4213 | |
---|
3628 | | - cRadio tab = GetCurrentTab(); |
---|
| 4214 | + //cRadio tab = GetCurrentTab(); |
---|
3629 | 4215 | |
---|
3630 | | - byte[] compress = CompressCopy(); |
---|
| 4216 | + Object3D compress = Duplicate(copy); // Saved version. No need for "Replace"? |
---|
3631 | 4217 | |
---|
3632 | 4218 | boolean thesame = false; |
---|
3633 | 4219 | |
---|
3634 | | - // Quick heuristic using length. Works only when stream is compressed. |
---|
3635 | | - if (copy.versionindex > 0 && copy.versions[copy.versionindex-1] != null && Equal(compress, copy.versions[copy.versionindex-1])) |
---|
3636 | | - { |
---|
3637 | | - thesame = true; |
---|
3638 | | - } |
---|
| 4220 | +// if (copy.versionindex > 0 && copy.versions[copy.versionindex-1] != null && Equal(compress, copy.versions[copy.versionindex-1])) |
---|
| 4221 | +// { |
---|
| 4222 | +// thesame = true; |
---|
| 4223 | +// } |
---|
3639 | 4224 | |
---|
3640 | 4225 | //EditorFrame.m_MainFrame.requestFocusInWindow(); |
---|
3641 | 4226 | if (!thesame) |
---|
3642 | 4227 | { |
---|
| 4228 | + for (int i = copy.versionlist.length; --i > copy.versionindex+1;) |
---|
| 4229 | + { |
---|
| 4230 | + copy.versionlist[i] = copy.versionlist[i-1]; |
---|
| 4231 | + } |
---|
| 4232 | + |
---|
3643 | 4233 | //tab.user[tab.versionindex] = user; |
---|
3644 | 4234 | //boolean increment = true; // tab.graphs[tab.versionindex] == null; |
---|
3645 | 4235 | |
---|
3646 | | - copy.versions[++copy.versionindex] = compress; |
---|
| 4236 | + copy.versionlist[++copy.versionindex] = compress; |
---|
3647 | 4237 | |
---|
3648 | 4238 | // if (increment) |
---|
3649 | 4239 | // tab.versionindex++; |
---|
.. | .. |
---|
3653 | 4243 | |
---|
3654 | 4244 | //assert(hashtable.isEmpty()); |
---|
3655 | 4245 | |
---|
3656 | | - for (int i = copy.versionindex+1; i < copy.versions.length; i++) |
---|
3657 | | - { |
---|
3658 | | - //tab.user[i] = false; |
---|
3659 | | - copy.versions[i] = null; |
---|
3660 | | - } |
---|
| 4246 | +// for (int i = copy.versionindex+1; i < copy.versionlist.length; i++) |
---|
| 4247 | +// { |
---|
| 4248 | +// //tab.user[i] = false; |
---|
| 4249 | +// copy.versionlist[i] = null; |
---|
| 4250 | +// } |
---|
3661 | 4251 | |
---|
3662 | | - SetUndoStates(); |
---|
| 4252 | + SetVersionStates(); |
---|
3663 | 4253 | |
---|
3664 | 4254 | // test save |
---|
3665 | 4255 | if (false) |
---|
.. | .. |
---|
3682 | 4272 | |
---|
3683 | 4273 | return !thesame; |
---|
3684 | 4274 | } |
---|
3685 | | - |
---|
3686 | | - void CopyChanged(Object3D obj) |
---|
| 4275 | + |
---|
| 4276 | + boolean flashIt = true; |
---|
| 4277 | + |
---|
| 4278 | + void RefreshSelection() |
---|
3687 | 4279 | { |
---|
3688 | | - SetUndoStates(); |
---|
| 4280 | + Object3D selection = new Object3D(); |
---|
| 4281 | + |
---|
| 4282 | + for (int i = 0; i < copy.selection.size(); i++) |
---|
| 4283 | + { |
---|
| 4284 | + Object3D elem = copy.selection.elementAt(i); |
---|
| 4285 | + |
---|
| 4286 | + Object3D obj = copy.GetObject(elem.GetUUID()); |
---|
| 4287 | + |
---|
| 4288 | + if (obj == null) |
---|
| 4289 | + { |
---|
| 4290 | + copy.selection.remove(i--); |
---|
| 4291 | + } |
---|
| 4292 | + else |
---|
| 4293 | + { |
---|
| 4294 | + selection.add(obj); |
---|
| 4295 | + copy.selection.setElementAt(obj, i); |
---|
| 4296 | + } |
---|
| 4297 | + } |
---|
| 4298 | + |
---|
| 4299 | + flashIt = false; |
---|
| 4300 | + GetTree().clearSelection(); |
---|
| 4301 | + for (int i = 0; i < selection.size(); i++) |
---|
| 4302 | + GetTree().addSelectionPath(selection.elementAt(i).GetTreePath().GetTreePath()); |
---|
| 4303 | + flashIt = true; |
---|
| 4304 | + |
---|
| 4305 | + //refreshContents(false); |
---|
| 4306 | + } |
---|
| 4307 | + |
---|
| 4308 | + void CopyChanged() |
---|
| 4309 | + { |
---|
| 4310 | + Object3D obj = (Object3D)Grafreed.clone(copy.versionlist[copy.versionindex]); |
---|
| 4311 | + |
---|
| 4312 | + SetVersionStates(); |
---|
3689 | 4313 | |
---|
3690 | 4314 | boolean temp = CameraPane.SWITCH; |
---|
3691 | 4315 | CameraPane.SWITCH = false; |
---|
.. | .. |
---|
3694 | 4318 | |
---|
3695 | 4319 | copy.clear(); |
---|
3696 | 4320 | |
---|
| 4321 | + copy.skyboxname = obj.skyboxname; |
---|
| 4322 | + copy.skyboxext = obj.skyboxext; |
---|
| 4323 | + |
---|
3697 | 4324 | for (int i=0; i<obj.Size(); i++) |
---|
3698 | 4325 | { |
---|
3699 | 4326 | copy.add(obj.get(i)); |
---|
.. | .. |
---|
3703 | 4330 | |
---|
3704 | 4331 | CameraPane.SWITCH = temp; |
---|
3705 | 4332 | |
---|
| 4333 | + RefreshSelection(); |
---|
3706 | 4334 | //assert(hashtable.isEmpty()); |
---|
3707 | 4335 | |
---|
3708 | 4336 | copy.Touch(); |
---|
.. | .. |
---|
3723 | 4351 | } |
---|
3724 | 4352 | } |
---|
3725 | 4353 | |
---|
3726 | | - refreshContents(); |
---|
| 4354 | + refreshContents(true); |
---|
3727 | 4355 | } |
---|
3728 | 4356 | |
---|
3729 | | - cButton undoButton; |
---|
| 4357 | + cButton previousVersionButton; |
---|
3730 | 4358 | cButton restoreButton; |
---|
3731 | 4359 | cButton replaceButton; |
---|
3732 | | - cButton redoButton; |
---|
| 4360 | + cButton nextVersionButton; |
---|
| 4361 | + cButton saveVersionButton; |
---|
| 4362 | + cButton deleteVersionButton; |
---|
3733 | 4363 | |
---|
3734 | | - void SetUndoStates() |
---|
| 4364 | + boolean muteSlider; |
---|
| 4365 | + |
---|
| 4366 | + int VersionCount() |
---|
3735 | 4367 | { |
---|
3736 | | - cRadio tab = GetCurrentTab(); |
---|
| 4368 | + int count = 0; |
---|
| 4369 | + |
---|
| 4370 | + for (int i = copy.versionlist.length; --i >= 0;) |
---|
| 4371 | + { |
---|
| 4372 | + if (copy.versionlist[i] != null) |
---|
| 4373 | + count++; |
---|
| 4374 | + } |
---|
| 4375 | + |
---|
| 4376 | + return count; |
---|
| 4377 | + } |
---|
| 4378 | + |
---|
| 4379 | + void SetVersionStates() |
---|
| 4380 | + { |
---|
| 4381 | + //if (true) |
---|
| 4382 | + // return; |
---|
| 4383 | + |
---|
| 4384 | + //cRadio tab = GetCurrentTab(); |
---|
3737 | 4385 | |
---|
3738 | 4386 | restoreButton.setEnabled(copy.versionindex != -1); |
---|
3739 | 4387 | replaceButton.setEnabled(copy.versionindex != -1); |
---|
3740 | | - undoButton.setEnabled(copy.versionindex > 0); |
---|
3741 | | - redoButton.setEnabled(copy.versions[copy.versionindex + 1] != null); |
---|
| 4388 | + |
---|
| 4389 | + previousVersionButton.setEnabled(copy.versionindex > 0); |
---|
| 4390 | + nextVersionButton.setEnabled(copy.versionlist[copy.versionindex + 1] != null); |
---|
| 4391 | + |
---|
| 4392 | + deleteVersionButton.setEnabled(//copy.versionindex > 0 && |
---|
| 4393 | + copy.versionlist[copy.versionindex + 1] != null); |
---|
| 4394 | + |
---|
| 4395 | + muteSlider = true; |
---|
| 4396 | + versionSlider.setMinimum(0); |
---|
| 4397 | + versionSlider.setMaximum(VersionCount() - 1); |
---|
| 4398 | + versionSlider.setInteger(copy.versionindex); |
---|
| 4399 | + versionSlider.setEnabled(copy.versionindex != -1); |
---|
| 4400 | + muteSlider = false; |
---|
3742 | 4401 | } |
---|
3743 | 4402 | |
---|
3744 | | - public boolean Undo() |
---|
| 4403 | + public boolean PreviousVersion() |
---|
3745 | 4404 | { |
---|
| 4405 | + // Option? |
---|
| 4406 | + Replace(); |
---|
| 4407 | + |
---|
3746 | 4408 | System.err.println("Undo"); |
---|
3747 | 4409 | |
---|
3748 | | - cRadio tab = GetCurrentTab(); |
---|
| 4410 | + //cRadio tab = GetCurrentTab(); |
---|
3749 | 4411 | |
---|
3750 | 4412 | if (copy.versionindex == 0) |
---|
3751 | 4413 | { |
---|
.. | .. |
---|
3768 | 4430 | |
---|
3769 | 4431 | copy.versionindex -= 1; |
---|
3770 | 4432 | |
---|
3771 | | - CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex])); |
---|
| 4433 | + CopyChanged(); |
---|
3772 | 4434 | |
---|
3773 | 4435 | return true; |
---|
3774 | 4436 | } |
---|
.. | .. |
---|
3777 | 4439 | { |
---|
3778 | 4440 | System.err.println("Restore"); |
---|
3779 | 4441 | |
---|
3780 | | - cRadio tab = GetCurrentTab(); |
---|
| 4442 | + //cRadio tab = GetCurrentTab(); |
---|
3781 | 4443 | |
---|
3782 | | - if (copy.versionindex == -1 || copy.versions[copy.versionindex] == null) |
---|
| 4444 | + if (copy.versionindex == -1 || copy.versionlist[copy.versionindex] == null) |
---|
3783 | 4445 | { |
---|
3784 | 4446 | java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
3785 | 4447 | return false; |
---|
3786 | 4448 | } |
---|
3787 | 4449 | |
---|
3788 | | - CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex])); |
---|
| 4450 | + //CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex])); |
---|
| 4451 | + CopyChanged(); |
---|
3789 | 4452 | |
---|
3790 | 4453 | return true; |
---|
3791 | 4454 | } |
---|
.. | .. |
---|
3794 | 4457 | { |
---|
3795 | 4458 | System.err.println("Replace"); |
---|
3796 | 4459 | |
---|
3797 | | - cRadio tab = GetCurrentTab(); |
---|
| 4460 | + //cRadio tab = GetCurrentTab(); |
---|
3798 | 4461 | |
---|
3799 | | - if (copy.versionindex == -1 || copy.versions[copy.versionindex] == null) |
---|
| 4462 | + if (copy.versionindex == -1 || copy.versionlist[copy.versionindex] == null) |
---|
3800 | 4463 | { |
---|
3801 | 4464 | // No version yet. OK. java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
3802 | 4465 | return false; |
---|
3803 | 4466 | } |
---|
3804 | 4467 | |
---|
3805 | | - copy.versions[copy.versionindex] = CompressCopy(); |
---|
| 4468 | + copy.versionlist[copy.versionindex] = Duplicate(copy); |
---|
3806 | 4469 | |
---|
3807 | 4470 | return true; |
---|
3808 | 4471 | } |
---|
3809 | 4472 | |
---|
3810 | | - public void Redo() |
---|
| 4473 | + public void NextVersion() |
---|
3811 | 4474 | { |
---|
3812 | | - cRadio tab = GetCurrentTab(); |
---|
| 4475 | + // Option? |
---|
| 4476 | + Replace(); |
---|
3813 | 4477 | |
---|
3814 | | - if (copy.versions[copy.versionindex + 1] == null) |
---|
| 4478 | + //cRadio tab = GetCurrentTab(); |
---|
| 4479 | + |
---|
| 4480 | + if (copy.versionlist[copy.versionindex + 1] == null) |
---|
3815 | 4481 | { |
---|
3816 | 4482 | java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
3817 | 4483 | return; |
---|
.. | .. |
---|
3819 | 4485 | |
---|
3820 | 4486 | copy.versionindex += 1; |
---|
3821 | 4487 | |
---|
3822 | | - CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex])); |
---|
| 4488 | + CopyChanged(); |
---|
3823 | 4489 | |
---|
3824 | 4490 | //if (!tab.user[tab.versionindex]) |
---|
3825 | 4491 | // tab.graphs[tab.versionindex] = null; |
---|
.. | .. |
---|
4033 | 4699 | //copy.material = new cMaterial(copy.GetMaterial()); |
---|
4034 | 4700 | |
---|
4035 | 4701 | current.color = (float) colorField.getFloat(); |
---|
4036 | | - current.modulation = (float) modulationField.getFloat(); |
---|
| 4702 | + current.modulation = (float) saturationField.getFloat(); |
---|
4037 | 4703 | current.metalness = (float) metalnessField.getFloat(); |
---|
4038 | 4704 | current.diffuse = (float) diffuseField.getFloat(); |
---|
4039 | 4705 | current.specular = (float) specularField.getFloat(); |
---|
.. | .. |
---|
4066 | 4732 | cMaterial mat = copy.material; |
---|
4067 | 4733 | |
---|
4068 | 4734 | colorField.SetToolTipValue((mat.color)); |
---|
4069 | | - modulationField.SetToolTipValue((mat.modulation)); |
---|
| 4735 | + saturationField.SetToolTipValue((mat.modulation)); |
---|
4070 | 4736 | metalnessField.SetToolTipValue((mat.metalness)); |
---|
4071 | 4737 | diffuseField.SetToolTipValue((mat.diffuse)); |
---|
4072 | 4738 | specularField.SetToolTipValue((mat.specular)); |
---|
.. | .. |
---|
4118 | 4784 | //copy.Touch(); |
---|
4119 | 4785 | } |
---|
4120 | 4786 | |
---|
4121 | | - cNumberSlider versionField; |
---|
| 4787 | + cNumberSlider versionSlider; |
---|
4122 | 4788 | |
---|
4123 | 4789 | public void stateChanged(ChangeEvent e) |
---|
4124 | 4790 | { |
---|
4125 | 4791 | // assert(false); |
---|
4126 | | - if (e.getSource() == versionField) |
---|
| 4792 | + if (e.getSource() == versionSlider) |
---|
4127 | 4793 | { |
---|
4128 | | - int version = versionField.getInteger(); |
---|
| 4794 | + if (muteSlider) |
---|
| 4795 | + return; |
---|
4129 | 4796 | |
---|
4130 | | - if (copy.versions[version] != null) |
---|
| 4797 | + Replace(); |
---|
| 4798 | + |
---|
| 4799 | + int version = versionSlider.getInteger(); |
---|
| 4800 | + |
---|
| 4801 | + if (version != -1 && copy.versionlist[version] != null) |
---|
4131 | 4802 | { |
---|
4132 | | - CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex = version])); |
---|
| 4803 | + copy.versionindex = version; |
---|
| 4804 | + CopyChanged(); |
---|
4133 | 4805 | } |
---|
4134 | 4806 | |
---|
4135 | 4807 | return; |
---|
.. | .. |
---|
4169 | 4841 | { |
---|
4170 | 4842 | //System.out.println("stateChanged = " + this); |
---|
4171 | 4843 | materialtouched = true; |
---|
| 4844 | + |
---|
| 4845 | + if (Globals.AUTOSATURATE && e.getSource() == colorField && saturationField.getFloat() == 0.001) |
---|
| 4846 | + { |
---|
| 4847 | + saturationField.setFloat(1); |
---|
| 4848 | + } |
---|
| 4849 | + |
---|
4172 | 4850 | applySelf(); |
---|
4173 | 4851 | //System.out.println("this = " + this); |
---|
4174 | 4852 | //System.out.println("PARENT = " + parent); |
---|
.. | .. |
---|
4468 | 5146 | { |
---|
4469 | 5147 | if (GetTree() != null) |
---|
4470 | 5148 | { |
---|
| 5149 | + GetTree().revalidate(); |
---|
4471 | 5150 | GetTree().repaint(); |
---|
4472 | 5151 | } |
---|
4473 | 5152 | |
---|
.. | .. |
---|
4476 | 5155 | ctrlPanel.validate(); // ? new |
---|
4477 | 5156 | ctrlPanel.repaint(); |
---|
4478 | 5157 | } |
---|
| 5158 | + |
---|
| 5159 | + if (previousVersionButton != null && copy.versionlist != null) |
---|
| 5160 | + SetVersionStates(); |
---|
4479 | 5161 | } |
---|
4480 | 5162 | |
---|
4481 | 5163 | static TweenManager tweenManager = new TweenManager(); |
---|
.. | .. |
---|
4724 | 5406 | readobj.ResetDisplayList(); |
---|
4725 | 5407 | } catch (Exception e) |
---|
4726 | 5408 | { |
---|
4727 | | - //e.printStackTrace(); |
---|
| 5409 | + if (!e.toString().contains("GZIP")) |
---|
| 5410 | + e.printStackTrace(); |
---|
| 5411 | + |
---|
4728 | 5412 | try |
---|
4729 | 5413 | { |
---|
4730 | 5414 | java.io.FileInputStream istream = new java.io.FileInputStream(fullname); |
---|
.. | .. |
---|
4804 | 5488 | { |
---|
4805 | 5489 | //readobj.deepCopySelf(copy); |
---|
4806 | 5490 | copy.clear(); // june 2014 |
---|
| 5491 | + copy.skyboxname = readobj.skyboxname; |
---|
| 5492 | + copy.skyboxext = readobj.skyboxext; |
---|
4807 | 5493 | for (int i = 0; i < readobj.size(); i++) |
---|
4808 | 5494 | { |
---|
4809 | 5495 | Object3D child = readobj.get(i); // reserve(i); |
---|
.. | .. |
---|
4844 | 5530 | } |
---|
4845 | 5531 | } catch (ClassCastException e) |
---|
4846 | 5532 | { |
---|
| 5533 | + e.printStackTrace(); |
---|
4847 | 5534 | assert (false); |
---|
4848 | 5535 | Composite c = (Composite) copy; |
---|
4849 | 5536 | c.children.clear(); |
---|
.. | .. |
---|
4854 | 5541 | c.addChild(csg); |
---|
4855 | 5542 | } |
---|
4856 | 5543 | |
---|
4857 | | - copy.versions = readobj.versions; |
---|
| 5544 | + copy.versionlist = readobj.versionlist; |
---|
4858 | 5545 | copy.versionindex = readobj.versionindex; |
---|
4859 | 5546 | |
---|
4860 | | - SetUndoStates(); |
---|
| 5547 | + if (copy.versionlist == null) |
---|
| 5548 | + { |
---|
| 5549 | + // Backward compatibility |
---|
| 5550 | + copy.versionlist = new Object3D[100]; |
---|
| 5551 | + copy.versionindex = -1; |
---|
| 5552 | + |
---|
| 5553 | + Save(true); |
---|
| 5554 | + } |
---|
| 5555 | + |
---|
| 5556 | + //? SetUndoStates(); |
---|
4861 | 5557 | |
---|
4862 | 5558 | ResetModel(); |
---|
4863 | 5559 | copy.HardTouch(); // recompile? |
---|
.. | .. |
---|
4869 | 5565 | { |
---|
4870 | 5566 | if (Grafreed.standAlone) |
---|
4871 | 5567 | { |
---|
4872 | | - FileDialog browser = new FileDialog(frame, "Load", FileDialog.LOAD); |
---|
| 5568 | + FileDialog browser = new FileDialog(frame, "Open", FileDialog.LOAD); |
---|
4873 | 5569 | browser.show(); |
---|
4874 | 5570 | String filename = browser.getFile(); |
---|
4875 | 5571 | if (filename != null && filename.length() > 0) |
---|
.. | .. |
---|
4946 | 5642 | |
---|
4947 | 5643 | void save() |
---|
4948 | 5644 | { |
---|
| 5645 | + Replace(); |
---|
| 5646 | + |
---|
4949 | 5647 | if (lastname == null) |
---|
4950 | 5648 | { |
---|
4951 | 5649 | return; |
---|
.. | .. |
---|
4968 | 5666 | //ps.print(buffer.toString()); |
---|
4969 | 5667 | } catch (IOException e) |
---|
4970 | 5668 | { |
---|
| 5669 | + e.printStackTrace(); |
---|
4971 | 5670 | } |
---|
4972 | 5671 | } |
---|
4973 | 5672 | |
---|
.. | .. |
---|
5187 | 5886 | ButtonGroup buttonGroup; |
---|
5188 | 5887 | |
---|
5189 | 5888 | cGridBag toolboxPanel; |
---|
| 5889 | + cGridBag skyboxPanel; |
---|
5190 | 5890 | cGridBag materialPanel; |
---|
5191 | 5891 | cGridBag ctrlPanel; |
---|
5192 | 5892 | |
---|
.. | .. |
---|
5260 | 5960 | JLabel colorLabel; |
---|
5261 | 5961 | cNumberSlider colorField; |
---|
5262 | 5962 | JLabel modulationLabel; |
---|
5263 | | - cNumberSlider modulationField; |
---|
| 5963 | + cNumberSlider saturationField; |
---|
5264 | 5964 | JLabel metalnessLabel; |
---|
5265 | 5965 | cNumberSlider metalnessField; |
---|
5266 | 5966 | JLabel diffuseLabel; |
---|
.. | .. |
---|
5291 | 5991 | cNumberSlider anisoField; |
---|
5292 | 5992 | JLabel anisoVLabel; |
---|
5293 | 5993 | cNumberSlider anisoVField; |
---|
| 5994 | + |
---|
5294 | 5995 | JLabel cameraLabel; |
---|
5295 | 5996 | cNumberSlider cameraField; |
---|
5296 | 5997 | JLabel selfshadowLabel; |
---|
.. | .. |
---|
5305 | 6006 | cNumberSlider fakedepthField; |
---|
5306 | 6007 | JLabel shadowbiasLabel; |
---|
5307 | 6008 | cNumberSlider shadowbiasField; |
---|
| 6009 | + |
---|
5308 | 6010 | JLabel bumpLabel; |
---|
5309 | 6011 | cNumberSlider bumpField; |
---|
5310 | 6012 | JLabel noiseLabel; |
---|