.. | .. |
---|
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 | |
---|
.. | .. |
---|
276 | 280 | void SetupMenu() |
---|
277 | 281 | { |
---|
278 | 282 | 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...")); |
---|
| 283 | + menuBar.add(fileMenu = new Menu("File")); |
---|
| 284 | + fileMenu.add(newItem = new MenuItem("New")); |
---|
| 285 | + fileMenu.add(loadItem = new MenuItem("Open...")); |
---|
| 286 | + |
---|
| 287 | + //oe.menuBar.add(menu = new Menu("Include")); |
---|
| 288 | + Menu menu = new Menu("Import"); |
---|
| 289 | + importOBJItem = menu.add(new MenuItem("OBJ file...")); |
---|
| 290 | + importOBJItem.addActionListener(this); |
---|
| 291 | + import3DSItem = menu.add(new MenuItem("3DS file...")); |
---|
| 292 | + import3DSItem.addActionListener(this); |
---|
| 293 | + importVRMLX3DItem = menu.add(new MenuItem("VRML/X3D file...")); |
---|
| 294 | + importVRMLX3DItem.addActionListener(this); |
---|
| 295 | + menu.add("-"); |
---|
| 296 | + importGFDItem = menu.add(new MenuItem("Grafreed file...")); |
---|
| 297 | + importGFDItem.addActionListener(this); |
---|
| 298 | + fileMenu.add(menu); |
---|
| 299 | + fileMenu.add("-"); |
---|
| 300 | + |
---|
| 301 | + fileMenu.add(saveItem = new MenuItem("Save")); |
---|
| 302 | + fileMenu.add(saveAsItem = new MenuItem("Save As...")); |
---|
284 | 303 | //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("-"); |
---|
| 304 | + fileMenu.add("-"); |
---|
| 305 | + fileMenu.add(exportAsItem = new MenuItem("Export Selection...")); |
---|
| 306 | + fileMenu.add(reexportItem = new MenuItem("Re-export")); |
---|
| 307 | + fileMenu.add("-"); |
---|
289 | 308 | if (client.parent != null) |
---|
290 | 309 | { |
---|
291 | | - windowMenu.add(closeItem = new MenuItem("Close")); |
---|
| 310 | + fileMenu.add(closeItem = new MenuItem("Close")); |
---|
292 | 311 | } else |
---|
293 | 312 | { |
---|
294 | | - windowMenu.add(closeItem = new MenuItem("Exit")); |
---|
| 313 | + fileMenu.add(closeItem = new MenuItem("Exit")); |
---|
295 | 314 | } |
---|
296 | 315 | |
---|
| 316 | + newItem.addActionListener(this); |
---|
297 | 317 | loadItem.addActionListener(this); |
---|
298 | 318 | saveItem.addActionListener(this); |
---|
299 | 319 | saveAsItem.addActionListener(this); |
---|
.. | .. |
---|
302 | 322 | //povItem.addActionListener(this); |
---|
303 | 323 | closeItem.addActionListener(this); |
---|
304 | 324 | |
---|
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 | 325 | objectPanel = new JTabbedPane(); |
---|
378 | 326 | toolbarPanel = new JPanel(); |
---|
379 | 327 | toolbarPanel.setName("Toolbar"); |
---|
380 | 328 | treePanel = new cGridBag(); |
---|
381 | 329 | treePanel.setName("Tree"); |
---|
| 330 | + |
---|
| 331 | + editPanel = new cGridBag().setVertical(true); |
---|
| 332 | + editPanel.setName("Edit"); |
---|
| 333 | + |
---|
382 | 334 | ctrlPanel = new cGridBag().setVertical(false); // new GridBagLayout()); |
---|
383 | | - ctrlPanel.setName("Edit"); |
---|
| 335 | + |
---|
| 336 | + editCommandsPanel = new cGridBag(); |
---|
| 337 | + editPanel.add(editCommandsPanel); |
---|
| 338 | + editPanel.add(ctrlPanel); |
---|
| 339 | + |
---|
384 | 340 | materialPanel = new cGridBag().setVertical(true); |
---|
| 341 | + |
---|
385 | 342 | materialPanel.setName("Material"); |
---|
386 | 343 | /*JTextPane*/ |
---|
387 | 344 | infoarea = createTextPane(); |
---|
.. | .. |
---|
475 | 432 | e.printStackTrace(); |
---|
476 | 433 | } |
---|
477 | 434 | |
---|
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(); |
---|
| 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(); |
---|
482 | 439 | //clipboard.setContents(data, data); |
---|
483 | 440 | } |
---|
484 | 441 | |
---|
.. | .. |
---|
501 | 458 | //SendInfo("Name:", "bold"); |
---|
502 | 459 | if (sel.GetTextures() != null || debug) |
---|
503 | 460 | { |
---|
504 | | - si.SendInfo(sel.toString(), "bold"); |
---|
| 461 | + si.SendInfo(sel.toString() + (Globals.ADVANCED?"":" " + System.identityHashCode(sel)), "bold"); |
---|
505 | 462 | //SendInfo("#children virtual = " + sel.size() + "; real = " + sel.Size() + newline, "regular"); |
---|
506 | 463 | if (sel.Size() > 0) |
---|
507 | 464 | { |
---|
508 | 465 | si.SendInfo("#children = " + sel.Size(), "regular"); |
---|
509 | 466 | } |
---|
510 | | - si.SendInfo((debug ? " Parent: " : " ") + sel.parent, "regular"); |
---|
| 467 | + si.SendInfo((debug ? " Parent: " : " ") + sel.parent + (Globals.ADVANCED?"":" " + System.identityHashCode(sel.parent)), "regular"); |
---|
511 | 468 | if (debug) |
---|
512 | 469 | { |
---|
513 | 470 | try |
---|
.. | .. |
---|
549 | 506 | } |
---|
550 | 507 | if (sel.support != null) |
---|
551 | 508 | { |
---|
552 | | - si.SendInfo(" support: " + sel.support, "regular"); |
---|
| 509 | + si.SendInfo(" support: " + sel.support + (Globals.ADVANCED?"":" " + System.identityHashCode(sel.support)), "regular"); |
---|
553 | 510 | } |
---|
554 | 511 | if (sel.scriptnode != null) |
---|
555 | 512 | { |
---|
.. | .. |
---|
638 | 595 | } |
---|
639 | 596 | } |
---|
640 | 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 | + |
---|
641 | 638 | void ToggleFullScreen() |
---|
642 | 639 | { |
---|
643 | 640 | if (CameraPane.FULLSCREEN) |
---|
644 | 641 | { |
---|
645 | | - frame.getContentPane().remove(/*"Center",*/bigThree); |
---|
646 | | - framePanel.add(bigThree); |
---|
647 | | - 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 | + |
---|
648 | 660 | } else |
---|
649 | 661 | { |
---|
650 | | - frame.getContentPane().remove(/*"Center",*/framePanel); |
---|
651 | | - framePanel.remove(bigThree); |
---|
652 | | - 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); |
---|
653 | 679 | } |
---|
| 680 | + |
---|
654 | 681 | cameraView.ToggleFullScreen(); |
---|
655 | 682 | } |
---|
656 | 683 | |
---|
.. | .. |
---|
752 | 779 | protected static ImageIcon createImageIcon(String path, |
---|
753 | 780 | String description) |
---|
754 | 781 | { |
---|
755 | | - java.net.URL imgURL = GrafreeD.class.getResource(path); |
---|
| 782 | + java.net.URL imgURL = Grafreed.class.getResource(path); |
---|
756 | 783 | if (imgURL != null) |
---|
757 | 784 | { |
---|
758 | 785 | return new ImageIcon(imgURL, description); |
---|
.. | .. |
---|
784 | 811 | // NumberSlider vDivsField; |
---|
785 | 812 | // JCheckBox endcaps; |
---|
786 | 813 | JCheckBox liveCB; |
---|
| 814 | + JCheckBox selectCB; |
---|
787 | 815 | JCheckBox hideCB; |
---|
788 | 816 | JCheckBox link2masterCB; |
---|
789 | 817 | JCheckBox markCB; |
---|
.. | .. |
---|
800 | 828 | JButton fasterButton; |
---|
801 | 829 | JButton remarkButton; |
---|
802 | 830 | |
---|
| 831 | + cGridBag editPanel; |
---|
| 832 | + cGridBag editCommandsPanel; |
---|
| 833 | + |
---|
803 | 834 | cGridBag namePanel; |
---|
804 | 835 | cGridBag setupPanel; |
---|
805 | | - cGridBag commandsPanel; |
---|
| 836 | + cGridBag setupPanel2; |
---|
| 837 | + cGridBag objectCommandsPanel; |
---|
806 | 838 | cGridBag pushPanel; |
---|
807 | 839 | cGridBag fillPanel; |
---|
808 | 840 | |
---|
.. | .. |
---|
986 | 1018 | |
---|
987 | 1019 | liveCB = AddCheckBox(setupPanel, "Live", copy.live); |
---|
988 | 1020 | liveCB.setToolTipText("Animate object"); |
---|
| 1021 | + selectCB = AddCheckBox(setupPanel, "Select", !copy.dontselect); |
---|
| 1022 | + selectCB.setToolTipText("Make object selectable"); |
---|
| 1023 | +// Return(); |
---|
989 | 1024 | hideCB = AddCheckBox(setupPanel, "Hide", copy.hide); |
---|
990 | 1025 | hideCB.setToolTipText("Hide object"); |
---|
991 | | -// Return(); |
---|
992 | 1026 | markCB = AddCheckBox(setupPanel, "Mark", copy.marked); |
---|
993 | 1027 | markCB.setToolTipText("Set the animation target transform"); |
---|
994 | 1028 | |
---|
995 | | - rewindCB = AddCheckBox(setupPanel, "Rewind", copy.rewind); |
---|
| 1029 | + setupPanel2 = new cGridBag().setVertical(false); |
---|
| 1030 | + |
---|
| 1031 | + rewindCB = AddCheckBox(setupPanel2, "Rewind", copy.rewind); |
---|
996 | 1032 | rewindCB.setToolTipText("Rewind animation"); |
---|
997 | 1033 | |
---|
998 | | - randomCB = AddCheckBox(setupPanel, "Random", copy.random); |
---|
999 | | - randomCB.setToolTipText("Option for switch node"); |
---|
| 1034 | + randomCB = AddCheckBox(setupPanel2, "Rand", copy.random); |
---|
| 1035 | + randomCB.setToolTipText("Randomly Rewind or Go back and forth"); |
---|
1000 | 1036 | |
---|
1001 | 1037 | if (Globals.ADVANCED) |
---|
1002 | 1038 | { |
---|
1003 | | - link2masterCB = AddCheckBox(setupPanel, "Support", copy.link2master); |
---|
| 1039 | + link2masterCB = AddCheckBox(setupPanel2, "Supp", copy.link2master); |
---|
1004 | 1040 | link2masterCB.setToolTipText("Attach to support"); |
---|
1005 | | - speedupCB = AddCheckBox(setupPanel, "Speed", copy.speedup); |
---|
| 1041 | + speedupCB = AddCheckBox(setupPanel2, "Speed", copy.speedup); |
---|
1006 | 1042 | speedupCB.setToolTipText("Option motion capture"); |
---|
1007 | 1043 | } |
---|
1008 | 1044 | |
---|
1009 | 1045 | oe.ctrlPanel.add(setupPanel); |
---|
1010 | 1046 | oe.ctrlPanel.Return(); |
---|
| 1047 | + oe.ctrlPanel.add(setupPanel2); |
---|
| 1048 | + oe.ctrlPanel.Return(); |
---|
1011 | 1049 | |
---|
1012 | | - commandsPanel = new cGridBag().setVertical(false); |
---|
| 1050 | + objectCommandsPanel = new cGridBag().setVertical(false); |
---|
1013 | 1051 | |
---|
1014 | | - resetButton = AddButton(commandsPanel, "Reset"); |
---|
| 1052 | + resetButton = AddButton(objectCommandsPanel, "Reset"); |
---|
1015 | 1053 | resetButton.setToolTipText("Jump to frame zero"); |
---|
1016 | | - stepButton = AddButton(commandsPanel, "Step"); |
---|
| 1054 | + stepButton = AddButton(objectCommandsPanel, "Step"); |
---|
1017 | 1055 | stepButton.setToolTipText("Step one frame"); |
---|
1018 | 1056 | // resetAllButton = AddButton(oe, "Reset All"); |
---|
1019 | 1057 | // stepAllButton = AddButton(oe, "Step All"); |
---|
1020 | 1058 | // Return(); |
---|
1021 | | - slowerButton = AddButton(commandsPanel, "Slow"); |
---|
| 1059 | + slowerButton = AddButton(objectCommandsPanel, "Slow"); |
---|
1022 | 1060 | slowerButton.setToolTipText("Decrease animation speed"); |
---|
1023 | | - fasterButton = AddButton(commandsPanel, "Fast"); |
---|
| 1061 | + fasterButton = AddButton(objectCommandsPanel, "Fast"); |
---|
1024 | 1062 | fasterButton.setToolTipText("Increase animation speed"); |
---|
1025 | | - remarkButton = AddButton(commandsPanel, "Remark"); |
---|
| 1063 | + remarkButton = AddButton(objectCommandsPanel, "Remark"); |
---|
1026 | 1064 | remarkButton.setToolTipText("Set the current transform as the target"); |
---|
1027 | 1065 | |
---|
1028 | | - oe.ctrlPanel.add(commandsPanel); |
---|
| 1066 | + oe.ctrlPanel.add(objectCommandsPanel); |
---|
1029 | 1067 | oe.ctrlPanel.Return(); |
---|
1030 | 1068 | |
---|
1031 | | - pushPanel = AddSlider(oe.ctrlPanel, "Push", -10, 10, 0, 1); |
---|
| 1069 | + pushPanel = AddSlider(oe.ctrlPanel, "Push", -1, 1, copy.NORMALPUSH, 1.1); // To have the buttons |
---|
1032 | 1070 | normalpushField = (cNumberSlider)pushPanel.getComponent(1); |
---|
1033 | 1071 | //Return(); |
---|
1034 | 1072 | |
---|
.. | .. |
---|
1231 | 1269 | //worldPanel.setName("World"); |
---|
1232 | 1270 | centralPanel = new cGridBag(); |
---|
1233 | 1271 | centralPanel.preferredWidth = 20; |
---|
1234 | | - timelinePanel = new JPanel(new BorderLayout()); |
---|
1235 | | - 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); |
---|
1236 | 1277 | |
---|
1237 | 1278 | cameraPanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, cameraView, timelinePanel); |
---|
1238 | 1279 | cameraPanel.setContinuousLayout(true); |
---|
.. | .. |
---|
1241 | 1282 | // cameraPanel.setDividerSize(9); |
---|
1242 | 1283 | cameraPanel.setResizeWeight(1.0); |
---|
1243 | 1284 | |
---|
| 1285 | + } |
---|
| 1286 | + |
---|
1244 | 1287 | centralPanel.add(cameraView); |
---|
| 1288 | + centralPanel.setFocusable(true); |
---|
1245 | 1289 | //frame.setJMenuBar(timelineMenubar); |
---|
1246 | 1290 | //centralPanel.add(timelinePanel); |
---|
1247 | 1291 | |
---|
.. | .. |
---|
1308 | 1352 | // north.setName("Edit"); |
---|
1309 | 1353 | // north.add(ctrlPanel, BorderLayout.NORTH); |
---|
1310 | 1354 | // objectPanel.add(north); |
---|
1311 | | - objectPanel.add(ctrlPanel); |
---|
| 1355 | + objectPanel.add(editPanel); |
---|
1312 | 1356 | objectPanel.add(infoPanel); |
---|
1313 | 1357 | |
---|
1314 | 1358 | /* |
---|
.. | .. |
---|
1439 | 1483 | frame.setSize(1280, 860); |
---|
1440 | 1484 | frame.setVisible(true); |
---|
1441 | 1485 | |
---|
| 1486 | + cameraView.requestFocusInWindow(); |
---|
| 1487 | + |
---|
1442 | 1488 | gridPanel.setDividerLocation(1.0); |
---|
1443 | 1489 | |
---|
1444 | 1490 | frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); |
---|
.. | .. |
---|
1476 | 1522 | |
---|
1477 | 1523 | cGridBag editBar = new cGridBag().setVertical(false); |
---|
1478 | 1524 | |
---|
1479 | | - editBar.add(createMaterialButton = new cButton("Create", !GrafreeD.NIMBUSLAF)); // , aConstraints); |
---|
| 1525 | + editBar.add(createMaterialButton = new cButton("Create", !Grafreed.NIMBUSLAF)); // , aConstraints); |
---|
1480 | 1526 | createMaterialButton.setToolTipText("Create material"); |
---|
1481 | 1527 | |
---|
1482 | 1528 | /* |
---|
1483 | 1529 | ctrlPanel.add(resetSlidersButton = new cButton("Reset All"), aConstraints); |
---|
1484 | 1530 | */ |
---|
1485 | 1531 | |
---|
1486 | | - editBar.add(clearMaterialButton = new cButton("Clear", !GrafreeD.NIMBUSLAF)); // , aConstraints); |
---|
| 1532 | + editBar.add(clearMaterialButton = new cButton("Clear", !Grafreed.NIMBUSLAF)); // , aConstraints); |
---|
1487 | 1533 | clearMaterialButton.setToolTipText("Clear material"); |
---|
1488 | 1534 | |
---|
1489 | 1535 | if (Globals.ADVANCED) |
---|
1490 | 1536 | { |
---|
1491 | | - editBar.add(resetSlidersButton = new cButton("Reset", !GrafreeD.NIMBUSLAF)); // , aConstraints); |
---|
| 1537 | + editBar.add(resetSlidersButton = new cButton("Reset", !Grafreed.NIMBUSLAF)); // , aConstraints); |
---|
1492 | 1538 | editBar.add(propagateToggle = new cCheckBox("Prop", propagate)); // , aConstraints); |
---|
1493 | 1539 | editBar.add(multiplyToggle = new cCheckBox("Mult", false)); // , aConstraints); |
---|
1494 | 1540 | } |
---|
.. | .. |
---|
1988 | 2034 | e2.printStackTrace(); |
---|
1989 | 2035 | } |
---|
1990 | 2036 | } |
---|
| 2037 | + |
---|
1991 | 2038 | LoadJMEThread loadThread; |
---|
1992 | 2039 | |
---|
1993 | 2040 | class LoadJMEThread extends Thread |
---|
.. | .. |
---|
2045 | 2092 | //LoadFile0(filename, converter); |
---|
2046 | 2093 | } |
---|
2047 | 2094 | } |
---|
| 2095 | + |
---|
2048 | 2096 | LoadOBJThread loadObjThread; |
---|
2049 | 2097 | |
---|
2050 | 2098 | class LoadOBJThread extends Thread |
---|
.. | .. |
---|
2123 | 2171 | |
---|
2124 | 2172 | void LoadObjFile(String fullname) |
---|
2125 | 2173 | { |
---|
2126 | | - /* |
---|
| 2174 | + System.out.println("Loading " + fullname); |
---|
| 2175 | + /**/ |
---|
2127 | 2176 | //lastFilename = fullname; |
---|
2128 | 2177 | if(loadObjThread == null) |
---|
2129 | 2178 | { |
---|
2130 | | - loadObjThread = new LoadOBJThread(); |
---|
2131 | | - loadObjThread.start(); |
---|
| 2179 | + loadObjThread = new LoadOBJThread(); |
---|
| 2180 | + loadObjThread.start(); |
---|
2132 | 2181 | } |
---|
2133 | 2182 | |
---|
2134 | 2183 | loadObjThread.add(fullname); |
---|
2135 | | - */ |
---|
| 2184 | + /**/ |
---|
2136 | 2185 | |
---|
2137 | | - System.out.println("Loading " + fullname); |
---|
2138 | | - makeSomething(new FileObject(fullname, true), true); |
---|
| 2186 | + //makeSomething(new FileObject(fullname, true), true); |
---|
2139 | 2187 | } |
---|
2140 | 2188 | |
---|
2141 | 2189 | void LoadGFDFile(String fullname) |
---|
.. | .. |
---|
2396 | 2444 | |
---|
2397 | 2445 | void ImportJME(com.jmex.model.converters.FormatConverter converter, String ext, String dialogName) |
---|
2398 | 2446 | { |
---|
2399 | | - if (GrafreeD.standAlone) |
---|
| 2447 | + if (Grafreed.standAlone) |
---|
2400 | 2448 | { |
---|
2401 | 2449 | /**/ |
---|
2402 | 2450 | FileDialog browser = new FileDialog(frame, dialogName, FileDialog.LOAD); |
---|
.. | .. |
---|
2978 | 3026 | return; |
---|
2979 | 3027 | } else if (event.getSource() == toggleSwitchItem) |
---|
2980 | 3028 | { |
---|
2981 | | - cameraView.ToggleRandom(); |
---|
| 3029 | + cameraView.ToggleSwitch(); |
---|
2982 | 3030 | cameraView.repaint(); |
---|
2983 | 3031 | return; |
---|
2984 | 3032 | } else if (event.getSource() == toggleHandleItem) |
---|
.. | .. |
---|
3006 | 3054 | } else if (event.getSource() == liveCB) |
---|
3007 | 3055 | { |
---|
3008 | 3056 | copy.live ^= true; |
---|
| 3057 | + return; |
---|
| 3058 | + } else if (event.getSource() == selectCB) |
---|
| 3059 | + { |
---|
| 3060 | + copy.dontselect ^= true; |
---|
3009 | 3061 | return; |
---|
3010 | 3062 | } else if (event.getSource() == hideCB) |
---|
3011 | 3063 | { |
---|
.. | .. |
---|
3045 | 3097 | |
---|
3046 | 3098 | public void actionPerformed(ActionEvent event) |
---|
3047 | 3099 | { |
---|
| 3100 | + Object source = event.getSource(); |
---|
3048 | 3101 | // SCRIPT DIALOG |
---|
3049 | | - if (event.getSource() == okbutton) |
---|
| 3102 | + if (source == okbutton) |
---|
3050 | 3103 | { |
---|
3051 | 3104 | textpanel.setVisible(false); |
---|
3052 | 3105 | textpanel.remove(textarea); |
---|
.. | .. |
---|
3058 | 3111 | textarea = null; |
---|
3059 | 3112 | textpanel = null; |
---|
3060 | 3113 | } |
---|
3061 | | - if (event.getSource() == cancelbutton) |
---|
| 3114 | + if (source == cancelbutton) |
---|
3062 | 3115 | { |
---|
3063 | 3116 | textpanel.setVisible(false); |
---|
3064 | 3117 | textpanel.remove(textarea); |
---|
.. | .. |
---|
3070 | 3123 | //applySelf(); |
---|
3071 | 3124 | //client.refreshEditWindow(); |
---|
3072 | 3125 | //refreshContents(); |
---|
3073 | | - if (event.getSource() == nameField) |
---|
| 3126 | + if (source == nameField) |
---|
3074 | 3127 | { |
---|
3075 | 3128 | //System.out.println("ObjEditor " + event); |
---|
3076 | 3129 | applySelf0(true); |
---|
3077 | 3130 | //parent.applySelf(); |
---|
3078 | 3131 | objEditor.refreshContents(); |
---|
3079 | | - } else if (event.getSource() == resetButton) |
---|
| 3132 | + } else if (source == resetButton) |
---|
3080 | 3133 | { |
---|
3081 | 3134 | CameraPane.fullreset = true; |
---|
3082 | 3135 | copy.Reset(); // ResetMeshes(); |
---|
3083 | 3136 | copy.Touch(); |
---|
3084 | 3137 | objEditor.refreshContents(); |
---|
3085 | | - } else if (event.getSource() == stepItem) |
---|
| 3138 | + } else if (source == stepItem) |
---|
3086 | 3139 | { |
---|
3087 | 3140 | //cameraView.ONESTEP = true; |
---|
3088 | 3141 | Globals.ONESTEP = true; |
---|
3089 | 3142 | cameraView.repaint(); |
---|
3090 | 3143 | return; |
---|
3091 | | - } else if (event.getSource() == stepButton) |
---|
| 3144 | + } else if (source == stepButton) |
---|
3092 | 3145 | { |
---|
3093 | 3146 | copy.Step(); |
---|
3094 | 3147 | copy.Touch(); |
---|
3095 | 3148 | objEditor.refreshContents(); |
---|
3096 | | - } else if (event.getSource() == slowerButton) |
---|
| 3149 | + } else if (source == slowerButton) |
---|
3097 | 3150 | { |
---|
3098 | 3151 | copy.Slower(); |
---|
3099 | 3152 | copy.Touch(); |
---|
3100 | 3153 | objEditor.refreshContents(); |
---|
3101 | | - } else if (event.getSource() == fasterButton) |
---|
| 3154 | + } else if (source == fasterButton) |
---|
3102 | 3155 | { |
---|
3103 | 3156 | copy.Faster(); |
---|
3104 | 3157 | copy.Touch(); |
---|
3105 | 3158 | objEditor.refreshContents(); |
---|
3106 | | - } else if (event.getSource() == remarkButton) |
---|
| 3159 | + } else if (source == remarkButton) |
---|
3107 | 3160 | { |
---|
3108 | 3161 | copy.Remark(); |
---|
3109 | 3162 | copy.Touch(); |
---|
3110 | 3163 | objEditor.refreshContents(); |
---|
3111 | | - } else if (event.getSource() == stepAllButton) |
---|
| 3164 | + } else if (source == stepAllButton) |
---|
3112 | 3165 | { |
---|
3113 | 3166 | copy.StepAll(); |
---|
3114 | 3167 | copy.Touch(); |
---|
3115 | 3168 | objEditor.refreshContents(); |
---|
3116 | | - } else if (event.getSource() == resetAllButton) |
---|
| 3169 | + } else if (source == resetAllButton) |
---|
3117 | 3170 | { |
---|
3118 | 3171 | //CameraPane.fullreset = true; |
---|
3119 | 3172 | copy.ResetAll(); // ResetMeshes(); |
---|
.. | .. |
---|
3146 | 3199 | // Close(); |
---|
3147 | 3200 | // } |
---|
3148 | 3201 | // else |
---|
3149 | | - if (event.getSource() == resetSlidersButton) |
---|
| 3202 | + if (source == resetSlidersButton) |
---|
3150 | 3203 | { |
---|
3151 | 3204 | ResetSliders(); |
---|
3152 | | - } else if (event.getSource() == clearMaterialButton) |
---|
| 3205 | + } else if (source == clearMaterialButton) |
---|
3153 | 3206 | { |
---|
3154 | 3207 | ClearMaterial(); |
---|
3155 | | - } else if (event.getSource() == createMaterialButton) |
---|
| 3208 | + } else if (source == createMaterialButton) |
---|
3156 | 3209 | { |
---|
3157 | 3210 | CreateMaterial(); |
---|
3158 | | - } else if (event.getSource() == clearPanelButton) |
---|
| 3211 | + } else if (source == clearPanelButton) |
---|
3159 | 3212 | { |
---|
3160 | 3213 | copy.ClearUI(); |
---|
3161 | 3214 | refreshContents(true); |
---|
3162 | | - } /* |
---|
3163 | | - } |
---|
3164 | | - |
---|
3165 | | - public boolean action(Event event, Object arg) |
---|
3166 | | - { |
---|
3167 | | - */ else if (event.getSource() == closeItem) |
---|
| 3215 | + } else if (source == importGFDItem) |
---|
| 3216 | + { |
---|
| 3217 | + ImportGFD(); |
---|
| 3218 | + } else |
---|
| 3219 | + if (source == importVRMLX3DItem) |
---|
| 3220 | + { |
---|
| 3221 | + ImportVRMLX3D(); |
---|
| 3222 | + } else |
---|
| 3223 | + if (source == import3DSItem) |
---|
| 3224 | + { |
---|
| 3225 | + objEditor.ImportJME(new com.jmex.model.converters.MaxToJme(), "3ds", "Import 3DS"); |
---|
| 3226 | + } else |
---|
| 3227 | + if (source == importOBJItem) |
---|
| 3228 | + { |
---|
| 3229 | + //objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ"); |
---|
| 3230 | + FileDialog browser = new FileDialog(frame, "Import OBJ", FileDialog.LOAD); |
---|
| 3231 | + browser.setVisible(true); |
---|
| 3232 | + String filename = browser.getFile(); |
---|
| 3233 | + if (filename != null && filename.length() > 0) |
---|
| 3234 | + { |
---|
| 3235 | + String fullname = browser.getDirectory() + filename; |
---|
| 3236 | + makeSomething(ReadOBJ(fullname), true); |
---|
| 3237 | + } |
---|
| 3238 | + } else |
---|
| 3239 | + if (source == closeItem) |
---|
3168 | 3240 | { |
---|
3169 | 3241 | Close(); |
---|
3170 | 3242 | //return true; |
---|
3171 | | - } else if (event.getSource() == loadItem) |
---|
| 3243 | + } else if (source == loadItem) |
---|
3172 | 3244 | { |
---|
3173 | 3245 | load(); |
---|
3174 | 3246 | //return true; |
---|
3175 | | - } else if (event.getSource() == saveItem) |
---|
| 3247 | + } else if (source == newItem) |
---|
| 3248 | + { |
---|
| 3249 | + New(); |
---|
| 3250 | + } else if (source == saveItem) |
---|
3176 | 3251 | { |
---|
3177 | 3252 | save(); |
---|
3178 | 3253 | //return true; |
---|
3179 | | - } else if (event.getSource() == saveAsItem) |
---|
| 3254 | + } else if (source == saveAsItem) |
---|
3180 | 3255 | { |
---|
3181 | 3256 | saveAs(); |
---|
3182 | 3257 | //return true; |
---|
3183 | | - } else if (event.getSource() == reexportItem) |
---|
| 3258 | + } else if (source == reexportItem) |
---|
3184 | 3259 | { |
---|
3185 | 3260 | reexport(); |
---|
3186 | 3261 | //return true; |
---|
3187 | | - } else if (event.getSource() == exportAsItem) |
---|
| 3262 | + } else if (source == exportAsItem) |
---|
3188 | 3263 | { |
---|
3189 | 3264 | export(); |
---|
3190 | 3265 | //return true; |
---|
3191 | | - } else if (event.getSource() == povItem) |
---|
| 3266 | + } else if (source == povItem) |
---|
3192 | 3267 | { |
---|
3193 | 3268 | generatePOV(); |
---|
3194 | 3269 | //return true; |
---|
3195 | | - } else if (event.getSource() == zBufferItem) |
---|
| 3270 | + } else if (source == zBufferItem) |
---|
3196 | 3271 | { |
---|
3197 | 3272 | try |
---|
3198 | 3273 | { |
---|
.. | .. |
---|
3214 | 3289 | cameraView.repaint(); |
---|
3215 | 3290 | //return true; |
---|
3216 | 3291 | } |
---|
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) |
---|
| 3292 | + */ else // combos... |
---|
| 3293 | + if (source == texresMenu) |
---|
3232 | 3294 | { |
---|
3233 | 3295 | System.err.println("Object = " + copy + "; change value " + copy.texres + " to " + texresMenu.getSelectedIndex()); |
---|
3234 | 3296 | copy.texres = texresMenu.getSelectedIndex(); |
---|
.. | .. |
---|
3240 | 3302 | } |
---|
3241 | 3303 | } |
---|
3242 | 3304 | |
---|
| 3305 | + void New() |
---|
| 3306 | + { |
---|
| 3307 | + while (copy.Size() > 1) |
---|
| 3308 | + { |
---|
| 3309 | + copy.remove(1); |
---|
| 3310 | + } |
---|
| 3311 | + |
---|
| 3312 | + ResetModel(); |
---|
| 3313 | + objEditor.refreshContents(); |
---|
| 3314 | + } |
---|
| 3315 | + |
---|
| 3316 | + static public byte[] Compress(Object3D o) |
---|
| 3317 | + { |
---|
| 3318 | + try |
---|
| 3319 | + { |
---|
| 3320 | + ByteArrayOutputStream baos = new ByteArrayOutputStream(); |
---|
| 3321 | + java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(baos); |
---|
| 3322 | + ObjectOutputStream out = new ObjectOutputStream(zstream); |
---|
| 3323 | + |
---|
| 3324 | + Object3D parent = o.parent; |
---|
| 3325 | + o.parent = null; |
---|
| 3326 | + |
---|
| 3327 | + out.writeObject(o); |
---|
| 3328 | + |
---|
| 3329 | + o.parent = parent; |
---|
| 3330 | + |
---|
| 3331 | + out.flush(); |
---|
| 3332 | + |
---|
| 3333 | + zstream.close(); |
---|
| 3334 | + out.close(); |
---|
| 3335 | + |
---|
| 3336 | + return baos.toByteArray(); |
---|
| 3337 | + } catch (Exception e) |
---|
| 3338 | + { |
---|
| 3339 | + System.err.println(e); |
---|
| 3340 | + return null; |
---|
| 3341 | + } |
---|
| 3342 | + } |
---|
| 3343 | + |
---|
| 3344 | + static public Object Uncompress(byte[] bytes) |
---|
| 3345 | + { |
---|
| 3346 | + System.out.println("#bytes = " + bytes.length); |
---|
| 3347 | + try |
---|
| 3348 | + { |
---|
| 3349 | + ByteArrayInputStream bais = new ByteArrayInputStream(bytes); |
---|
| 3350 | + java.util.zip.GZIPInputStream istream = new java.util.zip.GZIPInputStream(bais); |
---|
| 3351 | + ObjectInputStream in = new ObjectInputStream(istream); |
---|
| 3352 | + Object obj = in.readObject(); |
---|
| 3353 | + in.close(); |
---|
| 3354 | + |
---|
| 3355 | + return obj; |
---|
| 3356 | + } catch (Exception e) |
---|
| 3357 | + { |
---|
| 3358 | + System.err.println(e); |
---|
| 3359 | + return null; |
---|
| 3360 | + } |
---|
| 3361 | + } |
---|
| 3362 | + |
---|
| 3363 | + static public Object clone(Object o) |
---|
| 3364 | + { |
---|
| 3365 | + try |
---|
| 3366 | + { |
---|
| 3367 | + ByteArrayOutputStream baos = new ByteArrayOutputStream(); |
---|
| 3368 | + ObjectOutputStream out = new ObjectOutputStream(baos); |
---|
| 3369 | + |
---|
| 3370 | + out.writeObject(o); |
---|
| 3371 | + |
---|
| 3372 | + out.flush(); |
---|
| 3373 | + out.close(); |
---|
| 3374 | + |
---|
| 3375 | + byte[] bytes = baos.toByteArray(); |
---|
| 3376 | + |
---|
| 3377 | + System.out.println("clone = " + bytes.length); |
---|
| 3378 | + |
---|
| 3379 | + ByteArrayInputStream bais = new ByteArrayInputStream(bytes); |
---|
| 3380 | + ObjectInputStream in = new ObjectInputStream(bais); |
---|
| 3381 | + Object obj = in.readObject(); |
---|
| 3382 | + in.close(); |
---|
| 3383 | + |
---|
| 3384 | + return obj; |
---|
| 3385 | + } catch (Exception e) |
---|
| 3386 | + { |
---|
| 3387 | + System.err.println(e); |
---|
| 3388 | + return null; |
---|
| 3389 | + } |
---|
| 3390 | + } |
---|
| 3391 | + |
---|
| 3392 | + cRadio GetCurrentTab() |
---|
| 3393 | + { |
---|
| 3394 | + cRadio ab; |
---|
| 3395 | + for (java.util.Enumeration e = buttonGroup.getElements(); e.hasMoreElements();) |
---|
| 3396 | + { |
---|
| 3397 | + ab = (cRadio)e.nextElement(); |
---|
| 3398 | + if(ab.GetObject() == copy) |
---|
| 3399 | + { |
---|
| 3400 | + return ab; |
---|
| 3401 | + } |
---|
| 3402 | + } |
---|
| 3403 | + |
---|
| 3404 | + return null; |
---|
| 3405 | + } |
---|
| 3406 | + |
---|
| 3407 | + java.util.Hashtable<java.util.UUID, Object3D> hashtable = new java.util.Hashtable<java.util.UUID, Object3D>(); |
---|
| 3408 | + |
---|
| 3409 | + public void Save() |
---|
| 3410 | + { |
---|
| 3411 | + cRadio tab = GetCurrentTab(); |
---|
| 3412 | + |
---|
| 3413 | + boolean temp = CameraPane.SWITCH; |
---|
| 3414 | + CameraPane.SWITCH = false; |
---|
| 3415 | + |
---|
| 3416 | + copy.ExtractBigData(hashtable); |
---|
| 3417 | + |
---|
| 3418 | + //EditorFrame.m_MainFrame.requestFocusInWindow(); |
---|
| 3419 | + tab.graphs[tab.undoindex++] = Compress(copy); |
---|
| 3420 | + |
---|
| 3421 | + copy.RestoreBigData(hashtable); |
---|
| 3422 | + |
---|
| 3423 | + CameraPane.SWITCH = temp; |
---|
| 3424 | + |
---|
| 3425 | + //assert(hashtable.isEmpty()); |
---|
| 3426 | + |
---|
| 3427 | + for (int i = tab.undoindex; i < tab.graphs.length; i++) |
---|
| 3428 | + { |
---|
| 3429 | + tab.graphs[i] = null; |
---|
| 3430 | + } |
---|
| 3431 | + |
---|
| 3432 | + // test save |
---|
| 3433 | + if (false) |
---|
| 3434 | + { |
---|
| 3435 | + try |
---|
| 3436 | + { |
---|
| 3437 | + FileOutputStream ostream = new FileOutputStream("save" + tab.undoindex); |
---|
| 3438 | + ObjectOutputStream p = new ObjectOutputStream(ostream); |
---|
| 3439 | + |
---|
| 3440 | + p.writeObject(copy); |
---|
| 3441 | + |
---|
| 3442 | + p.flush(); |
---|
| 3443 | + |
---|
| 3444 | + ostream.close(); |
---|
| 3445 | + } catch (Exception e) |
---|
| 3446 | + { |
---|
| 3447 | + e.printStackTrace(); |
---|
| 3448 | + } |
---|
| 3449 | + } |
---|
| 3450 | + } |
---|
| 3451 | + |
---|
| 3452 | + void CopyChanged(Object3D obj) |
---|
| 3453 | + { |
---|
| 3454 | + boolean temp = CameraPane.SWITCH; |
---|
| 3455 | + CameraPane.SWITCH = false; |
---|
| 3456 | + |
---|
| 3457 | + copy.ExtractBigData(hashtable); |
---|
| 3458 | + |
---|
| 3459 | + copy.clear(); |
---|
| 3460 | + |
---|
| 3461 | + for (int i=0; i<obj.Size(); i++) |
---|
| 3462 | + { |
---|
| 3463 | + copy.add(obj.get(i)); |
---|
| 3464 | + } |
---|
| 3465 | + |
---|
| 3466 | + copy.RestoreBigData(hashtable); |
---|
| 3467 | + |
---|
| 3468 | + CameraPane.SWITCH = temp; |
---|
| 3469 | + |
---|
| 3470 | + //assert(hashtable.isEmpty()); |
---|
| 3471 | + |
---|
| 3472 | + copy.Touch(); |
---|
| 3473 | + |
---|
| 3474 | + ResetModel(); |
---|
| 3475 | + copy.HardTouch(); // recompile? |
---|
| 3476 | + |
---|
| 3477 | + cRadio ab; |
---|
| 3478 | + for (java.util.Enumeration e = buttonGroup.getElements(); e.hasMoreElements();) |
---|
| 3479 | + { |
---|
| 3480 | + ab = (cRadio)e.nextElement(); |
---|
| 3481 | + Object3D test = copy.GetObject(ab.object.GetUUID()); |
---|
| 3482 | + //ab.camera = (Camera)copy.GetObject(ab.camera.GetUUID()); |
---|
| 3483 | + if (test != null) |
---|
| 3484 | + { |
---|
| 3485 | + test.editWindow = ab.object.editWindow; |
---|
| 3486 | + ab.object = test; |
---|
| 3487 | + } |
---|
| 3488 | + } |
---|
| 3489 | + |
---|
| 3490 | + refreshContents(); |
---|
| 3491 | + } |
---|
| 3492 | + |
---|
| 3493 | + public void Undo() |
---|
| 3494 | + { |
---|
| 3495 | + cRadio tab = GetCurrentTab(); |
---|
| 3496 | + |
---|
| 3497 | + if (tab.undoindex == 0) |
---|
| 3498 | + { |
---|
| 3499 | + java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
| 3500 | + return; |
---|
| 3501 | + } |
---|
| 3502 | + |
---|
| 3503 | + if (tab.graphs[tab.undoindex] == null) |
---|
| 3504 | + { |
---|
| 3505 | + Save(); |
---|
| 3506 | + tab.undoindex -= 1; |
---|
| 3507 | + } |
---|
| 3508 | + |
---|
| 3509 | + tab.undoindex -= 1; |
---|
| 3510 | + |
---|
| 3511 | + CopyChanged((Object3D)Uncompress(tab.graphs[tab.undoindex])); |
---|
| 3512 | + } |
---|
| 3513 | + |
---|
| 3514 | + public void Redo() |
---|
| 3515 | + { |
---|
| 3516 | + cRadio tab = GetCurrentTab(); |
---|
| 3517 | + |
---|
| 3518 | + if (tab.graphs[tab.undoindex + 1] == null) |
---|
| 3519 | + { |
---|
| 3520 | + java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
| 3521 | + return; |
---|
| 3522 | + } |
---|
| 3523 | + |
---|
| 3524 | + tab.undoindex += 1; |
---|
| 3525 | + |
---|
| 3526 | + CopyChanged((Object3D)Uncompress(tab.graphs[tab.undoindex])); |
---|
| 3527 | + } |
---|
| 3528 | + |
---|
| 3529 | + void ImportGFD() |
---|
| 3530 | + { |
---|
| 3531 | + FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD); |
---|
| 3532 | + browser.show(); |
---|
| 3533 | + String filename = browser.getFile(); |
---|
| 3534 | + if (filename != null && filename.length() > 0) |
---|
| 3535 | + { |
---|
| 3536 | + String fullname = browser.getDirectory() + filename; |
---|
| 3537 | + |
---|
| 3538 | + //Object3D readobj = |
---|
| 3539 | + objEditor.ReadGFD(fullname, objEditor); |
---|
| 3540 | + //makeSomething(readobj); |
---|
| 3541 | + } |
---|
| 3542 | + } |
---|
| 3543 | + |
---|
| 3544 | + void ImportVRMLX3D() |
---|
| 3545 | + { |
---|
| 3546 | + if (Grafreed.standAlone) |
---|
| 3547 | + { |
---|
| 3548 | + /**/ |
---|
| 3549 | + FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD); |
---|
| 3550 | + browser.show(); |
---|
| 3551 | + String filename = browser.getFile(); |
---|
| 3552 | + if (filename != null && filename.length() > 0) |
---|
| 3553 | + { |
---|
| 3554 | + String fullname = browser.getDirectory() + filename; |
---|
| 3555 | + LoadVRMLX3D(fullname); |
---|
| 3556 | + } |
---|
| 3557 | + /**/ |
---|
| 3558 | + } |
---|
| 3559 | + } |
---|
| 3560 | + |
---|
3243 | 3561 | void ToggleAnimation() |
---|
3244 | 3562 | { |
---|
3245 | 3563 | if (!Globals.ANIMATION) |
---|
.. | .. |
---|
3255 | 3573 | |
---|
3256 | 3574 | Globals.ANIMATION ^= true; |
---|
3257 | 3575 | |
---|
3258 | | - GrafreeD.wav.cursor = 0; |
---|
3259 | | - GrafreeD.wav.loop = 0; |
---|
| 3576 | + Grafreed.wav.cursor = 0; |
---|
| 3577 | + Grafreed.wav.loop = 0; |
---|
3260 | 3578 | } |
---|
3261 | 3579 | } else |
---|
3262 | 3580 | { |
---|
.. | .. |
---|
3588 | 3906 | } |
---|
3589 | 3907 | |
---|
3590 | 3908 | if (normalpushField != null) |
---|
3591 | | - copy.NORMALPUSH = (float)normalpushField.getFloat()/1000; |
---|
| 3909 | + copy.NORMALPUSH = (float)normalpushField.getFloat()/100; |
---|
3592 | 3910 | } |
---|
3593 | 3911 | |
---|
3594 | 3912 | void SnapObject() |
---|
.. | .. |
---|
3852 | 4170 | |
---|
3853 | 4171 | void makeSomething(Object3D thing, boolean resetmodel) // deselect) |
---|
3854 | 4172 | { |
---|
| 4173 | + Save(); |
---|
3855 | 4174 | //Tween.set(thing, 0).target(1).start(tweenManager); |
---|
3856 | 4175 | //Tween.to(thing, 0, 0.5f).target(0).start(tweenManager); |
---|
3857 | 4176 | // if (thing instanceof GenericJointDemo) |
---|
.. | .. |
---|
4055 | 4374 | } |
---|
4056 | 4375 | } |
---|
4057 | 4376 | } |
---|
| 4377 | + |
---|
4058 | 4378 | LoadGFDThread loadGFDThread; |
---|
4059 | 4379 | |
---|
4060 | 4380 | void ReadGFD(String fullname, iCallBack cb) |
---|
.. | .. |
---|
4074 | 4394 | |
---|
4075 | 4395 | try |
---|
4076 | 4396 | { |
---|
| 4397 | + // Try compressed version first. |
---|
4077 | 4398 | java.io.FileInputStream istream = new java.io.FileInputStream(fullname); |
---|
4078 | | - java.io.ObjectInputStream p = new java.io.ObjectInputStream(istream); |
---|
| 4399 | + java.util.zip.GZIPInputStream zstream = new java.util.zip.GZIPInputStream(istream); |
---|
| 4400 | + java.io.ObjectInputStream p = new java.io.ObjectInputStream(zstream); |
---|
4079 | 4401 | |
---|
4080 | 4402 | readobj = (Object3D) p.readObject(); |
---|
4081 | 4403 | istream.close(); |
---|
.. | .. |
---|
4083 | 4405 | readobj.ResetDisplayList(); |
---|
4084 | 4406 | } catch (Exception e) |
---|
4085 | 4407 | { |
---|
4086 | | - e.printStackTrace(); |
---|
| 4408 | + //e.printStackTrace(); |
---|
| 4409 | + try |
---|
| 4410 | + { |
---|
| 4411 | + java.io.FileInputStream istream = new java.io.FileInputStream(fullname); |
---|
| 4412 | + java.io.ObjectInputStream p = new java.io.ObjectInputStream(istream); |
---|
| 4413 | + |
---|
| 4414 | + readobj = (Object3D) p.readObject(); |
---|
| 4415 | + istream.close(); |
---|
| 4416 | + |
---|
| 4417 | + readobj.ResetDisplayList(); |
---|
| 4418 | + } catch (Exception e2) |
---|
| 4419 | + { |
---|
| 4420 | + e2.printStackTrace(); |
---|
| 4421 | + } |
---|
4087 | 4422 | } |
---|
4088 | 4423 | // catch(java.io.StreamCorruptedException e) { e.printStackTrace(); } |
---|
4089 | 4424 | // catch(java.io.IOException e) { System.out.println("IOexception"); e.printStackTrace(); } |
---|
.. | .. |
---|
4129 | 4464 | |
---|
4130 | 4465 | void LoadIt(Object obj) |
---|
4131 | 4466 | { |
---|
| 4467 | + if (obj == null) |
---|
| 4468 | + { |
---|
| 4469 | + // Invalid file |
---|
| 4470 | + return; |
---|
| 4471 | + } |
---|
| 4472 | + |
---|
4132 | 4473 | System.out.println("Loaded " + obj); |
---|
4133 | 4474 | //new Exception().printStackTrace(); |
---|
4134 | 4475 | Object3D readobj = (Object3D) obj; |
---|
.. | .. |
---|
4138 | 4479 | |
---|
4139 | 4480 | if (readobj != null) |
---|
4140 | 4481 | { |
---|
| 4482 | + Save(); |
---|
4141 | 4483 | try |
---|
4142 | 4484 | { |
---|
4143 | 4485 | //readobj.deepCopySelf(copy); |
---|
.. | .. |
---|
4200 | 4542 | |
---|
4201 | 4543 | void load() // throws ClassNotFoundException |
---|
4202 | 4544 | { |
---|
4203 | | - if (GrafreeD.standAlone) |
---|
| 4545 | + if (Grafreed.standAlone) |
---|
4204 | 4546 | { |
---|
4205 | 4547 | FileDialog browser = new FileDialog(frame, "Load", FileDialog.LOAD); |
---|
4206 | 4548 | browser.show(); |
---|
.. | .. |
---|
4287 | 4629 | try |
---|
4288 | 4630 | { |
---|
4289 | 4631 | FileOutputStream ostream = new FileOutputStream(lastname); |
---|
4290 | | - ObjectOutputStream p = new ObjectOutputStream(ostream); |
---|
| 4632 | + java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream); |
---|
| 4633 | + ObjectOutputStream p = new ObjectOutputStream(zstream); |
---|
4291 | 4634 | |
---|
4292 | 4635 | p.writeObject(copy); |
---|
4293 | 4636 | p.flush(); |
---|
4294 | 4637 | |
---|
| 4638 | + zstream.close(); |
---|
4295 | 4639 | ostream.close(); |
---|
4296 | 4640 | |
---|
4297 | 4641 | //FileOutputStream fos = new FileOutputStream(fullname); |
---|
.. | .. |
---|
4301 | 4645 | { |
---|
4302 | 4646 | } |
---|
4303 | 4647 | } |
---|
| 4648 | + |
---|
4304 | 4649 | String lastname; |
---|
4305 | 4650 | |
---|
4306 | 4651 | void saveAs() |
---|
4307 | 4652 | { |
---|
4308 | | - if (GrafreeD.standAlone) |
---|
| 4653 | + if (Grafreed.standAlone) |
---|
4309 | 4654 | { |
---|
4310 | 4655 | FileDialog browser = new FileDialog(frame, "Save As", FileDialog.SAVE); |
---|
4311 | 4656 | browser.setVisible(true); |
---|
.. | .. |
---|
4410 | 4755 | try |
---|
4411 | 4756 | { |
---|
4412 | 4757 | FileOutputStream ostream = new FileOutputStream(filename); |
---|
4413 | | - // ?? java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream); |
---|
4414 | | - ObjectOutputStream p = new ObjectOutputStream(/*z*/ostream); |
---|
| 4758 | + java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream); |
---|
| 4759 | + ObjectOutputStream p = new ObjectOutputStream(zstream); |
---|
4415 | 4760 | |
---|
4416 | 4761 | Object3D objectparent = obj.parent; |
---|
4417 | 4762 | obj.parent = null; |
---|
4418 | 4763 | |
---|
4419 | | - Object3D object = (Object3D) GrafreeD.clone(obj); |
---|
| 4764 | + Object3D object = (Object3D) Grafreed.clone(obj); |
---|
4420 | 4765 | |
---|
4421 | 4766 | obj.parent = objectparent; |
---|
4422 | 4767 | |
---|
.. | .. |
---|
4428 | 4773 | p.writeObject(object); |
---|
4429 | 4774 | p.flush(); |
---|
4430 | 4775 | |
---|
| 4776 | + zstream.close(); |
---|
4431 | 4777 | ostream.close(); |
---|
4432 | | - // zstream.close(); |
---|
4433 | 4778 | |
---|
4434 | 4779 | // group.selection.get(0).parent = parent; |
---|
4435 | 4780 | //FileOutputStream fos = new FileOutputStream(fullname); |
---|
.. | .. |
---|
4450 | 4795 | buffer.append("background { color rgb <0.8,0.8,0.8> }\n\n"); |
---|
4451 | 4796 | cameraView.renderCamera.generatePOV(buffer, bnds.width, bnds.height); |
---|
4452 | 4797 | copy.generatePOV(buffer); |
---|
4453 | | - if (GrafreeD.standAlone) |
---|
| 4798 | + if (Grafreed.standAlone) |
---|
4454 | 4799 | { |
---|
4455 | 4800 | FileDialog browser = new FileDialog(frame, "Export POV", 1); |
---|
4456 | 4801 | browser.show(); |
---|
.. | .. |
---|
4476 | 4821 | Object3D client; |
---|
4477 | 4822 | Object3D copy; |
---|
4478 | 4823 | MenuBar menuBar; |
---|
4479 | | - Menu windowMenu; |
---|
| 4824 | + Menu fileMenu; |
---|
| 4825 | + MenuItem newItem; |
---|
4480 | 4826 | MenuItem loadItem; |
---|
4481 | 4827 | MenuItem saveItem; |
---|
4482 | 4828 | MenuItem saveAsItem; |
---|
.. | .. |
---|
4484 | 4830 | MenuItem reexportItem; |
---|
4485 | 4831 | MenuItem povItem; |
---|
4486 | 4832 | MenuItem closeItem; |
---|
4487 | | - Menu cameraMenu; |
---|
| 4833 | + |
---|
4488 | 4834 | CheckboxMenuItem zBufferItem; |
---|
4489 | 4835 | //MenuItem normalLensItem; |
---|
4490 | | - MenuItem editCameraItem; |
---|
4491 | | - MenuItem revertCameraItem; |
---|
4492 | 4836 | MenuItem stepItem; |
---|
4493 | 4837 | CheckboxMenuItem toggleLiveItem; |
---|
4494 | 4838 | CheckboxMenuItem toggleFullScreenItem; |
---|
.. | .. |
---|
4636 | 4980 | //ObjectUI parent; |
---|
4637 | 4981 | |
---|
4638 | 4982 | cNumberSlider normalpushField; |
---|
| 4983 | + |
---|
| 4984 | + private MenuItem importGFDItem; |
---|
| 4985 | + private MenuItem importVRMLX3DItem; |
---|
| 4986 | + private MenuItem import3DSItem; |
---|
| 4987 | + private MenuItem importOBJItem; |
---|
4639 | 4988 | } |
---|