.. | .. |
---|
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 | |
---|
.. | .. |
---|
276 | 327 | void SetupMenu() |
---|
277 | 328 | { |
---|
278 | 329 | frame.setMenuBar(menuBar = new MenuBar()); |
---|
279 | | - menuBar.add(windowMenu = new Menu("File")); |
---|
280 | | - windowMenu.add(loadItem = new MenuItem("Load...")); |
---|
281 | | - windowMenu.add("-"); |
---|
282 | | - windowMenu.add(saveItem = new MenuItem("Save")); |
---|
283 | | - windowMenu.add(saveAsItem = new MenuItem("Save As...")); |
---|
| 330 | + menuBar.add(fileMenu = new Menu("File")); |
---|
| 331 | + fileMenu.add(newItem = new MenuItem("New")); |
---|
| 332 | + fileMenu.add(loadItem = new MenuItem("Open...")); |
---|
| 333 | + |
---|
| 334 | + //oe.menuBar.add(menu = new Menu("Include")); |
---|
| 335 | + Menu menu = new Menu("Import"); |
---|
| 336 | + importOBJItem = menu.add(new MenuItem("OBJ file...")); |
---|
| 337 | + importOBJItem.addActionListener(this); |
---|
| 338 | + import3DSItem = menu.add(new MenuItem("3DS file...")); |
---|
| 339 | + import3DSItem.addActionListener(this); |
---|
| 340 | + importVRMLX3DItem = menu.add(new MenuItem("VRML/X3D file...")); |
---|
| 341 | + importVRMLX3DItem.addActionListener(this); |
---|
| 342 | + menu.add("-"); |
---|
| 343 | + importGFDItem = menu.add(new MenuItem("Grafreed file...")); |
---|
| 344 | + importGFDItem.addActionListener(this); |
---|
| 345 | + fileMenu.add(menu); |
---|
| 346 | + fileMenu.add("-"); |
---|
| 347 | + |
---|
| 348 | + fileMenu.add(saveItem = new MenuItem("Save")); |
---|
| 349 | + fileMenu.add(saveAsItem = new MenuItem("Save As...")); |
---|
284 | 350 | //windowMenu.add(povItem = new MenuItem("Emit POV-Ray...")); |
---|
285 | | - windowMenu.add("-"); |
---|
286 | | - windowMenu.add(exportAsItem = new MenuItem("Export Selection...")); |
---|
287 | | - windowMenu.add(reexportItem = new MenuItem("Re-export")); |
---|
288 | | - windowMenu.add("-"); |
---|
| 351 | + fileMenu.add("-"); |
---|
| 352 | + fileMenu.add(exportAsItem = new MenuItem("Export Selection...")); |
---|
| 353 | + fileMenu.add(reexportItem = new MenuItem("Re-export")); |
---|
| 354 | + fileMenu.add("-"); |
---|
289 | 355 | if (client.parent != null) |
---|
290 | 356 | { |
---|
291 | | - windowMenu.add(closeItem = new MenuItem("Close")); |
---|
| 357 | + fileMenu.add(closeItem = new MenuItem("Close")); |
---|
292 | 358 | } else |
---|
293 | 359 | { |
---|
294 | | - windowMenu.add(closeItem = new MenuItem("Exit")); |
---|
| 360 | + fileMenu.add(closeItem = new MenuItem("Exit")); |
---|
295 | 361 | } |
---|
296 | 362 | |
---|
| 363 | + newItem.addActionListener(this); |
---|
297 | 364 | loadItem.addActionListener(this); |
---|
298 | 365 | saveItem.addActionListener(this); |
---|
299 | 366 | saveAsItem.addActionListener(this); |
---|
.. | .. |
---|
302 | 369 | //povItem.addActionListener(this); |
---|
303 | 370 | closeItem.addActionListener(this); |
---|
304 | 371 | |
---|
305 | | - menuBar.add(cameraMenu = new Menu("View")); |
---|
306 | | - //cameraMenu.add(zBufferItem = new CheckboxMenuItem("Z Buffer")); |
---|
307 | | - //zBufferItem.addActionListener(this); |
---|
308 | | - //cameraMenu.add(normalLensItem = new MenuItem("Normal Lens")); |
---|
309 | | - //normalLensItem.addActionListener(this); |
---|
310 | | - cameraMenu.add(revertCameraItem = new MenuItem("Revert Camera")); |
---|
311 | | - revertCameraItem.addActionListener(this); |
---|
312 | | - |
---|
313 | | - cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen")); |
---|
314 | | - toggleFullScreenItem.addItemListener(this); |
---|
315 | | - toggleFullScreenItem.setState(CameraPane.FULLSCREEN); |
---|
316 | | - cameraMenu.add("-"); |
---|
317 | | - |
---|
318 | | - cameraMenu.add(toggleTextureItem = new CheckboxMenuItem("Texture")); |
---|
319 | | - toggleTextureItem.addItemListener(this); |
---|
320 | | - toggleTextureItem.setState(CameraPane.textureon); |
---|
321 | | - |
---|
322 | | - cameraMenu.add(toggleSwitchItem = new CheckboxMenuItem("Switch")); |
---|
323 | | - toggleSwitchItem.addItemListener(this); |
---|
324 | | - toggleSwitchItem.setState(CameraPane.SWITCH); |
---|
325 | | - |
---|
326 | | - cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Handles")); |
---|
327 | | - toggleHandleItem.addItemListener(this); |
---|
328 | | - toggleHandleItem.setState(CameraPane.HANDLES); |
---|
329 | | - |
---|
330 | | - cameraMenu.add(togglePaintItem = new CheckboxMenuItem("Paint mode")); |
---|
331 | | - togglePaintItem.addItemListener(this); |
---|
332 | | - togglePaintItem.setState(CameraPane.PAINTMODE); |
---|
333 | | - |
---|
334 | | - if (Globals.ADVANCED) |
---|
335 | | - { |
---|
336 | | - cameraMenu.add("-"); |
---|
337 | | - cameraMenu.add(toggleLiveItem = new CheckboxMenuItem("Live")); |
---|
338 | | - toggleLiveItem.addItemListener(this); |
---|
339 | | - toggleLiveItem.setState(Globals.isLIVE()); |
---|
340 | | - |
---|
341 | | - cameraMenu.add(stepItem = new MenuItem("Step")); |
---|
342 | | - stepItem.addActionListener(this); |
---|
343 | | - // cameraMenu.add(toggleDLItem = new CheckboxMenuItem("Display List")); |
---|
344 | | - // toggleDLItem.addItemListener(this); |
---|
345 | | - // toggleDLItem.setState(false); |
---|
346 | | - |
---|
347 | | - cameraMenu.add(toggleRenderItem = new CheckboxMenuItem("Render")); |
---|
348 | | - toggleRenderItem.addItemListener(this); |
---|
349 | | - toggleRenderItem.setState(!CameraPane.frozen); |
---|
350 | | - |
---|
351 | | - cameraMenu.add(toggleDebugItem = new CheckboxMenuItem("Debug")); |
---|
352 | | - toggleDebugItem.addItemListener(this); |
---|
353 | | - toggleDebugItem.setState(CameraPane.DEBUG); |
---|
354 | | - |
---|
355 | | - cameraMenu.add(toggleFrustumItem = new CheckboxMenuItem("Frustum")); |
---|
356 | | - toggleFrustumItem.addItemListener(this); |
---|
357 | | - toggleFrustumItem.setState(CameraPane.FRUSTUM); |
---|
358 | | - |
---|
359 | | - cameraMenu.add(toggleFootContactItem = new CheckboxMenuItem("Foot contact")); |
---|
360 | | - toggleFootContactItem.addItemListener(this); |
---|
361 | | - toggleFootContactItem.setState(CameraPane.FOOTCONTACT); |
---|
362 | | - |
---|
363 | | - cameraMenu.add(toggleTimelineItem = new CheckboxMenuItem("Timeline")); |
---|
364 | | - toggleTimelineItem.addItemListener(this); |
---|
365 | | - } |
---|
366 | | - |
---|
367 | | -// cameraMenu.add(toggleRootItem = new CheckboxMenuItem("Alternate Root")); |
---|
368 | | -// toggleRootItem.addItemListener(this); |
---|
369 | | -// toggleRootItem.setState(false); |
---|
370 | | -// cameraMenu.add(animationItem = new CheckboxMenuItem("Animation")); |
---|
371 | | -// animationItem.addItemListener(this); |
---|
372 | | -// animationItem.setState(CameraPane.ANIMATION); |
---|
373 | | - cameraMenu.add("-"); |
---|
374 | | - cameraMenu.add(editCameraItem = new MenuItem("Freeze Camera")); |
---|
375 | | - editCameraItem.addActionListener(this); |
---|
376 | | - |
---|
377 | 372 | objectPanel = new JTabbedPane(); |
---|
378 | 373 | toolbarPanel = new JPanel(); |
---|
379 | 374 | toolbarPanel.setName("Toolbar"); |
---|
380 | 375 | treePanel = new cGridBag(); |
---|
381 | 376 | treePanel.setName("Tree"); |
---|
| 377 | + |
---|
| 378 | + editPanel = new cGridBag().setVertical(true); |
---|
| 379 | + editPanel.setName("Edit"); |
---|
| 380 | + |
---|
382 | 381 | ctrlPanel = new cGridBag().setVertical(false); // new GridBagLayout()); |
---|
383 | | - ctrlPanel.setName("Edit"); |
---|
| 382 | + |
---|
| 383 | + editCommandsPanel = new cGridBag(); |
---|
| 384 | + editPanel.add(editCommandsPanel); |
---|
| 385 | + editPanel.add(ctrlPanel); |
---|
| 386 | + |
---|
384 | 387 | materialPanel = new cGridBag().setVertical(true); |
---|
| 388 | + |
---|
385 | 389 | materialPanel.setName("Material"); |
---|
386 | 390 | /*JTextPane*/ |
---|
387 | 391 | infoarea = createTextPane(); |
---|
.. | .. |
---|
475 | 479 | e.printStackTrace(); |
---|
476 | 480 | } |
---|
477 | 481 | |
---|
478 | | - String selection = infoarea.getText(); |
---|
479 | | - java.awt.datatransfer.StringSelection data = new java.awt.datatransfer.StringSelection(selection); |
---|
480 | | - java.awt.datatransfer.Clipboard clipboard = |
---|
481 | | - 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(); |
---|
482 | 486 | //clipboard.setContents(data, data); |
---|
483 | 487 | } |
---|
484 | 488 | |
---|
.. | .. |
---|
501 | 505 | //SendInfo("Name:", "bold"); |
---|
502 | 506 | if (sel.GetTextures() != null || debug) |
---|
503 | 507 | { |
---|
504 | | - si.SendInfo(sel.toString(), "bold"); |
---|
| 508 | + si.SendInfo(sel.toString() + (Globals.ADVANCED?"":" " + System.identityHashCode(sel)), "bold"); |
---|
505 | 509 | //SendInfo("#children virtual = " + sel.size() + "; real = " + sel.Size() + newline, "regular"); |
---|
506 | 510 | if (sel.Size() > 0) |
---|
507 | 511 | { |
---|
508 | 512 | si.SendInfo("#children = " + sel.Size(), "regular"); |
---|
509 | 513 | } |
---|
510 | | - si.SendInfo((debug ? " Parent: " : " ") + sel.parent, "regular"); |
---|
| 514 | + si.SendInfo((debug ? " Parent: " : " ") + sel.parent + (Globals.ADVANCED?"":" " + System.identityHashCode(sel.parent)), "regular"); |
---|
511 | 515 | if (debug) |
---|
512 | 516 | { |
---|
513 | 517 | try |
---|
.. | .. |
---|
549 | 553 | } |
---|
550 | 554 | if (sel.support != null) |
---|
551 | 555 | { |
---|
552 | | - si.SendInfo(" support: " + sel.support, "regular"); |
---|
| 556 | + si.SendInfo(" support: " + sel.support + (Globals.ADVANCED?"":" " + System.identityHashCode(sel.support)), "regular"); |
---|
553 | 557 | } |
---|
554 | 558 | if (sel.scriptnode != null) |
---|
555 | 559 | { |
---|
.. | .. |
---|
638 | 642 | } |
---|
639 | 643 | } |
---|
640 | 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 | + |
---|
641 | 685 | void ToggleFullScreen() |
---|
642 | 686 | { |
---|
643 | 687 | if (CameraPane.FULLSCREEN) |
---|
644 | 688 | { |
---|
645 | | - frame.getContentPane().remove(/*"Center",*/bigThree); |
---|
646 | | - framePanel.add(bigThree); |
---|
647 | | - 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 | + |
---|
648 | 707 | } else |
---|
649 | 708 | { |
---|
650 | | - frame.getContentPane().remove(/*"Center",*/framePanel); |
---|
651 | | - framePanel.remove(bigThree); |
---|
652 | | - 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); |
---|
653 | 726 | } |
---|
| 727 | + |
---|
654 | 728 | cameraView.ToggleFullScreen(); |
---|
655 | 729 | } |
---|
656 | 730 | |
---|
.. | .. |
---|
784 | 858 | // NumberSlider vDivsField; |
---|
785 | 859 | // JCheckBox endcaps; |
---|
786 | 860 | JCheckBox liveCB; |
---|
| 861 | + JCheckBox selectCB; |
---|
787 | 862 | JCheckBox hideCB; |
---|
788 | 863 | JCheckBox link2masterCB; |
---|
789 | 864 | JCheckBox markCB; |
---|
.. | .. |
---|
800 | 875 | JButton fasterButton; |
---|
801 | 876 | JButton remarkButton; |
---|
802 | 877 | |
---|
| 878 | + cGridBag editPanel; |
---|
| 879 | + cGridBag editCommandsPanel; |
---|
| 880 | + |
---|
803 | 881 | cGridBag namePanel; |
---|
804 | 882 | cGridBag setupPanel; |
---|
805 | | - cGridBag commandsPanel; |
---|
| 883 | + cGridBag setupPanel2; |
---|
| 884 | + cGridBag objectCommandsPanel; |
---|
806 | 885 | cGridBag pushPanel; |
---|
807 | 886 | cGridBag fillPanel; |
---|
808 | 887 | |
---|
.. | .. |
---|
986 | 1065 | |
---|
987 | 1066 | liveCB = AddCheckBox(setupPanel, "Live", copy.live); |
---|
988 | 1067 | liveCB.setToolTipText("Animate object"); |
---|
| 1068 | + selectCB = AddCheckBox(setupPanel, "Select", !copy.dontselect); |
---|
| 1069 | + selectCB.setToolTipText("Make object selectable"); |
---|
| 1070 | +// Return(); |
---|
989 | 1071 | hideCB = AddCheckBox(setupPanel, "Hide", copy.hide); |
---|
990 | 1072 | hideCB.setToolTipText("Hide object"); |
---|
991 | | -// Return(); |
---|
992 | 1073 | markCB = AddCheckBox(setupPanel, "Mark", copy.marked); |
---|
993 | 1074 | markCB.setToolTipText("Set the animation target transform"); |
---|
994 | 1075 | |
---|
995 | | - rewindCB = AddCheckBox(setupPanel, "Rewind", copy.rewind); |
---|
| 1076 | + setupPanel2 = new cGridBag().setVertical(false); |
---|
| 1077 | + |
---|
| 1078 | + rewindCB = AddCheckBox(setupPanel2, "Rewind", copy.rewind); |
---|
996 | 1079 | rewindCB.setToolTipText("Rewind animation"); |
---|
997 | 1080 | |
---|
998 | | - randomCB = AddCheckBox(setupPanel, "Random", copy.random); |
---|
999 | | - randomCB.setToolTipText("Option for switch node"); |
---|
| 1081 | + randomCB = AddCheckBox(setupPanel2, "Rand", copy.random); |
---|
| 1082 | + randomCB.setToolTipText("Randomly Rewind or Go back and forth"); |
---|
1000 | 1083 | |
---|
1001 | 1084 | if (Globals.ADVANCED) |
---|
1002 | 1085 | { |
---|
1003 | | - link2masterCB = AddCheckBox(setupPanel, "Support", copy.link2master); |
---|
| 1086 | + link2masterCB = AddCheckBox(setupPanel2, "Supp", copy.link2master); |
---|
1004 | 1087 | link2masterCB.setToolTipText("Attach to support"); |
---|
1005 | | - speedupCB = AddCheckBox(setupPanel, "Speed", copy.speedup); |
---|
| 1088 | + speedupCB = AddCheckBox(setupPanel2, "Speed", copy.speedup); |
---|
1006 | 1089 | speedupCB.setToolTipText("Option motion capture"); |
---|
1007 | 1090 | } |
---|
1008 | 1091 | |
---|
1009 | 1092 | oe.ctrlPanel.add(setupPanel); |
---|
1010 | 1093 | oe.ctrlPanel.Return(); |
---|
| 1094 | + oe.ctrlPanel.add(setupPanel2); |
---|
| 1095 | + oe.ctrlPanel.Return(); |
---|
1011 | 1096 | |
---|
1012 | | - commandsPanel = new cGridBag().setVertical(false); |
---|
| 1097 | + objectCommandsPanel = new cGridBag().setVertical(false); |
---|
1013 | 1098 | |
---|
1014 | | - resetButton = AddButton(commandsPanel, "Reset"); |
---|
| 1099 | + resetButton = AddButton(objectCommandsPanel, "Reset"); |
---|
1015 | 1100 | resetButton.setToolTipText("Jump to frame zero"); |
---|
1016 | | - stepButton = AddButton(commandsPanel, "Step"); |
---|
| 1101 | + stepButton = AddButton(objectCommandsPanel, "Step"); |
---|
1017 | 1102 | stepButton.setToolTipText("Step one frame"); |
---|
1018 | 1103 | // resetAllButton = AddButton(oe, "Reset All"); |
---|
1019 | 1104 | // stepAllButton = AddButton(oe, "Step All"); |
---|
1020 | 1105 | // Return(); |
---|
1021 | | - slowerButton = AddButton(commandsPanel, "Slow"); |
---|
| 1106 | + slowerButton = AddButton(objectCommandsPanel, "Slow"); |
---|
1022 | 1107 | slowerButton.setToolTipText("Decrease animation speed"); |
---|
1023 | | - fasterButton = AddButton(commandsPanel, "Fast"); |
---|
| 1108 | + fasterButton = AddButton(objectCommandsPanel, "Fast"); |
---|
1024 | 1109 | fasterButton.setToolTipText("Increase animation speed"); |
---|
1025 | | - remarkButton = AddButton(commandsPanel, "Remark"); |
---|
| 1110 | + remarkButton = AddButton(objectCommandsPanel, "Remark"); |
---|
1026 | 1111 | remarkButton.setToolTipText("Set the current transform as the target"); |
---|
1027 | 1112 | |
---|
1028 | | - oe.ctrlPanel.add(commandsPanel); |
---|
| 1113 | + oe.ctrlPanel.add(objectCommandsPanel); |
---|
1029 | 1114 | oe.ctrlPanel.Return(); |
---|
1030 | 1115 | |
---|
1031 | | - pushPanel = AddSlider(oe.ctrlPanel, "Push", -10, 10, 0, 1); |
---|
| 1116 | + pushPanel = AddSlider(oe.ctrlPanel, "Push", -1, 1, copy.NORMALPUSH, 1.1); // To have the buttons |
---|
1032 | 1117 | normalpushField = (cNumberSlider)pushPanel.getComponent(1); |
---|
1033 | 1118 | //Return(); |
---|
1034 | 1119 | |
---|
.. | .. |
---|
1231 | 1316 | //worldPanel.setName("World"); |
---|
1232 | 1317 | centralPanel = new cGridBag(); |
---|
1233 | 1318 | centralPanel.preferredWidth = 20; |
---|
1234 | | - timelinePanel = new JPanel(new BorderLayout()); |
---|
1235 | | - 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); |
---|
1236 | 1324 | |
---|
1237 | 1325 | cameraPanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, cameraView, timelinePanel); |
---|
1238 | 1326 | cameraPanel.setContinuousLayout(true); |
---|
.. | .. |
---|
1241 | 1329 | // cameraPanel.setDividerSize(9); |
---|
1242 | 1330 | cameraPanel.setResizeWeight(1.0); |
---|
1243 | 1331 | |
---|
| 1332 | + } |
---|
| 1333 | + |
---|
1244 | 1334 | centralPanel.add(cameraView); |
---|
| 1335 | + centralPanel.setFocusable(true); |
---|
1245 | 1336 | //frame.setJMenuBar(timelineMenubar); |
---|
1246 | 1337 | //centralPanel.add(timelinePanel); |
---|
1247 | 1338 | |
---|
.. | .. |
---|
1308 | 1399 | // north.setName("Edit"); |
---|
1309 | 1400 | // north.add(ctrlPanel, BorderLayout.NORTH); |
---|
1310 | 1401 | // objectPanel.add(north); |
---|
1311 | | - objectPanel.add(ctrlPanel); |
---|
| 1402 | + objectPanel.add(editPanel); |
---|
1312 | 1403 | objectPanel.add(infoPanel); |
---|
1313 | 1404 | |
---|
1314 | 1405 | /* |
---|
.. | .. |
---|
1439 | 1530 | frame.setSize(1280, 860); |
---|
1440 | 1531 | frame.setVisible(true); |
---|
1441 | 1532 | |
---|
| 1533 | + cameraView.requestFocusInWindow(); |
---|
| 1534 | + |
---|
1442 | 1535 | gridPanel.setDividerLocation(1.0); |
---|
1443 | 1536 | |
---|
1444 | 1537 | frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); |
---|
.. | .. |
---|
1988 | 2081 | e2.printStackTrace(); |
---|
1989 | 2082 | } |
---|
1990 | 2083 | } |
---|
| 2084 | + |
---|
1991 | 2085 | LoadJMEThread loadThread; |
---|
1992 | 2086 | |
---|
1993 | 2087 | class LoadJMEThread extends Thread |
---|
.. | .. |
---|
2045 | 2139 | //LoadFile0(filename, converter); |
---|
2046 | 2140 | } |
---|
2047 | 2141 | } |
---|
| 2142 | + |
---|
2048 | 2143 | LoadOBJThread loadObjThread; |
---|
2049 | 2144 | |
---|
2050 | 2145 | class LoadOBJThread extends Thread |
---|
.. | .. |
---|
2123 | 2218 | |
---|
2124 | 2219 | void LoadObjFile(String fullname) |
---|
2125 | 2220 | { |
---|
2126 | | - /* |
---|
| 2221 | + System.out.println("Loading " + fullname); |
---|
| 2222 | + /**/ |
---|
2127 | 2223 | //lastFilename = fullname; |
---|
2128 | 2224 | if(loadObjThread == null) |
---|
2129 | 2225 | { |
---|
2130 | | - loadObjThread = new LoadOBJThread(); |
---|
2131 | | - loadObjThread.start(); |
---|
| 2226 | + loadObjThread = new LoadOBJThread(); |
---|
| 2227 | + loadObjThread.start(); |
---|
2132 | 2228 | } |
---|
2133 | 2229 | |
---|
2134 | 2230 | loadObjThread.add(fullname); |
---|
2135 | | - */ |
---|
| 2231 | + /**/ |
---|
2136 | 2232 | |
---|
2137 | | - System.out.println("Loading " + fullname); |
---|
2138 | | - makeSomething(new FileObject(fullname, true), true); |
---|
| 2233 | + //makeSomething(new FileObject(fullname, true), true); |
---|
2139 | 2234 | } |
---|
2140 | 2235 | |
---|
2141 | 2236 | void LoadGFDFile(String fullname) |
---|
.. | .. |
---|
2978 | 3073 | return; |
---|
2979 | 3074 | } else if (event.getSource() == toggleSwitchItem) |
---|
2980 | 3075 | { |
---|
2981 | | - cameraView.ToggleRandom(); |
---|
| 3076 | + cameraView.ToggleSwitch(); |
---|
2982 | 3077 | cameraView.repaint(); |
---|
2983 | 3078 | return; |
---|
2984 | 3079 | } else if (event.getSource() == toggleHandleItem) |
---|
.. | .. |
---|
3006 | 3101 | } else if (event.getSource() == liveCB) |
---|
3007 | 3102 | { |
---|
3008 | 3103 | copy.live ^= true; |
---|
| 3104 | + return; |
---|
| 3105 | + } else if (event.getSource() == selectCB) |
---|
| 3106 | + { |
---|
| 3107 | + copy.dontselect ^= true; |
---|
3009 | 3108 | return; |
---|
3010 | 3109 | } else if (event.getSource() == hideCB) |
---|
3011 | 3110 | { |
---|
.. | .. |
---|
3045 | 3144 | |
---|
3046 | 3145 | public void actionPerformed(ActionEvent event) |
---|
3047 | 3146 | { |
---|
| 3147 | + Object source = event.getSource(); |
---|
3048 | 3148 | // SCRIPT DIALOG |
---|
3049 | | - if (event.getSource() == okbutton) |
---|
| 3149 | + if (source == okbutton) |
---|
3050 | 3150 | { |
---|
3051 | 3151 | textpanel.setVisible(false); |
---|
3052 | 3152 | textpanel.remove(textarea); |
---|
.. | .. |
---|
3058 | 3158 | textarea = null; |
---|
3059 | 3159 | textpanel = null; |
---|
3060 | 3160 | } |
---|
3061 | | - if (event.getSource() == cancelbutton) |
---|
| 3161 | + if (source == cancelbutton) |
---|
3062 | 3162 | { |
---|
3063 | 3163 | textpanel.setVisible(false); |
---|
3064 | 3164 | textpanel.remove(textarea); |
---|
.. | .. |
---|
3070 | 3170 | //applySelf(); |
---|
3071 | 3171 | //client.refreshEditWindow(); |
---|
3072 | 3172 | //refreshContents(); |
---|
3073 | | - if (event.getSource() == nameField) |
---|
| 3173 | + if (source == nameField) |
---|
3074 | 3174 | { |
---|
3075 | 3175 | //System.out.println("ObjEditor " + event); |
---|
3076 | 3176 | applySelf0(true); |
---|
3077 | 3177 | //parent.applySelf(); |
---|
3078 | 3178 | objEditor.refreshContents(); |
---|
3079 | | - } else if (event.getSource() == resetButton) |
---|
| 3179 | + } else if (source == resetButton) |
---|
3080 | 3180 | { |
---|
3081 | 3181 | CameraPane.fullreset = true; |
---|
3082 | 3182 | copy.Reset(); // ResetMeshes(); |
---|
3083 | 3183 | copy.Touch(); |
---|
3084 | 3184 | objEditor.refreshContents(); |
---|
3085 | | - } else if (event.getSource() == stepItem) |
---|
| 3185 | + } else if (source == stepItem) |
---|
3086 | 3186 | { |
---|
3087 | 3187 | //cameraView.ONESTEP = true; |
---|
3088 | 3188 | Globals.ONESTEP = true; |
---|
3089 | 3189 | cameraView.repaint(); |
---|
3090 | 3190 | return; |
---|
3091 | | - } else if (event.getSource() == stepButton) |
---|
| 3191 | + } else if (source == stepButton) |
---|
3092 | 3192 | { |
---|
3093 | 3193 | copy.Step(); |
---|
3094 | 3194 | copy.Touch(); |
---|
3095 | 3195 | objEditor.refreshContents(); |
---|
3096 | | - } else if (event.getSource() == slowerButton) |
---|
| 3196 | + } else if (source == slowerButton) |
---|
3097 | 3197 | { |
---|
3098 | 3198 | copy.Slower(); |
---|
3099 | 3199 | copy.Touch(); |
---|
3100 | 3200 | objEditor.refreshContents(); |
---|
3101 | | - } else if (event.getSource() == fasterButton) |
---|
| 3201 | + } else if (source == fasterButton) |
---|
3102 | 3202 | { |
---|
3103 | 3203 | copy.Faster(); |
---|
3104 | 3204 | copy.Touch(); |
---|
3105 | 3205 | objEditor.refreshContents(); |
---|
3106 | | - } else if (event.getSource() == remarkButton) |
---|
| 3206 | + } else if (source == remarkButton) |
---|
3107 | 3207 | { |
---|
3108 | 3208 | copy.Remark(); |
---|
3109 | 3209 | copy.Touch(); |
---|
3110 | 3210 | objEditor.refreshContents(); |
---|
3111 | | - } else if (event.getSource() == stepAllButton) |
---|
| 3211 | + } else if (source == stepAllButton) |
---|
3112 | 3212 | { |
---|
3113 | 3213 | copy.StepAll(); |
---|
3114 | 3214 | copy.Touch(); |
---|
3115 | 3215 | objEditor.refreshContents(); |
---|
3116 | | - } else if (event.getSource() == resetAllButton) |
---|
| 3216 | + } else if (source == resetAllButton) |
---|
3117 | 3217 | { |
---|
3118 | 3218 | //CameraPane.fullreset = true; |
---|
3119 | 3219 | copy.ResetAll(); // ResetMeshes(); |
---|
.. | .. |
---|
3146 | 3246 | // Close(); |
---|
3147 | 3247 | // } |
---|
3148 | 3248 | // else |
---|
3149 | | - if (event.getSource() == resetSlidersButton) |
---|
| 3249 | + if (source == resetSlidersButton) |
---|
3150 | 3250 | { |
---|
3151 | 3251 | ResetSliders(); |
---|
3152 | | - } else if (event.getSource() == clearMaterialButton) |
---|
| 3252 | + } else if (source == clearMaterialButton) |
---|
3153 | 3253 | { |
---|
3154 | 3254 | ClearMaterial(); |
---|
3155 | | - } else if (event.getSource() == createMaterialButton) |
---|
| 3255 | + } else if (source == createMaterialButton) |
---|
3156 | 3256 | { |
---|
3157 | 3257 | CreateMaterial(); |
---|
3158 | | - } else if (event.getSource() == clearPanelButton) |
---|
| 3258 | + } else if (source == clearPanelButton) |
---|
3159 | 3259 | { |
---|
3160 | 3260 | copy.ClearUI(); |
---|
3161 | 3261 | refreshContents(true); |
---|
3162 | | - } /* |
---|
3163 | | - } |
---|
3164 | | - |
---|
3165 | | - public boolean action(Event event, Object arg) |
---|
3166 | | - { |
---|
3167 | | - */ else if (event.getSource() == closeItem) |
---|
| 3262 | + } else if (source == importGFDItem) |
---|
| 3263 | + { |
---|
| 3264 | + ImportGFD(); |
---|
| 3265 | + } else |
---|
| 3266 | + if (source == importVRMLX3DItem) |
---|
| 3267 | + { |
---|
| 3268 | + ImportVRMLX3D(); |
---|
| 3269 | + } else |
---|
| 3270 | + if (source == import3DSItem) |
---|
| 3271 | + { |
---|
| 3272 | + objEditor.ImportJME(new com.jmex.model.converters.MaxToJme(), "3ds", "Import 3DS"); |
---|
| 3273 | + } else |
---|
| 3274 | + if (source == importOBJItem) |
---|
| 3275 | + { |
---|
| 3276 | + //objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ"); |
---|
| 3277 | + FileDialog browser = new FileDialog(frame, "Import OBJ", FileDialog.LOAD); |
---|
| 3278 | + browser.setVisible(true); |
---|
| 3279 | + String filename = browser.getFile(); |
---|
| 3280 | + if (filename != null && filename.length() > 0) |
---|
| 3281 | + { |
---|
| 3282 | + String fullname = browser.getDirectory() + filename; |
---|
| 3283 | + makeSomething(ReadOBJ(fullname), true); |
---|
| 3284 | + } |
---|
| 3285 | + } else |
---|
| 3286 | + if (source == closeItem) |
---|
3168 | 3287 | { |
---|
3169 | 3288 | Close(); |
---|
3170 | 3289 | //return true; |
---|
3171 | | - } else if (event.getSource() == loadItem) |
---|
| 3290 | + } else if (source == loadItem) |
---|
3172 | 3291 | { |
---|
3173 | 3292 | load(); |
---|
3174 | 3293 | //return true; |
---|
3175 | | - } else if (event.getSource() == saveItem) |
---|
| 3294 | + } else if (source == newItem) |
---|
| 3295 | + { |
---|
| 3296 | + New(); |
---|
| 3297 | + } else if (source == saveItem) |
---|
3176 | 3298 | { |
---|
3177 | 3299 | save(); |
---|
3178 | 3300 | //return true; |
---|
3179 | | - } else if (event.getSource() == saveAsItem) |
---|
| 3301 | + } else if (source == saveAsItem) |
---|
3180 | 3302 | { |
---|
3181 | 3303 | saveAs(); |
---|
3182 | 3304 | //return true; |
---|
3183 | | - } else if (event.getSource() == reexportItem) |
---|
| 3305 | + } else if (source == reexportItem) |
---|
3184 | 3306 | { |
---|
3185 | 3307 | reexport(); |
---|
3186 | 3308 | //return true; |
---|
3187 | | - } else if (event.getSource() == exportAsItem) |
---|
| 3309 | + } else if (source == exportAsItem) |
---|
3188 | 3310 | { |
---|
3189 | 3311 | export(); |
---|
3190 | 3312 | //return true; |
---|
3191 | | - } else if (event.getSource() == povItem) |
---|
| 3313 | + } else if (source == povItem) |
---|
3192 | 3314 | { |
---|
3193 | 3315 | generatePOV(); |
---|
3194 | 3316 | //return true; |
---|
3195 | | - } else if (event.getSource() == zBufferItem) |
---|
| 3317 | + } else if (source == zBufferItem) |
---|
3196 | 3318 | { |
---|
3197 | 3319 | try |
---|
3198 | 3320 | { |
---|
.. | .. |
---|
3214 | 3336 | cameraView.repaint(); |
---|
3215 | 3337 | //return true; |
---|
3216 | 3338 | } |
---|
3217 | | - */ else if (event.getSource() == editCameraItem) |
---|
3218 | | - { |
---|
3219 | | - cameraView.ProtectCamera(); |
---|
3220 | | - cameraView.repaint(); |
---|
3221 | | - return; |
---|
3222 | | - } else if (event.getSource() == revertCameraItem) |
---|
3223 | | - { |
---|
3224 | | - cameraView.RevertCamera(); |
---|
3225 | | - cameraView.repaint(); |
---|
3226 | | - return; |
---|
3227 | | -// } else if (event.getSource() == textureButton) |
---|
3228 | | -// { |
---|
3229 | | -// return; // true; |
---|
3230 | | - } else // combos... |
---|
3231 | | - if (event.getSource() == texresMenu) |
---|
| 3339 | + */ else // combos... |
---|
| 3340 | + if (source == texresMenu) |
---|
3232 | 3341 | { |
---|
3233 | 3342 | System.err.println("Object = " + copy + "; change value " + copy.texres + " to " + texresMenu.getSelectedIndex()); |
---|
3234 | 3343 | copy.texres = texresMenu.getSelectedIndex(); |
---|
.. | .. |
---|
3240 | 3349 | } |
---|
3241 | 3350 | } |
---|
3242 | 3351 | |
---|
| 3352 | + void New() |
---|
| 3353 | + { |
---|
| 3354 | + while (copy.Size() > 1) |
---|
| 3355 | + { |
---|
| 3356 | + copy.remove(1); |
---|
| 3357 | + } |
---|
| 3358 | + |
---|
| 3359 | + ResetModel(); |
---|
| 3360 | + objEditor.refreshContents(); |
---|
| 3361 | + } |
---|
| 3362 | + |
---|
| 3363 | + static public byte[] Compress(Object3D o) |
---|
| 3364 | + { |
---|
| 3365 | + try |
---|
| 3366 | + { |
---|
| 3367 | + ByteArrayOutputStream baos = new ByteArrayOutputStream(); |
---|
| 3368 | + java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(baos); |
---|
| 3369 | + ObjectOutputStream out = new ObjectOutputStream(zstream); |
---|
| 3370 | + |
---|
| 3371 | + Object3D parent = o.parent; |
---|
| 3372 | + o.parent = null; |
---|
| 3373 | + |
---|
| 3374 | + out.writeObject(o); |
---|
| 3375 | + |
---|
| 3376 | + o.parent = parent; |
---|
| 3377 | + |
---|
| 3378 | + out.flush(); |
---|
| 3379 | + |
---|
| 3380 | + zstream.close(); |
---|
| 3381 | + out.close(); |
---|
| 3382 | + |
---|
| 3383 | + return baos.toByteArray(); |
---|
| 3384 | + } catch (Exception e) |
---|
| 3385 | + { |
---|
| 3386 | + System.err.println(e); |
---|
| 3387 | + return null; |
---|
| 3388 | + } |
---|
| 3389 | + } |
---|
| 3390 | + |
---|
| 3391 | + static public Object Uncompress(byte[] bytes) |
---|
| 3392 | + { |
---|
| 3393 | + System.out.println("#bytes = " + bytes.length); |
---|
| 3394 | + try |
---|
| 3395 | + { |
---|
| 3396 | + ByteArrayInputStream bais = new ByteArrayInputStream(bytes); |
---|
| 3397 | + java.util.zip.GZIPInputStream istream = new java.util.zip.GZIPInputStream(bais); |
---|
| 3398 | + ObjectInputStream in = new ObjectInputStream(istream); |
---|
| 3399 | + Object obj = in.readObject(); |
---|
| 3400 | + in.close(); |
---|
| 3401 | + |
---|
| 3402 | + return obj; |
---|
| 3403 | + } catch (Exception e) |
---|
| 3404 | + { |
---|
| 3405 | + System.err.println(e); |
---|
| 3406 | + return null; |
---|
| 3407 | + } |
---|
| 3408 | + } |
---|
| 3409 | + |
---|
| 3410 | + static public Object clone(Object o) |
---|
| 3411 | + { |
---|
| 3412 | + try |
---|
| 3413 | + { |
---|
| 3414 | + ByteArrayOutputStream baos = new ByteArrayOutputStream(); |
---|
| 3415 | + ObjectOutputStream out = new ObjectOutputStream(baos); |
---|
| 3416 | + |
---|
| 3417 | + out.writeObject(o); |
---|
| 3418 | + |
---|
| 3419 | + out.flush(); |
---|
| 3420 | + out.close(); |
---|
| 3421 | + |
---|
| 3422 | + byte[] bytes = baos.toByteArray(); |
---|
| 3423 | + |
---|
| 3424 | + System.out.println("clone = " + bytes.length); |
---|
| 3425 | + |
---|
| 3426 | + ByteArrayInputStream bais = new ByteArrayInputStream(bytes); |
---|
| 3427 | + ObjectInputStream in = new ObjectInputStream(bais); |
---|
| 3428 | + Object obj = in.readObject(); |
---|
| 3429 | + in.close(); |
---|
| 3430 | + |
---|
| 3431 | + return obj; |
---|
| 3432 | + } catch (Exception e) |
---|
| 3433 | + { |
---|
| 3434 | + System.err.println(e); |
---|
| 3435 | + return null; |
---|
| 3436 | + } |
---|
| 3437 | + } |
---|
| 3438 | + |
---|
| 3439 | + cRadio GetCurrentTab() |
---|
| 3440 | + { |
---|
| 3441 | + cRadio ab; |
---|
| 3442 | + for (java.util.Enumeration e = buttonGroup.getElements(); e.hasMoreElements();) |
---|
| 3443 | + { |
---|
| 3444 | + ab = (cRadio)e.nextElement(); |
---|
| 3445 | + if(ab.GetObject() == copy) |
---|
| 3446 | + { |
---|
| 3447 | + return ab; |
---|
| 3448 | + } |
---|
| 3449 | + } |
---|
| 3450 | + |
---|
| 3451 | + return null; |
---|
| 3452 | + } |
---|
| 3453 | + |
---|
| 3454 | + java.util.Hashtable<java.util.UUID, Object3D> hashtable = new java.util.Hashtable<java.util.UUID, Object3D>(); |
---|
| 3455 | + |
---|
| 3456 | + public void Save() |
---|
| 3457 | + { |
---|
| 3458 | + System.err.println("Save"); |
---|
| 3459 | + |
---|
| 3460 | + cRadio tab = GetCurrentTab(); |
---|
| 3461 | + |
---|
| 3462 | + boolean temp = CameraPane.SWITCH; |
---|
| 3463 | + CameraPane.SWITCH = false; |
---|
| 3464 | + |
---|
| 3465 | + copy.ExtractBigData(hashtable); |
---|
| 3466 | + |
---|
| 3467 | + //EditorFrame.m_MainFrame.requestFocusInWindow(); |
---|
| 3468 | + tab.graphs[tab.undoindex++] = Compress(copy); |
---|
| 3469 | + |
---|
| 3470 | + copy.RestoreBigData(hashtable); |
---|
| 3471 | + |
---|
| 3472 | + CameraPane.SWITCH = temp; |
---|
| 3473 | + |
---|
| 3474 | + //assert(hashtable.isEmpty()); |
---|
| 3475 | + |
---|
| 3476 | + for (int i = tab.undoindex; i < tab.graphs.length; i++) |
---|
| 3477 | + { |
---|
| 3478 | + tab.graphs[i] = null; |
---|
| 3479 | + } |
---|
| 3480 | + |
---|
| 3481 | + // test save |
---|
| 3482 | + if (false) |
---|
| 3483 | + { |
---|
| 3484 | + try |
---|
| 3485 | + { |
---|
| 3486 | + FileOutputStream ostream = new FileOutputStream("save" + tab.undoindex); |
---|
| 3487 | + ObjectOutputStream p = new ObjectOutputStream(ostream); |
---|
| 3488 | + |
---|
| 3489 | + p.writeObject(copy); |
---|
| 3490 | + |
---|
| 3491 | + p.flush(); |
---|
| 3492 | + |
---|
| 3493 | + ostream.close(); |
---|
| 3494 | + } catch (Exception e) |
---|
| 3495 | + { |
---|
| 3496 | + e.printStackTrace(); |
---|
| 3497 | + } |
---|
| 3498 | + } |
---|
| 3499 | + } |
---|
| 3500 | + |
---|
| 3501 | + void CopyChanged(Object3D obj) |
---|
| 3502 | + { |
---|
| 3503 | + boolean temp = CameraPane.SWITCH; |
---|
| 3504 | + CameraPane.SWITCH = false; |
---|
| 3505 | + |
---|
| 3506 | + copy.ExtractBigData(hashtable); |
---|
| 3507 | + |
---|
| 3508 | + copy.clear(); |
---|
| 3509 | + |
---|
| 3510 | + for (int i=0; i<obj.Size(); i++) |
---|
| 3511 | + { |
---|
| 3512 | + copy.add(obj.get(i)); |
---|
| 3513 | + } |
---|
| 3514 | + |
---|
| 3515 | + copy.RestoreBigData(hashtable); |
---|
| 3516 | + |
---|
| 3517 | + CameraPane.SWITCH = temp; |
---|
| 3518 | + |
---|
| 3519 | + //assert(hashtable.isEmpty()); |
---|
| 3520 | + |
---|
| 3521 | + copy.Touch(); |
---|
| 3522 | + |
---|
| 3523 | + ResetModel(); |
---|
| 3524 | + copy.HardTouch(); // recompile? |
---|
| 3525 | + |
---|
| 3526 | + cRadio ab; |
---|
| 3527 | + for (java.util.Enumeration e = buttonGroup.getElements(); e.hasMoreElements();) |
---|
| 3528 | + { |
---|
| 3529 | + ab = (cRadio)e.nextElement(); |
---|
| 3530 | + Object3D test = copy.GetObject(ab.object.GetUUID()); |
---|
| 3531 | + //ab.camera = (Camera)copy.GetObject(ab.camera.GetUUID()); |
---|
| 3532 | + if (test != null) |
---|
| 3533 | + { |
---|
| 3534 | + test.editWindow = ab.object.editWindow; |
---|
| 3535 | + ab.object = test; |
---|
| 3536 | + } |
---|
| 3537 | + } |
---|
| 3538 | + |
---|
| 3539 | + refreshContents(); |
---|
| 3540 | + } |
---|
| 3541 | + |
---|
| 3542 | + public void Undo() |
---|
| 3543 | + { |
---|
| 3544 | + System.err.println("Undo"); |
---|
| 3545 | + |
---|
| 3546 | + cRadio tab = GetCurrentTab(); |
---|
| 3547 | + |
---|
| 3548 | + if (tab.undoindex == 0) |
---|
| 3549 | + { |
---|
| 3550 | + java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
| 3551 | + return; |
---|
| 3552 | + } |
---|
| 3553 | + |
---|
| 3554 | + if (tab.graphs[tab.undoindex] == null) |
---|
| 3555 | + { |
---|
| 3556 | + Save(); |
---|
| 3557 | + tab.undoindex -= 1; |
---|
| 3558 | + } |
---|
| 3559 | + |
---|
| 3560 | + tab.undoindex -= 1; |
---|
| 3561 | + |
---|
| 3562 | + CopyChanged((Object3D)Uncompress(tab.graphs[tab.undoindex])); |
---|
| 3563 | + } |
---|
| 3564 | + |
---|
| 3565 | + public void Redo() |
---|
| 3566 | + { |
---|
| 3567 | + cRadio tab = GetCurrentTab(); |
---|
| 3568 | + |
---|
| 3569 | + if (tab.graphs[tab.undoindex + 1] == null) |
---|
| 3570 | + { |
---|
| 3571 | + java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
| 3572 | + return; |
---|
| 3573 | + } |
---|
| 3574 | + |
---|
| 3575 | + tab.undoindex += 1; |
---|
| 3576 | + |
---|
| 3577 | + CopyChanged((Object3D)Uncompress(tab.graphs[tab.undoindex])); |
---|
| 3578 | + } |
---|
| 3579 | + |
---|
| 3580 | + void ImportGFD() |
---|
| 3581 | + { |
---|
| 3582 | + FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD); |
---|
| 3583 | + browser.show(); |
---|
| 3584 | + String filename = browser.getFile(); |
---|
| 3585 | + if (filename != null && filename.length() > 0) |
---|
| 3586 | + { |
---|
| 3587 | + String fullname = browser.getDirectory() + filename; |
---|
| 3588 | + |
---|
| 3589 | + //Object3D readobj = |
---|
| 3590 | + objEditor.ReadGFD(fullname, objEditor); |
---|
| 3591 | + //makeSomething(readobj); |
---|
| 3592 | + } |
---|
| 3593 | + } |
---|
| 3594 | + |
---|
| 3595 | + void ImportVRMLX3D() |
---|
| 3596 | + { |
---|
| 3597 | + if (Grafreed.standAlone) |
---|
| 3598 | + { |
---|
| 3599 | + /**/ |
---|
| 3600 | + FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD); |
---|
| 3601 | + browser.show(); |
---|
| 3602 | + String filename = browser.getFile(); |
---|
| 3603 | + if (filename != null && filename.length() > 0) |
---|
| 3604 | + { |
---|
| 3605 | + String fullname = browser.getDirectory() + filename; |
---|
| 3606 | + LoadVRMLX3D(fullname); |
---|
| 3607 | + } |
---|
| 3608 | + /**/ |
---|
| 3609 | + } |
---|
| 3610 | + } |
---|
| 3611 | + |
---|
3243 | 3612 | void ToggleAnimation() |
---|
3244 | 3613 | { |
---|
3245 | 3614 | if (!Globals.ANIMATION) |
---|
.. | .. |
---|
3588 | 3957 | } |
---|
3589 | 3958 | |
---|
3590 | 3959 | if (normalpushField != null) |
---|
3591 | | - copy.NORMALPUSH = (float)normalpushField.getFloat()/1000; |
---|
| 3960 | + copy.NORMALPUSH = (float)normalpushField.getFloat()/100; |
---|
3592 | 3961 | } |
---|
3593 | 3962 | |
---|
3594 | 3963 | void SnapObject() |
---|
.. | .. |
---|
3852 | 4221 | |
---|
3853 | 4222 | void makeSomething(Object3D thing, boolean resetmodel) // deselect) |
---|
3854 | 4223 | { |
---|
| 4224 | + if (Globals.SAVEONMAKE) |
---|
| 4225 | + Save(); |
---|
3855 | 4226 | //Tween.set(thing, 0).target(1).start(tweenManager); |
---|
3856 | 4227 | //Tween.to(thing, 0, 0.5f).target(0).start(tweenManager); |
---|
3857 | 4228 | // if (thing instanceof GenericJointDemo) |
---|
.. | .. |
---|
4055 | 4426 | } |
---|
4056 | 4427 | } |
---|
4057 | 4428 | } |
---|
| 4429 | + |
---|
4058 | 4430 | LoadGFDThread loadGFDThread; |
---|
4059 | 4431 | |
---|
4060 | 4432 | void ReadGFD(String fullname, iCallBack cb) |
---|
.. | .. |
---|
4074 | 4446 | |
---|
4075 | 4447 | try |
---|
4076 | 4448 | { |
---|
| 4449 | + // Try compressed version first. |
---|
4077 | 4450 | java.io.FileInputStream istream = new java.io.FileInputStream(fullname); |
---|
4078 | | - java.io.ObjectInputStream p = new java.io.ObjectInputStream(istream); |
---|
| 4451 | + java.util.zip.GZIPInputStream zstream = new java.util.zip.GZIPInputStream(istream); |
---|
| 4452 | + java.io.ObjectInputStream p = new java.io.ObjectInputStream(zstream); |
---|
4079 | 4453 | |
---|
4080 | 4454 | readobj = (Object3D) p.readObject(); |
---|
4081 | 4455 | istream.close(); |
---|
.. | .. |
---|
4083 | 4457 | readobj.ResetDisplayList(); |
---|
4084 | 4458 | } catch (Exception e) |
---|
4085 | 4459 | { |
---|
4086 | | - e.printStackTrace(); |
---|
| 4460 | + //e.printStackTrace(); |
---|
| 4461 | + try |
---|
| 4462 | + { |
---|
| 4463 | + java.io.FileInputStream istream = new java.io.FileInputStream(fullname); |
---|
| 4464 | + java.io.ObjectInputStream p = new java.io.ObjectInputStream(istream); |
---|
| 4465 | + |
---|
| 4466 | + readobj = (Object3D) p.readObject(); |
---|
| 4467 | + istream.close(); |
---|
| 4468 | + |
---|
| 4469 | + readobj.ResetDisplayList(); |
---|
| 4470 | + } catch (Exception e2) |
---|
| 4471 | + { |
---|
| 4472 | + e2.printStackTrace(); |
---|
| 4473 | + } |
---|
4087 | 4474 | } |
---|
4088 | 4475 | // catch(java.io.StreamCorruptedException e) { e.printStackTrace(); } |
---|
4089 | 4476 | // catch(java.io.IOException e) { System.out.println("IOexception"); e.printStackTrace(); } |
---|
.. | .. |
---|
4129 | 4516 | |
---|
4130 | 4517 | void LoadIt(Object obj) |
---|
4131 | 4518 | { |
---|
| 4519 | + if (obj == null) |
---|
| 4520 | + { |
---|
| 4521 | + // Invalid file |
---|
| 4522 | + return; |
---|
| 4523 | + } |
---|
| 4524 | + |
---|
4132 | 4525 | System.out.println("Loaded " + obj); |
---|
4133 | 4526 | //new Exception().printStackTrace(); |
---|
4134 | 4527 | Object3D readobj = (Object3D) obj; |
---|
.. | .. |
---|
4138 | 4531 | |
---|
4139 | 4532 | if (readobj != null) |
---|
4140 | 4533 | { |
---|
| 4534 | + if (Globals.SAVEONMAKE) |
---|
| 4535 | + Save(); |
---|
4141 | 4536 | try |
---|
4142 | 4537 | { |
---|
4143 | 4538 | //readobj.deepCopySelf(copy); |
---|
.. | .. |
---|
4287 | 4682 | try |
---|
4288 | 4683 | { |
---|
4289 | 4684 | FileOutputStream ostream = new FileOutputStream(lastname); |
---|
4290 | | - ObjectOutputStream p = new ObjectOutputStream(ostream); |
---|
| 4685 | + java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream); |
---|
| 4686 | + ObjectOutputStream p = new ObjectOutputStream(zstream); |
---|
4291 | 4687 | |
---|
4292 | 4688 | p.writeObject(copy); |
---|
4293 | 4689 | p.flush(); |
---|
4294 | 4690 | |
---|
| 4691 | + zstream.close(); |
---|
4295 | 4692 | ostream.close(); |
---|
4296 | 4693 | |
---|
4297 | 4694 | //FileOutputStream fos = new FileOutputStream(fullname); |
---|
.. | .. |
---|
4301 | 4698 | { |
---|
4302 | 4699 | } |
---|
4303 | 4700 | } |
---|
| 4701 | + |
---|
4304 | 4702 | String lastname; |
---|
4305 | 4703 | |
---|
4306 | 4704 | void saveAs() |
---|
.. | .. |
---|
4410 | 4808 | try |
---|
4411 | 4809 | { |
---|
4412 | 4810 | FileOutputStream ostream = new FileOutputStream(filename); |
---|
4413 | | - // ?? java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream); |
---|
4414 | | - ObjectOutputStream p = new ObjectOutputStream(/*z*/ostream); |
---|
| 4811 | + java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream); |
---|
| 4812 | + ObjectOutputStream p = new ObjectOutputStream(zstream); |
---|
4415 | 4813 | |
---|
4416 | 4814 | Object3D objectparent = obj.parent; |
---|
4417 | 4815 | obj.parent = null; |
---|
.. | .. |
---|
4428 | 4826 | p.writeObject(object); |
---|
4429 | 4827 | p.flush(); |
---|
4430 | 4828 | |
---|
| 4829 | + zstream.close(); |
---|
4431 | 4830 | ostream.close(); |
---|
4432 | | - // zstream.close(); |
---|
4433 | 4831 | |
---|
4434 | 4832 | // group.selection.get(0).parent = parent; |
---|
4435 | 4833 | //FileOutputStream fos = new FileOutputStream(fullname); |
---|
.. | .. |
---|
4476 | 4874 | Object3D client; |
---|
4477 | 4875 | Object3D copy; |
---|
4478 | 4876 | MenuBar menuBar; |
---|
4479 | | - Menu windowMenu; |
---|
| 4877 | + Menu fileMenu; |
---|
| 4878 | + MenuItem newItem; |
---|
4480 | 4879 | MenuItem loadItem; |
---|
4481 | 4880 | MenuItem saveItem; |
---|
4482 | 4881 | MenuItem saveAsItem; |
---|
.. | .. |
---|
4484 | 4883 | MenuItem reexportItem; |
---|
4485 | 4884 | MenuItem povItem; |
---|
4486 | 4885 | MenuItem closeItem; |
---|
4487 | | - Menu cameraMenu; |
---|
| 4886 | + |
---|
4488 | 4887 | CheckboxMenuItem zBufferItem; |
---|
4489 | 4888 | //MenuItem normalLensItem; |
---|
4490 | | - MenuItem editCameraItem; |
---|
4491 | | - MenuItem revertCameraItem; |
---|
4492 | 4889 | MenuItem stepItem; |
---|
4493 | 4890 | CheckboxMenuItem toggleLiveItem; |
---|
4494 | 4891 | CheckboxMenuItem toggleFullScreenItem; |
---|
.. | .. |
---|
4636 | 5033 | //ObjectUI parent; |
---|
4637 | 5034 | |
---|
4638 | 5035 | cNumberSlider normalpushField; |
---|
| 5036 | + |
---|
| 5037 | + private MenuItem importGFDItem; |
---|
| 5038 | + private MenuItem importVRMLX3DItem; |
---|
| 5039 | + private MenuItem import3DSItem; |
---|
| 5040 | + private MenuItem importOBJItem; |
---|
4639 | 5041 | } |
---|