Normand Briere
2019-08-15 24a2a946b35279605e645349bd6b82e9e60aac88
ObjEditor.java
....@@ -34,6 +34,7 @@
3434 iSendInfo
3535 //KeyListener
3636 {
37
+ public cToggleButton pinButton;
3738 boolean timeline;
3839 boolean wasFullScreen;
3940
....@@ -41,11 +42,25 @@
4142 JFrame frame;
4243
4344 static ObjEditor theFrame;
45
+
46
+ public cGridBag GetSeparator()
47
+ {
48
+ cGridBag separator = new cGridBag();
49
+ separator.add(new JSeparator());
50
+ separator.preferredHeight = 5;
51
+ return separator;
52
+ }
4453
4554 cButton GetButton(String name, boolean border)
4655 {
4756 ImageIcon icon = GetIcon(name);
4857 return new cButton(icon, border);
58
+ }
59
+
60
+ cLabel GetLabel(String name, boolean border)
61
+ {
62
+ //ImageIcon icon = GetIcon(name);
63
+ return new cLabel(GetImage(name), border);
4964 }
5065
5166 cToggleButton GetToggleButton(String name, boolean border)
....@@ -60,26 +75,52 @@
6075 return new cCheckBox(icon, border);
6176 }
6277
63
- private ImageIcon GetIcon(String name)
78
+ static java.util.Hashtable<String, javax.swing.ImageIcon> icons = new java.util.Hashtable<String, javax.swing.ImageIcon>();
79
+
80
+ ImageIcon GetIcon(String name)
6481 {
82
+ javax.swing.ImageIcon iconCache = icons.get(name);
83
+ if (iconCache != null)
84
+ {
85
+ return iconCache;
86
+ }
87
+
6588 try
6689 {
6790 BufferedImage image = javax.imageio.ImageIO.read(getClass().getClassLoader().getResourceAsStream(name));
6891
69
-// if (image.getWidth() != 24 && image.getHeight() != 24)
92
+// if (image.getWidth() > 48 && image.getHeight() > 48)
7093 // {
71
-// BufferedImage resized = new BufferedImage(24, 24, image.getType());
94
+// BufferedImage resized = new BufferedImage(48, 48, image.getType());
7295 // Graphics2D g = resized.createGraphics();
7396 // g.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR);
7497 // //g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
75
-// g.drawImage(image, 0, 0, 24, 24, 0, 0, image.getWidth(), image.getHeight(), null);
98
+// g.drawImage(image, 0, 0, 48, 48, 0, 0, image.getWidth(), image.getHeight(), null);
7699 // g.dispose();
77100 //
78101 // image = resized;
79102 // }
80103
81104 javax.swing.ImageIcon icon = new javax.swing.ImageIcon(image);
105
+
106
+ icons.put(name, icon);
107
+
82108 return icon;
109
+ }
110
+ catch (Exception e)
111
+ {
112
+ //icons.put(name, null);
113
+ return null;
114
+ }
115
+ }
116
+
117
+ BufferedImage GetImage(String name)
118
+ {
119
+ try
120
+ {
121
+ BufferedImage image = javax.imageio.ImageIO.read(getClass().getClassLoader().getResourceAsStream(name));
122
+
123
+ return image;
83124 }
84125 catch (Exception e)
85126 {
....@@ -268,11 +309,13 @@
268309 client = inClient;
269310 copy = client;
270311
271
- if (copy.versions == null)
272
- {
273
- copy.versions = new byte[100][];
274
- copy.versionindex = -1;
275
- }
312
+// if (copy.versionlist == null)
313
+// {
314
+// copy.versionlist = new Object3D[100];
315
+// copy.versionindex = -1;
316
+//
317
+// callee.Save(true);
318
+// }
276319
277320 // "this" is not called: SetupUI2(objEditor);
278321 }
....@@ -287,10 +330,12 @@
287330 client = inClient;
288331 copy = client;
289332
290
- if (copy.versions == null)
333
+ if (copy.versionlist == null)
291334 {
292
- copy.versions = new byte[100][];
335
+ copy.versionlist = new Object3D[100];
293336 copy.versionindex = -1;
337
+
338
+// Save(true);
294339 }
295340
296341 SetupUI2(callee.GetEditor());
....@@ -325,11 +370,13 @@
325370 copy = localCopy;
326371 copy.editWindow = this;
327372
328
- if (copy.versions == null)
329
- {
330
-// copy.versions = new byte[100][];
373
+// if (copy.versionlist == null)
374
+// {
375
+// copy.versionlist = new Object3D[100];
331376 // copy.versionindex = -1;
332
- }
377
+//
378
+// Save(true);
379
+// }
333380
334381 SetupMenu();
335382
....@@ -398,6 +445,8 @@
398445
399446 ChangeListener changeListener = new ChangeListener()
400447 {
448
+ //String name;
449
+
401450 public void stateChanged(ChangeEvent changeEvent)
402451 {
403452 // if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Material") && !materialFlushed)
....@@ -416,7 +465,37 @@
416465 // EditSelection(false);
417466 // }
418467
419
- refreshContents(false); // To refresh Info tab
468
+// if (objectPanel.getSelectedIndex() == 4)
469
+// {
470
+// name = copy.skyboxname;
471
+//
472
+// if (name == null)
473
+// {
474
+// name = "";
475
+// }
476
+//
477
+// copy.skyboxname = "cubemaps/default-skyboxes/rgb";
478
+// copy.skyboxext = "jpg";
479
+// }
480
+// else
481
+// {
482
+// if (name != null)
483
+// {
484
+// if (name.equals(""))
485
+// {
486
+// copy.skyboxname = null;
487
+// copy.skyboxext = null;
488
+// }
489
+// else
490
+// {
491
+// copy.skyboxname = name;
492
+// }
493
+// }
494
+// }
495
+ cameraView.transformMode = objectPanel.getSelectedIndex() == 4;
496
+
497
+// refreshContents(false); // To refresh Info tab
498
+ cameraView.repaint();
420499 }
421500 };
422501 objectPanel.addChangeListener(changeListener);
....@@ -439,7 +518,9 @@
439518 toolboxPanel = new cGridBag().setVertical(true);
440519 //toolboxPanel.setName("Toolbox");
441520
442
- materialPanel = new cGridBag().setVertical(true);
521
+ skyboxPanel = new cGridBag().setVertical(true);
522
+
523
+ materialPanel = new cGridBag().setVertical(false);
443524 //materialPanel.setName("Material");
444525
445526 /*JTextPane*/
....@@ -723,6 +804,7 @@
723804 boolean maximized;
724805
725806 cButton fullscreenLayout;
807
+ cButton expandedLayout;
726808
727809 void Minimize()
728810 {
....@@ -762,10 +844,12 @@
762844 cButton minButton;
763845 cButton maxButton;
764846 cButton fullButton;
847
+ cButton collapseButton;
848
+ cButton maximize3DButton;
765849
766850 void ToggleFullScreen()
767851 {
768
-GraphicsDevice device = frame.getGraphicsConfiguration().getDevice();
852
+ GraphicsDevice device = frame.getGraphicsConfiguration().getDevice();
769853
770854 cameraView.ToggleFullScreen();
771855
....@@ -786,13 +870,13 @@
786870 // X frame.getContentPane().remove(/*"Center",*/bigThree);
787871 // X framePanel.add(bigThree);
788872 // X frame.getContentPane().add(/*"Center",*/framePanel);
789
- framePanel.setDividerLocation(46);
873
+// framePanel.setDividerLocation(46); // icons are 24x24
790874
791875 //frame.setVisible(true);
792
- radio.layout = keepButton;
876
+// radio.layout = keepButton;
793877 //theFrame = null;
794878 keepButton = null;
795
- radio.layout.doClick();
879
+// radio.layout.doClick();
796880
797881 } else
798882 {
....@@ -813,31 +897,42 @@
813897 // X frame.getContentPane().remove(/*"Center",*/framePanel);
814898 // X framePanel.remove(bigThree);
815899 // X frame.getContentPane().add(/*"Center",*/bigThree);
816
- framePanel.setDividerLocation(0);
900
+// framePanel.setDividerLocation(0);
817901
818
- radio.layout = fullscreenLayout;
819
- radio.layout.doClick();
902
+// radio.layout = fullscreenLayout;
903
+// radio.layout.doClick();
820904 //frame.setVisible(true);
821905 }
822906 frame.validate();
907
+
908
+ cameraView.requestFocusInWindow();
823909 }
824910
825
- private byte[] CompressCopy()
911
+ void CollapseToolbar()
912
+ {
913
+ framePanel.setDividerLocation(0);
914
+ //frame.validate();
915
+
916
+ cameraView.requestFocusInWindow();
917
+ }
918
+
919
+ private Object3D Duplicate(Object3D object)
826920 {
827921 boolean temp = CameraPane.SWITCH;
828922 CameraPane.SWITCH = false;
829923
830
- copy.ExtractBigData(versiontable);
924
+ object.ExtractBigData(versiontable);
831925 // if (copy == client)
832926
833
- byte[] versions[] = copy.versions;
834
- copy.versions = null;
927
+ Object3D versions[] = object.versionlist;
928
+ object.versionlist = null;
835929
836
- byte[] compress = Compress(copy);
930
+ //byte[] compress = Compress(copy);
931
+ Object3D compress = (Object3D)Grafreed.clone(object);
837932
838
- copy.versions = versions;
933
+ object.versionlist = versions;
839934
840
- copy.RestoreBigData(versiontable);
935
+ object.RestoreBigData(versiontable);
841936
842937 CameraPane.SWITCH = temp;
843938
....@@ -965,6 +1060,7 @@
9651060 {
9661061 SetupMaterial(materialPanel);
9671062 }
1063
+
9681064 //SetupName();
9691065 //SetupViews();
9701066 }
....@@ -1173,6 +1269,18 @@
11731269
11741270 namePanel = new cGridBag();
11751271
1272
+ //if (copy.pinned)
1273
+ {
1274
+ pinButton = GetToggleButton("icons/pin.png", !Grafreed.NIMBUSLAF);
1275
+ pinButton.setSelected(copy.pinned);
1276
+ cGridBag t = new cGridBag();
1277
+ t.preferredWidth = 2;
1278
+ t.add(pinButton);
1279
+ namePanel.add(t);
1280
+
1281
+ pinButton.addItemListener(this);
1282
+ }
1283
+
11761284 nameField = AddText(namePanel, copy.GetName());
11771285 namePanel.add(new JScrollPane(nameField, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER));
11781286 oe.ctrlPanel.add(namePanel);
....@@ -1522,23 +1630,28 @@
15221630 //tmp.setName("Edit");
15231631 objectPanel.add(materialPanel);
15241632 objectPanel.setIconAt(0, GetIcon("icons/material.png"));
1633
+ objectPanel.setToolTipTextAt(0, "Material");
1634
+
1635
+ objectPanel.add(toolboxPanel);
1636
+ objectPanel.setIconAt(1, GetIcon("icons/primitives.png"));
1637
+ objectPanel.setToolTipTextAt(1, "Objects & textures");
1638
+
1639
+ objectPanel.add(skyboxPanel);
1640
+ objectPanel.setIconAt(2, GetIcon("icons/skybox.jpg"));
1641
+ objectPanel.setToolTipTextAt(2, "Backgrounds");
1642
+
15251643 // JPanel north = new JPanel(new BorderLayout());
15261644 // north.setName("Edit");
15271645 // north.add(ctrlPanel, BorderLayout.NORTH);
15281646 // objectPanel.add(north);
15291647 objectPanel.add(editPanel);
1530
- objectPanel.setIconAt(1, GetIcon("icons/write.png"));
1531
-
1532
- //if (Globals.ADVANCED)
1533
- objectPanel.add(infoPanel);
1534
- objectPanel.setIconAt(2, GetIcon("icons/info.png"));
1648
+ objectPanel.setIconAt(3, GetIcon("icons/write.png"));
1649
+ objectPanel.setToolTipTextAt(3, "Edit controls");
15351650
15361651 objectPanel.add(XYZPanel);
1537
- objectPanel.setIconAt(3, GetIcon("icons/XYZ.png"));
1652
+ objectPanel.setIconAt(4, GetIcon("icons/XYZ.png"));
1653
+ objectPanel.setToolTipTextAt(4, "XYZ/RGB transform");
15381654
1539
- objectPanel.add(toolboxPanel);
1540
- objectPanel.setIconAt(4, GetIcon("icons/primitives.png"));
1541
-
15421655 /*
15431656 aConstraints.gridx = 0;
15441657 aConstraints.gridwidth = 1;
....@@ -1575,6 +1688,11 @@
15751688
15761689 scenePanel.add(tabbedPane);
15771690
1691
+ //if (Globals.ADVANCED)
1692
+// tabbedPane.add(infoPanel);
1693
+// tabbedPane.setIconAt(3, GetIcon("icons/info.png"));
1694
+// tabbedPane.setToolTipTextAt(3, "Information");
1695
+
15781696 /*
15791697 cTree jTree = new cTree(null);
15801698 ToolTipManager.sharedInstance().registerComponent(jTree);
....@@ -1634,8 +1752,8 @@
16341752 /**/
16351753
16361754 bigThree = new cGridBag();
1637
- bigThree.addComponent(centralPanel);
16381755 bigThree.addComponent(scenePanel);
1756
+ bigThree.addComponent(centralPanel);
16391757 //bigThree.addComponent(XYZPanel);
16401758
16411759 // // SIDE EFFECT!!!
....@@ -1645,6 +1763,23 @@
16451763 // aConstraints.gridheight = 1;
16461764
16471765 framePanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, toolbarPanel, bigThree);
1766
+
1767
+ framePanel.addPropertyChangeListener(JSplitPane.DIVIDER_LOCATION_PROPERTY,
1768
+ new java.beans.PropertyChangeListener()
1769
+ {
1770
+ public void propertyChange(java.beans.PropertyChangeEvent pce)
1771
+ {
1772
+ if ((Integer)pce.getOldValue() == 1)
1773
+ {
1774
+ if (radio.layout != expandedLayout)
1775
+ {
1776
+ radio.layout = expandedLayout;
1777
+ radio.layout.doClick();
1778
+ }
1779
+ }
1780
+ }
1781
+ });
1782
+
16481783 framePanel.setContinuousLayout(false);
16491784 framePanel.setOneTouchExpandable(false);
16501785 //.setDividerLocation(0.8);
....@@ -1654,7 +1789,7 @@
16541789
16551790 frame.getContentPane().setLayout(new BorderLayout());
16561791 /**/
1657
- JTabbedPane worldPane = new JTabbedPane();
1792
+ //JTabbedPane worldPane = new JTabbedPane();
16581793 //worldPane.add(bigPanel);
16591794 //worldPane.add(worldPanel);
16601795 /**/
....@@ -1677,7 +1812,6 @@
16771812 frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
16781813 frame.addWindowListener(new WindowAdapter()
16791814 {
1680
-
16811815 public void windowClosing(WindowEvent e)
16821816 {
16831817 Close();
....@@ -1700,12 +1834,403 @@
17001834 ctrlPanel.removeAll();
17011835 }
17021836
1703
- void SetupMaterial(cGridBag panel)
1837
+ void SetupMaterial(cGridBag materialpanel)
17041838 {
1705
- /*
1839
+ cGridBag presetpanel = new cGridBag().setVertical(true);
1840
+
1841
+ cLabel skin = GetLabel("icons/shadericons/shadericon00000.png", !Grafreed.NIMBUSLAF);
1842
+ skin.setToolTipText("Skin");
1843
+ skin.addMouseListener(new MouseAdapter()
1844
+ {
1845
+ public void mouseClicked(MouseEvent e)
1846
+ {
1847
+ Object3D object = Grafreed.materials.versionlist[0].get(0);
1848
+ cMaterial material = object.material;
1849
+
1850
+ // Skin
1851
+ colorField.setFloat(material.color);
1852
+ saturationField.setFloat(material.modulation);
1853
+ subsurfaceField.setFloat(material.subsurface);
1854
+ selfshadowField.setFloat(material.diffuseness);
1855
+ diffusenessField.setFloat(material.factor);
1856
+ shininessField.setFloat(material.shininess);
1857
+ shadowbiasField.setFloat(material.shadowbias);
1858
+ diffuseField.setFloat(material.diffuse);
1859
+ specularField.setFloat(material.specular);
1860
+
1861
+ bumpField.setFloat(object.projectedVertices[0].x / 1000.0);
1862
+ noiseField.setFloat(object.projectedVertices[0].y / 1000.0);
1863
+ powerField.setFloat(object.projectedVertices[2].x / 1000.0);
1864
+
1865
+ materialtouched = true;
1866
+ applySelf();
1867
+ }
1868
+ });
1869
+ presetpanel.add(skin);
1870
+
1871
+ cLabel lambert = GetLabel("icons/shadericons/shadericon00002.png", !Grafreed.NIMBUSLAF);
1872
+ lambert.setToolTipText("Diffuse");
1873
+ lambert.addMouseListener(new MouseAdapter()
1874
+ {
1875
+ public void mouseClicked(MouseEvent e)
1876
+ {
1877
+ Object3D object = Grafreed.materials.versionlist[2].get(0);
1878
+ cMaterial material = object.material;
1879
+
1880
+ diffusenessField.setFloat(material.factor);
1881
+ selfshadowField.setFloat(material.diffuseness);
1882
+
1883
+ materialtouched = true;
1884
+ applySelf();
1885
+ }
1886
+ });
1887
+ presetpanel.add(lambert);
1888
+
1889
+ cLabel diffuse2 = GetLabel("icons/shadericons/shadericon00003.png", !Grafreed.NIMBUSLAF);
1890
+ diffuse2.setToolTipText("Diffuse2");
1891
+ diffuse2.addMouseListener(new MouseAdapter()
1892
+ {
1893
+ public void mouseClicked(MouseEvent e)
1894
+ {
1895
+ Object3D object = Grafreed.materials.versionlist[3].get(0);
1896
+ cMaterial material = object.material;
1897
+
1898
+ diffusenessField.setFloat(material.factor);
1899
+ selfshadowField.setFloat(material.diffuseness);
1900
+
1901
+ materialtouched = true;
1902
+ applySelf();
1903
+ }
1904
+ });
1905
+ presetpanel.add(diffuse2);
1906
+
1907
+ cLabel diffusemoon = GetLabel("icons/shadericons/shadericon00004.png", !Grafreed.NIMBUSLAF);
1908
+ diffusemoon.setToolTipText("Moon");
1909
+ diffusemoon.addMouseListener(new MouseAdapter()
1910
+ {
1911
+ public void mouseClicked(MouseEvent e)
1912
+ {
1913
+ Object3D object = Grafreed.materials.versionlist[4].get(0);
1914
+ cMaterial material = object.material;
1915
+
1916
+ diffusenessField.setFloat(material.factor);
1917
+ selfshadowField.setFloat(material.diffuseness);
1918
+
1919
+ materialtouched = true;
1920
+ applySelf();
1921
+ }
1922
+ });
1923
+ presetpanel.add(diffusemoon);
1924
+
1925
+ cLabel diffusemoon2 = GetLabel("icons/shadericons/shadericon00005.png", !Grafreed.NIMBUSLAF);
1926
+ diffusemoon2.setToolTipText("Moon2");
1927
+ diffusemoon2.addMouseListener(new MouseAdapter()
1928
+ {
1929
+ public void mouseClicked(MouseEvent e)
1930
+ {
1931
+ Object3D object = Grafreed.materials.versionlist[5].get(0);
1932
+ cMaterial material = object.material;
1933
+
1934
+ diffusenessField.setFloat(material.factor);
1935
+ selfshadowField.setFloat(material.diffuseness);
1936
+
1937
+ materialtouched = true;
1938
+ applySelf();
1939
+ }
1940
+ });
1941
+ presetpanel.add(diffusemoon2);
1942
+
1943
+ cLabel diffusemoon3 = GetLabel("icons/shadericons/shadericon00006.png", !Grafreed.NIMBUSLAF);
1944
+ diffusemoon3.setToolTipText("Moon3");
1945
+ diffusemoon3.addMouseListener(new MouseAdapter()
1946
+ {
1947
+ public void mouseClicked(MouseEvent e)
1948
+ {
1949
+ Object3D object = Grafreed.materials.versionlist[6].get(0);
1950
+ cMaterial material = object.material;
1951
+
1952
+ diffusenessField.setFloat(material.factor);
1953
+ selfshadowField.setFloat(material.diffuseness);
1954
+
1955
+ materialtouched = true;
1956
+ applySelf();
1957
+ }
1958
+ });
1959
+ presetpanel.add(diffusemoon3);
1960
+
1961
+ cLabel diffusesheen = GetLabel("icons/shadericons/shadericon00007.png", !Grafreed.NIMBUSLAF);
1962
+ diffusesheen.setToolTipText("Sheen");
1963
+ diffusesheen.addMouseListener(new MouseAdapter()
1964
+ {
1965
+ public void mouseClicked(MouseEvent e)
1966
+ {
1967
+ Object3D object = Grafreed.materials.versionlist[7].get(0);
1968
+ cMaterial material = object.material;
1969
+
1970
+ sheenField.setFloat(material.sheen);
1971
+
1972
+ materialtouched = true;
1973
+ applySelf();
1974
+ }
1975
+ });
1976
+ presetpanel.add(diffusesheen);
1977
+
1978
+ cLabel rough = GetLabel("icons/shadericons/shadericon00001.png", !Grafreed.NIMBUSLAF);
1979
+ rough.setToolTipText("Rough metal");
1980
+ rough.addMouseListener(new MouseAdapter()
1981
+ {
1982
+ public void mouseClicked(MouseEvent e)
1983
+ {
1984
+ Object3D object = Grafreed.materials.versionlist[1].get(0);
1985
+ cMaterial material = object.material;
1986
+
1987
+ shininessField.setFloat(material.shininess);
1988
+ velvetField.setFloat(material.velvet);
1989
+
1990
+ materialtouched = true;
1991
+ applySelf();
1992
+ }
1993
+ });
1994
+ presetpanel.add(rough);
1995
+
1996
+ cLabel rough2 = GetLabel("icons/shadericons/shadericon00013.png", !Grafreed.NIMBUSLAF);
1997
+ rough2.setToolTipText("Medium metal");
1998
+ rough2.addMouseListener(new MouseAdapter()
1999
+ {
2000
+ public void mouseClicked(MouseEvent e)
2001
+ {
2002
+ Object3D object = Grafreed.materials.versionlist[13].get(0);
2003
+ cMaterial material = object.material;
2004
+
2005
+ shininessField.setFloat(material.shininess);
2006
+ lightareaField.setFloat(material.lightarea);
2007
+
2008
+ materialtouched = true;
2009
+ applySelf();
2010
+ }
2011
+ });
2012
+ presetpanel.add(rough2);
2013
+
2014
+ cLabel shini0 = GetLabel("icons/shadericons/shadericon00014.png", !Grafreed.NIMBUSLAF);
2015
+ shini0.setToolTipText("Shiny");
2016
+ shini0.addMouseListener(new MouseAdapter()
2017
+ {
2018
+ public void mouseClicked(MouseEvent e)
2019
+ {
2020
+ Object3D object = Grafreed.materials.versionlist[14].get(0);
2021
+ cMaterial material = object.material;
2022
+
2023
+ shininessField.setFloat(material.shininess);
2024
+ lightareaField.setFloat(material.lightarea);
2025
+
2026
+ materialtouched = true;
2027
+ applySelf();
2028
+ }
2029
+ });
2030
+ presetpanel.add(shini0);
2031
+
2032
+ cLabel shini1 = GetLabel("icons/shadericons/shadericon00011.png", !Grafreed.NIMBUSLAF);
2033
+ shini1.setToolTipText("Shiny2");
2034
+ shini1.addMouseListener(new MouseAdapter()
2035
+ {
2036
+ public void mouseClicked(MouseEvent e)
2037
+ {
2038
+ Object3D object = Grafreed.materials.versionlist[11].get(0);
2039
+ cMaterial material = object.material;
2040
+
2041
+ shininessField.setFloat(material.shininess);
2042
+ lightareaField.setFloat(material.lightarea);
2043
+
2044
+ materialtouched = true;
2045
+ applySelf();
2046
+ }
2047
+ });
2048
+ presetpanel.add(shini1);
2049
+
2050
+ cLabel shini2 = GetLabel("icons/shadericons/shadericon00012.png", !Grafreed.NIMBUSLAF);
2051
+ shini2.setToolTipText("Shiny3");
2052
+ shini2.addMouseListener(new MouseAdapter()
2053
+ {
2054
+ public void mouseClicked(MouseEvent e)
2055
+ {
2056
+ Object3D object = Grafreed.materials.versionlist[12].get(0);
2057
+ cMaterial material = object.material;
2058
+
2059
+ shininessField.setFloat(material.shininess);
2060
+ lightareaField.setFloat(material.lightarea);
2061
+
2062
+ materialtouched = true;
2063
+ applySelf();
2064
+ }
2065
+ });
2066
+ presetpanel.add(shini2);
2067
+
2068
+ cLabel aniso = GetLabel("icons/shadericons/shadericon00008.png", !Grafreed.NIMBUSLAF);
2069
+ aniso.setToolTipText("AnisoU");
2070
+ aniso.addMouseListener(new MouseAdapter()
2071
+ {
2072
+ public void mouseClicked(MouseEvent e)
2073
+ {
2074
+ Object3D object = Grafreed.materials.versionlist[8].get(0);
2075
+ cMaterial material = object.material;
2076
+
2077
+ anisoField.setFloat(material.aniso);
2078
+ anisoVField.setFloat(material.anisoV);
2079
+
2080
+ materialtouched = true;
2081
+ applySelf();
2082
+ }
2083
+ });
2084
+ presetpanel.add(aniso);
2085
+
2086
+ cLabel aniso2 = GetLabel("icons/shadericons/shadericon00009.png", !Grafreed.NIMBUSLAF);
2087
+ aniso2.setToolTipText("AnisoV");
2088
+ aniso2.addMouseListener(new MouseAdapter()
2089
+ {
2090
+ public void mouseClicked(MouseEvent e)
2091
+ {
2092
+ Object3D object = Grafreed.materials.versionlist[9].get(0);
2093
+ cMaterial material = object.material;
2094
+
2095
+ anisoField.setFloat(material.aniso);
2096
+ anisoVField.setFloat(material.anisoV);
2097
+
2098
+ materialtouched = true;
2099
+ applySelf();
2100
+ }
2101
+ });
2102
+ presetpanel.add(aniso2);
2103
+
2104
+ cLabel aniso3 = GetLabel("icons/shadericons/shadericon00010.png", !Grafreed.NIMBUSLAF);
2105
+ aniso3.setToolTipText("AnisoUV");
2106
+ aniso3.addMouseListener(new MouseAdapter()
2107
+ {
2108
+ public void mouseClicked(MouseEvent e)
2109
+ {
2110
+ Object3D object = Grafreed.materials.versionlist[10].get(0);
2111
+ cMaterial material = object.material;
2112
+
2113
+ anisoField.setFloat(material.aniso);
2114
+ anisoVField.setFloat(material.anisoV);
2115
+
2116
+ materialtouched = true;
2117
+ applySelf();
2118
+ }
2119
+ });
2120
+ presetpanel.add(aniso3);
2121
+
2122
+ cLabel velvet0 = GetLabel("icons/shadericons/shadericon00015.png", !Grafreed.NIMBUSLAF);
2123
+ velvet0.setToolTipText("Velvet");
2124
+ velvet0.addMouseListener(new MouseAdapter()
2125
+ {
2126
+ public void mouseClicked(MouseEvent e)
2127
+ {
2128
+ Object3D object = Grafreed.materials.versionlist[15].get(0);
2129
+ cMaterial material = object.material;
2130
+
2131
+ diffusenessField.setFloat(material.factor);
2132
+ selfshadowField.setFloat(material.diffuseness);
2133
+ sheenField.setFloat(material.sheen);
2134
+ shininessField.setFloat(material.shininess);
2135
+ velvetField.setFloat(material.velvet);
2136
+ shiftField.setFloat(material.shift);
2137
+
2138
+ materialtouched = true;
2139
+ applySelf();
2140
+ }
2141
+ });
2142
+ presetpanel.add(velvet0);
2143
+
2144
+ cLabel bump0 = GetLabel("icons/shadericons/shadericon00016.png", !Grafreed.NIMBUSLAF);
2145
+ bump0.setToolTipText("Bump texture");
2146
+ bump0.addMouseListener(new MouseAdapter()
2147
+ {
2148
+ public void mouseClicked(MouseEvent e)
2149
+ {
2150
+ Object3D object = Grafreed.materials.versionlist[16].get(0);
2151
+ cMaterial material = object.material;
2152
+
2153
+ bumpField.setFloat(object.projectedVertices[0].x / 1000.0);
2154
+ noiseField.setFloat(object.projectedVertices[0].y / 1000.0);
2155
+ powerField.setFloat(object.projectedVertices[2].x / 1000.0);
2156
+
2157
+ materialtouched = true;
2158
+ applySelf();
2159
+ }
2160
+ });
2161
+ presetpanel.add(bump0);
2162
+
2163
+ cLabel halo = GetLabel("icons/shadericons/shadericon00017.png", !Grafreed.NIMBUSLAF);
2164
+ halo.setToolTipText("Halo");
2165
+ halo.addMouseListener(new MouseAdapter()
2166
+ {
2167
+ public void mouseClicked(MouseEvent e)
2168
+ {
2169
+ Object3D object = Grafreed.materials.versionlist[17].get(0);
2170
+ cMaterial material = object.material;
2171
+
2172
+ opacityPowerField.setFloat(object.projectedVertices[2].y / 1000.0);
2173
+
2174
+ materialtouched = true;
2175
+ applySelf();
2176
+ }
2177
+ });
2178
+ presetpanel.add(halo);
2179
+
2180
+ cLabel candle = GetLabel("icons/shadericons/shadericon00018.png", !Grafreed.NIMBUSLAF);
2181
+ candle.setToolTipText("Candle");
2182
+ candle.addMouseListener(new MouseAdapter()
2183
+ {
2184
+ public void mouseClicked(MouseEvent e)
2185
+ {
2186
+ Object3D object = Grafreed.materials.versionlist[18].get(0);
2187
+ cMaterial material = object.material;
2188
+
2189
+ subsurfaceField.setFloat(material.subsurface);
2190
+ shadowbiasField.setFloat(material.shadowbias);
2191
+ ambientField.setFloat(material.ambient);
2192
+ specularField.setFloat(material.specular);
2193
+ lightareaField.setFloat(material.lightarea);
2194
+ shininessField.setFloat(material.shininess);
2195
+
2196
+ materialtouched = true;
2197
+ applySelf();
2198
+ }
2199
+ });
2200
+ presetpanel.add(candle);
2201
+
2202
+ cLabel shadowShader = GetLabel("icons/shadericons/shadow.png", !Grafreed.NIMBUSLAF);
2203
+ shadowShader.setToolTipText("Shadow");
2204
+ shadowShader.addMouseListener(new MouseAdapter()
2205
+ {
2206
+ public void mouseClicked(MouseEvent e)
2207
+ {
2208
+ diffuseField.setFloat(0.001);
2209
+ ambientField.setFloat(0.001);
2210
+ cameraField.setFloat(0.001);
2211
+ specularField.setFloat(0.001);
2212
+ fakedepthField.setFloat(0.001);
2213
+ opacityField.setFloat(0.6);
2214
+
2215
+ materialtouched = true;
2216
+ applySelf();
2217
+ }
2218
+ });
2219
+ presetpanel.add(shadowShader);
2220
+
2221
+ cGridBag panel = new cGridBag().setVertical(true);
2222
+
2223
+ presetpanel.preferredWidth = 1;
2224
+
2225
+ materialpanel.add(presetpanel);
2226
+ materialpanel.add(panel);
2227
+
2228
+ panel.preferredWidth = 8;
2229
+
2230
+ /*
17062231 ctrlPanel.add(materialLabel = new JLabel("MATERIAL : "), aConstraints);
17072232 materialLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1708
- */
2233
+ */
17092234
17102235 cGridBag editBar = new cGridBag().setVertical(false);
17112236
....@@ -1739,27 +2264,50 @@
17392264 //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
17402265
17412266 cGridBag colorSection = new cGridBag().setVertical(true);
2267
+
2268
+ cGridBag huepanel = new cGridBag();
2269
+ cGridBag huelabel = new cGridBag();
2270
+ skin = GetLabel("icons/hue.png", false);
2271
+ skin.fit = true;
2272
+ huelabel.add(skin);
2273
+ huelabel.preferredWidth = 20;
2274
+ huepanel.add(new cGridBag()); // Label
2275
+ huepanel.add(huelabel); // Field/slider
2276
+
2277
+ huepanel.preferredHeight = 7;
2278
+
2279
+ colorSection.add(huepanel);
17422280
17432281 cGridBag color = new cGridBag();
1744
- color.add(colorLabel = new JLabel("Color/hue")); // , aConstraints);
1745
- colorLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1746
- color.add(colorField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
2282
+
2283
+ color.add(colorLabel = new JLabel("Color/hue")); // , aConstraints);
2284
+ colorLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2285
+ color.add(colorField = new cNumberSlider(this, 0.001, 1)); // , aConstraints);
2286
+
17472287 //colorField.preferredWidth = 200;
17482288 colorSection.add(color);
17492289
17502290 cGridBag modulation = new cGridBag();
17512291 modulation.add(modulationLabel = new JLabel("Saturation")); // , aConstraints);
17522292 modulationLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1753
- modulation.add(modulationField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
2293
+ modulation.add(saturationField = new cNumberSlider(this, 0.001, 1)); // , aConstraints);
17542294 colorSection.add(modulation);
17552295
2296
+ cGridBag opacity = new cGridBag();
2297
+ opacity.add(opacityLabel = new JLabel("Opacity")); // , aConstraints);
2298
+ opacityLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2299
+ opacity.add(opacityField = new cNumberSlider(this, 0.001, 1)); // , aConstraints);
2300
+ colorSection.add(opacity);
2301
+
2302
+ colorSection.add(GetSeparator());
2303
+
17562304 cGridBag texture = new cGridBag();
17572305 texture.add(textureLabel = new JLabel("Texture")); // , aConstraints);
17582306 textureLabel.setHorizontalAlignment(SwingConstants.TRAILING);
17592307 texture.add(textureField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
17602308 colorSection.add(texture);
17612309
1762
- panel.add(new JSeparator());
2310
+ panel.add(GetSeparator());
17632311
17642312 panel.add(colorSection);
17652313
....@@ -1815,7 +2363,7 @@
18152363 shadowbias.add(shadowbiasField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
18162364 diffuseSection.add(shadowbias);
18172365
1818
- panel.add(new JSeparator());
2366
+ panel.add(GetSeparator());
18192367
18202368 panel.add(diffuseSection);
18212369
....@@ -1878,7 +2426,7 @@
18782426 specularSection.add(anisoV);
18792427
18802428
1881
- panel.add(new JSeparator());
2429
+ panel.add(GetSeparator());
18822430
18832431 panel.add(specularSection);
18842432
....@@ -1903,12 +2451,6 @@
19032451 backlitLabel.setHorizontalAlignment(SwingConstants.TRAILING);
19042452 backlit.add(backlitField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
19052453 colorSection.add(backlit);
1906
-
1907
- cGridBag opacity = new cGridBag();
1908
- opacity.add(opacityLabel = new JLabel("Opacity")); // , aConstraints);
1909
- opacityLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1910
- opacity.add(opacityField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1911
- colorSection.add(opacity);
19122454
19132455 //panel.add(new JSeparator());
19142456
....@@ -1954,7 +2496,7 @@
19542496 opacityPower.add(opacityPowerField = new cNumberSlider(this, 0.0, 10 /*10 dec 2013*/)); // , aConstraints);
19552497 textureSection.add(opacityPower);
19562498
1957
- panel.add(new JSeparator());
2499
+ panel.add(GetSeparator());
19582500
19592501 panel.add(textureSection);
19602502
....@@ -2941,7 +3483,7 @@
29413483
29423484 freezematerial = true;
29433485 colorField.setFloat(mat.color);
2944
- modulationField.setFloat(mat.modulation);
3486
+ saturationField.setFloat(mat.modulation);
29453487 metalnessField.setFloat(mat.metalness);
29463488 diffuseField.setFloat(mat.diffuse);
29473489 specularField.setFloat(mat.specular);
....@@ -3148,6 +3690,17 @@
31483690 public void itemStateChanged(ItemEvent event)
31493691 {
31503692 // System.out.println("Propagate = " + propagate);
3693
+ if (event.getSource() == pinButton)
3694
+ {
3695
+ copy.pinned ^= true;
3696
+ if (!copy.pinned && !copy.editWindow.copy.selection.contains(copy))
3697
+ {
3698
+ ((GroupEditor)copy.editWindow).listUI.remove(copy);
3699
+ copy.CloseUI();
3700
+ //copy.editWindow.refreshContents();
3701
+ }
3702
+ }
3703
+ else
31513704 if (event.getSource() == propagateToggle)
31523705 {
31533706 propagate ^= true;
....@@ -3252,6 +3805,7 @@
32523805 } else if (event.getSource() == liveCB)
32533806 {
32543807 copy.live ^= true;
3808
+ objEditor.refreshContents(true); // To show item colors
32553809 return;
32563810 } else if (event.getSource() == selectableCB)
32573811 {
....@@ -3261,7 +3815,7 @@
32613815 {
32623816 copy.hide ^= true;
32633817 copy.Touch(); // display list issue
3264
- objEditor.refreshContents();
3818
+ objEditor.refreshContents(true); // To show item colors
32653819 return;
32663820 } else if (event.getSource() == link2masterCB)
32673821 {
....@@ -3517,6 +4071,7 @@
35174071
35184072 static public byte[] Compress(Object3D o)
35194073 {
4074
+ // Slower to actually compress.
35204075 try
35214076 {
35224077 ByteArrayOutputStream baos = new ByteArrayOutputStream();
....@@ -3618,6 +4173,7 @@
36184173 {
36194174 //Save(true);
36204175 Replace();
4176
+ SetVersionStates();
36214177 }
36224178
36234179 private boolean Equal(byte[] compress, byte[] name)
....@@ -3638,29 +4194,46 @@
36384194
36394195 java.util.Hashtable<java.util.UUID, Object3D> versiontable = new java.util.Hashtable<java.util.UUID, Object3D>();
36404196
4197
+ void DeleteVersion()
4198
+ {
4199
+ for (int i = copy.versionindex; i < copy.versionlist.length-1; i++)
4200
+ {
4201
+ copy.versionlist[i] = copy.versionlist[i+1];
4202
+ }
4203
+
4204
+ CopyChanged();
4205
+
4206
+ SetVersionStates();
4207
+ }
4208
+
36414209 public boolean Save(boolean user)
36424210 {
36434211 System.err.println("Save");
4212
+ Replace();
36444213
3645
- cRadio tab = GetCurrentTab();
4214
+ //cRadio tab = GetCurrentTab();
36464215
3647
- byte[] compress = CompressCopy();
4216
+ Object3D compress = Duplicate(copy); // Saved version. No need for "Replace"?
36484217
36494218 boolean thesame = false;
36504219
3651
- // Quick heuristic using length. Works only when stream is compressed.
3652
- if (copy.versionindex > 0 && copy.versions[copy.versionindex-1] != null && Equal(compress, copy.versions[copy.versionindex-1]))
3653
- {
3654
- thesame = true;
3655
- }
4220
+// if (copy.versionindex > 0 && copy.versions[copy.versionindex-1] != null && Equal(compress, copy.versions[copy.versionindex-1]))
4221
+// {
4222
+// thesame = true;
4223
+// }
36564224
36574225 //EditorFrame.m_MainFrame.requestFocusInWindow();
36584226 if (!thesame)
36594227 {
4228
+ for (int i = copy.versionlist.length; --i > copy.versionindex+1;)
4229
+ {
4230
+ copy.versionlist[i] = copy.versionlist[i-1];
4231
+ }
4232
+
36604233 //tab.user[tab.versionindex] = user;
36614234 //boolean increment = true; // tab.graphs[tab.versionindex] == null;
36624235
3663
- copy.versions[++copy.versionindex] = compress;
4236
+ copy.versionlist[++copy.versionindex] = compress;
36644237
36654238 // if (increment)
36664239 // tab.versionindex++;
....@@ -3670,13 +4243,13 @@
36704243
36714244 //assert(hashtable.isEmpty());
36724245
3673
- for (int i = copy.versionindex+1; i < copy.versions.length; i++)
3674
- {
3675
- //tab.user[i] = false;
3676
- copy.versions[i] = null;
3677
- }
4246
+// for (int i = copy.versionindex+1; i < copy.versionlist.length; i++)
4247
+// {
4248
+// //tab.user[i] = false;
4249
+// copy.versionlist[i] = null;
4250
+// }
36784251
3679
- SetUndoStates();
4252
+ SetVersionStates();
36804253
36814254 // test save
36824255 if (false)
....@@ -3699,10 +4272,44 @@
36994272
37004273 return !thesame;
37014274 }
3702
-
3703
- void CopyChanged(Object3D obj)
4275
+
4276
+ boolean flashIt = true;
4277
+
4278
+ void RefreshSelection()
37044279 {
3705
- SetUndoStates();
4280
+ Object3D selection = new Object3D();
4281
+
4282
+ for (int i = 0; i < copy.selection.size(); i++)
4283
+ {
4284
+ Object3D elem = copy.selection.elementAt(i);
4285
+
4286
+ Object3D obj = copy.GetObject(elem.GetUUID());
4287
+
4288
+ if (obj == null)
4289
+ {
4290
+ copy.selection.remove(i--);
4291
+ }
4292
+ else
4293
+ {
4294
+ selection.add(obj);
4295
+ copy.selection.setElementAt(obj, i);
4296
+ }
4297
+ }
4298
+
4299
+ flashIt = false;
4300
+ GetTree().clearSelection();
4301
+ for (int i = 0; i < selection.size(); i++)
4302
+ GetTree().addSelectionPath(selection.elementAt(i).GetTreePath().GetTreePath());
4303
+ flashIt = true;
4304
+
4305
+ //refreshContents(false);
4306
+ }
4307
+
4308
+ void CopyChanged()
4309
+ {
4310
+ Object3D obj = (Object3D)Grafreed.clone(copy.versionlist[copy.versionindex]);
4311
+
4312
+ SetVersionStates();
37064313
37074314 boolean temp = CameraPane.SWITCH;
37084315 CameraPane.SWITCH = false;
....@@ -3711,6 +4318,9 @@
37114318
37124319 copy.clear();
37134320
4321
+ copy.skyboxname = obj.skyboxname;
4322
+ copy.skyboxext = obj.skyboxext;
4323
+
37144324 for (int i=0; i<obj.Size(); i++)
37154325 {
37164326 copy.add(obj.get(i));
....@@ -3720,6 +4330,7 @@
37204330
37214331 CameraPane.SWITCH = temp;
37224332
4333
+ RefreshSelection();
37234334 //assert(hashtable.isEmpty());
37244335
37254336 copy.Touch();
....@@ -3740,13 +4351,15 @@
37404351 }
37414352 }
37424353
3743
- refreshContents();
4354
+ refreshContents(true);
37444355 }
37454356
3746
- cButton undoButton;
4357
+ cButton previousVersionButton;
37474358 cButton restoreButton;
37484359 cButton replaceButton;
3749
- cButton redoButton;
4360
+ cButton nextVersionButton;
4361
+ cButton saveVersionButton;
4362
+ cButton deleteVersionButton;
37504363
37514364 boolean muteSlider;
37524365
....@@ -3754,39 +4367,47 @@
37544367 {
37554368 int count = 0;
37564369
3757
- for (int i = copy.versions.length; --i >= 0;)
4370
+ for (int i = copy.versionlist.length; --i >= 0;)
37584371 {
3759
- if (copy.versions[i] != null)
4372
+ if (copy.versionlist[i] != null)
37604373 count++;
37614374 }
37624375
37634376 return count;
37644377 }
37654378
3766
- void SetUndoStates()
4379
+ void SetVersionStates()
37674380 {
3768
- cRadio tab = GetCurrentTab();
4381
+ //if (true)
4382
+ // return;
4383
+
4384
+ //cRadio tab = GetCurrentTab();
37694385
37704386 restoreButton.setEnabled(copy.versionindex != -1);
37714387 replaceButton.setEnabled(copy.versionindex != -1);
37724388
3773
- undoButton.setEnabled(copy.versionindex > 0);
3774
- redoButton.setEnabled(copy.versions[copy.versionindex + 1] != null);
4389
+ previousVersionButton.setEnabled(copy.versionindex > 0);
4390
+ nextVersionButton.setEnabled(copy.versionlist[copy.versionindex + 1] != null);
4391
+
4392
+ deleteVersionButton.setEnabled(//copy.versionindex > 0 &&
4393
+ copy.versionlist[copy.versionindex + 1] != null);
37754394
37764395 muteSlider = true;
4396
+ versionSlider.setMinimum(0);
37774397 versionSlider.setMaximum(VersionCount() - 1);
37784398 versionSlider.setInteger(copy.versionindex);
4399
+ versionSlider.setEnabled(copy.versionindex != -1);
37794400 muteSlider = false;
37804401 }
37814402
3782
- public boolean Undo()
4403
+ public boolean PreviousVersion()
37834404 {
37844405 // Option?
37854406 Replace();
37864407
37874408 System.err.println("Undo");
37884409
3789
- cRadio tab = GetCurrentTab();
4410
+ //cRadio tab = GetCurrentTab();
37904411
37914412 if (copy.versionindex == 0)
37924413 {
....@@ -3809,7 +4430,7 @@
38094430
38104431 copy.versionindex -= 1;
38114432
3812
- CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex]));
4433
+ CopyChanged();
38134434
38144435 return true;
38154436 }
....@@ -3818,15 +4439,16 @@
38184439 {
38194440 System.err.println("Restore");
38204441
3821
- cRadio tab = GetCurrentTab();
4442
+ //cRadio tab = GetCurrentTab();
38224443
3823
- if (copy.versionindex == -1 || copy.versions[copy.versionindex] == null)
4444
+ if (copy.versionindex == -1 || copy.versionlist[copy.versionindex] == null)
38244445 {
38254446 java.awt.Toolkit.getDefaultToolkit().beep();
38264447 return false;
38274448 }
38284449
3829
- CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex]));
4450
+ //CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex]));
4451
+ CopyChanged();
38304452
38314453 return true;
38324454 }
....@@ -3835,27 +4457,27 @@
38354457 {
38364458 System.err.println("Replace");
38374459
3838
- cRadio tab = GetCurrentTab();
4460
+ //cRadio tab = GetCurrentTab();
38394461
3840
- if (copy.versionindex == -1 || copy.versions[copy.versionindex] == null)
4462
+ if (copy.versionindex == -1 || copy.versionlist[copy.versionindex] == null)
38414463 {
38424464 // No version yet. OK. java.awt.Toolkit.getDefaultToolkit().beep();
38434465 return false;
38444466 }
38454467
3846
- copy.versions[copy.versionindex] = CompressCopy();
4468
+ copy.versionlist[copy.versionindex] = Duplicate(copy);
38474469
38484470 return true;
38494471 }
38504472
3851
- public void Redo()
4473
+ public void NextVersion()
38524474 {
38534475 // Option?
38544476 Replace();
38554477
3856
- cRadio tab = GetCurrentTab();
4478
+ //cRadio tab = GetCurrentTab();
38574479
3858
- if (copy.versions[copy.versionindex + 1] == null)
4480
+ if (copy.versionlist[copy.versionindex + 1] == null)
38594481 {
38604482 java.awt.Toolkit.getDefaultToolkit().beep();
38614483 return;
....@@ -3863,7 +4485,7 @@
38634485
38644486 copy.versionindex += 1;
38654487
3866
- CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex]));
4488
+ CopyChanged();
38674489
38684490 //if (!tab.user[tab.versionindex])
38694491 // tab.graphs[tab.versionindex] = null;
....@@ -4077,7 +4699,7 @@
40774699 //copy.material = new cMaterial(copy.GetMaterial());
40784700
40794701 current.color = (float) colorField.getFloat();
4080
- current.modulation = (float) modulationField.getFloat();
4702
+ current.modulation = (float) saturationField.getFloat();
40814703 current.metalness = (float) metalnessField.getFloat();
40824704 current.diffuse = (float) diffuseField.getFloat();
40834705 current.specular = (float) specularField.getFloat();
....@@ -4110,7 +4732,7 @@
41104732 cMaterial mat = copy.material;
41114733
41124734 colorField.SetToolTipValue((mat.color));
4113
- modulationField.SetToolTipValue((mat.modulation));
4735
+ saturationField.SetToolTipValue((mat.modulation));
41144736 metalnessField.SetToolTipValue((mat.metalness));
41154737 diffuseField.SetToolTipValue((mat.diffuse));
41164738 specularField.SetToolTipValue((mat.specular));
....@@ -4172,11 +4794,14 @@
41724794 if (muteSlider)
41734795 return;
41744796
4797
+ Replace();
4798
+
41754799 int version = versionSlider.getInteger();
41764800
4177
- if (copy.versions[version] != null)
4801
+ if (version != -1 && copy.versionlist[version] != null)
41784802 {
4179
- CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex = version]));
4803
+ copy.versionindex = version;
4804
+ CopyChanged();
41804805 }
41814806
41824807 return;
....@@ -4216,6 +4841,12 @@
42164841 {
42174842 //System.out.println("stateChanged = " + this);
42184843 materialtouched = true;
4844
+
4845
+ if (Globals.AUTOSATURATE && e.getSource() == colorField && saturationField.getFloat() == 0.001)
4846
+ {
4847
+ saturationField.setFloat(1);
4848
+ }
4849
+
42194850 applySelf();
42204851 //System.out.println("this = " + this);
42214852 //System.out.println("PARENT = " + parent);
....@@ -4515,6 +5146,7 @@
45155146 {
45165147 if (GetTree() != null)
45175148 {
5149
+ GetTree().revalidate();
45185150 GetTree().repaint();
45195151 }
45205152
....@@ -4523,6 +5155,9 @@
45235155 ctrlPanel.validate(); // ? new
45245156 ctrlPanel.repaint();
45255157 }
5158
+
5159
+ if (previousVersionButton != null && copy.versionlist != null)
5160
+ SetVersionStates();
45265161 }
45275162
45285163 static TweenManager tweenManager = new TweenManager();
....@@ -4853,6 +5488,8 @@
48535488 {
48545489 //readobj.deepCopySelf(copy);
48555490 copy.clear(); // june 2014
5491
+ copy.skyboxname = readobj.skyboxname;
5492
+ copy.skyboxext = readobj.skyboxext;
48565493 for (int i = 0; i < readobj.size(); i++)
48575494 {
48585495 Object3D child = readobj.get(i); // reserve(i);
....@@ -4904,13 +5541,16 @@
49045541 c.addChild(csg);
49055542 }
49065543
4907
- copy.versions = readobj.versions;
5544
+ copy.versionlist = readobj.versionlist;
49085545 copy.versionindex = readobj.versionindex;
49095546
4910
- if (copy.versions == null)
5547
+ if (copy.versionlist == null)
49115548 {
4912
- copy.versions = new byte[100][];
5549
+ // Backward compatibility
5550
+ copy.versionlist = new Object3D[100];
49135551 copy.versionindex = -1;
5552
+
5553
+ //Save(true);
49145554 }
49155555
49165556 //? SetUndoStates();
....@@ -4925,7 +5565,7 @@
49255565 {
49265566 if (Grafreed.standAlone)
49275567 {
4928
- FileDialog browser = new FileDialog(frame, "Load", FileDialog.LOAD);
5568
+ FileDialog browser = new FileDialog(frame, "Open", FileDialog.LOAD);
49295569 browser.show();
49305570 String filename = browser.getFile();
49315571 if (filename != null && filename.length() > 0)
....@@ -5002,6 +5642,8 @@
50025642
50035643 void save()
50045644 {
5645
+ Replace();
5646
+
50055647 if (lastname == null)
50065648 {
50075649 return;
....@@ -5244,6 +5886,7 @@
52445886 ButtonGroup buttonGroup;
52455887
52465888 cGridBag toolboxPanel;
5889
+ cGridBag skyboxPanel;
52475890 cGridBag materialPanel;
52485891 cGridBag ctrlPanel;
52495892
....@@ -5317,7 +5960,7 @@
53175960 JLabel colorLabel;
53185961 cNumberSlider colorField;
53195962 JLabel modulationLabel;
5320
- cNumberSlider modulationField;
5963
+ cNumberSlider saturationField;
53215964 JLabel metalnessLabel;
53225965 cNumberSlider metalnessField;
53235966 JLabel diffuseLabel;
....@@ -5348,6 +5991,7 @@
53485991 cNumberSlider anisoField;
53495992 JLabel anisoVLabel;
53505993 cNumberSlider anisoVField;
5994
+
53515995 JLabel cameraLabel;
53525996 cNumberSlider cameraField;
53535997 JLabel selfshadowLabel;
....@@ -5362,6 +6006,7 @@
53626006 cNumberSlider fakedepthField;
53636007 JLabel shadowbiasLabel;
53646008 cNumberSlider shadowbiasField;
6009
+
53656010 JLabel bumpLabel;
53666011 cNumberSlider bumpField;
53676012 JLabel noiseLabel;