Normand Briere
2019-08-12 b1d79b74514041a059b454a9f6fc3970773c0cb8
ObjEditor.java
....@@ -34,6 +34,7 @@
3434 iSendInfo
3535 //KeyListener
3636 {
37
+ public cToggleButton pinButton;
3738 boolean timeline;
3839 boolean wasFullScreen;
3940
....@@ -296,9 +297,9 @@
296297 client = inClient;
297298 copy = client;
298299
299
- if (copy.versions == null)
300
+ if (copy.versionlist == null)
300301 {
301
- copy.versions = new byte[100][];
302
+ copy.versionlist = new Object3D[100];
302303 copy.versionindex = -1;
303304 }
304305
....@@ -315,9 +316,9 @@
315316 client = inClient;
316317 copy = client;
317318
318
- if (copy.versions == null)
319
+ if (copy.versionlist == null)
319320 {
320
- copy.versions = new byte[100][];
321
+ copy.versionlist = new Object3D[100];
321322 copy.versionindex = -1;
322323 }
323324
....@@ -353,7 +354,7 @@
353354 copy = localCopy;
354355 copy.editWindow = this;
355356
356
- if (copy.versions == null)
357
+ if (copy.versionlist == null)
357358 {
358359 // copy.versions = new byte[100][];
359360 // copy.versionindex = -1;
....@@ -467,7 +468,9 @@
467468 toolboxPanel = new cGridBag().setVertical(true);
468469 //toolboxPanel.setName("Toolbox");
469470
470
- materialPanel = new cGridBag().setVertical(true);
471
+ skyboxPanel = new cGridBag().setVertical(true);
472
+
473
+ materialPanel = new cGridBag().setVertical(false);
471474 //materialPanel.setName("Material");
472475
473476 /*JTextPane*/
....@@ -751,6 +754,7 @@
751754 boolean maximized;
752755
753756 cButton fullscreenLayout;
757
+ cButton expandedLayout;
754758
755759 void Minimize()
756760 {
....@@ -790,10 +794,12 @@
790794 cButton minButton;
791795 cButton maxButton;
792796 cButton fullButton;
797
+ cButton collapseButton;
798
+ cButton maximize3DButton;
793799
794800 void ToggleFullScreen()
795801 {
796
-GraphicsDevice device = frame.getGraphicsConfiguration().getDevice();
802
+ GraphicsDevice device = frame.getGraphicsConfiguration().getDevice();
797803
798804 cameraView.ToggleFullScreen();
799805
....@@ -814,13 +820,13 @@
814820 // X frame.getContentPane().remove(/*"Center",*/bigThree);
815821 // X framePanel.add(bigThree);
816822 // X frame.getContentPane().add(/*"Center",*/framePanel);
817
- framePanel.setDividerLocation(46);
823
+// framePanel.setDividerLocation(46); // icons are 24x24
818824
819825 //frame.setVisible(true);
820
- radio.layout = keepButton;
826
+// radio.layout = keepButton;
821827 //theFrame = null;
822828 keepButton = null;
823
- radio.layout.doClick();
829
+// radio.layout.doClick();
824830
825831 } else
826832 {
....@@ -841,31 +847,42 @@
841847 // X frame.getContentPane().remove(/*"Center",*/framePanel);
842848 // X framePanel.remove(bigThree);
843849 // X frame.getContentPane().add(/*"Center",*/bigThree);
844
- framePanel.setDividerLocation(0);
850
+// framePanel.setDividerLocation(0);
845851
846
- radio.layout = fullscreenLayout;
847
- radio.layout.doClick();
852
+// radio.layout = fullscreenLayout;
853
+// radio.layout.doClick();
848854 //frame.setVisible(true);
849855 }
850856 frame.validate();
857
+
858
+ cameraView.requestFocusInWindow();
851859 }
852860
853
- private byte[] CompressCopy()
861
+ void CollapseToolbar()
862
+ {
863
+ framePanel.setDividerLocation(0);
864
+ //frame.validate();
865
+
866
+ cameraView.requestFocusInWindow();
867
+ }
868
+
869
+ private Object3D Duplicate(Object3D object)
854870 {
855871 boolean temp = CameraPane.SWITCH;
856872 CameraPane.SWITCH = false;
857873
858
- copy.ExtractBigData(versiontable);
874
+ object.ExtractBigData(versiontable);
859875 // if (copy == client)
860876
861
- byte[] versions[] = copy.versions;
862
- copy.versions = null;
877
+ Object3D versions[] = object.versionlist;
878
+ object.versionlist = null;
863879
864
- byte[] compress = Compress(copy);
880
+ //byte[] compress = Compress(copy);
881
+ Object3D compress = (Object3D)Grafreed.clone(object);
865882
866
- copy.versions = versions;
883
+ object.versionlist = versions;
867884
868
- copy.RestoreBigData(versiontable);
885
+ object.RestoreBigData(versiontable);
869886
870887 CameraPane.SWITCH = temp;
871888
....@@ -993,6 +1010,7 @@
9931010 {
9941011 SetupMaterial(materialPanel);
9951012 }
1013
+
9961014 //SetupName();
9971015 //SetupViews();
9981016 }
....@@ -1201,6 +1219,18 @@
12011219
12021220 namePanel = new cGridBag();
12031221
1222
+ //if (copy.pinned)
1223
+ {
1224
+ pinButton = GetToggleButton("icons/pin.png", !Grafreed.NIMBUSLAF);
1225
+ pinButton.setSelected(copy.pinned);
1226
+ cGridBag t = new cGridBag();
1227
+ t.preferredWidth = 2;
1228
+ t.add(pinButton);
1229
+ namePanel.add(t);
1230
+
1231
+ pinButton.addItemListener(this);
1232
+ }
1233
+
12041234 nameField = AddText(namePanel, copy.GetName());
12051235 namePanel.add(new JScrollPane(nameField, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER));
12061236 oe.ctrlPanel.add(namePanel);
....@@ -1550,29 +1580,28 @@
15501580 //tmp.setName("Edit");
15511581 objectPanel.add(materialPanel);
15521582 objectPanel.setIconAt(0, GetIcon("icons/material.png"));
1553
- objectPanel.setToolTipTextAt(0, "Material panel");
1583
+ objectPanel.setToolTipTextAt(0, "Material");
15541584
1585
+ objectPanel.add(toolboxPanel);
1586
+ objectPanel.setIconAt(1, GetIcon("icons/primitives.png"));
1587
+ objectPanel.setToolTipTextAt(1, "Objects & textures");
1588
+
1589
+ objectPanel.add(skyboxPanel);
1590
+ objectPanel.setIconAt(2, GetIcon("icons/skybox.jpg"));
1591
+ objectPanel.setToolTipTextAt(2, "Backgrounds");
1592
+
15551593 // JPanel north = new JPanel(new BorderLayout());
15561594 // north.setName("Edit");
15571595 // north.add(ctrlPanel, BorderLayout.NORTH);
15581596 // objectPanel.add(north);
15591597 objectPanel.add(editPanel);
1560
- objectPanel.setIconAt(1, GetIcon("icons/write.png"));
1561
- objectPanel.setToolTipTextAt(1, "Edit panel");
1562
-
1563
- //if (Globals.ADVANCED)
1564
- objectPanel.add(infoPanel);
1565
- objectPanel.setIconAt(2, GetIcon("icons/info.png"));
1566
- objectPanel.setToolTipTextAt(2, "Info panel");
1598
+ objectPanel.setIconAt(3, GetIcon("icons/write.png"));
1599
+ objectPanel.setToolTipTextAt(3, "Edit controls");
15671600
15681601 objectPanel.add(XYZPanel);
1569
- objectPanel.setIconAt(3, GetIcon("icons/XYZ.png"));
1570
- objectPanel.setToolTipTextAt(3, "XYZ/RGB panel");
1602
+ objectPanel.setIconAt(4, GetIcon("icons/XYZ.png"));
1603
+ objectPanel.setToolTipTextAt(4, "XYZ/RGB transform");
15711604
1572
- objectPanel.add(toolboxPanel);
1573
- objectPanel.setIconAt(4, GetIcon("icons/primitives.png"));
1574
- objectPanel.setToolTipTextAt(4, "Objects/backgrounds panel");
1575
-
15761605 /*
15771606 aConstraints.gridx = 0;
15781607 aConstraints.gridwidth = 1;
....@@ -1609,6 +1638,11 @@
16091638
16101639 scenePanel.add(tabbedPane);
16111640
1641
+ //if (Globals.ADVANCED)
1642
+ tabbedPane.add(infoPanel);
1643
+ tabbedPane.setIconAt(3, GetIcon("icons/info.png"));
1644
+ tabbedPane.setToolTipTextAt(3, "Information");
1645
+
16121646 /*
16131647 cTree jTree = new cTree(null);
16141648 ToolTipManager.sharedInstance().registerComponent(jTree);
....@@ -1679,6 +1713,23 @@
16791713 // aConstraints.gridheight = 1;
16801714
16811715 framePanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, toolbarPanel, bigThree);
1716
+
1717
+ framePanel.addPropertyChangeListener(JSplitPane.DIVIDER_LOCATION_PROPERTY,
1718
+ new java.beans.PropertyChangeListener()
1719
+ {
1720
+ public void propertyChange(java.beans.PropertyChangeEvent pce)
1721
+ {
1722
+ if ((Integer)pce.getOldValue() == 1)
1723
+ {
1724
+ if (radio.layout != expandedLayout)
1725
+ {
1726
+ radio.layout = expandedLayout;
1727
+ radio.layout.doClick();
1728
+ }
1729
+ }
1730
+ }
1731
+ });
1732
+
16821733 framePanel.setContinuousLayout(false);
16831734 framePanel.setOneTouchExpandable(false);
16841735 //.setDividerLocation(0.8);
....@@ -1733,12 +1784,403 @@
17331784 ctrlPanel.removeAll();
17341785 }
17351786
1736
- void SetupMaterial(cGridBag panel)
1787
+ void SetupMaterial(cGridBag materialpanel)
17371788 {
1738
- /*
1789
+ cGridBag presetpanel = new cGridBag().setVertical(true);
1790
+
1791
+ cLabel skin = GetLabel("icons/shadericons/shadericon00000.png", !Grafreed.NIMBUSLAF);
1792
+ skin.setToolTipText("Skin");
1793
+ skin.addMouseListener(new MouseAdapter()
1794
+ {
1795
+ public void mouseClicked(MouseEvent e)
1796
+ {
1797
+ Object3D object = Grafreed.materials.versionlist[0].get(0);
1798
+ cMaterial material = object.material;
1799
+
1800
+ // Skin
1801
+ colorField.setFloat(material.color);
1802
+ saturationField.setFloat(material.modulation);
1803
+ subsurfaceField.setFloat(material.subsurface);
1804
+ selfshadowField.setFloat(material.diffuseness);
1805
+ diffusenessField.setFloat(material.factor);
1806
+ shininessField.setFloat(material.shininess);
1807
+ shadowbiasField.setFloat(material.shadowbias);
1808
+ diffuseField.setFloat(material.diffuse);
1809
+ specularField.setFloat(material.specular);
1810
+
1811
+ bumpField.setFloat(object.projectedVertices[0].x / 1000.0);
1812
+ noiseField.setFloat(object.projectedVertices[0].y / 1000.0);
1813
+ powerField.setFloat(object.projectedVertices[2].x / 1000.0);
1814
+
1815
+ materialtouched = true;
1816
+ applySelf();
1817
+ }
1818
+ });
1819
+ presetpanel.add(skin);
1820
+
1821
+ cLabel lambert = GetLabel("icons/shadericons/shadericon00002.png", !Grafreed.NIMBUSLAF);
1822
+ lambert.setToolTipText("Diffuse");
1823
+ lambert.addMouseListener(new MouseAdapter()
1824
+ {
1825
+ public void mouseClicked(MouseEvent e)
1826
+ {
1827
+ Object3D object = Grafreed.materials.versionlist[2].get(0);
1828
+ cMaterial material = object.material;
1829
+
1830
+ diffusenessField.setFloat(material.factor);
1831
+ selfshadowField.setFloat(material.diffuseness);
1832
+
1833
+ materialtouched = true;
1834
+ applySelf();
1835
+ }
1836
+ });
1837
+ presetpanel.add(lambert);
1838
+
1839
+ cLabel diffuse2 = GetLabel("icons/shadericons/shadericon00003.png", !Grafreed.NIMBUSLAF);
1840
+ diffuse2.setToolTipText("Diffuse2");
1841
+ diffuse2.addMouseListener(new MouseAdapter()
1842
+ {
1843
+ public void mouseClicked(MouseEvent e)
1844
+ {
1845
+ Object3D object = Grafreed.materials.versionlist[3].get(0);
1846
+ cMaterial material = object.material;
1847
+
1848
+ diffusenessField.setFloat(material.factor);
1849
+ selfshadowField.setFloat(material.diffuseness);
1850
+
1851
+ materialtouched = true;
1852
+ applySelf();
1853
+ }
1854
+ });
1855
+ presetpanel.add(diffuse2);
1856
+
1857
+ cLabel diffusemoon = GetLabel("icons/shadericons/shadericon00004.png", !Grafreed.NIMBUSLAF);
1858
+ diffusemoon.setToolTipText("Moon");
1859
+ diffusemoon.addMouseListener(new MouseAdapter()
1860
+ {
1861
+ public void mouseClicked(MouseEvent e)
1862
+ {
1863
+ Object3D object = Grafreed.materials.versionlist[4].get(0);
1864
+ cMaterial material = object.material;
1865
+
1866
+ diffusenessField.setFloat(material.factor);
1867
+ selfshadowField.setFloat(material.diffuseness);
1868
+
1869
+ materialtouched = true;
1870
+ applySelf();
1871
+ }
1872
+ });
1873
+ presetpanel.add(diffusemoon);
1874
+
1875
+ cLabel diffusemoon2 = GetLabel("icons/shadericons/shadericon00005.png", !Grafreed.NIMBUSLAF);
1876
+ diffusemoon2.setToolTipText("Moon2");
1877
+ diffusemoon2.addMouseListener(new MouseAdapter()
1878
+ {
1879
+ public void mouseClicked(MouseEvent e)
1880
+ {
1881
+ Object3D object = Grafreed.materials.versionlist[5].get(0);
1882
+ cMaterial material = object.material;
1883
+
1884
+ diffusenessField.setFloat(material.factor);
1885
+ selfshadowField.setFloat(material.diffuseness);
1886
+
1887
+ materialtouched = true;
1888
+ applySelf();
1889
+ }
1890
+ });
1891
+ presetpanel.add(diffusemoon2);
1892
+
1893
+ cLabel diffusemoon3 = GetLabel("icons/shadericons/shadericon00006.png", !Grafreed.NIMBUSLAF);
1894
+ diffusemoon3.setToolTipText("Moon3");
1895
+ diffusemoon3.addMouseListener(new MouseAdapter()
1896
+ {
1897
+ public void mouseClicked(MouseEvent e)
1898
+ {
1899
+ Object3D object = Grafreed.materials.versionlist[6].get(0);
1900
+ cMaterial material = object.material;
1901
+
1902
+ diffusenessField.setFloat(material.factor);
1903
+ selfshadowField.setFloat(material.diffuseness);
1904
+
1905
+ materialtouched = true;
1906
+ applySelf();
1907
+ }
1908
+ });
1909
+ presetpanel.add(diffusemoon3);
1910
+
1911
+ cLabel diffusesheen = GetLabel("icons/shadericons/shadericon00007.png", !Grafreed.NIMBUSLAF);
1912
+ diffusesheen.setToolTipText("Sheen");
1913
+ diffusesheen.addMouseListener(new MouseAdapter()
1914
+ {
1915
+ public void mouseClicked(MouseEvent e)
1916
+ {
1917
+ Object3D object = Grafreed.materials.versionlist[7].get(0);
1918
+ cMaterial material = object.material;
1919
+
1920
+ sheenField.setFloat(material.sheen);
1921
+
1922
+ materialtouched = true;
1923
+ applySelf();
1924
+ }
1925
+ });
1926
+ presetpanel.add(diffusesheen);
1927
+
1928
+ cLabel rough = GetLabel("icons/shadericons/shadericon00001.png", !Grafreed.NIMBUSLAF);
1929
+ rough.setToolTipText("Rough metal");
1930
+ rough.addMouseListener(new MouseAdapter()
1931
+ {
1932
+ public void mouseClicked(MouseEvent e)
1933
+ {
1934
+ Object3D object = Grafreed.materials.versionlist[1].get(0);
1935
+ cMaterial material = object.material;
1936
+
1937
+ shininessField.setFloat(material.shininess);
1938
+ velvetField.setFloat(material.velvet);
1939
+
1940
+ materialtouched = true;
1941
+ applySelf();
1942
+ }
1943
+ });
1944
+ presetpanel.add(rough);
1945
+
1946
+ cLabel rough2 = GetLabel("icons/shadericons/shadericon00013.png", !Grafreed.NIMBUSLAF);
1947
+ rough2.setToolTipText("Medium metal");
1948
+ rough2.addMouseListener(new MouseAdapter()
1949
+ {
1950
+ public void mouseClicked(MouseEvent e)
1951
+ {
1952
+ Object3D object = Grafreed.materials.versionlist[13].get(0);
1953
+ cMaterial material = object.material;
1954
+
1955
+ shininessField.setFloat(material.shininess);
1956
+ lightareaField.setFloat(material.lightarea);
1957
+
1958
+ materialtouched = true;
1959
+ applySelf();
1960
+ }
1961
+ });
1962
+ presetpanel.add(rough2);
1963
+
1964
+ cLabel shini0 = GetLabel("icons/shadericons/shadericon00014.png", !Grafreed.NIMBUSLAF);
1965
+ shini0.setToolTipText("Shiny");
1966
+ shini0.addMouseListener(new MouseAdapter()
1967
+ {
1968
+ public void mouseClicked(MouseEvent e)
1969
+ {
1970
+ Object3D object = Grafreed.materials.versionlist[14].get(0);
1971
+ cMaterial material = object.material;
1972
+
1973
+ shininessField.setFloat(material.shininess);
1974
+ lightareaField.setFloat(material.lightarea);
1975
+
1976
+ materialtouched = true;
1977
+ applySelf();
1978
+ }
1979
+ });
1980
+ presetpanel.add(shini0);
1981
+
1982
+ cLabel shini1 = GetLabel("icons/shadericons/shadericon00011.png", !Grafreed.NIMBUSLAF);
1983
+ shini1.setToolTipText("Shiny2");
1984
+ shini1.addMouseListener(new MouseAdapter()
1985
+ {
1986
+ public void mouseClicked(MouseEvent e)
1987
+ {
1988
+ Object3D object = Grafreed.materials.versionlist[11].get(0);
1989
+ cMaterial material = object.material;
1990
+
1991
+ shininessField.setFloat(material.shininess);
1992
+ lightareaField.setFloat(material.lightarea);
1993
+
1994
+ materialtouched = true;
1995
+ applySelf();
1996
+ }
1997
+ });
1998
+ presetpanel.add(shini1);
1999
+
2000
+ cLabel shini2 = GetLabel("icons/shadericons/shadericon00012.png", !Grafreed.NIMBUSLAF);
2001
+ shini2.setToolTipText("Shiny3");
2002
+ shini2.addMouseListener(new MouseAdapter()
2003
+ {
2004
+ public void mouseClicked(MouseEvent e)
2005
+ {
2006
+ Object3D object = Grafreed.materials.versionlist[12].get(0);
2007
+ cMaterial material = object.material;
2008
+
2009
+ shininessField.setFloat(material.shininess);
2010
+ lightareaField.setFloat(material.lightarea);
2011
+
2012
+ materialtouched = true;
2013
+ applySelf();
2014
+ }
2015
+ });
2016
+ presetpanel.add(shini2);
2017
+
2018
+ cLabel aniso = GetLabel("icons/shadericons/shadericon00008.png", !Grafreed.NIMBUSLAF);
2019
+ aniso.setToolTipText("AnisoU");
2020
+ aniso.addMouseListener(new MouseAdapter()
2021
+ {
2022
+ public void mouseClicked(MouseEvent e)
2023
+ {
2024
+ Object3D object = Grafreed.materials.versionlist[8].get(0);
2025
+ cMaterial material = object.material;
2026
+
2027
+ anisoField.setFloat(material.aniso);
2028
+ anisoVField.setFloat(material.anisoV);
2029
+
2030
+ materialtouched = true;
2031
+ applySelf();
2032
+ }
2033
+ });
2034
+ presetpanel.add(aniso);
2035
+
2036
+ cLabel aniso2 = GetLabel("icons/shadericons/shadericon00009.png", !Grafreed.NIMBUSLAF);
2037
+ aniso2.setToolTipText("AnisoV");
2038
+ aniso2.addMouseListener(new MouseAdapter()
2039
+ {
2040
+ public void mouseClicked(MouseEvent e)
2041
+ {
2042
+ Object3D object = Grafreed.materials.versionlist[9].get(0);
2043
+ cMaterial material = object.material;
2044
+
2045
+ anisoField.setFloat(material.aniso);
2046
+ anisoVField.setFloat(material.anisoV);
2047
+
2048
+ materialtouched = true;
2049
+ applySelf();
2050
+ }
2051
+ });
2052
+ presetpanel.add(aniso2);
2053
+
2054
+ cLabel aniso3 = GetLabel("icons/shadericons/shadericon00010.png", !Grafreed.NIMBUSLAF);
2055
+ aniso3.setToolTipText("AnisoUV");
2056
+ aniso3.addMouseListener(new MouseAdapter()
2057
+ {
2058
+ public void mouseClicked(MouseEvent e)
2059
+ {
2060
+ Object3D object = Grafreed.materials.versionlist[10].get(0);
2061
+ cMaterial material = object.material;
2062
+
2063
+ anisoField.setFloat(material.aniso);
2064
+ anisoVField.setFloat(material.anisoV);
2065
+
2066
+ materialtouched = true;
2067
+ applySelf();
2068
+ }
2069
+ });
2070
+ presetpanel.add(aniso3);
2071
+
2072
+ cLabel velvet0 = GetLabel("icons/shadericons/shadericon00015.png", !Grafreed.NIMBUSLAF);
2073
+ velvet0.setToolTipText("Velvet");
2074
+ velvet0.addMouseListener(new MouseAdapter()
2075
+ {
2076
+ public void mouseClicked(MouseEvent e)
2077
+ {
2078
+ Object3D object = Grafreed.materials.versionlist[15].get(0);
2079
+ cMaterial material = object.material;
2080
+
2081
+ diffusenessField.setFloat(material.factor);
2082
+ selfshadowField.setFloat(material.diffuseness);
2083
+ sheenField.setFloat(material.sheen);
2084
+ shininessField.setFloat(material.shininess);
2085
+ velvetField.setFloat(material.velvet);
2086
+ shiftField.setFloat(material.shift);
2087
+
2088
+ materialtouched = true;
2089
+ applySelf();
2090
+ }
2091
+ });
2092
+ presetpanel.add(velvet0);
2093
+
2094
+ cLabel bump0 = GetLabel("icons/shadericons/shadericon00016.png", !Grafreed.NIMBUSLAF);
2095
+ bump0.setToolTipText("Bump texture");
2096
+ bump0.addMouseListener(new MouseAdapter()
2097
+ {
2098
+ public void mouseClicked(MouseEvent e)
2099
+ {
2100
+ Object3D object = Grafreed.materials.versionlist[16].get(0);
2101
+ cMaterial material = object.material;
2102
+
2103
+ bumpField.setFloat(object.projectedVertices[0].x / 1000.0);
2104
+ noiseField.setFloat(object.projectedVertices[0].y / 1000.0);
2105
+ powerField.setFloat(object.projectedVertices[2].x / 1000.0);
2106
+
2107
+ materialtouched = true;
2108
+ applySelf();
2109
+ }
2110
+ });
2111
+ presetpanel.add(bump0);
2112
+
2113
+ cLabel halo = GetLabel("icons/shadericons/shadericon00017.png", !Grafreed.NIMBUSLAF);
2114
+ halo.setToolTipText("Halo");
2115
+ halo.addMouseListener(new MouseAdapter()
2116
+ {
2117
+ public void mouseClicked(MouseEvent e)
2118
+ {
2119
+ Object3D object = Grafreed.materials.versionlist[17].get(0);
2120
+ cMaterial material = object.material;
2121
+
2122
+ opacityPowerField.setFloat(object.projectedVertices[2].y / 1000.0);
2123
+
2124
+ materialtouched = true;
2125
+ applySelf();
2126
+ }
2127
+ });
2128
+ presetpanel.add(halo);
2129
+
2130
+ cLabel candle = GetLabel("icons/shadericons/shadericon00018.png", !Grafreed.NIMBUSLAF);
2131
+ candle.setToolTipText("Candle");
2132
+ candle.addMouseListener(new MouseAdapter()
2133
+ {
2134
+ public void mouseClicked(MouseEvent e)
2135
+ {
2136
+ Object3D object = Grafreed.materials.versionlist[18].get(0);
2137
+ cMaterial material = object.material;
2138
+
2139
+ subsurfaceField.setFloat(material.subsurface);
2140
+ shadowbiasField.setFloat(material.shadowbias);
2141
+ ambientField.setFloat(material.ambient);
2142
+ specularField.setFloat(material.specular);
2143
+ lightareaField.setFloat(material.lightarea);
2144
+ shininessField.setFloat(material.shininess);
2145
+
2146
+ materialtouched = true;
2147
+ applySelf();
2148
+ }
2149
+ });
2150
+ presetpanel.add(candle);
2151
+
2152
+ cLabel shadowShader = GetLabel("icons/shadericons/shadow.png", !Grafreed.NIMBUSLAF);
2153
+ shadowShader.setToolTipText("Shadow");
2154
+ shadowShader.addMouseListener(new MouseAdapter()
2155
+ {
2156
+ public void mouseClicked(MouseEvent e)
2157
+ {
2158
+ diffuseField.setFloat(0.001);
2159
+ ambientField.setFloat(0.001);
2160
+ cameraField.setFloat(0.001);
2161
+ specularField.setFloat(0.001);
2162
+ fakedepthField.setFloat(0.001);
2163
+ opacityField.setFloat(0.6);
2164
+
2165
+ materialtouched = true;
2166
+ applySelf();
2167
+ }
2168
+ });
2169
+ presetpanel.add(shadowShader);
2170
+
2171
+ cGridBag panel = new cGridBag().setVertical(true);
2172
+
2173
+ presetpanel.preferredWidth = 1;
2174
+
2175
+ materialpanel.add(presetpanel);
2176
+ materialpanel.add(panel);
2177
+
2178
+ panel.preferredWidth = 8;
2179
+
2180
+ /*
17392181 ctrlPanel.add(materialLabel = new JLabel("MATERIAL : "), aConstraints);
17402182 materialLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1741
- */
2183
+ */
17422184
17432185 cGridBag editBar = new cGridBag().setVertical(false);
17442186
....@@ -1775,7 +2217,9 @@
17752217
17762218 cGridBag huepanel = new cGridBag();
17772219 cGridBag huelabel = new cGridBag();
1778
- huelabel.add(GetLabel("icons/hue.png", false));
2220
+ skin = GetLabel("icons/hue.png", false);
2221
+ skin.fit = true;
2222
+ huelabel.add(skin);
17792223 huelabel.preferredWidth = 20;
17802224 huepanel.add(new cGridBag()); // Label
17812225 huepanel.add(huelabel); // Field/slider
....@@ -1796,7 +2240,7 @@
17962240 cGridBag modulation = new cGridBag();
17972241 modulation.add(modulationLabel = new JLabel("Saturation")); // , aConstraints);
17982242 modulationLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1799
- modulation.add(modulationField = new cNumberSlider(this, 0.001, 1)); // , aConstraints);
2243
+ modulation.add(saturationField = new cNumberSlider(this, 0.001, 1)); // , aConstraints);
18002244 colorSection.add(modulation);
18012245
18022246 cGridBag opacity = new cGridBag();
....@@ -2989,7 +3433,7 @@
29893433
29903434 freezematerial = true;
29913435 colorField.setFloat(mat.color);
2992
- modulationField.setFloat(mat.modulation);
3436
+ saturationField.setFloat(mat.modulation);
29933437 metalnessField.setFloat(mat.metalness);
29943438 diffuseField.setFloat(mat.diffuse);
29953439 specularField.setFloat(mat.specular);
....@@ -3196,6 +3640,17 @@
31963640 public void itemStateChanged(ItemEvent event)
31973641 {
31983642 // System.out.println("Propagate = " + propagate);
3643
+ if (event.getSource() == pinButton)
3644
+ {
3645
+ copy.pinned ^= true;
3646
+ if (!copy.pinned && !copy.editWindow.copy.selection.contains(copy))
3647
+ {
3648
+ ((GroupEditor)copy.editWindow).listUI.remove(copy);
3649
+ copy.CloseUI();
3650
+ //copy.editWindow.refreshContents();
3651
+ }
3652
+ }
3653
+ else
31993654 if (event.getSource() == propagateToggle)
32003655 {
32013656 propagate ^= true;
....@@ -3300,6 +3755,7 @@
33003755 } else if (event.getSource() == liveCB)
33013756 {
33023757 copy.live ^= true;
3758
+ objEditor.refreshContents(true); // To show item colors
33033759 return;
33043760 } else if (event.getSource() == selectableCB)
33053761 {
....@@ -3309,7 +3765,7 @@
33093765 {
33103766 copy.hide ^= true;
33113767 copy.Touch(); // display list issue
3312
- objEditor.refreshContents();
3768
+ objEditor.refreshContents(true); // To show item colors
33133769 return;
33143770 } else if (event.getSource() == link2masterCB)
33153771 {
....@@ -3565,6 +4021,7 @@
35654021
35664022 static public byte[] Compress(Object3D o)
35674023 {
4024
+ // Slower to actually compress.
35684025 try
35694026 {
35704027 ByteArrayOutputStream baos = new ByteArrayOutputStream();
....@@ -3666,6 +4123,7 @@
36664123 {
36674124 //Save(true);
36684125 Replace();
4126
+ SetUndoStates();
36694127 }
36704128
36714129 private boolean Equal(byte[] compress, byte[] name)
....@@ -3686,29 +4144,46 @@
36864144
36874145 java.util.Hashtable<java.util.UUID, Object3D> versiontable = new java.util.Hashtable<java.util.UUID, Object3D>();
36884146
4147
+ void DeleteVersion()
4148
+ {
4149
+ for (int i = copy.versionindex; i < copy.versionlist.length-1; i++)
4150
+ {
4151
+ copy.versionlist[i] = copy.versionlist[i+1];
4152
+ }
4153
+
4154
+ CopyChanged();
4155
+
4156
+ SetUndoStates();
4157
+ }
4158
+
36894159 public boolean Save(boolean user)
36904160 {
36914161 System.err.println("Save");
4162
+ Replace();
36924163
36934164 cRadio tab = GetCurrentTab();
36944165
3695
- byte[] compress = CompressCopy(); // Saved version. No need for "Replace".
4166
+ Object3D compress = Duplicate(copy); // Saved version. No need for "Replace"?
36964167
36974168 boolean thesame = false;
36984169
3699
- // Quick heuristic using length. Works only when stream is compressed.
3700
- if (copy.versionindex > 0 && copy.versions[copy.versionindex-1] != null && Equal(compress, copy.versions[copy.versionindex-1]))
3701
- {
3702
- thesame = true;
3703
- }
4170
+// if (copy.versionindex > 0 && copy.versions[copy.versionindex-1] != null && Equal(compress, copy.versions[copy.versionindex-1]))
4171
+// {
4172
+// thesame = true;
4173
+// }
37044174
37054175 //EditorFrame.m_MainFrame.requestFocusInWindow();
37064176 if (!thesame)
37074177 {
4178
+ for (int i = copy.versionlist.length; --i > copy.versionindex+1;)
4179
+ {
4180
+ copy.versionlist[i] = copy.versionlist[i-1];
4181
+ }
4182
+
37084183 //tab.user[tab.versionindex] = user;
37094184 //boolean increment = true; // tab.graphs[tab.versionindex] == null;
37104185
3711
- copy.versions[++copy.versionindex] = compress;
4186
+ copy.versionlist[++copy.versionindex] = compress;
37124187
37134188 // if (increment)
37144189 // tab.versionindex++;
....@@ -3718,11 +4193,11 @@
37184193
37194194 //assert(hashtable.isEmpty());
37204195
3721
- for (int i = copy.versionindex+1; i < copy.versions.length; i++)
3722
- {
3723
- //tab.user[i] = false;
3724
- copy.versions[i] = null;
3725
- }
4196
+// for (int i = copy.versionindex+1; i < copy.versionlist.length; i++)
4197
+// {
4198
+// //tab.user[i] = false;
4199
+// copy.versionlist[i] = null;
4200
+// }
37264201
37274202 SetUndoStates();
37284203
....@@ -3747,9 +4222,43 @@
37474222
37484223 return !thesame;
37494224 }
3750
-
3751
- void CopyChanged(Object3D obj)
4225
+
4226
+ boolean flashIt = true;
4227
+
4228
+ void RefreshSelection()
37524229 {
4230
+ Object3D selection = new Object3D();
4231
+
4232
+ for (int i = 0; i < copy.selection.size(); i++)
4233
+ {
4234
+ Object3D elem = copy.selection.elementAt(i);
4235
+
4236
+ Object3D obj = copy.GetObject(elem.GetUUID());
4237
+
4238
+ if (obj == null)
4239
+ {
4240
+ copy.selection.remove(i--);
4241
+ }
4242
+ else
4243
+ {
4244
+ selection.add(obj);
4245
+ copy.selection.setElementAt(obj, i);
4246
+ }
4247
+ }
4248
+
4249
+ flashIt = false;
4250
+ GetTree().clearSelection();
4251
+ for (int i = 0; i < selection.size(); i++)
4252
+ GetTree().addSelectionPath(selection.elementAt(i).GetTreePath().GetTreePath());
4253
+ flashIt = true;
4254
+
4255
+ //refreshContents(false);
4256
+ }
4257
+
4258
+ void CopyChanged()
4259
+ {
4260
+ Object3D obj = (Object3D)Grafreed.clone(copy.versionlist[copy.versionindex]);
4261
+
37534262 SetUndoStates();
37544263
37554264 boolean temp = CameraPane.SWITCH;
....@@ -3771,6 +4280,7 @@
37714280
37724281 CameraPane.SWITCH = temp;
37734282
4283
+ RefreshSelection();
37744284 //assert(hashtable.isEmpty());
37754285
37764286 copy.Touch();
....@@ -3791,13 +4301,15 @@
37914301 }
37924302 }
37934303
3794
- refreshContents();
4304
+ refreshContents(true);
37954305 }
37964306
3797
- cButton undoButton;
4307
+ cButton previousVersionButton;
37984308 cButton restoreButton;
37994309 cButton replaceButton;
3800
- cButton redoButton;
4310
+ cButton nextVersionButton;
4311
+ cButton saveVersionButton;
4312
+ cButton deleteVersionButton;
38014313
38024314 boolean muteSlider;
38034315
....@@ -3805,9 +4317,9 @@
38054317 {
38064318 int count = 0;
38074319
3808
- for (int i = copy.versions.length; --i >= 0;)
4320
+ for (int i = copy.versionlist.length; --i >= 0;)
38094321 {
3810
- if (copy.versions[i] != null)
4322
+ if (copy.versionlist[i] != null)
38114323 count++;
38124324 }
38134325
....@@ -3818,11 +4330,14 @@
38184330 {
38194331 cRadio tab = GetCurrentTab();
38204332
3821
- restoreButton.setEnabled(copy.versionindex != -1);
3822
- replaceButton.setEnabled(copy.versionindex != -1);
4333
+ restoreButton.setEnabled(true); // copy.versionindex != -1);
4334
+ replaceButton.setEnabled(true); // copy.versionindex != -1);
38234335
3824
- undoButton.setEnabled(copy.versionindex > 0);
3825
- redoButton.setEnabled(copy.versions[copy.versionindex + 1] != null);
4336
+ previousVersionButton.setEnabled(copy.versionindex > 0);
4337
+ nextVersionButton.setEnabled(copy.versionlist[copy.versionindex + 1] != null);
4338
+
4339
+ deleteVersionButton.setEnabled(//copy.versionindex > 0 &&
4340
+ copy.versionlist[copy.versionindex + 1] != null);
38264341
38274342 muteSlider = true;
38284343 versionSlider.setMaximum(VersionCount() - 1);
....@@ -3830,7 +4345,7 @@
38304345 muteSlider = false;
38314346 }
38324347
3833
- public boolean Undo()
4348
+ public boolean PreviousVersion()
38344349 {
38354350 // Option?
38364351 Replace();
....@@ -3860,7 +4375,7 @@
38604375
38614376 copy.versionindex -= 1;
38624377
3863
- CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex]));
4378
+ CopyChanged();
38644379
38654380 return true;
38664381 }
....@@ -3871,13 +4386,14 @@
38714386
38724387 cRadio tab = GetCurrentTab();
38734388
3874
- if (copy.versionindex == -1 || copy.versions[copy.versionindex] == null)
4389
+ if (copy.versionindex == -1 || copy.versionlist[copy.versionindex] == null)
38754390 {
38764391 java.awt.Toolkit.getDefaultToolkit().beep();
38774392 return false;
38784393 }
38794394
3880
- CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex]));
4395
+ //CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex]));
4396
+ CopyChanged();
38814397
38824398 return true;
38834399 }
....@@ -3888,25 +4404,25 @@
38884404
38894405 cRadio tab = GetCurrentTab();
38904406
3891
- if (copy.versionindex == -1 || copy.versions[copy.versionindex] == null)
4407
+ if (copy.versionindex == -1 || copy.versionlist[copy.versionindex] == null)
38924408 {
38934409 // No version yet. OK. java.awt.Toolkit.getDefaultToolkit().beep();
38944410 return false;
38954411 }
38964412
3897
- copy.versions[copy.versionindex] = CompressCopy();
4413
+ copy.versionlist[copy.versionindex] = Duplicate(copy);
38984414
38994415 return true;
39004416 }
39014417
3902
- public void Redo()
4418
+ public void NextVersion()
39034419 {
39044420 // Option?
39054421 Replace();
39064422
39074423 cRadio tab = GetCurrentTab();
39084424
3909
- if (copy.versions[copy.versionindex + 1] == null)
4425
+ if (copy.versionlist[copy.versionindex + 1] == null)
39104426 {
39114427 java.awt.Toolkit.getDefaultToolkit().beep();
39124428 return;
....@@ -3914,7 +4430,7 @@
39144430
39154431 copy.versionindex += 1;
39164432
3917
- CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex]));
4433
+ CopyChanged();
39184434
39194435 //if (!tab.user[tab.versionindex])
39204436 // tab.graphs[tab.versionindex] = null;
....@@ -4128,7 +4644,7 @@
41284644 //copy.material = new cMaterial(copy.GetMaterial());
41294645
41304646 current.color = (float) colorField.getFloat();
4131
- current.modulation = (float) modulationField.getFloat();
4647
+ current.modulation = (float) saturationField.getFloat();
41324648 current.metalness = (float) metalnessField.getFloat();
41334649 current.diffuse = (float) diffuseField.getFloat();
41344650 current.specular = (float) specularField.getFloat();
....@@ -4161,7 +4677,7 @@
41614677 cMaterial mat = copy.material;
41624678
41634679 colorField.SetToolTipValue((mat.color));
4164
- modulationField.SetToolTipValue((mat.modulation));
4680
+ saturationField.SetToolTipValue((mat.modulation));
41654681 metalnessField.SetToolTipValue((mat.metalness));
41664682 diffuseField.SetToolTipValue((mat.diffuse));
41674683 specularField.SetToolTipValue((mat.specular));
....@@ -4225,9 +4741,10 @@
42254741
42264742 int version = versionSlider.getInteger();
42274743
4228
- if (copy.versions[version] != null)
4744
+ if (copy.versionlist[version] != null)
42294745 {
4230
- CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex = version]));
4746
+ copy.versionindex = version;
4747
+ CopyChanged();
42314748 }
42324749
42334750 return;
....@@ -4267,6 +4784,12 @@
42674784 {
42684785 //System.out.println("stateChanged = " + this);
42694786 materialtouched = true;
4787
+
4788
+ if (Globals.AUTOSATURATE && e.getSource() == colorField && saturationField.getFloat() == 0.001)
4789
+ {
4790
+ saturationField.setFloat(1);
4791
+ }
4792
+
42704793 applySelf();
42714794 //System.out.println("this = " + this);
42724795 //System.out.println("PARENT = " + parent);
....@@ -4566,6 +5089,7 @@
45665089 {
45675090 if (GetTree() != null)
45685091 {
5092
+ GetTree().revalidate();
45695093 GetTree().repaint();
45705094 }
45715095
....@@ -4574,6 +5098,9 @@
45745098 ctrlPanel.validate(); // ? new
45755099 ctrlPanel.repaint();
45765100 }
5101
+
5102
+ if (previousVersionButton != null && copy.versionlist != null)
5103
+ SetUndoStates();
45775104 }
45785105
45795106 static TweenManager tweenManager = new TweenManager();
....@@ -4957,12 +5484,12 @@
49575484 c.addChild(csg);
49585485 }
49595486
4960
- copy.versions = readobj.versions;
5487
+ copy.versionlist = readobj.versionlist;
49615488 copy.versionindex = readobj.versionindex;
49625489
4963
- if (copy.versions == null)
5490
+ if (copy.versionlist == null)
49645491 {
4965
- copy.versions = new byte[100][];
5492
+ copy.versionlist = new Object3D[100];
49665493 copy.versionindex = -1;
49675494 }
49685495
....@@ -4978,7 +5505,7 @@
49785505 {
49795506 if (Grafreed.standAlone)
49805507 {
4981
- FileDialog browser = new FileDialog(frame, "Load", FileDialog.LOAD);
5508
+ FileDialog browser = new FileDialog(frame, "Open", FileDialog.LOAD);
49825509 browser.show();
49835510 String filename = browser.getFile();
49845511 if (filename != null && filename.length() > 0)
....@@ -5297,6 +5824,7 @@
52975824 ButtonGroup buttonGroup;
52985825
52995826 cGridBag toolboxPanel;
5827
+ cGridBag skyboxPanel;
53005828 cGridBag materialPanel;
53015829 cGridBag ctrlPanel;
53025830
....@@ -5370,7 +5898,7 @@
53705898 JLabel colorLabel;
53715899 cNumberSlider colorField;
53725900 JLabel modulationLabel;
5373
- cNumberSlider modulationField;
5901
+ cNumberSlider saturationField;
53745902 JLabel metalnessLabel;
53755903 cNumberSlider metalnessField;
53765904 JLabel diffuseLabel;
....@@ -5401,6 +5929,7 @@
54015929 cNumberSlider anisoField;
54025930 JLabel anisoVLabel;
54035931 cNumberSlider anisoVField;
5932
+
54045933 JLabel cameraLabel;
54055934 cNumberSlider cameraField;
54065935 JLabel selfshadowLabel;
....@@ -5415,6 +5944,7 @@
54155944 cNumberSlider fakedepthField;
54165945 JLabel shadowbiasLabel;
54175946 cNumberSlider shadowbiasField;
5947
+
54185948 JLabel bumpLabel;
54195949 cNumberSlider bumpField;
54205950 JLabel noiseLabel;