Normand Briere
2019-08-01 90c87ae87a6d1b88ed8398da7bb95629f0df5b09
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,53 @@
3539
3640 GroupEditor callee;
3741 JFrame frame;
42
+
43
+ static ObjEditor theFrame;
44
+
45
+ cButton GetButton(String name, boolean border)
46
+ {
47
+ ImageIcon icon = GetIcon(name);
48
+ return new cButton(icon, border);
49
+ }
50
+
51
+ cToggleButton GetToggleButton(String name, boolean border)
52
+ {
53
+ ImageIcon icon = GetIcon(name);
54
+ return new cToggleButton(icon, border);
55
+ }
56
+
57
+ cCheckBox GetCheckBox(String name, boolean border)
58
+ {
59
+ ImageIcon icon = GetIcon(name);
60
+ return new cCheckBox(icon, border);
61
+ }
62
+
63
+ ImageIcon GetIcon(String name)
64
+ {
65
+ try
66
+ {
67
+ BufferedImage image = javax.imageio.ImageIO.read(getClass().getClassLoader().getResourceAsStream(name));
68
+
69
+// if (image.getWidth() > 48 && image.getHeight() > 48)
70
+// {
71
+// BufferedImage resized = new BufferedImage(48, 48, image.getType());
72
+// Graphics2D g = resized.createGraphics();
73
+// g.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR);
74
+// //g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
75
+// g.drawImage(image, 0, 0, 48, 48, 0, 0, image.getWidth(), image.getHeight(), null);
76
+// g.dispose();
77
+//
78
+// image = resized;
79
+// }
80
+
81
+ javax.swing.ImageIcon icon = new javax.swing.ImageIcon(image);
82
+ return icon;
83
+ }
84
+ catch (Exception e)
85
+ {
86
+ return null;
87
+ }
88
+ }
3889
3990 // SCRIPT
4091
....@@ -145,7 +196,7 @@
145196
146197 objEditor.ctrlPanel.remove(namePanel);
147198
148
- if (!GroupEditor.allparams)
199
+ if (!allparams)
149200 return;
150201
151202 // objEditor.ctrlPanel.remove(liveCB);
....@@ -169,7 +220,7 @@
169220
170221 objEditor.ctrlPanel.remove(setupPanel);
171222 objEditor.ctrlPanel.remove(setupPanel2);
172
- objEditor.ctrlPanel.remove(commandsPanel);
223
+ objEditor.ctrlPanel.remove(objectCommandsPanel);
173224 objEditor.ctrlPanel.remove(pushPanel);
174225 //objEditor.ctrlPanel.remove(fillPanel);
175226
....@@ -217,6 +268,12 @@
217268 client = inClient;
218269 copy = client;
219270
271
+ if (copy.versions == null)
272
+ {
273
+ copy.versions = new byte[100][];
274
+ copy.versionindex = -1;
275
+ }
276
+
220277 // "this" is not called: SetupUI2(objEditor);
221278 }
222279
....@@ -230,6 +287,12 @@
230287 client = inClient;
231288 copy = client;
232289
290
+ if (copy.versions == null)
291
+ {
292
+ copy.versions = new byte[100][];
293
+ copy.versionindex = -1;
294
+ }
295
+
233296 SetupUI2(callee.GetEditor());
234297 }
235298
....@@ -244,6 +307,7 @@
244307 //localCopy.parent = null;
245308
246309 frame = new JFrame();
310
+ frame.setUndecorated(false);
247311 objEditor = this;
248312 this.callee = callee;
249313
....@@ -261,6 +325,12 @@
261325 copy = localCopy;
262326 copy.editWindow = this;
263327
328
+ if (copy.versions == null)
329
+ {
330
+// copy.versions = new byte[100][];
331
+// copy.versionindex = -1;
332
+ }
333
+
264334 SetupMenu();
265335
266336 //SetupName(objEditor); // new
....@@ -274,12 +344,17 @@
274344 return frame.action(event, obj);
275345 }
276346
347
+ // Cannot work without static
348
+ static boolean allparams = true;
349
+
350
+ static java.util.Vector<Object3D> listUI = new java.util.Vector<Object3D>();
351
+
277352 void SetupMenu()
278353 {
279354 frame.setMenuBar(menuBar = new MenuBar());
280355 menuBar.add(fileMenu = new Menu("File"));
281356 fileMenu.add(newItem = new MenuItem("New"));
282
- fileMenu.add(loadItem = new MenuItem("Open..."));
357
+ fileMenu.add(openItem = new MenuItem("Open..."));
283358
284359 //oe.menuBar.add(menu = new Menu("Include"));
285360 Menu menu = new Menu("Import");
....@@ -311,7 +386,7 @@
311386 }
312387
313388 newItem.addActionListener(this);
314
- loadItem.addActionListener(this);
389
+ openItem.addActionListener(this);
315390 saveItem.addActionListener(this);
316391 saveAsItem.addActionListener(this);
317392 exportAsItem.addActionListener(this);
....@@ -320,28 +395,68 @@
320395 closeItem.addActionListener(this);
321396
322397 objectPanel = new JTabbedPane();
398
+
399
+ ChangeListener changeListener = new ChangeListener()
400
+ {
401
+ public void stateChanged(ChangeEvent changeEvent)
402
+ {
403
+// if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Material") && !materialFlushed)
404
+// {
405
+// if (latestObject != null)
406
+// {
407
+// refreshContents(true);
408
+// SetMaterial(latestObject);
409
+// }
410
+//
411
+// materialFlushed = true;
412
+// }
413
+// if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Edit"))
414
+// {
415
+// if (listUI.size() == 0)
416
+// EditSelection(false);
417
+// }
418
+
419
+ refreshContents(false); // To refresh Info tab
420
+ }
421
+ };
422
+ objectPanel.addChangeListener(changeListener);
423
+
323424 toolbarPanel = new JPanel();
324425 toolbarPanel.setName("Toolbar");
426
+
325427 treePanel = new cGridBag();
326428 treePanel.setName("Tree");
429
+
430
+ editPanel = new cGridBag().setVertical(true);
431
+ //editPanel.setName("Edit");
432
+
327433 ctrlPanel = new cGridBag().setVertical(false); // new GridBagLayout());
328
- ctrlPanel.setName("Edit");
434
+
435
+ editCommandsPanel = new cGridBag();
436
+ editPanel.add(editCommandsPanel);
437
+ editPanel.add(ctrlPanel);
438
+
439
+ toolboxPanel = new cGridBag().setVertical(true);
440
+ //toolboxPanel.setName("Toolbox");
441
+
329442 materialPanel = new cGridBag().setVertical(true);
330
- materialPanel.setName("Material");
443
+ //materialPanel.setName("Material");
444
+
331445 /*JTextPane*/
332446 infoarea = createTextPane();
333447 doc = infoarea.getStyledDocument();
334448
335449 infoarea.setEditable(true);
336450 SetText();
451
+
337452 // infoarea.setFont(infoarea.getFont().deriveFont(10, 14f));
338453 // infoarea.setOpaque(false);
339454 // //infoarea.setForeground(textcolor);
340455 // TEXTAREA infoarea.setLineWrap(true);
341456 // TEXTAREA infoarea.setWrapStyleWord(true);
342457 infoPanel = new JScrollPane(infoarea, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); //AS_NEEDED);
343
- infoPanel.setPreferredSize(new Dimension(50, 200));
344
- infoPanel.setName("Info");
458
+ infoPanel.setPreferredSize(new Dimension(1, 1));
459
+ //infoPanel.setName("Info");
345460 //infoPanel.setLayout(new BorderLayout());
346461 //infoPanel.add(createTextPane());
347462
....@@ -352,7 +467,14 @@
352467 mainPanel.setDividerSize(9);
353468 mainPanel.setDividerLocation(0.5); //1.0);
354469 mainPanel.setResizeWeight(0.5);
355
-
470
+
471
+//mainPanel.setDividerSize((int) (mainPanel.getDividerSize() * 1.5));
472
+ BasicSplitPaneDivider divider = ( (BasicSplitPaneUI) mainPanel.getUI()).getDivider();
473
+ divider.setDividerSize(15);
474
+ divider.setBorder(BorderFactory.createTitledBorder(divider.getBorder(), "Custom border title -- gets rid of the one-touch arrows!"));
475
+
476
+ mainPanel.setUI(new BasicSplitPaneUI());
477
+
356478 //ctrlPanel.setLayout(new GridLayout(4, 1, 5, 5));
357479 //mainPanel.setLayout(new GridBagLayout());
358480 toolbarPanel.setLayout(new FlowLayout(FlowLayout.LEFT));
....@@ -583,21 +705,144 @@
583705 }
584706 }
585707
708
+//static GraphicsDevice device = GraphicsEnvironment
709
+// .getLocalGraphicsEnvironment().getScreenDevices()[0];
710
+
711
+ Rectangle keeprect;
712
+ cRadio radio;
713
+
714
+cButton keepButton;
715
+ cButton twoButton; // Full 3D
716
+ cButton sixButton;
717
+ cButton threeButton;
718
+ cButton sevenButton;
719
+ cButton fourButton; // full panel
720
+ cButton oneButton; // full XYZ
721
+ //cButton currentLayout;
722
+
723
+ boolean maximized;
724
+
725
+ cButton fullscreenLayout;
726
+
727
+ void Minimize()
728
+ {
729
+ frame.setState(Frame.ICONIFIED);
730
+ frame.validate();
731
+ }
732
+
733
+// artifactURI=null, type=0, property=${file.reference.jfxrt.jar}, object=org.netbeans.modules.java.api.common.classpath.ClassPathSupport$RelativePath@6767876f, broken=false, additional={}
734
+// artifactURI=null, type=0, property=${file.reference.mac-ui.jar}, object=org.netbeans.modules.java.api.common.classpath.ClassPathSupport$RelativePath@16bdc817, broken=false, additional={}
735
+// artifactURI=null, type=0, property=${file.reference.classes.jar}, object=org.netbeans.modules.java.api.common.classpath.ClassPathSupport$RelativePath@9daa9c17, broken=false, additional={}
736
+ void Maximize()
737
+ {
738
+ if (CameraPane.FULLSCREEN)
739
+ {
740
+ ToggleFullScreen();
741
+ }
742
+
743
+ if (maximized)
744
+ {
745
+ frame.setBounds(keeprect.x, keeprect.y, keeprect.width, keeprect.height);
746
+ }
747
+ else
748
+ {
749
+ keeprect = frame.getBounds();
750
+// Rectangle rect = GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds();
751
+// Dimension rect2 = frame.getToolkit().getScreenSize();
752
+// frame.setBounds(0, rect2.height - rect.height, rect.width, rect.height);
753
+// frame.setState(Frame.MAXIMIZED_BOTH);
754
+ frame.setBounds(frame.getGraphicsConfiguration().getBounds());
755
+ }
756
+
757
+ maximized ^= true;
758
+
759
+ frame.validate();
760
+ }
761
+
762
+ cButton minButton;
763
+ cButton maxButton;
764
+ cButton fullButton;
765
+
586766 void ToggleFullScreen()
587767 {
588
- if (CameraPane.FULLSCREEN)
768
+GraphicsDevice device = frame.getGraphicsConfiguration().getDevice();
769
+
770
+ cameraView.ToggleFullScreen();
771
+
772
+ if (!CameraPane.FULLSCREEN)
589773 {
590
- frame.getContentPane().remove(/*"Center",*/bigThree);
591
- framePanel.add(bigThree);
592
- frame.getContentPane().add(/*"Center",*/framePanel);
774
+ device.setFullScreenWindow(null);
775
+ frame.dispose();
776
+ frame.setUndecorated(false);
777
+ frame.validate();
778
+ frame.setVisible(true);
779
+
780
+ //frame.setVisible(false);
781
+// frame.removeNotify();
782
+// frame.setUndecorated(false);
783
+// frame.addNotify();
784
+ //frame.setBounds(keeprect.x, keeprect.y, keeprect.width, keeprect.height);
785
+
786
+// X frame.getContentPane().remove(/*"Center",*/bigThree);
787
+// X framePanel.add(bigThree);
788
+// X frame.getContentPane().add(/*"Center",*/framePanel);
789
+ framePanel.setDividerLocation(46);
790
+
791
+ //frame.setVisible(true);
792
+ radio.layout = keepButton;
793
+ //theFrame = null;
794
+ keepButton = null;
795
+ radio.layout.doClick();
796
+
593797 } else
594798 {
595
- frame.getContentPane().remove(/*"Center",*/framePanel);
596
- framePanel.remove(bigThree);
597
- frame.getContentPane().add(/*"Center",*/bigThree);
799
+ keepButton = radio.layout;
800
+ //keeprect = frame.getBounds();
801
+// frame.setBounds(0, 0, frame.getToolkit().getScreenSize().width,
802
+// frame.getToolkit().getScreenSize().height);
803
+ //frame.setVisible(false);
804
+
805
+ frame.dispose();
806
+ frame.setUndecorated(true);
807
+ device.setFullScreenWindow(frame);
808
+ frame.validate();
809
+ frame.setVisible(true);
810
+// frame.removeNotify();
811
+// frame.setUndecorated(true);
812
+// frame.addNotify();
813
+// X frame.getContentPane().remove(/*"Center",*/framePanel);
814
+// X framePanel.remove(bigThree);
815
+// X frame.getContentPane().add(/*"Center",*/bigThree);
816
+ framePanel.setDividerLocation(0);
817
+
818
+ radio.layout = fullscreenLayout;
819
+ radio.layout.doClick();
820
+ //frame.setVisible(true);
598821 }
599
- cameraView.ToggleFullScreen();
822
+ frame.validate();
600823 }
824
+
825
+ private byte[] CompressCopy()
826
+ {
827
+ boolean temp = CameraPane.SWITCH;
828
+ CameraPane.SWITCH = false;
829
+
830
+ copy.ExtractBigData(versiontable);
831
+ // if (copy == client)
832
+
833
+ byte[] versions[] = copy.versions;
834
+ copy.versions = null;
835
+
836
+ byte[] compress = Compress(copy);
837
+
838
+ copy.versions = versions;
839
+
840
+ copy.RestoreBigData(versiontable);
841
+
842
+ CameraPane.SWITCH = temp;
843
+
844
+ return compress;
845
+ }
601846
602847 private JTextPane createTextPane()
603848 {
....@@ -729,7 +974,7 @@
729974 // NumberSlider vDivsField;
730975 // JCheckBox endcaps;
731976 JCheckBox liveCB;
732
- JCheckBox selectCB;
977
+ JCheckBox selectableCB;
733978 JCheckBox hideCB;
734979 JCheckBox link2masterCB;
735980 JCheckBox markCB;
....@@ -737,7 +982,12 @@
737982 JCheckBox speedupCB;
738983 JCheckBox rewindCB;
739984 JCheckBox flipVCB;
985
+
986
+ cCheckBox toggleTextureCB;
987
+ cCheckBox toggleSwitchCB;
988
+
740989 JComboBox texresMenu;
990
+
741991 JButton resetButton;
742992 JButton stepButton;
743993 JButton stepAllButton;
....@@ -746,10 +996,13 @@
746996 JButton fasterButton;
747997 JButton remarkButton;
748998
999
+ cGridBag editPanel;
1000
+ cGridBag editCommandsPanel;
1001
+
7491002 cGridBag namePanel;
7501003 cGridBag setupPanel;
7511004 cGridBag setupPanel2;
752
- cGridBag commandsPanel;
1005
+ cGridBag objectCommandsPanel;
7531006 cGridBag pushPanel;
7541007 cGridBag fillPanel;
7551008
....@@ -921,38 +1174,42 @@
9211174 namePanel = new cGridBag();
9221175
9231176 nameField = AddText(namePanel, copy.GetName());
924
- namePanel.add(nameField);
1177
+ namePanel.add(new JScrollPane(nameField, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER));
9251178 oe.ctrlPanel.add(namePanel);
9261179
9271180 oe.ctrlPanel.Return();
9281181
929
- if (!GroupEditor.allparams)
1182
+ if (!allparams)
9301183 return;
9311184
9321185 setupPanel = new cGridBag().setVertical(false);
9331186
9341187 liveCB = AddCheckBox(setupPanel, "Live", copy.live);
9351188 liveCB.setToolTipText("Animate object");
936
- selectCB = AddCheckBox(setupPanel, "Select", !copy.dontselect);
937
- selectCB.setToolTipText("Make object selectable");
1189
+ selectableCB = AddCheckBox(setupPanel, "Select", !copy.dontselect);
1190
+ selectableCB.setToolTipText("Make object selectable");
9381191 // Return();
1192
+
9391193 hideCB = AddCheckBox(setupPanel, "Hide", copy.hide);
9401194 hideCB.setToolTipText("Hide object");
9411195 markCB = AddCheckBox(setupPanel, "Mark", copy.marked);
942
- markCB.setToolTipText("Set the animation target transform");
1196
+ markCB.setToolTipText("As animation target transform");
1197
+
1198
+ ToolTipManager.sharedInstance().setLightWeightPopupEnabled(false);
9431199
9441200 setupPanel2 = new cGridBag().setVertical(false);
9451201
9461202 rewindCB = AddCheckBox(setupPanel2, "Rewind", copy.rewind);
9471203 rewindCB.setToolTipText("Rewind animation");
9481204
949
- randomCB = AddCheckBox(setupPanel2, "Rand", copy.random);
950
- randomCB.setToolTipText("Rewind or Go back and forth randomly");
1205
+ randomCB = AddCheckBox(setupPanel2, "Random", copy.random);
1206
+ randomCB.setToolTipText("Randomly Rewind (or Go back and forth)");
9511207
1208
+ link2masterCB = AddCheckBox(setupPanel2, "Support", copy.link2master);
1209
+ link2masterCB.setToolTipText("Attach to support");
1210
+
9521211 if (Globals.ADVANCED)
9531212 {
954
- link2masterCB = AddCheckBox(setupPanel2, "Supp", copy.link2master);
955
- link2masterCB.setToolTipText("Attach to support");
9561213 speedupCB = AddCheckBox(setupPanel2, "Speed", copy.speedup);
9571214 speedupCB.setToolTipText("Option motion capture");
9581215 }
....@@ -962,23 +1219,23 @@
9621219 oe.ctrlPanel.add(setupPanel2);
9631220 oe.ctrlPanel.Return();
9641221
965
- commandsPanel = new cGridBag().setVertical(false);
1222
+ objectCommandsPanel = new cGridBag().setVertical(false);
9661223
967
- resetButton = AddButton(commandsPanel, "Reset");
1224
+ resetButton = AddButton(objectCommandsPanel, "Reset");
9681225 resetButton.setToolTipText("Jump to frame zero");
969
- stepButton = AddButton(commandsPanel, "Step");
1226
+ stepButton = AddButton(objectCommandsPanel, "Step");
9701227 stepButton.setToolTipText("Step one frame");
9711228 // resetAllButton = AddButton(oe, "Reset All");
9721229 // stepAllButton = AddButton(oe, "Step All");
9731230 // Return();
974
- slowerButton = AddButton(commandsPanel, "Slow");
1231
+ slowerButton = AddButton(objectCommandsPanel, "Slow");
9751232 slowerButton.setToolTipText("Decrease animation speed");
976
- fasterButton = AddButton(commandsPanel, "Fast");
1233
+ fasterButton = AddButton(objectCommandsPanel, "Fast");
9771234 fasterButton.setToolTipText("Increase animation speed");
978
- remarkButton = AddButton(commandsPanel, "Remark");
1235
+ remarkButton = AddButton(objectCommandsPanel, "Remark");
9791236 remarkButton.setToolTipText("Set the current transform as the target");
9801237
981
- oe.ctrlPanel.add(commandsPanel);
1238
+ oe.ctrlPanel.add(objectCommandsPanel);
9821239 oe.ctrlPanel.Return();
9831240
9841241 pushPanel = AddSlider(oe.ctrlPanel, "Push", -1, 1, copy.NORMALPUSH, 1.1); // To have the buttons
....@@ -1184,8 +1441,11 @@
11841441 //worldPanel.setName("World");
11851442 centralPanel = new cGridBag();
11861443 centralPanel.preferredWidth = 20;
1187
- timelinePanel = new JPanel(new BorderLayout());
1188
- timelineMenubar = new timeflow.app.TimeflowApp().TimeFlowWindow(timelinePanel);
1444
+
1445
+ if (Globals.ADVANCED)
1446
+ {
1447
+ timelinePanel = new JPanel(new BorderLayout());
1448
+ timelineMenubar = new timeflow.app.TimeflowApp().TimeFlowWindow(timelinePanel);
11891449
11901450 cameraPanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, cameraView, timelinePanel);
11911451 cameraPanel.setContinuousLayout(true);
....@@ -1194,7 +1454,10 @@
11941454 // cameraPanel.setDividerSize(9);
11951455 cameraPanel.setResizeWeight(1.0);
11961456
1457
+ }
1458
+
11971459 centralPanel.add(cameraView);
1460
+ centralPanel.setFocusable(true);
11981461 //frame.setJMenuBar(timelineMenubar);
11991462 //centralPanel.add(timelinePanel);
12001463
....@@ -1220,6 +1483,7 @@
12201483 XYZPanel.addComponent(/*BorderLayout.SOUTH,*/sideView); // Scroll);
12211484 XYZPanel.addComponent(/*BorderLayout.CENTER,*/frontView); // Scroll);
12221485 XYZPanel.addComponent(/*BorderLayout.NORTH,*/topView); // Scroll);
1486
+ //XYZPanel.setName("XYZ");
12231487
12241488 /*
12251489 gridPanel = new JPanel(); //new BorderLayout());
....@@ -1257,12 +1521,23 @@
12571521 //JScrollPane tmp = new JScrollPane(ctrlPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
12581522 //tmp.setName("Edit");
12591523 objectPanel.add(materialPanel);
1524
+ objectPanel.setIconAt(0, GetIcon("icons/material.png"));
12601525 // JPanel north = new JPanel(new BorderLayout());
12611526 // north.setName("Edit");
12621527 // north.add(ctrlPanel, BorderLayout.NORTH);
12631528 // objectPanel.add(north);
1264
- objectPanel.add(ctrlPanel);
1265
- objectPanel.add(infoPanel);
1529
+ objectPanel.add(editPanel);
1530
+ objectPanel.setIconAt(1, GetIcon("icons/write.png"));
1531
+
1532
+ //if (Globals.ADVANCED)
1533
+ objectPanel.add(infoPanel);
1534
+ objectPanel.setIconAt(2, GetIcon("icons/info.png"));
1535
+
1536
+ objectPanel.add(XYZPanel);
1537
+ objectPanel.setIconAt(3, GetIcon("icons/XYZ.png"));
1538
+
1539
+ objectPanel.add(toolboxPanel);
1540
+ objectPanel.setIconAt(4, GetIcon("icons/primitives.png"));
12661541
12671542 /*
12681543 aConstraints.gridx = 0;
....@@ -1271,7 +1546,7 @@
12711546 aConstraints.gridy += 1;
12721547 aConstraints.gridwidth = 1;
12731548 mainPanel.add(objectPanel, aConstraints);
1274
- */
1549
+ */
12751550
12761551 scrollpane = new JScrollPane(mainPanel, ScrollPaneConstants.// VERTICAL_SCROLLBAR_ALWAYS,
12771552 VERTICAL_SCROLLBAR_AS_NEEDED,
....@@ -1283,14 +1558,12 @@
12831558 scrollpane.addMouseWheelListener(this); // Default not fast enough
12841559
12851560 /*JTabbedPane*/ scenePanel = new cGridBag();
1286
- scenePanel.preferredWidth = 6;
1561
+ scenePanel.preferredWidth = 5;
12871562
12881563 JTabbedPane tabbedPane = new JTabbedPane();
12891564 tabbedPane.add(scrollpane);
12901565
1291
- tabbedPane.add(FSPane = new cFileSystemPane(this));
1292
-
1293
- optionsPanel = new cGridBag().setVertical(true);
1566
+ optionsPanel = new cGridBag().setVertical(false);
12941567
12951568 optionsPanel.setName("Options");
12961569
....@@ -1298,6 +1571,8 @@
12981571
12991572 tabbedPane.add(optionsPanel);
13001573
1574
+ tabbedPane.add(FSPane = new cFileSystemPane(this));
1575
+
13011576 scenePanel.add(tabbedPane);
13021577
13031578 /*
....@@ -1359,9 +1634,9 @@
13591634 /**/
13601635
13611636 bigThree = new cGridBag();
1362
- bigThree.addComponent(scenePanel);
13631637 bigThree.addComponent(centralPanel);
1364
- bigThree.addComponent(XYZPanel);
1638
+ bigThree.addComponent(scenePanel);
1639
+ //bigThree.addComponent(XYZPanel);
13651640
13661641 // // SIDE EFFECT!!!
13671642 // aConstraints.gridx = 0;
....@@ -1370,9 +1645,9 @@
13701645 // aConstraints.gridheight = 1;
13711646
13721647 framePanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, toolbarPanel, bigThree);
1373
- framePanel.setContinuousLayout(true);
1374
- framePanel.setOneTouchExpandable(true);
1375
- framePanel.setDividerLocation(0.8);
1648
+ framePanel.setContinuousLayout(false);
1649
+ framePanel.setOneTouchExpandable(false);
1650
+ //.setDividerLocation(0.8);
13761651 //framePanel.setDividerSize(15);
13771652 //framePanel.setResizeWeight(0.15);
13781653 framePanel.setName("Frame");
....@@ -1390,9 +1665,14 @@
13901665 // aConstraints = gbc; // (GridBagConstraints) GrafreeD.clone(gbc);
13911666
13921667 frame.setSize(1280, 860);
1393
- frame.setVisible(true);
1394
-
1668
+
1669
+ cameraView.requestFocusInWindow();
1670
+
13951671 gridPanel.setDividerLocation(1.0);
1672
+
1673
+ frame.validate();
1674
+
1675
+ frame.setVisible(true);
13961676
13971677 frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
13981678 frame.addWindowListener(new WindowAdapter()
....@@ -1479,24 +1759,6 @@
14791759 texture.add(textureField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
14801760 colorSection.add(texture);
14811761
1482
- cGridBag anisoU = new cGridBag();
1483
- anisoU.add(anisoLabel = new JLabel("AnisoU")); // , aConstraints);
1484
- anisoLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1485
- anisoU.add(anisoField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1486
- colorSection.add(anisoU);
1487
-
1488
- cGridBag anisoV = new cGridBag();
1489
- anisoV.add(anisoVLabel = new JLabel("AnisoV")); // , aConstraints);
1490
- anisoVLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1491
- anisoV.add(anisoVField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1492
- colorSection.add(anisoV);
1493
-
1494
- cGridBag shadowbias = new cGridBag();
1495
- shadowbias.add(shadowbiasLabel = new JLabel("Shadowbias")); // , aConstraints);
1496
- shadowbiasLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1497
- shadowbias.add(shadowbiasField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1498
- colorSection.add(shadowbias);
1499
-
15001762 panel.add(new JSeparator());
15011763
15021764 panel.add(colorSection);
....@@ -1546,6 +1808,12 @@
15461808 fakedepthLabel.setHorizontalAlignment(SwingConstants.TRAILING);
15471809 fakedepth.add(fakedepthField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
15481810 diffuseSection.add(fakedepth);
1811
+
1812
+ cGridBag shadowbias = new cGridBag();
1813
+ shadowbias.add(shadowbiasLabel = new JLabel("Shadowbias")); // , aConstraints);
1814
+ shadowbiasLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1815
+ shadowbias.add(shadowbiasField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1816
+ diffuseSection.add(shadowbias);
15491817
15501818 panel.add(new JSeparator());
15511819
....@@ -1597,6 +1865,18 @@
15971865 // aConstraints.gridy += 1;
15981866 // aConstraints.gridwidth = 1;
15991867
1868
+ cGridBag anisoU = new cGridBag();
1869
+ anisoU.add(anisoLabel = new JLabel("AnisoU")); // , aConstraints);
1870
+ anisoLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1871
+ anisoU.add(anisoField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1872
+ specularSection.add(anisoU);
1873
+
1874
+ cGridBag anisoV = new cGridBag();
1875
+ anisoV.add(anisoVLabel = new JLabel("AnisoV")); // , aConstraints);
1876
+ anisoVLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1877
+ anisoV.add(anisoVField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1878
+ specularSection.add(anisoV);
1879
+
16001880
16011881 panel.add(new JSeparator());
16021882
....@@ -1604,35 +1884,35 @@
16041884
16051885 //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
16061886
1607
- cGridBag globalSection = new cGridBag().setVertical(true);
1887
+ //cGridBag globalSection = new cGridBag().setVertical(true);
16081888
16091889 cGridBag camera = new cGridBag();
16101890 camera.add(cameraLabel = new JLabel("GlobalLight")); // , aConstraints);
16111891 cameraLabel.setHorizontalAlignment(SwingConstants.TRAILING);
16121892 camera.add(cameraField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1613
- globalSection.add(camera);
1893
+ colorSection.add(camera);
16141894
16151895 cGridBag ambient = new cGridBag();
16161896 ambient.add(ambientLabel = new JLabel("Ambient")); // , aConstraints);
16171897 ambientLabel.setHorizontalAlignment(SwingConstants.TRAILING);
16181898 ambient.add(ambientField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1619
- globalSection.add(ambient);
1899
+ colorSection.add(ambient);
16201900
16211901 cGridBag backlit = new cGridBag();
16221902 backlit.add(backlitLabel = new JLabel("Backlit")); // , aConstraints);
16231903 backlitLabel.setHorizontalAlignment(SwingConstants.TRAILING);
16241904 backlit.add(backlitField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1625
- globalSection.add(backlit);
1905
+ colorSection.add(backlit);
16261906
16271907 cGridBag opacity = new cGridBag();
16281908 opacity.add(opacityLabel = new JLabel("Opacity")); // , aConstraints);
16291909 opacityLabel.setHorizontalAlignment(SwingConstants.TRAILING);
16301910 opacity.add(opacityField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1631
- globalSection.add(opacity);
1911
+ colorSection.add(opacity);
16321912
1633
- panel.add(new JSeparator());
1913
+ //panel.add(new JSeparator());
16341914
1635
- panel.add(globalSection);
1915
+ //panel.add(globalSection);
16361916
16371917 //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
16381918
....@@ -1739,8 +2019,9 @@
17392019 // 3D models
17402020 if (filename.endsWith(".3ds") || filename.endsWith(".3DS"))
17412021 {
1742
- lastConverter = new com.jmex.model.converters.MaxToJme();
1743
- LoadFile(filename, lastConverter);
2022
+ //lastConverter = new com.jmex.model.converters.MaxToJme();
2023
+ //LoadFile(filename, lastConverter);
2024
+ LoadObjFile(filename); // New 3ds loader
17442025 continue;
17452026 }
17462027 if (filename.endsWith(".dae") || filename.endsWith(".DAE"))
....@@ -2466,6 +2747,7 @@
24662747 LA.matXRotate(((Object3D) group.get(group.size() - 1)).toParent, -Math.PI / 2);
24672748 LA.matXRotate(((Object3D) group.get(group.size() - 1)).fromParent, Math.PI / 2);
24682749 }
2750
+
24692751 //cJME.count++;
24702752 //cJME.count %= 12;
24712753 if (gc)
....@@ -2649,6 +2931,7 @@
26492931 }
26502932 }
26512933 }
2934
+
26522935 cFileSystemPane FSPane;
26532936
26542937 void SetMaterial(cMaterial mat, Object3D.cVector2[] others)
....@@ -2702,11 +2985,14 @@
27022985 }
27032986 }
27042987 }
2988
+
27052989 freezematerial = false;
27062990 }
27072991
27082992 void SetMaterial(Object3D object)
27092993 {
2994
+ latestObject = object;
2995
+
27102996 cMaterial mat = object.material;
27112997
27122998 if (mat == null)
....@@ -2818,12 +3104,17 @@
28183104 // }
28193105
28203106 /**/
2821
- if (deselect)
3107
+ if (deselect || child == null)
28223108 {
28233109 //group.deselectAll();
28243110 //freeze = true;
28253111 GetTree().clearSelection();
28263112 //freeze = false;
3113
+
3114
+ if (child == null)
3115
+ {
3116
+ return;
3117
+ }
28273118 }
28283119
28293120 //group.addSelectee(child);
....@@ -2892,7 +3183,7 @@
28923183 cameraView.ToggleDL();
28933184 cameraView.repaint();
28943185 return;
2895
- } else if (event.getSource() == toggleTextureItem)
3186
+ } else if (event.getSource() == toggleTextureItem || event.getSource() == toggleTextureCB)
28963187 {
28973188 cameraView.ToggleTexture();
28983189 // june 2013 copy.HardTouch();
....@@ -2931,7 +3222,7 @@
29313222 frame.validate();
29323223
29333224 return;
2934
- } else if (event.getSource() == toggleSwitchItem)
3225
+ } else if (event.getSource() == toggleSwitchItem || event.getSource() == toggleSwitchCB)
29353226 {
29363227 cameraView.ToggleSwitch();
29373228 cameraView.repaint();
....@@ -2962,7 +3253,7 @@
29623253 {
29633254 copy.live ^= true;
29643255 return;
2965
- } else if (event.getSource() == selectCB)
3256
+ } else if (event.getSource() == selectableCB)
29663257 {
29673258 copy.dontselect ^= true;
29683259 return;
....@@ -3147,9 +3438,9 @@
31473438 {
31483439 Close();
31493440 //return true;
3150
- } else if (source == loadItem)
3441
+ } else if (source == openItem)
31513442 {
3152
- load();
3443
+ Open();
31533444 //return true;
31543445 } else if (source == newItem)
31553446 {
....@@ -3174,6 +3465,10 @@
31743465 {
31753466 generatePOV();
31763467 //return true;
3468
+ } else if (event.getSource() == archiveItem)
3469
+ {
3470
+ cTools.Archive(frame);
3471
+ return;
31773472 } else if (source == zBufferItem)
31783473 {
31793474 try
....@@ -3225,8 +3520,8 @@
32253520 try
32263521 {
32273522 ByteArrayOutputStream baos = new ByteArrayOutputStream();
3228
- java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(baos);
3229
- ObjectOutputStream out = new ObjectOutputStream(zstream);
3523
+// java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(baos);
3524
+ ObjectOutputStream out = new ObjectOutputStream(baos); //zstream);
32303525
32313526 Object3D parent = o.parent;
32323527 o.parent = null;
....@@ -3237,10 +3532,14 @@
32373532
32383533 out.flush();
32393534
3240
- zstream.close();
3535
+ baos //zstream
3536
+ .close();
32413537 out.close();
32423538
3243
- return baos.toByteArray();
3539
+ byte[] bytes = baos.toByteArray();
3540
+
3541
+ System.out.println("save #bytes = " + bytes.length);
3542
+ return bytes;
32443543 } catch (Exception e)
32453544 {
32463545 System.err.println(e);
....@@ -3250,13 +3549,16 @@
32503549
32513550 static public Object Uncompress(byte[] bytes)
32523551 {
3253
- System.out.println("#bytes = " + bytes.length);
3552
+ System.out.println("restore #bytes = " + bytes.length);
32543553 try
32553554 {
32563555 ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
3257
- java.util.zip.GZIPInputStream istream = new java.util.zip.GZIPInputStream(bais);
3258
- ObjectInputStream in = new ObjectInputStream(istream);
3556
+ //java.util.zip.GZIPInputStream istream = new java.util.zip.GZIPInputStream(bais);
3557
+ ObjectInputStream in = new ObjectInputStream(bais); // istream);
32593558 Object obj = in.readObject();
3559
+
3560
+ bais //istream
3561
+ .close();
32603562 in.close();
32613563
32623564 return obj;
....@@ -3311,37 +3613,77 @@
33113613 return null;
33123614 }
33133615
3314
- java.util.Hashtable<java.util.UUID, Object3D> hashtable = new java.util.Hashtable<java.util.UUID, Object3D>();
33153616
33163617 public void Save()
33173618 {
3619
+ //Save(true);
3620
+ Replace();
3621
+ }
3622
+
3623
+ private boolean Equal(byte[] compress, byte[] name)
3624
+ {
3625
+ if (compress.length != name.length)
3626
+ {
3627
+ return false;
3628
+ }
3629
+
3630
+ for (int i=compress.length; --i>=0;)
3631
+ {
3632
+ if (compress[i] != name[i])
3633
+ return false;
3634
+ }
3635
+
3636
+ return true;
3637
+ }
3638
+
3639
+ java.util.Hashtable<java.util.UUID, Object3D> versiontable = new java.util.Hashtable<java.util.UUID, Object3D>();
3640
+
3641
+ public boolean Save(boolean user)
3642
+ {
3643
+ System.err.println("Save");
3644
+
33183645 cRadio tab = GetCurrentTab();
33193646
3320
- boolean temp = CameraPane.SWITCH;
3321
- CameraPane.SWITCH = false;
3647
+ byte[] compress = CompressCopy();
33223648
3323
- copy.ExtractBigData(hashtable);
3649
+ boolean thesame = false;
3650
+
3651
+ // Quick heuristic using length. Works only when stream is compressed.
3652
+ if (copy.versionindex > 0 && copy.versions[copy.versionindex-1] != null && Equal(compress, copy.versions[copy.versionindex-1]))
3653
+ {
3654
+ thesame = true;
3655
+ }
33243656
33253657 //EditorFrame.m_MainFrame.requestFocusInWindow();
3326
- tab.graphs[tab.undoindex++] = Compress(copy);
3327
-
3328
- copy.RestoreBigData(hashtable);
3329
-
3330
- CameraPane.SWITCH = temp;
3331
-
3332
- //assert(hashtable.isEmpty());
3333
-
3334
- for (int i = tab.undoindex; i < tab.graphs.length; i++)
3658
+ if (!thesame)
33353659 {
3336
- tab.graphs[i] = null;
3660
+ //tab.user[tab.versionindex] = user;
3661
+ //boolean increment = true; // tab.graphs[tab.versionindex] == null;
3662
+
3663
+ copy.versions[++copy.versionindex] = compress;
3664
+
3665
+ // if (increment)
3666
+ // tab.versionindex++;
33373667 }
33383668
3669
+ //copy.RestoreBigData(versiontable);
3670
+
3671
+ //assert(hashtable.isEmpty());
3672
+
3673
+ for (int i = copy.versionindex+1; i < copy.versions.length; i++)
3674
+ {
3675
+ //tab.user[i] = false;
3676
+ copy.versions[i] = null;
3677
+ }
3678
+
3679
+ SetUndoStates();
3680
+
33393681 // test save
33403682 if (false)
33413683 {
33423684 try
33433685 {
3344
- FileOutputStream ostream = new FileOutputStream("save" + tab.undoindex);
3686
+ FileOutputStream ostream = new FileOutputStream("save" + copy.versionindex);
33453687 ObjectOutputStream p = new ObjectOutputStream(ostream);
33463688
33473689 p.writeObject(copy);
....@@ -3354,14 +3696,18 @@
33543696 e.printStackTrace();
33553697 }
33563698 }
3699
+
3700
+ return !thesame;
33573701 }
33583702
33593703 void CopyChanged(Object3D obj)
33603704 {
3705
+ SetUndoStates();
3706
+
33613707 boolean temp = CameraPane.SWITCH;
33623708 CameraPane.SWITCH = false;
33633709
3364
- copy.ExtractBigData(hashtable);
3710
+ copy.ExtractBigData(versiontable);
33653711
33663712 copy.clear();
33673713
....@@ -3370,7 +3716,7 @@
33703716 copy.add(obj.get(i));
33713717 }
33723718
3373
- copy.RestoreBigData(hashtable);
3719
+ copy.RestoreBigData(versiontable);
33743720
33753721 CameraPane.SWITCH = temp;
33763722
....@@ -3397,40 +3743,130 @@
33973743 refreshContents();
33983744 }
33993745
3400
- public void Undo()
3746
+ cButton undoButton;
3747
+ cButton restoreButton;
3748
+ cButton replaceButton;
3749
+ cButton redoButton;
3750
+
3751
+ boolean muteSlider;
3752
+
3753
+ int VersionCount()
3754
+ {
3755
+ int count = 0;
3756
+
3757
+ for (int i = copy.versions.length; --i >= 0;)
3758
+ {
3759
+ if (copy.versions[i] != null)
3760
+ count++;
3761
+ }
3762
+
3763
+ return count;
3764
+ }
3765
+
3766
+ void SetUndoStates()
34013767 {
34023768 cRadio tab = GetCurrentTab();
34033769
3404
- if (tab.undoindex == 0)
3770
+ restoreButton.setEnabled(copy.versionindex != -1);
3771
+ replaceButton.setEnabled(copy.versionindex != -1);
3772
+
3773
+ undoButton.setEnabled(copy.versionindex > 0);
3774
+ redoButton.setEnabled(copy.versions[copy.versionindex + 1] != null);
3775
+
3776
+ muteSlider = true;
3777
+ versionSlider.setMaximum(VersionCount() - 1);
3778
+ versionSlider.setInteger(copy.versionindex);
3779
+ muteSlider = false;
3780
+ }
3781
+
3782
+ public boolean Undo()
3783
+ {
3784
+ // Option?
3785
+ Replace();
3786
+
3787
+ System.err.println("Undo");
3788
+
3789
+ cRadio tab = GetCurrentTab();
3790
+
3791
+ if (copy.versionindex == 0)
34053792 {
34063793 java.awt.Toolkit.getDefaultToolkit().beep();
3407
- return;
3794
+ return false;
34083795 }
34093796
3410
- if (tab.graphs[tab.undoindex] == null)
3797
+// if (tab.graphs[tab.versionindex] == null) // || !tab.user[tab.versionindex])
3798
+// {
3799
+// if (Save(false))
3800
+// tab.versionindex -= 1;
3801
+// else
3802
+// {
3803
+// if (tab.versionindex <= 0)
3804
+// return false;
3805
+// else
3806
+// tab.versionindex -= 1;
3807
+// }
3808
+// }
3809
+
3810
+ copy.versionindex -= 1;
3811
+
3812
+ CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex]));
3813
+
3814
+ return true;
3815
+ }
3816
+
3817
+ public boolean Restore()
3818
+ {
3819
+ System.err.println("Restore");
3820
+
3821
+ cRadio tab = GetCurrentTab();
3822
+
3823
+ if (copy.versionindex == -1 || copy.versions[copy.versionindex] == null)
34113824 {
3412
- Save();
3413
- tab.undoindex -= 1;
3825
+ java.awt.Toolkit.getDefaultToolkit().beep();
3826
+ return false;
34143827 }
34153828
3416
- tab.undoindex -= 1;
3829
+ CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex]));
3830
+
3831
+ return true;
3832
+ }
34173833
3418
- CopyChanged((Object3D)Uncompress(tab.graphs[tab.undoindex]));
3834
+ public boolean Replace()
3835
+ {
3836
+ System.err.println("Replace");
3837
+
3838
+ cRadio tab = GetCurrentTab();
3839
+
3840
+ if (copy.versionindex == -1 || copy.versions[copy.versionindex] == null)
3841
+ {
3842
+ // No version yet. OK. java.awt.Toolkit.getDefaultToolkit().beep();
3843
+ return false;
3844
+ }
3845
+
3846
+ copy.versions[copy.versionindex] = CompressCopy();
3847
+
3848
+ return true;
34193849 }
34203850
34213851 public void Redo()
34223852 {
3853
+ // Option?
3854
+ Replace();
3855
+
34233856 cRadio tab = GetCurrentTab();
34243857
3425
- if (tab.graphs[tab.undoindex + 1] == null)
3858
+ if (copy.versions[copy.versionindex + 1] == null)
34263859 {
34273860 java.awt.Toolkit.getDefaultToolkit().beep();
34283861 return;
34293862 }
34303863
3431
- tab.undoindex += 1;
3864
+ copy.versionindex += 1;
34323865
3433
- CopyChanged((Object3D)Uncompress(tab.graphs[tab.undoindex]));
3866
+ CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex]));
3867
+
3868
+ //if (!tab.user[tab.versionindex])
3869
+ // tab.graphs[tab.versionindex] = null;
34343870 }
34353871
34363872 void ImportGFD()
....@@ -3582,7 +4018,7 @@
35824018 assert false;
35834019 }
35844020
3585
- void EditSelection()
4021
+ void EditSelection(boolean newWindow)
35864022 {
35874023 }
35884024
....@@ -3726,9 +4162,25 @@
37264162 //copy.Touch();
37274163 }
37284164
4165
+ cNumberSlider versionSlider;
4166
+
37294167 public void stateChanged(ChangeEvent e)
37304168 {
37314169 // assert(false);
4170
+ if (e.getSource() == versionSlider)
4171
+ {
4172
+ if (muteSlider)
4173
+ return;
4174
+
4175
+ int version = versionSlider.getInteger();
4176
+
4177
+ if (copy.versions[version] != null)
4178
+ {
4179
+ CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex = version]));
4180
+ }
4181
+
4182
+ return;
4183
+ }
37324184
37334185 if (freezematerial)
37344186 {
....@@ -4077,7 +4529,8 @@
40774529
40784530 void makeSomething(Object3D thing, boolean resetmodel) // deselect)
40794531 {
4080
- Save();
4532
+ if (Globals.REPLACEONMAKE) // && resetmodel)
4533
+ Save();
40814534 //Tween.set(thing, 0).target(1).start(tweenManager);
40824535 //Tween.to(thing, 0, 0.5f).target(0).start(tweenManager);
40834536 // if (thing instanceof GenericJointDemo)
....@@ -4164,6 +4617,12 @@
41644617 {
41654618 ResetModel();
41664619 Select(thing.GetTreePath(), true, false); // unselect... false);
4620
+
4621
+ if (thing.Size() == 0)
4622
+ {
4623
+ //EditSelection(false);
4624
+ }
4625
+
41674626 refreshContents();
41684627 }
41694628
....@@ -4312,7 +4771,9 @@
43124771 readobj.ResetDisplayList();
43134772 } catch (Exception e)
43144773 {
4315
- //e.printStackTrace();
4774
+ if (!e.toString().contains("GZIP"))
4775
+ e.printStackTrace();
4776
+
43164777 try
43174778 {
43184779 java.io.FileInputStream istream = new java.io.FileInputStream(fullname);
....@@ -4386,11 +4847,14 @@
43864847
43874848 if (readobj != null)
43884849 {
4389
- Save();
4850
+ //if (Globals.SAVEONMAKE) // A new object cannot share meshes
4851
+ // Save();
43904852 try
43914853 {
43924854 //readobj.deepCopySelf(copy);
43934855 copy.clear(); // june 2014
4856
+ copy.skyboxname = readobj.skyboxname;
4857
+ copy.skyboxext = readobj.skyboxext;
43944858 for (int i = 0; i < readobj.size(); i++)
43954859 {
43964860 Object3D child = readobj.get(i); // reserve(i);
....@@ -4431,6 +4895,7 @@
44314895 }
44324896 } catch (ClassCastException e)
44334897 {
4898
+ e.printStackTrace();
44344899 assert (false);
44354900 Composite c = (Composite) copy;
44364901 c.children.clear();
....@@ -4441,13 +4906,24 @@
44414906 c.addChild(csg);
44424907 }
44434908
4909
+ copy.versions = readobj.versions;
4910
+ copy.versionindex = readobj.versionindex;
4911
+
4912
+ if (copy.versions == null)
4913
+ {
4914
+ copy.versions = new byte[100][];
4915
+ copy.versionindex = -1;
4916
+ }
4917
+
4918
+ //? SetUndoStates();
4919
+
44444920 ResetModel();
44454921 copy.HardTouch(); // recompile?
44464922 refreshContents();
44474923 }
44484924 }
44494925
4450
- void load() // throws ClassNotFoundException
4926
+ void Open() // throws ClassNotFoundException
44514927 {
44524928 if (Grafreed.standAlone)
44534929 {
....@@ -4550,6 +5026,7 @@
45505026 //ps.print(buffer.toString());
45515027 } catch (IOException e)
45525028 {
5029
+ e.printStackTrace();
45535030 }
45545031 }
45555032
....@@ -4564,6 +5041,8 @@
45645041 String filename = browser.getFile();
45655042 if (filename != null && filename.length() > 0)
45665043 {
5044
+ if (!filename.endsWith(".gfd"))
5045
+ filename += ".gfd";
45675046 lastname = browser.getDirectory() + filename;
45685047 save();
45695048 }
....@@ -4730,7 +5209,7 @@
47305209 MenuBar menuBar;
47315210 Menu fileMenu;
47325211 MenuItem newItem;
4733
- MenuItem loadItem;
5212
+ MenuItem openItem;
47345213 MenuItem saveItem;
47355214 MenuItem saveAsItem;
47365215 MenuItem exportAsItem;
....@@ -4753,22 +5232,36 @@
47535232 CheckboxMenuItem toggleSwitchItem;
47545233 CheckboxMenuItem toggleRootItem;
47555234 CheckboxMenuItem animationItem;
5235
+ MenuItem archiveItem;
47565236 CheckboxMenuItem toggleHandleItem;
47575237 CheckboxMenuItem togglePaintItem;
47585238 JSplitPane mainPanel;
47595239 JScrollPane scrollpane;
5240
+
47605241 JPanel toolbarPanel;
5242
+
47615243 cGridBag treePanel;
5244
+
47625245 JPanel radioPanel;
47635246 ButtonGroup buttonGroup;
4764
- cGridBag ctrlPanel;
5247
+
5248
+ cGridBag toolboxPanel;
47655249 cGridBag materialPanel;
5250
+ cGridBag ctrlPanel;
5251
+
47665252 JScrollPane infoPanel;
5253
+
47675254 cGridBag optionsPanel;
5255
+
47685256 JTabbedPane objectPanel;
5257
+ boolean materialFlushed;
5258
+ Object3D latestObject;
5259
+
47695260 cGridBag XYZPanel;
5261
+
47705262 JSplitPane gridPanel;
47715263 JSplitPane bigPanel;
5264
+
47725265 cGridBag bigThree;
47735266 cGridBag scenePanel;
47745267 cGridBag centralPanel;
....@@ -4883,7 +5376,7 @@
48835376 cNumberSlider fogField;
48845377 JLabel opacityPowerLabel;
48855378 cNumberSlider opacityPowerField;
4886
- JTree jTree;
5379
+ cTree jTree;
48875380 //ObjectUI parent;
48885381
48895382 cNumberSlider normalpushField;