Normand Briere
2019-07-18 d7a17c35c443e2cb6c09eaa3cfeaf590a571faa1
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
....@@ -35,6 +39,67 @@
3539
3640 GroupEditor callee;
3741 JFrame frame;
42
+
43
+ static ObjEditor theFrame;
44
+
45
+ cButton GetButton(String name, boolean border)
46
+ {
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
+ }
56
+ }
57
+
58
+ cToggleButton GetToggleButton(String name, boolean border)
59
+ {
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
+ }
69
+ }
70
+
71
+ cCheckBox GetCheckBox(String name, boolean border)
72
+ {
73
+ try
74
+ {
75
+ ImageIcon icon = GetIcon(name);
76
+ return new cCheckBox(icon, border);
77
+ }
78
+ catch (Exception e)
79
+ {
80
+ return new cCheckBox(name, border);
81
+ }
82
+ }
83
+
84
+ private ImageIcon GetIcon(String name) throws IOException
85
+ {
86
+ BufferedImage image = javax.imageio.ImageIO.read(getClass().getClassLoader().getResourceAsStream(name));
87
+
88
+ if (image.getWidth() != 24 && image.getHeight() != 24)
89
+ {
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;
98
+ }
99
+
100
+ javax.swing.ImageIcon icon = new javax.swing.ImageIcon(image);
101
+ return icon;
102
+ }
38103
39104 // SCRIPT
40105
....@@ -145,7 +210,7 @@
145210
146211 objEditor.ctrlPanel.remove(namePanel);
147212
148
- if (!GroupEditor.allparams)
213
+ if (!allparams)
149214 return;
150215
151216 // objEditor.ctrlPanel.remove(liveCB);
....@@ -168,7 +233,8 @@
168233 // objEditor.ctrlPanel.remove(remarkButton);
169234
170235 objEditor.ctrlPanel.remove(setupPanel);
171
- objEditor.ctrlPanel.remove(commandsPanel);
236
+ objEditor.ctrlPanel.remove(setupPanel2);
237
+ objEditor.ctrlPanel.remove(objectCommandsPanel);
172238 objEditor.ctrlPanel.remove(pushPanel);
173239 //objEditor.ctrlPanel.remove(fillPanel);
174240
....@@ -216,6 +282,12 @@
216282 client = inClient;
217283 copy = client;
218284
285
+ if (copy.versions == null)
286
+ {
287
+ copy.versions = new byte[100][];
288
+ copy.versionindex = -1;
289
+ }
290
+
219291 // "this" is not called: SetupUI2(objEditor);
220292 }
221293
....@@ -229,6 +301,12 @@
229301 client = inClient;
230302 copy = client;
231303
304
+ if (copy.versions == null)
305
+ {
306
+ copy.versions = new byte[100][];
307
+ copy.versionindex = -1;
308
+ }
309
+
232310 SetupUI2(callee.GetEditor());
233311 }
234312
....@@ -243,6 +321,7 @@
243321 //localCopy.parent = null;
244322
245323 frame = new JFrame();
324
+ frame.setUndecorated(false);
246325 objEditor = this;
247326 this.callee = callee;
248327
....@@ -260,6 +339,12 @@
260339 copy = localCopy;
261340 copy.editWindow = this;
262341
342
+ if (copy.versions == null)
343
+ {
344
+ copy.versions = new byte[100][];
345
+ copy.versionindex = -1;
346
+ }
347
+
263348 SetupMenu();
264349
265350 //SetupName(objEditor); // new
....@@ -273,12 +358,17 @@
273358 return frame.action(event, obj);
274359 }
275360
361
+ // Cannot work without static
362
+ static boolean allparams = true;
363
+
364
+ static java.util.Vector<Object3D> listUI = new java.util.Vector<Object3D>();
365
+
276366 void SetupMenu()
277367 {
278368 frame.setMenuBar(menuBar = new MenuBar());
279369 menuBar.add(fileMenu = new Menu("File"));
280370 fileMenu.add(newItem = new MenuItem("New"));
281
- fileMenu.add(loadItem = new MenuItem("Load..."));
371
+ fileMenu.add(openItem = new MenuItem("Open..."));
282372
283373 //oe.menuBar.add(menu = new Menu("Include"));
284374 Menu menu = new Menu("Import");
....@@ -310,7 +400,7 @@
310400 }
311401
312402 newItem.addActionListener(this);
313
- loadItem.addActionListener(this);
403
+ openItem.addActionListener(this);
314404 saveItem.addActionListener(this);
315405 saveAsItem.addActionListener(this);
316406 exportAsItem.addActionListener(this);
....@@ -319,14 +409,52 @@
319409 closeItem.addActionListener(this);
320410
321411 objectPanel = new JTabbedPane();
412
+
413
+ ChangeListener changeListener = new ChangeListener()
414
+ {
415
+ public void stateChanged(ChangeEvent changeEvent)
416
+ {
417
+// if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Material") && !materialFlushed)
418
+// {
419
+// if (latestObject != null)
420
+// {
421
+// refreshContents(true);
422
+// SetMaterial(latestObject);
423
+// }
424
+//
425
+// materialFlushed = true;
426
+// }
427
+// if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Edit"))
428
+// {
429
+// if (listUI.size() == 0)
430
+// EditSelection(false);
431
+// }
432
+
433
+ refreshContents(false); // To refresh Info tab
434
+ }
435
+ };
436
+ objectPanel.addChangeListener(changeListener);
437
+
322438 toolbarPanel = new JPanel();
323439 toolbarPanel.setName("Toolbar");
324440 treePanel = new cGridBag();
325441 treePanel.setName("Tree");
442
+
443
+ editPanel = new cGridBag().setVertical(true);
444
+ editPanel.setName("Edit");
445
+
326446 ctrlPanel = new cGridBag().setVertical(false); // new GridBagLayout());
327
- ctrlPanel.setName("Edit");
447
+
448
+ editCommandsPanel = new cGridBag();
449
+ editPanel.add(editCommandsPanel);
450
+ editPanel.add(ctrlPanel);
451
+
452
+ toolboxPanel = new cGridBag().setVertical(false);
453
+ toolboxPanel.setName("Toolbox");
454
+
328455 materialPanel = new cGridBag().setVertical(true);
329456 materialPanel.setName("Material");
457
+
330458 /*JTextPane*/
331459 infoarea = createTextPane();
332460 doc = infoarea.getStyledDocument();
....@@ -339,7 +467,7 @@
339467 // TEXTAREA infoarea.setLineWrap(true);
340468 // TEXTAREA infoarea.setWrapStyleWord(true);
341469 infoPanel = new JScrollPane(infoarea, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); //AS_NEEDED);
342
- infoPanel.setPreferredSize(new Dimension(50, 200));
470
+ infoPanel.setPreferredSize(new Dimension(1, 1));
343471 infoPanel.setName("Info");
344472 //infoPanel.setLayout(new BorderLayout());
345473 //infoPanel.add(createTextPane());
....@@ -351,7 +479,14 @@
351479 mainPanel.setDividerSize(9);
352480 mainPanel.setDividerLocation(0.5); //1.0);
353481 mainPanel.setResizeWeight(0.5);
354
-
482
+
483
+//mainPanel.setDividerSize((int) (mainPanel.getDividerSize() * 1.5));
484
+ BasicSplitPaneDivider divider = ( (BasicSplitPaneUI) mainPanel.getUI()).getDivider();
485
+ divider.setDividerSize(15);
486
+ divider.setBorder(BorderFactory.createTitledBorder(divider.getBorder(), "Custom border title -- gets rid of the one-touch arrows!"));
487
+
488
+ mainPanel.setUI(new BasicSplitPaneUI());
489
+
355490 //ctrlPanel.setLayout(new GridLayout(4, 1, 5, 5));
356491 //mainPanel.setLayout(new GridBagLayout());
357492 toolbarPanel.setLayout(new FlowLayout(FlowLayout.LEFT));
....@@ -419,10 +554,10 @@
419554 e.printStackTrace();
420555 }
421556
422
- String selection = infoarea.getText();
423
- java.awt.datatransfer.StringSelection data = new java.awt.datatransfer.StringSelection(selection);
424
- java.awt.datatransfer.Clipboard clipboard =
425
- Toolkit.getDefaultToolkit().getSystemClipboard();
557
+// String selection = infoarea.getText();
558
+// java.awt.datatransfer.StringSelection data = new java.awt.datatransfer.StringSelection(selection);
559
+// java.awt.datatransfer.Clipboard clipboard =
560
+// Toolkit.getDefaultToolkit().getSystemClipboard();
426561 //clipboard.setContents(data, data);
427562 }
428563
....@@ -582,21 +717,144 @@
582717 }
583718 }
584719
720
+//static GraphicsDevice device = GraphicsEnvironment
721
+// .getLocalGraphicsEnvironment().getScreenDevices()[0];
722
+
723
+ Rectangle keeprect;
724
+ cRadio radio;
725
+
726
+cButton keepButton;
727
+ cButton twoButton; // Full 3D
728
+ cButton sixButton;
729
+ cButton threeButton;
730
+ cButton sevenButton;
731
+ cButton fourButton; // full panel
732
+ cButton oneButton; // full XYZ
733
+ //cButton currentLayout;
734
+
735
+ boolean maximized;
736
+
737
+ cButton fullscreenLayout;
738
+
739
+ void Minimize()
740
+ {
741
+ frame.setState(Frame.ICONIFIED);
742
+ frame.validate();
743
+ }
744
+
745
+// artifactURI=null, type=0, property=${file.reference.jfxrt.jar}, object=org.netbeans.modules.java.api.common.classpath.ClassPathSupport$RelativePath@6767876f, broken=false, additional={}
746
+// artifactURI=null, type=0, property=${file.reference.mac-ui.jar}, object=org.netbeans.modules.java.api.common.classpath.ClassPathSupport$RelativePath@16bdc817, broken=false, additional={}
747
+// artifactURI=null, type=0, property=${file.reference.classes.jar}, object=org.netbeans.modules.java.api.common.classpath.ClassPathSupport$RelativePath@9daa9c17, broken=false, additional={}
748
+ void Maximize()
749
+ {
750
+ if (CameraPane.FULLSCREEN)
751
+ {
752
+ ToggleFullScreen();
753
+ }
754
+
755
+ if (maximized)
756
+ {
757
+ frame.setBounds(keeprect.x, keeprect.y, keeprect.width, keeprect.height);
758
+ }
759
+ else
760
+ {
761
+ keeprect = frame.getBounds();
762
+// Rectangle rect = GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds();
763
+// Dimension rect2 = frame.getToolkit().getScreenSize();
764
+// frame.setBounds(0, rect2.height - rect.height, rect.width, rect.height);
765
+// frame.setState(Frame.MAXIMIZED_BOTH);
766
+ frame.setBounds(frame.getGraphicsConfiguration().getBounds());
767
+ }
768
+
769
+ maximized ^= true;
770
+
771
+ frame.validate();
772
+ }
773
+
774
+ cButton minButton;
775
+ cButton maxButton;
776
+ cButton fullButton;
777
+
585778 void ToggleFullScreen()
586779 {
587
- if (CameraPane.FULLSCREEN)
780
+GraphicsDevice device = frame.getGraphicsConfiguration().getDevice();
781
+
782
+ cameraView.ToggleFullScreen();
783
+
784
+ if (!CameraPane.FULLSCREEN)
588785 {
589
- frame.getContentPane().remove(/*"Center",*/bigThree);
590
- framePanel.add(bigThree);
591
- frame.getContentPane().add(/*"Center",*/framePanel);
786
+ device.setFullScreenWindow(null);
787
+ frame.dispose();
788
+ frame.setUndecorated(false);
789
+ frame.validate();
790
+ frame.setVisible(true);
791
+
792
+ //frame.setVisible(false);
793
+// frame.removeNotify();
794
+// frame.setUndecorated(false);
795
+// frame.addNotify();
796
+ //frame.setBounds(keeprect.x, keeprect.y, keeprect.width, keeprect.height);
797
+
798
+// X frame.getContentPane().remove(/*"Center",*/bigThree);
799
+// X framePanel.add(bigThree);
800
+// X frame.getContentPane().add(/*"Center",*/framePanel);
801
+ framePanel.setDividerLocation(46);
802
+
803
+ //frame.setVisible(true);
804
+ radio.layout = keepButton;
805
+ //theFrame = null;
806
+ keepButton = null;
807
+ radio.layout.doClick();
808
+
592809 } else
593810 {
594
- frame.getContentPane().remove(/*"Center",*/framePanel);
595
- framePanel.remove(bigThree);
596
- frame.getContentPane().add(/*"Center",*/bigThree);
811
+ keepButton = radio.layout;
812
+ //keeprect = frame.getBounds();
813
+// frame.setBounds(0, 0, frame.getToolkit().getScreenSize().width,
814
+// frame.getToolkit().getScreenSize().height);
815
+ //frame.setVisible(false);
816
+
817
+ frame.dispose();
818
+ frame.setUndecorated(true);
819
+ device.setFullScreenWindow(frame);
820
+ frame.validate();
821
+ frame.setVisible(true);
822
+// frame.removeNotify();
823
+// frame.setUndecorated(true);
824
+// frame.addNotify();
825
+// X frame.getContentPane().remove(/*"Center",*/framePanel);
826
+// X framePanel.remove(bigThree);
827
+// X frame.getContentPane().add(/*"Center",*/bigThree);
828
+ framePanel.setDividerLocation(0);
829
+
830
+ radio.layout = fullscreenLayout;
831
+ radio.layout.doClick();
832
+ //frame.setVisible(true);
597833 }
598
- cameraView.ToggleFullScreen();
834
+ frame.validate();
599835 }
836
+
837
+ private byte[] CompressCopy()
838
+ {
839
+ boolean temp = CameraPane.SWITCH;
840
+ CameraPane.SWITCH = false;
841
+
842
+ copy.ExtractBigData(versiontable);
843
+ // if (copy == client)
844
+
845
+ byte[] versions[] = copy.versions;
846
+ copy.versions = null;
847
+
848
+ byte[] compress = Compress(copy);
849
+
850
+ copy.versions = versions;
851
+
852
+ copy.RestoreBigData(versiontable);
853
+
854
+ CameraPane.SWITCH = temp;
855
+
856
+ return compress;
857
+ }
600858
601859 private JTextPane createTextPane()
602860 {
....@@ -736,7 +994,12 @@
736994 JCheckBox speedupCB;
737995 JCheckBox rewindCB;
738996 JCheckBox flipVCB;
997
+
998
+ cCheckBox toggleTextureCB;
999
+ cCheckBox toggleSwitchCB;
1000
+
7391001 JComboBox texresMenu;
1002
+
7401003 JButton resetButton;
7411004 JButton stepButton;
7421005 JButton stepAllButton;
....@@ -745,9 +1008,13 @@
7451008 JButton fasterButton;
7461009 JButton remarkButton;
7471010
1011
+ cGridBag editPanel;
1012
+ cGridBag editCommandsPanel;
1013
+
7481014 cGridBag namePanel;
7491015 cGridBag setupPanel;
750
- cGridBag commandsPanel;
1016
+ cGridBag setupPanel2;
1017
+ cGridBag objectCommandsPanel;
7511018 cGridBag pushPanel;
7521019 cGridBag fillPanel;
7531020
....@@ -919,12 +1186,12 @@
9191186 namePanel = new cGridBag();
9201187
9211188 nameField = AddText(namePanel, copy.GetName());
922
- namePanel.add(nameField);
1189
+ namePanel.add(new JScrollPane(nameField, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER));
9231190 oe.ctrlPanel.add(namePanel);
9241191
9251192 oe.ctrlPanel.Return();
9261193
927
- if (!GroupEditor.allparams)
1194
+ if (!allparams)
9281195 return;
9291196
9301197 setupPanel = new cGridBag().setVertical(false);
....@@ -937,42 +1204,47 @@
9371204 hideCB = AddCheckBox(setupPanel, "Hide", copy.hide);
9381205 hideCB.setToolTipText("Hide object");
9391206 markCB = AddCheckBox(setupPanel, "Mark", copy.marked);
940
- markCB.setToolTipText("Set the animation target transform");
1207
+ markCB.setToolTipText("As animation target transform");
9411208
942
- rewindCB = AddCheckBox(setupPanel, "Rewind", copy.rewind);
1209
+ setupPanel2 = new cGridBag().setVertical(false);
1210
+
1211
+ rewindCB = AddCheckBox(setupPanel2, "Rewind", copy.rewind);
9431212 rewindCB.setToolTipText("Rewind animation");
9441213
945
- randomCB = AddCheckBox(setupPanel, "Random", copy.random);
946
- randomCB.setToolTipText("Option for switch node");
1214
+ randomCB = AddCheckBox(setupPanel2, "Random", copy.random);
1215
+ randomCB.setToolTipText("Randomly Rewind (or Go back and forth)");
9471216
1217
+ link2masterCB = AddCheckBox(setupPanel2, "Support", copy.link2master);
1218
+ link2masterCB.setToolTipText("Attach to support");
1219
+
9481220 if (Globals.ADVANCED)
9491221 {
950
- link2masterCB = AddCheckBox(setupPanel, "Support", copy.link2master);
951
- link2masterCB.setToolTipText("Attach to support");
952
- speedupCB = AddCheckBox(setupPanel, "Speed", copy.speedup);
1222
+ speedupCB = AddCheckBox(setupPanel2, "Speed", copy.speedup);
9531223 speedupCB.setToolTipText("Option motion capture");
9541224 }
9551225
9561226 oe.ctrlPanel.add(setupPanel);
9571227 oe.ctrlPanel.Return();
1228
+ oe.ctrlPanel.add(setupPanel2);
1229
+ oe.ctrlPanel.Return();
9581230
959
- commandsPanel = new cGridBag().setVertical(false);
1231
+ objectCommandsPanel = new cGridBag().setVertical(false);
9601232
961
- resetButton = AddButton(commandsPanel, "Reset");
1233
+ resetButton = AddButton(objectCommandsPanel, "Reset");
9621234 resetButton.setToolTipText("Jump to frame zero");
963
- stepButton = AddButton(commandsPanel, "Step");
1235
+ stepButton = AddButton(objectCommandsPanel, "Step");
9641236 stepButton.setToolTipText("Step one frame");
9651237 // resetAllButton = AddButton(oe, "Reset All");
9661238 // stepAllButton = AddButton(oe, "Step All");
9671239 // Return();
968
- slowerButton = AddButton(commandsPanel, "Slow");
1240
+ slowerButton = AddButton(objectCommandsPanel, "Slow");
9691241 slowerButton.setToolTipText("Decrease animation speed");
970
- fasterButton = AddButton(commandsPanel, "Fast");
1242
+ fasterButton = AddButton(objectCommandsPanel, "Fast");
9711243 fasterButton.setToolTipText("Increase animation speed");
972
- remarkButton = AddButton(commandsPanel, "Remark");
1244
+ remarkButton = AddButton(objectCommandsPanel, "Remark");
9731245 remarkButton.setToolTipText("Set the current transform as the target");
9741246
975
- oe.ctrlPanel.add(commandsPanel);
1247
+ oe.ctrlPanel.add(objectCommandsPanel);
9761248 oe.ctrlPanel.Return();
9771249
9781250 pushPanel = AddSlider(oe.ctrlPanel, "Push", -1, 1, copy.NORMALPUSH, 1.1); // To have the buttons
....@@ -1178,8 +1450,11 @@
11781450 //worldPanel.setName("World");
11791451 centralPanel = new cGridBag();
11801452 centralPanel.preferredWidth = 20;
1181
- timelinePanel = new JPanel(new BorderLayout());
1182
- timelineMenubar = new timeflow.app.TimeflowApp().TimeFlowWindow(timelinePanel);
1453
+
1454
+ if (Globals.ADVANCED)
1455
+ {
1456
+ timelinePanel = new JPanel(new BorderLayout());
1457
+ timelineMenubar = new timeflow.app.TimeflowApp().TimeFlowWindow(timelinePanel);
11831458
11841459 cameraPanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, cameraView, timelinePanel);
11851460 cameraPanel.setContinuousLayout(true);
....@@ -1188,7 +1463,10 @@
11881463 // cameraPanel.setDividerSize(9);
11891464 cameraPanel.setResizeWeight(1.0);
11901465
1466
+ }
1467
+
11911468 centralPanel.add(cameraView);
1469
+ centralPanel.setFocusable(true);
11921470 //frame.setJMenuBar(timelineMenubar);
11931471 //centralPanel.add(timelinePanel);
11941472
....@@ -1255,8 +1533,12 @@
12551533 // north.setName("Edit");
12561534 // north.add(ctrlPanel, BorderLayout.NORTH);
12571535 // objectPanel.add(north);
1258
- objectPanel.add(ctrlPanel);
1259
- objectPanel.add(infoPanel);
1536
+ objectPanel.add(editPanel);
1537
+
1538
+ //if (Globals.ADVANCED)
1539
+ objectPanel.add(infoPanel);
1540
+
1541
+ objectPanel.add(toolboxPanel);
12601542
12611543 /*
12621544 aConstraints.gridx = 0;
....@@ -1265,7 +1547,7 @@
12651547 aConstraints.gridy += 1;
12661548 aConstraints.gridwidth = 1;
12671549 mainPanel.add(objectPanel, aConstraints);
1268
- */
1550
+ */
12691551
12701552 scrollpane = new JScrollPane(mainPanel, ScrollPaneConstants.// VERTICAL_SCROLLBAR_ALWAYS,
12711553 VERTICAL_SCROLLBAR_AS_NEEDED,
....@@ -1282,9 +1564,7 @@
12821564 JTabbedPane tabbedPane = new JTabbedPane();
12831565 tabbedPane.add(scrollpane);
12841566
1285
- tabbedPane.add(FSPane = new cFileSystemPane(this));
1286
-
1287
- optionsPanel = new cGridBag().setVertical(true);
1567
+ optionsPanel = new cGridBag().setVertical(false);
12881568
12891569 optionsPanel.setName("Options");
12901570
....@@ -1292,6 +1572,8 @@
12921572
12931573 tabbedPane.add(optionsPanel);
12941574
1575
+ tabbedPane.add(FSPane = new cFileSystemPane(this));
1576
+
12951577 scenePanel.add(tabbedPane);
12961578
12971579 /*
....@@ -1364,9 +1646,9 @@
13641646 // aConstraints.gridheight = 1;
13651647
13661648 framePanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, toolbarPanel, bigThree);
1367
- framePanel.setContinuousLayout(true);
1368
- framePanel.setOneTouchExpandable(true);
1369
- framePanel.setDividerLocation(0.8);
1649
+ framePanel.setContinuousLayout(false);
1650
+ framePanel.setOneTouchExpandable(false);
1651
+ //.setDividerLocation(0.8);
13701652 //framePanel.setDividerSize(15);
13711653 //framePanel.setResizeWeight(0.15);
13721654 framePanel.setName("Frame");
....@@ -1384,9 +1666,14 @@
13841666 // aConstraints = gbc; // (GridBagConstraints) GrafreeD.clone(gbc);
13851667
13861668 frame.setSize(1280, 860);
1387
- frame.setVisible(true);
1388
-
1669
+
1670
+ cameraView.requestFocusInWindow();
1671
+
13891672 gridPanel.setDividerLocation(1.0);
1673
+
1674
+ frame.validate();
1675
+
1676
+ frame.setVisible(true);
13901677
13911678 frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
13921679 frame.addWindowListener(new WindowAdapter()
....@@ -1473,24 +1760,6 @@
14731760 texture.add(textureField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
14741761 colorSection.add(texture);
14751762
1476
- cGridBag anisoU = new cGridBag();
1477
- anisoU.add(anisoLabel = new JLabel("AnisoU")); // , aConstraints);
1478
- anisoLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1479
- anisoU.add(anisoField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1480
- colorSection.add(anisoU);
1481
-
1482
- cGridBag anisoV = new cGridBag();
1483
- anisoV.add(anisoVLabel = new JLabel("AnisoV")); // , aConstraints);
1484
- anisoVLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1485
- anisoV.add(anisoVField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1486
- colorSection.add(anisoV);
1487
-
1488
- cGridBag shadowbias = new cGridBag();
1489
- shadowbias.add(shadowbiasLabel = new JLabel("Shadowbias")); // , aConstraints);
1490
- shadowbiasLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1491
- shadowbias.add(shadowbiasField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1492
- colorSection.add(shadowbias);
1493
-
14941763 panel.add(new JSeparator());
14951764
14961765 panel.add(colorSection);
....@@ -1540,6 +1809,12 @@
15401809 fakedepthLabel.setHorizontalAlignment(SwingConstants.TRAILING);
15411810 fakedepth.add(fakedepthField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
15421811 diffuseSection.add(fakedepth);
1812
+
1813
+ cGridBag shadowbias = new cGridBag();
1814
+ shadowbias.add(shadowbiasLabel = new JLabel("Shadowbias")); // , aConstraints);
1815
+ shadowbiasLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1816
+ shadowbias.add(shadowbiasField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1817
+ diffuseSection.add(shadowbias);
15431818
15441819 panel.add(new JSeparator());
15451820
....@@ -1591,6 +1866,18 @@
15911866 // aConstraints.gridy += 1;
15921867 // aConstraints.gridwidth = 1;
15931868
1869
+ cGridBag anisoU = new cGridBag();
1870
+ anisoU.add(anisoLabel = new JLabel("AnisoU")); // , aConstraints);
1871
+ anisoLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1872
+ anisoU.add(anisoField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1873
+ specularSection.add(anisoU);
1874
+
1875
+ cGridBag anisoV = new cGridBag();
1876
+ anisoV.add(anisoVLabel = new JLabel("AnisoV")); // , aConstraints);
1877
+ anisoVLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1878
+ anisoV.add(anisoVField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1879
+ specularSection.add(anisoV);
1880
+
15941881
15951882 panel.add(new JSeparator());
15961883
....@@ -1598,35 +1885,35 @@
15981885
15991886 //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
16001887
1601
- cGridBag globalSection = new cGridBag().setVertical(true);
1888
+ //cGridBag globalSection = new cGridBag().setVertical(true);
16021889
16031890 cGridBag camera = new cGridBag();
16041891 camera.add(cameraLabel = new JLabel("GlobalLight")); // , aConstraints);
16051892 cameraLabel.setHorizontalAlignment(SwingConstants.TRAILING);
16061893 camera.add(cameraField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1607
- globalSection.add(camera);
1894
+ colorSection.add(camera);
16081895
16091896 cGridBag ambient = new cGridBag();
16101897 ambient.add(ambientLabel = new JLabel("Ambient")); // , aConstraints);
16111898 ambientLabel.setHorizontalAlignment(SwingConstants.TRAILING);
16121899 ambient.add(ambientField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1613
- globalSection.add(ambient);
1900
+ colorSection.add(ambient);
16141901
16151902 cGridBag backlit = new cGridBag();
16161903 backlit.add(backlitLabel = new JLabel("Backlit")); // , aConstraints);
16171904 backlitLabel.setHorizontalAlignment(SwingConstants.TRAILING);
16181905 backlit.add(backlitField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1619
- globalSection.add(backlit);
1906
+ colorSection.add(backlit);
16201907
16211908 cGridBag opacity = new cGridBag();
16221909 opacity.add(opacityLabel = new JLabel("Opacity")); // , aConstraints);
16231910 opacityLabel.setHorizontalAlignment(SwingConstants.TRAILING);
16241911 opacity.add(opacityField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1625
- globalSection.add(opacity);
1912
+ colorSection.add(opacity);
16261913
1627
- panel.add(new JSeparator());
1914
+ //panel.add(new JSeparator());
16281915
1629
- panel.add(globalSection);
1916
+ //panel.add(globalSection);
16301917
16311918 //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
16321919
....@@ -1733,8 +2020,9 @@
17332020 // 3D models
17342021 if (filename.endsWith(".3ds") || filename.endsWith(".3DS"))
17352022 {
1736
- lastConverter = new com.jmex.model.converters.MaxToJme();
1737
- LoadFile(filename, lastConverter);
2023
+ //lastConverter = new com.jmex.model.converters.MaxToJme();
2024
+ //LoadFile(filename, lastConverter);
2025
+ LoadObjFile(filename); // New 3ds loader
17382026 continue;
17392027 }
17402028 if (filename.endsWith(".dae") || filename.endsWith(".DAE"))
....@@ -2072,19 +2360,19 @@
20722360
20732361 void LoadObjFile(String fullname)
20742362 {
2075
- /*
2363
+ System.out.println("Loading " + fullname);
2364
+ /**/
20762365 //lastFilename = fullname;
20772366 if(loadObjThread == null)
20782367 {
2079
- loadObjThread = new LoadOBJThread();
2080
- loadObjThread.start();
2368
+ loadObjThread = new LoadOBJThread();
2369
+ loadObjThread.start();
20812370 }
20822371
20832372 loadObjThread.add(fullname);
2084
- */
2373
+ /**/
20852374
2086
- System.out.println("Loading " + fullname);
2087
- makeSomething(new FileObject(fullname, true), true);
2375
+ //makeSomething(new FileObject(fullname, true), true);
20882376 }
20892377
20902378 void LoadGFDFile(String fullname)
....@@ -2460,6 +2748,7 @@
24602748 LA.matXRotate(((Object3D) group.get(group.size() - 1)).toParent, -Math.PI / 2);
24612749 LA.matXRotate(((Object3D) group.get(group.size() - 1)).fromParent, Math.PI / 2);
24622750 }
2751
+
24632752 //cJME.count++;
24642753 //cJME.count %= 12;
24652754 if (gc)
....@@ -2643,6 +2932,7 @@
26432932 }
26442933 }
26452934 }
2935
+
26462936 cFileSystemPane FSPane;
26472937
26482938 void SetMaterial(cMaterial mat, Object3D.cVector2[] others)
....@@ -2696,11 +2986,14 @@
26962986 }
26972987 }
26982988 }
2989
+
26992990 freezematerial = false;
27002991 }
27012992
27022993 void SetMaterial(Object3D object)
27032994 {
2995
+ latestObject = object;
2996
+
27042997 cMaterial mat = object.material;
27052998
27062999 if (mat == null)
....@@ -2812,12 +3105,17 @@
28123105 // }
28133106
28143107 /**/
2815
- if (deselect)
3108
+ if (deselect || child == null)
28163109 {
28173110 //group.deselectAll();
28183111 //freeze = true;
28193112 GetTree().clearSelection();
28203113 //freeze = false;
3114
+
3115
+ if (child == null)
3116
+ {
3117
+ return;
3118
+ }
28213119 }
28223120
28233121 //group.addSelectee(child);
....@@ -2886,7 +3184,7 @@
28863184 cameraView.ToggleDL();
28873185 cameraView.repaint();
28883186 return;
2889
- } else if (event.getSource() == toggleTextureItem)
3187
+ } else if (event.getSource() == toggleTextureItem || event.getSource() == toggleTextureCB)
28903188 {
28913189 cameraView.ToggleTexture();
28923190 // june 2013 copy.HardTouch();
....@@ -2925,7 +3223,7 @@
29253223 frame.validate();
29263224
29273225 return;
2928
- } else if (event.getSource() == toggleSwitchItem)
3226
+ } else if (event.getSource() == toggleSwitchItem || event.getSource() == toggleSwitchCB)
29293227 {
29303228 cameraView.ToggleSwitch();
29313229 cameraView.repaint();
....@@ -3141,9 +3439,9 @@
31413439 {
31423440 Close();
31433441 //return true;
3144
- } else if (source == loadItem)
3442
+ } else if (source == openItem)
31453443 {
3146
- load();
3444
+ Open();
31473445 //return true;
31483446 } else if (source == newItem)
31493447 {
....@@ -3168,6 +3466,10 @@
31683466 {
31693467 generatePOV();
31703468 //return true;
3469
+ } else if (event.getSource() == archiveItem)
3470
+ {
3471
+ cTools.Archive(frame);
3472
+ return;
31713473 } else if (source == zBufferItem)
31723474 {
31733475 try
....@@ -3214,22 +3516,31 @@
32143516 objEditor.refreshContents();
32153517 }
32163518
3217
- static public byte[] Compress(Object o)
3519
+ static public byte[] Compress(Object3D o)
32183520 {
32193521 try
32203522 {
32213523 ByteArrayOutputStream baos = new ByteArrayOutputStream();
3222
- java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(baos);
3223
- ObjectOutputStream out = new ObjectOutputStream(zstream);
3524
+// java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(baos);
3525
+ ObjectOutputStream out = new ObjectOutputStream(baos); //zstream);
32243526
3527
+ Object3D parent = o.parent;
3528
+ o.parent = null;
3529
+
32253530 out.writeObject(o);
32263531
3532
+ o.parent = parent;
3533
+
32273534 out.flush();
32283535
3229
- zstream.close();
3536
+ baos //zstream
3537
+ .close();
32303538 out.close();
32313539
3232
- return baos.toByteArray();
3540
+ byte[] bytes = baos.toByteArray();
3541
+
3542
+ System.out.println("save #bytes = " + bytes.length);
3543
+ return bytes;
32333544 } catch (Exception e)
32343545 {
32353546 System.err.println(e);
....@@ -3239,13 +3550,16 @@
32393550
32403551 static public Object Uncompress(byte[] bytes)
32413552 {
3242
- System.out.println("#bytes = " + bytes.length);
3553
+ System.out.println("restore #bytes = " + bytes.length);
32433554 try
32443555 {
32453556 ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
3246
- java.util.zip.GZIPInputStream istream = new java.util.zip.GZIPInputStream(bais);
3247
- ObjectInputStream in = new ObjectInputStream(istream);
3557
+ //java.util.zip.GZIPInputStream istream = new java.util.zip.GZIPInputStream(bais);
3558
+ ObjectInputStream in = new ObjectInputStream(bais); // istream);
32483559 Object obj = in.readObject();
3560
+
3561
+ bais //istream
3562
+ .close();
32493563 in.close();
32503564
32513565 return obj;
....@@ -3300,37 +3614,77 @@
33003614 return null;
33013615 }
33023616
3303
- java.util.Hashtable<java.util.UUID, Object3D> hashtable = new java.util.Hashtable<java.util.UUID, Object3D>();
33043617
33053618 public void Save()
33063619 {
3620
+ //Save(true);
3621
+ Replace();
3622
+ }
3623
+
3624
+ private boolean Equal(byte[] compress, byte[] name)
3625
+ {
3626
+ if (compress.length != name.length)
3627
+ {
3628
+ return false;
3629
+ }
3630
+
3631
+ for (int i=compress.length; --i>=0;)
3632
+ {
3633
+ if (compress[i] != name[i])
3634
+ return false;
3635
+ }
3636
+
3637
+ return true;
3638
+ }
3639
+
3640
+ java.util.Hashtable<java.util.UUID, Object3D> versiontable = new java.util.Hashtable<java.util.UUID, Object3D>();
3641
+
3642
+ public boolean Save(boolean user)
3643
+ {
3644
+ System.err.println("Save");
3645
+
33073646 cRadio tab = GetCurrentTab();
33083647
3309
- boolean temp = CameraPane.SWITCH;
3310
- CameraPane.SWITCH = false;
3648
+ byte[] compress = CompressCopy();
33113649
3312
- copy.ExtractBigData(hashtable);
3650
+ boolean thesame = false;
3651
+
3652
+ // Quick heuristic using length. Works only when stream is compressed.
3653
+ if (copy.versionindex > 0 && copy.versions[copy.versionindex-1] != null && Equal(compress, copy.versions[copy.versionindex-1]))
3654
+ {
3655
+ thesame = true;
3656
+ }
33133657
33143658 //EditorFrame.m_MainFrame.requestFocusInWindow();
3315
- tab.graphs[tab.undoindex++] = Compress(copy);
3316
-
3317
- copy.RestoreBigData(hashtable);
3318
-
3319
- CameraPane.SWITCH = temp;
3320
-
3321
- //assert(hashtable.isEmpty());
3322
-
3323
- for (int i = tab.undoindex; i < tab.graphs.length; i++)
3659
+ if (!thesame)
33243660 {
3325
- tab.graphs[i] = null;
3661
+ //tab.user[tab.versionindex] = user;
3662
+ //boolean increment = true; // tab.graphs[tab.versionindex] == null;
3663
+
3664
+ copy.versions[++copy.versionindex] = compress;
3665
+
3666
+ // if (increment)
3667
+ // tab.versionindex++;
33263668 }
33273669
3670
+ //copy.RestoreBigData(versiontable);
3671
+
3672
+ //assert(hashtable.isEmpty());
3673
+
3674
+ for (int i = copy.versionindex+1; i < copy.versions.length; i++)
3675
+ {
3676
+ //tab.user[i] = false;
3677
+ copy.versions[i] = null;
3678
+ }
3679
+
3680
+ SetUndoStates();
3681
+
33283682 // test save
33293683 if (false)
33303684 {
33313685 try
33323686 {
3333
- FileOutputStream ostream = new FileOutputStream("save" + tab.undoindex);
3687
+ FileOutputStream ostream = new FileOutputStream("save" + copy.versionindex);
33343688 ObjectOutputStream p = new ObjectOutputStream(ostream);
33353689
33363690 p.writeObject(copy);
....@@ -3343,14 +3697,18 @@
33433697 e.printStackTrace();
33443698 }
33453699 }
3700
+
3701
+ return !thesame;
33463702 }
33473703
33483704 void CopyChanged(Object3D obj)
33493705 {
3706
+ SetUndoStates();
3707
+
33503708 boolean temp = CameraPane.SWITCH;
33513709 CameraPane.SWITCH = false;
33523710
3353
- copy.ExtractBigData(hashtable);
3711
+ copy.ExtractBigData(versiontable);
33543712
33553713 copy.clear();
33563714
....@@ -3359,7 +3717,7 @@
33593717 copy.add(obj.get(i));
33603718 }
33613719
3362
- copy.RestoreBigData(hashtable);
3720
+ copy.RestoreBigData(versiontable);
33633721
33643722 CameraPane.SWITCH = temp;
33653723
....@@ -3386,40 +3744,130 @@
33863744 refreshContents();
33873745 }
33883746
3389
- public void Undo()
3747
+ cButton undoButton;
3748
+ cButton restoreButton;
3749
+ cButton replaceButton;
3750
+ cButton redoButton;
3751
+
3752
+ boolean muteSlider;
3753
+
3754
+ int VersionCount()
3755
+ {
3756
+ int count = 0;
3757
+
3758
+ for (int i = copy.versions.length; --i >= 0;)
3759
+ {
3760
+ if (copy.versions[i] != null)
3761
+ count++;
3762
+ }
3763
+
3764
+ return count;
3765
+ }
3766
+
3767
+ void SetUndoStates()
33903768 {
33913769 cRadio tab = GetCurrentTab();
33923770
3393
- if (tab.undoindex == 0)
3771
+ restoreButton.setEnabled(copy.versionindex != -1);
3772
+ replaceButton.setEnabled(copy.versionindex != -1);
3773
+
3774
+ undoButton.setEnabled(copy.versionindex > 0);
3775
+ redoButton.setEnabled(copy.versions[copy.versionindex + 1] != null);
3776
+
3777
+ muteSlider = true;
3778
+ versionSlider.setMaximum(VersionCount() - 1);
3779
+ versionSlider.setInteger(copy.versionindex);
3780
+ muteSlider = false;
3781
+ }
3782
+
3783
+ public boolean Undo()
3784
+ {
3785
+ // Option?
3786
+ Replace();
3787
+
3788
+ System.err.println("Undo");
3789
+
3790
+ cRadio tab = GetCurrentTab();
3791
+
3792
+ if (copy.versionindex == 0)
33943793 {
33953794 java.awt.Toolkit.getDefaultToolkit().beep();
3396
- return;
3795
+ return false;
33973796 }
33983797
3399
- if (tab.graphs[tab.undoindex] == null)
3798
+// if (tab.graphs[tab.versionindex] == null) // || !tab.user[tab.versionindex])
3799
+// {
3800
+// if (Save(false))
3801
+// tab.versionindex -= 1;
3802
+// else
3803
+// {
3804
+// if (tab.versionindex <= 0)
3805
+// return false;
3806
+// else
3807
+// tab.versionindex -= 1;
3808
+// }
3809
+// }
3810
+
3811
+ copy.versionindex -= 1;
3812
+
3813
+ CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex]));
3814
+
3815
+ return true;
3816
+ }
3817
+
3818
+ public boolean Restore()
3819
+ {
3820
+ System.err.println("Restore");
3821
+
3822
+ cRadio tab = GetCurrentTab();
3823
+
3824
+ if (copy.versionindex == -1 || copy.versions[copy.versionindex] == null)
34003825 {
3401
- Save();
3402
- tab.undoindex -= 1;
3826
+ java.awt.Toolkit.getDefaultToolkit().beep();
3827
+ return false;
34033828 }
34043829
3405
- tab.undoindex -= 1;
3830
+ CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex]));
3831
+
3832
+ return true;
3833
+ }
34063834
3407
- CopyChanged((Object3D)Uncompress(tab.graphs[tab.undoindex]));
3835
+ public boolean Replace()
3836
+ {
3837
+ System.err.println("Replace");
3838
+
3839
+ cRadio tab = GetCurrentTab();
3840
+
3841
+ if (copy.versionindex == -1 || copy.versions[copy.versionindex] == null)
3842
+ {
3843
+ // No version yet. OK. java.awt.Toolkit.getDefaultToolkit().beep();
3844
+ return false;
3845
+ }
3846
+
3847
+ copy.versions[copy.versionindex] = CompressCopy();
3848
+
3849
+ return true;
34083850 }
34093851
34103852 public void Redo()
34113853 {
3854
+ // Option?
3855
+ Replace();
3856
+
34123857 cRadio tab = GetCurrentTab();
34133858
3414
- if (tab.graphs[tab.undoindex + 1] == null)
3859
+ if (copy.versions[copy.versionindex + 1] == null)
34153860 {
34163861 java.awt.Toolkit.getDefaultToolkit().beep();
34173862 return;
34183863 }
34193864
3420
- tab.undoindex += 1;
3865
+ copy.versionindex += 1;
34213866
3422
- CopyChanged((Object3D)Uncompress(tab.graphs[tab.undoindex]));
3867
+ CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex]));
3868
+
3869
+ //if (!tab.user[tab.versionindex])
3870
+ // tab.graphs[tab.versionindex] = null;
34233871 }
34243872
34253873 void ImportGFD()
....@@ -3571,7 +4019,7 @@
35714019 assert false;
35724020 }
35734021
3574
- void EditSelection()
4022
+ void EditSelection(boolean newWindow)
35754023 {
35764024 }
35774025
....@@ -3715,9 +4163,25 @@
37154163 //copy.Touch();
37164164 }
37174165
4166
+ cNumberSlider versionSlider;
4167
+
37184168 public void stateChanged(ChangeEvent e)
37194169 {
37204170 // assert(false);
4171
+ if (e.getSource() == versionSlider)
4172
+ {
4173
+ if (muteSlider)
4174
+ return;
4175
+
4176
+ int version = versionSlider.getInteger();
4177
+
4178
+ if (copy.versions[version] != null)
4179
+ {
4180
+ CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex = version]));
4181
+ }
4182
+
4183
+ return;
4184
+ }
37214185
37224186 if (freezematerial)
37234187 {
....@@ -4066,7 +4530,8 @@
40664530
40674531 void makeSomething(Object3D thing, boolean resetmodel) // deselect)
40684532 {
4069
- Save();
4533
+ if (Globals.REPLACEONMAKE) // && resetmodel)
4534
+ Save();
40704535 //Tween.set(thing, 0).target(1).start(tweenManager);
40714536 //Tween.to(thing, 0, 0.5f).target(0).start(tweenManager);
40724537 // if (thing instanceof GenericJointDemo)
....@@ -4153,6 +4618,12 @@
41534618 {
41544619 ResetModel();
41554620 Select(thing.GetTreePath(), true, false); // unselect... false);
4621
+
4622
+ if (thing.Size() == 0)
4623
+ {
4624
+ //EditSelection(false);
4625
+ }
4626
+
41564627 refreshContents();
41574628 }
41584629
....@@ -4290,6 +4761,7 @@
42904761
42914762 try
42924763 {
4764
+ // Try compressed version first.
42934765 java.io.FileInputStream istream = new java.io.FileInputStream(fullname);
42944766 java.util.zip.GZIPInputStream zstream = new java.util.zip.GZIPInputStream(istream);
42954767 java.io.ObjectInputStream p = new java.io.ObjectInputStream(zstream);
....@@ -4359,6 +4831,12 @@
43594831
43604832 void LoadIt(Object obj)
43614833 {
4834
+ if (obj == null)
4835
+ {
4836
+ // Invalid file
4837
+ return;
4838
+ }
4839
+
43624840 System.out.println("Loaded " + obj);
43634841 //new Exception().printStackTrace();
43644842 Object3D readobj = (Object3D) obj;
....@@ -4368,7 +4846,8 @@
43684846
43694847 if (readobj != null)
43704848 {
4371
- Save();
4849
+ //if (Globals.SAVEONMAKE) // A new object cannot share meshes
4850
+ // Save();
43724851 try
43734852 {
43744853 //readobj.deepCopySelf(copy);
....@@ -4423,13 +4902,24 @@
44234902 c.addChild(csg);
44244903 }
44254904
4905
+ copy.versions = readobj.versions;
4906
+ copy.versionindex = readobj.versionindex;
4907
+
4908
+ if (copy.versions == null)
4909
+ {
4910
+ copy.versions = new byte[100][];
4911
+ copy.versionindex = -1;
4912
+ }
4913
+
4914
+ //? SetUndoStates();
4915
+
44264916 ResetModel();
44274917 copy.HardTouch(); // recompile?
44284918 refreshContents();
44294919 }
44304920 }
44314921
4432
- void load() // throws ClassNotFoundException
4922
+ void Open() // throws ClassNotFoundException
44334923 {
44344924 if (Grafreed.standAlone)
44354925 {
....@@ -4546,6 +5036,8 @@
45465036 String filename = browser.getFile();
45475037 if (filename != null && filename.length() > 0)
45485038 {
5039
+ if (!filename.endsWith(".gfd"))
5040
+ filename += ".gfd";
45495041 lastname = browser.getDirectory() + filename;
45505042 save();
45515043 }
....@@ -4712,7 +5204,7 @@
47125204 MenuBar menuBar;
47135205 Menu fileMenu;
47145206 MenuItem newItem;
4715
- MenuItem loadItem;
5207
+ MenuItem openItem;
47165208 MenuItem saveItem;
47175209 MenuItem saveAsItem;
47185210 MenuItem exportAsItem;
....@@ -4735,22 +5227,36 @@
47355227 CheckboxMenuItem toggleSwitchItem;
47365228 CheckboxMenuItem toggleRootItem;
47375229 CheckboxMenuItem animationItem;
5230
+ MenuItem archiveItem;
47385231 CheckboxMenuItem toggleHandleItem;
47395232 CheckboxMenuItem togglePaintItem;
47405233 JSplitPane mainPanel;
47415234 JScrollPane scrollpane;
5235
+
47425236 JPanel toolbarPanel;
5237
+
47435238 cGridBag treePanel;
5239
+
47445240 JPanel radioPanel;
47455241 ButtonGroup buttonGroup;
4746
- cGridBag ctrlPanel;
5242
+
5243
+ cGridBag toolboxPanel;
47475244 cGridBag materialPanel;
5245
+ cGridBag ctrlPanel;
5246
+
47485247 JScrollPane infoPanel;
5248
+
47495249 cGridBag optionsPanel;
5250
+
47505251 JTabbedPane objectPanel;
5252
+ boolean materialFlushed;
5253
+ Object3D latestObject;
5254
+
47515255 cGridBag XYZPanel;
5256
+
47525257 JSplitPane gridPanel;
47535258 JSplitPane bigPanel;
5259
+
47545260 cGridBag bigThree;
47555261 cGridBag scenePanel;
47565262 cGridBag centralPanel;
....@@ -4865,7 +5371,7 @@
48655371 cNumberSlider fogField;
48665372 JLabel opacityPowerLabel;
48675373 cNumberSlider opacityPowerField;
4868
- JTree jTree;
5374
+ cTree jTree;
48695375 //ObjectUI parent;
48705376
48715377 cNumberSlider normalpushField;