Normand Briere
2019-08-04 0c85af6e46f48b7425d59fc776b193c06a4a1f52
ObjEditor.java
....@@ -41,64 +41,78 @@
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 {
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
- }
55
+ ImageIcon icon = GetIcon(name);
56
+ 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);
5663 }
5764
5865 cToggleButton GetToggleButton(String name, boolean border)
5966 {
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
- }
67
+ ImageIcon icon = GetIcon(name);
68
+ return new cToggleButton(icon, border);
6969 }
7070
7171 cCheckBox GetCheckBox(String name, boolean border)
7272 {
73
+ ImageIcon icon = GetIcon(name);
74
+ return new cCheckBox(icon, border);
75
+ }
76
+
77
+ ImageIcon GetIcon(String name)
78
+ {
7379 try
7480 {
75
- ImageIcon icon = GetIcon(name);
76
- return new cCheckBox(icon, border);
81
+ BufferedImage image = javax.imageio.ImageIO.read(getClass().getClassLoader().getResourceAsStream(name));
82
+
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
+// }
94
+
95
+ javax.swing.ImageIcon icon = new javax.swing.ImageIcon(image);
96
+ return icon;
7797 }
7898 catch (Exception e)
7999 {
80
- return new cCheckBox(name, border);
100
+ return null;
81101 }
82102 }
83
-
84
- private ImageIcon GetIcon(String name) throws IOException
103
+
104
+ BufferedImage GetImage(String name)
85105 {
86
- BufferedImage image = javax.imageio.ImageIO.read(getClass().getClassLoader().getResourceAsStream(name));
87
-
88
- if (image.getWidth() != 24 && image.getHeight() != 24)
106
+ try
89107 {
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;
108
+ BufferedImage image = javax.imageio.ImageIO.read(getClass().getClassLoader().getResourceAsStream(name));
109
+
110
+ return image;
98111 }
99
-
100
- javax.swing.ImageIcon icon = new javax.swing.ImageIcon(image);
101
- return icon;
112
+ catch (Exception e)
113
+ {
114
+ return null;
115
+ }
102116 }
103117
104118 // SCRIPT
....@@ -282,9 +296,9 @@
282296 client = inClient;
283297 copy = client;
284298
285
- if (copy.versions == null)
299
+ if (copy.versionlist == null)
286300 {
287
- copy.versions = new byte[100][];
301
+ copy.versionlist = new Object3D[100];
288302 copy.versionindex = -1;
289303 }
290304
....@@ -301,9 +315,9 @@
301315 client = inClient;
302316 copy = client;
303317
304
- if (copy.versions == null)
318
+ if (copy.versionlist == null)
305319 {
306
- copy.versions = new byte[100][];
320
+ copy.versionlist = new Object3D[100];
307321 copy.versionindex = -1;
308322 }
309323
....@@ -339,10 +353,10 @@
339353 copy = localCopy;
340354 copy.editWindow = this;
341355
342
- if (copy.versions == null)
356
+ if (copy.versionlist == null)
343357 {
344
- copy.versions = new byte[100][];
345
- copy.versionindex = -1;
358
+// copy.versions = new byte[100][];
359
+// copy.versionindex = -1;
346360 }
347361
348362 SetupMenu();
....@@ -437,11 +451,12 @@
437451
438452 toolbarPanel = new JPanel();
439453 toolbarPanel.setName("Toolbar");
454
+
440455 treePanel = new cGridBag();
441456 treePanel.setName("Tree");
442457
443458 editPanel = new cGridBag().setVertical(true);
444
- editPanel.setName("Edit");
459
+ //editPanel.setName("Edit");
445460
446461 ctrlPanel = new cGridBag().setVertical(false); // new GridBagLayout());
447462
....@@ -449,11 +464,11 @@
449464 editPanel.add(editCommandsPanel);
450465 editPanel.add(ctrlPanel);
451466
452
- toolboxPanel = new cGridBag().setVertical(false);
453
- toolboxPanel.setName("Toolbox");
467
+ toolboxPanel = new cGridBag().setVertical(true);
468
+ //toolboxPanel.setName("Toolbox");
454469
455
- materialPanel = new cGridBag().setVertical(true);
456
- materialPanel.setName("Material");
470
+ materialPanel = new cGridBag().setVertical(false);
471
+ //materialPanel.setName("Material");
457472
458473 /*JTextPane*/
459474 infoarea = createTextPane();
....@@ -461,6 +476,7 @@
461476
462477 infoarea.setEditable(true);
463478 SetText();
479
+
464480 // infoarea.setFont(infoarea.getFont().deriveFont(10, 14f));
465481 // infoarea.setOpaque(false);
466482 // //infoarea.setForeground(textcolor);
....@@ -468,7 +484,7 @@
468484 // TEXTAREA infoarea.setWrapStyleWord(true);
469485 infoPanel = new JScrollPane(infoarea, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); //AS_NEEDED);
470486 infoPanel.setPreferredSize(new Dimension(1, 1));
471
- infoPanel.setName("Info");
487
+ //infoPanel.setName("Info");
472488 //infoPanel.setLayout(new BorderLayout());
473489 //infoPanel.add(createTextPane());
474490
....@@ -834,7 +850,7 @@
834850 frame.validate();
835851 }
836852
837
- private byte[] CompressCopy()
853
+ private Object3D CompressCopy()
838854 {
839855 boolean temp = CameraPane.SWITCH;
840856 CameraPane.SWITCH = false;
....@@ -842,12 +858,13 @@
842858 copy.ExtractBigData(versiontable);
843859 // if (copy == client)
844860
845
- byte[] versions[] = copy.versions;
846
- copy.versions = null;
861
+ Object3D versions[] = copy.versionlist;
862
+ copy.versionlist = null;
847863
848
- byte[] compress = Compress(copy);
864
+ //byte[] compress = Compress(copy);
865
+ Object3D compress = (Object3D)Grafreed.clone(copy);
849866
850
- copy.versions = versions;
867
+ copy.versionlist = versions;
851868
852869 copy.RestoreBigData(versiontable);
853870
....@@ -977,6 +994,7 @@
977994 {
978995 SetupMaterial(materialPanel);
979996 }
997
+
980998 //SetupName();
981999 //SetupViews();
9821000 }
....@@ -986,7 +1004,7 @@
9861004 // NumberSlider vDivsField;
9871005 // JCheckBox endcaps;
9881006 JCheckBox liveCB;
989
- JCheckBox selectCB;
1007
+ JCheckBox selectableCB;
9901008 JCheckBox hideCB;
9911009 JCheckBox link2masterCB;
9921010 JCheckBox markCB;
....@@ -1198,13 +1216,16 @@
11981216
11991217 liveCB = AddCheckBox(setupPanel, "Live", copy.live);
12001218 liveCB.setToolTipText("Animate object");
1201
- selectCB = AddCheckBox(setupPanel, "Select", !copy.dontselect);
1202
- selectCB.setToolTipText("Make object selectable");
1219
+ selectableCB = AddCheckBox(setupPanel, "Select", !copy.dontselect);
1220
+ selectableCB.setToolTipText("Make object selectable");
12031221 // Return();
1222
+
12041223 hideCB = AddCheckBox(setupPanel, "Hide", copy.hide);
12051224 hideCB.setToolTipText("Hide object");
12061225 markCB = AddCheckBox(setupPanel, "Mark", copy.marked);
12071226 markCB.setToolTipText("As animation target transform");
1227
+
1228
+ ToolTipManager.sharedInstance().setLightWeightPopupEnabled(false);
12081229
12091230 setupPanel2 = new cGridBag().setVertical(false);
12101231
....@@ -1492,6 +1513,7 @@
14921513 XYZPanel.addComponent(/*BorderLayout.SOUTH,*/sideView); // Scroll);
14931514 XYZPanel.addComponent(/*BorderLayout.CENTER,*/frontView); // Scroll);
14941515 XYZPanel.addComponent(/*BorderLayout.NORTH,*/topView); // Scroll);
1516
+ //XYZPanel.setName("XYZ");
14951517
14961518 /*
14971519 gridPanel = new JPanel(); //new BorderLayout());
....@@ -1529,16 +1551,29 @@
15291551 //JScrollPane tmp = new JScrollPane(ctrlPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
15301552 //tmp.setName("Edit");
15311553 objectPanel.add(materialPanel);
1554
+ objectPanel.setIconAt(0, GetIcon("icons/material.png"));
1555
+ objectPanel.setToolTipTextAt(0, "Material");
1556
+
15321557 // JPanel north = new JPanel(new BorderLayout());
15331558 // north.setName("Edit");
15341559 // north.add(ctrlPanel, BorderLayout.NORTH);
15351560 // objectPanel.add(north);
15361561 objectPanel.add(editPanel);
1562
+ objectPanel.setIconAt(1, GetIcon("icons/write.png"));
1563
+ objectPanel.setToolTipTextAt(1, "Edit controls");
15371564
15381565 //if (Globals.ADVANCED)
15391566 objectPanel.add(infoPanel);
1567
+ objectPanel.setIconAt(2, GetIcon("icons/info.png"));
1568
+ objectPanel.setToolTipTextAt(2, "Information");
1569
+
1570
+ objectPanel.add(XYZPanel);
1571
+ objectPanel.setIconAt(3, GetIcon("icons/XYZ.png"));
1572
+ objectPanel.setToolTipTextAt(3, "XYZ/RGB transform");
15401573
15411574 objectPanel.add(toolboxPanel);
1575
+ objectPanel.setIconAt(4, GetIcon("icons/primitives.png"));
1576
+ objectPanel.setToolTipTextAt(4, "Objects & backgrounds");
15421577
15431578 /*
15441579 aConstraints.gridx = 0;
....@@ -1559,7 +1594,7 @@
15591594 scrollpane.addMouseWheelListener(this); // Default not fast enough
15601595
15611596 /*JTabbedPane*/ scenePanel = new cGridBag();
1562
- scenePanel.preferredWidth = 6;
1597
+ scenePanel.preferredWidth = 5;
15631598
15641599 JTabbedPane tabbedPane = new JTabbedPane();
15651600 tabbedPane.add(scrollpane);
....@@ -1637,7 +1672,7 @@
16371672 bigThree = new cGridBag();
16381673 bigThree.addComponent(scenePanel);
16391674 bigThree.addComponent(centralPanel);
1640
- bigThree.addComponent(XYZPanel);
1675
+ //bigThree.addComponent(XYZPanel);
16411676
16421677 // // SIDE EFFECT!!!
16431678 // aConstraints.gridx = 0;
....@@ -1678,7 +1713,6 @@
16781713 frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
16791714 frame.addWindowListener(new WindowAdapter()
16801715 {
1681
-
16821716 public void windowClosing(WindowEvent e)
16831717 {
16841718 Close();
....@@ -1701,12 +1735,56 @@
17011735 ctrlPanel.removeAll();
17021736 }
17031737
1704
- void SetupMaterial(cGridBag panel)
1738
+ void SetupMaterial(cGridBag materialpanel)
17051739 {
1706
- /*
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
+ /*
17071785 ctrlPanel.add(materialLabel = new JLabel("MATERIAL : "), aConstraints);
17081786 materialLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1709
- */
1787
+ */
17101788
17111789 cGridBag editBar = new cGridBag().setVertical(false);
17121790
....@@ -1740,27 +1818,50 @@
17401818 //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
17411819
17421820 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);
17431834
17441835 cGridBag color = new cGridBag();
1745
- color.add(colorLabel = new JLabel("Color/hue")); // , aConstraints);
1746
- colorLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1747
- 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
+
17481841 //colorField.preferredWidth = 200;
17491842 colorSection.add(color);
17501843
17511844 cGridBag modulation = new cGridBag();
17521845 modulation.add(modulationLabel = new JLabel("Saturation")); // , aConstraints);
17531846 modulationLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1754
- modulation.add(modulationField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1847
+ modulation.add(saturationField = new cNumberSlider(this, 0.001, 1)); // , aConstraints);
17551848 colorSection.add(modulation);
17561849
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
+
17571858 cGridBag texture = new cGridBag();
17581859 texture.add(textureLabel = new JLabel("Texture")); // , aConstraints);
17591860 textureLabel.setHorizontalAlignment(SwingConstants.TRAILING);
17601861 texture.add(textureField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
17611862 colorSection.add(texture);
17621863
1763
- panel.add(new JSeparator());
1864
+ panel.add(GetSeparator());
17641865
17651866 panel.add(colorSection);
17661867
....@@ -1816,7 +1917,7 @@
18161917 shadowbias.add(shadowbiasField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
18171918 diffuseSection.add(shadowbias);
18181919
1819
- panel.add(new JSeparator());
1920
+ panel.add(GetSeparator());
18201921
18211922 panel.add(diffuseSection);
18221923
....@@ -1879,7 +1980,7 @@
18791980 specularSection.add(anisoV);
18801981
18811982
1882
- panel.add(new JSeparator());
1983
+ panel.add(GetSeparator());
18831984
18841985 panel.add(specularSection);
18851986
....@@ -1904,12 +2005,6 @@
19042005 backlitLabel.setHorizontalAlignment(SwingConstants.TRAILING);
19052006 backlit.add(backlitField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
19062007 colorSection.add(backlit);
1907
-
1908
- cGridBag opacity = new cGridBag();
1909
- opacity.add(opacityLabel = new JLabel("Opacity")); // , aConstraints);
1910
- opacityLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1911
- opacity.add(opacityField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1912
- colorSection.add(opacity);
19132008
19142009 //panel.add(new JSeparator());
19152010
....@@ -1955,7 +2050,7 @@
19552050 opacityPower.add(opacityPowerField = new cNumberSlider(this, 0.0, 10 /*10 dec 2013*/)); // , aConstraints);
19562051 textureSection.add(opacityPower);
19572052
1958
- panel.add(new JSeparator());
2053
+ panel.add(GetSeparator());
19592054
19602055 panel.add(textureSection);
19612056
....@@ -2942,7 +3037,7 @@
29423037
29433038 freezematerial = true;
29443039 colorField.setFloat(mat.color);
2945
- modulationField.setFloat(mat.modulation);
3040
+ saturationField.setFloat(mat.modulation);
29463041 metalnessField.setFloat(mat.metalness);
29473042 diffuseField.setFloat(mat.diffuse);
29483043 specularField.setFloat(mat.specular);
....@@ -3253,8 +3348,9 @@
32533348 } else if (event.getSource() == liveCB)
32543349 {
32553350 copy.live ^= true;
3351
+ objEditor.refreshContents(true); // To show item colors
32563352 return;
3257
- } else if (event.getSource() == selectCB)
3353
+ } else if (event.getSource() == selectableCB)
32583354 {
32593355 copy.dontselect ^= true;
32603356 return;
....@@ -3262,7 +3358,7 @@
32623358 {
32633359 copy.hide ^= true;
32643360 copy.Touch(); // display list issue
3265
- objEditor.refreshContents();
3361
+ objEditor.refreshContents(true); // To show item colors
32663362 return;
32673363 } else if (event.getSource() == link2masterCB)
32683364 {
....@@ -3518,6 +3614,7 @@
35183614
35193615 static public byte[] Compress(Object3D o)
35203616 {
3617
+ // Slower to actually compress.
35213618 try
35223619 {
35233620 ByteArrayOutputStream baos = new ByteArrayOutputStream();
....@@ -3619,6 +3716,7 @@
36193716 {
36203717 //Save(true);
36213718 Replace();
3719
+ SetUndoStates();
36223720 }
36233721
36243722 private boolean Equal(byte[] compress, byte[] name)
....@@ -3642,18 +3740,18 @@
36423740 public boolean Save(boolean user)
36433741 {
36443742 System.err.println("Save");
3743
+ Replace();
36453744
36463745 cRadio tab = GetCurrentTab();
36473746
3648
- byte[] compress = CompressCopy();
3747
+ Object3D compress = CompressCopy(); // Saved version. No need for "Replace".
36493748
36503749 boolean thesame = false;
36513750
3652
- // Quick heuristic using length. Works only when stream is compressed.
3653
- if (copy.versionindex > 0 && copy.versions[copy.versionindex-1] != null && Equal(compress, copy.versions[copy.versionindex-1]))
3654
- {
3655
- thesame = true;
3656
- }
3751
+// if (copy.versionindex > 0 && copy.versions[copy.versionindex-1] != null && Equal(compress, copy.versions[copy.versionindex-1]))
3752
+// {
3753
+// thesame = true;
3754
+// }
36573755
36583756 //EditorFrame.m_MainFrame.requestFocusInWindow();
36593757 if (!thesame)
....@@ -3661,7 +3759,7 @@
36613759 //tab.user[tab.versionindex] = user;
36623760 //boolean increment = true; // tab.graphs[tab.versionindex] == null;
36633761
3664
- copy.versions[++copy.versionindex] = compress;
3762
+ copy.versionlist[++copy.versionindex] = compress;
36653763
36663764 // if (increment)
36673765 // tab.versionindex++;
....@@ -3671,10 +3769,10 @@
36713769
36723770 //assert(hashtable.isEmpty());
36733771
3674
- for (int i = copy.versionindex+1; i < copy.versions.length; i++)
3772
+ for (int i = copy.versionindex+1; i < copy.versionlist.length; i++)
36753773 {
36763774 //tab.user[i] = false;
3677
- copy.versions[i] = null;
3775
+ copy.versionlist[i] = null;
36783776 }
36793777
36803778 SetUndoStates();
....@@ -3700,6 +3798,38 @@
37003798
37013799 return !thesame;
37023800 }
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
+ }
37033833
37043834 void CopyChanged(Object3D obj)
37053835 {
....@@ -3712,6 +3842,9 @@
37123842
37133843 copy.clear();
37143844
3845
+ copy.skyboxname = obj.skyboxname;
3846
+ copy.skyboxext = obj.skyboxext;
3847
+
37153848 for (int i=0; i<obj.Size(); i++)
37163849 {
37173850 copy.add(obj.get(i));
....@@ -3721,6 +3854,7 @@
37213854
37223855 CameraPane.SWITCH = temp;
37233856
3857
+ RefreshSelection();
37243858 //assert(hashtable.isEmpty());
37253859
37263860 copy.Touch();
....@@ -3755,9 +3889,9 @@
37553889 {
37563890 int count = 0;
37573891
3758
- for (int i = copy.versions.length; --i >= 0;)
3892
+ for (int i = copy.versionlist.length; --i >= 0;)
37593893 {
3760
- if (copy.versions[i] != null)
3894
+ if (copy.versionlist[i] != null)
37613895 count++;
37623896 }
37633897
....@@ -3772,7 +3906,7 @@
37723906 replaceButton.setEnabled(copy.versionindex != -1);
37733907
37743908 undoButton.setEnabled(copy.versionindex > 0);
3775
- redoButton.setEnabled(copy.versions[copy.versionindex + 1] != null);
3909
+ redoButton.setEnabled(copy.versionlist[copy.versionindex + 1] != null);
37763910
37773911 muteSlider = true;
37783912 versionSlider.setMaximum(VersionCount() - 1);
....@@ -3810,7 +3944,7 @@
38103944
38113945 copy.versionindex -= 1;
38123946
3813
- CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex]));
3947
+ CopyChanged((Object3D)copy.versionlist[copy.versionindex]);
38143948
38153949 return true;
38163950 }
....@@ -3821,13 +3955,14 @@
38213955
38223956 cRadio tab = GetCurrentTab();
38233957
3824
- if (copy.versionindex == -1 || copy.versions[copy.versionindex] == null)
3958
+ if (copy.versionindex == -1 || copy.versionlist[copy.versionindex] == null)
38253959 {
38263960 java.awt.Toolkit.getDefaultToolkit().beep();
38273961 return false;
38283962 }
38293963
3830
- CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex]));
3964
+ //CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex]));
3965
+ CopyChanged(copy.versionlist[copy.versionindex]);
38313966
38323967 return true;
38333968 }
....@@ -3838,13 +3973,13 @@
38383973
38393974 cRadio tab = GetCurrentTab();
38403975
3841
- if (copy.versionindex == -1 || copy.versions[copy.versionindex] == null)
3976
+ if (copy.versionindex == -1 || copy.versionlist[copy.versionindex] == null)
38423977 {
38433978 // No version yet. OK. java.awt.Toolkit.getDefaultToolkit().beep();
38443979 return false;
38453980 }
38463981
3847
- copy.versions[copy.versionindex] = CompressCopy();
3982
+ copy.versionlist[copy.versionindex] = CompressCopy();
38483983
38493984 return true;
38503985 }
....@@ -3856,7 +3991,7 @@
38563991
38573992 cRadio tab = GetCurrentTab();
38583993
3859
- if (copy.versions[copy.versionindex + 1] == null)
3994
+ if (copy.versionlist[copy.versionindex + 1] == null)
38603995 {
38613996 java.awt.Toolkit.getDefaultToolkit().beep();
38623997 return;
....@@ -3864,7 +3999,7 @@
38643999
38654000 copy.versionindex += 1;
38664001
3867
- CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex]));
4002
+ CopyChanged(copy.versionlist[copy.versionindex]);
38684003
38694004 //if (!tab.user[tab.versionindex])
38704005 // tab.graphs[tab.versionindex] = null;
....@@ -4078,7 +4213,7 @@
40784213 //copy.material = new cMaterial(copy.GetMaterial());
40794214
40804215 current.color = (float) colorField.getFloat();
4081
- current.modulation = (float) modulationField.getFloat();
4216
+ current.modulation = (float) saturationField.getFloat();
40824217 current.metalness = (float) metalnessField.getFloat();
40834218 current.diffuse = (float) diffuseField.getFloat();
40844219 current.specular = (float) specularField.getFloat();
....@@ -4111,7 +4246,7 @@
41114246 cMaterial mat = copy.material;
41124247
41134248 colorField.SetToolTipValue((mat.color));
4114
- modulationField.SetToolTipValue((mat.modulation));
4249
+ saturationField.SetToolTipValue((mat.modulation));
41154250 metalnessField.SetToolTipValue((mat.metalness));
41164251 diffuseField.SetToolTipValue((mat.diffuse));
41174252 specularField.SetToolTipValue((mat.specular));
....@@ -4175,9 +4310,9 @@
41754310
41764311 int version = versionSlider.getInteger();
41774312
4178
- if (copy.versions[version] != null)
4313
+ if (copy.versionlist[version] != null)
41794314 {
4180
- CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex = version]));
4315
+ CopyChanged(copy.versionlist[copy.versionindex = version]);
41814316 }
41824317
41834318 return;
....@@ -4217,6 +4352,12 @@
42174352 {
42184353 //System.out.println("stateChanged = " + this);
42194354 materialtouched = true;
4355
+
4356
+ if (e.getSource() == colorField && saturationField.getFloat() == 0.001)
4357
+ {
4358
+ saturationField.setFloat(1);
4359
+ }
4360
+
42204361 applySelf();
42214362 //System.out.println("this = " + this);
42224363 //System.out.println("PARENT = " + parent);
....@@ -4516,6 +4657,7 @@
45164657 {
45174658 if (GetTree() != null)
45184659 {
4660
+ GetTree().revalidate();
45194661 GetTree().repaint();
45204662 }
45214663
....@@ -4772,7 +4914,9 @@
47724914 readobj.ResetDisplayList();
47734915 } catch (Exception e)
47744916 {
4775
- //e.printStackTrace();
4917
+ if (!e.toString().contains("GZIP"))
4918
+ e.printStackTrace();
4919
+
47764920 try
47774921 {
47784922 java.io.FileInputStream istream = new java.io.FileInputStream(fullname);
....@@ -4852,6 +4996,8 @@
48524996 {
48534997 //readobj.deepCopySelf(copy);
48544998 copy.clear(); // june 2014
4999
+ copy.skyboxname = readobj.skyboxname;
5000
+ copy.skyboxext = readobj.skyboxext;
48555001 for (int i = 0; i < readobj.size(); i++)
48565002 {
48575003 Object3D child = readobj.get(i); // reserve(i);
....@@ -4892,6 +5038,7 @@
48925038 }
48935039 } catch (ClassCastException e)
48945040 {
5041
+ e.printStackTrace();
48955042 assert (false);
48965043 Composite c = (Composite) copy;
48975044 c.children.clear();
....@@ -4902,12 +5049,12 @@
49025049 c.addChild(csg);
49035050 }
49045051
4905
- copy.versions = readobj.versions;
5052
+ copy.versionlist = readobj.versionlist;
49065053 copy.versionindex = readobj.versionindex;
49075054
4908
- if (copy.versions == null)
5055
+ if (copy.versionlist == null)
49095056 {
4910
- copy.versions = new byte[100][];
5057
+ copy.versionlist = new Object3D[100];
49115058 copy.versionindex = -1;
49125059 }
49135060
....@@ -5022,6 +5169,7 @@
50225169 //ps.print(buffer.toString());
50235170 } catch (IOException e)
50245171 {
5172
+ e.printStackTrace();
50255173 }
50265174 }
50275175
....@@ -5314,7 +5462,7 @@
53145462 JLabel colorLabel;
53155463 cNumberSlider colorField;
53165464 JLabel modulationLabel;
5317
- cNumberSlider modulationField;
5465
+ cNumberSlider saturationField;
53185466 JLabel metalnessLabel;
53195467 cNumberSlider metalnessField;
53205468 JLabel diffuseLabel;