.. | .. |
---|
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.*; |
---|
.. | .. |
---|
13 | 14 | import javax.swing.plaf.metal.MetalLookAndFeel; |
---|
14 | 15 | //import javax.swing.plaf.ColorUIResource; |
---|
15 | 16 | //import javax.swing.plaf.metal.DefaultMetalTheme; |
---|
| 17 | + |
---|
| 18 | +import javax.swing.plaf.basic.BasicSplitPaneDivider; |
---|
| 19 | +import javax.swing.plaf.basic.BasicSplitPaneUI; |
---|
16 | 20 | |
---|
17 | 21 | //import javax.media.opengl.GLCanvas; |
---|
18 | 22 | |
---|
.. | .. |
---|
35 | 39 | |
---|
36 | 40 | GroupEditor callee; |
---|
37 | 41 | JFrame frame; |
---|
| 42 | + |
---|
| 43 | + static ObjEditor theFrame; |
---|
| 44 | + |
---|
| 45 | + cButton GetButton(String name, boolean border) |
---|
| 46 | + { |
---|
| 47 | + ImageIcon icon = GetIcon(name); |
---|
| 48 | + return new cButton(icon, border); |
---|
| 49 | + } |
---|
| 50 | + |
---|
| 51 | + cToggleButton GetToggleButton(String name, boolean border) |
---|
| 52 | + { |
---|
| 53 | + ImageIcon icon = GetIcon(name); |
---|
| 54 | + return new cToggleButton(icon, border); |
---|
| 55 | + } |
---|
| 56 | + |
---|
| 57 | + cCheckBox GetCheckBox(String name, boolean border) |
---|
| 58 | + { |
---|
| 59 | + ImageIcon icon = GetIcon(name); |
---|
| 60 | + return new cCheckBox(icon, border); |
---|
| 61 | + } |
---|
| 62 | + |
---|
| 63 | + private ImageIcon GetIcon(String name) |
---|
| 64 | + { |
---|
| 65 | + try |
---|
| 66 | + { |
---|
| 67 | + BufferedImage image = javax.imageio.ImageIO.read(getClass().getClassLoader().getResourceAsStream(name)); |
---|
| 68 | + |
---|
| 69 | + if (image.getWidth() != 24 && image.getHeight() != 24) |
---|
| 70 | + { |
---|
| 71 | + BufferedImage resized = new BufferedImage(24, 24, image.getType()); |
---|
| 72 | + Graphics2D g = resized.createGraphics(); |
---|
| 73 | + g.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR); |
---|
| 74 | + //g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); |
---|
| 75 | + g.drawImage(image, 0, 0, 24, 24, 0, 0, image.getWidth(), image.getHeight(), null); |
---|
| 76 | + g.dispose(); |
---|
| 77 | + |
---|
| 78 | + image = resized; |
---|
| 79 | + } |
---|
| 80 | + |
---|
| 81 | + javax.swing.ImageIcon icon = new javax.swing.ImageIcon(image); |
---|
| 82 | + return icon; |
---|
| 83 | + } |
---|
| 84 | + catch (Exception e) |
---|
| 85 | + { |
---|
| 86 | + return null; |
---|
| 87 | + } |
---|
| 88 | + } |
---|
38 | 89 | |
---|
39 | 90 | // SCRIPT |
---|
40 | 91 | |
---|
.. | .. |
---|
145 | 196 | |
---|
146 | 197 | objEditor.ctrlPanel.remove(namePanel); |
---|
147 | 198 | |
---|
148 | | - if (!GroupEditor.allparams) |
---|
| 199 | + if (!allparams) |
---|
149 | 200 | return; |
---|
150 | 201 | |
---|
151 | 202 | // objEditor.ctrlPanel.remove(liveCB); |
---|
.. | .. |
---|
168 | 219 | // objEditor.ctrlPanel.remove(remarkButton); |
---|
169 | 220 | |
---|
170 | 221 | objEditor.ctrlPanel.remove(setupPanel); |
---|
171 | | - objEditor.ctrlPanel.remove(commandsPanel); |
---|
| 222 | + objEditor.ctrlPanel.remove(setupPanel2); |
---|
| 223 | + objEditor.ctrlPanel.remove(objectCommandsPanel); |
---|
172 | 224 | objEditor.ctrlPanel.remove(pushPanel); |
---|
173 | 225 | //objEditor.ctrlPanel.remove(fillPanel); |
---|
174 | 226 | |
---|
.. | .. |
---|
216 | 268 | client = inClient; |
---|
217 | 269 | copy = client; |
---|
218 | 270 | |
---|
| 271 | + if (copy.versions == null) |
---|
| 272 | + { |
---|
| 273 | + copy.versions = new byte[100][]; |
---|
| 274 | + copy.versionindex = -1; |
---|
| 275 | + } |
---|
| 276 | + |
---|
219 | 277 | // "this" is not called: SetupUI2(objEditor); |
---|
220 | 278 | } |
---|
221 | 279 | |
---|
.. | .. |
---|
229 | 287 | client = inClient; |
---|
230 | 288 | copy = client; |
---|
231 | 289 | |
---|
| 290 | + if (copy.versions == null) |
---|
| 291 | + { |
---|
| 292 | + copy.versions = new byte[100][]; |
---|
| 293 | + copy.versionindex = -1; |
---|
| 294 | + } |
---|
| 295 | + |
---|
232 | 296 | SetupUI2(callee.GetEditor()); |
---|
233 | 297 | } |
---|
234 | 298 | |
---|
.. | .. |
---|
243 | 307 | //localCopy.parent = null; |
---|
244 | 308 | |
---|
245 | 309 | frame = new JFrame(); |
---|
| 310 | + frame.setUndecorated(false); |
---|
246 | 311 | objEditor = this; |
---|
247 | 312 | this.callee = callee; |
---|
248 | 313 | |
---|
.. | .. |
---|
260 | 325 | copy = localCopy; |
---|
261 | 326 | copy.editWindow = this; |
---|
262 | 327 | |
---|
| 328 | + if (copy.versions == null) |
---|
| 329 | + { |
---|
| 330 | +// copy.versions = new byte[100][]; |
---|
| 331 | +// copy.versionindex = -1; |
---|
| 332 | + } |
---|
| 333 | + |
---|
263 | 334 | SetupMenu(); |
---|
264 | 335 | |
---|
265 | 336 | //SetupName(objEditor); // new |
---|
.. | .. |
---|
273 | 344 | return frame.action(event, obj); |
---|
274 | 345 | } |
---|
275 | 346 | |
---|
| 347 | + // Cannot work without static |
---|
| 348 | + static boolean allparams = true; |
---|
| 349 | + |
---|
| 350 | + static java.util.Vector<Object3D> listUI = new java.util.Vector<Object3D>(); |
---|
| 351 | + |
---|
276 | 352 | void SetupMenu() |
---|
277 | 353 | { |
---|
278 | 354 | frame.setMenuBar(menuBar = new MenuBar()); |
---|
279 | 355 | menuBar.add(fileMenu = new Menu("File")); |
---|
280 | 356 | fileMenu.add(newItem = new MenuItem("New")); |
---|
281 | | - fileMenu.add(loadItem = new MenuItem("Load...")); |
---|
| 357 | + fileMenu.add(openItem = new MenuItem("Open...")); |
---|
282 | 358 | |
---|
283 | 359 | //oe.menuBar.add(menu = new Menu("Include")); |
---|
284 | 360 | Menu menu = new Menu("Import"); |
---|
.. | .. |
---|
310 | 386 | } |
---|
311 | 387 | |
---|
312 | 388 | newItem.addActionListener(this); |
---|
313 | | - loadItem.addActionListener(this); |
---|
| 389 | + openItem.addActionListener(this); |
---|
314 | 390 | saveItem.addActionListener(this); |
---|
315 | 391 | saveAsItem.addActionListener(this); |
---|
316 | 392 | exportAsItem.addActionListener(this); |
---|
.. | .. |
---|
319 | 395 | closeItem.addActionListener(this); |
---|
320 | 396 | |
---|
321 | 397 | objectPanel = new JTabbedPane(); |
---|
| 398 | + |
---|
| 399 | + ChangeListener changeListener = new ChangeListener() |
---|
| 400 | + { |
---|
| 401 | + public void stateChanged(ChangeEvent changeEvent) |
---|
| 402 | + { |
---|
| 403 | +// if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Material") && !materialFlushed) |
---|
| 404 | +// { |
---|
| 405 | +// if (latestObject != null) |
---|
| 406 | +// { |
---|
| 407 | +// refreshContents(true); |
---|
| 408 | +// SetMaterial(latestObject); |
---|
| 409 | +// } |
---|
| 410 | +// |
---|
| 411 | +// materialFlushed = true; |
---|
| 412 | +// } |
---|
| 413 | +// if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Edit")) |
---|
| 414 | +// { |
---|
| 415 | +// if (listUI.size() == 0) |
---|
| 416 | +// EditSelection(false); |
---|
| 417 | +// } |
---|
| 418 | + |
---|
| 419 | + refreshContents(false); // To refresh Info tab |
---|
| 420 | + } |
---|
| 421 | + }; |
---|
| 422 | + objectPanel.addChangeListener(changeListener); |
---|
| 423 | + |
---|
322 | 424 | toolbarPanel = new JPanel(); |
---|
323 | 425 | toolbarPanel.setName("Toolbar"); |
---|
| 426 | + |
---|
324 | 427 | treePanel = new cGridBag(); |
---|
325 | 428 | treePanel.setName("Tree"); |
---|
| 429 | + |
---|
| 430 | + editPanel = new cGridBag().setVertical(true); |
---|
| 431 | + //editPanel.setName("Edit"); |
---|
| 432 | + |
---|
326 | 433 | ctrlPanel = new cGridBag().setVertical(false); // new GridBagLayout()); |
---|
327 | | - ctrlPanel.setName("Edit"); |
---|
| 434 | + |
---|
| 435 | + editCommandsPanel = new cGridBag(); |
---|
| 436 | + editPanel.add(editCommandsPanel); |
---|
| 437 | + editPanel.add(ctrlPanel); |
---|
| 438 | + |
---|
| 439 | + toolboxPanel = new cGridBag().setVertical(false); |
---|
| 440 | + //toolboxPanel.setName("Toolbox"); |
---|
| 441 | + |
---|
328 | 442 | materialPanel = new cGridBag().setVertical(true); |
---|
329 | | - materialPanel.setName("Material"); |
---|
| 443 | + //materialPanel.setName("Material"); |
---|
| 444 | + |
---|
330 | 445 | /*JTextPane*/ |
---|
331 | 446 | infoarea = createTextPane(); |
---|
332 | 447 | doc = infoarea.getStyledDocument(); |
---|
333 | 448 | |
---|
334 | 449 | infoarea.setEditable(true); |
---|
335 | 450 | SetText(); |
---|
| 451 | + |
---|
336 | 452 | // infoarea.setFont(infoarea.getFont().deriveFont(10, 14f)); |
---|
337 | 453 | // infoarea.setOpaque(false); |
---|
338 | 454 | // //infoarea.setForeground(textcolor); |
---|
339 | 455 | // TEXTAREA infoarea.setLineWrap(true); |
---|
340 | 456 | // TEXTAREA infoarea.setWrapStyleWord(true); |
---|
341 | 457 | infoPanel = new JScrollPane(infoarea, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); //AS_NEEDED); |
---|
342 | | - infoPanel.setPreferredSize(new Dimension(50, 200)); |
---|
343 | | - infoPanel.setName("Info"); |
---|
| 458 | + infoPanel.setPreferredSize(new Dimension(1, 1)); |
---|
| 459 | + //infoPanel.setName("Info"); |
---|
344 | 460 | //infoPanel.setLayout(new BorderLayout()); |
---|
345 | 461 | //infoPanel.add(createTextPane()); |
---|
346 | 462 | |
---|
.. | .. |
---|
351 | 467 | mainPanel.setDividerSize(9); |
---|
352 | 468 | mainPanel.setDividerLocation(0.5); //1.0); |
---|
353 | 469 | mainPanel.setResizeWeight(0.5); |
---|
354 | | - |
---|
| 470 | + |
---|
| 471 | +//mainPanel.setDividerSize((int) (mainPanel.getDividerSize() * 1.5)); |
---|
| 472 | + BasicSplitPaneDivider divider = ( (BasicSplitPaneUI) mainPanel.getUI()).getDivider(); |
---|
| 473 | + divider.setDividerSize(15); |
---|
| 474 | + divider.setBorder(BorderFactory.createTitledBorder(divider.getBorder(), "Custom border title -- gets rid of the one-touch arrows!")); |
---|
| 475 | + |
---|
| 476 | + mainPanel.setUI(new BasicSplitPaneUI()); |
---|
| 477 | + |
---|
355 | 478 | //ctrlPanel.setLayout(new GridLayout(4, 1, 5, 5)); |
---|
356 | 479 | //mainPanel.setLayout(new GridBagLayout()); |
---|
357 | 480 | toolbarPanel.setLayout(new FlowLayout(FlowLayout.LEFT)); |
---|
.. | .. |
---|
419 | 542 | e.printStackTrace(); |
---|
420 | 543 | } |
---|
421 | 544 | |
---|
422 | | - String selection = infoarea.getText(); |
---|
423 | | - java.awt.datatransfer.StringSelection data = new java.awt.datatransfer.StringSelection(selection); |
---|
424 | | - java.awt.datatransfer.Clipboard clipboard = |
---|
425 | | - Toolkit.getDefaultToolkit().getSystemClipboard(); |
---|
| 545 | +// String selection = infoarea.getText(); |
---|
| 546 | +// java.awt.datatransfer.StringSelection data = new java.awt.datatransfer.StringSelection(selection); |
---|
| 547 | +// java.awt.datatransfer.Clipboard clipboard = |
---|
| 548 | +// Toolkit.getDefaultToolkit().getSystemClipboard(); |
---|
426 | 549 | //clipboard.setContents(data, data); |
---|
427 | 550 | } |
---|
428 | 551 | |
---|
.. | .. |
---|
582 | 705 | } |
---|
583 | 706 | } |
---|
584 | 707 | |
---|
| 708 | +//static GraphicsDevice device = GraphicsEnvironment |
---|
| 709 | +// .getLocalGraphicsEnvironment().getScreenDevices()[0]; |
---|
| 710 | + |
---|
| 711 | + Rectangle keeprect; |
---|
| 712 | + cRadio radio; |
---|
| 713 | + |
---|
| 714 | +cButton keepButton; |
---|
| 715 | + cButton twoButton; // Full 3D |
---|
| 716 | + cButton sixButton; |
---|
| 717 | + cButton threeButton; |
---|
| 718 | + cButton sevenButton; |
---|
| 719 | + cButton fourButton; // full panel |
---|
| 720 | + cButton oneButton; // full XYZ |
---|
| 721 | + //cButton currentLayout; |
---|
| 722 | + |
---|
| 723 | + boolean maximized; |
---|
| 724 | + |
---|
| 725 | + cButton fullscreenLayout; |
---|
| 726 | + |
---|
| 727 | + void Minimize() |
---|
| 728 | + { |
---|
| 729 | + frame.setState(Frame.ICONIFIED); |
---|
| 730 | + frame.validate(); |
---|
| 731 | + } |
---|
| 732 | + |
---|
| 733 | +// artifactURI=null, type=0, property=${file.reference.jfxrt.jar}, object=org.netbeans.modules.java.api.common.classpath.ClassPathSupport$RelativePath@6767876f, broken=false, additional={} |
---|
| 734 | +// artifactURI=null, type=0, property=${file.reference.mac-ui.jar}, object=org.netbeans.modules.java.api.common.classpath.ClassPathSupport$RelativePath@16bdc817, broken=false, additional={} |
---|
| 735 | +// artifactURI=null, type=0, property=${file.reference.classes.jar}, object=org.netbeans.modules.java.api.common.classpath.ClassPathSupport$RelativePath@9daa9c17, broken=false, additional={} |
---|
| 736 | + void Maximize() |
---|
| 737 | + { |
---|
| 738 | + if (CameraPane.FULLSCREEN) |
---|
| 739 | + { |
---|
| 740 | + ToggleFullScreen(); |
---|
| 741 | + } |
---|
| 742 | + |
---|
| 743 | + if (maximized) |
---|
| 744 | + { |
---|
| 745 | + frame.setBounds(keeprect.x, keeprect.y, keeprect.width, keeprect.height); |
---|
| 746 | + } |
---|
| 747 | + else |
---|
| 748 | + { |
---|
| 749 | + keeprect = frame.getBounds(); |
---|
| 750 | +// Rectangle rect = GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds(); |
---|
| 751 | +// Dimension rect2 = frame.getToolkit().getScreenSize(); |
---|
| 752 | +// frame.setBounds(0, rect2.height - rect.height, rect.width, rect.height); |
---|
| 753 | +// frame.setState(Frame.MAXIMIZED_BOTH); |
---|
| 754 | + frame.setBounds(frame.getGraphicsConfiguration().getBounds()); |
---|
| 755 | + } |
---|
| 756 | + |
---|
| 757 | + maximized ^= true; |
---|
| 758 | + |
---|
| 759 | + frame.validate(); |
---|
| 760 | + } |
---|
| 761 | + |
---|
| 762 | + cButton minButton; |
---|
| 763 | + cButton maxButton; |
---|
| 764 | + cButton fullButton; |
---|
| 765 | + |
---|
585 | 766 | void ToggleFullScreen() |
---|
586 | 767 | { |
---|
587 | | - if (CameraPane.FULLSCREEN) |
---|
| 768 | +GraphicsDevice device = frame.getGraphicsConfiguration().getDevice(); |
---|
| 769 | + |
---|
| 770 | + cameraView.ToggleFullScreen(); |
---|
| 771 | + |
---|
| 772 | + if (!CameraPane.FULLSCREEN) |
---|
588 | 773 | { |
---|
589 | | - frame.getContentPane().remove(/*"Center",*/bigThree); |
---|
590 | | - framePanel.add(bigThree); |
---|
591 | | - frame.getContentPane().add(/*"Center",*/framePanel); |
---|
| 774 | + device.setFullScreenWindow(null); |
---|
| 775 | + frame.dispose(); |
---|
| 776 | + frame.setUndecorated(false); |
---|
| 777 | + frame.validate(); |
---|
| 778 | + frame.setVisible(true); |
---|
| 779 | + |
---|
| 780 | + //frame.setVisible(false); |
---|
| 781 | +// frame.removeNotify(); |
---|
| 782 | +// frame.setUndecorated(false); |
---|
| 783 | +// frame.addNotify(); |
---|
| 784 | + //frame.setBounds(keeprect.x, keeprect.y, keeprect.width, keeprect.height); |
---|
| 785 | + |
---|
| 786 | +// X frame.getContentPane().remove(/*"Center",*/bigThree); |
---|
| 787 | +// X framePanel.add(bigThree); |
---|
| 788 | +// X frame.getContentPane().add(/*"Center",*/framePanel); |
---|
| 789 | + framePanel.setDividerLocation(46); |
---|
| 790 | + |
---|
| 791 | + //frame.setVisible(true); |
---|
| 792 | + radio.layout = keepButton; |
---|
| 793 | + //theFrame = null; |
---|
| 794 | + keepButton = null; |
---|
| 795 | + radio.layout.doClick(); |
---|
| 796 | + |
---|
592 | 797 | } else |
---|
593 | 798 | { |
---|
594 | | - frame.getContentPane().remove(/*"Center",*/framePanel); |
---|
595 | | - framePanel.remove(bigThree); |
---|
596 | | - frame.getContentPane().add(/*"Center",*/bigThree); |
---|
| 799 | + keepButton = radio.layout; |
---|
| 800 | + //keeprect = frame.getBounds(); |
---|
| 801 | +// frame.setBounds(0, 0, frame.getToolkit().getScreenSize().width, |
---|
| 802 | +// frame.getToolkit().getScreenSize().height); |
---|
| 803 | + //frame.setVisible(false); |
---|
| 804 | + |
---|
| 805 | + frame.dispose(); |
---|
| 806 | + frame.setUndecorated(true); |
---|
| 807 | + device.setFullScreenWindow(frame); |
---|
| 808 | + frame.validate(); |
---|
| 809 | + frame.setVisible(true); |
---|
| 810 | +// frame.removeNotify(); |
---|
| 811 | +// frame.setUndecorated(true); |
---|
| 812 | +// frame.addNotify(); |
---|
| 813 | +// X frame.getContentPane().remove(/*"Center",*/framePanel); |
---|
| 814 | +// X framePanel.remove(bigThree); |
---|
| 815 | +// X frame.getContentPane().add(/*"Center",*/bigThree); |
---|
| 816 | + framePanel.setDividerLocation(0); |
---|
| 817 | + |
---|
| 818 | + radio.layout = fullscreenLayout; |
---|
| 819 | + radio.layout.doClick(); |
---|
| 820 | + //frame.setVisible(true); |
---|
597 | 821 | } |
---|
598 | | - cameraView.ToggleFullScreen(); |
---|
| 822 | + frame.validate(); |
---|
599 | 823 | } |
---|
| 824 | + |
---|
| 825 | + private byte[] CompressCopy() |
---|
| 826 | + { |
---|
| 827 | + boolean temp = CameraPane.SWITCH; |
---|
| 828 | + CameraPane.SWITCH = false; |
---|
| 829 | + |
---|
| 830 | + copy.ExtractBigData(versiontable); |
---|
| 831 | + // if (copy == client) |
---|
| 832 | + |
---|
| 833 | + byte[] versions[] = copy.versions; |
---|
| 834 | + copy.versions = null; |
---|
| 835 | + |
---|
| 836 | + byte[] compress = Compress(copy); |
---|
| 837 | + |
---|
| 838 | + copy.versions = versions; |
---|
| 839 | + |
---|
| 840 | + copy.RestoreBigData(versiontable); |
---|
| 841 | + |
---|
| 842 | + CameraPane.SWITCH = temp; |
---|
| 843 | + |
---|
| 844 | + return compress; |
---|
| 845 | + } |
---|
600 | 846 | |
---|
601 | 847 | private JTextPane createTextPane() |
---|
602 | 848 | { |
---|
.. | .. |
---|
728 | 974 | // NumberSlider vDivsField; |
---|
729 | 975 | // JCheckBox endcaps; |
---|
730 | 976 | JCheckBox liveCB; |
---|
731 | | - JCheckBox selectCB; |
---|
| 977 | + JCheckBox selectableCB; |
---|
732 | 978 | JCheckBox hideCB; |
---|
733 | 979 | JCheckBox link2masterCB; |
---|
734 | 980 | JCheckBox markCB; |
---|
.. | .. |
---|
736 | 982 | JCheckBox speedupCB; |
---|
737 | 983 | JCheckBox rewindCB; |
---|
738 | 984 | JCheckBox flipVCB; |
---|
| 985 | + |
---|
| 986 | + cCheckBox toggleTextureCB; |
---|
| 987 | + cCheckBox toggleSwitchCB; |
---|
| 988 | + |
---|
739 | 989 | JComboBox texresMenu; |
---|
| 990 | + |
---|
740 | 991 | JButton resetButton; |
---|
741 | 992 | JButton stepButton; |
---|
742 | 993 | JButton stepAllButton; |
---|
.. | .. |
---|
745 | 996 | JButton fasterButton; |
---|
746 | 997 | JButton remarkButton; |
---|
747 | 998 | |
---|
| 999 | + cGridBag editPanel; |
---|
| 1000 | + cGridBag editCommandsPanel; |
---|
| 1001 | + |
---|
748 | 1002 | cGridBag namePanel; |
---|
749 | 1003 | cGridBag setupPanel; |
---|
750 | | - cGridBag commandsPanel; |
---|
| 1004 | + cGridBag setupPanel2; |
---|
| 1005 | + cGridBag objectCommandsPanel; |
---|
751 | 1006 | cGridBag pushPanel; |
---|
752 | 1007 | cGridBag fillPanel; |
---|
753 | 1008 | |
---|
.. | .. |
---|
919 | 1174 | namePanel = new cGridBag(); |
---|
920 | 1175 | |
---|
921 | 1176 | nameField = AddText(namePanel, copy.GetName()); |
---|
922 | | - namePanel.add(nameField); |
---|
| 1177 | + namePanel.add(new JScrollPane(nameField, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER)); |
---|
923 | 1178 | oe.ctrlPanel.add(namePanel); |
---|
924 | 1179 | |
---|
925 | 1180 | oe.ctrlPanel.Return(); |
---|
926 | 1181 | |
---|
927 | | - if (!GroupEditor.allparams) |
---|
| 1182 | + if (!allparams) |
---|
928 | 1183 | return; |
---|
929 | 1184 | |
---|
930 | 1185 | setupPanel = new cGridBag().setVertical(false); |
---|
931 | 1186 | |
---|
932 | 1187 | liveCB = AddCheckBox(setupPanel, "Live", copy.live); |
---|
933 | 1188 | liveCB.setToolTipText("Animate object"); |
---|
934 | | - selectCB = AddCheckBox(setupPanel, "Select", !copy.dontselect); |
---|
935 | | - selectCB.setToolTipText("Make object selectable"); |
---|
| 1189 | + selectableCB = AddCheckBox(setupPanel, "Select", !copy.dontselect); |
---|
| 1190 | + selectableCB.setToolTipText("Make object selectable"); |
---|
936 | 1191 | // Return(); |
---|
| 1192 | + |
---|
937 | 1193 | hideCB = AddCheckBox(setupPanel, "Hide", copy.hide); |
---|
938 | 1194 | hideCB.setToolTipText("Hide object"); |
---|
939 | 1195 | markCB = AddCheckBox(setupPanel, "Mark", copy.marked); |
---|
940 | | - markCB.setToolTipText("Set the animation target transform"); |
---|
| 1196 | + markCB.setToolTipText("As animation target transform"); |
---|
941 | 1197 | |
---|
942 | | - rewindCB = AddCheckBox(setupPanel, "Rewind", copy.rewind); |
---|
| 1198 | + setupPanel2 = new cGridBag().setVertical(false); |
---|
| 1199 | + |
---|
| 1200 | + rewindCB = AddCheckBox(setupPanel2, "Rewind", copy.rewind); |
---|
943 | 1201 | rewindCB.setToolTipText("Rewind animation"); |
---|
944 | 1202 | |
---|
945 | | - randomCB = AddCheckBox(setupPanel, "Random", copy.random); |
---|
946 | | - randomCB.setToolTipText("Option for switch node"); |
---|
| 1203 | + randomCB = AddCheckBox(setupPanel2, "Random", copy.random); |
---|
| 1204 | + randomCB.setToolTipText("Randomly Rewind (or Go back and forth)"); |
---|
947 | 1205 | |
---|
| 1206 | + link2masterCB = AddCheckBox(setupPanel2, "Support", copy.link2master); |
---|
| 1207 | + link2masterCB.setToolTipText("Attach to support"); |
---|
| 1208 | + |
---|
948 | 1209 | if (Globals.ADVANCED) |
---|
949 | 1210 | { |
---|
950 | | - link2masterCB = AddCheckBox(setupPanel, "Support", copy.link2master); |
---|
951 | | - link2masterCB.setToolTipText("Attach to support"); |
---|
952 | | - speedupCB = AddCheckBox(setupPanel, "Speed", copy.speedup); |
---|
| 1211 | + speedupCB = AddCheckBox(setupPanel2, "Speed", copy.speedup); |
---|
953 | 1212 | speedupCB.setToolTipText("Option motion capture"); |
---|
954 | 1213 | } |
---|
955 | 1214 | |
---|
956 | 1215 | oe.ctrlPanel.add(setupPanel); |
---|
957 | 1216 | oe.ctrlPanel.Return(); |
---|
| 1217 | + oe.ctrlPanel.add(setupPanel2); |
---|
| 1218 | + oe.ctrlPanel.Return(); |
---|
958 | 1219 | |
---|
959 | | - commandsPanel = new cGridBag().setVertical(false); |
---|
| 1220 | + objectCommandsPanel = new cGridBag().setVertical(false); |
---|
960 | 1221 | |
---|
961 | | - resetButton = AddButton(commandsPanel, "Reset"); |
---|
| 1222 | + resetButton = AddButton(objectCommandsPanel, "Reset"); |
---|
962 | 1223 | resetButton.setToolTipText("Jump to frame zero"); |
---|
963 | | - stepButton = AddButton(commandsPanel, "Step"); |
---|
| 1224 | + stepButton = AddButton(objectCommandsPanel, "Step"); |
---|
964 | 1225 | stepButton.setToolTipText("Step one frame"); |
---|
965 | 1226 | // resetAllButton = AddButton(oe, "Reset All"); |
---|
966 | 1227 | // stepAllButton = AddButton(oe, "Step All"); |
---|
967 | 1228 | // Return(); |
---|
968 | | - slowerButton = AddButton(commandsPanel, "Slow"); |
---|
| 1229 | + slowerButton = AddButton(objectCommandsPanel, "Slow"); |
---|
969 | 1230 | slowerButton.setToolTipText("Decrease animation speed"); |
---|
970 | | - fasterButton = AddButton(commandsPanel, "Fast"); |
---|
| 1231 | + fasterButton = AddButton(objectCommandsPanel, "Fast"); |
---|
971 | 1232 | fasterButton.setToolTipText("Increase animation speed"); |
---|
972 | | - remarkButton = AddButton(commandsPanel, "Remark"); |
---|
| 1233 | + remarkButton = AddButton(objectCommandsPanel, "Remark"); |
---|
973 | 1234 | remarkButton.setToolTipText("Set the current transform as the target"); |
---|
974 | 1235 | |
---|
975 | | - oe.ctrlPanel.add(commandsPanel); |
---|
| 1236 | + oe.ctrlPanel.add(objectCommandsPanel); |
---|
976 | 1237 | oe.ctrlPanel.Return(); |
---|
977 | 1238 | |
---|
978 | 1239 | pushPanel = AddSlider(oe.ctrlPanel, "Push", -1, 1, copy.NORMALPUSH, 1.1); // To have the buttons |
---|
.. | .. |
---|
1178 | 1439 | //worldPanel.setName("World"); |
---|
1179 | 1440 | centralPanel = new cGridBag(); |
---|
1180 | 1441 | centralPanel.preferredWidth = 20; |
---|
1181 | | - timelinePanel = new JPanel(new BorderLayout()); |
---|
1182 | | - timelineMenubar = new timeflow.app.TimeflowApp().TimeFlowWindow(timelinePanel); |
---|
| 1442 | + |
---|
| 1443 | + if (Globals.ADVANCED) |
---|
| 1444 | + { |
---|
| 1445 | + timelinePanel = new JPanel(new BorderLayout()); |
---|
| 1446 | + timelineMenubar = new timeflow.app.TimeflowApp().TimeFlowWindow(timelinePanel); |
---|
1183 | 1447 | |
---|
1184 | 1448 | cameraPanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, cameraView, timelinePanel); |
---|
1185 | 1449 | cameraPanel.setContinuousLayout(true); |
---|
.. | .. |
---|
1188 | 1452 | // cameraPanel.setDividerSize(9); |
---|
1189 | 1453 | cameraPanel.setResizeWeight(1.0); |
---|
1190 | 1454 | |
---|
| 1455 | + } |
---|
| 1456 | + |
---|
1191 | 1457 | centralPanel.add(cameraView); |
---|
| 1458 | + centralPanel.setFocusable(true); |
---|
1192 | 1459 | //frame.setJMenuBar(timelineMenubar); |
---|
1193 | 1460 | //centralPanel.add(timelinePanel); |
---|
1194 | 1461 | |
---|
.. | .. |
---|
1214 | 1481 | XYZPanel.addComponent(/*BorderLayout.SOUTH,*/sideView); // Scroll); |
---|
1215 | 1482 | XYZPanel.addComponent(/*BorderLayout.CENTER,*/frontView); // Scroll); |
---|
1216 | 1483 | XYZPanel.addComponent(/*BorderLayout.NORTH,*/topView); // Scroll); |
---|
| 1484 | + //XYZPanel.setName("XYZ"); |
---|
1217 | 1485 | |
---|
1218 | 1486 | /* |
---|
1219 | 1487 | gridPanel = new JPanel(); //new BorderLayout()); |
---|
.. | .. |
---|
1251 | 1519 | //JScrollPane tmp = new JScrollPane(ctrlPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); |
---|
1252 | 1520 | //tmp.setName("Edit"); |
---|
1253 | 1521 | objectPanel.add(materialPanel); |
---|
| 1522 | + objectPanel.setIconAt(0, GetIcon("icons/material.png")); |
---|
1254 | 1523 | // JPanel north = new JPanel(new BorderLayout()); |
---|
1255 | 1524 | // north.setName("Edit"); |
---|
1256 | 1525 | // north.add(ctrlPanel, BorderLayout.NORTH); |
---|
1257 | 1526 | // objectPanel.add(north); |
---|
1258 | | - objectPanel.add(ctrlPanel); |
---|
1259 | | - objectPanel.add(infoPanel); |
---|
| 1527 | + objectPanel.add(editPanel); |
---|
| 1528 | + objectPanel.setIconAt(1, GetIcon("icons/write.png")); |
---|
| 1529 | + |
---|
| 1530 | + //if (Globals.ADVANCED) |
---|
| 1531 | + objectPanel.add(infoPanel); |
---|
| 1532 | + objectPanel.setIconAt(2, GetIcon("icons/info.png")); |
---|
| 1533 | + |
---|
| 1534 | + objectPanel.add(XYZPanel); |
---|
| 1535 | + objectPanel.setIconAt(3, GetIcon("icons/XYZ.png")); |
---|
| 1536 | + |
---|
| 1537 | + objectPanel.add(toolboxPanel); |
---|
| 1538 | + objectPanel.setIconAt(4, GetIcon("icons/primitives.png")); |
---|
1260 | 1539 | |
---|
1261 | 1540 | /* |
---|
1262 | 1541 | aConstraints.gridx = 0; |
---|
.. | .. |
---|
1265 | 1544 | aConstraints.gridy += 1; |
---|
1266 | 1545 | aConstraints.gridwidth = 1; |
---|
1267 | 1546 | mainPanel.add(objectPanel, aConstraints); |
---|
1268 | | - */ |
---|
| 1547 | + */ |
---|
1269 | 1548 | |
---|
1270 | 1549 | scrollpane = new JScrollPane(mainPanel, ScrollPaneConstants.// VERTICAL_SCROLLBAR_ALWAYS, |
---|
1271 | 1550 | VERTICAL_SCROLLBAR_AS_NEEDED, |
---|
.. | .. |
---|
1277 | 1556 | scrollpane.addMouseWheelListener(this); // Default not fast enough |
---|
1278 | 1557 | |
---|
1279 | 1558 | /*JTabbedPane*/ scenePanel = new cGridBag(); |
---|
1280 | | - scenePanel.preferredWidth = 6; |
---|
| 1559 | + scenePanel.preferredWidth = 5; |
---|
1281 | 1560 | |
---|
1282 | 1561 | JTabbedPane tabbedPane = new JTabbedPane(); |
---|
1283 | 1562 | tabbedPane.add(scrollpane); |
---|
1284 | 1563 | |
---|
1285 | | - tabbedPane.add(FSPane = new cFileSystemPane(this)); |
---|
1286 | | - |
---|
1287 | | - optionsPanel = new cGridBag().setVertical(true); |
---|
| 1564 | + optionsPanel = new cGridBag().setVertical(false); |
---|
1288 | 1565 | |
---|
1289 | 1566 | optionsPanel.setName("Options"); |
---|
1290 | 1567 | |
---|
.. | .. |
---|
1292 | 1569 | |
---|
1293 | 1570 | tabbedPane.add(optionsPanel); |
---|
1294 | 1571 | |
---|
| 1572 | + tabbedPane.add(FSPane = new cFileSystemPane(this)); |
---|
| 1573 | + |
---|
1295 | 1574 | scenePanel.add(tabbedPane); |
---|
1296 | 1575 | |
---|
1297 | 1576 | /* |
---|
.. | .. |
---|
1353 | 1632 | /**/ |
---|
1354 | 1633 | |
---|
1355 | 1634 | bigThree = new cGridBag(); |
---|
1356 | | - bigThree.addComponent(scenePanel); |
---|
1357 | 1635 | bigThree.addComponent(centralPanel); |
---|
1358 | | - bigThree.addComponent(XYZPanel); |
---|
| 1636 | + bigThree.addComponent(scenePanel); |
---|
| 1637 | + //bigThree.addComponent(XYZPanel); |
---|
1359 | 1638 | |
---|
1360 | 1639 | // // SIDE EFFECT!!! |
---|
1361 | 1640 | // aConstraints.gridx = 0; |
---|
.. | .. |
---|
1364 | 1643 | // aConstraints.gridheight = 1; |
---|
1365 | 1644 | |
---|
1366 | 1645 | framePanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, toolbarPanel, bigThree); |
---|
1367 | | - framePanel.setContinuousLayout(true); |
---|
1368 | | - framePanel.setOneTouchExpandable(true); |
---|
1369 | | - framePanel.setDividerLocation(0.8); |
---|
| 1646 | + framePanel.setContinuousLayout(false); |
---|
| 1647 | + framePanel.setOneTouchExpandable(false); |
---|
| 1648 | + //.setDividerLocation(0.8); |
---|
1370 | 1649 | //framePanel.setDividerSize(15); |
---|
1371 | 1650 | //framePanel.setResizeWeight(0.15); |
---|
1372 | 1651 | framePanel.setName("Frame"); |
---|
.. | .. |
---|
1384 | 1663 | // aConstraints = gbc; // (GridBagConstraints) GrafreeD.clone(gbc); |
---|
1385 | 1664 | |
---|
1386 | 1665 | frame.setSize(1280, 860); |
---|
1387 | | - frame.setVisible(true); |
---|
1388 | | - |
---|
| 1666 | + |
---|
| 1667 | + cameraView.requestFocusInWindow(); |
---|
| 1668 | + |
---|
1389 | 1669 | gridPanel.setDividerLocation(1.0); |
---|
| 1670 | + |
---|
| 1671 | + frame.validate(); |
---|
| 1672 | + |
---|
| 1673 | + frame.setVisible(true); |
---|
1390 | 1674 | |
---|
1391 | 1675 | frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); |
---|
1392 | 1676 | frame.addWindowListener(new WindowAdapter() |
---|
.. | .. |
---|
1473 | 1757 | texture.add(textureField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
1474 | 1758 | colorSection.add(texture); |
---|
1475 | 1759 | |
---|
1476 | | - cGridBag anisoU = new cGridBag(); |
---|
1477 | | - anisoU.add(anisoLabel = new JLabel("AnisoU")); // , aConstraints); |
---|
1478 | | - anisoLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1479 | | - anisoU.add(anisoField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
1480 | | - colorSection.add(anisoU); |
---|
1481 | | - |
---|
1482 | | - cGridBag anisoV = new cGridBag(); |
---|
1483 | | - anisoV.add(anisoVLabel = new JLabel("AnisoV")); // , aConstraints); |
---|
1484 | | - anisoVLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1485 | | - anisoV.add(anisoVField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
1486 | | - colorSection.add(anisoV); |
---|
1487 | | - |
---|
1488 | | - cGridBag shadowbias = new cGridBag(); |
---|
1489 | | - shadowbias.add(shadowbiasLabel = new JLabel("Shadowbias")); // , aConstraints); |
---|
1490 | | - shadowbiasLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1491 | | - shadowbias.add(shadowbiasField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
1492 | | - colorSection.add(shadowbias); |
---|
1493 | | - |
---|
1494 | 1760 | panel.add(new JSeparator()); |
---|
1495 | 1761 | |
---|
1496 | 1762 | panel.add(colorSection); |
---|
.. | .. |
---|
1540 | 1806 | fakedepthLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1541 | 1807 | fakedepth.add(fakedepthField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
1542 | 1808 | diffuseSection.add(fakedepth); |
---|
| 1809 | + |
---|
| 1810 | + cGridBag shadowbias = new cGridBag(); |
---|
| 1811 | + shadowbias.add(shadowbiasLabel = new JLabel("Shadowbias")); // , aConstraints); |
---|
| 1812 | + shadowbiasLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 1813 | + shadowbias.add(shadowbiasField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
| 1814 | + diffuseSection.add(shadowbias); |
---|
1543 | 1815 | |
---|
1544 | 1816 | panel.add(new JSeparator()); |
---|
1545 | 1817 | |
---|
.. | .. |
---|
1591 | 1863 | // aConstraints.gridy += 1; |
---|
1592 | 1864 | // aConstraints.gridwidth = 1; |
---|
1593 | 1865 | |
---|
| 1866 | + cGridBag anisoU = new cGridBag(); |
---|
| 1867 | + anisoU.add(anisoLabel = new JLabel("AnisoU")); // , aConstraints); |
---|
| 1868 | + anisoLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 1869 | + anisoU.add(anisoField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
| 1870 | + specularSection.add(anisoU); |
---|
| 1871 | + |
---|
| 1872 | + cGridBag anisoV = new cGridBag(); |
---|
| 1873 | + anisoV.add(anisoVLabel = new JLabel("AnisoV")); // , aConstraints); |
---|
| 1874 | + anisoVLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 1875 | + anisoV.add(anisoVField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
| 1876 | + specularSection.add(anisoV); |
---|
| 1877 | + |
---|
1594 | 1878 | |
---|
1595 | 1879 | panel.add(new JSeparator()); |
---|
1596 | 1880 | |
---|
.. | .. |
---|
1598 | 1882 | |
---|
1599 | 1883 | //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints); |
---|
1600 | 1884 | |
---|
1601 | | - cGridBag globalSection = new cGridBag().setVertical(true); |
---|
| 1885 | + //cGridBag globalSection = new cGridBag().setVertical(true); |
---|
1602 | 1886 | |
---|
1603 | 1887 | cGridBag camera = new cGridBag(); |
---|
1604 | 1888 | camera.add(cameraLabel = new JLabel("GlobalLight")); // , aConstraints); |
---|
1605 | 1889 | cameraLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1606 | 1890 | camera.add(cameraField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
1607 | | - globalSection.add(camera); |
---|
| 1891 | + colorSection.add(camera); |
---|
1608 | 1892 | |
---|
1609 | 1893 | cGridBag ambient = new cGridBag(); |
---|
1610 | 1894 | ambient.add(ambientLabel = new JLabel("Ambient")); // , aConstraints); |
---|
1611 | 1895 | ambientLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1612 | 1896 | ambient.add(ambientField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
1613 | | - globalSection.add(ambient); |
---|
| 1897 | + colorSection.add(ambient); |
---|
1614 | 1898 | |
---|
1615 | 1899 | cGridBag backlit = new cGridBag(); |
---|
1616 | 1900 | backlit.add(backlitLabel = new JLabel("Backlit")); // , aConstraints); |
---|
1617 | 1901 | backlitLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1618 | 1902 | backlit.add(backlitField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
1619 | | - globalSection.add(backlit); |
---|
| 1903 | + colorSection.add(backlit); |
---|
1620 | 1904 | |
---|
1621 | 1905 | cGridBag opacity = new cGridBag(); |
---|
1622 | 1906 | opacity.add(opacityLabel = new JLabel("Opacity")); // , aConstraints); |
---|
1623 | 1907 | opacityLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1624 | 1908 | opacity.add(opacityField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
1625 | | - globalSection.add(opacity); |
---|
| 1909 | + colorSection.add(opacity); |
---|
1626 | 1910 | |
---|
1627 | | - panel.add(new JSeparator()); |
---|
| 1911 | + //panel.add(new JSeparator()); |
---|
1628 | 1912 | |
---|
1629 | | - panel.add(globalSection); |
---|
| 1913 | + //panel.add(globalSection); |
---|
1630 | 1914 | |
---|
1631 | 1915 | //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints); |
---|
1632 | 1916 | |
---|
.. | .. |
---|
1733 | 2017 | // 3D models |
---|
1734 | 2018 | if (filename.endsWith(".3ds") || filename.endsWith(".3DS")) |
---|
1735 | 2019 | { |
---|
1736 | | - lastConverter = new com.jmex.model.converters.MaxToJme(); |
---|
1737 | | - LoadFile(filename, lastConverter); |
---|
| 2020 | + //lastConverter = new com.jmex.model.converters.MaxToJme(); |
---|
| 2021 | + //LoadFile(filename, lastConverter); |
---|
| 2022 | + LoadObjFile(filename); // New 3ds loader |
---|
1738 | 2023 | continue; |
---|
1739 | 2024 | } |
---|
1740 | 2025 | if (filename.endsWith(".dae") || filename.endsWith(".DAE")) |
---|
.. | .. |
---|
2072 | 2357 | |
---|
2073 | 2358 | void LoadObjFile(String fullname) |
---|
2074 | 2359 | { |
---|
2075 | | - /* |
---|
| 2360 | + System.out.println("Loading " + fullname); |
---|
| 2361 | + /**/ |
---|
2076 | 2362 | //lastFilename = fullname; |
---|
2077 | 2363 | if(loadObjThread == null) |
---|
2078 | 2364 | { |
---|
2079 | | - loadObjThread = new LoadOBJThread(); |
---|
2080 | | - loadObjThread.start(); |
---|
| 2365 | + loadObjThread = new LoadOBJThread(); |
---|
| 2366 | + loadObjThread.start(); |
---|
2081 | 2367 | } |
---|
2082 | 2368 | |
---|
2083 | 2369 | loadObjThread.add(fullname); |
---|
2084 | | - */ |
---|
| 2370 | + /**/ |
---|
2085 | 2371 | |
---|
2086 | | - System.out.println("Loading " + fullname); |
---|
2087 | | - makeSomething(new FileObject(fullname, true), true); |
---|
| 2372 | + //makeSomething(new FileObject(fullname, true), true); |
---|
2088 | 2373 | } |
---|
2089 | 2374 | |
---|
2090 | 2375 | void LoadGFDFile(String fullname) |
---|
.. | .. |
---|
2460 | 2745 | LA.matXRotate(((Object3D) group.get(group.size() - 1)).toParent, -Math.PI / 2); |
---|
2461 | 2746 | LA.matXRotate(((Object3D) group.get(group.size() - 1)).fromParent, Math.PI / 2); |
---|
2462 | 2747 | } |
---|
| 2748 | + |
---|
2463 | 2749 | //cJME.count++; |
---|
2464 | 2750 | //cJME.count %= 12; |
---|
2465 | 2751 | if (gc) |
---|
.. | .. |
---|
2643 | 2929 | } |
---|
2644 | 2930 | } |
---|
2645 | 2931 | } |
---|
| 2932 | + |
---|
2646 | 2933 | cFileSystemPane FSPane; |
---|
2647 | 2934 | |
---|
2648 | 2935 | void SetMaterial(cMaterial mat, Object3D.cVector2[] others) |
---|
.. | .. |
---|
2696 | 2983 | } |
---|
2697 | 2984 | } |
---|
2698 | 2985 | } |
---|
| 2986 | + |
---|
2699 | 2987 | freezematerial = false; |
---|
2700 | 2988 | } |
---|
2701 | 2989 | |
---|
2702 | 2990 | void SetMaterial(Object3D object) |
---|
2703 | 2991 | { |
---|
| 2992 | + latestObject = object; |
---|
| 2993 | + |
---|
2704 | 2994 | cMaterial mat = object.material; |
---|
2705 | 2995 | |
---|
2706 | 2996 | if (mat == null) |
---|
.. | .. |
---|
2812 | 3102 | // } |
---|
2813 | 3103 | |
---|
2814 | 3104 | /**/ |
---|
2815 | | - if (deselect) |
---|
| 3105 | + if (deselect || child == null) |
---|
2816 | 3106 | { |
---|
2817 | 3107 | //group.deselectAll(); |
---|
2818 | 3108 | //freeze = true; |
---|
2819 | 3109 | GetTree().clearSelection(); |
---|
2820 | 3110 | //freeze = false; |
---|
| 3111 | + |
---|
| 3112 | + if (child == null) |
---|
| 3113 | + { |
---|
| 3114 | + return; |
---|
| 3115 | + } |
---|
2821 | 3116 | } |
---|
2822 | 3117 | |
---|
2823 | 3118 | //group.addSelectee(child); |
---|
.. | .. |
---|
2886 | 3181 | cameraView.ToggleDL(); |
---|
2887 | 3182 | cameraView.repaint(); |
---|
2888 | 3183 | return; |
---|
2889 | | - } else if (event.getSource() == toggleTextureItem) |
---|
| 3184 | + } else if (event.getSource() == toggleTextureItem || event.getSource() == toggleTextureCB) |
---|
2890 | 3185 | { |
---|
2891 | 3186 | cameraView.ToggleTexture(); |
---|
2892 | 3187 | // june 2013 copy.HardTouch(); |
---|
.. | .. |
---|
2925 | 3220 | frame.validate(); |
---|
2926 | 3221 | |
---|
2927 | 3222 | return; |
---|
2928 | | - } else if (event.getSource() == toggleSwitchItem) |
---|
| 3223 | + } else if (event.getSource() == toggleSwitchItem || event.getSource() == toggleSwitchCB) |
---|
2929 | 3224 | { |
---|
2930 | | - cameraView.ToggleRandom(); |
---|
| 3225 | + cameraView.ToggleSwitch(); |
---|
2931 | 3226 | cameraView.repaint(); |
---|
2932 | 3227 | return; |
---|
2933 | 3228 | } else if (event.getSource() == toggleHandleItem) |
---|
.. | .. |
---|
2956 | 3251 | { |
---|
2957 | 3252 | copy.live ^= true; |
---|
2958 | 3253 | return; |
---|
2959 | | - } else if (event.getSource() == selectCB) |
---|
| 3254 | + } else if (event.getSource() == selectableCB) |
---|
2960 | 3255 | { |
---|
2961 | 3256 | copy.dontselect ^= true; |
---|
2962 | 3257 | return; |
---|
.. | .. |
---|
3141 | 3436 | { |
---|
3142 | 3437 | Close(); |
---|
3143 | 3438 | //return true; |
---|
3144 | | - } else if (source == loadItem) |
---|
| 3439 | + } else if (source == openItem) |
---|
3145 | 3440 | { |
---|
3146 | | - load(); |
---|
| 3441 | + Open(); |
---|
3147 | 3442 | //return true; |
---|
3148 | 3443 | } else if (source == newItem) |
---|
3149 | 3444 | { |
---|
.. | .. |
---|
3168 | 3463 | { |
---|
3169 | 3464 | generatePOV(); |
---|
3170 | 3465 | //return true; |
---|
| 3466 | + } else if (event.getSource() == archiveItem) |
---|
| 3467 | + { |
---|
| 3468 | + cTools.Archive(frame); |
---|
| 3469 | + return; |
---|
3171 | 3470 | } else if (source == zBufferItem) |
---|
3172 | 3471 | { |
---|
3173 | 3472 | try |
---|
.. | .. |
---|
3214 | 3513 | objEditor.refreshContents(); |
---|
3215 | 3514 | } |
---|
3216 | 3515 | |
---|
| 3516 | + static public byte[] Compress(Object3D o) |
---|
| 3517 | + { |
---|
| 3518 | + try |
---|
| 3519 | + { |
---|
| 3520 | + ByteArrayOutputStream baos = new ByteArrayOutputStream(); |
---|
| 3521 | +// java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(baos); |
---|
| 3522 | + ObjectOutputStream out = new ObjectOutputStream(baos); //zstream); |
---|
| 3523 | + |
---|
| 3524 | + Object3D parent = o.parent; |
---|
| 3525 | + o.parent = null; |
---|
| 3526 | + |
---|
| 3527 | + out.writeObject(o); |
---|
| 3528 | + |
---|
| 3529 | + o.parent = parent; |
---|
| 3530 | + |
---|
| 3531 | + out.flush(); |
---|
| 3532 | + |
---|
| 3533 | + baos //zstream |
---|
| 3534 | + .close(); |
---|
| 3535 | + out.close(); |
---|
| 3536 | + |
---|
| 3537 | + byte[] bytes = baos.toByteArray(); |
---|
| 3538 | + |
---|
| 3539 | + System.out.println("save #bytes = " + bytes.length); |
---|
| 3540 | + return bytes; |
---|
| 3541 | + } catch (Exception e) |
---|
| 3542 | + { |
---|
| 3543 | + System.err.println(e); |
---|
| 3544 | + return null; |
---|
| 3545 | + } |
---|
| 3546 | + } |
---|
| 3547 | + |
---|
| 3548 | + static public Object Uncompress(byte[] bytes) |
---|
| 3549 | + { |
---|
| 3550 | + System.out.println("restore #bytes = " + bytes.length); |
---|
| 3551 | + try |
---|
| 3552 | + { |
---|
| 3553 | + ByteArrayInputStream bais = new ByteArrayInputStream(bytes); |
---|
| 3554 | + //java.util.zip.GZIPInputStream istream = new java.util.zip.GZIPInputStream(bais); |
---|
| 3555 | + ObjectInputStream in = new ObjectInputStream(bais); // istream); |
---|
| 3556 | + Object obj = in.readObject(); |
---|
| 3557 | + |
---|
| 3558 | + bais //istream |
---|
| 3559 | + .close(); |
---|
| 3560 | + in.close(); |
---|
| 3561 | + |
---|
| 3562 | + return obj; |
---|
| 3563 | + } catch (Exception e) |
---|
| 3564 | + { |
---|
| 3565 | + System.err.println(e); |
---|
| 3566 | + return null; |
---|
| 3567 | + } |
---|
| 3568 | + } |
---|
| 3569 | + |
---|
3217 | 3570 | static public Object clone(Object o) |
---|
3218 | 3571 | { |
---|
3219 | 3572 | try |
---|
.. | .. |
---|
3222 | 3575 | ObjectOutputStream out = new ObjectOutputStream(baos); |
---|
3223 | 3576 | |
---|
3224 | 3577 | out.writeObject(o); |
---|
| 3578 | + |
---|
| 3579 | + out.flush(); |
---|
| 3580 | + out.close(); |
---|
| 3581 | + |
---|
| 3582 | + byte[] bytes = baos.toByteArray(); |
---|
| 3583 | + |
---|
| 3584 | + System.out.println("clone = " + bytes.length); |
---|
3225 | 3585 | |
---|
3226 | | - ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray()); |
---|
| 3586 | + ByteArrayInputStream bais = new ByteArrayInputStream(bytes); |
---|
3227 | 3587 | ObjectInputStream in = new ObjectInputStream(bais); |
---|
3228 | 3588 | Object obj = in.readObject(); |
---|
3229 | 3589 | in.close(); |
---|
3230 | | - out.close(); |
---|
| 3590 | + |
---|
3231 | 3591 | return obj; |
---|
3232 | 3592 | } catch (Exception e) |
---|
3233 | 3593 | { |
---|
.. | .. |
---|
3251 | 3611 | return null; |
---|
3252 | 3612 | } |
---|
3253 | 3613 | |
---|
| 3614 | + |
---|
3254 | 3615 | public void Save() |
---|
3255 | 3616 | { |
---|
| 3617 | + //Save(true); |
---|
| 3618 | + Replace(); |
---|
| 3619 | + } |
---|
| 3620 | + |
---|
| 3621 | + private boolean Equal(byte[] compress, byte[] name) |
---|
| 3622 | + { |
---|
| 3623 | + if (compress.length != name.length) |
---|
| 3624 | + { |
---|
| 3625 | + return false; |
---|
| 3626 | + } |
---|
| 3627 | + |
---|
| 3628 | + for (int i=compress.length; --i>=0;) |
---|
| 3629 | + { |
---|
| 3630 | + if (compress[i] != name[i]) |
---|
| 3631 | + return false; |
---|
| 3632 | + } |
---|
| 3633 | + |
---|
| 3634 | + return true; |
---|
| 3635 | + } |
---|
| 3636 | + |
---|
| 3637 | + java.util.Hashtable<java.util.UUID, Object3D> versiontable = new java.util.Hashtable<java.util.UUID, Object3D>(); |
---|
| 3638 | + |
---|
| 3639 | + public boolean Save(boolean user) |
---|
| 3640 | + { |
---|
| 3641 | + System.err.println("Save"); |
---|
| 3642 | + |
---|
3256 | 3643 | cRadio tab = GetCurrentTab(); |
---|
3257 | 3644 | |
---|
3258 | | - //EditorFrame.m_MainFrame.requestFocusInWindow(); |
---|
3259 | | - tab.graphs[tab.undoindex++] = (Object3D)clone(copy); |
---|
3260 | | - |
---|
3261 | | - for (int i = tab.undoindex; i < tab.graphs.length; i++) |
---|
| 3645 | + byte[] compress = CompressCopy(); |
---|
| 3646 | + |
---|
| 3647 | + boolean thesame = false; |
---|
| 3648 | + |
---|
| 3649 | + // Quick heuristic using length. Works only when stream is compressed. |
---|
| 3650 | + if (copy.versionindex > 0 && copy.versions[copy.versionindex-1] != null && Equal(compress, copy.versions[copy.versionindex-1])) |
---|
3262 | 3651 | { |
---|
3263 | | - tab.graphs[i] = null; |
---|
| 3652 | + thesame = true; |
---|
| 3653 | + } |
---|
| 3654 | + |
---|
| 3655 | + //EditorFrame.m_MainFrame.requestFocusInWindow(); |
---|
| 3656 | + if (!thesame) |
---|
| 3657 | + { |
---|
| 3658 | + //tab.user[tab.versionindex] = user; |
---|
| 3659 | + //boolean increment = true; // tab.graphs[tab.versionindex] == null; |
---|
| 3660 | + |
---|
| 3661 | + copy.versions[++copy.versionindex] = compress; |
---|
| 3662 | + |
---|
| 3663 | + // if (increment) |
---|
| 3664 | + // tab.versionindex++; |
---|
3264 | 3665 | } |
---|
3265 | 3666 | |
---|
| 3667 | + //copy.RestoreBigData(versiontable); |
---|
| 3668 | + |
---|
| 3669 | + //assert(hashtable.isEmpty()); |
---|
| 3670 | + |
---|
| 3671 | + for (int i = copy.versionindex+1; i < copy.versions.length; i++) |
---|
| 3672 | + { |
---|
| 3673 | + //tab.user[i] = false; |
---|
| 3674 | + copy.versions[i] = null; |
---|
| 3675 | + } |
---|
| 3676 | + |
---|
| 3677 | + SetUndoStates(); |
---|
| 3678 | + |
---|
3266 | 3679 | // test save |
---|
3267 | 3680 | if (false) |
---|
3268 | 3681 | { |
---|
3269 | 3682 | try |
---|
3270 | 3683 | { |
---|
3271 | | - FileOutputStream ostream = new FileOutputStream("save" + tab.undoindex); |
---|
| 3684 | + FileOutputStream ostream = new FileOutputStream("save" + copy.versionindex); |
---|
3272 | 3685 | ObjectOutputStream p = new ObjectOutputStream(ostream); |
---|
3273 | 3686 | |
---|
3274 | 3687 | p.writeObject(copy); |
---|
.. | .. |
---|
3281 | 3694 | e.printStackTrace(); |
---|
3282 | 3695 | } |
---|
3283 | 3696 | } |
---|
| 3697 | + |
---|
| 3698 | + return !thesame; |
---|
3284 | 3699 | } |
---|
3285 | 3700 | |
---|
3286 | 3701 | void CopyChanged(Object3D obj) |
---|
3287 | 3702 | { |
---|
| 3703 | + SetUndoStates(); |
---|
| 3704 | + |
---|
| 3705 | + boolean temp = CameraPane.SWITCH; |
---|
| 3706 | + CameraPane.SWITCH = false; |
---|
| 3707 | + |
---|
| 3708 | + copy.ExtractBigData(versiontable); |
---|
| 3709 | + |
---|
3288 | 3710 | copy.clear(); |
---|
3289 | 3711 | |
---|
3290 | 3712 | for (int i=0; i<obj.Size(); i++) |
---|
3291 | 3713 | { |
---|
3292 | 3714 | copy.add(obj.get(i)); |
---|
3293 | 3715 | } |
---|
| 3716 | + |
---|
| 3717 | + copy.RestoreBigData(versiontable); |
---|
| 3718 | + |
---|
| 3719 | + CameraPane.SWITCH = temp; |
---|
| 3720 | + |
---|
| 3721 | + //assert(hashtable.isEmpty()); |
---|
3294 | 3722 | |
---|
3295 | 3723 | copy.Touch(); |
---|
3296 | 3724 | |
---|
.. | .. |
---|
3313 | 3741 | refreshContents(); |
---|
3314 | 3742 | } |
---|
3315 | 3743 | |
---|
3316 | | - public void Undo() |
---|
| 3744 | + cButton undoButton; |
---|
| 3745 | + cButton restoreButton; |
---|
| 3746 | + cButton replaceButton; |
---|
| 3747 | + cButton redoButton; |
---|
| 3748 | + |
---|
| 3749 | + boolean muteSlider; |
---|
| 3750 | + |
---|
| 3751 | + int VersionCount() |
---|
| 3752 | + { |
---|
| 3753 | + int count = 0; |
---|
| 3754 | + |
---|
| 3755 | + for (int i = copy.versions.length; --i >= 0;) |
---|
| 3756 | + { |
---|
| 3757 | + if (copy.versions[i] != null) |
---|
| 3758 | + count++; |
---|
| 3759 | + } |
---|
| 3760 | + |
---|
| 3761 | + return count; |
---|
| 3762 | + } |
---|
| 3763 | + |
---|
| 3764 | + void SetUndoStates() |
---|
3317 | 3765 | { |
---|
3318 | 3766 | cRadio tab = GetCurrentTab(); |
---|
3319 | 3767 | |
---|
3320 | | - if (tab.undoindex == 0) |
---|
| 3768 | + restoreButton.setEnabled(copy.versionindex != -1); |
---|
| 3769 | + replaceButton.setEnabled(copy.versionindex != -1); |
---|
| 3770 | + |
---|
| 3771 | + undoButton.setEnabled(copy.versionindex > 0); |
---|
| 3772 | + redoButton.setEnabled(copy.versions[copy.versionindex + 1] != null); |
---|
| 3773 | + |
---|
| 3774 | + muteSlider = true; |
---|
| 3775 | + versionSlider.setMaximum(VersionCount() - 1); |
---|
| 3776 | + versionSlider.setInteger(copy.versionindex); |
---|
| 3777 | + muteSlider = false; |
---|
| 3778 | + } |
---|
| 3779 | + |
---|
| 3780 | + public boolean Undo() |
---|
| 3781 | + { |
---|
| 3782 | + // Option? |
---|
| 3783 | + Replace(); |
---|
| 3784 | + |
---|
| 3785 | + System.err.println("Undo"); |
---|
| 3786 | + |
---|
| 3787 | + cRadio tab = GetCurrentTab(); |
---|
| 3788 | + |
---|
| 3789 | + if (copy.versionindex == 0) |
---|
3321 | 3790 | { |
---|
3322 | 3791 | java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
3323 | | - return; |
---|
| 3792 | + return false; |
---|
3324 | 3793 | } |
---|
3325 | 3794 | |
---|
3326 | | - if (tab.graphs[tab.undoindex] == null) |
---|
| 3795 | +// if (tab.graphs[tab.versionindex] == null) // || !tab.user[tab.versionindex]) |
---|
| 3796 | +// { |
---|
| 3797 | +// if (Save(false)) |
---|
| 3798 | +// tab.versionindex -= 1; |
---|
| 3799 | +// else |
---|
| 3800 | +// { |
---|
| 3801 | +// if (tab.versionindex <= 0) |
---|
| 3802 | +// return false; |
---|
| 3803 | +// else |
---|
| 3804 | +// tab.versionindex -= 1; |
---|
| 3805 | +// } |
---|
| 3806 | +// } |
---|
| 3807 | + |
---|
| 3808 | + copy.versionindex -= 1; |
---|
| 3809 | + |
---|
| 3810 | + CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex])); |
---|
| 3811 | + |
---|
| 3812 | + return true; |
---|
| 3813 | + } |
---|
| 3814 | + |
---|
| 3815 | + public boolean Restore() |
---|
| 3816 | + { |
---|
| 3817 | + System.err.println("Restore"); |
---|
| 3818 | + |
---|
| 3819 | + cRadio tab = GetCurrentTab(); |
---|
| 3820 | + |
---|
| 3821 | + if (copy.versionindex == -1 || copy.versions[copy.versionindex] == null) |
---|
3327 | 3822 | { |
---|
3328 | | - Save(); |
---|
3329 | | - tab.undoindex -= 1; |
---|
| 3823 | + java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
| 3824 | + return false; |
---|
3330 | 3825 | } |
---|
3331 | 3826 | |
---|
3332 | | - tab.undoindex -= 1; |
---|
| 3827 | + CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex])); |
---|
| 3828 | + |
---|
| 3829 | + return true; |
---|
| 3830 | + } |
---|
3333 | 3831 | |
---|
3334 | | - CopyChanged(tab.graphs[tab.undoindex]); |
---|
| 3832 | + public boolean Replace() |
---|
| 3833 | + { |
---|
| 3834 | + System.err.println("Replace"); |
---|
| 3835 | + |
---|
| 3836 | + cRadio tab = GetCurrentTab(); |
---|
| 3837 | + |
---|
| 3838 | + if (copy.versionindex == -1 || copy.versions[copy.versionindex] == null) |
---|
| 3839 | + { |
---|
| 3840 | + // No version yet. OK. java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
| 3841 | + return false; |
---|
| 3842 | + } |
---|
| 3843 | + |
---|
| 3844 | + copy.versions[copy.versionindex] = CompressCopy(); |
---|
| 3845 | + |
---|
| 3846 | + return true; |
---|
3335 | 3847 | } |
---|
3336 | 3848 | |
---|
3337 | 3849 | public void Redo() |
---|
3338 | 3850 | { |
---|
| 3851 | + // Option? |
---|
| 3852 | + Replace(); |
---|
| 3853 | + |
---|
3339 | 3854 | cRadio tab = GetCurrentTab(); |
---|
3340 | 3855 | |
---|
3341 | | - if (tab.graphs[tab.undoindex + 1] == null) |
---|
| 3856 | + if (copy.versions[copy.versionindex + 1] == null) |
---|
3342 | 3857 | { |
---|
3343 | 3858 | java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
3344 | 3859 | return; |
---|
3345 | 3860 | } |
---|
3346 | 3861 | |
---|
3347 | | - tab.undoindex += 1; |
---|
| 3862 | + copy.versionindex += 1; |
---|
3348 | 3863 | |
---|
3349 | | - CopyChanged(tab.graphs[tab.undoindex]); |
---|
| 3864 | + CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex])); |
---|
| 3865 | + |
---|
| 3866 | + //if (!tab.user[tab.versionindex]) |
---|
| 3867 | + // tab.graphs[tab.versionindex] = null; |
---|
3350 | 3868 | } |
---|
3351 | 3869 | |
---|
3352 | 3870 | void ImportGFD() |
---|
.. | .. |
---|
3498 | 4016 | assert false; |
---|
3499 | 4017 | } |
---|
3500 | 4018 | |
---|
3501 | | - void EditSelection() |
---|
| 4019 | + void EditSelection(boolean newWindow) |
---|
3502 | 4020 | { |
---|
3503 | 4021 | } |
---|
3504 | 4022 | |
---|
.. | .. |
---|
3642 | 4160 | //copy.Touch(); |
---|
3643 | 4161 | } |
---|
3644 | 4162 | |
---|
| 4163 | + cNumberSlider versionSlider; |
---|
| 4164 | + |
---|
3645 | 4165 | public void stateChanged(ChangeEvent e) |
---|
3646 | 4166 | { |
---|
3647 | 4167 | // assert(false); |
---|
| 4168 | + if (e.getSource() == versionSlider) |
---|
| 4169 | + { |
---|
| 4170 | + if (muteSlider) |
---|
| 4171 | + return; |
---|
| 4172 | + |
---|
| 4173 | + int version = versionSlider.getInteger(); |
---|
| 4174 | + |
---|
| 4175 | + if (copy.versions[version] != null) |
---|
| 4176 | + { |
---|
| 4177 | + CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex = version])); |
---|
| 4178 | + } |
---|
| 4179 | + |
---|
| 4180 | + return; |
---|
| 4181 | + } |
---|
3648 | 4182 | |
---|
3649 | 4183 | if (freezematerial) |
---|
3650 | 4184 | { |
---|
.. | .. |
---|
3993 | 4527 | |
---|
3994 | 4528 | void makeSomething(Object3D thing, boolean resetmodel) // deselect) |
---|
3995 | 4529 | { |
---|
3996 | | - Save(); |
---|
| 4530 | + if (Globals.REPLACEONMAKE) // && resetmodel) |
---|
| 4531 | + Save(); |
---|
3997 | 4532 | //Tween.set(thing, 0).target(1).start(tweenManager); |
---|
3998 | 4533 | //Tween.to(thing, 0, 0.5f).target(0).start(tweenManager); |
---|
3999 | 4534 | // if (thing instanceof GenericJointDemo) |
---|
.. | .. |
---|
4080 | 4615 | { |
---|
4081 | 4616 | ResetModel(); |
---|
4082 | 4617 | Select(thing.GetTreePath(), true, false); // unselect... false); |
---|
| 4618 | + |
---|
| 4619 | + if (thing.Size() == 0) |
---|
| 4620 | + { |
---|
| 4621 | + //EditSelection(false); |
---|
| 4622 | + } |
---|
| 4623 | + |
---|
4083 | 4624 | refreshContents(); |
---|
4084 | 4625 | } |
---|
4085 | 4626 | |
---|
.. | .. |
---|
4217 | 4758 | |
---|
4218 | 4759 | try |
---|
4219 | 4760 | { |
---|
| 4761 | + // Try compressed version first. |
---|
4220 | 4762 | java.io.FileInputStream istream = new java.io.FileInputStream(fullname); |
---|
4221 | 4763 | java.util.zip.GZIPInputStream zstream = new java.util.zip.GZIPInputStream(istream); |
---|
4222 | 4764 | java.io.ObjectInputStream p = new java.io.ObjectInputStream(zstream); |
---|
.. | .. |
---|
4227 | 4769 | readobj.ResetDisplayList(); |
---|
4228 | 4770 | } catch (Exception e) |
---|
4229 | 4771 | { |
---|
4230 | | - //e.printStackTrace(); |
---|
| 4772 | + if (!e.toString().contains("GZIP")) |
---|
| 4773 | + e.printStackTrace(); |
---|
| 4774 | + |
---|
4231 | 4775 | try |
---|
4232 | 4776 | { |
---|
4233 | 4777 | java.io.FileInputStream istream = new java.io.FileInputStream(fullname); |
---|
.. | .. |
---|
4286 | 4830 | |
---|
4287 | 4831 | void LoadIt(Object obj) |
---|
4288 | 4832 | { |
---|
| 4833 | + if (obj == null) |
---|
| 4834 | + { |
---|
| 4835 | + // Invalid file |
---|
| 4836 | + return; |
---|
| 4837 | + } |
---|
| 4838 | + |
---|
4289 | 4839 | System.out.println("Loaded " + obj); |
---|
4290 | 4840 | //new Exception().printStackTrace(); |
---|
4291 | 4841 | Object3D readobj = (Object3D) obj; |
---|
.. | .. |
---|
4295 | 4845 | |
---|
4296 | 4846 | if (readobj != null) |
---|
4297 | 4847 | { |
---|
| 4848 | + //if (Globals.SAVEONMAKE) // A new object cannot share meshes |
---|
| 4849 | + // Save(); |
---|
4298 | 4850 | try |
---|
4299 | 4851 | { |
---|
4300 | 4852 | //readobj.deepCopySelf(copy); |
---|
.. | .. |
---|
4339 | 4891 | } |
---|
4340 | 4892 | } catch (ClassCastException e) |
---|
4341 | 4893 | { |
---|
| 4894 | + e.printStackTrace(); |
---|
4342 | 4895 | assert (false); |
---|
4343 | 4896 | Composite c = (Composite) copy; |
---|
4344 | 4897 | c.children.clear(); |
---|
.. | .. |
---|
4349 | 4902 | c.addChild(csg); |
---|
4350 | 4903 | } |
---|
4351 | 4904 | |
---|
| 4905 | + copy.versions = readobj.versions; |
---|
| 4906 | + copy.versionindex = readobj.versionindex; |
---|
| 4907 | + |
---|
| 4908 | + if (copy.versions == null) |
---|
| 4909 | + { |
---|
| 4910 | + copy.versions = new byte[100][]; |
---|
| 4911 | + copy.versionindex = -1; |
---|
| 4912 | + } |
---|
| 4913 | + |
---|
| 4914 | + //? SetUndoStates(); |
---|
| 4915 | + |
---|
4352 | 4916 | ResetModel(); |
---|
4353 | 4917 | copy.HardTouch(); // recompile? |
---|
4354 | 4918 | refreshContents(); |
---|
4355 | 4919 | } |
---|
4356 | 4920 | } |
---|
4357 | 4921 | |
---|
4358 | | - void load() // throws ClassNotFoundException |
---|
| 4922 | + void Open() // throws ClassNotFoundException |
---|
4359 | 4923 | { |
---|
4360 | 4924 | if (Grafreed.standAlone) |
---|
4361 | 4925 | { |
---|
.. | .. |
---|
4458 | 5022 | //ps.print(buffer.toString()); |
---|
4459 | 5023 | } catch (IOException e) |
---|
4460 | 5024 | { |
---|
| 5025 | + e.printStackTrace(); |
---|
4461 | 5026 | } |
---|
4462 | 5027 | } |
---|
4463 | 5028 | |
---|
.. | .. |
---|
4472 | 5037 | String filename = browser.getFile(); |
---|
4473 | 5038 | if (filename != null && filename.length() > 0) |
---|
4474 | 5039 | { |
---|
| 5040 | + if (!filename.endsWith(".gfd")) |
---|
| 5041 | + filename += ".gfd"; |
---|
4475 | 5042 | lastname = browser.getDirectory() + filename; |
---|
4476 | 5043 | save(); |
---|
4477 | 5044 | } |
---|
.. | .. |
---|
4638 | 5205 | MenuBar menuBar; |
---|
4639 | 5206 | Menu fileMenu; |
---|
4640 | 5207 | MenuItem newItem; |
---|
4641 | | - MenuItem loadItem; |
---|
| 5208 | + MenuItem openItem; |
---|
4642 | 5209 | MenuItem saveItem; |
---|
4643 | 5210 | MenuItem saveAsItem; |
---|
4644 | 5211 | MenuItem exportAsItem; |
---|
.. | .. |
---|
4661 | 5228 | CheckboxMenuItem toggleSwitchItem; |
---|
4662 | 5229 | CheckboxMenuItem toggleRootItem; |
---|
4663 | 5230 | CheckboxMenuItem animationItem; |
---|
| 5231 | + MenuItem archiveItem; |
---|
4664 | 5232 | CheckboxMenuItem toggleHandleItem; |
---|
4665 | 5233 | CheckboxMenuItem togglePaintItem; |
---|
4666 | 5234 | JSplitPane mainPanel; |
---|
4667 | 5235 | JScrollPane scrollpane; |
---|
| 5236 | + |
---|
4668 | 5237 | JPanel toolbarPanel; |
---|
| 5238 | + |
---|
4669 | 5239 | cGridBag treePanel; |
---|
| 5240 | + |
---|
4670 | 5241 | JPanel radioPanel; |
---|
4671 | 5242 | ButtonGroup buttonGroup; |
---|
4672 | | - cGridBag ctrlPanel; |
---|
| 5243 | + |
---|
| 5244 | + cGridBag toolboxPanel; |
---|
4673 | 5245 | cGridBag materialPanel; |
---|
| 5246 | + cGridBag ctrlPanel; |
---|
| 5247 | + |
---|
4674 | 5248 | JScrollPane infoPanel; |
---|
| 5249 | + |
---|
4675 | 5250 | cGridBag optionsPanel; |
---|
| 5251 | + |
---|
4676 | 5252 | JTabbedPane objectPanel; |
---|
| 5253 | + boolean materialFlushed; |
---|
| 5254 | + Object3D latestObject; |
---|
| 5255 | + |
---|
4677 | 5256 | cGridBag XYZPanel; |
---|
| 5257 | + |
---|
4678 | 5258 | JSplitPane gridPanel; |
---|
4679 | 5259 | JSplitPane bigPanel; |
---|
| 5260 | + |
---|
4680 | 5261 | cGridBag bigThree; |
---|
4681 | 5262 | cGridBag scenePanel; |
---|
4682 | 5263 | cGridBag centralPanel; |
---|
.. | .. |
---|
4791 | 5372 | cNumberSlider fogField; |
---|
4792 | 5373 | JLabel opacityPowerLabel; |
---|
4793 | 5374 | cNumberSlider opacityPowerField; |
---|
4794 | | - JTree jTree; |
---|
| 5375 | + cTree jTree; |
---|
4795 | 5376 | //ObjectUI parent; |
---|
4796 | 5377 | |
---|
4797 | 5378 | cNumberSlider normalpushField; |
---|