Normand Briere
2019-09-28 57f4646563d6757f65ddc00ca38975c352d76de7
ObjEditor.java
....@@ -98,9 +98,11 @@
9898
9999 cButton GetButton(String name, boolean border)
100100 {
101
- ImageIcon icon = GetIcon(name);
102
- if (icon != null || name.contains("/"))
103
- 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);
104106 else
105107 return new cButton(name, border);
106108 }
....@@ -797,6 +799,8 @@
797799 // SendInfo(" delay: " + sel.delay + newline, "regular");
798800 // live, hide, ...
799801 //?? SendInfo(" Orig: " + maxima + newline, "regular");
802
+ if (sel.GetTextures().pigmentdata != null)
803
+ si.SendInfo(" EMBEDDED ", "regular");
800804 si.SendInfo((debug ? " Texture: " : " ") + sel.GetTextures(), "bold");
801805 // SendInfo((debug ? " Material: " : " ") + sel.material + newline, "regular");
802806 if (sel instanceof cMesh)
....@@ -1167,6 +1171,7 @@
11671171 JCheckBox selectableCB;
11681172 JCheckBox hideCB;
11691173 JCheckBox link2masterCB;
1174
+ JCheckBox sortCB;
11701175 JCheckBox markCB;
11711176 JCheckBox randomCB;
11721177 JCheckBox speedupCB;
....@@ -1410,11 +1415,14 @@
14101415 rewindCB = AddCheckBox(setupPanel2, "Rewind", copy.rewind);
14111416 rewindCB.setToolTipText("Rewind animation");
14121417
1418
+ sortCB = AddCheckBox(setupPanel2, "Sort", copy.sort);
1419
+ sortCB.setToolTipText("Display from back to front");
1420
+
14131421 randomCB = AddCheckBox(setupPanel2, "Random", copy.random);
14141422 randomCB.setToolTipText("Randomly Rewind (or Go back and forth)");
14151423
14161424 link2masterCB = AddCheckBox(setupPanel2, GetSupportText(), copy.link2master);
1417
- link2masterCB.setToolTipText("Attach to support");
1425
+ link2masterCB.setToolTipText("Link to support");
14181426
14191427 if (Globals.ADVANCED)
14201428 {
....@@ -1786,11 +1794,11 @@
17861794 objectTabbedPane.setToolTipTextAt(objectTabCount++, "Material");
17871795
17881796 figurePanel = new cGridBag();
1789
- figurePanel.add(new cButton("FIGURES amd POSES coming soon!"));
1797
+ figurePanel.add(new cButton("FIGURES and POSES coming soon!"));
17901798 objectTabbedPane.add(figurePanel);
17911799 objectTabbedPane.setIconAt(objectTabCount, GetIcon("icons/figure.png"));
17921800 objectTabbedPane.setToolTipTextAt(objectTabCount++, "Figures and poses");
1793
-
1801
+
17941802 // JPanel north = new JPanel(new BorderLayout());
17951803 // north.setName("Edit");
17961804 // north.add(ctrlPanel, BorderLayout.NORTH);
....@@ -1828,8 +1836,8 @@
18281836 /*JTabbedPane*/ scenePanel = new cGridBag();
18291837 scenePanel.preferredWidth = 6;
18301838
1831
- JTabbedPane tabbedPane = new JTabbedPane();
1832
- tabbedPane.add(scrollpane);
1839
+ JTabbedPane sceneTabbedPane = new JTabbedPane();
1840
+ sceneTabbedPane.add(scrollpane);
18331841
18341842 optionsPanel = new cGridBag().setVertical(false);
18351843
....@@ -1837,11 +1845,207 @@
18371845
18381846 AddOptions(optionsPanel); //, aConstraints);
18391847
1840
- tabbedPane.add(FSPane = new cFileSystemPane(this));
1848
+ sceneTabbedPane.add(FSPane = new cFileSystemPane(this));
18411849
1842
- tabbedPane.add(optionsPanel);
1850
+ fullscenePanel = new cGridBag();
1851
+ fullscenePanel.setName("Download");
1852
+ sceneTabbedPane.add(fullscenePanel);
18431853
1844
- 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);
18452049
18462050 cGridBag creditsPanel = new cGridBag().setVertical(true);
18472051 creditsPanel.setName("Credits");
....@@ -1930,8 +2134,8 @@
19302134 creditsPanel.add(new cGridBag());
19312135 }
19322136
1933
- tabbedPane.add(creditsPanel);
1934
- tabbedPane.setToolTipTextAt(3, "Credits");
2137
+ sceneTabbedPane.add(creditsPanel);
2138
+ sceneTabbedPane.setToolTipTextAt(3, "Credits");
19352139
19362140 if (Globals.SHOWINFO)
19372141 {
....@@ -4128,6 +4332,11 @@
41284332 copy.Touch(); // display list issue
41294333 objEditor.refreshContents(true); // To show item colors
41304334 return;
4335
+ } else if (event.getSource() == sortCB)
4336
+ {
4337
+ copy.sort ^= true;
4338
+ objEditor.refreshContents();
4339
+ return;
41314340 } else if (event.getSource() == link2masterCB)
41324341 {
41334342 copy.link2master ^= true;
....@@ -4402,13 +4611,13 @@
44024611 if (copy == Grafreed.grafreed.universe)
44034612 {
44044613 CreateCameras();
4405
- cameraView.SetCamera(GetCamera(copy, 0));
4614
+ cameraView.SetCamera(GetCamera(copy, 0), true);
44064615 cameraView.SetLight(GetCamera(copy, 4));
44074616 }
44084617
44094618 ResetModel();
44104619
4411
- DuplicateVersion();
4620
+ //DuplicateVersion();
44124621
44134622 this.SetVersionStates();
44144623 objEditor.refreshContents();
....@@ -4552,7 +4761,7 @@
45524761
45534762 SetVersionStates();
45544763
4555
- SetCameras();
4764
+ SetCameras(false);
45564765 }
45574766
45584767 public boolean DuplicateVersion() // boolean user)
....@@ -4801,7 +5010,7 @@
48015010
48025011 SetVersionStates();
48035012
4804
- SetCameras();
5013
+ SetCameras(false);
48055014
48065015 return true;
48075016 }
....@@ -4823,7 +5032,7 @@
48235032
48245033 SetVersionStates();
48255034
4826
- SetCameras();
5035
+ SetCameras(false);
48275036
48285037 return true;
48295038 }
....@@ -4834,7 +5043,8 @@
48345043
48355044 //cRadio tab = GetCurrentTab();
48365045
4837
- if (copy.versionindex == -1 || copy.versionlist[copy.versionindex] == null)
5046
+ // < 0 means == -2 || == -1
5047
+ if (copy.versionindex < 0 || copy.versionlist[copy.versionindex] == null)
48385048 {
48395049 // No version yet. OK. java.awt.Toolkit.getDefaultToolkit().beep();
48405050 return false;
....@@ -4867,33 +5077,39 @@
48675077
48685078 SetVersionStates();
48695079
4870
- SetCameras();
5080
+ SetCameras(false);
48715081 }
48725082
4873
- void SetCameras()
5083
+ void SetCameras(boolean set)
48745084 {
48755085 if (copy == Grafreed.grafreed.universe)
48765086 {
48775087 Camera neweye = (Camera)copy.GetObject(cameraView.cameras[cameraView.cameracount^1].GetUUID());
48785088 Camera newlight = (Camera)copy.GetObject(cameraView.LightCamera().GetUUID());
48795089
4880
- cameraView.SetCamera(neweye);
5090
+ cameraView.SetCamera(neweye, set);
48815091 cameraView.SetLight(newlight);
48825092 }
48835093 }
4884
-
5094
+
5095
+ void ImportGFD(String url)
5096
+ {
5097
+ objEditor.ReadGFD(url, objEditor);
5098
+ }
5099
+
48855100 void ImportGFD()
48865101 {
48875102 FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD);
4888
- browser.show();
5103
+ browser.setVisible(true);
48895104 String filename = browser.getFile();
48905105 if (filename != null && filename.length() > 0)
48915106 {
48925107 String fullname = browser.getDirectory() + filename;
48935108
48945109 //Object3D readobj =
4895
- objEditor.ReadGFD(fullname, objEditor);
5110
+ // objEditor.ReadGFD(fullname, objEditor);
48965111 //makeSomething(readobj);
5112
+ ImportGFD(fullname);
48975113 }
48985114 }
48995115
....@@ -5234,7 +5450,7 @@
52345450 copy.versionindex = version;
52355451 CopyChanged(copy);
52365452 SetVersionStates();
5237
- SetCameras();
5453
+ SetCameras(false);
52385454 }
52395455
52405456 return;
....@@ -5499,7 +5715,7 @@
54995715 interest.y = k * interest.y + (1 - k) * height;
55005716 }
55015717
5502
- CameraPane.zoomonce = true;
5718
+ // CameraPane.zoomonce = true;
55035719
55045720 // june 2014
55055721 Camera parentcam = cameraView.manipCamera;
....@@ -5573,7 +5789,7 @@
55735789
55745790 objEditor.ScreenFit(obj, false);
55755791
5576
- cameraView.pingthread.StepToTarget(true); // aout 2013
5792
+ cameraView.pingthread.StepToTarget(); //true); // aout 2013
55775793 refreshContents();
55785794 }
55795795
....@@ -5850,10 +6066,27 @@
58506066 {
58516067 Object3D readobj = null;
58526068
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
+
58536085 try
58546086 {
58556087 // Try compressed version first.
5856
- java.io.FileInputStream istream = new java.io.FileInputStream(fullname);
6088
+ java.io.InputStream istream //= new java.io.FileInputStream(fullname);
6089
+ = url.openStream();
58576090 java.util.zip.GZIPInputStream zstream = new java.util.zip.GZIPInputStream(istream);
58586091 java.io.ObjectInputStream p = new java.io.ObjectInputStream(zstream);
58596092
....@@ -5868,7 +6101,8 @@
58686101
58696102 try
58706103 {
5871
- java.io.FileInputStream istream = new java.io.FileInputStream(fullname);
6104
+ java.io.InputStream istream //= new java.io.FileInputStream(fullname);
6105
+ = url.openStream();
58726106 java.io.ObjectInputStream p = new java.io.ObjectInputStream(istream);
58736107
58746108 readobj = (Object3D) p.readObject();
....@@ -5966,12 +6200,11 @@
59666200 // // oct 2012 if(cam.parent == null)
59676201 // cam.parent = copy.get(0); // cams;
59686202 // }
5969
- cameraView.SetCamera((Camera) cams.get(0));
5970
- // MAJOR CRASH!!
5971
- cameraView.SetLight((Camera) cams.get(4));
5972
- topView.SetCamera((Camera) cams.get(1));
5973
- frontView.SetCamera((Camera) cams.get(2));
5974
- 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);
59756208
59766209 // copy.get(0).clear();
59776210 // copy.get(0).addAll(cams);
....@@ -6026,7 +6259,7 @@
60266259 if (Grafreed.standAlone)
60276260 {
60286261 FileDialog browser = new FileDialog(frame, "Open", FileDialog.LOAD);
6029
- browser.show();
6262
+ browser.setVisible(true);
60306263 String filename = browser.getFile();
60316264 if (filename != null && filename.length() > 0)
60326265 {
....@@ -6350,6 +6583,7 @@
63506583 cGridBag materialPanel;
63516584 cGridBag ctrlPanel;
63526585 cGridBag figurePanel;
6586
+ cGridBag fullscenePanel;
63536587
63546588 JScrollPane infoPanel;
63556589