.. | .. |
---|
41 | 41 | JFrame frame; |
---|
42 | 42 | |
---|
43 | 43 | static ObjEditor theFrame; |
---|
| 44 | + |
---|
| 45 | + public cGridBag GetSeparator() |
---|
| 46 | + { |
---|
| 47 | + cGridBag separator = new cGridBag(); |
---|
| 48 | + separator.add(new JSeparator()); |
---|
| 49 | + separator.preferredHeight = 5; |
---|
| 50 | + return separator; |
---|
| 51 | + } |
---|
44 | 52 | |
---|
45 | 53 | cButton GetButton(String name, boolean border) |
---|
46 | 54 | { |
---|
47 | | - try |
---|
48 | | - { |
---|
49 | | - ImageIcon icon = GetIcon(name); |
---|
50 | | - return new cButton(icon, border); |
---|
51 | | - } |
---|
52 | | - catch (Exception e) |
---|
53 | | - { |
---|
54 | | - return new cButton(name, border); |
---|
55 | | - } |
---|
| 55 | + ImageIcon icon = GetIcon(name); |
---|
| 56 | + return new cButton(icon, border); |
---|
| 57 | + } |
---|
| 58 | + |
---|
| 59 | + cLabel GetLabel(String name, boolean border) |
---|
| 60 | + { |
---|
| 61 | + //ImageIcon icon = GetIcon(name); |
---|
| 62 | + return new cLabel(GetImage(name), border); |
---|
56 | 63 | } |
---|
57 | 64 | |
---|
58 | 65 | cToggleButton GetToggleButton(String name, boolean border) |
---|
59 | 66 | { |
---|
60 | | - try |
---|
61 | | - { |
---|
62 | | - ImageIcon icon = GetIcon(name); |
---|
63 | | - return new cToggleButton(icon, border); |
---|
64 | | - } |
---|
65 | | - catch (Exception e) |
---|
66 | | - { |
---|
67 | | - return new cToggleButton(name, border); |
---|
68 | | - } |
---|
| 67 | + ImageIcon icon = GetIcon(name); |
---|
| 68 | + return new cToggleButton(icon, border); |
---|
69 | 69 | } |
---|
70 | 70 | |
---|
71 | 71 | cCheckBox GetCheckBox(String name, boolean border) |
---|
72 | 72 | { |
---|
| 73 | + ImageIcon icon = GetIcon(name); |
---|
| 74 | + return new cCheckBox(icon, border); |
---|
| 75 | + } |
---|
| 76 | + |
---|
| 77 | + ImageIcon GetIcon(String name) |
---|
| 78 | + { |
---|
73 | 79 | try |
---|
74 | 80 | { |
---|
75 | | - ImageIcon icon = GetIcon(name); |
---|
76 | | - return new cCheckBox(icon, border); |
---|
| 81 | + BufferedImage image = javax.imageio.ImageIO.read(getClass().getClassLoader().getResourceAsStream(name)); |
---|
| 82 | + |
---|
| 83 | +// if (image.getWidth() > 48 && image.getHeight() > 48) |
---|
| 84 | +// { |
---|
| 85 | +// BufferedImage resized = new BufferedImage(48, 48, image.getType()); |
---|
| 86 | +// Graphics2D g = resized.createGraphics(); |
---|
| 87 | +// g.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR); |
---|
| 88 | +// //g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); |
---|
| 89 | +// g.drawImage(image, 0, 0, 48, 48, 0, 0, image.getWidth(), image.getHeight(), null); |
---|
| 90 | +// g.dispose(); |
---|
| 91 | +// |
---|
| 92 | +// image = resized; |
---|
| 93 | +// } |
---|
| 94 | + |
---|
| 95 | + javax.swing.ImageIcon icon = new javax.swing.ImageIcon(image); |
---|
| 96 | + return icon; |
---|
77 | 97 | } |
---|
78 | 98 | catch (Exception e) |
---|
79 | 99 | { |
---|
80 | | - return new cCheckBox(name, border); |
---|
| 100 | + return null; |
---|
81 | 101 | } |
---|
82 | 102 | } |
---|
83 | | - |
---|
84 | | - private ImageIcon GetIcon(String name) throws IOException |
---|
| 103 | + |
---|
| 104 | + BufferedImage GetImage(String name) |
---|
85 | 105 | { |
---|
86 | | - BufferedImage image = javax.imageio.ImageIO.read(getClass().getClassLoader().getResourceAsStream(name)); |
---|
87 | | - |
---|
88 | | - if (image.getWidth() != 24 && image.getHeight() != 24) |
---|
| 106 | + try |
---|
89 | 107 | { |
---|
90 | | - BufferedImage resized = new BufferedImage(24, 24, image.getType()); |
---|
91 | | - Graphics2D g = resized.createGraphics(); |
---|
92 | | - g.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR); |
---|
93 | | - //g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); |
---|
94 | | - g.drawImage(image, 0, 0, 24, 24, 0, 0, image.getWidth(), image.getHeight(), null); |
---|
95 | | - g.dispose(); |
---|
96 | | - |
---|
97 | | - image = resized; |
---|
| 108 | + BufferedImage image = javax.imageio.ImageIO.read(getClass().getClassLoader().getResourceAsStream(name)); |
---|
| 109 | + |
---|
| 110 | + return image; |
---|
98 | 111 | } |
---|
99 | | - |
---|
100 | | - javax.swing.ImageIcon icon = new javax.swing.ImageIcon(image); |
---|
101 | | - return icon; |
---|
| 112 | + catch (Exception e) |
---|
| 113 | + { |
---|
| 114 | + return null; |
---|
| 115 | + } |
---|
102 | 116 | } |
---|
103 | 117 | |
---|
104 | 118 | // SCRIPT |
---|
.. | .. |
---|
282 | 296 | client = inClient; |
---|
283 | 297 | copy = client; |
---|
284 | 298 | |
---|
| 299 | + if (copy.versionlist == null) |
---|
| 300 | + { |
---|
| 301 | + copy.versionlist = new Object3D[100]; |
---|
| 302 | + copy.versionindex = -1; |
---|
| 303 | + } |
---|
| 304 | + |
---|
285 | 305 | // "this" is not called: SetupUI2(objEditor); |
---|
286 | 306 | } |
---|
287 | 307 | |
---|
.. | .. |
---|
295 | 315 | client = inClient; |
---|
296 | 316 | copy = client; |
---|
297 | 317 | |
---|
| 318 | + if (copy.versionlist == null) |
---|
| 319 | + { |
---|
| 320 | + copy.versionlist = new Object3D[100]; |
---|
| 321 | + copy.versionindex = -1; |
---|
| 322 | + } |
---|
| 323 | + |
---|
298 | 324 | SetupUI2(callee.GetEditor()); |
---|
299 | 325 | } |
---|
300 | 326 | |
---|
.. | .. |
---|
309 | 335 | //localCopy.parent = null; |
---|
310 | 336 | |
---|
311 | 337 | frame = new JFrame(); |
---|
312 | | - frame.setUndecorated(true); |
---|
| 338 | + frame.setUndecorated(false); |
---|
313 | 339 | objEditor = this; |
---|
314 | 340 | this.callee = callee; |
---|
315 | 341 | |
---|
.. | .. |
---|
327 | 353 | copy = localCopy; |
---|
328 | 354 | copy.editWindow = this; |
---|
329 | 355 | |
---|
| 356 | + if (copy.versionlist == null) |
---|
| 357 | + { |
---|
| 358 | +// copy.versions = new byte[100][]; |
---|
| 359 | +// copy.versionindex = -1; |
---|
| 360 | + } |
---|
| 361 | + |
---|
330 | 362 | SetupMenu(); |
---|
331 | 363 | |
---|
332 | 364 | //SetupName(objEditor); // new |
---|
.. | .. |
---|
350 | 382 | frame.setMenuBar(menuBar = new MenuBar()); |
---|
351 | 383 | menuBar.add(fileMenu = new Menu("File")); |
---|
352 | 384 | fileMenu.add(newItem = new MenuItem("New")); |
---|
353 | | - fileMenu.add(loadItem = new MenuItem("Open...")); |
---|
| 385 | + fileMenu.add(openItem = new MenuItem("Open...")); |
---|
354 | 386 | |
---|
355 | 387 | //oe.menuBar.add(menu = new Menu("Include")); |
---|
356 | 388 | Menu menu = new Menu("Import"); |
---|
.. | .. |
---|
382 | 414 | } |
---|
383 | 415 | |
---|
384 | 416 | newItem.addActionListener(this); |
---|
385 | | - loadItem.addActionListener(this); |
---|
| 417 | + openItem.addActionListener(this); |
---|
386 | 418 | saveItem.addActionListener(this); |
---|
387 | 419 | saveAsItem.addActionListener(this); |
---|
388 | 420 | exportAsItem.addActionListener(this); |
---|
.. | .. |
---|
419 | 451 | |
---|
420 | 452 | toolbarPanel = new JPanel(); |
---|
421 | 453 | toolbarPanel.setName("Toolbar"); |
---|
| 454 | + |
---|
422 | 455 | treePanel = new cGridBag(); |
---|
423 | 456 | treePanel.setName("Tree"); |
---|
424 | 457 | |
---|
425 | 458 | editPanel = new cGridBag().setVertical(true); |
---|
426 | | - editPanel.setName("Edit"); |
---|
| 459 | + //editPanel.setName("Edit"); |
---|
427 | 460 | |
---|
428 | 461 | ctrlPanel = new cGridBag().setVertical(false); // new GridBagLayout()); |
---|
429 | 462 | |
---|
.. | .. |
---|
431 | 464 | editPanel.add(editCommandsPanel); |
---|
432 | 465 | editPanel.add(ctrlPanel); |
---|
433 | 466 | |
---|
434 | | - toolboxPanel = new cGridBag().setVertical(false); |
---|
435 | | - toolboxPanel.setName("Toolbox"); |
---|
| 467 | + toolboxPanel = new cGridBag().setVertical(true); |
---|
| 468 | + //toolboxPanel.setName("Toolbox"); |
---|
436 | 469 | |
---|
437 | | - materialPanel = new cGridBag().setVertical(true); |
---|
438 | | - materialPanel.setName("Material"); |
---|
| 470 | + materialPanel = new cGridBag().setVertical(false); |
---|
| 471 | + //materialPanel.setName("Material"); |
---|
439 | 472 | |
---|
440 | 473 | /*JTextPane*/ |
---|
441 | 474 | infoarea = createTextPane(); |
---|
.. | .. |
---|
443 | 476 | |
---|
444 | 477 | infoarea.setEditable(true); |
---|
445 | 478 | SetText(); |
---|
| 479 | + |
---|
446 | 480 | // infoarea.setFont(infoarea.getFont().deriveFont(10, 14f)); |
---|
447 | 481 | // infoarea.setOpaque(false); |
---|
448 | 482 | // //infoarea.setForeground(textcolor); |
---|
449 | 483 | // TEXTAREA infoarea.setLineWrap(true); |
---|
450 | 484 | // TEXTAREA infoarea.setWrapStyleWord(true); |
---|
451 | 485 | infoPanel = new JScrollPane(infoarea, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); //AS_NEEDED); |
---|
452 | | - //infoPanel.setPreferredSize(new Dimension(50, 200)); |
---|
453 | | - infoPanel.setName("Info"); |
---|
| 486 | + infoPanel.setPreferredSize(new Dimension(1, 1)); |
---|
| 487 | + //infoPanel.setName("Info"); |
---|
454 | 488 | //infoPanel.setLayout(new BorderLayout()); |
---|
455 | 489 | //infoPanel.add(createTextPane()); |
---|
456 | 490 | |
---|
.. | .. |
---|
699 | 733 | } |
---|
700 | 734 | } |
---|
701 | 735 | |
---|
702 | | -static GraphicsDevice device = GraphicsEnvironment |
---|
703 | | - .getLocalGraphicsEnvironment().getScreenDevices()[0]; |
---|
| 736 | +//static GraphicsDevice device = GraphicsEnvironment |
---|
| 737 | +// .getLocalGraphicsEnvironment().getScreenDevices()[0]; |
---|
704 | 738 | |
---|
705 | 739 | Rectangle keeprect; |
---|
706 | 740 | cRadio radio; |
---|
.. | .. |
---|
741 | 775 | else |
---|
742 | 776 | { |
---|
743 | 777 | keeprect = frame.getBounds(); |
---|
744 | | - Rectangle rect = GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds(); |
---|
745 | | - Dimension rect2 = frame.getToolkit().getScreenSize(); |
---|
746 | | - frame.setBounds(0, rect2.height - rect.height, rect.width, rect.height); |
---|
| 778 | +// Rectangle rect = GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds(); |
---|
| 779 | +// Dimension rect2 = frame.getToolkit().getScreenSize(); |
---|
| 780 | +// frame.setBounds(0, rect2.height - rect.height, rect.width, rect.height); |
---|
747 | 781 | // frame.setState(Frame.MAXIMIZED_BOTH); |
---|
| 782 | + frame.setBounds(frame.getGraphicsConfiguration().getBounds()); |
---|
748 | 783 | } |
---|
749 | 784 | |
---|
750 | 785 | maximized ^= true; |
---|
.. | .. |
---|
758 | 793 | |
---|
759 | 794 | void ToggleFullScreen() |
---|
760 | 795 | { |
---|
| 796 | +GraphicsDevice device = frame.getGraphicsConfiguration().getDevice(); |
---|
| 797 | + |
---|
761 | 798 | cameraView.ToggleFullScreen(); |
---|
762 | 799 | |
---|
763 | 800 | if (!CameraPane.FULLSCREEN) |
---|
764 | 801 | { |
---|
765 | 802 | device.setFullScreenWindow(null); |
---|
| 803 | + frame.dispose(); |
---|
| 804 | + frame.setUndecorated(false); |
---|
766 | 805 | frame.validate(); |
---|
| 806 | + frame.setVisible(true); |
---|
767 | 807 | |
---|
768 | 808 | //frame.setVisible(false); |
---|
769 | 809 | // frame.removeNotify(); |
---|
.. | .. |
---|
774 | 814 | // X frame.getContentPane().remove(/*"Center",*/bigThree); |
---|
775 | 815 | // X framePanel.add(bigThree); |
---|
776 | 816 | // X frame.getContentPane().add(/*"Center",*/framePanel); |
---|
777 | | - framePanel.setDividerLocation(1); |
---|
| 817 | + framePanel.setDividerLocation(46); |
---|
778 | 818 | |
---|
779 | 819 | //frame.setVisible(true); |
---|
780 | 820 | radio.layout = keepButton; |
---|
.. | .. |
---|
789 | 829 | // frame.setBounds(0, 0, frame.getToolkit().getScreenSize().width, |
---|
790 | 830 | // frame.getToolkit().getScreenSize().height); |
---|
791 | 831 | //frame.setVisible(false); |
---|
| 832 | + |
---|
| 833 | + frame.dispose(); |
---|
| 834 | + frame.setUndecorated(true); |
---|
792 | 835 | device.setFullScreenWindow(frame); |
---|
793 | 836 | frame.validate(); |
---|
| 837 | + frame.setVisible(true); |
---|
794 | 838 | // frame.removeNotify(); |
---|
795 | 839 | // frame.setUndecorated(true); |
---|
796 | 840 | // frame.addNotify(); |
---|
.. | .. |
---|
804 | 848 | //frame.setVisible(true); |
---|
805 | 849 | } |
---|
806 | 850 | frame.validate(); |
---|
| 851 | + |
---|
| 852 | + cameraView.requestFocusInWindow(); |
---|
807 | 853 | } |
---|
| 854 | + |
---|
| 855 | + private Object3D CompressCopy() |
---|
| 856 | + { |
---|
| 857 | + boolean temp = CameraPane.SWITCH; |
---|
| 858 | + CameraPane.SWITCH = false; |
---|
| 859 | + |
---|
| 860 | + copy.ExtractBigData(versiontable); |
---|
| 861 | + // if (copy == client) |
---|
| 862 | + |
---|
| 863 | + Object3D versions[] = copy.versionlist; |
---|
| 864 | + copy.versionlist = null; |
---|
| 865 | + |
---|
| 866 | + //byte[] compress = Compress(copy); |
---|
| 867 | + Object3D compress = (Object3D)Grafreed.clone(copy); |
---|
| 868 | + |
---|
| 869 | + copy.versionlist = versions; |
---|
| 870 | + |
---|
| 871 | + copy.RestoreBigData(versiontable); |
---|
| 872 | + |
---|
| 873 | + CameraPane.SWITCH = temp; |
---|
| 874 | + |
---|
| 875 | + return compress; |
---|
| 876 | + } |
---|
808 | 877 | |
---|
809 | 878 | private JTextPane createTextPane() |
---|
810 | 879 | { |
---|
.. | .. |
---|
927 | 996 | { |
---|
928 | 997 | SetupMaterial(materialPanel); |
---|
929 | 998 | } |
---|
| 999 | + |
---|
930 | 1000 | //SetupName(); |
---|
931 | 1001 | //SetupViews(); |
---|
932 | 1002 | } |
---|
.. | .. |
---|
936 | 1006 | // NumberSlider vDivsField; |
---|
937 | 1007 | // JCheckBox endcaps; |
---|
938 | 1008 | JCheckBox liveCB; |
---|
939 | | - JCheckBox selectCB; |
---|
| 1009 | + JCheckBox selectableCB; |
---|
940 | 1010 | JCheckBox hideCB; |
---|
941 | 1011 | JCheckBox link2masterCB; |
---|
942 | 1012 | JCheckBox markCB; |
---|
.. | .. |
---|
1148 | 1218 | |
---|
1149 | 1219 | liveCB = AddCheckBox(setupPanel, "Live", copy.live); |
---|
1150 | 1220 | liveCB.setToolTipText("Animate object"); |
---|
1151 | | - selectCB = AddCheckBox(setupPanel, "Select", !copy.dontselect); |
---|
1152 | | - selectCB.setToolTipText("Make object selectable"); |
---|
| 1221 | + selectableCB = AddCheckBox(setupPanel, "Select", !copy.dontselect); |
---|
| 1222 | + selectableCB.setToolTipText("Make object selectable"); |
---|
1153 | 1223 | // Return(); |
---|
| 1224 | + |
---|
1154 | 1225 | hideCB = AddCheckBox(setupPanel, "Hide", copy.hide); |
---|
1155 | 1226 | hideCB.setToolTipText("Hide object"); |
---|
1156 | 1227 | markCB = AddCheckBox(setupPanel, "Mark", copy.marked); |
---|
1157 | 1228 | markCB.setToolTipText("As animation target transform"); |
---|
| 1229 | + |
---|
| 1230 | + ToolTipManager.sharedInstance().setLightWeightPopupEnabled(false); |
---|
1158 | 1231 | |
---|
1159 | 1232 | setupPanel2 = new cGridBag().setVertical(false); |
---|
1160 | 1233 | |
---|
.. | .. |
---|
1164 | 1237 | randomCB = AddCheckBox(setupPanel2, "Random", copy.random); |
---|
1165 | 1238 | randomCB.setToolTipText("Randomly Rewind (or Go back and forth)"); |
---|
1166 | 1239 | |
---|
| 1240 | + link2masterCB = AddCheckBox(setupPanel2, "Support", copy.link2master); |
---|
| 1241 | + link2masterCB.setToolTipText("Attach to support"); |
---|
| 1242 | + |
---|
1167 | 1243 | if (Globals.ADVANCED) |
---|
1168 | 1244 | { |
---|
1169 | | - link2masterCB = AddCheckBox(setupPanel2, "Supp", copy.link2master); |
---|
1170 | | - link2masterCB.setToolTipText("Attach to support"); |
---|
1171 | 1245 | speedupCB = AddCheckBox(setupPanel2, "Speed", copy.speedup); |
---|
1172 | 1246 | speedupCB.setToolTipText("Option motion capture"); |
---|
1173 | 1247 | } |
---|
.. | .. |
---|
1441 | 1515 | XYZPanel.addComponent(/*BorderLayout.SOUTH,*/sideView); // Scroll); |
---|
1442 | 1516 | XYZPanel.addComponent(/*BorderLayout.CENTER,*/frontView); // Scroll); |
---|
1443 | 1517 | XYZPanel.addComponent(/*BorderLayout.NORTH,*/topView); // Scroll); |
---|
| 1518 | + //XYZPanel.setName("XYZ"); |
---|
1444 | 1519 | |
---|
1445 | 1520 | /* |
---|
1446 | 1521 | gridPanel = new JPanel(); //new BorderLayout()); |
---|
.. | .. |
---|
1478 | 1553 | //JScrollPane tmp = new JScrollPane(ctrlPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); |
---|
1479 | 1554 | //tmp.setName("Edit"); |
---|
1480 | 1555 | objectPanel.add(materialPanel); |
---|
| 1556 | + objectPanel.setIconAt(0, GetIcon("icons/material.png")); |
---|
| 1557 | + objectPanel.setToolTipTextAt(0, "Material"); |
---|
| 1558 | + |
---|
1481 | 1559 | // JPanel north = new JPanel(new BorderLayout()); |
---|
1482 | 1560 | // north.setName("Edit"); |
---|
1483 | 1561 | // north.add(ctrlPanel, BorderLayout.NORTH); |
---|
1484 | 1562 | // objectPanel.add(north); |
---|
1485 | 1563 | objectPanel.add(editPanel); |
---|
1486 | | - objectPanel.add(infoPanel); |
---|
| 1564 | + objectPanel.setIconAt(1, GetIcon("icons/write.png")); |
---|
| 1565 | + objectPanel.setToolTipTextAt(1, "Edit controls"); |
---|
| 1566 | + |
---|
| 1567 | + //if (Globals.ADVANCED) |
---|
| 1568 | + objectPanel.add(infoPanel); |
---|
| 1569 | + objectPanel.setIconAt(2, GetIcon("icons/info.png")); |
---|
| 1570 | + objectPanel.setToolTipTextAt(2, "Information"); |
---|
| 1571 | + |
---|
| 1572 | + objectPanel.add(XYZPanel); |
---|
| 1573 | + objectPanel.setIconAt(3, GetIcon("icons/XYZ.png")); |
---|
| 1574 | + objectPanel.setToolTipTextAt(3, "XYZ/RGB transform"); |
---|
| 1575 | + |
---|
1487 | 1576 | objectPanel.add(toolboxPanel); |
---|
| 1577 | + objectPanel.setIconAt(4, GetIcon("icons/primitives.png")); |
---|
| 1578 | + objectPanel.setToolTipTextAt(4, "Objects & backgrounds"); |
---|
1488 | 1579 | |
---|
1489 | 1580 | /* |
---|
1490 | 1581 | aConstraints.gridx = 0; |
---|
.. | .. |
---|
1505 | 1596 | scrollpane.addMouseWheelListener(this); // Default not fast enough |
---|
1506 | 1597 | |
---|
1507 | 1598 | /*JTabbedPane*/ scenePanel = new cGridBag(); |
---|
1508 | | - scenePanel.preferredWidth = 6; |
---|
| 1599 | + scenePanel.preferredWidth = 5; |
---|
1509 | 1600 | |
---|
1510 | 1601 | JTabbedPane tabbedPane = new JTabbedPane(); |
---|
1511 | 1602 | tabbedPane.add(scrollpane); |
---|
.. | .. |
---|
1583 | 1674 | bigThree = new cGridBag(); |
---|
1584 | 1675 | bigThree.addComponent(scenePanel); |
---|
1585 | 1676 | bigThree.addComponent(centralPanel); |
---|
1586 | | - bigThree.addComponent(XYZPanel); |
---|
| 1677 | + //bigThree.addComponent(XYZPanel); |
---|
1587 | 1678 | |
---|
1588 | 1679 | // // SIDE EFFECT!!! |
---|
1589 | 1680 | // aConstraints.gridx = 0; |
---|
.. | .. |
---|
1592 | 1683 | // aConstraints.gridheight = 1; |
---|
1593 | 1684 | |
---|
1594 | 1685 | framePanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, toolbarPanel, bigThree); |
---|
1595 | | - framePanel.setContinuousLayout(true); |
---|
1596 | | - framePanel.setOneTouchExpandable(true); |
---|
1597 | | - framePanel.setDividerLocation(0.8); |
---|
| 1686 | + framePanel.setContinuousLayout(false); |
---|
| 1687 | + framePanel.setOneTouchExpandable(false); |
---|
| 1688 | + //.setDividerLocation(0.8); |
---|
1598 | 1689 | //framePanel.setDividerSize(15); |
---|
1599 | 1690 | //framePanel.setResizeWeight(0.15); |
---|
1600 | 1691 | framePanel.setName("Frame"); |
---|
.. | .. |
---|
1613 | 1704 | |
---|
1614 | 1705 | frame.setSize(1280, 860); |
---|
1615 | 1706 | |
---|
1616 | | - frame.validate(); |
---|
1617 | | - frame.setVisible(true); |
---|
1618 | | - |
---|
1619 | 1707 | cameraView.requestFocusInWindow(); |
---|
1620 | 1708 | |
---|
1621 | 1709 | gridPanel.setDividerLocation(1.0); |
---|
| 1710 | + |
---|
| 1711 | + frame.validate(); |
---|
| 1712 | + |
---|
| 1713 | + frame.setVisible(true); |
---|
1622 | 1714 | |
---|
1623 | 1715 | frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); |
---|
1624 | 1716 | frame.addWindowListener(new WindowAdapter() |
---|
1625 | 1717 | { |
---|
1626 | | - |
---|
1627 | 1718 | public void windowClosing(WindowEvent e) |
---|
1628 | 1719 | { |
---|
1629 | 1720 | Close(); |
---|
.. | .. |
---|
1646 | 1737 | ctrlPanel.removeAll(); |
---|
1647 | 1738 | } |
---|
1648 | 1739 | |
---|
1649 | | - void SetupMaterial(cGridBag panel) |
---|
| 1740 | + void SetupMaterial(cGridBag materialpanel) |
---|
1650 | 1741 | { |
---|
1651 | | - /* |
---|
| 1742 | + cGridBag presetpanel = new cGridBag().setVertical(true); |
---|
| 1743 | + cLabel skin = GetLabel("icons/shadericons/shadericon00000.png", !Grafreed.NIMBUSLAF); |
---|
| 1744 | + skin.addMouseListener(new MouseAdapter() |
---|
| 1745 | + { |
---|
| 1746 | + public void mouseClicked(MouseEvent e) |
---|
| 1747 | + { |
---|
| 1748 | + Object3D object = Grafreed.materials.versionlist[0].get(0); |
---|
| 1749 | + cMaterial material = object.material; |
---|
| 1750 | + |
---|
| 1751 | + // Skin |
---|
| 1752 | + colorField.setFloat(material.color); |
---|
| 1753 | + saturationField.setFloat(material.modulation); |
---|
| 1754 | + subsurfaceField.setFloat(material.subsurface); |
---|
| 1755 | + selfshadowField.setFloat(material.diffuseness); |
---|
| 1756 | + diffusenessField.setFloat(material.factor); |
---|
| 1757 | + shininessField.setFloat(material.shininess); |
---|
| 1758 | + shadowbiasField.setFloat(material.shadowbias); |
---|
| 1759 | + diffuseField.setFloat(material.diffuse); |
---|
| 1760 | + specularField.setFloat(material.specular); |
---|
| 1761 | + |
---|
| 1762 | + bumpField.setFloat(object.projectedVertices[0].x / 1000.0); |
---|
| 1763 | + noiseField.setFloat(object.projectedVertices[0].y / 1000.0); |
---|
| 1764 | + powerField.setFloat(object.projectedVertices[2].x / 1000.0); |
---|
| 1765 | + |
---|
| 1766 | + materialtouched = true; |
---|
| 1767 | + applySelf(); |
---|
| 1768 | + } |
---|
| 1769 | + }); |
---|
| 1770 | + presetpanel.add(skin); |
---|
| 1771 | + |
---|
| 1772 | + cLabel rough2 = GetLabel("icons/shadericons/shadericon00001.png", !Grafreed.NIMBUSLAF); |
---|
| 1773 | + rough2.addMouseListener(new MouseAdapter() |
---|
| 1774 | + { |
---|
| 1775 | + public void mouseClicked(MouseEvent e) |
---|
| 1776 | + { |
---|
| 1777 | + Object3D object = Grafreed.materials.versionlist[1].get(0); |
---|
| 1778 | + cMaterial material = object.material; |
---|
| 1779 | + |
---|
| 1780 | + shininessField.setFloat(material.shininess); |
---|
| 1781 | + velvetField.setFloat(material.velvet); |
---|
| 1782 | + |
---|
| 1783 | + materialtouched = true; |
---|
| 1784 | + applySelf(); |
---|
| 1785 | + } |
---|
| 1786 | + }); |
---|
| 1787 | + presetpanel.add(rough2); |
---|
| 1788 | + |
---|
| 1789 | + presetpanel.add(GetLabel("icons/shadericons/shadericon00002.png", !Grafreed.NIMBUSLAF)); |
---|
| 1790 | + presetpanel.add(GetLabel("icons/shadericons/shadericon00003.png", !Grafreed.NIMBUSLAF)); |
---|
| 1791 | + presetpanel.add(GetLabel("icons/shadericons/shadericon00004.png", !Grafreed.NIMBUSLAF)); |
---|
| 1792 | + presetpanel.add(GetLabel("icons/shadericons/shadericon00005.png", !Grafreed.NIMBUSLAF)); |
---|
| 1793 | + presetpanel.add(GetLabel("icons/shadericons/shadericon00006.png", !Grafreed.NIMBUSLAF)); |
---|
| 1794 | + presetpanel.add(GetLabel("icons/shadericons/shadericon00007.png", !Grafreed.NIMBUSLAF)); |
---|
| 1795 | + presetpanel.add(GetLabel("icons/shadericons/shadericon00008.png", !Grafreed.NIMBUSLAF)); |
---|
| 1796 | + presetpanel.add(GetLabel("icons/shadericons/shadericon00009.png", !Grafreed.NIMBUSLAF)); |
---|
| 1797 | + presetpanel.add(GetLabel("icons/shadericons/shadericon00010.png", !Grafreed.NIMBUSLAF)); |
---|
| 1798 | + presetpanel.add(GetLabel("icons/shadericons/shadericon00011.png", !Grafreed.NIMBUSLAF)); |
---|
| 1799 | + presetpanel.add(GetLabel("icons/shadericons/shadericon00012.png", !Grafreed.NIMBUSLAF)); |
---|
| 1800 | + presetpanel.add(GetLabel("icons/shadericons/shadericon00013.png", !Grafreed.NIMBUSLAF)); |
---|
| 1801 | + presetpanel.add(GetLabel("icons/shadericons/shadericon00014.png", !Grafreed.NIMBUSLAF)); |
---|
| 1802 | + presetpanel.add(GetLabel("icons/shadericons/shadericon00015.png", !Grafreed.NIMBUSLAF)); |
---|
| 1803 | + presetpanel.add(GetLabel("icons/shadericons/shadericon00016.png", !Grafreed.NIMBUSLAF)); |
---|
| 1804 | + presetpanel.add(GetLabel("icons/shadericons/shadericon00017.png", !Grafreed.NIMBUSLAF)); |
---|
| 1805 | + |
---|
| 1806 | + cGridBag panel = new cGridBag().setVertical(true); |
---|
| 1807 | + |
---|
| 1808 | + presetpanel.preferredWidth = 1; |
---|
| 1809 | + |
---|
| 1810 | + materialpanel.add(panel); |
---|
| 1811 | + materialpanel.add(presetpanel); |
---|
| 1812 | + |
---|
| 1813 | + panel.preferredWidth = 8; |
---|
| 1814 | + |
---|
| 1815 | + /* |
---|
1652 | 1816 | ctrlPanel.add(materialLabel = new JLabel("MATERIAL : "), aConstraints); |
---|
1653 | 1817 | materialLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1654 | | - */ |
---|
| 1818 | + */ |
---|
1655 | 1819 | |
---|
1656 | 1820 | cGridBag editBar = new cGridBag().setVertical(false); |
---|
1657 | 1821 | |
---|
.. | .. |
---|
1685 | 1849 | //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints); |
---|
1686 | 1850 | |
---|
1687 | 1851 | cGridBag colorSection = new cGridBag().setVertical(true); |
---|
| 1852 | + |
---|
| 1853 | + cGridBag huepanel = new cGridBag(); |
---|
| 1854 | + cGridBag huelabel = new cGridBag(); |
---|
| 1855 | + skin = GetLabel("icons/hue.png", false); |
---|
| 1856 | + skin.fit = true; |
---|
| 1857 | + huelabel.add(skin); |
---|
| 1858 | + huelabel.preferredWidth = 20; |
---|
| 1859 | + huepanel.add(new cGridBag()); // Label |
---|
| 1860 | + huepanel.add(huelabel); // Field/slider |
---|
| 1861 | + |
---|
| 1862 | + huepanel.preferredHeight = 7; |
---|
| 1863 | + |
---|
| 1864 | + colorSection.add(huepanel); |
---|
1688 | 1865 | |
---|
1689 | 1866 | cGridBag color = new cGridBag(); |
---|
1690 | | - color.add(colorLabel = new JLabel("Color/hue")); // , aConstraints); |
---|
1691 | | - colorLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1692 | | - color.add(colorField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
| 1867 | + |
---|
| 1868 | + color.add(colorLabel = new JLabel("Color/hue")); // , aConstraints); |
---|
| 1869 | + colorLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 1870 | + color.add(colorField = new cNumberSlider(this, 0.001, 1)); // , aConstraints); |
---|
| 1871 | + |
---|
1693 | 1872 | //colorField.preferredWidth = 200; |
---|
1694 | 1873 | colorSection.add(color); |
---|
1695 | 1874 | |
---|
1696 | 1875 | cGridBag modulation = new cGridBag(); |
---|
1697 | 1876 | modulation.add(modulationLabel = new JLabel("Saturation")); // , aConstraints); |
---|
1698 | 1877 | modulationLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1699 | | - modulation.add(modulationField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
| 1878 | + modulation.add(saturationField = new cNumberSlider(this, 0.001, 1)); // , aConstraints); |
---|
1700 | 1879 | colorSection.add(modulation); |
---|
1701 | 1880 | |
---|
| 1881 | + cGridBag opacity = new cGridBag(); |
---|
| 1882 | + opacity.add(opacityLabel = new JLabel("Opacity")); // , aConstraints); |
---|
| 1883 | + opacityLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 1884 | + opacity.add(opacityField = new cNumberSlider(this, 0.001, 1)); // , aConstraints); |
---|
| 1885 | + colorSection.add(opacity); |
---|
| 1886 | + |
---|
| 1887 | + colorSection.add(GetSeparator()); |
---|
| 1888 | + |
---|
1702 | 1889 | cGridBag texture = new cGridBag(); |
---|
1703 | 1890 | texture.add(textureLabel = new JLabel("Texture")); // , aConstraints); |
---|
1704 | 1891 | textureLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1705 | 1892 | texture.add(textureField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
1706 | 1893 | colorSection.add(texture); |
---|
1707 | 1894 | |
---|
1708 | | - panel.add(new JSeparator()); |
---|
| 1895 | + panel.add(GetSeparator()); |
---|
1709 | 1896 | |
---|
1710 | 1897 | panel.add(colorSection); |
---|
1711 | 1898 | |
---|
.. | .. |
---|
1761 | 1948 | shadowbias.add(shadowbiasField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
1762 | 1949 | diffuseSection.add(shadowbias); |
---|
1763 | 1950 | |
---|
1764 | | - panel.add(new JSeparator()); |
---|
| 1951 | + panel.add(GetSeparator()); |
---|
1765 | 1952 | |
---|
1766 | 1953 | panel.add(diffuseSection); |
---|
1767 | 1954 | |
---|
.. | .. |
---|
1824 | 2011 | specularSection.add(anisoV); |
---|
1825 | 2012 | |
---|
1826 | 2013 | |
---|
1827 | | - panel.add(new JSeparator()); |
---|
| 2014 | + panel.add(GetSeparator()); |
---|
1828 | 2015 | |
---|
1829 | 2016 | panel.add(specularSection); |
---|
1830 | 2017 | |
---|
.. | .. |
---|
1849 | 2036 | backlitLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1850 | 2037 | backlit.add(backlitField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
1851 | 2038 | colorSection.add(backlit); |
---|
1852 | | - |
---|
1853 | | - cGridBag opacity = new cGridBag(); |
---|
1854 | | - opacity.add(opacityLabel = new JLabel("Opacity")); // , aConstraints); |
---|
1855 | | - opacityLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1856 | | - opacity.add(opacityField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
1857 | | - colorSection.add(opacity); |
---|
1858 | 2039 | |
---|
1859 | 2040 | //panel.add(new JSeparator()); |
---|
1860 | 2041 | |
---|
.. | .. |
---|
1900 | 2081 | opacityPower.add(opacityPowerField = new cNumberSlider(this, 0.0, 10 /*10 dec 2013*/)); // , aConstraints); |
---|
1901 | 2082 | textureSection.add(opacityPower); |
---|
1902 | 2083 | |
---|
1903 | | - panel.add(new JSeparator()); |
---|
| 2084 | + panel.add(GetSeparator()); |
---|
1904 | 2085 | |
---|
1905 | 2086 | panel.add(textureSection); |
---|
1906 | 2087 | |
---|
.. | .. |
---|
1965 | 2146 | // 3D models |
---|
1966 | 2147 | if (filename.endsWith(".3ds") || filename.endsWith(".3DS")) |
---|
1967 | 2148 | { |
---|
1968 | | - lastConverter = new com.jmex.model.converters.MaxToJme(); |
---|
1969 | | - LoadFile(filename, lastConverter); |
---|
| 2149 | + //lastConverter = new com.jmex.model.converters.MaxToJme(); |
---|
| 2150 | + //LoadFile(filename, lastConverter); |
---|
| 2151 | + LoadObjFile(filename); // New 3ds loader |
---|
1970 | 2152 | continue; |
---|
1971 | 2153 | } |
---|
1972 | 2154 | if (filename.endsWith(".dae") || filename.endsWith(".DAE")) |
---|
.. | .. |
---|
2692 | 2874 | LA.matXRotate(((Object3D) group.get(group.size() - 1)).toParent, -Math.PI / 2); |
---|
2693 | 2875 | LA.matXRotate(((Object3D) group.get(group.size() - 1)).fromParent, Math.PI / 2); |
---|
2694 | 2876 | } |
---|
| 2877 | + |
---|
2695 | 2878 | //cJME.count++; |
---|
2696 | 2879 | //cJME.count %= 12; |
---|
2697 | 2880 | if (gc) |
---|
.. | .. |
---|
2875 | 3058 | } |
---|
2876 | 3059 | } |
---|
2877 | 3060 | } |
---|
| 3061 | + |
---|
2878 | 3062 | cFileSystemPane FSPane; |
---|
2879 | 3063 | |
---|
2880 | 3064 | void SetMaterial(cMaterial mat, Object3D.cVector2[] others) |
---|
.. | .. |
---|
2884 | 3068 | |
---|
2885 | 3069 | freezematerial = true; |
---|
2886 | 3070 | colorField.setFloat(mat.color); |
---|
2887 | | - modulationField.setFloat(mat.modulation); |
---|
| 3071 | + saturationField.setFloat(mat.modulation); |
---|
2888 | 3072 | metalnessField.setFloat(mat.metalness); |
---|
2889 | 3073 | diffuseField.setFloat(mat.diffuse); |
---|
2890 | 3074 | specularField.setFloat(mat.specular); |
---|
.. | .. |
---|
2928 | 3112 | } |
---|
2929 | 3113 | } |
---|
2930 | 3114 | } |
---|
| 3115 | + |
---|
2931 | 3116 | freezematerial = false; |
---|
2932 | 3117 | } |
---|
2933 | 3118 | |
---|
.. | .. |
---|
3194 | 3379 | } else if (event.getSource() == liveCB) |
---|
3195 | 3380 | { |
---|
3196 | 3381 | copy.live ^= true; |
---|
| 3382 | + objEditor.refreshContents(true); // To show item colors |
---|
3197 | 3383 | return; |
---|
3198 | | - } else if (event.getSource() == selectCB) |
---|
| 3384 | + } else if (event.getSource() == selectableCB) |
---|
3199 | 3385 | { |
---|
3200 | 3386 | copy.dontselect ^= true; |
---|
3201 | 3387 | return; |
---|
.. | .. |
---|
3203 | 3389 | { |
---|
3204 | 3390 | copy.hide ^= true; |
---|
3205 | 3391 | copy.Touch(); // display list issue |
---|
3206 | | - objEditor.refreshContents(); |
---|
| 3392 | + objEditor.refreshContents(true); // To show item colors |
---|
3207 | 3393 | return; |
---|
3208 | 3394 | } else if (event.getSource() == link2masterCB) |
---|
3209 | 3395 | { |
---|
.. | .. |
---|
3380 | 3566 | { |
---|
3381 | 3567 | Close(); |
---|
3382 | 3568 | //return true; |
---|
3383 | | - } else if (source == loadItem) |
---|
| 3569 | + } else if (source == openItem) |
---|
3384 | 3570 | { |
---|
3385 | | - load(); |
---|
| 3571 | + Open(); |
---|
3386 | 3572 | //return true; |
---|
3387 | 3573 | } else if (source == newItem) |
---|
3388 | 3574 | { |
---|
.. | .. |
---|
3407 | 3593 | { |
---|
3408 | 3594 | generatePOV(); |
---|
3409 | 3595 | //return true; |
---|
| 3596 | + } else if (event.getSource() == archiveItem) |
---|
| 3597 | + { |
---|
| 3598 | + cTools.Archive(frame); |
---|
| 3599 | + return; |
---|
3410 | 3600 | } else if (source == zBufferItem) |
---|
3411 | 3601 | { |
---|
3412 | 3602 | try |
---|
.. | .. |
---|
3455 | 3645 | |
---|
3456 | 3646 | static public byte[] Compress(Object3D o) |
---|
3457 | 3647 | { |
---|
| 3648 | + // Slower to actually compress. |
---|
3458 | 3649 | try |
---|
3459 | 3650 | { |
---|
3460 | 3651 | ByteArrayOutputStream baos = new ByteArrayOutputStream(); |
---|
3461 | | - java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(baos); |
---|
3462 | | - ObjectOutputStream out = new ObjectOutputStream(zstream); |
---|
| 3652 | +// java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(baos); |
---|
| 3653 | + ObjectOutputStream out = new ObjectOutputStream(baos); //zstream); |
---|
3463 | 3654 | |
---|
3464 | 3655 | Object3D parent = o.parent; |
---|
3465 | 3656 | o.parent = null; |
---|
.. | .. |
---|
3470 | 3661 | |
---|
3471 | 3662 | out.flush(); |
---|
3472 | 3663 | |
---|
3473 | | - zstream.close(); |
---|
| 3664 | + baos //zstream |
---|
| 3665 | + .close(); |
---|
3474 | 3666 | out.close(); |
---|
3475 | 3667 | |
---|
3476 | | - return baos.toByteArray(); |
---|
| 3668 | + byte[] bytes = baos.toByteArray(); |
---|
| 3669 | + |
---|
| 3670 | + System.out.println("save #bytes = " + bytes.length); |
---|
| 3671 | + return bytes; |
---|
3477 | 3672 | } catch (Exception e) |
---|
3478 | 3673 | { |
---|
3479 | 3674 | System.err.println(e); |
---|
.. | .. |
---|
3483 | 3678 | |
---|
3484 | 3679 | static public Object Uncompress(byte[] bytes) |
---|
3485 | 3680 | { |
---|
3486 | | - System.out.println("#bytes = " + bytes.length); |
---|
| 3681 | + System.out.println("restore #bytes = " + bytes.length); |
---|
3487 | 3682 | try |
---|
3488 | 3683 | { |
---|
3489 | 3684 | ByteArrayInputStream bais = new ByteArrayInputStream(bytes); |
---|
3490 | | - java.util.zip.GZIPInputStream istream = new java.util.zip.GZIPInputStream(bais); |
---|
3491 | | - ObjectInputStream in = new ObjectInputStream(istream); |
---|
| 3685 | + //java.util.zip.GZIPInputStream istream = new java.util.zip.GZIPInputStream(bais); |
---|
| 3686 | + ObjectInputStream in = new ObjectInputStream(bais); // istream); |
---|
3492 | 3687 | Object obj = in.readObject(); |
---|
| 3688 | + |
---|
| 3689 | + bais //istream |
---|
| 3690 | + .close(); |
---|
3493 | 3691 | in.close(); |
---|
3494 | 3692 | |
---|
3495 | 3693 | return obj; |
---|
.. | .. |
---|
3544 | 3742 | return null; |
---|
3545 | 3743 | } |
---|
3546 | 3744 | |
---|
3547 | | - java.util.Hashtable<java.util.UUID, Object3D> hashtable = new java.util.Hashtable<java.util.UUID, Object3D>(); |
---|
3548 | 3745 | |
---|
3549 | 3746 | public void Save() |
---|
3550 | 3747 | { |
---|
| 3748 | + //Save(true); |
---|
| 3749 | + Replace(); |
---|
| 3750 | + SetUndoStates(); |
---|
| 3751 | + } |
---|
| 3752 | + |
---|
| 3753 | + private boolean Equal(byte[] compress, byte[] name) |
---|
| 3754 | + { |
---|
| 3755 | + if (compress.length != name.length) |
---|
| 3756 | + { |
---|
| 3757 | + return false; |
---|
| 3758 | + } |
---|
| 3759 | + |
---|
| 3760 | + for (int i=compress.length; --i>=0;) |
---|
| 3761 | + { |
---|
| 3762 | + if (compress[i] != name[i]) |
---|
| 3763 | + return false; |
---|
| 3764 | + } |
---|
| 3765 | + |
---|
| 3766 | + return true; |
---|
| 3767 | + } |
---|
| 3768 | + |
---|
| 3769 | + java.util.Hashtable<java.util.UUID, Object3D> versiontable = new java.util.Hashtable<java.util.UUID, Object3D>(); |
---|
| 3770 | + |
---|
| 3771 | + void DeleteVersion() |
---|
| 3772 | + { |
---|
| 3773 | + for (int i = copy.versionindex; i < copy.versionlist.length-1; i++) |
---|
| 3774 | + { |
---|
| 3775 | + copy.versionlist[i] = copy.versionlist[i+1]; |
---|
| 3776 | + } |
---|
| 3777 | + |
---|
| 3778 | + CopyChanged(); |
---|
| 3779 | + |
---|
| 3780 | + SetUndoStates(); |
---|
| 3781 | + } |
---|
| 3782 | + |
---|
| 3783 | + public boolean Save(boolean user) |
---|
| 3784 | + { |
---|
3551 | 3785 | System.err.println("Save"); |
---|
| 3786 | + //Replace(); |
---|
3552 | 3787 | |
---|
3553 | 3788 | cRadio tab = GetCurrentTab(); |
---|
3554 | 3789 | |
---|
3555 | | - boolean temp = CameraPane.SWITCH; |
---|
3556 | | - CameraPane.SWITCH = false; |
---|
| 3790 | + Object3D compress = CompressCopy(); // Saved version. No need for "Replace"? |
---|
3557 | 3791 | |
---|
3558 | | - copy.ExtractBigData(hashtable); |
---|
| 3792 | + boolean thesame = false; |
---|
3559 | 3793 | |
---|
3560 | | - byte[] compress = Compress(copy); |
---|
| 3794 | +// if (copy.versionindex > 0 && copy.versions[copy.versionindex-1] != null && Equal(compress, copy.versions[copy.versionindex-1])) |
---|
| 3795 | +// { |
---|
| 3796 | +// thesame = true; |
---|
| 3797 | +// } |
---|
3561 | 3798 | |
---|
3562 | 3799 | //EditorFrame.m_MainFrame.requestFocusInWindow(); |
---|
3563 | | - tab.graphs[tab.undoindex++] = compress; |
---|
| 3800 | + if (!thesame) |
---|
| 3801 | + { |
---|
| 3802 | + for (int i = copy.versionlist.length; --i > copy.versionindex+1;) |
---|
| 3803 | + { |
---|
| 3804 | + copy.versionlist[i] = copy.versionlist[i-1]; |
---|
| 3805 | + } |
---|
| 3806 | + |
---|
| 3807 | + //tab.user[tab.versionindex] = user; |
---|
| 3808 | + //boolean increment = true; // tab.graphs[tab.versionindex] == null; |
---|
| 3809 | + |
---|
| 3810 | + copy.versionlist[++copy.versionindex] = compress; |
---|
| 3811 | + |
---|
| 3812 | + // if (increment) |
---|
| 3813 | + // tab.versionindex++; |
---|
| 3814 | + } |
---|
3564 | 3815 | |
---|
3565 | | - copy.RestoreBigData(hashtable); |
---|
| 3816 | + //copy.RestoreBigData(versiontable); |
---|
3566 | 3817 | |
---|
3567 | | - CameraPane.SWITCH = temp; |
---|
3568 | | - |
---|
3569 | 3818 | //assert(hashtable.isEmpty()); |
---|
3570 | 3819 | |
---|
3571 | | - for (int i = tab.undoindex; i < tab.graphs.length; i++) |
---|
3572 | | - { |
---|
3573 | | - tab.graphs[i] = null; |
---|
3574 | | - } |
---|
| 3820 | +// for (int i = copy.versionindex+1; i < copy.versionlist.length; i++) |
---|
| 3821 | +// { |
---|
| 3822 | +// //tab.user[i] = false; |
---|
| 3823 | +// copy.versionlist[i] = null; |
---|
| 3824 | +// } |
---|
3575 | 3825 | |
---|
3576 | 3826 | SetUndoStates(); |
---|
3577 | 3827 | |
---|
.. | .. |
---|
3580 | 3830 | { |
---|
3581 | 3831 | try |
---|
3582 | 3832 | { |
---|
3583 | | - FileOutputStream ostream = new FileOutputStream("save" + tab.undoindex); |
---|
| 3833 | + FileOutputStream ostream = new FileOutputStream("save" + copy.versionindex); |
---|
3584 | 3834 | ObjectOutputStream p = new ObjectOutputStream(ostream); |
---|
3585 | 3835 | |
---|
3586 | 3836 | p.writeObject(copy); |
---|
.. | .. |
---|
3593 | 3843 | e.printStackTrace(); |
---|
3594 | 3844 | } |
---|
3595 | 3845 | } |
---|
| 3846 | + |
---|
| 3847 | + return !thesame; |
---|
| 3848 | + } |
---|
| 3849 | + |
---|
| 3850 | + boolean flashIt = true; |
---|
| 3851 | + |
---|
| 3852 | + void RefreshSelection() |
---|
| 3853 | + { |
---|
| 3854 | + Object3D selection = new Object3D(); |
---|
| 3855 | + |
---|
| 3856 | + for (int i = 0; i < copy.selection.size(); i++) |
---|
| 3857 | + { |
---|
| 3858 | + Object3D elem = copy.selection.elementAt(i); |
---|
| 3859 | + |
---|
| 3860 | + Object3D obj = copy.GetObject(elem.GetUUID()); |
---|
| 3861 | + |
---|
| 3862 | + if (obj == null) |
---|
| 3863 | + { |
---|
| 3864 | + copy.selection.remove(i--); |
---|
| 3865 | + } |
---|
| 3866 | + else |
---|
| 3867 | + { |
---|
| 3868 | + selection.add(obj); |
---|
| 3869 | + copy.selection.setElementAt(obj, i); |
---|
| 3870 | + } |
---|
| 3871 | + } |
---|
| 3872 | + |
---|
| 3873 | + flashIt = false; |
---|
| 3874 | + GetTree().clearSelection(); |
---|
| 3875 | + for (int i = 0; i < selection.size(); i++) |
---|
| 3876 | + GetTree().addSelectionPath(selection.elementAt(i).GetTreePath().GetTreePath()); |
---|
| 3877 | + flashIt = true; |
---|
| 3878 | + |
---|
| 3879 | + //refreshContents(false); |
---|
3596 | 3880 | } |
---|
3597 | 3881 | |
---|
3598 | | - void CopyChanged(Object3D obj) |
---|
| 3882 | + void CopyChanged() |
---|
3599 | 3883 | { |
---|
| 3884 | + Object3D obj = copy.versionlist[copy.versionindex]; |
---|
| 3885 | + |
---|
3600 | 3886 | SetUndoStates(); |
---|
3601 | 3887 | |
---|
3602 | 3888 | boolean temp = CameraPane.SWITCH; |
---|
3603 | 3889 | CameraPane.SWITCH = false; |
---|
3604 | 3890 | |
---|
3605 | | - copy.ExtractBigData(hashtable); |
---|
| 3891 | + copy.ExtractBigData(versiontable); |
---|
3606 | 3892 | |
---|
3607 | 3893 | copy.clear(); |
---|
3608 | 3894 | |
---|
| 3895 | + copy.skyboxname = obj.skyboxname; |
---|
| 3896 | + copy.skyboxext = obj.skyboxext; |
---|
| 3897 | + |
---|
3609 | 3898 | for (int i=0; i<obj.Size(); i++) |
---|
3610 | 3899 | { |
---|
3611 | 3900 | copy.add(obj.get(i)); |
---|
3612 | 3901 | } |
---|
3613 | 3902 | |
---|
3614 | | - copy.RestoreBigData(hashtable); |
---|
| 3903 | + copy.RestoreBigData(versiontable); |
---|
3615 | 3904 | |
---|
3616 | 3905 | CameraPane.SWITCH = temp; |
---|
3617 | 3906 | |
---|
| 3907 | + RefreshSelection(); |
---|
3618 | 3908 | //assert(hashtable.isEmpty()); |
---|
3619 | 3909 | |
---|
3620 | 3910 | copy.Touch(); |
---|
.. | .. |
---|
3635 | 3925 | } |
---|
3636 | 3926 | } |
---|
3637 | 3927 | |
---|
3638 | | - refreshContents(); |
---|
| 3928 | + refreshContents(true); |
---|
3639 | 3929 | } |
---|
3640 | 3930 | |
---|
3641 | | - cButton undoButton; |
---|
3642 | | - cButton redoButton; |
---|
| 3931 | + cButton previousVersionButton; |
---|
| 3932 | + cButton restoreButton; |
---|
| 3933 | + cButton replaceButton; |
---|
| 3934 | + cButton nextVersionButton; |
---|
| 3935 | + cButton saveVersionButton; |
---|
| 3936 | + cButton deleteVersionButton; |
---|
3643 | 3937 | |
---|
| 3938 | + boolean muteSlider; |
---|
| 3939 | + |
---|
| 3940 | + int VersionCount() |
---|
| 3941 | + { |
---|
| 3942 | + int count = 0; |
---|
| 3943 | + |
---|
| 3944 | + for (int i = copy.versionlist.length; --i >= 0;) |
---|
| 3945 | + { |
---|
| 3946 | + if (copy.versionlist[i] != null) |
---|
| 3947 | + count++; |
---|
| 3948 | + } |
---|
| 3949 | + |
---|
| 3950 | + return count; |
---|
| 3951 | + } |
---|
| 3952 | + |
---|
3644 | 3953 | void SetUndoStates() |
---|
3645 | 3954 | { |
---|
3646 | 3955 | cRadio tab = GetCurrentTab(); |
---|
3647 | 3956 | |
---|
3648 | | - undoButton.setEnabled(tab.undoindex > 0); |
---|
3649 | | - redoButton.setEnabled(tab.graphs[tab.undoindex + 1] != null); |
---|
| 3957 | + restoreButton.setEnabled(true); // copy.versionindex != -1); |
---|
| 3958 | + replaceButton.setEnabled(true); // copy.versionindex != -1); |
---|
| 3959 | + |
---|
| 3960 | + previousVersionButton.setEnabled(copy.versionindex > 0); |
---|
| 3961 | + nextVersionButton.setEnabled(copy.versionlist[copy.versionindex + 1] != null); |
---|
| 3962 | + |
---|
| 3963 | + deleteVersionButton.setEnabled(//copy.versionindex > 0 && |
---|
| 3964 | + copy.versionlist[copy.versionindex + 1] != null); |
---|
| 3965 | + |
---|
| 3966 | + muteSlider = true; |
---|
| 3967 | + versionSlider.setMaximum(VersionCount() - 1); |
---|
| 3968 | + versionSlider.setInteger(copy.versionindex); |
---|
| 3969 | + muteSlider = false; |
---|
3650 | 3970 | } |
---|
3651 | 3971 | |
---|
3652 | | - public void Undo() |
---|
| 3972 | + public boolean PreviousVersion() |
---|
3653 | 3973 | { |
---|
| 3974 | + // Option? |
---|
| 3975 | + Replace(); |
---|
| 3976 | + |
---|
3654 | 3977 | System.err.println("Undo"); |
---|
3655 | 3978 | |
---|
3656 | 3979 | cRadio tab = GetCurrentTab(); |
---|
3657 | 3980 | |
---|
3658 | | - if (tab.undoindex == 0) |
---|
| 3981 | + if (copy.versionindex == 0) |
---|
3659 | 3982 | { |
---|
3660 | 3983 | java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
3661 | | - return; |
---|
| 3984 | + return false; |
---|
3662 | 3985 | } |
---|
3663 | 3986 | |
---|
3664 | | - if (tab.graphs[tab.undoindex] == null) |
---|
3665 | | - { |
---|
3666 | | - Save(); |
---|
3667 | | - tab.undoindex -= 1; |
---|
3668 | | - } |
---|
| 3987 | +// if (tab.graphs[tab.versionindex] == null) // || !tab.user[tab.versionindex]) |
---|
| 3988 | +// { |
---|
| 3989 | +// if (Save(false)) |
---|
| 3990 | +// tab.versionindex -= 1; |
---|
| 3991 | +// else |
---|
| 3992 | +// { |
---|
| 3993 | +// if (tab.versionindex <= 0) |
---|
| 3994 | +// return false; |
---|
| 3995 | +// else |
---|
| 3996 | +// tab.versionindex -= 1; |
---|
| 3997 | +// } |
---|
| 3998 | +// } |
---|
3669 | 3999 | |
---|
3670 | | - tab.undoindex -= 1; |
---|
| 4000 | + copy.versionindex -= 1; |
---|
3671 | 4001 | |
---|
3672 | | - CopyChanged((Object3D)Uncompress(tab.graphs[tab.undoindex])); |
---|
| 4002 | + CopyChanged(); |
---|
| 4003 | + |
---|
| 4004 | + return true; |
---|
3673 | 4005 | } |
---|
3674 | 4006 | |
---|
3675 | | - public void Redo() |
---|
| 4007 | + public boolean Restore() |
---|
3676 | 4008 | { |
---|
| 4009 | + System.err.println("Restore"); |
---|
| 4010 | + |
---|
3677 | 4011 | cRadio tab = GetCurrentTab(); |
---|
3678 | 4012 | |
---|
3679 | | - if (tab.graphs[tab.undoindex + 1] == null) |
---|
| 4013 | + if (copy.versionindex == -1 || copy.versionlist[copy.versionindex] == null) |
---|
| 4014 | + { |
---|
| 4015 | + java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
| 4016 | + return false; |
---|
| 4017 | + } |
---|
| 4018 | + |
---|
| 4019 | + //CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex])); |
---|
| 4020 | + CopyChanged(); |
---|
| 4021 | + |
---|
| 4022 | + return true; |
---|
| 4023 | + } |
---|
| 4024 | + |
---|
| 4025 | + public boolean Replace() |
---|
| 4026 | + { |
---|
| 4027 | + System.err.println("Replace"); |
---|
| 4028 | + |
---|
| 4029 | + cRadio tab = GetCurrentTab(); |
---|
| 4030 | + |
---|
| 4031 | + if (copy.versionindex == -1 || copy.versionlist[copy.versionindex] == null) |
---|
| 4032 | + { |
---|
| 4033 | + // No version yet. OK. java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
| 4034 | + return false; |
---|
| 4035 | + } |
---|
| 4036 | + |
---|
| 4037 | + copy.versionlist[copy.versionindex] = CompressCopy(); |
---|
| 4038 | + |
---|
| 4039 | + return true; |
---|
| 4040 | + } |
---|
| 4041 | + |
---|
| 4042 | + public void NextVersion() |
---|
| 4043 | + { |
---|
| 4044 | + // Option? |
---|
| 4045 | + Replace(); |
---|
| 4046 | + |
---|
| 4047 | + cRadio tab = GetCurrentTab(); |
---|
| 4048 | + |
---|
| 4049 | + if (copy.versionlist[copy.versionindex + 1] == null) |
---|
3680 | 4050 | { |
---|
3681 | 4051 | java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
3682 | 4052 | return; |
---|
3683 | 4053 | } |
---|
3684 | 4054 | |
---|
3685 | | - tab.undoindex += 1; |
---|
| 4055 | + copy.versionindex += 1; |
---|
3686 | 4056 | |
---|
3687 | | - CopyChanged((Object3D)Uncompress(tab.graphs[tab.undoindex])); |
---|
| 4057 | + CopyChanged(); |
---|
| 4058 | + |
---|
| 4059 | + //if (!tab.user[tab.versionindex]) |
---|
| 4060 | + // tab.graphs[tab.versionindex] = null; |
---|
3688 | 4061 | } |
---|
3689 | 4062 | |
---|
3690 | 4063 | void ImportGFD() |
---|
.. | .. |
---|
3895 | 4268 | //copy.material = new cMaterial(copy.GetMaterial()); |
---|
3896 | 4269 | |
---|
3897 | 4270 | current.color = (float) colorField.getFloat(); |
---|
3898 | | - current.modulation = (float) modulationField.getFloat(); |
---|
| 4271 | + current.modulation = (float) saturationField.getFloat(); |
---|
3899 | 4272 | current.metalness = (float) metalnessField.getFloat(); |
---|
3900 | 4273 | current.diffuse = (float) diffuseField.getFloat(); |
---|
3901 | 4274 | current.specular = (float) specularField.getFloat(); |
---|
.. | .. |
---|
3928 | 4301 | cMaterial mat = copy.material; |
---|
3929 | 4302 | |
---|
3930 | 4303 | colorField.SetToolTipValue((mat.color)); |
---|
3931 | | - modulationField.SetToolTipValue((mat.modulation)); |
---|
| 4304 | + saturationField.SetToolTipValue((mat.modulation)); |
---|
3932 | 4305 | metalnessField.SetToolTipValue((mat.metalness)); |
---|
3933 | 4306 | diffuseField.SetToolTipValue((mat.diffuse)); |
---|
3934 | 4307 | specularField.SetToolTipValue((mat.specular)); |
---|
.. | .. |
---|
3980 | 4353 | //copy.Touch(); |
---|
3981 | 4354 | } |
---|
3982 | 4355 | |
---|
| 4356 | + cNumberSlider versionSlider; |
---|
| 4357 | + |
---|
3983 | 4358 | public void stateChanged(ChangeEvent e) |
---|
3984 | 4359 | { |
---|
3985 | 4360 | // assert(false); |
---|
| 4361 | + if (e.getSource() == versionSlider) |
---|
| 4362 | + { |
---|
| 4363 | + if (muteSlider) |
---|
| 4364 | + return; |
---|
| 4365 | + |
---|
| 4366 | + int version = versionSlider.getInteger(); |
---|
| 4367 | + |
---|
| 4368 | + if (copy.versionlist[version] != null) |
---|
| 4369 | + { |
---|
| 4370 | + copy.versionindex = version; |
---|
| 4371 | + CopyChanged(); |
---|
| 4372 | + } |
---|
| 4373 | + |
---|
| 4374 | + return; |
---|
| 4375 | + } |
---|
3986 | 4376 | |
---|
3987 | 4377 | if (freezematerial) |
---|
3988 | 4378 | { |
---|
.. | .. |
---|
4018 | 4408 | { |
---|
4019 | 4409 | //System.out.println("stateChanged = " + this); |
---|
4020 | 4410 | materialtouched = true; |
---|
| 4411 | + |
---|
| 4412 | + if (e.getSource() == colorField && saturationField.getFloat() == 0.001) |
---|
| 4413 | + { |
---|
| 4414 | + saturationField.setFloat(1); |
---|
| 4415 | + } |
---|
| 4416 | + |
---|
4021 | 4417 | applySelf(); |
---|
4022 | 4418 | //System.out.println("this = " + this); |
---|
4023 | 4419 | //System.out.println("PARENT = " + parent); |
---|
.. | .. |
---|
4317 | 4713 | { |
---|
4318 | 4714 | if (GetTree() != null) |
---|
4319 | 4715 | { |
---|
| 4716 | + GetTree().revalidate(); |
---|
4320 | 4717 | GetTree().repaint(); |
---|
4321 | 4718 | } |
---|
4322 | 4719 | |
---|
.. | .. |
---|
4325 | 4722 | ctrlPanel.validate(); // ? new |
---|
4326 | 4723 | ctrlPanel.repaint(); |
---|
4327 | 4724 | } |
---|
| 4725 | + |
---|
| 4726 | + if (previousVersionButton != null && copy.versionlist != null) |
---|
| 4727 | + SetUndoStates(); |
---|
4328 | 4728 | } |
---|
4329 | 4729 | |
---|
4330 | 4730 | static TweenManager tweenManager = new TweenManager(); |
---|
4331 | 4731 | |
---|
4332 | 4732 | void makeSomething(Object3D thing, boolean resetmodel) // deselect) |
---|
4333 | 4733 | { |
---|
4334 | | - if (Globals.SAVEONMAKE) // && resetmodel) |
---|
| 4734 | + if (Globals.REPLACEONMAKE) // && resetmodel) |
---|
4335 | 4735 | Save(); |
---|
4336 | 4736 | //Tween.set(thing, 0).target(1).start(tweenManager); |
---|
4337 | 4737 | //Tween.to(thing, 0, 0.5f).target(0).start(tweenManager); |
---|
.. | .. |
---|
4573 | 4973 | readobj.ResetDisplayList(); |
---|
4574 | 4974 | } catch (Exception e) |
---|
4575 | 4975 | { |
---|
4576 | | - //e.printStackTrace(); |
---|
| 4976 | + if (!e.toString().contains("GZIP")) |
---|
| 4977 | + e.printStackTrace(); |
---|
| 4978 | + |
---|
4577 | 4979 | try |
---|
4578 | 4980 | { |
---|
4579 | 4981 | java.io.FileInputStream istream = new java.io.FileInputStream(fullname); |
---|
.. | .. |
---|
4647 | 5049 | |
---|
4648 | 5050 | if (readobj != null) |
---|
4649 | 5051 | { |
---|
4650 | | - if (Globals.SAVEONMAKE) |
---|
4651 | | - Save(); |
---|
| 5052 | + //if (Globals.SAVEONMAKE) // A new object cannot share meshes |
---|
| 5053 | + // Save(); |
---|
4652 | 5054 | try |
---|
4653 | 5055 | { |
---|
4654 | 5056 | //readobj.deepCopySelf(copy); |
---|
4655 | 5057 | copy.clear(); // june 2014 |
---|
| 5058 | + copy.skyboxname = readobj.skyboxname; |
---|
| 5059 | + copy.skyboxext = readobj.skyboxext; |
---|
4656 | 5060 | for (int i = 0; i < readobj.size(); i++) |
---|
4657 | 5061 | { |
---|
4658 | 5062 | Object3D child = readobj.get(i); // reserve(i); |
---|
.. | .. |
---|
4693 | 5097 | } |
---|
4694 | 5098 | } catch (ClassCastException e) |
---|
4695 | 5099 | { |
---|
| 5100 | + e.printStackTrace(); |
---|
4696 | 5101 | assert (false); |
---|
4697 | 5102 | Composite c = (Composite) copy; |
---|
4698 | 5103 | c.children.clear(); |
---|
.. | .. |
---|
4703 | 5108 | c.addChild(csg); |
---|
4704 | 5109 | } |
---|
4705 | 5110 | |
---|
| 5111 | + copy.versionlist = readobj.versionlist; |
---|
| 5112 | + copy.versionindex = readobj.versionindex; |
---|
| 5113 | + |
---|
| 5114 | + if (copy.versionlist == null) |
---|
| 5115 | + { |
---|
| 5116 | + copy.versionlist = new Object3D[100]; |
---|
| 5117 | + copy.versionindex = -1; |
---|
| 5118 | + } |
---|
| 5119 | + |
---|
| 5120 | + //? SetUndoStates(); |
---|
| 5121 | + |
---|
4706 | 5122 | ResetModel(); |
---|
4707 | 5123 | copy.HardTouch(); // recompile? |
---|
4708 | 5124 | refreshContents(); |
---|
4709 | 5125 | } |
---|
4710 | 5126 | } |
---|
4711 | 5127 | |
---|
4712 | | - void load() // throws ClassNotFoundException |
---|
| 5128 | + void Open() // throws ClassNotFoundException |
---|
4713 | 5129 | { |
---|
4714 | 5130 | if (Grafreed.standAlone) |
---|
4715 | 5131 | { |
---|
4716 | | - FileDialog browser = new FileDialog(frame, "Load", FileDialog.LOAD); |
---|
| 5132 | + FileDialog browser = new FileDialog(frame, "Open", FileDialog.LOAD); |
---|
4717 | 5133 | browser.show(); |
---|
4718 | 5134 | String filename = browser.getFile(); |
---|
4719 | 5135 | if (filename != null && filename.length() > 0) |
---|
.. | .. |
---|
4812 | 5228 | //ps.print(buffer.toString()); |
---|
4813 | 5229 | } catch (IOException e) |
---|
4814 | 5230 | { |
---|
| 5231 | + e.printStackTrace(); |
---|
4815 | 5232 | } |
---|
4816 | 5233 | } |
---|
4817 | 5234 | |
---|
.. | .. |
---|
4994 | 5411 | MenuBar menuBar; |
---|
4995 | 5412 | Menu fileMenu; |
---|
4996 | 5413 | MenuItem newItem; |
---|
4997 | | - MenuItem loadItem; |
---|
| 5414 | + MenuItem openItem; |
---|
4998 | 5415 | MenuItem saveItem; |
---|
4999 | 5416 | MenuItem saveAsItem; |
---|
5000 | 5417 | MenuItem exportAsItem; |
---|
.. | .. |
---|
5017 | 5434 | CheckboxMenuItem toggleSwitchItem; |
---|
5018 | 5435 | CheckboxMenuItem toggleRootItem; |
---|
5019 | 5436 | CheckboxMenuItem animationItem; |
---|
| 5437 | + MenuItem archiveItem; |
---|
5020 | 5438 | CheckboxMenuItem toggleHandleItem; |
---|
5021 | 5439 | CheckboxMenuItem togglePaintItem; |
---|
5022 | 5440 | JSplitPane mainPanel; |
---|
.. | .. |
---|
5103 | 5521 | JLabel colorLabel; |
---|
5104 | 5522 | cNumberSlider colorField; |
---|
5105 | 5523 | JLabel modulationLabel; |
---|
5106 | | - cNumberSlider modulationField; |
---|
| 5524 | + cNumberSlider saturationField; |
---|
5107 | 5525 | JLabel metalnessLabel; |
---|
5108 | 5526 | cNumberSlider metalnessField; |
---|
5109 | 5527 | JLabel diffuseLabel; |
---|