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,10 @@
8398 cButton GetButton(String name, boolean border)
8499 {
85100 ImageIcon icon = GetIcon(name);
86
- return new cButton(icon, border);
101
+ if (icon != null || name.contains("/"))
102
+ return new cButton(icon, border);
103
+ else
104
+ return new cButton(name, border);
87105 }
88106
89107 cLabel GetLabel(String name, boolean border)
....@@ -106,7 +124,7 @@
106124
107125 static java.util.Hashtable<String, javax.swing.ImageIcon> icons = new java.util.Hashtable<String, javax.swing.ImageIcon>();
108126
109
- ImageIcon GetIcon(String name)
127
+ static ImageIcon GetIcon(String name)
110128 {
111129 javax.swing.ImageIcon iconCache = icons.get(name);
112130 if (iconCache != null)
....@@ -116,7 +134,7 @@
116134
117135 try
118136 {
119
- BufferedImage image = javax.imageio.ImageIO.read(getClass().getClassLoader().getResourceAsStream(name));
137
+ BufferedImage image = javax.imageio.ImageIO.read(ObjEditor.class.getClassLoader().getResourceAsStream(name));
120138
121139 // if (image.getWidth() > 48 && image.getHeight() > 48)
122140 // {
....@@ -426,6 +444,9 @@
426444
427445 static java.util.Vector<Object3D> listUI = new java.util.Vector<Object3D>();
428446
447
+ // This is to refresh the UI of the material panel.
448
+ boolean patchMaterial;
449
+
429450 void SetupMenu()
430451 {
431452 frame.setMenuBar(menuBar = new MenuBar());
....@@ -962,8 +983,13 @@
962983 object.versionlist = null;
963984 object.versiontable = null;
964985
986
+ Object3D parent = object.parent;
987
+ object.parent = null;
988
+
965989 //byte[] compress = Compress(copy);
966990 Object3D compress = (Object3D)Grafreed.clone(object);
991
+
992
+ object.parent = parent;
967993
968994 object.versionlist = versions;
969995 object.versiontable = versiontable; // if Grafreed.grafreed.universe
....@@ -1307,7 +1333,7 @@
13071333
13081334 //if (copy.pinned)
13091335 {
1310
- pinButton = GetToggleButton("icons/pin.png", !Grafreed.NIMBUSLAF);
1336
+ pinButton = GetToggleButton("icons/pin.png", !Globals.NIMBUSLAF);
13111337 pinButton.setSelected(copy.pinned);
13121338 cGridBag t = new cGridBag();
13131339 t.preferredWidth = 2;
....@@ -1539,23 +1565,9 @@
15391565
15401566 if (cam == null || !(copy.get(0) instanceof cGroup))
15411567 {
1542
- if (Globals.DEBUG)
1543
- System.out.println("CREATE CAMERAS");
1544
- cams = new cTemplate();
1545
- cams.name = "Cameras";
1546
- copy.insertElementAt(cams, 0);
1547
- //cams.parent = copy;
1548
-
1549
- cam = new Camera(); // LA.newVector(3, 2, 1));
1550
- cams.addChild(cam);
1551
- cam = new Camera(1);
1552
- cams.addChild(cam);
1553
- cam = new Camera(2);
1554
- cams.addChild(cam);
1555
- cam = new Camera(3);
1556
- cams.addChild(cam);
1557
- cam = new Camera(4); // Light
1558
- cams.addChild(cam);
1568
+ if (Globals.DEBUG)
1569
+ System.out.println("CREATE CAMERAS");
1570
+ cams = CreateCameras();
15591571 } else
15601572 {
15611573 cams = (cGroup) copy.get(0);
....@@ -1621,6 +1633,45 @@
16211633 //frontView.object = copy;
16221634 //sideView.object = copy;
16231635
1636
+ transformPanel = new cGridBag().setVertical(true);
1637
+
1638
+ cGridBag resetTransformPanel = new cGridBag();
1639
+
1640
+ resetTransformPanel.preferredHeight = 2;
1641
+
1642
+ cButton resetTransform = GetButton("Reset all", !Globals.NIMBUSLAF);
1643
+ resetTransform.setToolTipText("Reset Translation, Rotation and Scale");
1644
+ resetTransform.addMouseListener(new MouseAdapter()
1645
+ {
1646
+ public void mouseClicked(MouseEvent e)
1647
+ {
1648
+ ResetTransform();
1649
+ }
1650
+ });
1651
+ resetTransformPanel.add(resetTransform);
1652
+
1653
+ resetTransform = GetButton("T only", !Globals.NIMBUSLAF);
1654
+ resetTransform.setToolTipText("Reset Translation only");
1655
+ resetTransform.addMouseListener(new MouseAdapter()
1656
+ {
1657
+ public void mouseClicked(MouseEvent e)
1658
+ {
1659
+ ResetTransform(1);
1660
+ }
1661
+ });
1662
+ resetTransformPanel.add(resetTransform);
1663
+
1664
+ resetTransform = GetButton("RS only", !Globals.NIMBUSLAF);
1665
+ resetTransform.setToolTipText("Reset Rotation and Scale only");
1666
+ resetTransform.addMouseListener(new MouseAdapter()
1667
+ {
1668
+ public void mouseClicked(MouseEvent e)
1669
+ {
1670
+ ResetTransform(2);
1671
+ }
1672
+ });
1673
+ resetTransformPanel.add(resetTransform);
1674
+
16241675 XYZPanel = new cGridBag().setVertical(true);
16251676 //XYZPanel.setLayout(new GridLayout(3, 1, 5, 5));
16261677
....@@ -1630,6 +1681,9 @@
16301681 XYZPanel.addComponent(/*BorderLayout.NORTH,*/topView); // Scroll);
16311682 //XYZPanel.setName("XYZ");
16321683
1684
+ transformPanel.add(resetTransformPanel);
1685
+ transformPanel.add(XYZPanel);
1686
+
16331687 /*
16341688 gridPanel = new JPanel(); //new BorderLayout());
16351689 gridPanel.setLayout(new GridLayout(1, 2));
....@@ -1637,12 +1691,12 @@
16371691 gridPanel.add(cameraView);
16381692 gridPanel.add(XYZPanel);
16391693 */
1640
- gridPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, centralPanel, XYZPanel); //new BorderLayout());
1641
- gridPanel.setContinuousLayout(true);
1642
- gridPanel.setOneTouchExpandable(true);
1643
- gridPanel.setDividerLocation(1.0);
1644
- gridPanel.setDividerSize(9);
1645
- gridPanel.setResizeWeight(0.85);
1694
+// gridPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, centralPanel, XYZPanel); //new BorderLayout());
1695
+// gridPanel.setContinuousLayout(true);
1696
+// gridPanel.setOneTouchExpandable(true);
1697
+// gridPanel.setDividerLocation(1.0);
1698
+// gridPanel.setDividerSize(9);
1699
+// gridPanel.setResizeWeight(0.85);
16461700
16471701 // aConstraints.weighty = 0;
16481702 //System.out.println("THIS = " + this);
....@@ -1665,30 +1719,34 @@
16651719
16661720 //JScrollPane tmp = new JScrollPane(ctrlPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
16671721 //tmp.setName("Edit");
1722
+ objectPanel.add(skyboxPanel);
1723
+ objectPanel.setIconAt(0, GetIcon("icons/skybox.jpg"));
1724
+ objectPanel.setToolTipTextAt(0, "Backgrounds");
1725
+
16681726 objectPanel.add(toolboxPanel);
1669
- objectPanel.setIconAt(0, GetIcon("icons/primitives.png"));
1670
- objectPanel.setToolTipTextAt(0, "Objects & textures");
1727
+ objectPanel.setIconAt(1, GetIcon("icons/primitives.png"));
1728
+ objectPanel.setToolTipTextAt(1, "Objects & textures");
16711729
16721730 objectPanel.add(materialPanel);
1673
- objectPanel.setIconAt(1, GetIcon("icons/material.png"));
1674
- objectPanel.setToolTipTextAt(1, "Material");
1731
+ objectPanel.setIconAt(2, GetIcon("icons/material.png"));
1732
+ objectPanel.setToolTipTextAt(2, "Material");
16751733
1676
- objectPanel.add(skyboxPanel);
1677
- objectPanel.setIconAt(2, GetIcon("icons/skybox.jpg"));
1678
- objectPanel.setToolTipTextAt(2, "Backgrounds");
1679
-
16801734 // JPanel north = new JPanel(new BorderLayout());
16811735 // north.setName("Edit");
16821736 // north.add(ctrlPanel, BorderLayout.NORTH);
16831737 // objectPanel.add(north);
16841738 objectPanel.add(editPanel);
1685
- objectPanel.setIconAt(3, GetIcon("icons/write.png"));
1739
+ objectPanel.setIconAt(3, GetIcon("icons/writewhite.png"));
16861740 objectPanel.setToolTipTextAt(3, "Edit controls");
16871741
1688
- objectPanel.add(XYZPanel);
1742
+ objectPanel.add(transformPanel);
16891743 objectPanel.setIconAt(4, GetIcon("icons/XYZ.png"));
1690
- objectPanel.setToolTipTextAt(4, "XYZ/RGB transform");
1744
+ objectPanel.setToolTipTextAt(4, "TRS transform");
16911745
1746
+ patchMaterial = true;
1747
+ cameraView.patchMaterial = this;
1748
+ objectPanel.setSelectedIndex(2);
1749
+
16921750 /*
16931751 aConstraints.gridx = 0;
16941752 aConstraints.gridwidth = 1;
....@@ -1708,7 +1766,7 @@
17081766 scrollpane.addMouseWheelListener(this); // Default not fast enough
17091767
17101768 /*JTabbedPane*/ scenePanel = new cGridBag();
1711
- scenePanel.preferredWidth = 5;
1769
+ scenePanel.preferredWidth = 6;
17121770
17131771 JTabbedPane tabbedPane = new JTabbedPane();
17141772 tabbedPane.add(scrollpane);
....@@ -1719,17 +1777,52 @@
17191777
17201778 AddOptions(optionsPanel); //, aConstraints);
17211779
1722
- tabbedPane.add(optionsPanel);
1723
-
17241780 tabbedPane.add(FSPane = new cFileSystemPane(this));
17251781
1782
+ tabbedPane.add(optionsPanel);
1783
+
17261784 scenePanel.add(tabbedPane);
17271785
1728
- //if (Globals.ADVANCED)
1729
-// tabbedPane.add(infoPanel);
1730
-// tabbedPane.setIconAt(3, GetIcon("icons/info.png"));
1731
-// tabbedPane.setToolTipTextAt(3, "Information");
1786
+ cGridBag creditsPanel = new cGridBag().setVertical(true);
1787
+ creditsPanel.setName("Credits");
17321788
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
+
17331826 /*
17341827 cTree jTree = new cTree(null);
17351828 ToolTipManager.sharedInstance().registerComponent(jTree);
....@@ -1750,13 +1843,13 @@
17501843 jtp.add(tree);
17511844 */
17521845
1753
- bigPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, scenePanel, gridPanel);
1754
- bigPanel.setContinuousLayout(true);
1755
- bigPanel.setOneTouchExpandable(true);
1756
- bigPanel.setDividerLocation(0.8);
1757
- bigPanel.setDividerSize(15);
1758
- bigPanel.setResizeWeight(0.15);
1759
- bigPanel.setName("Scene");
1846
+// bigPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, scenePanel, gridPanel);
1847
+// bigPanel.setContinuousLayout(true);
1848
+// bigPanel.setOneTouchExpandable(true);
1849
+// bigPanel.setDividerLocation(0.8);
1850
+// bigPanel.setDividerSize(15);
1851
+// bigPanel.setResizeWeight(0.15);
1852
+// bigPanel.setName("Scene");
17601853
17611854 //bigPanel.setLayout(new BorderLayout());
17621855 //bigPanel.setSize(new Dimension(10,10));
....@@ -1840,7 +1933,7 @@
18401933
18411934 cameraView.requestFocusInWindow();
18421935
1843
- gridPanel.setDividerLocation(1.0);
1936
+// gridPanel.setDividerLocation(1.0);
18441937
18451938 frame.validate();
18461939
....@@ -1875,7 +1968,7 @@
18751968 {
18761969 cGridBag presetpanel = new cGridBag().setVertical(true);
18771970
1878
- cLabel skin = GetLabel("icons/shadericons/shadericon00000.png", !Grafreed.NIMBUSLAF);
1971
+ cLabel skin = GetLabel("icons/shadericons/shadericon00000.png", !Globals.NIMBUSLAF);
18791972 skin.setToolTipText("Skin");
18801973 skin.addMouseListener(new MouseAdapter()
18811974 {
....@@ -1886,7 +1979,15 @@
18861979
18871980 // Skin
18881981 colorField.setFloat(material.color);
1889
- saturationField.setFloat(material.modulation);
1982
+ float saturation = material.modulation;
1983
+
1984
+ if (!cameraView.Skinshader)
1985
+ {
1986
+ saturation /= 1.5;
1987
+ }
1988
+
1989
+ saturationField.setFloat(saturation);
1990
+
18901991 subsurfaceField.setFloat(material.subsurface);
18911992 selfshadowField.setFloat(material.diffuseness);
18921993 diffusenessField.setFloat(material.factor);
....@@ -1905,7 +2006,7 @@
19052006 });
19062007 presetpanel.add(skin);
19072008
1908
- cLabel lambert = GetLabel("icons/shadericons/shadericon00002.png", !Grafreed.NIMBUSLAF);
2009
+ cLabel lambert = GetLabel("icons/shadericons/shadericon00002.png", !Globals.NIMBUSLAF);
19092010 lambert.setToolTipText("Diffuse");
19102011 lambert.addMouseListener(new MouseAdapter()
19112012 {
....@@ -1923,7 +2024,7 @@
19232024 });
19242025 presetpanel.add(lambert);
19252026
1926
- cLabel diffuse2 = GetLabel("icons/shadericons/shadericon00003.png", !Grafreed.NIMBUSLAF);
2027
+ cLabel diffuse2 = GetLabel("icons/shadericons/shadericon00003.png", !Globals.NIMBUSLAF);
19272028 diffuse2.setToolTipText("Diffuse2");
19282029 diffuse2.addMouseListener(new MouseAdapter()
19292030 {
....@@ -1941,7 +2042,7 @@
19412042 });
19422043 presetpanel.add(diffuse2);
19432044
1944
- cLabel diffusemoon = GetLabel("icons/shadericons/shadericon00004.png", !Grafreed.NIMBUSLAF);
2045
+ cLabel diffusemoon = GetLabel("icons/shadericons/shadericon00004.png", !Globals.NIMBUSLAF);
19452046 diffusemoon.setToolTipText("Moon");
19462047 diffusemoon.addMouseListener(new MouseAdapter()
19472048 {
....@@ -1959,7 +2060,7 @@
19592060 });
19602061 presetpanel.add(diffusemoon);
19612062
1962
- cLabel diffusemoon2 = GetLabel("icons/shadericons/shadericon00005.png", !Grafreed.NIMBUSLAF);
2063
+ cLabel diffusemoon2 = GetLabel("icons/shadericons/shadericon00005.png", !Globals.NIMBUSLAF);
19632064 diffusemoon2.setToolTipText("Moon2");
19642065 diffusemoon2.addMouseListener(new MouseAdapter()
19652066 {
....@@ -1977,7 +2078,7 @@
19772078 });
19782079 presetpanel.add(diffusemoon2);
19792080
1980
- cLabel diffusemoon3 = GetLabel("icons/shadericons/shadericon00006.png", !Grafreed.NIMBUSLAF);
2081
+ cLabel diffusemoon3 = GetLabel("icons/shadericons/shadericon00006.png", !Globals.NIMBUSLAF);
19812082 diffusemoon3.setToolTipText("Moon3");
19822083 diffusemoon3.addMouseListener(new MouseAdapter()
19832084 {
....@@ -1995,7 +2096,7 @@
19952096 });
19962097 presetpanel.add(diffusemoon3);
19972098
1998
- cLabel diffusesheen = GetLabel("icons/shadericons/shadericon00007.png", !Grafreed.NIMBUSLAF);
2099
+ cLabel diffusesheen = GetLabel("icons/shadericons/shadericon00007.png", !Globals.NIMBUSLAF);
19992100 diffusesheen.setToolTipText("Sheen");
20002101 diffusesheen.addMouseListener(new MouseAdapter()
20012102 {
....@@ -2012,7 +2113,7 @@
20122113 });
20132114 presetpanel.add(diffusesheen);
20142115
2015
- cLabel rough = GetLabel("icons/shadericons/shadericon00001.png", !Grafreed.NIMBUSLAF);
2116
+ cLabel rough = GetLabel("icons/shadericons/shadericon00001.png", !Globals.NIMBUSLAF);
20162117 rough.setToolTipText("Rough metal");
20172118 rough.addMouseListener(new MouseAdapter()
20182119 {
....@@ -2030,7 +2131,7 @@
20302131 });
20312132 presetpanel.add(rough);
20322133
2033
- cLabel rough2 = GetLabel("icons/shadericons/shadericon00013.png", !Grafreed.NIMBUSLAF);
2134
+ cLabel rough2 = GetLabel("icons/shadericons/shadericon00013.png", !Globals.NIMBUSLAF);
20342135 rough2.setToolTipText("Medium metal");
20352136 rough2.addMouseListener(new MouseAdapter()
20362137 {
....@@ -2048,7 +2149,7 @@
20482149 });
20492150 presetpanel.add(rough2);
20502151
2051
- cLabel shini0 = GetLabel("icons/shadericons/shadericon00014.png", !Grafreed.NIMBUSLAF);
2152
+ cLabel shini0 = GetLabel("icons/shadericons/shadericon00014.png", !Globals.NIMBUSLAF);
20522153 shini0.setToolTipText("Shiny");
20532154 shini0.addMouseListener(new MouseAdapter()
20542155 {
....@@ -2066,7 +2167,7 @@
20662167 });
20672168 presetpanel.add(shini0);
20682169
2069
- cLabel shini1 = GetLabel("icons/shadericons/shadericon00011.png", !Grafreed.NIMBUSLAF);
2170
+ cLabel shini1 = GetLabel("icons/shadericons/shadericon00011.png", !Globals.NIMBUSLAF);
20702171 shini1.setToolTipText("Shiny2");
20712172 shini1.addMouseListener(new MouseAdapter()
20722173 {
....@@ -2084,7 +2185,7 @@
20842185 });
20852186 presetpanel.add(shini1);
20862187
2087
- cLabel shini2 = GetLabel("icons/shadericons/shadericon00012.png", !Grafreed.NIMBUSLAF);
2188
+ cLabel shini2 = GetLabel("icons/shadericons/shadericon00012.png", !Globals.NIMBUSLAF);
20882189 shini2.setToolTipText("Shiny3");
20892190 shini2.addMouseListener(new MouseAdapter()
20902191 {
....@@ -2102,7 +2203,7 @@
21022203 });
21032204 presetpanel.add(shini2);
21042205
2105
- cLabel aniso = GetLabel("icons/shadericons/shadericon00008.png", !Grafreed.NIMBUSLAF);
2206
+ cLabel aniso = GetLabel("icons/shadericons/shadericon00008.png", !Globals.NIMBUSLAF);
21062207 aniso.setToolTipText("AnisoU");
21072208 aniso.addMouseListener(new MouseAdapter()
21082209 {
....@@ -2120,7 +2221,7 @@
21202221 });
21212222 presetpanel.add(aniso);
21222223
2123
- cLabel aniso2 = GetLabel("icons/shadericons/shadericon00009.png", !Grafreed.NIMBUSLAF);
2224
+ cLabel aniso2 = GetLabel("icons/shadericons/shadericon00009.png", !Globals.NIMBUSLAF);
21242225 aniso2.setToolTipText("AnisoV");
21252226 aniso2.addMouseListener(new MouseAdapter()
21262227 {
....@@ -2138,7 +2239,7 @@
21382239 });
21392240 presetpanel.add(aniso2);
21402241
2141
- cLabel aniso3 = GetLabel("icons/shadericons/shadericon00010.png", !Grafreed.NIMBUSLAF);
2242
+ cLabel aniso3 = GetLabel("icons/shadericons/shadericon00010.png", !Globals.NIMBUSLAF);
21422243 aniso3.setToolTipText("AnisoUV");
21432244 aniso3.addMouseListener(new MouseAdapter()
21442245 {
....@@ -2156,7 +2257,7 @@
21562257 });
21572258 presetpanel.add(aniso3);
21582259
2159
- cLabel velvet0 = GetLabel("icons/shadericons/shadericon00015.png", !Grafreed.NIMBUSLAF);
2260
+ cLabel velvet0 = GetLabel("icons/shadericons/shadericon00015.png", !Globals.NIMBUSLAF);
21602261 velvet0.setToolTipText("Velvet");
21612262 velvet0.addMouseListener(new MouseAdapter()
21622263 {
....@@ -2178,7 +2279,7 @@
21782279 });
21792280 presetpanel.add(velvet0);
21802281
2181
- cLabel bump0 = GetLabel("icons/shadericons/shadericon00016.png", !Grafreed.NIMBUSLAF);
2282
+ cLabel bump0 = GetLabel("icons/shadericons/shadericon00016.png", !Globals.NIMBUSLAF);
21822283 bump0.setToolTipText("Bump texture");
21832284 bump0.addMouseListener(new MouseAdapter()
21842285 {
....@@ -2197,7 +2298,7 @@
21972298 });
21982299 presetpanel.add(bump0);
21992300
2200
- cLabel borderShader = GetLabel("icons/shadericons/borderfade.jpg", !Grafreed.NIMBUSLAF);
2301
+ cLabel borderShader = GetLabel("icons/shadericons/borderfade.jpg", !Globals.NIMBUSLAF);
22012302 borderShader.setToolTipText("Border fade");
22022303 borderShader.addMouseListener(new MouseAdapter()
22032304 {
....@@ -2212,7 +2313,7 @@
22122313 });
22132314 presetpanel.add(borderShader);
22142315
2215
- cLabel halo = GetLabel("icons/shadericons/shadericon00017.png", !Grafreed.NIMBUSLAF);
2316
+ cLabel halo = GetLabel("icons/shadericons/shadericon00017.png", !Globals.NIMBUSLAF);
22162317 halo.setToolTipText("Halo");
22172318 halo.addMouseListener(new MouseAdapter()
22182319 {
....@@ -2229,7 +2330,7 @@
22292330 });
22302331 presetpanel.add(halo);
22312332
2232
- cLabel candle = GetLabel("icons/shadericons/shadericon00018.png", !Grafreed.NIMBUSLAF);
2333
+ cLabel candle = GetLabel("icons/shadericons/shadericon00018.png", !Globals.NIMBUSLAF);
22332334 candle.setToolTipText("Candle");
22342335 candle.addMouseListener(new MouseAdapter()
22352336 {
....@@ -2251,7 +2352,7 @@
22512352 });
22522353 presetpanel.add(candle);
22532354
2254
- cLabel shadowShader = GetLabel("icons/shadericons/shadow.png", !Grafreed.NIMBUSLAF);
2355
+ cLabel shadowShader = GetLabel("icons/shadericons/shadow.png", !Globals.NIMBUSLAF);
22552356 shadowShader.setToolTipText("Shadow");
22562357 shadowShader.addMouseListener(new MouseAdapter()
22572358 {
....@@ -2286,19 +2387,19 @@
22862387
22872388 cGridBag editBar = new cGridBag().setVertical(false);
22882389
2289
- editBar.add(createMaterialButton = new cButton("Create", !Grafreed.NIMBUSLAF)); // , aConstraints);
2390
+ editBar.add(createMaterialButton = new cButton("Create", !Globals.NIMBUSLAF)); // , aConstraints);
22902391 createMaterialButton.setToolTipText("Create material");
22912392
22922393 /*
22932394 ctrlPanel.add(resetSlidersButton = new cButton("Reset All"), aConstraints);
22942395 */
22952396
2296
- editBar.add(clearMaterialButton = new cButton("Clear", !Grafreed.NIMBUSLAF)); // , aConstraints);
2397
+ editBar.add(clearMaterialButton = new cButton("Clear", !Globals.NIMBUSLAF)); // , aConstraints);
22972398 clearMaterialButton.setToolTipText("Clear material");
22982399
22992400 if (Globals.ADVANCED)
23002401 {
2301
- editBar.add(resetSlidersButton = new cButton("Reset", !Grafreed.NIMBUSLAF)); // , aConstraints);
2402
+ editBar.add(resetSlidersButton = new cButton("Reset", !Globals.NIMBUSLAF)); // , aConstraints);
23022403 editBar.add(propagateToggle = new cCheckBox("Prop", propagate)); // , aConstraints);
23032404 editBar.add(multiplyToggle = new cCheckBox("Mult", false)); // , aConstraints);
23042405 }
....@@ -4099,11 +4200,18 @@
40994200
41004201 void New()
41014202 {
4102
- while (copy.Size() > 1)
4203
+ while (copy.Size() > 0)
41034204 {
4104
- copy.remove(1);
4205
+ copy.remove(0);
41054206 }
41064207
4208
+ copy.selection.clear();
4209
+
4210
+ if (copy == Grafreed.grafreed.universe)
4211
+ {
4212
+ CreateCameras();
4213
+ cameraView.SetCamera(GetCamera(copy, 0));
4214
+ }
41074215 ResetModel();
41084216 objEditor.refreshContents();
41094217 }
....@@ -4417,6 +4525,8 @@
44174525 return count;
44184526 }
44194527
4528
+ public cGridBag versionSliderPane;
4529
+
44204530 void SetVersionStates()
44214531 {
44224532 //if (true)
....@@ -4424,21 +4534,36 @@
44244534
44254535 //cRadio tab = GetCurrentTab();
44264536
4427
- restoreButton.setEnabled(copy.versionindex != -1);
4428
- replaceButton.setEnabled(copy.versionindex != -1);
4429
-
4430
- previousVersionButton.setEnabled(copy.versionindex > 0);
4431
- nextVersionButton.setEnabled(copy.versionlist[copy.versionindex + 1] != null);
4432
-
4433
- deleteVersionButton.setEnabled(copy.versionindex != -1);
4434
- //copy.versionlist[copy.versionindex + 1] != null);
4435
-
4436
- muteSlider = true;
4437
- versionSlider.setMinimum(0);
4438
- versionSlider.setMaximum(VersionCount() - 1);
4439
- versionSlider.setInteger(copy.versionindex);
4440
- versionSlider.setEnabled(copy.versionindex != -1);
4441
- muteSlider = false;
4537
+ if (copy.versionlist == null)
4538
+ {
4539
+ saveVersionButton.setEnabled(false);
4540
+ restoreButton.setEnabled(false);
4541
+ replaceButton.setEnabled(false);
4542
+ previousVersionButton.setEnabled(false);
4543
+ nextVersionButton.setEnabled(false);
4544
+ deleteVersionButton.setEnabled(false);
4545
+ versionSliderPane.setVisible(false);
4546
+ }
4547
+ else
4548
+ {
4549
+ restoreButton.setEnabled(copy.versionindex != -1);
4550
+ replaceButton.setEnabled(copy.versionindex != -1);
4551
+
4552
+ previousVersionButton.setEnabled(copy.versionindex > 0);
4553
+ nextVersionButton.setEnabled(copy.versionlist[copy.versionindex + 1] != null);
4554
+
4555
+ deleteVersionButton.setEnabled(copy.versionindex != -1);
4556
+ //copy.versionlist[copy.versionindex + 1] != null);
4557
+
4558
+ muteSlider = true;
4559
+ versionSlider.setMinimum(0);
4560
+ versionSlider.setMaximum(VersionCount() - 1);
4561
+ versionSlider.setInteger(copy.versionindex);
4562
+ versionSlider.setEnabled(copy.versionindex != -1);
4563
+ muteSlider = false;
4564
+
4565
+ versionSliderPane.setVisible(true);
4566
+ }
44424567 }
44434568
44444569 public boolean PreviousVersion()
....@@ -4723,6 +4848,12 @@
47234848 // else
47244849 // applySelf(true);
47254850 // }
4851
+
4852
+ boolean Equal(double a, double b)
4853
+ {
4854
+ return Math.abs(a - b) < 0.001;
4855
+ }
4856
+
47264857 void applySelf0(boolean name)
47274858 {
47284859 if (name)
....@@ -4772,29 +4903,52 @@
47724903 {
47734904 cMaterial mat = copy.material;
47744905
4775
- colorField.SetToolTipValue((mat.color));
4776
- saturationField.SetToolTipValue((mat.modulation));
4777
- metalnessField.SetToolTipValue((mat.metalness));
4778
- diffuseField.SetToolTipValue((mat.diffuse));
4779
- specularField.SetToolTipValue((mat.specular));
4780
- shininessField.SetToolTipValue((mat.shininess));
4781
- shiftField.SetToolTipValue((mat.shift));
4782
- ambientField.SetToolTipValue((mat.ambient));
4783
- lightareaField.SetToolTipValue((mat.lightarea));
4784
- diffusenessField.SetToolTipValue((mat.factor));
4785
- velvetField.SetToolTipValue((mat.velvet));
4786
- sheenField.SetToolTipValue((mat.sheen));
4787
- subsurfaceField.SetToolTipValue((mat.subsurface));
4788
- backlitField.SetToolTipValue((mat.bump));
4789
- anisoField.SetToolTipValue((mat.aniso));
4790
- anisoVField.SetToolTipValue((mat.anisoV));
4791
- cameraField.SetToolTipValue((mat.cameralight));
4792
- selfshadowField.SetToolTipValue((mat.diffuseness));
4793
- shadowField.SetToolTipValue((mat.shadow));
4794
- textureField.SetToolTipValue((mat.texture));
4795
- opacityField.SetToolTipValue((mat.opacity));
4796
- fakedepthField.SetToolTipValue((mat.fakedepth));
4797
- shadowbiasField.SetToolTipValue((mat.shadowbias));
4906
+ if (!Equal(colorField.getFloat(), mat.color))
4907
+ colorField.SetToolTipValue((mat.color));
4908
+ if (!Equal(saturationField.getFloat(), mat.modulation))
4909
+ saturationField.SetToolTipValue((mat.modulation));
4910
+ if (!Equal(metalnessField.getFloat(), mat.metalness))
4911
+ metalnessField.SetToolTipValue((mat.metalness));
4912
+ if (!Equal(diffuseField.getFloat(), mat.diffuse))
4913
+ diffuseField.SetToolTipValue((mat.diffuse));
4914
+ if (!Equal(specularField.getFloat(), mat.specular))
4915
+ specularField.SetToolTipValue((mat.specular));
4916
+ if (!Equal(shininessField.getFloat(), mat.shininess))
4917
+ shininessField.SetToolTipValue((mat.shininess));
4918
+ if (!Equal(shiftField.getFloat(), mat.shift))
4919
+ shiftField.SetToolTipValue((mat.shift));
4920
+ if (!Equal(ambientField.getFloat(), mat.ambient))
4921
+ ambientField.SetToolTipValue((mat.ambient));
4922
+ if (!Equal(lightareaField.getFloat(), mat.lightarea))
4923
+ lightareaField.SetToolTipValue((mat.lightarea));
4924
+ if (!Equal(diffusenessField.getFloat(), mat.factor))
4925
+ diffusenessField.SetToolTipValue((mat.factor));
4926
+ if (!Equal(velvetField.getFloat(), mat.velvet))
4927
+ velvetField.SetToolTipValue((mat.velvet));
4928
+ if (!Equal(sheenField.getFloat(), mat.sheen))
4929
+ sheenField.SetToolTipValue((mat.sheen));
4930
+ if (!Equal(subsurfaceField.getFloat(), mat.subsurface))
4931
+ subsurfaceField.SetToolTipValue((mat.subsurface));
4932
+ if (!Equal(backlitField.getFloat(), mat.bump))
4933
+ backlitField.SetToolTipValue((mat.bump));
4934
+ if (!Equal(anisoField.getFloat(), mat.aniso))
4935
+ anisoField.SetToolTipValue((mat.aniso));
4936
+ if (!Equal(anisoVField.getFloat(), mat.anisoV))
4937
+ anisoVField.SetToolTipValue((mat.anisoV));
4938
+ if (!Equal(cameraField.getFloat(), mat.cameralight))
4939
+ cameraField.SetToolTipValue((mat.cameralight));
4940
+ if (!Equal(selfshadowField.getFloat(), mat.diffuseness))
4941
+ selfshadowField.SetToolTipValue((mat.diffuseness));
4942
+ if (!Equal(shadowField.getFloat(), mat.shadow))
4943
+ shadowField.SetToolTipValue((mat.shadow));
4944
+ if (!Equal(textureField.getFloat(), mat.texture))
4945
+ textureField.SetToolTipValue((mat.texture));
4946
+ if (!Equal(opacityField.getFloat(), mat.opacity))
4947
+ opacityField.SetToolTipValue((mat.opacity));
4948
+ if (!Equal(fakedepthField.getFloat(), mat.fakedepth))
4949
+ fakedepthField.SetToolTipValue((mat.fakedepth));
4950
+ if (!Equal(shadowbiasField.getFloat(), mat.shadowbias))
4951
+ shadowbiasField.SetToolTipValue((mat.shadowbias));
47984952 }
47994953
48004954 if (copy.material != null && copy.projectedVertices.length > 0 && copy.projectedVertices[0] != null)
....@@ -4829,7 +4983,7 @@
48294983
48304984 public void stateChanged(ChangeEvent e)
48314985 {
4832
- // assert(false);
4986
+ // assert(false);
48334987 if (e.getSource() == versionSlider)
48344988 {
48354989 if (muteSlider)
....@@ -5942,6 +6096,7 @@
59426096 boolean materialFlushed;
59436097 Object3D latestObject;
59446098
6099
+ cGridBag transformPanel;
59456100 cGridBag XYZPanel;
59466101
59476102 JSplitPane gridPanel;