.. | .. |
---|
4 | 4 | |
---|
5 | 5 | import java.awt.*; |
---|
6 | 6 | import java.awt.event.*; |
---|
| 7 | +import java.awt.image.BufferedImage; |
---|
7 | 8 | import javax.swing.*; |
---|
8 | 9 | import javax.swing.event.*; |
---|
9 | 10 | import javax.swing.text.*; |
---|
.. | .. |
---|
35 | 36 | |
---|
36 | 37 | GroupEditor callee; |
---|
37 | 38 | 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 | + cCheckBox GetCheckBox(String name, boolean border) |
---|
| 56 | + { |
---|
| 57 | + try |
---|
| 58 | + { |
---|
| 59 | + ImageIcon icon = GetIcon(name); |
---|
| 60 | + return new cCheckBox(icon, border); |
---|
| 61 | + } |
---|
| 62 | + catch (Exception e) |
---|
| 63 | + { |
---|
| 64 | + return new cCheckBox(name, border); |
---|
| 65 | + } |
---|
| 66 | + } |
---|
| 67 | + |
---|
| 68 | + private ImageIcon GetIcon(String name) throws IOException |
---|
| 69 | + { |
---|
| 70 | + BufferedImage image = javax.imageio.ImageIO.read(getClass().getClassLoader().getResourceAsStream(name)); |
---|
| 71 | + |
---|
| 72 | + if (image.getWidth() != 24 && image.getHeight() != 24) |
---|
| 73 | + { |
---|
| 74 | + BufferedImage resized = new BufferedImage(24, 24, image.getType()); |
---|
| 75 | + Graphics2D g = resized.createGraphics(); |
---|
| 76 | + g.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR); |
---|
| 77 | + //g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); |
---|
| 78 | + g.drawImage(image, 0, 0, 24, 24, 0, 0, image.getWidth(), image.getHeight(), null); |
---|
| 79 | + g.dispose(); |
---|
| 80 | + |
---|
| 81 | + image = resized; |
---|
| 82 | + } |
---|
| 83 | + |
---|
| 84 | + javax.swing.ImageIcon icon = new javax.swing.ImageIcon(image); |
---|
| 85 | + return icon; |
---|
| 86 | + } |
---|
38 | 87 | |
---|
39 | 88 | // SCRIPT |
---|
40 | 89 | |
---|
.. | .. |
---|
168 | 217 | // objEditor.ctrlPanel.remove(remarkButton); |
---|
169 | 218 | |
---|
170 | 219 | objEditor.ctrlPanel.remove(setupPanel); |
---|
171 | | - objEditor.ctrlPanel.remove(commandsPanel); |
---|
| 220 | + objEditor.ctrlPanel.remove(setupPanel2); |
---|
| 221 | + objEditor.ctrlPanel.remove(objectCommandsPanel); |
---|
172 | 222 | objEditor.ctrlPanel.remove(pushPanel); |
---|
173 | 223 | //objEditor.ctrlPanel.remove(fillPanel); |
---|
174 | 224 | |
---|
.. | .. |
---|
243 | 293 | //localCopy.parent = null; |
---|
244 | 294 | |
---|
245 | 295 | frame = new JFrame(); |
---|
| 296 | + frame.setUndecorated(true); |
---|
246 | 297 | objEditor = this; |
---|
247 | 298 | this.callee = callee; |
---|
248 | 299 | |
---|
.. | .. |
---|
278 | 329 | frame.setMenuBar(menuBar = new MenuBar()); |
---|
279 | 330 | menuBar.add(fileMenu = new Menu("File")); |
---|
280 | 331 | fileMenu.add(newItem = new MenuItem("New")); |
---|
281 | | - fileMenu.add(loadItem = new MenuItem("Load...")); |
---|
| 332 | + fileMenu.add(loadItem = new MenuItem("Open...")); |
---|
282 | 333 | |
---|
283 | 334 | //oe.menuBar.add(menu = new Menu("Include")); |
---|
284 | 335 | Menu menu = new Menu("Import"); |
---|
.. | .. |
---|
323 | 374 | toolbarPanel.setName("Toolbar"); |
---|
324 | 375 | treePanel = new cGridBag(); |
---|
325 | 376 | treePanel.setName("Tree"); |
---|
| 377 | + |
---|
| 378 | + editPanel = new cGridBag().setVertical(true); |
---|
| 379 | + editPanel.setName("Edit"); |
---|
| 380 | + |
---|
326 | 381 | ctrlPanel = new cGridBag().setVertical(false); // new GridBagLayout()); |
---|
327 | | - ctrlPanel.setName("Edit"); |
---|
| 382 | + |
---|
| 383 | + editCommandsPanel = new cGridBag(); |
---|
| 384 | + editPanel.add(editCommandsPanel); |
---|
| 385 | + editPanel.add(ctrlPanel); |
---|
| 386 | + |
---|
328 | 387 | materialPanel = new cGridBag().setVertical(true); |
---|
| 388 | + |
---|
329 | 389 | materialPanel.setName("Material"); |
---|
330 | 390 | /*JTextPane*/ |
---|
331 | 391 | infoarea = createTextPane(); |
---|
.. | .. |
---|
419 | 479 | e.printStackTrace(); |
---|
420 | 480 | } |
---|
421 | 481 | |
---|
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(); |
---|
| 482 | +// String selection = infoarea.getText(); |
---|
| 483 | +// java.awt.datatransfer.StringSelection data = new java.awt.datatransfer.StringSelection(selection); |
---|
| 484 | +// java.awt.datatransfer.Clipboard clipboard = |
---|
| 485 | +// Toolkit.getDefaultToolkit().getSystemClipboard(); |
---|
426 | 486 | //clipboard.setContents(data, data); |
---|
427 | 487 | } |
---|
428 | 488 | |
---|
.. | .. |
---|
582 | 642 | } |
---|
583 | 643 | } |
---|
584 | 644 | |
---|
| 645 | +static GraphicsDevice device = GraphicsEnvironment |
---|
| 646 | + .getLocalGraphicsEnvironment().getScreenDevices()[0]; |
---|
| 647 | + |
---|
| 648 | + Rectangle keeprect; |
---|
| 649 | + cRadio radio; |
---|
| 650 | + |
---|
| 651 | +cButton keepButton; |
---|
| 652 | + cButton twoButton; // Full 3D |
---|
| 653 | + cButton sixButton; |
---|
| 654 | + cButton threeButton; |
---|
| 655 | + cButton sevenButton; |
---|
| 656 | + cButton fourButton; // full panel |
---|
| 657 | + cButton oneButton; // full XYZ |
---|
| 658 | + //cButton currentLayout; |
---|
| 659 | + |
---|
| 660 | + boolean maximized; |
---|
| 661 | + |
---|
| 662 | + void Minimize() |
---|
| 663 | + { |
---|
| 664 | + frame.setState(Frame.ICONIFIED); |
---|
| 665 | + } |
---|
| 666 | + |
---|
| 667 | + void Maximize() |
---|
| 668 | + { |
---|
| 669 | + if (maximized) |
---|
| 670 | + { |
---|
| 671 | + frame.setBounds(keeprect.x, keeprect.y, keeprect.width, keeprect.height); |
---|
| 672 | + } |
---|
| 673 | + else |
---|
| 674 | + { |
---|
| 675 | + keeprect = frame.getBounds(); |
---|
| 676 | + Rectangle rect = GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds(); |
---|
| 677 | + Dimension rect2 = frame.getToolkit().getScreenSize(); |
---|
| 678 | + frame.setBounds(0, rect2.height - rect.height, rect.width, rect.height); |
---|
| 679 | +// frame.setState(Frame.MAXIMIZED_BOTH); |
---|
| 680 | + } |
---|
| 681 | + |
---|
| 682 | + maximized ^= true; |
---|
| 683 | + } |
---|
| 684 | + |
---|
585 | 685 | void ToggleFullScreen() |
---|
586 | 686 | { |
---|
587 | 687 | if (CameraPane.FULLSCREEN) |
---|
588 | 688 | { |
---|
589 | | - frame.getContentPane().remove(/*"Center",*/bigThree); |
---|
590 | | - framePanel.add(bigThree); |
---|
591 | | - frame.getContentPane().add(/*"Center",*/framePanel); |
---|
| 689 | + device.setFullScreenWindow(null); |
---|
| 690 | + //frame.setVisible(false); |
---|
| 691 | +// frame.removeNotify(); |
---|
| 692 | +// frame.setUndecorated(false); |
---|
| 693 | +// frame.addNotify(); |
---|
| 694 | + //frame.setBounds(keeprect.x, keeprect.y, keeprect.width, keeprect.height); |
---|
| 695 | + |
---|
| 696 | +// X frame.getContentPane().remove(/*"Center",*/bigThree); |
---|
| 697 | +// X framePanel.add(bigThree); |
---|
| 698 | +// X frame.getContentPane().add(/*"Center",*/framePanel); |
---|
| 699 | + framePanel.setDividerLocation(1); |
---|
| 700 | + |
---|
| 701 | + //frame.setVisible(true); |
---|
| 702 | + radio.layout = keepButton; |
---|
| 703 | + //theFrame = null; |
---|
| 704 | + keepButton = null; |
---|
| 705 | + radio.layout.doClick(); |
---|
| 706 | + |
---|
592 | 707 | } else |
---|
593 | 708 | { |
---|
594 | | - frame.getContentPane().remove(/*"Center",*/framePanel); |
---|
595 | | - framePanel.remove(bigThree); |
---|
596 | | - frame.getContentPane().add(/*"Center",*/bigThree); |
---|
| 709 | + keepButton = radio.layout; |
---|
| 710 | + //keeprect = frame.getBounds(); |
---|
| 711 | +// frame.setBounds(0, 0, frame.getToolkit().getScreenSize().width, |
---|
| 712 | +// frame.getToolkit().getScreenSize().height); |
---|
| 713 | + //frame.setVisible(false); |
---|
| 714 | + device.setFullScreenWindow(frame); |
---|
| 715 | +// frame.removeNotify(); |
---|
| 716 | +// frame.setUndecorated(true); |
---|
| 717 | +// frame.addNotify(); |
---|
| 718 | +// X frame.getContentPane().remove(/*"Center",*/framePanel); |
---|
| 719 | +// X framePanel.remove(bigThree); |
---|
| 720 | +// X frame.getContentPane().add(/*"Center",*/bigThree); |
---|
| 721 | + framePanel.setDividerLocation(0); |
---|
| 722 | + |
---|
| 723 | + radio.layout = twoButton; |
---|
| 724 | + radio.layout.doClick(); |
---|
| 725 | + //frame.setVisible(true); |
---|
597 | 726 | } |
---|
| 727 | + |
---|
598 | 728 | cameraView.ToggleFullScreen(); |
---|
599 | 729 | } |
---|
600 | 730 | |
---|
.. | .. |
---|
745 | 875 | JButton fasterButton; |
---|
746 | 876 | JButton remarkButton; |
---|
747 | 877 | |
---|
| 878 | + cGridBag editPanel; |
---|
| 879 | + cGridBag editCommandsPanel; |
---|
| 880 | + |
---|
748 | 881 | cGridBag namePanel; |
---|
749 | 882 | cGridBag setupPanel; |
---|
750 | | - cGridBag commandsPanel; |
---|
| 883 | + cGridBag setupPanel2; |
---|
| 884 | + cGridBag objectCommandsPanel; |
---|
751 | 885 | cGridBag pushPanel; |
---|
752 | 886 | cGridBag fillPanel; |
---|
753 | 887 | |
---|
.. | .. |
---|
939 | 1073 | markCB = AddCheckBox(setupPanel, "Mark", copy.marked); |
---|
940 | 1074 | markCB.setToolTipText("Set the animation target transform"); |
---|
941 | 1075 | |
---|
942 | | - rewindCB = AddCheckBox(setupPanel, "Rewind", copy.rewind); |
---|
| 1076 | + setupPanel2 = new cGridBag().setVertical(false); |
---|
| 1077 | + |
---|
| 1078 | + rewindCB = AddCheckBox(setupPanel2, "Rewind", copy.rewind); |
---|
943 | 1079 | rewindCB.setToolTipText("Rewind animation"); |
---|
944 | 1080 | |
---|
945 | | - randomCB = AddCheckBox(setupPanel, "Random", copy.random); |
---|
946 | | - randomCB.setToolTipText("Option for switch node"); |
---|
| 1081 | + randomCB = AddCheckBox(setupPanel2, "Rand", copy.random); |
---|
| 1082 | + randomCB.setToolTipText("Randomly Rewind or Go back and forth"); |
---|
947 | 1083 | |
---|
948 | 1084 | if (Globals.ADVANCED) |
---|
949 | 1085 | { |
---|
950 | | - link2masterCB = AddCheckBox(setupPanel, "Support", copy.link2master); |
---|
| 1086 | + link2masterCB = AddCheckBox(setupPanel2, "Supp", copy.link2master); |
---|
951 | 1087 | link2masterCB.setToolTipText("Attach to support"); |
---|
952 | | - speedupCB = AddCheckBox(setupPanel, "Speed", copy.speedup); |
---|
| 1088 | + speedupCB = AddCheckBox(setupPanel2, "Speed", copy.speedup); |
---|
953 | 1089 | speedupCB.setToolTipText("Option motion capture"); |
---|
954 | 1090 | } |
---|
955 | 1091 | |
---|
956 | 1092 | oe.ctrlPanel.add(setupPanel); |
---|
957 | 1093 | oe.ctrlPanel.Return(); |
---|
| 1094 | + oe.ctrlPanel.add(setupPanel2); |
---|
| 1095 | + oe.ctrlPanel.Return(); |
---|
958 | 1096 | |
---|
959 | | - commandsPanel = new cGridBag().setVertical(false); |
---|
| 1097 | + objectCommandsPanel = new cGridBag().setVertical(false); |
---|
960 | 1098 | |
---|
961 | | - resetButton = AddButton(commandsPanel, "Reset"); |
---|
| 1099 | + resetButton = AddButton(objectCommandsPanel, "Reset"); |
---|
962 | 1100 | resetButton.setToolTipText("Jump to frame zero"); |
---|
963 | | - stepButton = AddButton(commandsPanel, "Step"); |
---|
| 1101 | + stepButton = AddButton(objectCommandsPanel, "Step"); |
---|
964 | 1102 | stepButton.setToolTipText("Step one frame"); |
---|
965 | 1103 | // resetAllButton = AddButton(oe, "Reset All"); |
---|
966 | 1104 | // stepAllButton = AddButton(oe, "Step All"); |
---|
967 | 1105 | // Return(); |
---|
968 | | - slowerButton = AddButton(commandsPanel, "Slow"); |
---|
| 1106 | + slowerButton = AddButton(objectCommandsPanel, "Slow"); |
---|
969 | 1107 | slowerButton.setToolTipText("Decrease animation speed"); |
---|
970 | | - fasterButton = AddButton(commandsPanel, "Fast"); |
---|
| 1108 | + fasterButton = AddButton(objectCommandsPanel, "Fast"); |
---|
971 | 1109 | fasterButton.setToolTipText("Increase animation speed"); |
---|
972 | | - remarkButton = AddButton(commandsPanel, "Remark"); |
---|
| 1110 | + remarkButton = AddButton(objectCommandsPanel, "Remark"); |
---|
973 | 1111 | remarkButton.setToolTipText("Set the current transform as the target"); |
---|
974 | 1112 | |
---|
975 | | - oe.ctrlPanel.add(commandsPanel); |
---|
| 1113 | + oe.ctrlPanel.add(objectCommandsPanel); |
---|
976 | 1114 | oe.ctrlPanel.Return(); |
---|
977 | 1115 | |
---|
978 | 1116 | pushPanel = AddSlider(oe.ctrlPanel, "Push", -1, 1, copy.NORMALPUSH, 1.1); // To have the buttons |
---|
.. | .. |
---|
1178 | 1316 | //worldPanel.setName("World"); |
---|
1179 | 1317 | centralPanel = new cGridBag(); |
---|
1180 | 1318 | centralPanel.preferredWidth = 20; |
---|
1181 | | - timelinePanel = new JPanel(new BorderLayout()); |
---|
1182 | | - timelineMenubar = new timeflow.app.TimeflowApp().TimeFlowWindow(timelinePanel); |
---|
| 1319 | + |
---|
| 1320 | + if (Globals.ADVANCED) |
---|
| 1321 | + { |
---|
| 1322 | + timelinePanel = new JPanel(new BorderLayout()); |
---|
| 1323 | + timelineMenubar = new timeflow.app.TimeflowApp().TimeFlowWindow(timelinePanel); |
---|
1183 | 1324 | |
---|
1184 | 1325 | cameraPanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, cameraView, timelinePanel); |
---|
1185 | 1326 | cameraPanel.setContinuousLayout(true); |
---|
.. | .. |
---|
1188 | 1329 | // cameraPanel.setDividerSize(9); |
---|
1189 | 1330 | cameraPanel.setResizeWeight(1.0); |
---|
1190 | 1331 | |
---|
| 1332 | + } |
---|
| 1333 | + |
---|
1191 | 1334 | centralPanel.add(cameraView); |
---|
| 1335 | + centralPanel.setFocusable(true); |
---|
1192 | 1336 | //frame.setJMenuBar(timelineMenubar); |
---|
1193 | 1337 | //centralPanel.add(timelinePanel); |
---|
1194 | 1338 | |
---|
.. | .. |
---|
1255 | 1399 | // north.setName("Edit"); |
---|
1256 | 1400 | // north.add(ctrlPanel, BorderLayout.NORTH); |
---|
1257 | 1401 | // objectPanel.add(north); |
---|
1258 | | - objectPanel.add(ctrlPanel); |
---|
| 1402 | + objectPanel.add(editPanel); |
---|
1259 | 1403 | objectPanel.add(infoPanel); |
---|
1260 | 1404 | |
---|
1261 | 1405 | /* |
---|
.. | .. |
---|
1386 | 1530 | frame.setSize(1280, 860); |
---|
1387 | 1531 | frame.setVisible(true); |
---|
1388 | 1532 | |
---|
| 1533 | + cameraView.requestFocusInWindow(); |
---|
| 1534 | + |
---|
1389 | 1535 | gridPanel.setDividerLocation(1.0); |
---|
1390 | 1536 | |
---|
1391 | 1537 | frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); |
---|
.. | .. |
---|
2072 | 2218 | |
---|
2073 | 2219 | void LoadObjFile(String fullname) |
---|
2074 | 2220 | { |
---|
2075 | | - /* |
---|
| 2221 | + System.out.println("Loading " + fullname); |
---|
| 2222 | + /**/ |
---|
2076 | 2223 | //lastFilename = fullname; |
---|
2077 | 2224 | if(loadObjThread == null) |
---|
2078 | 2225 | { |
---|
2079 | | - loadObjThread = new LoadOBJThread(); |
---|
2080 | | - loadObjThread.start(); |
---|
| 2226 | + loadObjThread = new LoadOBJThread(); |
---|
| 2227 | + loadObjThread.start(); |
---|
2081 | 2228 | } |
---|
2082 | 2229 | |
---|
2083 | 2230 | loadObjThread.add(fullname); |
---|
2084 | | - */ |
---|
| 2231 | + /**/ |
---|
2085 | 2232 | |
---|
2086 | | - System.out.println("Loading " + fullname); |
---|
2087 | | - makeSomething(new FileObject(fullname, true), true); |
---|
| 2233 | + //makeSomething(new FileObject(fullname, true), true); |
---|
2088 | 2234 | } |
---|
2089 | 2235 | |
---|
2090 | 2236 | void LoadGFDFile(String fullname) |
---|
.. | .. |
---|
2927 | 3073 | return; |
---|
2928 | 3074 | } else if (event.getSource() == toggleSwitchItem) |
---|
2929 | 3075 | { |
---|
2930 | | - cameraView.ToggleRandom(); |
---|
| 3076 | + cameraView.ToggleSwitch(); |
---|
2931 | 3077 | cameraView.repaint(); |
---|
2932 | 3078 | return; |
---|
2933 | 3079 | } else if (event.getSource() == toggleHandleItem) |
---|
.. | .. |
---|
3214 | 3360 | objEditor.refreshContents(); |
---|
3215 | 3361 | } |
---|
3216 | 3362 | |
---|
3217 | | - static public byte[] Compress(Object o) |
---|
| 3363 | + static public byte[] Compress(Object3D o) |
---|
3218 | 3364 | { |
---|
3219 | 3365 | try |
---|
3220 | 3366 | { |
---|
.. | .. |
---|
3222 | 3368 | java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(baos); |
---|
3223 | 3369 | ObjectOutputStream out = new ObjectOutputStream(zstream); |
---|
3224 | 3370 | |
---|
| 3371 | + Object3D parent = o.parent; |
---|
| 3372 | + o.parent = null; |
---|
| 3373 | + |
---|
3225 | 3374 | out.writeObject(o); |
---|
3226 | 3375 | |
---|
| 3376 | + o.parent = parent; |
---|
| 3377 | + |
---|
3227 | 3378 | out.flush(); |
---|
3228 | 3379 | |
---|
3229 | 3380 | zstream.close(); |
---|
.. | .. |
---|
3239 | 3390 | |
---|
3240 | 3391 | static public Object Uncompress(byte[] bytes) |
---|
3241 | 3392 | { |
---|
| 3393 | + System.out.println("#bytes = " + bytes.length); |
---|
3242 | 3394 | try |
---|
3243 | 3395 | { |
---|
3244 | 3396 | ByteArrayInputStream bais = new ByteArrayInputStream(bytes); |
---|
.. | .. |
---|
3303 | 3455 | |
---|
3304 | 3456 | public void Save() |
---|
3305 | 3457 | { |
---|
| 3458 | + System.err.println("Save"); |
---|
| 3459 | + |
---|
3306 | 3460 | cRadio tab = GetCurrentTab(); |
---|
| 3461 | + |
---|
| 3462 | + boolean temp = CameraPane.SWITCH; |
---|
| 3463 | + CameraPane.SWITCH = false; |
---|
3307 | 3464 | |
---|
3308 | 3465 | copy.ExtractBigData(hashtable); |
---|
3309 | 3466 | |
---|
3310 | 3467 | //EditorFrame.m_MainFrame.requestFocusInWindow(); |
---|
3311 | | - tab.graphs[tab.undoindex++] = (Object3D)clone(copy); |
---|
| 3468 | + tab.graphs[tab.undoindex++] = Compress(copy); |
---|
3312 | 3469 | |
---|
3313 | 3470 | copy.RestoreBigData(hashtable); |
---|
| 3471 | + |
---|
| 3472 | + CameraPane.SWITCH = temp; |
---|
3314 | 3473 | |
---|
3315 | 3474 | //assert(hashtable.isEmpty()); |
---|
3316 | 3475 | |
---|
.. | .. |
---|
3341 | 3500 | |
---|
3342 | 3501 | void CopyChanged(Object3D obj) |
---|
3343 | 3502 | { |
---|
| 3503 | + boolean temp = CameraPane.SWITCH; |
---|
| 3504 | + CameraPane.SWITCH = false; |
---|
| 3505 | + |
---|
3344 | 3506 | copy.ExtractBigData(hashtable); |
---|
3345 | 3507 | |
---|
3346 | 3508 | copy.clear(); |
---|
.. | .. |
---|
3351 | 3513 | } |
---|
3352 | 3514 | |
---|
3353 | 3515 | copy.RestoreBigData(hashtable); |
---|
| 3516 | + |
---|
| 3517 | + CameraPane.SWITCH = temp; |
---|
3354 | 3518 | |
---|
3355 | 3519 | //assert(hashtable.isEmpty()); |
---|
3356 | 3520 | |
---|
.. | .. |
---|
3377 | 3541 | |
---|
3378 | 3542 | public void Undo() |
---|
3379 | 3543 | { |
---|
| 3544 | + System.err.println("Undo"); |
---|
| 3545 | + |
---|
3380 | 3546 | cRadio tab = GetCurrentTab(); |
---|
3381 | 3547 | |
---|
3382 | 3548 | if (tab.undoindex == 0) |
---|
.. | .. |
---|
3393 | 3559 | |
---|
3394 | 3560 | tab.undoindex -= 1; |
---|
3395 | 3561 | |
---|
3396 | | - CopyChanged(tab.graphs[tab.undoindex]); |
---|
| 3562 | + CopyChanged((Object3D)Uncompress(tab.graphs[tab.undoindex])); |
---|
3397 | 3563 | } |
---|
3398 | 3564 | |
---|
3399 | 3565 | public void Redo() |
---|
.. | .. |
---|
3408 | 3574 | |
---|
3409 | 3575 | tab.undoindex += 1; |
---|
3410 | 3576 | |
---|
3411 | | - CopyChanged(tab.graphs[tab.undoindex]); |
---|
| 3577 | + CopyChanged((Object3D)Uncompress(tab.graphs[tab.undoindex])); |
---|
3412 | 3578 | } |
---|
3413 | 3579 | |
---|
3414 | 3580 | void ImportGFD() |
---|
.. | .. |
---|
4055 | 4221 | |
---|
4056 | 4222 | void makeSomething(Object3D thing, boolean resetmodel) // deselect) |
---|
4057 | 4223 | { |
---|
4058 | | - Save(); |
---|
| 4224 | + if (Globals.SAVEONMAKE) |
---|
| 4225 | + Save(); |
---|
4059 | 4226 | //Tween.set(thing, 0).target(1).start(tweenManager); |
---|
4060 | 4227 | //Tween.to(thing, 0, 0.5f).target(0).start(tweenManager); |
---|
4061 | 4228 | // if (thing instanceof GenericJointDemo) |
---|
.. | .. |
---|
4279 | 4446 | |
---|
4280 | 4447 | try |
---|
4281 | 4448 | { |
---|
| 4449 | + // Try compressed version first. |
---|
4282 | 4450 | java.io.FileInputStream istream = new java.io.FileInputStream(fullname); |
---|
4283 | 4451 | java.util.zip.GZIPInputStream zstream = new java.util.zip.GZIPInputStream(istream); |
---|
4284 | 4452 | java.io.ObjectInputStream p = new java.io.ObjectInputStream(zstream); |
---|
.. | .. |
---|
4348 | 4516 | |
---|
4349 | 4517 | void LoadIt(Object obj) |
---|
4350 | 4518 | { |
---|
| 4519 | + if (obj == null) |
---|
| 4520 | + { |
---|
| 4521 | + // Invalid file |
---|
| 4522 | + return; |
---|
| 4523 | + } |
---|
| 4524 | + |
---|
4351 | 4525 | System.out.println("Loaded " + obj); |
---|
4352 | 4526 | //new Exception().printStackTrace(); |
---|
4353 | 4527 | Object3D readobj = (Object3D) obj; |
---|
.. | .. |
---|
4357 | 4531 | |
---|
4358 | 4532 | if (readobj != null) |
---|
4359 | 4533 | { |
---|
| 4534 | + if (Globals.SAVEONMAKE) |
---|
4360 | 4535 | Save(); |
---|
4361 | 4536 | try |
---|
4362 | 4537 | { |
---|