Normand Briere
2019-08-18 66aca73cce89e4b4d7521862760edf4b0888bc38
ObjEditor.java
....@@ -83,7 +83,10 @@
8383 cButton GetButton(String name, boolean border)
8484 {
8585 ImageIcon icon = GetIcon(name);
86
- return new cButton(icon, border);
86
+ if (icon != null || name.contains("/"))
87
+ return new cButton(icon, border);
88
+ else
89
+ return new cButton(name, border);
8790 }
8891
8992 cLabel GetLabel(String name, boolean border)
....@@ -106,7 +109,7 @@
106109
107110 static java.util.Hashtable<String, javax.swing.ImageIcon> icons = new java.util.Hashtable<String, javax.swing.ImageIcon>();
108111
109
- ImageIcon GetIcon(String name)
112
+ static ImageIcon GetIcon(String name)
110113 {
111114 javax.swing.ImageIcon iconCache = icons.get(name);
112115 if (iconCache != null)
....@@ -116,7 +119,7 @@
116119
117120 try
118121 {
119
- BufferedImage image = javax.imageio.ImageIO.read(getClass().getClassLoader().getResourceAsStream(name));
122
+ BufferedImage image = javax.imageio.ImageIO.read(ObjEditor.class.getClassLoader().getResourceAsStream(name));
120123
121124 // if (image.getWidth() > 48 && image.getHeight() > 48)
122125 // {
....@@ -965,8 +968,13 @@
965968 object.versionlist = null;
966969 object.versiontable = null;
967970
971
+ Object3D parent = object.parent;
972
+ object.parent = null;
973
+
968974 //byte[] compress = Compress(copy);
969975 Object3D compress = (Object3D)Grafreed.clone(object);
976
+
977
+ object.parent = parent;
970978
971979 object.versionlist = versions;
972980 object.versiontable = versiontable; // if Grafreed.grafreed.universe
....@@ -1310,7 +1318,7 @@
13101318
13111319 //if (copy.pinned)
13121320 {
1313
- pinButton = GetToggleButton("icons/pin.png", !Grafreed.NIMBUSLAF);
1321
+ pinButton = GetToggleButton("icons/pin.png", !Globals.NIMBUSLAF);
13141322 pinButton.setSelected(copy.pinned);
13151323 cGridBag t = new cGridBag();
13161324 t.preferredWidth = 2;
....@@ -1624,6 +1632,45 @@
16241632 //frontView.object = copy;
16251633 //sideView.object = copy;
16261634
1635
+ transformPanel = new cGridBag().setVertical(true);
1636
+
1637
+ cGridBag resetTransformPanel = new cGridBag();
1638
+
1639
+ resetTransformPanel.preferredHeight = 2;
1640
+
1641
+ cButton resetTransform = GetButton("Reset all", !Globals.NIMBUSLAF);
1642
+ resetTransform.setToolTipText("Reset Translation, Rotation and Scale");
1643
+ resetTransform.addMouseListener(new MouseAdapter()
1644
+ {
1645
+ public void mouseClicked(MouseEvent e)
1646
+ {
1647
+ ResetTransform();
1648
+ }
1649
+ });
1650
+ resetTransformPanel.add(resetTransform);
1651
+
1652
+ resetTransform = GetButton("T only", !Globals.NIMBUSLAF);
1653
+ resetTransform.setToolTipText("Reset Translation only");
1654
+ resetTransform.addMouseListener(new MouseAdapter()
1655
+ {
1656
+ public void mouseClicked(MouseEvent e)
1657
+ {
1658
+ ResetTransform(1);
1659
+ }
1660
+ });
1661
+ resetTransformPanel.add(resetTransform);
1662
+
1663
+ resetTransform = GetButton("RS only", !Globals.NIMBUSLAF);
1664
+ resetTransform.setToolTipText("Reset Rotation and Scale only");
1665
+ resetTransform.addMouseListener(new MouseAdapter()
1666
+ {
1667
+ public void mouseClicked(MouseEvent e)
1668
+ {
1669
+ ResetTransform(2);
1670
+ }
1671
+ });
1672
+ resetTransformPanel.add(resetTransform);
1673
+
16271674 XYZPanel = new cGridBag().setVertical(true);
16281675 //XYZPanel.setLayout(new GridLayout(3, 1, 5, 5));
16291676
....@@ -1633,6 +1680,9 @@
16331680 XYZPanel.addComponent(/*BorderLayout.NORTH,*/topView); // Scroll);
16341681 //XYZPanel.setName("XYZ");
16351682
1683
+ transformPanel.add(resetTransformPanel);
1684
+ transformPanel.add(XYZPanel);
1685
+
16361686 /*
16371687 gridPanel = new JPanel(); //new BorderLayout());
16381688 gridPanel.setLayout(new GridLayout(1, 2));
....@@ -1640,12 +1690,12 @@
16401690 gridPanel.add(cameraView);
16411691 gridPanel.add(XYZPanel);
16421692 */
1643
- gridPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, centralPanel, XYZPanel); //new BorderLayout());
1644
- gridPanel.setContinuousLayout(true);
1645
- gridPanel.setOneTouchExpandable(true);
1646
- gridPanel.setDividerLocation(1.0);
1647
- gridPanel.setDividerSize(9);
1648
- gridPanel.setResizeWeight(0.85);
1693
+// gridPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, centralPanel, XYZPanel); //new BorderLayout());
1694
+// gridPanel.setContinuousLayout(true);
1695
+// gridPanel.setOneTouchExpandable(true);
1696
+// gridPanel.setDividerLocation(1.0);
1697
+// gridPanel.setDividerSize(9);
1698
+// gridPanel.setResizeWeight(0.85);
16491699
16501700 // aConstraints.weighty = 0;
16511701 //System.out.println("THIS = " + this);
....@@ -1688,9 +1738,9 @@
16881738 objectPanel.setIconAt(3, GetIcon("icons/write.png"));
16891739 objectPanel.setToolTipTextAt(3, "Edit controls");
16901740
1691
- objectPanel.add(XYZPanel);
1741
+ objectPanel.add(transformPanel);
16921742 objectPanel.setIconAt(4, GetIcon("icons/XYZ.png"));
1693
- objectPanel.setToolTipTextAt(4, "XYZ/RGB transform");
1743
+ objectPanel.setToolTipTextAt(4, "TRS transform");
16941744
16951745 patchMaterial = true;
16961746 cameraView.patchMaterial = this;
....@@ -1715,7 +1765,7 @@
17151765 scrollpane.addMouseWheelListener(this); // Default not fast enough
17161766
17171767 /*JTabbedPane*/ scenePanel = new cGridBag();
1718
- scenePanel.preferredWidth = 5;
1768
+ scenePanel.preferredWidth = 6;
17191769
17201770 JTabbedPane tabbedPane = new JTabbedPane();
17211771 tabbedPane.add(scrollpane);
....@@ -1726,17 +1776,52 @@
17261776
17271777 AddOptions(optionsPanel); //, aConstraints);
17281778
1729
- tabbedPane.add(optionsPanel);
1730
-
17311779 tabbedPane.add(FSPane = new cFileSystemPane(this));
17321780
1781
+ tabbedPane.add(optionsPanel);
1782
+
17331783 scenePanel.add(tabbedPane);
17341784
1735
- //if (Globals.ADVANCED)
1736
-// tabbedPane.add(infoPanel);
1737
-// tabbedPane.setIconAt(3, GetIcon("icons/info.png"));
1738
-// tabbedPane.setToolTipTextAt(3, "Information");
1785
+ cGridBag creditsPanel = new cGridBag().setVertical(true);
1786
+ creditsPanel.setName("Credits");
17391787
1788
+ cLabel ogaLabel = new cLabel(" Most Skyboxes courtesy of OpenGameArt!", !Globals.NIMBUSLAF);
1789
+ creditsPanel.add(ogaLabel);
1790
+
1791
+ cButton opengameartButton;
1792
+ creditsPanel.add(opengameartButton = GetButton("icons/sara-logo.png", !Globals.NIMBUSLAF));
1793
+ opengameartButton.setToolTipText("https://opengameart.org");
1794
+
1795
+ opengameartButton.addMouseListener(new MouseAdapter()
1796
+ {
1797
+ public void mouseClicked(MouseEvent e)
1798
+ {
1799
+ try
1800
+ {
1801
+ Desktop.getDesktop().browse(new java.net.URI("https://opengameart.org/"));
1802
+ } catch (Exception e1)
1803
+// } catch (java.io.IOException | java.net.URISyntaxException e1)
1804
+ {
1805
+ e1.printStackTrace();
1806
+ }
1807
+ }
1808
+ });
1809
+
1810
+ for (int i=10; --i>=0;)
1811
+ {
1812
+ creditsPanel.add(new cGridBag());
1813
+ }
1814
+
1815
+ tabbedPane.add(creditsPanel);
1816
+ tabbedPane.setToolTipTextAt(3, "Credits");
1817
+
1818
+ if (Globals.ADVANCED)
1819
+ {
1820
+ tabbedPane.add(infoPanel);
1821
+ tabbedPane.setIconAt(4, GetIcon("icons/info.png"));
1822
+ tabbedPane.setToolTipTextAt(4, "Information");
1823
+ }
1824
+
17401825 /*
17411826 cTree jTree = new cTree(null);
17421827 ToolTipManager.sharedInstance().registerComponent(jTree);
....@@ -1757,13 +1842,13 @@
17571842 jtp.add(tree);
17581843 */
17591844
1760
- bigPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, scenePanel, gridPanel);
1761
- bigPanel.setContinuousLayout(true);
1762
- bigPanel.setOneTouchExpandable(true);
1763
- bigPanel.setDividerLocation(0.8);
1764
- bigPanel.setDividerSize(15);
1765
- bigPanel.setResizeWeight(0.15);
1766
- bigPanel.setName("Scene");
1845
+// bigPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, scenePanel, gridPanel);
1846
+// bigPanel.setContinuousLayout(true);
1847
+// bigPanel.setOneTouchExpandable(true);
1848
+// bigPanel.setDividerLocation(0.8);
1849
+// bigPanel.setDividerSize(15);
1850
+// bigPanel.setResizeWeight(0.15);
1851
+// bigPanel.setName("Scene");
17671852
17681853 //bigPanel.setLayout(new BorderLayout());
17691854 //bigPanel.setSize(new Dimension(10,10));
....@@ -1847,7 +1932,7 @@
18471932
18481933 cameraView.requestFocusInWindow();
18491934
1850
- gridPanel.setDividerLocation(1.0);
1935
+// gridPanel.setDividerLocation(1.0);
18511936
18521937 frame.validate();
18531938
....@@ -1882,7 +1967,7 @@
18821967 {
18831968 cGridBag presetpanel = new cGridBag().setVertical(true);
18841969
1885
- cLabel skin = GetLabel("icons/shadericons/shadericon00000.png", !Grafreed.NIMBUSLAF);
1970
+ cLabel skin = GetLabel("icons/shadericons/shadericon00000.png", !Globals.NIMBUSLAF);
18861971 skin.setToolTipText("Skin");
18871972 skin.addMouseListener(new MouseAdapter()
18881973 {
....@@ -1920,7 +2005,7 @@
19202005 });
19212006 presetpanel.add(skin);
19222007
1923
- cLabel lambert = GetLabel("icons/shadericons/shadericon00002.png", !Grafreed.NIMBUSLAF);
2008
+ cLabel lambert = GetLabel("icons/shadericons/shadericon00002.png", !Globals.NIMBUSLAF);
19242009 lambert.setToolTipText("Diffuse");
19252010 lambert.addMouseListener(new MouseAdapter()
19262011 {
....@@ -1938,7 +2023,7 @@
19382023 });
19392024 presetpanel.add(lambert);
19402025
1941
- cLabel diffuse2 = GetLabel("icons/shadericons/shadericon00003.png", !Grafreed.NIMBUSLAF);
2026
+ cLabel diffuse2 = GetLabel("icons/shadericons/shadericon00003.png", !Globals.NIMBUSLAF);
19422027 diffuse2.setToolTipText("Diffuse2");
19432028 diffuse2.addMouseListener(new MouseAdapter()
19442029 {
....@@ -1956,7 +2041,7 @@
19562041 });
19572042 presetpanel.add(diffuse2);
19582043
1959
- cLabel diffusemoon = GetLabel("icons/shadericons/shadericon00004.png", !Grafreed.NIMBUSLAF);
2044
+ cLabel diffusemoon = GetLabel("icons/shadericons/shadericon00004.png", !Globals.NIMBUSLAF);
19602045 diffusemoon.setToolTipText("Moon");
19612046 diffusemoon.addMouseListener(new MouseAdapter()
19622047 {
....@@ -1974,7 +2059,7 @@
19742059 });
19752060 presetpanel.add(diffusemoon);
19762061
1977
- cLabel diffusemoon2 = GetLabel("icons/shadericons/shadericon00005.png", !Grafreed.NIMBUSLAF);
2062
+ cLabel diffusemoon2 = GetLabel("icons/shadericons/shadericon00005.png", !Globals.NIMBUSLAF);
19782063 diffusemoon2.setToolTipText("Moon2");
19792064 diffusemoon2.addMouseListener(new MouseAdapter()
19802065 {
....@@ -1992,7 +2077,7 @@
19922077 });
19932078 presetpanel.add(diffusemoon2);
19942079
1995
- cLabel diffusemoon3 = GetLabel("icons/shadericons/shadericon00006.png", !Grafreed.NIMBUSLAF);
2080
+ cLabel diffusemoon3 = GetLabel("icons/shadericons/shadericon00006.png", !Globals.NIMBUSLAF);
19962081 diffusemoon3.setToolTipText("Moon3");
19972082 diffusemoon3.addMouseListener(new MouseAdapter()
19982083 {
....@@ -2010,7 +2095,7 @@
20102095 });
20112096 presetpanel.add(diffusemoon3);
20122097
2013
- cLabel diffusesheen = GetLabel("icons/shadericons/shadericon00007.png", !Grafreed.NIMBUSLAF);
2098
+ cLabel diffusesheen = GetLabel("icons/shadericons/shadericon00007.png", !Globals.NIMBUSLAF);
20142099 diffusesheen.setToolTipText("Sheen");
20152100 diffusesheen.addMouseListener(new MouseAdapter()
20162101 {
....@@ -2027,7 +2112,7 @@
20272112 });
20282113 presetpanel.add(diffusesheen);
20292114
2030
- cLabel rough = GetLabel("icons/shadericons/shadericon00001.png", !Grafreed.NIMBUSLAF);
2115
+ cLabel rough = GetLabel("icons/shadericons/shadericon00001.png", !Globals.NIMBUSLAF);
20312116 rough.setToolTipText("Rough metal");
20322117 rough.addMouseListener(new MouseAdapter()
20332118 {
....@@ -2045,7 +2130,7 @@
20452130 });
20462131 presetpanel.add(rough);
20472132
2048
- cLabel rough2 = GetLabel("icons/shadericons/shadericon00013.png", !Grafreed.NIMBUSLAF);
2133
+ cLabel rough2 = GetLabel("icons/shadericons/shadericon00013.png", !Globals.NIMBUSLAF);
20492134 rough2.setToolTipText("Medium metal");
20502135 rough2.addMouseListener(new MouseAdapter()
20512136 {
....@@ -2063,7 +2148,7 @@
20632148 });
20642149 presetpanel.add(rough2);
20652150
2066
- cLabel shini0 = GetLabel("icons/shadericons/shadericon00014.png", !Grafreed.NIMBUSLAF);
2151
+ cLabel shini0 = GetLabel("icons/shadericons/shadericon00014.png", !Globals.NIMBUSLAF);
20672152 shini0.setToolTipText("Shiny");
20682153 shini0.addMouseListener(new MouseAdapter()
20692154 {
....@@ -2081,7 +2166,7 @@
20812166 });
20822167 presetpanel.add(shini0);
20832168
2084
- cLabel shini1 = GetLabel("icons/shadericons/shadericon00011.png", !Grafreed.NIMBUSLAF);
2169
+ cLabel shini1 = GetLabel("icons/shadericons/shadericon00011.png", !Globals.NIMBUSLAF);
20852170 shini1.setToolTipText("Shiny2");
20862171 shini1.addMouseListener(new MouseAdapter()
20872172 {
....@@ -2099,7 +2184,7 @@
20992184 });
21002185 presetpanel.add(shini1);
21012186
2102
- cLabel shini2 = GetLabel("icons/shadericons/shadericon00012.png", !Grafreed.NIMBUSLAF);
2187
+ cLabel shini2 = GetLabel("icons/shadericons/shadericon00012.png", !Globals.NIMBUSLAF);
21032188 shini2.setToolTipText("Shiny3");
21042189 shini2.addMouseListener(new MouseAdapter()
21052190 {
....@@ -2117,7 +2202,7 @@
21172202 });
21182203 presetpanel.add(shini2);
21192204
2120
- cLabel aniso = GetLabel("icons/shadericons/shadericon00008.png", !Grafreed.NIMBUSLAF);
2205
+ cLabel aniso = GetLabel("icons/shadericons/shadericon00008.png", !Globals.NIMBUSLAF);
21212206 aniso.setToolTipText("AnisoU");
21222207 aniso.addMouseListener(new MouseAdapter()
21232208 {
....@@ -2135,7 +2220,7 @@
21352220 });
21362221 presetpanel.add(aniso);
21372222
2138
- cLabel aniso2 = GetLabel("icons/shadericons/shadericon00009.png", !Grafreed.NIMBUSLAF);
2223
+ cLabel aniso2 = GetLabel("icons/shadericons/shadericon00009.png", !Globals.NIMBUSLAF);
21392224 aniso2.setToolTipText("AnisoV");
21402225 aniso2.addMouseListener(new MouseAdapter()
21412226 {
....@@ -2153,7 +2238,7 @@
21532238 });
21542239 presetpanel.add(aniso2);
21552240
2156
- cLabel aniso3 = GetLabel("icons/shadericons/shadericon00010.png", !Grafreed.NIMBUSLAF);
2241
+ cLabel aniso3 = GetLabel("icons/shadericons/shadericon00010.png", !Globals.NIMBUSLAF);
21572242 aniso3.setToolTipText("AnisoUV");
21582243 aniso3.addMouseListener(new MouseAdapter()
21592244 {
....@@ -2171,7 +2256,7 @@
21712256 });
21722257 presetpanel.add(aniso3);
21732258
2174
- cLabel velvet0 = GetLabel("icons/shadericons/shadericon00015.png", !Grafreed.NIMBUSLAF);
2259
+ cLabel velvet0 = GetLabel("icons/shadericons/shadericon00015.png", !Globals.NIMBUSLAF);
21752260 velvet0.setToolTipText("Velvet");
21762261 velvet0.addMouseListener(new MouseAdapter()
21772262 {
....@@ -2193,7 +2278,7 @@
21932278 });
21942279 presetpanel.add(velvet0);
21952280
2196
- cLabel bump0 = GetLabel("icons/shadericons/shadericon00016.png", !Grafreed.NIMBUSLAF);
2281
+ cLabel bump0 = GetLabel("icons/shadericons/shadericon00016.png", !Globals.NIMBUSLAF);
21972282 bump0.setToolTipText("Bump texture");
21982283 bump0.addMouseListener(new MouseAdapter()
21992284 {
....@@ -2212,7 +2297,7 @@
22122297 });
22132298 presetpanel.add(bump0);
22142299
2215
- cLabel borderShader = GetLabel("icons/shadericons/borderfade.jpg", !Grafreed.NIMBUSLAF);
2300
+ cLabel borderShader = GetLabel("icons/shadericons/borderfade.jpg", !Globals.NIMBUSLAF);
22162301 borderShader.setToolTipText("Border fade");
22172302 borderShader.addMouseListener(new MouseAdapter()
22182303 {
....@@ -2227,7 +2312,7 @@
22272312 });
22282313 presetpanel.add(borderShader);
22292314
2230
- cLabel halo = GetLabel("icons/shadericons/shadericon00017.png", !Grafreed.NIMBUSLAF);
2315
+ cLabel halo = GetLabel("icons/shadericons/shadericon00017.png", !Globals.NIMBUSLAF);
22312316 halo.setToolTipText("Halo");
22322317 halo.addMouseListener(new MouseAdapter()
22332318 {
....@@ -2244,7 +2329,7 @@
22442329 });
22452330 presetpanel.add(halo);
22462331
2247
- cLabel candle = GetLabel("icons/shadericons/shadericon00018.png", !Grafreed.NIMBUSLAF);
2332
+ cLabel candle = GetLabel("icons/shadericons/shadericon00018.png", !Globals.NIMBUSLAF);
22482333 candle.setToolTipText("Candle");
22492334 candle.addMouseListener(new MouseAdapter()
22502335 {
....@@ -2266,7 +2351,7 @@
22662351 });
22672352 presetpanel.add(candle);
22682353
2269
- cLabel shadowShader = GetLabel("icons/shadericons/shadow.png", !Grafreed.NIMBUSLAF);
2354
+ cLabel shadowShader = GetLabel("icons/shadericons/shadow.png", !Globals.NIMBUSLAF);
22702355 shadowShader.setToolTipText("Shadow");
22712356 shadowShader.addMouseListener(new MouseAdapter()
22722357 {
....@@ -2301,19 +2386,19 @@
23012386
23022387 cGridBag editBar = new cGridBag().setVertical(false);
23032388
2304
- editBar.add(createMaterialButton = new cButton("Create", !Grafreed.NIMBUSLAF)); // , aConstraints);
2389
+ editBar.add(createMaterialButton = new cButton("Create", !Globals.NIMBUSLAF)); // , aConstraints);
23052390 createMaterialButton.setToolTipText("Create material");
23062391
23072392 /*
23082393 ctrlPanel.add(resetSlidersButton = new cButton("Reset All"), aConstraints);
23092394 */
23102395
2311
- editBar.add(clearMaterialButton = new cButton("Clear", !Grafreed.NIMBUSLAF)); // , aConstraints);
2396
+ editBar.add(clearMaterialButton = new cButton("Clear", !Globals.NIMBUSLAF)); // , aConstraints);
23122397 clearMaterialButton.setToolTipText("Clear material");
23132398
23142399 if (Globals.ADVANCED)
23152400 {
2316
- editBar.add(resetSlidersButton = new cButton("Reset", !Grafreed.NIMBUSLAF)); // , aConstraints);
2401
+ editBar.add(resetSlidersButton = new cButton("Reset", !Globals.NIMBUSLAF)); // , aConstraints);
23172402 editBar.add(propagateToggle = new cCheckBox("Prop", propagate)); // , aConstraints);
23182403 editBar.add(multiplyToggle = new cCheckBox("Mult", false)); // , aConstraints);
23192404 }
....@@ -4114,12 +4199,15 @@
41144199
41154200 void New()
41164201 {
4117
- while (copy.Size() > 1)
4202
+ while (copy.Size() > 0)
41184203 {
4119
- copy.remove(1);
4204
+ copy.remove(0);
41204205 }
41214206
4207
+ copy.selection.clear();
4208
+
41224209 ResetModel();
4210
+ SetupViews();
41234211 objEditor.refreshContents();
41244212 }
41254213
....@@ -4432,6 +4520,8 @@
44324520 return count;
44334521 }
44344522
4523
+ public cGridBag versionSliderPane;
4524
+
44354525 void SetVersionStates()
44364526 {
44374527 //if (true)
....@@ -4439,21 +4529,36 @@
44394529
44404530 //cRadio tab = GetCurrentTab();
44414531
4442
- restoreButton.setEnabled(copy.versionindex != -1);
4443
- replaceButton.setEnabled(copy.versionindex != -1);
4444
-
4445
- previousVersionButton.setEnabled(copy.versionindex > 0);
4446
- nextVersionButton.setEnabled(copy.versionlist[copy.versionindex + 1] != null);
4447
-
4448
- deleteVersionButton.setEnabled(copy.versionindex != -1);
4449
- //copy.versionlist[copy.versionindex + 1] != null);
4450
-
4451
- muteSlider = true;
4452
- versionSlider.setMinimum(0);
4453
- versionSlider.setMaximum(VersionCount() - 1);
4454
- versionSlider.setInteger(copy.versionindex);
4455
- versionSlider.setEnabled(copy.versionindex != -1);
4456
- muteSlider = false;
4532
+ if (copy.versionlist == null)
4533
+ {
4534
+ saveVersionButton.setEnabled(false);
4535
+ restoreButton.setEnabled(false);
4536
+ replaceButton.setEnabled(false);
4537
+ previousVersionButton.setEnabled(false);
4538
+ nextVersionButton.setEnabled(false);
4539
+ deleteVersionButton.setEnabled(false);
4540
+ versionSliderPane.setVisible(false);
4541
+ }
4542
+ else
4543
+ {
4544
+ restoreButton.setEnabled(copy.versionindex != -1);
4545
+ replaceButton.setEnabled(copy.versionindex != -1);
4546
+
4547
+ previousVersionButton.setEnabled(copy.versionindex > 0);
4548
+ nextVersionButton.setEnabled(copy.versionlist[copy.versionindex + 1] != null);
4549
+
4550
+ deleteVersionButton.setEnabled(copy.versionindex != -1);
4551
+ //copy.versionlist[copy.versionindex + 1] != null);
4552
+
4553
+ muteSlider = true;
4554
+ versionSlider.setMinimum(0);
4555
+ versionSlider.setMaximum(VersionCount() - 1);
4556
+ versionSlider.setInteger(copy.versionindex);
4557
+ versionSlider.setEnabled(copy.versionindex != -1);
4558
+ muteSlider = false;
4559
+
4560
+ versionSliderPane.setVisible(true);
4561
+ }
44574562 }
44584563
44594564 public boolean PreviousVersion()
....@@ -4738,6 +4843,12 @@
47384843 // else
47394844 // applySelf(true);
47404845 // }
4846
+
4847
+ boolean Equal(double a, double b)
4848
+ {
4849
+ return Math.abs(a - b) < 0.001;
4850
+ }
4851
+
47414852 void applySelf0(boolean name)
47424853 {
47434854 if (name)
....@@ -4787,29 +4898,52 @@
47874898 {
47884899 cMaterial mat = copy.material;
47894900
4790
- colorField.SetToolTipValue((mat.color));
4791
- saturationField.SetToolTipValue((mat.modulation));
4792
- metalnessField.SetToolTipValue((mat.metalness));
4793
- diffuseField.SetToolTipValue((mat.diffuse));
4794
- specularField.SetToolTipValue((mat.specular));
4795
- shininessField.SetToolTipValue((mat.shininess));
4796
- shiftField.SetToolTipValue((mat.shift));
4797
- ambientField.SetToolTipValue((mat.ambient));
4798
- lightareaField.SetToolTipValue((mat.lightarea));
4799
- diffusenessField.SetToolTipValue((mat.factor));
4800
- velvetField.SetToolTipValue((mat.velvet));
4801
- sheenField.SetToolTipValue((mat.sheen));
4802
- subsurfaceField.SetToolTipValue((mat.subsurface));
4803
- backlitField.SetToolTipValue((mat.bump));
4804
- anisoField.SetToolTipValue((mat.aniso));
4805
- anisoVField.SetToolTipValue((mat.anisoV));
4806
- cameraField.SetToolTipValue((mat.cameralight));
4807
- selfshadowField.SetToolTipValue((mat.diffuseness));
4808
- shadowField.SetToolTipValue((mat.shadow));
4809
- textureField.SetToolTipValue((mat.texture));
4810
- opacityField.SetToolTipValue((mat.opacity));
4811
- fakedepthField.SetToolTipValue((mat.fakedepth));
4812
- shadowbiasField.SetToolTipValue((mat.shadowbias));
4901
+ if (!Equal(colorField.getFloat(), mat.color))
4902
+ colorField.SetToolTipValue((mat.color));
4903
+ if (!Equal(saturationField.getFloat(), mat.modulation))
4904
+ saturationField.SetToolTipValue((mat.modulation));
4905
+ if (!Equal(metalnessField.getFloat(), mat.metalness))
4906
+ metalnessField.SetToolTipValue((mat.metalness));
4907
+ if (!Equal(diffuseField.getFloat(), mat.diffuse))
4908
+ diffuseField.SetToolTipValue((mat.diffuse));
4909
+ if (!Equal(specularField.getFloat(), mat.specular))
4910
+ specularField.SetToolTipValue((mat.specular));
4911
+ if (!Equal(shininessField.getFloat(), mat.shininess))
4912
+ shininessField.SetToolTipValue((mat.shininess));
4913
+ if (!Equal(shiftField.getFloat(), mat.shift))
4914
+ shiftField.SetToolTipValue((mat.shift));
4915
+ if (!Equal(ambientField.getFloat(), mat.ambient))
4916
+ ambientField.SetToolTipValue((mat.ambient));
4917
+ if (!Equal(lightareaField.getFloat(), mat.lightarea))
4918
+ lightareaField.SetToolTipValue((mat.lightarea));
4919
+ if (!Equal(diffusenessField.getFloat(), mat.factor))
4920
+ diffusenessField.SetToolTipValue((mat.factor));
4921
+ if (!Equal(velvetField.getFloat(), mat.velvet))
4922
+ velvetField.SetToolTipValue((mat.velvet));
4923
+ if (!Equal(sheenField.getFloat(), mat.sheen))
4924
+ sheenField.SetToolTipValue((mat.sheen));
4925
+ if (!Equal(subsurfaceField.getFloat(), mat.subsurface))
4926
+ subsurfaceField.SetToolTipValue((mat.subsurface));
4927
+ if (!Equal(backlitField.getFloat(), mat.bump))
4928
+ backlitField.SetToolTipValue((mat.bump));
4929
+ if (!Equal(anisoField.getFloat(), mat.aniso))
4930
+ anisoField.SetToolTipValue((mat.aniso));
4931
+ if (!Equal(anisoVField.getFloat(), mat.anisoV))
4932
+ anisoVField.SetToolTipValue((mat.anisoV));
4933
+ if (!Equal(cameraField.getFloat(), mat.cameralight))
4934
+ cameraField.SetToolTipValue((mat.cameralight));
4935
+ if (!Equal(selfshadowField.getFloat(), mat.diffuseness))
4936
+ selfshadowField.SetToolTipValue((mat.diffuseness));
4937
+ if (!Equal(shadowField.getFloat(), mat.shadow))
4938
+ shadowField.SetToolTipValue((mat.shadow));
4939
+ if (!Equal(textureField.getFloat(), mat.texture))
4940
+ textureField.SetToolTipValue((mat.texture));
4941
+ if (!Equal(opacityField.getFloat(), mat.opacity))
4942
+ opacityField.SetToolTipValue((mat.opacity));
4943
+ if (!Equal(fakedepthField.getFloat(), mat.fakedepth))
4944
+ fakedepthField.SetToolTipValue((mat.fakedepth));
4945
+ if (!Equal(shadowbiasField.getFloat(), mat.shadowbias))
4946
+ shadowbiasField.SetToolTipValue((mat.shadowbias));
48134947 }
48144948
48154949 if (copy.material != null && copy.projectedVertices.length > 0 && copy.projectedVertices[0] != null)
....@@ -4844,7 +4978,7 @@
48444978
48454979 public void stateChanged(ChangeEvent e)
48464980 {
4847
- // assert(false);
4981
+ // assert(false);
48484982 if (e.getSource() == versionSlider)
48494983 {
48504984 if (muteSlider)
....@@ -5957,6 +6091,7 @@
59576091 boolean materialFlushed;
59586092 Object3D latestObject;
59596093
6094
+ cGridBag transformPanel;
59606095 cGridBag XYZPanel;
59616096
59626097 JSplitPane gridPanel;