Normand Briere
2019-08-01 c49ad213b600f844e9070cb09390c3e6d3d13db4
ObjEditor.java
....@@ -4,6 +4,7 @@
44
55 import java.awt.*;
66 import java.awt.event.*;
7
+import java.awt.image.BufferedImage;
78 import javax.swing.*;
89 import javax.swing.event.*;
910 import javax.swing.text.*;
....@@ -13,6 +14,9 @@
1314 import javax.swing.plaf.metal.MetalLookAndFeel;
1415 //import javax.swing.plaf.ColorUIResource;
1516 //import javax.swing.plaf.metal.DefaultMetalTheme;
17
+
18
+import javax.swing.plaf.basic.BasicSplitPaneDivider;
19
+import javax.swing.plaf.basic.BasicSplitPaneUI;
1620
1721 //import javax.media.opengl.GLCanvas;
1822
....@@ -37,6 +41,79 @@
3741 JFrame frame;
3842
3943 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
+ }
52
+
53
+ cButton GetButton(String name, boolean border)
54
+ {
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);
63
+ }
64
+
65
+ cToggleButton GetToggleButton(String name, boolean border)
66
+ {
67
+ ImageIcon icon = GetIcon(name);
68
+ return new cToggleButton(icon, border);
69
+ }
70
+
71
+ cCheckBox GetCheckBox(String name, boolean border)
72
+ {
73
+ ImageIcon icon = GetIcon(name);
74
+ return new cCheckBox(icon, border);
75
+ }
76
+
77
+ ImageIcon GetIcon(String name)
78
+ {
79
+ try
80
+ {
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;
97
+ }
98
+ catch (Exception e)
99
+ {
100
+ return null;
101
+ }
102
+ }
103
+
104
+ BufferedImage GetImage(String name)
105
+ {
106
+ try
107
+ {
108
+ BufferedImage image = javax.imageio.ImageIO.read(getClass().getClassLoader().getResourceAsStream(name));
109
+
110
+ return image;
111
+ }
112
+ catch (Exception e)
113
+ {
114
+ return null;
115
+ }
116
+ }
40117
41118 // SCRIPT
42119
....@@ -147,7 +224,7 @@
147224
148225 objEditor.ctrlPanel.remove(namePanel);
149226
150
- if (!GroupEditor.allparams)
227
+ if (!allparams)
151228 return;
152229
153230 // objEditor.ctrlPanel.remove(liveCB);
....@@ -219,6 +296,12 @@
219296 client = inClient;
220297 copy = client;
221298
299
+ if (copy.versions == null)
300
+ {
301
+ copy.versions = new Object3D[100];
302
+ copy.versionindex = -1;
303
+ }
304
+
222305 // "this" is not called: SetupUI2(objEditor);
223306 }
224307
....@@ -232,6 +315,12 @@
232315 client = inClient;
233316 copy = client;
234317
318
+ if (copy.versions == null)
319
+ {
320
+ copy.versions = new Object3D[100];
321
+ copy.versionindex = -1;
322
+ }
323
+
235324 SetupUI2(callee.GetEditor());
236325 }
237326
....@@ -246,7 +335,7 @@
246335 //localCopy.parent = null;
247336
248337 frame = new JFrame();
249
- frame.setUndecorated(true);
338
+ frame.setUndecorated(false);
250339 objEditor = this;
251340 this.callee = callee;
252341
....@@ -264,6 +353,12 @@
264353 copy = localCopy;
265354 copy.editWindow = this;
266355
356
+ if (copy.versions == null)
357
+ {
358
+// copy.versions = new byte[100][];
359
+// copy.versionindex = -1;
360
+ }
361
+
267362 SetupMenu();
268363
269364 //SetupName(objEditor); // new
....@@ -277,12 +372,17 @@
277372 return frame.action(event, obj);
278373 }
279374
375
+ // Cannot work without static
376
+ static boolean allparams = true;
377
+
378
+ static java.util.Vector<Object3D> listUI = new java.util.Vector<Object3D>();
379
+
280380 void SetupMenu()
281381 {
282382 frame.setMenuBar(menuBar = new MenuBar());
283383 menuBar.add(fileMenu = new Menu("File"));
284384 fileMenu.add(newItem = new MenuItem("New"));
285
- fileMenu.add(loadItem = new MenuItem("Open..."));
385
+ fileMenu.add(openItem = new MenuItem("Open..."));
286386
287387 //oe.menuBar.add(menu = new Menu("Include"));
288388 Menu menu = new Menu("Import");
....@@ -314,7 +414,7 @@
314414 }
315415
316416 newItem.addActionListener(this);
317
- loadItem.addActionListener(this);
417
+ openItem.addActionListener(this);
318418 saveItem.addActionListener(this);
319419 saveAsItem.addActionListener(this);
320420 exportAsItem.addActionListener(this);
....@@ -323,13 +423,40 @@
323423 closeItem.addActionListener(this);
324424
325425 objectPanel = new JTabbedPane();
426
+
427
+ ChangeListener changeListener = new ChangeListener()
428
+ {
429
+ public void stateChanged(ChangeEvent changeEvent)
430
+ {
431
+// if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Material") && !materialFlushed)
432
+// {
433
+// if (latestObject != null)
434
+// {
435
+// refreshContents(true);
436
+// SetMaterial(latestObject);
437
+// }
438
+//
439
+// materialFlushed = true;
440
+// }
441
+// if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Edit"))
442
+// {
443
+// if (listUI.size() == 0)
444
+// EditSelection(false);
445
+// }
446
+
447
+ refreshContents(false); // To refresh Info tab
448
+ }
449
+ };
450
+ objectPanel.addChangeListener(changeListener);
451
+
326452 toolbarPanel = new JPanel();
327453 toolbarPanel.setName("Toolbar");
454
+
328455 treePanel = new cGridBag();
329456 treePanel.setName("Tree");
330457
331458 editPanel = new cGridBag().setVertical(true);
332
- editPanel.setName("Edit");
459
+ //editPanel.setName("Edit");
333460
334461 ctrlPanel = new cGridBag().setVertical(false); // new GridBagLayout());
335462
....@@ -337,23 +464,27 @@
337464 editPanel.add(editCommandsPanel);
338465 editPanel.add(ctrlPanel);
339466
340
- materialPanel = new cGridBag().setVertical(true);
467
+ toolboxPanel = new cGridBag().setVertical(true);
468
+ //toolboxPanel.setName("Toolbox");
341469
342
- materialPanel.setName("Material");
470
+ materialPanel = new cGridBag().setVertical(true);
471
+ //materialPanel.setName("Material");
472
+
343473 /*JTextPane*/
344474 infoarea = createTextPane();
345475 doc = infoarea.getStyledDocument();
346476
347477 infoarea.setEditable(true);
348478 SetText();
479
+
349480 // infoarea.setFont(infoarea.getFont().deriveFont(10, 14f));
350481 // infoarea.setOpaque(false);
351482 // //infoarea.setForeground(textcolor);
352483 // TEXTAREA infoarea.setLineWrap(true);
353484 // TEXTAREA infoarea.setWrapStyleWord(true);
354485 infoPanel = new JScrollPane(infoarea, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); //AS_NEEDED);
355
- infoPanel.setPreferredSize(new Dimension(50, 200));
356
- infoPanel.setName("Info");
486
+ infoPanel.setPreferredSize(new Dimension(1, 1));
487
+ //infoPanel.setName("Info");
357488 //infoPanel.setLayout(new BorderLayout());
358489 //infoPanel.add(createTextPane());
359490
....@@ -364,7 +495,14 @@
364495 mainPanel.setDividerSize(9);
365496 mainPanel.setDividerLocation(0.5); //1.0);
366497 mainPanel.setResizeWeight(0.5);
367
-
498
+
499
+//mainPanel.setDividerSize((int) (mainPanel.getDividerSize() * 1.5));
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!"));
503
+
504
+ mainPanel.setUI(new BasicSplitPaneUI());
505
+
368506 //ctrlPanel.setLayout(new GridLayout(4, 1, 5, 5));
369507 //mainPanel.setLayout(new GridBagLayout());
370508 toolbarPanel.setLayout(new FlowLayout(FlowLayout.LEFT));
....@@ -595,8 +733,8 @@
595733 }
596734 }
597735
598
-static GraphicsDevice device = GraphicsEnvironment
599
- .getLocalGraphicsEnvironment().getScreenDevices()[0];
736
+//static GraphicsDevice device = GraphicsEnvironment
737
+// .getLocalGraphicsEnvironment().getScreenDevices()[0];
600738
601739 Rectangle keeprect;
602740 cRadio radio;
....@@ -612,13 +750,24 @@
612750
613751 boolean maximized;
614752
753
+ cButton fullscreenLayout;
754
+
615755 void Minimize()
616756 {
617757 frame.setState(Frame.ICONIFIED);
758
+ frame.validate();
618759 }
619760
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={}
620764 void Maximize()
621765 {
766
+ if (CameraPane.FULLSCREEN)
767
+ {
768
+ ToggleFullScreen();
769
+ }
770
+
622771 if (maximized)
623772 {
624773 frame.setBounds(keeprect.x, keeprect.y, keeprect.width, keeprect.height);
....@@ -626,20 +775,36 @@
626775 else
627776 {
628777 keeprect = frame.getBounds();
629
- Rectangle rect = GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds();
630
- Dimension rect2 = frame.getToolkit().getScreenSize();
631
- 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);
632781 // frame.setState(Frame.MAXIMIZED_BOTH);
782
+ frame.setBounds(frame.getGraphicsConfiguration().getBounds());
633783 }
634784
635785 maximized ^= true;
786
+
787
+ frame.validate();
636788 }
789
+
790
+ cButton minButton;
791
+ cButton maxButton;
792
+ cButton fullButton;
637793
638794 void ToggleFullScreen()
639795 {
640
- if (CameraPane.FULLSCREEN)
796
+GraphicsDevice device = frame.getGraphicsConfiguration().getDevice();
797
+
798
+ cameraView.ToggleFullScreen();
799
+
800
+ if (!CameraPane.FULLSCREEN)
641801 {
642802 device.setFullScreenWindow(null);
803
+ frame.dispose();
804
+ frame.setUndecorated(false);
805
+ frame.validate();
806
+ frame.setVisible(true);
807
+
643808 //frame.setVisible(false);
644809 // frame.removeNotify();
645810 // frame.setUndecorated(false);
....@@ -649,7 +814,7 @@
649814 // X frame.getContentPane().remove(/*"Center",*/bigThree);
650815 // X framePanel.add(bigThree);
651816 // X frame.getContentPane().add(/*"Center",*/framePanel);
652
- framePanel.setDividerLocation(1);
817
+ framePanel.setDividerLocation(46);
653818
654819 //frame.setVisible(true);
655820 radio.layout = keepButton;
....@@ -664,7 +829,12 @@
664829 // frame.setBounds(0, 0, frame.getToolkit().getScreenSize().width,
665830 // frame.getToolkit().getScreenSize().height);
666831 //frame.setVisible(false);
832
+
833
+ frame.dispose();
834
+ frame.setUndecorated(true);
667835 device.setFullScreenWindow(frame);
836
+ frame.validate();
837
+ frame.setVisible(true);
668838 // frame.removeNotify();
669839 // frame.setUndecorated(true);
670840 // frame.addNotify();
....@@ -673,13 +843,35 @@
673843 // X frame.getContentPane().add(/*"Center",*/bigThree);
674844 framePanel.setDividerLocation(0);
675845
676
- radio.layout = twoButton;
846
+ radio.layout = fullscreenLayout;
677847 radio.layout.doClick();
678848 //frame.setVisible(true);
679849 }
680
-
681
- cameraView.ToggleFullScreen();
850
+ frame.validate();
682851 }
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.versions;
862
+ copy.versions = null;
863
+
864
+ //byte[] compress = Compress(copy);
865
+ Object3D compress = (Object3D)Grafreed.clone(copy);
866
+
867
+ copy.versions = versions;
868
+
869
+ copy.RestoreBigData(versiontable);
870
+
871
+ CameraPane.SWITCH = temp;
872
+
873
+ return compress;
874
+ }
683875
684876 private JTextPane createTextPane()
685877 {
....@@ -811,7 +1003,7 @@
8111003 // NumberSlider vDivsField;
8121004 // JCheckBox endcaps;
8131005 JCheckBox liveCB;
814
- JCheckBox selectCB;
1006
+ JCheckBox selectableCB;
8151007 JCheckBox hideCB;
8161008 JCheckBox link2masterCB;
8171009 JCheckBox markCB;
....@@ -819,7 +1011,12 @@
8191011 JCheckBox speedupCB;
8201012 JCheckBox rewindCB;
8211013 JCheckBox flipVCB;
1014
+
1015
+ cCheckBox toggleTextureCB;
1016
+ cCheckBox toggleSwitchCB;
1017
+
8221018 JComboBox texresMenu;
1019
+
8231020 JButton resetButton;
8241021 JButton stepButton;
8251022 JButton stepAllButton;
....@@ -1006,38 +1203,42 @@
10061203 namePanel = new cGridBag();
10071204
10081205 nameField = AddText(namePanel, copy.GetName());
1009
- namePanel.add(nameField);
1206
+ namePanel.add(new JScrollPane(nameField, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER));
10101207 oe.ctrlPanel.add(namePanel);
10111208
10121209 oe.ctrlPanel.Return();
10131210
1014
- if (!GroupEditor.allparams)
1211
+ if (!allparams)
10151212 return;
10161213
10171214 setupPanel = new cGridBag().setVertical(false);
10181215
10191216 liveCB = AddCheckBox(setupPanel, "Live", copy.live);
10201217 liveCB.setToolTipText("Animate object");
1021
- selectCB = AddCheckBox(setupPanel, "Select", !copy.dontselect);
1022
- selectCB.setToolTipText("Make object selectable");
1218
+ selectableCB = AddCheckBox(setupPanel, "Select", !copy.dontselect);
1219
+ selectableCB.setToolTipText("Make object selectable");
10231220 // Return();
1221
+
10241222 hideCB = AddCheckBox(setupPanel, "Hide", copy.hide);
10251223 hideCB.setToolTipText("Hide object");
10261224 markCB = AddCheckBox(setupPanel, "Mark", copy.marked);
1027
- markCB.setToolTipText("Set the animation target transform");
1225
+ markCB.setToolTipText("As animation target transform");
1226
+
1227
+ ToolTipManager.sharedInstance().setLightWeightPopupEnabled(false);
10281228
10291229 setupPanel2 = new cGridBag().setVertical(false);
10301230
10311231 rewindCB = AddCheckBox(setupPanel2, "Rewind", copy.rewind);
10321232 rewindCB.setToolTipText("Rewind animation");
10331233
1034
- randomCB = AddCheckBox(setupPanel2, "Rand", copy.random);
1035
- randomCB.setToolTipText("Randomly Rewind or Go back and forth");
1234
+ randomCB = AddCheckBox(setupPanel2, "Random", copy.random);
1235
+ randomCB.setToolTipText("Randomly Rewind (or Go back and forth)");
10361236
1237
+ link2masterCB = AddCheckBox(setupPanel2, "Support", copy.link2master);
1238
+ link2masterCB.setToolTipText("Attach to support");
1239
+
10371240 if (Globals.ADVANCED)
10381241 {
1039
- link2masterCB = AddCheckBox(setupPanel2, "Supp", copy.link2master);
1040
- link2masterCB.setToolTipText("Attach to support");
10411242 speedupCB = AddCheckBox(setupPanel2, "Speed", copy.speedup);
10421243 speedupCB.setToolTipText("Option motion capture");
10431244 }
....@@ -1311,6 +1512,7 @@
13111512 XYZPanel.addComponent(/*BorderLayout.SOUTH,*/sideView); // Scroll);
13121513 XYZPanel.addComponent(/*BorderLayout.CENTER,*/frontView); // Scroll);
13131514 XYZPanel.addComponent(/*BorderLayout.NORTH,*/topView); // Scroll);
1515
+ //XYZPanel.setName("XYZ");
13141516
13151517 /*
13161518 gridPanel = new JPanel(); //new BorderLayout());
....@@ -1348,12 +1550,29 @@
13481550 //JScrollPane tmp = new JScrollPane(ctrlPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
13491551 //tmp.setName("Edit");
13501552 objectPanel.add(materialPanel);
1553
+ objectPanel.setIconAt(0, GetIcon("icons/material.png"));
1554
+ objectPanel.setToolTipTextAt(0, "Material panel");
1555
+
13511556 // JPanel north = new JPanel(new BorderLayout());
13521557 // north.setName("Edit");
13531558 // north.add(ctrlPanel, BorderLayout.NORTH);
13541559 // objectPanel.add(north);
13551560 objectPanel.add(editPanel);
1356
- objectPanel.add(infoPanel);
1561
+ objectPanel.setIconAt(1, GetIcon("icons/write.png"));
1562
+ objectPanel.setToolTipTextAt(1, "Edit panel");
1563
+
1564
+ //if (Globals.ADVANCED)
1565
+ objectPanel.add(infoPanel);
1566
+ objectPanel.setIconAt(2, GetIcon("icons/info.png"));
1567
+ objectPanel.setToolTipTextAt(2, "Info panel");
1568
+
1569
+ objectPanel.add(XYZPanel);
1570
+ objectPanel.setIconAt(3, GetIcon("icons/XYZ.png"));
1571
+ objectPanel.setToolTipTextAt(3, "XYZ/RGB panel");
1572
+
1573
+ objectPanel.add(toolboxPanel);
1574
+ objectPanel.setIconAt(4, GetIcon("icons/primitives.png"));
1575
+ objectPanel.setToolTipTextAt(4, "Objects/backgrounds panel");
13571576
13581577 /*
13591578 aConstraints.gridx = 0;
....@@ -1362,7 +1581,7 @@
13621581 aConstraints.gridy += 1;
13631582 aConstraints.gridwidth = 1;
13641583 mainPanel.add(objectPanel, aConstraints);
1365
- */
1584
+ */
13661585
13671586 scrollpane = new JScrollPane(mainPanel, ScrollPaneConstants.// VERTICAL_SCROLLBAR_ALWAYS,
13681587 VERTICAL_SCROLLBAR_AS_NEEDED,
....@@ -1374,14 +1593,12 @@
13741593 scrollpane.addMouseWheelListener(this); // Default not fast enough
13751594
13761595 /*JTabbedPane*/ scenePanel = new cGridBag();
1377
- scenePanel.preferredWidth = 6;
1596
+ scenePanel.preferredWidth = 5;
13781597
13791598 JTabbedPane tabbedPane = new JTabbedPane();
13801599 tabbedPane.add(scrollpane);
13811600
1382
- tabbedPane.add(FSPane = new cFileSystemPane(this));
1383
-
1384
- optionsPanel = new cGridBag().setVertical(true);
1601
+ optionsPanel = new cGridBag().setVertical(false);
13851602
13861603 optionsPanel.setName("Options");
13871604
....@@ -1389,6 +1606,8 @@
13891606
13901607 tabbedPane.add(optionsPanel);
13911608
1609
+ tabbedPane.add(FSPane = new cFileSystemPane(this));
1610
+
13921611 scenePanel.add(tabbedPane);
13931612
13941613 /*
....@@ -1452,7 +1671,7 @@
14521671 bigThree = new cGridBag();
14531672 bigThree.addComponent(scenePanel);
14541673 bigThree.addComponent(centralPanel);
1455
- bigThree.addComponent(XYZPanel);
1674
+ //bigThree.addComponent(XYZPanel);
14561675
14571676 // // SIDE EFFECT!!!
14581677 // aConstraints.gridx = 0;
....@@ -1461,9 +1680,9 @@
14611680 // aConstraints.gridheight = 1;
14621681
14631682 framePanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, toolbarPanel, bigThree);
1464
- framePanel.setContinuousLayout(true);
1465
- framePanel.setOneTouchExpandable(true);
1466
- framePanel.setDividerLocation(0.8);
1683
+ framePanel.setContinuousLayout(false);
1684
+ framePanel.setOneTouchExpandable(false);
1685
+ //.setDividerLocation(0.8);
14671686 //framePanel.setDividerSize(15);
14681687 //framePanel.setResizeWeight(0.15);
14691688 framePanel.setName("Frame");
....@@ -1481,16 +1700,18 @@
14811700 // aConstraints = gbc; // (GridBagConstraints) GrafreeD.clone(gbc);
14821701
14831702 frame.setSize(1280, 860);
1484
- frame.setVisible(true);
1485
-
1703
+
14861704 cameraView.requestFocusInWindow();
14871705
14881706 gridPanel.setDividerLocation(1.0);
1707
+
1708
+ frame.validate();
1709
+
1710
+ frame.setVisible(true);
14891711
14901712 frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
14911713 frame.addWindowListener(new WindowAdapter()
14921714 {
1493
-
14941715 public void windowClosing(WindowEvent e)
14951716 {
14961717 Close();
....@@ -1552,45 +1773,48 @@
15521773 //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
15531774
15541775 cGridBag colorSection = new cGridBag().setVertical(true);
1776
+
1777
+ cGridBag huepanel = new cGridBag();
1778
+ cGridBag huelabel = new cGridBag();
1779
+ huelabel.add(GetLabel("icons/hue.png", false));
1780
+ huelabel.preferredWidth = 20;
1781
+ huepanel.add(new cGridBag()); // Label
1782
+ huepanel.add(huelabel); // Field/slider
1783
+
1784
+ huepanel.preferredHeight = 7;
1785
+
1786
+ colorSection.add(huepanel);
15551787
15561788 cGridBag color = new cGridBag();
1557
- color.add(colorLabel = new JLabel("Color/hue")); // , aConstraints);
1558
- colorLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1559
- color.add(colorField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1789
+
1790
+ color.add(colorLabel = new JLabel("Color/hue")); // , aConstraints);
1791
+ colorLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1792
+ color.add(colorField = new cNumberSlider(this, 0.001, 1)); // , aConstraints);
1793
+
15601794 //colorField.preferredWidth = 200;
15611795 colorSection.add(color);
15621796
15631797 cGridBag modulation = new cGridBag();
15641798 modulation.add(modulationLabel = new JLabel("Saturation")); // , aConstraints);
15651799 modulationLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1566
- modulation.add(modulationField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1800
+ modulation.add(modulationField = new cNumberSlider(this, 0.001, 1)); // , aConstraints);
15671801 colorSection.add(modulation);
15681802
1803
+ cGridBag opacity = new cGridBag();
1804
+ opacity.add(opacityLabel = new JLabel("Opacity")); // , aConstraints);
1805
+ opacityLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1806
+ opacity.add(opacityField = new cNumberSlider(this, 0.001, 1)); // , aConstraints);
1807
+ colorSection.add(opacity);
1808
+
1809
+ colorSection.add(GetSeparator());
1810
+
15691811 cGridBag texture = new cGridBag();
15701812 texture.add(textureLabel = new JLabel("Texture")); // , aConstraints);
15711813 textureLabel.setHorizontalAlignment(SwingConstants.TRAILING);
15721814 texture.add(textureField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
15731815 colorSection.add(texture);
15741816
1575
- cGridBag anisoU = new cGridBag();
1576
- anisoU.add(anisoLabel = new JLabel("AnisoU")); // , aConstraints);
1577
- anisoLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1578
- anisoU.add(anisoField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1579
- colorSection.add(anisoU);
1580
-
1581
- cGridBag anisoV = new cGridBag();
1582
- anisoV.add(anisoVLabel = new JLabel("AnisoV")); // , aConstraints);
1583
- anisoVLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1584
- anisoV.add(anisoVField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1585
- colorSection.add(anisoV);
1586
-
1587
- cGridBag shadowbias = new cGridBag();
1588
- shadowbias.add(shadowbiasLabel = new JLabel("Shadowbias")); // , aConstraints);
1589
- shadowbiasLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1590
- shadowbias.add(shadowbiasField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1591
- colorSection.add(shadowbias);
1592
-
1593
- panel.add(new JSeparator());
1817
+ panel.add(GetSeparator());
15941818
15951819 panel.add(colorSection);
15961820
....@@ -1640,7 +1864,13 @@
16401864 fakedepth.add(fakedepthField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
16411865 diffuseSection.add(fakedepth);
16421866
1643
- panel.add(new JSeparator());
1867
+ cGridBag shadowbias = new cGridBag();
1868
+ shadowbias.add(shadowbiasLabel = new JLabel("Shadowbias")); // , aConstraints);
1869
+ shadowbiasLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1870
+ shadowbias.add(shadowbiasField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1871
+ diffuseSection.add(shadowbias);
1872
+
1873
+ panel.add(GetSeparator());
16441874
16451875 panel.add(diffuseSection);
16461876
....@@ -1690,42 +1920,48 @@
16901920 // aConstraints.gridy += 1;
16911921 // aConstraints.gridwidth = 1;
16921922
1923
+ cGridBag anisoU = new cGridBag();
1924
+ anisoU.add(anisoLabel = new JLabel("AnisoU")); // , aConstraints);
1925
+ anisoLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1926
+ anisoU.add(anisoField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1927
+ specularSection.add(anisoU);
16931928
1694
- panel.add(new JSeparator());
1929
+ cGridBag anisoV = new cGridBag();
1930
+ anisoV.add(anisoVLabel = new JLabel("AnisoV")); // , aConstraints);
1931
+ anisoVLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1932
+ anisoV.add(anisoVField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1933
+ specularSection.add(anisoV);
1934
+
1935
+
1936
+ panel.add(GetSeparator());
16951937
16961938 panel.add(specularSection);
16971939
16981940 //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
16991941
1700
- cGridBag globalSection = new cGridBag().setVertical(true);
1942
+ //cGridBag globalSection = new cGridBag().setVertical(true);
17011943
17021944 cGridBag camera = new cGridBag();
17031945 camera.add(cameraLabel = new JLabel("GlobalLight")); // , aConstraints);
17041946 cameraLabel.setHorizontalAlignment(SwingConstants.TRAILING);
17051947 camera.add(cameraField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1706
- globalSection.add(camera);
1948
+ colorSection.add(camera);
17071949
17081950 cGridBag ambient = new cGridBag();
17091951 ambient.add(ambientLabel = new JLabel("Ambient")); // , aConstraints);
17101952 ambientLabel.setHorizontalAlignment(SwingConstants.TRAILING);
17111953 ambient.add(ambientField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1712
- globalSection.add(ambient);
1954
+ colorSection.add(ambient);
17131955
17141956 cGridBag backlit = new cGridBag();
17151957 backlit.add(backlitLabel = new JLabel("Backlit")); // , aConstraints);
17161958 backlitLabel.setHorizontalAlignment(SwingConstants.TRAILING);
17171959 backlit.add(backlitField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1718
- globalSection.add(backlit);
1960
+ colorSection.add(backlit);
17191961
1720
- cGridBag opacity = new cGridBag();
1721
- opacity.add(opacityLabel = new JLabel("Opacity")); // , aConstraints);
1722
- opacityLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1723
- opacity.add(opacityField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1724
- globalSection.add(opacity);
1725
-
1726
- panel.add(new JSeparator());
1962
+ //panel.add(new JSeparator());
17271963
1728
- panel.add(globalSection);
1964
+ //panel.add(globalSection);
17291965
17301966 //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
17311967
....@@ -1767,7 +2003,7 @@
17672003 opacityPower.add(opacityPowerField = new cNumberSlider(this, 0.0, 10 /*10 dec 2013*/)); // , aConstraints);
17682004 textureSection.add(opacityPower);
17692005
1770
- panel.add(new JSeparator());
2006
+ panel.add(GetSeparator());
17712007
17722008 panel.add(textureSection);
17732009
....@@ -1832,8 +2068,9 @@
18322068 // 3D models
18332069 if (filename.endsWith(".3ds") || filename.endsWith(".3DS"))
18342070 {
1835
- lastConverter = new com.jmex.model.converters.MaxToJme();
1836
- LoadFile(filename, lastConverter);
2071
+ //lastConverter = new com.jmex.model.converters.MaxToJme();
2072
+ //LoadFile(filename, lastConverter);
2073
+ LoadObjFile(filename); // New 3ds loader
18372074 continue;
18382075 }
18392076 if (filename.endsWith(".dae") || filename.endsWith(".DAE"))
....@@ -2559,6 +2796,7 @@
25592796 LA.matXRotate(((Object3D) group.get(group.size() - 1)).toParent, -Math.PI / 2);
25602797 LA.matXRotate(((Object3D) group.get(group.size() - 1)).fromParent, Math.PI / 2);
25612798 }
2799
+
25622800 //cJME.count++;
25632801 //cJME.count %= 12;
25642802 if (gc)
....@@ -2742,6 +2980,7 @@
27422980 }
27432981 }
27442982 }
2983
+
27452984 cFileSystemPane FSPane;
27462985
27472986 void SetMaterial(cMaterial mat, Object3D.cVector2[] others)
....@@ -2795,11 +3034,14 @@
27953034 }
27963035 }
27973036 }
3037
+
27983038 freezematerial = false;
27993039 }
28003040
28013041 void SetMaterial(Object3D object)
28023042 {
3043
+ latestObject = object;
3044
+
28033045 cMaterial mat = object.material;
28043046
28053047 if (mat == null)
....@@ -2911,12 +3153,17 @@
29113153 // }
29123154
29133155 /**/
2914
- if (deselect)
3156
+ if (deselect || child == null)
29153157 {
29163158 //group.deselectAll();
29173159 //freeze = true;
29183160 GetTree().clearSelection();
29193161 //freeze = false;
3162
+
3163
+ if (child == null)
3164
+ {
3165
+ return;
3166
+ }
29203167 }
29213168
29223169 //group.addSelectee(child);
....@@ -2985,7 +3232,7 @@
29853232 cameraView.ToggleDL();
29863233 cameraView.repaint();
29873234 return;
2988
- } else if (event.getSource() == toggleTextureItem)
3235
+ } else if (event.getSource() == toggleTextureItem || event.getSource() == toggleTextureCB)
29893236 {
29903237 cameraView.ToggleTexture();
29913238 // june 2013 copy.HardTouch();
....@@ -3024,7 +3271,7 @@
30243271 frame.validate();
30253272
30263273 return;
3027
- } else if (event.getSource() == toggleSwitchItem)
3274
+ } else if (event.getSource() == toggleSwitchItem || event.getSource() == toggleSwitchCB)
30283275 {
30293276 cameraView.ToggleSwitch();
30303277 cameraView.repaint();
....@@ -3055,7 +3302,7 @@
30553302 {
30563303 copy.live ^= true;
30573304 return;
3058
- } else if (event.getSource() == selectCB)
3305
+ } else if (event.getSource() == selectableCB)
30593306 {
30603307 copy.dontselect ^= true;
30613308 return;
....@@ -3240,9 +3487,9 @@
32403487 {
32413488 Close();
32423489 //return true;
3243
- } else if (source == loadItem)
3490
+ } else if (source == openItem)
32443491 {
3245
- load();
3492
+ Open();
32463493 //return true;
32473494 } else if (source == newItem)
32483495 {
....@@ -3267,6 +3514,10 @@
32673514 {
32683515 generatePOV();
32693516 //return true;
3517
+ } else if (event.getSource() == archiveItem)
3518
+ {
3519
+ cTools.Archive(frame);
3520
+ return;
32703521 } else if (source == zBufferItem)
32713522 {
32723523 try
....@@ -3315,11 +3566,12 @@
33153566
33163567 static public byte[] Compress(Object3D o)
33173568 {
3569
+ // Slower to actually compress.
33183570 try
33193571 {
33203572 ByteArrayOutputStream baos = new ByteArrayOutputStream();
3321
- java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(baos);
3322
- ObjectOutputStream out = new ObjectOutputStream(zstream);
3573
+// java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(baos);
3574
+ ObjectOutputStream out = new ObjectOutputStream(baos); //zstream);
33233575
33243576 Object3D parent = o.parent;
33253577 o.parent = null;
....@@ -3330,10 +3582,14 @@
33303582
33313583 out.flush();
33323584
3333
- zstream.close();
3585
+ baos //zstream
3586
+ .close();
33343587 out.close();
33353588
3336
- return baos.toByteArray();
3589
+ byte[] bytes = baos.toByteArray();
3590
+
3591
+ System.out.println("save #bytes = " + bytes.length);
3592
+ return bytes;
33373593 } catch (Exception e)
33383594 {
33393595 System.err.println(e);
....@@ -3343,13 +3599,16 @@
33433599
33443600 static public Object Uncompress(byte[] bytes)
33453601 {
3346
- System.out.println("#bytes = " + bytes.length);
3602
+ System.out.println("restore #bytes = " + bytes.length);
33473603 try
33483604 {
33493605 ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
3350
- java.util.zip.GZIPInputStream istream = new java.util.zip.GZIPInputStream(bais);
3351
- ObjectInputStream in = new ObjectInputStream(istream);
3606
+ //java.util.zip.GZIPInputStream istream = new java.util.zip.GZIPInputStream(bais);
3607
+ ObjectInputStream in = new ObjectInputStream(bais); // istream);
33523608 Object obj = in.readObject();
3609
+
3610
+ bais //istream
3611
+ .close();
33533612 in.close();
33543613
33553614 return obj;
....@@ -3404,37 +3663,76 @@
34043663 return null;
34053664 }
34063665
3407
- java.util.Hashtable<java.util.UUID, Object3D> hashtable = new java.util.Hashtable<java.util.UUID, Object3D>();
34083666
34093667 public void Save()
34103668 {
3669
+ //Save(true);
3670
+ Replace();
3671
+ }
3672
+
3673
+ private boolean Equal(byte[] compress, byte[] name)
3674
+ {
3675
+ if (compress.length != name.length)
3676
+ {
3677
+ return false;
3678
+ }
3679
+
3680
+ for (int i=compress.length; --i>=0;)
3681
+ {
3682
+ if (compress[i] != name[i])
3683
+ return false;
3684
+ }
3685
+
3686
+ return true;
3687
+ }
3688
+
3689
+ java.util.Hashtable<java.util.UUID, Object3D> versiontable = new java.util.Hashtable<java.util.UUID, Object3D>();
3690
+
3691
+ public boolean Save(boolean user)
3692
+ {
3693
+ System.err.println("Save");
3694
+
34113695 cRadio tab = GetCurrentTab();
34123696
3413
- boolean temp = CameraPane.SWITCH;
3414
- CameraPane.SWITCH = false;
3697
+ Object3D compress = CompressCopy(); // Saved version. No need for "Replace".
34153698
3416
- copy.ExtractBigData(hashtable);
3699
+ boolean thesame = false;
3700
+
3701
+// if (copy.versionindex > 0 && copy.versions[copy.versionindex-1] != null && Equal(compress, copy.versions[copy.versionindex-1]))
3702
+// {
3703
+// thesame = true;
3704
+// }
34173705
34183706 //EditorFrame.m_MainFrame.requestFocusInWindow();
3419
- tab.graphs[tab.undoindex++] = Compress(copy);
3420
-
3421
- copy.RestoreBigData(hashtable);
3422
-
3423
- CameraPane.SWITCH = temp;
3424
-
3425
- //assert(hashtable.isEmpty());
3426
-
3427
- for (int i = tab.undoindex; i < tab.graphs.length; i++)
3707
+ if (!thesame)
34283708 {
3429
- tab.graphs[i] = null;
3709
+ //tab.user[tab.versionindex] = user;
3710
+ //boolean increment = true; // tab.graphs[tab.versionindex] == null;
3711
+
3712
+ copy.versions[++copy.versionindex] = compress;
3713
+
3714
+ // if (increment)
3715
+ // tab.versionindex++;
34303716 }
34313717
3718
+ //copy.RestoreBigData(versiontable);
3719
+
3720
+ //assert(hashtable.isEmpty());
3721
+
3722
+ for (int i = copy.versionindex+1; i < copy.versions.length; i++)
3723
+ {
3724
+ //tab.user[i] = false;
3725
+ copy.versions[i] = null;
3726
+ }
3727
+
3728
+ SetUndoStates();
3729
+
34323730 // test save
34333731 if (false)
34343732 {
34353733 try
34363734 {
3437
- FileOutputStream ostream = new FileOutputStream("save" + tab.undoindex);
3735
+ FileOutputStream ostream = new FileOutputStream("save" + copy.versionindex);
34383736 ObjectOutputStream p = new ObjectOutputStream(ostream);
34393737
34403738 p.writeObject(copy);
....@@ -3447,23 +3745,30 @@
34473745 e.printStackTrace();
34483746 }
34493747 }
3748
+
3749
+ return !thesame;
34503750 }
34513751
34523752 void CopyChanged(Object3D obj)
34533753 {
3754
+ SetUndoStates();
3755
+
34543756 boolean temp = CameraPane.SWITCH;
34553757 CameraPane.SWITCH = false;
34563758
3457
- copy.ExtractBigData(hashtable);
3759
+ copy.ExtractBigData(versiontable);
34583760
34593761 copy.clear();
34603762
3763
+ copy.skyboxname = obj.skyboxname;
3764
+ copy.skyboxext = obj.skyboxext;
3765
+
34613766 for (int i=0; i<obj.Size(); i++)
34623767 {
34633768 copy.add(obj.get(i));
34643769 }
34653770
3466
- copy.RestoreBigData(hashtable);
3771
+ copy.RestoreBigData(versiontable);
34673772
34683773 CameraPane.SWITCH = temp;
34693774
....@@ -3490,40 +3795,131 @@
34903795 refreshContents();
34913796 }
34923797
3493
- public void Undo()
3798
+ cButton undoButton;
3799
+ cButton restoreButton;
3800
+ cButton replaceButton;
3801
+ cButton redoButton;
3802
+
3803
+ boolean muteSlider;
3804
+
3805
+ int VersionCount()
3806
+ {
3807
+ int count = 0;
3808
+
3809
+ for (int i = copy.versions.length; --i >= 0;)
3810
+ {
3811
+ if (copy.versions[i] != null)
3812
+ count++;
3813
+ }
3814
+
3815
+ return count;
3816
+ }
3817
+
3818
+ void SetUndoStates()
34943819 {
34953820 cRadio tab = GetCurrentTab();
34963821
3497
- if (tab.undoindex == 0)
3822
+ restoreButton.setEnabled(copy.versionindex != -1);
3823
+ replaceButton.setEnabled(copy.versionindex != -1);
3824
+
3825
+ undoButton.setEnabled(copy.versionindex > 0);
3826
+ redoButton.setEnabled(copy.versions[copy.versionindex + 1] != null);
3827
+
3828
+ muteSlider = true;
3829
+ versionSlider.setMaximum(VersionCount() - 1);
3830
+ versionSlider.setInteger(copy.versionindex);
3831
+ muteSlider = false;
3832
+ }
3833
+
3834
+ public boolean Undo()
3835
+ {
3836
+ // Option?
3837
+ Replace();
3838
+
3839
+ System.err.println("Undo");
3840
+
3841
+ cRadio tab = GetCurrentTab();
3842
+
3843
+ if (copy.versionindex == 0)
34983844 {
34993845 java.awt.Toolkit.getDefaultToolkit().beep();
3500
- return;
3846
+ return false;
35013847 }
35023848
3503
- if (tab.graphs[tab.undoindex] == null)
3849
+// if (tab.graphs[tab.versionindex] == null) // || !tab.user[tab.versionindex])
3850
+// {
3851
+// if (Save(false))
3852
+// tab.versionindex -= 1;
3853
+// else
3854
+// {
3855
+// if (tab.versionindex <= 0)
3856
+// return false;
3857
+// else
3858
+// tab.versionindex -= 1;
3859
+// }
3860
+// }
3861
+
3862
+ copy.versionindex -= 1;
3863
+
3864
+ CopyChanged((Object3D)copy.versions[copy.versionindex]);
3865
+
3866
+ return true;
3867
+ }
3868
+
3869
+ public boolean Restore()
3870
+ {
3871
+ System.err.println("Restore");
3872
+
3873
+ cRadio tab = GetCurrentTab();
3874
+
3875
+ if (copy.versionindex == -1 || copy.versions[copy.versionindex] == null)
35043876 {
3505
- Save();
3506
- tab.undoindex -= 1;
3877
+ java.awt.Toolkit.getDefaultToolkit().beep();
3878
+ return false;
35073879 }
35083880
3509
- tab.undoindex -= 1;
3881
+ //CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex]));
3882
+ CopyChanged(copy.versions[copy.versionindex]);
3883
+
3884
+ return true;
3885
+ }
35103886
3511
- CopyChanged((Object3D)Uncompress(tab.graphs[tab.undoindex]));
3887
+ public boolean Replace()
3888
+ {
3889
+ System.err.println("Replace");
3890
+
3891
+ cRadio tab = GetCurrentTab();
3892
+
3893
+ if (copy.versionindex == -1 || copy.versions[copy.versionindex] == null)
3894
+ {
3895
+ // No version yet. OK. java.awt.Toolkit.getDefaultToolkit().beep();
3896
+ return false;
3897
+ }
3898
+
3899
+ copy.versions[copy.versionindex] = CompressCopy();
3900
+
3901
+ return true;
35123902 }
35133903
35143904 public void Redo()
35153905 {
3906
+ // Option?
3907
+ Replace();
3908
+
35163909 cRadio tab = GetCurrentTab();
35173910
3518
- if (tab.graphs[tab.undoindex + 1] == null)
3911
+ if (copy.versions[copy.versionindex + 1] == null)
35193912 {
35203913 java.awt.Toolkit.getDefaultToolkit().beep();
35213914 return;
35223915 }
35233916
3524
- tab.undoindex += 1;
3917
+ copy.versionindex += 1;
35253918
3526
- CopyChanged((Object3D)Uncompress(tab.graphs[tab.undoindex]));
3919
+ CopyChanged(copy.versions[copy.versionindex]);
3920
+
3921
+ //if (!tab.user[tab.versionindex])
3922
+ // tab.graphs[tab.versionindex] = null;
35273923 }
35283924
35293925 void ImportGFD()
....@@ -3675,7 +4071,7 @@
36754071 assert false;
36764072 }
36774073
3678
- void EditSelection()
4074
+ void EditSelection(boolean newWindow)
36794075 {
36804076 }
36814077
....@@ -3819,9 +4215,25 @@
38194215 //copy.Touch();
38204216 }
38214217
4218
+ cNumberSlider versionSlider;
4219
+
38224220 public void stateChanged(ChangeEvent e)
38234221 {
38244222 // assert(false);
4223
+ if (e.getSource() == versionSlider)
4224
+ {
4225
+ if (muteSlider)
4226
+ return;
4227
+
4228
+ int version = versionSlider.getInteger();
4229
+
4230
+ if (copy.versions[version] != null)
4231
+ {
4232
+ CopyChanged(copy.versions[copy.versionindex = version]);
4233
+ }
4234
+
4235
+ return;
4236
+ }
38254237
38264238 if (freezematerial)
38274239 {
....@@ -4170,7 +4582,8 @@
41704582
41714583 void makeSomething(Object3D thing, boolean resetmodel) // deselect)
41724584 {
4173
- Save();
4585
+ if (Globals.REPLACEONMAKE) // && resetmodel)
4586
+ Save();
41744587 //Tween.set(thing, 0).target(1).start(tweenManager);
41754588 //Tween.to(thing, 0, 0.5f).target(0).start(tweenManager);
41764589 // if (thing instanceof GenericJointDemo)
....@@ -4257,6 +4670,12 @@
42574670 {
42584671 ResetModel();
42594672 Select(thing.GetTreePath(), true, false); // unselect... false);
4673
+
4674
+ if (thing.Size() == 0)
4675
+ {
4676
+ //EditSelection(false);
4677
+ }
4678
+
42604679 refreshContents();
42614680 }
42624681
....@@ -4405,7 +4824,9 @@
44054824 readobj.ResetDisplayList();
44064825 } catch (Exception e)
44074826 {
4408
- //e.printStackTrace();
4827
+ if (!e.toString().contains("GZIP"))
4828
+ e.printStackTrace();
4829
+
44094830 try
44104831 {
44114832 java.io.FileInputStream istream = new java.io.FileInputStream(fullname);
....@@ -4479,11 +4900,14 @@
44794900
44804901 if (readobj != null)
44814902 {
4482
- Save();
4903
+ //if (Globals.SAVEONMAKE) // A new object cannot share meshes
4904
+ // Save();
44834905 try
44844906 {
44854907 //readobj.deepCopySelf(copy);
44864908 copy.clear(); // june 2014
4909
+ copy.skyboxname = readobj.skyboxname;
4910
+ copy.skyboxext = readobj.skyboxext;
44874911 for (int i = 0; i < readobj.size(); i++)
44884912 {
44894913 Object3D child = readobj.get(i); // reserve(i);
....@@ -4524,6 +4948,7 @@
45244948 }
45254949 } catch (ClassCastException e)
45264950 {
4951
+ e.printStackTrace();
45274952 assert (false);
45284953 Composite c = (Composite) copy;
45294954 c.children.clear();
....@@ -4534,13 +4959,24 @@
45344959 c.addChild(csg);
45354960 }
45364961
4962
+ copy.versions = readobj.versions;
4963
+ copy.versionindex = readobj.versionindex;
4964
+
4965
+ if (copy.versions == null)
4966
+ {
4967
+ copy.versions = new Object3D[100];
4968
+ copy.versionindex = -1;
4969
+ }
4970
+
4971
+ //? SetUndoStates();
4972
+
45374973 ResetModel();
45384974 copy.HardTouch(); // recompile?
45394975 refreshContents();
45404976 }
45414977 }
45424978
4543
- void load() // throws ClassNotFoundException
4979
+ void Open() // throws ClassNotFoundException
45444980 {
45454981 if (Grafreed.standAlone)
45464982 {
....@@ -4643,6 +5079,7 @@
46435079 //ps.print(buffer.toString());
46445080 } catch (IOException e)
46455081 {
5082
+ e.printStackTrace();
46465083 }
46475084 }
46485085
....@@ -4657,6 +5094,8 @@
46575094 String filename = browser.getFile();
46585095 if (filename != null && filename.length() > 0)
46595096 {
5097
+ if (!filename.endsWith(".gfd"))
5098
+ filename += ".gfd";
46605099 lastname = browser.getDirectory() + filename;
46615100 save();
46625101 }
....@@ -4823,7 +5262,7 @@
48235262 MenuBar menuBar;
48245263 Menu fileMenu;
48255264 MenuItem newItem;
4826
- MenuItem loadItem;
5265
+ MenuItem openItem;
48275266 MenuItem saveItem;
48285267 MenuItem saveAsItem;
48295268 MenuItem exportAsItem;
....@@ -4846,22 +5285,36 @@
48465285 CheckboxMenuItem toggleSwitchItem;
48475286 CheckboxMenuItem toggleRootItem;
48485287 CheckboxMenuItem animationItem;
5288
+ MenuItem archiveItem;
48495289 CheckboxMenuItem toggleHandleItem;
48505290 CheckboxMenuItem togglePaintItem;
48515291 JSplitPane mainPanel;
48525292 JScrollPane scrollpane;
5293
+
48535294 JPanel toolbarPanel;
5295
+
48545296 cGridBag treePanel;
5297
+
48555298 JPanel radioPanel;
48565299 ButtonGroup buttonGroup;
4857
- cGridBag ctrlPanel;
5300
+
5301
+ cGridBag toolboxPanel;
48585302 cGridBag materialPanel;
5303
+ cGridBag ctrlPanel;
5304
+
48595305 JScrollPane infoPanel;
5306
+
48605307 cGridBag optionsPanel;
5308
+
48615309 JTabbedPane objectPanel;
5310
+ boolean materialFlushed;
5311
+ Object3D latestObject;
5312
+
48625313 cGridBag XYZPanel;
5314
+
48635315 JSplitPane gridPanel;
48645316 JSplitPane bigPanel;
5317
+
48655318 cGridBag bigThree;
48665319 cGridBag scenePanel;
48675320 cGridBag centralPanel;
....@@ -4976,7 +5429,7 @@
49765429 cNumberSlider fogField;
49775430 JLabel opacityPowerLabel;
49785431 cNumberSlider opacityPowerField;
4979
- JTree jTree;
5432
+ cTree jTree;
49805433 //ObjectUI parent;
49815434
49825435 cNumberSlider normalpushField;