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
....@@ -41,64 +42,78 @@
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 {
47
- try
48
- {
49
- ImageIcon icon = GetIcon(name);
50
- return new cButton(icon, border);
51
- }
52
- catch (Exception e)
53
- {
54
- return new cButton(name, border);
55
- }
56
+ ImageIcon icon = GetIcon(name);
57
+ 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);
5664 }
5765
5866 cToggleButton GetToggleButton(String name, boolean border)
5967 {
60
- try
61
- {
62
- ImageIcon icon = GetIcon(name);
63
- return new cToggleButton(icon, border);
64
- }
65
- catch (Exception e)
66
- {
67
- return new cToggleButton(name, border);
68
- }
68
+ ImageIcon icon = GetIcon(name);
69
+ return new cToggleButton(icon, border);
6970 }
7071
7172 cCheckBox GetCheckBox(String name, boolean border)
7273 {
74
+ ImageIcon icon = GetIcon(name);
75
+ return new cCheckBox(icon, border);
76
+ }
77
+
78
+ ImageIcon GetIcon(String name)
79
+ {
7380 try
7481 {
75
- ImageIcon icon = GetIcon(name);
76
- return new cCheckBox(icon, border);
82
+ BufferedImage image = javax.imageio.ImageIO.read(getClass().getClassLoader().getResourceAsStream(name));
83
+
84
+// if (image.getWidth() > 48 && image.getHeight() > 48)
85
+// {
86
+// BufferedImage resized = new BufferedImage(48, 48, image.getType());
87
+// Graphics2D g = resized.createGraphics();
88
+// g.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR);
89
+// //g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
90
+// g.drawImage(image, 0, 0, 48, 48, 0, 0, image.getWidth(), image.getHeight(), null);
91
+// g.dispose();
92
+//
93
+// image = resized;
94
+// }
95
+
96
+ javax.swing.ImageIcon icon = new javax.swing.ImageIcon(image);
97
+ return icon;
7798 }
7899 catch (Exception e)
79100 {
80
- return new cCheckBox(name, border);
101
+ return null;
81102 }
82103 }
83
-
84
- private ImageIcon GetIcon(String name) throws IOException
104
+
105
+ BufferedImage GetImage(String name)
85106 {
86
- BufferedImage image = javax.imageio.ImageIO.read(getClass().getClassLoader().getResourceAsStream(name));
87
-
88
- if (image.getWidth() != 24 && image.getHeight() != 24)
107
+ try
89108 {
90
- BufferedImage resized = new BufferedImage(24, 24, image.getType());
91
- Graphics2D g = resized.createGraphics();
92
- g.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR);
93
- //g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
94
- g.drawImage(image, 0, 0, 24, 24, 0, 0, image.getWidth(), image.getHeight(), null);
95
- g.dispose();
96
-
97
- image = resized;
109
+ BufferedImage image = javax.imageio.ImageIO.read(getClass().getClassLoader().getResourceAsStream(name));
110
+
111
+ return image;
98112 }
99
-
100
- javax.swing.ImageIcon icon = new javax.swing.ImageIcon(image);
101
- return icon;
113
+ catch (Exception e)
114
+ {
115
+ return null;
116
+ }
102117 }
103118
104119 // SCRIPT
....@@ -282,6 +297,12 @@
282297 client = inClient;
283298 copy = client;
284299
300
+ if (copy.versionlist == null)
301
+ {
302
+ copy.versionlist = new Object3D[100];
303
+ copy.versionindex = -1;
304
+ }
305
+
285306 // "this" is not called: SetupUI2(objEditor);
286307 }
287308
....@@ -295,6 +316,12 @@
295316 client = inClient;
296317 copy = client;
297318
319
+ if (copy.versionlist == null)
320
+ {
321
+ copy.versionlist = new Object3D[100];
322
+ copy.versionindex = -1;
323
+ }
324
+
298325 SetupUI2(callee.GetEditor());
299326 }
300327
....@@ -327,6 +354,12 @@
327354 copy = localCopy;
328355 copy.editWindow = this;
329356
357
+ if (copy.versionlist == null)
358
+ {
359
+// copy.versions = new byte[100][];
360
+// copy.versionindex = -1;
361
+ }
362
+
330363 SetupMenu();
331364
332365 //SetupName(objEditor); // new
....@@ -419,11 +452,12 @@
419452
420453 toolbarPanel = new JPanel();
421454 toolbarPanel.setName("Toolbar");
455
+
422456 treePanel = new cGridBag();
423457 treePanel.setName("Tree");
424458
425459 editPanel = new cGridBag().setVertical(true);
426
- editPanel.setName("Edit");
460
+ //editPanel.setName("Edit");
427461
428462 ctrlPanel = new cGridBag().setVertical(false); // new GridBagLayout());
429463
....@@ -431,11 +465,13 @@
431465 editPanel.add(editCommandsPanel);
432466 editPanel.add(ctrlPanel);
433467
434
- toolboxPanel = new cGridBag().setVertical(false);
435
- toolboxPanel.setName("Toolbox");
468
+ toolboxPanel = new cGridBag().setVertical(true);
469
+ //toolboxPanel.setName("Toolbox");
436470
437
- materialPanel = new cGridBag().setVertical(true);
438
- materialPanel.setName("Material");
471
+ skyboxPanel = new cGridBag().setVertical(true);
472
+
473
+ materialPanel = new cGridBag().setVertical(false);
474
+ //materialPanel.setName("Material");
439475
440476 /*JTextPane*/
441477 infoarea = createTextPane();
....@@ -443,6 +479,7 @@
443479
444480 infoarea.setEditable(true);
445481 SetText();
482
+
446483 // infoarea.setFont(infoarea.getFont().deriveFont(10, 14f));
447484 // infoarea.setOpaque(false);
448485 // //infoarea.setForeground(textcolor);
....@@ -450,7 +487,7 @@
450487 // TEXTAREA infoarea.setWrapStyleWord(true);
451488 infoPanel = new JScrollPane(infoarea, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); //AS_NEEDED);
452489 infoPanel.setPreferredSize(new Dimension(1, 1));
453
- infoPanel.setName("Info");
490
+ //infoPanel.setName("Info");
454491 //infoPanel.setLayout(new BorderLayout());
455492 //infoPanel.add(createTextPane());
456493
....@@ -814,9 +851,11 @@
814851 //frame.setVisible(true);
815852 }
816853 frame.validate();
854
+
855
+ cameraView.requestFocusInWindow();
817856 }
818857
819
- private byte[] CompressCopy()
858
+ private Object3D CompressCopy()
820859 {
821860 boolean temp = CameraPane.SWITCH;
822861 CameraPane.SWITCH = false;
....@@ -824,12 +863,13 @@
824863 copy.ExtractBigData(versiontable);
825864 // if (copy == client)
826865
827
- byte[] versions[] = copy.versions;
828
- copy.versions = null;
866
+ Object3D versions[] = copy.versionlist;
867
+ copy.versionlist = null;
829868
830
- byte[] compress = Compress(copy);
869
+ //byte[] compress = Compress(copy);
870
+ Object3D compress = (Object3D)Grafreed.clone(copy);
831871
832
- copy.versions = versions;
872
+ copy.versionlist = versions;
833873
834874 copy.RestoreBigData(versiontable);
835875
....@@ -959,6 +999,7 @@
959999 {
9601000 SetupMaterial(materialPanel);
9611001 }
1002
+
9621003 //SetupName();
9631004 //SetupViews();
9641005 }
....@@ -968,7 +1009,7 @@
9681009 // NumberSlider vDivsField;
9691010 // JCheckBox endcaps;
9701011 JCheckBox liveCB;
971
- JCheckBox selectCB;
1012
+ JCheckBox selectableCB;
9721013 JCheckBox hideCB;
9731014 JCheckBox link2masterCB;
9741015 JCheckBox markCB;
....@@ -1167,6 +1208,18 @@
11671208
11681209 namePanel = new cGridBag();
11691210
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
+
11701223 nameField = AddText(namePanel, copy.GetName());
11711224 namePanel.add(new JScrollPane(nameField, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER));
11721225 oe.ctrlPanel.add(namePanel);
....@@ -1180,13 +1233,16 @@
11801233
11811234 liveCB = AddCheckBox(setupPanel, "Live", copy.live);
11821235 liveCB.setToolTipText("Animate object");
1183
- selectCB = AddCheckBox(setupPanel, "Select", !copy.dontselect);
1184
- selectCB.setToolTipText("Make object selectable");
1236
+ selectableCB = AddCheckBox(setupPanel, "Select", !copy.dontselect);
1237
+ selectableCB.setToolTipText("Make object selectable");
11851238 // Return();
1239
+
11861240 hideCB = AddCheckBox(setupPanel, "Hide", copy.hide);
11871241 hideCB.setToolTipText("Hide object");
11881242 markCB = AddCheckBox(setupPanel, "Mark", copy.marked);
11891243 markCB.setToolTipText("As animation target transform");
1244
+
1245
+ ToolTipManager.sharedInstance().setLightWeightPopupEnabled(false);
11901246
11911247 setupPanel2 = new cGridBag().setVertical(false);
11921248
....@@ -1474,6 +1530,7 @@
14741530 XYZPanel.addComponent(/*BorderLayout.SOUTH,*/sideView); // Scroll);
14751531 XYZPanel.addComponent(/*BorderLayout.CENTER,*/frontView); // Scroll);
14761532 XYZPanel.addComponent(/*BorderLayout.NORTH,*/topView); // Scroll);
1533
+ //XYZPanel.setName("XYZ");
14771534
14781535 /*
14791536 gridPanel = new JPanel(); //new BorderLayout());
....@@ -1511,17 +1568,29 @@
15111568 //JScrollPane tmp = new JScrollPane(ctrlPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
15121569 //tmp.setName("Edit");
15131570 objectPanel.add(materialPanel);
1571
+ objectPanel.setIconAt(0, GetIcon("icons/material.png"));
1572
+ objectPanel.setToolTipTextAt(0, "Material");
1573
+
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
+
15141582 // JPanel north = new JPanel(new BorderLayout());
15151583 // north.setName("Edit");
15161584 // north.add(ctrlPanel, BorderLayout.NORTH);
15171585 // objectPanel.add(north);
15181586 objectPanel.add(editPanel);
1587
+ objectPanel.setIconAt(3, GetIcon("icons/write.png"));
1588
+ objectPanel.setToolTipTextAt(3, "Edit controls");
15191589
1520
- //if (Globals.ADVANCED)
1521
- objectPanel.add(infoPanel);
1590
+ objectPanel.add(XYZPanel);
1591
+ objectPanel.setIconAt(4, GetIcon("icons/XYZ.png"));
1592
+ objectPanel.setToolTipTextAt(4, "XYZ/RGB transform");
15221593
1523
- objectPanel.add(toolboxPanel);
1524
-
15251594 /*
15261595 aConstraints.gridx = 0;
15271596 aConstraints.gridwidth = 1;
....@@ -1541,7 +1610,7 @@
15411610 scrollpane.addMouseWheelListener(this); // Default not fast enough
15421611
15431612 /*JTabbedPane*/ scenePanel = new cGridBag();
1544
- scenePanel.preferredWidth = 6;
1613
+ scenePanel.preferredWidth = 5;
15451614
15461615 JTabbedPane tabbedPane = new JTabbedPane();
15471616 tabbedPane.add(scrollpane);
....@@ -1558,6 +1627,11 @@
15581627
15591628 scenePanel.add(tabbedPane);
15601629
1630
+ //if (Globals.ADVANCED)
1631
+ tabbedPane.add(infoPanel);
1632
+ tabbedPane.setIconAt(3, GetIcon("icons/info.png"));
1633
+ tabbedPane.setToolTipTextAt(3, "Information");
1634
+
15611635 /*
15621636 cTree jTree = new cTree(null);
15631637 ToolTipManager.sharedInstance().registerComponent(jTree);
....@@ -1619,7 +1693,7 @@
16191693 bigThree = new cGridBag();
16201694 bigThree.addComponent(scenePanel);
16211695 bigThree.addComponent(centralPanel);
1622
- bigThree.addComponent(XYZPanel);
1696
+ //bigThree.addComponent(XYZPanel);
16231697
16241698 // // SIDE EFFECT!!!
16251699 // aConstraints.gridx = 0;
....@@ -1660,7 +1734,6 @@
16601734 frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
16611735 frame.addWindowListener(new WindowAdapter()
16621736 {
1663
-
16641737 public void windowClosing(WindowEvent e)
16651738 {
16661739 Close();
....@@ -1683,12 +1756,384 @@
16831756 ctrlPanel.removeAll();
16841757 }
16851758
1686
- void SetupMaterial(cGridBag panel)
1759
+ void SetupMaterial(cGridBag materialpanel)
16871760 {
1688
- /*
1761
+ cGridBag presetpanel = new cGridBag().setVertical(true);
1762
+
1763
+ cLabel skin = GetLabel("icons/shadericons/shadericon00000.png", !Grafreed.NIMBUSLAF);
1764
+ skin.setToolTipText("Skin");
1765
+ skin.addMouseListener(new MouseAdapter()
1766
+ {
1767
+ public void mouseClicked(MouseEvent e)
1768
+ {
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
+
1787
+ materialtouched = true;
1788
+ applySelf();
1789
+ }
1790
+ });
1791
+ presetpanel.add(skin);
1792
+
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);
2123
+
2124
+ cGridBag panel = new cGridBag().setVertical(true);
2125
+
2126
+ presetpanel.preferredWidth = 1;
2127
+
2128
+ materialpanel.add(presetpanel);
2129
+ materialpanel.add(panel);
2130
+
2131
+ panel.preferredWidth = 8;
2132
+
2133
+ /*
16892134 ctrlPanel.add(materialLabel = new JLabel("MATERIAL : "), aConstraints);
16902135 materialLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1691
- */
2136
+ */
16922137
16932138 cGridBag editBar = new cGridBag().setVertical(false);
16942139
....@@ -1722,27 +2167,50 @@
17222167 //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
17232168
17242169 cGridBag colorSection = new cGridBag().setVertical(true);
2170
+
2171
+ cGridBag huepanel = new cGridBag();
2172
+ cGridBag huelabel = new cGridBag();
2173
+ skin = GetLabel("icons/hue.png", false);
2174
+ skin.fit = true;
2175
+ huelabel.add(skin);
2176
+ huelabel.preferredWidth = 20;
2177
+ huepanel.add(new cGridBag()); // Label
2178
+ huepanel.add(huelabel); // Field/slider
2179
+
2180
+ huepanel.preferredHeight = 7;
2181
+
2182
+ colorSection.add(huepanel);
17252183
17262184 cGridBag color = new cGridBag();
1727
- color.add(colorLabel = new JLabel("Color/hue")); // , aConstraints);
1728
- colorLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1729
- color.add(colorField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
2185
+
2186
+ color.add(colorLabel = new JLabel("Color/hue")); // , aConstraints);
2187
+ colorLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2188
+ color.add(colorField = new cNumberSlider(this, 0.001, 1)); // , aConstraints);
2189
+
17302190 //colorField.preferredWidth = 200;
17312191 colorSection.add(color);
17322192
17332193 cGridBag modulation = new cGridBag();
17342194 modulation.add(modulationLabel = new JLabel("Saturation")); // , aConstraints);
17352195 modulationLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1736
- modulation.add(modulationField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
2196
+ modulation.add(saturationField = new cNumberSlider(this, 0.001, 1)); // , aConstraints);
17372197 colorSection.add(modulation);
17382198
2199
+ cGridBag opacity = new cGridBag();
2200
+ opacity.add(opacityLabel = new JLabel("Opacity")); // , aConstraints);
2201
+ opacityLabel.setHorizontalAlignment(SwingConstants.TRAILING);
2202
+ opacity.add(opacityField = new cNumberSlider(this, 0.001, 1)); // , aConstraints);
2203
+ colorSection.add(opacity);
2204
+
2205
+ colorSection.add(GetSeparator());
2206
+
17392207 cGridBag texture = new cGridBag();
17402208 texture.add(textureLabel = new JLabel("Texture")); // , aConstraints);
17412209 textureLabel.setHorizontalAlignment(SwingConstants.TRAILING);
17422210 texture.add(textureField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
17432211 colorSection.add(texture);
17442212
1745
- panel.add(new JSeparator());
2213
+ panel.add(GetSeparator());
17462214
17472215 panel.add(colorSection);
17482216
....@@ -1798,7 +2266,7 @@
17982266 shadowbias.add(shadowbiasField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
17992267 diffuseSection.add(shadowbias);
18002268
1801
- panel.add(new JSeparator());
2269
+ panel.add(GetSeparator());
18022270
18032271 panel.add(diffuseSection);
18042272
....@@ -1861,7 +2329,7 @@
18612329 specularSection.add(anisoV);
18622330
18632331
1864
- panel.add(new JSeparator());
2332
+ panel.add(GetSeparator());
18652333
18662334 panel.add(specularSection);
18672335
....@@ -1886,12 +2354,6 @@
18862354 backlitLabel.setHorizontalAlignment(SwingConstants.TRAILING);
18872355 backlit.add(backlitField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
18882356 colorSection.add(backlit);
1889
-
1890
- cGridBag opacity = new cGridBag();
1891
- opacity.add(opacityLabel = new JLabel("Opacity")); // , aConstraints);
1892
- opacityLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1893
- opacity.add(opacityField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1894
- colorSection.add(opacity);
18952357
18962358 //panel.add(new JSeparator());
18972359
....@@ -1937,7 +2399,7 @@
19372399 opacityPower.add(opacityPowerField = new cNumberSlider(this, 0.0, 10 /*10 dec 2013*/)); // , aConstraints);
19382400 textureSection.add(opacityPower);
19392401
1940
- panel.add(new JSeparator());
2402
+ panel.add(GetSeparator());
19412403
19422404 panel.add(textureSection);
19432405
....@@ -2924,7 +3386,7 @@
29243386
29253387 freezematerial = true;
29263388 colorField.setFloat(mat.color);
2927
- modulationField.setFloat(mat.modulation);
3389
+ saturationField.setFloat(mat.modulation);
29283390 metalnessField.setFloat(mat.metalness);
29293391 diffuseField.setFloat(mat.diffuse);
29303392 specularField.setFloat(mat.specular);
....@@ -3131,6 +3593,17 @@
31313593 public void itemStateChanged(ItemEvent event)
31323594 {
31333595 // 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
31343607 if (event.getSource() == propagateToggle)
31353608 {
31363609 propagate ^= true;
....@@ -3235,8 +3708,9 @@
32353708 } else if (event.getSource() == liveCB)
32363709 {
32373710 copy.live ^= true;
3711
+ objEditor.refreshContents(true); // To show item colors
32383712 return;
3239
- } else if (event.getSource() == selectCB)
3713
+ } else if (event.getSource() == selectableCB)
32403714 {
32413715 copy.dontselect ^= true;
32423716 return;
....@@ -3244,7 +3718,7 @@
32443718 {
32453719 copy.hide ^= true;
32463720 copy.Touch(); // display list issue
3247
- objEditor.refreshContents();
3721
+ objEditor.refreshContents(true); // To show item colors
32483722 return;
32493723 } else if (event.getSource() == link2masterCB)
32503724 {
....@@ -3500,6 +3974,7 @@
35003974
35013975 static public byte[] Compress(Object3D o)
35023976 {
3977
+ // Slower to actually compress.
35033978 try
35043979 {
35053980 ByteArrayOutputStream baos = new ByteArrayOutputStream();
....@@ -3601,6 +4076,7 @@
36014076 {
36024077 //Save(true);
36034078 Replace();
4079
+ SetUndoStates();
36044080 }
36054081
36064082 private boolean Equal(byte[] compress, byte[] name)
....@@ -3621,29 +4097,46 @@
36214097
36224098 java.util.Hashtable<java.util.UUID, Object3D> versiontable = new java.util.Hashtable<java.util.UUID, Object3D>();
36234099
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
+
36244112 public boolean Save(boolean user)
36254113 {
36264114 System.err.println("Save");
4115
+ //Replace();
36274116
36284117 cRadio tab = GetCurrentTab();
36294118
3630
- byte[] compress = CompressCopy();
4119
+ Object3D compress = CompressCopy(); // Saved version. No need for "Replace"?
36314120
36324121 boolean thesame = false;
36334122
3634
- // Quick heuristic using length. Works only when stream is compressed.
3635
- if (copy.versionindex > 0 && copy.versions[copy.versionindex-1] != null && Equal(compress, copy.versions[copy.versionindex-1]))
3636
- {
3637
- thesame = true;
3638
- }
4123
+// if (copy.versionindex > 0 && copy.versions[copy.versionindex-1] != null && Equal(compress, copy.versions[copy.versionindex-1]))
4124
+// {
4125
+// thesame = true;
4126
+// }
36394127
36404128 //EditorFrame.m_MainFrame.requestFocusInWindow();
36414129 if (!thesame)
36424130 {
4131
+ for (int i = copy.versionlist.length; --i > copy.versionindex+1;)
4132
+ {
4133
+ copy.versionlist[i] = copy.versionlist[i-1];
4134
+ }
4135
+
36434136 //tab.user[tab.versionindex] = user;
36444137 //boolean increment = true; // tab.graphs[tab.versionindex] == null;
36454138
3646
- copy.versions[++copy.versionindex] = compress;
4139
+ copy.versionlist[++copy.versionindex] = compress;
36474140
36484141 // if (increment)
36494142 // tab.versionindex++;
....@@ -3653,11 +4146,11 @@
36534146
36544147 //assert(hashtable.isEmpty());
36554148
3656
- for (int i = copy.versionindex+1; i < copy.versions.length; i++)
3657
- {
3658
- //tab.user[i] = false;
3659
- copy.versions[i] = null;
3660
- }
4149
+// for (int i = copy.versionindex+1; i < copy.versionlist.length; i++)
4150
+// {
4151
+// //tab.user[i] = false;
4152
+// copy.versionlist[i] = null;
4153
+// }
36614154
36624155 SetUndoStates();
36634156
....@@ -3682,9 +4175,43 @@
36824175
36834176 return !thesame;
36844177 }
3685
-
3686
- void CopyChanged(Object3D obj)
4178
+
4179
+ boolean flashIt = true;
4180
+
4181
+ void RefreshSelection()
36874182 {
4183
+ Object3D selection = new Object3D();
4184
+
4185
+ for (int i = 0; i < copy.selection.size(); i++)
4186
+ {
4187
+ Object3D elem = copy.selection.elementAt(i);
4188
+
4189
+ Object3D obj = copy.GetObject(elem.GetUUID());
4190
+
4191
+ if (obj == null)
4192
+ {
4193
+ copy.selection.remove(i--);
4194
+ }
4195
+ else
4196
+ {
4197
+ selection.add(obj);
4198
+ copy.selection.setElementAt(obj, i);
4199
+ }
4200
+ }
4201
+
4202
+ flashIt = false;
4203
+ GetTree().clearSelection();
4204
+ for (int i = 0; i < selection.size(); i++)
4205
+ GetTree().addSelectionPath(selection.elementAt(i).GetTreePath().GetTreePath());
4206
+ flashIt = true;
4207
+
4208
+ //refreshContents(false);
4209
+ }
4210
+
4211
+ void CopyChanged()
4212
+ {
4213
+ Object3D obj = copy.versionlist[copy.versionindex];
4214
+
36884215 SetUndoStates();
36894216
36904217 boolean temp = CameraPane.SWITCH;
....@@ -3694,6 +4221,9 @@
36944221
36954222 copy.clear();
36964223
4224
+ copy.skyboxname = obj.skyboxname;
4225
+ copy.skyboxext = obj.skyboxext;
4226
+
36974227 for (int i=0; i<obj.Size(); i++)
36984228 {
36994229 copy.add(obj.get(i));
....@@ -3703,6 +4233,7 @@
37034233
37044234 CameraPane.SWITCH = temp;
37054235
4236
+ RefreshSelection();
37064237 //assert(hashtable.isEmpty());
37074238
37084239 copy.Touch();
....@@ -3723,26 +4254,55 @@
37234254 }
37244255 }
37254256
3726
- refreshContents();
4257
+ refreshContents(true);
37274258 }
37284259
3729
- cButton undoButton;
4260
+ cButton previousVersionButton;
37304261 cButton restoreButton;
37314262 cButton replaceButton;
3732
- cButton redoButton;
4263
+ cButton nextVersionButton;
4264
+ cButton saveVersionButton;
4265
+ cButton deleteVersionButton;
37334266
4267
+ boolean muteSlider;
4268
+
4269
+ int VersionCount()
4270
+ {
4271
+ int count = 0;
4272
+
4273
+ for (int i = copy.versionlist.length; --i >= 0;)
4274
+ {
4275
+ if (copy.versionlist[i] != null)
4276
+ count++;
4277
+ }
4278
+
4279
+ return count;
4280
+ }
4281
+
37344282 void SetUndoStates()
37354283 {
37364284 cRadio tab = GetCurrentTab();
37374285
3738
- restoreButton.setEnabled(copy.versionindex != -1);
3739
- replaceButton.setEnabled(copy.versionindex != -1);
3740
- undoButton.setEnabled(copy.versionindex > 0);
3741
- redoButton.setEnabled(copy.versions[copy.versionindex + 1] != null);
4286
+ restoreButton.setEnabled(true); // copy.versionindex != -1);
4287
+ replaceButton.setEnabled(true); // copy.versionindex != -1);
4288
+
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);
4294
+
4295
+ muteSlider = true;
4296
+ versionSlider.setMaximum(VersionCount() - 1);
4297
+ versionSlider.setInteger(copy.versionindex);
4298
+ muteSlider = false;
37424299 }
37434300
3744
- public boolean Undo()
4301
+ public boolean PreviousVersion()
37454302 {
4303
+ // Option?
4304
+ Replace();
4305
+
37464306 System.err.println("Undo");
37474307
37484308 cRadio tab = GetCurrentTab();
....@@ -3768,7 +4328,7 @@
37684328
37694329 copy.versionindex -= 1;
37704330
3771
- CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex]));
4331
+ CopyChanged();
37724332
37734333 return true;
37744334 }
....@@ -3779,13 +4339,14 @@
37794339
37804340 cRadio tab = GetCurrentTab();
37814341
3782
- if (copy.versionindex == -1 || copy.versions[copy.versionindex] == null)
4342
+ if (copy.versionindex == -1 || copy.versionlist[copy.versionindex] == null)
37834343 {
37844344 java.awt.Toolkit.getDefaultToolkit().beep();
37854345 return false;
37864346 }
37874347
3788
- CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex]));
4348
+ //CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex]));
4349
+ CopyChanged();
37894350
37904351 return true;
37914352 }
....@@ -3796,22 +4357,25 @@
37964357
37974358 cRadio tab = GetCurrentTab();
37984359
3799
- if (copy.versionindex == -1 || copy.versions[copy.versionindex] == null)
4360
+ if (copy.versionindex == -1 || copy.versionlist[copy.versionindex] == null)
38004361 {
38014362 // No version yet. OK. java.awt.Toolkit.getDefaultToolkit().beep();
38024363 return false;
38034364 }
38044365
3805
- copy.versions[copy.versionindex] = CompressCopy();
4366
+ copy.versionlist[copy.versionindex] = CompressCopy();
38064367
38074368 return true;
38084369 }
38094370
3810
- public void Redo()
4371
+ public void NextVersion()
38114372 {
4373
+ // Option?
4374
+ Replace();
4375
+
38124376 cRadio tab = GetCurrentTab();
38134377
3814
- if (copy.versions[copy.versionindex + 1] == null)
4378
+ if (copy.versionlist[copy.versionindex + 1] == null)
38154379 {
38164380 java.awt.Toolkit.getDefaultToolkit().beep();
38174381 return;
....@@ -3819,7 +4383,7 @@
38194383
38204384 copy.versionindex += 1;
38214385
3822
- CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex]));
4386
+ CopyChanged();
38234387
38244388 //if (!tab.user[tab.versionindex])
38254389 // tab.graphs[tab.versionindex] = null;
....@@ -4033,7 +4597,7 @@
40334597 //copy.material = new cMaterial(copy.GetMaterial());
40344598
40354599 current.color = (float) colorField.getFloat();
4036
- current.modulation = (float) modulationField.getFloat();
4600
+ current.modulation = (float) saturationField.getFloat();
40374601 current.metalness = (float) metalnessField.getFloat();
40384602 current.diffuse = (float) diffuseField.getFloat();
40394603 current.specular = (float) specularField.getFloat();
....@@ -4066,7 +4630,7 @@
40664630 cMaterial mat = copy.material;
40674631
40684632 colorField.SetToolTipValue((mat.color));
4069
- modulationField.SetToolTipValue((mat.modulation));
4633
+ saturationField.SetToolTipValue((mat.modulation));
40704634 metalnessField.SetToolTipValue((mat.metalness));
40714635 diffuseField.SetToolTipValue((mat.diffuse));
40724636 specularField.SetToolTipValue((mat.specular));
....@@ -4118,18 +4682,22 @@
41184682 //copy.Touch();
41194683 }
41204684
4121
- cNumberSlider versionField;
4685
+ cNumberSlider versionSlider;
41224686
41234687 public void stateChanged(ChangeEvent e)
41244688 {
41254689 // assert(false);
4126
- if (e.getSource() == versionField)
4690
+ if (e.getSource() == versionSlider)
41274691 {
4128
- int version = versionField.getInteger();
4692
+ if (muteSlider)
4693
+ return;
41294694
4130
- if (copy.versions[version] != null)
4695
+ int version = versionSlider.getInteger();
4696
+
4697
+ if (copy.versionlist[version] != null)
41314698 {
4132
- CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex = version]));
4699
+ copy.versionindex = version;
4700
+ CopyChanged();
41334701 }
41344702
41354703 return;
....@@ -4169,6 +4737,12 @@
41694737 {
41704738 //System.out.println("stateChanged = " + this);
41714739 materialtouched = true;
4740
+
4741
+ if (e.getSource() == colorField && saturationField.getFloat() == 0.001)
4742
+ {
4743
+ saturationField.setFloat(1);
4744
+ }
4745
+
41724746 applySelf();
41734747 //System.out.println("this = " + this);
41744748 //System.out.println("PARENT = " + parent);
....@@ -4468,6 +5042,7 @@
44685042 {
44695043 if (GetTree() != null)
44705044 {
5045
+ GetTree().revalidate();
44715046 GetTree().repaint();
44725047 }
44735048
....@@ -4476,6 +5051,9 @@
44765051 ctrlPanel.validate(); // ? new
44775052 ctrlPanel.repaint();
44785053 }
5054
+
5055
+ if (previousVersionButton != null && copy.versionlist != null)
5056
+ SetUndoStates();
44795057 }
44805058
44815059 static TweenManager tweenManager = new TweenManager();
....@@ -4724,7 +5302,9 @@
47245302 readobj.ResetDisplayList();
47255303 } catch (Exception e)
47265304 {
4727
- //e.printStackTrace();
5305
+ if (!e.toString().contains("GZIP"))
5306
+ e.printStackTrace();
5307
+
47285308 try
47295309 {
47305310 java.io.FileInputStream istream = new java.io.FileInputStream(fullname);
....@@ -4804,6 +5384,8 @@
48045384 {
48055385 //readobj.deepCopySelf(copy);
48065386 copy.clear(); // june 2014
5387
+ copy.skyboxname = readobj.skyboxname;
5388
+ copy.skyboxext = readobj.skyboxext;
48075389 for (int i = 0; i < readobj.size(); i++)
48085390 {
48095391 Object3D child = readobj.get(i); // reserve(i);
....@@ -4844,6 +5426,7 @@
48445426 }
48455427 } catch (ClassCastException e)
48465428 {
5429
+ e.printStackTrace();
48475430 assert (false);
48485431 Composite c = (Composite) copy;
48495432 c.children.clear();
....@@ -4854,10 +5437,16 @@
48545437 c.addChild(csg);
48555438 }
48565439
4857
- copy.versions = readobj.versions;
5440
+ copy.versionlist = readobj.versionlist;
48585441 copy.versionindex = readobj.versionindex;
48595442
4860
- SetUndoStates();
5443
+ if (copy.versionlist == null)
5444
+ {
5445
+ copy.versionlist = new Object3D[100];
5446
+ copy.versionindex = -1;
5447
+ }
5448
+
5449
+ //? SetUndoStates();
48615450
48625451 ResetModel();
48635452 copy.HardTouch(); // recompile?
....@@ -4869,7 +5458,7 @@
48695458 {
48705459 if (Grafreed.standAlone)
48715460 {
4872
- FileDialog browser = new FileDialog(frame, "Load", FileDialog.LOAD);
5461
+ FileDialog browser = new FileDialog(frame, "Open", FileDialog.LOAD);
48735462 browser.show();
48745463 String filename = browser.getFile();
48755464 if (filename != null && filename.length() > 0)
....@@ -4968,6 +5557,7 @@
49685557 //ps.print(buffer.toString());
49695558 } catch (IOException e)
49705559 {
5560
+ e.printStackTrace();
49715561 }
49725562 }
49735563
....@@ -5187,6 +5777,7 @@
51875777 ButtonGroup buttonGroup;
51885778
51895779 cGridBag toolboxPanel;
5780
+ cGridBag skyboxPanel;
51905781 cGridBag materialPanel;
51915782 cGridBag ctrlPanel;
51925783
....@@ -5260,7 +5851,7 @@
52605851 JLabel colorLabel;
52615852 cNumberSlider colorField;
52625853 JLabel modulationLabel;
5263
- cNumberSlider modulationField;
5854
+ cNumberSlider saturationField;
52645855 JLabel metalnessLabel;
52655856 cNumberSlider metalnessField;
52665857 JLabel diffuseLabel;