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,6 +296,12 @@
282296 client = inClient;
283297 copy = client;
284298
299
+ if (copy.versionlist == null)
300
+ {
301
+ copy.versionlist = new Object3D[100];
302
+ copy.versionindex = -1;
303
+ }
304
+
285305 // "this" is not called: SetupUI2(objEditor);
286306 }
287307
....@@ -295,6 +315,12 @@
295315 client = inClient;
296316 copy = client;
297317
318
+ if (copy.versionlist == null)
319
+ {
320
+ copy.versionlist = new Object3D[100];
321
+ copy.versionindex = -1;
322
+ }
323
+
298324 SetupUI2(callee.GetEditor());
299325 }
300326
....@@ -309,7 +335,7 @@
309335 //localCopy.parent = null;
310336
311337 frame = new JFrame();
312
- frame.setUndecorated(true);
338
+ frame.setUndecorated(false);
313339 objEditor = this;
314340 this.callee = callee;
315341
....@@ -327,6 +353,12 @@
327353 copy = localCopy;
328354 copy.editWindow = this;
329355
356
+ if (copy.versionlist == null)
357
+ {
358
+// copy.versions = new byte[100][];
359
+// copy.versionindex = -1;
360
+ }
361
+
330362 SetupMenu();
331363
332364 //SetupName(objEditor); // new
....@@ -350,7 +382,7 @@
350382 frame.setMenuBar(menuBar = new MenuBar());
351383 menuBar.add(fileMenu = new Menu("File"));
352384 fileMenu.add(newItem = new MenuItem("New"));
353
- fileMenu.add(loadItem = new MenuItem("Open..."));
385
+ fileMenu.add(openItem = new MenuItem("Open..."));
354386
355387 //oe.menuBar.add(menu = new Menu("Include"));
356388 Menu menu = new Menu("Import");
....@@ -382,7 +414,7 @@
382414 }
383415
384416 newItem.addActionListener(this);
385
- loadItem.addActionListener(this);
417
+ openItem.addActionListener(this);
386418 saveItem.addActionListener(this);
387419 saveAsItem.addActionListener(this);
388420 exportAsItem.addActionListener(this);
....@@ -419,11 +451,12 @@
419451
420452 toolbarPanel = new JPanel();
421453 toolbarPanel.setName("Toolbar");
454
+
422455 treePanel = new cGridBag();
423456 treePanel.setName("Tree");
424457
425458 editPanel = new cGridBag().setVertical(true);
426
- editPanel.setName("Edit");
459
+ //editPanel.setName("Edit");
427460
428461 ctrlPanel = new cGridBag().setVertical(false); // new GridBagLayout());
429462
....@@ -431,11 +464,11 @@
431464 editPanel.add(editCommandsPanel);
432465 editPanel.add(ctrlPanel);
433466
434
- toolboxPanel = new cGridBag().setVertical(false);
435
- toolboxPanel.setName("Toolbox");
467
+ toolboxPanel = new cGridBag().setVertical(true);
468
+ //toolboxPanel.setName("Toolbox");
436469
437
- materialPanel = new cGridBag().setVertical(true);
438
- materialPanel.setName("Material");
470
+ materialPanel = new cGridBag().setVertical(false);
471
+ //materialPanel.setName("Material");
439472
440473 /*JTextPane*/
441474 infoarea = createTextPane();
....@@ -443,14 +476,15 @@
443476
444477 infoarea.setEditable(true);
445478 SetText();
479
+
446480 // infoarea.setFont(infoarea.getFont().deriveFont(10, 14f));
447481 // infoarea.setOpaque(false);
448482 // //infoarea.setForeground(textcolor);
449483 // TEXTAREA infoarea.setLineWrap(true);
450484 // TEXTAREA infoarea.setWrapStyleWord(true);
451485 infoPanel = new JScrollPane(infoarea, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); //AS_NEEDED);
452
- infoPanel.setPreferredSize(new Dimension(50, 200));
453
- infoPanel.setName("Info");
486
+ infoPanel.setPreferredSize(new Dimension(1, 1));
487
+ //infoPanel.setName("Info");
454488 //infoPanel.setLayout(new BorderLayout());
455489 //infoPanel.add(createTextPane());
456490
....@@ -699,8 +733,8 @@
699733 }
700734 }
701735
702
-static GraphicsDevice device = GraphicsEnvironment
703
- .getLocalGraphicsEnvironment().getScreenDevices()[0];
736
+//static GraphicsDevice device = GraphicsEnvironment
737
+// .getLocalGraphicsEnvironment().getScreenDevices()[0];
704738
705739 Rectangle keeprect;
706740 cRadio radio;
....@@ -721,10 +755,19 @@
721755 void Minimize()
722756 {
723757 frame.setState(Frame.ICONIFIED);
758
+ frame.validate();
724759 }
725760
761
+// artifactURI=null, type=0, property=${file.reference.jfxrt.jar}, object=org.netbeans.modules.java.api.common.classpath.ClassPathSupport$RelativePath@6767876f, broken=false, additional={}
762
+// artifactURI=null, type=0, property=${file.reference.mac-ui.jar}, object=org.netbeans.modules.java.api.common.classpath.ClassPathSupport$RelativePath@16bdc817, broken=false, additional={}
763
+// artifactURI=null, type=0, property=${file.reference.classes.jar}, object=org.netbeans.modules.java.api.common.classpath.ClassPathSupport$RelativePath@9daa9c17, broken=false, additional={}
726764 void Maximize()
727765 {
766
+ if (CameraPane.FULLSCREEN)
767
+ {
768
+ ToggleFullScreen();
769
+ }
770
+
728771 if (maximized)
729772 {
730773 frame.setBounds(keeprect.x, keeprect.y, keeprect.width, keeprect.height);
....@@ -732,22 +775,36 @@
732775 else
733776 {
734777 keeprect = frame.getBounds();
735
- Rectangle rect = GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds();
736
- Dimension rect2 = frame.getToolkit().getScreenSize();
737
- frame.setBounds(0, rect2.height - rect.height, rect.width, rect.height);
778
+// Rectangle rect = GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds();
779
+// Dimension rect2 = frame.getToolkit().getScreenSize();
780
+// frame.setBounds(0, rect2.height - rect.height, rect.width, rect.height);
738781 // frame.setState(Frame.MAXIMIZED_BOTH);
782
+ frame.setBounds(frame.getGraphicsConfiguration().getBounds());
739783 }
740784
741785 maximized ^= true;
786
+
787
+ frame.validate();
742788 }
789
+
790
+ cButton minButton;
791
+ cButton maxButton;
792
+ cButton fullButton;
743793
744794 void ToggleFullScreen()
745795 {
796
+GraphicsDevice device = frame.getGraphicsConfiguration().getDevice();
797
+
746798 cameraView.ToggleFullScreen();
747799
748800 if (!CameraPane.FULLSCREEN)
749801 {
750802 device.setFullScreenWindow(null);
803
+ frame.dispose();
804
+ frame.setUndecorated(false);
805
+ frame.validate();
806
+ frame.setVisible(true);
807
+
751808 //frame.setVisible(false);
752809 // frame.removeNotify();
753810 // frame.setUndecorated(false);
....@@ -757,7 +814,7 @@
757814 // X frame.getContentPane().remove(/*"Center",*/bigThree);
758815 // X framePanel.add(bigThree);
759816 // X frame.getContentPane().add(/*"Center",*/framePanel);
760
- framePanel.setDividerLocation(1);
817
+ framePanel.setDividerLocation(46);
761818
762819 //frame.setVisible(true);
763820 radio.layout = keepButton;
....@@ -772,7 +829,12 @@
772829 // frame.setBounds(0, 0, frame.getToolkit().getScreenSize().width,
773830 // frame.getToolkit().getScreenSize().height);
774831 //frame.setVisible(false);
832
+
833
+ frame.dispose();
834
+ frame.setUndecorated(true);
775835 device.setFullScreenWindow(frame);
836
+ frame.validate();
837
+ frame.setVisible(true);
776838 // frame.removeNotify();
777839 // frame.setUndecorated(true);
778840 // frame.addNotify();
....@@ -785,7 +847,31 @@
785847 radio.layout.doClick();
786848 //frame.setVisible(true);
787849 }
850
+ frame.validate();
788851 }
852
+
853
+ private Object3D CompressCopy()
854
+ {
855
+ boolean temp = CameraPane.SWITCH;
856
+ CameraPane.SWITCH = false;
857
+
858
+ copy.ExtractBigData(versiontable);
859
+ // if (copy == client)
860
+
861
+ Object3D versions[] = copy.versionlist;
862
+ copy.versionlist = null;
863
+
864
+ //byte[] compress = Compress(copy);
865
+ Object3D compress = (Object3D)Grafreed.clone(copy);
866
+
867
+ copy.versionlist = versions;
868
+
869
+ copy.RestoreBigData(versiontable);
870
+
871
+ CameraPane.SWITCH = temp;
872
+
873
+ return compress;
874
+ }
789875
790876 private JTextPane createTextPane()
791877 {
....@@ -908,6 +994,7 @@
908994 {
909995 SetupMaterial(materialPanel);
910996 }
997
+
911998 //SetupName();
912999 //SetupViews();
9131000 }
....@@ -917,7 +1004,7 @@
9171004 // NumberSlider vDivsField;
9181005 // JCheckBox endcaps;
9191006 JCheckBox liveCB;
920
- JCheckBox selectCB;
1007
+ JCheckBox selectableCB;
9211008 JCheckBox hideCB;
9221009 JCheckBox link2masterCB;
9231010 JCheckBox markCB;
....@@ -1117,7 +1204,7 @@
11171204 namePanel = new cGridBag();
11181205
11191206 nameField = AddText(namePanel, copy.GetName());
1120
- namePanel.add(nameField);
1207
+ namePanel.add(new JScrollPane(nameField, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER));
11211208 oe.ctrlPanel.add(namePanel);
11221209
11231210 oe.ctrlPanel.Return();
....@@ -1129,26 +1216,30 @@
11291216
11301217 liveCB = AddCheckBox(setupPanel, "Live", copy.live);
11311218 liveCB.setToolTipText("Animate object");
1132
- selectCB = AddCheckBox(setupPanel, "Select", !copy.dontselect);
1133
- selectCB.setToolTipText("Make object selectable");
1219
+ selectableCB = AddCheckBox(setupPanel, "Select", !copy.dontselect);
1220
+ selectableCB.setToolTipText("Make object selectable");
11341221 // Return();
1222
+
11351223 hideCB = AddCheckBox(setupPanel, "Hide", copy.hide);
11361224 hideCB.setToolTipText("Hide object");
11371225 markCB = AddCheckBox(setupPanel, "Mark", copy.marked);
11381226 markCB.setToolTipText("As animation target transform");
1227
+
1228
+ ToolTipManager.sharedInstance().setLightWeightPopupEnabled(false);
11391229
11401230 setupPanel2 = new cGridBag().setVertical(false);
11411231
11421232 rewindCB = AddCheckBox(setupPanel2, "Rewind", copy.rewind);
11431233 rewindCB.setToolTipText("Rewind animation");
11441234
1145
- randomCB = AddCheckBox(setupPanel2, "Rand", copy.random);
1235
+ randomCB = AddCheckBox(setupPanel2, "Random", copy.random);
11461236 randomCB.setToolTipText("Randomly Rewind (or Go back and forth)");
11471237
1238
+ link2masterCB = AddCheckBox(setupPanel2, "Support", copy.link2master);
1239
+ link2masterCB.setToolTipText("Attach to support");
1240
+
11481241 if (Globals.ADVANCED)
11491242 {
1150
- link2masterCB = AddCheckBox(setupPanel2, "Supp", copy.link2master);
1151
- link2masterCB.setToolTipText("Attach to support");
11521243 speedupCB = AddCheckBox(setupPanel2, "Speed", copy.speedup);
11531244 speedupCB.setToolTipText("Option motion capture");
11541245 }
....@@ -1422,6 +1513,7 @@
14221513 XYZPanel.addComponent(/*BorderLayout.SOUTH,*/sideView); // Scroll);
14231514 XYZPanel.addComponent(/*BorderLayout.CENTER,*/frontView); // Scroll);
14241515 XYZPanel.addComponent(/*BorderLayout.NORTH,*/topView); // Scroll);
1516
+ //XYZPanel.setName("XYZ");
14251517
14261518 /*
14271519 gridPanel = new JPanel(); //new BorderLayout());
....@@ -1459,13 +1551,29 @@
14591551 //JScrollPane tmp = new JScrollPane(ctrlPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
14601552 //tmp.setName("Edit");
14611553 objectPanel.add(materialPanel);
1554
+ objectPanel.setIconAt(0, GetIcon("icons/material.png"));
1555
+ objectPanel.setToolTipTextAt(0, "Material");
1556
+
14621557 // JPanel north = new JPanel(new BorderLayout());
14631558 // north.setName("Edit");
14641559 // north.add(ctrlPanel, BorderLayout.NORTH);
14651560 // objectPanel.add(north);
14661561 objectPanel.add(editPanel);
1467
- objectPanel.add(infoPanel);
1562
+ objectPanel.setIconAt(1, GetIcon("icons/write.png"));
1563
+ objectPanel.setToolTipTextAt(1, "Edit controls");
1564
+
1565
+ //if (Globals.ADVANCED)
1566
+ objectPanel.add(infoPanel);
1567
+ objectPanel.setIconAt(2, GetIcon("icons/info.png"));
1568
+ objectPanel.setToolTipTextAt(2, "Information");
1569
+
1570
+ objectPanel.add(XYZPanel);
1571
+ objectPanel.setIconAt(3, GetIcon("icons/XYZ.png"));
1572
+ objectPanel.setToolTipTextAt(3, "XYZ/RGB transform");
1573
+
14681574 objectPanel.add(toolboxPanel);
1575
+ objectPanel.setIconAt(4, GetIcon("icons/primitives.png"));
1576
+ objectPanel.setToolTipTextAt(4, "Objects & backgrounds");
14691577
14701578 /*
14711579 aConstraints.gridx = 0;
....@@ -1486,7 +1594,7 @@
14861594 scrollpane.addMouseWheelListener(this); // Default not fast enough
14871595
14881596 /*JTabbedPane*/ scenePanel = new cGridBag();
1489
- scenePanel.preferredWidth = 6;
1597
+ scenePanel.preferredWidth = 5;
14901598
14911599 JTabbedPane tabbedPane = new JTabbedPane();
14921600 tabbedPane.add(scrollpane);
....@@ -1564,7 +1672,7 @@
15641672 bigThree = new cGridBag();
15651673 bigThree.addComponent(scenePanel);
15661674 bigThree.addComponent(centralPanel);
1567
- bigThree.addComponent(XYZPanel);
1675
+ //bigThree.addComponent(XYZPanel);
15681676
15691677 // // SIDE EFFECT!!!
15701678 // aConstraints.gridx = 0;
....@@ -1573,9 +1681,9 @@
15731681 // aConstraints.gridheight = 1;
15741682
15751683 framePanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, toolbarPanel, bigThree);
1576
- framePanel.setContinuousLayout(true);
1577
- framePanel.setOneTouchExpandable(true);
1578
- framePanel.setDividerLocation(0.8);
1684
+ framePanel.setContinuousLayout(false);
1685
+ framePanel.setOneTouchExpandable(false);
1686
+ //.setDividerLocation(0.8);
15791687 //framePanel.setDividerSize(15);
15801688 //framePanel.setResizeWeight(0.15);
15811689 framePanel.setName("Frame");
....@@ -1594,17 +1702,17 @@
15941702
15951703 frame.setSize(1280, 860);
15961704
1597
- frame.validate();
1598
- frame.setVisible(true);
1599
-
16001705 cameraView.requestFocusInWindow();
16011706
16021707 gridPanel.setDividerLocation(1.0);
1708
+
1709
+ frame.validate();
1710
+
1711
+ frame.setVisible(true);
16031712
16041713 frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
16051714 frame.addWindowListener(new WindowAdapter()
16061715 {
1607
-
16081716 public void windowClosing(WindowEvent e)
16091717 {
16101718 Close();
....@@ -1627,12 +1735,56 @@
16271735 ctrlPanel.removeAll();
16281736 }
16291737
1630
- void SetupMaterial(cGridBag panel)
1738
+ void SetupMaterial(cGridBag materialpanel)
16311739 {
1632
- /*
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
+ /*
16331785 ctrlPanel.add(materialLabel = new JLabel("MATERIAL : "), aConstraints);
16341786 materialLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1635
- */
1787
+ */
16361788
16371789 cGridBag editBar = new cGridBag().setVertical(false);
16381790
....@@ -1666,45 +1818,50 @@
16661818 //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
16671819
16681820 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);
16691834
16701835 cGridBag color = new cGridBag();
1671
- color.add(colorLabel = new JLabel("Color/hue")); // , aConstraints);
1672
- colorLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1673
- 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
+
16741841 //colorField.preferredWidth = 200;
16751842 colorSection.add(color);
16761843
16771844 cGridBag modulation = new cGridBag();
16781845 modulation.add(modulationLabel = new JLabel("Saturation")); // , aConstraints);
16791846 modulationLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1680
- modulation.add(modulationField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1847
+ modulation.add(saturationField = new cNumberSlider(this, 0.001, 1)); // , aConstraints);
16811848 colorSection.add(modulation);
16821849
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
+
16831858 cGridBag texture = new cGridBag();
16841859 texture.add(textureLabel = new JLabel("Texture")); // , aConstraints);
16851860 textureLabel.setHorizontalAlignment(SwingConstants.TRAILING);
16861861 texture.add(textureField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
16871862 colorSection.add(texture);
16881863
1689
- cGridBag anisoU = new cGridBag();
1690
- anisoU.add(anisoLabel = new JLabel("AnisoU")); // , aConstraints);
1691
- anisoLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1692
- anisoU.add(anisoField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1693
- colorSection.add(anisoU);
1694
-
1695
- cGridBag anisoV = new cGridBag();
1696
- anisoV.add(anisoVLabel = new JLabel("AnisoV")); // , aConstraints);
1697
- anisoVLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1698
- anisoV.add(anisoVField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1699
- colorSection.add(anisoV);
1700
-
1701
- cGridBag shadowbias = new cGridBag();
1702
- shadowbias.add(shadowbiasLabel = new JLabel("Shadowbias")); // , aConstraints);
1703
- shadowbiasLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1704
- shadowbias.add(shadowbiasField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1705
- colorSection.add(shadowbias);
1706
-
1707
- panel.add(new JSeparator());
1864
+ panel.add(GetSeparator());
17081865
17091866 panel.add(colorSection);
17101867
....@@ -1754,7 +1911,13 @@
17541911 fakedepth.add(fakedepthField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
17551912 diffuseSection.add(fakedepth);
17561913
1757
- panel.add(new JSeparator());
1914
+ cGridBag shadowbias = new cGridBag();
1915
+ shadowbias.add(shadowbiasLabel = new JLabel("Shadowbias")); // , aConstraints);
1916
+ shadowbiasLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1917
+ shadowbias.add(shadowbiasField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1918
+ diffuseSection.add(shadowbias);
1919
+
1920
+ panel.add(GetSeparator());
17581921
17591922 panel.add(diffuseSection);
17601923
....@@ -1804,42 +1967,48 @@
18041967 // aConstraints.gridy += 1;
18051968 // aConstraints.gridwidth = 1;
18061969
1970
+ cGridBag anisoU = new cGridBag();
1971
+ anisoU.add(anisoLabel = new JLabel("AnisoU")); // , aConstraints);
1972
+ anisoLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1973
+ anisoU.add(anisoField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1974
+ specularSection.add(anisoU);
18071975
1808
- panel.add(new JSeparator());
1976
+ cGridBag anisoV = new cGridBag();
1977
+ anisoV.add(anisoVLabel = new JLabel("AnisoV")); // , aConstraints);
1978
+ anisoVLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1979
+ anisoV.add(anisoVField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1980
+ specularSection.add(anisoV);
1981
+
1982
+
1983
+ panel.add(GetSeparator());
18091984
18101985 panel.add(specularSection);
18111986
18121987 //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
18131988
1814
- cGridBag globalSection = new cGridBag().setVertical(true);
1989
+ //cGridBag globalSection = new cGridBag().setVertical(true);
18151990
18161991 cGridBag camera = new cGridBag();
18171992 camera.add(cameraLabel = new JLabel("GlobalLight")); // , aConstraints);
18181993 cameraLabel.setHorizontalAlignment(SwingConstants.TRAILING);
18191994 camera.add(cameraField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1820
- globalSection.add(camera);
1995
+ colorSection.add(camera);
18211996
18221997 cGridBag ambient = new cGridBag();
18231998 ambient.add(ambientLabel = new JLabel("Ambient")); // , aConstraints);
18241999 ambientLabel.setHorizontalAlignment(SwingConstants.TRAILING);
18252000 ambient.add(ambientField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1826
- globalSection.add(ambient);
2001
+ colorSection.add(ambient);
18272002
18282003 cGridBag backlit = new cGridBag();
18292004 backlit.add(backlitLabel = new JLabel("Backlit")); // , aConstraints);
18302005 backlitLabel.setHorizontalAlignment(SwingConstants.TRAILING);
18312006 backlit.add(backlitField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1832
- globalSection.add(backlit);
2007
+ colorSection.add(backlit);
18332008
1834
- cGridBag opacity = new cGridBag();
1835
- opacity.add(opacityLabel = new JLabel("Opacity")); // , aConstraints);
1836
- opacityLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1837
- opacity.add(opacityField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1838
- globalSection.add(opacity);
1839
-
1840
- panel.add(new JSeparator());
2009
+ //panel.add(new JSeparator());
18412010
1842
- panel.add(globalSection);
2011
+ //panel.add(globalSection);
18432012
18442013 //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
18452014
....@@ -1881,7 +2050,7 @@
18812050 opacityPower.add(opacityPowerField = new cNumberSlider(this, 0.0, 10 /*10 dec 2013*/)); // , aConstraints);
18822051 textureSection.add(opacityPower);
18832052
1884
- panel.add(new JSeparator());
2053
+ panel.add(GetSeparator());
18852054
18862055 panel.add(textureSection);
18872056
....@@ -1946,8 +2115,9 @@
19462115 // 3D models
19472116 if (filename.endsWith(".3ds") || filename.endsWith(".3DS"))
19482117 {
1949
- lastConverter = new com.jmex.model.converters.MaxToJme();
1950
- LoadFile(filename, lastConverter);
2118
+ //lastConverter = new com.jmex.model.converters.MaxToJme();
2119
+ //LoadFile(filename, lastConverter);
2120
+ LoadObjFile(filename); // New 3ds loader
19512121 continue;
19522122 }
19532123 if (filename.endsWith(".dae") || filename.endsWith(".DAE"))
....@@ -2673,6 +2843,7 @@
26732843 LA.matXRotate(((Object3D) group.get(group.size() - 1)).toParent, -Math.PI / 2);
26742844 LA.matXRotate(((Object3D) group.get(group.size() - 1)).fromParent, Math.PI / 2);
26752845 }
2846
+
26762847 //cJME.count++;
26772848 //cJME.count %= 12;
26782849 if (gc)
....@@ -2856,6 +3027,7 @@
28563027 }
28573028 }
28583029 }
3030
+
28593031 cFileSystemPane FSPane;
28603032
28613033 void SetMaterial(cMaterial mat, Object3D.cVector2[] others)
....@@ -2865,7 +3037,7 @@
28653037
28663038 freezematerial = true;
28673039 colorField.setFloat(mat.color);
2868
- modulationField.setFloat(mat.modulation);
3040
+ saturationField.setFloat(mat.modulation);
28693041 metalnessField.setFloat(mat.metalness);
28703042 diffuseField.setFloat(mat.diffuse);
28713043 specularField.setFloat(mat.specular);
....@@ -2909,6 +3081,7 @@
29093081 }
29103082 }
29113083 }
3084
+
29123085 freezematerial = false;
29133086 }
29143087
....@@ -3175,8 +3348,9 @@
31753348 } else if (event.getSource() == liveCB)
31763349 {
31773350 copy.live ^= true;
3351
+ objEditor.refreshContents(true); // To show item colors
31783352 return;
3179
- } else if (event.getSource() == selectCB)
3353
+ } else if (event.getSource() == selectableCB)
31803354 {
31813355 copy.dontselect ^= true;
31823356 return;
....@@ -3184,7 +3358,7 @@
31843358 {
31853359 copy.hide ^= true;
31863360 copy.Touch(); // display list issue
3187
- objEditor.refreshContents();
3361
+ objEditor.refreshContents(true); // To show item colors
31883362 return;
31893363 } else if (event.getSource() == link2masterCB)
31903364 {
....@@ -3361,9 +3535,9 @@
33613535 {
33623536 Close();
33633537 //return true;
3364
- } else if (source == loadItem)
3538
+ } else if (source == openItem)
33653539 {
3366
- load();
3540
+ Open();
33673541 //return true;
33683542 } else if (source == newItem)
33693543 {
....@@ -3388,6 +3562,10 @@
33883562 {
33893563 generatePOV();
33903564 //return true;
3565
+ } else if (event.getSource() == archiveItem)
3566
+ {
3567
+ cTools.Archive(frame);
3568
+ return;
33913569 } else if (source == zBufferItem)
33923570 {
33933571 try
....@@ -3436,11 +3614,12 @@
34363614
34373615 static public byte[] Compress(Object3D o)
34383616 {
3617
+ // Slower to actually compress.
34393618 try
34403619 {
34413620 ByteArrayOutputStream baos = new ByteArrayOutputStream();
3442
- java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(baos);
3443
- ObjectOutputStream out = new ObjectOutputStream(zstream);
3621
+// java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(baos);
3622
+ ObjectOutputStream out = new ObjectOutputStream(baos); //zstream);
34443623
34453624 Object3D parent = o.parent;
34463625 o.parent = null;
....@@ -3451,10 +3630,14 @@
34513630
34523631 out.flush();
34533632
3454
- zstream.close();
3633
+ baos //zstream
3634
+ .close();
34553635 out.close();
34563636
3457
- return baos.toByteArray();
3637
+ byte[] bytes = baos.toByteArray();
3638
+
3639
+ System.out.println("save #bytes = " + bytes.length);
3640
+ return bytes;
34583641 } catch (Exception e)
34593642 {
34603643 System.err.println(e);
....@@ -3464,13 +3647,16 @@
34643647
34653648 static public Object Uncompress(byte[] bytes)
34663649 {
3467
- System.out.println("#bytes = " + bytes.length);
3650
+ System.out.println("restore #bytes = " + bytes.length);
34683651 try
34693652 {
34703653 ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
3471
- java.util.zip.GZIPInputStream istream = new java.util.zip.GZIPInputStream(bais);
3472
- ObjectInputStream in = new ObjectInputStream(istream);
3654
+ //java.util.zip.GZIPInputStream istream = new java.util.zip.GZIPInputStream(bais);
3655
+ ObjectInputStream in = new ObjectInputStream(bais); // istream);
34733656 Object obj = in.readObject();
3657
+
3658
+ bais //istream
3659
+ .close();
34743660 in.close();
34753661
34763662 return obj;
....@@ -3525,31 +3711,68 @@
35253711 return null;
35263712 }
35273713
3528
- java.util.Hashtable<java.util.UUID, Object3D> hashtable = new java.util.Hashtable<java.util.UUID, Object3D>();
35293714
35303715 public void Save()
35313716 {
3717
+ //Save(true);
3718
+ Replace();
3719
+ SetUndoStates();
3720
+ }
3721
+
3722
+ private boolean Equal(byte[] compress, byte[] name)
3723
+ {
3724
+ if (compress.length != name.length)
3725
+ {
3726
+ return false;
3727
+ }
3728
+
3729
+ for (int i=compress.length; --i>=0;)
3730
+ {
3731
+ if (compress[i] != name[i])
3732
+ return false;
3733
+ }
3734
+
3735
+ return true;
3736
+ }
3737
+
3738
+ java.util.Hashtable<java.util.UUID, Object3D> versiontable = new java.util.Hashtable<java.util.UUID, Object3D>();
3739
+
3740
+ public boolean Save(boolean user)
3741
+ {
35323742 System.err.println("Save");
3743
+ Replace();
35333744
35343745 cRadio tab = GetCurrentTab();
35353746
3536
- boolean temp = CameraPane.SWITCH;
3537
- CameraPane.SWITCH = false;
3747
+ Object3D compress = CompressCopy(); // Saved version. No need for "Replace".
35383748
3539
- copy.ExtractBigData(hashtable);
3749
+ boolean thesame = false;
3750
+
3751
+// if (copy.versionindex > 0 && copy.versions[copy.versionindex-1] != null && Equal(compress, copy.versions[copy.versionindex-1]))
3752
+// {
3753
+// thesame = true;
3754
+// }
35403755
35413756 //EditorFrame.m_MainFrame.requestFocusInWindow();
3542
- tab.graphs[tab.undoindex++] = Compress(copy);
3757
+ if (!thesame)
3758
+ {
3759
+ //tab.user[tab.versionindex] = user;
3760
+ //boolean increment = true; // tab.graphs[tab.versionindex] == null;
3761
+
3762
+ copy.versionlist[++copy.versionindex] = compress;
3763
+
3764
+ // if (increment)
3765
+ // tab.versionindex++;
3766
+ }
35433767
3544
- copy.RestoreBigData(hashtable);
3768
+ //copy.RestoreBigData(versiontable);
35453769
3546
- CameraPane.SWITCH = temp;
3547
-
35483770 //assert(hashtable.isEmpty());
35493771
3550
- for (int i = tab.undoindex; i < tab.graphs.length; i++)
3772
+ for (int i = copy.versionindex+1; i < copy.versionlist.length; i++)
35513773 {
3552
- tab.graphs[i] = null;
3774
+ //tab.user[i] = false;
3775
+ copy.versionlist[i] = null;
35533776 }
35543777
35553778 SetUndoStates();
....@@ -3559,7 +3782,7 @@
35593782 {
35603783 try
35613784 {
3562
- FileOutputStream ostream = new FileOutputStream("save" + tab.undoindex);
3785
+ FileOutputStream ostream = new FileOutputStream("save" + copy.versionindex);
35633786 ObjectOutputStream p = new ObjectOutputStream(ostream);
35643787
35653788 p.writeObject(copy);
....@@ -3572,6 +3795,40 @@
35723795 e.printStackTrace();
35733796 }
35743797 }
3798
+
3799
+ return !thesame;
3800
+ }
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);
35753832 }
35763833
35773834 void CopyChanged(Object3D obj)
....@@ -3581,19 +3838,23 @@
35813838 boolean temp = CameraPane.SWITCH;
35823839 CameraPane.SWITCH = false;
35833840
3584
- copy.ExtractBigData(hashtable);
3841
+ copy.ExtractBigData(versiontable);
35853842
35863843 copy.clear();
35873844
3845
+ copy.skyboxname = obj.skyboxname;
3846
+ copy.skyboxext = obj.skyboxext;
3847
+
35883848 for (int i=0; i<obj.Size(); i++)
35893849 {
35903850 copy.add(obj.get(i));
35913851 }
35923852
3593
- copy.RestoreBigData(hashtable);
3853
+ copy.RestoreBigData(versiontable);
35943854
35953855 CameraPane.SWITCH = temp;
35963856
3857
+ RefreshSelection();
35973858 //assert(hashtable.isEmpty());
35983859
35993860 copy.Touch();
....@@ -3618,52 +3879,130 @@
36183879 }
36193880
36203881 cButton undoButton;
3882
+ cButton restoreButton;
3883
+ cButton replaceButton;
36213884 cButton redoButton;
36223885
3886
+ boolean muteSlider;
3887
+
3888
+ int VersionCount()
3889
+ {
3890
+ int count = 0;
3891
+
3892
+ for (int i = copy.versionlist.length; --i >= 0;)
3893
+ {
3894
+ if (copy.versionlist[i] != null)
3895
+ count++;
3896
+ }
3897
+
3898
+ return count;
3899
+ }
3900
+
36233901 void SetUndoStates()
36243902 {
36253903 cRadio tab = GetCurrentTab();
36263904
3627
- undoButton.setEnabled(tab.undoindex > 0);
3628
- redoButton.setEnabled(tab.graphs[tab.undoindex + 1] != null);
3905
+ restoreButton.setEnabled(copy.versionindex != -1);
3906
+ replaceButton.setEnabled(copy.versionindex != -1);
3907
+
3908
+ undoButton.setEnabled(copy.versionindex > 0);
3909
+ redoButton.setEnabled(copy.versionlist[copy.versionindex + 1] != null);
3910
+
3911
+ muteSlider = true;
3912
+ versionSlider.setMaximum(VersionCount() - 1);
3913
+ versionSlider.setInteger(copy.versionindex);
3914
+ muteSlider = false;
36293915 }
36303916
3631
- public void Undo()
3917
+ public boolean Undo()
36323918 {
3919
+ // Option?
3920
+ Replace();
3921
+
36333922 System.err.println("Undo");
36343923
36353924 cRadio tab = GetCurrentTab();
36363925
3637
- if (tab.undoindex == 0)
3926
+ if (copy.versionindex == 0)
36383927 {
36393928 java.awt.Toolkit.getDefaultToolkit().beep();
3640
- return;
3929
+ return false;
36413930 }
36423931
3643
- if (tab.graphs[tab.undoindex] == null)
3932
+// if (tab.graphs[tab.versionindex] == null) // || !tab.user[tab.versionindex])
3933
+// {
3934
+// if (Save(false))
3935
+// tab.versionindex -= 1;
3936
+// else
3937
+// {
3938
+// if (tab.versionindex <= 0)
3939
+// return false;
3940
+// else
3941
+// tab.versionindex -= 1;
3942
+// }
3943
+// }
3944
+
3945
+ copy.versionindex -= 1;
3946
+
3947
+ CopyChanged((Object3D)copy.versionlist[copy.versionindex]);
3948
+
3949
+ return true;
3950
+ }
3951
+
3952
+ public boolean Restore()
3953
+ {
3954
+ System.err.println("Restore");
3955
+
3956
+ cRadio tab = GetCurrentTab();
3957
+
3958
+ if (copy.versionindex == -1 || copy.versionlist[copy.versionindex] == null)
36443959 {
3645
- Save();
3646
- tab.undoindex -= 1;
3960
+ java.awt.Toolkit.getDefaultToolkit().beep();
3961
+ return false;
36473962 }
36483963
3649
- tab.undoindex -= 1;
3964
+ //CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex]));
3965
+ CopyChanged(copy.versionlist[copy.versionindex]);
3966
+
3967
+ return true;
3968
+ }
36503969
3651
- CopyChanged((Object3D)Uncompress(tab.graphs[tab.undoindex]));
3970
+ public boolean Replace()
3971
+ {
3972
+ System.err.println("Replace");
3973
+
3974
+ cRadio tab = GetCurrentTab();
3975
+
3976
+ if (copy.versionindex == -1 || copy.versionlist[copy.versionindex] == null)
3977
+ {
3978
+ // No version yet. OK. java.awt.Toolkit.getDefaultToolkit().beep();
3979
+ return false;
3980
+ }
3981
+
3982
+ copy.versionlist[copy.versionindex] = CompressCopy();
3983
+
3984
+ return true;
36523985 }
36533986
36543987 public void Redo()
36553988 {
3989
+ // Option?
3990
+ Replace();
3991
+
36563992 cRadio tab = GetCurrentTab();
36573993
3658
- if (tab.graphs[tab.undoindex + 1] == null)
3994
+ if (copy.versionlist[copy.versionindex + 1] == null)
36593995 {
36603996 java.awt.Toolkit.getDefaultToolkit().beep();
36613997 return;
36623998 }
36633999
3664
- tab.undoindex += 1;
4000
+ copy.versionindex += 1;
36654001
3666
- CopyChanged((Object3D)Uncompress(tab.graphs[tab.undoindex]));
4002
+ CopyChanged(copy.versionlist[copy.versionindex]);
4003
+
4004
+ //if (!tab.user[tab.versionindex])
4005
+ // tab.graphs[tab.versionindex] = null;
36674006 }
36684007
36694008 void ImportGFD()
....@@ -3874,7 +4213,7 @@
38744213 //copy.material = new cMaterial(copy.GetMaterial());
38754214
38764215 current.color = (float) colorField.getFloat();
3877
- current.modulation = (float) modulationField.getFloat();
4216
+ current.modulation = (float) saturationField.getFloat();
38784217 current.metalness = (float) metalnessField.getFloat();
38794218 current.diffuse = (float) diffuseField.getFloat();
38804219 current.specular = (float) specularField.getFloat();
....@@ -3907,7 +4246,7 @@
39074246 cMaterial mat = copy.material;
39084247
39094248 colorField.SetToolTipValue((mat.color));
3910
- modulationField.SetToolTipValue((mat.modulation));
4249
+ saturationField.SetToolTipValue((mat.modulation));
39114250 metalnessField.SetToolTipValue((mat.metalness));
39124251 diffuseField.SetToolTipValue((mat.diffuse));
39134252 specularField.SetToolTipValue((mat.specular));
....@@ -3959,9 +4298,25 @@
39594298 //copy.Touch();
39604299 }
39614300
4301
+ cNumberSlider versionSlider;
4302
+
39624303 public void stateChanged(ChangeEvent e)
39634304 {
39644305 // assert(false);
4306
+ if (e.getSource() == versionSlider)
4307
+ {
4308
+ if (muteSlider)
4309
+ return;
4310
+
4311
+ int version = versionSlider.getInteger();
4312
+
4313
+ if (copy.versionlist[version] != null)
4314
+ {
4315
+ CopyChanged(copy.versionlist[copy.versionindex = version]);
4316
+ }
4317
+
4318
+ return;
4319
+ }
39654320
39664321 if (freezematerial)
39674322 {
....@@ -3997,6 +4352,12 @@
39974352 {
39984353 //System.out.println("stateChanged = " + this);
39994354 materialtouched = true;
4355
+
4356
+ if (e.getSource() == colorField && saturationField.getFloat() == 0.001)
4357
+ {
4358
+ saturationField.setFloat(1);
4359
+ }
4360
+
40004361 applySelf();
40014362 //System.out.println("this = " + this);
40024363 //System.out.println("PARENT = " + parent);
....@@ -4296,6 +4657,7 @@
42964657 {
42974658 if (GetTree() != null)
42984659 {
4660
+ GetTree().revalidate();
42994661 GetTree().repaint();
43004662 }
43014663
....@@ -4310,7 +4672,7 @@
43104672
43114673 void makeSomething(Object3D thing, boolean resetmodel) // deselect)
43124674 {
4313
- if (Globals.SAVEONMAKE) // && resetmodel)
4675
+ if (Globals.REPLACEONMAKE) // && resetmodel)
43144676 Save();
43154677 //Tween.set(thing, 0).target(1).start(tweenManager);
43164678 //Tween.to(thing, 0, 0.5f).target(0).start(tweenManager);
....@@ -4552,7 +4914,9 @@
45524914 readobj.ResetDisplayList();
45534915 } catch (Exception e)
45544916 {
4555
- //e.printStackTrace();
4917
+ if (!e.toString().contains("GZIP"))
4918
+ e.printStackTrace();
4919
+
45564920 try
45574921 {
45584922 java.io.FileInputStream istream = new java.io.FileInputStream(fullname);
....@@ -4626,12 +4990,14 @@
46264990
46274991 if (readobj != null)
46284992 {
4629
- if (Globals.SAVEONMAKE)
4630
- Save();
4993
+ //if (Globals.SAVEONMAKE) // A new object cannot share meshes
4994
+ // Save();
46314995 try
46324996 {
46334997 //readobj.deepCopySelf(copy);
46344998 copy.clear(); // june 2014
4999
+ copy.skyboxname = readobj.skyboxname;
5000
+ copy.skyboxext = readobj.skyboxext;
46355001 for (int i = 0; i < readobj.size(); i++)
46365002 {
46375003 Object3D child = readobj.get(i); // reserve(i);
....@@ -4672,6 +5038,7 @@
46725038 }
46735039 } catch (ClassCastException e)
46745040 {
5041
+ e.printStackTrace();
46755042 assert (false);
46765043 Composite c = (Composite) copy;
46775044 c.children.clear();
....@@ -4682,13 +5049,24 @@
46825049 c.addChild(csg);
46835050 }
46845051
5052
+ copy.versionlist = readobj.versionlist;
5053
+ copy.versionindex = readobj.versionindex;
5054
+
5055
+ if (copy.versionlist == null)
5056
+ {
5057
+ copy.versionlist = new Object3D[100];
5058
+ copy.versionindex = -1;
5059
+ }
5060
+
5061
+ //? SetUndoStates();
5062
+
46855063 ResetModel();
46865064 copy.HardTouch(); // recompile?
46875065 refreshContents();
46885066 }
46895067 }
46905068
4691
- void load() // throws ClassNotFoundException
5069
+ void Open() // throws ClassNotFoundException
46925070 {
46935071 if (Grafreed.standAlone)
46945072 {
....@@ -4791,6 +5169,7 @@
47915169 //ps.print(buffer.toString());
47925170 } catch (IOException e)
47935171 {
5172
+ e.printStackTrace();
47945173 }
47955174 }
47965175
....@@ -4973,7 +5352,7 @@
49735352 MenuBar menuBar;
49745353 Menu fileMenu;
49755354 MenuItem newItem;
4976
- MenuItem loadItem;
5355
+ MenuItem openItem;
49775356 MenuItem saveItem;
49785357 MenuItem saveAsItem;
49795358 MenuItem exportAsItem;
....@@ -4996,6 +5375,7 @@
49965375 CheckboxMenuItem toggleSwitchItem;
49975376 CheckboxMenuItem toggleRootItem;
49985377 CheckboxMenuItem animationItem;
5378
+ MenuItem archiveItem;
49995379 CheckboxMenuItem toggleHandleItem;
50005380 CheckboxMenuItem togglePaintItem;
50015381 JSplitPane mainPanel;
....@@ -5082,7 +5462,7 @@
50825462 JLabel colorLabel;
50835463 cNumberSlider colorField;
50845464 JLabel modulationLabel;
5085
- cNumberSlider modulationField;
5465
+ cNumberSlider saturationField;
50865466 JLabel metalnessLabel;
50875467 cNumberSlider metalnessField;
50885468 JLabel diffuseLabel;