Normand Briere
2019-08-19 22e8ab6479334206f97b0093f6c5ffd14610cce3
ObjEditor.java
....@@ -72,6 +72,21 @@
7272 }
7373 }
7474
75
+ public Composite CreateCameras()
76
+ {
77
+ Composite cams = new cTemplate();
78
+ cams.name = "Cameras";
79
+ copy.insertElementAt(cams, 0);
80
+
81
+ cams.addChild(new Camera());
82
+ cams.addChild(new Camera(1));
83
+ cams.addChild(new Camera(2));
84
+ cams.addChild(new Camera(3));
85
+ cams.addChild(new Camera(4));
86
+
87
+ return cams;
88
+ }
89
+
7590 public cGridBag GetSeparator()
7691 {
7792 cGridBag separator = new cGridBag();
....@@ -83,7 +98,7 @@
8398 cButton GetButton(String name, boolean border)
8499 {
85100 ImageIcon icon = GetIcon(name);
86
- if (icon != null)
101
+ if (icon != null || name.contains("/"))
87102 return new cButton(icon, border);
88103 else
89104 return new cButton(name, border);
....@@ -445,8 +460,11 @@
445460 importOBJItem.addActionListener(this);
446461 import3DSItem = menu.add(new MenuItem("3DS file..."));
447462 import3DSItem.addActionListener(this);
463
+ if (Globals.ADVANCED)
464
+ {
448465 importVRMLX3DItem = menu.add(new MenuItem("VRML/X3D file..."));
449466 importVRMLX3DItem.addActionListener(this);
467
+ }
450468 menu.add("-");
451469 importGFDItem = menu.add(new MenuItem("Grafreed file..."));
452470 importGFDItem.addActionListener(this);
....@@ -1318,7 +1336,7 @@
13181336
13191337 //if (copy.pinned)
13201338 {
1321
- pinButton = GetToggleButton("icons/pin.png", !Grafreed.NIMBUSLAF);
1339
+ pinButton = GetToggleButton("icons/pin.png", !Globals.NIMBUSLAF);
13221340 pinButton.setSelected(copy.pinned);
13231341 cGridBag t = new cGridBag();
13241342 t.preferredWidth = 2;
....@@ -1550,23 +1568,9 @@
15501568
15511569 if (cam == null || !(copy.get(0) instanceof cGroup))
15521570 {
1553
- if (Globals.DEBUG)
1554
- System.out.println("CREATE CAMERAS");
1555
- cams = new cTemplate();
1556
- cams.name = "Cameras";
1557
- copy.insertElementAt(cams, 0);
1558
- //cams.parent = copy;
1559
-
1560
- cam = new Camera(); // LA.newVector(3, 2, 1));
1561
- cams.addChild(cam);
1562
- cam = new Camera(1);
1563
- cams.addChild(cam);
1564
- cam = new Camera(2);
1565
- cams.addChild(cam);
1566
- cam = new Camera(3);
1567
- cams.addChild(cam);
1568
- cam = new Camera(4); // Light
1569
- cams.addChild(cam);
1571
+ if (Globals.DEBUG)
1572
+ System.out.println("CREATE CAMERAS");
1573
+ cams = CreateCameras();
15701574 } else
15711575 {
15721576 cams = (cGroup) copy.get(0);
....@@ -1638,7 +1642,8 @@
16381642
16391643 resetTransformPanel.preferredHeight = 2;
16401644
1641
- cButton resetTransform = GetButton("Reset all", !Grafreed.NIMBUSLAF);
1645
+ cButton resetTransform = GetButton("Reset all", !Globals.NIMBUSLAF);
1646
+ resetTransform.setToolTipText("Reset Translation, Rotation and Scale");
16421647 resetTransform.addMouseListener(new MouseAdapter()
16431648 {
16441649 public void mouseClicked(MouseEvent e)
....@@ -1648,7 +1653,8 @@
16481653 });
16491654 resetTransformPanel.add(resetTransform);
16501655
1651
- resetTransform = GetButton("T only", !Grafreed.NIMBUSLAF);
1656
+ resetTransform = GetButton("T only", !Globals.NIMBUSLAF);
1657
+ resetTransform.setToolTipText("Reset Translation only");
16521658 resetTransform.addMouseListener(new MouseAdapter()
16531659 {
16541660 public void mouseClicked(MouseEvent e)
....@@ -1658,7 +1664,8 @@
16581664 });
16591665 resetTransformPanel.add(resetTransform);
16601666
1661
- resetTransform = GetButton("RS only", !Grafreed.NIMBUSLAF);
1667
+ resetTransform = GetButton("RS only", !Globals.NIMBUSLAF);
1668
+ resetTransform.setToolTipText("Reset Rotation and Scale only");
16621669 resetTransform.addMouseListener(new MouseAdapter()
16631670 {
16641671 public void mouseClicked(MouseEvent e)
....@@ -1715,24 +1722,24 @@
17151722
17161723 //JScrollPane tmp = new JScrollPane(ctrlPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
17171724 //tmp.setName("Edit");
1725
+ objectPanel.add(skyboxPanel);
1726
+ objectPanel.setIconAt(0, GetIcon("icons/skybox.jpg"));
1727
+ objectPanel.setToolTipTextAt(0, "Backgrounds");
1728
+
17181729 objectPanel.add(toolboxPanel);
1719
- objectPanel.setIconAt(0, GetIcon("icons/primitives.png"));
1720
- objectPanel.setToolTipTextAt(0, "Objects & textures");
1730
+ objectPanel.setIconAt(1, GetIcon("icons/primitives.png"));
1731
+ objectPanel.setToolTipTextAt(1, "Objects & textures");
17211732
17221733 objectPanel.add(materialPanel);
1723
- objectPanel.setIconAt(1, GetIcon("icons/material.png"));
1724
- objectPanel.setToolTipTextAt(1, "Material");
1734
+ objectPanel.setIconAt(2, GetIcon("icons/material.png"));
1735
+ objectPanel.setToolTipTextAt(2, "Material");
17251736
1726
- objectPanel.add(skyboxPanel);
1727
- objectPanel.setIconAt(2, GetIcon("icons/skybox.jpg"));
1728
- objectPanel.setToolTipTextAt(2, "Backgrounds");
1729
-
17301737 // JPanel north = new JPanel(new BorderLayout());
17311738 // north.setName("Edit");
17321739 // north.add(ctrlPanel, BorderLayout.NORTH);
17331740 // objectPanel.add(north);
17341741 objectPanel.add(editPanel);
1735
- objectPanel.setIconAt(3, GetIcon("icons/write.png"));
1742
+ objectPanel.setIconAt(3, GetIcon("icons/writewhite.png"));
17361743 objectPanel.setToolTipTextAt(3, "Edit controls");
17371744
17381745 objectPanel.add(transformPanel);
....@@ -1741,7 +1748,7 @@
17411748
17421749 patchMaterial = true;
17431750 cameraView.patchMaterial = this;
1744
- objectPanel.setSelectedIndex(1);
1751
+ objectPanel.setSelectedIndex(2);
17451752
17461753 /*
17471754 aConstraints.gridx = 0;
....@@ -1773,17 +1780,109 @@
17731780
17741781 AddOptions(optionsPanel); //, aConstraints);
17751782
1776
- tabbedPane.add(optionsPanel);
1777
-
17781783 tabbedPane.add(FSPane = new cFileSystemPane(this));
17791784
1785
+ tabbedPane.add(optionsPanel);
1786
+
17801787 scenePanel.add(tabbedPane);
17811788
1782
- //if (Globals.ADVANCED)
1783
-// tabbedPane.add(infoPanel);
1784
-// tabbedPane.setIconAt(3, GetIcon("icons/info.png"));
1785
-// tabbedPane.setToolTipTextAt(3, "Information");
1789
+ cGridBag creditsPanel = new cGridBag().setVertical(true);
1790
+ creditsPanel.setName("Credits");
17861791
1792
+ cLabel ogaLabel = new cLabel(" Most Skyboxes courtesy of OpenGameArt!", !Globals.NIMBUSLAF);
1793
+ creditsPanel.add(ogaLabel);
1794
+
1795
+ cButton creditButton;
1796
+ creditsPanel.add(creditButton = GetButton("icons/sara-logo.png", !Globals.NIMBUSLAF));
1797
+ creditButton.setToolTipText("https://opengameart.org");
1798
+
1799
+ creditButton.addMouseListener(new MouseAdapter()
1800
+ {
1801
+ public void mouseClicked(MouseEvent e)
1802
+ {
1803
+ try
1804
+ {
1805
+ Desktop.getDesktop().browse(new java.net.URI("https://opengameart.org/"));
1806
+ } catch (Exception e1)
1807
+// } catch (java.io.IOException | java.net.URISyntaxException e1)
1808
+ {
1809
+ e1.printStackTrace();
1810
+ }
1811
+ }
1812
+ });
1813
+
1814
+ ogaLabel = new cLabel(" Download 3D models! (.3ds and .obj only)", !Globals.NIMBUSLAF);
1815
+ creditsPanel.add(ogaLabel);
1816
+
1817
+ creditsPanel.add(creditButton = GetButton("icons/3delicious.png", !Globals.NIMBUSLAF));
1818
+ creditButton.setToolTipText("https://3delicious.net");
1819
+
1820
+ creditButton.addMouseListener(new MouseAdapter()
1821
+ {
1822
+ public void mouseClicked(MouseEvent e)
1823
+ {
1824
+ try
1825
+ {
1826
+ Desktop.getDesktop().browse(new java.net.URI("https://3delicious.net"));
1827
+ } catch (Exception e1)
1828
+// } catch (java.io.IOException | java.net.URISyntaxException e1)
1829
+ {
1830
+ e1.printStackTrace();
1831
+ }
1832
+ }
1833
+ });
1834
+
1835
+ creditsPanel.add(creditButton = GetButton("icons/archive3d.png", !Globals.NIMBUSLAF));
1836
+ creditButton.setToolTipText("https://archive3d.net");
1837
+
1838
+ creditButton.addMouseListener(new MouseAdapter()
1839
+ {
1840
+ public void mouseClicked(MouseEvent e)
1841
+ {
1842
+ try
1843
+ {
1844
+ Desktop.getDesktop().browse(new java.net.URI("https://archive3d.net"));
1845
+ } catch (Exception e1)
1846
+// } catch (java.io.IOException | java.net.URISyntaxException e1)
1847
+ {
1848
+ e1.printStackTrace();
1849
+ }
1850
+ }
1851
+ });
1852
+
1853
+ creditsPanel.add(creditButton = GetButton("icons/turbosquid.png", !Globals.NIMBUSLAF));
1854
+ creditButton.setToolTipText("https://turbosquid.com");
1855
+
1856
+ creditButton.addMouseListener(new MouseAdapter()
1857
+ {
1858
+ public void mouseClicked(MouseEvent e)
1859
+ {
1860
+ try
1861
+ {
1862
+ Desktop.getDesktop().browse(new java.net.URI("https://www.turbosquid.com/Search/3D-Models/free"));
1863
+ } catch (Exception e1)
1864
+// } catch (java.io.IOException | java.net.URISyntaxException e1)
1865
+ {
1866
+ e1.printStackTrace();
1867
+ }
1868
+ }
1869
+ });
1870
+
1871
+ for (int i=6; --i>=0;)
1872
+ {
1873
+ creditsPanel.add(new cGridBag());
1874
+ }
1875
+
1876
+ tabbedPane.add(creditsPanel);
1877
+ tabbedPane.setToolTipTextAt(3, "Credits");
1878
+
1879
+ if (Globals.ADVANCED)
1880
+ {
1881
+ tabbedPane.add(infoPanel);
1882
+ tabbedPane.setIconAt(4, GetIcon("icons/info.png"));
1883
+ tabbedPane.setToolTipTextAt(4, "Information");
1884
+ }
1885
+
17871886 /*
17881887 cTree jTree = new cTree(null);
17891888 ToolTipManager.sharedInstance().registerComponent(jTree);
....@@ -1929,7 +2028,7 @@
19292028 {
19302029 cGridBag presetpanel = new cGridBag().setVertical(true);
19312030
1932
- cLabel skin = GetLabel("icons/shadericons/shadericon00000.png", !Grafreed.NIMBUSLAF);
2031
+ cLabel skin = GetLabel("icons/shadericons/shadericon00000.png", !Globals.NIMBUSLAF);
19332032 skin.setToolTipText("Skin");
19342033 skin.addMouseListener(new MouseAdapter()
19352034 {
....@@ -1967,7 +2066,7 @@
19672066 });
19682067 presetpanel.add(skin);
19692068
1970
- cLabel lambert = GetLabel("icons/shadericons/shadericon00002.png", !Grafreed.NIMBUSLAF);
2069
+ cLabel lambert = GetLabel("icons/shadericons/shadericon00002.png", !Globals.NIMBUSLAF);
19712070 lambert.setToolTipText("Diffuse");
19722071 lambert.addMouseListener(new MouseAdapter()
19732072 {
....@@ -1985,7 +2084,7 @@
19852084 });
19862085 presetpanel.add(lambert);
19872086
1988
- cLabel diffuse2 = GetLabel("icons/shadericons/shadericon00003.png", !Grafreed.NIMBUSLAF);
2087
+ cLabel diffuse2 = GetLabel("icons/shadericons/shadericon00003.png", !Globals.NIMBUSLAF);
19892088 diffuse2.setToolTipText("Diffuse2");
19902089 diffuse2.addMouseListener(new MouseAdapter()
19912090 {
....@@ -2003,7 +2102,7 @@
20032102 });
20042103 presetpanel.add(diffuse2);
20052104
2006
- cLabel diffusemoon = GetLabel("icons/shadericons/shadericon00004.png", !Grafreed.NIMBUSLAF);
2105
+ cLabel diffusemoon = GetLabel("icons/shadericons/shadericon00004.png", !Globals.NIMBUSLAF);
20072106 diffusemoon.setToolTipText("Moon");
20082107 diffusemoon.addMouseListener(new MouseAdapter()
20092108 {
....@@ -2021,7 +2120,7 @@
20212120 });
20222121 presetpanel.add(diffusemoon);
20232122
2024
- cLabel diffusemoon2 = GetLabel("icons/shadericons/shadericon00005.png", !Grafreed.NIMBUSLAF);
2123
+ cLabel diffusemoon2 = GetLabel("icons/shadericons/shadericon00005.png", !Globals.NIMBUSLAF);
20252124 diffusemoon2.setToolTipText("Moon2");
20262125 diffusemoon2.addMouseListener(new MouseAdapter()
20272126 {
....@@ -2039,7 +2138,7 @@
20392138 });
20402139 presetpanel.add(diffusemoon2);
20412140
2042
- cLabel diffusemoon3 = GetLabel("icons/shadericons/shadericon00006.png", !Grafreed.NIMBUSLAF);
2141
+ cLabel diffusemoon3 = GetLabel("icons/shadericons/shadericon00006.png", !Globals.NIMBUSLAF);
20432142 diffusemoon3.setToolTipText("Moon3");
20442143 diffusemoon3.addMouseListener(new MouseAdapter()
20452144 {
....@@ -2057,7 +2156,7 @@
20572156 });
20582157 presetpanel.add(diffusemoon3);
20592158
2060
- cLabel diffusesheen = GetLabel("icons/shadericons/shadericon00007.png", !Grafreed.NIMBUSLAF);
2159
+ cLabel diffusesheen = GetLabel("icons/shadericons/shadericon00007.png", !Globals.NIMBUSLAF);
20612160 diffusesheen.setToolTipText("Sheen");
20622161 diffusesheen.addMouseListener(new MouseAdapter()
20632162 {
....@@ -2074,7 +2173,7 @@
20742173 });
20752174 presetpanel.add(diffusesheen);
20762175
2077
- cLabel rough = GetLabel("icons/shadericons/shadericon00001.png", !Grafreed.NIMBUSLAF);
2176
+ cLabel rough = GetLabel("icons/shadericons/shadericon00001.png", !Globals.NIMBUSLAF);
20782177 rough.setToolTipText("Rough metal");
20792178 rough.addMouseListener(new MouseAdapter()
20802179 {
....@@ -2092,7 +2191,7 @@
20922191 });
20932192 presetpanel.add(rough);
20942193
2095
- cLabel rough2 = GetLabel("icons/shadericons/shadericon00013.png", !Grafreed.NIMBUSLAF);
2194
+ cLabel rough2 = GetLabel("icons/shadericons/shadericon00013.png", !Globals.NIMBUSLAF);
20962195 rough2.setToolTipText("Medium metal");
20972196 rough2.addMouseListener(new MouseAdapter()
20982197 {
....@@ -2110,7 +2209,7 @@
21102209 });
21112210 presetpanel.add(rough2);
21122211
2113
- cLabel shini0 = GetLabel("icons/shadericons/shadericon00014.png", !Grafreed.NIMBUSLAF);
2212
+ cLabel shini0 = GetLabel("icons/shadericons/shadericon00014.png", !Globals.NIMBUSLAF);
21142213 shini0.setToolTipText("Shiny");
21152214 shini0.addMouseListener(new MouseAdapter()
21162215 {
....@@ -2128,7 +2227,7 @@
21282227 });
21292228 presetpanel.add(shini0);
21302229
2131
- cLabel shini1 = GetLabel("icons/shadericons/shadericon00011.png", !Grafreed.NIMBUSLAF);
2230
+ cLabel shini1 = GetLabel("icons/shadericons/shadericon00011.png", !Globals.NIMBUSLAF);
21322231 shini1.setToolTipText("Shiny2");
21332232 shini1.addMouseListener(new MouseAdapter()
21342233 {
....@@ -2146,7 +2245,7 @@
21462245 });
21472246 presetpanel.add(shini1);
21482247
2149
- cLabel shini2 = GetLabel("icons/shadericons/shadericon00012.png", !Grafreed.NIMBUSLAF);
2248
+ cLabel shini2 = GetLabel("icons/shadericons/shadericon00012.png", !Globals.NIMBUSLAF);
21502249 shini2.setToolTipText("Shiny3");
21512250 shini2.addMouseListener(new MouseAdapter()
21522251 {
....@@ -2164,7 +2263,7 @@
21642263 });
21652264 presetpanel.add(shini2);
21662265
2167
- cLabel aniso = GetLabel("icons/shadericons/shadericon00008.png", !Grafreed.NIMBUSLAF);
2266
+ cLabel aniso = GetLabel("icons/shadericons/shadericon00008.png", !Globals.NIMBUSLAF);
21682267 aniso.setToolTipText("AnisoU");
21692268 aniso.addMouseListener(new MouseAdapter()
21702269 {
....@@ -2182,7 +2281,7 @@
21822281 });
21832282 presetpanel.add(aniso);
21842283
2185
- cLabel aniso2 = GetLabel("icons/shadericons/shadericon00009.png", !Grafreed.NIMBUSLAF);
2284
+ cLabel aniso2 = GetLabel("icons/shadericons/shadericon00009.png", !Globals.NIMBUSLAF);
21862285 aniso2.setToolTipText("AnisoV");
21872286 aniso2.addMouseListener(new MouseAdapter()
21882287 {
....@@ -2200,7 +2299,7 @@
22002299 });
22012300 presetpanel.add(aniso2);
22022301
2203
- cLabel aniso3 = GetLabel("icons/shadericons/shadericon00010.png", !Grafreed.NIMBUSLAF);
2302
+ cLabel aniso3 = GetLabel("icons/shadericons/shadericon00010.png", !Globals.NIMBUSLAF);
22042303 aniso3.setToolTipText("AnisoUV");
22052304 aniso3.addMouseListener(new MouseAdapter()
22062305 {
....@@ -2218,7 +2317,7 @@
22182317 });
22192318 presetpanel.add(aniso3);
22202319
2221
- cLabel velvet0 = GetLabel("icons/shadericons/shadericon00015.png", !Grafreed.NIMBUSLAF);
2320
+ cLabel velvet0 = GetLabel("icons/shadericons/shadericon00015.png", !Globals.NIMBUSLAF);
22222321 velvet0.setToolTipText("Velvet");
22232322 velvet0.addMouseListener(new MouseAdapter()
22242323 {
....@@ -2240,7 +2339,7 @@
22402339 });
22412340 presetpanel.add(velvet0);
22422341
2243
- cLabel bump0 = GetLabel("icons/shadericons/shadericon00016.png", !Grafreed.NIMBUSLAF);
2342
+ cLabel bump0 = GetLabel("icons/shadericons/shadericon00016.png", !Globals.NIMBUSLAF);
22442343 bump0.setToolTipText("Bump texture");
22452344 bump0.addMouseListener(new MouseAdapter()
22462345 {
....@@ -2259,7 +2358,7 @@
22592358 });
22602359 presetpanel.add(bump0);
22612360
2262
- cLabel borderShader = GetLabel("icons/shadericons/borderfade.jpg", !Grafreed.NIMBUSLAF);
2361
+ cLabel borderShader = GetLabel("icons/shadericons/borderfade.jpg", !Globals.NIMBUSLAF);
22632362 borderShader.setToolTipText("Border fade");
22642363 borderShader.addMouseListener(new MouseAdapter()
22652364 {
....@@ -2274,7 +2373,7 @@
22742373 });
22752374 presetpanel.add(borderShader);
22762375
2277
- cLabel halo = GetLabel("icons/shadericons/shadericon00017.png", !Grafreed.NIMBUSLAF);
2376
+ cLabel halo = GetLabel("icons/shadericons/shadericon00017.png", !Globals.NIMBUSLAF);
22782377 halo.setToolTipText("Halo");
22792378 halo.addMouseListener(new MouseAdapter()
22802379 {
....@@ -2291,7 +2390,7 @@
22912390 });
22922391 presetpanel.add(halo);
22932392
2294
- cLabel candle = GetLabel("icons/shadericons/shadericon00018.png", !Grafreed.NIMBUSLAF);
2393
+ cLabel candle = GetLabel("icons/shadericons/shadericon00018.png", !Globals.NIMBUSLAF);
22952394 candle.setToolTipText("Candle");
22962395 candle.addMouseListener(new MouseAdapter()
22972396 {
....@@ -2313,7 +2412,7 @@
23132412 });
23142413 presetpanel.add(candle);
23152414
2316
- cLabel shadowShader = GetLabel("icons/shadericons/shadow.png", !Grafreed.NIMBUSLAF);
2415
+ cLabel shadowShader = GetLabel("icons/shadericons/shadow.png", !Globals.NIMBUSLAF);
23172416 shadowShader.setToolTipText("Shadow");
23182417 shadowShader.addMouseListener(new MouseAdapter()
23192418 {
....@@ -2348,19 +2447,19 @@
23482447
23492448 cGridBag editBar = new cGridBag().setVertical(false);
23502449
2351
- editBar.add(createMaterialButton = new cButton("Create", !Grafreed.NIMBUSLAF)); // , aConstraints);
2450
+ editBar.add(createMaterialButton = new cButton("Create", !Globals.NIMBUSLAF)); // , aConstraints);
23522451 createMaterialButton.setToolTipText("Create material");
23532452
23542453 /*
23552454 ctrlPanel.add(resetSlidersButton = new cButton("Reset All"), aConstraints);
23562455 */
23572456
2358
- editBar.add(clearMaterialButton = new cButton("Clear", !Grafreed.NIMBUSLAF)); // , aConstraints);
2457
+ editBar.add(clearMaterialButton = new cButton("Clear", !Globals.NIMBUSLAF)); // , aConstraints);
23592458 clearMaterialButton.setToolTipText("Clear material");
23602459
23612460 if (Globals.ADVANCED)
23622461 {
2363
- editBar.add(resetSlidersButton = new cButton("Reset", !Grafreed.NIMBUSLAF)); // , aConstraints);
2462
+ editBar.add(resetSlidersButton = new cButton("Reset", !Globals.NIMBUSLAF)); // , aConstraints);
23642463 editBar.add(propagateToggle = new cCheckBox("Prop", propagate)); // , aConstraints);
23652464 editBar.add(multiplyToggle = new cCheckBox("Mult", false)); // , aConstraints);
23662465 }
....@@ -4161,11 +4260,18 @@
41614260
41624261 void New()
41634262 {
4164
- while (copy.Size() > 1)
4263
+ while (copy.Size() > 0)
41654264 {
4166
- copy.remove(1);
4265
+ copy.remove(0);
41674266 }
41684267
4268
+ copy.selection.clear();
4269
+
4270
+ if (copy == Grafreed.grafreed.universe)
4271
+ {
4272
+ CreateCameras();
4273
+ cameraView.SetCamera(GetCamera(copy, 0));
4274
+ }
41694275 ResetModel();
41704276 objEditor.refreshContents();
41714277 }