Normand Briere
2019-08-07 59de607850161a26863f92961d53caae7a2dabc8
ObjEditor.java
....@@ -34,6 +34,7 @@
3434 iSendInfo
3535 //KeyListener
3636 {
37
+ public cToggleButton pinButton;
3738 boolean timeline;
3839 boolean wasFullScreen;
3940
....@@ -467,6 +468,8 @@
467468 toolboxPanel = new cGridBag().setVertical(true);
468469 //toolboxPanel.setName("Toolbox");
469470
471
+ skyboxPanel = new cGridBag().setVertical(true);
472
+
470473 materialPanel = new cGridBag().setVertical(false);
471474 //materialPanel.setName("Material");
472475
....@@ -848,6 +851,8 @@
848851 //frame.setVisible(true);
849852 }
850853 frame.validate();
854
+
855
+ cameraView.requestFocusInWindow();
851856 }
852857
853858 private Object3D CompressCopy()
....@@ -1203,6 +1208,18 @@
12031208
12041209 namePanel = new cGridBag();
12051210
1211
+ //if (copy.pinned)
1212
+ {
1213
+ pinButton = GetToggleButton("icons/pin.png", !Grafreed.NIMBUSLAF);
1214
+ pinButton.setSelected(copy.pinned);
1215
+ cGridBag t = new cGridBag();
1216
+ t.preferredWidth = 2;
1217
+ t.add(pinButton);
1218
+ namePanel.add(t);
1219
+
1220
+ pinButton.addItemListener(this);
1221
+ }
1222
+
12061223 nameField = AddText(namePanel, copy.GetName());
12071224 namePanel.add(new JScrollPane(nameField, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER));
12081225 oe.ctrlPanel.add(namePanel);
....@@ -1554,27 +1571,26 @@
15541571 objectPanel.setIconAt(0, GetIcon("icons/material.png"));
15551572 objectPanel.setToolTipTextAt(0, "Material");
15561573
1574
+ objectPanel.add(toolboxPanel);
1575
+ objectPanel.setIconAt(1, GetIcon("icons/primitives.png"));
1576
+ objectPanel.setToolTipTextAt(1, "Objects & textures");
1577
+
1578
+ objectPanel.add(skyboxPanel);
1579
+ objectPanel.setIconAt(2, GetIcon("icons/skybox.jpg"));
1580
+ objectPanel.setToolTipTextAt(2, "Backgrounds");
1581
+
15571582 // JPanel north = new JPanel(new BorderLayout());
15581583 // north.setName("Edit");
15591584 // north.add(ctrlPanel, BorderLayout.NORTH);
15601585 // objectPanel.add(north);
15611586 objectPanel.add(editPanel);
1562
- objectPanel.setIconAt(1, GetIcon("icons/write.png"));
1563
- objectPanel.setToolTipTextAt(1, "Edit controls");
1564
-
1565
- //if (Globals.ADVANCED)
1566
- objectPanel.add(infoPanel);
1567
- objectPanel.setIconAt(2, GetIcon("icons/info.png"));
1568
- objectPanel.setToolTipTextAt(2, "Information");
1587
+ objectPanel.setIconAt(3, GetIcon("icons/write.png"));
1588
+ objectPanel.setToolTipTextAt(3, "Edit controls");
15691589
15701590 objectPanel.add(XYZPanel);
1571
- objectPanel.setIconAt(3, GetIcon("icons/XYZ.png"));
1572
- objectPanel.setToolTipTextAt(3, "XYZ/RGB transform");
1591
+ objectPanel.setIconAt(4, GetIcon("icons/XYZ.png"));
1592
+ objectPanel.setToolTipTextAt(4, "XYZ/RGB transform");
15731593
1574
- objectPanel.add(toolboxPanel);
1575
- objectPanel.setIconAt(4, GetIcon("icons/primitives.png"));
1576
- objectPanel.setToolTipTextAt(4, "Objects & backgrounds");
1577
-
15781594 /*
15791595 aConstraints.gridx = 0;
15801596 aConstraints.gridwidth = 1;
....@@ -1611,6 +1627,11 @@
16111627
16121628 scenePanel.add(tabbedPane);
16131629
1630
+ //if (Globals.ADVANCED)
1631
+ tabbedPane.add(infoPanel);
1632
+ tabbedPane.setIconAt(3, GetIcon("icons/info.png"));
1633
+ tabbedPane.setToolTipTextAt(3, "Information");
1634
+
16141635 /*
16151636 cTree jTree = new cTree(null);
16161637 ToolTipManager.sharedInstance().registerComponent(jTree);
....@@ -1738,46 +1759,374 @@
17381759 void SetupMaterial(cGridBag materialpanel)
17391760 {
17401761 cGridBag presetpanel = new cGridBag().setVertical(true);
1741
- cLabel label = GetLabel("icons/shadericons/shadericon00000.png", !Grafreed.NIMBUSLAF);
1742
- label.addMouseListener(new MouseAdapter()
1762
+
1763
+ cLabel skin = GetLabel("icons/shadericons/shadericon00000.png", !Grafreed.NIMBUSLAF);
1764
+ skin.setToolTipText("Skin");
1765
+ skin.addMouseListener(new MouseAdapter()
17431766 {
17441767 public void mouseClicked(MouseEvent e)
17451768 {
1746
- colorField.setFloat(0);
1747
- saturationField.setFloat(1);
1769
+ Object3D object = Grafreed.materials.versionlist[0].get(0);
1770
+ cMaterial material = object.material;
1771
+
1772
+ // Skin
1773
+ colorField.setFloat(material.color);
1774
+ saturationField.setFloat(material.modulation);
1775
+ subsurfaceField.setFloat(material.subsurface);
1776
+ selfshadowField.setFloat(material.diffuseness);
1777
+ diffusenessField.setFloat(material.factor);
1778
+ shininessField.setFloat(material.shininess);
1779
+ shadowbiasField.setFloat(material.shadowbias);
1780
+ diffuseField.setFloat(material.diffuse);
1781
+ specularField.setFloat(material.specular);
1782
+
1783
+ bumpField.setFloat(object.projectedVertices[0].x / 1000.0);
1784
+ noiseField.setFloat(object.projectedVertices[0].y / 1000.0);
1785
+ powerField.setFloat(object.projectedVertices[2].x / 1000.0);
1786
+
17481787 materialtouched = true;
17491788 applySelf();
17501789 }
17511790 });
1752
- presetpanel.add(label);
1791
+ presetpanel.add(skin);
17531792
1754
- presetpanel.add(GetLabel("icons/shadericons/shadericon00001.png", !Grafreed.NIMBUSLAF));
1755
- presetpanel.add(GetLabel("icons/shadericons/shadericon00002.png", !Grafreed.NIMBUSLAF));
1756
- presetpanel.add(GetLabel("icons/shadericons/shadericon00003.png", !Grafreed.NIMBUSLAF));
1757
- presetpanel.add(GetLabel("icons/shadericons/shadericon00004.png", !Grafreed.NIMBUSLAF));
1758
- presetpanel.add(GetLabel("icons/shadericons/shadericon00005.png", !Grafreed.NIMBUSLAF));
1759
- presetpanel.add(GetLabel("icons/shadericons/shadericon00006.png", !Grafreed.NIMBUSLAF));
1760
- presetpanel.add(GetLabel("icons/shadericons/shadericon00007.png", !Grafreed.NIMBUSLAF));
1761
- presetpanel.add(GetLabel("icons/shadericons/shadericon00008.png", !Grafreed.NIMBUSLAF));
1762
- presetpanel.add(GetLabel("icons/shadericons/shadericon00009.png", !Grafreed.NIMBUSLAF));
1763
- presetpanel.add(GetLabel("icons/shadericons/shadericon00010.png", !Grafreed.NIMBUSLAF));
1764
- presetpanel.add(GetLabel("icons/shadericons/shadericon00011.png", !Grafreed.NIMBUSLAF));
1765
- presetpanel.add(GetLabel("icons/shadericons/shadericon00012.png", !Grafreed.NIMBUSLAF));
1766
- presetpanel.add(GetLabel("icons/shadericons/shadericon00013.png", !Grafreed.NIMBUSLAF));
1767
- presetpanel.add(GetLabel("icons/shadericons/shadericon00014.png", !Grafreed.NIMBUSLAF));
1768
- presetpanel.add(GetLabel("icons/shadericons/shadericon00015.png", !Grafreed.NIMBUSLAF));
1769
- presetpanel.add(GetLabel("icons/shadericons/shadericon00016.png", !Grafreed.NIMBUSLAF));
1770
- presetpanel.add(GetLabel("icons/shadericons/shadericon00017.png", !Grafreed.NIMBUSLAF));
1771
- presetpanel.add(GetLabel("icons/shadericons/shadericon00018.png", !Grafreed.NIMBUSLAF));
1772
- presetpanel.add(GetLabel("icons/shadericons/shadericon00019.png", !Grafreed.NIMBUSLAF));
1773
- presetpanel.add(GetLabel("icons/shadericons/shadericon00020.png", !Grafreed.NIMBUSLAF));
1793
+ cLabel lambert = GetLabel("icons/shadericons/shadericon00002.png", !Grafreed.NIMBUSLAF);
1794
+ lambert.setToolTipText("Diffuse");
1795
+ lambert.addMouseListener(new MouseAdapter()
1796
+ {
1797
+ public void mouseClicked(MouseEvent e)
1798
+ {
1799
+ Object3D object = Grafreed.materials.versionlist[2].get(0);
1800
+ cMaterial material = object.material;
1801
+
1802
+ diffusenessField.setFloat(material.factor);
1803
+ selfshadowField.setFloat(material.diffuseness);
1804
+
1805
+ materialtouched = true;
1806
+ applySelf();
1807
+ }
1808
+ });
1809
+ presetpanel.add(lambert);
1810
+
1811
+ cLabel diffuse2 = GetLabel("icons/shadericons/shadericon00003.png", !Grafreed.NIMBUSLAF);
1812
+ diffuse2.setToolTipText("Diffuse2");
1813
+ diffuse2.addMouseListener(new MouseAdapter()
1814
+ {
1815
+ public void mouseClicked(MouseEvent e)
1816
+ {
1817
+ Object3D object = Grafreed.materials.versionlist[3].get(0);
1818
+ cMaterial material = object.material;
1819
+
1820
+ diffusenessField.setFloat(material.factor);
1821
+ selfshadowField.setFloat(material.diffuseness);
1822
+
1823
+ materialtouched = true;
1824
+ applySelf();
1825
+ }
1826
+ });
1827
+ presetpanel.add(diffuse2);
1828
+
1829
+ cLabel diffusemoon = GetLabel("icons/shadericons/shadericon00004.png", !Grafreed.NIMBUSLAF);
1830
+ diffusemoon.setToolTipText("Moon");
1831
+ diffusemoon.addMouseListener(new MouseAdapter()
1832
+ {
1833
+ public void mouseClicked(MouseEvent e)
1834
+ {
1835
+ Object3D object = Grafreed.materials.versionlist[4].get(0);
1836
+ cMaterial material = object.material;
1837
+
1838
+ diffusenessField.setFloat(material.factor);
1839
+ selfshadowField.setFloat(material.diffuseness);
1840
+
1841
+ materialtouched = true;
1842
+ applySelf();
1843
+ }
1844
+ });
1845
+ presetpanel.add(diffusemoon);
1846
+
1847
+ cLabel diffusemoon2 = GetLabel("icons/shadericons/shadericon00005.png", !Grafreed.NIMBUSLAF);
1848
+ diffusemoon2.setToolTipText("Moon2");
1849
+ diffusemoon2.addMouseListener(new MouseAdapter()
1850
+ {
1851
+ public void mouseClicked(MouseEvent e)
1852
+ {
1853
+ Object3D object = Grafreed.materials.versionlist[5].get(0);
1854
+ cMaterial material = object.material;
1855
+
1856
+ diffusenessField.setFloat(material.factor);
1857
+ selfshadowField.setFloat(material.diffuseness);
1858
+
1859
+ materialtouched = true;
1860
+ applySelf();
1861
+ }
1862
+ });
1863
+ presetpanel.add(diffusemoon2);
1864
+
1865
+ cLabel diffusemoon3 = GetLabel("icons/shadericons/shadericon00006.png", !Grafreed.NIMBUSLAF);
1866
+ diffusemoon3.setToolTipText("Moon3");
1867
+ diffusemoon3.addMouseListener(new MouseAdapter()
1868
+ {
1869
+ public void mouseClicked(MouseEvent e)
1870
+ {
1871
+ Object3D object = Grafreed.materials.versionlist[6].get(0);
1872
+ cMaterial material = object.material;
1873
+
1874
+ diffusenessField.setFloat(material.factor);
1875
+ selfshadowField.setFloat(material.diffuseness);
1876
+
1877
+ materialtouched = true;
1878
+ applySelf();
1879
+ }
1880
+ });
1881
+ presetpanel.add(diffusemoon3);
1882
+
1883
+ cLabel diffusesheen = GetLabel("icons/shadericons/shadericon00007.png", !Grafreed.NIMBUSLAF);
1884
+ diffusesheen.setToolTipText("Sheen");
1885
+ diffusesheen.addMouseListener(new MouseAdapter()
1886
+ {
1887
+ public void mouseClicked(MouseEvent e)
1888
+ {
1889
+ Object3D object = Grafreed.materials.versionlist[7].get(0);
1890
+ cMaterial material = object.material;
1891
+
1892
+ sheenField.setFloat(material.sheen);
1893
+
1894
+ materialtouched = true;
1895
+ applySelf();
1896
+ }
1897
+ });
1898
+ presetpanel.add(diffusesheen);
1899
+
1900
+ cLabel rough = GetLabel("icons/shadericons/shadericon00001.png", !Grafreed.NIMBUSLAF);
1901
+ rough.setToolTipText("Rough metal");
1902
+ rough.addMouseListener(new MouseAdapter()
1903
+ {
1904
+ public void mouseClicked(MouseEvent e)
1905
+ {
1906
+ Object3D object = Grafreed.materials.versionlist[1].get(0);
1907
+ cMaterial material = object.material;
1908
+
1909
+ shininessField.setFloat(material.shininess);
1910
+ velvetField.setFloat(material.velvet);
1911
+
1912
+ materialtouched = true;
1913
+ applySelf();
1914
+ }
1915
+ });
1916
+ presetpanel.add(rough);
1917
+
1918
+ cLabel rough2 = GetLabel("icons/shadericons/shadericon00013.png", !Grafreed.NIMBUSLAF);
1919
+ rough2.setToolTipText("Medium metal");
1920
+ rough2.addMouseListener(new MouseAdapter()
1921
+ {
1922
+ public void mouseClicked(MouseEvent e)
1923
+ {
1924
+ Object3D object = Grafreed.materials.versionlist[13].get(0);
1925
+ cMaterial material = object.material;
1926
+
1927
+ shininessField.setFloat(material.shininess);
1928
+ lightareaField.setFloat(material.lightarea);
1929
+
1930
+ materialtouched = true;
1931
+ applySelf();
1932
+ }
1933
+ });
1934
+ presetpanel.add(rough2);
1935
+
1936
+ cLabel shini0 = GetLabel("icons/shadericons/shadericon00014.png", !Grafreed.NIMBUSLAF);
1937
+ shini0.setToolTipText("Shiny");
1938
+ shini0.addMouseListener(new MouseAdapter()
1939
+ {
1940
+ public void mouseClicked(MouseEvent e)
1941
+ {
1942
+ Object3D object = Grafreed.materials.versionlist[14].get(0);
1943
+ cMaterial material = object.material;
1944
+
1945
+ shininessField.setFloat(material.shininess);
1946
+ lightareaField.setFloat(material.lightarea);
1947
+
1948
+ materialtouched = true;
1949
+ applySelf();
1950
+ }
1951
+ });
1952
+ presetpanel.add(shini0);
1953
+
1954
+ cLabel shini1 = GetLabel("icons/shadericons/shadericon00011.png", !Grafreed.NIMBUSLAF);
1955
+ shini1.setToolTipText("Shiny2");
1956
+ shini1.addMouseListener(new MouseAdapter()
1957
+ {
1958
+ public void mouseClicked(MouseEvent e)
1959
+ {
1960
+ Object3D object = Grafreed.materials.versionlist[11].get(0);
1961
+ cMaterial material = object.material;
1962
+
1963
+ shininessField.setFloat(material.shininess);
1964
+ lightareaField.setFloat(material.lightarea);
1965
+
1966
+ materialtouched = true;
1967
+ applySelf();
1968
+ }
1969
+ });
1970
+ presetpanel.add(shini1);
1971
+
1972
+ cLabel shini2 = GetLabel("icons/shadericons/shadericon00012.png", !Grafreed.NIMBUSLAF);
1973
+ shini2.setToolTipText("Shiny3");
1974
+ shini2.addMouseListener(new MouseAdapter()
1975
+ {
1976
+ public void mouseClicked(MouseEvent e)
1977
+ {
1978
+ Object3D object = Grafreed.materials.versionlist[12].get(0);
1979
+ cMaterial material = object.material;
1980
+
1981
+ shininessField.setFloat(material.shininess);
1982
+ lightareaField.setFloat(material.lightarea);
1983
+
1984
+ materialtouched = true;
1985
+ applySelf();
1986
+ }
1987
+ });
1988
+ presetpanel.add(shini2);
1989
+
1990
+ cLabel aniso = GetLabel("icons/shadericons/shadericon00008.png", !Grafreed.NIMBUSLAF);
1991
+ aniso.setToolTipText("AnisoU");
1992
+ aniso.addMouseListener(new MouseAdapter()
1993
+ {
1994
+ public void mouseClicked(MouseEvent e)
1995
+ {
1996
+ Object3D object = Grafreed.materials.versionlist[8].get(0);
1997
+ cMaterial material = object.material;
1998
+
1999
+ anisoField.setFloat(material.aniso);
2000
+ anisoVField.setFloat(material.anisoV);
2001
+
2002
+ materialtouched = true;
2003
+ applySelf();
2004
+ }
2005
+ });
2006
+ presetpanel.add(aniso);
2007
+
2008
+ cLabel aniso2 = GetLabel("icons/shadericons/shadericon00009.png", !Grafreed.NIMBUSLAF);
2009
+ aniso2.setToolTipText("AnisoV");
2010
+ aniso2.addMouseListener(new MouseAdapter()
2011
+ {
2012
+ public void mouseClicked(MouseEvent e)
2013
+ {
2014
+ Object3D object = Grafreed.materials.versionlist[9].get(0);
2015
+ cMaterial material = object.material;
2016
+
2017
+ anisoField.setFloat(material.aniso);
2018
+ anisoVField.setFloat(material.anisoV);
2019
+
2020
+ materialtouched = true;
2021
+ applySelf();
2022
+ }
2023
+ });
2024
+ presetpanel.add(aniso2);
2025
+
2026
+ cLabel aniso3 = GetLabel("icons/shadericons/shadericon00010.png", !Grafreed.NIMBUSLAF);
2027
+ aniso3.setToolTipText("AnisoUV");
2028
+ aniso3.addMouseListener(new MouseAdapter()
2029
+ {
2030
+ public void mouseClicked(MouseEvent e)
2031
+ {
2032
+ Object3D object = Grafreed.materials.versionlist[10].get(0);
2033
+ cMaterial material = object.material;
2034
+
2035
+ anisoField.setFloat(material.aniso);
2036
+ anisoVField.setFloat(material.anisoV);
2037
+
2038
+ materialtouched = true;
2039
+ applySelf();
2040
+ }
2041
+ });
2042
+ presetpanel.add(aniso3);
2043
+
2044
+ cLabel velvet0 = GetLabel("icons/shadericons/shadericon00015.png", !Grafreed.NIMBUSLAF);
2045
+ velvet0.setToolTipText("Velvet");
2046
+ velvet0.addMouseListener(new MouseAdapter()
2047
+ {
2048
+ public void mouseClicked(MouseEvent e)
2049
+ {
2050
+ Object3D object = Grafreed.materials.versionlist[15].get(0);
2051
+ cMaterial material = object.material;
2052
+
2053
+ diffusenessField.setFloat(material.factor);
2054
+ selfshadowField.setFloat(material.diffuseness);
2055
+ sheenField.setFloat(material.sheen);
2056
+ shininessField.setFloat(material.shininess);
2057
+ velvetField.setFloat(material.velvet);
2058
+ shiftField.setFloat(material.shift);
2059
+
2060
+ materialtouched = true;
2061
+ applySelf();
2062
+ }
2063
+ });
2064
+ presetpanel.add(velvet0);
2065
+
2066
+ cLabel bump0 = GetLabel("icons/shadericons/shadericon00016.png", !Grafreed.NIMBUSLAF);
2067
+ bump0.setToolTipText("Bump texture");
2068
+ bump0.addMouseListener(new MouseAdapter()
2069
+ {
2070
+ public void mouseClicked(MouseEvent e)
2071
+ {
2072
+ Object3D object = Grafreed.materials.versionlist[16].get(0);
2073
+ cMaterial material = object.material;
2074
+
2075
+ bumpField.setFloat(object.projectedVertices[0].x / 1000.0);
2076
+ noiseField.setFloat(object.projectedVertices[0].y / 1000.0);
2077
+ powerField.setFloat(object.projectedVertices[2].x / 1000.0);
2078
+
2079
+ materialtouched = true;
2080
+ applySelf();
2081
+ }
2082
+ });
2083
+ presetpanel.add(bump0);
2084
+
2085
+ cLabel halo = GetLabel("icons/shadericons/shadericon00017.png", !Grafreed.NIMBUSLAF);
2086
+ halo.setToolTipText("Halo");
2087
+ halo.addMouseListener(new MouseAdapter()
2088
+ {
2089
+ public void mouseClicked(MouseEvent e)
2090
+ {
2091
+ Object3D object = Grafreed.materials.versionlist[17].get(0);
2092
+ cMaterial material = object.material;
2093
+
2094
+ opacityPowerField.setFloat(object.projectedVertices[2].y / 1000.0);
2095
+
2096
+ materialtouched = true;
2097
+ applySelf();
2098
+ }
2099
+ });
2100
+ presetpanel.add(halo);
2101
+
2102
+ cLabel candle = GetLabel("icons/shadericons/shadericon00018.png", !Grafreed.NIMBUSLAF);
2103
+ candle.setToolTipText("Candle");
2104
+ candle.addMouseListener(new MouseAdapter()
2105
+ {
2106
+ public void mouseClicked(MouseEvent e)
2107
+ {
2108
+ Object3D object = Grafreed.materials.versionlist[18].get(0);
2109
+ cMaterial material = object.material;
2110
+
2111
+ subsurfaceField.setFloat(material.subsurface);
2112
+ shadowbiasField.setFloat(material.shadowbias);
2113
+ ambientField.setFloat(material.ambient);
2114
+ specularField.setFloat(material.specular);
2115
+ lightareaField.setFloat(material.lightarea);
2116
+ shininessField.setFloat(material.shininess);
2117
+
2118
+ materialtouched = true;
2119
+ applySelf();
2120
+ }
2121
+ });
2122
+ presetpanel.add(candle);
17742123
17752124 cGridBag panel = new cGridBag().setVertical(true);
17762125
17772126 presetpanel.preferredWidth = 1;
17782127
1779
- materialpanel.add(panel);
17802128 materialpanel.add(presetpanel);
2129
+ materialpanel.add(panel);
17812130
17822131 panel.preferredWidth = 8;
17832132
....@@ -1821,9 +2170,9 @@
18212170
18222171 cGridBag huepanel = new cGridBag();
18232172 cGridBag huelabel = new cGridBag();
1824
- label = GetLabel("icons/hue.png", false);
1825
- label.fit = true;
1826
- huelabel.add(label);
2173
+ skin = GetLabel("icons/hue.png", false);
2174
+ skin.fit = true;
2175
+ huelabel.add(skin);
18272176 huelabel.preferredWidth = 20;
18282177 huepanel.add(new cGridBag()); // Label
18292178 huepanel.add(huelabel); // Field/slider
....@@ -3244,6 +3593,17 @@
32443593 public void itemStateChanged(ItemEvent event)
32453594 {
32463595 // System.out.println("Propagate = " + propagate);
3596
+ if (event.getSource() == pinButton)
3597
+ {
3598
+ copy.pinned ^= true;
3599
+ if (!copy.pinned && !copy.editWindow.copy.selection.contains(copy))
3600
+ {
3601
+ ((GroupEditor)copy.editWindow).listUI.remove(copy);
3602
+ copy.CloseUI();
3603
+ //copy.editWindow.refreshContents();
3604
+ }
3605
+ }
3606
+ else
32473607 if (event.getSource() == propagateToggle)
32483608 {
32493609 propagate ^= true;
....@@ -3737,14 +4097,26 @@
37374097
37384098 java.util.Hashtable<java.util.UUID, Object3D> versiontable = new java.util.Hashtable<java.util.UUID, Object3D>();
37394099
4100
+ void DeleteVersion()
4101
+ {
4102
+ for (int i = copy.versionindex; i < copy.versionlist.length-1; i++)
4103
+ {
4104
+ copy.versionlist[i] = copy.versionlist[i+1];
4105
+ }
4106
+
4107
+ CopyChanged();
4108
+
4109
+ SetUndoStates();
4110
+ }
4111
+
37404112 public boolean Save(boolean user)
37414113 {
37424114 System.err.println("Save");
3743
- Replace();
4115
+ //Replace();
37444116
37454117 cRadio tab = GetCurrentTab();
37464118
3747
- Object3D compress = CompressCopy(); // Saved version. No need for "Replace".
4119
+ Object3D compress = CompressCopy(); // Saved version. No need for "Replace"?
37484120
37494121 boolean thesame = false;
37504122
....@@ -3756,6 +4128,11 @@
37564128 //EditorFrame.m_MainFrame.requestFocusInWindow();
37574129 if (!thesame)
37584130 {
4131
+ for (int i = copy.versionlist.length; --i > copy.versionindex+1;)
4132
+ {
4133
+ copy.versionlist[i] = copy.versionlist[i-1];
4134
+ }
4135
+
37594136 //tab.user[tab.versionindex] = user;
37604137 //boolean increment = true; // tab.graphs[tab.versionindex] == null;
37614138
....@@ -3769,11 +4146,11 @@
37694146
37704147 //assert(hashtable.isEmpty());
37714148
3772
- for (int i = copy.versionindex+1; i < copy.versionlist.length; i++)
3773
- {
3774
- //tab.user[i] = false;
3775
- copy.versionlist[i] = null;
3776
- }
4149
+// for (int i = copy.versionindex+1; i < copy.versionlist.length; i++)
4150
+// {
4151
+// //tab.user[i] = false;
4152
+// copy.versionlist[i] = null;
4153
+// }
37774154
37784155 SetUndoStates();
37794156
....@@ -3828,11 +4205,13 @@
38284205 GetTree().addSelectionPath(selection.elementAt(i).GetTreePath().GetTreePath());
38294206 flashIt = true;
38304207
3831
- refreshContents(false);
4208
+ //refreshContents(false);
38324209 }
38334210
3834
- void CopyChanged(Object3D obj)
4211
+ void CopyChanged()
38354212 {
4213
+ Object3D obj = copy.versionlist[copy.versionindex];
4214
+
38364215 SetUndoStates();
38374216
38384217 boolean temp = CameraPane.SWITCH;
....@@ -3875,13 +4254,15 @@
38754254 }
38764255 }
38774256
3878
- refreshContents();
4257
+ refreshContents(true);
38794258 }
38804259
3881
- cButton undoButton;
4260
+ cButton previousVersionButton;
38824261 cButton restoreButton;
38834262 cButton replaceButton;
3884
- cButton redoButton;
4263
+ cButton nextVersionButton;
4264
+ cButton saveVersionButton;
4265
+ cButton deleteVersionButton;
38854266
38864267 boolean muteSlider;
38874268
....@@ -3902,11 +4283,14 @@
39024283 {
39034284 cRadio tab = GetCurrentTab();
39044285
3905
- restoreButton.setEnabled(copy.versionindex != -1);
3906
- replaceButton.setEnabled(copy.versionindex != -1);
4286
+ restoreButton.setEnabled(true); // copy.versionindex != -1);
4287
+ replaceButton.setEnabled(true); // copy.versionindex != -1);
39074288
3908
- undoButton.setEnabled(copy.versionindex > 0);
3909
- redoButton.setEnabled(copy.versionlist[copy.versionindex + 1] != null);
4289
+ previousVersionButton.setEnabled(copy.versionindex > 0);
4290
+ nextVersionButton.setEnabled(copy.versionlist[copy.versionindex + 1] != null);
4291
+
4292
+ deleteVersionButton.setEnabled(//copy.versionindex > 0 &&
4293
+ copy.versionlist[copy.versionindex + 1] != null);
39104294
39114295 muteSlider = true;
39124296 versionSlider.setMaximum(VersionCount() - 1);
....@@ -3914,7 +4298,7 @@
39144298 muteSlider = false;
39154299 }
39164300
3917
- public boolean Undo()
4301
+ public boolean PreviousVersion()
39184302 {
39194303 // Option?
39204304 Replace();
....@@ -3944,7 +4328,7 @@
39444328
39454329 copy.versionindex -= 1;
39464330
3947
- CopyChanged((Object3D)copy.versionlist[copy.versionindex]);
4331
+ CopyChanged();
39484332
39494333 return true;
39504334 }
....@@ -3962,7 +4346,7 @@
39624346 }
39634347
39644348 //CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex]));
3965
- CopyChanged(copy.versionlist[copy.versionindex]);
4349
+ CopyChanged();
39664350
39674351 return true;
39684352 }
....@@ -3984,7 +4368,7 @@
39844368 return true;
39854369 }
39864370
3987
- public void Redo()
4371
+ public void NextVersion()
39884372 {
39894373 // Option?
39904374 Replace();
....@@ -3999,7 +4383,7 @@
39994383
40004384 copy.versionindex += 1;
40014385
4002
- CopyChanged(copy.versionlist[copy.versionindex]);
4386
+ CopyChanged();
40034387
40044388 //if (!tab.user[tab.versionindex])
40054389 // tab.graphs[tab.versionindex] = null;
....@@ -4312,7 +4696,8 @@
43124696
43134697 if (copy.versionlist[version] != null)
43144698 {
4315
- CopyChanged(copy.versionlist[copy.versionindex = version]);
4699
+ copy.versionindex = version;
4700
+ CopyChanged();
43164701 }
43174702
43184703 return;
....@@ -4666,6 +5051,9 @@
46665051 ctrlPanel.validate(); // ? new
46675052 ctrlPanel.repaint();
46685053 }
5054
+
5055
+ if (previousVersionButton != null && copy.versionlist != null)
5056
+ SetUndoStates();
46695057 }
46705058
46715059 static TweenManager tweenManager = new TweenManager();
....@@ -5070,7 +5458,7 @@
50705458 {
50715459 if (Grafreed.standAlone)
50725460 {
5073
- FileDialog browser = new FileDialog(frame, "Load", FileDialog.LOAD);
5461
+ FileDialog browser = new FileDialog(frame, "Open", FileDialog.LOAD);
50745462 browser.show();
50755463 String filename = browser.getFile();
50765464 if (filename != null && filename.length() > 0)
....@@ -5389,6 +5777,7 @@
53895777 ButtonGroup buttonGroup;
53905778
53915779 cGridBag toolboxPanel;
5780
+ cGridBag skyboxPanel;
53925781 cGridBag materialPanel;
53935782 cGridBag ctrlPanel;
53945783