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());
....@@ -951,18 +972,29 @@
951972 boolean temp = CameraPane.SWITCH;
952973 CameraPane.SWITCH = false;
953974
954
- object.ExtractBigData(versiontable);
975
+ if (Grafreed.grafreed.universe.versiontable == null)
976
+ Grafreed.grafreed.universe.versiontable = new java.util.Hashtable<java.util.UUID, Object3D>();
977
+
978
+ object.ExtractBigData(Grafreed.grafreed.universe.versiontable);
955979 // if (copy == client)
956980
957981 Object3D versions[] = object.versionlist;
982
+ java.util.Hashtable<java.util.UUID, Object3D> versiontable = object.versiontable; // if Grafreed.grafreed.universe
958983 object.versionlist = null;
984
+ object.versiontable = null;
985
+
986
+ Object3D parent = object.parent;
987
+ object.parent = null;
959988
960989 //byte[] compress = Compress(copy);
961990 Object3D compress = (Object3D)Grafreed.clone(object);
962991
963
- object.versionlist = versions;
992
+ object.parent = parent;
964993
965
- object.RestoreBigData(versiontable);
994
+ object.versionlist = versions;
995
+ object.versiontable = versiontable; // if Grafreed.grafreed.universe
996
+
997
+ object.RestoreBigData(Grafreed.grafreed.universe.versiontable);
966998
967999 CameraPane.SWITCH = temp;
9681000
....@@ -1301,7 +1333,7 @@
13011333
13021334 //if (copy.pinned)
13031335 {
1304
- pinButton = GetToggleButton("icons/pin.png", !Grafreed.NIMBUSLAF);
1336
+ pinButton = GetToggleButton("icons/pin.png", !Globals.NIMBUSLAF);
13051337 pinButton.setSelected(copy.pinned);
13061338 cGridBag t = new cGridBag();
13071339 t.preferredWidth = 2;
....@@ -1533,23 +1565,9 @@
15331565
15341566 if (cam == null || !(copy.get(0) instanceof cGroup))
15351567 {
1536
- if (Globals.DEBUG)
1537
- System.out.println("CREATE CAMERAS");
1538
- cams = new cTemplate();
1539
- cams.name = "Cameras";
1540
- copy.insertElementAt(cams, 0);
1541
- //cams.parent = copy;
1542
-
1543
- cam = new Camera(); // LA.newVector(3, 2, 1));
1544
- cams.addChild(cam);
1545
- cam = new Camera(1);
1546
- cams.addChild(cam);
1547
- cam = new Camera(2);
1548
- cams.addChild(cam);
1549
- cam = new Camera(3);
1550
- cams.addChild(cam);
1551
- cam = new Camera(4); // Light
1552
- cams.addChild(cam);
1568
+ if (Globals.DEBUG)
1569
+ System.out.println("CREATE CAMERAS");
1570
+ cams = CreateCameras();
15531571 } else
15541572 {
15551573 cams = (cGroup) copy.get(0);
....@@ -1615,6 +1633,45 @@
16151633 //frontView.object = copy;
16161634 //sideView.object = copy;
16171635
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
+
16181675 XYZPanel = new cGridBag().setVertical(true);
16191676 //XYZPanel.setLayout(new GridLayout(3, 1, 5, 5));
16201677
....@@ -1624,6 +1681,9 @@
16241681 XYZPanel.addComponent(/*BorderLayout.NORTH,*/topView); // Scroll);
16251682 //XYZPanel.setName("XYZ");
16261683
1684
+ transformPanel.add(resetTransformPanel);
1685
+ transformPanel.add(XYZPanel);
1686
+
16271687 /*
16281688 gridPanel = new JPanel(); //new BorderLayout());
16291689 gridPanel.setLayout(new GridLayout(1, 2));
....@@ -1631,12 +1691,12 @@
16311691 gridPanel.add(cameraView);
16321692 gridPanel.add(XYZPanel);
16331693 */
1634
- gridPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, centralPanel, XYZPanel); //new BorderLayout());
1635
- gridPanel.setContinuousLayout(true);
1636
- gridPanel.setOneTouchExpandable(true);
1637
- gridPanel.setDividerLocation(1.0);
1638
- gridPanel.setDividerSize(9);
1639
- 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);
16401700
16411701 // aConstraints.weighty = 0;
16421702 //System.out.println("THIS = " + this);
....@@ -1659,30 +1719,34 @@
16591719
16601720 //JScrollPane tmp = new JScrollPane(ctrlPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
16611721 //tmp.setName("Edit");
1662
- objectPanel.add(materialPanel);
1663
- objectPanel.setIconAt(0, GetIcon("icons/material.png"));
1664
- objectPanel.setToolTipTextAt(0, "Material");
1665
-
1722
+ objectPanel.add(skyboxPanel);
1723
+ objectPanel.setIconAt(0, GetIcon("icons/skybox.jpg"));
1724
+ objectPanel.setToolTipTextAt(0, "Backgrounds");
1725
+
16661726 objectPanel.add(toolboxPanel);
16671727 objectPanel.setIconAt(1, GetIcon("icons/primitives.png"));
16681728 objectPanel.setToolTipTextAt(1, "Objects & textures");
16691729
1670
- objectPanel.add(skyboxPanel);
1671
- objectPanel.setIconAt(2, GetIcon("icons/skybox.jpg"));
1672
- objectPanel.setToolTipTextAt(2, "Backgrounds");
1673
-
1730
+ objectPanel.add(materialPanel);
1731
+ objectPanel.setIconAt(2, GetIcon("icons/material.png"));
1732
+ objectPanel.setToolTipTextAt(2, "Material");
1733
+
16741734 // JPanel north = new JPanel(new BorderLayout());
16751735 // north.setName("Edit");
16761736 // north.add(ctrlPanel, BorderLayout.NORTH);
16771737 // objectPanel.add(north);
16781738 objectPanel.add(editPanel);
1679
- objectPanel.setIconAt(3, GetIcon("icons/write.png"));
1739
+ objectPanel.setIconAt(3, GetIcon("icons/writewhite.png"));
16801740 objectPanel.setToolTipTextAt(3, "Edit controls");
16811741
1682
- objectPanel.add(XYZPanel);
1742
+ objectPanel.add(transformPanel);
16831743 objectPanel.setIconAt(4, GetIcon("icons/XYZ.png"));
1684
- objectPanel.setToolTipTextAt(4, "XYZ/RGB transform");
1744
+ objectPanel.setToolTipTextAt(4, "TRS transform");
16851745
1746
+ patchMaterial = true;
1747
+ cameraView.patchMaterial = this;
1748
+ objectPanel.setSelectedIndex(2);
1749
+
16861750 /*
16871751 aConstraints.gridx = 0;
16881752 aConstraints.gridwidth = 1;
....@@ -1702,7 +1766,7 @@
17021766 scrollpane.addMouseWheelListener(this); // Default not fast enough
17031767
17041768 /*JTabbedPane*/ scenePanel = new cGridBag();
1705
- scenePanel.preferredWidth = 5;
1769
+ scenePanel.preferredWidth = 6;
17061770
17071771 JTabbedPane tabbedPane = new JTabbedPane();
17081772 tabbedPane.add(scrollpane);
....@@ -1713,17 +1777,52 @@
17131777
17141778 AddOptions(optionsPanel); //, aConstraints);
17151779
1716
- tabbedPane.add(optionsPanel);
1717
-
17181780 tabbedPane.add(FSPane = new cFileSystemPane(this));
17191781
1782
+ tabbedPane.add(optionsPanel);
1783
+
17201784 scenePanel.add(tabbedPane);
17211785
1722
- //if (Globals.ADVANCED)
1723
-// tabbedPane.add(infoPanel);
1724
-// tabbedPane.setIconAt(3, GetIcon("icons/info.png"));
1725
-// tabbedPane.setToolTipTextAt(3, "Information");
1786
+ cGridBag creditsPanel = new cGridBag().setVertical(true);
1787
+ creditsPanel.setName("Credits");
17261788
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
+
17271826 /*
17281827 cTree jTree = new cTree(null);
17291828 ToolTipManager.sharedInstance().registerComponent(jTree);
....@@ -1744,13 +1843,13 @@
17441843 jtp.add(tree);
17451844 */
17461845
1747
- bigPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, scenePanel, gridPanel);
1748
- bigPanel.setContinuousLayout(true);
1749
- bigPanel.setOneTouchExpandable(true);
1750
- bigPanel.setDividerLocation(0.8);
1751
- bigPanel.setDividerSize(15);
1752
- bigPanel.setResizeWeight(0.15);
1753
- 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");
17541853
17551854 //bigPanel.setLayout(new BorderLayout());
17561855 //bigPanel.setSize(new Dimension(10,10));
....@@ -1834,7 +1933,7 @@
18341933
18351934 cameraView.requestFocusInWindow();
18361935
1837
- gridPanel.setDividerLocation(1.0);
1936
+// gridPanel.setDividerLocation(1.0);
18381937
18391938 frame.validate();
18401939
....@@ -1869,7 +1968,7 @@
18691968 {
18701969 cGridBag presetpanel = new cGridBag().setVertical(true);
18711970
1872
- cLabel skin = GetLabel("icons/shadericons/shadericon00000.png", !Grafreed.NIMBUSLAF);
1971
+ cLabel skin = GetLabel("icons/shadericons/shadericon00000.png", !Globals.NIMBUSLAF);
18731972 skin.setToolTipText("Skin");
18741973 skin.addMouseListener(new MouseAdapter()
18751974 {
....@@ -1880,7 +1979,15 @@
18801979
18811980 // Skin
18821981 colorField.setFloat(material.color);
1883
- 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
+
18841991 subsurfaceField.setFloat(material.subsurface);
18851992 selfshadowField.setFloat(material.diffuseness);
18861993 diffusenessField.setFloat(material.factor);
....@@ -1899,7 +2006,7 @@
18992006 });
19002007 presetpanel.add(skin);
19012008
1902
- cLabel lambert = GetLabel("icons/shadericons/shadericon00002.png", !Grafreed.NIMBUSLAF);
2009
+ cLabel lambert = GetLabel("icons/shadericons/shadericon00002.png", !Globals.NIMBUSLAF);
19032010 lambert.setToolTipText("Diffuse");
19042011 lambert.addMouseListener(new MouseAdapter()
19052012 {
....@@ -1917,7 +2024,7 @@
19172024 });
19182025 presetpanel.add(lambert);
19192026
1920
- cLabel diffuse2 = GetLabel("icons/shadericons/shadericon00003.png", !Grafreed.NIMBUSLAF);
2027
+ cLabel diffuse2 = GetLabel("icons/shadericons/shadericon00003.png", !Globals.NIMBUSLAF);
19212028 diffuse2.setToolTipText("Diffuse2");
19222029 diffuse2.addMouseListener(new MouseAdapter()
19232030 {
....@@ -1935,7 +2042,7 @@
19352042 });
19362043 presetpanel.add(diffuse2);
19372044
1938
- cLabel diffusemoon = GetLabel("icons/shadericons/shadericon00004.png", !Grafreed.NIMBUSLAF);
2045
+ cLabel diffusemoon = GetLabel("icons/shadericons/shadericon00004.png", !Globals.NIMBUSLAF);
19392046 diffusemoon.setToolTipText("Moon");
19402047 diffusemoon.addMouseListener(new MouseAdapter()
19412048 {
....@@ -1953,7 +2060,7 @@
19532060 });
19542061 presetpanel.add(diffusemoon);
19552062
1956
- cLabel diffusemoon2 = GetLabel("icons/shadericons/shadericon00005.png", !Grafreed.NIMBUSLAF);
2063
+ cLabel diffusemoon2 = GetLabel("icons/shadericons/shadericon00005.png", !Globals.NIMBUSLAF);
19572064 diffusemoon2.setToolTipText("Moon2");
19582065 diffusemoon2.addMouseListener(new MouseAdapter()
19592066 {
....@@ -1971,7 +2078,7 @@
19712078 });
19722079 presetpanel.add(diffusemoon2);
19732080
1974
- cLabel diffusemoon3 = GetLabel("icons/shadericons/shadericon00006.png", !Grafreed.NIMBUSLAF);
2081
+ cLabel diffusemoon3 = GetLabel("icons/shadericons/shadericon00006.png", !Globals.NIMBUSLAF);
19752082 diffusemoon3.setToolTipText("Moon3");
19762083 diffusemoon3.addMouseListener(new MouseAdapter()
19772084 {
....@@ -1989,7 +2096,7 @@
19892096 });
19902097 presetpanel.add(diffusemoon3);
19912098
1992
- cLabel diffusesheen = GetLabel("icons/shadericons/shadericon00007.png", !Grafreed.NIMBUSLAF);
2099
+ cLabel diffusesheen = GetLabel("icons/shadericons/shadericon00007.png", !Globals.NIMBUSLAF);
19932100 diffusesheen.setToolTipText("Sheen");
19942101 diffusesheen.addMouseListener(new MouseAdapter()
19952102 {
....@@ -2006,7 +2113,7 @@
20062113 });
20072114 presetpanel.add(diffusesheen);
20082115
2009
- cLabel rough = GetLabel("icons/shadericons/shadericon00001.png", !Grafreed.NIMBUSLAF);
2116
+ cLabel rough = GetLabel("icons/shadericons/shadericon00001.png", !Globals.NIMBUSLAF);
20102117 rough.setToolTipText("Rough metal");
20112118 rough.addMouseListener(new MouseAdapter()
20122119 {
....@@ -2024,7 +2131,7 @@
20242131 });
20252132 presetpanel.add(rough);
20262133
2027
- cLabel rough2 = GetLabel("icons/shadericons/shadericon00013.png", !Grafreed.NIMBUSLAF);
2134
+ cLabel rough2 = GetLabel("icons/shadericons/shadericon00013.png", !Globals.NIMBUSLAF);
20282135 rough2.setToolTipText("Medium metal");
20292136 rough2.addMouseListener(new MouseAdapter()
20302137 {
....@@ -2042,7 +2149,7 @@
20422149 });
20432150 presetpanel.add(rough2);
20442151
2045
- cLabel shini0 = GetLabel("icons/shadericons/shadericon00014.png", !Grafreed.NIMBUSLAF);
2152
+ cLabel shini0 = GetLabel("icons/shadericons/shadericon00014.png", !Globals.NIMBUSLAF);
20462153 shini0.setToolTipText("Shiny");
20472154 shini0.addMouseListener(new MouseAdapter()
20482155 {
....@@ -2060,7 +2167,7 @@
20602167 });
20612168 presetpanel.add(shini0);
20622169
2063
- cLabel shini1 = GetLabel("icons/shadericons/shadericon00011.png", !Grafreed.NIMBUSLAF);
2170
+ cLabel shini1 = GetLabel("icons/shadericons/shadericon00011.png", !Globals.NIMBUSLAF);
20642171 shini1.setToolTipText("Shiny2");
20652172 shini1.addMouseListener(new MouseAdapter()
20662173 {
....@@ -2078,7 +2185,7 @@
20782185 });
20792186 presetpanel.add(shini1);
20802187
2081
- cLabel shini2 = GetLabel("icons/shadericons/shadericon00012.png", !Grafreed.NIMBUSLAF);
2188
+ cLabel shini2 = GetLabel("icons/shadericons/shadericon00012.png", !Globals.NIMBUSLAF);
20822189 shini2.setToolTipText("Shiny3");
20832190 shini2.addMouseListener(new MouseAdapter()
20842191 {
....@@ -2096,7 +2203,7 @@
20962203 });
20972204 presetpanel.add(shini2);
20982205
2099
- cLabel aniso = GetLabel("icons/shadericons/shadericon00008.png", !Grafreed.NIMBUSLAF);
2206
+ cLabel aniso = GetLabel("icons/shadericons/shadericon00008.png", !Globals.NIMBUSLAF);
21002207 aniso.setToolTipText("AnisoU");
21012208 aniso.addMouseListener(new MouseAdapter()
21022209 {
....@@ -2114,7 +2221,7 @@
21142221 });
21152222 presetpanel.add(aniso);
21162223
2117
- cLabel aniso2 = GetLabel("icons/shadericons/shadericon00009.png", !Grafreed.NIMBUSLAF);
2224
+ cLabel aniso2 = GetLabel("icons/shadericons/shadericon00009.png", !Globals.NIMBUSLAF);
21182225 aniso2.setToolTipText("AnisoV");
21192226 aniso2.addMouseListener(new MouseAdapter()
21202227 {
....@@ -2132,7 +2239,7 @@
21322239 });
21332240 presetpanel.add(aniso2);
21342241
2135
- cLabel aniso3 = GetLabel("icons/shadericons/shadericon00010.png", !Grafreed.NIMBUSLAF);
2242
+ cLabel aniso3 = GetLabel("icons/shadericons/shadericon00010.png", !Globals.NIMBUSLAF);
21362243 aniso3.setToolTipText("AnisoUV");
21372244 aniso3.addMouseListener(new MouseAdapter()
21382245 {
....@@ -2150,7 +2257,7 @@
21502257 });
21512258 presetpanel.add(aniso3);
21522259
2153
- cLabel velvet0 = GetLabel("icons/shadericons/shadericon00015.png", !Grafreed.NIMBUSLAF);
2260
+ cLabel velvet0 = GetLabel("icons/shadericons/shadericon00015.png", !Globals.NIMBUSLAF);
21542261 velvet0.setToolTipText("Velvet");
21552262 velvet0.addMouseListener(new MouseAdapter()
21562263 {
....@@ -2172,7 +2279,7 @@
21722279 });
21732280 presetpanel.add(velvet0);
21742281
2175
- cLabel bump0 = GetLabel("icons/shadericons/shadericon00016.png", !Grafreed.NIMBUSLAF);
2282
+ cLabel bump0 = GetLabel("icons/shadericons/shadericon00016.png", !Globals.NIMBUSLAF);
21762283 bump0.setToolTipText("Bump texture");
21772284 bump0.addMouseListener(new MouseAdapter()
21782285 {
....@@ -2191,7 +2298,7 @@
21912298 });
21922299 presetpanel.add(bump0);
21932300
2194
- cLabel borderShader = GetLabel("icons/shadericons/borderfade.jpg", !Grafreed.NIMBUSLAF);
2301
+ cLabel borderShader = GetLabel("icons/shadericons/borderfade.jpg", !Globals.NIMBUSLAF);
21952302 borderShader.setToolTipText("Border fade");
21962303 borderShader.addMouseListener(new MouseAdapter()
21972304 {
....@@ -2206,7 +2313,7 @@
22062313 });
22072314 presetpanel.add(borderShader);
22082315
2209
- cLabel halo = GetLabel("icons/shadericons/shadericon00017.png", !Grafreed.NIMBUSLAF);
2316
+ cLabel halo = GetLabel("icons/shadericons/shadericon00017.png", !Globals.NIMBUSLAF);
22102317 halo.setToolTipText("Halo");
22112318 halo.addMouseListener(new MouseAdapter()
22122319 {
....@@ -2223,7 +2330,7 @@
22232330 });
22242331 presetpanel.add(halo);
22252332
2226
- cLabel candle = GetLabel("icons/shadericons/shadericon00018.png", !Grafreed.NIMBUSLAF);
2333
+ cLabel candle = GetLabel("icons/shadericons/shadericon00018.png", !Globals.NIMBUSLAF);
22272334 candle.setToolTipText("Candle");
22282335 candle.addMouseListener(new MouseAdapter()
22292336 {
....@@ -2245,7 +2352,7 @@
22452352 });
22462353 presetpanel.add(candle);
22472354
2248
- cLabel shadowShader = GetLabel("icons/shadericons/shadow.png", !Grafreed.NIMBUSLAF);
2355
+ cLabel shadowShader = GetLabel("icons/shadericons/shadow.png", !Globals.NIMBUSLAF);
22492356 shadowShader.setToolTipText("Shadow");
22502357 shadowShader.addMouseListener(new MouseAdapter()
22512358 {
....@@ -2280,19 +2387,19 @@
22802387
22812388 cGridBag editBar = new cGridBag().setVertical(false);
22822389
2283
- editBar.add(createMaterialButton = new cButton("Create", !Grafreed.NIMBUSLAF)); // , aConstraints);
2390
+ editBar.add(createMaterialButton = new cButton("Create", !Globals.NIMBUSLAF)); // , aConstraints);
22842391 createMaterialButton.setToolTipText("Create material");
22852392
22862393 /*
22872394 ctrlPanel.add(resetSlidersButton = new cButton("Reset All"), aConstraints);
22882395 */
22892396
2290
- editBar.add(clearMaterialButton = new cButton("Clear", !Grafreed.NIMBUSLAF)); // , aConstraints);
2397
+ editBar.add(clearMaterialButton = new cButton("Clear", !Globals.NIMBUSLAF)); // , aConstraints);
22912398 clearMaterialButton.setToolTipText("Clear material");
22922399
22932400 if (Globals.ADVANCED)
22942401 {
2295
- editBar.add(resetSlidersButton = new cButton("Reset", !Grafreed.NIMBUSLAF)); // , aConstraints);
2402
+ editBar.add(resetSlidersButton = new cButton("Reset", !Globals.NIMBUSLAF)); // , aConstraints);
22962403 editBar.add(propagateToggle = new cCheckBox("Prop", propagate)); // , aConstraints);
22972404 editBar.add(multiplyToggle = new cCheckBox("Mult", false)); // , aConstraints);
22982405 }
....@@ -3913,7 +4020,7 @@
39134020 //System.out.println("ObjEditor " + event);
39144021 applySelf0(true);
39154022 //parent.applySelf();
3916
- objEditor.refreshContents();
4023
+ // conflicts with requestFocus objEditor.refreshContents();
39174024 } else if (source == resetButton)
39184025 {
39194026 CameraPane.fullreset = true;
....@@ -4093,11 +4200,18 @@
40934200
40944201 void New()
40954202 {
4096
- while (copy.Size() > 1)
4203
+ while (copy.Size() > 0)
40974204 {
4098
- copy.remove(1);
4205
+ copy.remove(0);
40994206 }
41004207
4208
+ copy.selection.clear();
4209
+
4210
+ if (copy == Grafreed.grafreed.universe)
4211
+ {
4212
+ CreateCameras();
4213
+ cameraView.SetCamera(GetCamera(copy, 0));
4214
+ }
41014215 ResetModel();
41024216 objEditor.refreshContents();
41034217 }
....@@ -4225,8 +4339,6 @@
42254339 return true;
42264340 }
42274341
4228
- java.util.Hashtable<java.util.UUID, Object3D> versiontable = new java.util.Hashtable<java.util.UUID, Object3D>();
4229
-
42304342 void DeleteVersion()
42314343 {
42324344 for (int i = copy.versionindex; i < copy.versionlist.length-1; i++)
....@@ -4234,7 +4346,11 @@
42344346 copy.versionlist[i] = copy.versionlist[i+1];
42354347 }
42364348
4237
- CopyChanged();
4349
+ if (copy.versionlist[copy.versionindex] == null)
4350
+ copy.versionindex -= 1;
4351
+
4352
+ if (copy.versionindex != -1)
4353
+ CopyChanged();
42384354
42394355 SetVersionStates();
42404356 }
....@@ -4347,7 +4463,7 @@
43474463 boolean temp = CameraPane.SWITCH;
43484464 CameraPane.SWITCH = false;
43494465
4350
- copy.ExtractBigData(versiontable);
4466
+ copy.ExtractBigData(Grafreed.grafreed.universe.versiontable);
43514467
43524468 copy.clear();
43534469
....@@ -4359,7 +4475,7 @@
43594475 copy.add(obj.get(i));
43604476 }
43614477
4362
- copy.RestoreBigData(versiontable);
4478
+ copy.RestoreBigData(Grafreed.grafreed.universe.versiontable);
43634479
43644480 CameraPane.SWITCH = temp;
43654481
....@@ -4409,6 +4525,8 @@
44094525 return count;
44104526 }
44114527
4528
+ public cGridBag versionSliderPane;
4529
+
44124530 void SetVersionStates()
44134531 {
44144532 //if (true)
....@@ -4416,21 +4534,36 @@
44164534
44174535 //cRadio tab = GetCurrentTab();
44184536
4419
- restoreButton.setEnabled(copy.versionindex != -1);
4420
- replaceButton.setEnabled(copy.versionindex != -1);
4421
-
4422
- previousVersionButton.setEnabled(copy.versionindex > 0);
4423
- nextVersionButton.setEnabled(copy.versionlist[copy.versionindex + 1] != null);
4424
-
4425
- deleteVersionButton.setEnabled(//copy.versionindex > 0 &&
4426
- copy.versionlist[copy.versionindex + 1] != null);
4427
-
4428
- muteSlider = true;
4429
- versionSlider.setMinimum(0);
4430
- versionSlider.setMaximum(VersionCount() - 1);
4431
- versionSlider.setInteger(copy.versionindex);
4432
- versionSlider.setEnabled(copy.versionindex != -1);
4433
- 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
+ }
44344567 }
44354568
44364569 public boolean PreviousVersion()
....@@ -4488,7 +4621,7 @@
44884621
44894622 public boolean Replace()
44904623 {
4491
- System.err.println("Replace");
4624
+ //System.err.println("Replace");
44924625
44934626 //cRadio tab = GetCurrentTab();
44944627
....@@ -4715,6 +4848,12 @@
47154848 // else
47164849 // applySelf(true);
47174850 // }
4851
+
4852
+ boolean Equal(double a, double b)
4853
+ {
4854
+ return Math.abs(a - b) < 0.001;
4855
+ }
4856
+
47184857 void applySelf0(boolean name)
47194858 {
47204859 if (name)
....@@ -4764,29 +4903,52 @@
47644903 {
47654904 cMaterial mat = copy.material;
47664905
4767
- colorField.SetToolTipValue((mat.color));
4768
- saturationField.SetToolTipValue((mat.modulation));
4769
- metalnessField.SetToolTipValue((mat.metalness));
4770
- diffuseField.SetToolTipValue((mat.diffuse));
4771
- specularField.SetToolTipValue((mat.specular));
4772
- shininessField.SetToolTipValue((mat.shininess));
4773
- shiftField.SetToolTipValue((mat.shift));
4774
- ambientField.SetToolTipValue((mat.ambient));
4775
- lightareaField.SetToolTipValue((mat.lightarea));
4776
- diffusenessField.SetToolTipValue((mat.factor));
4777
- velvetField.SetToolTipValue((mat.velvet));
4778
- sheenField.SetToolTipValue((mat.sheen));
4779
- subsurfaceField.SetToolTipValue((mat.subsurface));
4780
- backlitField.SetToolTipValue((mat.bump));
4781
- anisoField.SetToolTipValue((mat.aniso));
4782
- anisoVField.SetToolTipValue((mat.anisoV));
4783
- cameraField.SetToolTipValue((mat.cameralight));
4784
- selfshadowField.SetToolTipValue((mat.diffuseness));
4785
- shadowField.SetToolTipValue((mat.shadow));
4786
- textureField.SetToolTipValue((mat.texture));
4787
- opacityField.SetToolTipValue((mat.opacity));
4788
- fakedepthField.SetToolTipValue((mat.fakedepth));
4789
- 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));
47904952 }
47914953
47924954 if (copy.material != null && copy.projectedVertices.length > 0 && copy.projectedVertices[0] != null)
....@@ -4821,7 +4983,7 @@
48214983
48224984 public void stateChanged(ChangeEvent e)
48234985 {
4824
- // assert(false);
4986
+ // assert(false);
48254987 if (e.getSource() == versionSlider)
48264988 {
48274989 if (muteSlider)
....@@ -5578,6 +5740,7 @@
55785740
55795741 copy.versionlist = readobj.versionlist;
55805742 copy.versionindex = readobj.versionindex;
5743
+ copy.versiontable = readobj.versiontable;
55815744
55825745 if (copy.versionlist == null)
55835746 {
....@@ -5933,6 +6096,7 @@
59336096 boolean materialFlushed;
59346097 Object3D latestObject;
59356098
6099
+ cGridBag transformPanel;
59366100 cGridBag XYZPanel;
59376101
59386102 JSplitPane gridPanel;