Normand Briere
2019-08-18 480ad70047e54b2b92f974e6c2ac5a6c0bdc5a5c
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);
....@@ -1318,7 +1333,7 @@
13181333
13191334 //if (copy.pinned)
13201335 {
1321
- pinButton = GetToggleButton("icons/pin.png", !Grafreed.NIMBUSLAF);
1336
+ pinButton = GetToggleButton("icons/pin.png", !Globals.NIMBUSLAF);
13221337 pinButton.setSelected(copy.pinned);
13231338 cGridBag t = new cGridBag();
13241339 t.preferredWidth = 2;
....@@ -1550,23 +1565,9 @@
15501565
15511566 if (cam == null || !(copy.get(0) instanceof cGroup))
15521567 {
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);
1568
+ if (Globals.DEBUG)
1569
+ System.out.println("CREATE CAMERAS");
1570
+ cams = CreateCameras();
15701571 } else
15711572 {
15721573 cams = (cGroup) copy.get(0);
....@@ -1638,7 +1639,8 @@
16381639
16391640 resetTransformPanel.preferredHeight = 2;
16401641
1641
- cButton resetTransform = GetButton("Reset all", !Grafreed.NIMBUSLAF);
1642
+ cButton resetTransform = GetButton("Reset all", !Globals.NIMBUSLAF);
1643
+ resetTransform.setToolTipText("Reset Translation, Rotation and Scale");
16421644 resetTransform.addMouseListener(new MouseAdapter()
16431645 {
16441646 public void mouseClicked(MouseEvent e)
....@@ -1648,7 +1650,8 @@
16481650 });
16491651 resetTransformPanel.add(resetTransform);
16501652
1651
- resetTransform = GetButton("T only", !Grafreed.NIMBUSLAF);
1653
+ resetTransform = GetButton("T only", !Globals.NIMBUSLAF);
1654
+ resetTransform.setToolTipText("Reset Translation only");
16521655 resetTransform.addMouseListener(new MouseAdapter()
16531656 {
16541657 public void mouseClicked(MouseEvent e)
....@@ -1658,7 +1661,8 @@
16581661 });
16591662 resetTransformPanel.add(resetTransform);
16601663
1661
- resetTransform = GetButton("RS only", !Grafreed.NIMBUSLAF);
1664
+ resetTransform = GetButton("RS only", !Globals.NIMBUSLAF);
1665
+ resetTransform.setToolTipText("Reset Rotation and Scale only");
16621666 resetTransform.addMouseListener(new MouseAdapter()
16631667 {
16641668 public void mouseClicked(MouseEvent e)
....@@ -1715,24 +1719,24 @@
17151719
17161720 //JScrollPane tmp = new JScrollPane(ctrlPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
17171721 //tmp.setName("Edit");
1722
+ objectPanel.add(skyboxPanel);
1723
+ objectPanel.setIconAt(0, GetIcon("icons/skybox.jpg"));
1724
+ objectPanel.setToolTipTextAt(0, "Backgrounds");
1725
+
17181726 objectPanel.add(toolboxPanel);
1719
- objectPanel.setIconAt(0, GetIcon("icons/primitives.png"));
1720
- objectPanel.setToolTipTextAt(0, "Objects & textures");
1727
+ objectPanel.setIconAt(1, GetIcon("icons/primitives.png"));
1728
+ objectPanel.setToolTipTextAt(1, "Objects & textures");
17211729
17221730 objectPanel.add(materialPanel);
1723
- objectPanel.setIconAt(1, GetIcon("icons/material.png"));
1724
- objectPanel.setToolTipTextAt(1, "Material");
1731
+ objectPanel.setIconAt(2, GetIcon("icons/material.png"));
1732
+ objectPanel.setToolTipTextAt(2, "Material");
17251733
1726
- objectPanel.add(skyboxPanel);
1727
- objectPanel.setIconAt(2, GetIcon("icons/skybox.jpg"));
1728
- objectPanel.setToolTipTextAt(2, "Backgrounds");
1729
-
17301734 // JPanel north = new JPanel(new BorderLayout());
17311735 // north.setName("Edit");
17321736 // north.add(ctrlPanel, BorderLayout.NORTH);
17331737 // objectPanel.add(north);
17341738 objectPanel.add(editPanel);
1735
- objectPanel.setIconAt(3, GetIcon("icons/write.png"));
1739
+ objectPanel.setIconAt(3, GetIcon("icons/writewhite.png"));
17361740 objectPanel.setToolTipTextAt(3, "Edit controls");
17371741
17381742 objectPanel.add(transformPanel);
....@@ -1741,7 +1745,7 @@
17411745
17421746 patchMaterial = true;
17431747 cameraView.patchMaterial = this;
1744
- objectPanel.setSelectedIndex(1);
1748
+ objectPanel.setSelectedIndex(2);
17451749
17461750 /*
17471751 aConstraints.gridx = 0;
....@@ -1773,17 +1777,52 @@
17731777
17741778 AddOptions(optionsPanel); //, aConstraints);
17751779
1776
- tabbedPane.add(optionsPanel);
1777
-
17781780 tabbedPane.add(FSPane = new cFileSystemPane(this));
17791781
1782
+ tabbedPane.add(optionsPanel);
1783
+
17801784 scenePanel.add(tabbedPane);
17811785
1782
- //if (Globals.ADVANCED)
1783
-// tabbedPane.add(infoPanel);
1784
-// tabbedPane.setIconAt(3, GetIcon("icons/info.png"));
1785
-// tabbedPane.setToolTipTextAt(3, "Information");
1786
+ cGridBag creditsPanel = new cGridBag().setVertical(true);
1787
+ creditsPanel.setName("Credits");
17861788
1789
+ cLabel ogaLabel = new cLabel(" Most Skyboxes courtesy of OpenGameArt!", !Globals.NIMBUSLAF);
1790
+ creditsPanel.add(ogaLabel);
1791
+
1792
+ cButton opengameartButton;
1793
+ creditsPanel.add(opengameartButton = GetButton("icons/sara-logo.png", !Globals.NIMBUSLAF));
1794
+ opengameartButton.setToolTipText("https://opengameart.org");
1795
+
1796
+ opengameartButton.addMouseListener(new MouseAdapter()
1797
+ {
1798
+ public void mouseClicked(MouseEvent e)
1799
+ {
1800
+ try
1801
+ {
1802
+ Desktop.getDesktop().browse(new java.net.URI("https://opengameart.org/"));
1803
+ } catch (Exception e1)
1804
+// } catch (java.io.IOException | java.net.URISyntaxException e1)
1805
+ {
1806
+ e1.printStackTrace();
1807
+ }
1808
+ }
1809
+ });
1810
+
1811
+ for (int i=10; --i>=0;)
1812
+ {
1813
+ creditsPanel.add(new cGridBag());
1814
+ }
1815
+
1816
+ tabbedPane.add(creditsPanel);
1817
+ tabbedPane.setToolTipTextAt(3, "Credits");
1818
+
1819
+ if (Globals.ADVANCED)
1820
+ {
1821
+ tabbedPane.add(infoPanel);
1822
+ tabbedPane.setIconAt(4, GetIcon("icons/info.png"));
1823
+ tabbedPane.setToolTipTextAt(4, "Information");
1824
+ }
1825
+
17871826 /*
17881827 cTree jTree = new cTree(null);
17891828 ToolTipManager.sharedInstance().registerComponent(jTree);
....@@ -1929,7 +1968,7 @@
19291968 {
19301969 cGridBag presetpanel = new cGridBag().setVertical(true);
19311970
1932
- cLabel skin = GetLabel("icons/shadericons/shadericon00000.png", !Grafreed.NIMBUSLAF);
1971
+ cLabel skin = GetLabel("icons/shadericons/shadericon00000.png", !Globals.NIMBUSLAF);
19331972 skin.setToolTipText("Skin");
19341973 skin.addMouseListener(new MouseAdapter()
19351974 {
....@@ -1967,7 +2006,7 @@
19672006 });
19682007 presetpanel.add(skin);
19692008
1970
- cLabel lambert = GetLabel("icons/shadericons/shadericon00002.png", !Grafreed.NIMBUSLAF);
2009
+ cLabel lambert = GetLabel("icons/shadericons/shadericon00002.png", !Globals.NIMBUSLAF);
19712010 lambert.setToolTipText("Diffuse");
19722011 lambert.addMouseListener(new MouseAdapter()
19732012 {
....@@ -1985,7 +2024,7 @@
19852024 });
19862025 presetpanel.add(lambert);
19872026
1988
- cLabel diffuse2 = GetLabel("icons/shadericons/shadericon00003.png", !Grafreed.NIMBUSLAF);
2027
+ cLabel diffuse2 = GetLabel("icons/shadericons/shadericon00003.png", !Globals.NIMBUSLAF);
19892028 diffuse2.setToolTipText("Diffuse2");
19902029 diffuse2.addMouseListener(new MouseAdapter()
19912030 {
....@@ -2003,7 +2042,7 @@
20032042 });
20042043 presetpanel.add(diffuse2);
20052044
2006
- cLabel diffusemoon = GetLabel("icons/shadericons/shadericon00004.png", !Grafreed.NIMBUSLAF);
2045
+ cLabel diffusemoon = GetLabel("icons/shadericons/shadericon00004.png", !Globals.NIMBUSLAF);
20072046 diffusemoon.setToolTipText("Moon");
20082047 diffusemoon.addMouseListener(new MouseAdapter()
20092048 {
....@@ -2021,7 +2060,7 @@
20212060 });
20222061 presetpanel.add(diffusemoon);
20232062
2024
- cLabel diffusemoon2 = GetLabel("icons/shadericons/shadericon00005.png", !Grafreed.NIMBUSLAF);
2063
+ cLabel diffusemoon2 = GetLabel("icons/shadericons/shadericon00005.png", !Globals.NIMBUSLAF);
20252064 diffusemoon2.setToolTipText("Moon2");
20262065 diffusemoon2.addMouseListener(new MouseAdapter()
20272066 {
....@@ -2039,7 +2078,7 @@
20392078 });
20402079 presetpanel.add(diffusemoon2);
20412080
2042
- cLabel diffusemoon3 = GetLabel("icons/shadericons/shadericon00006.png", !Grafreed.NIMBUSLAF);
2081
+ cLabel diffusemoon3 = GetLabel("icons/shadericons/shadericon00006.png", !Globals.NIMBUSLAF);
20432082 diffusemoon3.setToolTipText("Moon3");
20442083 diffusemoon3.addMouseListener(new MouseAdapter()
20452084 {
....@@ -2057,7 +2096,7 @@
20572096 });
20582097 presetpanel.add(diffusemoon3);
20592098
2060
- cLabel diffusesheen = GetLabel("icons/shadericons/shadericon00007.png", !Grafreed.NIMBUSLAF);
2099
+ cLabel diffusesheen = GetLabel("icons/shadericons/shadericon00007.png", !Globals.NIMBUSLAF);
20612100 diffusesheen.setToolTipText("Sheen");
20622101 diffusesheen.addMouseListener(new MouseAdapter()
20632102 {
....@@ -2074,7 +2113,7 @@
20742113 });
20752114 presetpanel.add(diffusesheen);
20762115
2077
- cLabel rough = GetLabel("icons/shadericons/shadericon00001.png", !Grafreed.NIMBUSLAF);
2116
+ cLabel rough = GetLabel("icons/shadericons/shadericon00001.png", !Globals.NIMBUSLAF);
20782117 rough.setToolTipText("Rough metal");
20792118 rough.addMouseListener(new MouseAdapter()
20802119 {
....@@ -2092,7 +2131,7 @@
20922131 });
20932132 presetpanel.add(rough);
20942133
2095
- cLabel rough2 = GetLabel("icons/shadericons/shadericon00013.png", !Grafreed.NIMBUSLAF);
2134
+ cLabel rough2 = GetLabel("icons/shadericons/shadericon00013.png", !Globals.NIMBUSLAF);
20962135 rough2.setToolTipText("Medium metal");
20972136 rough2.addMouseListener(new MouseAdapter()
20982137 {
....@@ -2110,7 +2149,7 @@
21102149 });
21112150 presetpanel.add(rough2);
21122151
2113
- cLabel shini0 = GetLabel("icons/shadericons/shadericon00014.png", !Grafreed.NIMBUSLAF);
2152
+ cLabel shini0 = GetLabel("icons/shadericons/shadericon00014.png", !Globals.NIMBUSLAF);
21142153 shini0.setToolTipText("Shiny");
21152154 shini0.addMouseListener(new MouseAdapter()
21162155 {
....@@ -2128,7 +2167,7 @@
21282167 });
21292168 presetpanel.add(shini0);
21302169
2131
- cLabel shini1 = GetLabel("icons/shadericons/shadericon00011.png", !Grafreed.NIMBUSLAF);
2170
+ cLabel shini1 = GetLabel("icons/shadericons/shadericon00011.png", !Globals.NIMBUSLAF);
21322171 shini1.setToolTipText("Shiny2");
21332172 shini1.addMouseListener(new MouseAdapter()
21342173 {
....@@ -2146,7 +2185,7 @@
21462185 });
21472186 presetpanel.add(shini1);
21482187
2149
- cLabel shini2 = GetLabel("icons/shadericons/shadericon00012.png", !Grafreed.NIMBUSLAF);
2188
+ cLabel shini2 = GetLabel("icons/shadericons/shadericon00012.png", !Globals.NIMBUSLAF);
21502189 shini2.setToolTipText("Shiny3");
21512190 shini2.addMouseListener(new MouseAdapter()
21522191 {
....@@ -2164,7 +2203,7 @@
21642203 });
21652204 presetpanel.add(shini2);
21662205
2167
- cLabel aniso = GetLabel("icons/shadericons/shadericon00008.png", !Grafreed.NIMBUSLAF);
2206
+ cLabel aniso = GetLabel("icons/shadericons/shadericon00008.png", !Globals.NIMBUSLAF);
21682207 aniso.setToolTipText("AnisoU");
21692208 aniso.addMouseListener(new MouseAdapter()
21702209 {
....@@ -2182,7 +2221,7 @@
21822221 });
21832222 presetpanel.add(aniso);
21842223
2185
- cLabel aniso2 = GetLabel("icons/shadericons/shadericon00009.png", !Grafreed.NIMBUSLAF);
2224
+ cLabel aniso2 = GetLabel("icons/shadericons/shadericon00009.png", !Globals.NIMBUSLAF);
21862225 aniso2.setToolTipText("AnisoV");
21872226 aniso2.addMouseListener(new MouseAdapter()
21882227 {
....@@ -2200,7 +2239,7 @@
22002239 });
22012240 presetpanel.add(aniso2);
22022241
2203
- cLabel aniso3 = GetLabel("icons/shadericons/shadericon00010.png", !Grafreed.NIMBUSLAF);
2242
+ cLabel aniso3 = GetLabel("icons/shadericons/shadericon00010.png", !Globals.NIMBUSLAF);
22042243 aniso3.setToolTipText("AnisoUV");
22052244 aniso3.addMouseListener(new MouseAdapter()
22062245 {
....@@ -2218,7 +2257,7 @@
22182257 });
22192258 presetpanel.add(aniso3);
22202259
2221
- cLabel velvet0 = GetLabel("icons/shadericons/shadericon00015.png", !Grafreed.NIMBUSLAF);
2260
+ cLabel velvet0 = GetLabel("icons/shadericons/shadericon00015.png", !Globals.NIMBUSLAF);
22222261 velvet0.setToolTipText("Velvet");
22232262 velvet0.addMouseListener(new MouseAdapter()
22242263 {
....@@ -2240,7 +2279,7 @@
22402279 });
22412280 presetpanel.add(velvet0);
22422281
2243
- cLabel bump0 = GetLabel("icons/shadericons/shadericon00016.png", !Grafreed.NIMBUSLAF);
2282
+ cLabel bump0 = GetLabel("icons/shadericons/shadericon00016.png", !Globals.NIMBUSLAF);
22442283 bump0.setToolTipText("Bump texture");
22452284 bump0.addMouseListener(new MouseAdapter()
22462285 {
....@@ -2259,7 +2298,7 @@
22592298 });
22602299 presetpanel.add(bump0);
22612300
2262
- cLabel borderShader = GetLabel("icons/shadericons/borderfade.jpg", !Grafreed.NIMBUSLAF);
2301
+ cLabel borderShader = GetLabel("icons/shadericons/borderfade.jpg", !Globals.NIMBUSLAF);
22632302 borderShader.setToolTipText("Border fade");
22642303 borderShader.addMouseListener(new MouseAdapter()
22652304 {
....@@ -2274,7 +2313,7 @@
22742313 });
22752314 presetpanel.add(borderShader);
22762315
2277
- cLabel halo = GetLabel("icons/shadericons/shadericon00017.png", !Grafreed.NIMBUSLAF);
2316
+ cLabel halo = GetLabel("icons/shadericons/shadericon00017.png", !Globals.NIMBUSLAF);
22782317 halo.setToolTipText("Halo");
22792318 halo.addMouseListener(new MouseAdapter()
22802319 {
....@@ -2291,7 +2330,7 @@
22912330 });
22922331 presetpanel.add(halo);
22932332
2294
- cLabel candle = GetLabel("icons/shadericons/shadericon00018.png", !Grafreed.NIMBUSLAF);
2333
+ cLabel candle = GetLabel("icons/shadericons/shadericon00018.png", !Globals.NIMBUSLAF);
22952334 candle.setToolTipText("Candle");
22962335 candle.addMouseListener(new MouseAdapter()
22972336 {
....@@ -2313,7 +2352,7 @@
23132352 });
23142353 presetpanel.add(candle);
23152354
2316
- cLabel shadowShader = GetLabel("icons/shadericons/shadow.png", !Grafreed.NIMBUSLAF);
2355
+ cLabel shadowShader = GetLabel("icons/shadericons/shadow.png", !Globals.NIMBUSLAF);
23172356 shadowShader.setToolTipText("Shadow");
23182357 shadowShader.addMouseListener(new MouseAdapter()
23192358 {
....@@ -2348,19 +2387,19 @@
23482387
23492388 cGridBag editBar = new cGridBag().setVertical(false);
23502389
2351
- editBar.add(createMaterialButton = new cButton("Create", !Grafreed.NIMBUSLAF)); // , aConstraints);
2390
+ editBar.add(createMaterialButton = new cButton("Create", !Globals.NIMBUSLAF)); // , aConstraints);
23522391 createMaterialButton.setToolTipText("Create material");
23532392
23542393 /*
23552394 ctrlPanel.add(resetSlidersButton = new cButton("Reset All"), aConstraints);
23562395 */
23572396
2358
- editBar.add(clearMaterialButton = new cButton("Clear", !Grafreed.NIMBUSLAF)); // , aConstraints);
2397
+ editBar.add(clearMaterialButton = new cButton("Clear", !Globals.NIMBUSLAF)); // , aConstraints);
23592398 clearMaterialButton.setToolTipText("Clear material");
23602399
23612400 if (Globals.ADVANCED)
23622401 {
2363
- editBar.add(resetSlidersButton = new cButton("Reset", !Grafreed.NIMBUSLAF)); // , aConstraints);
2402
+ editBar.add(resetSlidersButton = new cButton("Reset", !Globals.NIMBUSLAF)); // , aConstraints);
23642403 editBar.add(propagateToggle = new cCheckBox("Prop", propagate)); // , aConstraints);
23652404 editBar.add(multiplyToggle = new cCheckBox("Mult", false)); // , aConstraints);
23662405 }
....@@ -4161,11 +4200,18 @@
41614200
41624201 void New()
41634202 {
4164
- while (copy.Size() > 1)
4203
+ while (copy.Size() > 0)
41654204 {
4166
- copy.remove(1);
4205
+ copy.remove(0);
41674206 }
41684207
4208
+ copy.selection.clear();
4209
+
4210
+ if (copy == Grafreed.grafreed.universe)
4211
+ {
4212
+ CreateCameras();
4213
+ cameraView.SetCamera(GetCamera(copy, 0));
4214
+ }
41694215 ResetModel();
41704216 objEditor.refreshContents();
41714217 }