.. | .. |
---|
24 | 24 | matrix.Matrix; |
---|
25 | 25 | |
---|
26 | 26 | import grafeme.ui.*; |
---|
| 27 | +import org.xj3d.ui.swt.widgets.ImageLoader; |
---|
27 | 28 | |
---|
28 | 29 | class ObjEditor /*extends JFrame*/ implements iCallBack, ObjectUI, |
---|
29 | 30 | ActionListener, ChangeListener, |
---|
.. | .. |
---|
34 | 35 | iSendInfo |
---|
35 | 36 | //KeyListener |
---|
36 | 37 | { |
---|
| 38 | + public cToggleButton pinButton; |
---|
37 | 39 | boolean timeline; |
---|
38 | 40 | boolean wasFullScreen; |
---|
39 | 41 | |
---|
.. | .. |
---|
41 | 43 | JFrame frame; |
---|
42 | 44 | |
---|
43 | 45 | static ObjEditor theFrame; |
---|
| 46 | + |
---|
| 47 | + public void AllocProjectedVertices(Object3D object) |
---|
| 48 | + { |
---|
| 49 | + assert (object.projectedVertices != null); |
---|
| 50 | + |
---|
| 51 | + if (object.projectedVertices.length <= 2) |
---|
| 52 | + { |
---|
| 53 | + // Side effect... |
---|
| 54 | + Object3D.cVector2[] keep = object.projectedVertices; |
---|
| 55 | + object.projectedVertices = new Object3D.cVector2[3]; |
---|
| 56 | + for (int i = 0; i < 3; i++) |
---|
| 57 | + { |
---|
| 58 | + if (i < keep.length) |
---|
| 59 | + { |
---|
| 60 | + object.projectedVertices[i] = keep[i]; |
---|
| 61 | + } else |
---|
| 62 | + { |
---|
| 63 | + object.projectedVertices[i] = new Object3D.cVector2(); |
---|
| 64 | + } |
---|
| 65 | + /* |
---|
| 66 | + if(keep.length == 0) |
---|
| 67 | + object.projectedVertices[0] = new Object3D.cVector2(); |
---|
| 68 | + else |
---|
| 69 | + object.projectedVertices[0] = keep[0]; |
---|
| 70 | + object.projectedVertices[1] = new Object3D.cVector2(); |
---|
| 71 | + */ |
---|
| 72 | + } |
---|
| 73 | + } |
---|
| 74 | + } |
---|
| 75 | + |
---|
| 76 | + public Composite CreateCameras() |
---|
| 77 | + { |
---|
| 78 | + Composite cams = new cTemplate(); |
---|
| 79 | + cams.name = "Cameras"; |
---|
| 80 | + copy.insertElementAt(cams, 0); |
---|
| 81 | + |
---|
| 82 | + cams.addChild(new Camera()); |
---|
| 83 | + cams.addChild(new Camera(1)); |
---|
| 84 | + cams.addChild(new Camera(2)); |
---|
| 85 | + cams.addChild(new Camera(3)); |
---|
| 86 | + cams.addChild(new Camera(4)); |
---|
| 87 | + |
---|
| 88 | + return cams; |
---|
| 89 | + } |
---|
| 90 | + |
---|
| 91 | + public cGridBag GetSeparator() |
---|
| 92 | + { |
---|
| 93 | + cGridBag separator = new cGridBag(); |
---|
| 94 | + separator.add(new JSeparator()); |
---|
| 95 | + separator.preferredHeight = 5; |
---|
| 96 | + return separator; |
---|
| 97 | + } |
---|
44 | 98 | |
---|
45 | 99 | cButton GetButton(String name, boolean border) |
---|
46 | 100 | { |
---|
47 | 101 | ImageIcon icon = GetIcon(name); |
---|
48 | | - return new cButton(icon, border); |
---|
| 102 | + if (icon != null || name.contains("/")) |
---|
| 103 | + return new cButton(icon, border); |
---|
| 104 | + else |
---|
| 105 | + return new cButton(name, border); |
---|
| 106 | + } |
---|
| 107 | + |
---|
| 108 | + cLabel GetLabel(String name, boolean border) |
---|
| 109 | + { |
---|
| 110 | + //ImageIcon icon = GetIcon(name); |
---|
| 111 | + return new cLabel(GetImage(name), border); |
---|
49 | 112 | } |
---|
50 | 113 | |
---|
51 | 114 | cToggleButton GetToggleButton(String name, boolean border) |
---|
.. | .. |
---|
60 | 123 | return new cCheckBox(icon, border); |
---|
61 | 124 | } |
---|
62 | 125 | |
---|
63 | | - ImageIcon GetIcon(String name) |
---|
| 126 | + static java.util.Hashtable<String, javax.swing.ImageIcon> icons = new java.util.Hashtable<String, javax.swing.ImageIcon>(); |
---|
| 127 | + |
---|
| 128 | + static ImageIcon GetIcon(String name) |
---|
| 129 | + { |
---|
| 130 | + javax.swing.ImageIcon iconCache = icons.get(name); |
---|
| 131 | + if (iconCache != null) |
---|
| 132 | + { |
---|
| 133 | + return iconCache; |
---|
| 134 | + } |
---|
| 135 | + |
---|
| 136 | + try |
---|
| 137 | + { |
---|
| 138 | + BufferedImage image; |
---|
| 139 | + |
---|
| 140 | + if (!Grafreed.isWindows && name.endsWith("jpg")) |
---|
| 141 | + { |
---|
| 142 | + try |
---|
| 143 | + { |
---|
| 144 | + // Much faster! |
---|
| 145 | + image = JpegLoader.load(name); |
---|
| 146 | + } |
---|
| 147 | + catch (Exception e) |
---|
| 148 | + { |
---|
| 149 | + image = javax.imageio.ImageIO.read(ObjEditor.class.getClassLoader().getResourceAsStream(name)); |
---|
| 150 | + } |
---|
| 151 | + } |
---|
| 152 | + else |
---|
| 153 | + image = javax.imageio.ImageIO.read(ObjEditor.class.getClassLoader().getResourceAsStream(name)); |
---|
| 154 | + |
---|
| 155 | +// if (image.getWidth() > 48 && image.getHeight() > 48) |
---|
| 156 | +// { |
---|
| 157 | +// BufferedImage resized = new BufferedImage(48, 48, image.getType()); |
---|
| 158 | +// Graphics2D g = resized.createGraphics(); |
---|
| 159 | +// g.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR); |
---|
| 160 | +// //g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); |
---|
| 161 | +// g.drawImage(image, 0, 0, 48, 48, 0, 0, image.getWidth(), image.getHeight(), null); |
---|
| 162 | +// g.dispose(); |
---|
| 163 | +// |
---|
| 164 | +// image = resized; |
---|
| 165 | +// } |
---|
| 166 | + |
---|
| 167 | + javax.swing.ImageIcon icon = new javax.swing.ImageIcon(image); |
---|
| 168 | + |
---|
| 169 | + icons.put(name, icon); |
---|
| 170 | + |
---|
| 171 | + return icon; |
---|
| 172 | + } |
---|
| 173 | + catch (Exception e) |
---|
| 174 | + { |
---|
| 175 | + //icons.put(name, null); |
---|
| 176 | + return null; |
---|
| 177 | + } |
---|
| 178 | + } |
---|
| 179 | + |
---|
| 180 | + BufferedImage GetImage(String name) |
---|
64 | 181 | { |
---|
65 | 182 | try |
---|
66 | 183 | { |
---|
67 | 184 | BufferedImage image = javax.imageio.ImageIO.read(getClass().getClassLoader().getResourceAsStream(name)); |
---|
68 | 185 | |
---|
69 | | - if (image.getWidth() > 48 && image.getHeight() > 48) |
---|
70 | | - { |
---|
71 | | - BufferedImage resized = new BufferedImage(48, 48, image.getType()); |
---|
72 | | - Graphics2D g = resized.createGraphics(); |
---|
73 | | - g.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR); |
---|
74 | | - //g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); |
---|
75 | | - g.drawImage(image, 0, 0, 48, 48, 0, 0, image.getWidth(), image.getHeight(), null); |
---|
76 | | - g.dispose(); |
---|
77 | | - |
---|
78 | | - image = resized; |
---|
79 | | - } |
---|
80 | | - |
---|
81 | | - javax.swing.ImageIcon icon = new javax.swing.ImageIcon(image); |
---|
82 | | - return icon; |
---|
| 186 | + return image; |
---|
83 | 187 | } |
---|
84 | 188 | catch (Exception e) |
---|
85 | 189 | { |
---|
.. | .. |
---|
222 | 326 | objEditor.ctrlPanel.remove(setupPanel2); |
---|
223 | 327 | objEditor.ctrlPanel.remove(objectCommandsPanel); |
---|
224 | 328 | objEditor.ctrlPanel.remove(pushPanel); |
---|
| 329 | + if (versionPanel != null) |
---|
| 330 | + objEditor.ctrlPanel.remove(versionPanel); |
---|
225 | 331 | //objEditor.ctrlPanel.remove(fillPanel); |
---|
226 | 332 | |
---|
227 | 333 | //Remove(normalpushField); |
---|
.. | .. |
---|
268 | 374 | client = inClient; |
---|
269 | 375 | copy = client; |
---|
270 | 376 | |
---|
271 | | - if (copy.versions == null) |
---|
272 | | - { |
---|
273 | | - copy.versions = new byte[100][]; |
---|
274 | | - copy.versionindex = -1; |
---|
275 | | - } |
---|
| 377 | +// if (copy.versionlist == null) |
---|
| 378 | +// { |
---|
| 379 | +// copy.versionlist = new Object3D[100]; |
---|
| 380 | +// copy.versionindex = -1; |
---|
| 381 | +// |
---|
| 382 | +// callee.Save(true); |
---|
| 383 | +// } |
---|
276 | 384 | |
---|
277 | 385 | // "this" is not called: SetupUI2(objEditor); |
---|
278 | 386 | } |
---|
.. | .. |
---|
287 | 395 | client = inClient; |
---|
288 | 396 | copy = client; |
---|
289 | 397 | |
---|
290 | | - if (copy.versions == null) |
---|
291 | | - { |
---|
292 | | - copy.versions = new byte[100][]; |
---|
293 | | - copy.versionindex = -1; |
---|
294 | | - } |
---|
295 | | - |
---|
296 | 398 | SetupUI2(callee.GetEditor()); |
---|
297 | 399 | } |
---|
298 | 400 | |
---|
.. | .. |
---|
314 | 416 | //parent = p; |
---|
315 | 417 | |
---|
316 | 418 | GraphicsDevice gd = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice(); |
---|
317 | | - System.out.println("getFullScreenWindow? " + gd.getFullScreenWindow()); |
---|
| 419 | + if (Globals.DEBUG) |
---|
| 420 | + System.out.println("getFullScreenWindow? " + gd.getFullScreenWindow()); |
---|
318 | 421 | //gd.setFullScreenWindow(this); |
---|
319 | 422 | //setResizable(false); |
---|
320 | 423 | //if (!isDisplayable()) |
---|
.. | .. |
---|
325 | 428 | copy = localCopy; |
---|
326 | 429 | copy.editWindow = this; |
---|
327 | 430 | |
---|
328 | | - if (copy.versions == null) |
---|
329 | | - { |
---|
330 | | -// copy.versions = new byte[100][]; |
---|
| 431 | +// if (copy.versionlist == null) |
---|
| 432 | +// { |
---|
| 433 | +// copy.versionlist = new Object3D[100]; |
---|
331 | 434 | // copy.versionindex = -1; |
---|
332 | | - } |
---|
| 435 | +// |
---|
| 436 | +// Save(true); |
---|
| 437 | +// } |
---|
333 | 438 | |
---|
334 | 439 | SetupMenu(); |
---|
335 | 440 | |
---|
.. | .. |
---|
349 | 454 | |
---|
350 | 455 | static java.util.Vector<Object3D> listUI = new java.util.Vector<Object3D>(); |
---|
351 | 456 | |
---|
| 457 | + // This is to refresh the UI of the material panel. |
---|
| 458 | + boolean patchMaterial; |
---|
| 459 | + |
---|
352 | 460 | void SetupMenu() |
---|
353 | 461 | { |
---|
354 | 462 | frame.setMenuBar(menuBar = new MenuBar()); |
---|
.. | .. |
---|
362 | 470 | importOBJItem.addActionListener(this); |
---|
363 | 471 | import3DSItem = menu.add(new MenuItem("3DS file...")); |
---|
364 | 472 | import3DSItem.addActionListener(this); |
---|
| 473 | + if (Globals.ADVANCED) |
---|
| 474 | + { |
---|
365 | 475 | importVRMLX3DItem = menu.add(new MenuItem("VRML/X3D file...")); |
---|
366 | 476 | importVRMLX3DItem.addActionListener(this); |
---|
| 477 | + } |
---|
367 | 478 | menu.add("-"); |
---|
368 | 479 | importGFDItem = menu.add(new MenuItem("Grafreed file...")); |
---|
369 | 480 | importGFDItem.addActionListener(this); |
---|
.. | .. |
---|
394 | 505 | //povItem.addActionListener(this); |
---|
395 | 506 | closeItem.addActionListener(this); |
---|
396 | 507 | |
---|
397 | | - objectPanel = new JTabbedPane(); |
---|
| 508 | + objectTabbedPane = new JTabbedPane(); |
---|
398 | 509 | |
---|
399 | 510 | ChangeListener changeListener = new ChangeListener() |
---|
400 | 511 | { |
---|
| 512 | + //String name; |
---|
| 513 | + |
---|
401 | 514 | public void stateChanged(ChangeEvent changeEvent) |
---|
402 | 515 | { |
---|
403 | 516 | // if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Material") && !materialFlushed) |
---|
.. | .. |
---|
416 | 529 | // EditSelection(false); |
---|
417 | 530 | // } |
---|
418 | 531 | |
---|
419 | | - refreshContents(false); // To refresh Info tab |
---|
| 532 | +// if (objectPanel.getSelectedIndex() == 4) |
---|
| 533 | +// { |
---|
| 534 | +// name = copy.skyboxname; |
---|
| 535 | +// |
---|
| 536 | +// if (name == null) |
---|
| 537 | +// { |
---|
| 538 | +// name = ""; |
---|
| 539 | +// } |
---|
| 540 | +// |
---|
| 541 | +// copy.skyboxname = "cubemaps/default-skyboxes/rgb"; |
---|
| 542 | +// copy.skyboxext = "jpg"; |
---|
| 543 | +// } |
---|
| 544 | +// else |
---|
| 545 | +// { |
---|
| 546 | +// if (name != null) |
---|
| 547 | +// { |
---|
| 548 | +// if (name.equals("")) |
---|
| 549 | +// { |
---|
| 550 | +// copy.skyboxname = null; |
---|
| 551 | +// copy.skyboxext = null; |
---|
| 552 | +// } |
---|
| 553 | +// else |
---|
| 554 | +// { |
---|
| 555 | +// copy.skyboxname = name; |
---|
| 556 | +// } |
---|
| 557 | +// } |
---|
| 558 | +// } |
---|
| 559 | + cameraView.transformMode = objectTabbedPane.getSelectedIndex() == 5; |
---|
| 560 | + |
---|
| 561 | +// refreshContents(false); // To refresh Info tab |
---|
| 562 | + cameraView.repaint(); |
---|
420 | 563 | } |
---|
421 | 564 | }; |
---|
422 | | - objectPanel.addChangeListener(changeListener); |
---|
| 565 | + objectTabbedPane.addChangeListener(changeListener); |
---|
423 | 566 | |
---|
424 | 567 | toolbarPanel = new JPanel(); |
---|
425 | 568 | toolbarPanel.setName("Toolbar"); |
---|
.. | .. |
---|
439 | 582 | toolboxPanel = new cGridBag().setVertical(true); |
---|
440 | 583 | //toolboxPanel.setName("Toolbox"); |
---|
441 | 584 | |
---|
442 | | - materialPanel = new cGridBag().setVertical(true); |
---|
| 585 | + skyboxPanel = new cGridBag().setVertical(true); |
---|
| 586 | + |
---|
| 587 | + materialPanel = new cGridBag().setVertical(false); |
---|
443 | 588 | //materialPanel.setName("Material"); |
---|
444 | 589 | |
---|
445 | 590 | /*JTextPane*/ |
---|
.. | .. |
---|
460 | 605 | //infoPanel.setLayout(new BorderLayout()); |
---|
461 | 606 | //infoPanel.add(createTextPane()); |
---|
462 | 607 | |
---|
463 | | - mainPanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, treePanel, objectPanel); |
---|
| 608 | + mainPanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, treePanel, objectTabbedPane); |
---|
464 | 609 | mainPanel.setName("Main"); |
---|
465 | 610 | mainPanel.setContinuousLayout(true); |
---|
466 | 611 | mainPanel.setOneTouchExpandable(true); |
---|
.. | .. |
---|
723 | 868 | boolean maximized; |
---|
724 | 869 | |
---|
725 | 870 | cButton fullscreenLayout; |
---|
| 871 | + cButton expandedLayout; |
---|
726 | 872 | |
---|
727 | 873 | void Minimize() |
---|
728 | 874 | { |
---|
.. | .. |
---|
761 | 907 | |
---|
762 | 908 | cButton minButton; |
---|
763 | 909 | cButton maxButton; |
---|
764 | | - cButton fullButton; |
---|
| 910 | + cButton fullScreenButton; |
---|
| 911 | + cButton collapseButton; |
---|
| 912 | + cButton maximize3DButton; |
---|
765 | 913 | |
---|
| 914 | + public void Show3DView() |
---|
| 915 | + { |
---|
| 916 | + // bug |
---|
| 917 | + //gridPanel.setDividerLocation(1.0); |
---|
| 918 | + //bigPanel.setDividerLocation(0.0); |
---|
| 919 | + bigThree.ClearUI(); |
---|
| 920 | + bigThree.add(centralPanel); |
---|
| 921 | + bigThree.FlushUI(); |
---|
| 922 | + } |
---|
| 923 | + |
---|
766 | 924 | void ToggleFullScreen() |
---|
767 | 925 | { |
---|
768 | | -GraphicsDevice device = frame.getGraphicsConfiguration().getDevice(); |
---|
| 926 | + GraphicsDevice device = frame.getGraphicsConfiguration().getDevice(); |
---|
769 | 927 | |
---|
770 | 928 | cameraView.ToggleFullScreen(); |
---|
771 | 929 | |
---|
.. | .. |
---|
786 | 944 | // X frame.getContentPane().remove(/*"Center",*/bigThree); |
---|
787 | 945 | // X framePanel.add(bigThree); |
---|
788 | 946 | // X frame.getContentPane().add(/*"Center",*/framePanel); |
---|
789 | | - framePanel.setDividerLocation(46); |
---|
| 947 | +// framePanel.setDividerLocation(46); // icons are 24x24 |
---|
790 | 948 | |
---|
791 | 949 | //frame.setVisible(true); |
---|
792 | 950 | radio.layout = keepButton; |
---|
.. | .. |
---|
797 | 955 | } else |
---|
798 | 956 | { |
---|
799 | 957 | keepButton = radio.layout; |
---|
| 958 | + |
---|
| 959 | + radio.layout = twoButton; |
---|
| 960 | + Show3DView(); |
---|
| 961 | + |
---|
800 | 962 | //keeprect = frame.getBounds(); |
---|
801 | 963 | // frame.setBounds(0, 0, frame.getToolkit().getScreenSize().width, |
---|
802 | 964 | // frame.getToolkit().getScreenSize().height); |
---|
.. | .. |
---|
813 | 975 | // X frame.getContentPane().remove(/*"Center",*/framePanel); |
---|
814 | 976 | // X framePanel.remove(bigThree); |
---|
815 | 977 | // X frame.getContentPane().add(/*"Center",*/bigThree); |
---|
816 | | - framePanel.setDividerLocation(0); |
---|
| 978 | +// framePanel.setDividerLocation(0); |
---|
817 | 979 | |
---|
818 | | - radio.layout = fullscreenLayout; |
---|
819 | | - radio.layout.doClick(); |
---|
| 980 | +// radio.layout = fullscreenLayout; |
---|
| 981 | +// radio.layout.doClick(); |
---|
820 | 982 | //frame.setVisible(true); |
---|
| 983 | + CollapseToolbar(); |
---|
821 | 984 | } |
---|
822 | 985 | frame.validate(); |
---|
| 986 | + |
---|
| 987 | + cameraView.requestFocusInWindow(); |
---|
823 | 988 | } |
---|
824 | 989 | |
---|
825 | | - private byte[] CompressCopy() |
---|
| 990 | + void CollapseToolbar() |
---|
| 991 | + { |
---|
| 992 | + framePanel.setDividerLocation(0); |
---|
| 993 | + //frame.validate(); |
---|
| 994 | + |
---|
| 995 | + cameraView.requestFocusInWindow(); |
---|
| 996 | + } |
---|
| 997 | + |
---|
| 998 | + private Object3D Duplicate(Object3D object) |
---|
826 | 999 | { |
---|
827 | 1000 | boolean temp = CameraPane.SWITCH; |
---|
828 | 1001 | CameraPane.SWITCH = false; |
---|
829 | 1002 | |
---|
830 | | - copy.ExtractBigData(versiontable); |
---|
| 1003 | + if (Grafreed.grafreed.universe.versiontable == null) |
---|
| 1004 | + Grafreed.grafreed.universe.versiontable = new java.util.Hashtable<java.util.UUID, Object3D>(); |
---|
| 1005 | + |
---|
| 1006 | + object.ExtractBigData(Grafreed.grafreed.universe.versiontable); |
---|
831 | 1007 | // if (copy == client) |
---|
832 | 1008 | |
---|
833 | | - byte[] versions[] = copy.versions; |
---|
834 | | - copy.versions = null; |
---|
| 1009 | + assert(!object.HasBigData()); |
---|
835 | 1010 | |
---|
836 | | - byte[] compress = Compress(copy); |
---|
| 1011 | + Object3D versions[] = object.versionlist; |
---|
| 1012 | + java.util.Hashtable<java.util.UUID, Object3D> versiontable = object.versiontable; // if Grafreed.grafreed.universe |
---|
| 1013 | + object.versionlist = null; |
---|
| 1014 | + object.versiontable = null; |
---|
837 | 1015 | |
---|
838 | | - copy.versions = versions; |
---|
| 1016 | + Object3D parent = object.parent; |
---|
| 1017 | + object.parent = null; |
---|
839 | 1018 | |
---|
840 | | - copy.RestoreBigData(versiontable); |
---|
| 1019 | + //byte[] compress = Compress(copy); |
---|
| 1020 | + Object3D compress = (Object3D)Grafreed.clone(object); |
---|
| 1021 | + |
---|
| 1022 | + assert(!compress.HasBigData()); |
---|
| 1023 | + |
---|
| 1024 | + object.parent = parent; |
---|
| 1025 | + |
---|
| 1026 | + object.versionlist = versions; |
---|
| 1027 | + object.versiontable = versiontable; // if Grafreed.grafreed.universe |
---|
| 1028 | + |
---|
| 1029 | + object.RestoreBigData(Grafreed.grafreed.universe.versiontable); |
---|
841 | 1030 | |
---|
842 | 1031 | CameraPane.SWITCH = temp; |
---|
843 | 1032 | |
---|
.. | .. |
---|
965 | 1154 | { |
---|
966 | 1155 | SetupMaterial(materialPanel); |
---|
967 | 1156 | } |
---|
| 1157 | + |
---|
968 | 1158 | //SetupName(); |
---|
969 | 1159 | //SetupViews(); |
---|
970 | 1160 | } |
---|
.. | .. |
---|
1004 | 1194 | cGridBag setupPanel2; |
---|
1005 | 1195 | cGridBag objectCommandsPanel; |
---|
1006 | 1196 | cGridBag pushPanel; |
---|
| 1197 | + cGridBag versionPanel; |
---|
1007 | 1198 | cGridBag fillPanel; |
---|
1008 | 1199 | |
---|
1009 | 1200 | JCheckBox AddCheckBox(cGridBag panel, String label, boolean on) |
---|
.. | .. |
---|
1166 | 1357 | obj = o; |
---|
1167 | 1358 | } |
---|
1168 | 1359 | } |
---|
| 1360 | + |
---|
| 1361 | + String GetSupportText() |
---|
| 1362 | + { |
---|
| 1363 | + return "Support"; |
---|
| 1364 | + } |
---|
1169 | 1365 | |
---|
1170 | 1366 | void SetupUI2(ObjEditor oe) |
---|
1171 | 1367 | { |
---|
.. | .. |
---|
1173 | 1369 | |
---|
1174 | 1370 | namePanel = new cGridBag(); |
---|
1175 | 1371 | |
---|
| 1372 | + //if (copy.pinned) |
---|
| 1373 | + { |
---|
| 1374 | + pinButton = GetToggleButton("icons/pin.png", !Globals.NIMBUSLAF); |
---|
| 1375 | + pinButton.setSelected(copy.pinned); |
---|
| 1376 | + cGridBag t = new cGridBag(); |
---|
| 1377 | + t.preferredWidth = 2; |
---|
| 1378 | + t.add(pinButton); |
---|
| 1379 | + namePanel.add(t); |
---|
| 1380 | + |
---|
| 1381 | + pinButton.addItemListener(this); |
---|
| 1382 | + } |
---|
| 1383 | + |
---|
1176 | 1384 | nameField = AddText(namePanel, copy.GetName()); |
---|
1177 | 1385 | namePanel.add(new JScrollPane(nameField, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER)); |
---|
1178 | 1386 | oe.ctrlPanel.add(namePanel); |
---|
.. | .. |
---|
1186 | 1394 | |
---|
1187 | 1395 | liveCB = AddCheckBox(setupPanel, "Live", copy.live); |
---|
1188 | 1396 | liveCB.setToolTipText("Animate object"); |
---|
| 1397 | + markCB = AddCheckBox(setupPanel, "Anim", copy.marked); |
---|
| 1398 | + markCB.setToolTipText("Set target transform"); |
---|
1189 | 1399 | selectableCB = AddCheckBox(setupPanel, "Select", !copy.dontselect); |
---|
1190 | 1400 | selectableCB.setToolTipText("Make object selectable"); |
---|
1191 | 1401 | // Return(); |
---|
1192 | 1402 | |
---|
1193 | 1403 | hideCB = AddCheckBox(setupPanel, "Hide", copy.hide); |
---|
1194 | 1404 | hideCB.setToolTipText("Hide object"); |
---|
1195 | | - markCB = AddCheckBox(setupPanel, "Mark", copy.marked); |
---|
1196 | | - markCB.setToolTipText("As animation target transform"); |
---|
1197 | 1405 | |
---|
1198 | 1406 | ToolTipManager.sharedInstance().setLightWeightPopupEnabled(false); |
---|
1199 | 1407 | |
---|
.. | .. |
---|
1205 | 1413 | randomCB = AddCheckBox(setupPanel2, "Random", copy.random); |
---|
1206 | 1414 | randomCB.setToolTipText("Randomly Rewind (or Go back and forth)"); |
---|
1207 | 1415 | |
---|
1208 | | - link2masterCB = AddCheckBox(setupPanel2, "Support", copy.link2master); |
---|
| 1416 | + link2masterCB = AddCheckBox(setupPanel2, GetSupportText(), copy.link2master); |
---|
1209 | 1417 | link2masterCB.setToolTipText("Attach to support"); |
---|
1210 | 1418 | |
---|
1211 | 1419 | if (Globals.ADVANCED) |
---|
.. | .. |
---|
1238 | 1446 | oe.ctrlPanel.add(objectCommandsPanel); |
---|
1239 | 1447 | oe.ctrlPanel.Return(); |
---|
1240 | 1448 | |
---|
1241 | | - pushPanel = AddSlider(oe.ctrlPanel, "Push", -1, 1, copy.NORMALPUSH, 1.1); // To have the buttons |
---|
| 1449 | + pushPanel = AddSlider(oe.ctrlPanel, "Push", -1, 1, copy.NORMALPUSH * 100, 1.1); // To have the buttons |
---|
1242 | 1450 | normalpushField = (cNumberSlider)pushPanel.getComponent(1); |
---|
1243 | | - //Return(); |
---|
| 1451 | + if (false && copy.versionlist != null && copy.versionindex != -1) |
---|
| 1452 | + { |
---|
| 1453 | + oe.ctrlPanel.Return(); |
---|
| 1454 | + versionPanel = AddSlider(oe.ctrlPanel, "Version", 0, copy.VersionCount() - 1, copy.versionindex); |
---|
| 1455 | + versionField = (cNumberSlider)versionPanel.getComponent(1); |
---|
| 1456 | + } |
---|
1244 | 1457 | |
---|
1245 | 1458 | oe.ctrlPanel.Return(); |
---|
1246 | 1459 | |
---|
.. | .. |
---|
1377 | 1590 | |
---|
1378 | 1591 | return null; |
---|
1379 | 1592 | } |
---|
| 1593 | + |
---|
| 1594 | + int objectTabCount; |
---|
1380 | 1595 | |
---|
1381 | 1596 | void SetupViews() |
---|
1382 | 1597 | { |
---|
.. | .. |
---|
1395 | 1610 | |
---|
1396 | 1611 | if (cam == null || !(copy.get(0) instanceof cGroup)) |
---|
1397 | 1612 | { |
---|
1398 | | - System.out.println("CREATE CAMERAS"); |
---|
1399 | | - cams = new cTemplate(); |
---|
1400 | | - cams.name = "Cameras"; |
---|
1401 | | - copy.insertElementAt(cams, 0); |
---|
1402 | | - //cams.parent = copy; |
---|
1403 | | - |
---|
1404 | | - cam = new Camera(); // LA.newVector(3, 2, 1)); |
---|
1405 | | - cams.addChild(cam); |
---|
1406 | | - cam = new Camera(1); |
---|
1407 | | - cams.addChild(cam); |
---|
1408 | | - cam = new Camera(2); |
---|
1409 | | - cams.addChild(cam); |
---|
1410 | | - cam = new Camera(3); |
---|
1411 | | - cams.addChild(cam); |
---|
1412 | | - cam = new Camera(4); // Light |
---|
1413 | | - cams.addChild(cam); |
---|
| 1613 | + if (Globals.DEBUG) |
---|
| 1614 | + System.out.println("CREATE CAMERAS"); |
---|
| 1615 | + cams = CreateCameras(); |
---|
1414 | 1616 | } else |
---|
1415 | 1617 | { |
---|
1416 | 1618 | cams = (cGroup) copy.get(0); |
---|
.. | .. |
---|
1476 | 1678 | //frontView.object = copy; |
---|
1477 | 1679 | //sideView.object = copy; |
---|
1478 | 1680 | |
---|
| 1681 | + transformPanel = new cGridBag().setVertical(true); |
---|
| 1682 | + |
---|
| 1683 | + cGridBag resetTransformPanel = new cGridBag(); |
---|
| 1684 | + |
---|
| 1685 | + resetTransformPanel.preferredHeight = 2; |
---|
| 1686 | + |
---|
| 1687 | + cButton resetTransform = GetButton("Reset all", !Globals.NIMBUSLAF); |
---|
| 1688 | + resetTransform.setToolTipText("Reset Translation, Rotation and Scale"); |
---|
| 1689 | + resetTransform.addMouseListener(new MouseAdapter() |
---|
| 1690 | + { |
---|
| 1691 | + public void mouseClicked(MouseEvent e) |
---|
| 1692 | + { |
---|
| 1693 | + ResetTransform(); |
---|
| 1694 | + } |
---|
| 1695 | + }); |
---|
| 1696 | + resetTransformPanel.add(resetTransform); |
---|
| 1697 | + |
---|
| 1698 | + resetTransform = GetButton("T only", !Globals.NIMBUSLAF); |
---|
| 1699 | + resetTransform.setToolTipText("Reset Translation only"); |
---|
| 1700 | + resetTransform.addMouseListener(new MouseAdapter() |
---|
| 1701 | + { |
---|
| 1702 | + public void mouseClicked(MouseEvent e) |
---|
| 1703 | + { |
---|
| 1704 | + ResetTransform(1); |
---|
| 1705 | + } |
---|
| 1706 | + }); |
---|
| 1707 | + resetTransformPanel.add(resetTransform); |
---|
| 1708 | + |
---|
| 1709 | + resetTransform = GetButton("RS only", !Globals.NIMBUSLAF); |
---|
| 1710 | + resetTransform.setToolTipText("Reset Rotation and Scale only"); |
---|
| 1711 | + resetTransform.addMouseListener(new MouseAdapter() |
---|
| 1712 | + { |
---|
| 1713 | + public void mouseClicked(MouseEvent e) |
---|
| 1714 | + { |
---|
| 1715 | + ResetTransform(2); |
---|
| 1716 | + } |
---|
| 1717 | + }); |
---|
| 1718 | + resetTransformPanel.add(resetTransform); |
---|
| 1719 | + |
---|
1479 | 1720 | XYZPanel = new cGridBag().setVertical(true); |
---|
1480 | 1721 | //XYZPanel.setLayout(new GridLayout(3, 1, 5, 5)); |
---|
1481 | 1722 | |
---|
.. | .. |
---|
1485 | 1726 | XYZPanel.addComponent(/*BorderLayout.NORTH,*/topView); // Scroll); |
---|
1486 | 1727 | //XYZPanel.setName("XYZ"); |
---|
1487 | 1728 | |
---|
| 1729 | + transformPanel.add(resetTransformPanel); |
---|
| 1730 | + |
---|
| 1731 | + cGridBag scalePanel = AddSlider(transformPanel, "Scale", 1, 10, 1); |
---|
| 1732 | + scalePanel.preferredHeight = 2; |
---|
| 1733 | + scaleSlider = (cNumberSlider)scalePanel.getComponent(1); |
---|
| 1734 | + transformPanel.add(scalePanel); |
---|
| 1735 | + |
---|
| 1736 | + transformPanel.add(XYZPanel); |
---|
| 1737 | + |
---|
1488 | 1738 | /* |
---|
1489 | 1739 | gridPanel = new JPanel(); //new BorderLayout()); |
---|
1490 | 1740 | gridPanel.setLayout(new GridLayout(1, 2)); |
---|
.. | .. |
---|
1492 | 1742 | gridPanel.add(cameraView); |
---|
1493 | 1743 | gridPanel.add(XYZPanel); |
---|
1494 | 1744 | */ |
---|
1495 | | - gridPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, centralPanel, XYZPanel); //new BorderLayout()); |
---|
1496 | | - gridPanel.setContinuousLayout(true); |
---|
1497 | | - gridPanel.setOneTouchExpandable(true); |
---|
1498 | | - gridPanel.setDividerLocation(1.0); |
---|
1499 | | - gridPanel.setDividerSize(9); |
---|
1500 | | - gridPanel.setResizeWeight(0.85); |
---|
| 1745 | +// gridPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, centralPanel, XYZPanel); //new BorderLayout()); |
---|
| 1746 | +// gridPanel.setContinuousLayout(true); |
---|
| 1747 | +// gridPanel.setOneTouchExpandable(true); |
---|
| 1748 | +// gridPanel.setDividerLocation(1.0); |
---|
| 1749 | +// gridPanel.setDividerSize(9); |
---|
| 1750 | +// gridPanel.setResizeWeight(0.85); |
---|
1501 | 1751 | |
---|
1502 | 1752 | // aConstraints.weighty = 0; |
---|
1503 | 1753 | //System.out.println("THIS = " + this); |
---|
.. | .. |
---|
1520 | 1770 | |
---|
1521 | 1771 | //JScrollPane tmp = new JScrollPane(ctrlPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); |
---|
1522 | 1772 | //tmp.setName("Edit"); |
---|
1523 | | - objectPanel.add(materialPanel); |
---|
1524 | | - objectPanel.setIconAt(0, GetIcon("icons/material.png")); |
---|
| 1773 | + |
---|
| 1774 | + objectTabCount = 0; |
---|
| 1775 | + |
---|
| 1776 | + objectTabbedPane.add(skyboxPanel); |
---|
| 1777 | + objectTabbedPane.setIconAt(objectTabCount, GetIcon("icons/skybox.jpg")); |
---|
| 1778 | + objectTabbedPane.setToolTipTextAt(objectTabCount++, "Backgrounds"); |
---|
| 1779 | + |
---|
| 1780 | + objectTabbedPane.add(toolboxPanel); |
---|
| 1781 | + objectTabbedPane.setIconAt(objectTabCount, GetIcon("icons/primitives.png")); |
---|
| 1782 | + objectTabbedPane.setToolTipTextAt(objectTabCount++, "Objects & textures"); |
---|
| 1783 | + |
---|
| 1784 | + objectTabbedPane.add(materialPanel); |
---|
| 1785 | + objectTabbedPane.setIconAt(objectTabCount, GetIcon("icons/material.png")); |
---|
| 1786 | + objectTabbedPane.setToolTipTextAt(objectTabCount++, "Material"); |
---|
| 1787 | + |
---|
| 1788 | + figurePanel = new cGridBag(); |
---|
| 1789 | + figurePanel.add(new cButton("FIGURES amd POSES coming soon!")); |
---|
| 1790 | + objectTabbedPane.add(figurePanel); |
---|
| 1791 | + objectTabbedPane.setIconAt(objectTabCount, GetIcon("icons/figure.png")); |
---|
| 1792 | + objectTabbedPane.setToolTipTextAt(objectTabCount++, "Figures and poses"); |
---|
| 1793 | + |
---|
1525 | 1794 | // JPanel north = new JPanel(new BorderLayout()); |
---|
1526 | 1795 | // north.setName("Edit"); |
---|
1527 | 1796 | // north.add(ctrlPanel, BorderLayout.NORTH); |
---|
1528 | 1797 | // objectPanel.add(north); |
---|
1529 | | - objectPanel.add(editPanel); |
---|
1530 | | - objectPanel.setIconAt(1, GetIcon("icons/write.png")); |
---|
| 1798 | + objectTabbedPane.add(editPanel); |
---|
| 1799 | + objectTabbedPane.setIconAt(objectTabCount, GetIcon("icons/writewhite.png")); |
---|
| 1800 | + objectTabbedPane.setToolTipTextAt(objectTabCount++, "Edit controls"); |
---|
1531 | 1801 | |
---|
1532 | | - //if (Globals.ADVANCED) |
---|
1533 | | - objectPanel.add(infoPanel); |
---|
1534 | | - objectPanel.setIconAt(2, GetIcon("icons/info.png")); |
---|
| 1802 | + objectTabbedPane.add(transformPanel); |
---|
| 1803 | + objectTabbedPane.setIconAt(objectTabCount, GetIcon("icons/XYZ.png")); |
---|
| 1804 | + objectTabbedPane.setToolTipTextAt(objectTabCount++, "TRS transform"); |
---|
1535 | 1805 | |
---|
1536 | | - objectPanel.add(XYZPanel); |
---|
1537 | | - objectPanel.setIconAt(3, GetIcon("icons/XYZ.png")); |
---|
1538 | | - |
---|
1539 | | - objectPanel.add(toolboxPanel); |
---|
1540 | | - objectPanel.setIconAt(4, GetIcon("icons/primitives.png")); |
---|
1541 | | - |
---|
| 1806 | + patchMaterial = true; |
---|
| 1807 | + cameraView.patchMaterial = this; |
---|
| 1808 | + objectTabbedPane.setSelectedIndex(2); |
---|
| 1809 | + |
---|
1542 | 1810 | /* |
---|
1543 | 1811 | aConstraints.gridx = 0; |
---|
1544 | 1812 | aConstraints.gridwidth = 1; |
---|
.. | .. |
---|
1558 | 1826 | scrollpane.addMouseWheelListener(this); // Default not fast enough |
---|
1559 | 1827 | |
---|
1560 | 1828 | /*JTabbedPane*/ scenePanel = new cGridBag(); |
---|
1561 | | - scenePanel.preferredWidth = 5; |
---|
| 1829 | + scenePanel.preferredWidth = 6; |
---|
1562 | 1830 | |
---|
1563 | 1831 | JTabbedPane tabbedPane = new JTabbedPane(); |
---|
1564 | 1832 | tabbedPane.add(scrollpane); |
---|
.. | .. |
---|
1569 | 1837 | |
---|
1570 | 1838 | AddOptions(optionsPanel); //, aConstraints); |
---|
1571 | 1839 | |
---|
1572 | | - tabbedPane.add(optionsPanel); |
---|
1573 | | - |
---|
1574 | 1840 | tabbedPane.add(FSPane = new cFileSystemPane(this)); |
---|
1575 | 1841 | |
---|
| 1842 | + tabbedPane.add(optionsPanel); |
---|
| 1843 | + |
---|
1576 | 1844 | scenePanel.add(tabbedPane); |
---|
| 1845 | + |
---|
| 1846 | + cGridBag creditsPanel = new cGridBag().setVertical(true); |
---|
| 1847 | + creditsPanel.setName("Credits"); |
---|
| 1848 | + |
---|
| 1849 | + cLabel ogaLabel = new cLabel(" Skyboxes courtesy of OpenGameArt!", !Globals.NIMBUSLAF); |
---|
| 1850 | + creditsPanel.add(ogaLabel); |
---|
| 1851 | + |
---|
| 1852 | + cButton creditButton; |
---|
| 1853 | + creditsPanel.add(creditButton = GetButton("icons/sara-logo.png", !Globals.NIMBUSLAF)); |
---|
| 1854 | + creditButton.setToolTipText("https://opengameart.org"); |
---|
| 1855 | + |
---|
| 1856 | + creditButton.addMouseListener(new MouseAdapter() |
---|
| 1857 | + { |
---|
| 1858 | + public void mouseClicked(MouseEvent e) |
---|
| 1859 | + { |
---|
| 1860 | + try |
---|
| 1861 | + { |
---|
| 1862 | + Desktop.getDesktop().browse(new java.net.URI("https://opengameart.org/")); |
---|
| 1863 | + } catch (Exception e1) |
---|
| 1864 | +// } catch (java.io.IOException | java.net.URISyntaxException e1) |
---|
| 1865 | + { |
---|
| 1866 | + e1.printStackTrace(); |
---|
| 1867 | + } |
---|
| 1868 | + } |
---|
| 1869 | + }); |
---|
| 1870 | + |
---|
| 1871 | + ogaLabel = new cLabel(" Download 3D models! (.3ds and .obj only)", !Globals.NIMBUSLAF); |
---|
| 1872 | + creditsPanel.add(ogaLabel); |
---|
| 1873 | + |
---|
| 1874 | + creditsPanel.add(creditButton = GetButton("icons/3delicious.png", !Globals.NIMBUSLAF)); |
---|
| 1875 | + creditButton.setToolTipText("https://3delicious.net"); |
---|
| 1876 | + |
---|
| 1877 | + creditButton.addMouseListener(new MouseAdapter() |
---|
| 1878 | + { |
---|
| 1879 | + public void mouseClicked(MouseEvent e) |
---|
| 1880 | + { |
---|
| 1881 | + try |
---|
| 1882 | + { |
---|
| 1883 | + Desktop.getDesktop().browse(new java.net.URI("https://3delicious.net")); |
---|
| 1884 | + } catch (Exception e1) |
---|
| 1885 | +// } catch (java.io.IOException | java.net.URISyntaxException e1) |
---|
| 1886 | + { |
---|
| 1887 | + e1.printStackTrace(); |
---|
| 1888 | + } |
---|
| 1889 | + } |
---|
| 1890 | + }); |
---|
| 1891 | + |
---|
| 1892 | + creditsPanel.add(creditButton = GetButton("icons/archive3d.png", !Globals.NIMBUSLAF)); |
---|
| 1893 | + creditButton.setToolTipText("https://archive3d.net"); |
---|
| 1894 | + |
---|
| 1895 | + creditButton.addMouseListener(new MouseAdapter() |
---|
| 1896 | + { |
---|
| 1897 | + public void mouseClicked(MouseEvent e) |
---|
| 1898 | + { |
---|
| 1899 | + try |
---|
| 1900 | + { |
---|
| 1901 | + Desktop.getDesktop().browse(new java.net.URI("https://archive3d.net")); |
---|
| 1902 | + } catch (Exception e1) |
---|
| 1903 | +// } catch (java.io.IOException | java.net.URISyntaxException e1) |
---|
| 1904 | + { |
---|
| 1905 | + e1.printStackTrace(); |
---|
| 1906 | + } |
---|
| 1907 | + } |
---|
| 1908 | + }); |
---|
| 1909 | + |
---|
| 1910 | + creditsPanel.add(creditButton = GetButton("icons/turbosquid.png", !Globals.NIMBUSLAF)); |
---|
| 1911 | + creditButton.setToolTipText("https://turbosquid.com"); |
---|
| 1912 | + |
---|
| 1913 | + creditButton.addMouseListener(new MouseAdapter() |
---|
| 1914 | + { |
---|
| 1915 | + public void mouseClicked(MouseEvent e) |
---|
| 1916 | + { |
---|
| 1917 | + try |
---|
| 1918 | + { |
---|
| 1919 | + Desktop.getDesktop().browse(new java.net.URI("https://www.turbosquid.com/Search/3D-Models/free")); |
---|
| 1920 | + } catch (Exception e1) |
---|
| 1921 | +// } catch (java.io.IOException | java.net.URISyntaxException e1) |
---|
| 1922 | + { |
---|
| 1923 | + e1.printStackTrace(); |
---|
| 1924 | + } |
---|
| 1925 | + } |
---|
| 1926 | + }); |
---|
| 1927 | + |
---|
| 1928 | + for (int i=6; --i>=0;) |
---|
| 1929 | + { |
---|
| 1930 | + creditsPanel.add(new cGridBag()); |
---|
| 1931 | + } |
---|
| 1932 | + |
---|
| 1933 | + tabbedPane.add(creditsPanel); |
---|
| 1934 | + tabbedPane.setToolTipTextAt(3, "Credits"); |
---|
| 1935 | + |
---|
| 1936 | + if (Globals.SHOWINFO) |
---|
| 1937 | + { |
---|
| 1938 | + objectTabbedPane.add(infoPanel); |
---|
| 1939 | + objectTabbedPane.setIconAt(objectTabCount, GetIcon("icons/info.png")); |
---|
| 1940 | + objectTabbedPane.setToolTipTextAt(objectTabCount++, "Information"); |
---|
| 1941 | + } |
---|
1577 | 1942 | |
---|
1578 | 1943 | /* |
---|
1579 | 1944 | cTree jTree = new cTree(null); |
---|
.. | .. |
---|
1595 | 1960 | jtp.add(tree); |
---|
1596 | 1961 | */ |
---|
1597 | 1962 | |
---|
1598 | | - bigPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, scenePanel, gridPanel); |
---|
1599 | | - bigPanel.setContinuousLayout(true); |
---|
1600 | | - bigPanel.setOneTouchExpandable(true); |
---|
1601 | | - bigPanel.setDividerLocation(0.8); |
---|
1602 | | - bigPanel.setDividerSize(15); |
---|
1603 | | - bigPanel.setResizeWeight(0.15); |
---|
1604 | | - bigPanel.setName("Scene"); |
---|
| 1963 | +// bigPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, scenePanel, gridPanel); |
---|
| 1964 | +// bigPanel.setContinuousLayout(true); |
---|
| 1965 | +// bigPanel.setOneTouchExpandable(true); |
---|
| 1966 | +// bigPanel.setDividerLocation(0.8); |
---|
| 1967 | +// bigPanel.setDividerSize(15); |
---|
| 1968 | +// bigPanel.setResizeWeight(0.15); |
---|
| 1969 | +// bigPanel.setName("Scene"); |
---|
1605 | 1970 | |
---|
1606 | 1971 | //bigPanel.setLayout(new BorderLayout()); |
---|
1607 | 1972 | //bigPanel.setSize(new Dimension(10,10)); |
---|
.. | .. |
---|
1634 | 1999 | /**/ |
---|
1635 | 2000 | |
---|
1636 | 2001 | bigThree = new cGridBag(); |
---|
1637 | | - bigThree.addComponent(centralPanel); |
---|
1638 | 2002 | bigThree.addComponent(scenePanel); |
---|
| 2003 | + bigThree.addComponent(centralPanel); |
---|
1639 | 2004 | //bigThree.addComponent(XYZPanel); |
---|
1640 | 2005 | |
---|
1641 | 2006 | // // SIDE EFFECT!!! |
---|
.. | .. |
---|
1645 | 2010 | // aConstraints.gridheight = 1; |
---|
1646 | 2011 | |
---|
1647 | 2012 | framePanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, toolbarPanel, bigThree); |
---|
| 2013 | + |
---|
| 2014 | + framePanel.addPropertyChangeListener(JSplitPane.DIVIDER_LOCATION_PROPERTY, |
---|
| 2015 | + new java.beans.PropertyChangeListener() |
---|
| 2016 | + { |
---|
| 2017 | + public void propertyChange(java.beans.PropertyChangeEvent pce) |
---|
| 2018 | + { |
---|
| 2019 | + if ((Integer)pce.getOldValue() == 1) |
---|
| 2020 | + { |
---|
| 2021 | + if (CameraPane.FULLSCREEN) |
---|
| 2022 | + { |
---|
| 2023 | + ToggleFullScreen(); |
---|
| 2024 | + } |
---|
| 2025 | + |
---|
| 2026 | +// if (radio.layout != expandedLayout) |
---|
| 2027 | +// { |
---|
| 2028 | +// radio.layout = expandedLayout; |
---|
| 2029 | +// radio.layout.doClick(); |
---|
| 2030 | +// } |
---|
| 2031 | + } |
---|
| 2032 | + } |
---|
| 2033 | + }); |
---|
| 2034 | + |
---|
1648 | 2035 | framePanel.setContinuousLayout(false); |
---|
1649 | 2036 | framePanel.setOneTouchExpandable(false); |
---|
1650 | 2037 | //.setDividerLocation(0.8); |
---|
.. | .. |
---|
1654 | 2041 | |
---|
1655 | 2042 | frame.getContentPane().setLayout(new BorderLayout()); |
---|
1656 | 2043 | /**/ |
---|
1657 | | - JTabbedPane worldPane = new JTabbedPane(); |
---|
| 2044 | + //JTabbedPane worldPane = new JTabbedPane(); |
---|
1658 | 2045 | //worldPane.add(bigPanel); |
---|
1659 | 2046 | //worldPane.add(worldPanel); |
---|
1660 | 2047 | /**/ |
---|
.. | .. |
---|
1664 | 2051 | |
---|
1665 | 2052 | // aConstraints = gbc; // (GridBagConstraints) GrafreeD.clone(gbc); |
---|
1666 | 2053 | |
---|
1667 | | - frame.setSize(1280, 860); |
---|
| 2054 | + frame.setSize(1280, 900); |
---|
1668 | 2055 | |
---|
1669 | 2056 | cameraView.requestFocusInWindow(); |
---|
1670 | 2057 | |
---|
1671 | | - gridPanel.setDividerLocation(1.0); |
---|
| 2058 | +// gridPanel.setDividerLocation(1.0); |
---|
1672 | 2059 | |
---|
1673 | 2060 | frame.validate(); |
---|
1674 | 2061 | |
---|
.. | .. |
---|
1677 | 2064 | frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); |
---|
1678 | 2065 | frame.addWindowListener(new WindowAdapter() |
---|
1679 | 2066 | { |
---|
1680 | | - |
---|
1681 | 2067 | public void windowClosing(WindowEvent e) |
---|
1682 | 2068 | { |
---|
1683 | 2069 | Close(); |
---|
.. | .. |
---|
1700 | 2086 | ctrlPanel.removeAll(); |
---|
1701 | 2087 | } |
---|
1702 | 2088 | |
---|
1703 | | - void SetupMaterial(cGridBag panel) |
---|
| 2089 | + void SetupMaterial(cGridBag materialpanel) |
---|
1704 | 2090 | { |
---|
1705 | | - /* |
---|
| 2091 | + cGridBag presetpanel = new cGridBag().setVertical(true); |
---|
| 2092 | + |
---|
| 2093 | + cLabel skin = GetLabel("icons/shadericons/shadericon00000.png", !Globals.NIMBUSLAF); |
---|
| 2094 | + skin.setToolTipText("Skin"); |
---|
| 2095 | + skin.addMouseListener(new MouseAdapter() |
---|
| 2096 | + { |
---|
| 2097 | + public void mouseClicked(MouseEvent e) |
---|
| 2098 | + { |
---|
| 2099 | + Object3D object = Grafreed.materials.versionlist[0].get(0); |
---|
| 2100 | + cMaterial material = object.material; |
---|
| 2101 | + |
---|
| 2102 | + // Skin |
---|
| 2103 | + colorField.setFloat(material.color); |
---|
| 2104 | + float saturation = material.modulation; |
---|
| 2105 | + |
---|
| 2106 | + if (!cameraView.Skinshader) |
---|
| 2107 | + { |
---|
| 2108 | + saturation /= 1.5; |
---|
| 2109 | + } |
---|
| 2110 | + |
---|
| 2111 | + saturationField.setFloat(saturation); |
---|
| 2112 | + |
---|
| 2113 | + subsurfaceField.setFloat(material.subsurface); |
---|
| 2114 | + selfshadowField.setFloat(material.diffuseness); |
---|
| 2115 | + diffusenessField.setFloat(material.factor); |
---|
| 2116 | + shininessField.setFloat(material.shininess); |
---|
| 2117 | + shadowbiasField.setFloat(material.shadowbias); |
---|
| 2118 | + diffuseField.setFloat(material.diffuse); |
---|
| 2119 | + specularField.setFloat(material.specular); |
---|
| 2120 | + |
---|
| 2121 | + bumpField.setFloat(object.projectedVertices[0].x / 1000.0); |
---|
| 2122 | + noiseField.setFloat(object.projectedVertices[0].y / 1000.0); |
---|
| 2123 | + powerField.setFloat(object.projectedVertices[2].x / 1000.0); |
---|
| 2124 | + |
---|
| 2125 | + materialtouched = true; |
---|
| 2126 | + applySelf(); |
---|
| 2127 | + } |
---|
| 2128 | + }); |
---|
| 2129 | + presetpanel.add(skin); |
---|
| 2130 | + |
---|
| 2131 | + cLabel lambert = GetLabel("icons/shadericons/shadericon00002.png", !Globals.NIMBUSLAF); |
---|
| 2132 | + lambert.setToolTipText("Diffuse"); |
---|
| 2133 | + lambert.addMouseListener(new MouseAdapter() |
---|
| 2134 | + { |
---|
| 2135 | + public void mouseClicked(MouseEvent e) |
---|
| 2136 | + { |
---|
| 2137 | + Object3D object = Grafreed.materials.versionlist[2].get(0); |
---|
| 2138 | + cMaterial material = object.material; |
---|
| 2139 | + |
---|
| 2140 | + diffusenessField.setFloat(material.factor); |
---|
| 2141 | + selfshadowField.setFloat(material.diffuseness); |
---|
| 2142 | + |
---|
| 2143 | + materialtouched = true; |
---|
| 2144 | + applySelf(); |
---|
| 2145 | + } |
---|
| 2146 | + }); |
---|
| 2147 | + presetpanel.add(lambert); |
---|
| 2148 | + |
---|
| 2149 | + cLabel diffuse2 = GetLabel("icons/shadericons/shadericon00003.png", !Globals.NIMBUSLAF); |
---|
| 2150 | + diffuse2.setToolTipText("Diffuse2"); |
---|
| 2151 | + diffuse2.addMouseListener(new MouseAdapter() |
---|
| 2152 | + { |
---|
| 2153 | + public void mouseClicked(MouseEvent e) |
---|
| 2154 | + { |
---|
| 2155 | + Object3D object = Grafreed.materials.versionlist[3].get(0); |
---|
| 2156 | + cMaterial material = object.material; |
---|
| 2157 | + |
---|
| 2158 | + diffusenessField.setFloat(material.factor); |
---|
| 2159 | + selfshadowField.setFloat(material.diffuseness); |
---|
| 2160 | + |
---|
| 2161 | + materialtouched = true; |
---|
| 2162 | + applySelf(); |
---|
| 2163 | + } |
---|
| 2164 | + }); |
---|
| 2165 | + presetpanel.add(diffuse2); |
---|
| 2166 | + |
---|
| 2167 | + cLabel diffusemoon = GetLabel("icons/shadericons/shadericon00004.png", !Globals.NIMBUSLAF); |
---|
| 2168 | + diffusemoon.setToolTipText("Moon"); |
---|
| 2169 | + diffusemoon.addMouseListener(new MouseAdapter() |
---|
| 2170 | + { |
---|
| 2171 | + public void mouseClicked(MouseEvent e) |
---|
| 2172 | + { |
---|
| 2173 | + Object3D object = Grafreed.materials.versionlist[4].get(0); |
---|
| 2174 | + cMaterial material = object.material; |
---|
| 2175 | + |
---|
| 2176 | + diffusenessField.setFloat(material.factor); |
---|
| 2177 | + selfshadowField.setFloat(material.diffuseness); |
---|
| 2178 | + |
---|
| 2179 | + materialtouched = true; |
---|
| 2180 | + applySelf(); |
---|
| 2181 | + } |
---|
| 2182 | + }); |
---|
| 2183 | + presetpanel.add(diffusemoon); |
---|
| 2184 | + |
---|
| 2185 | + cLabel diffusemoon2 = GetLabel("icons/shadericons/shadericon00005.png", !Globals.NIMBUSLAF); |
---|
| 2186 | + diffusemoon2.setToolTipText("Moon2"); |
---|
| 2187 | + diffusemoon2.addMouseListener(new MouseAdapter() |
---|
| 2188 | + { |
---|
| 2189 | + public void mouseClicked(MouseEvent e) |
---|
| 2190 | + { |
---|
| 2191 | + Object3D object = Grafreed.materials.versionlist[5].get(0); |
---|
| 2192 | + cMaterial material = object.material; |
---|
| 2193 | + |
---|
| 2194 | + diffusenessField.setFloat(material.factor); |
---|
| 2195 | + selfshadowField.setFloat(material.diffuseness); |
---|
| 2196 | + |
---|
| 2197 | + materialtouched = true; |
---|
| 2198 | + applySelf(); |
---|
| 2199 | + } |
---|
| 2200 | + }); |
---|
| 2201 | + presetpanel.add(diffusemoon2); |
---|
| 2202 | + |
---|
| 2203 | + cLabel diffusemoon3 = GetLabel("icons/shadericons/shadericon00006.png", !Globals.NIMBUSLAF); |
---|
| 2204 | + diffusemoon3.setToolTipText("Moon3"); |
---|
| 2205 | + diffusemoon3.addMouseListener(new MouseAdapter() |
---|
| 2206 | + { |
---|
| 2207 | + public void mouseClicked(MouseEvent e) |
---|
| 2208 | + { |
---|
| 2209 | + Object3D object = Grafreed.materials.versionlist[6].get(0); |
---|
| 2210 | + cMaterial material = object.material; |
---|
| 2211 | + |
---|
| 2212 | + diffusenessField.setFloat(material.factor); |
---|
| 2213 | + selfshadowField.setFloat(material.diffuseness); |
---|
| 2214 | + |
---|
| 2215 | + materialtouched = true; |
---|
| 2216 | + applySelf(); |
---|
| 2217 | + } |
---|
| 2218 | + }); |
---|
| 2219 | + presetpanel.add(diffusemoon3); |
---|
| 2220 | + |
---|
| 2221 | + cLabel diffusesheen = GetLabel("icons/shadericons/shadericon00007.png", !Globals.NIMBUSLAF); |
---|
| 2222 | + diffusesheen.setToolTipText("Sheen"); |
---|
| 2223 | + diffusesheen.addMouseListener(new MouseAdapter() |
---|
| 2224 | + { |
---|
| 2225 | + public void mouseClicked(MouseEvent e) |
---|
| 2226 | + { |
---|
| 2227 | + Object3D object = Grafreed.materials.versionlist[7].get(0); |
---|
| 2228 | + cMaterial material = object.material; |
---|
| 2229 | + |
---|
| 2230 | + sheenField.setFloat(material.sheen); |
---|
| 2231 | + |
---|
| 2232 | + materialtouched = true; |
---|
| 2233 | + applySelf(); |
---|
| 2234 | + } |
---|
| 2235 | + }); |
---|
| 2236 | + presetpanel.add(diffusesheen); |
---|
| 2237 | + |
---|
| 2238 | + cLabel rough = GetLabel("icons/shadericons/shadericon00001.png", !Globals.NIMBUSLAF); |
---|
| 2239 | + rough.setToolTipText("Rough metal"); |
---|
| 2240 | + rough.addMouseListener(new MouseAdapter() |
---|
| 2241 | + { |
---|
| 2242 | + public void mouseClicked(MouseEvent e) |
---|
| 2243 | + { |
---|
| 2244 | + Object3D object = Grafreed.materials.versionlist[1].get(0); |
---|
| 2245 | + cMaterial material = object.material; |
---|
| 2246 | + |
---|
| 2247 | + shininessField.setFloat(material.shininess); |
---|
| 2248 | + velvetField.setFloat(material.velvet); |
---|
| 2249 | + |
---|
| 2250 | + materialtouched = true; |
---|
| 2251 | + applySelf(); |
---|
| 2252 | + } |
---|
| 2253 | + }); |
---|
| 2254 | + presetpanel.add(rough); |
---|
| 2255 | + |
---|
| 2256 | + cLabel rough2 = GetLabel("icons/shadericons/shadericon00013.png", !Globals.NIMBUSLAF); |
---|
| 2257 | + rough2.setToolTipText("Medium metal"); |
---|
| 2258 | + rough2.addMouseListener(new MouseAdapter() |
---|
| 2259 | + { |
---|
| 2260 | + public void mouseClicked(MouseEvent e) |
---|
| 2261 | + { |
---|
| 2262 | + Object3D object = Grafreed.materials.versionlist[13].get(0); |
---|
| 2263 | + cMaterial material = object.material; |
---|
| 2264 | + |
---|
| 2265 | + shininessField.setFloat(material.shininess); |
---|
| 2266 | + lightareaField.setFloat(material.lightarea); |
---|
| 2267 | + |
---|
| 2268 | + materialtouched = true; |
---|
| 2269 | + applySelf(); |
---|
| 2270 | + } |
---|
| 2271 | + }); |
---|
| 2272 | + presetpanel.add(rough2); |
---|
| 2273 | + |
---|
| 2274 | + cLabel shini0 = GetLabel("icons/shadericons/shadericon00014.png", !Globals.NIMBUSLAF); |
---|
| 2275 | + shini0.setToolTipText("Shiny"); |
---|
| 2276 | + shini0.addMouseListener(new MouseAdapter() |
---|
| 2277 | + { |
---|
| 2278 | + public void mouseClicked(MouseEvent e) |
---|
| 2279 | + { |
---|
| 2280 | + Object3D object = Grafreed.materials.versionlist[14].get(0); |
---|
| 2281 | + cMaterial material = object.material; |
---|
| 2282 | + |
---|
| 2283 | + shininessField.setFloat(material.shininess); |
---|
| 2284 | + lightareaField.setFloat(material.lightarea); |
---|
| 2285 | + |
---|
| 2286 | + materialtouched = true; |
---|
| 2287 | + applySelf(); |
---|
| 2288 | + } |
---|
| 2289 | + }); |
---|
| 2290 | + presetpanel.add(shini0); |
---|
| 2291 | + |
---|
| 2292 | + cLabel shini1 = GetLabel("icons/shadericons/shadericon00011.png", !Globals.NIMBUSLAF); |
---|
| 2293 | + shini1.setToolTipText("Shiny2"); |
---|
| 2294 | + shini1.addMouseListener(new MouseAdapter() |
---|
| 2295 | + { |
---|
| 2296 | + public void mouseClicked(MouseEvent e) |
---|
| 2297 | + { |
---|
| 2298 | + Object3D object = Grafreed.materials.versionlist[11].get(0); |
---|
| 2299 | + cMaterial material = object.material; |
---|
| 2300 | + |
---|
| 2301 | + shininessField.setFloat(material.shininess); |
---|
| 2302 | + lightareaField.setFloat(material.lightarea); |
---|
| 2303 | + |
---|
| 2304 | + materialtouched = true; |
---|
| 2305 | + applySelf(); |
---|
| 2306 | + } |
---|
| 2307 | + }); |
---|
| 2308 | + presetpanel.add(shini1); |
---|
| 2309 | + |
---|
| 2310 | + cLabel shini2 = GetLabel("icons/shadericons/shadericon00012.png", !Globals.NIMBUSLAF); |
---|
| 2311 | + shini2.setToolTipText("Shiny3"); |
---|
| 2312 | + shini2.addMouseListener(new MouseAdapter() |
---|
| 2313 | + { |
---|
| 2314 | + public void mouseClicked(MouseEvent e) |
---|
| 2315 | + { |
---|
| 2316 | + Object3D object = Grafreed.materials.versionlist[12].get(0); |
---|
| 2317 | + cMaterial material = object.material; |
---|
| 2318 | + |
---|
| 2319 | + shininessField.setFloat(material.shininess); |
---|
| 2320 | + lightareaField.setFloat(material.lightarea); |
---|
| 2321 | + |
---|
| 2322 | + materialtouched = true; |
---|
| 2323 | + applySelf(); |
---|
| 2324 | + } |
---|
| 2325 | + }); |
---|
| 2326 | + presetpanel.add(shini2); |
---|
| 2327 | + |
---|
| 2328 | + cLabel aniso = GetLabel("icons/shadericons/shadericon00008.png", !Globals.NIMBUSLAF); |
---|
| 2329 | + aniso.setToolTipText("AnisoU"); |
---|
| 2330 | + aniso.addMouseListener(new MouseAdapter() |
---|
| 2331 | + { |
---|
| 2332 | + public void mouseClicked(MouseEvent e) |
---|
| 2333 | + { |
---|
| 2334 | + Object3D object = Grafreed.materials.versionlist[8].get(0); |
---|
| 2335 | + cMaterial material = object.material; |
---|
| 2336 | + |
---|
| 2337 | + anisoField.setFloat(material.aniso); |
---|
| 2338 | + anisoVField.setFloat(material.anisoV); |
---|
| 2339 | + |
---|
| 2340 | + materialtouched = true; |
---|
| 2341 | + applySelf(); |
---|
| 2342 | + } |
---|
| 2343 | + }); |
---|
| 2344 | + presetpanel.add(aniso); |
---|
| 2345 | + |
---|
| 2346 | + cLabel aniso2 = GetLabel("icons/shadericons/shadericon00009.png", !Globals.NIMBUSLAF); |
---|
| 2347 | + aniso2.setToolTipText("AnisoV"); |
---|
| 2348 | + aniso2.addMouseListener(new MouseAdapter() |
---|
| 2349 | + { |
---|
| 2350 | + public void mouseClicked(MouseEvent e) |
---|
| 2351 | + { |
---|
| 2352 | + Object3D object = Grafreed.materials.versionlist[9].get(0); |
---|
| 2353 | + cMaterial material = object.material; |
---|
| 2354 | + |
---|
| 2355 | + anisoField.setFloat(material.aniso); |
---|
| 2356 | + anisoVField.setFloat(material.anisoV); |
---|
| 2357 | + |
---|
| 2358 | + materialtouched = true; |
---|
| 2359 | + applySelf(); |
---|
| 2360 | + } |
---|
| 2361 | + }); |
---|
| 2362 | + presetpanel.add(aniso2); |
---|
| 2363 | + |
---|
| 2364 | + cLabel aniso3 = GetLabel("icons/shadericons/shadericon00010.png", !Globals.NIMBUSLAF); |
---|
| 2365 | + aniso3.setToolTipText("AnisoUV"); |
---|
| 2366 | + aniso3.addMouseListener(new MouseAdapter() |
---|
| 2367 | + { |
---|
| 2368 | + public void mouseClicked(MouseEvent e) |
---|
| 2369 | + { |
---|
| 2370 | + Object3D object = Grafreed.materials.versionlist[10].get(0); |
---|
| 2371 | + cMaterial material = object.material; |
---|
| 2372 | + |
---|
| 2373 | + anisoField.setFloat(material.aniso); |
---|
| 2374 | + anisoVField.setFloat(material.anisoV); |
---|
| 2375 | + |
---|
| 2376 | + materialtouched = true; |
---|
| 2377 | + applySelf(); |
---|
| 2378 | + } |
---|
| 2379 | + }); |
---|
| 2380 | + presetpanel.add(aniso3); |
---|
| 2381 | + |
---|
| 2382 | + cLabel velvet0 = GetLabel("icons/shadericons/shadericon00015.png", !Globals.NIMBUSLAF); |
---|
| 2383 | + velvet0.setToolTipText("Velvet"); |
---|
| 2384 | + velvet0.addMouseListener(new MouseAdapter() |
---|
| 2385 | + { |
---|
| 2386 | + public void mouseClicked(MouseEvent e) |
---|
| 2387 | + { |
---|
| 2388 | + Object3D object = Grafreed.materials.versionlist[15].get(0); |
---|
| 2389 | + cMaterial material = object.material; |
---|
| 2390 | + |
---|
| 2391 | + diffusenessField.setFloat(material.factor); |
---|
| 2392 | + selfshadowField.setFloat(material.diffuseness); |
---|
| 2393 | + sheenField.setFloat(material.sheen); |
---|
| 2394 | + shininessField.setFloat(material.shininess); |
---|
| 2395 | + velvetField.setFloat(material.velvet); |
---|
| 2396 | + shiftField.setFloat(material.shift); |
---|
| 2397 | + |
---|
| 2398 | + materialtouched = true; |
---|
| 2399 | + applySelf(); |
---|
| 2400 | + } |
---|
| 2401 | + }); |
---|
| 2402 | + presetpanel.add(velvet0); |
---|
| 2403 | + |
---|
| 2404 | + cLabel bump0 = GetLabel("icons/shadericons/shadericon00016.png", !Globals.NIMBUSLAF); |
---|
| 2405 | + bump0.setToolTipText("Bump texture"); |
---|
| 2406 | + bump0.addMouseListener(new MouseAdapter() |
---|
| 2407 | + { |
---|
| 2408 | + public void mouseClicked(MouseEvent e) |
---|
| 2409 | + { |
---|
| 2410 | + Object3D object = Grafreed.materials.versionlist[16].get(0); |
---|
| 2411 | + cMaterial material = object.material; |
---|
| 2412 | + |
---|
| 2413 | + bumpField.setFloat(object.projectedVertices[0].x / 1000.0); |
---|
| 2414 | + noiseField.setFloat(object.projectedVertices[0].y / 1000.0); |
---|
| 2415 | + powerField.setFloat(object.projectedVertices[2].x / 1000.0); |
---|
| 2416 | + |
---|
| 2417 | + materialtouched = true; |
---|
| 2418 | + applySelf(); |
---|
| 2419 | + } |
---|
| 2420 | + }); |
---|
| 2421 | + presetpanel.add(bump0); |
---|
| 2422 | + |
---|
| 2423 | + cLabel borderShader = GetLabel("icons/shadericons/borderfade.jpg", !Globals.NIMBUSLAF); |
---|
| 2424 | + borderShader.setToolTipText("Border fade"); |
---|
| 2425 | + borderShader.addMouseListener(new MouseAdapter() |
---|
| 2426 | + { |
---|
| 2427 | + public void mouseClicked(MouseEvent e) |
---|
| 2428 | + { |
---|
| 2429 | + borderfadeField.setFloat(0.4); |
---|
| 2430 | + opacityField.setFloat(0.75); |
---|
| 2431 | + |
---|
| 2432 | + materialtouched = true; |
---|
| 2433 | + applySelf(); |
---|
| 2434 | + } |
---|
| 2435 | + }); |
---|
| 2436 | + presetpanel.add(borderShader); |
---|
| 2437 | + |
---|
| 2438 | + cLabel halo = GetLabel("icons/shadericons/shadericon00017.png", !Globals.NIMBUSLAF); |
---|
| 2439 | + halo.setToolTipText("Halo"); |
---|
| 2440 | + halo.addMouseListener(new MouseAdapter() |
---|
| 2441 | + { |
---|
| 2442 | + public void mouseClicked(MouseEvent e) |
---|
| 2443 | + { |
---|
| 2444 | + Object3D object = Grafreed.materials.versionlist[17].get(0); |
---|
| 2445 | + cMaterial material = object.material; |
---|
| 2446 | + |
---|
| 2447 | + opacityPowerField.setFloat(object.projectedVertices[2].y / 1000.0); |
---|
| 2448 | + |
---|
| 2449 | + materialtouched = true; |
---|
| 2450 | + applySelf(); |
---|
| 2451 | + } |
---|
| 2452 | + }); |
---|
| 2453 | + presetpanel.add(halo); |
---|
| 2454 | + |
---|
| 2455 | + cLabel candle = GetLabel("icons/shadericons/shadericon00018.png", !Globals.NIMBUSLAF); |
---|
| 2456 | + candle.setToolTipText("Candle"); |
---|
| 2457 | + candle.addMouseListener(new MouseAdapter() |
---|
| 2458 | + { |
---|
| 2459 | + public void mouseClicked(MouseEvent e) |
---|
| 2460 | + { |
---|
| 2461 | + Object3D object = Grafreed.materials.versionlist[18].get(0); |
---|
| 2462 | + cMaterial material = object.material; |
---|
| 2463 | + |
---|
| 2464 | + subsurfaceField.setFloat(material.subsurface); |
---|
| 2465 | + shadowbiasField.setFloat(material.shadowbias); |
---|
| 2466 | + ambientField.setFloat(material.ambient); |
---|
| 2467 | + specularField.setFloat(material.specular); |
---|
| 2468 | + lightareaField.setFloat(material.lightarea); |
---|
| 2469 | + shininessField.setFloat(material.shininess); |
---|
| 2470 | + |
---|
| 2471 | + materialtouched = true; |
---|
| 2472 | + applySelf(); |
---|
| 2473 | + } |
---|
| 2474 | + }); |
---|
| 2475 | + presetpanel.add(candle); |
---|
| 2476 | + |
---|
| 2477 | + cLabel shadowShader = GetLabel("icons/shadericons/shadow.png", !Globals.NIMBUSLAF); |
---|
| 2478 | + shadowShader.setToolTipText("Shadow"); |
---|
| 2479 | + shadowShader.addMouseListener(new MouseAdapter() |
---|
| 2480 | + { |
---|
| 2481 | + public void mouseClicked(MouseEvent e) |
---|
| 2482 | + { |
---|
| 2483 | + diffuseField.setFloat(0.001); |
---|
| 2484 | + ambientField.setFloat(0.001); |
---|
| 2485 | + cameraField.setFloat(0.001); |
---|
| 2486 | + specularField.setFloat(0.001); |
---|
| 2487 | + fakedepthField.setFloat(0.001); |
---|
| 2488 | + opacityField.setFloat(0.4); |
---|
| 2489 | + |
---|
| 2490 | + materialtouched = true; |
---|
| 2491 | + applySelf(); |
---|
| 2492 | + } |
---|
| 2493 | + }); |
---|
| 2494 | + presetpanel.add(shadowShader); |
---|
| 2495 | + |
---|
| 2496 | + cLabel para0 = GetLabel("icons/shadericons/parallax0.png", !Globals.NIMBUSLAF); |
---|
| 2497 | + para0.setToolTipText("No parallax"); |
---|
| 2498 | + para0.addMouseListener(new MouseAdapter() |
---|
| 2499 | + { |
---|
| 2500 | + public void mouseClicked(MouseEvent e) |
---|
| 2501 | + { |
---|
| 2502 | + parallaxField.setFloat(0.125); |
---|
| 2503 | + |
---|
| 2504 | + materialtouched = true; |
---|
| 2505 | + applySelf(); |
---|
| 2506 | + } |
---|
| 2507 | + }); |
---|
| 2508 | + presetpanel.add(para0); |
---|
| 2509 | + |
---|
| 2510 | + cLabel para1 = GetLabel("icons/shadericons/parallax1.png", !Globals.NIMBUSLAF); |
---|
| 2511 | + para1.setToolTipText("With parallax"); |
---|
| 2512 | + para1.addMouseListener(new MouseAdapter() |
---|
| 2513 | + { |
---|
| 2514 | + public void mouseClicked(MouseEvent e) |
---|
| 2515 | + { |
---|
| 2516 | + parallaxField.setFloat(0.13); |
---|
| 2517 | + |
---|
| 2518 | + materialtouched = true; |
---|
| 2519 | + applySelf(); |
---|
| 2520 | + } |
---|
| 2521 | + }); |
---|
| 2522 | + presetpanel.add(para1); |
---|
| 2523 | + |
---|
| 2524 | + cLabel para2 = GetLabel("icons/shadericons/parallax2.png", !Globals.NIMBUSLAF); |
---|
| 2525 | + para2.setToolTipText("Reset parallax"); |
---|
| 2526 | + para2.addMouseListener(new MouseAdapter() |
---|
| 2527 | + { |
---|
| 2528 | + public void mouseClicked(MouseEvent e) |
---|
| 2529 | + { |
---|
| 2530 | + parallaxField.setFloat(0.14); |
---|
| 2531 | + |
---|
| 2532 | + materialtouched = true; |
---|
| 2533 | + applySelf(); |
---|
| 2534 | + } |
---|
| 2535 | + }); |
---|
| 2536 | + presetpanel.add(para2); |
---|
| 2537 | + |
---|
| 2538 | + cGridBag panel = new cGridBag().setVertical(true); |
---|
| 2539 | + |
---|
| 2540 | + presetpanel.preferredWidth = 1; |
---|
| 2541 | + |
---|
| 2542 | + materialpanel.add(presetpanel); |
---|
| 2543 | + materialpanel.add(panel); |
---|
| 2544 | + |
---|
| 2545 | + panel.preferredWidth = 8; |
---|
| 2546 | + |
---|
| 2547 | + /* |
---|
1706 | 2548 | ctrlPanel.add(materialLabel = new JLabel("MATERIAL : "), aConstraints); |
---|
1707 | 2549 | materialLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1708 | | - */ |
---|
| 2550 | + */ |
---|
1709 | 2551 | |
---|
1710 | 2552 | cGridBag editBar = new cGridBag().setVertical(false); |
---|
1711 | 2553 | |
---|
1712 | | - editBar.add(createMaterialButton = new cButton("Create", !Grafreed.NIMBUSLAF)); // , aConstraints); |
---|
| 2554 | + editBar.add(createMaterialButton = new cButton("Create", !Globals.NIMBUSLAF)); // , aConstraints); |
---|
1713 | 2555 | createMaterialButton.setToolTipText("Create material"); |
---|
1714 | 2556 | |
---|
1715 | 2557 | /* |
---|
1716 | 2558 | ctrlPanel.add(resetSlidersButton = new cButton("Reset All"), aConstraints); |
---|
1717 | 2559 | */ |
---|
1718 | 2560 | |
---|
1719 | | - editBar.add(clearMaterialButton = new cButton("Clear", !Grafreed.NIMBUSLAF)); // , aConstraints); |
---|
| 2561 | + editBar.add(clearMaterialButton = new cButton("Clear", !Globals.NIMBUSLAF)); // , aConstraints); |
---|
1720 | 2562 | clearMaterialButton.setToolTipText("Clear material"); |
---|
1721 | 2563 | |
---|
1722 | 2564 | if (Globals.ADVANCED) |
---|
1723 | 2565 | { |
---|
1724 | | - editBar.add(resetSlidersButton = new cButton("Reset", !Grafreed.NIMBUSLAF)); // , aConstraints); |
---|
| 2566 | + editBar.add(resetSlidersButton = new cButton("Reset", !Globals.NIMBUSLAF)); // , aConstraints); |
---|
1725 | 2567 | editBar.add(propagateToggle = new cCheckBox("Prop", propagate)); // , aConstraints); |
---|
1726 | 2568 | editBar.add(multiplyToggle = new cCheckBox("Mult", false)); // , aConstraints); |
---|
1727 | 2569 | } |
---|
.. | .. |
---|
1739 | 2581 | //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints); |
---|
1740 | 2582 | |
---|
1741 | 2583 | cGridBag colorSection = new cGridBag().setVertical(true); |
---|
| 2584 | + |
---|
| 2585 | + cGridBag huepanel = new cGridBag(); |
---|
| 2586 | + cGridBag huelabel = new cGridBag(); |
---|
| 2587 | + cLabel hue = GetLabel("icons/hue.png", false); |
---|
| 2588 | + hue.fit = true; |
---|
| 2589 | + |
---|
| 2590 | + hue.addMouseListener(new MouseAdapter() |
---|
| 2591 | + { |
---|
| 2592 | + public void mousePressed(MouseEvent e) |
---|
| 2593 | + { |
---|
| 2594 | + int x = e.getX(); |
---|
| 2595 | + |
---|
| 2596 | + colorField.setFloat((double)x / ((cLabel)e.getSource()).getWidth()); |
---|
| 2597 | + } |
---|
| 2598 | + }); |
---|
| 2599 | + |
---|
| 2600 | + huelabel.add(hue); |
---|
| 2601 | + huelabel.preferredWidth = 20; |
---|
| 2602 | + huepanel.add(new cGridBag()); // Label |
---|
| 2603 | + huepanel.add(huelabel); // Field/slider |
---|
| 2604 | + |
---|
| 2605 | + huepanel.preferredHeight = 7; |
---|
| 2606 | + |
---|
| 2607 | + colorSection.add(huepanel); |
---|
1742 | 2608 | |
---|
1743 | 2609 | cGridBag color = new cGridBag(); |
---|
1744 | | - color.add(colorLabel = new JLabel("Color/hue")); // , aConstraints); |
---|
1745 | | - colorLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1746 | | - color.add(colorField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
| 2610 | + |
---|
| 2611 | + color.add(colorLabel = new JLabel("Color/hue")); // , aConstraints); |
---|
| 2612 | + colorLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 2613 | + color.add(colorField = new cNumberSlider(this, 0.001, 1)); // , aConstraints); |
---|
| 2614 | + |
---|
1747 | 2615 | //colorField.preferredWidth = 200; |
---|
1748 | 2616 | colorSection.add(color); |
---|
1749 | 2617 | |
---|
1750 | 2618 | cGridBag modulation = new cGridBag(); |
---|
1751 | 2619 | modulation.add(modulationLabel = new JLabel("Saturation")); // , aConstraints); |
---|
1752 | 2620 | modulationLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1753 | | - modulation.add(modulationField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
| 2621 | + modulation.add(saturationField = new cNumberSlider(this, 0.001, 1)); // , aConstraints); |
---|
1754 | 2622 | colorSection.add(modulation); |
---|
1755 | 2623 | |
---|
| 2624 | + cGridBag opacity = new cGridBag(); |
---|
| 2625 | + opacity.add(opacityLabel = new JLabel("Opacity")); // , aConstraints); |
---|
| 2626 | + opacityLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 2627 | + opacity.add(opacityField = new cNumberSlider(this, 0.001, 1)); // , aConstraints); |
---|
| 2628 | + colorSection.add(opacity); |
---|
| 2629 | + |
---|
| 2630 | + colorSection.add(GetSeparator()); |
---|
| 2631 | + |
---|
1756 | 2632 | cGridBag texture = new cGridBag(); |
---|
1757 | 2633 | texture.add(textureLabel = new JLabel("Texture")); // , aConstraints); |
---|
1758 | 2634 | textureLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1759 | 2635 | texture.add(textureField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
1760 | 2636 | colorSection.add(texture); |
---|
1761 | 2637 | |
---|
1762 | | - panel.add(new JSeparator()); |
---|
| 2638 | + panel.add(GetSeparator()); |
---|
1763 | 2639 | |
---|
1764 | 2640 | panel.add(colorSection); |
---|
1765 | 2641 | |
---|
.. | .. |
---|
1815 | 2691 | shadowbias.add(shadowbiasField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
1816 | 2692 | diffuseSection.add(shadowbias); |
---|
1817 | 2693 | |
---|
1818 | | - panel.add(new JSeparator()); |
---|
| 2694 | + panel.add(GetSeparator()); |
---|
1819 | 2695 | |
---|
1820 | 2696 | panel.add(diffuseSection); |
---|
1821 | 2697 | |
---|
.. | .. |
---|
1878 | 2754 | specularSection.add(anisoV); |
---|
1879 | 2755 | |
---|
1880 | 2756 | |
---|
1881 | | - panel.add(new JSeparator()); |
---|
| 2757 | + panel.add(GetSeparator()); |
---|
1882 | 2758 | |
---|
1883 | 2759 | panel.add(specularSection); |
---|
1884 | 2760 | |
---|
.. | .. |
---|
1904 | 2780 | backlit.add(backlitField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
1905 | 2781 | colorSection.add(backlit); |
---|
1906 | 2782 | |
---|
1907 | | - cGridBag opacity = new cGridBag(); |
---|
1908 | | - opacity.add(opacityLabel = new JLabel("Opacity")); // , aConstraints); |
---|
1909 | | - opacityLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1910 | | - opacity.add(opacityField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
1911 | | - colorSection.add(opacity); |
---|
1912 | | - |
---|
| 2783 | + cGridBag parallax = new cGridBag(); |
---|
| 2784 | + parallax.add(parallaxLabel = new JLabel("Parallax")); // , aConstraints); |
---|
| 2785 | + parallaxLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 2786 | + parallax.add(parallaxField = new cNumberSlider(this, 0.001, 0.25, -0.125)); // , aConstraints); |
---|
| 2787 | + colorSection.add(parallax); |
---|
| 2788 | + |
---|
1913 | 2789 | //panel.add(new JSeparator()); |
---|
1914 | 2790 | |
---|
1915 | 2791 | //panel.add(globalSection); |
---|
.. | .. |
---|
1954 | 2830 | opacityPower.add(opacityPowerField = new cNumberSlider(this, 0.0, 10 /*10 dec 2013*/)); // , aConstraints); |
---|
1955 | 2831 | textureSection.add(opacityPower); |
---|
1956 | 2832 | |
---|
1957 | | - panel.add(new JSeparator()); |
---|
| 2833 | + panel.add(GetSeparator()); |
---|
1958 | 2834 | |
---|
1959 | 2835 | panel.add(textureSection); |
---|
1960 | 2836 | |
---|
.. | .. |
---|
2941 | 3817 | |
---|
2942 | 3818 | freezematerial = true; |
---|
2943 | 3819 | colorField.setFloat(mat.color); |
---|
2944 | | - modulationField.setFloat(mat.modulation); |
---|
| 3820 | + saturationField.setFloat(mat.modulation); |
---|
2945 | 3821 | metalnessField.setFloat(mat.metalness); |
---|
2946 | 3822 | diffuseField.setFloat(mat.diffuse); |
---|
2947 | 3823 | specularField.setFloat(mat.specular); |
---|
.. | .. |
---|
2961 | 3837 | shadowField.setFloat(mat.shadow); |
---|
2962 | 3838 | textureField.setFloat(mat.texture); |
---|
2963 | 3839 | opacityField.setFloat(mat.opacity); |
---|
| 3840 | + parallaxField.setFloat(mat.parallax + 0.125f); |
---|
2964 | 3841 | fakedepthField.setFloat(mat.fakedepth); |
---|
2965 | 3842 | shadowbiasField.setFloat(mat.shadowbias); |
---|
2966 | 3843 | bumpField.setInteger(1); // dec 2013 |
---|
.. | .. |
---|
3003 | 3880 | |
---|
3004 | 3881 | if (multiplyToggle != null) |
---|
3005 | 3882 | multiplyToggle.setSelected(mat.multiply); |
---|
3006 | | - |
---|
3007 | | - assert (object.projectedVertices != null); |
---|
3008 | | - |
---|
3009 | | - if (object.projectedVertices.length <= 2) |
---|
3010 | | - { |
---|
3011 | | - // Side effect... |
---|
3012 | | - Object3D.cVector2[] keep = object.projectedVertices; |
---|
3013 | | - object.projectedVertices = new Object3D.cVector2[3]; |
---|
3014 | | - for (int i = 0; i < 3; i++) |
---|
3015 | | - { |
---|
3016 | | - if (i < keep.length) |
---|
3017 | | - { |
---|
3018 | | - object.projectedVertices[i] = keep[i]; |
---|
3019 | | - } else |
---|
3020 | | - { |
---|
3021 | | - object.projectedVertices[i] = new Object3D.cVector2(); |
---|
3022 | | - } |
---|
3023 | | - /* |
---|
3024 | | - if(keep.length == 0) |
---|
3025 | | - object.projectedVertices[0] = new Object3D.cVector2(); |
---|
3026 | | - else |
---|
3027 | | - object.projectedVertices[0] = keep[0]; |
---|
3028 | | - object.projectedVertices[1] = new Object3D.cVector2(); |
---|
3029 | | - */ |
---|
3030 | | - } |
---|
3031 | | - } |
---|
| 3883 | + |
---|
| 3884 | + AllocProjectedVertices(object); |
---|
3032 | 3885 | |
---|
3033 | 3886 | SetMaterial(mat, object.projectedVertices); |
---|
3034 | 3887 | } |
---|
.. | .. |
---|
3148 | 4001 | public void itemStateChanged(ItemEvent event) |
---|
3149 | 4002 | { |
---|
3150 | 4003 | // System.out.println("Propagate = " + propagate); |
---|
| 4004 | + if (event.getSource() == pinButton) |
---|
| 4005 | + { |
---|
| 4006 | + copy.pinned ^= true; |
---|
| 4007 | + if (!copy.pinned && !copy.editWindow.copy.selection.contains(copy)) |
---|
| 4008 | + { |
---|
| 4009 | + ((GroupEditor)copy.editWindow).listUI.remove(copy); |
---|
| 4010 | + copy.CloseUI(); |
---|
| 4011 | + //copy.editWindow.refreshContents(); |
---|
| 4012 | + } |
---|
| 4013 | + } |
---|
| 4014 | + else |
---|
3151 | 4015 | if (event.getSource() == propagateToggle) |
---|
3152 | 4016 | { |
---|
3153 | 4017 | propagate ^= true; |
---|
.. | .. |
---|
3252 | 4116 | } else if (event.getSource() == liveCB) |
---|
3253 | 4117 | { |
---|
3254 | 4118 | copy.live ^= true; |
---|
| 4119 | + objEditor.refreshContents(true); // To show item colors |
---|
3255 | 4120 | return; |
---|
3256 | 4121 | } else if (event.getSource() == selectableCB) |
---|
3257 | 4122 | { |
---|
.. | .. |
---|
3261 | 4126 | { |
---|
3262 | 4127 | copy.hide ^= true; |
---|
3263 | 4128 | copy.Touch(); // display list issue |
---|
3264 | | - objEditor.refreshContents(); |
---|
| 4129 | + objEditor.refreshContents(true); // To show item colors |
---|
3265 | 4130 | return; |
---|
3266 | 4131 | } else if (event.getSource() == link2masterCB) |
---|
3267 | 4132 | { |
---|
3268 | 4133 | copy.link2master ^= true; |
---|
| 4134 | + objEditor.refreshContents(); |
---|
3269 | 4135 | return; |
---|
3270 | 4136 | } |
---|
3271 | 4137 | if (event.getSource() == randomCB) |
---|
3272 | 4138 | { |
---|
3273 | 4139 | copy.random ^= true; |
---|
| 4140 | + if (this instanceof RandomEditor) |
---|
| 4141 | + { |
---|
| 4142 | + cGridBag itemPanel = ((RandomEditor)this).itemPanel; |
---|
| 4143 | + itemPanel.getComponent(0).setEnabled(!copy.random); |
---|
| 4144 | + |
---|
| 4145 | + // Tooltip? |
---|
| 4146 | + if (copy.random) |
---|
| 4147 | + { |
---|
| 4148 | + } |
---|
| 4149 | + else |
---|
| 4150 | + { |
---|
| 4151 | + } |
---|
| 4152 | + } |
---|
| 4153 | + |
---|
3274 | 4154 | objEditor.refreshContents(); |
---|
3275 | 4155 | return; |
---|
3276 | 4156 | } |
---|
.. | .. |
---|
3326 | 4206 | //System.out.println("ObjEditor " + event); |
---|
3327 | 4207 | applySelf0(true); |
---|
3328 | 4208 | //parent.applySelf(); |
---|
3329 | | - objEditor.refreshContents(); |
---|
| 4209 | + // conflicts with requestFocus objEditor.refreshContents(); |
---|
3330 | 4210 | } else if (source == resetButton) |
---|
3331 | 4211 | { |
---|
3332 | 4212 | CameraPane.fullreset = true; |
---|
.. | .. |
---|
3506 | 4386 | |
---|
3507 | 4387 | void New() |
---|
3508 | 4388 | { |
---|
3509 | | - while (copy.Size() > 1) |
---|
| 4389 | + copy.skyboxname = "cubemaps/penguins-skyboxes/yonder"; |
---|
| 4390 | + copy.skyboxext = "jpg"; |
---|
| 4391 | + |
---|
| 4392 | + copy.versionlist = null; |
---|
| 4393 | + copy.versionindex = -1; |
---|
| 4394 | + |
---|
| 4395 | + while (copy.Size() > 0) |
---|
3510 | 4396 | { |
---|
3511 | | - copy.remove(1); |
---|
| 4397 | + copy.remove(0); |
---|
| 4398 | + } |
---|
| 4399 | + |
---|
| 4400 | + copy.selection.clear(); |
---|
| 4401 | + |
---|
| 4402 | + if (copy == Grafreed.grafreed.universe) |
---|
| 4403 | + { |
---|
| 4404 | + CreateCameras(); |
---|
| 4405 | + cameraView.SetCamera(GetCamera(copy, 0)); |
---|
| 4406 | + cameraView.SetLight(GetCamera(copy, 4)); |
---|
3512 | 4407 | } |
---|
3513 | 4408 | |
---|
3514 | 4409 | ResetModel(); |
---|
| 4410 | + |
---|
| 4411 | + DuplicateVersion(); |
---|
| 4412 | + |
---|
| 4413 | + this.SetVersionStates(); |
---|
3515 | 4414 | objEditor.refreshContents(); |
---|
3516 | 4415 | } |
---|
3517 | 4416 | |
---|
3518 | 4417 | static public byte[] Compress(Object3D o) |
---|
3519 | 4418 | { |
---|
| 4419 | + // Slower to actually compress. |
---|
3520 | 4420 | try |
---|
3521 | 4421 | { |
---|
3522 | 4422 | ByteArrayOutputStream baos = new ByteArrayOutputStream(); |
---|
.. | .. |
---|
3618 | 4518 | { |
---|
3619 | 4519 | //Save(true); |
---|
3620 | 4520 | Replace(); |
---|
| 4521 | + SetVersionStates(); |
---|
3621 | 4522 | } |
---|
3622 | 4523 | |
---|
3623 | 4524 | private boolean Equal(byte[] compress, byte[] name) |
---|
.. | .. |
---|
3636 | 4537 | return true; |
---|
3637 | 4538 | } |
---|
3638 | 4539 | |
---|
3639 | | - java.util.Hashtable<java.util.UUID, Object3D> versiontable = new java.util.Hashtable<java.util.UUID, Object3D>(); |
---|
| 4540 | + void DeleteVersion() |
---|
| 4541 | + { |
---|
| 4542 | + for (int i = copy.versionindex; i < copy.versionlist.length-1; i++) |
---|
| 4543 | + { |
---|
| 4544 | + copy.versionlist[i] = copy.versionlist[i+1]; |
---|
| 4545 | + } |
---|
| 4546 | + |
---|
| 4547 | + if (copy.versionlist[copy.versionindex] == null) |
---|
| 4548 | + copy.versionindex -= 1; |
---|
| 4549 | + |
---|
| 4550 | + if (copy.versionindex != -1) |
---|
| 4551 | + CopyChanged(copy); |
---|
| 4552 | + |
---|
| 4553 | + SetVersionStates(); |
---|
| 4554 | + |
---|
| 4555 | + SetCameras(); |
---|
| 4556 | + } |
---|
3640 | 4557 | |
---|
3641 | | - public boolean Save(boolean user) |
---|
| 4558 | + public boolean DuplicateVersion() // boolean user) |
---|
3642 | 4559 | { |
---|
3643 | 4560 | System.err.println("Save"); |
---|
| 4561 | + //Replace(); |
---|
3644 | 4562 | |
---|
3645 | | - cRadio tab = GetCurrentTab(); |
---|
| 4563 | + if (copy.versionlist == null) |
---|
| 4564 | + { |
---|
| 4565 | + copy.versionlist = new Object3D[100]; |
---|
| 4566 | + copy.versionindex = -1; |
---|
| 4567 | + } |
---|
3646 | 4568 | |
---|
3647 | | - byte[] compress = CompressCopy(); |
---|
| 4569 | + Object3D compress = Duplicate(copy); // Saved version. No need for "Replace"? |
---|
3648 | 4570 | |
---|
3649 | 4571 | boolean thesame = false; |
---|
3650 | 4572 | |
---|
3651 | | - // Quick heuristic using length. Works only when stream is compressed. |
---|
3652 | | - if (copy.versionindex > 0 && copy.versions[copy.versionindex-1] != null && Equal(compress, copy.versions[copy.versionindex-1])) |
---|
3653 | | - { |
---|
3654 | | - thesame = true; |
---|
3655 | | - } |
---|
| 4573 | +// if (copy.versionindex > 0 && copy.versions[copy.versionindex-1] != null && Equal(compress, copy.versions[copy.versionindex-1])) |
---|
| 4574 | +// { |
---|
| 4575 | +// thesame = true; |
---|
| 4576 | +// } |
---|
3656 | 4577 | |
---|
3657 | 4578 | //EditorFrame.m_MainFrame.requestFocusInWindow(); |
---|
3658 | 4579 | if (!thesame) |
---|
3659 | 4580 | { |
---|
| 4581 | + for (int i = copy.versionlist.length; --i > copy.versionindex+1;) |
---|
| 4582 | + { |
---|
| 4583 | + copy.versionlist[i] = copy.versionlist[i-1]; |
---|
| 4584 | + } |
---|
| 4585 | + |
---|
3660 | 4586 | //tab.user[tab.versionindex] = user; |
---|
3661 | 4587 | //boolean increment = true; // tab.graphs[tab.versionindex] == null; |
---|
3662 | 4588 | |
---|
3663 | | - copy.versions[++copy.versionindex] = compress; |
---|
| 4589 | + copy.versionlist[++copy.versionindex] = compress; |
---|
3664 | 4590 | |
---|
3665 | 4591 | // if (increment) |
---|
3666 | 4592 | // tab.versionindex++; |
---|
.. | .. |
---|
3670 | 4596 | |
---|
3671 | 4597 | //assert(hashtable.isEmpty()); |
---|
3672 | 4598 | |
---|
3673 | | - for (int i = copy.versionindex+1; i < copy.versions.length; i++) |
---|
3674 | | - { |
---|
3675 | | - //tab.user[i] = false; |
---|
3676 | | - copy.versions[i] = null; |
---|
3677 | | - } |
---|
| 4599 | +// for (int i = copy.versionindex+1; i < copy.versionlist.length; i++) |
---|
| 4600 | +// { |
---|
| 4601 | +// //tab.user[i] = false; |
---|
| 4602 | +// copy.versionlist[i] = null; |
---|
| 4603 | +// } |
---|
3678 | 4604 | |
---|
3679 | | - SetUndoStates(); |
---|
| 4605 | + SetVersionStates(); |
---|
3680 | 4606 | |
---|
3681 | 4607 | // test save |
---|
3682 | 4608 | if (false) |
---|
.. | .. |
---|
3699 | 4625 | |
---|
3700 | 4626 | return !thesame; |
---|
3701 | 4627 | } |
---|
3702 | | - |
---|
3703 | | - void CopyChanged(Object3D obj) |
---|
| 4628 | + |
---|
| 4629 | + boolean flashIt = true; |
---|
| 4630 | + |
---|
| 4631 | + void RefreshSelection() |
---|
3704 | 4632 | { |
---|
3705 | | - SetUndoStates(); |
---|
| 4633 | + Object3D selection = new Object3D(); |
---|
| 4634 | + |
---|
| 4635 | + if (objEditor.copy.selection == null) |
---|
| 4636 | + { |
---|
| 4637 | + objEditor.copy.selection = new Object3D(); |
---|
| 4638 | + } |
---|
| 4639 | + |
---|
| 4640 | + for (int i = 0; i < objEditor.copy.selection.size(); i++) |
---|
| 4641 | + { |
---|
| 4642 | + Object3D elem = objEditor.copy.selection.elementAt(i); |
---|
| 4643 | + |
---|
| 4644 | + Object3D obj = objEditor.copy.GetObject(elem.GetUUID()); |
---|
| 4645 | + |
---|
| 4646 | + if (obj == null) |
---|
| 4647 | + { |
---|
| 4648 | + objEditor.copy.selection.remove(i--); |
---|
| 4649 | + } |
---|
| 4650 | + else |
---|
| 4651 | + { |
---|
| 4652 | + selection.add(obj); |
---|
| 4653 | + objEditor.copy.selection.setElementAt(obj, i); |
---|
| 4654 | + } |
---|
| 4655 | + } |
---|
| 4656 | + |
---|
| 4657 | + flashIt = false; |
---|
| 4658 | + GetTree().clearSelection(); |
---|
| 4659 | + for (int i = 0; i < selection.size(); i++) |
---|
| 4660 | + GetTree().addSelectionPath(selection.elementAt(i).GetTreePath().GetTreePath()); |
---|
| 4661 | + flashIt = true; |
---|
| 4662 | + |
---|
| 4663 | + //refreshContents(false); |
---|
| 4664 | + } |
---|
| 4665 | + |
---|
| 4666 | + void CopyChanged(Object3D changed) |
---|
| 4667 | + { |
---|
| 4668 | + Object3D obj = (Object3D)Grafreed.clone(changed.versionlist[copy.versionindex]); |
---|
| 4669 | + |
---|
| 4670 | + assert(!obj.HasBigData()); |
---|
3706 | 4671 | |
---|
3707 | 4672 | boolean temp = CameraPane.SWITCH; |
---|
3708 | 4673 | CameraPane.SWITCH = false; |
---|
3709 | 4674 | |
---|
3710 | | - copy.ExtractBigData(versiontable); |
---|
| 4675 | + changed.ExtractBigData(Grafreed.grafreed.universe.versiontable); |
---|
3711 | 4676 | |
---|
3712 | | - copy.clear(); |
---|
3713 | | - |
---|
| 4677 | + changed.clear(); |
---|
| 4678 | + |
---|
| 4679 | + obj.deepCopyNode(changed); |
---|
| 4680 | + |
---|
3714 | 4681 | for (int i=0; i<obj.Size(); i++) |
---|
3715 | 4682 | { |
---|
3716 | | - copy.add(obj.get(i)); |
---|
| 4683 | + changed.add(obj.get(i)); |
---|
3717 | 4684 | } |
---|
3718 | 4685 | |
---|
3719 | | - copy.RestoreBigData(versiontable); |
---|
| 4686 | + changed.RestoreBigData(Grafreed.grafreed.universe.versiontable); |
---|
3720 | 4687 | |
---|
3721 | 4688 | CameraPane.SWITCH = temp; |
---|
3722 | 4689 | |
---|
| 4690 | + if (objEditor == this) |
---|
| 4691 | + RefreshSelection(); |
---|
3723 | 4692 | //assert(hashtable.isEmpty()); |
---|
3724 | 4693 | |
---|
3725 | | - copy.Touch(); |
---|
| 4694 | + objEditor.copy.Touch(); |
---|
3726 | 4695 | |
---|
3727 | 4696 | ResetModel(); |
---|
3728 | | - copy.HardTouch(); // recompile? |
---|
| 4697 | + objEditor.copy.HardTouch(); // recompile? |
---|
3729 | 4698 | |
---|
3730 | 4699 | cRadio ab; |
---|
3731 | | - for (java.util.Enumeration e = buttonGroup.getElements(); e.hasMoreElements();) |
---|
| 4700 | + for (java.util.Enumeration e = objEditor.buttonGroup.getElements(); e.hasMoreElements();) |
---|
3732 | 4701 | { |
---|
3733 | 4702 | ab = (cRadio)e.nextElement(); |
---|
3734 | | - Object3D test = copy.GetObject(ab.object.GetUUID()); |
---|
| 4703 | + Object3D test = objEditor.copy.GetObject(ab.object.GetUUID()); |
---|
3735 | 4704 | //ab.camera = (Camera)copy.GetObject(ab.camera.GetUUID()); |
---|
3736 | 4705 | if (test != null) |
---|
3737 | 4706 | { |
---|
.. | .. |
---|
3740 | 4709 | } |
---|
3741 | 4710 | } |
---|
3742 | 4711 | |
---|
3743 | | - refreshContents(); |
---|
| 4712 | + objEditor.refreshContents(true); |
---|
3744 | 4713 | } |
---|
3745 | 4714 | |
---|
3746 | | - cButton undoButton; |
---|
| 4715 | + cButton previousVersionButton; |
---|
3747 | 4716 | cButton restoreButton; |
---|
3748 | 4717 | cButton replaceButton; |
---|
3749 | | - cButton redoButton; |
---|
| 4718 | + cButton nextVersionButton; |
---|
| 4719 | + cButton saveVersionButton; |
---|
| 4720 | + cButton deleteVersionButton; |
---|
3750 | 4721 | |
---|
3751 | 4722 | boolean muteSlider; |
---|
3752 | 4723 | |
---|
3753 | 4724 | int VersionCount() |
---|
3754 | 4725 | { |
---|
3755 | | - int count = 0; |
---|
3756 | | - |
---|
3757 | | - for (int i = copy.versions.length; --i >= 0;) |
---|
3758 | | - { |
---|
3759 | | - if (copy.versions[i] != null) |
---|
3760 | | - count++; |
---|
3761 | | - } |
---|
3762 | | - |
---|
3763 | | - return count; |
---|
| 4726 | + return copy.VersionCount(); |
---|
3764 | 4727 | } |
---|
3765 | 4728 | |
---|
3766 | | - void SetUndoStates() |
---|
| 4729 | + public cGridBag versionSliderPane; |
---|
| 4730 | + |
---|
| 4731 | + void SetVersionStates() |
---|
3767 | 4732 | { |
---|
3768 | | - cRadio tab = GetCurrentTab(); |
---|
| 4733 | + //if (true) |
---|
| 4734 | + // return; |
---|
| 4735 | + |
---|
| 4736 | + //cRadio tab = GetCurrentTab(); |
---|
3769 | 4737 | |
---|
3770 | | - restoreButton.setEnabled(copy.versionindex != -1); |
---|
3771 | | - replaceButton.setEnabled(copy.versionindex != -1); |
---|
3772 | | - |
---|
3773 | | - undoButton.setEnabled(copy.versionindex > 0); |
---|
3774 | | - redoButton.setEnabled(copy.versions[copy.versionindex + 1] != null); |
---|
3775 | | - |
---|
3776 | | - muteSlider = true; |
---|
3777 | | - versionSlider.setMaximum(VersionCount() - 1); |
---|
3778 | | - versionSlider.setInteger(copy.versionindex); |
---|
3779 | | - muteSlider = false; |
---|
| 4738 | + if (copy.versionindex == -2) |
---|
| 4739 | + { |
---|
| 4740 | + saveVersionButton.setEnabled(false); |
---|
| 4741 | + restoreButton.setEnabled(false); |
---|
| 4742 | + replaceButton.setEnabled(false); |
---|
| 4743 | + previousVersionButton.setEnabled(false); |
---|
| 4744 | + nextVersionButton.setEnabled(false); |
---|
| 4745 | + deleteVersionButton.setEnabled(false); |
---|
| 4746 | + versionSliderPane.setVisible(false); |
---|
| 4747 | + } |
---|
| 4748 | + else |
---|
| 4749 | + { |
---|
| 4750 | + restoreButton.setEnabled(copy.versionindex != -1); |
---|
| 4751 | + replaceButton.setEnabled(copy.versionindex != -1); |
---|
| 4752 | + |
---|
| 4753 | + previousVersionButton.setEnabled(copy.versionindex > 0); |
---|
| 4754 | + nextVersionButton.setEnabled(copy.versionlist != null && copy.versionlist[copy.versionindex + 1] != null); |
---|
| 4755 | + |
---|
| 4756 | + deleteVersionButton.setEnabled(copy.versionindex != -1); |
---|
| 4757 | + //copy.versionlist[copy.versionindex + 1] != null); |
---|
| 4758 | + |
---|
| 4759 | + muteSlider = true; |
---|
| 4760 | + versionSlider.setMinimum(0); |
---|
| 4761 | + versionSlider.setMaximum(VersionCount() - 1); |
---|
| 4762 | + versionSlider.setInteger(copy.versionindex); |
---|
| 4763 | + versionSlider.setEnabled(copy.versionindex != -1); |
---|
| 4764 | + muteSlider = false; |
---|
| 4765 | + |
---|
| 4766 | + versionSliderPane.setVisible(true); |
---|
| 4767 | + } |
---|
3780 | 4768 | } |
---|
3781 | 4769 | |
---|
3782 | | - public boolean Undo() |
---|
| 4770 | + public boolean PreviousVersion() |
---|
3783 | 4771 | { |
---|
3784 | 4772 | // Option? |
---|
3785 | 4773 | Replace(); |
---|
3786 | 4774 | |
---|
3787 | | - System.err.println("Undo"); |
---|
| 4775 | + //System.err.println("Previous"); |
---|
3788 | 4776 | |
---|
3789 | | - cRadio tab = GetCurrentTab(); |
---|
| 4777 | + //cRadio tab = GetCurrentTab(); |
---|
3790 | 4778 | |
---|
3791 | 4779 | if (copy.versionindex == 0) |
---|
3792 | 4780 | { |
---|
.. | .. |
---|
3809 | 4797 | |
---|
3810 | 4798 | copy.versionindex -= 1; |
---|
3811 | 4799 | |
---|
3812 | | - CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex])); |
---|
| 4800 | + CopyChanged(copy); |
---|
| 4801 | + |
---|
| 4802 | + SetVersionStates(); |
---|
| 4803 | + |
---|
| 4804 | + SetCameras(); |
---|
3813 | 4805 | |
---|
3814 | 4806 | return true; |
---|
3815 | 4807 | } |
---|
.. | .. |
---|
3818 | 4810 | { |
---|
3819 | 4811 | System.err.println("Restore"); |
---|
3820 | 4812 | |
---|
3821 | | - cRadio tab = GetCurrentTab(); |
---|
| 4813 | + //cRadio tab = GetCurrentTab(); |
---|
3822 | 4814 | |
---|
3823 | | - if (copy.versionindex == -1 || copy.versions[copy.versionindex] == null) |
---|
| 4815 | + if (copy.versionindex == -1 || copy.versionlist[copy.versionindex] == null) |
---|
3824 | 4816 | { |
---|
3825 | 4817 | java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
3826 | 4818 | return false; |
---|
3827 | 4819 | } |
---|
3828 | 4820 | |
---|
3829 | | - CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex])); |
---|
| 4821 | + //CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex])); |
---|
| 4822 | + CopyChanged(copy); |
---|
| 4823 | + |
---|
| 4824 | + SetVersionStates(); |
---|
| 4825 | + |
---|
| 4826 | + SetCameras(); |
---|
3830 | 4827 | |
---|
3831 | 4828 | return true; |
---|
3832 | 4829 | } |
---|
3833 | 4830 | |
---|
3834 | 4831 | public boolean Replace() |
---|
3835 | 4832 | { |
---|
3836 | | - System.err.println("Replace"); |
---|
| 4833 | + //System.err.println("Replace"); |
---|
3837 | 4834 | |
---|
3838 | | - cRadio tab = GetCurrentTab(); |
---|
| 4835 | + //cRadio tab = GetCurrentTab(); |
---|
3839 | 4836 | |
---|
3840 | | - if (copy.versionindex == -1 || copy.versions[copy.versionindex] == null) |
---|
| 4837 | + if (copy.versionindex == -1 || copy.versionlist[copy.versionindex] == null) |
---|
3841 | 4838 | { |
---|
3842 | 4839 | // No version yet. OK. java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
3843 | 4840 | return false; |
---|
3844 | 4841 | } |
---|
3845 | 4842 | |
---|
3846 | | - copy.versions[copy.versionindex] = CompressCopy(); |
---|
| 4843 | + copy.versionlist[copy.versionindex] = Duplicate(copy); |
---|
3847 | 4844 | |
---|
3848 | 4845 | return true; |
---|
3849 | 4846 | } |
---|
3850 | 4847 | |
---|
3851 | | - public void Redo() |
---|
| 4848 | + public void NextVersion() |
---|
3852 | 4849 | { |
---|
3853 | 4850 | // Option? |
---|
3854 | 4851 | Replace(); |
---|
3855 | 4852 | |
---|
3856 | | - cRadio tab = GetCurrentTab(); |
---|
| 4853 | + //cRadio tab = GetCurrentTab(); |
---|
3857 | 4854 | |
---|
3858 | | - if (copy.versions[copy.versionindex + 1] == null) |
---|
| 4855 | + if (copy.versionlist[copy.versionindex + 1] == null) |
---|
3859 | 4856 | { |
---|
3860 | 4857 | java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
3861 | 4858 | return; |
---|
.. | .. |
---|
3863 | 4860 | |
---|
3864 | 4861 | copy.versionindex += 1; |
---|
3865 | 4862 | |
---|
3866 | | - CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex])); |
---|
| 4863 | + CopyChanged(copy); |
---|
3867 | 4864 | |
---|
3868 | 4865 | //if (!tab.user[tab.versionindex]) |
---|
3869 | 4866 | // tab.graphs[tab.versionindex] = null; |
---|
| 4867 | + |
---|
| 4868 | + SetVersionStates(); |
---|
| 4869 | + |
---|
| 4870 | + SetCameras(); |
---|
3870 | 4871 | } |
---|
3871 | 4872 | |
---|
| 4873 | + void SetCameras() |
---|
| 4874 | + { |
---|
| 4875 | + if (copy == Grafreed.grafreed.universe) |
---|
| 4876 | + { |
---|
| 4877 | + Camera neweye = (Camera)copy.GetObject(cameraView.cameras[cameraView.cameracount^1].GetUUID()); |
---|
| 4878 | + Camera newlight = (Camera)copy.GetObject(cameraView.LightCamera().GetUUID()); |
---|
| 4879 | + |
---|
| 4880 | + cameraView.SetCamera(neweye); |
---|
| 4881 | + cameraView.SetLight(newlight); |
---|
| 4882 | + } |
---|
| 4883 | + } |
---|
| 4884 | + |
---|
3872 | 4885 | void ImportGFD() |
---|
3873 | 4886 | { |
---|
3874 | 4887 | FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD); |
---|
.. | .. |
---|
4060 | 5073 | // else |
---|
4061 | 5074 | // applySelf(true); |
---|
4062 | 5075 | // } |
---|
| 5076 | + |
---|
| 5077 | + boolean Equal(double a, double b) |
---|
| 5078 | + { |
---|
| 5079 | + return Math.abs(a - b) < 0.001; |
---|
| 5080 | + } |
---|
| 5081 | + |
---|
4063 | 5082 | void applySelf0(boolean name) |
---|
4064 | 5083 | { |
---|
4065 | 5084 | if (name) |
---|
.. | .. |
---|
4077 | 5096 | //copy.material = new cMaterial(copy.GetMaterial()); |
---|
4078 | 5097 | |
---|
4079 | 5098 | current.color = (float) colorField.getFloat(); |
---|
4080 | | - current.modulation = (float) modulationField.getFloat(); |
---|
| 5099 | + current.modulation = (float) saturationField.getFloat(); |
---|
4081 | 5100 | current.metalness = (float) metalnessField.getFloat(); |
---|
4082 | 5101 | current.diffuse = (float) diffuseField.getFloat(); |
---|
4083 | 5102 | current.specular = (float) specularField.getFloat(); |
---|
.. | .. |
---|
4097 | 5116 | current.shadow = (float) shadowField.getFloat(); |
---|
4098 | 5117 | current.texture = (float) textureField.getFloat(); |
---|
4099 | 5118 | current.opacity = (float) opacityField.getFloat(); |
---|
| 5119 | + current.parallax = (float) parallaxField.getFloat() - 0.125f; |
---|
4100 | 5120 | current.fakedepth = (float) fakedepthField.getFloat(); |
---|
4101 | 5121 | current.shadowbias = (float) shadowbiasField.getFloat(); |
---|
4102 | 5122 | |
---|
.. | .. |
---|
4109 | 5129 | { |
---|
4110 | 5130 | cMaterial mat = copy.material; |
---|
4111 | 5131 | |
---|
4112 | | - colorField.SetToolTipValue((mat.color)); |
---|
4113 | | - modulationField.SetToolTipValue((mat.modulation)); |
---|
4114 | | - metalnessField.SetToolTipValue((mat.metalness)); |
---|
4115 | | - diffuseField.SetToolTipValue((mat.diffuse)); |
---|
4116 | | - specularField.SetToolTipValue((mat.specular)); |
---|
4117 | | - shininessField.SetToolTipValue((mat.shininess)); |
---|
4118 | | - shiftField.SetToolTipValue((mat.shift)); |
---|
4119 | | - ambientField.SetToolTipValue((mat.ambient)); |
---|
4120 | | - lightareaField.SetToolTipValue((mat.lightarea)); |
---|
4121 | | - diffusenessField.SetToolTipValue((mat.factor)); |
---|
4122 | | - velvetField.SetToolTipValue((mat.velvet)); |
---|
4123 | | - sheenField.SetToolTipValue((mat.sheen)); |
---|
4124 | | - subsurfaceField.SetToolTipValue((mat.subsurface)); |
---|
4125 | | - backlitField.SetToolTipValue((mat.bump)); |
---|
4126 | | - anisoField.SetToolTipValue((mat.aniso)); |
---|
4127 | | - anisoVField.SetToolTipValue((mat.anisoV)); |
---|
4128 | | - cameraField.SetToolTipValue((mat.cameralight)); |
---|
4129 | | - selfshadowField.SetToolTipValue((mat.diffuseness)); |
---|
4130 | | - shadowField.SetToolTipValue((mat.shadow)); |
---|
4131 | | - textureField.SetToolTipValue((mat.texture)); |
---|
4132 | | - opacityField.SetToolTipValue((mat.opacity)); |
---|
4133 | | - fakedepthField.SetToolTipValue((mat.fakedepth)); |
---|
4134 | | - shadowbiasField.SetToolTipValue((mat.shadowbias)); |
---|
| 5132 | + if (!Equal(colorField.getFloat(), mat.color)) |
---|
| 5133 | + colorField.SetToolTipValue((mat.color)); |
---|
| 5134 | + if (!Equal(saturationField.getFloat(), mat.modulation)) |
---|
| 5135 | + saturationField.SetToolTipValue((mat.modulation)); |
---|
| 5136 | + if (!Equal(metalnessField.getFloat(), mat.metalness)) |
---|
| 5137 | + metalnessField.SetToolTipValue((mat.metalness)); |
---|
| 5138 | + if (!Equal(diffuseField.getFloat(), mat.diffuse)) |
---|
| 5139 | + diffuseField.SetToolTipValue((mat.diffuse)); |
---|
| 5140 | + if (!Equal(specularField.getFloat(), mat.specular)) |
---|
| 5141 | + specularField.SetToolTipValue((mat.specular)); |
---|
| 5142 | + if (!Equal(shininessField.getFloat(), mat.shininess)) |
---|
| 5143 | + shininessField.SetToolTipValue((mat.shininess)); |
---|
| 5144 | + if (!Equal(shiftField.getFloat(), mat.shift)) |
---|
| 5145 | + shiftField.SetToolTipValue((mat.shift)); |
---|
| 5146 | + if (!Equal(ambientField.getFloat(), mat.ambient)) |
---|
| 5147 | + ambientField.SetToolTipValue((mat.ambient)); |
---|
| 5148 | + if (!Equal(lightareaField.getFloat(), mat.lightarea)) |
---|
| 5149 | + lightareaField.SetToolTipValue((mat.lightarea)); |
---|
| 5150 | + if (!Equal(diffusenessField.getFloat(), mat.factor)) |
---|
| 5151 | + diffusenessField.SetToolTipValue((mat.factor)); |
---|
| 5152 | + if (!Equal(velvetField.getFloat(), mat.velvet)) |
---|
| 5153 | + velvetField.SetToolTipValue((mat.velvet)); |
---|
| 5154 | + if (!Equal(sheenField.getFloat(), mat.sheen)) |
---|
| 5155 | + sheenField.SetToolTipValue((mat.sheen)); |
---|
| 5156 | + if (!Equal(subsurfaceField.getFloat(), mat.subsurface)) |
---|
| 5157 | + subsurfaceField.SetToolTipValue((mat.subsurface)); |
---|
| 5158 | + if (!Equal(backlitField.getFloat(), mat.bump)) |
---|
| 5159 | + backlitField.SetToolTipValue((mat.bump)); |
---|
| 5160 | + if (!Equal(anisoField.getFloat(), mat.aniso)) |
---|
| 5161 | + anisoField.SetToolTipValue((mat.aniso)); |
---|
| 5162 | + if (!Equal(anisoVField.getFloat(), mat.anisoV)) |
---|
| 5163 | + anisoVField.SetToolTipValue((mat.anisoV)); |
---|
| 5164 | + if (!Equal(cameraField.getFloat(), mat.cameralight)) |
---|
| 5165 | + cameraField.SetToolTipValue((mat.cameralight)); |
---|
| 5166 | + if (!Equal(selfshadowField.getFloat(), mat.diffuseness)) |
---|
| 5167 | + selfshadowField.SetToolTipValue((mat.diffuseness)); |
---|
| 5168 | + if (!Equal(shadowField.getFloat(), mat.shadow)) |
---|
| 5169 | + shadowField.SetToolTipValue((mat.shadow)); |
---|
| 5170 | + if (!Equal(textureField.getFloat(), mat.texture)) |
---|
| 5171 | + textureField.SetToolTipValue((mat.texture)); |
---|
| 5172 | + if (!Equal(opacityField.getFloat(), mat.opacity)) |
---|
| 5173 | + opacityField.SetToolTipValue((mat.opacity)); |
---|
| 5174 | + //if (!Equal(parallaxField.getFloat(), mat.parallax)) |
---|
| 5175 | + parallaxField.SetToolTipValue((mat.parallax)); |
---|
| 5176 | + if (!Equal(fakedepthField.getFloat(), mat.fakedepth)) |
---|
| 5177 | + fakedepthField.SetToolTipValue((mat.fakedepth)); |
---|
| 5178 | + if (!Equal(shadowbiasField.getFloat(), mat.shadowbias)) |
---|
| 5179 | + shadowbiasField.SetToolTipValue((mat.shadowbias)); |
---|
4135 | 5180 | } |
---|
4136 | 5181 | |
---|
4137 | 5182 | if (copy.material != null && copy.projectedVertices.length > 0 && copy.projectedVertices[0] != null) |
---|
.. | .. |
---|
4163 | 5208 | } |
---|
4164 | 5209 | |
---|
4165 | 5210 | cNumberSlider versionSlider; |
---|
| 5211 | + cNumberSlider versionField; |
---|
4166 | 5212 | |
---|
| 5213 | + cNumberSlider scaleSlider; |
---|
| 5214 | + |
---|
| 5215 | + void ScaleSelection(int scale) |
---|
| 5216 | + { |
---|
| 5217 | + } |
---|
| 5218 | + |
---|
4167 | 5219 | public void stateChanged(ChangeEvent e) |
---|
4168 | 5220 | { |
---|
4169 | | - // assert(false); |
---|
| 5221 | + // assert(false); |
---|
| 5222 | + // Main version slider |
---|
4170 | 5223 | if (e.getSource() == versionSlider) |
---|
4171 | 5224 | { |
---|
4172 | 5225 | if (muteSlider) |
---|
4173 | 5226 | return; |
---|
4174 | 5227 | |
---|
| 5228 | + Replace(); |
---|
| 5229 | + |
---|
4175 | 5230 | int version = versionSlider.getInteger(); |
---|
4176 | 5231 | |
---|
4177 | | - if (copy.versions[version] != null) |
---|
| 5232 | + if (version != -1 && copy.versionlist[version] != null) |
---|
4178 | 5233 | { |
---|
4179 | | - CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex = version])); |
---|
| 5234 | + copy.versionindex = version; |
---|
| 5235 | + CopyChanged(copy); |
---|
| 5236 | + SetVersionStates(); |
---|
| 5237 | + SetCameras(); |
---|
4180 | 5238 | } |
---|
4181 | 5239 | |
---|
| 5240 | + return; |
---|
| 5241 | + } |
---|
| 5242 | + |
---|
| 5243 | + // Version slider of edited object |
---|
| 5244 | + if (e.getSource() == versionField) |
---|
| 5245 | + { |
---|
| 5246 | + int version = versionField.getInteger(); |
---|
| 5247 | + |
---|
| 5248 | + if (version != -1 && copy.versionindex != version && copy.versionlist[version] != null) |
---|
| 5249 | + { |
---|
| 5250 | + copy.versionindex = version; |
---|
| 5251 | + CopyChanged(copy); |
---|
| 5252 | + } |
---|
| 5253 | + |
---|
| 5254 | + return; |
---|
| 5255 | + } |
---|
| 5256 | + |
---|
| 5257 | + if (e.getSource() == scaleSlider) |
---|
| 5258 | + { |
---|
| 5259 | + int scale = scaleSlider.getInteger(); |
---|
| 5260 | + |
---|
| 5261 | + ScaleSelection(scale); |
---|
4182 | 5262 | return; |
---|
4183 | 5263 | } |
---|
4184 | 5264 | |
---|
.. | .. |
---|
4216 | 5296 | { |
---|
4217 | 5297 | //System.out.println("stateChanged = " + this); |
---|
4218 | 5298 | materialtouched = true; |
---|
| 5299 | + |
---|
| 5300 | + if (Globals.AUTOSATURATE && e.getSource() == colorField && saturationField.getFloat() == 0.001) |
---|
| 5301 | + { |
---|
| 5302 | + saturationField.setFloat(1); |
---|
| 5303 | + } |
---|
| 5304 | + |
---|
4219 | 5305 | applySelf(); |
---|
4220 | 5306 | //System.out.println("this = " + this); |
---|
4221 | 5307 | //System.out.println("PARENT = " + parent); |
---|
.. | .. |
---|
4265 | 5351 | } |
---|
4266 | 5352 | |
---|
4267 | 5353 | if (normalpushField != null) |
---|
4268 | | - copy.NORMALPUSH = (float)normalpushField.getFloat()/100; |
---|
| 5354 | + copy.NORMALPUSH = (float)normalpushField.getFloat() / 100; |
---|
4269 | 5355 | } |
---|
4270 | 5356 | |
---|
4271 | 5357 | void SnapObject() |
---|
.. | .. |
---|
4515 | 5601 | { |
---|
4516 | 5602 | if (GetTree() != null) |
---|
4517 | 5603 | { |
---|
| 5604 | + GetTree().revalidate(); |
---|
4518 | 5605 | GetTree().repaint(); |
---|
4519 | 5606 | } |
---|
4520 | 5607 | |
---|
.. | .. |
---|
4523 | 5610 | ctrlPanel.validate(); // ? new |
---|
4524 | 5611 | ctrlPanel.repaint(); |
---|
4525 | 5612 | } |
---|
| 5613 | + |
---|
| 5614 | + if (previousVersionButton != null && copy.versionlist != null) |
---|
| 5615 | + SetVersionStates(); |
---|
| 5616 | + |
---|
| 5617 | + cameraView.requestFocusInWindow(); |
---|
4526 | 5618 | } |
---|
4527 | 5619 | |
---|
4528 | 5620 | static TweenManager tweenManager = new TweenManager(); |
---|
.. | .. |
---|
4554 | 5646 | // group = (Composite) group.get(0); |
---|
4555 | 5647 | // } |
---|
4556 | 5648 | |
---|
4557 | | - System.out.println("makeSomething of " + thing); |
---|
| 5649 | + //System.out.println("makeSomething of " + thing); |
---|
4558 | 5650 | |
---|
4559 | 5651 | /* |
---|
4560 | 5652 | if (deselect && jList != null) |
---|
.. | .. |
---|
4633 | 5725 | void ResetModel() |
---|
4634 | 5726 | { |
---|
4635 | 5727 | //assert(copy instanceof Composite); |
---|
4636 | | - Object3D /*Composite*/ group = (Object3D /*Composite*/) copy; |
---|
| 5728 | + Object3D /*Composite*/ group = (Object3D /*Composite*/) objEditor.copy; |
---|
4637 | 5729 | |
---|
4638 | 5730 | // necessary? group.selection = new Object3D(); // java.util.Vector(); |
---|
4639 | 5731 | |
---|
.. | .. |
---|
4644 | 5736 | //group.refreshEditWindow(); |
---|
4645 | 5737 | //refreshContents(); |
---|
4646 | 5738 | |
---|
4647 | | - if (copy.selection == null) |
---|
| 5739 | + if (objEditor.copy.selection == null) |
---|
4648 | 5740 | { |
---|
4649 | | - copy.selection = new Object3D(); |
---|
| 5741 | + objEditor.copy.selection = new Object3D(); |
---|
4650 | 5742 | } |
---|
4651 | 5743 | |
---|
4652 | | - for (int j = 0; j < copy.selection.size(); j++) |
---|
| 5744 | + for (int j = 0; j < objEditor.copy.selection.size(); j++) |
---|
4653 | 5745 | { |
---|
4654 | | - Object3D item = copy.selection.get(j); |
---|
| 5746 | + Object3D item = objEditor.copy.selection.get(j); |
---|
4655 | 5747 | |
---|
4656 | 5748 | if (item instanceof cGroup && ((cGroup) item).transientlink) |
---|
4657 | 5749 | { |
---|
.. | .. |
---|
4660 | 5752 | |
---|
4661 | 5753 | if (item.count <= 1) // ??? == 0) |
---|
4662 | 5754 | { |
---|
4663 | | - copy.selection.remove(item); |
---|
| 5755 | + objEditor.copy.selection.remove(item); |
---|
4664 | 5756 | } |
---|
4665 | 5757 | } |
---|
4666 | 5758 | |
---|
4667 | 5759 | boolean first = true; |
---|
4668 | 5760 | |
---|
4669 | | - for (int i = copy.selection.size(); --i >= 0;) |
---|
| 5761 | + for (int i = objEditor.copy.selection.size(); --i >= 0;) |
---|
4670 | 5762 | { |
---|
4671 | | - Object3D item = copy.selection.get(i); |
---|
| 5763 | + Object3D item = objEditor.copy.selection.get(i); |
---|
4672 | 5764 | |
---|
4673 | 5765 | if (item instanceof cGroup && ((cGroup) item).transientlink) |
---|
4674 | 5766 | { |
---|
.. | .. |
---|
4853 | 5945 | { |
---|
4854 | 5946 | //readobj.deepCopySelf(copy); |
---|
4855 | 5947 | copy.clear(); // june 2014 |
---|
| 5948 | + copy.skyboxname = readobj.skyboxname; |
---|
| 5949 | + copy.skyboxext = readobj.skyboxext; |
---|
4856 | 5950 | for (int i = 0; i < readobj.size(); i++) |
---|
4857 | 5951 | { |
---|
4858 | 5952 | Object3D child = readobj.get(i); // reserve(i); |
---|
.. | .. |
---|
4904 | 5998 | c.addChild(csg); |
---|
4905 | 5999 | } |
---|
4906 | 6000 | |
---|
4907 | | - copy.versions = readobj.versions; |
---|
| 6001 | + copy.versionlist = readobj.versionlist; |
---|
4908 | 6002 | copy.versionindex = readobj.versionindex; |
---|
| 6003 | + copy.versiontable = readobj.versiontable; |
---|
4909 | 6004 | |
---|
4910 | | - if (copy.versions == null) |
---|
| 6005 | + if (copy.versionlist == null) |
---|
4911 | 6006 | { |
---|
4912 | | - copy.versions = new byte[100][]; |
---|
| 6007 | + // Backward compatibility |
---|
| 6008 | + copy.versionlist = new Object3D[100]; |
---|
4913 | 6009 | copy.versionindex = -1; |
---|
| 6010 | + |
---|
| 6011 | + //Save(true); |
---|
4914 | 6012 | } |
---|
4915 | 6013 | |
---|
4916 | 6014 | //? SetUndoStates(); |
---|
| 6015 | + |
---|
| 6016 | + cameraView.RevertCamera(); |
---|
4917 | 6017 | |
---|
4918 | 6018 | ResetModel(); |
---|
4919 | 6019 | copy.HardTouch(); // recompile? |
---|
.. | .. |
---|
4925 | 6025 | { |
---|
4926 | 6026 | if (Grafreed.standAlone) |
---|
4927 | 6027 | { |
---|
4928 | | - FileDialog browser = new FileDialog(frame, "Load", FileDialog.LOAD); |
---|
| 6028 | + FileDialog browser = new FileDialog(frame, "Open", FileDialog.LOAD); |
---|
4929 | 6029 | browser.show(); |
---|
4930 | 6030 | String filename = browser.getFile(); |
---|
4931 | 6031 | if (filename != null && filename.length() > 0) |
---|
.. | .. |
---|
5002 | 6102 | |
---|
5003 | 6103 | void save() |
---|
5004 | 6104 | { |
---|
| 6105 | + Replace(); |
---|
| 6106 | + |
---|
5005 | 6107 | if (lastname == null) |
---|
5006 | 6108 | { |
---|
5007 | 6109 | return; |
---|
.. | .. |
---|
5244 | 6346 | ButtonGroup buttonGroup; |
---|
5245 | 6347 | |
---|
5246 | 6348 | cGridBag toolboxPanel; |
---|
| 6349 | + cGridBag skyboxPanel; |
---|
5247 | 6350 | cGridBag materialPanel; |
---|
5248 | 6351 | cGridBag ctrlPanel; |
---|
| 6352 | + cGridBag figurePanel; |
---|
5249 | 6353 | |
---|
5250 | 6354 | JScrollPane infoPanel; |
---|
5251 | 6355 | |
---|
5252 | 6356 | cGridBag optionsPanel; |
---|
5253 | 6357 | |
---|
5254 | | - JTabbedPane objectPanel; |
---|
| 6358 | + JTabbedPane objectTabbedPane; |
---|
5255 | 6359 | boolean materialFlushed; |
---|
5256 | 6360 | Object3D latestObject; |
---|
5257 | 6361 | |
---|
| 6362 | + cGridBag transformPanel; |
---|
5258 | 6363 | cGridBag XYZPanel; |
---|
5259 | 6364 | |
---|
5260 | 6365 | JSplitPane gridPanel; |
---|
.. | .. |
---|
5317 | 6422 | JLabel colorLabel; |
---|
5318 | 6423 | cNumberSlider colorField; |
---|
5319 | 6424 | JLabel modulationLabel; |
---|
5320 | | - cNumberSlider modulationField; |
---|
| 6425 | + cNumberSlider saturationField; |
---|
5321 | 6426 | JLabel metalnessLabel; |
---|
5322 | 6427 | cNumberSlider metalnessField; |
---|
5323 | 6428 | JLabel diffuseLabel; |
---|
.. | .. |
---|
5348 | 6453 | cNumberSlider anisoField; |
---|
5349 | 6454 | JLabel anisoVLabel; |
---|
5350 | 6455 | cNumberSlider anisoVField; |
---|
| 6456 | + |
---|
5351 | 6457 | JLabel cameraLabel; |
---|
5352 | 6458 | cNumberSlider cameraField; |
---|
5353 | 6459 | JLabel selfshadowLabel; |
---|
.. | .. |
---|
5358 | 6464 | cNumberSlider textureField; |
---|
5359 | 6465 | JLabel opacityLabel; |
---|
5360 | 6466 | cNumberSlider opacityField; |
---|
| 6467 | + JLabel parallaxLabel; |
---|
| 6468 | + cNumberSlider parallaxField; |
---|
5361 | 6469 | JLabel fakedepthLabel; |
---|
5362 | 6470 | cNumberSlider fakedepthField; |
---|
5363 | 6471 | JLabel shadowbiasLabel; |
---|
5364 | 6472 | cNumberSlider shadowbiasField; |
---|
| 6473 | + |
---|
5365 | 6474 | JLabel bumpLabel; |
---|
5366 | 6475 | cNumberSlider bumpField; |
---|
5367 | 6476 | JLabel noiseLabel; |
---|