.. | .. |
---|
36 | 36 | GroupEditor callee; |
---|
37 | 37 | JFrame frame; |
---|
38 | 38 | |
---|
| 39 | + static ObjEditor theFrame; |
---|
| 40 | + |
---|
39 | 41 | // SCRIPT |
---|
40 | 42 | |
---|
41 | 43 | transient JFrame textpanel = null; |
---|
.. | .. |
---|
168 | 170 | // objEditor.ctrlPanel.remove(remarkButton); |
---|
169 | 171 | |
---|
170 | 172 | objEditor.ctrlPanel.remove(setupPanel); |
---|
171 | | - objEditor.ctrlPanel.remove(commandsPanel); |
---|
| 173 | + objEditor.ctrlPanel.remove(setupPanel2); |
---|
| 174 | + objEditor.ctrlPanel.remove(objectCommandsPanel); |
---|
172 | 175 | objEditor.ctrlPanel.remove(pushPanel); |
---|
173 | 176 | //objEditor.ctrlPanel.remove(fillPanel); |
---|
174 | 177 | |
---|
.. | .. |
---|
243 | 246 | //localCopy.parent = null; |
---|
244 | 247 | |
---|
245 | 248 | frame = new JFrame(); |
---|
| 249 | + frame.setUndecorated(true); |
---|
246 | 250 | objEditor = this; |
---|
247 | 251 | this.callee = callee; |
---|
248 | 252 | |
---|
.. | .. |
---|
278 | 282 | frame.setMenuBar(menuBar = new MenuBar()); |
---|
279 | 283 | menuBar.add(fileMenu = new Menu("File")); |
---|
280 | 284 | fileMenu.add(newItem = new MenuItem("New")); |
---|
281 | | - fileMenu.add(loadItem = new MenuItem("Load...")); |
---|
| 285 | + fileMenu.add(loadItem = new MenuItem("Open...")); |
---|
282 | 286 | |
---|
283 | 287 | //oe.menuBar.add(menu = new Menu("Include")); |
---|
284 | 288 | Menu menu = new Menu("Import"); |
---|
.. | .. |
---|
323 | 327 | toolbarPanel.setName("Toolbar"); |
---|
324 | 328 | treePanel = new cGridBag(); |
---|
325 | 329 | treePanel.setName("Tree"); |
---|
| 330 | + |
---|
| 331 | + editPanel = new cGridBag().setVertical(true); |
---|
| 332 | + editPanel.setName("Edit"); |
---|
| 333 | + |
---|
326 | 334 | ctrlPanel = new cGridBag().setVertical(false); // new GridBagLayout()); |
---|
327 | | - ctrlPanel.setName("Edit"); |
---|
| 335 | + |
---|
| 336 | + editCommandsPanel = new cGridBag(); |
---|
| 337 | + editPanel.add(editCommandsPanel); |
---|
| 338 | + editPanel.add(ctrlPanel); |
---|
| 339 | + |
---|
328 | 340 | materialPanel = new cGridBag().setVertical(true); |
---|
| 341 | + |
---|
329 | 342 | materialPanel.setName("Material"); |
---|
330 | 343 | /*JTextPane*/ |
---|
331 | 344 | infoarea = createTextPane(); |
---|
.. | .. |
---|
419 | 432 | e.printStackTrace(); |
---|
420 | 433 | } |
---|
421 | 434 | |
---|
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(); |
---|
| 435 | +// String selection = infoarea.getText(); |
---|
| 436 | +// java.awt.datatransfer.StringSelection data = new java.awt.datatransfer.StringSelection(selection); |
---|
| 437 | +// java.awt.datatransfer.Clipboard clipboard = |
---|
| 438 | +// Toolkit.getDefaultToolkit().getSystemClipboard(); |
---|
426 | 439 | //clipboard.setContents(data, data); |
---|
427 | 440 | } |
---|
428 | 441 | |
---|
.. | .. |
---|
582 | 595 | } |
---|
583 | 596 | } |
---|
584 | 597 | |
---|
| 598 | +static GraphicsDevice device = GraphicsEnvironment |
---|
| 599 | + .getLocalGraphicsEnvironment().getScreenDevices()[0]; |
---|
| 600 | + |
---|
| 601 | + Rectangle keeprect; |
---|
| 602 | + cRadio radio; |
---|
| 603 | + |
---|
| 604 | +cButton keepButton; |
---|
| 605 | + cButton twoButton; // Full 3D |
---|
| 606 | + cButton sixButton; |
---|
| 607 | + cButton threeButton; |
---|
| 608 | + cButton sevenButton; |
---|
| 609 | + cButton fourButton; // full panel |
---|
| 610 | + cButton oneButton; // full XYZ |
---|
| 611 | + //cButton currentLayout; |
---|
| 612 | + |
---|
| 613 | + boolean maximized; |
---|
| 614 | + |
---|
| 615 | + void Minimize() |
---|
| 616 | + { |
---|
| 617 | + frame.setState(Frame.ICONIFIED); |
---|
| 618 | + } |
---|
| 619 | + |
---|
| 620 | + void Maximize() |
---|
| 621 | + { |
---|
| 622 | + if (maximized) |
---|
| 623 | + { |
---|
| 624 | + frame.setBounds(keeprect.x, keeprect.y, keeprect.width, keeprect.height); |
---|
| 625 | + } |
---|
| 626 | + else |
---|
| 627 | + { |
---|
| 628 | + keeprect = frame.getBounds(); |
---|
| 629 | + Rectangle rect = GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds(); |
---|
| 630 | + Dimension rect2 = frame.getToolkit().getScreenSize(); |
---|
| 631 | + frame.setBounds(0, rect2.height - rect.height, rect.width, rect.height); |
---|
| 632 | +// frame.setState(Frame.MAXIMIZED_BOTH); |
---|
| 633 | + } |
---|
| 634 | + |
---|
| 635 | + maximized ^= true; |
---|
| 636 | + } |
---|
| 637 | + |
---|
585 | 638 | void ToggleFullScreen() |
---|
586 | 639 | { |
---|
587 | 640 | if (CameraPane.FULLSCREEN) |
---|
588 | 641 | { |
---|
589 | | - frame.getContentPane().remove(/*"Center",*/bigThree); |
---|
590 | | - framePanel.add(bigThree); |
---|
591 | | - frame.getContentPane().add(/*"Center",*/framePanel); |
---|
| 642 | + device.setFullScreenWindow(null); |
---|
| 643 | + //frame.setVisible(false); |
---|
| 644 | +// frame.removeNotify(); |
---|
| 645 | +// frame.setUndecorated(false); |
---|
| 646 | +// frame.addNotify(); |
---|
| 647 | + //frame.setBounds(keeprect.x, keeprect.y, keeprect.width, keeprect.height); |
---|
| 648 | + |
---|
| 649 | +// X frame.getContentPane().remove(/*"Center",*/bigThree); |
---|
| 650 | +// X framePanel.add(bigThree); |
---|
| 651 | +// X frame.getContentPane().add(/*"Center",*/framePanel); |
---|
| 652 | + framePanel.setDividerLocation(1); |
---|
| 653 | + |
---|
| 654 | + //frame.setVisible(true); |
---|
| 655 | + radio.layout = keepButton; |
---|
| 656 | + //theFrame = null; |
---|
| 657 | + keepButton = null; |
---|
| 658 | + radio.layout.doClick(); |
---|
| 659 | + |
---|
592 | 660 | } else |
---|
593 | 661 | { |
---|
594 | | - frame.getContentPane().remove(/*"Center",*/framePanel); |
---|
595 | | - framePanel.remove(bigThree); |
---|
596 | | - frame.getContentPane().add(/*"Center",*/bigThree); |
---|
| 662 | + keepButton = radio.layout; |
---|
| 663 | + //keeprect = frame.getBounds(); |
---|
| 664 | +// frame.setBounds(0, 0, frame.getToolkit().getScreenSize().width, |
---|
| 665 | +// frame.getToolkit().getScreenSize().height); |
---|
| 666 | + //frame.setVisible(false); |
---|
| 667 | + device.setFullScreenWindow(frame); |
---|
| 668 | +// frame.removeNotify(); |
---|
| 669 | +// frame.setUndecorated(true); |
---|
| 670 | +// frame.addNotify(); |
---|
| 671 | +// X frame.getContentPane().remove(/*"Center",*/framePanel); |
---|
| 672 | +// X framePanel.remove(bigThree); |
---|
| 673 | +// X frame.getContentPane().add(/*"Center",*/bigThree); |
---|
| 674 | + framePanel.setDividerLocation(0); |
---|
| 675 | + |
---|
| 676 | + radio.layout = twoButton; |
---|
| 677 | + radio.layout.doClick(); |
---|
| 678 | + //frame.setVisible(true); |
---|
597 | 679 | } |
---|
| 680 | + |
---|
598 | 681 | cameraView.ToggleFullScreen(); |
---|
599 | 682 | } |
---|
600 | 683 | |
---|
.. | .. |
---|
745 | 828 | JButton fasterButton; |
---|
746 | 829 | JButton remarkButton; |
---|
747 | 830 | |
---|
| 831 | + cGridBag editPanel; |
---|
| 832 | + cGridBag editCommandsPanel; |
---|
| 833 | + |
---|
748 | 834 | cGridBag namePanel; |
---|
749 | 835 | cGridBag setupPanel; |
---|
750 | | - cGridBag commandsPanel; |
---|
| 836 | + cGridBag setupPanel2; |
---|
| 837 | + cGridBag objectCommandsPanel; |
---|
751 | 838 | cGridBag pushPanel; |
---|
752 | 839 | cGridBag fillPanel; |
---|
753 | 840 | |
---|
.. | .. |
---|
939 | 1026 | markCB = AddCheckBox(setupPanel, "Mark", copy.marked); |
---|
940 | 1027 | markCB.setToolTipText("Set the animation target transform"); |
---|
941 | 1028 | |
---|
942 | | - rewindCB = AddCheckBox(setupPanel, "Rewind", copy.rewind); |
---|
| 1029 | + setupPanel2 = new cGridBag().setVertical(false); |
---|
| 1030 | + |
---|
| 1031 | + rewindCB = AddCheckBox(setupPanel2, "Rewind", copy.rewind); |
---|
943 | 1032 | rewindCB.setToolTipText("Rewind animation"); |
---|
944 | 1033 | |
---|
945 | | - randomCB = AddCheckBox(setupPanel, "Random", copy.random); |
---|
946 | | - randomCB.setToolTipText("Option for switch node"); |
---|
| 1034 | + randomCB = AddCheckBox(setupPanel2, "Rand", copy.random); |
---|
| 1035 | + randomCB.setToolTipText("Randomly Rewind or Go back and forth"); |
---|
947 | 1036 | |
---|
948 | 1037 | if (Globals.ADVANCED) |
---|
949 | 1038 | { |
---|
950 | | - link2masterCB = AddCheckBox(setupPanel, "Support", copy.link2master); |
---|
| 1039 | + link2masterCB = AddCheckBox(setupPanel2, "Supp", copy.link2master); |
---|
951 | 1040 | link2masterCB.setToolTipText("Attach to support"); |
---|
952 | | - speedupCB = AddCheckBox(setupPanel, "Speed", copy.speedup); |
---|
| 1041 | + speedupCB = AddCheckBox(setupPanel2, "Speed", copy.speedup); |
---|
953 | 1042 | speedupCB.setToolTipText("Option motion capture"); |
---|
954 | 1043 | } |
---|
955 | 1044 | |
---|
956 | 1045 | oe.ctrlPanel.add(setupPanel); |
---|
957 | 1046 | oe.ctrlPanel.Return(); |
---|
| 1047 | + oe.ctrlPanel.add(setupPanel2); |
---|
| 1048 | + oe.ctrlPanel.Return(); |
---|
958 | 1049 | |
---|
959 | | - commandsPanel = new cGridBag().setVertical(false); |
---|
| 1050 | + objectCommandsPanel = new cGridBag().setVertical(false); |
---|
960 | 1051 | |
---|
961 | | - resetButton = AddButton(commandsPanel, "Reset"); |
---|
| 1052 | + resetButton = AddButton(objectCommandsPanel, "Reset"); |
---|
962 | 1053 | resetButton.setToolTipText("Jump to frame zero"); |
---|
963 | | - stepButton = AddButton(commandsPanel, "Step"); |
---|
| 1054 | + stepButton = AddButton(objectCommandsPanel, "Step"); |
---|
964 | 1055 | stepButton.setToolTipText("Step one frame"); |
---|
965 | 1056 | // resetAllButton = AddButton(oe, "Reset All"); |
---|
966 | 1057 | // stepAllButton = AddButton(oe, "Step All"); |
---|
967 | 1058 | // Return(); |
---|
968 | | - slowerButton = AddButton(commandsPanel, "Slow"); |
---|
| 1059 | + slowerButton = AddButton(objectCommandsPanel, "Slow"); |
---|
969 | 1060 | slowerButton.setToolTipText("Decrease animation speed"); |
---|
970 | | - fasterButton = AddButton(commandsPanel, "Fast"); |
---|
| 1061 | + fasterButton = AddButton(objectCommandsPanel, "Fast"); |
---|
971 | 1062 | fasterButton.setToolTipText("Increase animation speed"); |
---|
972 | | - remarkButton = AddButton(commandsPanel, "Remark"); |
---|
| 1063 | + remarkButton = AddButton(objectCommandsPanel, "Remark"); |
---|
973 | 1064 | remarkButton.setToolTipText("Set the current transform as the target"); |
---|
974 | 1065 | |
---|
975 | | - oe.ctrlPanel.add(commandsPanel); |
---|
| 1066 | + oe.ctrlPanel.add(objectCommandsPanel); |
---|
976 | 1067 | oe.ctrlPanel.Return(); |
---|
977 | 1068 | |
---|
978 | 1069 | pushPanel = AddSlider(oe.ctrlPanel, "Push", -1, 1, copy.NORMALPUSH, 1.1); // To have the buttons |
---|
.. | .. |
---|
1178 | 1269 | //worldPanel.setName("World"); |
---|
1179 | 1270 | centralPanel = new cGridBag(); |
---|
1180 | 1271 | centralPanel.preferredWidth = 20; |
---|
1181 | | - timelinePanel = new JPanel(new BorderLayout()); |
---|
1182 | | - timelineMenubar = new timeflow.app.TimeflowApp().TimeFlowWindow(timelinePanel); |
---|
| 1272 | + |
---|
| 1273 | + if (Globals.ADVANCED) |
---|
| 1274 | + { |
---|
| 1275 | + timelinePanel = new JPanel(new BorderLayout()); |
---|
| 1276 | + timelineMenubar = new timeflow.app.TimeflowApp().TimeFlowWindow(timelinePanel); |
---|
1183 | 1277 | |
---|
1184 | 1278 | cameraPanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, cameraView, timelinePanel); |
---|
1185 | 1279 | cameraPanel.setContinuousLayout(true); |
---|
.. | .. |
---|
1188 | 1282 | // cameraPanel.setDividerSize(9); |
---|
1189 | 1283 | cameraPanel.setResizeWeight(1.0); |
---|
1190 | 1284 | |
---|
| 1285 | + } |
---|
| 1286 | + |
---|
1191 | 1287 | centralPanel.add(cameraView); |
---|
| 1288 | + centralPanel.setFocusable(true); |
---|
1192 | 1289 | //frame.setJMenuBar(timelineMenubar); |
---|
1193 | 1290 | //centralPanel.add(timelinePanel); |
---|
1194 | 1291 | |
---|
.. | .. |
---|
1255 | 1352 | // north.setName("Edit"); |
---|
1256 | 1353 | // north.add(ctrlPanel, BorderLayout.NORTH); |
---|
1257 | 1354 | // objectPanel.add(north); |
---|
1258 | | - objectPanel.add(ctrlPanel); |
---|
| 1355 | + objectPanel.add(editPanel); |
---|
1259 | 1356 | objectPanel.add(infoPanel); |
---|
1260 | 1357 | |
---|
1261 | 1358 | /* |
---|
.. | .. |
---|
1386 | 1483 | frame.setSize(1280, 860); |
---|
1387 | 1484 | frame.setVisible(true); |
---|
1388 | 1485 | |
---|
| 1486 | + cameraView.requestFocusInWindow(); |
---|
| 1487 | + |
---|
1389 | 1488 | gridPanel.setDividerLocation(1.0); |
---|
1390 | 1489 | |
---|
1391 | 1490 | frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); |
---|
.. | .. |
---|
2072 | 2171 | |
---|
2073 | 2172 | void LoadObjFile(String fullname) |
---|
2074 | 2173 | { |
---|
2075 | | - /* |
---|
| 2174 | + System.out.println("Loading " + fullname); |
---|
| 2175 | + /**/ |
---|
2076 | 2176 | //lastFilename = fullname; |
---|
2077 | 2177 | if(loadObjThread == null) |
---|
2078 | 2178 | { |
---|
2079 | | - loadObjThread = new LoadOBJThread(); |
---|
2080 | | - loadObjThread.start(); |
---|
| 2179 | + loadObjThread = new LoadOBJThread(); |
---|
| 2180 | + loadObjThread.start(); |
---|
2081 | 2181 | } |
---|
2082 | 2182 | |
---|
2083 | 2183 | loadObjThread.add(fullname); |
---|
2084 | | - */ |
---|
| 2184 | + /**/ |
---|
2085 | 2185 | |
---|
2086 | | - System.out.println("Loading " + fullname); |
---|
2087 | | - makeSomething(new FileObject(fullname, true), true); |
---|
| 2186 | + //makeSomething(new FileObject(fullname, true), true); |
---|
2088 | 2187 | } |
---|
2089 | 2188 | |
---|
2090 | 2189 | void LoadGFDFile(String fullname) |
---|
.. | .. |
---|
3214 | 3313 | objEditor.refreshContents(); |
---|
3215 | 3314 | } |
---|
3216 | 3315 | |
---|
3217 | | - static public byte[] Compress(Object o) |
---|
| 3316 | + static public byte[] Compress(Object3D o) |
---|
3218 | 3317 | { |
---|
3219 | 3318 | try |
---|
3220 | 3319 | { |
---|
.. | .. |
---|
3222 | 3321 | java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(baos); |
---|
3223 | 3322 | ObjectOutputStream out = new ObjectOutputStream(zstream); |
---|
3224 | 3323 | |
---|
| 3324 | + Object3D parent = o.parent; |
---|
| 3325 | + o.parent = null; |
---|
| 3326 | + |
---|
3225 | 3327 | out.writeObject(o); |
---|
3226 | 3328 | |
---|
| 3329 | + o.parent = parent; |
---|
| 3330 | + |
---|
3227 | 3331 | out.flush(); |
---|
3228 | 3332 | |
---|
3229 | 3333 | zstream.close(); |
---|
.. | .. |
---|
3306 | 3410 | { |
---|
3307 | 3411 | cRadio tab = GetCurrentTab(); |
---|
3308 | 3412 | |
---|
| 3413 | + boolean temp = CameraPane.SWITCH; |
---|
| 3414 | + CameraPane.SWITCH = false; |
---|
| 3415 | + |
---|
3309 | 3416 | copy.ExtractBigData(hashtable); |
---|
3310 | 3417 | |
---|
3311 | 3418 | //EditorFrame.m_MainFrame.requestFocusInWindow(); |
---|
3312 | 3419 | tab.graphs[tab.undoindex++] = Compress(copy); |
---|
3313 | 3420 | |
---|
3314 | 3421 | copy.RestoreBigData(hashtable); |
---|
| 3422 | + |
---|
| 3423 | + CameraPane.SWITCH = temp; |
---|
3315 | 3424 | |
---|
3316 | 3425 | //assert(hashtable.isEmpty()); |
---|
3317 | 3426 | |
---|
.. | .. |
---|
3342 | 3451 | |
---|
3343 | 3452 | void CopyChanged(Object3D obj) |
---|
3344 | 3453 | { |
---|
| 3454 | + boolean temp = CameraPane.SWITCH; |
---|
| 3455 | + CameraPane.SWITCH = false; |
---|
| 3456 | + |
---|
3345 | 3457 | copy.ExtractBigData(hashtable); |
---|
3346 | 3458 | |
---|
3347 | 3459 | copy.clear(); |
---|
.. | .. |
---|
3352 | 3464 | } |
---|
3353 | 3465 | |
---|
3354 | 3466 | copy.RestoreBigData(hashtable); |
---|
| 3467 | + |
---|
| 3468 | + CameraPane.SWITCH = temp; |
---|
3355 | 3469 | |
---|
3356 | 3470 | //assert(hashtable.isEmpty()); |
---|
3357 | 3471 | |
---|
.. | .. |
---|
4280 | 4394 | |
---|
4281 | 4395 | try |
---|
4282 | 4396 | { |
---|
| 4397 | + // Try compressed version first. |
---|
4283 | 4398 | java.io.FileInputStream istream = new java.io.FileInputStream(fullname); |
---|
4284 | 4399 | java.util.zip.GZIPInputStream zstream = new java.util.zip.GZIPInputStream(istream); |
---|
4285 | 4400 | java.io.ObjectInputStream p = new java.io.ObjectInputStream(zstream); |
---|
.. | .. |
---|
4349 | 4464 | |
---|
4350 | 4465 | void LoadIt(Object obj) |
---|
4351 | 4466 | { |
---|
| 4467 | + if (obj == null) |
---|
| 4468 | + { |
---|
| 4469 | + // Invalid file |
---|
| 4470 | + return; |
---|
| 4471 | + } |
---|
| 4472 | + |
---|
4352 | 4473 | System.out.println("Loaded " + obj); |
---|
4353 | 4474 | //new Exception().printStackTrace(); |
---|
4354 | 4475 | Object3D readobj = (Object3D) obj; |
---|