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)
....@@ -3212,23 +3379,45 @@
32123379 objEditor.refreshContents();
32133380 }
32143381
3215
- Object3D graphs[] = new Object3D[10000];
3216
- int undoindex = 0;
3217
-
3218
- static public Object clone(Object o)
3382
+ static public byte[] Compress(Object3D o)
32193383 {
32203384 try
32213385 {
32223386 ByteArrayOutputStream baos = new ByteArrayOutputStream();
3223
- ObjectOutputStream out = new ObjectOutputStream(baos);
3387
+ java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(baos);
3388
+ ObjectOutputStream out = new ObjectOutputStream(zstream);
32243389
3390
+ Object3D parent = o.parent;
3391
+ o.parent = null;
3392
+
32253393 out.writeObject(o);
3394
+
3395
+ o.parent = parent;
3396
+
3397
+ out.flush();
32263398
3227
- ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
3228
- ObjectInputStream in = new ObjectInputStream(bais);
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);
32293418 Object obj = in.readObject();
32303419 in.close();
3231
- out.close();
3420
+
32323421 return obj;
32333422 } catch (Exception e)
32343423 {
....@@ -3237,16 +3426,75 @@
32373426 }
32383427 }
32393428
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
+
32403475 public void Save()
32413476 {
3242
- if (true) return;
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);
32433485
32443486 //EditorFrame.m_MainFrame.requestFocusInWindow();
3245
- graphs[undoindex++] = (Object3D)clone(copy);
3487
+ tab.graphs[tab.undoindex++] = Compress(copy);
32463488
3247
- for (int i = undoindex; i < graphs.length; i++)
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++)
32483496 {
3249
- graphs[i] = null;
3497
+ tab.graphs[i] = null;
32503498 }
32513499
32523500 // test save
....@@ -3254,7 +3502,7 @@
32543502 {
32553503 try
32563504 {
3257
- FileOutputStream ostream = new FileOutputStream("save" + undoindex);
3505
+ FileOutputStream ostream = new FileOutputStream("save" + tab.undoindex);
32583506 ObjectOutputStream p = new ObjectOutputStream(ostream);
32593507
32603508 p.writeObject(copy);
....@@ -3269,48 +3517,83 @@
32693517 }
32703518 }
32713519
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
+
32723561 public void Undo()
32733562 {
3274
- if (undoindex == 0)
3563
+ System.err.println("Undo");
3564
+
3565
+ cRadio tab = GetCurrentTab();
3566
+
3567
+ if (tab.undoindex == 0)
32753568 {
32763569 java.awt.Toolkit.getDefaultToolkit().beep();
32773570 return;
32783571 }
32793572
3280
- if (graphs[undoindex] == null)
3573
+ if (tab.graphs[tab.undoindex] == null)
32813574 {
32823575 Save();
3283
- undoindex -= 1;
3576
+ tab.undoindex -= 1;
32843577 }
32853578
3286
- undoindex -= 1;
3579
+ tab.undoindex -= 1;
32873580
3288
- copy = graphs[undoindex];
3289
-
3290
- cameraView.object = copy;
3291
- copy.Touch();
3292
-
3293
- ResetModel();
3294
- refreshContents();
3581
+ CopyChanged((Object3D)Uncompress(tab.graphs[tab.undoindex]));
32953582 }
32963583
32973584 public void Redo()
32983585 {
3299
- if (graphs[undoindex + 1] == null)
3586
+ cRadio tab = GetCurrentTab();
3587
+
3588
+ if (tab.graphs[tab.undoindex + 1] == null)
33003589 {
33013590 java.awt.Toolkit.getDefaultToolkit().beep();
33023591 return;
33033592 }
33043593
3305
- undoindex += 1;
3594
+ tab.undoindex += 1;
33063595
3307
- copy = graphs[undoindex];
3308
-
3309
- cameraView.object = copy;
3310
- copy.Touch();
3311
-
3312
- ResetModel();
3313
- refreshContents();
3596
+ CopyChanged((Object3D)Uncompress(tab.graphs[tab.undoindex]));
33143597 }
33153598
33163599 void ImportGFD()
....@@ -3462,7 +3745,7 @@
34623745 assert false;
34633746 }
34643747
3465
- void EditSelection()
3748
+ void EditSelection(boolean newWindow)
34663749 {
34673750 }
34683751
....@@ -3957,7 +4240,8 @@
39574240
39584241 void makeSomething(Object3D thing, boolean resetmodel) // deselect)
39594242 {
3960
- Save();
4243
+ if (Globals.SAVEONMAKE) // && resetmodel)
4244
+ Save();
39614245 //Tween.set(thing, 0).target(1).start(tweenManager);
39624246 //Tween.to(thing, 0, 0.5f).target(0).start(tweenManager);
39634247 // if (thing instanceof GenericJointDemo)
....@@ -4044,6 +4328,12 @@
40444328 {
40454329 ResetModel();
40464330 Select(thing.GetTreePath(), true, false); // unselect... false);
4331
+
4332
+ if (thing.Size() == 0)
4333
+ {
4334
+ //EditSelection(false);
4335
+ }
4336
+
40474337 refreshContents();
40484338 }
40494339
....@@ -4181,6 +4471,7 @@
41814471
41824472 try
41834473 {
4474
+ // Try compressed version first.
41844475 java.io.FileInputStream istream = new java.io.FileInputStream(fullname);
41854476 java.util.zip.GZIPInputStream zstream = new java.util.zip.GZIPInputStream(istream);
41864477 java.io.ObjectInputStream p = new java.io.ObjectInputStream(zstream);
....@@ -4250,6 +4541,12 @@
42504541
42514542 void LoadIt(Object obj)
42524543 {
4544
+ if (obj == null)
4545
+ {
4546
+ // Invalid file
4547
+ return;
4548
+ }
4549
+
42534550 System.out.println("Loaded " + obj);
42544551 //new Exception().printStackTrace();
42554552 Object3D readobj = (Object3D) obj;
....@@ -4259,6 +4556,8 @@
42594556
42604557 if (readobj != null)
42614558 {
4559
+ if (Globals.SAVEONMAKE)
4560
+ Save();
42624561 try
42634562 {
42644563 //readobj.deepCopySelf(copy);
....@@ -4629,18 +4928,29 @@
46294928 CheckboxMenuItem togglePaintItem;
46304929 JSplitPane mainPanel;
46314930 JScrollPane scrollpane;
4931
+
46324932 JPanel toolbarPanel;
4933
+
46334934 cGridBag treePanel;
4935
+
46344936 JPanel radioPanel;
46354937 ButtonGroup buttonGroup;
4636
- cGridBag ctrlPanel;
4938
+
4939
+ cGridBag toolboxPanel;
46374940 cGridBag materialPanel;
4941
+ cGridBag ctrlPanel;
4942
+
46384943 JScrollPane infoPanel;
4944
+
46394945 cGridBag optionsPanel;
4946
+
46404947 JTabbedPane objectPanel;
4948
+
46414949 cGridBag XYZPanel;
4950
+
46424951 JSplitPane gridPanel;
46434952 JSplitPane bigPanel;
4953
+
46444954 cGridBag bigThree;
46454955 cGridBag scenePanel;
46464956 cGridBag centralPanel;
....@@ -4755,7 +5065,7 @@
47555065 cNumberSlider fogField;
47565066 JLabel opacityPowerLabel;
47575067 cNumberSlider opacityPowerField;
4758
- JTree jTree;
5068
+ cTree jTree;
47595069 //ObjectUI parent;
47605070
47615071 cNumberSlider normalpushField;