Normand Briere
2019-06-24 47cd0f0a3870d843cb758535316060d30f15c811
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.*;
....@@ -35,6 +36,67 @@
3536
3637 GroupEditor callee;
3738 JFrame frame;
39
+
40
+ static ObjEditor theFrame;
41
+
42
+ cButton GetButton(String name, boolean border)
43
+ {
44
+ try
45
+ {
46
+ ImageIcon icon = GetIcon(name);
47
+ return new cButton(icon, border);
48
+ }
49
+ catch (Exception e)
50
+ {
51
+ return new cButton(name, border);
52
+ }
53
+ }
54
+
55
+ cToggleButton GetToggleButton(String name, boolean border)
56
+ {
57
+ try
58
+ {
59
+ ImageIcon icon = GetIcon(name);
60
+ return new cToggleButton(icon, border);
61
+ }
62
+ catch (Exception e)
63
+ {
64
+ return new cToggleButton(name, border);
65
+ }
66
+ }
67
+
68
+ cCheckBox GetCheckBox(String name, boolean border)
69
+ {
70
+ try
71
+ {
72
+ ImageIcon icon = GetIcon(name);
73
+ return new cCheckBox(icon, border);
74
+ }
75
+ catch (Exception e)
76
+ {
77
+ return new cCheckBox(name, border);
78
+ }
79
+ }
80
+
81
+ private ImageIcon GetIcon(String name) throws IOException
82
+ {
83
+ BufferedImage image = javax.imageio.ImageIO.read(getClass().getClassLoader().getResourceAsStream(name));
84
+
85
+ if (image.getWidth() != 24 && image.getHeight() != 24)
86
+ {
87
+ BufferedImage resized = new BufferedImage(24, 24, image.getType());
88
+ Graphics2D g = resized.createGraphics();
89
+ g.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR);
90
+ //g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
91
+ g.drawImage(image, 0, 0, 24, 24, 0, 0, image.getWidth(), image.getHeight(), null);
92
+ g.dispose();
93
+
94
+ image = resized;
95
+ }
96
+
97
+ javax.swing.ImageIcon icon = new javax.swing.ImageIcon(image);
98
+ return icon;
99
+ }
38100
39101 // SCRIPT
40102
....@@ -168,7 +230,8 @@
168230 // objEditor.ctrlPanel.remove(remarkButton);
169231
170232 objEditor.ctrlPanel.remove(setupPanel);
171
- objEditor.ctrlPanel.remove(commandsPanel);
233
+ objEditor.ctrlPanel.remove(setupPanel2);
234
+ objEditor.ctrlPanel.remove(objectCommandsPanel);
172235 objEditor.ctrlPanel.remove(pushPanel);
173236 //objEditor.ctrlPanel.remove(fillPanel);
174237
....@@ -243,6 +306,7 @@
243306 //localCopy.parent = null;
244307
245308 frame = new JFrame();
309
+ frame.setUndecorated(true);
246310 objEditor = this;
247311 this.callee = callee;
248312
....@@ -278,7 +342,7 @@
278342 frame.setMenuBar(menuBar = new MenuBar());
279343 menuBar.add(fileMenu = new Menu("File"));
280344 fileMenu.add(newItem = new MenuItem("New"));
281
- fileMenu.add(loadItem = new MenuItem("Load..."));
345
+ fileMenu.add(loadItem = new MenuItem("Open..."));
282346
283347 //oe.menuBar.add(menu = new Menu("Include"));
284348 Menu menu = new Menu("Import");
....@@ -323,10 +387,22 @@
323387 toolbarPanel.setName("Toolbar");
324388 treePanel = new cGridBag();
325389 treePanel.setName("Tree");
390
+
391
+ editPanel = new cGridBag().setVertical(true);
392
+ editPanel.setName("Edit");
393
+
326394 ctrlPanel = new cGridBag().setVertical(false); // new GridBagLayout());
327
- ctrlPanel.setName("Edit");
395
+
396
+ editCommandsPanel = new cGridBag();
397
+ editPanel.add(editCommandsPanel);
398
+ editPanel.add(ctrlPanel);
399
+
400
+ toolboxPanel = new cGridBag().setVertical(false);
401
+ toolboxPanel.setName("Toolbox");
402
+
328403 materialPanel = new cGridBag().setVertical(true);
329404 materialPanel.setName("Material");
405
+
330406 /*JTextPane*/
331407 infoarea = createTextPane();
332408 doc = infoarea.getStyledDocument();
....@@ -419,10 +495,10 @@
419495 e.printStackTrace();
420496 }
421497
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();
498
+// String selection = infoarea.getText();
499
+// java.awt.datatransfer.StringSelection data = new java.awt.datatransfer.StringSelection(selection);
500
+// java.awt.datatransfer.Clipboard clipboard =
501
+// Toolkit.getDefaultToolkit().getSystemClipboard();
426502 //clipboard.setContents(data, data);
427503 }
428504
....@@ -582,19 +658,91 @@
582658 }
583659 }
584660
661
+static GraphicsDevice device = GraphicsEnvironment
662
+ .getLocalGraphicsEnvironment().getScreenDevices()[0];
663
+
664
+ Rectangle keeprect;
665
+ cRadio radio;
666
+
667
+cButton keepButton;
668
+ cButton twoButton; // Full 3D
669
+ cButton sixButton;
670
+ cButton threeButton;
671
+ cButton sevenButton;
672
+ cButton fourButton; // full panel
673
+ cButton oneButton; // full XYZ
674
+ //cButton currentLayout;
675
+
676
+ boolean maximized;
677
+
678
+ cButton fullscreenLayout;
679
+
680
+ void Minimize()
681
+ {
682
+ frame.setState(Frame.ICONIFIED);
683
+ }
684
+
685
+ void Maximize()
686
+ {
687
+ if (maximized)
688
+ {
689
+ frame.setBounds(keeprect.x, keeprect.y, keeprect.width, keeprect.height);
690
+ }
691
+ else
692
+ {
693
+ keeprect = frame.getBounds();
694
+ Rectangle rect = GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds();
695
+ Dimension rect2 = frame.getToolkit().getScreenSize();
696
+ frame.setBounds(0, rect2.height - rect.height, rect.width, rect.height);
697
+// frame.setState(Frame.MAXIMIZED_BOTH);
698
+ }
699
+
700
+ maximized ^= true;
701
+ }
702
+
585703 void ToggleFullScreen()
586704 {
587705 if (CameraPane.FULLSCREEN)
588706 {
589
- frame.getContentPane().remove(/*"Center",*/bigThree);
590
- framePanel.add(bigThree);
591
- frame.getContentPane().add(/*"Center",*/framePanel);
707
+ device.setFullScreenWindow(null);
708
+ //frame.setVisible(false);
709
+// frame.removeNotify();
710
+// frame.setUndecorated(false);
711
+// frame.addNotify();
712
+ //frame.setBounds(keeprect.x, keeprect.y, keeprect.width, keeprect.height);
713
+
714
+// X frame.getContentPane().remove(/*"Center",*/bigThree);
715
+// X framePanel.add(bigThree);
716
+// X frame.getContentPane().add(/*"Center",*/framePanel);
717
+ framePanel.setDividerLocation(1);
718
+
719
+ //frame.setVisible(true);
720
+ radio.layout = keepButton;
721
+ //theFrame = null;
722
+ keepButton = null;
723
+ radio.layout.doClick();
724
+
592725 } else
593726 {
594
- frame.getContentPane().remove(/*"Center",*/framePanel);
595
- framePanel.remove(bigThree);
596
- frame.getContentPane().add(/*"Center",*/bigThree);
727
+ keepButton = radio.layout;
728
+ //keeprect = frame.getBounds();
729
+// frame.setBounds(0, 0, frame.getToolkit().getScreenSize().width,
730
+// frame.getToolkit().getScreenSize().height);
731
+ //frame.setVisible(false);
732
+ device.setFullScreenWindow(frame);
733
+// frame.removeNotify();
734
+// frame.setUndecorated(true);
735
+// frame.addNotify();
736
+// X frame.getContentPane().remove(/*"Center",*/framePanel);
737
+// X framePanel.remove(bigThree);
738
+// X frame.getContentPane().add(/*"Center",*/bigThree);
739
+ framePanel.setDividerLocation(0);
740
+
741
+ radio.layout = fullscreenLayout;
742
+ radio.layout.doClick();
743
+ //frame.setVisible(true);
597744 }
745
+
598746 cameraView.ToggleFullScreen();
599747 }
600748
....@@ -745,9 +893,13 @@
745893 JButton fasterButton;
746894 JButton remarkButton;
747895
896
+ cGridBag editPanel;
897
+ cGridBag editCommandsPanel;
898
+
748899 cGridBag namePanel;
749900 cGridBag setupPanel;
750
- cGridBag commandsPanel;
901
+ cGridBag setupPanel2;
902
+ cGridBag objectCommandsPanel;
751903 cGridBag pushPanel;
752904 cGridBag fillPanel;
753905
....@@ -939,40 +1091,44 @@
9391091 markCB = AddCheckBox(setupPanel, "Mark", copy.marked);
9401092 markCB.setToolTipText("Set the animation target transform");
9411093
942
- rewindCB = AddCheckBox(setupPanel, "Rewind", copy.rewind);
1094
+ setupPanel2 = new cGridBag().setVertical(false);
1095
+
1096
+ rewindCB = AddCheckBox(setupPanel2, "Rewind", copy.rewind);
9431097 rewindCB.setToolTipText("Rewind animation");
9441098
945
- randomCB = AddCheckBox(setupPanel, "Random", copy.random);
946
- randomCB.setToolTipText("Option for switch node");
1099
+ randomCB = AddCheckBox(setupPanel2, "Rand", copy.random);
1100
+ randomCB.setToolTipText("Randomly Rewind or Go back and forth");
9471101
9481102 if (Globals.ADVANCED)
9491103 {
950
- link2masterCB = AddCheckBox(setupPanel, "Support", copy.link2master);
1104
+ link2masterCB = AddCheckBox(setupPanel2, "Supp", copy.link2master);
9511105 link2masterCB.setToolTipText("Attach to support");
952
- speedupCB = AddCheckBox(setupPanel, "Speed", copy.speedup);
1106
+ speedupCB = AddCheckBox(setupPanel2, "Speed", copy.speedup);
9531107 speedupCB.setToolTipText("Option motion capture");
9541108 }
9551109
9561110 oe.ctrlPanel.add(setupPanel);
9571111 oe.ctrlPanel.Return();
1112
+ oe.ctrlPanel.add(setupPanel2);
1113
+ oe.ctrlPanel.Return();
9581114
959
- commandsPanel = new cGridBag().setVertical(false);
1115
+ objectCommandsPanel = new cGridBag().setVertical(false);
9601116
961
- resetButton = AddButton(commandsPanel, "Reset");
1117
+ resetButton = AddButton(objectCommandsPanel, "Reset");
9621118 resetButton.setToolTipText("Jump to frame zero");
963
- stepButton = AddButton(commandsPanel, "Step");
1119
+ stepButton = AddButton(objectCommandsPanel, "Step");
9641120 stepButton.setToolTipText("Step one frame");
9651121 // resetAllButton = AddButton(oe, "Reset All");
9661122 // stepAllButton = AddButton(oe, "Step All");
9671123 // Return();
968
- slowerButton = AddButton(commandsPanel, "Slow");
1124
+ slowerButton = AddButton(objectCommandsPanel, "Slow");
9691125 slowerButton.setToolTipText("Decrease animation speed");
970
- fasterButton = AddButton(commandsPanel, "Fast");
1126
+ fasterButton = AddButton(objectCommandsPanel, "Fast");
9711127 fasterButton.setToolTipText("Increase animation speed");
972
- remarkButton = AddButton(commandsPanel, "Remark");
1128
+ remarkButton = AddButton(objectCommandsPanel, "Remark");
9731129 remarkButton.setToolTipText("Set the current transform as the target");
9741130
975
- oe.ctrlPanel.add(commandsPanel);
1131
+ oe.ctrlPanel.add(objectCommandsPanel);
9761132 oe.ctrlPanel.Return();
9771133
9781134 pushPanel = AddSlider(oe.ctrlPanel, "Push", -1, 1, copy.NORMALPUSH, 1.1); // To have the buttons
....@@ -1178,8 +1334,11 @@
11781334 //worldPanel.setName("World");
11791335 centralPanel = new cGridBag();
11801336 centralPanel.preferredWidth = 20;
1181
- timelinePanel = new JPanel(new BorderLayout());
1182
- timelineMenubar = new timeflow.app.TimeflowApp().TimeFlowWindow(timelinePanel);
1337
+
1338
+ if (Globals.ADVANCED)
1339
+ {
1340
+ timelinePanel = new JPanel(new BorderLayout());
1341
+ timelineMenubar = new timeflow.app.TimeflowApp().TimeFlowWindow(timelinePanel);
11831342
11841343 cameraPanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, cameraView, timelinePanel);
11851344 cameraPanel.setContinuousLayout(true);
....@@ -1188,7 +1347,10 @@
11881347 // cameraPanel.setDividerSize(9);
11891348 cameraPanel.setResizeWeight(1.0);
11901349
1350
+ }
1351
+
11911352 centralPanel.add(cameraView);
1353
+ centralPanel.setFocusable(true);
11921354 //frame.setJMenuBar(timelineMenubar);
11931355 //centralPanel.add(timelinePanel);
11941356
....@@ -1250,12 +1412,13 @@
12501412
12511413 //JScrollPane tmp = new JScrollPane(ctrlPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
12521414 //tmp.setName("Edit");
1415
+ objectPanel.add(toolboxPanel);
12531416 objectPanel.add(materialPanel);
12541417 // JPanel north = new JPanel(new BorderLayout());
12551418 // north.setName("Edit");
12561419 // north.add(ctrlPanel, BorderLayout.NORTH);
12571420 // objectPanel.add(north);
1258
- objectPanel.add(ctrlPanel);
1421
+ objectPanel.add(editPanel);
12591422 objectPanel.add(infoPanel);
12601423
12611424 /*
....@@ -1386,6 +1549,8 @@
13861549 frame.setSize(1280, 860);
13871550 frame.setVisible(true);
13881551
1552
+ cameraView.requestFocusInWindow();
1553
+
13891554 gridPanel.setDividerLocation(1.0);
13901555
13911556 frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
....@@ -1935,6 +2100,7 @@
19352100 e2.printStackTrace();
19362101 }
19372102 }
2103
+
19382104 LoadJMEThread loadThread;
19392105
19402106 class LoadJMEThread extends Thread
....@@ -1992,6 +2158,7 @@
19922158 //LoadFile0(filename, converter);
19932159 }
19942160 }
2161
+
19952162 LoadOBJThread loadObjThread;
19962163
19972164 class LoadOBJThread extends Thread
....@@ -2070,19 +2237,19 @@
20702237
20712238 void LoadObjFile(String fullname)
20722239 {
2073
- /*
2240
+ System.out.println("Loading " + fullname);
2241
+ /**/
20742242 //lastFilename = fullname;
20752243 if(loadObjThread == null)
20762244 {
2077
- loadObjThread = new LoadOBJThread();
2078
- loadObjThread.start();
2245
+ loadObjThread = new LoadOBJThread();
2246
+ loadObjThread.start();
20792247 }
20802248
20812249 loadObjThread.add(fullname);
2082
- */
2250
+ /**/
20832251
2084
- System.out.println("Loading " + fullname);
2085
- makeSomething(new FileObject(fullname, true), true);
2252
+ //makeSomething(new FileObject(fullname, true), true);
20862253 }
20872254
20882255 void LoadGFDFile(String fullname)
....@@ -2925,7 +3092,7 @@
29253092 return;
29263093 } else if (event.getSource() == toggleSwitchItem)
29273094 {
2928
- cameraView.ToggleRandom();
3095
+ cameraView.ToggleSwitch();
29293096 cameraView.repaint();
29303097 return;
29313098 } else if (event.getSource() == toggleHandleItem)
....@@ -3207,10 +3374,228 @@
32073374 {
32083375 copy.remove(1);
32093376 }
3377
+
32103378 ResetModel();
32113379 objEditor.refreshContents();
32123380 }
32133381
3382
+ static public byte[] Compress(Object3D o)
3383
+ {
3384
+ try
3385
+ {
3386
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
3387
+ java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(baos);
3388
+ ObjectOutputStream out = new ObjectOutputStream(zstream);
3389
+
3390
+ Object3D parent = o.parent;
3391
+ o.parent = null;
3392
+
3393
+ out.writeObject(o);
3394
+
3395
+ o.parent = parent;
3396
+
3397
+ out.flush();
3398
+
3399
+ zstream.close();
3400
+ out.close();
3401
+
3402
+ return baos.toByteArray();
3403
+ } catch (Exception e)
3404
+ {
3405
+ System.err.println(e);
3406
+ return null;
3407
+ }
3408
+ }
3409
+
3410
+ static public Object Uncompress(byte[] bytes)
3411
+ {
3412
+ System.out.println("#bytes = " + bytes.length);
3413
+ try
3414
+ {
3415
+ ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
3416
+ java.util.zip.GZIPInputStream istream = new java.util.zip.GZIPInputStream(bais);
3417
+ ObjectInputStream in = new ObjectInputStream(istream);
3418
+ Object obj = in.readObject();
3419
+ in.close();
3420
+
3421
+ return obj;
3422
+ } catch (Exception e)
3423
+ {
3424
+ System.err.println(e);
3425
+ return null;
3426
+ }
3427
+ }
3428
+
3429
+ static public Object clone(Object o)
3430
+ {
3431
+ try
3432
+ {
3433
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
3434
+ ObjectOutputStream out = new ObjectOutputStream(baos);
3435
+
3436
+ out.writeObject(o);
3437
+
3438
+ out.flush();
3439
+ out.close();
3440
+
3441
+ byte[] bytes = baos.toByteArray();
3442
+
3443
+ System.out.println("clone = " + bytes.length);
3444
+
3445
+ ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
3446
+ ObjectInputStream in = new ObjectInputStream(bais);
3447
+ Object obj = in.readObject();
3448
+ in.close();
3449
+
3450
+ return obj;
3451
+ } catch (Exception e)
3452
+ {
3453
+ System.err.println(e);
3454
+ return null;
3455
+ }
3456
+ }
3457
+
3458
+ cRadio GetCurrentTab()
3459
+ {
3460
+ cRadio ab;
3461
+ for (java.util.Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
3462
+ {
3463
+ ab = (cRadio)e.nextElement();
3464
+ if(ab.GetObject() == copy)
3465
+ {
3466
+ return ab;
3467
+ }
3468
+ }
3469
+
3470
+ return null;
3471
+ }
3472
+
3473
+ java.util.Hashtable<java.util.UUID, Object3D> hashtable = new java.util.Hashtable<java.util.UUID, Object3D>();
3474
+
3475
+ public void Save()
3476
+ {
3477
+ System.err.println("Save");
3478
+
3479
+ cRadio tab = GetCurrentTab();
3480
+
3481
+ boolean temp = CameraPane.SWITCH;
3482
+ CameraPane.SWITCH = false;
3483
+
3484
+ copy.ExtractBigData(hashtable);
3485
+
3486
+ //EditorFrame.m_MainFrame.requestFocusInWindow();
3487
+ tab.graphs[tab.undoindex++] = Compress(copy);
3488
+
3489
+ copy.RestoreBigData(hashtable);
3490
+
3491
+ CameraPane.SWITCH = temp;
3492
+
3493
+ //assert(hashtable.isEmpty());
3494
+
3495
+ for (int i = tab.undoindex; i < tab.graphs.length; i++)
3496
+ {
3497
+ tab.graphs[i] = null;
3498
+ }
3499
+
3500
+ // test save
3501
+ if (false)
3502
+ {
3503
+ try
3504
+ {
3505
+ FileOutputStream ostream = new FileOutputStream("save" + tab.undoindex);
3506
+ ObjectOutputStream p = new ObjectOutputStream(ostream);
3507
+
3508
+ p.writeObject(copy);
3509
+
3510
+ p.flush();
3511
+
3512
+ ostream.close();
3513
+ } catch (Exception e)
3514
+ {
3515
+ e.printStackTrace();
3516
+ }
3517
+ }
3518
+ }
3519
+
3520
+ void CopyChanged(Object3D obj)
3521
+ {
3522
+ boolean temp = CameraPane.SWITCH;
3523
+ CameraPane.SWITCH = false;
3524
+
3525
+ copy.ExtractBigData(hashtable);
3526
+
3527
+ copy.clear();
3528
+
3529
+ for (int i=0; i<obj.Size(); i++)
3530
+ {
3531
+ copy.add(obj.get(i));
3532
+ }
3533
+
3534
+ copy.RestoreBigData(hashtable);
3535
+
3536
+ CameraPane.SWITCH = temp;
3537
+
3538
+ //assert(hashtable.isEmpty());
3539
+
3540
+ copy.Touch();
3541
+
3542
+ ResetModel();
3543
+ copy.HardTouch(); // recompile?
3544
+
3545
+ cRadio ab;
3546
+ for (java.util.Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
3547
+ {
3548
+ ab = (cRadio)e.nextElement();
3549
+ Object3D test = copy.GetObject(ab.object.GetUUID());
3550
+ //ab.camera = (Camera)copy.GetObject(ab.camera.GetUUID());
3551
+ if (test != null)
3552
+ {
3553
+ test.editWindow = ab.object.editWindow;
3554
+ ab.object = test;
3555
+ }
3556
+ }
3557
+
3558
+ refreshContents();
3559
+ }
3560
+
3561
+ public void Undo()
3562
+ {
3563
+ System.err.println("Undo");
3564
+
3565
+ cRadio tab = GetCurrentTab();
3566
+
3567
+ if (tab.undoindex == 0)
3568
+ {
3569
+ java.awt.Toolkit.getDefaultToolkit().beep();
3570
+ return;
3571
+ }
3572
+
3573
+ if (tab.graphs[tab.undoindex] == null)
3574
+ {
3575
+ Save();
3576
+ tab.undoindex -= 1;
3577
+ }
3578
+
3579
+ tab.undoindex -= 1;
3580
+
3581
+ CopyChanged((Object3D)Uncompress(tab.graphs[tab.undoindex]));
3582
+ }
3583
+
3584
+ public void Redo()
3585
+ {
3586
+ cRadio tab = GetCurrentTab();
3587
+
3588
+ if (tab.graphs[tab.undoindex + 1] == null)
3589
+ {
3590
+ java.awt.Toolkit.getDefaultToolkit().beep();
3591
+ return;
3592
+ }
3593
+
3594
+ tab.undoindex += 1;
3595
+
3596
+ CopyChanged((Object3D)Uncompress(tab.graphs[tab.undoindex]));
3597
+ }
3598
+
32143599 void ImportGFD()
32153600 {
32163601 FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD);
....@@ -3360,7 +3745,7 @@
33603745 assert false;
33613746 }
33623747
3363
- void EditSelection()
3748
+ void EditSelection(boolean newWindow)
33643749 {
33653750 }
33663751
....@@ -3855,6 +4240,8 @@
38554240
38564241 void makeSomething(Object3D thing, boolean resetmodel) // deselect)
38574242 {
4243
+ if (Globals.SAVEONMAKE) // && resetmodel)
4244
+ Save();
38584245 //Tween.set(thing, 0).target(1).start(tweenManager);
38594246 //Tween.to(thing, 0, 0.5f).target(0).start(tweenManager);
38604247 // if (thing instanceof GenericJointDemo)
....@@ -3941,6 +4328,12 @@
39414328 {
39424329 ResetModel();
39434330 Select(thing.GetTreePath(), true, false); // unselect... false);
4331
+
4332
+ if (thing.Size() == 0)
4333
+ {
4334
+ //EditSelection(false);
4335
+ }
4336
+
39444337 refreshContents();
39454338 }
39464339
....@@ -4078,6 +4471,7 @@
40784471
40794472 try
40804473 {
4474
+ // Try compressed version first.
40814475 java.io.FileInputStream istream = new java.io.FileInputStream(fullname);
40824476 java.util.zip.GZIPInputStream zstream = new java.util.zip.GZIPInputStream(istream);
40834477 java.io.ObjectInputStream p = new java.io.ObjectInputStream(zstream);
....@@ -4147,6 +4541,12 @@
41474541
41484542 void LoadIt(Object obj)
41494543 {
4544
+ if (obj == null)
4545
+ {
4546
+ // Invalid file
4547
+ return;
4548
+ }
4549
+
41504550 System.out.println("Loaded " + obj);
41514551 //new Exception().printStackTrace();
41524552 Object3D readobj = (Object3D) obj;
....@@ -4156,6 +4556,8 @@
41564556
41574557 if (readobj != null)
41584558 {
4559
+ if (Globals.SAVEONMAKE)
4560
+ Save();
41594561 try
41604562 {
41614563 //readobj.deepCopySelf(copy);
....@@ -4526,18 +4928,29 @@
45264928 CheckboxMenuItem togglePaintItem;
45274929 JSplitPane mainPanel;
45284930 JScrollPane scrollpane;
4931
+
45294932 JPanel toolbarPanel;
4933
+
45304934 cGridBag treePanel;
4935
+
45314936 JPanel radioPanel;
45324937 ButtonGroup buttonGroup;
4533
- cGridBag ctrlPanel;
4938
+
4939
+ cGridBag toolboxPanel;
45344940 cGridBag materialPanel;
4941
+ cGridBag ctrlPanel;
4942
+
45354943 JScrollPane infoPanel;
4944
+
45364945 cGridBag optionsPanel;
4946
+
45374947 JTabbedPane objectPanel;
4948
+
45384949 cGridBag XYZPanel;
4950
+
45394951 JSplitPane gridPanel;
45404952 JSplitPane bigPanel;
4953
+
45414954 cGridBag bigThree;
45424955 cGridBag scenePanel;
45434956 cGridBag centralPanel;
....@@ -4652,7 +5065,7 @@
46525065 cNumberSlider fogField;
46535066 JLabel opacityPowerLabel;
46545067 cNumberSlider opacityPowerField;
4655
- JTree jTree;
5068
+ cTree jTree;
46565069 //ObjectUI parent;
46575070
46585071 cNumberSlider normalpushField;