Normand Briere
2019-08-04 0c85af6e46f48b7425d59fc776b193c06a4a1f52
ObjEditor.java
....@@ -41,11 +41,25 @@
4141 JFrame frame;
4242
4343 static ObjEditor theFrame;
44
+
45
+ public cGridBag GetSeparator()
46
+ {
47
+ cGridBag separator = new cGridBag();
48
+ separator.add(new JSeparator());
49
+ separator.preferredHeight = 5;
50
+ return separator;
51
+ }
4452
4553 cButton GetButton(String name, boolean border)
4654 {
4755 ImageIcon icon = GetIcon(name);
4856 return new cButton(icon, border);
57
+ }
58
+
59
+ cLabel GetLabel(String name, boolean border)
60
+ {
61
+ //ImageIcon icon = GetIcon(name);
62
+ return new cLabel(GetImage(name), border);
4963 }
5064
5165 cToggleButton GetToggleButton(String name, boolean border)
....@@ -60,26 +74,40 @@
6074 return new cCheckBox(icon, border);
6175 }
6276
63
- private ImageIcon GetIcon(String name)
77
+ ImageIcon GetIcon(String name)
6478 {
6579 try
6680 {
6781 BufferedImage image = javax.imageio.ImageIO.read(getClass().getClassLoader().getResourceAsStream(name));
6882
69
- if (image.getWidth() != 24 && image.getHeight() != 24)
70
- {
71
- BufferedImage resized = new BufferedImage(24, 24, image.getType());
72
- Graphics2D g = resized.createGraphics();
73
- g.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR);
74
- //g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
75
- g.drawImage(image, 0, 0, 24, 24, 0, 0, image.getWidth(), image.getHeight(), null);
76
- g.dispose();
77
-
78
- image = resized;
79
- }
83
+// if (image.getWidth() > 48 && image.getHeight() > 48)
84
+// {
85
+// BufferedImage resized = new BufferedImage(48, 48, image.getType());
86
+// Graphics2D g = resized.createGraphics();
87
+// g.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR);
88
+// //g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
89
+// g.drawImage(image, 0, 0, 48, 48, 0, 0, image.getWidth(), image.getHeight(), null);
90
+// g.dispose();
91
+//
92
+// image = resized;
93
+// }
8094
8195 javax.swing.ImageIcon icon = new javax.swing.ImageIcon(image);
8296 return icon;
97
+ }
98
+ catch (Exception e)
99
+ {
100
+ return null;
101
+ }
102
+ }
103
+
104
+ BufferedImage GetImage(String name)
105
+ {
106
+ try
107
+ {
108
+ BufferedImage image = javax.imageio.ImageIO.read(getClass().getClassLoader().getResourceAsStream(name));
109
+
110
+ return image;
83111 }
84112 catch (Exception e)
85113 {
....@@ -268,9 +296,9 @@
268296 client = inClient;
269297 copy = client;
270298
271
- if (copy.versions == null)
299
+ if (copy.versionlist == null)
272300 {
273
- copy.versions = new byte[100][];
301
+ copy.versionlist = new Object3D[100];
274302 copy.versionindex = -1;
275303 }
276304
....@@ -287,9 +315,9 @@
287315 client = inClient;
288316 copy = client;
289317
290
- if (copy.versions == null)
318
+ if (copy.versionlist == null)
291319 {
292
- copy.versions = new byte[100][];
320
+ copy.versionlist = new Object3D[100];
293321 copy.versionindex = -1;
294322 }
295323
....@@ -325,10 +353,10 @@
325353 copy = localCopy;
326354 copy.editWindow = this;
327355
328
- if (copy.versions == null)
356
+ if (copy.versionlist == null)
329357 {
330
- copy.versions = new byte[100][];
331
- copy.versionindex = -1;
358
+// copy.versions = new byte[100][];
359
+// copy.versionindex = -1;
332360 }
333361
334362 SetupMenu();
....@@ -436,10 +464,10 @@
436464 editPanel.add(editCommandsPanel);
437465 editPanel.add(ctrlPanel);
438466
439
- toolboxPanel = new cGridBag().setVertical(false);
467
+ toolboxPanel = new cGridBag().setVertical(true);
440468 //toolboxPanel.setName("Toolbox");
441469
442
- materialPanel = new cGridBag().setVertical(true);
470
+ materialPanel = new cGridBag().setVertical(false);
443471 //materialPanel.setName("Material");
444472
445473 /*JTextPane*/
....@@ -822,7 +850,7 @@
822850 frame.validate();
823851 }
824852
825
- private byte[] CompressCopy()
853
+ private Object3D CompressCopy()
826854 {
827855 boolean temp = CameraPane.SWITCH;
828856 CameraPane.SWITCH = false;
....@@ -830,12 +858,13 @@
830858 copy.ExtractBigData(versiontable);
831859 // if (copy == client)
832860
833
- byte[] versions[] = copy.versions;
834
- copy.versions = null;
861
+ Object3D versions[] = copy.versionlist;
862
+ copy.versionlist = null;
835863
836
- byte[] compress = Compress(copy);
864
+ //byte[] compress = Compress(copy);
865
+ Object3D compress = (Object3D)Grafreed.clone(copy);
837866
838
- copy.versions = versions;
867
+ copy.versionlist = versions;
839868
840869 copy.RestoreBigData(versiontable);
841870
....@@ -965,6 +994,7 @@
965994 {
966995 SetupMaterial(materialPanel);
967996 }
997
+
968998 //SetupName();
969999 //SetupViews();
9701000 }
....@@ -974,7 +1004,7 @@
9741004 // NumberSlider vDivsField;
9751005 // JCheckBox endcaps;
9761006 JCheckBox liveCB;
977
- JCheckBox selectCB;
1007
+ JCheckBox selectableCB;
9781008 JCheckBox hideCB;
9791009 JCheckBox link2masterCB;
9801010 JCheckBox markCB;
....@@ -1186,13 +1216,16 @@
11861216
11871217 liveCB = AddCheckBox(setupPanel, "Live", copy.live);
11881218 liveCB.setToolTipText("Animate object");
1189
- selectCB = AddCheckBox(setupPanel, "Select", !copy.dontselect);
1190
- selectCB.setToolTipText("Make object selectable");
1219
+ selectableCB = AddCheckBox(setupPanel, "Select", !copy.dontselect);
1220
+ selectableCB.setToolTipText("Make object selectable");
11911221 // Return();
1222
+
11921223 hideCB = AddCheckBox(setupPanel, "Hide", copy.hide);
11931224 hideCB.setToolTipText("Hide object");
11941225 markCB = AddCheckBox(setupPanel, "Mark", copy.marked);
11951226 markCB.setToolTipText("As animation target transform");
1227
+
1228
+ ToolTipManager.sharedInstance().setLightWeightPopupEnabled(false);
11961229
11971230 setupPanel2 = new cGridBag().setVertical(false);
11981231
....@@ -1519,22 +1552,28 @@
15191552 //tmp.setName("Edit");
15201553 objectPanel.add(materialPanel);
15211554 objectPanel.setIconAt(0, GetIcon("icons/material.png"));
1555
+ objectPanel.setToolTipTextAt(0, "Material");
1556
+
15221557 // JPanel north = new JPanel(new BorderLayout());
15231558 // north.setName("Edit");
15241559 // north.add(ctrlPanel, BorderLayout.NORTH);
15251560 // objectPanel.add(north);
15261561 objectPanel.add(editPanel);
15271562 objectPanel.setIconAt(1, GetIcon("icons/write.png"));
1563
+ objectPanel.setToolTipTextAt(1, "Edit controls");
15281564
15291565 //if (Globals.ADVANCED)
15301566 objectPanel.add(infoPanel);
15311567 objectPanel.setIconAt(2, GetIcon("icons/info.png"));
1568
+ objectPanel.setToolTipTextAt(2, "Information");
15321569
15331570 objectPanel.add(XYZPanel);
15341571 objectPanel.setIconAt(3, GetIcon("icons/XYZ.png"));
1572
+ objectPanel.setToolTipTextAt(3, "XYZ/RGB transform");
15351573
15361574 objectPanel.add(toolboxPanel);
15371575 objectPanel.setIconAt(4, GetIcon("icons/primitives.png"));
1576
+ objectPanel.setToolTipTextAt(4, "Objects & backgrounds");
15381577
15391578 /*
15401579 aConstraints.gridx = 0;
....@@ -1674,7 +1713,6 @@
16741713 frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
16751714 frame.addWindowListener(new WindowAdapter()
16761715 {
1677
-
16781716 public void windowClosing(WindowEvent e)
16791717 {
16801718 Close();
....@@ -1697,12 +1735,56 @@
16971735 ctrlPanel.removeAll();
16981736 }
16991737
1700
- void SetupMaterial(cGridBag panel)
1738
+ void SetupMaterial(cGridBag materialpanel)
17011739 {
1702
- /*
1740
+ cGridBag presetpanel = new cGridBag().setVertical(true);
1741
+ cLabel label = GetLabel("icons/shadericons/shadericon00000.png", !Grafreed.NIMBUSLAF);
1742
+ label.addMouseListener(new MouseAdapter()
1743
+ {
1744
+ public void mouseClicked(MouseEvent e)
1745
+ {
1746
+ colorField.setFloat(0);
1747
+ saturationField.setFloat(1);
1748
+ materialtouched = true;
1749
+ applySelf();
1750
+ }
1751
+ });
1752
+ presetpanel.add(label);
1753
+
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));
1774
+
1775
+ cGridBag panel = new cGridBag().setVertical(true);
1776
+
1777
+ presetpanel.preferredWidth = 1;
1778
+
1779
+ materialpanel.add(panel);
1780
+ materialpanel.add(presetpanel);
1781
+
1782
+ panel.preferredWidth = 8;
1783
+
1784
+ /*
17031785 ctrlPanel.add(materialLabel = new JLabel("MATERIAL : "), aConstraints);
17041786 materialLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1705
- */
1787
+ */
17061788
17071789 cGridBag editBar = new cGridBag().setVertical(false);
17081790
....@@ -1736,27 +1818,50 @@
17361818 //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
17371819
17381820 cGridBag colorSection = new cGridBag().setVertical(true);
1821
+
1822
+ cGridBag huepanel = new cGridBag();
1823
+ cGridBag huelabel = new cGridBag();
1824
+ label = GetLabel("icons/hue.png", false);
1825
+ label.fit = true;
1826
+ huelabel.add(label);
1827
+ huelabel.preferredWidth = 20;
1828
+ huepanel.add(new cGridBag()); // Label
1829
+ huepanel.add(huelabel); // Field/slider
1830
+
1831
+ huepanel.preferredHeight = 7;
1832
+
1833
+ colorSection.add(huepanel);
17391834
17401835 cGridBag color = new cGridBag();
1741
- color.add(colorLabel = new JLabel("Color/hue")); // , aConstraints);
1742
- colorLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1743
- color.add(colorField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1836
+
1837
+ color.add(colorLabel = new JLabel("Color/hue")); // , aConstraints);
1838
+ colorLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1839
+ color.add(colorField = new cNumberSlider(this, 0.001, 1)); // , aConstraints);
1840
+
17441841 //colorField.preferredWidth = 200;
17451842 colorSection.add(color);
17461843
17471844 cGridBag modulation = new cGridBag();
17481845 modulation.add(modulationLabel = new JLabel("Saturation")); // , aConstraints);
17491846 modulationLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1750
- modulation.add(modulationField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1847
+ modulation.add(saturationField = new cNumberSlider(this, 0.001, 1)); // , aConstraints);
17511848 colorSection.add(modulation);
17521849
1850
+ cGridBag opacity = new cGridBag();
1851
+ opacity.add(opacityLabel = new JLabel("Opacity")); // , aConstraints);
1852
+ opacityLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1853
+ opacity.add(opacityField = new cNumberSlider(this, 0.001, 1)); // , aConstraints);
1854
+ colorSection.add(opacity);
1855
+
1856
+ colorSection.add(GetSeparator());
1857
+
17531858 cGridBag texture = new cGridBag();
17541859 texture.add(textureLabel = new JLabel("Texture")); // , aConstraints);
17551860 textureLabel.setHorizontalAlignment(SwingConstants.TRAILING);
17561861 texture.add(textureField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
17571862 colorSection.add(texture);
17581863
1759
- panel.add(new JSeparator());
1864
+ panel.add(GetSeparator());
17601865
17611866 panel.add(colorSection);
17621867
....@@ -1812,7 +1917,7 @@
18121917 shadowbias.add(shadowbiasField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
18131918 diffuseSection.add(shadowbias);
18141919
1815
- panel.add(new JSeparator());
1920
+ panel.add(GetSeparator());
18161921
18171922 panel.add(diffuseSection);
18181923
....@@ -1875,7 +1980,7 @@
18751980 specularSection.add(anisoV);
18761981
18771982
1878
- panel.add(new JSeparator());
1983
+ panel.add(GetSeparator());
18791984
18801985 panel.add(specularSection);
18811986
....@@ -1900,12 +2005,6 @@
19002005 backlitLabel.setHorizontalAlignment(SwingConstants.TRAILING);
19012006 backlit.add(backlitField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
19022007 colorSection.add(backlit);
1903
-
1904
- cGridBag opacity = new cGridBag();
1905
- opacity.add(opacityLabel = new JLabel("Opacity")); // , aConstraints);
1906
- opacityLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1907
- opacity.add(opacityField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1908
- colorSection.add(opacity);
19092008
19102009 //panel.add(new JSeparator());
19112010
....@@ -1951,7 +2050,7 @@
19512050 opacityPower.add(opacityPowerField = new cNumberSlider(this, 0.0, 10 /*10 dec 2013*/)); // , aConstraints);
19522051 textureSection.add(opacityPower);
19532052
1954
- panel.add(new JSeparator());
2053
+ panel.add(GetSeparator());
19552054
19562055 panel.add(textureSection);
19572056
....@@ -2938,7 +3037,7 @@
29383037
29393038 freezematerial = true;
29403039 colorField.setFloat(mat.color);
2941
- modulationField.setFloat(mat.modulation);
3040
+ saturationField.setFloat(mat.modulation);
29423041 metalnessField.setFloat(mat.metalness);
29433042 diffuseField.setFloat(mat.diffuse);
29443043 specularField.setFloat(mat.specular);
....@@ -3249,8 +3348,9 @@
32493348 } else if (event.getSource() == liveCB)
32503349 {
32513350 copy.live ^= true;
3351
+ objEditor.refreshContents(true); // To show item colors
32523352 return;
3253
- } else if (event.getSource() == selectCB)
3353
+ } else if (event.getSource() == selectableCB)
32543354 {
32553355 copy.dontselect ^= true;
32563356 return;
....@@ -3258,7 +3358,7 @@
32583358 {
32593359 copy.hide ^= true;
32603360 copy.Touch(); // display list issue
3261
- objEditor.refreshContents();
3361
+ objEditor.refreshContents(true); // To show item colors
32623362 return;
32633363 } else if (event.getSource() == link2masterCB)
32643364 {
....@@ -3514,6 +3614,7 @@
35143614
35153615 static public byte[] Compress(Object3D o)
35163616 {
3617
+ // Slower to actually compress.
35173618 try
35183619 {
35193620 ByteArrayOutputStream baos = new ByteArrayOutputStream();
....@@ -3615,6 +3716,7 @@
36153716 {
36163717 //Save(true);
36173718 Replace();
3719
+ SetUndoStates();
36183720 }
36193721
36203722 private boolean Equal(byte[] compress, byte[] name)
....@@ -3638,18 +3740,18 @@
36383740 public boolean Save(boolean user)
36393741 {
36403742 System.err.println("Save");
3743
+ Replace();
36413744
36423745 cRadio tab = GetCurrentTab();
36433746
3644
- byte[] compress = CompressCopy();
3747
+ Object3D compress = CompressCopy(); // Saved version. No need for "Replace".
36453748
36463749 boolean thesame = false;
36473750
3648
- // Quick heuristic using length. Works only when stream is compressed.
3649
- if (copy.versionindex > 0 && copy.versions[copy.versionindex-1] != null && Equal(compress, copy.versions[copy.versionindex-1]))
3650
- {
3651
- thesame = true;
3652
- }
3751
+// if (copy.versionindex > 0 && copy.versions[copy.versionindex-1] != null && Equal(compress, copy.versions[copy.versionindex-1]))
3752
+// {
3753
+// thesame = true;
3754
+// }
36533755
36543756 //EditorFrame.m_MainFrame.requestFocusInWindow();
36553757 if (!thesame)
....@@ -3657,7 +3759,7 @@
36573759 //tab.user[tab.versionindex] = user;
36583760 //boolean increment = true; // tab.graphs[tab.versionindex] == null;
36593761
3660
- copy.versions[++copy.versionindex] = compress;
3762
+ copy.versionlist[++copy.versionindex] = compress;
36613763
36623764 // if (increment)
36633765 // tab.versionindex++;
....@@ -3667,10 +3769,10 @@
36673769
36683770 //assert(hashtable.isEmpty());
36693771
3670
- for (int i = copy.versionindex+1; i < copy.versions.length; i++)
3772
+ for (int i = copy.versionindex+1; i < copy.versionlist.length; i++)
36713773 {
36723774 //tab.user[i] = false;
3673
- copy.versions[i] = null;
3775
+ copy.versionlist[i] = null;
36743776 }
36753777
36763778 SetUndoStates();
....@@ -3696,6 +3798,38 @@
36963798
36973799 return !thesame;
36983800 }
3801
+
3802
+ boolean flashIt = true;
3803
+
3804
+ void RefreshSelection()
3805
+ {
3806
+ Object3D selection = new Object3D();
3807
+
3808
+ for (int i = 0; i < copy.selection.size(); i++)
3809
+ {
3810
+ Object3D elem = copy.selection.elementAt(i);
3811
+
3812
+ Object3D obj = copy.GetObject(elem.GetUUID());
3813
+
3814
+ if (obj == null)
3815
+ {
3816
+ copy.selection.remove(i--);
3817
+ }
3818
+ else
3819
+ {
3820
+ selection.add(obj);
3821
+ copy.selection.setElementAt(obj, i);
3822
+ }
3823
+ }
3824
+
3825
+ flashIt = false;
3826
+ GetTree().clearSelection();
3827
+ for (int i = 0; i < selection.size(); i++)
3828
+ GetTree().addSelectionPath(selection.elementAt(i).GetTreePath().GetTreePath());
3829
+ flashIt = true;
3830
+
3831
+ refreshContents(false);
3832
+ }
36993833
37003834 void CopyChanged(Object3D obj)
37013835 {
....@@ -3708,6 +3842,9 @@
37083842
37093843 copy.clear();
37103844
3845
+ copy.skyboxname = obj.skyboxname;
3846
+ copy.skyboxext = obj.skyboxext;
3847
+
37113848 for (int i=0; i<obj.Size(); i++)
37123849 {
37133850 copy.add(obj.get(i));
....@@ -3717,6 +3854,7 @@
37173854
37183855 CameraPane.SWITCH = temp;
37193856
3857
+ RefreshSelection();
37203858 //assert(hashtable.isEmpty());
37213859
37223860 copy.Touch();
....@@ -3751,9 +3889,9 @@
37513889 {
37523890 int count = 0;
37533891
3754
- for (int i = copy.versions.length; --i >= 0;)
3892
+ for (int i = copy.versionlist.length; --i >= 0;)
37553893 {
3756
- if (copy.versions[i] != null)
3894
+ if (copy.versionlist[i] != null)
37573895 count++;
37583896 }
37593897
....@@ -3768,7 +3906,7 @@
37683906 replaceButton.setEnabled(copy.versionindex != -1);
37693907
37703908 undoButton.setEnabled(copy.versionindex > 0);
3771
- redoButton.setEnabled(copy.versions[copy.versionindex + 1] != null);
3909
+ redoButton.setEnabled(copy.versionlist[copy.versionindex + 1] != null);
37723910
37733911 muteSlider = true;
37743912 versionSlider.setMaximum(VersionCount() - 1);
....@@ -3806,7 +3944,7 @@
38063944
38073945 copy.versionindex -= 1;
38083946
3809
- CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex]));
3947
+ CopyChanged((Object3D)copy.versionlist[copy.versionindex]);
38103948
38113949 return true;
38123950 }
....@@ -3817,13 +3955,14 @@
38173955
38183956 cRadio tab = GetCurrentTab();
38193957
3820
- if (copy.versionindex == -1 || copy.versions[copy.versionindex] == null)
3958
+ if (copy.versionindex == -1 || copy.versionlist[copy.versionindex] == null)
38213959 {
38223960 java.awt.Toolkit.getDefaultToolkit().beep();
38233961 return false;
38243962 }
38253963
3826
- CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex]));
3964
+ //CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex]));
3965
+ CopyChanged(copy.versionlist[copy.versionindex]);
38273966
38283967 return true;
38293968 }
....@@ -3834,13 +3973,13 @@
38343973
38353974 cRadio tab = GetCurrentTab();
38363975
3837
- if (copy.versionindex == -1 || copy.versions[copy.versionindex] == null)
3976
+ if (copy.versionindex == -1 || copy.versionlist[copy.versionindex] == null)
38383977 {
38393978 // No version yet. OK. java.awt.Toolkit.getDefaultToolkit().beep();
38403979 return false;
38413980 }
38423981
3843
- copy.versions[copy.versionindex] = CompressCopy();
3982
+ copy.versionlist[copy.versionindex] = CompressCopy();
38443983
38453984 return true;
38463985 }
....@@ -3852,7 +3991,7 @@
38523991
38533992 cRadio tab = GetCurrentTab();
38543993
3855
- if (copy.versions[copy.versionindex + 1] == null)
3994
+ if (copy.versionlist[copy.versionindex + 1] == null)
38563995 {
38573996 java.awt.Toolkit.getDefaultToolkit().beep();
38583997 return;
....@@ -3860,7 +3999,7 @@
38603999
38614000 copy.versionindex += 1;
38624001
3863
- CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex]));
4002
+ CopyChanged(copy.versionlist[copy.versionindex]);
38644003
38654004 //if (!tab.user[tab.versionindex])
38664005 // tab.graphs[tab.versionindex] = null;
....@@ -4074,7 +4213,7 @@
40744213 //copy.material = new cMaterial(copy.GetMaterial());
40754214
40764215 current.color = (float) colorField.getFloat();
4077
- current.modulation = (float) modulationField.getFloat();
4216
+ current.modulation = (float) saturationField.getFloat();
40784217 current.metalness = (float) metalnessField.getFloat();
40794218 current.diffuse = (float) diffuseField.getFloat();
40804219 current.specular = (float) specularField.getFloat();
....@@ -4107,7 +4246,7 @@
41074246 cMaterial mat = copy.material;
41084247
41094248 colorField.SetToolTipValue((mat.color));
4110
- modulationField.SetToolTipValue((mat.modulation));
4249
+ saturationField.SetToolTipValue((mat.modulation));
41114250 metalnessField.SetToolTipValue((mat.metalness));
41124251 diffuseField.SetToolTipValue((mat.diffuse));
41134252 specularField.SetToolTipValue((mat.specular));
....@@ -4171,9 +4310,9 @@
41714310
41724311 int version = versionSlider.getInteger();
41734312
4174
- if (copy.versions[version] != null)
4313
+ if (copy.versionlist[version] != null)
41754314 {
4176
- CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex = version]));
4315
+ CopyChanged(copy.versionlist[copy.versionindex = version]);
41774316 }
41784317
41794318 return;
....@@ -4213,6 +4352,12 @@
42134352 {
42144353 //System.out.println("stateChanged = " + this);
42154354 materialtouched = true;
4355
+
4356
+ if (e.getSource() == colorField && saturationField.getFloat() == 0.001)
4357
+ {
4358
+ saturationField.setFloat(1);
4359
+ }
4360
+
42164361 applySelf();
42174362 //System.out.println("this = " + this);
42184363 //System.out.println("PARENT = " + parent);
....@@ -4512,6 +4657,7 @@
45124657 {
45134658 if (GetTree() != null)
45144659 {
4660
+ GetTree().revalidate();
45154661 GetTree().repaint();
45164662 }
45174663
....@@ -4768,7 +4914,9 @@
47684914 readobj.ResetDisplayList();
47694915 } catch (Exception e)
47704916 {
4771
- //e.printStackTrace();
4917
+ if (!e.toString().contains("GZIP"))
4918
+ e.printStackTrace();
4919
+
47724920 try
47734921 {
47744922 java.io.FileInputStream istream = new java.io.FileInputStream(fullname);
....@@ -4848,6 +4996,8 @@
48484996 {
48494997 //readobj.deepCopySelf(copy);
48504998 copy.clear(); // june 2014
4999
+ copy.skyboxname = readobj.skyboxname;
5000
+ copy.skyboxext = readobj.skyboxext;
48515001 for (int i = 0; i < readobj.size(); i++)
48525002 {
48535003 Object3D child = readobj.get(i); // reserve(i);
....@@ -4888,6 +5038,7 @@
48885038 }
48895039 } catch (ClassCastException e)
48905040 {
5041
+ e.printStackTrace();
48915042 assert (false);
48925043 Composite c = (Composite) copy;
48935044 c.children.clear();
....@@ -4898,12 +5049,12 @@
48985049 c.addChild(csg);
48995050 }
49005051
4901
- copy.versions = readobj.versions;
5052
+ copy.versionlist = readobj.versionlist;
49025053 copy.versionindex = readobj.versionindex;
49035054
4904
- if (copy.versions == null)
5055
+ if (copy.versionlist == null)
49055056 {
4906
- copy.versions = new byte[100][];
5057
+ copy.versionlist = new Object3D[100];
49075058 copy.versionindex = -1;
49085059 }
49095060
....@@ -5018,6 +5169,7 @@
50185169 //ps.print(buffer.toString());
50195170 } catch (IOException e)
50205171 {
5172
+ e.printStackTrace();
50215173 }
50225174 }
50235175
....@@ -5310,7 +5462,7 @@
53105462 JLabel colorLabel;
53115463 cNumberSlider colorField;
53125464 JLabel modulationLabel;
5313
- cNumberSlider modulationField;
5465
+ cNumberSlider saturationField;
53145466 JLabel metalnessLabel;
53155467 cNumberSlider metalnessField;
53165468 JLabel diffuseLabel;