.. | .. |
---|
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); |
---|
| 85 | + ImageIcon icon = GetIcon(name); |
---|
| 86 | + if (icon != null || name.contains("/")) |
---|
50 | 87 | return new cButton(icon, border); |
---|
51 | | - } |
---|
52 | | - catch (Exception e) |
---|
53 | | - { |
---|
| 88 | + else |
---|
54 | 89 | return new cButton(name, border); |
---|
55 | | - } |
---|
| 90 | + } |
---|
| 91 | + |
---|
| 92 | + cLabel GetLabel(String name, boolean border) |
---|
| 93 | + { |
---|
| 94 | + //ImageIcon icon = GetIcon(name); |
---|
| 95 | + return new cLabel(GetImage(name), border); |
---|
56 | 96 | } |
---|
57 | 97 | |
---|
58 | 98 | cToggleButton GetToggleButton(String name, boolean border) |
---|
59 | 99 | { |
---|
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 | | - } |
---|
| 100 | + ImageIcon icon = GetIcon(name); |
---|
| 101 | + return new cToggleButton(icon, border); |
---|
69 | 102 | } |
---|
70 | 103 | |
---|
71 | 104 | cCheckBox GetCheckBox(String name, boolean border) |
---|
72 | 105 | { |
---|
| 106 | + ImageIcon icon = GetIcon(name); |
---|
| 107 | + return new cCheckBox(icon, border); |
---|
| 108 | + } |
---|
| 109 | + |
---|
| 110 | + static java.util.Hashtable<String, javax.swing.ImageIcon> icons = new java.util.Hashtable<String, javax.swing.ImageIcon>(); |
---|
| 111 | + |
---|
| 112 | + static ImageIcon GetIcon(String name) |
---|
| 113 | + { |
---|
| 114 | + javax.swing.ImageIcon iconCache = icons.get(name); |
---|
| 115 | + if (iconCache != null) |
---|
| 116 | + { |
---|
| 117 | + return iconCache; |
---|
| 118 | + } |
---|
| 119 | + |
---|
73 | 120 | try |
---|
74 | 121 | { |
---|
75 | | - ImageIcon icon = GetIcon(name); |
---|
76 | | - return new cCheckBox(icon, border); |
---|
| 122 | + BufferedImage image = javax.imageio.ImageIO.read(ObjEditor.class.getClassLoader().getResourceAsStream(name)); |
---|
| 123 | + |
---|
| 124 | +// if (image.getWidth() > 48 && image.getHeight() > 48) |
---|
| 125 | +// { |
---|
| 126 | +// BufferedImage resized = new BufferedImage(48, 48, image.getType()); |
---|
| 127 | +// Graphics2D g = resized.createGraphics(); |
---|
| 128 | +// g.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR); |
---|
| 129 | +// //g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); |
---|
| 130 | +// g.drawImage(image, 0, 0, 48, 48, 0, 0, image.getWidth(), image.getHeight(), null); |
---|
| 131 | +// g.dispose(); |
---|
| 132 | +// |
---|
| 133 | +// image = resized; |
---|
| 134 | +// } |
---|
| 135 | + |
---|
| 136 | + javax.swing.ImageIcon icon = new javax.swing.ImageIcon(image); |
---|
| 137 | + |
---|
| 138 | + icons.put(name, icon); |
---|
| 139 | + |
---|
| 140 | + return icon; |
---|
77 | 141 | } |
---|
78 | 142 | catch (Exception e) |
---|
79 | 143 | { |
---|
80 | | - return new cCheckBox(name, border); |
---|
| 144 | + //icons.put(name, null); |
---|
| 145 | + return null; |
---|
81 | 146 | } |
---|
82 | 147 | } |
---|
83 | | - |
---|
84 | | - private ImageIcon GetIcon(String name) throws IOException |
---|
| 148 | + |
---|
| 149 | + BufferedImage GetImage(String name) |
---|
85 | 150 | { |
---|
86 | | - BufferedImage image = javax.imageio.ImageIO.read(getClass().getClassLoader().getResourceAsStream(name)); |
---|
87 | | - |
---|
88 | | - if (image.getWidth() != 24 && image.getHeight() != 24) |
---|
| 151 | + try |
---|
89 | 152 | { |
---|
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; |
---|
| 153 | + BufferedImage image = javax.imageio.ImageIO.read(getClass().getClassLoader().getResourceAsStream(name)); |
---|
| 154 | + |
---|
| 155 | + return image; |
---|
98 | 156 | } |
---|
99 | | - |
---|
100 | | - javax.swing.ImageIcon icon = new javax.swing.ImageIcon(image); |
---|
101 | | - return icon; |
---|
| 157 | + catch (Exception e) |
---|
| 158 | + { |
---|
| 159 | + return null; |
---|
| 160 | + } |
---|
102 | 161 | } |
---|
103 | 162 | |
---|
104 | 163 | // SCRIPT |
---|
.. | .. |
---|
282 | 341 | client = inClient; |
---|
283 | 342 | copy = client; |
---|
284 | 343 | |
---|
| 344 | +// if (copy.versionlist == null) |
---|
| 345 | +// { |
---|
| 346 | +// copy.versionlist = new Object3D[100]; |
---|
| 347 | +// copy.versionindex = -1; |
---|
| 348 | +// |
---|
| 349 | +// callee.Save(true); |
---|
| 350 | +// } |
---|
| 351 | + |
---|
285 | 352 | // "this" is not called: SetupUI2(objEditor); |
---|
286 | 353 | } |
---|
287 | 354 | |
---|
.. | .. |
---|
295 | 362 | client = inClient; |
---|
296 | 363 | copy = client; |
---|
297 | 364 | |
---|
| 365 | + if (copy.versionlist == null) |
---|
| 366 | + { |
---|
| 367 | + copy.versionlist = new Object3D[100]; |
---|
| 368 | + copy.versionindex = -1; |
---|
| 369 | + |
---|
| 370 | +// Save(true); |
---|
| 371 | + } |
---|
| 372 | + |
---|
298 | 373 | SetupUI2(callee.GetEditor()); |
---|
299 | 374 | } |
---|
300 | 375 | |
---|
.. | .. |
---|
316 | 391 | //parent = p; |
---|
317 | 392 | |
---|
318 | 393 | GraphicsDevice gd = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice(); |
---|
319 | | - System.out.println("getFullScreenWindow? " + gd.getFullScreenWindow()); |
---|
| 394 | + if (Globals.DEBUG) |
---|
| 395 | + System.out.println("getFullScreenWindow? " + gd.getFullScreenWindow()); |
---|
320 | 396 | //gd.setFullScreenWindow(this); |
---|
321 | 397 | //setResizable(false); |
---|
322 | 398 | //if (!isDisplayable()) |
---|
.. | .. |
---|
327 | 403 | copy = localCopy; |
---|
328 | 404 | copy.editWindow = this; |
---|
329 | 405 | |
---|
| 406 | +// if (copy.versionlist == null) |
---|
| 407 | +// { |
---|
| 408 | +// copy.versionlist = new Object3D[100]; |
---|
| 409 | +// copy.versionindex = -1; |
---|
| 410 | +// |
---|
| 411 | +// Save(true); |
---|
| 412 | +// } |
---|
| 413 | + |
---|
330 | 414 | SetupMenu(); |
---|
331 | 415 | |
---|
332 | 416 | //SetupName(objEditor); // new |
---|
.. | .. |
---|
345 | 429 | |
---|
346 | 430 | static java.util.Vector<Object3D> listUI = new java.util.Vector<Object3D>(); |
---|
347 | 431 | |
---|
| 432 | + // This is to refresh the UI of the material panel. |
---|
| 433 | + boolean patchMaterial; |
---|
| 434 | + |
---|
348 | 435 | void SetupMenu() |
---|
349 | 436 | { |
---|
350 | 437 | frame.setMenuBar(menuBar = new MenuBar()); |
---|
.. | .. |
---|
394 | 481 | |
---|
395 | 482 | ChangeListener changeListener = new ChangeListener() |
---|
396 | 483 | { |
---|
| 484 | + //String name; |
---|
| 485 | + |
---|
397 | 486 | public void stateChanged(ChangeEvent changeEvent) |
---|
398 | 487 | { |
---|
399 | 488 | // if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Material") && !materialFlushed) |
---|
.. | .. |
---|
412 | 501 | // EditSelection(false); |
---|
413 | 502 | // } |
---|
414 | 503 | |
---|
415 | | - refreshContents(false); // To refresh Info tab |
---|
| 504 | +// if (objectPanel.getSelectedIndex() == 4) |
---|
| 505 | +// { |
---|
| 506 | +// name = copy.skyboxname; |
---|
| 507 | +// |
---|
| 508 | +// if (name == null) |
---|
| 509 | +// { |
---|
| 510 | +// name = ""; |
---|
| 511 | +// } |
---|
| 512 | +// |
---|
| 513 | +// copy.skyboxname = "cubemaps/default-skyboxes/rgb"; |
---|
| 514 | +// copy.skyboxext = "jpg"; |
---|
| 515 | +// } |
---|
| 516 | +// else |
---|
| 517 | +// { |
---|
| 518 | +// if (name != null) |
---|
| 519 | +// { |
---|
| 520 | +// if (name.equals("")) |
---|
| 521 | +// { |
---|
| 522 | +// copy.skyboxname = null; |
---|
| 523 | +// copy.skyboxext = null; |
---|
| 524 | +// } |
---|
| 525 | +// else |
---|
| 526 | +// { |
---|
| 527 | +// copy.skyboxname = name; |
---|
| 528 | +// } |
---|
| 529 | +// } |
---|
| 530 | +// } |
---|
| 531 | + cameraView.transformMode = objectPanel.getSelectedIndex() == 4; |
---|
| 532 | + |
---|
| 533 | +// refreshContents(false); // To refresh Info tab |
---|
| 534 | + cameraView.repaint(); |
---|
416 | 535 | } |
---|
417 | 536 | }; |
---|
418 | 537 | objectPanel.addChangeListener(changeListener); |
---|
419 | 538 | |
---|
420 | 539 | toolbarPanel = new JPanel(); |
---|
421 | 540 | toolbarPanel.setName("Toolbar"); |
---|
| 541 | + |
---|
422 | 542 | treePanel = new cGridBag(); |
---|
423 | 543 | treePanel.setName("Tree"); |
---|
424 | 544 | |
---|
425 | 545 | editPanel = new cGridBag().setVertical(true); |
---|
426 | | - editPanel.setName("Edit"); |
---|
| 546 | + //editPanel.setName("Edit"); |
---|
427 | 547 | |
---|
428 | 548 | ctrlPanel = new cGridBag().setVertical(false); // new GridBagLayout()); |
---|
429 | 549 | |
---|
.. | .. |
---|
431 | 551 | editPanel.add(editCommandsPanel); |
---|
432 | 552 | editPanel.add(ctrlPanel); |
---|
433 | 553 | |
---|
434 | | - toolboxPanel = new cGridBag().setVertical(false); |
---|
435 | | - toolboxPanel.setName("Toolbox"); |
---|
| 554 | + toolboxPanel = new cGridBag().setVertical(true); |
---|
| 555 | + //toolboxPanel.setName("Toolbox"); |
---|
436 | 556 | |
---|
437 | | - materialPanel = new cGridBag().setVertical(true); |
---|
438 | | - materialPanel.setName("Material"); |
---|
| 557 | + skyboxPanel = new cGridBag().setVertical(true); |
---|
| 558 | + |
---|
| 559 | + materialPanel = new cGridBag().setVertical(false); |
---|
| 560 | + //materialPanel.setName("Material"); |
---|
439 | 561 | |
---|
440 | 562 | /*JTextPane*/ |
---|
441 | 563 | infoarea = createTextPane(); |
---|
.. | .. |
---|
443 | 565 | |
---|
444 | 566 | infoarea.setEditable(true); |
---|
445 | 567 | SetText(); |
---|
| 568 | + |
---|
446 | 569 | // infoarea.setFont(infoarea.getFont().deriveFont(10, 14f)); |
---|
447 | 570 | // infoarea.setOpaque(false); |
---|
448 | 571 | // //infoarea.setForeground(textcolor); |
---|
.. | .. |
---|
450 | 573 | // TEXTAREA infoarea.setWrapStyleWord(true); |
---|
451 | 574 | infoPanel = new JScrollPane(infoarea, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); //AS_NEEDED); |
---|
452 | 575 | infoPanel.setPreferredSize(new Dimension(1, 1)); |
---|
453 | | - infoPanel.setName("Info"); |
---|
| 576 | + //infoPanel.setName("Info"); |
---|
454 | 577 | //infoPanel.setLayout(new BorderLayout()); |
---|
455 | 578 | //infoPanel.add(createTextPane()); |
---|
456 | 579 | |
---|
.. | .. |
---|
717 | 840 | boolean maximized; |
---|
718 | 841 | |
---|
719 | 842 | cButton fullscreenLayout; |
---|
| 843 | + cButton expandedLayout; |
---|
720 | 844 | |
---|
721 | 845 | void Minimize() |
---|
722 | 846 | { |
---|
.. | .. |
---|
756 | 880 | cButton minButton; |
---|
757 | 881 | cButton maxButton; |
---|
758 | 882 | cButton fullButton; |
---|
| 883 | + cButton collapseButton; |
---|
| 884 | + cButton maximize3DButton; |
---|
759 | 885 | |
---|
760 | 886 | void ToggleFullScreen() |
---|
761 | 887 | { |
---|
762 | | -GraphicsDevice device = frame.getGraphicsConfiguration().getDevice(); |
---|
| 888 | + GraphicsDevice device = frame.getGraphicsConfiguration().getDevice(); |
---|
763 | 889 | |
---|
764 | 890 | cameraView.ToggleFullScreen(); |
---|
765 | 891 | |
---|
.. | .. |
---|
780 | 906 | // X frame.getContentPane().remove(/*"Center",*/bigThree); |
---|
781 | 907 | // X framePanel.add(bigThree); |
---|
782 | 908 | // X frame.getContentPane().add(/*"Center",*/framePanel); |
---|
783 | | - framePanel.setDividerLocation(46); |
---|
| 909 | +// framePanel.setDividerLocation(46); // icons are 24x24 |
---|
784 | 910 | |
---|
785 | 911 | //frame.setVisible(true); |
---|
786 | | - radio.layout = keepButton; |
---|
| 912 | +// radio.layout = keepButton; |
---|
787 | 913 | //theFrame = null; |
---|
788 | 914 | keepButton = null; |
---|
789 | | - radio.layout.doClick(); |
---|
| 915 | +// radio.layout.doClick(); |
---|
790 | 916 | |
---|
791 | 917 | } else |
---|
792 | 918 | { |
---|
.. | .. |
---|
807 | 933 | // X frame.getContentPane().remove(/*"Center",*/framePanel); |
---|
808 | 934 | // X framePanel.remove(bigThree); |
---|
809 | 935 | // X frame.getContentPane().add(/*"Center",*/bigThree); |
---|
810 | | - framePanel.setDividerLocation(0); |
---|
| 936 | +// framePanel.setDividerLocation(0); |
---|
811 | 937 | |
---|
812 | | - radio.layout = fullscreenLayout; |
---|
813 | | - radio.layout.doClick(); |
---|
| 938 | +// radio.layout = fullscreenLayout; |
---|
| 939 | +// radio.layout.doClick(); |
---|
814 | 940 | //frame.setVisible(true); |
---|
815 | 941 | } |
---|
816 | 942 | frame.validate(); |
---|
| 943 | + |
---|
| 944 | + cameraView.requestFocusInWindow(); |
---|
817 | 945 | } |
---|
818 | 946 | |
---|
819 | | - private byte[] CompressCopy() |
---|
| 947 | + void CollapseToolbar() |
---|
| 948 | + { |
---|
| 949 | + framePanel.setDividerLocation(0); |
---|
| 950 | + //frame.validate(); |
---|
| 951 | + |
---|
| 952 | + cameraView.requestFocusInWindow(); |
---|
| 953 | + } |
---|
| 954 | + |
---|
| 955 | + private Object3D Duplicate(Object3D object) |
---|
820 | 956 | { |
---|
821 | 957 | boolean temp = CameraPane.SWITCH; |
---|
822 | 958 | CameraPane.SWITCH = false; |
---|
823 | 959 | |
---|
824 | | - copy.ExtractBigData(versiontable); |
---|
| 960 | + if (Grafreed.grafreed.universe.versiontable == null) |
---|
| 961 | + Grafreed.grafreed.universe.versiontable = new java.util.Hashtable<java.util.UUID, Object3D>(); |
---|
| 962 | + |
---|
| 963 | + object.ExtractBigData(Grafreed.grafreed.universe.versiontable); |
---|
825 | 964 | // if (copy == client) |
---|
826 | 965 | |
---|
827 | | - byte[] versions[] = copy.versions; |
---|
828 | | - copy.versions = null; |
---|
| 966 | + Object3D versions[] = object.versionlist; |
---|
| 967 | + java.util.Hashtable<java.util.UUID, Object3D> versiontable = object.versiontable; // if Grafreed.grafreed.universe |
---|
| 968 | + object.versionlist = null; |
---|
| 969 | + object.versiontable = null; |
---|
829 | 970 | |
---|
830 | | - byte[] compress = Compress(copy); |
---|
| 971 | + Object3D parent = object.parent; |
---|
| 972 | + object.parent = null; |
---|
831 | 973 | |
---|
832 | | - copy.versions = versions; |
---|
| 974 | + //byte[] compress = Compress(copy); |
---|
| 975 | + Object3D compress = (Object3D)Grafreed.clone(object); |
---|
833 | 976 | |
---|
834 | | - copy.RestoreBigData(versiontable); |
---|
| 977 | + object.parent = parent; |
---|
| 978 | + |
---|
| 979 | + object.versionlist = versions; |
---|
| 980 | + object.versiontable = versiontable; // if Grafreed.grafreed.universe |
---|
| 981 | + |
---|
| 982 | + object.RestoreBigData(Grafreed.grafreed.universe.versiontable); |
---|
835 | 983 | |
---|
836 | 984 | CameraPane.SWITCH = temp; |
---|
837 | 985 | |
---|
.. | .. |
---|
959 | 1107 | { |
---|
960 | 1108 | SetupMaterial(materialPanel); |
---|
961 | 1109 | } |
---|
| 1110 | + |
---|
962 | 1111 | //SetupName(); |
---|
963 | 1112 | //SetupViews(); |
---|
964 | 1113 | } |
---|
.. | .. |
---|
968 | 1117 | // NumberSlider vDivsField; |
---|
969 | 1118 | // JCheckBox endcaps; |
---|
970 | 1119 | JCheckBox liveCB; |
---|
971 | | - JCheckBox selectCB; |
---|
| 1120 | + JCheckBox selectableCB; |
---|
972 | 1121 | JCheckBox hideCB; |
---|
973 | 1122 | JCheckBox link2masterCB; |
---|
974 | 1123 | JCheckBox markCB; |
---|
.. | .. |
---|
1167 | 1316 | |
---|
1168 | 1317 | namePanel = new cGridBag(); |
---|
1169 | 1318 | |
---|
| 1319 | + //if (copy.pinned) |
---|
| 1320 | + { |
---|
| 1321 | + pinButton = GetToggleButton("icons/pin.png", !Globals.NIMBUSLAF); |
---|
| 1322 | + pinButton.setSelected(copy.pinned); |
---|
| 1323 | + cGridBag t = new cGridBag(); |
---|
| 1324 | + t.preferredWidth = 2; |
---|
| 1325 | + t.add(pinButton); |
---|
| 1326 | + namePanel.add(t); |
---|
| 1327 | + |
---|
| 1328 | + pinButton.addItemListener(this); |
---|
| 1329 | + } |
---|
| 1330 | + |
---|
1170 | 1331 | nameField = AddText(namePanel, copy.GetName()); |
---|
1171 | 1332 | namePanel.add(new JScrollPane(nameField, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER)); |
---|
1172 | 1333 | oe.ctrlPanel.add(namePanel); |
---|
.. | .. |
---|
1180 | 1341 | |
---|
1181 | 1342 | liveCB = AddCheckBox(setupPanel, "Live", copy.live); |
---|
1182 | 1343 | liveCB.setToolTipText("Animate object"); |
---|
1183 | | - selectCB = AddCheckBox(setupPanel, "Select", !copy.dontselect); |
---|
1184 | | - selectCB.setToolTipText("Make object selectable"); |
---|
| 1344 | + markCB = AddCheckBox(setupPanel, "Anim", copy.marked); |
---|
| 1345 | + markCB.setToolTipText("Set target transform"); |
---|
| 1346 | + selectableCB = AddCheckBox(setupPanel, "Select", !copy.dontselect); |
---|
| 1347 | + selectableCB.setToolTipText("Make object selectable"); |
---|
1185 | 1348 | // Return(); |
---|
| 1349 | + |
---|
1186 | 1350 | hideCB = AddCheckBox(setupPanel, "Hide", copy.hide); |
---|
1187 | 1351 | hideCB.setToolTipText("Hide object"); |
---|
1188 | | - markCB = AddCheckBox(setupPanel, "Mark", copy.marked); |
---|
1189 | | - markCB.setToolTipText("As animation target transform"); |
---|
| 1352 | + |
---|
| 1353 | + ToolTipManager.sharedInstance().setLightWeightPopupEnabled(false); |
---|
1190 | 1354 | |
---|
1191 | 1355 | setupPanel2 = new cGridBag().setVertical(false); |
---|
1192 | 1356 | |
---|
.. | .. |
---|
1386 | 1550 | |
---|
1387 | 1551 | if (cam == null || !(copy.get(0) instanceof cGroup)) |
---|
1388 | 1552 | { |
---|
| 1553 | + if (Globals.DEBUG) |
---|
1389 | 1554 | System.out.println("CREATE CAMERAS"); |
---|
1390 | 1555 | cams = new cTemplate(); |
---|
1391 | 1556 | cams.name = "Cameras"; |
---|
.. | .. |
---|
1467 | 1632 | //frontView.object = copy; |
---|
1468 | 1633 | //sideView.object = copy; |
---|
1469 | 1634 | |
---|
| 1635 | + transformPanel = new cGridBag().setVertical(true); |
---|
| 1636 | + |
---|
| 1637 | + cGridBag resetTransformPanel = new cGridBag(); |
---|
| 1638 | + |
---|
| 1639 | + resetTransformPanel.preferredHeight = 2; |
---|
| 1640 | + |
---|
| 1641 | + cButton resetTransform = GetButton("Reset all", !Globals.NIMBUSLAF); |
---|
| 1642 | + resetTransform.setToolTipText("Reset Translation, Rotation and Scale"); |
---|
| 1643 | + resetTransform.addMouseListener(new MouseAdapter() |
---|
| 1644 | + { |
---|
| 1645 | + public void mouseClicked(MouseEvent e) |
---|
| 1646 | + { |
---|
| 1647 | + ResetTransform(); |
---|
| 1648 | + } |
---|
| 1649 | + }); |
---|
| 1650 | + resetTransformPanel.add(resetTransform); |
---|
| 1651 | + |
---|
| 1652 | + resetTransform = GetButton("T only", !Globals.NIMBUSLAF); |
---|
| 1653 | + resetTransform.setToolTipText("Reset Translation only"); |
---|
| 1654 | + resetTransform.addMouseListener(new MouseAdapter() |
---|
| 1655 | + { |
---|
| 1656 | + public void mouseClicked(MouseEvent e) |
---|
| 1657 | + { |
---|
| 1658 | + ResetTransform(1); |
---|
| 1659 | + } |
---|
| 1660 | + }); |
---|
| 1661 | + resetTransformPanel.add(resetTransform); |
---|
| 1662 | + |
---|
| 1663 | + resetTransform = GetButton("RS only", !Globals.NIMBUSLAF); |
---|
| 1664 | + resetTransform.setToolTipText("Reset Rotation and Scale only"); |
---|
| 1665 | + resetTransform.addMouseListener(new MouseAdapter() |
---|
| 1666 | + { |
---|
| 1667 | + public void mouseClicked(MouseEvent e) |
---|
| 1668 | + { |
---|
| 1669 | + ResetTransform(2); |
---|
| 1670 | + } |
---|
| 1671 | + }); |
---|
| 1672 | + resetTransformPanel.add(resetTransform); |
---|
| 1673 | + |
---|
1470 | 1674 | XYZPanel = new cGridBag().setVertical(true); |
---|
1471 | 1675 | //XYZPanel.setLayout(new GridLayout(3, 1, 5, 5)); |
---|
1472 | 1676 | |
---|
.. | .. |
---|
1474 | 1678 | XYZPanel.addComponent(/*BorderLayout.SOUTH,*/sideView); // Scroll); |
---|
1475 | 1679 | XYZPanel.addComponent(/*BorderLayout.CENTER,*/frontView); // Scroll); |
---|
1476 | 1680 | XYZPanel.addComponent(/*BorderLayout.NORTH,*/topView); // Scroll); |
---|
| 1681 | + //XYZPanel.setName("XYZ"); |
---|
1477 | 1682 | |
---|
| 1683 | + transformPanel.add(resetTransformPanel); |
---|
| 1684 | + transformPanel.add(XYZPanel); |
---|
| 1685 | + |
---|
1478 | 1686 | /* |
---|
1479 | 1687 | gridPanel = new JPanel(); //new BorderLayout()); |
---|
1480 | 1688 | gridPanel.setLayout(new GridLayout(1, 2)); |
---|
.. | .. |
---|
1482 | 1690 | gridPanel.add(cameraView); |
---|
1483 | 1691 | gridPanel.add(XYZPanel); |
---|
1484 | 1692 | */ |
---|
1485 | | - gridPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, centralPanel, XYZPanel); //new BorderLayout()); |
---|
1486 | | - gridPanel.setContinuousLayout(true); |
---|
1487 | | - gridPanel.setOneTouchExpandable(true); |
---|
1488 | | - gridPanel.setDividerLocation(1.0); |
---|
1489 | | - gridPanel.setDividerSize(9); |
---|
1490 | | - gridPanel.setResizeWeight(0.85); |
---|
| 1693 | +// gridPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, centralPanel, XYZPanel); //new BorderLayout()); |
---|
| 1694 | +// gridPanel.setContinuousLayout(true); |
---|
| 1695 | +// gridPanel.setOneTouchExpandable(true); |
---|
| 1696 | +// gridPanel.setDividerLocation(1.0); |
---|
| 1697 | +// gridPanel.setDividerSize(9); |
---|
| 1698 | +// gridPanel.setResizeWeight(0.85); |
---|
1491 | 1699 | |
---|
1492 | 1700 | // aConstraints.weighty = 0; |
---|
1493 | 1701 | //System.out.println("THIS = " + this); |
---|
.. | .. |
---|
1510 | 1718 | |
---|
1511 | 1719 | //JScrollPane tmp = new JScrollPane(ctrlPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); |
---|
1512 | 1720 | //tmp.setName("Edit"); |
---|
| 1721 | + objectPanel.add(toolboxPanel); |
---|
| 1722 | + objectPanel.setIconAt(0, GetIcon("icons/primitives.png")); |
---|
| 1723 | + objectPanel.setToolTipTextAt(0, "Objects & textures"); |
---|
| 1724 | + |
---|
1513 | 1725 | objectPanel.add(materialPanel); |
---|
| 1726 | + objectPanel.setIconAt(1, GetIcon("icons/material.png")); |
---|
| 1727 | + objectPanel.setToolTipTextAt(1, "Material"); |
---|
| 1728 | + |
---|
| 1729 | + objectPanel.add(skyboxPanel); |
---|
| 1730 | + objectPanel.setIconAt(2, GetIcon("icons/skybox.jpg")); |
---|
| 1731 | + objectPanel.setToolTipTextAt(2, "Backgrounds"); |
---|
| 1732 | + |
---|
1514 | 1733 | // JPanel north = new JPanel(new BorderLayout()); |
---|
1515 | 1734 | // north.setName("Edit"); |
---|
1516 | 1735 | // north.add(ctrlPanel, BorderLayout.NORTH); |
---|
1517 | 1736 | // objectPanel.add(north); |
---|
1518 | 1737 | objectPanel.add(editPanel); |
---|
| 1738 | + objectPanel.setIconAt(3, GetIcon("icons/write.png")); |
---|
| 1739 | + objectPanel.setToolTipTextAt(3, "Edit controls"); |
---|
1519 | 1740 | |
---|
1520 | | - //if (Globals.ADVANCED) |
---|
1521 | | - objectPanel.add(infoPanel); |
---|
| 1741 | + objectPanel.add(transformPanel); |
---|
| 1742 | + objectPanel.setIconAt(4, GetIcon("icons/XYZ.png")); |
---|
| 1743 | + objectPanel.setToolTipTextAt(4, "TRS transform"); |
---|
1522 | 1744 | |
---|
1523 | | - objectPanel.add(toolboxPanel); |
---|
1524 | | - |
---|
| 1745 | + patchMaterial = true; |
---|
| 1746 | + cameraView.patchMaterial = this; |
---|
| 1747 | + objectPanel.setSelectedIndex(1); |
---|
| 1748 | + |
---|
1525 | 1749 | /* |
---|
1526 | 1750 | aConstraints.gridx = 0; |
---|
1527 | 1751 | aConstraints.gridwidth = 1; |
---|
.. | .. |
---|
1552 | 1776 | |
---|
1553 | 1777 | AddOptions(optionsPanel); //, aConstraints); |
---|
1554 | 1778 | |
---|
1555 | | - tabbedPane.add(optionsPanel); |
---|
1556 | | - |
---|
1557 | 1779 | tabbedPane.add(FSPane = new cFileSystemPane(this)); |
---|
1558 | 1780 | |
---|
| 1781 | + tabbedPane.add(optionsPanel); |
---|
| 1782 | + |
---|
1559 | 1783 | scenePanel.add(tabbedPane); |
---|
| 1784 | + |
---|
| 1785 | + cGridBag creditsPanel = new cGridBag().setVertical(true); |
---|
| 1786 | + creditsPanel.setName("Credits"); |
---|
| 1787 | + |
---|
| 1788 | + cLabel ogaLabel = new cLabel(" Most Skyboxes courtesy of OpenGameArt!", !Globals.NIMBUSLAF); |
---|
| 1789 | + creditsPanel.add(ogaLabel); |
---|
| 1790 | + |
---|
| 1791 | + cButton opengameartButton; |
---|
| 1792 | + creditsPanel.add(opengameartButton = GetButton("icons/sara-logo.png", !Globals.NIMBUSLAF)); |
---|
| 1793 | + opengameartButton.setToolTipText("https://opengameart.org"); |
---|
| 1794 | + |
---|
| 1795 | + opengameartButton.addMouseListener(new MouseAdapter() |
---|
| 1796 | + { |
---|
| 1797 | + public void mouseClicked(MouseEvent e) |
---|
| 1798 | + { |
---|
| 1799 | + try |
---|
| 1800 | + { |
---|
| 1801 | + Desktop.getDesktop().browse(new java.net.URI("https://opengameart.org/")); |
---|
| 1802 | + } catch (Exception e1) |
---|
| 1803 | +// } catch (java.io.IOException | java.net.URISyntaxException e1) |
---|
| 1804 | + { |
---|
| 1805 | + e1.printStackTrace(); |
---|
| 1806 | + } |
---|
| 1807 | + } |
---|
| 1808 | + }); |
---|
| 1809 | + |
---|
| 1810 | + for (int i=10; --i>=0;) |
---|
| 1811 | + { |
---|
| 1812 | + creditsPanel.add(new cGridBag()); |
---|
| 1813 | + } |
---|
| 1814 | + |
---|
| 1815 | + tabbedPane.add(creditsPanel); |
---|
| 1816 | + tabbedPane.setToolTipTextAt(3, "Credits"); |
---|
| 1817 | + |
---|
| 1818 | + if (Globals.ADVANCED) |
---|
| 1819 | + { |
---|
| 1820 | + tabbedPane.add(infoPanel); |
---|
| 1821 | + tabbedPane.setIconAt(4, GetIcon("icons/info.png")); |
---|
| 1822 | + tabbedPane.setToolTipTextAt(4, "Information"); |
---|
| 1823 | + } |
---|
1560 | 1824 | |
---|
1561 | 1825 | /* |
---|
1562 | 1826 | cTree jTree = new cTree(null); |
---|
.. | .. |
---|
1578 | 1842 | jtp.add(tree); |
---|
1579 | 1843 | */ |
---|
1580 | 1844 | |
---|
1581 | | - bigPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, scenePanel, gridPanel); |
---|
1582 | | - bigPanel.setContinuousLayout(true); |
---|
1583 | | - bigPanel.setOneTouchExpandable(true); |
---|
1584 | | - bigPanel.setDividerLocation(0.8); |
---|
1585 | | - bigPanel.setDividerSize(15); |
---|
1586 | | - bigPanel.setResizeWeight(0.15); |
---|
1587 | | - bigPanel.setName("Scene"); |
---|
| 1845 | +// bigPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, scenePanel, gridPanel); |
---|
| 1846 | +// bigPanel.setContinuousLayout(true); |
---|
| 1847 | +// bigPanel.setOneTouchExpandable(true); |
---|
| 1848 | +// bigPanel.setDividerLocation(0.8); |
---|
| 1849 | +// bigPanel.setDividerSize(15); |
---|
| 1850 | +// bigPanel.setResizeWeight(0.15); |
---|
| 1851 | +// bigPanel.setName("Scene"); |
---|
1588 | 1852 | |
---|
1589 | 1853 | //bigPanel.setLayout(new BorderLayout()); |
---|
1590 | 1854 | //bigPanel.setSize(new Dimension(10,10)); |
---|
.. | .. |
---|
1619 | 1883 | bigThree = new cGridBag(); |
---|
1620 | 1884 | bigThree.addComponent(scenePanel); |
---|
1621 | 1885 | bigThree.addComponent(centralPanel); |
---|
1622 | | - bigThree.addComponent(XYZPanel); |
---|
| 1886 | + //bigThree.addComponent(XYZPanel); |
---|
1623 | 1887 | |
---|
1624 | 1888 | // // SIDE EFFECT!!! |
---|
1625 | 1889 | // aConstraints.gridx = 0; |
---|
.. | .. |
---|
1628 | 1892 | // aConstraints.gridheight = 1; |
---|
1629 | 1893 | |
---|
1630 | 1894 | framePanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, toolbarPanel, bigThree); |
---|
| 1895 | + |
---|
| 1896 | + framePanel.addPropertyChangeListener(JSplitPane.DIVIDER_LOCATION_PROPERTY, |
---|
| 1897 | + new java.beans.PropertyChangeListener() |
---|
| 1898 | + { |
---|
| 1899 | + public void propertyChange(java.beans.PropertyChangeEvent pce) |
---|
| 1900 | + { |
---|
| 1901 | + if ((Integer)pce.getOldValue() == 1) |
---|
| 1902 | + { |
---|
| 1903 | + if (radio.layout != expandedLayout) |
---|
| 1904 | + { |
---|
| 1905 | + radio.layout = expandedLayout; |
---|
| 1906 | + radio.layout.doClick(); |
---|
| 1907 | + } |
---|
| 1908 | + } |
---|
| 1909 | + } |
---|
| 1910 | + }); |
---|
| 1911 | + |
---|
1631 | 1912 | framePanel.setContinuousLayout(false); |
---|
1632 | 1913 | framePanel.setOneTouchExpandable(false); |
---|
1633 | 1914 | //.setDividerLocation(0.8); |
---|
.. | .. |
---|
1637 | 1918 | |
---|
1638 | 1919 | frame.getContentPane().setLayout(new BorderLayout()); |
---|
1639 | 1920 | /**/ |
---|
1640 | | - JTabbedPane worldPane = new JTabbedPane(); |
---|
| 1921 | + //JTabbedPane worldPane = new JTabbedPane(); |
---|
1641 | 1922 | //worldPane.add(bigPanel); |
---|
1642 | 1923 | //worldPane.add(worldPanel); |
---|
1643 | 1924 | /**/ |
---|
.. | .. |
---|
1651 | 1932 | |
---|
1652 | 1933 | cameraView.requestFocusInWindow(); |
---|
1653 | 1934 | |
---|
1654 | | - gridPanel.setDividerLocation(1.0); |
---|
| 1935 | +// gridPanel.setDividerLocation(1.0); |
---|
1655 | 1936 | |
---|
1656 | 1937 | frame.validate(); |
---|
1657 | 1938 | |
---|
.. | .. |
---|
1660 | 1941 | frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); |
---|
1661 | 1942 | frame.addWindowListener(new WindowAdapter() |
---|
1662 | 1943 | { |
---|
1663 | | - |
---|
1664 | 1944 | public void windowClosing(WindowEvent e) |
---|
1665 | 1945 | { |
---|
1666 | 1946 | Close(); |
---|
.. | .. |
---|
1683 | 1963 | ctrlPanel.removeAll(); |
---|
1684 | 1964 | } |
---|
1685 | 1965 | |
---|
1686 | | - void SetupMaterial(cGridBag panel) |
---|
| 1966 | + void SetupMaterial(cGridBag materialpanel) |
---|
1687 | 1967 | { |
---|
1688 | | - /* |
---|
| 1968 | + cGridBag presetpanel = new cGridBag().setVertical(true); |
---|
| 1969 | + |
---|
| 1970 | + cLabel skin = GetLabel("icons/shadericons/shadericon00000.png", !Globals.NIMBUSLAF); |
---|
| 1971 | + skin.setToolTipText("Skin"); |
---|
| 1972 | + skin.addMouseListener(new MouseAdapter() |
---|
| 1973 | + { |
---|
| 1974 | + public void mouseClicked(MouseEvent e) |
---|
| 1975 | + { |
---|
| 1976 | + Object3D object = Grafreed.materials.versionlist[0].get(0); |
---|
| 1977 | + cMaterial material = object.material; |
---|
| 1978 | + |
---|
| 1979 | + // Skin |
---|
| 1980 | + colorField.setFloat(material.color); |
---|
| 1981 | + float saturation = material.modulation; |
---|
| 1982 | + |
---|
| 1983 | + if (!cameraView.Skinshader) |
---|
| 1984 | + { |
---|
| 1985 | + saturation /= 1.5; |
---|
| 1986 | + } |
---|
| 1987 | + |
---|
| 1988 | + saturationField.setFloat(saturation); |
---|
| 1989 | + |
---|
| 1990 | + subsurfaceField.setFloat(material.subsurface); |
---|
| 1991 | + selfshadowField.setFloat(material.diffuseness); |
---|
| 1992 | + diffusenessField.setFloat(material.factor); |
---|
| 1993 | + shininessField.setFloat(material.shininess); |
---|
| 1994 | + shadowbiasField.setFloat(material.shadowbias); |
---|
| 1995 | + diffuseField.setFloat(material.diffuse); |
---|
| 1996 | + specularField.setFloat(material.specular); |
---|
| 1997 | + |
---|
| 1998 | + bumpField.setFloat(object.projectedVertices[0].x / 1000.0); |
---|
| 1999 | + noiseField.setFloat(object.projectedVertices[0].y / 1000.0); |
---|
| 2000 | + powerField.setFloat(object.projectedVertices[2].x / 1000.0); |
---|
| 2001 | + |
---|
| 2002 | + materialtouched = true; |
---|
| 2003 | + applySelf(); |
---|
| 2004 | + } |
---|
| 2005 | + }); |
---|
| 2006 | + presetpanel.add(skin); |
---|
| 2007 | + |
---|
| 2008 | + cLabel lambert = GetLabel("icons/shadericons/shadericon00002.png", !Globals.NIMBUSLAF); |
---|
| 2009 | + lambert.setToolTipText("Diffuse"); |
---|
| 2010 | + lambert.addMouseListener(new MouseAdapter() |
---|
| 2011 | + { |
---|
| 2012 | + public void mouseClicked(MouseEvent e) |
---|
| 2013 | + { |
---|
| 2014 | + Object3D object = Grafreed.materials.versionlist[2].get(0); |
---|
| 2015 | + cMaterial material = object.material; |
---|
| 2016 | + |
---|
| 2017 | + diffusenessField.setFloat(material.factor); |
---|
| 2018 | + selfshadowField.setFloat(material.diffuseness); |
---|
| 2019 | + |
---|
| 2020 | + materialtouched = true; |
---|
| 2021 | + applySelf(); |
---|
| 2022 | + } |
---|
| 2023 | + }); |
---|
| 2024 | + presetpanel.add(lambert); |
---|
| 2025 | + |
---|
| 2026 | + cLabel diffuse2 = GetLabel("icons/shadericons/shadericon00003.png", !Globals.NIMBUSLAF); |
---|
| 2027 | + diffuse2.setToolTipText("Diffuse2"); |
---|
| 2028 | + diffuse2.addMouseListener(new MouseAdapter() |
---|
| 2029 | + { |
---|
| 2030 | + public void mouseClicked(MouseEvent e) |
---|
| 2031 | + { |
---|
| 2032 | + Object3D object = Grafreed.materials.versionlist[3].get(0); |
---|
| 2033 | + cMaterial material = object.material; |
---|
| 2034 | + |
---|
| 2035 | + diffusenessField.setFloat(material.factor); |
---|
| 2036 | + selfshadowField.setFloat(material.diffuseness); |
---|
| 2037 | + |
---|
| 2038 | + materialtouched = true; |
---|
| 2039 | + applySelf(); |
---|
| 2040 | + } |
---|
| 2041 | + }); |
---|
| 2042 | + presetpanel.add(diffuse2); |
---|
| 2043 | + |
---|
| 2044 | + cLabel diffusemoon = GetLabel("icons/shadericons/shadericon00004.png", !Globals.NIMBUSLAF); |
---|
| 2045 | + diffusemoon.setToolTipText("Moon"); |
---|
| 2046 | + diffusemoon.addMouseListener(new MouseAdapter() |
---|
| 2047 | + { |
---|
| 2048 | + public void mouseClicked(MouseEvent e) |
---|
| 2049 | + { |
---|
| 2050 | + Object3D object = Grafreed.materials.versionlist[4].get(0); |
---|
| 2051 | + cMaterial material = object.material; |
---|
| 2052 | + |
---|
| 2053 | + diffusenessField.setFloat(material.factor); |
---|
| 2054 | + selfshadowField.setFloat(material.diffuseness); |
---|
| 2055 | + |
---|
| 2056 | + materialtouched = true; |
---|
| 2057 | + applySelf(); |
---|
| 2058 | + } |
---|
| 2059 | + }); |
---|
| 2060 | + presetpanel.add(diffusemoon); |
---|
| 2061 | + |
---|
| 2062 | + cLabel diffusemoon2 = GetLabel("icons/shadericons/shadericon00005.png", !Globals.NIMBUSLAF); |
---|
| 2063 | + diffusemoon2.setToolTipText("Moon2"); |
---|
| 2064 | + diffusemoon2.addMouseListener(new MouseAdapter() |
---|
| 2065 | + { |
---|
| 2066 | + public void mouseClicked(MouseEvent e) |
---|
| 2067 | + { |
---|
| 2068 | + Object3D object = Grafreed.materials.versionlist[5].get(0); |
---|
| 2069 | + cMaterial material = object.material; |
---|
| 2070 | + |
---|
| 2071 | + diffusenessField.setFloat(material.factor); |
---|
| 2072 | + selfshadowField.setFloat(material.diffuseness); |
---|
| 2073 | + |
---|
| 2074 | + materialtouched = true; |
---|
| 2075 | + applySelf(); |
---|
| 2076 | + } |
---|
| 2077 | + }); |
---|
| 2078 | + presetpanel.add(diffusemoon2); |
---|
| 2079 | + |
---|
| 2080 | + cLabel diffusemoon3 = GetLabel("icons/shadericons/shadericon00006.png", !Globals.NIMBUSLAF); |
---|
| 2081 | + diffusemoon3.setToolTipText("Moon3"); |
---|
| 2082 | + diffusemoon3.addMouseListener(new MouseAdapter() |
---|
| 2083 | + { |
---|
| 2084 | + public void mouseClicked(MouseEvent e) |
---|
| 2085 | + { |
---|
| 2086 | + Object3D object = Grafreed.materials.versionlist[6].get(0); |
---|
| 2087 | + cMaterial material = object.material; |
---|
| 2088 | + |
---|
| 2089 | + diffusenessField.setFloat(material.factor); |
---|
| 2090 | + selfshadowField.setFloat(material.diffuseness); |
---|
| 2091 | + |
---|
| 2092 | + materialtouched = true; |
---|
| 2093 | + applySelf(); |
---|
| 2094 | + } |
---|
| 2095 | + }); |
---|
| 2096 | + presetpanel.add(diffusemoon3); |
---|
| 2097 | + |
---|
| 2098 | + cLabel diffusesheen = GetLabel("icons/shadericons/shadericon00007.png", !Globals.NIMBUSLAF); |
---|
| 2099 | + diffusesheen.setToolTipText("Sheen"); |
---|
| 2100 | + diffusesheen.addMouseListener(new MouseAdapter() |
---|
| 2101 | + { |
---|
| 2102 | + public void mouseClicked(MouseEvent e) |
---|
| 2103 | + { |
---|
| 2104 | + Object3D object = Grafreed.materials.versionlist[7].get(0); |
---|
| 2105 | + cMaterial material = object.material; |
---|
| 2106 | + |
---|
| 2107 | + sheenField.setFloat(material.sheen); |
---|
| 2108 | + |
---|
| 2109 | + materialtouched = true; |
---|
| 2110 | + applySelf(); |
---|
| 2111 | + } |
---|
| 2112 | + }); |
---|
| 2113 | + presetpanel.add(diffusesheen); |
---|
| 2114 | + |
---|
| 2115 | + cLabel rough = GetLabel("icons/shadericons/shadericon00001.png", !Globals.NIMBUSLAF); |
---|
| 2116 | + rough.setToolTipText("Rough metal"); |
---|
| 2117 | + rough.addMouseListener(new MouseAdapter() |
---|
| 2118 | + { |
---|
| 2119 | + public void mouseClicked(MouseEvent e) |
---|
| 2120 | + { |
---|
| 2121 | + Object3D object = Grafreed.materials.versionlist[1].get(0); |
---|
| 2122 | + cMaterial material = object.material; |
---|
| 2123 | + |
---|
| 2124 | + shininessField.setFloat(material.shininess); |
---|
| 2125 | + velvetField.setFloat(material.velvet); |
---|
| 2126 | + |
---|
| 2127 | + materialtouched = true; |
---|
| 2128 | + applySelf(); |
---|
| 2129 | + } |
---|
| 2130 | + }); |
---|
| 2131 | + presetpanel.add(rough); |
---|
| 2132 | + |
---|
| 2133 | + cLabel rough2 = GetLabel("icons/shadericons/shadericon00013.png", !Globals.NIMBUSLAF); |
---|
| 2134 | + rough2.setToolTipText("Medium metal"); |
---|
| 2135 | + rough2.addMouseListener(new MouseAdapter() |
---|
| 2136 | + { |
---|
| 2137 | + public void mouseClicked(MouseEvent e) |
---|
| 2138 | + { |
---|
| 2139 | + Object3D object = Grafreed.materials.versionlist[13].get(0); |
---|
| 2140 | + cMaterial material = object.material; |
---|
| 2141 | + |
---|
| 2142 | + shininessField.setFloat(material.shininess); |
---|
| 2143 | + lightareaField.setFloat(material.lightarea); |
---|
| 2144 | + |
---|
| 2145 | + materialtouched = true; |
---|
| 2146 | + applySelf(); |
---|
| 2147 | + } |
---|
| 2148 | + }); |
---|
| 2149 | + presetpanel.add(rough2); |
---|
| 2150 | + |
---|
| 2151 | + cLabel shini0 = GetLabel("icons/shadericons/shadericon00014.png", !Globals.NIMBUSLAF); |
---|
| 2152 | + shini0.setToolTipText("Shiny"); |
---|
| 2153 | + shini0.addMouseListener(new MouseAdapter() |
---|
| 2154 | + { |
---|
| 2155 | + public void mouseClicked(MouseEvent e) |
---|
| 2156 | + { |
---|
| 2157 | + Object3D object = Grafreed.materials.versionlist[14].get(0); |
---|
| 2158 | + cMaterial material = object.material; |
---|
| 2159 | + |
---|
| 2160 | + shininessField.setFloat(material.shininess); |
---|
| 2161 | + lightareaField.setFloat(material.lightarea); |
---|
| 2162 | + |
---|
| 2163 | + materialtouched = true; |
---|
| 2164 | + applySelf(); |
---|
| 2165 | + } |
---|
| 2166 | + }); |
---|
| 2167 | + presetpanel.add(shini0); |
---|
| 2168 | + |
---|
| 2169 | + cLabel shini1 = GetLabel("icons/shadericons/shadericon00011.png", !Globals.NIMBUSLAF); |
---|
| 2170 | + shini1.setToolTipText("Shiny2"); |
---|
| 2171 | + shini1.addMouseListener(new MouseAdapter() |
---|
| 2172 | + { |
---|
| 2173 | + public void mouseClicked(MouseEvent e) |
---|
| 2174 | + { |
---|
| 2175 | + Object3D object = Grafreed.materials.versionlist[11].get(0); |
---|
| 2176 | + cMaterial material = object.material; |
---|
| 2177 | + |
---|
| 2178 | + shininessField.setFloat(material.shininess); |
---|
| 2179 | + lightareaField.setFloat(material.lightarea); |
---|
| 2180 | + |
---|
| 2181 | + materialtouched = true; |
---|
| 2182 | + applySelf(); |
---|
| 2183 | + } |
---|
| 2184 | + }); |
---|
| 2185 | + presetpanel.add(shini1); |
---|
| 2186 | + |
---|
| 2187 | + cLabel shini2 = GetLabel("icons/shadericons/shadericon00012.png", !Globals.NIMBUSLAF); |
---|
| 2188 | + shini2.setToolTipText("Shiny3"); |
---|
| 2189 | + shini2.addMouseListener(new MouseAdapter() |
---|
| 2190 | + { |
---|
| 2191 | + public void mouseClicked(MouseEvent e) |
---|
| 2192 | + { |
---|
| 2193 | + Object3D object = Grafreed.materials.versionlist[12].get(0); |
---|
| 2194 | + cMaterial material = object.material; |
---|
| 2195 | + |
---|
| 2196 | + shininessField.setFloat(material.shininess); |
---|
| 2197 | + lightareaField.setFloat(material.lightarea); |
---|
| 2198 | + |
---|
| 2199 | + materialtouched = true; |
---|
| 2200 | + applySelf(); |
---|
| 2201 | + } |
---|
| 2202 | + }); |
---|
| 2203 | + presetpanel.add(shini2); |
---|
| 2204 | + |
---|
| 2205 | + cLabel aniso = GetLabel("icons/shadericons/shadericon00008.png", !Globals.NIMBUSLAF); |
---|
| 2206 | + aniso.setToolTipText("AnisoU"); |
---|
| 2207 | + aniso.addMouseListener(new MouseAdapter() |
---|
| 2208 | + { |
---|
| 2209 | + public void mouseClicked(MouseEvent e) |
---|
| 2210 | + { |
---|
| 2211 | + Object3D object = Grafreed.materials.versionlist[8].get(0); |
---|
| 2212 | + cMaterial material = object.material; |
---|
| 2213 | + |
---|
| 2214 | + anisoField.setFloat(material.aniso); |
---|
| 2215 | + anisoVField.setFloat(material.anisoV); |
---|
| 2216 | + |
---|
| 2217 | + materialtouched = true; |
---|
| 2218 | + applySelf(); |
---|
| 2219 | + } |
---|
| 2220 | + }); |
---|
| 2221 | + presetpanel.add(aniso); |
---|
| 2222 | + |
---|
| 2223 | + cLabel aniso2 = GetLabel("icons/shadericons/shadericon00009.png", !Globals.NIMBUSLAF); |
---|
| 2224 | + aniso2.setToolTipText("AnisoV"); |
---|
| 2225 | + aniso2.addMouseListener(new MouseAdapter() |
---|
| 2226 | + { |
---|
| 2227 | + public void mouseClicked(MouseEvent e) |
---|
| 2228 | + { |
---|
| 2229 | + Object3D object = Grafreed.materials.versionlist[9].get(0); |
---|
| 2230 | + cMaterial material = object.material; |
---|
| 2231 | + |
---|
| 2232 | + anisoField.setFloat(material.aniso); |
---|
| 2233 | + anisoVField.setFloat(material.anisoV); |
---|
| 2234 | + |
---|
| 2235 | + materialtouched = true; |
---|
| 2236 | + applySelf(); |
---|
| 2237 | + } |
---|
| 2238 | + }); |
---|
| 2239 | + presetpanel.add(aniso2); |
---|
| 2240 | + |
---|
| 2241 | + cLabel aniso3 = GetLabel("icons/shadericons/shadericon00010.png", !Globals.NIMBUSLAF); |
---|
| 2242 | + aniso3.setToolTipText("AnisoUV"); |
---|
| 2243 | + aniso3.addMouseListener(new MouseAdapter() |
---|
| 2244 | + { |
---|
| 2245 | + public void mouseClicked(MouseEvent e) |
---|
| 2246 | + { |
---|
| 2247 | + Object3D object = Grafreed.materials.versionlist[10].get(0); |
---|
| 2248 | + cMaterial material = object.material; |
---|
| 2249 | + |
---|
| 2250 | + anisoField.setFloat(material.aniso); |
---|
| 2251 | + anisoVField.setFloat(material.anisoV); |
---|
| 2252 | + |
---|
| 2253 | + materialtouched = true; |
---|
| 2254 | + applySelf(); |
---|
| 2255 | + } |
---|
| 2256 | + }); |
---|
| 2257 | + presetpanel.add(aniso3); |
---|
| 2258 | + |
---|
| 2259 | + cLabel velvet0 = GetLabel("icons/shadericons/shadericon00015.png", !Globals.NIMBUSLAF); |
---|
| 2260 | + velvet0.setToolTipText("Velvet"); |
---|
| 2261 | + velvet0.addMouseListener(new MouseAdapter() |
---|
| 2262 | + { |
---|
| 2263 | + public void mouseClicked(MouseEvent e) |
---|
| 2264 | + { |
---|
| 2265 | + Object3D object = Grafreed.materials.versionlist[15].get(0); |
---|
| 2266 | + cMaterial material = object.material; |
---|
| 2267 | + |
---|
| 2268 | + diffusenessField.setFloat(material.factor); |
---|
| 2269 | + selfshadowField.setFloat(material.diffuseness); |
---|
| 2270 | + sheenField.setFloat(material.sheen); |
---|
| 2271 | + shininessField.setFloat(material.shininess); |
---|
| 2272 | + velvetField.setFloat(material.velvet); |
---|
| 2273 | + shiftField.setFloat(material.shift); |
---|
| 2274 | + |
---|
| 2275 | + materialtouched = true; |
---|
| 2276 | + applySelf(); |
---|
| 2277 | + } |
---|
| 2278 | + }); |
---|
| 2279 | + presetpanel.add(velvet0); |
---|
| 2280 | + |
---|
| 2281 | + cLabel bump0 = GetLabel("icons/shadericons/shadericon00016.png", !Globals.NIMBUSLAF); |
---|
| 2282 | + bump0.setToolTipText("Bump texture"); |
---|
| 2283 | + bump0.addMouseListener(new MouseAdapter() |
---|
| 2284 | + { |
---|
| 2285 | + public void mouseClicked(MouseEvent e) |
---|
| 2286 | + { |
---|
| 2287 | + Object3D object = Grafreed.materials.versionlist[16].get(0); |
---|
| 2288 | + cMaterial material = object.material; |
---|
| 2289 | + |
---|
| 2290 | + bumpField.setFloat(object.projectedVertices[0].x / 1000.0); |
---|
| 2291 | + noiseField.setFloat(object.projectedVertices[0].y / 1000.0); |
---|
| 2292 | + powerField.setFloat(object.projectedVertices[2].x / 1000.0); |
---|
| 2293 | + |
---|
| 2294 | + materialtouched = true; |
---|
| 2295 | + applySelf(); |
---|
| 2296 | + } |
---|
| 2297 | + }); |
---|
| 2298 | + presetpanel.add(bump0); |
---|
| 2299 | + |
---|
| 2300 | + cLabel borderShader = GetLabel("icons/shadericons/borderfade.jpg", !Globals.NIMBUSLAF); |
---|
| 2301 | + borderShader.setToolTipText("Border fade"); |
---|
| 2302 | + borderShader.addMouseListener(new MouseAdapter() |
---|
| 2303 | + { |
---|
| 2304 | + public void mouseClicked(MouseEvent e) |
---|
| 2305 | + { |
---|
| 2306 | + borderfadeField.setFloat(0.5); |
---|
| 2307 | + opacityField.setFloat(0.75); |
---|
| 2308 | + |
---|
| 2309 | + materialtouched = true; |
---|
| 2310 | + applySelf(); |
---|
| 2311 | + } |
---|
| 2312 | + }); |
---|
| 2313 | + presetpanel.add(borderShader); |
---|
| 2314 | + |
---|
| 2315 | + cLabel halo = GetLabel("icons/shadericons/shadericon00017.png", !Globals.NIMBUSLAF); |
---|
| 2316 | + halo.setToolTipText("Halo"); |
---|
| 2317 | + halo.addMouseListener(new MouseAdapter() |
---|
| 2318 | + { |
---|
| 2319 | + public void mouseClicked(MouseEvent e) |
---|
| 2320 | + { |
---|
| 2321 | + Object3D object = Grafreed.materials.versionlist[17].get(0); |
---|
| 2322 | + cMaterial material = object.material; |
---|
| 2323 | + |
---|
| 2324 | + opacityPowerField.setFloat(object.projectedVertices[2].y / 1000.0); |
---|
| 2325 | + |
---|
| 2326 | + materialtouched = true; |
---|
| 2327 | + applySelf(); |
---|
| 2328 | + } |
---|
| 2329 | + }); |
---|
| 2330 | + presetpanel.add(halo); |
---|
| 2331 | + |
---|
| 2332 | + cLabel candle = GetLabel("icons/shadericons/shadericon00018.png", !Globals.NIMBUSLAF); |
---|
| 2333 | + candle.setToolTipText("Candle"); |
---|
| 2334 | + candle.addMouseListener(new MouseAdapter() |
---|
| 2335 | + { |
---|
| 2336 | + public void mouseClicked(MouseEvent e) |
---|
| 2337 | + { |
---|
| 2338 | + Object3D object = Grafreed.materials.versionlist[18].get(0); |
---|
| 2339 | + cMaterial material = object.material; |
---|
| 2340 | + |
---|
| 2341 | + subsurfaceField.setFloat(material.subsurface); |
---|
| 2342 | + shadowbiasField.setFloat(material.shadowbias); |
---|
| 2343 | + ambientField.setFloat(material.ambient); |
---|
| 2344 | + specularField.setFloat(material.specular); |
---|
| 2345 | + lightareaField.setFloat(material.lightarea); |
---|
| 2346 | + shininessField.setFloat(material.shininess); |
---|
| 2347 | + |
---|
| 2348 | + materialtouched = true; |
---|
| 2349 | + applySelf(); |
---|
| 2350 | + } |
---|
| 2351 | + }); |
---|
| 2352 | + presetpanel.add(candle); |
---|
| 2353 | + |
---|
| 2354 | + cLabel shadowShader = GetLabel("icons/shadericons/shadow.png", !Globals.NIMBUSLAF); |
---|
| 2355 | + shadowShader.setToolTipText("Shadow"); |
---|
| 2356 | + shadowShader.addMouseListener(new MouseAdapter() |
---|
| 2357 | + { |
---|
| 2358 | + public void mouseClicked(MouseEvent e) |
---|
| 2359 | + { |
---|
| 2360 | + diffuseField.setFloat(0.001); |
---|
| 2361 | + ambientField.setFloat(0.001); |
---|
| 2362 | + cameraField.setFloat(0.001); |
---|
| 2363 | + specularField.setFloat(0.001); |
---|
| 2364 | + fakedepthField.setFloat(0.001); |
---|
| 2365 | + opacityField.setFloat(0.6); |
---|
| 2366 | + |
---|
| 2367 | + materialtouched = true; |
---|
| 2368 | + applySelf(); |
---|
| 2369 | + } |
---|
| 2370 | + }); |
---|
| 2371 | + presetpanel.add(shadowShader); |
---|
| 2372 | + |
---|
| 2373 | + cGridBag panel = new cGridBag().setVertical(true); |
---|
| 2374 | + |
---|
| 2375 | + presetpanel.preferredWidth = 1; |
---|
| 2376 | + |
---|
| 2377 | + materialpanel.add(presetpanel); |
---|
| 2378 | + materialpanel.add(panel); |
---|
| 2379 | + |
---|
| 2380 | + panel.preferredWidth = 8; |
---|
| 2381 | + |
---|
| 2382 | + /* |
---|
1689 | 2383 | ctrlPanel.add(materialLabel = new JLabel("MATERIAL : "), aConstraints); |
---|
1690 | 2384 | materialLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1691 | | - */ |
---|
| 2385 | + */ |
---|
1692 | 2386 | |
---|
1693 | 2387 | cGridBag editBar = new cGridBag().setVertical(false); |
---|
1694 | 2388 | |
---|
1695 | | - editBar.add(createMaterialButton = new cButton("Create", !Grafreed.NIMBUSLAF)); // , aConstraints); |
---|
| 2389 | + editBar.add(createMaterialButton = new cButton("Create", !Globals.NIMBUSLAF)); // , aConstraints); |
---|
1696 | 2390 | createMaterialButton.setToolTipText("Create material"); |
---|
1697 | 2391 | |
---|
1698 | 2392 | /* |
---|
1699 | 2393 | ctrlPanel.add(resetSlidersButton = new cButton("Reset All"), aConstraints); |
---|
1700 | 2394 | */ |
---|
1701 | 2395 | |
---|
1702 | | - editBar.add(clearMaterialButton = new cButton("Clear", !Grafreed.NIMBUSLAF)); // , aConstraints); |
---|
| 2396 | + editBar.add(clearMaterialButton = new cButton("Clear", !Globals.NIMBUSLAF)); // , aConstraints); |
---|
1703 | 2397 | clearMaterialButton.setToolTipText("Clear material"); |
---|
1704 | 2398 | |
---|
1705 | 2399 | if (Globals.ADVANCED) |
---|
1706 | 2400 | { |
---|
1707 | | - editBar.add(resetSlidersButton = new cButton("Reset", !Grafreed.NIMBUSLAF)); // , aConstraints); |
---|
| 2401 | + editBar.add(resetSlidersButton = new cButton("Reset", !Globals.NIMBUSLAF)); // , aConstraints); |
---|
1708 | 2402 | editBar.add(propagateToggle = new cCheckBox("Prop", propagate)); // , aConstraints); |
---|
1709 | 2403 | editBar.add(multiplyToggle = new cCheckBox("Mult", false)); // , aConstraints); |
---|
1710 | 2404 | } |
---|
.. | .. |
---|
1722 | 2416 | //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints); |
---|
1723 | 2417 | |
---|
1724 | 2418 | cGridBag colorSection = new cGridBag().setVertical(true); |
---|
| 2419 | + |
---|
| 2420 | + cGridBag huepanel = new cGridBag(); |
---|
| 2421 | + cGridBag huelabel = new cGridBag(); |
---|
| 2422 | + cLabel hue = GetLabel("icons/hue.png", false); |
---|
| 2423 | + hue.fit = true; |
---|
| 2424 | + |
---|
| 2425 | + hue.addMouseListener(new MouseAdapter() |
---|
| 2426 | + { |
---|
| 2427 | + public void mousePressed(MouseEvent e) |
---|
| 2428 | + { |
---|
| 2429 | + int x = e.getX(); |
---|
| 2430 | + |
---|
| 2431 | + colorField.setFloat((double)x / ((cLabel)e.getSource()).getWidth()); |
---|
| 2432 | + } |
---|
| 2433 | + }); |
---|
| 2434 | + |
---|
| 2435 | + huelabel.add(hue); |
---|
| 2436 | + huelabel.preferredWidth = 20; |
---|
| 2437 | + huepanel.add(new cGridBag()); // Label |
---|
| 2438 | + huepanel.add(huelabel); // Field/slider |
---|
| 2439 | + |
---|
| 2440 | + huepanel.preferredHeight = 7; |
---|
| 2441 | + |
---|
| 2442 | + colorSection.add(huepanel); |
---|
1725 | 2443 | |
---|
1726 | 2444 | 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); |
---|
| 2445 | + |
---|
| 2446 | + color.add(colorLabel = new JLabel("Color/hue")); // , aConstraints); |
---|
| 2447 | + colorLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 2448 | + color.add(colorField = new cNumberSlider(this, 0.001, 1)); // , aConstraints); |
---|
| 2449 | + |
---|
1730 | 2450 | //colorField.preferredWidth = 200; |
---|
1731 | 2451 | colorSection.add(color); |
---|
1732 | 2452 | |
---|
1733 | 2453 | cGridBag modulation = new cGridBag(); |
---|
1734 | 2454 | modulation.add(modulationLabel = new JLabel("Saturation")); // , aConstraints); |
---|
1735 | 2455 | modulationLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1736 | | - modulation.add(modulationField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
| 2456 | + modulation.add(saturationField = new cNumberSlider(this, 0.001, 1)); // , aConstraints); |
---|
1737 | 2457 | colorSection.add(modulation); |
---|
1738 | 2458 | |
---|
| 2459 | + cGridBag opacity = new cGridBag(); |
---|
| 2460 | + opacity.add(opacityLabel = new JLabel("Opacity")); // , aConstraints); |
---|
| 2461 | + opacityLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 2462 | + opacity.add(opacityField = new cNumberSlider(this, 0.001, 1)); // , aConstraints); |
---|
| 2463 | + colorSection.add(opacity); |
---|
| 2464 | + |
---|
| 2465 | + colorSection.add(GetSeparator()); |
---|
| 2466 | + |
---|
1739 | 2467 | cGridBag texture = new cGridBag(); |
---|
1740 | 2468 | texture.add(textureLabel = new JLabel("Texture")); // , aConstraints); |
---|
1741 | 2469 | textureLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1742 | 2470 | texture.add(textureField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
1743 | 2471 | colorSection.add(texture); |
---|
1744 | 2472 | |
---|
1745 | | - panel.add(new JSeparator()); |
---|
| 2473 | + panel.add(GetSeparator()); |
---|
1746 | 2474 | |
---|
1747 | 2475 | panel.add(colorSection); |
---|
1748 | 2476 | |
---|
.. | .. |
---|
1798 | 2526 | shadowbias.add(shadowbiasField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
1799 | 2527 | diffuseSection.add(shadowbias); |
---|
1800 | 2528 | |
---|
1801 | | - panel.add(new JSeparator()); |
---|
| 2529 | + panel.add(GetSeparator()); |
---|
1802 | 2530 | |
---|
1803 | 2531 | panel.add(diffuseSection); |
---|
1804 | 2532 | |
---|
.. | .. |
---|
1861 | 2589 | specularSection.add(anisoV); |
---|
1862 | 2590 | |
---|
1863 | 2591 | |
---|
1864 | | - panel.add(new JSeparator()); |
---|
| 2592 | + panel.add(GetSeparator()); |
---|
1865 | 2593 | |
---|
1866 | 2594 | panel.add(specularSection); |
---|
1867 | 2595 | |
---|
.. | .. |
---|
1886 | 2614 | backlitLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1887 | 2615 | backlit.add(backlitField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
1888 | 2616 | 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 | 2617 | |
---|
1896 | 2618 | //panel.add(new JSeparator()); |
---|
1897 | 2619 | |
---|
.. | .. |
---|
1937 | 2659 | opacityPower.add(opacityPowerField = new cNumberSlider(this, 0.0, 10 /*10 dec 2013*/)); // , aConstraints); |
---|
1938 | 2660 | textureSection.add(opacityPower); |
---|
1939 | 2661 | |
---|
1940 | | - panel.add(new JSeparator()); |
---|
| 2662 | + panel.add(GetSeparator()); |
---|
1941 | 2663 | |
---|
1942 | 2664 | panel.add(textureSection); |
---|
1943 | 2665 | |
---|
.. | .. |
---|
2924 | 3646 | |
---|
2925 | 3647 | freezematerial = true; |
---|
2926 | 3648 | colorField.setFloat(mat.color); |
---|
2927 | | - modulationField.setFloat(mat.modulation); |
---|
| 3649 | + saturationField.setFloat(mat.modulation); |
---|
2928 | 3650 | metalnessField.setFloat(mat.metalness); |
---|
2929 | 3651 | diffuseField.setFloat(mat.diffuse); |
---|
2930 | 3652 | specularField.setFloat(mat.specular); |
---|
.. | .. |
---|
2986 | 3708 | |
---|
2987 | 3709 | if (multiplyToggle != null) |
---|
2988 | 3710 | multiplyToggle.setSelected(mat.multiply); |
---|
2989 | | - |
---|
2990 | | - assert (object.projectedVertices != null); |
---|
2991 | | - |
---|
2992 | | - if (object.projectedVertices.length <= 2) |
---|
2993 | | - { |
---|
2994 | | - // Side effect... |
---|
2995 | | - Object3D.cVector2[] keep = object.projectedVertices; |
---|
2996 | | - object.projectedVertices = new Object3D.cVector2[3]; |
---|
2997 | | - for (int i = 0; i < 3; i++) |
---|
2998 | | - { |
---|
2999 | | - if (i < keep.length) |
---|
3000 | | - { |
---|
3001 | | - object.projectedVertices[i] = keep[i]; |
---|
3002 | | - } else |
---|
3003 | | - { |
---|
3004 | | - object.projectedVertices[i] = new Object3D.cVector2(); |
---|
3005 | | - } |
---|
3006 | | - /* |
---|
3007 | | - if(keep.length == 0) |
---|
3008 | | - object.projectedVertices[0] = new Object3D.cVector2(); |
---|
3009 | | - else |
---|
3010 | | - object.projectedVertices[0] = keep[0]; |
---|
3011 | | - object.projectedVertices[1] = new Object3D.cVector2(); |
---|
3012 | | - */ |
---|
3013 | | - } |
---|
3014 | | - } |
---|
| 3711 | + |
---|
| 3712 | + AllocProjectedVertices(object); |
---|
3015 | 3713 | |
---|
3016 | 3714 | SetMaterial(mat, object.projectedVertices); |
---|
3017 | 3715 | } |
---|
.. | .. |
---|
3131 | 3829 | public void itemStateChanged(ItemEvent event) |
---|
3132 | 3830 | { |
---|
3133 | 3831 | // System.out.println("Propagate = " + propagate); |
---|
| 3832 | + if (event.getSource() == pinButton) |
---|
| 3833 | + { |
---|
| 3834 | + copy.pinned ^= true; |
---|
| 3835 | + if (!copy.pinned && !copy.editWindow.copy.selection.contains(copy)) |
---|
| 3836 | + { |
---|
| 3837 | + ((GroupEditor)copy.editWindow).listUI.remove(copy); |
---|
| 3838 | + copy.CloseUI(); |
---|
| 3839 | + //copy.editWindow.refreshContents(); |
---|
| 3840 | + } |
---|
| 3841 | + } |
---|
| 3842 | + else |
---|
3134 | 3843 | if (event.getSource() == propagateToggle) |
---|
3135 | 3844 | { |
---|
3136 | 3845 | propagate ^= true; |
---|
.. | .. |
---|
3235 | 3944 | } else if (event.getSource() == liveCB) |
---|
3236 | 3945 | { |
---|
3237 | 3946 | copy.live ^= true; |
---|
| 3947 | + objEditor.refreshContents(true); // To show item colors |
---|
3238 | 3948 | return; |
---|
3239 | | - } else if (event.getSource() == selectCB) |
---|
| 3949 | + } else if (event.getSource() == selectableCB) |
---|
3240 | 3950 | { |
---|
3241 | 3951 | copy.dontselect ^= true; |
---|
3242 | 3952 | return; |
---|
.. | .. |
---|
3244 | 3954 | { |
---|
3245 | 3955 | copy.hide ^= true; |
---|
3246 | 3956 | copy.Touch(); // display list issue |
---|
3247 | | - objEditor.refreshContents(); |
---|
| 3957 | + objEditor.refreshContents(true); // To show item colors |
---|
3248 | 3958 | return; |
---|
3249 | 3959 | } else if (event.getSource() == link2masterCB) |
---|
3250 | 3960 | { |
---|
.. | .. |
---|
3309 | 4019 | //System.out.println("ObjEditor " + event); |
---|
3310 | 4020 | applySelf0(true); |
---|
3311 | 4021 | //parent.applySelf(); |
---|
3312 | | - objEditor.refreshContents(); |
---|
| 4022 | + // conflicts with requestFocus objEditor.refreshContents(); |
---|
3313 | 4023 | } else if (source == resetButton) |
---|
3314 | 4024 | { |
---|
3315 | 4025 | CameraPane.fullreset = true; |
---|
.. | .. |
---|
3489 | 4199 | |
---|
3490 | 4200 | void New() |
---|
3491 | 4201 | { |
---|
3492 | | - while (copy.Size() > 1) |
---|
| 4202 | + while (copy.Size() > 0) |
---|
3493 | 4203 | { |
---|
3494 | | - copy.remove(1); |
---|
| 4204 | + copy.remove(0); |
---|
3495 | 4205 | } |
---|
3496 | 4206 | |
---|
| 4207 | + copy.selection.clear(); |
---|
| 4208 | + |
---|
3497 | 4209 | ResetModel(); |
---|
| 4210 | + SetupViews(); |
---|
3498 | 4211 | objEditor.refreshContents(); |
---|
3499 | 4212 | } |
---|
3500 | 4213 | |
---|
3501 | 4214 | static public byte[] Compress(Object3D o) |
---|
3502 | 4215 | { |
---|
| 4216 | + // Slower to actually compress. |
---|
3503 | 4217 | try |
---|
3504 | 4218 | { |
---|
3505 | 4219 | ByteArrayOutputStream baos = new ByteArrayOutputStream(); |
---|
.. | .. |
---|
3601 | 4315 | { |
---|
3602 | 4316 | //Save(true); |
---|
3603 | 4317 | Replace(); |
---|
| 4318 | + SetVersionStates(); |
---|
3604 | 4319 | } |
---|
3605 | 4320 | |
---|
3606 | 4321 | private boolean Equal(byte[] compress, byte[] name) |
---|
.. | .. |
---|
3619 | 4334 | return true; |
---|
3620 | 4335 | } |
---|
3621 | 4336 | |
---|
3622 | | - java.util.Hashtable<java.util.UUID, Object3D> versiontable = new java.util.Hashtable<java.util.UUID, Object3D>(); |
---|
| 4337 | + void DeleteVersion() |
---|
| 4338 | + { |
---|
| 4339 | + for (int i = copy.versionindex; i < copy.versionlist.length-1; i++) |
---|
| 4340 | + { |
---|
| 4341 | + copy.versionlist[i] = copy.versionlist[i+1]; |
---|
| 4342 | + } |
---|
| 4343 | + |
---|
| 4344 | + if (copy.versionlist[copy.versionindex] == null) |
---|
| 4345 | + copy.versionindex -= 1; |
---|
| 4346 | + |
---|
| 4347 | + if (copy.versionindex != -1) |
---|
| 4348 | + CopyChanged(); |
---|
| 4349 | + |
---|
| 4350 | + SetVersionStates(); |
---|
| 4351 | + } |
---|
3623 | 4352 | |
---|
3624 | 4353 | public boolean Save(boolean user) |
---|
3625 | 4354 | { |
---|
3626 | 4355 | System.err.println("Save"); |
---|
| 4356 | + Replace(); |
---|
3627 | 4357 | |
---|
3628 | | - cRadio tab = GetCurrentTab(); |
---|
| 4358 | + //cRadio tab = GetCurrentTab(); |
---|
3629 | 4359 | |
---|
3630 | | - byte[] compress = CompressCopy(); |
---|
| 4360 | + Object3D compress = Duplicate(copy); // Saved version. No need for "Replace"? |
---|
3631 | 4361 | |
---|
3632 | 4362 | boolean thesame = false; |
---|
3633 | 4363 | |
---|
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 | | - } |
---|
| 4364 | +// if (copy.versionindex > 0 && copy.versions[copy.versionindex-1] != null && Equal(compress, copy.versions[copy.versionindex-1])) |
---|
| 4365 | +// { |
---|
| 4366 | +// thesame = true; |
---|
| 4367 | +// } |
---|
3639 | 4368 | |
---|
3640 | 4369 | //EditorFrame.m_MainFrame.requestFocusInWindow(); |
---|
3641 | 4370 | if (!thesame) |
---|
3642 | 4371 | { |
---|
| 4372 | + for (int i = copy.versionlist.length; --i > copy.versionindex+1;) |
---|
| 4373 | + { |
---|
| 4374 | + copy.versionlist[i] = copy.versionlist[i-1]; |
---|
| 4375 | + } |
---|
| 4376 | + |
---|
3643 | 4377 | //tab.user[tab.versionindex] = user; |
---|
3644 | 4378 | //boolean increment = true; // tab.graphs[tab.versionindex] == null; |
---|
3645 | 4379 | |
---|
3646 | | - copy.versions[++copy.versionindex] = compress; |
---|
| 4380 | + copy.versionlist[++copy.versionindex] = compress; |
---|
3647 | 4381 | |
---|
3648 | 4382 | // if (increment) |
---|
3649 | 4383 | // tab.versionindex++; |
---|
.. | .. |
---|
3653 | 4387 | |
---|
3654 | 4388 | //assert(hashtable.isEmpty()); |
---|
3655 | 4389 | |
---|
3656 | | - for (int i = copy.versionindex+1; i < copy.versions.length; i++) |
---|
3657 | | - { |
---|
3658 | | - //tab.user[i] = false; |
---|
3659 | | - copy.versions[i] = null; |
---|
3660 | | - } |
---|
| 4390 | +// for (int i = copy.versionindex+1; i < copy.versionlist.length; i++) |
---|
| 4391 | +// { |
---|
| 4392 | +// //tab.user[i] = false; |
---|
| 4393 | +// copy.versionlist[i] = null; |
---|
| 4394 | +// } |
---|
3661 | 4395 | |
---|
3662 | | - SetUndoStates(); |
---|
| 4396 | + SetVersionStates(); |
---|
3663 | 4397 | |
---|
3664 | 4398 | // test save |
---|
3665 | 4399 | if (false) |
---|
.. | .. |
---|
3682 | 4416 | |
---|
3683 | 4417 | return !thesame; |
---|
3684 | 4418 | } |
---|
3685 | | - |
---|
3686 | | - void CopyChanged(Object3D obj) |
---|
| 4419 | + |
---|
| 4420 | + boolean flashIt = true; |
---|
| 4421 | + |
---|
| 4422 | + void RefreshSelection() |
---|
3687 | 4423 | { |
---|
3688 | | - SetUndoStates(); |
---|
| 4424 | + Object3D selection = new Object3D(); |
---|
| 4425 | + |
---|
| 4426 | + for (int i = 0; i < copy.selection.size(); i++) |
---|
| 4427 | + { |
---|
| 4428 | + Object3D elem = copy.selection.elementAt(i); |
---|
| 4429 | + |
---|
| 4430 | + Object3D obj = copy.GetObject(elem.GetUUID()); |
---|
| 4431 | + |
---|
| 4432 | + if (obj == null) |
---|
| 4433 | + { |
---|
| 4434 | + copy.selection.remove(i--); |
---|
| 4435 | + } |
---|
| 4436 | + else |
---|
| 4437 | + { |
---|
| 4438 | + selection.add(obj); |
---|
| 4439 | + copy.selection.setElementAt(obj, i); |
---|
| 4440 | + } |
---|
| 4441 | + } |
---|
| 4442 | + |
---|
| 4443 | + flashIt = false; |
---|
| 4444 | + GetTree().clearSelection(); |
---|
| 4445 | + for (int i = 0; i < selection.size(); i++) |
---|
| 4446 | + GetTree().addSelectionPath(selection.elementAt(i).GetTreePath().GetTreePath()); |
---|
| 4447 | + flashIt = true; |
---|
| 4448 | + |
---|
| 4449 | + //refreshContents(false); |
---|
| 4450 | + } |
---|
| 4451 | + |
---|
| 4452 | + void CopyChanged() |
---|
| 4453 | + { |
---|
| 4454 | + Object3D obj = (Object3D)Grafreed.clone(copy.versionlist[copy.versionindex]); |
---|
| 4455 | + |
---|
| 4456 | + SetVersionStates(); |
---|
3689 | 4457 | |
---|
3690 | 4458 | boolean temp = CameraPane.SWITCH; |
---|
3691 | 4459 | CameraPane.SWITCH = false; |
---|
3692 | 4460 | |
---|
3693 | | - copy.ExtractBigData(versiontable); |
---|
| 4461 | + copy.ExtractBigData(Grafreed.grafreed.universe.versiontable); |
---|
3694 | 4462 | |
---|
3695 | 4463 | copy.clear(); |
---|
3696 | 4464 | |
---|
| 4465 | + copy.skyboxname = obj.skyboxname; |
---|
| 4466 | + copy.skyboxext = obj.skyboxext; |
---|
| 4467 | + |
---|
3697 | 4468 | for (int i=0; i<obj.Size(); i++) |
---|
3698 | 4469 | { |
---|
3699 | 4470 | copy.add(obj.get(i)); |
---|
3700 | 4471 | } |
---|
3701 | 4472 | |
---|
3702 | | - copy.RestoreBigData(versiontable); |
---|
| 4473 | + copy.RestoreBigData(Grafreed.grafreed.universe.versiontable); |
---|
3703 | 4474 | |
---|
3704 | 4475 | CameraPane.SWITCH = temp; |
---|
3705 | 4476 | |
---|
| 4477 | + RefreshSelection(); |
---|
3706 | 4478 | //assert(hashtable.isEmpty()); |
---|
3707 | 4479 | |
---|
3708 | 4480 | copy.Touch(); |
---|
.. | .. |
---|
3723 | 4495 | } |
---|
3724 | 4496 | } |
---|
3725 | 4497 | |
---|
3726 | | - refreshContents(); |
---|
| 4498 | + refreshContents(true); |
---|
3727 | 4499 | } |
---|
3728 | 4500 | |
---|
3729 | | - cButton undoButton; |
---|
| 4501 | + cButton previousVersionButton; |
---|
3730 | 4502 | cButton restoreButton; |
---|
3731 | 4503 | cButton replaceButton; |
---|
3732 | | - cButton redoButton; |
---|
| 4504 | + cButton nextVersionButton; |
---|
| 4505 | + cButton saveVersionButton; |
---|
| 4506 | + cButton deleteVersionButton; |
---|
3733 | 4507 | |
---|
3734 | | - void SetUndoStates() |
---|
| 4508 | + boolean muteSlider; |
---|
| 4509 | + |
---|
| 4510 | + int VersionCount() |
---|
3735 | 4511 | { |
---|
3736 | | - cRadio tab = GetCurrentTab(); |
---|
| 4512 | + int count = 0; |
---|
3737 | 4513 | |
---|
3738 | | - restoreButton.setEnabled(copy.versionindex != -1); |
---|
3739 | | - replaceButton.setEnabled(copy.versionindex != -1); |
---|
3740 | | - undoButton.setEnabled(copy.versionindex > 0); |
---|
3741 | | - redoButton.setEnabled(copy.versions[copy.versionindex + 1] != null); |
---|
| 4514 | + for (int i = copy.versionlist.length; --i >= 0;) |
---|
| 4515 | + { |
---|
| 4516 | + if (copy.versionlist[i] != null) |
---|
| 4517 | + count++; |
---|
| 4518 | + } |
---|
| 4519 | + |
---|
| 4520 | + return count; |
---|
3742 | 4521 | } |
---|
3743 | 4522 | |
---|
3744 | | - public boolean Undo() |
---|
| 4523 | + public cGridBag versionSliderPane; |
---|
| 4524 | + |
---|
| 4525 | + void SetVersionStates() |
---|
3745 | 4526 | { |
---|
| 4527 | + //if (true) |
---|
| 4528 | + // return; |
---|
| 4529 | + |
---|
| 4530 | + //cRadio tab = GetCurrentTab(); |
---|
| 4531 | + |
---|
| 4532 | + if (copy.versionlist == null) |
---|
| 4533 | + { |
---|
| 4534 | + saveVersionButton.setEnabled(false); |
---|
| 4535 | + restoreButton.setEnabled(false); |
---|
| 4536 | + replaceButton.setEnabled(false); |
---|
| 4537 | + previousVersionButton.setEnabled(false); |
---|
| 4538 | + nextVersionButton.setEnabled(false); |
---|
| 4539 | + deleteVersionButton.setEnabled(false); |
---|
| 4540 | + versionSliderPane.setVisible(false); |
---|
| 4541 | + } |
---|
| 4542 | + else |
---|
| 4543 | + { |
---|
| 4544 | + restoreButton.setEnabled(copy.versionindex != -1); |
---|
| 4545 | + replaceButton.setEnabled(copy.versionindex != -1); |
---|
| 4546 | + |
---|
| 4547 | + previousVersionButton.setEnabled(copy.versionindex > 0); |
---|
| 4548 | + nextVersionButton.setEnabled(copy.versionlist[copy.versionindex + 1] != null); |
---|
| 4549 | + |
---|
| 4550 | + deleteVersionButton.setEnabled(copy.versionindex != -1); |
---|
| 4551 | + //copy.versionlist[copy.versionindex + 1] != null); |
---|
| 4552 | + |
---|
| 4553 | + muteSlider = true; |
---|
| 4554 | + versionSlider.setMinimum(0); |
---|
| 4555 | + versionSlider.setMaximum(VersionCount() - 1); |
---|
| 4556 | + versionSlider.setInteger(copy.versionindex); |
---|
| 4557 | + versionSlider.setEnabled(copy.versionindex != -1); |
---|
| 4558 | + muteSlider = false; |
---|
| 4559 | + |
---|
| 4560 | + versionSliderPane.setVisible(true); |
---|
| 4561 | + } |
---|
| 4562 | + } |
---|
| 4563 | + |
---|
| 4564 | + public boolean PreviousVersion() |
---|
| 4565 | + { |
---|
| 4566 | + // Option? |
---|
| 4567 | + Replace(); |
---|
| 4568 | + |
---|
3746 | 4569 | System.err.println("Undo"); |
---|
3747 | 4570 | |
---|
3748 | | - cRadio tab = GetCurrentTab(); |
---|
| 4571 | + //cRadio tab = GetCurrentTab(); |
---|
3749 | 4572 | |
---|
3750 | 4573 | if (copy.versionindex == 0) |
---|
3751 | 4574 | { |
---|
.. | .. |
---|
3768 | 4591 | |
---|
3769 | 4592 | copy.versionindex -= 1; |
---|
3770 | 4593 | |
---|
3771 | | - CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex])); |
---|
| 4594 | + CopyChanged(); |
---|
3772 | 4595 | |
---|
3773 | 4596 | return true; |
---|
3774 | 4597 | } |
---|
.. | .. |
---|
3777 | 4600 | { |
---|
3778 | 4601 | System.err.println("Restore"); |
---|
3779 | 4602 | |
---|
3780 | | - cRadio tab = GetCurrentTab(); |
---|
| 4603 | + //cRadio tab = GetCurrentTab(); |
---|
3781 | 4604 | |
---|
3782 | | - if (copy.versionindex == -1 || copy.versions[copy.versionindex] == null) |
---|
| 4605 | + if (copy.versionindex == -1 || copy.versionlist[copy.versionindex] == null) |
---|
3783 | 4606 | { |
---|
3784 | 4607 | java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
3785 | 4608 | return false; |
---|
3786 | 4609 | } |
---|
3787 | 4610 | |
---|
3788 | | - CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex])); |
---|
| 4611 | + //CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex])); |
---|
| 4612 | + CopyChanged(); |
---|
3789 | 4613 | |
---|
3790 | 4614 | return true; |
---|
3791 | 4615 | } |
---|
3792 | 4616 | |
---|
3793 | 4617 | public boolean Replace() |
---|
3794 | 4618 | { |
---|
3795 | | - System.err.println("Replace"); |
---|
| 4619 | + //System.err.println("Replace"); |
---|
3796 | 4620 | |
---|
3797 | | - cRadio tab = GetCurrentTab(); |
---|
| 4621 | + //cRadio tab = GetCurrentTab(); |
---|
3798 | 4622 | |
---|
3799 | | - if (copy.versionindex == -1 || copy.versions[copy.versionindex] == null) |
---|
| 4623 | + if (copy.versionindex == -1 || copy.versionlist[copy.versionindex] == null) |
---|
3800 | 4624 | { |
---|
3801 | 4625 | // No version yet. OK. java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
3802 | 4626 | return false; |
---|
3803 | 4627 | } |
---|
3804 | 4628 | |
---|
3805 | | - copy.versions[copy.versionindex] = CompressCopy(); |
---|
| 4629 | + copy.versionlist[copy.versionindex] = Duplicate(copy); |
---|
3806 | 4630 | |
---|
3807 | 4631 | return true; |
---|
3808 | 4632 | } |
---|
3809 | 4633 | |
---|
3810 | | - public void Redo() |
---|
| 4634 | + public void NextVersion() |
---|
3811 | 4635 | { |
---|
3812 | | - cRadio tab = GetCurrentTab(); |
---|
| 4636 | + // Option? |
---|
| 4637 | + Replace(); |
---|
3813 | 4638 | |
---|
3814 | | - if (copy.versions[copy.versionindex + 1] == null) |
---|
| 4639 | + //cRadio tab = GetCurrentTab(); |
---|
| 4640 | + |
---|
| 4641 | + if (copy.versionlist[copy.versionindex + 1] == null) |
---|
3815 | 4642 | { |
---|
3816 | 4643 | java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
3817 | 4644 | return; |
---|
.. | .. |
---|
3819 | 4646 | |
---|
3820 | 4647 | copy.versionindex += 1; |
---|
3821 | 4648 | |
---|
3822 | | - CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex])); |
---|
| 4649 | + CopyChanged(); |
---|
3823 | 4650 | |
---|
3824 | 4651 | //if (!tab.user[tab.versionindex]) |
---|
3825 | 4652 | // tab.graphs[tab.versionindex] = null; |
---|
.. | .. |
---|
4016 | 4843 | // else |
---|
4017 | 4844 | // applySelf(true); |
---|
4018 | 4845 | // } |
---|
| 4846 | + |
---|
| 4847 | + boolean Equal(double a, double b) |
---|
| 4848 | + { |
---|
| 4849 | + return Math.abs(a - b) < 0.001; |
---|
| 4850 | + } |
---|
| 4851 | + |
---|
4019 | 4852 | void applySelf0(boolean name) |
---|
4020 | 4853 | { |
---|
4021 | 4854 | if (name) |
---|
.. | .. |
---|
4033 | 4866 | //copy.material = new cMaterial(copy.GetMaterial()); |
---|
4034 | 4867 | |
---|
4035 | 4868 | current.color = (float) colorField.getFloat(); |
---|
4036 | | - current.modulation = (float) modulationField.getFloat(); |
---|
| 4869 | + current.modulation = (float) saturationField.getFloat(); |
---|
4037 | 4870 | current.metalness = (float) metalnessField.getFloat(); |
---|
4038 | 4871 | current.diffuse = (float) diffuseField.getFloat(); |
---|
4039 | 4872 | current.specular = (float) specularField.getFloat(); |
---|
.. | .. |
---|
4065 | 4898 | { |
---|
4066 | 4899 | cMaterial mat = copy.material; |
---|
4067 | 4900 | |
---|
4068 | | - colorField.SetToolTipValue((mat.color)); |
---|
4069 | | - modulationField.SetToolTipValue((mat.modulation)); |
---|
4070 | | - metalnessField.SetToolTipValue((mat.metalness)); |
---|
4071 | | - diffuseField.SetToolTipValue((mat.diffuse)); |
---|
4072 | | - specularField.SetToolTipValue((mat.specular)); |
---|
4073 | | - shininessField.SetToolTipValue((mat.shininess)); |
---|
4074 | | - shiftField.SetToolTipValue((mat.shift)); |
---|
4075 | | - ambientField.SetToolTipValue((mat.ambient)); |
---|
4076 | | - lightareaField.SetToolTipValue((mat.lightarea)); |
---|
4077 | | - diffusenessField.SetToolTipValue((mat.factor)); |
---|
4078 | | - velvetField.SetToolTipValue((mat.velvet)); |
---|
4079 | | - sheenField.SetToolTipValue((mat.sheen)); |
---|
4080 | | - subsurfaceField.SetToolTipValue((mat.subsurface)); |
---|
4081 | | - backlitField.SetToolTipValue((mat.bump)); |
---|
4082 | | - anisoField.SetToolTipValue((mat.aniso)); |
---|
4083 | | - anisoVField.SetToolTipValue((mat.anisoV)); |
---|
4084 | | - cameraField.SetToolTipValue((mat.cameralight)); |
---|
4085 | | - selfshadowField.SetToolTipValue((mat.diffuseness)); |
---|
4086 | | - shadowField.SetToolTipValue((mat.shadow)); |
---|
4087 | | - textureField.SetToolTipValue((mat.texture)); |
---|
4088 | | - opacityField.SetToolTipValue((mat.opacity)); |
---|
4089 | | - fakedepthField.SetToolTipValue((mat.fakedepth)); |
---|
4090 | | - shadowbiasField.SetToolTipValue((mat.shadowbias)); |
---|
| 4901 | + if (!Equal(colorField.getFloat(), mat.color)) |
---|
| 4902 | + colorField.SetToolTipValue((mat.color)); |
---|
| 4903 | + if (!Equal(saturationField.getFloat(), mat.modulation)) |
---|
| 4904 | + saturationField.SetToolTipValue((mat.modulation)); |
---|
| 4905 | + if (!Equal(metalnessField.getFloat(), mat.metalness)) |
---|
| 4906 | + metalnessField.SetToolTipValue((mat.metalness)); |
---|
| 4907 | + if (!Equal(diffuseField.getFloat(), mat.diffuse)) |
---|
| 4908 | + diffuseField.SetToolTipValue((mat.diffuse)); |
---|
| 4909 | + if (!Equal(specularField.getFloat(), mat.specular)) |
---|
| 4910 | + specularField.SetToolTipValue((mat.specular)); |
---|
| 4911 | + if (!Equal(shininessField.getFloat(), mat.shininess)) |
---|
| 4912 | + shininessField.SetToolTipValue((mat.shininess)); |
---|
| 4913 | + if (!Equal(shiftField.getFloat(), mat.shift)) |
---|
| 4914 | + shiftField.SetToolTipValue((mat.shift)); |
---|
| 4915 | + if (!Equal(ambientField.getFloat(), mat.ambient)) |
---|
| 4916 | + ambientField.SetToolTipValue((mat.ambient)); |
---|
| 4917 | + if (!Equal(lightareaField.getFloat(), mat.lightarea)) |
---|
| 4918 | + lightareaField.SetToolTipValue((mat.lightarea)); |
---|
| 4919 | + if (!Equal(diffusenessField.getFloat(), mat.factor)) |
---|
| 4920 | + diffusenessField.SetToolTipValue((mat.factor)); |
---|
| 4921 | + if (!Equal(velvetField.getFloat(), mat.velvet)) |
---|
| 4922 | + velvetField.SetToolTipValue((mat.velvet)); |
---|
| 4923 | + if (!Equal(sheenField.getFloat(), mat.sheen)) |
---|
| 4924 | + sheenField.SetToolTipValue((mat.sheen)); |
---|
| 4925 | + if (!Equal(subsurfaceField.getFloat(), mat.subsurface)) |
---|
| 4926 | + subsurfaceField.SetToolTipValue((mat.subsurface)); |
---|
| 4927 | + if (!Equal(backlitField.getFloat(), mat.bump)) |
---|
| 4928 | + backlitField.SetToolTipValue((mat.bump)); |
---|
| 4929 | + if (!Equal(anisoField.getFloat(), mat.aniso)) |
---|
| 4930 | + anisoField.SetToolTipValue((mat.aniso)); |
---|
| 4931 | + if (!Equal(anisoVField.getFloat(), mat.anisoV)) |
---|
| 4932 | + anisoVField.SetToolTipValue((mat.anisoV)); |
---|
| 4933 | + if (!Equal(cameraField.getFloat(), mat.cameralight)) |
---|
| 4934 | + cameraField.SetToolTipValue((mat.cameralight)); |
---|
| 4935 | + if (!Equal(selfshadowField.getFloat(), mat.diffuseness)) |
---|
| 4936 | + selfshadowField.SetToolTipValue((mat.diffuseness)); |
---|
| 4937 | + if (!Equal(shadowField.getFloat(), mat.shadow)) |
---|
| 4938 | + shadowField.SetToolTipValue((mat.shadow)); |
---|
| 4939 | + if (!Equal(textureField.getFloat(), mat.texture)) |
---|
| 4940 | + textureField.SetToolTipValue((mat.texture)); |
---|
| 4941 | + if (!Equal(opacityField.getFloat(), mat.opacity)) |
---|
| 4942 | + opacityField.SetToolTipValue((mat.opacity)); |
---|
| 4943 | + if (!Equal(fakedepthField.getFloat(), mat.fakedepth)) |
---|
| 4944 | + fakedepthField.SetToolTipValue((mat.fakedepth)); |
---|
| 4945 | + if (!Equal(shadowbiasField.getFloat(), mat.shadowbias)) |
---|
| 4946 | + shadowbiasField.SetToolTipValue((mat.shadowbias)); |
---|
4091 | 4947 | } |
---|
4092 | 4948 | |
---|
4093 | 4949 | if (copy.material != null && copy.projectedVertices.length > 0 && copy.projectedVertices[0] != null) |
---|
.. | .. |
---|
4118 | 4974 | //copy.Touch(); |
---|
4119 | 4975 | } |
---|
4120 | 4976 | |
---|
4121 | | - cNumberSlider versionField; |
---|
| 4977 | + cNumberSlider versionSlider; |
---|
4122 | 4978 | |
---|
4123 | 4979 | public void stateChanged(ChangeEvent e) |
---|
4124 | 4980 | { |
---|
4125 | | - // assert(false); |
---|
4126 | | - if (e.getSource() == versionField) |
---|
| 4981 | + // assert(false); |
---|
| 4982 | + if (e.getSource() == versionSlider) |
---|
4127 | 4983 | { |
---|
4128 | | - int version = versionField.getInteger(); |
---|
| 4984 | + if (muteSlider) |
---|
| 4985 | + return; |
---|
4129 | 4986 | |
---|
4130 | | - if (copy.versions[version] != null) |
---|
| 4987 | + Replace(); |
---|
| 4988 | + |
---|
| 4989 | + int version = versionSlider.getInteger(); |
---|
| 4990 | + |
---|
| 4991 | + if (version != -1 && copy.versionlist[version] != null) |
---|
4131 | 4992 | { |
---|
4132 | | - CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex = version])); |
---|
| 4993 | + copy.versionindex = version; |
---|
| 4994 | + CopyChanged(); |
---|
4133 | 4995 | } |
---|
4134 | 4996 | |
---|
4135 | 4997 | return; |
---|
.. | .. |
---|
4169 | 5031 | { |
---|
4170 | 5032 | //System.out.println("stateChanged = " + this); |
---|
4171 | 5033 | materialtouched = true; |
---|
| 5034 | + |
---|
| 5035 | + if (Globals.AUTOSATURATE && e.getSource() == colorField && saturationField.getFloat() == 0.001) |
---|
| 5036 | + { |
---|
| 5037 | + saturationField.setFloat(1); |
---|
| 5038 | + } |
---|
| 5039 | + |
---|
4172 | 5040 | applySelf(); |
---|
4173 | 5041 | //System.out.println("this = " + this); |
---|
4174 | 5042 | //System.out.println("PARENT = " + parent); |
---|
.. | .. |
---|
4468 | 5336 | { |
---|
4469 | 5337 | if (GetTree() != null) |
---|
4470 | 5338 | { |
---|
| 5339 | + GetTree().revalidate(); |
---|
4471 | 5340 | GetTree().repaint(); |
---|
4472 | 5341 | } |
---|
4473 | 5342 | |
---|
.. | .. |
---|
4476 | 5345 | ctrlPanel.validate(); // ? new |
---|
4477 | 5346 | ctrlPanel.repaint(); |
---|
4478 | 5347 | } |
---|
| 5348 | + |
---|
| 5349 | + if (previousVersionButton != null && copy.versionlist != null) |
---|
| 5350 | + SetVersionStates(); |
---|
| 5351 | + |
---|
| 5352 | + cameraView.requestFocusInWindow(); |
---|
4479 | 5353 | } |
---|
4480 | 5354 | |
---|
4481 | 5355 | static TweenManager tweenManager = new TweenManager(); |
---|
.. | .. |
---|
4507 | 5381 | // group = (Composite) group.get(0); |
---|
4508 | 5382 | // } |
---|
4509 | 5383 | |
---|
4510 | | - System.out.println("makeSomething of " + thing); |
---|
| 5384 | + //System.out.println("makeSomething of " + thing); |
---|
4511 | 5385 | |
---|
4512 | 5386 | /* |
---|
4513 | 5387 | if (deselect && jList != null) |
---|
.. | .. |
---|
4724 | 5598 | readobj.ResetDisplayList(); |
---|
4725 | 5599 | } catch (Exception e) |
---|
4726 | 5600 | { |
---|
4727 | | - //e.printStackTrace(); |
---|
| 5601 | + if (!e.toString().contains("GZIP")) |
---|
| 5602 | + e.printStackTrace(); |
---|
| 5603 | + |
---|
4728 | 5604 | try |
---|
4729 | 5605 | { |
---|
4730 | 5606 | java.io.FileInputStream istream = new java.io.FileInputStream(fullname); |
---|
.. | .. |
---|
4804 | 5680 | { |
---|
4805 | 5681 | //readobj.deepCopySelf(copy); |
---|
4806 | 5682 | copy.clear(); // june 2014 |
---|
| 5683 | + copy.skyboxname = readobj.skyboxname; |
---|
| 5684 | + copy.skyboxext = readobj.skyboxext; |
---|
4807 | 5685 | for (int i = 0; i < readobj.size(); i++) |
---|
4808 | 5686 | { |
---|
4809 | 5687 | Object3D child = readobj.get(i); // reserve(i); |
---|
.. | .. |
---|
4844 | 5722 | } |
---|
4845 | 5723 | } catch (ClassCastException e) |
---|
4846 | 5724 | { |
---|
| 5725 | + e.printStackTrace(); |
---|
4847 | 5726 | assert (false); |
---|
4848 | 5727 | Composite c = (Composite) copy; |
---|
4849 | 5728 | c.children.clear(); |
---|
.. | .. |
---|
4854 | 5733 | c.addChild(csg); |
---|
4855 | 5734 | } |
---|
4856 | 5735 | |
---|
4857 | | - copy.versions = readobj.versions; |
---|
| 5736 | + copy.versionlist = readobj.versionlist; |
---|
4858 | 5737 | copy.versionindex = readobj.versionindex; |
---|
| 5738 | + copy.versiontable = readobj.versiontable; |
---|
4859 | 5739 | |
---|
4860 | | - SetUndoStates(); |
---|
| 5740 | + if (copy.versionlist == null) |
---|
| 5741 | + { |
---|
| 5742 | + // Backward compatibility |
---|
| 5743 | + copy.versionlist = new Object3D[100]; |
---|
| 5744 | + copy.versionindex = -1; |
---|
| 5745 | + |
---|
| 5746 | + //Save(true); |
---|
| 5747 | + } |
---|
| 5748 | + |
---|
| 5749 | + //? SetUndoStates(); |
---|
4861 | 5750 | |
---|
4862 | 5751 | ResetModel(); |
---|
4863 | 5752 | copy.HardTouch(); // recompile? |
---|
.. | .. |
---|
4869 | 5758 | { |
---|
4870 | 5759 | if (Grafreed.standAlone) |
---|
4871 | 5760 | { |
---|
4872 | | - FileDialog browser = new FileDialog(frame, "Load", FileDialog.LOAD); |
---|
| 5761 | + FileDialog browser = new FileDialog(frame, "Open", FileDialog.LOAD); |
---|
4873 | 5762 | browser.show(); |
---|
4874 | 5763 | String filename = browser.getFile(); |
---|
4875 | 5764 | if (filename != null && filename.length() > 0) |
---|
.. | .. |
---|
4946 | 5835 | |
---|
4947 | 5836 | void save() |
---|
4948 | 5837 | { |
---|
| 5838 | + Replace(); |
---|
| 5839 | + |
---|
4949 | 5840 | if (lastname == null) |
---|
4950 | 5841 | { |
---|
4951 | 5842 | return; |
---|
.. | .. |
---|
4968 | 5859 | //ps.print(buffer.toString()); |
---|
4969 | 5860 | } catch (IOException e) |
---|
4970 | 5861 | { |
---|
| 5862 | + e.printStackTrace(); |
---|
4971 | 5863 | } |
---|
4972 | 5864 | } |
---|
4973 | 5865 | |
---|
.. | .. |
---|
5187 | 6079 | ButtonGroup buttonGroup; |
---|
5188 | 6080 | |
---|
5189 | 6081 | cGridBag toolboxPanel; |
---|
| 6082 | + cGridBag skyboxPanel; |
---|
5190 | 6083 | cGridBag materialPanel; |
---|
5191 | 6084 | cGridBag ctrlPanel; |
---|
5192 | 6085 | |
---|
.. | .. |
---|
5198 | 6091 | boolean materialFlushed; |
---|
5199 | 6092 | Object3D latestObject; |
---|
5200 | 6093 | |
---|
| 6094 | + cGridBag transformPanel; |
---|
5201 | 6095 | cGridBag XYZPanel; |
---|
5202 | 6096 | |
---|
5203 | 6097 | JSplitPane gridPanel; |
---|
.. | .. |
---|
5260 | 6154 | JLabel colorLabel; |
---|
5261 | 6155 | cNumberSlider colorField; |
---|
5262 | 6156 | JLabel modulationLabel; |
---|
5263 | | - cNumberSlider modulationField; |
---|
| 6157 | + cNumberSlider saturationField; |
---|
5264 | 6158 | JLabel metalnessLabel; |
---|
5265 | 6159 | cNumberSlider metalnessField; |
---|
5266 | 6160 | JLabel diffuseLabel; |
---|
.. | .. |
---|
5291 | 6185 | cNumberSlider anisoField; |
---|
5292 | 6186 | JLabel anisoVLabel; |
---|
5293 | 6187 | cNumberSlider anisoVField; |
---|
| 6188 | + |
---|
5294 | 6189 | JLabel cameraLabel; |
---|
5295 | 6190 | cNumberSlider cameraField; |
---|
5296 | 6191 | JLabel selfshadowLabel; |
---|
.. | .. |
---|
5305 | 6200 | cNumberSlider fakedepthField; |
---|
5306 | 6201 | JLabel shadowbiasLabel; |
---|
5307 | 6202 | cNumberSlider shadowbiasField; |
---|
| 6203 | + |
---|
5308 | 6204 | JLabel bumpLabel; |
---|
5309 | 6205 | cNumberSlider bumpField; |
---|
5310 | 6206 | JLabel noiseLabel; |
---|