.. | .. |
---|
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, |
---|
.. | .. |
---|
97 | 98 | |
---|
98 | 99 | cButton GetButton(String name, boolean border) |
---|
99 | 100 | { |
---|
100 | | - ImageIcon icon = GetIcon(name); |
---|
101 | | - if (icon != null || name.contains("/")) |
---|
102 | | - return new cButton(icon, border); |
---|
| 101 | + //ImageIcon icon = GetIcon(name); |
---|
| 102 | + boolean fit = !name.startsWith("icons"); |
---|
| 103 | + if (//icon != null || |
---|
| 104 | + name.contains("/")) |
---|
| 105 | + return new cButton(name, border, fit); |
---|
103 | 106 | else |
---|
104 | 107 | return new cButton(name, border); |
---|
105 | 108 | } |
---|
.. | .. |
---|
136 | 139 | { |
---|
137 | 140 | BufferedImage image; |
---|
138 | 141 | |
---|
139 | | - if (name.endsWith("jpg")) |
---|
140 | | - // Much faster! |
---|
141 | | - image = new sun.awt.image.codec.JPEGImageDecoderImpl(ObjEditor.class.getClassLoader().getResourceAsStream(name)).decodeAsBufferedImage(); |
---|
| 142 | + if (!Grafreed.isWindows && name.endsWith("jpg")) |
---|
| 143 | + { |
---|
| 144 | + try |
---|
| 145 | + { |
---|
| 146 | + // Much faster! |
---|
| 147 | + image = JpegLoader.load(name); |
---|
| 148 | + } |
---|
| 149 | + catch (Exception e) |
---|
| 150 | + { |
---|
| 151 | + image = javax.imageio.ImageIO.read(ObjEditor.class.getClassLoader().getResourceAsStream(name)); |
---|
| 152 | + } |
---|
| 153 | + } |
---|
142 | 154 | else |
---|
143 | 155 | image = javax.imageio.ImageIO.read(ObjEditor.class.getClassLoader().getResourceAsStream(name)); |
---|
144 | 156 | |
---|
.. | .. |
---|
316 | 328 | objEditor.ctrlPanel.remove(setupPanel2); |
---|
317 | 329 | objEditor.ctrlPanel.remove(objectCommandsPanel); |
---|
318 | 330 | objEditor.ctrlPanel.remove(pushPanel); |
---|
| 331 | + if (versionPanel != null) |
---|
| 332 | + objEditor.ctrlPanel.remove(versionPanel); |
---|
319 | 333 | //objEditor.ctrlPanel.remove(fillPanel); |
---|
320 | 334 | |
---|
321 | 335 | //Remove(normalpushField); |
---|
.. | .. |
---|
383 | 397 | client = inClient; |
---|
384 | 398 | copy = client; |
---|
385 | 399 | |
---|
386 | | - if (copy.versionlist == null) |
---|
387 | | - { |
---|
388 | | - copy.versionlist = new Object3D[100]; |
---|
389 | | - copy.versionindex = -1; |
---|
390 | | - |
---|
391 | | -// Save(true); |
---|
392 | | - } |
---|
393 | | - |
---|
394 | 400 | SetupUI2(callee.GetEditor()); |
---|
395 | 401 | } |
---|
396 | 402 | |
---|
.. | .. |
---|
501 | 507 | //povItem.addActionListener(this); |
---|
502 | 508 | closeItem.addActionListener(this); |
---|
503 | 509 | |
---|
504 | | - objectPanel = new JTabbedPane(); |
---|
| 510 | + objectTabbedPane = new JTabbedPane(); |
---|
505 | 511 | |
---|
506 | 512 | ChangeListener changeListener = new ChangeListener() |
---|
507 | 513 | { |
---|
.. | .. |
---|
552 | 558 | // } |
---|
553 | 559 | // } |
---|
554 | 560 | // } |
---|
555 | | - cameraView.transformMode = objectPanel.getSelectedIndex() == 4; |
---|
| 561 | + cameraView.transformMode = objectTabbedPane.getSelectedIndex() == 5; |
---|
556 | 562 | |
---|
557 | 563 | // refreshContents(false); // To refresh Info tab |
---|
558 | 564 | cameraView.repaint(); |
---|
559 | 565 | } |
---|
560 | 566 | }; |
---|
561 | | - objectPanel.addChangeListener(changeListener); |
---|
| 567 | + objectTabbedPane.addChangeListener(changeListener); |
---|
562 | 568 | |
---|
563 | 569 | toolbarPanel = new JPanel(); |
---|
564 | 570 | toolbarPanel.setName("Toolbar"); |
---|
.. | .. |
---|
601 | 607 | //infoPanel.setLayout(new BorderLayout()); |
---|
602 | 608 | //infoPanel.add(createTextPane()); |
---|
603 | 609 | |
---|
604 | | - mainPanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, treePanel, objectPanel); |
---|
| 610 | + mainPanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, treePanel, objectTabbedPane); |
---|
605 | 611 | mainPanel.setName("Main"); |
---|
606 | 612 | mainPanel.setContinuousLayout(true); |
---|
607 | 613 | mainPanel.setOneTouchExpandable(true); |
---|
.. | .. |
---|
793 | 799 | // SendInfo(" delay: " + sel.delay + newline, "regular"); |
---|
794 | 800 | // live, hide, ... |
---|
795 | 801 | //?? SendInfo(" Orig: " + maxima + newline, "regular"); |
---|
| 802 | + if (sel.GetTextures().pigmentdata != null) |
---|
| 803 | + si.SendInfo(" EMBEDDED ", "regular"); |
---|
796 | 804 | si.SendInfo((debug ? " Texture: " : " ") + sel.GetTextures(), "bold"); |
---|
797 | 805 | // SendInfo((debug ? " Material: " : " ") + sel.material + newline, "regular"); |
---|
798 | 806 | if (sel instanceof cMesh) |
---|
.. | .. |
---|
903 | 911 | |
---|
904 | 912 | cButton minButton; |
---|
905 | 913 | cButton maxButton; |
---|
906 | | - cButton fullButton; |
---|
| 914 | + cButton fullScreenButton; |
---|
907 | 915 | cButton collapseButton; |
---|
908 | 916 | cButton maximize3DButton; |
---|
909 | 917 | |
---|
| 918 | + public void Show3DView() |
---|
| 919 | + { |
---|
| 920 | + // bug |
---|
| 921 | + //gridPanel.setDividerLocation(1.0); |
---|
| 922 | + //bigPanel.setDividerLocation(0.0); |
---|
| 923 | + bigThree.ClearUI(); |
---|
| 924 | + bigThree.add(centralPanel); |
---|
| 925 | + bigThree.FlushUI(); |
---|
| 926 | + } |
---|
| 927 | + |
---|
910 | 928 | void ToggleFullScreen() |
---|
911 | 929 | { |
---|
912 | 930 | GraphicsDevice device = frame.getGraphicsConfiguration().getDevice(); |
---|
.. | .. |
---|
933 | 951 | // framePanel.setDividerLocation(46); // icons are 24x24 |
---|
934 | 952 | |
---|
935 | 953 | //frame.setVisible(true); |
---|
936 | | -// radio.layout = keepButton; |
---|
| 954 | + radio.layout = keepButton; |
---|
937 | 955 | //theFrame = null; |
---|
938 | 956 | keepButton = null; |
---|
939 | | -// radio.layout.doClick(); |
---|
| 957 | + radio.layout.doClick(); |
---|
940 | 958 | |
---|
941 | 959 | } else |
---|
942 | 960 | { |
---|
943 | 961 | keepButton = radio.layout; |
---|
| 962 | + |
---|
| 963 | + radio.layout = twoButton; |
---|
| 964 | + Show3DView(); |
---|
| 965 | + |
---|
944 | 966 | //keeprect = frame.getBounds(); |
---|
945 | 967 | // frame.setBounds(0, 0, frame.getToolkit().getScreenSize().width, |
---|
946 | 968 | // frame.getToolkit().getScreenSize().height); |
---|
.. | .. |
---|
962 | 984 | // radio.layout = fullscreenLayout; |
---|
963 | 985 | // radio.layout.doClick(); |
---|
964 | 986 | //frame.setVisible(true); |
---|
| 987 | + CollapseToolbar(); |
---|
965 | 988 | } |
---|
966 | 989 | frame.validate(); |
---|
967 | 990 | |
---|
.. | .. |
---|
987 | 1010 | object.ExtractBigData(Grafreed.grafreed.universe.versiontable); |
---|
988 | 1011 | // if (copy == client) |
---|
989 | 1012 | |
---|
| 1013 | + assert(!object.HasBigData()); |
---|
| 1014 | + |
---|
990 | 1015 | Object3D versions[] = object.versionlist; |
---|
991 | 1016 | java.util.Hashtable<java.util.UUID, Object3D> versiontable = object.versiontable; // if Grafreed.grafreed.universe |
---|
992 | 1017 | object.versionlist = null; |
---|
.. | .. |
---|
997 | 1022 | |
---|
998 | 1023 | //byte[] compress = Compress(copy); |
---|
999 | 1024 | Object3D compress = (Object3D)Grafreed.clone(object); |
---|
| 1025 | + |
---|
| 1026 | + assert(!compress.HasBigData()); |
---|
1000 | 1027 | |
---|
1001 | 1028 | object.parent = parent; |
---|
1002 | 1029 | |
---|
.. | .. |
---|
1144 | 1171 | JCheckBox selectableCB; |
---|
1145 | 1172 | JCheckBox hideCB; |
---|
1146 | 1173 | JCheckBox link2masterCB; |
---|
| 1174 | + JCheckBox sortCB; |
---|
1147 | 1175 | JCheckBox markCB; |
---|
1148 | 1176 | JCheckBox randomCB; |
---|
1149 | 1177 | JCheckBox speedupCB; |
---|
.. | .. |
---|
1171 | 1199 | cGridBag setupPanel2; |
---|
1172 | 1200 | cGridBag objectCommandsPanel; |
---|
1173 | 1201 | cGridBag pushPanel; |
---|
| 1202 | + cGridBag versionPanel; |
---|
1174 | 1203 | cGridBag fillPanel; |
---|
1175 | 1204 | |
---|
1176 | 1205 | JCheckBox AddCheckBox(cGridBag panel, String label, boolean on) |
---|
.. | .. |
---|
1333 | 1362 | obj = o; |
---|
1334 | 1363 | } |
---|
1335 | 1364 | } |
---|
| 1365 | + |
---|
| 1366 | + String GetSupportText() |
---|
| 1367 | + { |
---|
| 1368 | + return "Support"; |
---|
| 1369 | + } |
---|
1336 | 1370 | |
---|
1337 | 1371 | void SetupUI2(ObjEditor oe) |
---|
1338 | 1372 | { |
---|
.. | .. |
---|
1381 | 1415 | rewindCB = AddCheckBox(setupPanel2, "Rewind", copy.rewind); |
---|
1382 | 1416 | rewindCB.setToolTipText("Rewind animation"); |
---|
1383 | 1417 | |
---|
| 1418 | + sortCB = AddCheckBox(setupPanel2, "Sort", copy.sort); |
---|
| 1419 | + sortCB.setToolTipText("Display from back to front"); |
---|
| 1420 | + |
---|
1384 | 1421 | randomCB = AddCheckBox(setupPanel2, "Random", copy.random); |
---|
1385 | 1422 | randomCB.setToolTipText("Randomly Rewind (or Go back and forth)"); |
---|
1386 | 1423 | |
---|
1387 | | - link2masterCB = AddCheckBox(setupPanel2, "Support", copy.link2master); |
---|
1388 | | - link2masterCB.setToolTipText("Attach to support"); |
---|
| 1424 | + link2masterCB = AddCheckBox(setupPanel2, GetSupportText(), copy.link2master); |
---|
| 1425 | + link2masterCB.setToolTipText("Link to support"); |
---|
1389 | 1426 | |
---|
1390 | 1427 | if (Globals.ADVANCED) |
---|
1391 | 1428 | { |
---|
.. | .. |
---|
1417 | 1454 | oe.ctrlPanel.add(objectCommandsPanel); |
---|
1418 | 1455 | oe.ctrlPanel.Return(); |
---|
1419 | 1456 | |
---|
1420 | | - pushPanel = AddSlider(oe.ctrlPanel, "Push", -1, 1, copy.NORMALPUSH, 1.1); // To have the buttons |
---|
| 1457 | + pushPanel = AddSlider(oe.ctrlPanel, "Push", -1, 1, copy.NORMALPUSH * 100, 1.1); // To have the buttons |
---|
1421 | 1458 | normalpushField = (cNumberSlider)pushPanel.getComponent(1); |
---|
1422 | | - //Return(); |
---|
| 1459 | + if (false && copy.versionlist != null && copy.versionindex != -1) |
---|
| 1460 | + { |
---|
| 1461 | + oe.ctrlPanel.Return(); |
---|
| 1462 | + versionPanel = AddSlider(oe.ctrlPanel, "Version", 0, copy.VersionCount() - 1, copy.versionindex); |
---|
| 1463 | + versionField = (cNumberSlider)versionPanel.getComponent(1); |
---|
| 1464 | + } |
---|
1423 | 1465 | |
---|
1424 | 1466 | oe.ctrlPanel.Return(); |
---|
1425 | 1467 | |
---|
.. | .. |
---|
1556 | 1598 | |
---|
1557 | 1599 | return null; |
---|
1558 | 1600 | } |
---|
| 1601 | + |
---|
| 1602 | + int objectTabCount; |
---|
1559 | 1603 | |
---|
1560 | 1604 | void SetupViews() |
---|
1561 | 1605 | { |
---|
.. | .. |
---|
1691 | 1735 | //XYZPanel.setName("XYZ"); |
---|
1692 | 1736 | |
---|
1693 | 1737 | transformPanel.add(resetTransformPanel); |
---|
| 1738 | + |
---|
| 1739 | + cGridBag scalePanel = AddSlider(transformPanel, "Scale", 1, 10, 1); |
---|
| 1740 | + scalePanel.preferredHeight = 2; |
---|
| 1741 | + scaleSlider = (cNumberSlider)scalePanel.getComponent(1); |
---|
| 1742 | + transformPanel.add(scalePanel); |
---|
| 1743 | + |
---|
1694 | 1744 | transformPanel.add(XYZPanel); |
---|
1695 | 1745 | |
---|
1696 | 1746 | /* |
---|
.. | .. |
---|
1728 | 1778 | |
---|
1729 | 1779 | //JScrollPane tmp = new JScrollPane(ctrlPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); |
---|
1730 | 1780 | //tmp.setName("Edit"); |
---|
1731 | | - objectPanel.add(skyboxPanel); |
---|
1732 | | - objectPanel.setIconAt(0, GetIcon("icons/skybox.jpg")); |
---|
1733 | | - objectPanel.setToolTipTextAt(0, "Backgrounds"); |
---|
1734 | 1781 | |
---|
1735 | | - objectPanel.add(toolboxPanel); |
---|
1736 | | - objectPanel.setIconAt(1, GetIcon("icons/primitives.png")); |
---|
1737 | | - objectPanel.setToolTipTextAt(1, "Objects & textures"); |
---|
| 1782 | + objectTabCount = 0; |
---|
| 1783 | + |
---|
| 1784 | + objectTabbedPane.add(skyboxPanel); |
---|
| 1785 | + objectTabbedPane.setIconAt(objectTabCount, GetIcon("icons/skybox.jpg")); |
---|
| 1786 | + objectTabbedPane.setToolTipTextAt(objectTabCount++, "Backgrounds"); |
---|
| 1787 | + |
---|
| 1788 | + objectTabbedPane.add(toolboxPanel); |
---|
| 1789 | + objectTabbedPane.setIconAt(objectTabCount, GetIcon("icons/primitives.png")); |
---|
| 1790 | + objectTabbedPane.setToolTipTextAt(objectTabCount++, "Objects & textures"); |
---|
1738 | 1791 | |
---|
1739 | | - objectPanel.add(materialPanel); |
---|
1740 | | - objectPanel.setIconAt(2, GetIcon("icons/material.png")); |
---|
1741 | | - objectPanel.setToolTipTextAt(2, "Material"); |
---|
| 1792 | + objectTabbedPane.add(materialPanel); |
---|
| 1793 | + objectTabbedPane.setIconAt(objectTabCount, GetIcon("icons/material.png")); |
---|
| 1794 | + objectTabbedPane.setToolTipTextAt(objectTabCount++, "Material"); |
---|
1742 | 1795 | |
---|
| 1796 | + figurePanel = new cGridBag(); |
---|
| 1797 | + figurePanel.add(new cButton("FIGURES and POSES coming soon!")); |
---|
| 1798 | + objectTabbedPane.add(figurePanel); |
---|
| 1799 | + objectTabbedPane.setIconAt(objectTabCount, GetIcon("icons/figure.png")); |
---|
| 1800 | + objectTabbedPane.setToolTipTextAt(objectTabCount++, "Figures and poses"); |
---|
| 1801 | + |
---|
1743 | 1802 | // JPanel north = new JPanel(new BorderLayout()); |
---|
1744 | 1803 | // north.setName("Edit"); |
---|
1745 | 1804 | // north.add(ctrlPanel, BorderLayout.NORTH); |
---|
1746 | 1805 | // objectPanel.add(north); |
---|
1747 | | - objectPanel.add(editPanel); |
---|
1748 | | - objectPanel.setIconAt(3, GetIcon("icons/writewhite.png")); |
---|
1749 | | - objectPanel.setToolTipTextAt(3, "Edit controls"); |
---|
| 1806 | + objectTabbedPane.add(editPanel); |
---|
| 1807 | + objectTabbedPane.setIconAt(objectTabCount, GetIcon("icons/writewhite.png")); |
---|
| 1808 | + objectTabbedPane.setToolTipTextAt(objectTabCount++, "Edit controls"); |
---|
1750 | 1809 | |
---|
1751 | | - objectPanel.add(transformPanel); |
---|
1752 | | - objectPanel.setIconAt(4, GetIcon("icons/XYZ.png")); |
---|
1753 | | - objectPanel.setToolTipTextAt(4, "TRS transform"); |
---|
| 1810 | + objectTabbedPane.add(transformPanel); |
---|
| 1811 | + objectTabbedPane.setIconAt(objectTabCount, GetIcon("icons/XYZ.png")); |
---|
| 1812 | + objectTabbedPane.setToolTipTextAt(objectTabCount++, "TRS transform"); |
---|
1754 | 1813 | |
---|
1755 | 1814 | patchMaterial = true; |
---|
1756 | 1815 | cameraView.patchMaterial = this; |
---|
1757 | | - objectPanel.setSelectedIndex(2); |
---|
| 1816 | + objectTabbedPane.setSelectedIndex(2); |
---|
1758 | 1817 | |
---|
1759 | 1818 | /* |
---|
1760 | 1819 | aConstraints.gridx = 0; |
---|
.. | .. |
---|
1777 | 1836 | /*JTabbedPane*/ scenePanel = new cGridBag(); |
---|
1778 | 1837 | scenePanel.preferredWidth = 6; |
---|
1779 | 1838 | |
---|
1780 | | - JTabbedPane tabbedPane = new JTabbedPane(); |
---|
1781 | | - tabbedPane.add(scrollpane); |
---|
| 1839 | + JTabbedPane sceneTabbedPane = new JTabbedPane(); |
---|
| 1840 | + sceneTabbedPane.add(scrollpane); |
---|
1782 | 1841 | |
---|
1783 | 1842 | optionsPanel = new cGridBag().setVertical(false); |
---|
1784 | 1843 | |
---|
.. | .. |
---|
1786 | 1845 | |
---|
1787 | 1846 | AddOptions(optionsPanel); //, aConstraints); |
---|
1788 | 1847 | |
---|
1789 | | - tabbedPane.add(FSPane = new cFileSystemPane(this)); |
---|
| 1848 | + sceneTabbedPane.add(FSPane = new cFileSystemPane(this)); |
---|
1790 | 1849 | |
---|
1791 | | - tabbedPane.add(optionsPanel); |
---|
| 1850 | + fullscenePanel = new cGridBag(); |
---|
| 1851 | + fullscenePanel.setName("Download"); |
---|
| 1852 | + sceneTabbedPane.add(fullscenePanel); |
---|
1792 | 1853 | |
---|
1793 | | - scenePanel.add(tabbedPane); |
---|
| 1854 | + cButton fullsceneButton; |
---|
| 1855 | + |
---|
| 1856 | + fullscenePanel.add(fullsceneButton = GetButton("fullscenes/alsace.png", !Globals.NIMBUSLAF)); |
---|
| 1857 | + fullsceneButton.setToolTipText("Alsace!"); |
---|
| 1858 | + fullsceneButton.addActionListener(new ActionListener() |
---|
| 1859 | + { |
---|
| 1860 | + @Override |
---|
| 1861 | + public void actionPerformed(ActionEvent e) |
---|
| 1862 | + { |
---|
| 1863 | + ReadGFD("https://www.noaofarc.ca/akeeba/categories/Applications/Alsace.gfd", new iCallBack() |
---|
| 1864 | + { |
---|
| 1865 | + |
---|
| 1866 | + public void Callback(Object obj) |
---|
| 1867 | + { |
---|
| 1868 | + LoadIt(obj); |
---|
| 1869 | + } |
---|
| 1870 | + |
---|
| 1871 | + public void DragGesture() |
---|
| 1872 | + { |
---|
| 1873 | + } |
---|
| 1874 | + }); |
---|
| 1875 | + } |
---|
| 1876 | + }); |
---|
| 1877 | + |
---|
| 1878 | + fullscenePanel.add(fullsceneButton = GetButton("fullscenes/desertmotel.png", !Globals.NIMBUSLAF)); |
---|
| 1879 | + fullsceneButton.setToolTipText("Desert Motel!"); |
---|
| 1880 | + fullsceneButton.addActionListener(new ActionListener() |
---|
| 1881 | + { |
---|
| 1882 | + @Override |
---|
| 1883 | + public void actionPerformed(ActionEvent e) |
---|
| 1884 | + { |
---|
| 1885 | + ReadGFD("https://www.noaofarc.ca/akeeba/categories/Applications/DesertMotel.gfd", new iCallBack() |
---|
| 1886 | + { |
---|
| 1887 | + |
---|
| 1888 | + public void Callback(Object obj) |
---|
| 1889 | + { |
---|
| 1890 | + LoadIt(obj); |
---|
| 1891 | + } |
---|
| 1892 | + |
---|
| 1893 | + public void DragGesture() |
---|
| 1894 | + { |
---|
| 1895 | + } |
---|
| 1896 | + }); |
---|
| 1897 | + } |
---|
| 1898 | + }); |
---|
| 1899 | + |
---|
| 1900 | + fullscenePanel.Return(); |
---|
| 1901 | + |
---|
| 1902 | + fullscenePanel.add(fullsceneButton = GetButton("fullscenes/london.png", !Globals.NIMBUSLAF)); |
---|
| 1903 | + fullsceneButton.setToolTipText("Old London!"); |
---|
| 1904 | + fullsceneButton.addActionListener(new ActionListener() |
---|
| 1905 | + { |
---|
| 1906 | + @Override |
---|
| 1907 | + public void actionPerformed(ActionEvent e) |
---|
| 1908 | + { |
---|
| 1909 | + ReadGFD("https://www.noaofarc.ca/akeeba/categories/Applications/oldlondon.gfd", new iCallBack() |
---|
| 1910 | + { |
---|
| 1911 | + |
---|
| 1912 | + public void Callback(Object obj) |
---|
| 1913 | + { |
---|
| 1914 | + LoadIt(obj); |
---|
| 1915 | + } |
---|
| 1916 | + |
---|
| 1917 | + public void DragGesture() |
---|
| 1918 | + { |
---|
| 1919 | + } |
---|
| 1920 | + }); |
---|
| 1921 | + } |
---|
| 1922 | + }); |
---|
| 1923 | + |
---|
| 1924 | + fullscenePanel.add(fullsceneButton = GetButton("fullscenes/skullcove.png", !Globals.NIMBUSLAF)); |
---|
| 1925 | + fullsceneButton.setToolTipText("Skull Cove Island!"); |
---|
| 1926 | + fullsceneButton.addActionListener(new ActionListener() |
---|
| 1927 | + { |
---|
| 1928 | + @Override |
---|
| 1929 | + public void actionPerformed(ActionEvent e) |
---|
| 1930 | + { |
---|
| 1931 | + ReadGFD("https://www.noaofarc.ca/akeeba/categories/Applications/SkullCoveIsland.gfd", new iCallBack() |
---|
| 1932 | + { |
---|
| 1933 | + |
---|
| 1934 | + public void Callback(Object obj) |
---|
| 1935 | + { |
---|
| 1936 | + LoadIt(obj); |
---|
| 1937 | + } |
---|
| 1938 | + |
---|
| 1939 | + public void DragGesture() |
---|
| 1940 | + { |
---|
| 1941 | + } |
---|
| 1942 | + }); |
---|
| 1943 | + } |
---|
| 1944 | + }); |
---|
| 1945 | + |
---|
| 1946 | + fullscenePanel.Return(); |
---|
| 1947 | + |
---|
| 1948 | + fullscenePanel.add(fullsceneButton = GetButton("fullscenes/tuscany.png", !Globals.NIMBUSLAF)); |
---|
| 1949 | + fullsceneButton.setToolTipText("Tuscany!"); |
---|
| 1950 | + fullsceneButton.addActionListener(new ActionListener() |
---|
| 1951 | + { |
---|
| 1952 | + @Override |
---|
| 1953 | + public void actionPerformed(ActionEvent e) |
---|
| 1954 | + { |
---|
| 1955 | + ReadGFD("https://www.noaofarc.ca/akeeba/categories/Applications/Tuscany.gfd", new iCallBack() |
---|
| 1956 | + { |
---|
| 1957 | + |
---|
| 1958 | + public void Callback(Object obj) |
---|
| 1959 | + { |
---|
| 1960 | + LoadIt(obj); |
---|
| 1961 | + } |
---|
| 1962 | + |
---|
| 1963 | + public void DragGesture() |
---|
| 1964 | + { |
---|
| 1965 | + } |
---|
| 1966 | + }); |
---|
| 1967 | + } |
---|
| 1968 | + }); |
---|
| 1969 | + |
---|
| 1970 | + fullscenePanel.add(fullsceneButton = GetButton("fullscenes/venice.png", !Globals.NIMBUSLAF)); |
---|
| 1971 | + fullsceneButton.setToolTipText("Venice!"); |
---|
| 1972 | + fullsceneButton.addActionListener(new ActionListener() |
---|
| 1973 | + { |
---|
| 1974 | + @Override |
---|
| 1975 | + public void actionPerformed(ActionEvent e) |
---|
| 1976 | + { |
---|
| 1977 | + ReadGFD("https://www.noaofarc.ca/akeeba/categories/Applications/Venice.gfd", new iCallBack() |
---|
| 1978 | + { |
---|
| 1979 | + |
---|
| 1980 | + public void Callback(Object obj) |
---|
| 1981 | + { |
---|
| 1982 | + LoadIt(obj); |
---|
| 1983 | + } |
---|
| 1984 | + |
---|
| 1985 | + public void DragGesture() |
---|
| 1986 | + { |
---|
| 1987 | + } |
---|
| 1988 | + }); |
---|
| 1989 | + } |
---|
| 1990 | + }); |
---|
| 1991 | + |
---|
| 1992 | + fullscenePanel.Return(); |
---|
| 1993 | + |
---|
| 1994 | + fullscenePanel.add(fullsceneButton = GetButton("fullscenes/viking.png", !Globals.NIMBUSLAF)); |
---|
| 1995 | + fullsceneButton.setToolTipText("Viking Village!"); |
---|
| 1996 | + fullsceneButton.addActionListener(new ActionListener() |
---|
| 1997 | + { |
---|
| 1998 | + @Override |
---|
| 1999 | + public void actionPerformed(ActionEvent e) |
---|
| 2000 | + { |
---|
| 2001 | + ReadGFD("https://www.noaofarc.ca/akeeba/categories/Applications/VikingVillage.gfd", new iCallBack() |
---|
| 2002 | + { |
---|
| 2003 | + |
---|
| 2004 | + public void Callback(Object obj) |
---|
| 2005 | + { |
---|
| 2006 | + LoadIt(obj); |
---|
| 2007 | + } |
---|
| 2008 | + |
---|
| 2009 | + public void DragGesture() |
---|
| 2010 | + { |
---|
| 2011 | + } |
---|
| 2012 | + }); |
---|
| 2013 | + } |
---|
| 2014 | + }); |
---|
| 2015 | + |
---|
| 2016 | + fullscenePanel.add(fullsceneButton = GetButton("fullscenes/yvoire.png", !Globals.NIMBUSLAF)); |
---|
| 2017 | + fullsceneButton.setToolTipText("Yvoire!"); |
---|
| 2018 | + fullsceneButton.addActionListener(new ActionListener() |
---|
| 2019 | + { |
---|
| 2020 | + @Override |
---|
| 2021 | + public void actionPerformed(ActionEvent e) |
---|
| 2022 | + { |
---|
| 2023 | + ReadGFD("https://www.noaofarc.ca/akeeba/categories/Applications/Yvoire.gfd", new iCallBack() |
---|
| 2024 | + { |
---|
| 2025 | + |
---|
| 2026 | + public void Callback(Object obj) |
---|
| 2027 | + { |
---|
| 2028 | + LoadIt(obj); |
---|
| 2029 | + } |
---|
| 2030 | + |
---|
| 2031 | + public void DragGesture() |
---|
| 2032 | + { |
---|
| 2033 | + } |
---|
| 2034 | + }); |
---|
| 2035 | + } |
---|
| 2036 | + }); |
---|
| 2037 | + |
---|
| 2038 | + fullscenePanel.Return(); |
---|
| 2039 | + |
---|
| 2040 | + fullscenePanel.add(new cGridBag()); |
---|
| 2041 | + fullscenePanel.add(new cGridBag()); |
---|
| 2042 | + fullscenePanel.Return(); |
---|
| 2043 | + fullscenePanel.add(new cGridBag()); |
---|
| 2044 | + fullscenePanel.add(new cGridBag()); |
---|
| 2045 | + |
---|
| 2046 | + sceneTabbedPane.add(optionsPanel); |
---|
| 2047 | + |
---|
| 2048 | + scenePanel.add(sceneTabbedPane); |
---|
1794 | 2049 | |
---|
1795 | 2050 | cGridBag creditsPanel = new cGridBag().setVertical(true); |
---|
1796 | 2051 | creditsPanel.setName("Credits"); |
---|
.. | .. |
---|
1879 | 2134 | creditsPanel.add(new cGridBag()); |
---|
1880 | 2135 | } |
---|
1881 | 2136 | |
---|
1882 | | - tabbedPane.add(creditsPanel); |
---|
1883 | | - tabbedPane.setToolTipTextAt(3, "Credits"); |
---|
| 2137 | + sceneTabbedPane.add(creditsPanel); |
---|
| 2138 | + sceneTabbedPane.setToolTipTextAt(3, "Credits"); |
---|
1884 | 2139 | |
---|
1885 | | - if (Globals.ADVANCED) |
---|
| 2140 | + if (Globals.SHOWINFO) |
---|
1886 | 2141 | { |
---|
1887 | | - tabbedPane.add(infoPanel); |
---|
1888 | | - tabbedPane.setIconAt(4, GetIcon("icons/info.png")); |
---|
1889 | | - tabbedPane.setToolTipTextAt(4, "Information"); |
---|
| 2142 | + objectTabbedPane.add(infoPanel); |
---|
| 2143 | + objectTabbedPane.setIconAt(objectTabCount, GetIcon("icons/info.png")); |
---|
| 2144 | + objectTabbedPane.setToolTipTextAt(objectTabCount++, "Information"); |
---|
1890 | 2145 | } |
---|
1891 | 2146 | |
---|
1892 | 2147 | /* |
---|
.. | .. |
---|
1967 | 2222 | { |
---|
1968 | 2223 | if ((Integer)pce.getOldValue() == 1) |
---|
1969 | 2224 | { |
---|
1970 | | - if (radio.layout != expandedLayout) |
---|
| 2225 | + if (CameraPane.FULLSCREEN) |
---|
1971 | 2226 | { |
---|
1972 | | - radio.layout = expandedLayout; |
---|
1973 | | - radio.layout.doClick(); |
---|
| 2227 | + ToggleFullScreen(); |
---|
1974 | 2228 | } |
---|
| 2229 | + |
---|
| 2230 | +// if (radio.layout != expandedLayout) |
---|
| 2231 | +// { |
---|
| 2232 | +// radio.layout = expandedLayout; |
---|
| 2233 | +// radio.layout.doClick(); |
---|
| 2234 | +// } |
---|
1975 | 2235 | } |
---|
1976 | 2236 | } |
---|
1977 | 2237 | }); |
---|
.. | .. |
---|
1995 | 2255 | |
---|
1996 | 2256 | // aConstraints = gbc; // (GridBagConstraints) GrafreeD.clone(gbc); |
---|
1997 | 2257 | |
---|
1998 | | - frame.setSize(1280, 860); |
---|
| 2258 | + frame.setSize(1280, 900); |
---|
1999 | 2259 | |
---|
2000 | 2260 | cameraView.requestFocusInWindow(); |
---|
2001 | 2261 | |
---|
.. | .. |
---|
2370 | 2630 | { |
---|
2371 | 2631 | public void mouseClicked(MouseEvent e) |
---|
2372 | 2632 | { |
---|
2373 | | - borderfadeField.setFloat(0.5); |
---|
| 2633 | + borderfadeField.setFloat(0.4); |
---|
2374 | 2634 | opacityField.setFloat(0.75); |
---|
2375 | 2635 | |
---|
2376 | 2636 | materialtouched = true; |
---|
.. | .. |
---|
2429 | 2689 | cameraField.setFloat(0.001); |
---|
2430 | 2690 | specularField.setFloat(0.001); |
---|
2431 | 2691 | fakedepthField.setFloat(0.001); |
---|
2432 | | - opacityField.setFloat(0.6); |
---|
| 2692 | + opacityField.setFloat(0.4); |
---|
2433 | 2693 | |
---|
2434 | 2694 | materialtouched = true; |
---|
2435 | 2695 | applySelf(); |
---|
2436 | 2696 | } |
---|
2437 | 2697 | }); |
---|
2438 | 2698 | presetpanel.add(shadowShader); |
---|
| 2699 | + |
---|
| 2700 | + cLabel para0 = GetLabel("icons/shadericons/parallax0.png", !Globals.NIMBUSLAF); |
---|
| 2701 | + para0.setToolTipText("No parallax"); |
---|
| 2702 | + para0.addMouseListener(new MouseAdapter() |
---|
| 2703 | + { |
---|
| 2704 | + public void mouseClicked(MouseEvent e) |
---|
| 2705 | + { |
---|
| 2706 | + parallaxField.setFloat(0.125); |
---|
| 2707 | + |
---|
| 2708 | + materialtouched = true; |
---|
| 2709 | + applySelf(); |
---|
| 2710 | + } |
---|
| 2711 | + }); |
---|
| 2712 | + presetpanel.add(para0); |
---|
| 2713 | + |
---|
| 2714 | + cLabel para1 = GetLabel("icons/shadericons/parallax1.png", !Globals.NIMBUSLAF); |
---|
| 2715 | + para1.setToolTipText("With parallax"); |
---|
| 2716 | + para1.addMouseListener(new MouseAdapter() |
---|
| 2717 | + { |
---|
| 2718 | + public void mouseClicked(MouseEvent e) |
---|
| 2719 | + { |
---|
| 2720 | + parallaxField.setFloat(0.13); |
---|
| 2721 | + |
---|
| 2722 | + materialtouched = true; |
---|
| 2723 | + applySelf(); |
---|
| 2724 | + } |
---|
| 2725 | + }); |
---|
| 2726 | + presetpanel.add(para1); |
---|
| 2727 | + |
---|
| 2728 | + cLabel para2 = GetLabel("icons/shadericons/parallax2.png", !Globals.NIMBUSLAF); |
---|
| 2729 | + para2.setToolTipText("Reset parallax"); |
---|
| 2730 | + para2.addMouseListener(new MouseAdapter() |
---|
| 2731 | + { |
---|
| 2732 | + public void mouseClicked(MouseEvent e) |
---|
| 2733 | + { |
---|
| 2734 | + parallaxField.setFloat(0.14); |
---|
| 2735 | + |
---|
| 2736 | + materialtouched = true; |
---|
| 2737 | + applySelf(); |
---|
| 2738 | + } |
---|
| 2739 | + }); |
---|
| 2740 | + presetpanel.add(para2); |
---|
2439 | 2741 | |
---|
2440 | 2742 | cGridBag panel = new cGridBag().setVertical(true); |
---|
2441 | 2743 | |
---|
.. | .. |
---|
2685 | 2987 | cGridBag parallax = new cGridBag(); |
---|
2686 | 2988 | parallax.add(parallaxLabel = new JLabel("Parallax")); // , aConstraints); |
---|
2687 | 2989 | parallaxLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
2688 | | - parallax.add(parallaxField = new cNumberSlider(this, 0.001, 0.5, -0.25)); // , aConstraints); |
---|
| 2990 | + parallax.add(parallaxField = new cNumberSlider(this, 0.001, 0.25, -0.125)); // , aConstraints); |
---|
2689 | 2991 | colorSection.add(parallax); |
---|
2690 | 2992 | |
---|
2691 | 2993 | //panel.add(new JSeparator()); |
---|
.. | .. |
---|
3739 | 4041 | shadowField.setFloat(mat.shadow); |
---|
3740 | 4042 | textureField.setFloat(mat.texture); |
---|
3741 | 4043 | opacityField.setFloat(mat.opacity); |
---|
3742 | | - parallaxField.setFloat(mat.parallax + 0.25f); |
---|
| 4044 | + parallaxField.setFloat(mat.parallax + 0.125f); |
---|
3743 | 4045 | fakedepthField.setFloat(mat.fakedepth); |
---|
3744 | 4046 | shadowbiasField.setFloat(mat.shadowbias); |
---|
3745 | 4047 | bumpField.setInteger(1); // dec 2013 |
---|
.. | .. |
---|
4030 | 4332 | copy.Touch(); // display list issue |
---|
4031 | 4333 | objEditor.refreshContents(true); // To show item colors |
---|
4032 | 4334 | return; |
---|
| 4335 | + } else if (event.getSource() == sortCB) |
---|
| 4336 | + { |
---|
| 4337 | + copy.sort ^= true; |
---|
| 4338 | + objEditor.refreshContents(); |
---|
| 4339 | + return; |
---|
4033 | 4340 | } else if (event.getSource() == link2masterCB) |
---|
4034 | 4341 | { |
---|
4035 | 4342 | copy.link2master ^= true; |
---|
| 4343 | + objEditor.refreshContents(); |
---|
4036 | 4344 | return; |
---|
4037 | 4345 | } |
---|
4038 | 4346 | if (event.getSource() == randomCB) |
---|
4039 | 4347 | { |
---|
4040 | 4348 | copy.random ^= true; |
---|
| 4349 | + if (this instanceof RandomEditor) |
---|
| 4350 | + { |
---|
| 4351 | + cGridBag itemPanel = ((RandomEditor)this).itemPanel; |
---|
| 4352 | + itemPanel.getComponent(0).setEnabled(!copy.random); |
---|
| 4353 | + |
---|
| 4354 | + // Tooltip? |
---|
| 4355 | + if (copy.random) |
---|
| 4356 | + { |
---|
| 4357 | + } |
---|
| 4358 | + else |
---|
| 4359 | + { |
---|
| 4360 | + } |
---|
| 4361 | + } |
---|
| 4362 | + |
---|
4041 | 4363 | objEditor.refreshContents(); |
---|
4042 | 4364 | return; |
---|
4043 | 4365 | } |
---|
.. | .. |
---|
4273 | 4595 | |
---|
4274 | 4596 | void New() |
---|
4275 | 4597 | { |
---|
| 4598 | + copy.skyboxname = "cubemaps/penguins-skyboxes/yonder"; |
---|
| 4599 | + copy.skyboxext = "jpg"; |
---|
| 4600 | + |
---|
| 4601 | + copy.versionlist = null; |
---|
| 4602 | + copy.versionindex = -1; |
---|
| 4603 | + |
---|
4276 | 4604 | while (copy.Size() > 0) |
---|
4277 | 4605 | { |
---|
4278 | 4606 | copy.remove(0); |
---|
.. | .. |
---|
4283 | 4611 | if (copy == Grafreed.grafreed.universe) |
---|
4284 | 4612 | { |
---|
4285 | 4613 | CreateCameras(); |
---|
4286 | | - cameraView.SetCamera(GetCamera(copy, 0)); |
---|
| 4614 | + cameraView.SetCamera(GetCamera(copy, 0), true); |
---|
| 4615 | + cameraView.SetLight(GetCamera(copy, 4)); |
---|
4287 | 4616 | } |
---|
| 4617 | + |
---|
4288 | 4618 | ResetModel(); |
---|
| 4619 | + |
---|
| 4620 | + //DuplicateVersion(); |
---|
| 4621 | + |
---|
| 4622 | + this.SetVersionStates(); |
---|
4289 | 4623 | objEditor.refreshContents(); |
---|
4290 | 4624 | } |
---|
4291 | 4625 | |
---|
.. | .. |
---|
4423 | 4757 | copy.versionindex -= 1; |
---|
4424 | 4758 | |
---|
4425 | 4759 | if (copy.versionindex != -1) |
---|
4426 | | - CopyChanged(); |
---|
| 4760 | + CopyChanged(copy); |
---|
4427 | 4761 | |
---|
4428 | 4762 | SetVersionStates(); |
---|
| 4763 | + |
---|
| 4764 | + SetCameras(false); |
---|
4429 | 4765 | } |
---|
4430 | 4766 | |
---|
4431 | | - public boolean Save(boolean user) |
---|
| 4767 | + public boolean DuplicateVersion() // boolean user) |
---|
4432 | 4768 | { |
---|
4433 | 4769 | System.err.println("Save"); |
---|
4434 | | - Replace(); |
---|
| 4770 | + //Replace(); |
---|
4435 | 4771 | |
---|
4436 | | - //cRadio tab = GetCurrentTab(); |
---|
| 4772 | + if (copy.versionlist == null) |
---|
| 4773 | + { |
---|
| 4774 | + copy.versionlist = new Object3D[100]; |
---|
| 4775 | + copy.versionindex = -1; |
---|
| 4776 | + } |
---|
4437 | 4777 | |
---|
4438 | 4778 | Object3D compress = Duplicate(copy); // Saved version. No need for "Replace"? |
---|
4439 | 4779 | |
---|
.. | .. |
---|
4501 | 4841 | { |
---|
4502 | 4842 | Object3D selection = new Object3D(); |
---|
4503 | 4843 | |
---|
4504 | | - for (int i = 0; i < copy.selection.size(); i++) |
---|
| 4844 | + if (objEditor.copy.selection == null) |
---|
4505 | 4845 | { |
---|
4506 | | - Object3D elem = copy.selection.elementAt(i); |
---|
| 4846 | + objEditor.copy.selection = new Object3D(); |
---|
| 4847 | + } |
---|
| 4848 | + |
---|
| 4849 | + for (int i = 0; i < objEditor.copy.selection.size(); i++) |
---|
| 4850 | + { |
---|
| 4851 | + Object3D elem = objEditor.copy.selection.elementAt(i); |
---|
4507 | 4852 | |
---|
4508 | | - Object3D obj = copy.GetObject(elem.GetUUID()); |
---|
| 4853 | + Object3D obj = objEditor.copy.GetObject(elem.GetUUID()); |
---|
4509 | 4854 | |
---|
4510 | 4855 | if (obj == null) |
---|
4511 | 4856 | { |
---|
4512 | | - copy.selection.remove(i--); |
---|
| 4857 | + objEditor.copy.selection.remove(i--); |
---|
4513 | 4858 | } |
---|
4514 | 4859 | else |
---|
4515 | 4860 | { |
---|
4516 | 4861 | selection.add(obj); |
---|
4517 | | - copy.selection.setElementAt(obj, i); |
---|
| 4862 | + objEditor.copy.selection.setElementAt(obj, i); |
---|
4518 | 4863 | } |
---|
4519 | 4864 | } |
---|
4520 | 4865 | |
---|
.. | .. |
---|
4527 | 4872 | //refreshContents(false); |
---|
4528 | 4873 | } |
---|
4529 | 4874 | |
---|
4530 | | - void CopyChanged() |
---|
| 4875 | + void CopyChanged(Object3D changed) |
---|
4531 | 4876 | { |
---|
4532 | | - Object3D obj = (Object3D)Grafreed.clone(copy.versionlist[copy.versionindex]); |
---|
| 4877 | + Object3D obj = (Object3D)Grafreed.clone(changed.versionlist[copy.versionindex]); |
---|
4533 | 4878 | |
---|
4534 | | - SetVersionStates(); |
---|
| 4879 | + assert(!obj.HasBigData()); |
---|
4535 | 4880 | |
---|
4536 | 4881 | boolean temp = CameraPane.SWITCH; |
---|
4537 | 4882 | CameraPane.SWITCH = false; |
---|
4538 | 4883 | |
---|
4539 | | - copy.ExtractBigData(Grafreed.grafreed.universe.versiontable); |
---|
| 4884 | + changed.ExtractBigData(Grafreed.grafreed.universe.versiontable); |
---|
4540 | 4885 | |
---|
4541 | | - copy.clear(); |
---|
4542 | | - |
---|
4543 | | - copy.skyboxname = obj.skyboxname; |
---|
4544 | | - copy.skyboxext = obj.skyboxext; |
---|
| 4886 | + changed.clear(); |
---|
| 4887 | + |
---|
| 4888 | + obj.deepCopyNode(changed); |
---|
4545 | 4889 | |
---|
4546 | 4890 | for (int i=0; i<obj.Size(); i++) |
---|
4547 | 4891 | { |
---|
4548 | | - copy.add(obj.get(i)); |
---|
| 4892 | + changed.add(obj.get(i)); |
---|
4549 | 4893 | } |
---|
4550 | 4894 | |
---|
4551 | | - copy.RestoreBigData(Grafreed.grafreed.universe.versiontable); |
---|
| 4895 | + changed.RestoreBigData(Grafreed.grafreed.universe.versiontable); |
---|
4552 | 4896 | |
---|
4553 | 4897 | CameraPane.SWITCH = temp; |
---|
4554 | 4898 | |
---|
4555 | | - RefreshSelection(); |
---|
| 4899 | + if (objEditor == this) |
---|
| 4900 | + RefreshSelection(); |
---|
4556 | 4901 | //assert(hashtable.isEmpty()); |
---|
4557 | 4902 | |
---|
4558 | | - copy.Touch(); |
---|
| 4903 | + objEditor.copy.Touch(); |
---|
4559 | 4904 | |
---|
4560 | 4905 | ResetModel(); |
---|
4561 | | - copy.HardTouch(); // recompile? |
---|
| 4906 | + objEditor.copy.HardTouch(); // recompile? |
---|
4562 | 4907 | |
---|
4563 | 4908 | cRadio ab; |
---|
4564 | | - for (java.util.Enumeration e = buttonGroup.getElements(); e.hasMoreElements();) |
---|
| 4909 | + for (java.util.Enumeration e = objEditor.buttonGroup.getElements(); e.hasMoreElements();) |
---|
4565 | 4910 | { |
---|
4566 | 4911 | ab = (cRadio)e.nextElement(); |
---|
4567 | | - Object3D test = copy.GetObject(ab.object.GetUUID()); |
---|
| 4912 | + Object3D test = objEditor.copy.GetObject(ab.object.GetUUID()); |
---|
4568 | 4913 | //ab.camera = (Camera)copy.GetObject(ab.camera.GetUUID()); |
---|
4569 | 4914 | if (test != null) |
---|
4570 | 4915 | { |
---|
.. | .. |
---|
4573 | 4918 | } |
---|
4574 | 4919 | } |
---|
4575 | 4920 | |
---|
4576 | | - refreshContents(true); |
---|
| 4921 | + objEditor.refreshContents(true); |
---|
4577 | 4922 | } |
---|
4578 | 4923 | |
---|
4579 | 4924 | cButton previousVersionButton; |
---|
.. | .. |
---|
4587 | 4932 | |
---|
4588 | 4933 | int VersionCount() |
---|
4589 | 4934 | { |
---|
4590 | | - int count = 0; |
---|
4591 | | - |
---|
4592 | | - for (int i = copy.versionlist.length; --i >= 0;) |
---|
4593 | | - { |
---|
4594 | | - if (copy.versionlist[i] != null) |
---|
4595 | | - count++; |
---|
4596 | | - } |
---|
4597 | | - |
---|
4598 | | - return count; |
---|
| 4935 | + return copy.VersionCount(); |
---|
4599 | 4936 | } |
---|
4600 | 4937 | |
---|
4601 | 4938 | public cGridBag versionSliderPane; |
---|
.. | .. |
---|
4607 | 4944 | |
---|
4608 | 4945 | //cRadio tab = GetCurrentTab(); |
---|
4609 | 4946 | |
---|
4610 | | - if (copy.versionlist == null) |
---|
| 4947 | + if (copy.versionindex == -2) |
---|
4611 | 4948 | { |
---|
4612 | 4949 | saveVersionButton.setEnabled(false); |
---|
4613 | 4950 | restoreButton.setEnabled(false); |
---|
.. | .. |
---|
4623 | 4960 | replaceButton.setEnabled(copy.versionindex != -1); |
---|
4624 | 4961 | |
---|
4625 | 4962 | previousVersionButton.setEnabled(copy.versionindex > 0); |
---|
4626 | | - nextVersionButton.setEnabled(copy.versionlist[copy.versionindex + 1] != null); |
---|
| 4963 | + nextVersionButton.setEnabled(copy.versionlist != null && copy.versionlist[copy.versionindex + 1] != null); |
---|
4627 | 4964 | |
---|
4628 | 4965 | deleteVersionButton.setEnabled(copy.versionindex != -1); |
---|
4629 | 4966 | //copy.versionlist[copy.versionindex + 1] != null); |
---|
.. | .. |
---|
4644 | 4981 | // Option? |
---|
4645 | 4982 | Replace(); |
---|
4646 | 4983 | |
---|
4647 | | - System.err.println("Undo"); |
---|
| 4984 | + //System.err.println("Previous"); |
---|
4648 | 4985 | |
---|
4649 | 4986 | //cRadio tab = GetCurrentTab(); |
---|
4650 | 4987 | |
---|
.. | .. |
---|
4669 | 5006 | |
---|
4670 | 5007 | copy.versionindex -= 1; |
---|
4671 | 5008 | |
---|
4672 | | - CopyChanged(); |
---|
| 5009 | + CopyChanged(copy); |
---|
| 5010 | + |
---|
| 5011 | + SetVersionStates(); |
---|
| 5012 | + |
---|
| 5013 | + SetCameras(false); |
---|
4673 | 5014 | |
---|
4674 | 5015 | return true; |
---|
4675 | 5016 | } |
---|
.. | .. |
---|
4687 | 5028 | } |
---|
4688 | 5029 | |
---|
4689 | 5030 | //CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex])); |
---|
4690 | | - CopyChanged(); |
---|
| 5031 | + CopyChanged(copy); |
---|
| 5032 | + |
---|
| 5033 | + SetVersionStates(); |
---|
| 5034 | + |
---|
| 5035 | + SetCameras(false); |
---|
4691 | 5036 | |
---|
4692 | 5037 | return true; |
---|
4693 | 5038 | } |
---|
.. | .. |
---|
4698 | 5043 | |
---|
4699 | 5044 | //cRadio tab = GetCurrentTab(); |
---|
4700 | 5045 | |
---|
4701 | | - if (copy.versionindex == -1 || copy.versionlist[copy.versionindex] == null) |
---|
| 5046 | + // < 0 means == -2 || == -1 |
---|
| 5047 | + if (copy.versionindex < 0 || copy.versionlist[copy.versionindex] == null) |
---|
4702 | 5048 | { |
---|
4703 | 5049 | // No version yet. OK. java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
4704 | 5050 | return false; |
---|
.. | .. |
---|
4724 | 5070 | |
---|
4725 | 5071 | copy.versionindex += 1; |
---|
4726 | 5072 | |
---|
4727 | | - CopyChanged(); |
---|
| 5073 | + CopyChanged(copy); |
---|
4728 | 5074 | |
---|
4729 | 5075 | //if (!tab.user[tab.versionindex]) |
---|
4730 | 5076 | // tab.graphs[tab.versionindex] = null; |
---|
| 5077 | + |
---|
| 5078 | + SetVersionStates(); |
---|
| 5079 | + |
---|
| 5080 | + SetCameras(false); |
---|
4731 | 5081 | } |
---|
4732 | 5082 | |
---|
| 5083 | + void SetCameras(boolean set) |
---|
| 5084 | + { |
---|
| 5085 | + if (copy == Grafreed.grafreed.universe) |
---|
| 5086 | + { |
---|
| 5087 | + Camera neweye = (Camera)copy.GetObject(cameraView.cameras[cameraView.cameracount^1].GetUUID()); |
---|
| 5088 | + Camera newlight = (Camera)copy.GetObject(cameraView.LightCamera().GetUUID()); |
---|
| 5089 | + |
---|
| 5090 | + cameraView.SetCamera(neweye, set); |
---|
| 5091 | + cameraView.SetLight(newlight); |
---|
| 5092 | + } |
---|
| 5093 | + } |
---|
| 5094 | + |
---|
| 5095 | + void ImportGFD(String url) |
---|
| 5096 | + { |
---|
| 5097 | + objEditor.ReadGFD(url, objEditor); |
---|
| 5098 | + } |
---|
| 5099 | + |
---|
4733 | 5100 | void ImportGFD() |
---|
4734 | 5101 | { |
---|
4735 | 5102 | FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD); |
---|
4736 | | - browser.show(); |
---|
| 5103 | + browser.setVisible(true); |
---|
4737 | 5104 | String filename = browser.getFile(); |
---|
4738 | 5105 | if (filename != null && filename.length() > 0) |
---|
4739 | 5106 | { |
---|
4740 | 5107 | String fullname = browser.getDirectory() + filename; |
---|
4741 | 5108 | |
---|
4742 | 5109 | //Object3D readobj = |
---|
4743 | | - objEditor.ReadGFD(fullname, objEditor); |
---|
| 5110 | + // objEditor.ReadGFD(fullname, objEditor); |
---|
4744 | 5111 | //makeSomething(readobj); |
---|
| 5112 | + ImportGFD(fullname); |
---|
4745 | 5113 | } |
---|
4746 | 5114 | } |
---|
4747 | 5115 | |
---|
.. | .. |
---|
4964 | 5332 | current.shadow = (float) shadowField.getFloat(); |
---|
4965 | 5333 | current.texture = (float) textureField.getFloat(); |
---|
4966 | 5334 | current.opacity = (float) opacityField.getFloat(); |
---|
4967 | | - current.parallax = (float) parallaxField.getFloat() - 0.25f; |
---|
| 5335 | + current.parallax = (float) parallaxField.getFloat() - 0.125f; |
---|
4968 | 5336 | current.fakedepth = (float) fakedepthField.getFloat(); |
---|
4969 | 5337 | current.shadowbias = (float) shadowbiasField.getFloat(); |
---|
4970 | 5338 | |
---|
.. | .. |
---|
5056 | 5424 | } |
---|
5057 | 5425 | |
---|
5058 | 5426 | cNumberSlider versionSlider; |
---|
| 5427 | + cNumberSlider versionField; |
---|
5059 | 5428 | |
---|
| 5429 | + cNumberSlider scaleSlider; |
---|
| 5430 | + |
---|
| 5431 | + void ScaleSelection(int scale) |
---|
| 5432 | + { |
---|
| 5433 | + } |
---|
| 5434 | + |
---|
5060 | 5435 | public void stateChanged(ChangeEvent e) |
---|
5061 | 5436 | { |
---|
5062 | 5437 | // assert(false); |
---|
| 5438 | + // Main version slider |
---|
5063 | 5439 | if (e.getSource() == versionSlider) |
---|
5064 | 5440 | { |
---|
5065 | 5441 | if (muteSlider) |
---|
.. | .. |
---|
5072 | 5448 | if (version != -1 && copy.versionlist[version] != null) |
---|
5073 | 5449 | { |
---|
5074 | 5450 | copy.versionindex = version; |
---|
5075 | | - CopyChanged(); |
---|
| 5451 | + CopyChanged(copy); |
---|
| 5452 | + SetVersionStates(); |
---|
| 5453 | + SetCameras(false); |
---|
5076 | 5454 | } |
---|
5077 | 5455 | |
---|
| 5456 | + return; |
---|
| 5457 | + } |
---|
| 5458 | + |
---|
| 5459 | + // Version slider of edited object |
---|
| 5460 | + if (e.getSource() == versionField) |
---|
| 5461 | + { |
---|
| 5462 | + int version = versionField.getInteger(); |
---|
| 5463 | + |
---|
| 5464 | + if (version != -1 && copy.versionindex != version && copy.versionlist[version] != null) |
---|
| 5465 | + { |
---|
| 5466 | + copy.versionindex = version; |
---|
| 5467 | + CopyChanged(copy); |
---|
| 5468 | + } |
---|
| 5469 | + |
---|
| 5470 | + return; |
---|
| 5471 | + } |
---|
| 5472 | + |
---|
| 5473 | + if (e.getSource() == scaleSlider) |
---|
| 5474 | + { |
---|
| 5475 | + int scale = scaleSlider.getInteger(); |
---|
| 5476 | + |
---|
| 5477 | + ScaleSelection(scale); |
---|
5078 | 5478 | return; |
---|
5079 | 5479 | } |
---|
5080 | 5480 | |
---|
.. | .. |
---|
5167 | 5567 | } |
---|
5168 | 5568 | |
---|
5169 | 5569 | if (normalpushField != null) |
---|
5170 | | - copy.NORMALPUSH = (float)normalpushField.getFloat()/100; |
---|
| 5570 | + copy.NORMALPUSH = (float)normalpushField.getFloat() / 100; |
---|
5171 | 5571 | } |
---|
5172 | 5572 | |
---|
5173 | 5573 | void SnapObject() |
---|
.. | .. |
---|
5315 | 5715 | interest.y = k * interest.y + (1 - k) * height; |
---|
5316 | 5716 | } |
---|
5317 | 5717 | |
---|
5318 | | - CameraPane.zoomonce = true; |
---|
| 5718 | + // CameraPane.zoomonce = true; |
---|
5319 | 5719 | |
---|
5320 | 5720 | // june 2014 |
---|
5321 | 5721 | Camera parentcam = cameraView.manipCamera; |
---|
.. | .. |
---|
5389 | 5789 | |
---|
5390 | 5790 | objEditor.ScreenFit(obj, false); |
---|
5391 | 5791 | |
---|
5392 | | - cameraView.pingthread.StepToTarget(true); // aout 2013 |
---|
| 5792 | + cameraView.pingthread.StepToTarget(); //true); // aout 2013 |
---|
5393 | 5793 | refreshContents(); |
---|
5394 | 5794 | } |
---|
5395 | 5795 | |
---|
.. | .. |
---|
5541 | 5941 | void ResetModel() |
---|
5542 | 5942 | { |
---|
5543 | 5943 | //assert(copy instanceof Composite); |
---|
5544 | | - Object3D /*Composite*/ group = (Object3D /*Composite*/) copy; |
---|
| 5944 | + Object3D /*Composite*/ group = (Object3D /*Composite*/) objEditor.copy; |
---|
5545 | 5945 | |
---|
5546 | 5946 | // necessary? group.selection = new Object3D(); // java.util.Vector(); |
---|
5547 | 5947 | |
---|
.. | .. |
---|
5552 | 5952 | //group.refreshEditWindow(); |
---|
5553 | 5953 | //refreshContents(); |
---|
5554 | 5954 | |
---|
5555 | | - if (copy.selection == null) |
---|
| 5955 | + if (objEditor.copy.selection == null) |
---|
5556 | 5956 | { |
---|
5557 | | - copy.selection = new Object3D(); |
---|
| 5957 | + objEditor.copy.selection = new Object3D(); |
---|
5558 | 5958 | } |
---|
5559 | 5959 | |
---|
5560 | | - for (int j = 0; j < copy.selection.size(); j++) |
---|
| 5960 | + for (int j = 0; j < objEditor.copy.selection.size(); j++) |
---|
5561 | 5961 | { |
---|
5562 | | - Object3D item = copy.selection.get(j); |
---|
| 5962 | + Object3D item = objEditor.copy.selection.get(j); |
---|
5563 | 5963 | |
---|
5564 | 5964 | if (item instanceof cGroup && ((cGroup) item).transientlink) |
---|
5565 | 5965 | { |
---|
.. | .. |
---|
5568 | 5968 | |
---|
5569 | 5969 | if (item.count <= 1) // ??? == 0) |
---|
5570 | 5970 | { |
---|
5571 | | - copy.selection.remove(item); |
---|
| 5971 | + objEditor.copy.selection.remove(item); |
---|
5572 | 5972 | } |
---|
5573 | 5973 | } |
---|
5574 | 5974 | |
---|
5575 | 5975 | boolean first = true; |
---|
5576 | 5976 | |
---|
5577 | | - for (int i = copy.selection.size(); --i >= 0;) |
---|
| 5977 | + for (int i = objEditor.copy.selection.size(); --i >= 0;) |
---|
5578 | 5978 | { |
---|
5579 | | - Object3D item = copy.selection.get(i); |
---|
| 5979 | + Object3D item = objEditor.copy.selection.get(i); |
---|
5580 | 5980 | |
---|
5581 | 5981 | if (item instanceof cGroup && ((cGroup) item).transientlink) |
---|
5582 | 5982 | { |
---|
.. | .. |
---|
5666 | 6066 | { |
---|
5667 | 6067 | Object3D readobj = null; |
---|
5668 | 6068 | |
---|
| 6069 | + java.net.URL url = null; |
---|
| 6070 | + |
---|
| 6071 | + try |
---|
| 6072 | + { |
---|
| 6073 | + url = new java.net.URL(fullname); |
---|
| 6074 | + } catch (Exception e) |
---|
| 6075 | + { |
---|
| 6076 | + try |
---|
| 6077 | + { |
---|
| 6078 | + url = new java.net.URL("file:///" + fullname); |
---|
| 6079 | + } catch (Exception e2) |
---|
| 6080 | + { |
---|
| 6081 | + e2.printStackTrace(); |
---|
| 6082 | + } |
---|
| 6083 | + } |
---|
| 6084 | + |
---|
5669 | 6085 | try |
---|
5670 | 6086 | { |
---|
5671 | 6087 | // Try compressed version first. |
---|
5672 | | - java.io.FileInputStream istream = new java.io.FileInputStream(fullname); |
---|
| 6088 | + java.io.InputStream istream //= new java.io.FileInputStream(fullname); |
---|
| 6089 | + = url.openStream(); |
---|
5673 | 6090 | java.util.zip.GZIPInputStream zstream = new java.util.zip.GZIPInputStream(istream); |
---|
5674 | 6091 | java.io.ObjectInputStream p = new java.io.ObjectInputStream(zstream); |
---|
5675 | 6092 | |
---|
.. | .. |
---|
5684 | 6101 | |
---|
5685 | 6102 | try |
---|
5686 | 6103 | { |
---|
5687 | | - java.io.FileInputStream istream = new java.io.FileInputStream(fullname); |
---|
| 6104 | + java.io.InputStream istream //= new java.io.FileInputStream(fullname); |
---|
| 6105 | + = url.openStream(); |
---|
5688 | 6106 | java.io.ObjectInputStream p = new java.io.ObjectInputStream(istream); |
---|
5689 | 6107 | |
---|
5690 | 6108 | readobj = (Object3D) p.readObject(); |
---|
.. | .. |
---|
5782 | 6200 | // // oct 2012 if(cam.parent == null) |
---|
5783 | 6201 | // cam.parent = copy.get(0); // cams; |
---|
5784 | 6202 | // } |
---|
5785 | | - cameraView.SetCamera((Camera) cams.get(0)); |
---|
5786 | | - // MAJOR CRASH!! |
---|
5787 | | - cameraView.SetLight((Camera) cams.get(4)); |
---|
5788 | | - topView.SetCamera((Camera) cams.get(1)); |
---|
5789 | | - frontView.SetCamera((Camera) cams.get(2)); |
---|
5790 | | - sideView.SetCamera((Camera) cams.get(3)); |
---|
| 6203 | + cameraView.SetCamera((Camera) cams.get(0), true); |
---|
| 6204 | + cameraView.SetLight((Camera) cams.get(4)); // MAJOR CRASH!! |
---|
| 6205 | + topView.SetCamera((Camera) cams.get(1), true); |
---|
| 6206 | + frontView.SetCamera((Camera) cams.get(2), true); |
---|
| 6207 | + sideView.SetCamera((Camera) cams.get(3), true); |
---|
5791 | 6208 | |
---|
5792 | 6209 | // copy.get(0).clear(); |
---|
5793 | 6210 | // copy.get(0).addAll(cams); |
---|
.. | .. |
---|
5829 | 6246 | |
---|
5830 | 6247 | //? SetUndoStates(); |
---|
5831 | 6248 | |
---|
| 6249 | + cameraView.RevertCamera(); |
---|
| 6250 | + |
---|
5832 | 6251 | ResetModel(); |
---|
5833 | 6252 | copy.HardTouch(); // recompile? |
---|
5834 | 6253 | refreshContents(); |
---|
.. | .. |
---|
5840 | 6259 | if (Grafreed.standAlone) |
---|
5841 | 6260 | { |
---|
5842 | 6261 | FileDialog browser = new FileDialog(frame, "Open", FileDialog.LOAD); |
---|
5843 | | - browser.show(); |
---|
| 6262 | + browser.setVisible(true); |
---|
5844 | 6263 | String filename = browser.getFile(); |
---|
5845 | 6264 | if (filename != null && filename.length() > 0) |
---|
5846 | 6265 | { |
---|
.. | .. |
---|
6163 | 6582 | cGridBag skyboxPanel; |
---|
6164 | 6583 | cGridBag materialPanel; |
---|
6165 | 6584 | cGridBag ctrlPanel; |
---|
| 6585 | + cGridBag figurePanel; |
---|
| 6586 | + cGridBag fullscenePanel; |
---|
6166 | 6587 | |
---|
6167 | 6588 | JScrollPane infoPanel; |
---|
6168 | 6589 | |
---|
6169 | 6590 | cGridBag optionsPanel; |
---|
6170 | 6591 | |
---|
6171 | | - JTabbedPane objectPanel; |
---|
| 6592 | + JTabbedPane objectTabbedPane; |
---|
6172 | 6593 | boolean materialFlushed; |
---|
6173 | 6594 | Object3D latestObject; |
---|
6174 | 6595 | |
---|