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 // {
....@@ -388,7 +406,8 @@
388406 //parent = p;
389407
390408 GraphicsDevice gd = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice();
391
- System.out.println("getFullScreenWindow? " + gd.getFullScreenWindow());
409
+ if (Globals.DEBUG)
410
+ System.out.println("getFullScreenWindow? " + gd.getFullScreenWindow());
392411 //gd.setFullScreenWindow(this);
393412 //setResizable(false);
394413 //if (!isDisplayable())
....@@ -425,6 +444,9 @@
425444
426445 static java.util.Vector<Object3D> listUI = new java.util.Vector<Object3D>();
427446
447
+ // This is to refresh the UI of the material panel.
448
+ boolean patchMaterial;
449
+
428450 void SetupMenu()
429451 {
430452 frame.setMenuBar(menuBar = new MenuBar());
....@@ -950,18 +972,29 @@
950972 boolean temp = CameraPane.SWITCH;
951973 CameraPane.SWITCH = false;
952974
953
- 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);
954979 // if (copy == client)
955980
956981 Object3D versions[] = object.versionlist;
982
+ java.util.Hashtable<java.util.UUID, Object3D> versiontable = object.versiontable; // if Grafreed.grafreed.universe
957983 object.versionlist = null;
984
+ object.versiontable = null;
985
+
986
+ Object3D parent = object.parent;
987
+ object.parent = null;
958988
959989 //byte[] compress = Compress(copy);
960990 Object3D compress = (Object3D)Grafreed.clone(object);
961991
962
- object.versionlist = versions;
992
+ object.parent = parent;
963993
964
- object.RestoreBigData(versiontable);
994
+ object.versionlist = versions;
995
+ object.versiontable = versiontable; // if Grafreed.grafreed.universe
996
+
997
+ object.RestoreBigData(Grafreed.grafreed.universe.versiontable);
965998
966999 CameraPane.SWITCH = temp;
9671000
....@@ -1300,7 +1333,7 @@
13001333
13011334 //if (copy.pinned)
13021335 {
1303
- pinButton = GetToggleButton("icons/pin.png", !Grafreed.NIMBUSLAF);
1336
+ pinButton = GetToggleButton("icons/pin.png", !Globals.NIMBUSLAF);
13041337 pinButton.setSelected(copy.pinned);
13051338 cGridBag t = new cGridBag();
13061339 t.preferredWidth = 2;
....@@ -1323,14 +1356,14 @@
13231356
13241357 liveCB = AddCheckBox(setupPanel, "Live", copy.live);
13251358 liveCB.setToolTipText("Animate object");
1359
+ markCB = AddCheckBox(setupPanel, "Anim", copy.marked);
1360
+ markCB.setToolTipText("Set target transform");
13261361 selectableCB = AddCheckBox(setupPanel, "Select", !copy.dontselect);
13271362 selectableCB.setToolTipText("Make object selectable");
13281363 // Return();
13291364
13301365 hideCB = AddCheckBox(setupPanel, "Hide", copy.hide);
13311366 hideCB.setToolTipText("Hide object");
1332
- markCB = AddCheckBox(setupPanel, "Mark", copy.marked);
1333
- markCB.setToolTipText("As animation target transform");
13341367
13351368 ToolTipManager.sharedInstance().setLightWeightPopupEnabled(false);
13361369
....@@ -1532,22 +1565,9 @@
15321565
15331566 if (cam == null || !(copy.get(0) instanceof cGroup))
15341567 {
1535
- System.out.println("CREATE CAMERAS");
1536
- cams = new cTemplate();
1537
- cams.name = "Cameras";
1538
- copy.insertElementAt(cams, 0);
1539
- //cams.parent = copy;
1540
-
1541
- cam = new Camera(); // LA.newVector(3, 2, 1));
1542
- cams.addChild(cam);
1543
- cam = new Camera(1);
1544
- cams.addChild(cam);
1545
- cam = new Camera(2);
1546
- cams.addChild(cam);
1547
- cam = new Camera(3);
1548
- cams.addChild(cam);
1549
- cam = new Camera(4); // Light
1550
- cams.addChild(cam);
1568
+ if (Globals.DEBUG)
1569
+ System.out.println("CREATE CAMERAS");
1570
+ cams = CreateCameras();
15511571 } else
15521572 {
15531573 cams = (cGroup) copy.get(0);
....@@ -1613,6 +1633,45 @@
16131633 //frontView.object = copy;
16141634 //sideView.object = copy;
16151635
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
+
16161675 XYZPanel = new cGridBag().setVertical(true);
16171676 //XYZPanel.setLayout(new GridLayout(3, 1, 5, 5));
16181677
....@@ -1622,6 +1681,9 @@
16221681 XYZPanel.addComponent(/*BorderLayout.NORTH,*/topView); // Scroll);
16231682 //XYZPanel.setName("XYZ");
16241683
1684
+ transformPanel.add(resetTransformPanel);
1685
+ transformPanel.add(XYZPanel);
1686
+
16251687 /*
16261688 gridPanel = new JPanel(); //new BorderLayout());
16271689 gridPanel.setLayout(new GridLayout(1, 2));
....@@ -1629,12 +1691,12 @@
16291691 gridPanel.add(cameraView);
16301692 gridPanel.add(XYZPanel);
16311693 */
1632
- gridPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, centralPanel, XYZPanel); //new BorderLayout());
1633
- gridPanel.setContinuousLayout(true);
1634
- gridPanel.setOneTouchExpandable(true);
1635
- gridPanel.setDividerLocation(1.0);
1636
- gridPanel.setDividerSize(9);
1637
- 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);
16381700
16391701 // aConstraints.weighty = 0;
16401702 //System.out.println("THIS = " + this);
....@@ -1657,30 +1719,34 @@
16571719
16581720 //JScrollPane tmp = new JScrollPane(ctrlPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
16591721 //tmp.setName("Edit");
1660
- objectPanel.add(materialPanel);
1661
- objectPanel.setIconAt(0, GetIcon("icons/material.png"));
1662
- objectPanel.setToolTipTextAt(0, "Material");
1663
-
1722
+ objectPanel.add(skyboxPanel);
1723
+ objectPanel.setIconAt(0, GetIcon("icons/skybox.jpg"));
1724
+ objectPanel.setToolTipTextAt(0, "Backgrounds");
1725
+
16641726 objectPanel.add(toolboxPanel);
16651727 objectPanel.setIconAt(1, GetIcon("icons/primitives.png"));
16661728 objectPanel.setToolTipTextAt(1, "Objects & textures");
16671729
1668
- objectPanel.add(skyboxPanel);
1669
- objectPanel.setIconAt(2, GetIcon("icons/skybox.jpg"));
1670
- objectPanel.setToolTipTextAt(2, "Backgrounds");
1671
-
1730
+ objectPanel.add(materialPanel);
1731
+ objectPanel.setIconAt(2, GetIcon("icons/material.png"));
1732
+ objectPanel.setToolTipTextAt(2, "Material");
1733
+
16721734 // JPanel north = new JPanel(new BorderLayout());
16731735 // north.setName("Edit");
16741736 // north.add(ctrlPanel, BorderLayout.NORTH);
16751737 // objectPanel.add(north);
16761738 objectPanel.add(editPanel);
1677
- objectPanel.setIconAt(3, GetIcon("icons/write.png"));
1739
+ objectPanel.setIconAt(3, GetIcon("icons/writewhite.png"));
16781740 objectPanel.setToolTipTextAt(3, "Edit controls");
16791741
1680
- objectPanel.add(XYZPanel);
1742
+ objectPanel.add(transformPanel);
16811743 objectPanel.setIconAt(4, GetIcon("icons/XYZ.png"));
1682
- objectPanel.setToolTipTextAt(4, "XYZ/RGB transform");
1744
+ objectPanel.setToolTipTextAt(4, "TRS transform");
16831745
1746
+ patchMaterial = true;
1747
+ cameraView.patchMaterial = this;
1748
+ objectPanel.setSelectedIndex(2);
1749
+
16841750 /*
16851751 aConstraints.gridx = 0;
16861752 aConstraints.gridwidth = 1;
....@@ -1700,7 +1766,7 @@
17001766 scrollpane.addMouseWheelListener(this); // Default not fast enough
17011767
17021768 /*JTabbedPane*/ scenePanel = new cGridBag();
1703
- scenePanel.preferredWidth = 5;
1769
+ scenePanel.preferredWidth = 6;
17041770
17051771 JTabbedPane tabbedPane = new JTabbedPane();
17061772 tabbedPane.add(scrollpane);
....@@ -1711,17 +1777,52 @@
17111777
17121778 AddOptions(optionsPanel); //, aConstraints);
17131779
1714
- tabbedPane.add(optionsPanel);
1715
-
17161780 tabbedPane.add(FSPane = new cFileSystemPane(this));
17171781
1782
+ tabbedPane.add(optionsPanel);
1783
+
17181784 scenePanel.add(tabbedPane);
17191785
1720
- //if (Globals.ADVANCED)
1721
-// tabbedPane.add(infoPanel);
1722
-// tabbedPane.setIconAt(3, GetIcon("icons/info.png"));
1723
-// tabbedPane.setToolTipTextAt(3, "Information");
1786
+ cGridBag creditsPanel = new cGridBag().setVertical(true);
1787
+ creditsPanel.setName("Credits");
17241788
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
+
17251826 /*
17261827 cTree jTree = new cTree(null);
17271828 ToolTipManager.sharedInstance().registerComponent(jTree);
....@@ -1742,13 +1843,13 @@
17421843 jtp.add(tree);
17431844 */
17441845
1745
- bigPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, scenePanel, gridPanel);
1746
- bigPanel.setContinuousLayout(true);
1747
- bigPanel.setOneTouchExpandable(true);
1748
- bigPanel.setDividerLocation(0.8);
1749
- bigPanel.setDividerSize(15);
1750
- bigPanel.setResizeWeight(0.15);
1751
- 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");
17521853
17531854 //bigPanel.setLayout(new BorderLayout());
17541855 //bigPanel.setSize(new Dimension(10,10));
....@@ -1832,7 +1933,7 @@
18321933
18331934 cameraView.requestFocusInWindow();
18341935
1835
- gridPanel.setDividerLocation(1.0);
1936
+// gridPanel.setDividerLocation(1.0);
18361937
18371938 frame.validate();
18381939
....@@ -1867,7 +1968,7 @@
18671968 {
18681969 cGridBag presetpanel = new cGridBag().setVertical(true);
18691970
1870
- cLabel skin = GetLabel("icons/shadericons/shadericon00000.png", !Grafreed.NIMBUSLAF);
1971
+ cLabel skin = GetLabel("icons/shadericons/shadericon00000.png", !Globals.NIMBUSLAF);
18711972 skin.setToolTipText("Skin");
18721973 skin.addMouseListener(new MouseAdapter()
18731974 {
....@@ -1878,7 +1979,15 @@
18781979
18791980 // Skin
18801981 colorField.setFloat(material.color);
1881
- 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
+
18821991 subsurfaceField.setFloat(material.subsurface);
18831992 selfshadowField.setFloat(material.diffuseness);
18841993 diffusenessField.setFloat(material.factor);
....@@ -1897,7 +2006,7 @@
18972006 });
18982007 presetpanel.add(skin);
18992008
1900
- cLabel lambert = GetLabel("icons/shadericons/shadericon00002.png", !Grafreed.NIMBUSLAF);
2009
+ cLabel lambert = GetLabel("icons/shadericons/shadericon00002.png", !Globals.NIMBUSLAF);
19012010 lambert.setToolTipText("Diffuse");
19022011 lambert.addMouseListener(new MouseAdapter()
19032012 {
....@@ -1915,7 +2024,7 @@
19152024 });
19162025 presetpanel.add(lambert);
19172026
1918
- cLabel diffuse2 = GetLabel("icons/shadericons/shadericon00003.png", !Grafreed.NIMBUSLAF);
2027
+ cLabel diffuse2 = GetLabel("icons/shadericons/shadericon00003.png", !Globals.NIMBUSLAF);
19192028 diffuse2.setToolTipText("Diffuse2");
19202029 diffuse2.addMouseListener(new MouseAdapter()
19212030 {
....@@ -1933,7 +2042,7 @@
19332042 });
19342043 presetpanel.add(diffuse2);
19352044
1936
- cLabel diffusemoon = GetLabel("icons/shadericons/shadericon00004.png", !Grafreed.NIMBUSLAF);
2045
+ cLabel diffusemoon = GetLabel("icons/shadericons/shadericon00004.png", !Globals.NIMBUSLAF);
19372046 diffusemoon.setToolTipText("Moon");
19382047 diffusemoon.addMouseListener(new MouseAdapter()
19392048 {
....@@ -1951,7 +2060,7 @@
19512060 });
19522061 presetpanel.add(diffusemoon);
19532062
1954
- cLabel diffusemoon2 = GetLabel("icons/shadericons/shadericon00005.png", !Grafreed.NIMBUSLAF);
2063
+ cLabel diffusemoon2 = GetLabel("icons/shadericons/shadericon00005.png", !Globals.NIMBUSLAF);
19552064 diffusemoon2.setToolTipText("Moon2");
19562065 diffusemoon2.addMouseListener(new MouseAdapter()
19572066 {
....@@ -1969,7 +2078,7 @@
19692078 });
19702079 presetpanel.add(diffusemoon2);
19712080
1972
- cLabel diffusemoon3 = GetLabel("icons/shadericons/shadericon00006.png", !Grafreed.NIMBUSLAF);
2081
+ cLabel diffusemoon3 = GetLabel("icons/shadericons/shadericon00006.png", !Globals.NIMBUSLAF);
19732082 diffusemoon3.setToolTipText("Moon3");
19742083 diffusemoon3.addMouseListener(new MouseAdapter()
19752084 {
....@@ -1987,7 +2096,7 @@
19872096 });
19882097 presetpanel.add(diffusemoon3);
19892098
1990
- cLabel diffusesheen = GetLabel("icons/shadericons/shadericon00007.png", !Grafreed.NIMBUSLAF);
2099
+ cLabel diffusesheen = GetLabel("icons/shadericons/shadericon00007.png", !Globals.NIMBUSLAF);
19912100 diffusesheen.setToolTipText("Sheen");
19922101 diffusesheen.addMouseListener(new MouseAdapter()
19932102 {
....@@ -2004,7 +2113,7 @@
20042113 });
20052114 presetpanel.add(diffusesheen);
20062115
2007
- cLabel rough = GetLabel("icons/shadericons/shadericon00001.png", !Grafreed.NIMBUSLAF);
2116
+ cLabel rough = GetLabel("icons/shadericons/shadericon00001.png", !Globals.NIMBUSLAF);
20082117 rough.setToolTipText("Rough metal");
20092118 rough.addMouseListener(new MouseAdapter()
20102119 {
....@@ -2022,7 +2131,7 @@
20222131 });
20232132 presetpanel.add(rough);
20242133
2025
- cLabel rough2 = GetLabel("icons/shadericons/shadericon00013.png", !Grafreed.NIMBUSLAF);
2134
+ cLabel rough2 = GetLabel("icons/shadericons/shadericon00013.png", !Globals.NIMBUSLAF);
20262135 rough2.setToolTipText("Medium metal");
20272136 rough2.addMouseListener(new MouseAdapter()
20282137 {
....@@ -2040,7 +2149,7 @@
20402149 });
20412150 presetpanel.add(rough2);
20422151
2043
- cLabel shini0 = GetLabel("icons/shadericons/shadericon00014.png", !Grafreed.NIMBUSLAF);
2152
+ cLabel shini0 = GetLabel("icons/shadericons/shadericon00014.png", !Globals.NIMBUSLAF);
20442153 shini0.setToolTipText("Shiny");
20452154 shini0.addMouseListener(new MouseAdapter()
20462155 {
....@@ -2058,7 +2167,7 @@
20582167 });
20592168 presetpanel.add(shini0);
20602169
2061
- cLabel shini1 = GetLabel("icons/shadericons/shadericon00011.png", !Grafreed.NIMBUSLAF);
2170
+ cLabel shini1 = GetLabel("icons/shadericons/shadericon00011.png", !Globals.NIMBUSLAF);
20622171 shini1.setToolTipText("Shiny2");
20632172 shini1.addMouseListener(new MouseAdapter()
20642173 {
....@@ -2076,7 +2185,7 @@
20762185 });
20772186 presetpanel.add(shini1);
20782187
2079
- cLabel shini2 = GetLabel("icons/shadericons/shadericon00012.png", !Grafreed.NIMBUSLAF);
2188
+ cLabel shini2 = GetLabel("icons/shadericons/shadericon00012.png", !Globals.NIMBUSLAF);
20802189 shini2.setToolTipText("Shiny3");
20812190 shini2.addMouseListener(new MouseAdapter()
20822191 {
....@@ -2094,7 +2203,7 @@
20942203 });
20952204 presetpanel.add(shini2);
20962205
2097
- cLabel aniso = GetLabel("icons/shadericons/shadericon00008.png", !Grafreed.NIMBUSLAF);
2206
+ cLabel aniso = GetLabel("icons/shadericons/shadericon00008.png", !Globals.NIMBUSLAF);
20982207 aniso.setToolTipText("AnisoU");
20992208 aniso.addMouseListener(new MouseAdapter()
21002209 {
....@@ -2112,7 +2221,7 @@
21122221 });
21132222 presetpanel.add(aniso);
21142223
2115
- cLabel aniso2 = GetLabel("icons/shadericons/shadericon00009.png", !Grafreed.NIMBUSLAF);
2224
+ cLabel aniso2 = GetLabel("icons/shadericons/shadericon00009.png", !Globals.NIMBUSLAF);
21162225 aniso2.setToolTipText("AnisoV");
21172226 aniso2.addMouseListener(new MouseAdapter()
21182227 {
....@@ -2130,7 +2239,7 @@
21302239 });
21312240 presetpanel.add(aniso2);
21322241
2133
- cLabel aniso3 = GetLabel("icons/shadericons/shadericon00010.png", !Grafreed.NIMBUSLAF);
2242
+ cLabel aniso3 = GetLabel("icons/shadericons/shadericon00010.png", !Globals.NIMBUSLAF);
21342243 aniso3.setToolTipText("AnisoUV");
21352244 aniso3.addMouseListener(new MouseAdapter()
21362245 {
....@@ -2148,7 +2257,7 @@
21482257 });
21492258 presetpanel.add(aniso3);
21502259
2151
- cLabel velvet0 = GetLabel("icons/shadericons/shadericon00015.png", !Grafreed.NIMBUSLAF);
2260
+ cLabel velvet0 = GetLabel("icons/shadericons/shadericon00015.png", !Globals.NIMBUSLAF);
21522261 velvet0.setToolTipText("Velvet");
21532262 velvet0.addMouseListener(new MouseAdapter()
21542263 {
....@@ -2170,7 +2279,7 @@
21702279 });
21712280 presetpanel.add(velvet0);
21722281
2173
- cLabel bump0 = GetLabel("icons/shadericons/shadericon00016.png", !Grafreed.NIMBUSLAF);
2282
+ cLabel bump0 = GetLabel("icons/shadericons/shadericon00016.png", !Globals.NIMBUSLAF);
21742283 bump0.setToolTipText("Bump texture");
21752284 bump0.addMouseListener(new MouseAdapter()
21762285 {
....@@ -2189,14 +2298,14 @@
21892298 });
21902299 presetpanel.add(bump0);
21912300
2192
- cLabel borderShader = GetLabel("icons/shadericons/borderfade.jpg", !Grafreed.NIMBUSLAF);
2301
+ cLabel borderShader = GetLabel("icons/shadericons/borderfade.jpg", !Globals.NIMBUSLAF);
21932302 borderShader.setToolTipText("Border fade");
21942303 borderShader.addMouseListener(new MouseAdapter()
21952304 {
21962305 public void mouseClicked(MouseEvent e)
21972306 {
21982307 borderfadeField.setFloat(0.5);
2199
- opacityField.setFloat(0.6);
2308
+ opacityField.setFloat(0.75);
22002309
22012310 materialtouched = true;
22022311 applySelf();
....@@ -2204,7 +2313,7 @@
22042313 });
22052314 presetpanel.add(borderShader);
22062315
2207
- cLabel halo = GetLabel("icons/shadericons/shadericon00017.png", !Grafreed.NIMBUSLAF);
2316
+ cLabel halo = GetLabel("icons/shadericons/shadericon00017.png", !Globals.NIMBUSLAF);
22082317 halo.setToolTipText("Halo");
22092318 halo.addMouseListener(new MouseAdapter()
22102319 {
....@@ -2221,7 +2330,7 @@
22212330 });
22222331 presetpanel.add(halo);
22232332
2224
- cLabel candle = GetLabel("icons/shadericons/shadericon00018.png", !Grafreed.NIMBUSLAF);
2333
+ cLabel candle = GetLabel("icons/shadericons/shadericon00018.png", !Globals.NIMBUSLAF);
22252334 candle.setToolTipText("Candle");
22262335 candle.addMouseListener(new MouseAdapter()
22272336 {
....@@ -2243,7 +2352,7 @@
22432352 });
22442353 presetpanel.add(candle);
22452354
2246
- cLabel shadowShader = GetLabel("icons/shadericons/shadow.png", !Grafreed.NIMBUSLAF);
2355
+ cLabel shadowShader = GetLabel("icons/shadericons/shadow.png", !Globals.NIMBUSLAF);
22472356 shadowShader.setToolTipText("Shadow");
22482357 shadowShader.addMouseListener(new MouseAdapter()
22492358 {
....@@ -2278,19 +2387,19 @@
22782387
22792388 cGridBag editBar = new cGridBag().setVertical(false);
22802389
2281
- editBar.add(createMaterialButton = new cButton("Create", !Grafreed.NIMBUSLAF)); // , aConstraints);
2390
+ editBar.add(createMaterialButton = new cButton("Create", !Globals.NIMBUSLAF)); // , aConstraints);
22822391 createMaterialButton.setToolTipText("Create material");
22832392
22842393 /*
22852394 ctrlPanel.add(resetSlidersButton = new cButton("Reset All"), aConstraints);
22862395 */
22872396
2288
- editBar.add(clearMaterialButton = new cButton("Clear", !Grafreed.NIMBUSLAF)); // , aConstraints);
2397
+ editBar.add(clearMaterialButton = new cButton("Clear", !Globals.NIMBUSLAF)); // , aConstraints);
22892398 clearMaterialButton.setToolTipText("Clear material");
22902399
22912400 if (Globals.ADVANCED)
22922401 {
2293
- editBar.add(resetSlidersButton = new cButton("Reset", !Grafreed.NIMBUSLAF)); // , aConstraints);
2402
+ editBar.add(resetSlidersButton = new cButton("Reset", !Globals.NIMBUSLAF)); // , aConstraints);
22942403 editBar.add(propagateToggle = new cCheckBox("Prop", propagate)); // , aConstraints);
22952404 editBar.add(multiplyToggle = new cCheckBox("Mult", false)); // , aConstraints);
22962405 }
....@@ -2311,9 +2420,20 @@
23112420
23122421 cGridBag huepanel = new cGridBag();
23132422 cGridBag huelabel = new cGridBag();
2314
- skin = GetLabel("icons/hue.png", false);
2315
- skin.fit = true;
2316
- huelabel.add(skin);
2423
+ cLabel hue = GetLabel("icons/hue.png", false);
2424
+ hue.fit = true;
2425
+
2426
+ hue.addMouseListener(new MouseAdapter()
2427
+ {
2428
+ public void mousePressed(MouseEvent e)
2429
+ {
2430
+ int x = e.getX();
2431
+
2432
+ colorField.setFloat((double)x / ((cLabel)e.getSource()).getWidth());
2433
+ }
2434
+ });
2435
+
2436
+ huelabel.add(hue);
23172437 huelabel.preferredWidth = 20;
23182438 huepanel.add(new cGridBag()); // Label
23192439 huepanel.add(huelabel); // Field/slider
....@@ -3900,7 +4020,7 @@
39004020 //System.out.println("ObjEditor " + event);
39014021 applySelf0(true);
39024022 //parent.applySelf();
3903
- objEditor.refreshContents();
4023
+ // conflicts with requestFocus objEditor.refreshContents();
39044024 } else if (source == resetButton)
39054025 {
39064026 CameraPane.fullreset = true;
....@@ -4080,11 +4200,18 @@
40804200
40814201 void New()
40824202 {
4083
- while (copy.Size() > 1)
4203
+ while (copy.Size() > 0)
40844204 {
4085
- copy.remove(1);
4205
+ copy.remove(0);
40864206 }
40874207
4208
+ copy.selection.clear();
4209
+
4210
+ if (copy == Grafreed.grafreed.universe)
4211
+ {
4212
+ CreateCameras();
4213
+ cameraView.SetCamera(GetCamera(copy, 0));
4214
+ }
40884215 ResetModel();
40894216 objEditor.refreshContents();
40904217 }
....@@ -4212,8 +4339,6 @@
42124339 return true;
42134340 }
42144341
4215
- java.util.Hashtable<java.util.UUID, Object3D> versiontable = new java.util.Hashtable<java.util.UUID, Object3D>();
4216
-
42174342 void DeleteVersion()
42184343 {
42194344 for (int i = copy.versionindex; i < copy.versionlist.length-1; i++)
....@@ -4221,7 +4346,11 @@
42214346 copy.versionlist[i] = copy.versionlist[i+1];
42224347 }
42234348
4224
- CopyChanged();
4349
+ if (copy.versionlist[copy.versionindex] == null)
4350
+ copy.versionindex -= 1;
4351
+
4352
+ if (copy.versionindex != -1)
4353
+ CopyChanged();
42254354
42264355 SetVersionStates();
42274356 }
....@@ -4334,7 +4463,7 @@
43344463 boolean temp = CameraPane.SWITCH;
43354464 CameraPane.SWITCH = false;
43364465
4337
- copy.ExtractBigData(versiontable);
4466
+ copy.ExtractBigData(Grafreed.grafreed.universe.versiontable);
43384467
43394468 copy.clear();
43404469
....@@ -4346,7 +4475,7 @@
43464475 copy.add(obj.get(i));
43474476 }
43484477
4349
- copy.RestoreBigData(versiontable);
4478
+ copy.RestoreBigData(Grafreed.grafreed.universe.versiontable);
43504479
43514480 CameraPane.SWITCH = temp;
43524481
....@@ -4396,6 +4525,8 @@
43964525 return count;
43974526 }
43984527
4528
+ public cGridBag versionSliderPane;
4529
+
43994530 void SetVersionStates()
44004531 {
44014532 //if (true)
....@@ -4403,21 +4534,36 @@
44034534
44044535 //cRadio tab = GetCurrentTab();
44054536
4406
- restoreButton.setEnabled(copy.versionindex != -1);
4407
- replaceButton.setEnabled(copy.versionindex != -1);
4408
-
4409
- previousVersionButton.setEnabled(copy.versionindex > 0);
4410
- nextVersionButton.setEnabled(copy.versionlist[copy.versionindex + 1] != null);
4411
-
4412
- deleteVersionButton.setEnabled(//copy.versionindex > 0 &&
4413
- copy.versionlist[copy.versionindex + 1] != null);
4414
-
4415
- muteSlider = true;
4416
- versionSlider.setMinimum(0);
4417
- versionSlider.setMaximum(VersionCount() - 1);
4418
- versionSlider.setInteger(copy.versionindex);
4419
- versionSlider.setEnabled(copy.versionindex != -1);
4420
- 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
+ }
44214567 }
44224568
44234569 public boolean PreviousVersion()
....@@ -4475,7 +4621,7 @@
44754621
44764622 public boolean Replace()
44774623 {
4478
- System.err.println("Replace");
4624
+ //System.err.println("Replace");
44794625
44804626 //cRadio tab = GetCurrentTab();
44814627
....@@ -4702,6 +4848,12 @@
47024848 // else
47034849 // applySelf(true);
47044850 // }
4851
+
4852
+ boolean Equal(double a, double b)
4853
+ {
4854
+ return Math.abs(a - b) < 0.001;
4855
+ }
4856
+
47054857 void applySelf0(boolean name)
47064858 {
47074859 if (name)
....@@ -4751,29 +4903,52 @@
47514903 {
47524904 cMaterial mat = copy.material;
47534905
4754
- colorField.SetToolTipValue((mat.color));
4755
- saturationField.SetToolTipValue((mat.modulation));
4756
- metalnessField.SetToolTipValue((mat.metalness));
4757
- diffuseField.SetToolTipValue((mat.diffuse));
4758
- specularField.SetToolTipValue((mat.specular));
4759
- shininessField.SetToolTipValue((mat.shininess));
4760
- shiftField.SetToolTipValue((mat.shift));
4761
- ambientField.SetToolTipValue((mat.ambient));
4762
- lightareaField.SetToolTipValue((mat.lightarea));
4763
- diffusenessField.SetToolTipValue((mat.factor));
4764
- velvetField.SetToolTipValue((mat.velvet));
4765
- sheenField.SetToolTipValue((mat.sheen));
4766
- subsurfaceField.SetToolTipValue((mat.subsurface));
4767
- backlitField.SetToolTipValue((mat.bump));
4768
- anisoField.SetToolTipValue((mat.aniso));
4769
- anisoVField.SetToolTipValue((mat.anisoV));
4770
- cameraField.SetToolTipValue((mat.cameralight));
4771
- selfshadowField.SetToolTipValue((mat.diffuseness));
4772
- shadowField.SetToolTipValue((mat.shadow));
4773
- textureField.SetToolTipValue((mat.texture));
4774
- opacityField.SetToolTipValue((mat.opacity));
4775
- fakedepthField.SetToolTipValue((mat.fakedepth));
4776
- 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));
47774952 }
47784953
47794954 if (copy.material != null && copy.projectedVertices.length > 0 && copy.projectedVertices[0] != null)
....@@ -4808,7 +4983,7 @@
48084983
48094984 public void stateChanged(ChangeEvent e)
48104985 {
4811
- // assert(false);
4986
+ // assert(false);
48124987 if (e.getSource() == versionSlider)
48134988 {
48144989 if (muteSlider)
....@@ -5178,6 +5353,8 @@
51785353
51795354 if (previousVersionButton != null && copy.versionlist != null)
51805355 SetVersionStates();
5356
+
5357
+ cameraView.requestFocusInWindow();
51815358 }
51825359
51835360 static TweenManager tweenManager = new TweenManager();
....@@ -5209,7 +5386,7 @@
52095386 // group = (Composite) group.get(0);
52105387 // }
52115388
5212
- System.out.println("makeSomething of " + thing);
5389
+ //System.out.println("makeSomething of " + thing);
52135390
52145391 /*
52155392 if (deselect && jList != null)
....@@ -5563,6 +5740,7 @@
55635740
55645741 copy.versionlist = readobj.versionlist;
55655742 copy.versionindex = readobj.versionindex;
5743
+ copy.versiontable = readobj.versiontable;
55665744
55675745 if (copy.versionlist == null)
55685746 {
....@@ -5918,6 +6096,7 @@
59186096 boolean materialFlushed;
59196097 Object3D latestObject;
59206098
6099
+ cGridBag transformPanel;
59216100 cGridBag XYZPanel;
59226101
59236102 JSplitPane gridPanel;