Normand Briere
2019-08-26 6266c8a4b2485b29a7d5bcb217460d7aad3e1c4a
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);
....@@ -119,8 +134,14 @@
119134
120135 try
121136 {
122
- BufferedImage image = javax.imageio.ImageIO.read(ObjEditor.class.getClassLoader().getResourceAsStream(name));
123
-
137
+ BufferedImage image;
138
+
139
+ if (name.endsWith("jpg"))
140
+ // Much faster!
141
+ image = new sun.awt.image.codec.JPEGImageDecoderImpl(ObjEditor.class.getClassLoader().getResourceAsStream(name)).decodeAsBufferedImage();
142
+ else
143
+ image = javax.imageio.ImageIO.read(ObjEditor.class.getClassLoader().getResourceAsStream(name));
144
+
124145 // if (image.getWidth() > 48 && image.getHeight() > 48)
125146 // {
126147 // BufferedImage resized = new BufferedImage(48, 48, image.getType());
....@@ -295,6 +316,8 @@
295316 objEditor.ctrlPanel.remove(setupPanel2);
296317 objEditor.ctrlPanel.remove(objectCommandsPanel);
297318 objEditor.ctrlPanel.remove(pushPanel);
319
+ if (versionPanel != null)
320
+ objEditor.ctrlPanel.remove(versionPanel);
298321 //objEditor.ctrlPanel.remove(fillPanel);
299322
300323 //Remove(normalpushField);
....@@ -362,14 +385,6 @@
362385 client = inClient;
363386 copy = client;
364387
365
- if (copy.versionlist == null)
366
- {
367
- copy.versionlist = new Object3D[100];
368
- copy.versionindex = -1;
369
-
370
-// Save(true);
371
- }
372
-
373388 SetupUI2(callee.GetEditor());
374389 }
375390
....@@ -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);
....@@ -1147,6 +1165,7 @@
11471165 cGridBag setupPanel2;
11481166 cGridBag objectCommandsPanel;
11491167 cGridBag pushPanel;
1168
+ cGridBag versionPanel;
11501169 cGridBag fillPanel;
11511170
11521171 JCheckBox AddCheckBox(cGridBag panel, String label, boolean on)
....@@ -1318,7 +1337,7 @@
13181337
13191338 //if (copy.pinned)
13201339 {
1321
- pinButton = GetToggleButton("icons/pin.png", !Grafreed.NIMBUSLAF);
1340
+ pinButton = GetToggleButton("icons/pin.png", !Globals.NIMBUSLAF);
13221341 pinButton.setSelected(copy.pinned);
13231342 cGridBag t = new cGridBag();
13241343 t.preferredWidth = 2;
....@@ -1393,9 +1412,14 @@
13931412 oe.ctrlPanel.add(objectCommandsPanel);
13941413 oe.ctrlPanel.Return();
13951414
1396
- pushPanel = AddSlider(oe.ctrlPanel, "Push", -1, 1, copy.NORMALPUSH, 1.1); // To have the buttons
1415
+ pushPanel = AddSlider(oe.ctrlPanel, "Push", -1, 1, copy.NORMALPUSH * 100, 1.1); // To have the buttons
13971416 normalpushField = (cNumberSlider)pushPanel.getComponent(1);
1398
- //Return();
1417
+ if (false && copy.versionlist != null && copy.versionindex != -1)
1418
+ {
1419
+ oe.ctrlPanel.Return();
1420
+ versionPanel = AddSlider(oe.ctrlPanel, "Version", 0, copy.VersionCount() - 1, copy.versionindex);
1421
+ versionField = (cNumberSlider)versionPanel.getComponent(1);
1422
+ }
13991423
14001424 oe.ctrlPanel.Return();
14011425
....@@ -1550,23 +1574,9 @@
15501574
15511575 if (cam == null || !(copy.get(0) instanceof cGroup))
15521576 {
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);
1577
+ if (Globals.DEBUG)
1578
+ System.out.println("CREATE CAMERAS");
1579
+ cams = CreateCameras();
15701580 } else
15711581 {
15721582 cams = (cGroup) copy.get(0);
....@@ -1638,7 +1648,8 @@
16381648
16391649 resetTransformPanel.preferredHeight = 2;
16401650
1641
- cButton resetTransform = GetButton("Reset all", !Grafreed.NIMBUSLAF);
1651
+ cButton resetTransform = GetButton("Reset all", !Globals.NIMBUSLAF);
1652
+ resetTransform.setToolTipText("Reset Translation, Rotation and Scale");
16421653 resetTransform.addMouseListener(new MouseAdapter()
16431654 {
16441655 public void mouseClicked(MouseEvent e)
....@@ -1648,7 +1659,8 @@
16481659 });
16491660 resetTransformPanel.add(resetTransform);
16501661
1651
- resetTransform = GetButton("T only", !Grafreed.NIMBUSLAF);
1662
+ resetTransform = GetButton("T only", !Globals.NIMBUSLAF);
1663
+ resetTransform.setToolTipText("Reset Translation only");
16521664 resetTransform.addMouseListener(new MouseAdapter()
16531665 {
16541666 public void mouseClicked(MouseEvent e)
....@@ -1658,7 +1670,8 @@
16581670 });
16591671 resetTransformPanel.add(resetTransform);
16601672
1661
- resetTransform = GetButton("RS only", !Grafreed.NIMBUSLAF);
1673
+ resetTransform = GetButton("RS only", !Globals.NIMBUSLAF);
1674
+ resetTransform.setToolTipText("Reset Rotation and Scale only");
16621675 resetTransform.addMouseListener(new MouseAdapter()
16631676 {
16641677 public void mouseClicked(MouseEvent e)
....@@ -1715,24 +1728,24 @@
17151728
17161729 //JScrollPane tmp = new JScrollPane(ctrlPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
17171730 //tmp.setName("Edit");
1731
+ objectPanel.add(skyboxPanel);
1732
+ objectPanel.setIconAt(0, GetIcon("icons/skybox.jpg"));
1733
+ objectPanel.setToolTipTextAt(0, "Backgrounds");
1734
+
17181735 objectPanel.add(toolboxPanel);
1719
- objectPanel.setIconAt(0, GetIcon("icons/primitives.png"));
1720
- objectPanel.setToolTipTextAt(0, "Objects & textures");
1736
+ objectPanel.setIconAt(1, GetIcon("icons/primitives.png"));
1737
+ objectPanel.setToolTipTextAt(1, "Objects & textures");
17211738
17221739 objectPanel.add(materialPanel);
1723
- objectPanel.setIconAt(1, GetIcon("icons/material.png"));
1724
- objectPanel.setToolTipTextAt(1, "Material");
1740
+ objectPanel.setIconAt(2, GetIcon("icons/material.png"));
1741
+ objectPanel.setToolTipTextAt(2, "Material");
17251742
1726
- objectPanel.add(skyboxPanel);
1727
- objectPanel.setIconAt(2, GetIcon("icons/skybox.jpg"));
1728
- objectPanel.setToolTipTextAt(2, "Backgrounds");
1729
-
17301743 // JPanel north = new JPanel(new BorderLayout());
17311744 // north.setName("Edit");
17321745 // north.add(ctrlPanel, BorderLayout.NORTH);
17331746 // objectPanel.add(north);
17341747 objectPanel.add(editPanel);
1735
- objectPanel.setIconAt(3, GetIcon("icons/write.png"));
1748
+ objectPanel.setIconAt(3, GetIcon("icons/writewhite.png"));
17361749 objectPanel.setToolTipTextAt(3, "Edit controls");
17371750
17381751 objectPanel.add(transformPanel);
....@@ -1741,7 +1754,7 @@
17411754
17421755 patchMaterial = true;
17431756 cameraView.patchMaterial = this;
1744
- objectPanel.setSelectedIndex(1);
1757
+ objectPanel.setSelectedIndex(2);
17451758
17461759 /*
17471760 aConstraints.gridx = 0;
....@@ -1762,7 +1775,7 @@
17621775 scrollpane.addMouseWheelListener(this); // Default not fast enough
17631776
17641777 /*JTabbedPane*/ scenePanel = new cGridBag();
1765
- scenePanel.preferredWidth = 6;
1778
+ scenePanel.preferredWidth = 5;
17661779
17671780 JTabbedPane tabbedPane = new JTabbedPane();
17681781 tabbedPane.add(scrollpane);
....@@ -1773,17 +1786,109 @@
17731786
17741787 AddOptions(optionsPanel); //, aConstraints);
17751788
1776
- tabbedPane.add(optionsPanel);
1777
-
17781789 tabbedPane.add(FSPane = new cFileSystemPane(this));
17791790
1791
+ tabbedPane.add(optionsPanel);
1792
+
17801793 scenePanel.add(tabbedPane);
17811794
1782
- //if (Globals.ADVANCED)
1783
-// tabbedPane.add(infoPanel);
1784
-// tabbedPane.setIconAt(3, GetIcon("icons/info.png"));
1785
-// tabbedPane.setToolTipTextAt(3, "Information");
1795
+ cGridBag creditsPanel = new cGridBag().setVertical(true);
1796
+ creditsPanel.setName("Credits");
17861797
1798
+ cLabel ogaLabel = new cLabel(" Skyboxes courtesy of OpenGameArt!", !Globals.NIMBUSLAF);
1799
+ creditsPanel.add(ogaLabel);
1800
+
1801
+ cButton creditButton;
1802
+ creditsPanel.add(creditButton = GetButton("icons/sara-logo.png", !Globals.NIMBUSLAF));
1803
+ creditButton.setToolTipText("https://opengameart.org");
1804
+
1805
+ creditButton.addMouseListener(new MouseAdapter()
1806
+ {
1807
+ public void mouseClicked(MouseEvent e)
1808
+ {
1809
+ try
1810
+ {
1811
+ Desktop.getDesktop().browse(new java.net.URI("https://opengameart.org/"));
1812
+ } catch (Exception e1)
1813
+// } catch (java.io.IOException | java.net.URISyntaxException e1)
1814
+ {
1815
+ e1.printStackTrace();
1816
+ }
1817
+ }
1818
+ });
1819
+
1820
+ ogaLabel = new cLabel(" Download 3D models! (.3ds and .obj only)", !Globals.NIMBUSLAF);
1821
+ creditsPanel.add(ogaLabel);
1822
+
1823
+ creditsPanel.add(creditButton = GetButton("icons/3delicious.png", !Globals.NIMBUSLAF));
1824
+ creditButton.setToolTipText("https://3delicious.net");
1825
+
1826
+ creditButton.addMouseListener(new MouseAdapter()
1827
+ {
1828
+ public void mouseClicked(MouseEvent e)
1829
+ {
1830
+ try
1831
+ {
1832
+ Desktop.getDesktop().browse(new java.net.URI("https://3delicious.net"));
1833
+ } catch (Exception e1)
1834
+// } catch (java.io.IOException | java.net.URISyntaxException e1)
1835
+ {
1836
+ e1.printStackTrace();
1837
+ }
1838
+ }
1839
+ });
1840
+
1841
+ creditsPanel.add(creditButton = GetButton("icons/archive3d.png", !Globals.NIMBUSLAF));
1842
+ creditButton.setToolTipText("https://archive3d.net");
1843
+
1844
+ creditButton.addMouseListener(new MouseAdapter()
1845
+ {
1846
+ public void mouseClicked(MouseEvent e)
1847
+ {
1848
+ try
1849
+ {
1850
+ Desktop.getDesktop().browse(new java.net.URI("https://archive3d.net"));
1851
+ } catch (Exception e1)
1852
+// } catch (java.io.IOException | java.net.URISyntaxException e1)
1853
+ {
1854
+ e1.printStackTrace();
1855
+ }
1856
+ }
1857
+ });
1858
+
1859
+ creditsPanel.add(creditButton = GetButton("icons/turbosquid.png", !Globals.NIMBUSLAF));
1860
+ creditButton.setToolTipText("https://turbosquid.com");
1861
+
1862
+ creditButton.addMouseListener(new MouseAdapter()
1863
+ {
1864
+ public void mouseClicked(MouseEvent e)
1865
+ {
1866
+ try
1867
+ {
1868
+ Desktop.getDesktop().browse(new java.net.URI("https://www.turbosquid.com/Search/3D-Models/free"));
1869
+ } catch (Exception e1)
1870
+// } catch (java.io.IOException | java.net.URISyntaxException e1)
1871
+ {
1872
+ e1.printStackTrace();
1873
+ }
1874
+ }
1875
+ });
1876
+
1877
+ for (int i=6; --i>=0;)
1878
+ {
1879
+ creditsPanel.add(new cGridBag());
1880
+ }
1881
+
1882
+ tabbedPane.add(creditsPanel);
1883
+ tabbedPane.setToolTipTextAt(3, "Credits");
1884
+
1885
+ if (Globals.ADVANCED)
1886
+ {
1887
+ objectPanel.add(infoPanel);
1888
+ objectPanel.setIconAt(5, GetIcon("icons/info.png"));
1889
+ objectPanel.setToolTipTextAt(4, "Information");
1890
+ }
1891
+
17871892 /*
17881893 cTree jTree = new cTree(null);
17891894 ToolTipManager.sharedInstance().registerComponent(jTree);
....@@ -1929,7 +2034,7 @@
19292034 {
19302035 cGridBag presetpanel = new cGridBag().setVertical(true);
19312036
1932
- cLabel skin = GetLabel("icons/shadericons/shadericon00000.png", !Grafreed.NIMBUSLAF);
2037
+ cLabel skin = GetLabel("icons/shadericons/shadericon00000.png", !Globals.NIMBUSLAF);
19332038 skin.setToolTipText("Skin");
19342039 skin.addMouseListener(new MouseAdapter()
19352040 {
....@@ -1967,7 +2072,7 @@
19672072 });
19682073 presetpanel.add(skin);
19692074
1970
- cLabel lambert = GetLabel("icons/shadericons/shadericon00002.png", !Grafreed.NIMBUSLAF);
2075
+ cLabel lambert = GetLabel("icons/shadericons/shadericon00002.png", !Globals.NIMBUSLAF);
19712076 lambert.setToolTipText("Diffuse");
19722077 lambert.addMouseListener(new MouseAdapter()
19732078 {
....@@ -1985,7 +2090,7 @@
19852090 });
19862091 presetpanel.add(lambert);
19872092
1988
- cLabel diffuse2 = GetLabel("icons/shadericons/shadericon00003.png", !Grafreed.NIMBUSLAF);
2093
+ cLabel diffuse2 = GetLabel("icons/shadericons/shadericon00003.png", !Globals.NIMBUSLAF);
19892094 diffuse2.setToolTipText("Diffuse2");
19902095 diffuse2.addMouseListener(new MouseAdapter()
19912096 {
....@@ -2003,7 +2108,7 @@
20032108 });
20042109 presetpanel.add(diffuse2);
20052110
2006
- cLabel diffusemoon = GetLabel("icons/shadericons/shadericon00004.png", !Grafreed.NIMBUSLAF);
2111
+ cLabel diffusemoon = GetLabel("icons/shadericons/shadericon00004.png", !Globals.NIMBUSLAF);
20072112 diffusemoon.setToolTipText("Moon");
20082113 diffusemoon.addMouseListener(new MouseAdapter()
20092114 {
....@@ -2021,7 +2126,7 @@
20212126 });
20222127 presetpanel.add(diffusemoon);
20232128
2024
- cLabel diffusemoon2 = GetLabel("icons/shadericons/shadericon00005.png", !Grafreed.NIMBUSLAF);
2129
+ cLabel diffusemoon2 = GetLabel("icons/shadericons/shadericon00005.png", !Globals.NIMBUSLAF);
20252130 diffusemoon2.setToolTipText("Moon2");
20262131 diffusemoon2.addMouseListener(new MouseAdapter()
20272132 {
....@@ -2039,7 +2144,7 @@
20392144 });
20402145 presetpanel.add(diffusemoon2);
20412146
2042
- cLabel diffusemoon3 = GetLabel("icons/shadericons/shadericon00006.png", !Grafreed.NIMBUSLAF);
2147
+ cLabel diffusemoon3 = GetLabel("icons/shadericons/shadericon00006.png", !Globals.NIMBUSLAF);
20432148 diffusemoon3.setToolTipText("Moon3");
20442149 diffusemoon3.addMouseListener(new MouseAdapter()
20452150 {
....@@ -2057,7 +2162,7 @@
20572162 });
20582163 presetpanel.add(diffusemoon3);
20592164
2060
- cLabel diffusesheen = GetLabel("icons/shadericons/shadericon00007.png", !Grafreed.NIMBUSLAF);
2165
+ cLabel diffusesheen = GetLabel("icons/shadericons/shadericon00007.png", !Globals.NIMBUSLAF);
20612166 diffusesheen.setToolTipText("Sheen");
20622167 diffusesheen.addMouseListener(new MouseAdapter()
20632168 {
....@@ -2074,7 +2179,7 @@
20742179 });
20752180 presetpanel.add(diffusesheen);
20762181
2077
- cLabel rough = GetLabel("icons/shadericons/shadericon00001.png", !Grafreed.NIMBUSLAF);
2182
+ cLabel rough = GetLabel("icons/shadericons/shadericon00001.png", !Globals.NIMBUSLAF);
20782183 rough.setToolTipText("Rough metal");
20792184 rough.addMouseListener(new MouseAdapter()
20802185 {
....@@ -2092,7 +2197,7 @@
20922197 });
20932198 presetpanel.add(rough);
20942199
2095
- cLabel rough2 = GetLabel("icons/shadericons/shadericon00013.png", !Grafreed.NIMBUSLAF);
2200
+ cLabel rough2 = GetLabel("icons/shadericons/shadericon00013.png", !Globals.NIMBUSLAF);
20962201 rough2.setToolTipText("Medium metal");
20972202 rough2.addMouseListener(new MouseAdapter()
20982203 {
....@@ -2110,7 +2215,7 @@
21102215 });
21112216 presetpanel.add(rough2);
21122217
2113
- cLabel shini0 = GetLabel("icons/shadericons/shadericon00014.png", !Grafreed.NIMBUSLAF);
2218
+ cLabel shini0 = GetLabel("icons/shadericons/shadericon00014.png", !Globals.NIMBUSLAF);
21142219 shini0.setToolTipText("Shiny");
21152220 shini0.addMouseListener(new MouseAdapter()
21162221 {
....@@ -2128,7 +2233,7 @@
21282233 });
21292234 presetpanel.add(shini0);
21302235
2131
- cLabel shini1 = GetLabel("icons/shadericons/shadericon00011.png", !Grafreed.NIMBUSLAF);
2236
+ cLabel shini1 = GetLabel("icons/shadericons/shadericon00011.png", !Globals.NIMBUSLAF);
21322237 shini1.setToolTipText("Shiny2");
21332238 shini1.addMouseListener(new MouseAdapter()
21342239 {
....@@ -2146,7 +2251,7 @@
21462251 });
21472252 presetpanel.add(shini1);
21482253
2149
- cLabel shini2 = GetLabel("icons/shadericons/shadericon00012.png", !Grafreed.NIMBUSLAF);
2254
+ cLabel shini2 = GetLabel("icons/shadericons/shadericon00012.png", !Globals.NIMBUSLAF);
21502255 shini2.setToolTipText("Shiny3");
21512256 shini2.addMouseListener(new MouseAdapter()
21522257 {
....@@ -2164,7 +2269,7 @@
21642269 });
21652270 presetpanel.add(shini2);
21662271
2167
- cLabel aniso = GetLabel("icons/shadericons/shadericon00008.png", !Grafreed.NIMBUSLAF);
2272
+ cLabel aniso = GetLabel("icons/shadericons/shadericon00008.png", !Globals.NIMBUSLAF);
21682273 aniso.setToolTipText("AnisoU");
21692274 aniso.addMouseListener(new MouseAdapter()
21702275 {
....@@ -2182,7 +2287,7 @@
21822287 });
21832288 presetpanel.add(aniso);
21842289
2185
- cLabel aniso2 = GetLabel("icons/shadericons/shadericon00009.png", !Grafreed.NIMBUSLAF);
2290
+ cLabel aniso2 = GetLabel("icons/shadericons/shadericon00009.png", !Globals.NIMBUSLAF);
21862291 aniso2.setToolTipText("AnisoV");
21872292 aniso2.addMouseListener(new MouseAdapter()
21882293 {
....@@ -2200,7 +2305,7 @@
22002305 });
22012306 presetpanel.add(aniso2);
22022307
2203
- cLabel aniso3 = GetLabel("icons/shadericons/shadericon00010.png", !Grafreed.NIMBUSLAF);
2308
+ cLabel aniso3 = GetLabel("icons/shadericons/shadericon00010.png", !Globals.NIMBUSLAF);
22042309 aniso3.setToolTipText("AnisoUV");
22052310 aniso3.addMouseListener(new MouseAdapter()
22062311 {
....@@ -2218,7 +2323,7 @@
22182323 });
22192324 presetpanel.add(aniso3);
22202325
2221
- cLabel velvet0 = GetLabel("icons/shadericons/shadericon00015.png", !Grafreed.NIMBUSLAF);
2326
+ cLabel velvet0 = GetLabel("icons/shadericons/shadericon00015.png", !Globals.NIMBUSLAF);
22222327 velvet0.setToolTipText("Velvet");
22232328 velvet0.addMouseListener(new MouseAdapter()
22242329 {
....@@ -2240,7 +2345,7 @@
22402345 });
22412346 presetpanel.add(velvet0);
22422347
2243
- cLabel bump0 = GetLabel("icons/shadericons/shadericon00016.png", !Grafreed.NIMBUSLAF);
2348
+ cLabel bump0 = GetLabel("icons/shadericons/shadericon00016.png", !Globals.NIMBUSLAF);
22442349 bump0.setToolTipText("Bump texture");
22452350 bump0.addMouseListener(new MouseAdapter()
22462351 {
....@@ -2259,13 +2364,13 @@
22592364 });
22602365 presetpanel.add(bump0);
22612366
2262
- cLabel borderShader = GetLabel("icons/shadericons/borderfade.jpg", !Grafreed.NIMBUSLAF);
2367
+ cLabel borderShader = GetLabel("icons/shadericons/borderfade.jpg", !Globals.NIMBUSLAF);
22632368 borderShader.setToolTipText("Border fade");
22642369 borderShader.addMouseListener(new MouseAdapter()
22652370 {
22662371 public void mouseClicked(MouseEvent e)
22672372 {
2268
- borderfadeField.setFloat(0.5);
2373
+ borderfadeField.setFloat(0.4);
22692374 opacityField.setFloat(0.75);
22702375
22712376 materialtouched = true;
....@@ -2274,7 +2379,7 @@
22742379 });
22752380 presetpanel.add(borderShader);
22762381
2277
- cLabel halo = GetLabel("icons/shadericons/shadericon00017.png", !Grafreed.NIMBUSLAF);
2382
+ cLabel halo = GetLabel("icons/shadericons/shadericon00017.png", !Globals.NIMBUSLAF);
22782383 halo.setToolTipText("Halo");
22792384 halo.addMouseListener(new MouseAdapter()
22802385 {
....@@ -2291,7 +2396,7 @@
22912396 });
22922397 presetpanel.add(halo);
22932398
2294
- cLabel candle = GetLabel("icons/shadericons/shadericon00018.png", !Grafreed.NIMBUSLAF);
2399
+ cLabel candle = GetLabel("icons/shadericons/shadericon00018.png", !Globals.NIMBUSLAF);
22952400 candle.setToolTipText("Candle");
22962401 candle.addMouseListener(new MouseAdapter()
22972402 {
....@@ -2313,7 +2418,7 @@
23132418 });
23142419 presetpanel.add(candle);
23152420
2316
- cLabel shadowShader = GetLabel("icons/shadericons/shadow.png", !Grafreed.NIMBUSLAF);
2421
+ cLabel shadowShader = GetLabel("icons/shadericons/shadow.png", !Globals.NIMBUSLAF);
23172422 shadowShader.setToolTipText("Shadow");
23182423 shadowShader.addMouseListener(new MouseAdapter()
23192424 {
....@@ -2324,13 +2429,55 @@
23242429 cameraField.setFloat(0.001);
23252430 specularField.setFloat(0.001);
23262431 fakedepthField.setFloat(0.001);
2327
- opacityField.setFloat(0.6);
2432
+ opacityField.setFloat(0.4);
23282433
23292434 materialtouched = true;
23302435 applySelf();
23312436 }
23322437 });
23332438 presetpanel.add(shadowShader);
2439
+
2440
+ cLabel para0 = GetLabel("icons/shadericons/parallax0.png", !Globals.NIMBUSLAF);
2441
+ para0.setToolTipText("No parallax");
2442
+ para0.addMouseListener(new MouseAdapter()
2443
+ {
2444
+ public void mouseClicked(MouseEvent e)
2445
+ {
2446
+ parallaxField.setFloat(0.125);
2447
+
2448
+ materialtouched = true;
2449
+ applySelf();
2450
+ }
2451
+ });
2452
+ presetpanel.add(para0);
2453
+
2454
+ cLabel para1 = GetLabel("icons/shadericons/parallax1.png", !Globals.NIMBUSLAF);
2455
+ para1.setToolTipText("With parallax");
2456
+ para1.addMouseListener(new MouseAdapter()
2457
+ {
2458
+ public void mouseClicked(MouseEvent e)
2459
+ {
2460
+ parallaxField.setFloat(0.13);
2461
+
2462
+ materialtouched = true;
2463
+ applySelf();
2464
+ }
2465
+ });
2466
+ presetpanel.add(para1);
2467
+
2468
+ cLabel para2 = GetLabel("icons/shadericons/parallax2.png", !Globals.NIMBUSLAF);
2469
+ para2.setToolTipText("Reset parallax");
2470
+ para2.addMouseListener(new MouseAdapter()
2471
+ {
2472
+ public void mouseClicked(MouseEvent e)
2473
+ {
2474
+ parallaxField.setFloat(0.14);
2475
+
2476
+ materialtouched = true;
2477
+ applySelf();
2478
+ }
2479
+ });
2480
+ presetpanel.add(para2);
23342481
23352482 cGridBag panel = new cGridBag().setVertical(true);
23362483
....@@ -2348,19 +2495,19 @@
23482495
23492496 cGridBag editBar = new cGridBag().setVertical(false);
23502497
2351
- editBar.add(createMaterialButton = new cButton("Create", !Grafreed.NIMBUSLAF)); // , aConstraints);
2498
+ editBar.add(createMaterialButton = new cButton("Create", !Globals.NIMBUSLAF)); // , aConstraints);
23522499 createMaterialButton.setToolTipText("Create material");
23532500
23542501 /*
23552502 ctrlPanel.add(resetSlidersButton = new cButton("Reset All"), aConstraints);
23562503 */
23572504
2358
- editBar.add(clearMaterialButton = new cButton("Clear", !Grafreed.NIMBUSLAF)); // , aConstraints);
2505
+ editBar.add(clearMaterialButton = new cButton("Clear", !Globals.NIMBUSLAF)); // , aConstraints);
23592506 clearMaterialButton.setToolTipText("Clear material");
23602507
23612508 if (Globals.ADVANCED)
23622509 {
2363
- editBar.add(resetSlidersButton = new cButton("Reset", !Grafreed.NIMBUSLAF)); // , aConstraints);
2510
+ editBar.add(resetSlidersButton = new cButton("Reset", !Globals.NIMBUSLAF)); // , aConstraints);
23642511 editBar.add(propagateToggle = new cCheckBox("Prop", propagate)); // , aConstraints);
23652512 editBar.add(multiplyToggle = new cCheckBox("Mult", false)); // , aConstraints);
23662513 }
....@@ -2577,6 +2724,12 @@
25772724 backlit.add(backlitField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
25782725 colorSection.add(backlit);
25792726
2727
+ cGridBag parallax = new cGridBag();
2728
+ parallax.add(parallaxLabel = new JLabel("Parallax")); // , aConstraints);
2729
+ parallaxLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2730
+ parallax.add(parallaxField = new cNumberSlider(this, 0.001, 0.25, -0.125)); // , aConstraints);
2731
+ colorSection.add(parallax);
2732
+
25802733 //panel.add(new JSeparator());
25812734
25822735 //panel.add(globalSection);
....@@ -3628,6 +3781,7 @@
36283781 shadowField.setFloat(mat.shadow);
36293782 textureField.setFloat(mat.texture);
36303783 opacityField.setFloat(mat.opacity);
3784
+ parallaxField.setFloat(mat.parallax + 0.125f);
36313785 fakedepthField.setFloat(mat.fakedepth);
36323786 shadowbiasField.setFloat(mat.shadowbias);
36333787 bumpField.setInteger(1); // dec 2013
....@@ -3921,6 +4075,7 @@
39214075 } else if (event.getSource() == link2masterCB)
39224076 {
39234077 copy.link2master ^= true;
4078
+ objEditor.refreshContents();
39244079 return;
39254080 }
39264081 if (event.getSource() == randomCB)
....@@ -4161,11 +4316,18 @@
41614316
41624317 void New()
41634318 {
4164
- while (copy.Size() > 1)
4319
+ while (copy.Size() > 0)
41654320 {
4166
- copy.remove(1);
4321
+ copy.remove(0);
41674322 }
41684323
4324
+ copy.selection.clear();
4325
+
4326
+ if (copy == Grafreed.grafreed.universe)
4327
+ {
4328
+ CreateCameras();
4329
+ cameraView.SetCamera(GetCamera(copy, 0));
4330
+ }
41694331 ResetModel();
41704332 objEditor.refreshContents();
41714333 }
....@@ -4304,7 +4466,7 @@
43044466 copy.versionindex -= 1;
43054467
43064468 if (copy.versionindex != -1)
4307
- CopyChanged();
4469
+ CopyChanged(copy);
43084470
43094471 SetVersionStates();
43104472 }
....@@ -4314,7 +4476,11 @@
43144476 System.err.println("Save");
43154477 Replace();
43164478
4317
- //cRadio tab = GetCurrentTab();
4479
+ if (copy.versionlist == null)
4480
+ {
4481
+ copy.versionlist = new Object3D[100];
4482
+ copy.versionindex = -1;
4483
+ }
43184484
43194485 Object3D compress = Duplicate(copy); // Saved version. No need for "Replace"?
43204486
....@@ -4382,20 +4548,20 @@
43824548 {
43834549 Object3D selection = new Object3D();
43844550
4385
- for (int i = 0; i < copy.selection.size(); i++)
4551
+ for (int i = 0; i < objEditor.copy.selection.size(); i++)
43864552 {
4387
- Object3D elem = copy.selection.elementAt(i);
4553
+ Object3D elem = objEditor.copy.selection.elementAt(i);
43884554
4389
- Object3D obj = copy.GetObject(elem.GetUUID());
4555
+ Object3D obj = objEditor.copy.GetObject(elem.GetUUID());
43904556
43914557 if (obj == null)
43924558 {
4393
- copy.selection.remove(i--);
4559
+ objEditor.copy.selection.remove(i--);
43944560 }
43954561 else
43964562 {
43974563 selection.add(obj);
4398
- copy.selection.setElementAt(obj, i);
4564
+ objEditor.copy.selection.setElementAt(obj, i);
43994565 }
44004566 }
44014567
....@@ -4408,44 +4574,43 @@
44084574 //refreshContents(false);
44094575 }
44104576
4411
- void CopyChanged()
4577
+ void CopyChanged(Object3D changed)
44124578 {
4413
- Object3D obj = (Object3D)Grafreed.clone(copy.versionlist[copy.versionindex]);
4414
-
4415
- SetVersionStates();
4579
+ Object3D obj = (Object3D)Grafreed.clone(changed.versionlist[copy.versionindex]);
44164580
44174581 boolean temp = CameraPane.SWITCH;
44184582 CameraPane.SWITCH = false;
44194583
4420
- copy.ExtractBigData(Grafreed.grafreed.universe.versiontable);
4584
+ changed.ExtractBigData(Grafreed.grafreed.universe.versiontable);
44214585
4422
- copy.clear();
4586
+ changed.clear();
44234587
4424
- copy.skyboxname = obj.skyboxname;
4425
- copy.skyboxext = obj.skyboxext;
4588
+ changed.skyboxname = obj.skyboxname;
4589
+ changed.skyboxext = obj.skyboxext;
44264590
44274591 for (int i=0; i<obj.Size(); i++)
44284592 {
4429
- copy.add(obj.get(i));
4593
+ changed.add(obj.get(i));
44304594 }
44314595
4432
- copy.RestoreBigData(Grafreed.grafreed.universe.versiontable);
4596
+ changed.RestoreBigData(Grafreed.grafreed.universe.versiontable);
44334597
44344598 CameraPane.SWITCH = temp;
44354599
4436
- RefreshSelection();
4600
+ if (objEditor == this)
4601
+ RefreshSelection();
44374602 //assert(hashtable.isEmpty());
44384603
4439
- copy.Touch();
4604
+ objEditor.copy.Touch();
44404605
44414606 ResetModel();
4442
- copy.HardTouch(); // recompile?
4607
+ objEditor.copy.HardTouch(); // recompile?
44434608
44444609 cRadio ab;
4445
- for (java.util.Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
4610
+ for (java.util.Enumeration e = objEditor.buttonGroup.getElements(); e.hasMoreElements();)
44464611 {
44474612 ab = (cRadio)e.nextElement();
4448
- Object3D test = copy.GetObject(ab.object.GetUUID());
4613
+ Object3D test = objEditor.copy.GetObject(ab.object.GetUUID());
44494614 //ab.camera = (Camera)copy.GetObject(ab.camera.GetUUID());
44504615 if (test != null)
44514616 {
....@@ -4454,7 +4619,7 @@
44544619 }
44554620 }
44564621
4457
- refreshContents(true);
4622
+ objEditor.refreshContents(true);
44584623 }
44594624
44604625 cButton previousVersionButton;
....@@ -4468,15 +4633,7 @@
44684633
44694634 int VersionCount()
44704635 {
4471
- int count = 0;
4472
-
4473
- for (int i = copy.versionlist.length; --i >= 0;)
4474
- {
4475
- if (copy.versionlist[i] != null)
4476
- count++;
4477
- }
4478
-
4479
- return count;
4636
+ return copy.VersionCount();
44804637 }
44814638
44824639 public cGridBag versionSliderPane;
....@@ -4488,7 +4645,7 @@
44884645
44894646 //cRadio tab = GetCurrentTab();
44904647
4491
- if (copy.versionlist == null)
4648
+ if (copy.versionindex == -2)
44924649 {
44934650 saveVersionButton.setEnabled(false);
44944651 restoreButton.setEnabled(false);
....@@ -4550,7 +4707,9 @@
45504707
45514708 copy.versionindex -= 1;
45524709
4553
- CopyChanged();
4710
+ CopyChanged(copy);
4711
+
4712
+ SetVersionStates();
45544713
45554714 return true;
45564715 }
....@@ -4568,7 +4727,9 @@
45684727 }
45694728
45704729 //CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex]));
4571
- CopyChanged();
4730
+ CopyChanged(copy);
4731
+
4732
+ SetVersionStates();
45724733
45734734 return true;
45744735 }
....@@ -4605,10 +4766,12 @@
46054766
46064767 copy.versionindex += 1;
46074768
4608
- CopyChanged();
4769
+ CopyChanged(copy);
46094770
46104771 //if (!tab.user[tab.versionindex])
46114772 // tab.graphs[tab.versionindex] = null;
4773
+
4774
+ SetVersionStates();
46124775 }
46134776
46144777 void ImportGFD()
....@@ -4845,6 +5008,7 @@
48455008 current.shadow = (float) shadowField.getFloat();
48465009 current.texture = (float) textureField.getFloat();
48475010 current.opacity = (float) opacityField.getFloat();
5011
+ current.parallax = (float) parallaxField.getFloat() - 0.125f;
48485012 current.fakedepth = (float) fakedepthField.getFloat();
48495013 current.shadowbias = (float) shadowbiasField.getFloat();
48505014
....@@ -4899,6 +5063,8 @@
48995063 textureField.SetToolTipValue((mat.texture));
49005064 if (!Equal(opacityField.getFloat(), mat.opacity))
49015065 opacityField.SetToolTipValue((mat.opacity));
5066
+ //if (!Equal(parallaxField.getFloat(), mat.parallax))
5067
+ parallaxField.SetToolTipValue((mat.parallax));
49025068 if (!Equal(fakedepthField.getFloat(), mat.fakedepth))
49035069 fakedepthField.SetToolTipValue((mat.fakedepth));
49045070 if (!Equal(shadowbiasField.getFloat(), mat.shadowbias))
....@@ -4934,6 +5100,7 @@
49345100 }
49355101
49365102 cNumberSlider versionSlider;
5103
+ cNumberSlider versionField;
49375104
49385105 public void stateChanged(ChangeEvent e)
49395106 {
....@@ -4950,12 +5117,26 @@
49505117 if (version != -1 && copy.versionlist[version] != null)
49515118 {
49525119 copy.versionindex = version;
4953
- CopyChanged();
5120
+ CopyChanged(copy);
5121
+ SetVersionStates();
49545122 }
49555123
49565124 return;
49575125 }
49585126
5127
+ if (e.getSource() == versionField)
5128
+ {
5129
+ int version = versionField.getInteger();
5130
+
5131
+ if (version != -1 && copy.versionindex != version && copy.versionlist[version] != null)
5132
+ {
5133
+ copy.versionindex = version;
5134
+ CopyChanged(copy);
5135
+ }
5136
+
5137
+ return;
5138
+ }
5139
+
49595140 if (freezematerial)
49605141 {
49615142 return;
....@@ -5045,7 +5226,7 @@
50455226 }
50465227
50475228 if (normalpushField != null)
5048
- copy.NORMALPUSH = (float)normalpushField.getFloat()/100;
5229
+ copy.NORMALPUSH = (float)normalpushField.getFloat() / 100;
50495230 }
50505231
50515232 void SnapObject()
....@@ -5419,7 +5600,7 @@
54195600 void ResetModel()
54205601 {
54215602 //assert(copy instanceof Composite);
5422
- Object3D /*Composite*/ group = (Object3D /*Composite*/) copy;
5603
+ Object3D /*Composite*/ group = (Object3D /*Composite*/) objEditor.copy;
54235604
54245605 // necessary? group.selection = new Object3D(); // java.util.Vector();
54255606
....@@ -5430,14 +5611,14 @@
54305611 //group.refreshEditWindow();
54315612 //refreshContents();
54325613
5433
- if (copy.selection == null)
5614
+ if (objEditor.copy.selection == null)
54345615 {
5435
- copy.selection = new Object3D();
5616
+ objEditor.copy.selection = new Object3D();
54365617 }
54375618
5438
- for (int j = 0; j < copy.selection.size(); j++)
5619
+ for (int j = 0; j < objEditor.copy.selection.size(); j++)
54395620 {
5440
- Object3D item = copy.selection.get(j);
5621
+ Object3D item = objEditor.copy.selection.get(j);
54415622
54425623 if (item instanceof cGroup && ((cGroup) item).transientlink)
54435624 {
....@@ -5446,15 +5627,15 @@
54465627
54475628 if (item.count <= 1) // ??? == 0)
54485629 {
5449
- copy.selection.remove(item);
5630
+ objEditor.copy.selection.remove(item);
54505631 }
54515632 }
54525633
54535634 boolean first = true;
54545635
5455
- for (int i = copy.selection.size(); --i >= 0;)
5636
+ for (int i = objEditor.copy.selection.size(); --i >= 0;)
54565637 {
5457
- Object3D item = copy.selection.get(i);
5638
+ Object3D item = objEditor.copy.selection.get(i);
54585639
54595640 if (item instanceof cGroup && ((cGroup) item).transientlink)
54605641 {
....@@ -6155,6 +6336,8 @@
61556336 cNumberSlider textureField;
61566337 JLabel opacityLabel;
61576338 cNumberSlider opacityField;
6339
+ JLabel parallaxLabel;
6340
+ cNumberSlider parallaxField;
61586341 JLabel fakedepthLabel;
61596342 cNumberSlider fakedepthField;
61606343 JLabel shadowbiasLabel;