.. | .. |
---|
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 | + public cGridBag GetSeparator() |
---|
| 46 | + { |
---|
| 47 | + cGridBag separator = new cGridBag(); |
---|
| 48 | + separator.add(new JSeparator()); |
---|
| 49 | + separator.preferredHeight = 5; |
---|
| 50 | + return separator; |
---|
| 51 | + } |
---|
| 52 | + |
---|
| 53 | + cButton GetButton(String name, boolean border) |
---|
| 54 | + { |
---|
| 55 | + ImageIcon icon = GetIcon(name); |
---|
| 56 | + return new cButton(icon, border); |
---|
| 57 | + } |
---|
| 58 | + |
---|
| 59 | + cLabel GetLabel(String name, boolean border) |
---|
| 60 | + { |
---|
| 61 | + //ImageIcon icon = GetIcon(name); |
---|
| 62 | + return new cLabel(GetImage(name), border); |
---|
| 63 | + } |
---|
| 64 | + |
---|
| 65 | + cToggleButton GetToggleButton(String name, boolean border) |
---|
| 66 | + { |
---|
| 67 | + ImageIcon icon = GetIcon(name); |
---|
| 68 | + return new cToggleButton(icon, border); |
---|
| 69 | + } |
---|
| 70 | + |
---|
| 71 | + cCheckBox GetCheckBox(String name, boolean border) |
---|
| 72 | + { |
---|
| 73 | + ImageIcon icon = GetIcon(name); |
---|
| 74 | + return new cCheckBox(icon, border); |
---|
| 75 | + } |
---|
| 76 | + |
---|
| 77 | + ImageIcon GetIcon(String name) |
---|
| 78 | + { |
---|
| 79 | + try |
---|
| 80 | + { |
---|
| 81 | + BufferedImage image = javax.imageio.ImageIO.read(getClass().getClassLoader().getResourceAsStream(name)); |
---|
| 82 | + |
---|
| 83 | +// if (image.getWidth() > 48 && image.getHeight() > 48) |
---|
| 84 | +// { |
---|
| 85 | +// BufferedImage resized = new BufferedImage(48, 48, image.getType()); |
---|
| 86 | +// Graphics2D g = resized.createGraphics(); |
---|
| 87 | +// g.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR); |
---|
| 88 | +// //g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); |
---|
| 89 | +// g.drawImage(image, 0, 0, 48, 48, 0, 0, image.getWidth(), image.getHeight(), null); |
---|
| 90 | +// g.dispose(); |
---|
| 91 | +// |
---|
| 92 | +// image = resized; |
---|
| 93 | +// } |
---|
| 94 | + |
---|
| 95 | + javax.swing.ImageIcon icon = new javax.swing.ImageIcon(image); |
---|
| 96 | + return icon; |
---|
| 97 | + } |
---|
| 98 | + catch (Exception e) |
---|
| 99 | + { |
---|
| 100 | + return null; |
---|
| 101 | + } |
---|
| 102 | + } |
---|
| 103 | + |
---|
| 104 | + BufferedImage GetImage(String name) |
---|
| 105 | + { |
---|
| 106 | + try |
---|
| 107 | + { |
---|
| 108 | + BufferedImage image = javax.imageio.ImageIO.read(getClass().getClassLoader().getResourceAsStream(name)); |
---|
| 109 | + |
---|
| 110 | + return image; |
---|
| 111 | + } |
---|
| 112 | + catch (Exception e) |
---|
| 113 | + { |
---|
| 114 | + return null; |
---|
| 115 | + } |
---|
| 116 | + } |
---|
38 | 117 | |
---|
39 | 118 | // SCRIPT |
---|
40 | 119 | |
---|
.. | .. |
---|
145 | 224 | |
---|
146 | 225 | objEditor.ctrlPanel.remove(namePanel); |
---|
147 | 226 | |
---|
148 | | - if (!GroupEditor.allparams) |
---|
| 227 | + if (!allparams) |
---|
149 | 228 | return; |
---|
150 | 229 | |
---|
151 | 230 | // objEditor.ctrlPanel.remove(liveCB); |
---|
.. | .. |
---|
168 | 247 | // objEditor.ctrlPanel.remove(remarkButton); |
---|
169 | 248 | |
---|
170 | 249 | objEditor.ctrlPanel.remove(setupPanel); |
---|
171 | | - objEditor.ctrlPanel.remove(commandsPanel); |
---|
| 250 | + objEditor.ctrlPanel.remove(setupPanel2); |
---|
| 251 | + objEditor.ctrlPanel.remove(objectCommandsPanel); |
---|
172 | 252 | objEditor.ctrlPanel.remove(pushPanel); |
---|
173 | 253 | //objEditor.ctrlPanel.remove(fillPanel); |
---|
174 | 254 | |
---|
.. | .. |
---|
216 | 296 | client = inClient; |
---|
217 | 297 | copy = client; |
---|
218 | 298 | |
---|
| 299 | + if (copy.versions == null) |
---|
| 300 | + { |
---|
| 301 | + copy.versions = new byte[100][]; |
---|
| 302 | + copy.versionindex = -1; |
---|
| 303 | + } |
---|
| 304 | + |
---|
219 | 305 | // "this" is not called: SetupUI2(objEditor); |
---|
220 | 306 | } |
---|
221 | 307 | |
---|
.. | .. |
---|
229 | 315 | client = inClient; |
---|
230 | 316 | copy = client; |
---|
231 | 317 | |
---|
| 318 | + if (copy.versions == null) |
---|
| 319 | + { |
---|
| 320 | + copy.versions = new byte[100][]; |
---|
| 321 | + copy.versionindex = -1; |
---|
| 322 | + } |
---|
| 323 | + |
---|
232 | 324 | SetupUI2(callee.GetEditor()); |
---|
233 | 325 | } |
---|
234 | 326 | |
---|
.. | .. |
---|
243 | 335 | //localCopy.parent = null; |
---|
244 | 336 | |
---|
245 | 337 | frame = new JFrame(); |
---|
| 338 | + frame.setUndecorated(false); |
---|
246 | 339 | objEditor = this; |
---|
247 | 340 | this.callee = callee; |
---|
248 | 341 | |
---|
.. | .. |
---|
260 | 353 | copy = localCopy; |
---|
261 | 354 | copy.editWindow = this; |
---|
262 | 355 | |
---|
| 356 | + if (copy.versions == null) |
---|
| 357 | + { |
---|
| 358 | +// copy.versions = new byte[100][]; |
---|
| 359 | +// copy.versionindex = -1; |
---|
| 360 | + } |
---|
| 361 | + |
---|
263 | 362 | SetupMenu(); |
---|
264 | 363 | |
---|
265 | 364 | //SetupName(objEditor); // new |
---|
.. | .. |
---|
273 | 372 | return frame.action(event, obj); |
---|
274 | 373 | } |
---|
275 | 374 | |
---|
| 375 | + // Cannot work without static |
---|
| 376 | + static boolean allparams = true; |
---|
| 377 | + |
---|
| 378 | + static java.util.Vector<Object3D> listUI = new java.util.Vector<Object3D>(); |
---|
| 379 | + |
---|
276 | 380 | void SetupMenu() |
---|
277 | 381 | { |
---|
278 | 382 | frame.setMenuBar(menuBar = new MenuBar()); |
---|
279 | 383 | menuBar.add(fileMenu = new Menu("File")); |
---|
280 | 384 | fileMenu.add(newItem = new MenuItem("New")); |
---|
281 | | - fileMenu.add(loadItem = new MenuItem("Open...")); |
---|
| 385 | + fileMenu.add(openItem = new MenuItem("Open...")); |
---|
282 | 386 | |
---|
283 | 387 | //oe.menuBar.add(menu = new Menu("Include")); |
---|
284 | 388 | Menu menu = new Menu("Import"); |
---|
.. | .. |
---|
310 | 414 | } |
---|
311 | 415 | |
---|
312 | 416 | newItem.addActionListener(this); |
---|
313 | | - loadItem.addActionListener(this); |
---|
| 417 | + openItem.addActionListener(this); |
---|
314 | 418 | saveItem.addActionListener(this); |
---|
315 | 419 | saveAsItem.addActionListener(this); |
---|
316 | 420 | exportAsItem.addActionListener(this); |
---|
.. | .. |
---|
319 | 423 | closeItem.addActionListener(this); |
---|
320 | 424 | |
---|
321 | 425 | objectPanel = new JTabbedPane(); |
---|
| 426 | + |
---|
| 427 | + ChangeListener changeListener = new ChangeListener() |
---|
| 428 | + { |
---|
| 429 | + public void stateChanged(ChangeEvent changeEvent) |
---|
| 430 | + { |
---|
| 431 | +// if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Material") && !materialFlushed) |
---|
| 432 | +// { |
---|
| 433 | +// if (latestObject != null) |
---|
| 434 | +// { |
---|
| 435 | +// refreshContents(true); |
---|
| 436 | +// SetMaterial(latestObject); |
---|
| 437 | +// } |
---|
| 438 | +// |
---|
| 439 | +// materialFlushed = true; |
---|
| 440 | +// } |
---|
| 441 | +// if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Edit")) |
---|
| 442 | +// { |
---|
| 443 | +// if (listUI.size() == 0) |
---|
| 444 | +// EditSelection(false); |
---|
| 445 | +// } |
---|
| 446 | + |
---|
| 447 | + refreshContents(false); // To refresh Info tab |
---|
| 448 | + } |
---|
| 449 | + }; |
---|
| 450 | + objectPanel.addChangeListener(changeListener); |
---|
| 451 | + |
---|
322 | 452 | toolbarPanel = new JPanel(); |
---|
323 | 453 | toolbarPanel.setName("Toolbar"); |
---|
| 454 | + |
---|
324 | 455 | treePanel = new cGridBag(); |
---|
325 | 456 | treePanel.setName("Tree"); |
---|
| 457 | + |
---|
| 458 | + editPanel = new cGridBag().setVertical(true); |
---|
| 459 | + //editPanel.setName("Edit"); |
---|
| 460 | + |
---|
326 | 461 | ctrlPanel = new cGridBag().setVertical(false); // new GridBagLayout()); |
---|
327 | | - ctrlPanel.setName("Edit"); |
---|
| 462 | + |
---|
| 463 | + editCommandsPanel = new cGridBag(); |
---|
| 464 | + editPanel.add(editCommandsPanel); |
---|
| 465 | + editPanel.add(ctrlPanel); |
---|
| 466 | + |
---|
| 467 | + toolboxPanel = new cGridBag().setVertical(true); |
---|
| 468 | + //toolboxPanel.setName("Toolbox"); |
---|
| 469 | + |
---|
328 | 470 | materialPanel = new cGridBag().setVertical(true); |
---|
329 | | - materialPanel.setName("Material"); |
---|
| 471 | + //materialPanel.setName("Material"); |
---|
| 472 | + |
---|
330 | 473 | /*JTextPane*/ |
---|
331 | 474 | infoarea = createTextPane(); |
---|
332 | 475 | doc = infoarea.getStyledDocument(); |
---|
333 | 476 | |
---|
334 | 477 | infoarea.setEditable(true); |
---|
335 | 478 | SetText(); |
---|
| 479 | + |
---|
336 | 480 | // infoarea.setFont(infoarea.getFont().deriveFont(10, 14f)); |
---|
337 | 481 | // infoarea.setOpaque(false); |
---|
338 | 482 | // //infoarea.setForeground(textcolor); |
---|
339 | 483 | // TEXTAREA infoarea.setLineWrap(true); |
---|
340 | 484 | // TEXTAREA infoarea.setWrapStyleWord(true); |
---|
341 | 485 | 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"); |
---|
| 486 | + infoPanel.setPreferredSize(new Dimension(1, 1)); |
---|
| 487 | + //infoPanel.setName("Info"); |
---|
344 | 488 | //infoPanel.setLayout(new BorderLayout()); |
---|
345 | 489 | //infoPanel.add(createTextPane()); |
---|
346 | 490 | |
---|
.. | .. |
---|
351 | 495 | mainPanel.setDividerSize(9); |
---|
352 | 496 | mainPanel.setDividerLocation(0.5); //1.0); |
---|
353 | 497 | mainPanel.setResizeWeight(0.5); |
---|
354 | | - |
---|
| 498 | + |
---|
| 499 | +//mainPanel.setDividerSize((int) (mainPanel.getDividerSize() * 1.5)); |
---|
| 500 | + BasicSplitPaneDivider divider = ( (BasicSplitPaneUI) mainPanel.getUI()).getDivider(); |
---|
| 501 | + divider.setDividerSize(15); |
---|
| 502 | + divider.setBorder(BorderFactory.createTitledBorder(divider.getBorder(), "Custom border title -- gets rid of the one-touch arrows!")); |
---|
| 503 | + |
---|
| 504 | + mainPanel.setUI(new BasicSplitPaneUI()); |
---|
| 505 | + |
---|
355 | 506 | //ctrlPanel.setLayout(new GridLayout(4, 1, 5, 5)); |
---|
356 | 507 | //mainPanel.setLayout(new GridBagLayout()); |
---|
357 | 508 | toolbarPanel.setLayout(new FlowLayout(FlowLayout.LEFT)); |
---|
.. | .. |
---|
419 | 570 | e.printStackTrace(); |
---|
420 | 571 | } |
---|
421 | 572 | |
---|
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(); |
---|
| 573 | +// String selection = infoarea.getText(); |
---|
| 574 | +// java.awt.datatransfer.StringSelection data = new java.awt.datatransfer.StringSelection(selection); |
---|
| 575 | +// java.awt.datatransfer.Clipboard clipboard = |
---|
| 576 | +// Toolkit.getDefaultToolkit().getSystemClipboard(); |
---|
426 | 577 | //clipboard.setContents(data, data); |
---|
427 | 578 | } |
---|
428 | 579 | |
---|
.. | .. |
---|
582 | 733 | } |
---|
583 | 734 | } |
---|
584 | 735 | |
---|
| 736 | +//static GraphicsDevice device = GraphicsEnvironment |
---|
| 737 | +// .getLocalGraphicsEnvironment().getScreenDevices()[0]; |
---|
| 738 | + |
---|
| 739 | + Rectangle keeprect; |
---|
| 740 | + cRadio radio; |
---|
| 741 | + |
---|
| 742 | +cButton keepButton; |
---|
| 743 | + cButton twoButton; // Full 3D |
---|
| 744 | + cButton sixButton; |
---|
| 745 | + cButton threeButton; |
---|
| 746 | + cButton sevenButton; |
---|
| 747 | + cButton fourButton; // full panel |
---|
| 748 | + cButton oneButton; // full XYZ |
---|
| 749 | + //cButton currentLayout; |
---|
| 750 | + |
---|
| 751 | + boolean maximized; |
---|
| 752 | + |
---|
| 753 | + cButton fullscreenLayout; |
---|
| 754 | + |
---|
| 755 | + void Minimize() |
---|
| 756 | + { |
---|
| 757 | + frame.setState(Frame.ICONIFIED); |
---|
| 758 | + frame.validate(); |
---|
| 759 | + } |
---|
| 760 | + |
---|
| 761 | +// artifactURI=null, type=0, property=${file.reference.jfxrt.jar}, object=org.netbeans.modules.java.api.common.classpath.ClassPathSupport$RelativePath@6767876f, broken=false, additional={} |
---|
| 762 | +// artifactURI=null, type=0, property=${file.reference.mac-ui.jar}, object=org.netbeans.modules.java.api.common.classpath.ClassPathSupport$RelativePath@16bdc817, broken=false, additional={} |
---|
| 763 | +// artifactURI=null, type=0, property=${file.reference.classes.jar}, object=org.netbeans.modules.java.api.common.classpath.ClassPathSupport$RelativePath@9daa9c17, broken=false, additional={} |
---|
| 764 | + void Maximize() |
---|
| 765 | + { |
---|
| 766 | + if (CameraPane.FULLSCREEN) |
---|
| 767 | + { |
---|
| 768 | + ToggleFullScreen(); |
---|
| 769 | + } |
---|
| 770 | + |
---|
| 771 | + if (maximized) |
---|
| 772 | + { |
---|
| 773 | + frame.setBounds(keeprect.x, keeprect.y, keeprect.width, keeprect.height); |
---|
| 774 | + } |
---|
| 775 | + else |
---|
| 776 | + { |
---|
| 777 | + keeprect = frame.getBounds(); |
---|
| 778 | +// Rectangle rect = GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds(); |
---|
| 779 | +// Dimension rect2 = frame.getToolkit().getScreenSize(); |
---|
| 780 | +// frame.setBounds(0, rect2.height - rect.height, rect.width, rect.height); |
---|
| 781 | +// frame.setState(Frame.MAXIMIZED_BOTH); |
---|
| 782 | + frame.setBounds(frame.getGraphicsConfiguration().getBounds()); |
---|
| 783 | + } |
---|
| 784 | + |
---|
| 785 | + maximized ^= true; |
---|
| 786 | + |
---|
| 787 | + frame.validate(); |
---|
| 788 | + } |
---|
| 789 | + |
---|
| 790 | + cButton minButton; |
---|
| 791 | + cButton maxButton; |
---|
| 792 | + cButton fullButton; |
---|
| 793 | + |
---|
585 | 794 | void ToggleFullScreen() |
---|
586 | 795 | { |
---|
587 | | - if (CameraPane.FULLSCREEN) |
---|
| 796 | +GraphicsDevice device = frame.getGraphicsConfiguration().getDevice(); |
---|
| 797 | + |
---|
| 798 | + cameraView.ToggleFullScreen(); |
---|
| 799 | + |
---|
| 800 | + if (!CameraPane.FULLSCREEN) |
---|
588 | 801 | { |
---|
589 | | - frame.getContentPane().remove(/*"Center",*/bigThree); |
---|
590 | | - framePanel.add(bigThree); |
---|
591 | | - frame.getContentPane().add(/*"Center",*/framePanel); |
---|
| 802 | + device.setFullScreenWindow(null); |
---|
| 803 | + frame.dispose(); |
---|
| 804 | + frame.setUndecorated(false); |
---|
| 805 | + frame.validate(); |
---|
| 806 | + frame.setVisible(true); |
---|
| 807 | + |
---|
| 808 | + //frame.setVisible(false); |
---|
| 809 | +// frame.removeNotify(); |
---|
| 810 | +// frame.setUndecorated(false); |
---|
| 811 | +// frame.addNotify(); |
---|
| 812 | + //frame.setBounds(keeprect.x, keeprect.y, keeprect.width, keeprect.height); |
---|
| 813 | + |
---|
| 814 | +// X frame.getContentPane().remove(/*"Center",*/bigThree); |
---|
| 815 | +// X framePanel.add(bigThree); |
---|
| 816 | +// X frame.getContentPane().add(/*"Center",*/framePanel); |
---|
| 817 | + framePanel.setDividerLocation(46); |
---|
| 818 | + |
---|
| 819 | + //frame.setVisible(true); |
---|
| 820 | + radio.layout = keepButton; |
---|
| 821 | + //theFrame = null; |
---|
| 822 | + keepButton = null; |
---|
| 823 | + radio.layout.doClick(); |
---|
| 824 | + |
---|
592 | 825 | } else |
---|
593 | 826 | { |
---|
594 | | - frame.getContentPane().remove(/*"Center",*/framePanel); |
---|
595 | | - framePanel.remove(bigThree); |
---|
596 | | - frame.getContentPane().add(/*"Center",*/bigThree); |
---|
| 827 | + keepButton = radio.layout; |
---|
| 828 | + //keeprect = frame.getBounds(); |
---|
| 829 | +// frame.setBounds(0, 0, frame.getToolkit().getScreenSize().width, |
---|
| 830 | +// frame.getToolkit().getScreenSize().height); |
---|
| 831 | + //frame.setVisible(false); |
---|
| 832 | + |
---|
| 833 | + frame.dispose(); |
---|
| 834 | + frame.setUndecorated(true); |
---|
| 835 | + device.setFullScreenWindow(frame); |
---|
| 836 | + frame.validate(); |
---|
| 837 | + frame.setVisible(true); |
---|
| 838 | +// frame.removeNotify(); |
---|
| 839 | +// frame.setUndecorated(true); |
---|
| 840 | +// frame.addNotify(); |
---|
| 841 | +// X frame.getContentPane().remove(/*"Center",*/framePanel); |
---|
| 842 | +// X framePanel.remove(bigThree); |
---|
| 843 | +// X frame.getContentPane().add(/*"Center",*/bigThree); |
---|
| 844 | + framePanel.setDividerLocation(0); |
---|
| 845 | + |
---|
| 846 | + radio.layout = fullscreenLayout; |
---|
| 847 | + radio.layout.doClick(); |
---|
| 848 | + //frame.setVisible(true); |
---|
597 | 849 | } |
---|
598 | | - cameraView.ToggleFullScreen(); |
---|
| 850 | + frame.validate(); |
---|
599 | 851 | } |
---|
| 852 | + |
---|
| 853 | + private byte[] CompressCopy() |
---|
| 854 | + { |
---|
| 855 | + boolean temp = CameraPane.SWITCH; |
---|
| 856 | + CameraPane.SWITCH = false; |
---|
| 857 | + |
---|
| 858 | + copy.ExtractBigData(versiontable); |
---|
| 859 | + // if (copy == client) |
---|
| 860 | + |
---|
| 861 | + byte[] versions[] = copy.versions; |
---|
| 862 | + copy.versions = null; |
---|
| 863 | + |
---|
| 864 | + byte[] compress = Compress(copy); |
---|
| 865 | + |
---|
| 866 | + copy.versions = versions; |
---|
| 867 | + |
---|
| 868 | + copy.RestoreBigData(versiontable); |
---|
| 869 | + |
---|
| 870 | + CameraPane.SWITCH = temp; |
---|
| 871 | + |
---|
| 872 | + return compress; |
---|
| 873 | + } |
---|
600 | 874 | |
---|
601 | 875 | private JTextPane createTextPane() |
---|
602 | 876 | { |
---|
.. | .. |
---|
728 | 1002 | // NumberSlider vDivsField; |
---|
729 | 1003 | // JCheckBox endcaps; |
---|
730 | 1004 | JCheckBox liveCB; |
---|
731 | | - JCheckBox selectCB; |
---|
| 1005 | + JCheckBox selectableCB; |
---|
732 | 1006 | JCheckBox hideCB; |
---|
733 | 1007 | JCheckBox link2masterCB; |
---|
734 | 1008 | JCheckBox markCB; |
---|
.. | .. |
---|
736 | 1010 | JCheckBox speedupCB; |
---|
737 | 1011 | JCheckBox rewindCB; |
---|
738 | 1012 | JCheckBox flipVCB; |
---|
| 1013 | + |
---|
| 1014 | + cCheckBox toggleTextureCB; |
---|
| 1015 | + cCheckBox toggleSwitchCB; |
---|
| 1016 | + |
---|
739 | 1017 | JComboBox texresMenu; |
---|
| 1018 | + |
---|
740 | 1019 | JButton resetButton; |
---|
741 | 1020 | JButton stepButton; |
---|
742 | 1021 | JButton stepAllButton; |
---|
.. | .. |
---|
745 | 1024 | JButton fasterButton; |
---|
746 | 1025 | JButton remarkButton; |
---|
747 | 1026 | |
---|
| 1027 | + cGridBag editPanel; |
---|
| 1028 | + cGridBag editCommandsPanel; |
---|
| 1029 | + |
---|
748 | 1030 | cGridBag namePanel; |
---|
749 | 1031 | cGridBag setupPanel; |
---|
750 | | - cGridBag commandsPanel; |
---|
| 1032 | + cGridBag setupPanel2; |
---|
| 1033 | + cGridBag objectCommandsPanel; |
---|
751 | 1034 | cGridBag pushPanel; |
---|
752 | 1035 | cGridBag fillPanel; |
---|
753 | 1036 | |
---|
.. | .. |
---|
919 | 1202 | namePanel = new cGridBag(); |
---|
920 | 1203 | |
---|
921 | 1204 | nameField = AddText(namePanel, copy.GetName()); |
---|
922 | | - namePanel.add(nameField); |
---|
| 1205 | + namePanel.add(new JScrollPane(nameField, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER)); |
---|
923 | 1206 | oe.ctrlPanel.add(namePanel); |
---|
924 | 1207 | |
---|
925 | 1208 | oe.ctrlPanel.Return(); |
---|
926 | 1209 | |
---|
927 | | - if (!GroupEditor.allparams) |
---|
| 1210 | + if (!allparams) |
---|
928 | 1211 | return; |
---|
929 | 1212 | |
---|
930 | 1213 | setupPanel = new cGridBag().setVertical(false); |
---|
931 | 1214 | |
---|
932 | 1215 | liveCB = AddCheckBox(setupPanel, "Live", copy.live); |
---|
933 | 1216 | liveCB.setToolTipText("Animate object"); |
---|
934 | | - selectCB = AddCheckBox(setupPanel, "Select", !copy.dontselect); |
---|
935 | | - selectCB.setToolTipText("Make object selectable"); |
---|
| 1217 | + selectableCB = AddCheckBox(setupPanel, "Select", !copy.dontselect); |
---|
| 1218 | + selectableCB.setToolTipText("Make object selectable"); |
---|
936 | 1219 | // Return(); |
---|
| 1220 | + |
---|
937 | 1221 | hideCB = AddCheckBox(setupPanel, "Hide", copy.hide); |
---|
938 | 1222 | hideCB.setToolTipText("Hide object"); |
---|
939 | 1223 | markCB = AddCheckBox(setupPanel, "Mark", copy.marked); |
---|
940 | | - markCB.setToolTipText("Set the animation target transform"); |
---|
| 1224 | + markCB.setToolTipText("As animation target transform"); |
---|
941 | 1225 | |
---|
942 | | - rewindCB = AddCheckBox(setupPanel, "Rewind", copy.rewind); |
---|
| 1226 | + ToolTipManager.sharedInstance().setLightWeightPopupEnabled(false); |
---|
| 1227 | + |
---|
| 1228 | + setupPanel2 = new cGridBag().setVertical(false); |
---|
| 1229 | + |
---|
| 1230 | + rewindCB = AddCheckBox(setupPanel2, "Rewind", copy.rewind); |
---|
943 | 1231 | rewindCB.setToolTipText("Rewind animation"); |
---|
944 | 1232 | |
---|
945 | | - randomCB = AddCheckBox(setupPanel, "Random", copy.random); |
---|
946 | | - randomCB.setToolTipText("Option for switch node"); |
---|
| 1233 | + randomCB = AddCheckBox(setupPanel2, "Random", copy.random); |
---|
| 1234 | + randomCB.setToolTipText("Randomly Rewind (or Go back and forth)"); |
---|
947 | 1235 | |
---|
| 1236 | + link2masterCB = AddCheckBox(setupPanel2, "Support", copy.link2master); |
---|
| 1237 | + link2masterCB.setToolTipText("Attach to support"); |
---|
| 1238 | + |
---|
948 | 1239 | if (Globals.ADVANCED) |
---|
949 | 1240 | { |
---|
950 | | - link2masterCB = AddCheckBox(setupPanel, "Support", copy.link2master); |
---|
951 | | - link2masterCB.setToolTipText("Attach to support"); |
---|
952 | | - speedupCB = AddCheckBox(setupPanel, "Speed", copy.speedup); |
---|
| 1241 | + speedupCB = AddCheckBox(setupPanel2, "Speed", copy.speedup); |
---|
953 | 1242 | speedupCB.setToolTipText("Option motion capture"); |
---|
954 | 1243 | } |
---|
955 | 1244 | |
---|
956 | 1245 | oe.ctrlPanel.add(setupPanel); |
---|
957 | 1246 | oe.ctrlPanel.Return(); |
---|
| 1247 | + oe.ctrlPanel.add(setupPanel2); |
---|
| 1248 | + oe.ctrlPanel.Return(); |
---|
958 | 1249 | |
---|
959 | | - commandsPanel = new cGridBag().setVertical(false); |
---|
| 1250 | + objectCommandsPanel = new cGridBag().setVertical(false); |
---|
960 | 1251 | |
---|
961 | | - resetButton = AddButton(commandsPanel, "Reset"); |
---|
| 1252 | + resetButton = AddButton(objectCommandsPanel, "Reset"); |
---|
962 | 1253 | resetButton.setToolTipText("Jump to frame zero"); |
---|
963 | | - stepButton = AddButton(commandsPanel, "Step"); |
---|
| 1254 | + stepButton = AddButton(objectCommandsPanel, "Step"); |
---|
964 | 1255 | stepButton.setToolTipText("Step one frame"); |
---|
965 | 1256 | // resetAllButton = AddButton(oe, "Reset All"); |
---|
966 | 1257 | // stepAllButton = AddButton(oe, "Step All"); |
---|
967 | 1258 | // Return(); |
---|
968 | | - slowerButton = AddButton(commandsPanel, "Slow"); |
---|
| 1259 | + slowerButton = AddButton(objectCommandsPanel, "Slow"); |
---|
969 | 1260 | slowerButton.setToolTipText("Decrease animation speed"); |
---|
970 | | - fasterButton = AddButton(commandsPanel, "Fast"); |
---|
| 1261 | + fasterButton = AddButton(objectCommandsPanel, "Fast"); |
---|
971 | 1262 | fasterButton.setToolTipText("Increase animation speed"); |
---|
972 | | - remarkButton = AddButton(commandsPanel, "Remark"); |
---|
| 1263 | + remarkButton = AddButton(objectCommandsPanel, "Remark"); |
---|
973 | 1264 | remarkButton.setToolTipText("Set the current transform as the target"); |
---|
974 | 1265 | |
---|
975 | | - oe.ctrlPanel.add(commandsPanel); |
---|
| 1266 | + oe.ctrlPanel.add(objectCommandsPanel); |
---|
976 | 1267 | oe.ctrlPanel.Return(); |
---|
977 | 1268 | |
---|
978 | 1269 | pushPanel = AddSlider(oe.ctrlPanel, "Push", -1, 1, copy.NORMALPUSH, 1.1); // To have the buttons |
---|
.. | .. |
---|
1178 | 1469 | //worldPanel.setName("World"); |
---|
1179 | 1470 | centralPanel = new cGridBag(); |
---|
1180 | 1471 | centralPanel.preferredWidth = 20; |
---|
1181 | | - timelinePanel = new JPanel(new BorderLayout()); |
---|
1182 | | - timelineMenubar = new timeflow.app.TimeflowApp().TimeFlowWindow(timelinePanel); |
---|
| 1472 | + |
---|
| 1473 | + if (Globals.ADVANCED) |
---|
| 1474 | + { |
---|
| 1475 | + timelinePanel = new JPanel(new BorderLayout()); |
---|
| 1476 | + timelineMenubar = new timeflow.app.TimeflowApp().TimeFlowWindow(timelinePanel); |
---|
1183 | 1477 | |
---|
1184 | 1478 | cameraPanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, cameraView, timelinePanel); |
---|
1185 | 1479 | cameraPanel.setContinuousLayout(true); |
---|
.. | .. |
---|
1188 | 1482 | // cameraPanel.setDividerSize(9); |
---|
1189 | 1483 | cameraPanel.setResizeWeight(1.0); |
---|
1190 | 1484 | |
---|
| 1485 | + } |
---|
| 1486 | + |
---|
1191 | 1487 | centralPanel.add(cameraView); |
---|
| 1488 | + centralPanel.setFocusable(true); |
---|
1192 | 1489 | //frame.setJMenuBar(timelineMenubar); |
---|
1193 | 1490 | //centralPanel.add(timelinePanel); |
---|
1194 | 1491 | |
---|
.. | .. |
---|
1214 | 1511 | XYZPanel.addComponent(/*BorderLayout.SOUTH,*/sideView); // Scroll); |
---|
1215 | 1512 | XYZPanel.addComponent(/*BorderLayout.CENTER,*/frontView); // Scroll); |
---|
1216 | 1513 | XYZPanel.addComponent(/*BorderLayout.NORTH,*/topView); // Scroll); |
---|
| 1514 | + //XYZPanel.setName("XYZ"); |
---|
1217 | 1515 | |
---|
1218 | 1516 | /* |
---|
1219 | 1517 | gridPanel = new JPanel(); //new BorderLayout()); |
---|
.. | .. |
---|
1251 | 1549 | //JScrollPane tmp = new JScrollPane(ctrlPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); |
---|
1252 | 1550 | //tmp.setName("Edit"); |
---|
1253 | 1551 | objectPanel.add(materialPanel); |
---|
| 1552 | + objectPanel.setIconAt(0, GetIcon("icons/material.png")); |
---|
| 1553 | + objectPanel.setToolTipTextAt(0, "Material panel"); |
---|
| 1554 | + |
---|
1254 | 1555 | // JPanel north = new JPanel(new BorderLayout()); |
---|
1255 | 1556 | // north.setName("Edit"); |
---|
1256 | 1557 | // north.add(ctrlPanel, BorderLayout.NORTH); |
---|
1257 | 1558 | // objectPanel.add(north); |
---|
1258 | | - objectPanel.add(ctrlPanel); |
---|
1259 | | - objectPanel.add(infoPanel); |
---|
| 1559 | + objectPanel.add(editPanel); |
---|
| 1560 | + objectPanel.setIconAt(1, GetIcon("icons/write.png")); |
---|
| 1561 | + objectPanel.setToolTipTextAt(1, "Edit panel"); |
---|
| 1562 | + |
---|
| 1563 | + //if (Globals.ADVANCED) |
---|
| 1564 | + objectPanel.add(infoPanel); |
---|
| 1565 | + objectPanel.setIconAt(2, GetIcon("icons/info.png")); |
---|
| 1566 | + objectPanel.setToolTipTextAt(2, "Info panel"); |
---|
| 1567 | + |
---|
| 1568 | + objectPanel.add(XYZPanel); |
---|
| 1569 | + objectPanel.setIconAt(3, GetIcon("icons/XYZ.png")); |
---|
| 1570 | + objectPanel.setToolTipTextAt(3, "XYZ/RGB panel"); |
---|
| 1571 | + |
---|
| 1572 | + objectPanel.add(toolboxPanel); |
---|
| 1573 | + objectPanel.setIconAt(4, GetIcon("icons/primitives.png")); |
---|
| 1574 | + objectPanel.setToolTipTextAt(4, "Objects/backgrounds panel"); |
---|
1260 | 1575 | |
---|
1261 | 1576 | /* |
---|
1262 | 1577 | aConstraints.gridx = 0; |
---|
.. | .. |
---|
1265 | 1580 | aConstraints.gridy += 1; |
---|
1266 | 1581 | aConstraints.gridwidth = 1; |
---|
1267 | 1582 | mainPanel.add(objectPanel, aConstraints); |
---|
1268 | | - */ |
---|
| 1583 | + */ |
---|
1269 | 1584 | |
---|
1270 | 1585 | scrollpane = new JScrollPane(mainPanel, ScrollPaneConstants.// VERTICAL_SCROLLBAR_ALWAYS, |
---|
1271 | 1586 | VERTICAL_SCROLLBAR_AS_NEEDED, |
---|
.. | .. |
---|
1277 | 1592 | scrollpane.addMouseWheelListener(this); // Default not fast enough |
---|
1278 | 1593 | |
---|
1279 | 1594 | /*JTabbedPane*/ scenePanel = new cGridBag(); |
---|
1280 | | - scenePanel.preferredWidth = 6; |
---|
| 1595 | + scenePanel.preferredWidth = 5; |
---|
1281 | 1596 | |
---|
1282 | 1597 | JTabbedPane tabbedPane = new JTabbedPane(); |
---|
1283 | 1598 | tabbedPane.add(scrollpane); |
---|
1284 | 1599 | |
---|
1285 | | - tabbedPane.add(FSPane = new cFileSystemPane(this)); |
---|
1286 | | - |
---|
1287 | | - optionsPanel = new cGridBag().setVertical(true); |
---|
| 1600 | + optionsPanel = new cGridBag().setVertical(false); |
---|
1288 | 1601 | |
---|
1289 | 1602 | optionsPanel.setName("Options"); |
---|
1290 | 1603 | |
---|
.. | .. |
---|
1292 | 1605 | |
---|
1293 | 1606 | tabbedPane.add(optionsPanel); |
---|
1294 | 1607 | |
---|
| 1608 | + tabbedPane.add(FSPane = new cFileSystemPane(this)); |
---|
| 1609 | + |
---|
1295 | 1610 | scenePanel.add(tabbedPane); |
---|
1296 | 1611 | |
---|
1297 | 1612 | /* |
---|
.. | .. |
---|
1355 | 1670 | bigThree = new cGridBag(); |
---|
1356 | 1671 | bigThree.addComponent(scenePanel); |
---|
1357 | 1672 | bigThree.addComponent(centralPanel); |
---|
1358 | | - bigThree.addComponent(XYZPanel); |
---|
| 1673 | + //bigThree.addComponent(XYZPanel); |
---|
1359 | 1674 | |
---|
1360 | 1675 | // // SIDE EFFECT!!! |
---|
1361 | 1676 | // aConstraints.gridx = 0; |
---|
.. | .. |
---|
1364 | 1679 | // aConstraints.gridheight = 1; |
---|
1365 | 1680 | |
---|
1366 | 1681 | framePanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, toolbarPanel, bigThree); |
---|
1367 | | - framePanel.setContinuousLayout(true); |
---|
1368 | | - framePanel.setOneTouchExpandable(true); |
---|
1369 | | - framePanel.setDividerLocation(0.8); |
---|
| 1682 | + framePanel.setContinuousLayout(false); |
---|
| 1683 | + framePanel.setOneTouchExpandable(false); |
---|
| 1684 | + //.setDividerLocation(0.8); |
---|
1370 | 1685 | //framePanel.setDividerSize(15); |
---|
1371 | 1686 | //framePanel.setResizeWeight(0.15); |
---|
1372 | 1687 | framePanel.setName("Frame"); |
---|
.. | .. |
---|
1384 | 1699 | // aConstraints = gbc; // (GridBagConstraints) GrafreeD.clone(gbc); |
---|
1385 | 1700 | |
---|
1386 | 1701 | frame.setSize(1280, 860); |
---|
1387 | | - frame.setVisible(true); |
---|
1388 | | - |
---|
| 1702 | + |
---|
| 1703 | + cameraView.requestFocusInWindow(); |
---|
| 1704 | + |
---|
1389 | 1705 | gridPanel.setDividerLocation(1.0); |
---|
| 1706 | + |
---|
| 1707 | + frame.validate(); |
---|
| 1708 | + |
---|
| 1709 | + frame.setVisible(true); |
---|
1390 | 1710 | |
---|
1391 | 1711 | frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); |
---|
1392 | 1712 | frame.addWindowListener(new WindowAdapter() |
---|
1393 | 1713 | { |
---|
1394 | | - |
---|
1395 | 1714 | public void windowClosing(WindowEvent e) |
---|
1396 | 1715 | { |
---|
1397 | 1716 | Close(); |
---|
.. | .. |
---|
1453 | 1772 | //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints); |
---|
1454 | 1773 | |
---|
1455 | 1774 | cGridBag colorSection = new cGridBag().setVertical(true); |
---|
| 1775 | + |
---|
| 1776 | + cGridBag huepanel = new cGridBag(); |
---|
| 1777 | + cGridBag huelabel = new cGridBag(); |
---|
| 1778 | + huelabel.add(GetLabel("icons/hue.png", false)); |
---|
| 1779 | + huelabel.preferredWidth = 20; |
---|
| 1780 | + huepanel.add(new cGridBag()); // Label |
---|
| 1781 | + huepanel.add(huelabel); // Field/slider |
---|
| 1782 | + |
---|
| 1783 | + huepanel.preferredHeight = 7; |
---|
| 1784 | + |
---|
| 1785 | + colorSection.add(huepanel); |
---|
1456 | 1786 | |
---|
1457 | 1787 | cGridBag color = new cGridBag(); |
---|
1458 | | - color.add(colorLabel = new JLabel("Color/hue")); // , aConstraints); |
---|
1459 | | - colorLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1460 | | - color.add(colorField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
| 1788 | + |
---|
| 1789 | + color.add(colorLabel = new JLabel("Color/hue")); // , aConstraints); |
---|
| 1790 | + colorLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 1791 | + color.add(colorField = new cNumberSlider(this, 0.001, 1)); // , aConstraints); |
---|
| 1792 | + |
---|
1461 | 1793 | //colorField.preferredWidth = 200; |
---|
1462 | 1794 | colorSection.add(color); |
---|
1463 | 1795 | |
---|
1464 | 1796 | cGridBag modulation = new cGridBag(); |
---|
1465 | 1797 | modulation.add(modulationLabel = new JLabel("Saturation")); // , aConstraints); |
---|
1466 | 1798 | modulationLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1467 | | - modulation.add(modulationField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
| 1799 | + modulation.add(modulationField = new cNumberSlider(this, 0.001, 1)); // , aConstraints); |
---|
1468 | 1800 | colorSection.add(modulation); |
---|
1469 | 1801 | |
---|
| 1802 | + cGridBag opacity = new cGridBag(); |
---|
| 1803 | + opacity.add(opacityLabel = new JLabel("Opacity")); // , aConstraints); |
---|
| 1804 | + opacityLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 1805 | + opacity.add(opacityField = new cNumberSlider(this, 0.001, 1)); // , aConstraints); |
---|
| 1806 | + colorSection.add(opacity); |
---|
| 1807 | + |
---|
| 1808 | + colorSection.add(GetSeparator()); |
---|
| 1809 | + |
---|
1470 | 1810 | cGridBag texture = new cGridBag(); |
---|
1471 | 1811 | texture.add(textureLabel = new JLabel("Texture")); // , aConstraints); |
---|
1472 | 1812 | textureLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1473 | 1813 | texture.add(textureField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
1474 | 1814 | colorSection.add(texture); |
---|
1475 | 1815 | |
---|
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 | | - panel.add(new JSeparator()); |
---|
| 1816 | + panel.add(GetSeparator()); |
---|
1495 | 1817 | |
---|
1496 | 1818 | panel.add(colorSection); |
---|
1497 | 1819 | |
---|
.. | .. |
---|
1541 | 1863 | fakedepth.add(fakedepthField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
1542 | 1864 | diffuseSection.add(fakedepth); |
---|
1543 | 1865 | |
---|
1544 | | - panel.add(new JSeparator()); |
---|
| 1866 | + cGridBag shadowbias = new cGridBag(); |
---|
| 1867 | + shadowbias.add(shadowbiasLabel = new JLabel("Shadowbias")); // , aConstraints); |
---|
| 1868 | + shadowbiasLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 1869 | + shadowbias.add(shadowbiasField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
| 1870 | + diffuseSection.add(shadowbias); |
---|
| 1871 | + |
---|
| 1872 | + panel.add(GetSeparator()); |
---|
1545 | 1873 | |
---|
1546 | 1874 | panel.add(diffuseSection); |
---|
1547 | 1875 | |
---|
.. | .. |
---|
1591 | 1919 | // aConstraints.gridy += 1; |
---|
1592 | 1920 | // aConstraints.gridwidth = 1; |
---|
1593 | 1921 | |
---|
| 1922 | + cGridBag anisoU = new cGridBag(); |
---|
| 1923 | + anisoU.add(anisoLabel = new JLabel("AnisoU")); // , aConstraints); |
---|
| 1924 | + anisoLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 1925 | + anisoU.add(anisoField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
| 1926 | + specularSection.add(anisoU); |
---|
1594 | 1927 | |
---|
1595 | | - panel.add(new JSeparator()); |
---|
| 1928 | + cGridBag anisoV = new cGridBag(); |
---|
| 1929 | + anisoV.add(anisoVLabel = new JLabel("AnisoV")); // , aConstraints); |
---|
| 1930 | + anisoVLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 1931 | + anisoV.add(anisoVField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
| 1932 | + specularSection.add(anisoV); |
---|
| 1933 | + |
---|
| 1934 | + |
---|
| 1935 | + panel.add(GetSeparator()); |
---|
1596 | 1936 | |
---|
1597 | 1937 | panel.add(specularSection); |
---|
1598 | 1938 | |
---|
1599 | 1939 | //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints); |
---|
1600 | 1940 | |
---|
1601 | | - cGridBag globalSection = new cGridBag().setVertical(true); |
---|
| 1941 | + //cGridBag globalSection = new cGridBag().setVertical(true); |
---|
1602 | 1942 | |
---|
1603 | 1943 | cGridBag camera = new cGridBag(); |
---|
1604 | 1944 | camera.add(cameraLabel = new JLabel("GlobalLight")); // , aConstraints); |
---|
1605 | 1945 | cameraLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1606 | 1946 | camera.add(cameraField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
1607 | | - globalSection.add(camera); |
---|
| 1947 | + colorSection.add(camera); |
---|
1608 | 1948 | |
---|
1609 | 1949 | cGridBag ambient = new cGridBag(); |
---|
1610 | 1950 | ambient.add(ambientLabel = new JLabel("Ambient")); // , aConstraints); |
---|
1611 | 1951 | ambientLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1612 | 1952 | ambient.add(ambientField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
1613 | | - globalSection.add(ambient); |
---|
| 1953 | + colorSection.add(ambient); |
---|
1614 | 1954 | |
---|
1615 | 1955 | cGridBag backlit = new cGridBag(); |
---|
1616 | 1956 | backlit.add(backlitLabel = new JLabel("Backlit")); // , aConstraints); |
---|
1617 | 1957 | backlitLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1618 | 1958 | backlit.add(backlitField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
1619 | | - globalSection.add(backlit); |
---|
| 1959 | + colorSection.add(backlit); |
---|
1620 | 1960 | |
---|
1621 | | - cGridBag opacity = new cGridBag(); |
---|
1622 | | - opacity.add(opacityLabel = new JLabel("Opacity")); // , aConstraints); |
---|
1623 | | - opacityLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1624 | | - opacity.add(opacityField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
1625 | | - globalSection.add(opacity); |
---|
1626 | | - |
---|
1627 | | - panel.add(new JSeparator()); |
---|
| 1961 | + //panel.add(new JSeparator()); |
---|
1628 | 1962 | |
---|
1629 | | - panel.add(globalSection); |
---|
| 1963 | + //panel.add(globalSection); |
---|
1630 | 1964 | |
---|
1631 | 1965 | //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints); |
---|
1632 | 1966 | |
---|
.. | .. |
---|
1668 | 2002 | opacityPower.add(opacityPowerField = new cNumberSlider(this, 0.0, 10 /*10 dec 2013*/)); // , aConstraints); |
---|
1669 | 2003 | textureSection.add(opacityPower); |
---|
1670 | 2004 | |
---|
1671 | | - panel.add(new JSeparator()); |
---|
| 2005 | + panel.add(GetSeparator()); |
---|
1672 | 2006 | |
---|
1673 | 2007 | panel.add(textureSection); |
---|
1674 | 2008 | |
---|
.. | .. |
---|
1733 | 2067 | // 3D models |
---|
1734 | 2068 | if (filename.endsWith(".3ds") || filename.endsWith(".3DS")) |
---|
1735 | 2069 | { |
---|
1736 | | - lastConverter = new com.jmex.model.converters.MaxToJme(); |
---|
1737 | | - LoadFile(filename, lastConverter); |
---|
| 2070 | + //lastConverter = new com.jmex.model.converters.MaxToJme(); |
---|
| 2071 | + //LoadFile(filename, lastConverter); |
---|
| 2072 | + LoadObjFile(filename); // New 3ds loader |
---|
1738 | 2073 | continue; |
---|
1739 | 2074 | } |
---|
1740 | 2075 | if (filename.endsWith(".dae") || filename.endsWith(".DAE")) |
---|
.. | .. |
---|
2460 | 2795 | LA.matXRotate(((Object3D) group.get(group.size() - 1)).toParent, -Math.PI / 2); |
---|
2461 | 2796 | LA.matXRotate(((Object3D) group.get(group.size() - 1)).fromParent, Math.PI / 2); |
---|
2462 | 2797 | } |
---|
| 2798 | + |
---|
2463 | 2799 | //cJME.count++; |
---|
2464 | 2800 | //cJME.count %= 12; |
---|
2465 | 2801 | if (gc) |
---|
.. | .. |
---|
2643 | 2979 | } |
---|
2644 | 2980 | } |
---|
2645 | 2981 | } |
---|
| 2982 | + |
---|
2646 | 2983 | cFileSystemPane FSPane; |
---|
2647 | 2984 | |
---|
2648 | 2985 | void SetMaterial(cMaterial mat, Object3D.cVector2[] others) |
---|
.. | .. |
---|
2696 | 3033 | } |
---|
2697 | 3034 | } |
---|
2698 | 3035 | } |
---|
| 3036 | + |
---|
2699 | 3037 | freezematerial = false; |
---|
2700 | 3038 | } |
---|
2701 | 3039 | |
---|
2702 | 3040 | void SetMaterial(Object3D object) |
---|
2703 | 3041 | { |
---|
| 3042 | + latestObject = object; |
---|
| 3043 | + |
---|
2704 | 3044 | cMaterial mat = object.material; |
---|
2705 | 3045 | |
---|
2706 | 3046 | if (mat == null) |
---|
.. | .. |
---|
2812 | 3152 | // } |
---|
2813 | 3153 | |
---|
2814 | 3154 | /**/ |
---|
2815 | | - if (deselect) |
---|
| 3155 | + if (deselect || child == null) |
---|
2816 | 3156 | { |
---|
2817 | 3157 | //group.deselectAll(); |
---|
2818 | 3158 | //freeze = true; |
---|
2819 | 3159 | GetTree().clearSelection(); |
---|
2820 | 3160 | //freeze = false; |
---|
| 3161 | + |
---|
| 3162 | + if (child == null) |
---|
| 3163 | + { |
---|
| 3164 | + return; |
---|
| 3165 | + } |
---|
2821 | 3166 | } |
---|
2822 | 3167 | |
---|
2823 | 3168 | //group.addSelectee(child); |
---|
.. | .. |
---|
2886 | 3231 | cameraView.ToggleDL(); |
---|
2887 | 3232 | cameraView.repaint(); |
---|
2888 | 3233 | return; |
---|
2889 | | - } else if (event.getSource() == toggleTextureItem) |
---|
| 3234 | + } else if (event.getSource() == toggleTextureItem || event.getSource() == toggleTextureCB) |
---|
2890 | 3235 | { |
---|
2891 | 3236 | cameraView.ToggleTexture(); |
---|
2892 | 3237 | // june 2013 copy.HardTouch(); |
---|
.. | .. |
---|
2925 | 3270 | frame.validate(); |
---|
2926 | 3271 | |
---|
2927 | 3272 | return; |
---|
2928 | | - } else if (event.getSource() == toggleSwitchItem) |
---|
| 3273 | + } else if (event.getSource() == toggleSwitchItem || event.getSource() == toggleSwitchCB) |
---|
2929 | 3274 | { |
---|
2930 | 3275 | cameraView.ToggleSwitch(); |
---|
2931 | 3276 | cameraView.repaint(); |
---|
.. | .. |
---|
2956 | 3301 | { |
---|
2957 | 3302 | copy.live ^= true; |
---|
2958 | 3303 | return; |
---|
2959 | | - } else if (event.getSource() == selectCB) |
---|
| 3304 | + } else if (event.getSource() == selectableCB) |
---|
2960 | 3305 | { |
---|
2961 | 3306 | copy.dontselect ^= true; |
---|
2962 | 3307 | return; |
---|
.. | .. |
---|
3141 | 3486 | { |
---|
3142 | 3487 | Close(); |
---|
3143 | 3488 | //return true; |
---|
3144 | | - } else if (source == loadItem) |
---|
| 3489 | + } else if (source == openItem) |
---|
3145 | 3490 | { |
---|
3146 | | - load(); |
---|
| 3491 | + Open(); |
---|
3147 | 3492 | //return true; |
---|
3148 | 3493 | } else if (source == newItem) |
---|
3149 | 3494 | { |
---|
.. | .. |
---|
3168 | 3513 | { |
---|
3169 | 3514 | generatePOV(); |
---|
3170 | 3515 | //return true; |
---|
| 3516 | + } else if (event.getSource() == archiveItem) |
---|
| 3517 | + { |
---|
| 3518 | + cTools.Archive(frame); |
---|
| 3519 | + return; |
---|
3171 | 3520 | } else if (source == zBufferItem) |
---|
3172 | 3521 | { |
---|
3173 | 3522 | try |
---|
.. | .. |
---|
3219 | 3568 | try |
---|
3220 | 3569 | { |
---|
3221 | 3570 | ByteArrayOutputStream baos = new ByteArrayOutputStream(); |
---|
3222 | | - java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(baos); |
---|
3223 | | - ObjectOutputStream out = new ObjectOutputStream(zstream); |
---|
| 3571 | +// java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(baos); |
---|
| 3572 | + ObjectOutputStream out = new ObjectOutputStream(baos); //zstream); |
---|
3224 | 3573 | |
---|
3225 | 3574 | Object3D parent = o.parent; |
---|
3226 | 3575 | o.parent = null; |
---|
.. | .. |
---|
3231 | 3580 | |
---|
3232 | 3581 | out.flush(); |
---|
3233 | 3582 | |
---|
3234 | | - zstream.close(); |
---|
| 3583 | + baos //zstream |
---|
| 3584 | + .close(); |
---|
3235 | 3585 | out.close(); |
---|
3236 | 3586 | |
---|
3237 | | - return baos.toByteArray(); |
---|
| 3587 | + byte[] bytes = baos.toByteArray(); |
---|
| 3588 | + |
---|
| 3589 | + System.out.println("save #bytes = " + bytes.length); |
---|
| 3590 | + return bytes; |
---|
3238 | 3591 | } catch (Exception e) |
---|
3239 | 3592 | { |
---|
3240 | 3593 | System.err.println(e); |
---|
.. | .. |
---|
3244 | 3597 | |
---|
3245 | 3598 | static public Object Uncompress(byte[] bytes) |
---|
3246 | 3599 | { |
---|
3247 | | - System.out.println("#bytes = " + bytes.length); |
---|
| 3600 | + System.out.println("restore #bytes = " + bytes.length); |
---|
3248 | 3601 | try |
---|
3249 | 3602 | { |
---|
3250 | 3603 | ByteArrayInputStream bais = new ByteArrayInputStream(bytes); |
---|
3251 | | - java.util.zip.GZIPInputStream istream = new java.util.zip.GZIPInputStream(bais); |
---|
3252 | | - ObjectInputStream in = new ObjectInputStream(istream); |
---|
| 3604 | + //java.util.zip.GZIPInputStream istream = new java.util.zip.GZIPInputStream(bais); |
---|
| 3605 | + ObjectInputStream in = new ObjectInputStream(bais); // istream); |
---|
3253 | 3606 | Object obj = in.readObject(); |
---|
| 3607 | + |
---|
| 3608 | + bais //istream |
---|
| 3609 | + .close(); |
---|
3254 | 3610 | in.close(); |
---|
3255 | 3611 | |
---|
3256 | 3612 | return obj; |
---|
.. | .. |
---|
3305 | 3661 | return null; |
---|
3306 | 3662 | } |
---|
3307 | 3663 | |
---|
3308 | | - java.util.Hashtable<java.util.UUID, Object3D> hashtable = new java.util.Hashtable<java.util.UUID, Object3D>(); |
---|
3309 | 3664 | |
---|
3310 | 3665 | public void Save() |
---|
3311 | 3666 | { |
---|
| 3667 | + //Save(true); |
---|
| 3668 | + Replace(); |
---|
| 3669 | + } |
---|
| 3670 | + |
---|
| 3671 | + private boolean Equal(byte[] compress, byte[] name) |
---|
| 3672 | + { |
---|
| 3673 | + if (compress.length != name.length) |
---|
| 3674 | + { |
---|
| 3675 | + return false; |
---|
| 3676 | + } |
---|
| 3677 | + |
---|
| 3678 | + for (int i=compress.length; --i>=0;) |
---|
| 3679 | + { |
---|
| 3680 | + if (compress[i] != name[i]) |
---|
| 3681 | + return false; |
---|
| 3682 | + } |
---|
| 3683 | + |
---|
| 3684 | + return true; |
---|
| 3685 | + } |
---|
| 3686 | + |
---|
| 3687 | + java.util.Hashtable<java.util.UUID, Object3D> versiontable = new java.util.Hashtable<java.util.UUID, Object3D>(); |
---|
| 3688 | + |
---|
| 3689 | + public boolean Save(boolean user) |
---|
| 3690 | + { |
---|
| 3691 | + System.err.println("Save"); |
---|
| 3692 | + |
---|
3312 | 3693 | cRadio tab = GetCurrentTab(); |
---|
3313 | 3694 | |
---|
3314 | | - boolean temp = CameraPane.SWITCH; |
---|
3315 | | - CameraPane.SWITCH = false; |
---|
| 3695 | + byte[] compress = CompressCopy(); // Saved version. No need for "Replace". |
---|
3316 | 3696 | |
---|
3317 | | - copy.ExtractBigData(hashtable); |
---|
| 3697 | + boolean thesame = false; |
---|
| 3698 | + |
---|
| 3699 | + // Quick heuristic using length. Works only when stream is compressed. |
---|
| 3700 | + if (copy.versionindex > 0 && copy.versions[copy.versionindex-1] != null && Equal(compress, copy.versions[copy.versionindex-1])) |
---|
| 3701 | + { |
---|
| 3702 | + thesame = true; |
---|
| 3703 | + } |
---|
3318 | 3704 | |
---|
3319 | 3705 | //EditorFrame.m_MainFrame.requestFocusInWindow(); |
---|
3320 | | - tab.graphs[tab.undoindex++] = Compress(copy); |
---|
3321 | | - |
---|
3322 | | - copy.RestoreBigData(hashtable); |
---|
3323 | | - |
---|
3324 | | - CameraPane.SWITCH = temp; |
---|
3325 | | - |
---|
3326 | | - //assert(hashtable.isEmpty()); |
---|
3327 | | - |
---|
3328 | | - for (int i = tab.undoindex; i < tab.graphs.length; i++) |
---|
| 3706 | + if (!thesame) |
---|
3329 | 3707 | { |
---|
3330 | | - tab.graphs[i] = null; |
---|
| 3708 | + //tab.user[tab.versionindex] = user; |
---|
| 3709 | + //boolean increment = true; // tab.graphs[tab.versionindex] == null; |
---|
| 3710 | + |
---|
| 3711 | + copy.versions[++copy.versionindex] = compress; |
---|
| 3712 | + |
---|
| 3713 | + // if (increment) |
---|
| 3714 | + // tab.versionindex++; |
---|
3331 | 3715 | } |
---|
3332 | 3716 | |
---|
| 3717 | + //copy.RestoreBigData(versiontable); |
---|
| 3718 | + |
---|
| 3719 | + //assert(hashtable.isEmpty()); |
---|
| 3720 | + |
---|
| 3721 | + for (int i = copy.versionindex+1; i < copy.versions.length; i++) |
---|
| 3722 | + { |
---|
| 3723 | + //tab.user[i] = false; |
---|
| 3724 | + copy.versions[i] = null; |
---|
| 3725 | + } |
---|
| 3726 | + |
---|
| 3727 | + SetUndoStates(); |
---|
| 3728 | + |
---|
3333 | 3729 | // test save |
---|
3334 | 3730 | if (false) |
---|
3335 | 3731 | { |
---|
3336 | 3732 | try |
---|
3337 | 3733 | { |
---|
3338 | | - FileOutputStream ostream = new FileOutputStream("save" + tab.undoindex); |
---|
| 3734 | + FileOutputStream ostream = new FileOutputStream("save" + copy.versionindex); |
---|
3339 | 3735 | ObjectOutputStream p = new ObjectOutputStream(ostream); |
---|
3340 | 3736 | |
---|
3341 | 3737 | p.writeObject(copy); |
---|
.. | .. |
---|
3348 | 3744 | e.printStackTrace(); |
---|
3349 | 3745 | } |
---|
3350 | 3746 | } |
---|
| 3747 | + |
---|
| 3748 | + return !thesame; |
---|
3351 | 3749 | } |
---|
3352 | 3750 | |
---|
3353 | 3751 | void CopyChanged(Object3D obj) |
---|
3354 | 3752 | { |
---|
| 3753 | + SetUndoStates(); |
---|
| 3754 | + |
---|
3355 | 3755 | boolean temp = CameraPane.SWITCH; |
---|
3356 | 3756 | CameraPane.SWITCH = false; |
---|
3357 | 3757 | |
---|
3358 | | - copy.ExtractBigData(hashtable); |
---|
| 3758 | + copy.ExtractBigData(versiontable); |
---|
3359 | 3759 | |
---|
3360 | 3760 | copy.clear(); |
---|
3361 | 3761 | |
---|
| 3762 | + copy.skyboxname = obj.skyboxname; |
---|
| 3763 | + copy.skyboxext = obj.skyboxext; |
---|
| 3764 | + |
---|
3362 | 3765 | for (int i=0; i<obj.Size(); i++) |
---|
3363 | 3766 | { |
---|
3364 | 3767 | copy.add(obj.get(i)); |
---|
3365 | 3768 | } |
---|
3366 | 3769 | |
---|
3367 | | - copy.RestoreBigData(hashtable); |
---|
| 3770 | + copy.RestoreBigData(versiontable); |
---|
3368 | 3771 | |
---|
3369 | 3772 | CameraPane.SWITCH = temp; |
---|
3370 | 3773 | |
---|
.. | .. |
---|
3391 | 3794 | refreshContents(); |
---|
3392 | 3795 | } |
---|
3393 | 3796 | |
---|
3394 | | - public void Undo() |
---|
| 3797 | + cButton undoButton; |
---|
| 3798 | + cButton restoreButton; |
---|
| 3799 | + cButton replaceButton; |
---|
| 3800 | + cButton redoButton; |
---|
| 3801 | + |
---|
| 3802 | + boolean muteSlider; |
---|
| 3803 | + |
---|
| 3804 | + int VersionCount() |
---|
| 3805 | + { |
---|
| 3806 | + int count = 0; |
---|
| 3807 | + |
---|
| 3808 | + for (int i = copy.versions.length; --i >= 0;) |
---|
| 3809 | + { |
---|
| 3810 | + if (copy.versions[i] != null) |
---|
| 3811 | + count++; |
---|
| 3812 | + } |
---|
| 3813 | + |
---|
| 3814 | + return count; |
---|
| 3815 | + } |
---|
| 3816 | + |
---|
| 3817 | + void SetUndoStates() |
---|
3395 | 3818 | { |
---|
3396 | 3819 | cRadio tab = GetCurrentTab(); |
---|
3397 | 3820 | |
---|
3398 | | - if (tab.undoindex == 0) |
---|
| 3821 | + restoreButton.setEnabled(copy.versionindex != -1); |
---|
| 3822 | + replaceButton.setEnabled(copy.versionindex != -1); |
---|
| 3823 | + |
---|
| 3824 | + undoButton.setEnabled(copy.versionindex > 0); |
---|
| 3825 | + redoButton.setEnabled(copy.versions[copy.versionindex + 1] != null); |
---|
| 3826 | + |
---|
| 3827 | + muteSlider = true; |
---|
| 3828 | + versionSlider.setMaximum(VersionCount() - 1); |
---|
| 3829 | + versionSlider.setInteger(copy.versionindex); |
---|
| 3830 | + muteSlider = false; |
---|
| 3831 | + } |
---|
| 3832 | + |
---|
| 3833 | + public boolean Undo() |
---|
| 3834 | + { |
---|
| 3835 | + // Option? |
---|
| 3836 | + Replace(); |
---|
| 3837 | + |
---|
| 3838 | + System.err.println("Undo"); |
---|
| 3839 | + |
---|
| 3840 | + cRadio tab = GetCurrentTab(); |
---|
| 3841 | + |
---|
| 3842 | + if (copy.versionindex == 0) |
---|
3399 | 3843 | { |
---|
3400 | 3844 | java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
3401 | | - return; |
---|
| 3845 | + return false; |
---|
3402 | 3846 | } |
---|
3403 | 3847 | |
---|
3404 | | - if (tab.graphs[tab.undoindex] == null) |
---|
| 3848 | +// if (tab.graphs[tab.versionindex] == null) // || !tab.user[tab.versionindex]) |
---|
| 3849 | +// { |
---|
| 3850 | +// if (Save(false)) |
---|
| 3851 | +// tab.versionindex -= 1; |
---|
| 3852 | +// else |
---|
| 3853 | +// { |
---|
| 3854 | +// if (tab.versionindex <= 0) |
---|
| 3855 | +// return false; |
---|
| 3856 | +// else |
---|
| 3857 | +// tab.versionindex -= 1; |
---|
| 3858 | +// } |
---|
| 3859 | +// } |
---|
| 3860 | + |
---|
| 3861 | + copy.versionindex -= 1; |
---|
| 3862 | + |
---|
| 3863 | + CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex])); |
---|
| 3864 | + |
---|
| 3865 | + return true; |
---|
| 3866 | + } |
---|
| 3867 | + |
---|
| 3868 | + public boolean Restore() |
---|
| 3869 | + { |
---|
| 3870 | + System.err.println("Restore"); |
---|
| 3871 | + |
---|
| 3872 | + cRadio tab = GetCurrentTab(); |
---|
| 3873 | + |
---|
| 3874 | + if (copy.versionindex == -1 || copy.versions[copy.versionindex] == null) |
---|
3405 | 3875 | { |
---|
3406 | | - Save(); |
---|
3407 | | - tab.undoindex -= 1; |
---|
| 3876 | + java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
| 3877 | + return false; |
---|
3408 | 3878 | } |
---|
3409 | 3879 | |
---|
3410 | | - tab.undoindex -= 1; |
---|
| 3880 | + CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex])); |
---|
| 3881 | + |
---|
| 3882 | + return true; |
---|
| 3883 | + } |
---|
3411 | 3884 | |
---|
3412 | | - CopyChanged((Object3D)Uncompress(tab.graphs[tab.undoindex])); |
---|
| 3885 | + public boolean Replace() |
---|
| 3886 | + { |
---|
| 3887 | + System.err.println("Replace"); |
---|
| 3888 | + |
---|
| 3889 | + cRadio tab = GetCurrentTab(); |
---|
| 3890 | + |
---|
| 3891 | + if (copy.versionindex == -1 || copy.versions[copy.versionindex] == null) |
---|
| 3892 | + { |
---|
| 3893 | + // No version yet. OK. java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
| 3894 | + return false; |
---|
| 3895 | + } |
---|
| 3896 | + |
---|
| 3897 | + copy.versions[copy.versionindex] = CompressCopy(); |
---|
| 3898 | + |
---|
| 3899 | + return true; |
---|
3413 | 3900 | } |
---|
3414 | 3901 | |
---|
3415 | 3902 | public void Redo() |
---|
3416 | 3903 | { |
---|
| 3904 | + // Option? |
---|
| 3905 | + Replace(); |
---|
| 3906 | + |
---|
3417 | 3907 | cRadio tab = GetCurrentTab(); |
---|
3418 | 3908 | |
---|
3419 | | - if (tab.graphs[tab.undoindex + 1] == null) |
---|
| 3909 | + if (copy.versions[copy.versionindex + 1] == null) |
---|
3420 | 3910 | { |
---|
3421 | 3911 | java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
3422 | 3912 | return; |
---|
3423 | 3913 | } |
---|
3424 | 3914 | |
---|
3425 | | - tab.undoindex += 1; |
---|
| 3915 | + copy.versionindex += 1; |
---|
3426 | 3916 | |
---|
3427 | | - CopyChanged((Object3D)Uncompress(tab.graphs[tab.undoindex])); |
---|
| 3917 | + CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex])); |
---|
| 3918 | + |
---|
| 3919 | + //if (!tab.user[tab.versionindex]) |
---|
| 3920 | + // tab.graphs[tab.versionindex] = null; |
---|
3428 | 3921 | } |
---|
3429 | 3922 | |
---|
3430 | 3923 | void ImportGFD() |
---|
.. | .. |
---|
3576 | 4069 | assert false; |
---|
3577 | 4070 | } |
---|
3578 | 4071 | |
---|
3579 | | - void EditSelection() |
---|
| 4072 | + void EditSelection(boolean newWindow) |
---|
3580 | 4073 | { |
---|
3581 | 4074 | } |
---|
3582 | 4075 | |
---|
.. | .. |
---|
3720 | 4213 | //copy.Touch(); |
---|
3721 | 4214 | } |
---|
3722 | 4215 | |
---|
| 4216 | + cNumberSlider versionSlider; |
---|
| 4217 | + |
---|
3723 | 4218 | public void stateChanged(ChangeEvent e) |
---|
3724 | 4219 | { |
---|
3725 | 4220 | // assert(false); |
---|
| 4221 | + if (e.getSource() == versionSlider) |
---|
| 4222 | + { |
---|
| 4223 | + if (muteSlider) |
---|
| 4224 | + return; |
---|
| 4225 | + |
---|
| 4226 | + int version = versionSlider.getInteger(); |
---|
| 4227 | + |
---|
| 4228 | + if (copy.versions[version] != null) |
---|
| 4229 | + { |
---|
| 4230 | + CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex = version])); |
---|
| 4231 | + } |
---|
| 4232 | + |
---|
| 4233 | + return; |
---|
| 4234 | + } |
---|
3726 | 4235 | |
---|
3727 | 4236 | if (freezematerial) |
---|
3728 | 4237 | { |
---|
.. | .. |
---|
4071 | 4580 | |
---|
4072 | 4581 | void makeSomething(Object3D thing, boolean resetmodel) // deselect) |
---|
4073 | 4582 | { |
---|
4074 | | - Save(); |
---|
| 4583 | + if (Globals.REPLACEONMAKE) // && resetmodel) |
---|
| 4584 | + Save(); |
---|
4075 | 4585 | //Tween.set(thing, 0).target(1).start(tweenManager); |
---|
4076 | 4586 | //Tween.to(thing, 0, 0.5f).target(0).start(tweenManager); |
---|
4077 | 4587 | // if (thing instanceof GenericJointDemo) |
---|
.. | .. |
---|
4158 | 4668 | { |
---|
4159 | 4669 | ResetModel(); |
---|
4160 | 4670 | Select(thing.GetTreePath(), true, false); // unselect... false); |
---|
| 4671 | + |
---|
| 4672 | + if (thing.Size() == 0) |
---|
| 4673 | + { |
---|
| 4674 | + //EditSelection(false); |
---|
| 4675 | + } |
---|
| 4676 | + |
---|
4161 | 4677 | refreshContents(); |
---|
4162 | 4678 | } |
---|
4163 | 4679 | |
---|
.. | .. |
---|
4295 | 4811 | |
---|
4296 | 4812 | try |
---|
4297 | 4813 | { |
---|
| 4814 | + // Try compressed version first. |
---|
4298 | 4815 | java.io.FileInputStream istream = new java.io.FileInputStream(fullname); |
---|
4299 | 4816 | java.util.zip.GZIPInputStream zstream = new java.util.zip.GZIPInputStream(istream); |
---|
4300 | 4817 | java.io.ObjectInputStream p = new java.io.ObjectInputStream(zstream); |
---|
.. | .. |
---|
4305 | 4822 | readobj.ResetDisplayList(); |
---|
4306 | 4823 | } catch (Exception e) |
---|
4307 | 4824 | { |
---|
4308 | | - //e.printStackTrace(); |
---|
| 4825 | + if (!e.toString().contains("GZIP")) |
---|
| 4826 | + e.printStackTrace(); |
---|
| 4827 | + |
---|
4309 | 4828 | try |
---|
4310 | 4829 | { |
---|
4311 | 4830 | java.io.FileInputStream istream = new java.io.FileInputStream(fullname); |
---|
.. | .. |
---|
4364 | 4883 | |
---|
4365 | 4884 | void LoadIt(Object obj) |
---|
4366 | 4885 | { |
---|
| 4886 | + if (obj == null) |
---|
| 4887 | + { |
---|
| 4888 | + // Invalid file |
---|
| 4889 | + return; |
---|
| 4890 | + } |
---|
| 4891 | + |
---|
4367 | 4892 | System.out.println("Loaded " + obj); |
---|
4368 | 4893 | //new Exception().printStackTrace(); |
---|
4369 | 4894 | Object3D readobj = (Object3D) obj; |
---|
.. | .. |
---|
4373 | 4898 | |
---|
4374 | 4899 | if (readobj != null) |
---|
4375 | 4900 | { |
---|
4376 | | - Save(); |
---|
| 4901 | + //if (Globals.SAVEONMAKE) // A new object cannot share meshes |
---|
| 4902 | + // Save(); |
---|
4377 | 4903 | try |
---|
4378 | 4904 | { |
---|
4379 | 4905 | //readobj.deepCopySelf(copy); |
---|
4380 | 4906 | copy.clear(); // june 2014 |
---|
| 4907 | + copy.skyboxname = readobj.skyboxname; |
---|
| 4908 | + copy.skyboxext = readobj.skyboxext; |
---|
4381 | 4909 | for (int i = 0; i < readobj.size(); i++) |
---|
4382 | 4910 | { |
---|
4383 | 4911 | Object3D child = readobj.get(i); // reserve(i); |
---|
.. | .. |
---|
4418 | 4946 | } |
---|
4419 | 4947 | } catch (ClassCastException e) |
---|
4420 | 4948 | { |
---|
| 4949 | + e.printStackTrace(); |
---|
4421 | 4950 | assert (false); |
---|
4422 | 4951 | Composite c = (Composite) copy; |
---|
4423 | 4952 | c.children.clear(); |
---|
.. | .. |
---|
4428 | 4957 | c.addChild(csg); |
---|
4429 | 4958 | } |
---|
4430 | 4959 | |
---|
| 4960 | + copy.versions = readobj.versions; |
---|
| 4961 | + copy.versionindex = readobj.versionindex; |
---|
| 4962 | + |
---|
| 4963 | + if (copy.versions == null) |
---|
| 4964 | + { |
---|
| 4965 | + copy.versions = new byte[100][]; |
---|
| 4966 | + copy.versionindex = -1; |
---|
| 4967 | + } |
---|
| 4968 | + |
---|
| 4969 | + //? SetUndoStates(); |
---|
| 4970 | + |
---|
4431 | 4971 | ResetModel(); |
---|
4432 | 4972 | copy.HardTouch(); // recompile? |
---|
4433 | 4973 | refreshContents(); |
---|
4434 | 4974 | } |
---|
4435 | 4975 | } |
---|
4436 | 4976 | |
---|
4437 | | - void load() // throws ClassNotFoundException |
---|
| 4977 | + void Open() // throws ClassNotFoundException |
---|
4438 | 4978 | { |
---|
4439 | 4979 | if (Grafreed.standAlone) |
---|
4440 | 4980 | { |
---|
.. | .. |
---|
4537 | 5077 | //ps.print(buffer.toString()); |
---|
4538 | 5078 | } catch (IOException e) |
---|
4539 | 5079 | { |
---|
| 5080 | + e.printStackTrace(); |
---|
4540 | 5081 | } |
---|
4541 | 5082 | } |
---|
4542 | 5083 | |
---|
.. | .. |
---|
4551 | 5092 | String filename = browser.getFile(); |
---|
4552 | 5093 | if (filename != null && filename.length() > 0) |
---|
4553 | 5094 | { |
---|
| 5095 | + if (!filename.endsWith(".gfd")) |
---|
| 5096 | + filename += ".gfd"; |
---|
4554 | 5097 | lastname = browser.getDirectory() + filename; |
---|
4555 | 5098 | save(); |
---|
4556 | 5099 | } |
---|
.. | .. |
---|
4717 | 5260 | MenuBar menuBar; |
---|
4718 | 5261 | Menu fileMenu; |
---|
4719 | 5262 | MenuItem newItem; |
---|
4720 | | - MenuItem loadItem; |
---|
| 5263 | + MenuItem openItem; |
---|
4721 | 5264 | MenuItem saveItem; |
---|
4722 | 5265 | MenuItem saveAsItem; |
---|
4723 | 5266 | MenuItem exportAsItem; |
---|
.. | .. |
---|
4740 | 5283 | CheckboxMenuItem toggleSwitchItem; |
---|
4741 | 5284 | CheckboxMenuItem toggleRootItem; |
---|
4742 | 5285 | CheckboxMenuItem animationItem; |
---|
| 5286 | + MenuItem archiveItem; |
---|
4743 | 5287 | CheckboxMenuItem toggleHandleItem; |
---|
4744 | 5288 | CheckboxMenuItem togglePaintItem; |
---|
4745 | 5289 | JSplitPane mainPanel; |
---|
4746 | 5290 | JScrollPane scrollpane; |
---|
| 5291 | + |
---|
4747 | 5292 | JPanel toolbarPanel; |
---|
| 5293 | + |
---|
4748 | 5294 | cGridBag treePanel; |
---|
| 5295 | + |
---|
4749 | 5296 | JPanel radioPanel; |
---|
4750 | 5297 | ButtonGroup buttonGroup; |
---|
4751 | | - cGridBag ctrlPanel; |
---|
| 5298 | + |
---|
| 5299 | + cGridBag toolboxPanel; |
---|
4752 | 5300 | cGridBag materialPanel; |
---|
| 5301 | + cGridBag ctrlPanel; |
---|
| 5302 | + |
---|
4753 | 5303 | JScrollPane infoPanel; |
---|
| 5304 | + |
---|
4754 | 5305 | cGridBag optionsPanel; |
---|
| 5306 | + |
---|
4755 | 5307 | JTabbedPane objectPanel; |
---|
| 5308 | + boolean materialFlushed; |
---|
| 5309 | + Object3D latestObject; |
---|
| 5310 | + |
---|
4756 | 5311 | cGridBag XYZPanel; |
---|
| 5312 | + |
---|
4757 | 5313 | JSplitPane gridPanel; |
---|
4758 | 5314 | JSplitPane bigPanel; |
---|
| 5315 | + |
---|
4759 | 5316 | cGridBag bigThree; |
---|
4760 | 5317 | cGridBag scenePanel; |
---|
4761 | 5318 | cGridBag centralPanel; |
---|
.. | .. |
---|
4870 | 5427 | cNumberSlider fogField; |
---|
4871 | 5428 | JLabel opacityPowerLabel; |
---|
4872 | 5429 | cNumberSlider opacityPowerField; |
---|
4873 | | - JTree jTree; |
---|
| 5430 | + cTree jTree; |
---|
4874 | 5431 | //ObjectUI parent; |
---|
4875 | 5432 | |
---|
4876 | 5433 | cNumberSlider normalpushField; |
---|