Normand Briere
2019-08-01 29d5516687020263d3ae0454ce81879a3a450af0
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 byte[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 byte[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,34 @@
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 byte[] CompressCopy()
854
+ {
855
+ boolean temp = CameraPane.SWITCH;
856
+ CameraPane.SWITCH = false;
857
+
858
+ copy.ExtractBigData(versiontable);
859
+ // if (copy == client)
860
+
861
+ byte[] versions[] = copy.versions;
862
+ copy.versions = null;
863
+
864
+ byte[] compress = Compress(copy);
865
+
866
+ copy.versions = versions;
867
+
868
+ copy.RestoreBigData(versiontable);
869
+
870
+ CameraPane.SWITCH = temp;
871
+
872
+ return compress;
873
+ }
683874
684875 private JTextPane createTextPane()
685876 {
....@@ -811,7 +1002,7 @@
8111002 // NumberSlider vDivsField;
8121003 // JCheckBox endcaps;
8131004 JCheckBox liveCB;
814
- JCheckBox selectCB;
1005
+ JCheckBox selectableCB;
8151006 JCheckBox hideCB;
8161007 JCheckBox link2masterCB;
8171008 JCheckBox markCB;
....@@ -819,7 +1010,12 @@
8191010 JCheckBox speedupCB;
8201011 JCheckBox rewindCB;
8211012 JCheckBox flipVCB;
1013
+
1014
+ cCheckBox toggleTextureCB;
1015
+ cCheckBox toggleSwitchCB;
1016
+
8221017 JComboBox texresMenu;
1018
+
8231019 JButton resetButton;
8241020 JButton stepButton;
8251021 JButton stepAllButton;
....@@ -1006,38 +1202,42 @@
10061202 namePanel = new cGridBag();
10071203
10081204 nameField = AddText(namePanel, copy.GetName());
1009
- namePanel.add(nameField);
1205
+ namePanel.add(new JScrollPane(nameField, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER));
10101206 oe.ctrlPanel.add(namePanel);
10111207
10121208 oe.ctrlPanel.Return();
10131209
1014
- if (!GroupEditor.allparams)
1210
+ if (!allparams)
10151211 return;
10161212
10171213 setupPanel = new cGridBag().setVertical(false);
10181214
10191215 liveCB = AddCheckBox(setupPanel, "Live", copy.live);
10201216 liveCB.setToolTipText("Animate object");
1021
- selectCB = AddCheckBox(setupPanel, "Select", !copy.dontselect);
1022
- selectCB.setToolTipText("Make object selectable");
1217
+ selectableCB = AddCheckBox(setupPanel, "Select", !copy.dontselect);
1218
+ selectableCB.setToolTipText("Make object selectable");
10231219 // Return();
1220
+
10241221 hideCB = AddCheckBox(setupPanel, "Hide", copy.hide);
10251222 hideCB.setToolTipText("Hide object");
10261223 markCB = AddCheckBox(setupPanel, "Mark", copy.marked);
1027
- markCB.setToolTipText("Set the animation target transform");
1224
+ markCB.setToolTipText("As animation target transform");
1225
+
1226
+ ToolTipManager.sharedInstance().setLightWeightPopupEnabled(false);
10281227
10291228 setupPanel2 = new cGridBag().setVertical(false);
10301229
10311230 rewindCB = AddCheckBox(setupPanel2, "Rewind", copy.rewind);
10321231 rewindCB.setToolTipText("Rewind animation");
10331232
1034
- randomCB = AddCheckBox(setupPanel2, "Rand", copy.random);
1035
- randomCB.setToolTipText("Randomly Rewind or Go back and forth");
1233
+ randomCB = AddCheckBox(setupPanel2, "Random", copy.random);
1234
+ randomCB.setToolTipText("Randomly Rewind (or Go back and forth)");
10361235
1236
+ link2masterCB = AddCheckBox(setupPanel2, "Support", copy.link2master);
1237
+ link2masterCB.setToolTipText("Attach to support");
1238
+
10371239 if (Globals.ADVANCED)
10381240 {
1039
- link2masterCB = AddCheckBox(setupPanel2, "Supp", copy.link2master);
1040
- link2masterCB.setToolTipText("Attach to support");
10411241 speedupCB = AddCheckBox(setupPanel2, "Speed", copy.speedup);
10421242 speedupCB.setToolTipText("Option motion capture");
10431243 }
....@@ -1311,6 +1511,7 @@
13111511 XYZPanel.addComponent(/*BorderLayout.SOUTH,*/sideView); // Scroll);
13121512 XYZPanel.addComponent(/*BorderLayout.CENTER,*/frontView); // Scroll);
13131513 XYZPanel.addComponent(/*BorderLayout.NORTH,*/topView); // Scroll);
1514
+ //XYZPanel.setName("XYZ");
13141515
13151516 /*
13161517 gridPanel = new JPanel(); //new BorderLayout());
....@@ -1348,12 +1549,29 @@
13481549 //JScrollPane tmp = new JScrollPane(ctrlPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
13491550 //tmp.setName("Edit");
13501551 objectPanel.add(materialPanel);
1552
+ objectPanel.setIconAt(0, GetIcon("icons/material.png"));
1553
+ objectPanel.setToolTipTextAt(0, "Material panel");
1554
+
13511555 // JPanel north = new JPanel(new BorderLayout());
13521556 // north.setName("Edit");
13531557 // north.add(ctrlPanel, BorderLayout.NORTH);
13541558 // objectPanel.add(north);
13551559 objectPanel.add(editPanel);
1356
- objectPanel.add(infoPanel);
1560
+ objectPanel.setIconAt(1, GetIcon("icons/write.png"));
1561
+ objectPanel.setToolTipTextAt(1, "Edit panel");
1562
+
1563
+ //if (Globals.ADVANCED)
1564
+ objectPanel.add(infoPanel);
1565
+ objectPanel.setIconAt(2, GetIcon("icons/info.png"));
1566
+ objectPanel.setToolTipTextAt(2, "Info panel");
1567
+
1568
+ objectPanel.add(XYZPanel);
1569
+ objectPanel.setIconAt(3, GetIcon("icons/XYZ.png"));
1570
+ objectPanel.setToolTipTextAt(3, "XYZ/RGB panel");
1571
+
1572
+ objectPanel.add(toolboxPanel);
1573
+ objectPanel.setIconAt(4, GetIcon("icons/primitives.png"));
1574
+ objectPanel.setToolTipTextAt(4, "Objects/backgrounds panel");
13571575
13581576 /*
13591577 aConstraints.gridx = 0;
....@@ -1362,7 +1580,7 @@
13621580 aConstraints.gridy += 1;
13631581 aConstraints.gridwidth = 1;
13641582 mainPanel.add(objectPanel, aConstraints);
1365
- */
1583
+ */
13661584
13671585 scrollpane = new JScrollPane(mainPanel, ScrollPaneConstants.// VERTICAL_SCROLLBAR_ALWAYS,
13681586 VERTICAL_SCROLLBAR_AS_NEEDED,
....@@ -1374,14 +1592,12 @@
13741592 scrollpane.addMouseWheelListener(this); // Default not fast enough
13751593
13761594 /*JTabbedPane*/ scenePanel = new cGridBag();
1377
- scenePanel.preferredWidth = 6;
1595
+ scenePanel.preferredWidth = 5;
13781596
13791597 JTabbedPane tabbedPane = new JTabbedPane();
13801598 tabbedPane.add(scrollpane);
13811599
1382
- tabbedPane.add(FSPane = new cFileSystemPane(this));
1383
-
1384
- optionsPanel = new cGridBag().setVertical(true);
1600
+ optionsPanel = new cGridBag().setVertical(false);
13851601
13861602 optionsPanel.setName("Options");
13871603
....@@ -1389,6 +1605,8 @@
13891605
13901606 tabbedPane.add(optionsPanel);
13911607
1608
+ tabbedPane.add(FSPane = new cFileSystemPane(this));
1609
+
13921610 scenePanel.add(tabbedPane);
13931611
13941612 /*
....@@ -1452,7 +1670,7 @@
14521670 bigThree = new cGridBag();
14531671 bigThree.addComponent(scenePanel);
14541672 bigThree.addComponent(centralPanel);
1455
- bigThree.addComponent(XYZPanel);
1673
+ //bigThree.addComponent(XYZPanel);
14561674
14571675 // // SIDE EFFECT!!!
14581676 // aConstraints.gridx = 0;
....@@ -1461,9 +1679,9 @@
14611679 // aConstraints.gridheight = 1;
14621680
14631681 framePanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, toolbarPanel, bigThree);
1464
- framePanel.setContinuousLayout(true);
1465
- framePanel.setOneTouchExpandable(true);
1466
- framePanel.setDividerLocation(0.8);
1682
+ framePanel.setContinuousLayout(false);
1683
+ framePanel.setOneTouchExpandable(false);
1684
+ //.setDividerLocation(0.8);
14671685 //framePanel.setDividerSize(15);
14681686 //framePanel.setResizeWeight(0.15);
14691687 framePanel.setName("Frame");
....@@ -1481,16 +1699,18 @@
14811699 // aConstraints = gbc; // (GridBagConstraints) GrafreeD.clone(gbc);
14821700
14831701 frame.setSize(1280, 860);
1484
- frame.setVisible(true);
1485
-
1702
+
14861703 cameraView.requestFocusInWindow();
14871704
14881705 gridPanel.setDividerLocation(1.0);
1706
+
1707
+ frame.validate();
1708
+
1709
+ frame.setVisible(true);
14891710
14901711 frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
14911712 frame.addWindowListener(new WindowAdapter()
14921713 {
1493
-
14941714 public void windowClosing(WindowEvent e)
14951715 {
14961716 Close();
....@@ -1552,45 +1772,48 @@
15521772 //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
15531773
15541774 cGridBag colorSection = new cGridBag().setVertical(true);
1775
+
1776
+ cGridBag huepanel = new cGridBag();
1777
+ cGridBag huelabel = new cGridBag();
1778
+ huelabel.add(GetLabel("icons/hue.png", false));
1779
+ huelabel.preferredWidth = 20;
1780
+ huepanel.add(new cGridBag()); // Label
1781
+ huepanel.add(huelabel); // Field/slider
1782
+
1783
+ huepanel.preferredHeight = 7;
1784
+
1785
+ colorSection.add(huepanel);
15551786
15561787 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);
1788
+
1789
+ color.add(colorLabel = new JLabel("Color/hue")); // , aConstraints);
1790
+ colorLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1791
+ color.add(colorField = new cNumberSlider(this, 0.001, 1)); // , aConstraints);
1792
+
15601793 //colorField.preferredWidth = 200;
15611794 colorSection.add(color);
15621795
15631796 cGridBag modulation = new cGridBag();
15641797 modulation.add(modulationLabel = new JLabel("Saturation")); // , aConstraints);
15651798 modulationLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1566
- modulation.add(modulationField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1799
+ modulation.add(modulationField = new cNumberSlider(this, 0.001, 1)); // , aConstraints);
15671800 colorSection.add(modulation);
15681801
1802
+ cGridBag opacity = new cGridBag();
1803
+ opacity.add(opacityLabel = new JLabel("Opacity")); // , aConstraints);
1804
+ opacityLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1805
+ opacity.add(opacityField = new cNumberSlider(this, 0.001, 1)); // , aConstraints);
1806
+ colorSection.add(opacity);
1807
+
1808
+ colorSection.add(GetSeparator());
1809
+
15691810 cGridBag texture = new cGridBag();
15701811 texture.add(textureLabel = new JLabel("Texture")); // , aConstraints);
15711812 textureLabel.setHorizontalAlignment(SwingConstants.TRAILING);
15721813 texture.add(textureField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
15731814 colorSection.add(texture);
15741815
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());
1816
+ panel.add(GetSeparator());
15941817
15951818 panel.add(colorSection);
15961819
....@@ -1640,7 +1863,13 @@
16401863 fakedepth.add(fakedepthField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
16411864 diffuseSection.add(fakedepth);
16421865
1643
- panel.add(new JSeparator());
1866
+ cGridBag shadowbias = new cGridBag();
1867
+ shadowbias.add(shadowbiasLabel = new JLabel("Shadowbias")); // , aConstraints);
1868
+ shadowbiasLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1869
+ shadowbias.add(shadowbiasField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1870
+ diffuseSection.add(shadowbias);
1871
+
1872
+ panel.add(GetSeparator());
16441873
16451874 panel.add(diffuseSection);
16461875
....@@ -1690,42 +1919,48 @@
16901919 // aConstraints.gridy += 1;
16911920 // aConstraints.gridwidth = 1;
16921921
1922
+ cGridBag anisoU = new cGridBag();
1923
+ anisoU.add(anisoLabel = new JLabel("AnisoU")); // , aConstraints);
1924
+ anisoLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1925
+ anisoU.add(anisoField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1926
+ specularSection.add(anisoU);
16931927
1694
- panel.add(new JSeparator());
1928
+ cGridBag anisoV = new cGridBag();
1929
+ anisoV.add(anisoVLabel = new JLabel("AnisoV")); // , aConstraints);
1930
+ anisoVLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1931
+ anisoV.add(anisoVField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1932
+ specularSection.add(anisoV);
1933
+
1934
+
1935
+ panel.add(GetSeparator());
16951936
16961937 panel.add(specularSection);
16971938
16981939 //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
16991940
1700
- cGridBag globalSection = new cGridBag().setVertical(true);
1941
+ //cGridBag globalSection = new cGridBag().setVertical(true);
17011942
17021943 cGridBag camera = new cGridBag();
17031944 camera.add(cameraLabel = new JLabel("GlobalLight")); // , aConstraints);
17041945 cameraLabel.setHorizontalAlignment(SwingConstants.TRAILING);
17051946 camera.add(cameraField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1706
- globalSection.add(camera);
1947
+ colorSection.add(camera);
17071948
17081949 cGridBag ambient = new cGridBag();
17091950 ambient.add(ambientLabel = new JLabel("Ambient")); // , aConstraints);
17101951 ambientLabel.setHorizontalAlignment(SwingConstants.TRAILING);
17111952 ambient.add(ambientField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1712
- globalSection.add(ambient);
1953
+ colorSection.add(ambient);
17131954
17141955 cGridBag backlit = new cGridBag();
17151956 backlit.add(backlitLabel = new JLabel("Backlit")); // , aConstraints);
17161957 backlitLabel.setHorizontalAlignment(SwingConstants.TRAILING);
17171958 backlit.add(backlitField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1718
- globalSection.add(backlit);
1959
+ colorSection.add(backlit);
17191960
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());
1961
+ //panel.add(new JSeparator());
17271962
1728
- panel.add(globalSection);
1963
+ //panel.add(globalSection);
17291964
17301965 //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
17311966
....@@ -1767,7 +2002,7 @@
17672002 opacityPower.add(opacityPowerField = new cNumberSlider(this, 0.0, 10 /*10 dec 2013*/)); // , aConstraints);
17682003 textureSection.add(opacityPower);
17692004
1770
- panel.add(new JSeparator());
2005
+ panel.add(GetSeparator());
17712006
17722007 panel.add(textureSection);
17732008
....@@ -1832,8 +2067,9 @@
18322067 // 3D models
18332068 if (filename.endsWith(".3ds") || filename.endsWith(".3DS"))
18342069 {
1835
- lastConverter = new com.jmex.model.converters.MaxToJme();
1836
- LoadFile(filename, lastConverter);
2070
+ //lastConverter = new com.jmex.model.converters.MaxToJme();
2071
+ //LoadFile(filename, lastConverter);
2072
+ LoadObjFile(filename); // New 3ds loader
18372073 continue;
18382074 }
18392075 if (filename.endsWith(".dae") || filename.endsWith(".DAE"))
....@@ -2559,6 +2795,7 @@
25592795 LA.matXRotate(((Object3D) group.get(group.size() - 1)).toParent, -Math.PI / 2);
25602796 LA.matXRotate(((Object3D) group.get(group.size() - 1)).fromParent, Math.PI / 2);
25612797 }
2798
+
25622799 //cJME.count++;
25632800 //cJME.count %= 12;
25642801 if (gc)
....@@ -2742,6 +2979,7 @@
27422979 }
27432980 }
27442981 }
2982
+
27452983 cFileSystemPane FSPane;
27462984
27472985 void SetMaterial(cMaterial mat, Object3D.cVector2[] others)
....@@ -2795,11 +3033,14 @@
27953033 }
27963034 }
27973035 }
3036
+
27983037 freezematerial = false;
27993038 }
28003039
28013040 void SetMaterial(Object3D object)
28023041 {
3042
+ latestObject = object;
3043
+
28033044 cMaterial mat = object.material;
28043045
28053046 if (mat == null)
....@@ -2911,12 +3152,17 @@
29113152 // }
29123153
29133154 /**/
2914
- if (deselect)
3155
+ if (deselect || child == null)
29153156 {
29163157 //group.deselectAll();
29173158 //freeze = true;
29183159 GetTree().clearSelection();
29193160 //freeze = false;
3161
+
3162
+ if (child == null)
3163
+ {
3164
+ return;
3165
+ }
29203166 }
29213167
29223168 //group.addSelectee(child);
....@@ -2985,7 +3231,7 @@
29853231 cameraView.ToggleDL();
29863232 cameraView.repaint();
29873233 return;
2988
- } else if (event.getSource() == toggleTextureItem)
3234
+ } else if (event.getSource() == toggleTextureItem || event.getSource() == toggleTextureCB)
29893235 {
29903236 cameraView.ToggleTexture();
29913237 // june 2013 copy.HardTouch();
....@@ -3024,7 +3270,7 @@
30243270 frame.validate();
30253271
30263272 return;
3027
- } else if (event.getSource() == toggleSwitchItem)
3273
+ } else if (event.getSource() == toggleSwitchItem || event.getSource() == toggleSwitchCB)
30283274 {
30293275 cameraView.ToggleSwitch();
30303276 cameraView.repaint();
....@@ -3055,7 +3301,7 @@
30553301 {
30563302 copy.live ^= true;
30573303 return;
3058
- } else if (event.getSource() == selectCB)
3304
+ } else if (event.getSource() == selectableCB)
30593305 {
30603306 copy.dontselect ^= true;
30613307 return;
....@@ -3240,9 +3486,9 @@
32403486 {
32413487 Close();
32423488 //return true;
3243
- } else if (source == loadItem)
3489
+ } else if (source == openItem)
32443490 {
3245
- load();
3491
+ Open();
32463492 //return true;
32473493 } else if (source == newItem)
32483494 {
....@@ -3267,6 +3513,10 @@
32673513 {
32683514 generatePOV();
32693515 //return true;
3516
+ } else if (event.getSource() == archiveItem)
3517
+ {
3518
+ cTools.Archive(frame);
3519
+ return;
32703520 } else if (source == zBufferItem)
32713521 {
32723522 try
....@@ -3318,8 +3568,8 @@
33183568 try
33193569 {
33203570 ByteArrayOutputStream baos = new ByteArrayOutputStream();
3321
- java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(baos);
3322
- ObjectOutputStream out = new ObjectOutputStream(zstream);
3571
+// java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(baos);
3572
+ ObjectOutputStream out = new ObjectOutputStream(baos); //zstream);
33233573
33243574 Object3D parent = o.parent;
33253575 o.parent = null;
....@@ -3330,10 +3580,14 @@
33303580
33313581 out.flush();
33323582
3333
- zstream.close();
3583
+ baos //zstream
3584
+ .close();
33343585 out.close();
33353586
3336
- return baos.toByteArray();
3587
+ byte[] bytes = baos.toByteArray();
3588
+
3589
+ System.out.println("save #bytes = " + bytes.length);
3590
+ return bytes;
33373591 } catch (Exception e)
33383592 {
33393593 System.err.println(e);
....@@ -3343,13 +3597,16 @@
33433597
33443598 static public Object Uncompress(byte[] bytes)
33453599 {
3346
- System.out.println("#bytes = " + bytes.length);
3600
+ System.out.println("restore #bytes = " + bytes.length);
33473601 try
33483602 {
33493603 ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
3350
- java.util.zip.GZIPInputStream istream = new java.util.zip.GZIPInputStream(bais);
3351
- ObjectInputStream in = new ObjectInputStream(istream);
3604
+ //java.util.zip.GZIPInputStream istream = new java.util.zip.GZIPInputStream(bais);
3605
+ ObjectInputStream in = new ObjectInputStream(bais); // istream);
33523606 Object obj = in.readObject();
3607
+
3608
+ bais //istream
3609
+ .close();
33533610 in.close();
33543611
33553612 return obj;
....@@ -3404,37 +3661,77 @@
34043661 return null;
34053662 }
34063663
3407
- java.util.Hashtable<java.util.UUID, Object3D> hashtable = new java.util.Hashtable<java.util.UUID, Object3D>();
34083664
34093665 public void Save()
34103666 {
3667
+ //Save(true);
3668
+ Replace();
3669
+ }
3670
+
3671
+ private boolean Equal(byte[] compress, byte[] name)
3672
+ {
3673
+ if (compress.length != name.length)
3674
+ {
3675
+ return false;
3676
+ }
3677
+
3678
+ for (int i=compress.length; --i>=0;)
3679
+ {
3680
+ if (compress[i] != name[i])
3681
+ return false;
3682
+ }
3683
+
3684
+ return true;
3685
+ }
3686
+
3687
+ java.util.Hashtable<java.util.UUID, Object3D> versiontable = new java.util.Hashtable<java.util.UUID, Object3D>();
3688
+
3689
+ public boolean Save(boolean user)
3690
+ {
3691
+ System.err.println("Save");
3692
+
34113693 cRadio tab = GetCurrentTab();
34123694
3413
- boolean temp = CameraPane.SWITCH;
3414
- CameraPane.SWITCH = false;
3695
+ byte[] compress = CompressCopy(); // Saved version. No need for "Replace".
34153696
3416
- copy.ExtractBigData(hashtable);
3697
+ boolean thesame = false;
3698
+
3699
+ // Quick heuristic using length. Works only when stream is compressed.
3700
+ if (copy.versionindex > 0 && copy.versions[copy.versionindex-1] != null && Equal(compress, copy.versions[copy.versionindex-1]))
3701
+ {
3702
+ thesame = true;
3703
+ }
34173704
34183705 //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++)
3706
+ if (!thesame)
34283707 {
3429
- tab.graphs[i] = null;
3708
+ //tab.user[tab.versionindex] = user;
3709
+ //boolean increment = true; // tab.graphs[tab.versionindex] == null;
3710
+
3711
+ copy.versions[++copy.versionindex] = compress;
3712
+
3713
+ // if (increment)
3714
+ // tab.versionindex++;
34303715 }
34313716
3717
+ //copy.RestoreBigData(versiontable);
3718
+
3719
+ //assert(hashtable.isEmpty());
3720
+
3721
+ for (int i = copy.versionindex+1; i < copy.versions.length; i++)
3722
+ {
3723
+ //tab.user[i] = false;
3724
+ copy.versions[i] = null;
3725
+ }
3726
+
3727
+ SetUndoStates();
3728
+
34323729 // test save
34333730 if (false)
34343731 {
34353732 try
34363733 {
3437
- FileOutputStream ostream = new FileOutputStream("save" + tab.undoindex);
3734
+ FileOutputStream ostream = new FileOutputStream("save" + copy.versionindex);
34383735 ObjectOutputStream p = new ObjectOutputStream(ostream);
34393736
34403737 p.writeObject(copy);
....@@ -3447,23 +3744,30 @@
34473744 e.printStackTrace();
34483745 }
34493746 }
3747
+
3748
+ return !thesame;
34503749 }
34513750
34523751 void CopyChanged(Object3D obj)
34533752 {
3753
+ SetUndoStates();
3754
+
34543755 boolean temp = CameraPane.SWITCH;
34553756 CameraPane.SWITCH = false;
34563757
3457
- copy.ExtractBigData(hashtable);
3758
+ copy.ExtractBigData(versiontable);
34583759
34593760 copy.clear();
34603761
3762
+ copy.skyboxname = obj.skyboxname;
3763
+ copy.skyboxext = obj.skyboxext;
3764
+
34613765 for (int i=0; i<obj.Size(); i++)
34623766 {
34633767 copy.add(obj.get(i));
34643768 }
34653769
3466
- copy.RestoreBigData(hashtable);
3770
+ copy.RestoreBigData(versiontable);
34673771
34683772 CameraPane.SWITCH = temp;
34693773
....@@ -3490,40 +3794,130 @@
34903794 refreshContents();
34913795 }
34923796
3493
- public void Undo()
3797
+ cButton undoButton;
3798
+ cButton restoreButton;
3799
+ cButton replaceButton;
3800
+ cButton redoButton;
3801
+
3802
+ boolean muteSlider;
3803
+
3804
+ int VersionCount()
3805
+ {
3806
+ int count = 0;
3807
+
3808
+ for (int i = copy.versions.length; --i >= 0;)
3809
+ {
3810
+ if (copy.versions[i] != null)
3811
+ count++;
3812
+ }
3813
+
3814
+ return count;
3815
+ }
3816
+
3817
+ void SetUndoStates()
34943818 {
34953819 cRadio tab = GetCurrentTab();
34963820
3497
- if (tab.undoindex == 0)
3821
+ restoreButton.setEnabled(copy.versionindex != -1);
3822
+ replaceButton.setEnabled(copy.versionindex != -1);
3823
+
3824
+ undoButton.setEnabled(copy.versionindex > 0);
3825
+ redoButton.setEnabled(copy.versions[copy.versionindex + 1] != null);
3826
+
3827
+ muteSlider = true;
3828
+ versionSlider.setMaximum(VersionCount() - 1);
3829
+ versionSlider.setInteger(copy.versionindex);
3830
+ muteSlider = false;
3831
+ }
3832
+
3833
+ public boolean Undo()
3834
+ {
3835
+ // Option?
3836
+ Replace();
3837
+
3838
+ System.err.println("Undo");
3839
+
3840
+ cRadio tab = GetCurrentTab();
3841
+
3842
+ if (copy.versionindex == 0)
34983843 {
34993844 java.awt.Toolkit.getDefaultToolkit().beep();
3500
- return;
3845
+ return false;
35013846 }
35023847
3503
- if (tab.graphs[tab.undoindex] == null)
3848
+// if (tab.graphs[tab.versionindex] == null) // || !tab.user[tab.versionindex])
3849
+// {
3850
+// if (Save(false))
3851
+// tab.versionindex -= 1;
3852
+// else
3853
+// {
3854
+// if (tab.versionindex <= 0)
3855
+// return false;
3856
+// else
3857
+// tab.versionindex -= 1;
3858
+// }
3859
+// }
3860
+
3861
+ copy.versionindex -= 1;
3862
+
3863
+ CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex]));
3864
+
3865
+ return true;
3866
+ }
3867
+
3868
+ public boolean Restore()
3869
+ {
3870
+ System.err.println("Restore");
3871
+
3872
+ cRadio tab = GetCurrentTab();
3873
+
3874
+ if (copy.versionindex == -1 || copy.versions[copy.versionindex] == null)
35043875 {
3505
- Save();
3506
- tab.undoindex -= 1;
3876
+ java.awt.Toolkit.getDefaultToolkit().beep();
3877
+ return false;
35073878 }
35083879
3509
- tab.undoindex -= 1;
3880
+ CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex]));
3881
+
3882
+ return true;
3883
+ }
35103884
3511
- CopyChanged((Object3D)Uncompress(tab.graphs[tab.undoindex]));
3885
+ public boolean Replace()
3886
+ {
3887
+ System.err.println("Replace");
3888
+
3889
+ cRadio tab = GetCurrentTab();
3890
+
3891
+ if (copy.versionindex == -1 || copy.versions[copy.versionindex] == null)
3892
+ {
3893
+ // No version yet. OK. java.awt.Toolkit.getDefaultToolkit().beep();
3894
+ return false;
3895
+ }
3896
+
3897
+ copy.versions[copy.versionindex] = CompressCopy();
3898
+
3899
+ return true;
35123900 }
35133901
35143902 public void Redo()
35153903 {
3904
+ // Option?
3905
+ Replace();
3906
+
35163907 cRadio tab = GetCurrentTab();
35173908
3518
- if (tab.graphs[tab.undoindex + 1] == null)
3909
+ if (copy.versions[copy.versionindex + 1] == null)
35193910 {
35203911 java.awt.Toolkit.getDefaultToolkit().beep();
35213912 return;
35223913 }
35233914
3524
- tab.undoindex += 1;
3915
+ copy.versionindex += 1;
35253916
3526
- CopyChanged((Object3D)Uncompress(tab.graphs[tab.undoindex]));
3917
+ CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex]));
3918
+
3919
+ //if (!tab.user[tab.versionindex])
3920
+ // tab.graphs[tab.versionindex] = null;
35273921 }
35283922
35293923 void ImportGFD()
....@@ -3675,7 +4069,7 @@
36754069 assert false;
36764070 }
36774071
3678
- void EditSelection()
4072
+ void EditSelection(boolean newWindow)
36794073 {
36804074 }
36814075
....@@ -3819,9 +4213,25 @@
38194213 //copy.Touch();
38204214 }
38214215
4216
+ cNumberSlider versionSlider;
4217
+
38224218 public void stateChanged(ChangeEvent e)
38234219 {
38244220 // assert(false);
4221
+ if (e.getSource() == versionSlider)
4222
+ {
4223
+ if (muteSlider)
4224
+ return;
4225
+
4226
+ int version = versionSlider.getInteger();
4227
+
4228
+ if (copy.versions[version] != null)
4229
+ {
4230
+ CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex = version]));
4231
+ }
4232
+
4233
+ return;
4234
+ }
38254235
38264236 if (freezematerial)
38274237 {
....@@ -4170,7 +4580,8 @@
41704580
41714581 void makeSomething(Object3D thing, boolean resetmodel) // deselect)
41724582 {
4173
- Save();
4583
+ if (Globals.REPLACEONMAKE) // && resetmodel)
4584
+ Save();
41744585 //Tween.set(thing, 0).target(1).start(tweenManager);
41754586 //Tween.to(thing, 0, 0.5f).target(0).start(tweenManager);
41764587 // if (thing instanceof GenericJointDemo)
....@@ -4257,6 +4668,12 @@
42574668 {
42584669 ResetModel();
42594670 Select(thing.GetTreePath(), true, false); // unselect... false);
4671
+
4672
+ if (thing.Size() == 0)
4673
+ {
4674
+ //EditSelection(false);
4675
+ }
4676
+
42604677 refreshContents();
42614678 }
42624679
....@@ -4405,7 +4822,9 @@
44054822 readobj.ResetDisplayList();
44064823 } catch (Exception e)
44074824 {
4408
- //e.printStackTrace();
4825
+ if (!e.toString().contains("GZIP"))
4826
+ e.printStackTrace();
4827
+
44094828 try
44104829 {
44114830 java.io.FileInputStream istream = new java.io.FileInputStream(fullname);
....@@ -4479,11 +4898,14 @@
44794898
44804899 if (readobj != null)
44814900 {
4482
- Save();
4901
+ //if (Globals.SAVEONMAKE) // A new object cannot share meshes
4902
+ // Save();
44834903 try
44844904 {
44854905 //readobj.deepCopySelf(copy);
44864906 copy.clear(); // june 2014
4907
+ copy.skyboxname = readobj.skyboxname;
4908
+ copy.skyboxext = readobj.skyboxext;
44874909 for (int i = 0; i < readobj.size(); i++)
44884910 {
44894911 Object3D child = readobj.get(i); // reserve(i);
....@@ -4524,6 +4946,7 @@
45244946 }
45254947 } catch (ClassCastException e)
45264948 {
4949
+ e.printStackTrace();
45274950 assert (false);
45284951 Composite c = (Composite) copy;
45294952 c.children.clear();
....@@ -4534,13 +4957,24 @@
45344957 c.addChild(csg);
45354958 }
45364959
4960
+ copy.versions = readobj.versions;
4961
+ copy.versionindex = readobj.versionindex;
4962
+
4963
+ if (copy.versions == null)
4964
+ {
4965
+ copy.versions = new byte[100][];
4966
+ copy.versionindex = -1;
4967
+ }
4968
+
4969
+ //? SetUndoStates();
4970
+
45374971 ResetModel();
45384972 copy.HardTouch(); // recompile?
45394973 refreshContents();
45404974 }
45414975 }
45424976
4543
- void load() // throws ClassNotFoundException
4977
+ void Open() // throws ClassNotFoundException
45444978 {
45454979 if (Grafreed.standAlone)
45464980 {
....@@ -4643,6 +5077,7 @@
46435077 //ps.print(buffer.toString());
46445078 } catch (IOException e)
46455079 {
5080
+ e.printStackTrace();
46465081 }
46475082 }
46485083
....@@ -4657,6 +5092,8 @@
46575092 String filename = browser.getFile();
46585093 if (filename != null && filename.length() > 0)
46595094 {
5095
+ if (!filename.endsWith(".gfd"))
5096
+ filename += ".gfd";
46605097 lastname = browser.getDirectory() + filename;
46615098 save();
46625099 }
....@@ -4823,7 +5260,7 @@
48235260 MenuBar menuBar;
48245261 Menu fileMenu;
48255262 MenuItem newItem;
4826
- MenuItem loadItem;
5263
+ MenuItem openItem;
48275264 MenuItem saveItem;
48285265 MenuItem saveAsItem;
48295266 MenuItem exportAsItem;
....@@ -4846,22 +5283,36 @@
48465283 CheckboxMenuItem toggleSwitchItem;
48475284 CheckboxMenuItem toggleRootItem;
48485285 CheckboxMenuItem animationItem;
5286
+ MenuItem archiveItem;
48495287 CheckboxMenuItem toggleHandleItem;
48505288 CheckboxMenuItem togglePaintItem;
48515289 JSplitPane mainPanel;
48525290 JScrollPane scrollpane;
5291
+
48535292 JPanel toolbarPanel;
5293
+
48545294 cGridBag treePanel;
5295
+
48555296 JPanel radioPanel;
48565297 ButtonGroup buttonGroup;
4857
- cGridBag ctrlPanel;
5298
+
5299
+ cGridBag toolboxPanel;
48585300 cGridBag materialPanel;
5301
+ cGridBag ctrlPanel;
5302
+
48595303 JScrollPane infoPanel;
5304
+
48605305 cGridBag optionsPanel;
5306
+
48615307 JTabbedPane objectPanel;
5308
+ boolean materialFlushed;
5309
+ Object3D latestObject;
5310
+
48625311 cGridBag XYZPanel;
5312
+
48635313 JSplitPane gridPanel;
48645314 JSplitPane bigPanel;
5315
+
48655316 cGridBag bigThree;
48665317 cGridBag scenePanel;
48675318 cGridBag centralPanel;
....@@ -4976,7 +5427,7 @@
49765427 cNumberSlider fogField;
49775428 JLabel opacityPowerLabel;
49785429 cNumberSlider opacityPowerField;
4979
- JTree jTree;
5430
+ cTree jTree;
49805431 //ObjectUI parent;
49815432
49825433 cNumberSlider normalpushField;