.. | .. |
---|
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); |
---|
| 173 | + objEditor.ctrlPanel.remove(setupPanel2); |
---|
171 | 174 | objEditor.ctrlPanel.remove(commandsPanel); |
---|
172 | 175 | objEditor.ctrlPanel.remove(pushPanel); |
---|
173 | 176 | //objEditor.ctrlPanel.remove(fillPanel); |
---|
.. | .. |
---|
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"); |
---|
.. | .. |
---|
419 | 423 | e.printStackTrace(); |
---|
420 | 424 | } |
---|
421 | 425 | |
---|
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(); |
---|
| 426 | +// String selection = infoarea.getText(); |
---|
| 427 | +// java.awt.datatransfer.StringSelection data = new java.awt.datatransfer.StringSelection(selection); |
---|
| 428 | +// java.awt.datatransfer.Clipboard clipboard = |
---|
| 429 | +// Toolkit.getDefaultToolkit().getSystemClipboard(); |
---|
426 | 430 | //clipboard.setContents(data, data); |
---|
427 | 431 | } |
---|
428 | 432 | |
---|
.. | .. |
---|
582 | 586 | } |
---|
583 | 587 | } |
---|
584 | 588 | |
---|
| 589 | +static GraphicsDevice device = GraphicsEnvironment |
---|
| 590 | + .getLocalGraphicsEnvironment().getScreenDevices()[0]; |
---|
| 591 | + |
---|
| 592 | + Rectangle keeprect; |
---|
| 593 | + cRadio radio; |
---|
| 594 | + |
---|
| 595 | +cButton keepButton; |
---|
| 596 | + cButton twoButton; // Full 3D |
---|
| 597 | + cButton sixButton; |
---|
| 598 | + cButton threeButton; |
---|
| 599 | + cButton sevenButton; |
---|
| 600 | + cButton fourButton; // full panel |
---|
| 601 | + cButton oneButton; // full XYZ |
---|
| 602 | + //cButton currentLayout; |
---|
| 603 | + |
---|
| 604 | + boolean maximized; |
---|
| 605 | + |
---|
| 606 | + void Minimize() |
---|
| 607 | + { |
---|
| 608 | + frame.setState(Frame.ICONIFIED); |
---|
| 609 | + } |
---|
| 610 | + |
---|
| 611 | + void Maximize() |
---|
| 612 | + { |
---|
| 613 | + if (maximized) |
---|
| 614 | + { |
---|
| 615 | + frame.setBounds(keeprect.x, keeprect.y, keeprect.width, keeprect.height); |
---|
| 616 | + } |
---|
| 617 | + else |
---|
| 618 | + { |
---|
| 619 | + keeprect = frame.getBounds(); |
---|
| 620 | + Rectangle rect = GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds(); |
---|
| 621 | + Dimension rect2 = frame.getToolkit().getScreenSize(); |
---|
| 622 | + frame.setBounds(0, rect2.height - rect.height, rect.width, rect.height); |
---|
| 623 | +// frame.setState(Frame.MAXIMIZED_BOTH); |
---|
| 624 | + } |
---|
| 625 | + |
---|
| 626 | + maximized ^= true; |
---|
| 627 | + } |
---|
| 628 | + |
---|
585 | 629 | void ToggleFullScreen() |
---|
586 | 630 | { |
---|
587 | 631 | if (CameraPane.FULLSCREEN) |
---|
588 | 632 | { |
---|
589 | | - frame.getContentPane().remove(/*"Center",*/bigThree); |
---|
590 | | - framePanel.add(bigThree); |
---|
591 | | - frame.getContentPane().add(/*"Center",*/framePanel); |
---|
| 633 | + device.setFullScreenWindow(null); |
---|
| 634 | + //frame.setVisible(false); |
---|
| 635 | +// frame.removeNotify(); |
---|
| 636 | +// frame.setUndecorated(false); |
---|
| 637 | +// frame.addNotify(); |
---|
| 638 | + //frame.setBounds(keeprect.x, keeprect.y, keeprect.width, keeprect.height); |
---|
| 639 | + |
---|
| 640 | +// X frame.getContentPane().remove(/*"Center",*/bigThree); |
---|
| 641 | +// X framePanel.add(bigThree); |
---|
| 642 | +// X frame.getContentPane().add(/*"Center",*/framePanel); |
---|
| 643 | + framePanel.setDividerLocation(1); |
---|
| 644 | + |
---|
| 645 | + //frame.setVisible(true); |
---|
| 646 | + radio.layout = keepButton; |
---|
| 647 | + //theFrame = null; |
---|
| 648 | + keepButton = null; |
---|
| 649 | + radio.layout.doClick(); |
---|
| 650 | + |
---|
592 | 651 | } else |
---|
593 | 652 | { |
---|
594 | | - frame.getContentPane().remove(/*"Center",*/framePanel); |
---|
595 | | - framePanel.remove(bigThree); |
---|
596 | | - frame.getContentPane().add(/*"Center",*/bigThree); |
---|
| 653 | + keepButton = radio.layout; |
---|
| 654 | + //keeprect = frame.getBounds(); |
---|
| 655 | +// frame.setBounds(0, 0, frame.getToolkit().getScreenSize().width, |
---|
| 656 | +// frame.getToolkit().getScreenSize().height); |
---|
| 657 | + //frame.setVisible(false); |
---|
| 658 | + device.setFullScreenWindow(frame); |
---|
| 659 | +// frame.removeNotify(); |
---|
| 660 | +// frame.setUndecorated(true); |
---|
| 661 | +// frame.addNotify(); |
---|
| 662 | +// X frame.getContentPane().remove(/*"Center",*/framePanel); |
---|
| 663 | +// X framePanel.remove(bigThree); |
---|
| 664 | +// X frame.getContentPane().add(/*"Center",*/bigThree); |
---|
| 665 | + framePanel.setDividerLocation(0); |
---|
| 666 | + |
---|
| 667 | + radio.layout = twoButton; |
---|
| 668 | + radio.layout.doClick(); |
---|
| 669 | + //frame.setVisible(true); |
---|
597 | 670 | } |
---|
| 671 | + |
---|
598 | 672 | cameraView.ToggleFullScreen(); |
---|
599 | 673 | } |
---|
600 | 674 | |
---|
.. | .. |
---|
747 | 821 | |
---|
748 | 822 | cGridBag namePanel; |
---|
749 | 823 | cGridBag setupPanel; |
---|
| 824 | + cGridBag setupPanel2; |
---|
750 | 825 | cGridBag commandsPanel; |
---|
751 | 826 | cGridBag pushPanel; |
---|
752 | 827 | cGridBag fillPanel; |
---|
.. | .. |
---|
939 | 1014 | markCB = AddCheckBox(setupPanel, "Mark", copy.marked); |
---|
940 | 1015 | markCB.setToolTipText("Set the animation target transform"); |
---|
941 | 1016 | |
---|
942 | | - rewindCB = AddCheckBox(setupPanel, "Rewind", copy.rewind); |
---|
| 1017 | + setupPanel2 = new cGridBag().setVertical(false); |
---|
| 1018 | + |
---|
| 1019 | + rewindCB = AddCheckBox(setupPanel2, "Rewind", copy.rewind); |
---|
943 | 1020 | rewindCB.setToolTipText("Rewind animation"); |
---|
944 | 1021 | |
---|
945 | | - randomCB = AddCheckBox(setupPanel, "Random", copy.random); |
---|
946 | | - randomCB.setToolTipText("Option for switch node"); |
---|
| 1022 | + randomCB = AddCheckBox(setupPanel2, "Rand", copy.random); |
---|
| 1023 | + randomCB.setToolTipText("Randomly Rewind or Go back and forth"); |
---|
947 | 1024 | |
---|
948 | 1025 | if (Globals.ADVANCED) |
---|
949 | 1026 | { |
---|
950 | | - link2masterCB = AddCheckBox(setupPanel, "Support", copy.link2master); |
---|
| 1027 | + link2masterCB = AddCheckBox(setupPanel2, "Supp", copy.link2master); |
---|
951 | 1028 | link2masterCB.setToolTipText("Attach to support"); |
---|
952 | | - speedupCB = AddCheckBox(setupPanel, "Speed", copy.speedup); |
---|
| 1029 | + speedupCB = AddCheckBox(setupPanel2, "Speed", copy.speedup); |
---|
953 | 1030 | speedupCB.setToolTipText("Option motion capture"); |
---|
954 | 1031 | } |
---|
955 | 1032 | |
---|
956 | 1033 | oe.ctrlPanel.add(setupPanel); |
---|
| 1034 | + oe.ctrlPanel.Return(); |
---|
| 1035 | + oe.ctrlPanel.add(setupPanel2); |
---|
957 | 1036 | oe.ctrlPanel.Return(); |
---|
958 | 1037 | |
---|
959 | 1038 | commandsPanel = new cGridBag().setVertical(false); |
---|
.. | .. |
---|
1178 | 1257 | //worldPanel.setName("World"); |
---|
1179 | 1258 | centralPanel = new cGridBag(); |
---|
1180 | 1259 | centralPanel.preferredWidth = 20; |
---|
1181 | | - timelinePanel = new JPanel(new BorderLayout()); |
---|
1182 | | - timelineMenubar = new timeflow.app.TimeflowApp().TimeFlowWindow(timelinePanel); |
---|
| 1260 | + |
---|
| 1261 | + if (Globals.ADVANCED) |
---|
| 1262 | + { |
---|
| 1263 | + timelinePanel = new JPanel(new BorderLayout()); |
---|
| 1264 | + timelineMenubar = new timeflow.app.TimeflowApp().TimeFlowWindow(timelinePanel); |
---|
1183 | 1265 | |
---|
1184 | 1266 | cameraPanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, cameraView, timelinePanel); |
---|
1185 | 1267 | cameraPanel.setContinuousLayout(true); |
---|
.. | .. |
---|
1188 | 1270 | // cameraPanel.setDividerSize(9); |
---|
1189 | 1271 | cameraPanel.setResizeWeight(1.0); |
---|
1190 | 1272 | |
---|
| 1273 | + } |
---|
| 1274 | + |
---|
1191 | 1275 | centralPanel.add(cameraView); |
---|
| 1276 | + centralPanel.setFocusable(true); |
---|
1192 | 1277 | //frame.setJMenuBar(timelineMenubar); |
---|
1193 | 1278 | //centralPanel.add(timelinePanel); |
---|
1194 | 1279 | |
---|
.. | .. |
---|
1386 | 1471 | frame.setSize(1280, 860); |
---|
1387 | 1472 | frame.setVisible(true); |
---|
1388 | 1473 | |
---|
| 1474 | + cameraView.requestFocusInWindow(); |
---|
| 1475 | + |
---|
1389 | 1476 | gridPanel.setDividerLocation(1.0); |
---|
1390 | 1477 | |
---|
1391 | 1478 | frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); |
---|
.. | .. |
---|
2072 | 2159 | |
---|
2073 | 2160 | void LoadObjFile(String fullname) |
---|
2074 | 2161 | { |
---|
2075 | | - /* |
---|
| 2162 | + System.out.println("Loading " + fullname); |
---|
| 2163 | + /**/ |
---|
2076 | 2164 | //lastFilename = fullname; |
---|
2077 | 2165 | if(loadObjThread == null) |
---|
2078 | 2166 | { |
---|
2079 | | - loadObjThread = new LoadOBJThread(); |
---|
2080 | | - loadObjThread.start(); |
---|
| 2167 | + loadObjThread = new LoadOBJThread(); |
---|
| 2168 | + loadObjThread.start(); |
---|
2081 | 2169 | } |
---|
2082 | 2170 | |
---|
2083 | 2171 | loadObjThread.add(fullname); |
---|
2084 | | - */ |
---|
| 2172 | + /**/ |
---|
2085 | 2173 | |
---|
2086 | | - System.out.println("Loading " + fullname); |
---|
2087 | | - makeSomething(new FileObject(fullname, true), true); |
---|
| 2174 | + //makeSomething(new FileObject(fullname, true), true); |
---|
2088 | 2175 | } |
---|
2089 | 2176 | |
---|
2090 | 2177 | void LoadGFDFile(String fullname) |
---|
.. | .. |
---|
2927 | 3014 | return; |
---|
2928 | 3015 | } else if (event.getSource() == toggleSwitchItem) |
---|
2929 | 3016 | { |
---|
2930 | | - cameraView.ToggleRandom(); |
---|
| 3017 | + cameraView.ToggleSwitch(); |
---|
2931 | 3018 | cameraView.repaint(); |
---|
2932 | 3019 | return; |
---|
2933 | 3020 | } else if (event.getSource() == toggleHandleItem) |
---|
.. | .. |
---|
3214 | 3301 | objEditor.refreshContents(); |
---|
3215 | 3302 | } |
---|
3216 | 3303 | |
---|
3217 | | - static public byte[] Compress(Object o) |
---|
| 3304 | + static public byte[] Compress(Object3D o) |
---|
3218 | 3305 | { |
---|
3219 | 3306 | try |
---|
3220 | 3307 | { |
---|
.. | .. |
---|
3222 | 3309 | java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(baos); |
---|
3223 | 3310 | ObjectOutputStream out = new ObjectOutputStream(zstream); |
---|
3224 | 3311 | |
---|
| 3312 | + Object3D parent = o.parent; |
---|
| 3313 | + o.parent = null; |
---|
| 3314 | + |
---|
3225 | 3315 | out.writeObject(o); |
---|
3226 | 3316 | |
---|
| 3317 | + o.parent = parent; |
---|
| 3318 | + |
---|
3227 | 3319 | out.flush(); |
---|
3228 | 3320 | |
---|
3229 | 3321 | zstream.close(); |
---|
.. | .. |
---|
3239 | 3331 | |
---|
3240 | 3332 | static public Object Uncompress(byte[] bytes) |
---|
3241 | 3333 | { |
---|
| 3334 | + System.out.println("#bytes = " + bytes.length); |
---|
3242 | 3335 | try |
---|
3243 | 3336 | { |
---|
3244 | 3337 | ByteArrayInputStream bais = new ByteArrayInputStream(bytes); |
---|
.. | .. |
---|
3305 | 3398 | { |
---|
3306 | 3399 | cRadio tab = GetCurrentTab(); |
---|
3307 | 3400 | |
---|
| 3401 | + boolean temp = CameraPane.SWITCH; |
---|
| 3402 | + CameraPane.SWITCH = false; |
---|
| 3403 | + |
---|
3308 | 3404 | copy.ExtractBigData(hashtable); |
---|
3309 | 3405 | |
---|
3310 | 3406 | //EditorFrame.m_MainFrame.requestFocusInWindow(); |
---|
3311 | | - tab.graphs[tab.undoindex++] = (Object3D)clone(copy); |
---|
| 3407 | + tab.graphs[tab.undoindex++] = Compress(copy); |
---|
3312 | 3408 | |
---|
3313 | 3409 | copy.RestoreBigData(hashtable); |
---|
| 3410 | + |
---|
| 3411 | + CameraPane.SWITCH = temp; |
---|
3314 | 3412 | |
---|
3315 | 3413 | //assert(hashtable.isEmpty()); |
---|
3316 | 3414 | |
---|
.. | .. |
---|
3341 | 3439 | |
---|
3342 | 3440 | void CopyChanged(Object3D obj) |
---|
3343 | 3441 | { |
---|
| 3442 | + boolean temp = CameraPane.SWITCH; |
---|
| 3443 | + CameraPane.SWITCH = false; |
---|
| 3444 | + |
---|
3344 | 3445 | copy.ExtractBigData(hashtable); |
---|
3345 | 3446 | |
---|
3346 | 3447 | copy.clear(); |
---|
.. | .. |
---|
3351 | 3452 | } |
---|
3352 | 3453 | |
---|
3353 | 3454 | copy.RestoreBigData(hashtable); |
---|
| 3455 | + |
---|
| 3456 | + CameraPane.SWITCH = temp; |
---|
3354 | 3457 | |
---|
3355 | 3458 | //assert(hashtable.isEmpty()); |
---|
3356 | 3459 | |
---|
.. | .. |
---|
3393 | 3496 | |
---|
3394 | 3497 | tab.undoindex -= 1; |
---|
3395 | 3498 | |
---|
3396 | | - CopyChanged(tab.graphs[tab.undoindex]); |
---|
| 3499 | + CopyChanged((Object3D)Uncompress(tab.graphs[tab.undoindex])); |
---|
3397 | 3500 | } |
---|
3398 | 3501 | |
---|
3399 | 3502 | public void Redo() |
---|
.. | .. |
---|
3408 | 3511 | |
---|
3409 | 3512 | tab.undoindex += 1; |
---|
3410 | 3513 | |
---|
3411 | | - CopyChanged(tab.graphs[tab.undoindex]); |
---|
| 3514 | + CopyChanged((Object3D)Uncompress(tab.graphs[tab.undoindex])); |
---|
3412 | 3515 | } |
---|
3413 | 3516 | |
---|
3414 | 3517 | void ImportGFD() |
---|
.. | .. |
---|
4279 | 4382 | |
---|
4280 | 4383 | try |
---|
4281 | 4384 | { |
---|
| 4385 | + // Try compressed version first. |
---|
4282 | 4386 | java.io.FileInputStream istream = new java.io.FileInputStream(fullname); |
---|
4283 | 4387 | java.util.zip.GZIPInputStream zstream = new java.util.zip.GZIPInputStream(istream); |
---|
4284 | 4388 | java.io.ObjectInputStream p = new java.io.ObjectInputStream(zstream); |
---|
.. | .. |
---|
4348 | 4452 | |
---|
4349 | 4453 | void LoadIt(Object obj) |
---|
4350 | 4454 | { |
---|
| 4455 | + if (obj == null) |
---|
| 4456 | + { |
---|
| 4457 | + // Invalid file |
---|
| 4458 | + return; |
---|
| 4459 | + } |
---|
| 4460 | + |
---|
4351 | 4461 | System.out.println("Loaded " + obj); |
---|
4352 | 4462 | //new Exception().printStackTrace(); |
---|
4353 | 4463 | Object3D readobj = (Object3D) obj; |
---|