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
....@@ -463,10 +497,11 @@
463497 mainPanel.setResizeWeight(0.5);
464498
465499 //mainPanel.setDividerSize((int) (mainPanel.getDividerSize() * 1.5));
466
-// BasicSplitPaneDivider divider = ( (BasicSplitPaneUI) mainPanel.getUI()).getDivider();
467
-// divider.setDividerSize(15);
468
-// divider.setBorder(BorderFactory.createTitledBorder(divider.getBorder(), "Custom border title -- gets rid of the one-touch arrows!"));
500
+ BasicSplitPaneDivider divider = ( (BasicSplitPaneUI) mainPanel.getUI()).getDivider();
501
+ divider.setDividerSize(15);
502
+ divider.setBorder(BorderFactory.createTitledBorder(divider.getBorder(), "Custom border title -- gets rid of the one-touch arrows!"));
469503
504
+ mainPanel.setUI(new BasicSplitPaneUI());
470505
471506 //ctrlPanel.setLayout(new GridLayout(4, 1, 5, 5));
472507 //mainPanel.setLayout(new GridBagLayout());
....@@ -698,8 +733,8 @@
698733 }
699734 }
700735
701
-static GraphicsDevice device = GraphicsEnvironment
702
- .getLocalGraphicsEnvironment().getScreenDevices()[0];
736
+//static GraphicsDevice device = GraphicsEnvironment
737
+// .getLocalGraphicsEnvironment().getScreenDevices()[0];
703738
704739 Rectangle keeprect;
705740 cRadio radio;
....@@ -720,10 +755,19 @@
720755 void Minimize()
721756 {
722757 frame.setState(Frame.ICONIFIED);
758
+ frame.validate();
723759 }
724760
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={}
725764 void Maximize()
726765 {
766
+ if (CameraPane.FULLSCREEN)
767
+ {
768
+ ToggleFullScreen();
769
+ }
770
+
727771 if (maximized)
728772 {
729773 frame.setBounds(keeprect.x, keeprect.y, keeprect.width, keeprect.height);
....@@ -731,22 +775,36 @@
731775 else
732776 {
733777 keeprect = frame.getBounds();
734
- Rectangle rect = GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds();
735
- Dimension rect2 = frame.getToolkit().getScreenSize();
736
- 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);
737781 // frame.setState(Frame.MAXIMIZED_BOTH);
782
+ frame.setBounds(frame.getGraphicsConfiguration().getBounds());
738783 }
739784
740785 maximized ^= true;
786
+
787
+ frame.validate();
741788 }
789
+
790
+ cButton minButton;
791
+ cButton maxButton;
792
+ cButton fullButton;
742793
743794 void ToggleFullScreen()
744795 {
796
+GraphicsDevice device = frame.getGraphicsConfiguration().getDevice();
797
+
745798 cameraView.ToggleFullScreen();
746799
747800 if (!CameraPane.FULLSCREEN)
748801 {
749802 device.setFullScreenWindow(null);
803
+ frame.dispose();
804
+ frame.setUndecorated(false);
805
+ frame.validate();
806
+ frame.setVisible(true);
807
+
750808 //frame.setVisible(false);
751809 // frame.removeNotify();
752810 // frame.setUndecorated(false);
....@@ -756,7 +814,7 @@
756814 // X frame.getContentPane().remove(/*"Center",*/bigThree);
757815 // X framePanel.add(bigThree);
758816 // X frame.getContentPane().add(/*"Center",*/framePanel);
759
- framePanel.setDividerLocation(1);
817
+ framePanel.setDividerLocation(46);
760818
761819 //frame.setVisible(true);
762820 radio.layout = keepButton;
....@@ -771,7 +829,12 @@
771829 // frame.setBounds(0, 0, frame.getToolkit().getScreenSize().width,
772830 // frame.getToolkit().getScreenSize().height);
773831 //frame.setVisible(false);
832
+
833
+ frame.dispose();
834
+ frame.setUndecorated(true);
774835 device.setFullScreenWindow(frame);
836
+ frame.validate();
837
+ frame.setVisible(true);
775838 // frame.removeNotify();
776839 // frame.setUndecorated(true);
777840 // frame.addNotify();
....@@ -784,7 +847,31 @@
784847 radio.layout.doClick();
785848 //frame.setVisible(true);
786849 }
850
+ frame.validate();
787851 }
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
+ }
788875
789876 private JTextPane createTextPane()
790877 {
....@@ -907,6 +994,7 @@
907994 {
908995 SetupMaterial(materialPanel);
909996 }
997
+
910998 //SetupName();
911999 //SetupViews();
9121000 }
....@@ -916,7 +1004,7 @@
9161004 // NumberSlider vDivsField;
9171005 // JCheckBox endcaps;
9181006 JCheckBox liveCB;
919
- JCheckBox selectCB;
1007
+ JCheckBox selectableCB;
9201008 JCheckBox hideCB;
9211009 JCheckBox link2masterCB;
9221010 JCheckBox markCB;
....@@ -1116,7 +1204,7 @@
11161204 namePanel = new cGridBag();
11171205
11181206 nameField = AddText(namePanel, copy.GetName());
1119
- namePanel.add(nameField);
1207
+ namePanel.add(new JScrollPane(nameField, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER));
11201208 oe.ctrlPanel.add(namePanel);
11211209
11221210 oe.ctrlPanel.Return();
....@@ -1128,26 +1216,30 @@
11281216
11291217 liveCB = AddCheckBox(setupPanel, "Live", copy.live);
11301218 liveCB.setToolTipText("Animate object");
1131
- selectCB = AddCheckBox(setupPanel, "Select", !copy.dontselect);
1132
- selectCB.setToolTipText("Make object selectable");
1219
+ selectableCB = AddCheckBox(setupPanel, "Select", !copy.dontselect);
1220
+ selectableCB.setToolTipText("Make object selectable");
11331221 // Return();
1222
+
11341223 hideCB = AddCheckBox(setupPanel, "Hide", copy.hide);
11351224 hideCB.setToolTipText("Hide object");
11361225 markCB = AddCheckBox(setupPanel, "Mark", copy.marked);
11371226 markCB.setToolTipText("As animation target transform");
1227
+
1228
+ ToolTipManager.sharedInstance().setLightWeightPopupEnabled(false);
11381229
11391230 setupPanel2 = new cGridBag().setVertical(false);
11401231
11411232 rewindCB = AddCheckBox(setupPanel2, "Rewind", copy.rewind);
11421233 rewindCB.setToolTipText("Rewind animation");
11431234
1144
- randomCB = AddCheckBox(setupPanel2, "Rand", copy.random);
1235
+ randomCB = AddCheckBox(setupPanel2, "Random", copy.random);
11451236 randomCB.setToolTipText("Randomly Rewind (or Go back and forth)");
11461237
1238
+ link2masterCB = AddCheckBox(setupPanel2, "Support", copy.link2master);
1239
+ link2masterCB.setToolTipText("Attach to support");
1240
+
11471241 if (Globals.ADVANCED)
11481242 {
1149
- link2masterCB = AddCheckBox(setupPanel2, "Supp", copy.link2master);
1150
- link2masterCB.setToolTipText("Attach to support");
11511243 speedupCB = AddCheckBox(setupPanel2, "Speed", copy.speedup);
11521244 speedupCB.setToolTipText("Option motion capture");
11531245 }
....@@ -1421,6 +1513,7 @@
14211513 XYZPanel.addComponent(/*BorderLayout.SOUTH,*/sideView); // Scroll);
14221514 XYZPanel.addComponent(/*BorderLayout.CENTER,*/frontView); // Scroll);
14231515 XYZPanel.addComponent(/*BorderLayout.NORTH,*/topView); // Scroll);
1516
+ //XYZPanel.setName("XYZ");
14241517
14251518 /*
14261519 gridPanel = new JPanel(); //new BorderLayout());
....@@ -1458,13 +1551,29 @@
14581551 //JScrollPane tmp = new JScrollPane(ctrlPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
14591552 //tmp.setName("Edit");
14601553 objectPanel.add(materialPanel);
1554
+ objectPanel.setIconAt(0, GetIcon("icons/material.png"));
1555
+ objectPanel.setToolTipTextAt(0, "Material");
1556
+
14611557 // JPanel north = new JPanel(new BorderLayout());
14621558 // north.setName("Edit");
14631559 // north.add(ctrlPanel, BorderLayout.NORTH);
14641560 // objectPanel.add(north);
14651561 objectPanel.add(editPanel);
1466
- 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
+
14671574 objectPanel.add(toolboxPanel);
1575
+ objectPanel.setIconAt(4, GetIcon("icons/primitives.png"));
1576
+ objectPanel.setToolTipTextAt(4, "Objects & backgrounds");
14681577
14691578 /*
14701579 aConstraints.gridx = 0;
....@@ -1485,7 +1594,7 @@
14851594 scrollpane.addMouseWheelListener(this); // Default not fast enough
14861595
14871596 /*JTabbedPane*/ scenePanel = new cGridBag();
1488
- scenePanel.preferredWidth = 6;
1597
+ scenePanel.preferredWidth = 5;
14891598
14901599 JTabbedPane tabbedPane = new JTabbedPane();
14911600 tabbedPane.add(scrollpane);
....@@ -1563,7 +1672,7 @@
15631672 bigThree = new cGridBag();
15641673 bigThree.addComponent(scenePanel);
15651674 bigThree.addComponent(centralPanel);
1566
- bigThree.addComponent(XYZPanel);
1675
+ //bigThree.addComponent(XYZPanel);
15671676
15681677 // // SIDE EFFECT!!!
15691678 // aConstraints.gridx = 0;
....@@ -1572,9 +1681,9 @@
15721681 // aConstraints.gridheight = 1;
15731682
15741683 framePanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, toolbarPanel, bigThree);
1575
- framePanel.setContinuousLayout(true);
1576
- framePanel.setOneTouchExpandable(true);
1577
- framePanel.setDividerLocation(0.8);
1684
+ framePanel.setContinuousLayout(false);
1685
+ framePanel.setOneTouchExpandable(false);
1686
+ //.setDividerLocation(0.8);
15781687 //framePanel.setDividerSize(15);
15791688 //framePanel.setResizeWeight(0.15);
15801689 framePanel.setName("Frame");
....@@ -1593,17 +1702,17 @@
15931702
15941703 frame.setSize(1280, 860);
15951704
1596
- frame.validate();
1597
- frame.setVisible(true);
1598
-
15991705 cameraView.requestFocusInWindow();
16001706
16011707 gridPanel.setDividerLocation(1.0);
1708
+
1709
+ frame.validate();
1710
+
1711
+ frame.setVisible(true);
16021712
16031713 frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
16041714 frame.addWindowListener(new WindowAdapter()
16051715 {
1606
-
16071716 public void windowClosing(WindowEvent e)
16081717 {
16091718 Close();
....@@ -1626,12 +1735,56 @@
16261735 ctrlPanel.removeAll();
16271736 }
16281737
1629
- void SetupMaterial(cGridBag panel)
1738
+ void SetupMaterial(cGridBag materialpanel)
16301739 {
1631
- /*
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
+ /*
16321785 ctrlPanel.add(materialLabel = new JLabel("MATERIAL : "), aConstraints);
16331786 materialLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1634
- */
1787
+ */
16351788
16361789 cGridBag editBar = new cGridBag().setVertical(false);
16371790
....@@ -1665,45 +1818,50 @@
16651818 //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
16661819
16671820 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);
16681834
16691835 cGridBag color = new cGridBag();
1670
- color.add(colorLabel = new JLabel("Color/hue")); // , aConstraints);
1671
- colorLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1672
- 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
+
16731841 //colorField.preferredWidth = 200;
16741842 colorSection.add(color);
16751843
16761844 cGridBag modulation = new cGridBag();
16771845 modulation.add(modulationLabel = new JLabel("Saturation")); // , aConstraints);
16781846 modulationLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1679
- modulation.add(modulationField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1847
+ modulation.add(saturationField = new cNumberSlider(this, 0.001, 1)); // , aConstraints);
16801848 colorSection.add(modulation);
16811849
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
+
16821858 cGridBag texture = new cGridBag();
16831859 texture.add(textureLabel = new JLabel("Texture")); // , aConstraints);
16841860 textureLabel.setHorizontalAlignment(SwingConstants.TRAILING);
16851861 texture.add(textureField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
16861862 colorSection.add(texture);
16871863
1688
- cGridBag anisoU = new cGridBag();
1689
- anisoU.add(anisoLabel = new JLabel("AnisoU")); // , aConstraints);
1690
- anisoLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1691
- anisoU.add(anisoField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1692
- colorSection.add(anisoU);
1693
-
1694
- cGridBag anisoV = new cGridBag();
1695
- anisoV.add(anisoVLabel = new JLabel("AnisoV")); // , aConstraints);
1696
- anisoVLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1697
- anisoV.add(anisoVField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1698
- colorSection.add(anisoV);
1699
-
1700
- cGridBag shadowbias = new cGridBag();
1701
- shadowbias.add(shadowbiasLabel = new JLabel("Shadowbias")); // , aConstraints);
1702
- shadowbiasLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1703
- shadowbias.add(shadowbiasField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1704
- colorSection.add(shadowbias);
1705
-
1706
- panel.add(new JSeparator());
1864
+ panel.add(GetSeparator());
17071865
17081866 panel.add(colorSection);
17091867
....@@ -1753,7 +1911,13 @@
17531911 fakedepth.add(fakedepthField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
17541912 diffuseSection.add(fakedepth);
17551913
1756
- 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());
17571921
17581922 panel.add(diffuseSection);
17591923
....@@ -1803,42 +1967,48 @@
18031967 // aConstraints.gridy += 1;
18041968 // aConstraints.gridwidth = 1;
18051969
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);
18061975
1807
- 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());
18081984
18091985 panel.add(specularSection);
18101986
18111987 //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
18121988
1813
- cGridBag globalSection = new cGridBag().setVertical(true);
1989
+ //cGridBag globalSection = new cGridBag().setVertical(true);
18141990
18151991 cGridBag camera = new cGridBag();
18161992 camera.add(cameraLabel = new JLabel("GlobalLight")); // , aConstraints);
18171993 cameraLabel.setHorizontalAlignment(SwingConstants.TRAILING);
18181994 camera.add(cameraField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1819
- globalSection.add(camera);
1995
+ colorSection.add(camera);
18201996
18211997 cGridBag ambient = new cGridBag();
18221998 ambient.add(ambientLabel = new JLabel("Ambient")); // , aConstraints);
18231999 ambientLabel.setHorizontalAlignment(SwingConstants.TRAILING);
18242000 ambient.add(ambientField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1825
- globalSection.add(ambient);
2001
+ colorSection.add(ambient);
18262002
18272003 cGridBag backlit = new cGridBag();
18282004 backlit.add(backlitLabel = new JLabel("Backlit")); // , aConstraints);
18292005 backlitLabel.setHorizontalAlignment(SwingConstants.TRAILING);
18302006 backlit.add(backlitField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1831
- globalSection.add(backlit);
2007
+ colorSection.add(backlit);
18322008
1833
- cGridBag opacity = new cGridBag();
1834
- opacity.add(opacityLabel = new JLabel("Opacity")); // , aConstraints);
1835
- opacityLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1836
- opacity.add(opacityField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1837
- globalSection.add(opacity);
1838
-
1839
- panel.add(new JSeparator());
2009
+ //panel.add(new JSeparator());
18402010
1841
- panel.add(globalSection);
2011
+ //panel.add(globalSection);
18422012
18432013 //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
18442014
....@@ -1880,7 +2050,7 @@
18802050 opacityPower.add(opacityPowerField = new cNumberSlider(this, 0.0, 10 /*10 dec 2013*/)); // , aConstraints);
18812051 textureSection.add(opacityPower);
18822052
1883
- panel.add(new JSeparator());
2053
+ panel.add(GetSeparator());
18842054
18852055 panel.add(textureSection);
18862056
....@@ -1945,8 +2115,9 @@
19452115 // 3D models
19462116 if (filename.endsWith(".3ds") || filename.endsWith(".3DS"))
19472117 {
1948
- lastConverter = new com.jmex.model.converters.MaxToJme();
1949
- LoadFile(filename, lastConverter);
2118
+ //lastConverter = new com.jmex.model.converters.MaxToJme();
2119
+ //LoadFile(filename, lastConverter);
2120
+ LoadObjFile(filename); // New 3ds loader
19502121 continue;
19512122 }
19522123 if (filename.endsWith(".dae") || filename.endsWith(".DAE"))
....@@ -2672,6 +2843,7 @@
26722843 LA.matXRotate(((Object3D) group.get(group.size() - 1)).toParent, -Math.PI / 2);
26732844 LA.matXRotate(((Object3D) group.get(group.size() - 1)).fromParent, Math.PI / 2);
26742845 }
2846
+
26752847 //cJME.count++;
26762848 //cJME.count %= 12;
26772849 if (gc)
....@@ -2855,6 +3027,7 @@
28553027 }
28563028 }
28573029 }
3030
+
28583031 cFileSystemPane FSPane;
28593032
28603033 void SetMaterial(cMaterial mat, Object3D.cVector2[] others)
....@@ -2864,7 +3037,7 @@
28643037
28653038 freezematerial = true;
28663039 colorField.setFloat(mat.color);
2867
- modulationField.setFloat(mat.modulation);
3040
+ saturationField.setFloat(mat.modulation);
28683041 metalnessField.setFloat(mat.metalness);
28693042 diffuseField.setFloat(mat.diffuse);
28703043 specularField.setFloat(mat.specular);
....@@ -2908,6 +3081,7 @@
29083081 }
29093082 }
29103083 }
3084
+
29113085 freezematerial = false;
29123086 }
29133087
....@@ -3174,8 +3348,9 @@
31743348 } else if (event.getSource() == liveCB)
31753349 {
31763350 copy.live ^= true;
3351
+ objEditor.refreshContents(true); // To show item colors
31773352 return;
3178
- } else if (event.getSource() == selectCB)
3353
+ } else if (event.getSource() == selectableCB)
31793354 {
31803355 copy.dontselect ^= true;
31813356 return;
....@@ -3183,7 +3358,7 @@
31833358 {
31843359 copy.hide ^= true;
31853360 copy.Touch(); // display list issue
3186
- objEditor.refreshContents();
3361
+ objEditor.refreshContents(true); // To show item colors
31873362 return;
31883363 } else if (event.getSource() == link2masterCB)
31893364 {
....@@ -3360,9 +3535,9 @@
33603535 {
33613536 Close();
33623537 //return true;
3363
- } else if (source == loadItem)
3538
+ } else if (source == openItem)
33643539 {
3365
- load();
3540
+ Open();
33663541 //return true;
33673542 } else if (source == newItem)
33683543 {
....@@ -3387,6 +3562,10 @@
33873562 {
33883563 generatePOV();
33893564 //return true;
3565
+ } else if (event.getSource() == archiveItem)
3566
+ {
3567
+ cTools.Archive(frame);
3568
+ return;
33903569 } else if (source == zBufferItem)
33913570 {
33923571 try
....@@ -3435,11 +3614,12 @@
34353614
34363615 static public byte[] Compress(Object3D o)
34373616 {
3617
+ // Slower to actually compress.
34383618 try
34393619 {
34403620 ByteArrayOutputStream baos = new ByteArrayOutputStream();
3441
- java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(baos);
3442
- ObjectOutputStream out = new ObjectOutputStream(zstream);
3621
+// java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(baos);
3622
+ ObjectOutputStream out = new ObjectOutputStream(baos); //zstream);
34433623
34443624 Object3D parent = o.parent;
34453625 o.parent = null;
....@@ -3450,10 +3630,14 @@
34503630
34513631 out.flush();
34523632
3453
- zstream.close();
3633
+ baos //zstream
3634
+ .close();
34543635 out.close();
34553636
3456
- return baos.toByteArray();
3637
+ byte[] bytes = baos.toByteArray();
3638
+
3639
+ System.out.println("save #bytes = " + bytes.length);
3640
+ return bytes;
34573641 } catch (Exception e)
34583642 {
34593643 System.err.println(e);
....@@ -3463,13 +3647,16 @@
34633647
34643648 static public Object Uncompress(byte[] bytes)
34653649 {
3466
- System.out.println("#bytes = " + bytes.length);
3650
+ System.out.println("restore #bytes = " + bytes.length);
34673651 try
34683652 {
34693653 ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
3470
- java.util.zip.GZIPInputStream istream = new java.util.zip.GZIPInputStream(bais);
3471
- ObjectInputStream in = new ObjectInputStream(istream);
3654
+ //java.util.zip.GZIPInputStream istream = new java.util.zip.GZIPInputStream(bais);
3655
+ ObjectInputStream in = new ObjectInputStream(bais); // istream);
34723656 Object obj = in.readObject();
3657
+
3658
+ bais //istream
3659
+ .close();
34733660 in.close();
34743661
34753662 return obj;
....@@ -3524,31 +3711,68 @@
35243711 return null;
35253712 }
35263713
3527
- java.util.Hashtable<java.util.UUID, Object3D> hashtable = new java.util.Hashtable<java.util.UUID, Object3D>();
35283714
35293715 public void Save()
35303716 {
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
+ {
35313742 System.err.println("Save");
3743
+ Replace();
35323744
35333745 cRadio tab = GetCurrentTab();
35343746
3535
- boolean temp = CameraPane.SWITCH;
3536
- CameraPane.SWITCH = false;
3747
+ Object3D compress = CompressCopy(); // Saved version. No need for "Replace".
35373748
3538
- 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
+// }
35393755
35403756 //EditorFrame.m_MainFrame.requestFocusInWindow();
3541
- 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
+ }
35423767
3543
- copy.RestoreBigData(hashtable);
3768
+ //copy.RestoreBigData(versiontable);
35443769
3545
- CameraPane.SWITCH = temp;
3546
-
35473770 //assert(hashtable.isEmpty());
35483771
3549
- for (int i = tab.undoindex; i < tab.graphs.length; i++)
3772
+ for (int i = copy.versionindex+1; i < copy.versionlist.length; i++)
35503773 {
3551
- tab.graphs[i] = null;
3774
+ //tab.user[i] = false;
3775
+ copy.versionlist[i] = null;
35523776 }
35533777
35543778 SetUndoStates();
....@@ -3558,7 +3782,7 @@
35583782 {
35593783 try
35603784 {
3561
- FileOutputStream ostream = new FileOutputStream("save" + tab.undoindex);
3785
+ FileOutputStream ostream = new FileOutputStream("save" + copy.versionindex);
35623786 ObjectOutputStream p = new ObjectOutputStream(ostream);
35633787
35643788 p.writeObject(copy);
....@@ -3571,6 +3795,40 @@
35713795 e.printStackTrace();
35723796 }
35733797 }
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);
35743832 }
35753833
35763834 void CopyChanged(Object3D obj)
....@@ -3580,19 +3838,23 @@
35803838 boolean temp = CameraPane.SWITCH;
35813839 CameraPane.SWITCH = false;
35823840
3583
- copy.ExtractBigData(hashtable);
3841
+ copy.ExtractBigData(versiontable);
35843842
35853843 copy.clear();
35863844
3845
+ copy.skyboxname = obj.skyboxname;
3846
+ copy.skyboxext = obj.skyboxext;
3847
+
35873848 for (int i=0; i<obj.Size(); i++)
35883849 {
35893850 copy.add(obj.get(i));
35903851 }
35913852
3592
- copy.RestoreBigData(hashtable);
3853
+ copy.RestoreBigData(versiontable);
35933854
35943855 CameraPane.SWITCH = temp;
35953856
3857
+ RefreshSelection();
35963858 //assert(hashtable.isEmpty());
35973859
35983860 copy.Touch();
....@@ -3617,52 +3879,130 @@
36173879 }
36183880
36193881 cButton undoButton;
3882
+ cButton restoreButton;
3883
+ cButton replaceButton;
36203884 cButton redoButton;
36213885
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
+
36223901 void SetUndoStates()
36233902 {
36243903 cRadio tab = GetCurrentTab();
36253904
3626
- undoButton.setEnabled(tab.undoindex > 0);
3627
- 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;
36283915 }
36293916
3630
- public void Undo()
3917
+ public boolean Undo()
36313918 {
3919
+ // Option?
3920
+ Replace();
3921
+
36323922 System.err.println("Undo");
36333923
36343924 cRadio tab = GetCurrentTab();
36353925
3636
- if (tab.undoindex == 0)
3926
+ if (copy.versionindex == 0)
36373927 {
36383928 java.awt.Toolkit.getDefaultToolkit().beep();
3639
- return;
3929
+ return false;
36403930 }
36413931
3642
- 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)
36433959 {
3644
- Save();
3645
- tab.undoindex -= 1;
3960
+ java.awt.Toolkit.getDefaultToolkit().beep();
3961
+ return false;
36463962 }
36473963
3648
- tab.undoindex -= 1;
3964
+ //CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex]));
3965
+ CopyChanged(copy.versionlist[copy.versionindex]);
3966
+
3967
+ return true;
3968
+ }
36493969
3650
- 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;
36513985 }
36523986
36533987 public void Redo()
36543988 {
3989
+ // Option?
3990
+ Replace();
3991
+
36553992 cRadio tab = GetCurrentTab();
36563993
3657
- if (tab.graphs[tab.undoindex + 1] == null)
3994
+ if (copy.versionlist[copy.versionindex + 1] == null)
36583995 {
36593996 java.awt.Toolkit.getDefaultToolkit().beep();
36603997 return;
36613998 }
36623999
3663
- tab.undoindex += 1;
4000
+ copy.versionindex += 1;
36644001
3665
- 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;
36664006 }
36674007
36684008 void ImportGFD()
....@@ -3873,7 +4213,7 @@
38734213 //copy.material = new cMaterial(copy.GetMaterial());
38744214
38754215 current.color = (float) colorField.getFloat();
3876
- current.modulation = (float) modulationField.getFloat();
4216
+ current.modulation = (float) saturationField.getFloat();
38774217 current.metalness = (float) metalnessField.getFloat();
38784218 current.diffuse = (float) diffuseField.getFloat();
38794219 current.specular = (float) specularField.getFloat();
....@@ -3906,7 +4246,7 @@
39064246 cMaterial mat = copy.material;
39074247
39084248 colorField.SetToolTipValue((mat.color));
3909
- modulationField.SetToolTipValue((mat.modulation));
4249
+ saturationField.SetToolTipValue((mat.modulation));
39104250 metalnessField.SetToolTipValue((mat.metalness));
39114251 diffuseField.SetToolTipValue((mat.diffuse));
39124252 specularField.SetToolTipValue((mat.specular));
....@@ -3958,9 +4298,25 @@
39584298 //copy.Touch();
39594299 }
39604300
4301
+ cNumberSlider versionSlider;
4302
+
39614303 public void stateChanged(ChangeEvent e)
39624304 {
39634305 // 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
+ }
39644320
39654321 if (freezematerial)
39664322 {
....@@ -3996,6 +4352,12 @@
39964352 {
39974353 //System.out.println("stateChanged = " + this);
39984354 materialtouched = true;
4355
+
4356
+ if (e.getSource() == colorField && saturationField.getFloat() == 0.001)
4357
+ {
4358
+ saturationField.setFloat(1);
4359
+ }
4360
+
39994361 applySelf();
40004362 //System.out.println("this = " + this);
40014363 //System.out.println("PARENT = " + parent);
....@@ -4295,6 +4657,7 @@
42954657 {
42964658 if (GetTree() != null)
42974659 {
4660
+ GetTree().revalidate();
42984661 GetTree().repaint();
42994662 }
43004663
....@@ -4309,7 +4672,7 @@
43094672
43104673 void makeSomething(Object3D thing, boolean resetmodel) // deselect)
43114674 {
4312
- if (Globals.SAVEONMAKE) // && resetmodel)
4675
+ if (Globals.REPLACEONMAKE) // && resetmodel)
43134676 Save();
43144677 //Tween.set(thing, 0).target(1).start(tweenManager);
43154678 //Tween.to(thing, 0, 0.5f).target(0).start(tweenManager);
....@@ -4551,7 +4914,9 @@
45514914 readobj.ResetDisplayList();
45524915 } catch (Exception e)
45534916 {
4554
- //e.printStackTrace();
4917
+ if (!e.toString().contains("GZIP"))
4918
+ e.printStackTrace();
4919
+
45554920 try
45564921 {
45574922 java.io.FileInputStream istream = new java.io.FileInputStream(fullname);
....@@ -4625,12 +4990,14 @@
46254990
46264991 if (readobj != null)
46274992 {
4628
- if (Globals.SAVEONMAKE)
4629
- Save();
4993
+ //if (Globals.SAVEONMAKE) // A new object cannot share meshes
4994
+ // Save();
46304995 try
46314996 {
46324997 //readobj.deepCopySelf(copy);
46334998 copy.clear(); // june 2014
4999
+ copy.skyboxname = readobj.skyboxname;
5000
+ copy.skyboxext = readobj.skyboxext;
46345001 for (int i = 0; i < readobj.size(); i++)
46355002 {
46365003 Object3D child = readobj.get(i); // reserve(i);
....@@ -4671,6 +5038,7 @@
46715038 }
46725039 } catch (ClassCastException e)
46735040 {
5041
+ e.printStackTrace();
46745042 assert (false);
46755043 Composite c = (Composite) copy;
46765044 c.children.clear();
....@@ -4681,13 +5049,24 @@
46815049 c.addChild(csg);
46825050 }
46835051
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
+
46845063 ResetModel();
46855064 copy.HardTouch(); // recompile?
46865065 refreshContents();
46875066 }
46885067 }
46895068
4690
- void load() // throws ClassNotFoundException
5069
+ void Open() // throws ClassNotFoundException
46915070 {
46925071 if (Grafreed.standAlone)
46935072 {
....@@ -4790,6 +5169,7 @@
47905169 //ps.print(buffer.toString());
47915170 } catch (IOException e)
47925171 {
5172
+ e.printStackTrace();
47935173 }
47945174 }
47955175
....@@ -4972,7 +5352,7 @@
49725352 MenuBar menuBar;
49735353 Menu fileMenu;
49745354 MenuItem newItem;
4975
- MenuItem loadItem;
5355
+ MenuItem openItem;
49765356 MenuItem saveItem;
49775357 MenuItem saveAsItem;
49785358 MenuItem exportAsItem;
....@@ -4995,6 +5375,7 @@
49955375 CheckboxMenuItem toggleSwitchItem;
49965376 CheckboxMenuItem toggleRootItem;
49975377 CheckboxMenuItem animationItem;
5378
+ MenuItem archiveItem;
49985379 CheckboxMenuItem toggleHandleItem;
49995380 CheckboxMenuItem togglePaintItem;
50005381 JSplitPane mainPanel;
....@@ -5081,7 +5462,7 @@
50815462 JLabel colorLabel;
50825463 cNumberSlider colorField;
50835464 JLabel modulationLabel;
5084
- cNumberSlider modulationField;
5465
+ cNumberSlider saturationField;
50855466 JLabel metalnessLabel;
50865467 cNumberSlider metalnessField;
50875468 JLabel diffuseLabel;