.. | .. |
---|
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 | |
---|
.. | .. |
---|
30 | 34 | iSendInfo |
---|
31 | 35 | //KeyListener |
---|
32 | 36 | { |
---|
| 37 | + public cToggleButton pinButton; |
---|
33 | 38 | boolean timeline; |
---|
34 | 39 | boolean wasFullScreen; |
---|
35 | 40 | |
---|
.. | .. |
---|
37 | 42 | JFrame frame; |
---|
38 | 43 | |
---|
39 | 44 | static ObjEditor theFrame; |
---|
| 45 | + |
---|
| 46 | + public cGridBag GetSeparator() |
---|
| 47 | + { |
---|
| 48 | + cGridBag separator = new cGridBag(); |
---|
| 49 | + separator.add(new JSeparator()); |
---|
| 50 | + separator.preferredHeight = 5; |
---|
| 51 | + return separator; |
---|
| 52 | + } |
---|
| 53 | + |
---|
| 54 | + cButton GetButton(String name, boolean border) |
---|
| 55 | + { |
---|
| 56 | + ImageIcon icon = GetIcon(name); |
---|
| 57 | + return new cButton(icon, border); |
---|
| 58 | + } |
---|
| 59 | + |
---|
| 60 | + cLabel GetLabel(String name, boolean border) |
---|
| 61 | + { |
---|
| 62 | + //ImageIcon icon = GetIcon(name); |
---|
| 63 | + return new cLabel(GetImage(name), border); |
---|
| 64 | + } |
---|
| 65 | + |
---|
| 66 | + cToggleButton GetToggleButton(String name, boolean border) |
---|
| 67 | + { |
---|
| 68 | + ImageIcon icon = GetIcon(name); |
---|
| 69 | + return new cToggleButton(icon, border); |
---|
| 70 | + } |
---|
| 71 | + |
---|
| 72 | + cCheckBox GetCheckBox(String name, boolean border) |
---|
| 73 | + { |
---|
| 74 | + ImageIcon icon = GetIcon(name); |
---|
| 75 | + return new cCheckBox(icon, border); |
---|
| 76 | + } |
---|
| 77 | + |
---|
| 78 | + ImageIcon GetIcon(String name) |
---|
| 79 | + { |
---|
| 80 | + try |
---|
| 81 | + { |
---|
| 82 | + BufferedImage image = javax.imageio.ImageIO.read(getClass().getClassLoader().getResourceAsStream(name)); |
---|
| 83 | + |
---|
| 84 | +// if (image.getWidth() > 48 && image.getHeight() > 48) |
---|
| 85 | +// { |
---|
| 86 | +// BufferedImage resized = new BufferedImage(48, 48, image.getType()); |
---|
| 87 | +// Graphics2D g = resized.createGraphics(); |
---|
| 88 | +// g.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR); |
---|
| 89 | +// //g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); |
---|
| 90 | +// g.drawImage(image, 0, 0, 48, 48, 0, 0, image.getWidth(), image.getHeight(), null); |
---|
| 91 | +// g.dispose(); |
---|
| 92 | +// |
---|
| 93 | +// image = resized; |
---|
| 94 | +// } |
---|
| 95 | + |
---|
| 96 | + javax.swing.ImageIcon icon = new javax.swing.ImageIcon(image); |
---|
| 97 | + return icon; |
---|
| 98 | + } |
---|
| 99 | + catch (Exception e) |
---|
| 100 | + { |
---|
| 101 | + return null; |
---|
| 102 | + } |
---|
| 103 | + } |
---|
| 104 | + |
---|
| 105 | + BufferedImage GetImage(String name) |
---|
| 106 | + { |
---|
| 107 | + try |
---|
| 108 | + { |
---|
| 109 | + BufferedImage image = javax.imageio.ImageIO.read(getClass().getClassLoader().getResourceAsStream(name)); |
---|
| 110 | + |
---|
| 111 | + return image; |
---|
| 112 | + } |
---|
| 113 | + catch (Exception e) |
---|
| 114 | + { |
---|
| 115 | + return null; |
---|
| 116 | + } |
---|
| 117 | + } |
---|
40 | 118 | |
---|
41 | 119 | // SCRIPT |
---|
42 | 120 | |
---|
.. | .. |
---|
147 | 225 | |
---|
148 | 226 | objEditor.ctrlPanel.remove(namePanel); |
---|
149 | 227 | |
---|
150 | | - if (!GroupEditor.allparams) |
---|
| 228 | + if (!allparams) |
---|
151 | 229 | return; |
---|
152 | 230 | |
---|
153 | 231 | // objEditor.ctrlPanel.remove(liveCB); |
---|
.. | .. |
---|
171 | 249 | |
---|
172 | 250 | objEditor.ctrlPanel.remove(setupPanel); |
---|
173 | 251 | objEditor.ctrlPanel.remove(setupPanel2); |
---|
174 | | - objEditor.ctrlPanel.remove(commandsPanel); |
---|
| 252 | + objEditor.ctrlPanel.remove(objectCommandsPanel); |
---|
175 | 253 | objEditor.ctrlPanel.remove(pushPanel); |
---|
176 | 254 | //objEditor.ctrlPanel.remove(fillPanel); |
---|
177 | 255 | |
---|
.. | .. |
---|
219 | 297 | client = inClient; |
---|
220 | 298 | copy = client; |
---|
221 | 299 | |
---|
| 300 | + if (copy.versionlist == null) |
---|
| 301 | + { |
---|
| 302 | + copy.versionlist = new Object3D[100]; |
---|
| 303 | + copy.versionindex = -1; |
---|
| 304 | + } |
---|
| 305 | + |
---|
222 | 306 | // "this" is not called: SetupUI2(objEditor); |
---|
223 | 307 | } |
---|
224 | 308 | |
---|
.. | .. |
---|
232 | 316 | client = inClient; |
---|
233 | 317 | copy = client; |
---|
234 | 318 | |
---|
| 319 | + if (copy.versionlist == null) |
---|
| 320 | + { |
---|
| 321 | + copy.versionlist = new Object3D[100]; |
---|
| 322 | + copy.versionindex = -1; |
---|
| 323 | + } |
---|
| 324 | + |
---|
235 | 325 | SetupUI2(callee.GetEditor()); |
---|
236 | 326 | } |
---|
237 | 327 | |
---|
.. | .. |
---|
246 | 336 | //localCopy.parent = null; |
---|
247 | 337 | |
---|
248 | 338 | frame = new JFrame(); |
---|
249 | | - frame.setUndecorated(true); |
---|
| 339 | + frame.setUndecorated(false); |
---|
250 | 340 | objEditor = this; |
---|
251 | 341 | this.callee = callee; |
---|
252 | 342 | |
---|
.. | .. |
---|
264 | 354 | copy = localCopy; |
---|
265 | 355 | copy.editWindow = this; |
---|
266 | 356 | |
---|
| 357 | + if (copy.versionlist == null) |
---|
| 358 | + { |
---|
| 359 | +// copy.versions = new byte[100][]; |
---|
| 360 | +// copy.versionindex = -1; |
---|
| 361 | + } |
---|
| 362 | + |
---|
267 | 363 | SetupMenu(); |
---|
268 | 364 | |
---|
269 | 365 | //SetupName(objEditor); // new |
---|
.. | .. |
---|
277 | 373 | return frame.action(event, obj); |
---|
278 | 374 | } |
---|
279 | 375 | |
---|
| 376 | + // Cannot work without static |
---|
| 377 | + static boolean allparams = true; |
---|
| 378 | + |
---|
| 379 | + static java.util.Vector<Object3D> listUI = new java.util.Vector<Object3D>(); |
---|
| 380 | + |
---|
280 | 381 | void SetupMenu() |
---|
281 | 382 | { |
---|
282 | 383 | frame.setMenuBar(menuBar = new MenuBar()); |
---|
283 | 384 | menuBar.add(fileMenu = new Menu("File")); |
---|
284 | 385 | fileMenu.add(newItem = new MenuItem("New")); |
---|
285 | | - fileMenu.add(loadItem = new MenuItem("Open...")); |
---|
| 386 | + fileMenu.add(openItem = new MenuItem("Open...")); |
---|
286 | 387 | |
---|
287 | 388 | //oe.menuBar.add(menu = new Menu("Include")); |
---|
288 | 389 | Menu menu = new Menu("Import"); |
---|
.. | .. |
---|
314 | 415 | } |
---|
315 | 416 | |
---|
316 | 417 | newItem.addActionListener(this); |
---|
317 | | - loadItem.addActionListener(this); |
---|
| 418 | + openItem.addActionListener(this); |
---|
318 | 419 | saveItem.addActionListener(this); |
---|
319 | 420 | saveAsItem.addActionListener(this); |
---|
320 | 421 | exportAsItem.addActionListener(this); |
---|
.. | .. |
---|
323 | 424 | closeItem.addActionListener(this); |
---|
324 | 425 | |
---|
325 | 426 | objectPanel = new JTabbedPane(); |
---|
| 427 | + |
---|
| 428 | + ChangeListener changeListener = new ChangeListener() |
---|
| 429 | + { |
---|
| 430 | + public void stateChanged(ChangeEvent changeEvent) |
---|
| 431 | + { |
---|
| 432 | +// if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Material") && !materialFlushed) |
---|
| 433 | +// { |
---|
| 434 | +// if (latestObject != null) |
---|
| 435 | +// { |
---|
| 436 | +// refreshContents(true); |
---|
| 437 | +// SetMaterial(latestObject); |
---|
| 438 | +// } |
---|
| 439 | +// |
---|
| 440 | +// materialFlushed = true; |
---|
| 441 | +// } |
---|
| 442 | +// if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Edit")) |
---|
| 443 | +// { |
---|
| 444 | +// if (listUI.size() == 0) |
---|
| 445 | +// EditSelection(false); |
---|
| 446 | +// } |
---|
| 447 | + |
---|
| 448 | + refreshContents(false); // To refresh Info tab |
---|
| 449 | + } |
---|
| 450 | + }; |
---|
| 451 | + objectPanel.addChangeListener(changeListener); |
---|
| 452 | + |
---|
326 | 453 | toolbarPanel = new JPanel(); |
---|
327 | 454 | toolbarPanel.setName("Toolbar"); |
---|
| 455 | + |
---|
328 | 456 | treePanel = new cGridBag(); |
---|
329 | 457 | treePanel.setName("Tree"); |
---|
| 458 | + |
---|
| 459 | + editPanel = new cGridBag().setVertical(true); |
---|
| 460 | + //editPanel.setName("Edit"); |
---|
| 461 | + |
---|
330 | 462 | ctrlPanel = new cGridBag().setVertical(false); // new GridBagLayout()); |
---|
331 | | - ctrlPanel.setName("Edit"); |
---|
332 | | - materialPanel = new cGridBag().setVertical(true); |
---|
333 | | - materialPanel.setName("Material"); |
---|
| 463 | + |
---|
| 464 | + editCommandsPanel = new cGridBag(); |
---|
| 465 | + editPanel.add(editCommandsPanel); |
---|
| 466 | + editPanel.add(ctrlPanel); |
---|
| 467 | + |
---|
| 468 | + toolboxPanel = new cGridBag().setVertical(true); |
---|
| 469 | + //toolboxPanel.setName("Toolbox"); |
---|
| 470 | + |
---|
| 471 | + skyboxPanel = new cGridBag().setVertical(true); |
---|
| 472 | + |
---|
| 473 | + materialPanel = new cGridBag().setVertical(false); |
---|
| 474 | + //materialPanel.setName("Material"); |
---|
| 475 | + |
---|
334 | 476 | /*JTextPane*/ |
---|
335 | 477 | infoarea = createTextPane(); |
---|
336 | 478 | doc = infoarea.getStyledDocument(); |
---|
337 | 479 | |
---|
338 | 480 | infoarea.setEditable(true); |
---|
339 | 481 | SetText(); |
---|
| 482 | + |
---|
340 | 483 | // infoarea.setFont(infoarea.getFont().deriveFont(10, 14f)); |
---|
341 | 484 | // infoarea.setOpaque(false); |
---|
342 | 485 | // //infoarea.setForeground(textcolor); |
---|
343 | 486 | // TEXTAREA infoarea.setLineWrap(true); |
---|
344 | 487 | // TEXTAREA infoarea.setWrapStyleWord(true); |
---|
345 | 488 | infoPanel = new JScrollPane(infoarea, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); //AS_NEEDED); |
---|
346 | | - infoPanel.setPreferredSize(new Dimension(50, 200)); |
---|
347 | | - infoPanel.setName("Info"); |
---|
| 489 | + infoPanel.setPreferredSize(new Dimension(1, 1)); |
---|
| 490 | + //infoPanel.setName("Info"); |
---|
348 | 491 | //infoPanel.setLayout(new BorderLayout()); |
---|
349 | 492 | //infoPanel.add(createTextPane()); |
---|
350 | 493 | |
---|
.. | .. |
---|
355 | 498 | mainPanel.setDividerSize(9); |
---|
356 | 499 | mainPanel.setDividerLocation(0.5); //1.0); |
---|
357 | 500 | mainPanel.setResizeWeight(0.5); |
---|
358 | | - |
---|
| 501 | + |
---|
| 502 | +//mainPanel.setDividerSize((int) (mainPanel.getDividerSize() * 1.5)); |
---|
| 503 | + BasicSplitPaneDivider divider = ( (BasicSplitPaneUI) mainPanel.getUI()).getDivider(); |
---|
| 504 | + divider.setDividerSize(15); |
---|
| 505 | + divider.setBorder(BorderFactory.createTitledBorder(divider.getBorder(), "Custom border title -- gets rid of the one-touch arrows!")); |
---|
| 506 | + |
---|
| 507 | + mainPanel.setUI(new BasicSplitPaneUI()); |
---|
| 508 | + |
---|
359 | 509 | //ctrlPanel.setLayout(new GridLayout(4, 1, 5, 5)); |
---|
360 | 510 | //mainPanel.setLayout(new GridBagLayout()); |
---|
361 | 511 | toolbarPanel.setLayout(new FlowLayout(FlowLayout.LEFT)); |
---|
.. | .. |
---|
586 | 736 | } |
---|
587 | 737 | } |
---|
588 | 738 | |
---|
589 | | -static GraphicsDevice device = GraphicsEnvironment |
---|
590 | | - .getLocalGraphicsEnvironment().getScreenDevices()[0]; |
---|
| 739 | +//static GraphicsDevice device = GraphicsEnvironment |
---|
| 740 | +// .getLocalGraphicsEnvironment().getScreenDevices()[0]; |
---|
591 | 741 | |
---|
592 | 742 | Rectangle keeprect; |
---|
593 | 743 | cRadio radio; |
---|
.. | .. |
---|
603 | 753 | |
---|
604 | 754 | boolean maximized; |
---|
605 | 755 | |
---|
| 756 | + cButton fullscreenLayout; |
---|
| 757 | + |
---|
606 | 758 | void Minimize() |
---|
607 | 759 | { |
---|
608 | 760 | frame.setState(Frame.ICONIFIED); |
---|
| 761 | + frame.validate(); |
---|
609 | 762 | } |
---|
610 | 763 | |
---|
| 764 | +// artifactURI=null, type=0, property=${file.reference.jfxrt.jar}, object=org.netbeans.modules.java.api.common.classpath.ClassPathSupport$RelativePath@6767876f, broken=false, additional={} |
---|
| 765 | +// artifactURI=null, type=0, property=${file.reference.mac-ui.jar}, object=org.netbeans.modules.java.api.common.classpath.ClassPathSupport$RelativePath@16bdc817, broken=false, additional={} |
---|
| 766 | +// artifactURI=null, type=0, property=${file.reference.classes.jar}, object=org.netbeans.modules.java.api.common.classpath.ClassPathSupport$RelativePath@9daa9c17, broken=false, additional={} |
---|
611 | 767 | void Maximize() |
---|
612 | 768 | { |
---|
| 769 | + if (CameraPane.FULLSCREEN) |
---|
| 770 | + { |
---|
| 771 | + ToggleFullScreen(); |
---|
| 772 | + } |
---|
| 773 | + |
---|
613 | 774 | if (maximized) |
---|
614 | 775 | { |
---|
615 | 776 | frame.setBounds(keeprect.x, keeprect.y, keeprect.width, keeprect.height); |
---|
.. | .. |
---|
617 | 778 | else |
---|
618 | 779 | { |
---|
619 | 780 | keeprect = frame.getBounds(); |
---|
620 | | - Rectangle rect = GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds(); |
---|
621 | | - Dimension rect2 = frame.getToolkit().getScreenSize(); |
---|
622 | | - frame.setBounds(0, rect2.height - rect.height, rect.width, rect.height); |
---|
| 781 | +// Rectangle rect = GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds(); |
---|
| 782 | +// Dimension rect2 = frame.getToolkit().getScreenSize(); |
---|
| 783 | +// frame.setBounds(0, rect2.height - rect.height, rect.width, rect.height); |
---|
623 | 784 | // frame.setState(Frame.MAXIMIZED_BOTH); |
---|
| 785 | + frame.setBounds(frame.getGraphicsConfiguration().getBounds()); |
---|
624 | 786 | } |
---|
625 | 787 | |
---|
626 | 788 | maximized ^= true; |
---|
| 789 | + |
---|
| 790 | + frame.validate(); |
---|
627 | 791 | } |
---|
| 792 | + |
---|
| 793 | + cButton minButton; |
---|
| 794 | + cButton maxButton; |
---|
| 795 | + cButton fullButton; |
---|
628 | 796 | |
---|
629 | 797 | void ToggleFullScreen() |
---|
630 | 798 | { |
---|
631 | | - if (CameraPane.FULLSCREEN) |
---|
| 799 | +GraphicsDevice device = frame.getGraphicsConfiguration().getDevice(); |
---|
| 800 | + |
---|
| 801 | + cameraView.ToggleFullScreen(); |
---|
| 802 | + |
---|
| 803 | + if (!CameraPane.FULLSCREEN) |
---|
632 | 804 | { |
---|
633 | 805 | device.setFullScreenWindow(null); |
---|
| 806 | + frame.dispose(); |
---|
| 807 | + frame.setUndecorated(false); |
---|
| 808 | + frame.validate(); |
---|
| 809 | + frame.setVisible(true); |
---|
| 810 | + |
---|
634 | 811 | //frame.setVisible(false); |
---|
635 | 812 | // frame.removeNotify(); |
---|
636 | 813 | // frame.setUndecorated(false); |
---|
.. | .. |
---|
640 | 817 | // X frame.getContentPane().remove(/*"Center",*/bigThree); |
---|
641 | 818 | // X framePanel.add(bigThree); |
---|
642 | 819 | // X frame.getContentPane().add(/*"Center",*/framePanel); |
---|
643 | | - framePanel.setDividerLocation(1); |
---|
| 820 | + framePanel.setDividerLocation(46); |
---|
644 | 821 | |
---|
645 | 822 | //frame.setVisible(true); |
---|
646 | 823 | radio.layout = keepButton; |
---|
.. | .. |
---|
655 | 832 | // frame.setBounds(0, 0, frame.getToolkit().getScreenSize().width, |
---|
656 | 833 | // frame.getToolkit().getScreenSize().height); |
---|
657 | 834 | //frame.setVisible(false); |
---|
| 835 | + |
---|
| 836 | + frame.dispose(); |
---|
| 837 | + frame.setUndecorated(true); |
---|
658 | 838 | device.setFullScreenWindow(frame); |
---|
| 839 | + frame.validate(); |
---|
| 840 | + frame.setVisible(true); |
---|
659 | 841 | // frame.removeNotify(); |
---|
660 | 842 | // frame.setUndecorated(true); |
---|
661 | 843 | // frame.addNotify(); |
---|
.. | .. |
---|
664 | 846 | // X frame.getContentPane().add(/*"Center",*/bigThree); |
---|
665 | 847 | framePanel.setDividerLocation(0); |
---|
666 | 848 | |
---|
667 | | - radio.layout = twoButton; |
---|
| 849 | + radio.layout = fullscreenLayout; |
---|
668 | 850 | radio.layout.doClick(); |
---|
669 | 851 | //frame.setVisible(true); |
---|
670 | 852 | } |
---|
671 | | - |
---|
672 | | - cameraView.ToggleFullScreen(); |
---|
| 853 | + frame.validate(); |
---|
| 854 | + |
---|
| 855 | + cameraView.requestFocusInWindow(); |
---|
673 | 856 | } |
---|
| 857 | + |
---|
| 858 | + private Object3D CompressCopy() |
---|
| 859 | + { |
---|
| 860 | + boolean temp = CameraPane.SWITCH; |
---|
| 861 | + CameraPane.SWITCH = false; |
---|
| 862 | + |
---|
| 863 | + copy.ExtractBigData(versiontable); |
---|
| 864 | + // if (copy == client) |
---|
| 865 | + |
---|
| 866 | + Object3D versions[] = copy.versionlist; |
---|
| 867 | + copy.versionlist = null; |
---|
| 868 | + |
---|
| 869 | + //byte[] compress = Compress(copy); |
---|
| 870 | + Object3D compress = (Object3D)Grafreed.clone(copy); |
---|
| 871 | + |
---|
| 872 | + copy.versionlist = versions; |
---|
| 873 | + |
---|
| 874 | + copy.RestoreBigData(versiontable); |
---|
| 875 | + |
---|
| 876 | + CameraPane.SWITCH = temp; |
---|
| 877 | + |
---|
| 878 | + return compress; |
---|
| 879 | + } |
---|
674 | 880 | |
---|
675 | 881 | private JTextPane createTextPane() |
---|
676 | 882 | { |
---|
.. | .. |
---|
793 | 999 | { |
---|
794 | 1000 | SetupMaterial(materialPanel); |
---|
795 | 1001 | } |
---|
| 1002 | + |
---|
796 | 1003 | //SetupName(); |
---|
797 | 1004 | //SetupViews(); |
---|
798 | 1005 | } |
---|
.. | .. |
---|
802 | 1009 | // NumberSlider vDivsField; |
---|
803 | 1010 | // JCheckBox endcaps; |
---|
804 | 1011 | JCheckBox liveCB; |
---|
805 | | - JCheckBox selectCB; |
---|
| 1012 | + JCheckBox selectableCB; |
---|
806 | 1013 | JCheckBox hideCB; |
---|
807 | 1014 | JCheckBox link2masterCB; |
---|
808 | 1015 | JCheckBox markCB; |
---|
.. | .. |
---|
810 | 1017 | JCheckBox speedupCB; |
---|
811 | 1018 | JCheckBox rewindCB; |
---|
812 | 1019 | JCheckBox flipVCB; |
---|
| 1020 | + |
---|
| 1021 | + cCheckBox toggleTextureCB; |
---|
| 1022 | + cCheckBox toggleSwitchCB; |
---|
| 1023 | + |
---|
813 | 1024 | JComboBox texresMenu; |
---|
| 1025 | + |
---|
814 | 1026 | JButton resetButton; |
---|
815 | 1027 | JButton stepButton; |
---|
816 | 1028 | JButton stepAllButton; |
---|
.. | .. |
---|
819 | 1031 | JButton fasterButton; |
---|
820 | 1032 | JButton remarkButton; |
---|
821 | 1033 | |
---|
| 1034 | + cGridBag editPanel; |
---|
| 1035 | + cGridBag editCommandsPanel; |
---|
| 1036 | + |
---|
822 | 1037 | cGridBag namePanel; |
---|
823 | 1038 | cGridBag setupPanel; |
---|
824 | 1039 | cGridBag setupPanel2; |
---|
825 | | - cGridBag commandsPanel; |
---|
| 1040 | + cGridBag objectCommandsPanel; |
---|
826 | 1041 | cGridBag pushPanel; |
---|
827 | 1042 | cGridBag fillPanel; |
---|
828 | 1043 | |
---|
.. | .. |
---|
993 | 1208 | |
---|
994 | 1209 | namePanel = new cGridBag(); |
---|
995 | 1210 | |
---|
| 1211 | + //if (copy.pinned) |
---|
| 1212 | + { |
---|
| 1213 | + pinButton = GetToggleButton("icons/pin.png", !Grafreed.NIMBUSLAF); |
---|
| 1214 | + pinButton.setSelected(copy.pinned); |
---|
| 1215 | + cGridBag t = new cGridBag(); |
---|
| 1216 | + t.preferredWidth = 2; |
---|
| 1217 | + t.add(pinButton); |
---|
| 1218 | + namePanel.add(t); |
---|
| 1219 | + |
---|
| 1220 | + pinButton.addItemListener(this); |
---|
| 1221 | + } |
---|
| 1222 | + |
---|
996 | 1223 | nameField = AddText(namePanel, copy.GetName()); |
---|
997 | | - namePanel.add(nameField); |
---|
| 1224 | + namePanel.add(new JScrollPane(nameField, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER)); |
---|
998 | 1225 | oe.ctrlPanel.add(namePanel); |
---|
999 | 1226 | |
---|
1000 | 1227 | oe.ctrlPanel.Return(); |
---|
1001 | 1228 | |
---|
1002 | | - if (!GroupEditor.allparams) |
---|
| 1229 | + if (!allparams) |
---|
1003 | 1230 | return; |
---|
1004 | 1231 | |
---|
1005 | 1232 | setupPanel = new cGridBag().setVertical(false); |
---|
1006 | 1233 | |
---|
1007 | 1234 | liveCB = AddCheckBox(setupPanel, "Live", copy.live); |
---|
1008 | 1235 | liveCB.setToolTipText("Animate object"); |
---|
1009 | | - selectCB = AddCheckBox(setupPanel, "Select", !copy.dontselect); |
---|
1010 | | - selectCB.setToolTipText("Make object selectable"); |
---|
| 1236 | + selectableCB = AddCheckBox(setupPanel, "Select", !copy.dontselect); |
---|
| 1237 | + selectableCB.setToolTipText("Make object selectable"); |
---|
1011 | 1238 | // Return(); |
---|
| 1239 | + |
---|
1012 | 1240 | hideCB = AddCheckBox(setupPanel, "Hide", copy.hide); |
---|
1013 | 1241 | hideCB.setToolTipText("Hide object"); |
---|
1014 | 1242 | markCB = AddCheckBox(setupPanel, "Mark", copy.marked); |
---|
1015 | | - markCB.setToolTipText("Set the animation target transform"); |
---|
| 1243 | + markCB.setToolTipText("As animation target transform"); |
---|
| 1244 | + |
---|
| 1245 | + ToolTipManager.sharedInstance().setLightWeightPopupEnabled(false); |
---|
1016 | 1246 | |
---|
1017 | 1247 | setupPanel2 = new cGridBag().setVertical(false); |
---|
1018 | 1248 | |
---|
1019 | 1249 | rewindCB = AddCheckBox(setupPanel2, "Rewind", copy.rewind); |
---|
1020 | 1250 | rewindCB.setToolTipText("Rewind animation"); |
---|
1021 | 1251 | |
---|
1022 | | - randomCB = AddCheckBox(setupPanel2, "Rand", copy.random); |
---|
1023 | | - randomCB.setToolTipText("Randomly Rewind or Go back and forth"); |
---|
| 1252 | + randomCB = AddCheckBox(setupPanel2, "Random", copy.random); |
---|
| 1253 | + randomCB.setToolTipText("Randomly Rewind (or Go back and forth)"); |
---|
1024 | 1254 | |
---|
| 1255 | + link2masterCB = AddCheckBox(setupPanel2, "Support", copy.link2master); |
---|
| 1256 | + link2masterCB.setToolTipText("Attach to support"); |
---|
| 1257 | + |
---|
1025 | 1258 | if (Globals.ADVANCED) |
---|
1026 | 1259 | { |
---|
1027 | | - link2masterCB = AddCheckBox(setupPanel2, "Supp", copy.link2master); |
---|
1028 | | - link2masterCB.setToolTipText("Attach to support"); |
---|
1029 | 1260 | speedupCB = AddCheckBox(setupPanel2, "Speed", copy.speedup); |
---|
1030 | 1261 | speedupCB.setToolTipText("Option motion capture"); |
---|
1031 | 1262 | } |
---|
.. | .. |
---|
1035 | 1266 | oe.ctrlPanel.add(setupPanel2); |
---|
1036 | 1267 | oe.ctrlPanel.Return(); |
---|
1037 | 1268 | |
---|
1038 | | - commandsPanel = new cGridBag().setVertical(false); |
---|
| 1269 | + objectCommandsPanel = new cGridBag().setVertical(false); |
---|
1039 | 1270 | |
---|
1040 | | - resetButton = AddButton(commandsPanel, "Reset"); |
---|
| 1271 | + resetButton = AddButton(objectCommandsPanel, "Reset"); |
---|
1041 | 1272 | resetButton.setToolTipText("Jump to frame zero"); |
---|
1042 | | - stepButton = AddButton(commandsPanel, "Step"); |
---|
| 1273 | + stepButton = AddButton(objectCommandsPanel, "Step"); |
---|
1043 | 1274 | stepButton.setToolTipText("Step one frame"); |
---|
1044 | 1275 | // resetAllButton = AddButton(oe, "Reset All"); |
---|
1045 | 1276 | // stepAllButton = AddButton(oe, "Step All"); |
---|
1046 | 1277 | // Return(); |
---|
1047 | | - slowerButton = AddButton(commandsPanel, "Slow"); |
---|
| 1278 | + slowerButton = AddButton(objectCommandsPanel, "Slow"); |
---|
1048 | 1279 | slowerButton.setToolTipText("Decrease animation speed"); |
---|
1049 | | - fasterButton = AddButton(commandsPanel, "Fast"); |
---|
| 1280 | + fasterButton = AddButton(objectCommandsPanel, "Fast"); |
---|
1050 | 1281 | fasterButton.setToolTipText("Increase animation speed"); |
---|
1051 | | - remarkButton = AddButton(commandsPanel, "Remark"); |
---|
| 1282 | + remarkButton = AddButton(objectCommandsPanel, "Remark"); |
---|
1052 | 1283 | remarkButton.setToolTipText("Set the current transform as the target"); |
---|
1053 | 1284 | |
---|
1054 | | - oe.ctrlPanel.add(commandsPanel); |
---|
| 1285 | + oe.ctrlPanel.add(objectCommandsPanel); |
---|
1055 | 1286 | oe.ctrlPanel.Return(); |
---|
1056 | 1287 | |
---|
1057 | 1288 | pushPanel = AddSlider(oe.ctrlPanel, "Push", -1, 1, copy.NORMALPUSH, 1.1); // To have the buttons |
---|
.. | .. |
---|
1299 | 1530 | XYZPanel.addComponent(/*BorderLayout.SOUTH,*/sideView); // Scroll); |
---|
1300 | 1531 | XYZPanel.addComponent(/*BorderLayout.CENTER,*/frontView); // Scroll); |
---|
1301 | 1532 | XYZPanel.addComponent(/*BorderLayout.NORTH,*/topView); // Scroll); |
---|
| 1533 | + //XYZPanel.setName("XYZ"); |
---|
1302 | 1534 | |
---|
1303 | 1535 | /* |
---|
1304 | 1536 | gridPanel = new JPanel(); //new BorderLayout()); |
---|
.. | .. |
---|
1336 | 1568 | //JScrollPane tmp = new JScrollPane(ctrlPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); |
---|
1337 | 1569 | //tmp.setName("Edit"); |
---|
1338 | 1570 | objectPanel.add(materialPanel); |
---|
| 1571 | + objectPanel.setIconAt(0, GetIcon("icons/material.png")); |
---|
| 1572 | + objectPanel.setToolTipTextAt(0, "Material"); |
---|
| 1573 | + |
---|
| 1574 | + objectPanel.add(toolboxPanel); |
---|
| 1575 | + objectPanel.setIconAt(1, GetIcon("icons/primitives.png")); |
---|
| 1576 | + objectPanel.setToolTipTextAt(1, "Objects & textures"); |
---|
| 1577 | + |
---|
| 1578 | + objectPanel.add(skyboxPanel); |
---|
| 1579 | + objectPanel.setIconAt(2, GetIcon("icons/skybox.jpg")); |
---|
| 1580 | + objectPanel.setToolTipTextAt(2, "Backgrounds"); |
---|
| 1581 | + |
---|
1339 | 1582 | // JPanel north = new JPanel(new BorderLayout()); |
---|
1340 | 1583 | // north.setName("Edit"); |
---|
1341 | 1584 | // north.add(ctrlPanel, BorderLayout.NORTH); |
---|
1342 | 1585 | // objectPanel.add(north); |
---|
1343 | | - objectPanel.add(ctrlPanel); |
---|
1344 | | - objectPanel.add(infoPanel); |
---|
1345 | | - |
---|
| 1586 | + objectPanel.add(editPanel); |
---|
| 1587 | + objectPanel.setIconAt(3, GetIcon("icons/write.png")); |
---|
| 1588 | + objectPanel.setToolTipTextAt(3, "Edit controls"); |
---|
| 1589 | + |
---|
| 1590 | + objectPanel.add(XYZPanel); |
---|
| 1591 | + objectPanel.setIconAt(4, GetIcon("icons/XYZ.png")); |
---|
| 1592 | + objectPanel.setToolTipTextAt(4, "XYZ/RGB transform"); |
---|
| 1593 | + |
---|
1346 | 1594 | /* |
---|
1347 | 1595 | aConstraints.gridx = 0; |
---|
1348 | 1596 | aConstraints.gridwidth = 1; |
---|
.. | .. |
---|
1350 | 1598 | aConstraints.gridy += 1; |
---|
1351 | 1599 | aConstraints.gridwidth = 1; |
---|
1352 | 1600 | mainPanel.add(objectPanel, aConstraints); |
---|
1353 | | - */ |
---|
| 1601 | + */ |
---|
1354 | 1602 | |
---|
1355 | 1603 | scrollpane = new JScrollPane(mainPanel, ScrollPaneConstants.// VERTICAL_SCROLLBAR_ALWAYS, |
---|
1356 | 1604 | VERTICAL_SCROLLBAR_AS_NEEDED, |
---|
.. | .. |
---|
1362 | 1610 | scrollpane.addMouseWheelListener(this); // Default not fast enough |
---|
1363 | 1611 | |
---|
1364 | 1612 | /*JTabbedPane*/ scenePanel = new cGridBag(); |
---|
1365 | | - scenePanel.preferredWidth = 6; |
---|
| 1613 | + scenePanel.preferredWidth = 5; |
---|
1366 | 1614 | |
---|
1367 | 1615 | JTabbedPane tabbedPane = new JTabbedPane(); |
---|
1368 | 1616 | tabbedPane.add(scrollpane); |
---|
1369 | 1617 | |
---|
1370 | | - tabbedPane.add(FSPane = new cFileSystemPane(this)); |
---|
1371 | | - |
---|
1372 | | - optionsPanel = new cGridBag().setVertical(true); |
---|
| 1618 | + optionsPanel = new cGridBag().setVertical(false); |
---|
1373 | 1619 | |
---|
1374 | 1620 | optionsPanel.setName("Options"); |
---|
1375 | 1621 | |
---|
.. | .. |
---|
1377 | 1623 | |
---|
1378 | 1624 | tabbedPane.add(optionsPanel); |
---|
1379 | 1625 | |
---|
| 1626 | + tabbedPane.add(FSPane = new cFileSystemPane(this)); |
---|
| 1627 | + |
---|
1380 | 1628 | scenePanel.add(tabbedPane); |
---|
1381 | 1629 | |
---|
| 1630 | + //if (Globals.ADVANCED) |
---|
| 1631 | + tabbedPane.add(infoPanel); |
---|
| 1632 | + tabbedPane.setIconAt(3, GetIcon("icons/info.png")); |
---|
| 1633 | + tabbedPane.setToolTipTextAt(3, "Information"); |
---|
| 1634 | + |
---|
1382 | 1635 | /* |
---|
1383 | 1636 | cTree jTree = new cTree(null); |
---|
1384 | 1637 | ToolTipManager.sharedInstance().registerComponent(jTree); |
---|
.. | .. |
---|
1440 | 1693 | bigThree = new cGridBag(); |
---|
1441 | 1694 | bigThree.addComponent(scenePanel); |
---|
1442 | 1695 | bigThree.addComponent(centralPanel); |
---|
1443 | | - bigThree.addComponent(XYZPanel); |
---|
| 1696 | + //bigThree.addComponent(XYZPanel); |
---|
1444 | 1697 | |
---|
1445 | 1698 | // // SIDE EFFECT!!! |
---|
1446 | 1699 | // aConstraints.gridx = 0; |
---|
.. | .. |
---|
1449 | 1702 | // aConstraints.gridheight = 1; |
---|
1450 | 1703 | |
---|
1451 | 1704 | framePanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, toolbarPanel, bigThree); |
---|
1452 | | - framePanel.setContinuousLayout(true); |
---|
1453 | | - framePanel.setOneTouchExpandable(true); |
---|
1454 | | - framePanel.setDividerLocation(0.8); |
---|
| 1705 | + framePanel.setContinuousLayout(false); |
---|
| 1706 | + framePanel.setOneTouchExpandable(false); |
---|
| 1707 | + //.setDividerLocation(0.8); |
---|
1455 | 1708 | //framePanel.setDividerSize(15); |
---|
1456 | 1709 | //framePanel.setResizeWeight(0.15); |
---|
1457 | 1710 | framePanel.setName("Frame"); |
---|
.. | .. |
---|
1469 | 1722 | // aConstraints = gbc; // (GridBagConstraints) GrafreeD.clone(gbc); |
---|
1470 | 1723 | |
---|
1471 | 1724 | frame.setSize(1280, 860); |
---|
1472 | | - frame.setVisible(true); |
---|
1473 | | - |
---|
| 1725 | + |
---|
1474 | 1726 | cameraView.requestFocusInWindow(); |
---|
1475 | 1727 | |
---|
1476 | 1728 | gridPanel.setDividerLocation(1.0); |
---|
| 1729 | + |
---|
| 1730 | + frame.validate(); |
---|
| 1731 | + |
---|
| 1732 | + frame.setVisible(true); |
---|
1477 | 1733 | |
---|
1478 | 1734 | frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); |
---|
1479 | 1735 | frame.addWindowListener(new WindowAdapter() |
---|
1480 | 1736 | { |
---|
1481 | | - |
---|
1482 | 1737 | public void windowClosing(WindowEvent e) |
---|
1483 | 1738 | { |
---|
1484 | 1739 | Close(); |
---|
.. | .. |
---|
1501 | 1756 | ctrlPanel.removeAll(); |
---|
1502 | 1757 | } |
---|
1503 | 1758 | |
---|
1504 | | - void SetupMaterial(cGridBag panel) |
---|
| 1759 | + void SetupMaterial(cGridBag materialpanel) |
---|
1505 | 1760 | { |
---|
1506 | | - /* |
---|
| 1761 | + cGridBag presetpanel = new cGridBag().setVertical(true); |
---|
| 1762 | + |
---|
| 1763 | + cLabel skin = GetLabel("icons/shadericons/shadericon00000.png", !Grafreed.NIMBUSLAF); |
---|
| 1764 | + skin.setToolTipText("Skin"); |
---|
| 1765 | + skin.addMouseListener(new MouseAdapter() |
---|
| 1766 | + { |
---|
| 1767 | + public void mouseClicked(MouseEvent e) |
---|
| 1768 | + { |
---|
| 1769 | + Object3D object = Grafreed.materials.versionlist[0].get(0); |
---|
| 1770 | + cMaterial material = object.material; |
---|
| 1771 | + |
---|
| 1772 | + // Skin |
---|
| 1773 | + colorField.setFloat(material.color); |
---|
| 1774 | + saturationField.setFloat(material.modulation); |
---|
| 1775 | + subsurfaceField.setFloat(material.subsurface); |
---|
| 1776 | + selfshadowField.setFloat(material.diffuseness); |
---|
| 1777 | + diffusenessField.setFloat(material.factor); |
---|
| 1778 | + shininessField.setFloat(material.shininess); |
---|
| 1779 | + shadowbiasField.setFloat(material.shadowbias); |
---|
| 1780 | + diffuseField.setFloat(material.diffuse); |
---|
| 1781 | + specularField.setFloat(material.specular); |
---|
| 1782 | + |
---|
| 1783 | + bumpField.setFloat(object.projectedVertices[0].x / 1000.0); |
---|
| 1784 | + noiseField.setFloat(object.projectedVertices[0].y / 1000.0); |
---|
| 1785 | + powerField.setFloat(object.projectedVertices[2].x / 1000.0); |
---|
| 1786 | + |
---|
| 1787 | + materialtouched = true; |
---|
| 1788 | + applySelf(); |
---|
| 1789 | + } |
---|
| 1790 | + }); |
---|
| 1791 | + presetpanel.add(skin); |
---|
| 1792 | + |
---|
| 1793 | + cLabel lambert = GetLabel("icons/shadericons/shadericon00002.png", !Grafreed.NIMBUSLAF); |
---|
| 1794 | + lambert.setToolTipText("Diffuse"); |
---|
| 1795 | + lambert.addMouseListener(new MouseAdapter() |
---|
| 1796 | + { |
---|
| 1797 | + public void mouseClicked(MouseEvent e) |
---|
| 1798 | + { |
---|
| 1799 | + Object3D object = Grafreed.materials.versionlist[2].get(0); |
---|
| 1800 | + cMaterial material = object.material; |
---|
| 1801 | + |
---|
| 1802 | + diffusenessField.setFloat(material.factor); |
---|
| 1803 | + selfshadowField.setFloat(material.diffuseness); |
---|
| 1804 | + |
---|
| 1805 | + materialtouched = true; |
---|
| 1806 | + applySelf(); |
---|
| 1807 | + } |
---|
| 1808 | + }); |
---|
| 1809 | + presetpanel.add(lambert); |
---|
| 1810 | + |
---|
| 1811 | + cLabel diffuse2 = GetLabel("icons/shadericons/shadericon00003.png", !Grafreed.NIMBUSLAF); |
---|
| 1812 | + diffuse2.setToolTipText("Diffuse2"); |
---|
| 1813 | + diffuse2.addMouseListener(new MouseAdapter() |
---|
| 1814 | + { |
---|
| 1815 | + public void mouseClicked(MouseEvent e) |
---|
| 1816 | + { |
---|
| 1817 | + Object3D object = Grafreed.materials.versionlist[3].get(0); |
---|
| 1818 | + cMaterial material = object.material; |
---|
| 1819 | + |
---|
| 1820 | + diffusenessField.setFloat(material.factor); |
---|
| 1821 | + selfshadowField.setFloat(material.diffuseness); |
---|
| 1822 | + |
---|
| 1823 | + materialtouched = true; |
---|
| 1824 | + applySelf(); |
---|
| 1825 | + } |
---|
| 1826 | + }); |
---|
| 1827 | + presetpanel.add(diffuse2); |
---|
| 1828 | + |
---|
| 1829 | + cLabel diffusemoon = GetLabel("icons/shadericons/shadericon00004.png", !Grafreed.NIMBUSLAF); |
---|
| 1830 | + diffusemoon.setToolTipText("Moon"); |
---|
| 1831 | + diffusemoon.addMouseListener(new MouseAdapter() |
---|
| 1832 | + { |
---|
| 1833 | + public void mouseClicked(MouseEvent e) |
---|
| 1834 | + { |
---|
| 1835 | + Object3D object = Grafreed.materials.versionlist[4].get(0); |
---|
| 1836 | + cMaterial material = object.material; |
---|
| 1837 | + |
---|
| 1838 | + diffusenessField.setFloat(material.factor); |
---|
| 1839 | + selfshadowField.setFloat(material.diffuseness); |
---|
| 1840 | + |
---|
| 1841 | + materialtouched = true; |
---|
| 1842 | + applySelf(); |
---|
| 1843 | + } |
---|
| 1844 | + }); |
---|
| 1845 | + presetpanel.add(diffusemoon); |
---|
| 1846 | + |
---|
| 1847 | + cLabel diffusemoon2 = GetLabel("icons/shadericons/shadericon00005.png", !Grafreed.NIMBUSLAF); |
---|
| 1848 | + diffusemoon2.setToolTipText("Moon2"); |
---|
| 1849 | + diffusemoon2.addMouseListener(new MouseAdapter() |
---|
| 1850 | + { |
---|
| 1851 | + public void mouseClicked(MouseEvent e) |
---|
| 1852 | + { |
---|
| 1853 | + Object3D object = Grafreed.materials.versionlist[5].get(0); |
---|
| 1854 | + cMaterial material = object.material; |
---|
| 1855 | + |
---|
| 1856 | + diffusenessField.setFloat(material.factor); |
---|
| 1857 | + selfshadowField.setFloat(material.diffuseness); |
---|
| 1858 | + |
---|
| 1859 | + materialtouched = true; |
---|
| 1860 | + applySelf(); |
---|
| 1861 | + } |
---|
| 1862 | + }); |
---|
| 1863 | + presetpanel.add(diffusemoon2); |
---|
| 1864 | + |
---|
| 1865 | + cLabel diffusemoon3 = GetLabel("icons/shadericons/shadericon00006.png", !Grafreed.NIMBUSLAF); |
---|
| 1866 | + diffusemoon3.setToolTipText("Moon3"); |
---|
| 1867 | + diffusemoon3.addMouseListener(new MouseAdapter() |
---|
| 1868 | + { |
---|
| 1869 | + public void mouseClicked(MouseEvent e) |
---|
| 1870 | + { |
---|
| 1871 | + Object3D object = Grafreed.materials.versionlist[6].get(0); |
---|
| 1872 | + cMaterial material = object.material; |
---|
| 1873 | + |
---|
| 1874 | + diffusenessField.setFloat(material.factor); |
---|
| 1875 | + selfshadowField.setFloat(material.diffuseness); |
---|
| 1876 | + |
---|
| 1877 | + materialtouched = true; |
---|
| 1878 | + applySelf(); |
---|
| 1879 | + } |
---|
| 1880 | + }); |
---|
| 1881 | + presetpanel.add(diffusemoon3); |
---|
| 1882 | + |
---|
| 1883 | + cLabel diffusesheen = GetLabel("icons/shadericons/shadericon00007.png", !Grafreed.NIMBUSLAF); |
---|
| 1884 | + diffusesheen.setToolTipText("Sheen"); |
---|
| 1885 | + diffusesheen.addMouseListener(new MouseAdapter() |
---|
| 1886 | + { |
---|
| 1887 | + public void mouseClicked(MouseEvent e) |
---|
| 1888 | + { |
---|
| 1889 | + Object3D object = Grafreed.materials.versionlist[7].get(0); |
---|
| 1890 | + cMaterial material = object.material; |
---|
| 1891 | + |
---|
| 1892 | + sheenField.setFloat(material.sheen); |
---|
| 1893 | + |
---|
| 1894 | + materialtouched = true; |
---|
| 1895 | + applySelf(); |
---|
| 1896 | + } |
---|
| 1897 | + }); |
---|
| 1898 | + presetpanel.add(diffusesheen); |
---|
| 1899 | + |
---|
| 1900 | + cLabel rough = GetLabel("icons/shadericons/shadericon00001.png", !Grafreed.NIMBUSLAF); |
---|
| 1901 | + rough.setToolTipText("Rough metal"); |
---|
| 1902 | + rough.addMouseListener(new MouseAdapter() |
---|
| 1903 | + { |
---|
| 1904 | + public void mouseClicked(MouseEvent e) |
---|
| 1905 | + { |
---|
| 1906 | + Object3D object = Grafreed.materials.versionlist[1].get(0); |
---|
| 1907 | + cMaterial material = object.material; |
---|
| 1908 | + |
---|
| 1909 | + shininessField.setFloat(material.shininess); |
---|
| 1910 | + velvetField.setFloat(material.velvet); |
---|
| 1911 | + |
---|
| 1912 | + materialtouched = true; |
---|
| 1913 | + applySelf(); |
---|
| 1914 | + } |
---|
| 1915 | + }); |
---|
| 1916 | + presetpanel.add(rough); |
---|
| 1917 | + |
---|
| 1918 | + cLabel rough2 = GetLabel("icons/shadericons/shadericon00013.png", !Grafreed.NIMBUSLAF); |
---|
| 1919 | + rough2.setToolTipText("Medium metal"); |
---|
| 1920 | + rough2.addMouseListener(new MouseAdapter() |
---|
| 1921 | + { |
---|
| 1922 | + public void mouseClicked(MouseEvent e) |
---|
| 1923 | + { |
---|
| 1924 | + Object3D object = Grafreed.materials.versionlist[13].get(0); |
---|
| 1925 | + cMaterial material = object.material; |
---|
| 1926 | + |
---|
| 1927 | + shininessField.setFloat(material.shininess); |
---|
| 1928 | + lightareaField.setFloat(material.lightarea); |
---|
| 1929 | + |
---|
| 1930 | + materialtouched = true; |
---|
| 1931 | + applySelf(); |
---|
| 1932 | + } |
---|
| 1933 | + }); |
---|
| 1934 | + presetpanel.add(rough2); |
---|
| 1935 | + |
---|
| 1936 | + cLabel shini0 = GetLabel("icons/shadericons/shadericon00014.png", !Grafreed.NIMBUSLAF); |
---|
| 1937 | + shini0.setToolTipText("Shiny"); |
---|
| 1938 | + shini0.addMouseListener(new MouseAdapter() |
---|
| 1939 | + { |
---|
| 1940 | + public void mouseClicked(MouseEvent e) |
---|
| 1941 | + { |
---|
| 1942 | + Object3D object = Grafreed.materials.versionlist[14].get(0); |
---|
| 1943 | + cMaterial material = object.material; |
---|
| 1944 | + |
---|
| 1945 | + shininessField.setFloat(material.shininess); |
---|
| 1946 | + lightareaField.setFloat(material.lightarea); |
---|
| 1947 | + |
---|
| 1948 | + materialtouched = true; |
---|
| 1949 | + applySelf(); |
---|
| 1950 | + } |
---|
| 1951 | + }); |
---|
| 1952 | + presetpanel.add(shini0); |
---|
| 1953 | + |
---|
| 1954 | + cLabel shini1 = GetLabel("icons/shadericons/shadericon00011.png", !Grafreed.NIMBUSLAF); |
---|
| 1955 | + shini1.setToolTipText("Shiny2"); |
---|
| 1956 | + shini1.addMouseListener(new MouseAdapter() |
---|
| 1957 | + { |
---|
| 1958 | + public void mouseClicked(MouseEvent e) |
---|
| 1959 | + { |
---|
| 1960 | + Object3D object = Grafreed.materials.versionlist[11].get(0); |
---|
| 1961 | + cMaterial material = object.material; |
---|
| 1962 | + |
---|
| 1963 | + shininessField.setFloat(material.shininess); |
---|
| 1964 | + lightareaField.setFloat(material.lightarea); |
---|
| 1965 | + |
---|
| 1966 | + materialtouched = true; |
---|
| 1967 | + applySelf(); |
---|
| 1968 | + } |
---|
| 1969 | + }); |
---|
| 1970 | + presetpanel.add(shini1); |
---|
| 1971 | + |
---|
| 1972 | + cLabel shini2 = GetLabel("icons/shadericons/shadericon00012.png", !Grafreed.NIMBUSLAF); |
---|
| 1973 | + shini2.setToolTipText("Shiny3"); |
---|
| 1974 | + shini2.addMouseListener(new MouseAdapter() |
---|
| 1975 | + { |
---|
| 1976 | + public void mouseClicked(MouseEvent e) |
---|
| 1977 | + { |
---|
| 1978 | + Object3D object = Grafreed.materials.versionlist[12].get(0); |
---|
| 1979 | + cMaterial material = object.material; |
---|
| 1980 | + |
---|
| 1981 | + shininessField.setFloat(material.shininess); |
---|
| 1982 | + lightareaField.setFloat(material.lightarea); |
---|
| 1983 | + |
---|
| 1984 | + materialtouched = true; |
---|
| 1985 | + applySelf(); |
---|
| 1986 | + } |
---|
| 1987 | + }); |
---|
| 1988 | + presetpanel.add(shini2); |
---|
| 1989 | + |
---|
| 1990 | + cLabel aniso = GetLabel("icons/shadericons/shadericon00008.png", !Grafreed.NIMBUSLAF); |
---|
| 1991 | + aniso.setToolTipText("AnisoU"); |
---|
| 1992 | + aniso.addMouseListener(new MouseAdapter() |
---|
| 1993 | + { |
---|
| 1994 | + public void mouseClicked(MouseEvent e) |
---|
| 1995 | + { |
---|
| 1996 | + Object3D object = Grafreed.materials.versionlist[8].get(0); |
---|
| 1997 | + cMaterial material = object.material; |
---|
| 1998 | + |
---|
| 1999 | + anisoField.setFloat(material.aniso); |
---|
| 2000 | + anisoVField.setFloat(material.anisoV); |
---|
| 2001 | + |
---|
| 2002 | + materialtouched = true; |
---|
| 2003 | + applySelf(); |
---|
| 2004 | + } |
---|
| 2005 | + }); |
---|
| 2006 | + presetpanel.add(aniso); |
---|
| 2007 | + |
---|
| 2008 | + cLabel aniso2 = GetLabel("icons/shadericons/shadericon00009.png", !Grafreed.NIMBUSLAF); |
---|
| 2009 | + aniso2.setToolTipText("AnisoV"); |
---|
| 2010 | + aniso2.addMouseListener(new MouseAdapter() |
---|
| 2011 | + { |
---|
| 2012 | + public void mouseClicked(MouseEvent e) |
---|
| 2013 | + { |
---|
| 2014 | + Object3D object = Grafreed.materials.versionlist[9].get(0); |
---|
| 2015 | + cMaterial material = object.material; |
---|
| 2016 | + |
---|
| 2017 | + anisoField.setFloat(material.aniso); |
---|
| 2018 | + anisoVField.setFloat(material.anisoV); |
---|
| 2019 | + |
---|
| 2020 | + materialtouched = true; |
---|
| 2021 | + applySelf(); |
---|
| 2022 | + } |
---|
| 2023 | + }); |
---|
| 2024 | + presetpanel.add(aniso2); |
---|
| 2025 | + |
---|
| 2026 | + cLabel aniso3 = GetLabel("icons/shadericons/shadericon00010.png", !Grafreed.NIMBUSLAF); |
---|
| 2027 | + aniso3.setToolTipText("AnisoUV"); |
---|
| 2028 | + aniso3.addMouseListener(new MouseAdapter() |
---|
| 2029 | + { |
---|
| 2030 | + public void mouseClicked(MouseEvent e) |
---|
| 2031 | + { |
---|
| 2032 | + Object3D object = Grafreed.materials.versionlist[10].get(0); |
---|
| 2033 | + cMaterial material = object.material; |
---|
| 2034 | + |
---|
| 2035 | + anisoField.setFloat(material.aniso); |
---|
| 2036 | + anisoVField.setFloat(material.anisoV); |
---|
| 2037 | + |
---|
| 2038 | + materialtouched = true; |
---|
| 2039 | + applySelf(); |
---|
| 2040 | + } |
---|
| 2041 | + }); |
---|
| 2042 | + presetpanel.add(aniso3); |
---|
| 2043 | + |
---|
| 2044 | + cLabel velvet0 = GetLabel("icons/shadericons/shadericon00015.png", !Grafreed.NIMBUSLAF); |
---|
| 2045 | + velvet0.setToolTipText("Velvet"); |
---|
| 2046 | + velvet0.addMouseListener(new MouseAdapter() |
---|
| 2047 | + { |
---|
| 2048 | + public void mouseClicked(MouseEvent e) |
---|
| 2049 | + { |
---|
| 2050 | + Object3D object = Grafreed.materials.versionlist[15].get(0); |
---|
| 2051 | + cMaterial material = object.material; |
---|
| 2052 | + |
---|
| 2053 | + diffusenessField.setFloat(material.factor); |
---|
| 2054 | + selfshadowField.setFloat(material.diffuseness); |
---|
| 2055 | + sheenField.setFloat(material.sheen); |
---|
| 2056 | + shininessField.setFloat(material.shininess); |
---|
| 2057 | + velvetField.setFloat(material.velvet); |
---|
| 2058 | + shiftField.setFloat(material.shift); |
---|
| 2059 | + |
---|
| 2060 | + materialtouched = true; |
---|
| 2061 | + applySelf(); |
---|
| 2062 | + } |
---|
| 2063 | + }); |
---|
| 2064 | + presetpanel.add(velvet0); |
---|
| 2065 | + |
---|
| 2066 | + cLabel bump0 = GetLabel("icons/shadericons/shadericon00016.png", !Grafreed.NIMBUSLAF); |
---|
| 2067 | + bump0.setToolTipText("Bump texture"); |
---|
| 2068 | + bump0.addMouseListener(new MouseAdapter() |
---|
| 2069 | + { |
---|
| 2070 | + public void mouseClicked(MouseEvent e) |
---|
| 2071 | + { |
---|
| 2072 | + Object3D object = Grafreed.materials.versionlist[16].get(0); |
---|
| 2073 | + cMaterial material = object.material; |
---|
| 2074 | + |
---|
| 2075 | + bumpField.setFloat(object.projectedVertices[0].x / 1000.0); |
---|
| 2076 | + noiseField.setFloat(object.projectedVertices[0].y / 1000.0); |
---|
| 2077 | + powerField.setFloat(object.projectedVertices[2].x / 1000.0); |
---|
| 2078 | + |
---|
| 2079 | + materialtouched = true; |
---|
| 2080 | + applySelf(); |
---|
| 2081 | + } |
---|
| 2082 | + }); |
---|
| 2083 | + presetpanel.add(bump0); |
---|
| 2084 | + |
---|
| 2085 | + cLabel halo = GetLabel("icons/shadericons/shadericon00017.png", !Grafreed.NIMBUSLAF); |
---|
| 2086 | + halo.setToolTipText("Halo"); |
---|
| 2087 | + halo.addMouseListener(new MouseAdapter() |
---|
| 2088 | + { |
---|
| 2089 | + public void mouseClicked(MouseEvent e) |
---|
| 2090 | + { |
---|
| 2091 | + Object3D object = Grafreed.materials.versionlist[17].get(0); |
---|
| 2092 | + cMaterial material = object.material; |
---|
| 2093 | + |
---|
| 2094 | + opacityPowerField.setFloat(object.projectedVertices[2].y / 1000.0); |
---|
| 2095 | + |
---|
| 2096 | + materialtouched = true; |
---|
| 2097 | + applySelf(); |
---|
| 2098 | + } |
---|
| 2099 | + }); |
---|
| 2100 | + presetpanel.add(halo); |
---|
| 2101 | + |
---|
| 2102 | + cLabel candle = GetLabel("icons/shadericons/shadericon00018.png", !Grafreed.NIMBUSLAF); |
---|
| 2103 | + candle.setToolTipText("Candle"); |
---|
| 2104 | + candle.addMouseListener(new MouseAdapter() |
---|
| 2105 | + { |
---|
| 2106 | + public void mouseClicked(MouseEvent e) |
---|
| 2107 | + { |
---|
| 2108 | + Object3D object = Grafreed.materials.versionlist[18].get(0); |
---|
| 2109 | + cMaterial material = object.material; |
---|
| 2110 | + |
---|
| 2111 | + subsurfaceField.setFloat(material.subsurface); |
---|
| 2112 | + shadowbiasField.setFloat(material.shadowbias); |
---|
| 2113 | + ambientField.setFloat(material.ambient); |
---|
| 2114 | + specularField.setFloat(material.specular); |
---|
| 2115 | + lightareaField.setFloat(material.lightarea); |
---|
| 2116 | + shininessField.setFloat(material.shininess); |
---|
| 2117 | + |
---|
| 2118 | + materialtouched = true; |
---|
| 2119 | + applySelf(); |
---|
| 2120 | + } |
---|
| 2121 | + }); |
---|
| 2122 | + presetpanel.add(candle); |
---|
| 2123 | + |
---|
| 2124 | + cGridBag panel = new cGridBag().setVertical(true); |
---|
| 2125 | + |
---|
| 2126 | + presetpanel.preferredWidth = 1; |
---|
| 2127 | + |
---|
| 2128 | + materialpanel.add(presetpanel); |
---|
| 2129 | + materialpanel.add(panel); |
---|
| 2130 | + |
---|
| 2131 | + panel.preferredWidth = 8; |
---|
| 2132 | + |
---|
| 2133 | + /* |
---|
1507 | 2134 | ctrlPanel.add(materialLabel = new JLabel("MATERIAL : "), aConstraints); |
---|
1508 | 2135 | materialLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1509 | | - */ |
---|
| 2136 | + */ |
---|
1510 | 2137 | |
---|
1511 | 2138 | cGridBag editBar = new cGridBag().setVertical(false); |
---|
1512 | 2139 | |
---|
.. | .. |
---|
1540 | 2167 | //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints); |
---|
1541 | 2168 | |
---|
1542 | 2169 | cGridBag colorSection = new cGridBag().setVertical(true); |
---|
| 2170 | + |
---|
| 2171 | + cGridBag huepanel = new cGridBag(); |
---|
| 2172 | + cGridBag huelabel = new cGridBag(); |
---|
| 2173 | + skin = GetLabel("icons/hue.png", false); |
---|
| 2174 | + skin.fit = true; |
---|
| 2175 | + huelabel.add(skin); |
---|
| 2176 | + huelabel.preferredWidth = 20; |
---|
| 2177 | + huepanel.add(new cGridBag()); // Label |
---|
| 2178 | + huepanel.add(huelabel); // Field/slider |
---|
| 2179 | + |
---|
| 2180 | + huepanel.preferredHeight = 7; |
---|
| 2181 | + |
---|
| 2182 | + colorSection.add(huepanel); |
---|
1543 | 2183 | |
---|
1544 | 2184 | cGridBag color = new cGridBag(); |
---|
1545 | | - color.add(colorLabel = new JLabel("Color/hue")); // , aConstraints); |
---|
1546 | | - colorLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1547 | | - color.add(colorField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
| 2185 | + |
---|
| 2186 | + color.add(colorLabel = new JLabel("Color/hue")); // , aConstraints); |
---|
| 2187 | + colorLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 2188 | + color.add(colorField = new cNumberSlider(this, 0.001, 1)); // , aConstraints); |
---|
| 2189 | + |
---|
1548 | 2190 | //colorField.preferredWidth = 200; |
---|
1549 | 2191 | colorSection.add(color); |
---|
1550 | 2192 | |
---|
1551 | 2193 | cGridBag modulation = new cGridBag(); |
---|
1552 | 2194 | modulation.add(modulationLabel = new JLabel("Saturation")); // , aConstraints); |
---|
1553 | 2195 | modulationLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1554 | | - modulation.add(modulationField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
| 2196 | + modulation.add(saturationField = new cNumberSlider(this, 0.001, 1)); // , aConstraints); |
---|
1555 | 2197 | colorSection.add(modulation); |
---|
1556 | 2198 | |
---|
| 2199 | + cGridBag opacity = new cGridBag(); |
---|
| 2200 | + opacity.add(opacityLabel = new JLabel("Opacity")); // , aConstraints); |
---|
| 2201 | + opacityLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 2202 | + opacity.add(opacityField = new cNumberSlider(this, 0.001, 1)); // , aConstraints); |
---|
| 2203 | + colorSection.add(opacity); |
---|
| 2204 | + |
---|
| 2205 | + colorSection.add(GetSeparator()); |
---|
| 2206 | + |
---|
1557 | 2207 | cGridBag texture = new cGridBag(); |
---|
1558 | 2208 | texture.add(textureLabel = new JLabel("Texture")); // , aConstraints); |
---|
1559 | 2209 | textureLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1560 | 2210 | texture.add(textureField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
1561 | 2211 | colorSection.add(texture); |
---|
1562 | 2212 | |
---|
1563 | | - cGridBag anisoU = new cGridBag(); |
---|
1564 | | - anisoU.add(anisoLabel = new JLabel("AnisoU")); // , aConstraints); |
---|
1565 | | - anisoLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1566 | | - anisoU.add(anisoField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
1567 | | - colorSection.add(anisoU); |
---|
1568 | | - |
---|
1569 | | - cGridBag anisoV = new cGridBag(); |
---|
1570 | | - anisoV.add(anisoVLabel = new JLabel("AnisoV")); // , aConstraints); |
---|
1571 | | - anisoVLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1572 | | - anisoV.add(anisoVField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
1573 | | - colorSection.add(anisoV); |
---|
1574 | | - |
---|
1575 | | - cGridBag shadowbias = new cGridBag(); |
---|
1576 | | - shadowbias.add(shadowbiasLabel = new JLabel("Shadowbias")); // , aConstraints); |
---|
1577 | | - shadowbiasLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1578 | | - shadowbias.add(shadowbiasField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
1579 | | - colorSection.add(shadowbias); |
---|
1580 | | - |
---|
1581 | | - panel.add(new JSeparator()); |
---|
| 2213 | + panel.add(GetSeparator()); |
---|
1582 | 2214 | |
---|
1583 | 2215 | panel.add(colorSection); |
---|
1584 | 2216 | |
---|
.. | .. |
---|
1628 | 2260 | fakedepth.add(fakedepthField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
1629 | 2261 | diffuseSection.add(fakedepth); |
---|
1630 | 2262 | |
---|
1631 | | - panel.add(new JSeparator()); |
---|
| 2263 | + cGridBag shadowbias = new cGridBag(); |
---|
| 2264 | + shadowbias.add(shadowbiasLabel = new JLabel("Shadowbias")); // , aConstraints); |
---|
| 2265 | + shadowbiasLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 2266 | + shadowbias.add(shadowbiasField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
| 2267 | + diffuseSection.add(shadowbias); |
---|
| 2268 | + |
---|
| 2269 | + panel.add(GetSeparator()); |
---|
1632 | 2270 | |
---|
1633 | 2271 | panel.add(diffuseSection); |
---|
1634 | 2272 | |
---|
.. | .. |
---|
1678 | 2316 | // aConstraints.gridy += 1; |
---|
1679 | 2317 | // aConstraints.gridwidth = 1; |
---|
1680 | 2318 | |
---|
| 2319 | + cGridBag anisoU = new cGridBag(); |
---|
| 2320 | + anisoU.add(anisoLabel = new JLabel("AnisoU")); // , aConstraints); |
---|
| 2321 | + anisoLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 2322 | + anisoU.add(anisoField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
| 2323 | + specularSection.add(anisoU); |
---|
1681 | 2324 | |
---|
1682 | | - panel.add(new JSeparator()); |
---|
| 2325 | + cGridBag anisoV = new cGridBag(); |
---|
| 2326 | + anisoV.add(anisoVLabel = new JLabel("AnisoV")); // , aConstraints); |
---|
| 2327 | + anisoVLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 2328 | + anisoV.add(anisoVField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
| 2329 | + specularSection.add(anisoV); |
---|
| 2330 | + |
---|
| 2331 | + |
---|
| 2332 | + panel.add(GetSeparator()); |
---|
1683 | 2333 | |
---|
1684 | 2334 | panel.add(specularSection); |
---|
1685 | 2335 | |
---|
1686 | 2336 | //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints); |
---|
1687 | 2337 | |
---|
1688 | | - cGridBag globalSection = new cGridBag().setVertical(true); |
---|
| 2338 | + //cGridBag globalSection = new cGridBag().setVertical(true); |
---|
1689 | 2339 | |
---|
1690 | 2340 | cGridBag camera = new cGridBag(); |
---|
1691 | 2341 | camera.add(cameraLabel = new JLabel("GlobalLight")); // , aConstraints); |
---|
1692 | 2342 | cameraLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1693 | 2343 | camera.add(cameraField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
1694 | | - globalSection.add(camera); |
---|
| 2344 | + colorSection.add(camera); |
---|
1695 | 2345 | |
---|
1696 | 2346 | cGridBag ambient = new cGridBag(); |
---|
1697 | 2347 | ambient.add(ambientLabel = new JLabel("Ambient")); // , aConstraints); |
---|
1698 | 2348 | ambientLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1699 | 2349 | ambient.add(ambientField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
1700 | | - globalSection.add(ambient); |
---|
| 2350 | + colorSection.add(ambient); |
---|
1701 | 2351 | |
---|
1702 | 2352 | cGridBag backlit = new cGridBag(); |
---|
1703 | 2353 | backlit.add(backlitLabel = new JLabel("Backlit")); // , aConstraints); |
---|
1704 | 2354 | backlitLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1705 | 2355 | backlit.add(backlitField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
1706 | | - globalSection.add(backlit); |
---|
| 2356 | + colorSection.add(backlit); |
---|
1707 | 2357 | |
---|
1708 | | - cGridBag opacity = new cGridBag(); |
---|
1709 | | - opacity.add(opacityLabel = new JLabel("Opacity")); // , aConstraints); |
---|
1710 | | - opacityLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1711 | | - opacity.add(opacityField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
1712 | | - globalSection.add(opacity); |
---|
1713 | | - |
---|
1714 | | - panel.add(new JSeparator()); |
---|
| 2358 | + //panel.add(new JSeparator()); |
---|
1715 | 2359 | |
---|
1716 | | - panel.add(globalSection); |
---|
| 2360 | + //panel.add(globalSection); |
---|
1717 | 2361 | |
---|
1718 | 2362 | //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints); |
---|
1719 | 2363 | |
---|
.. | .. |
---|
1755 | 2399 | opacityPower.add(opacityPowerField = new cNumberSlider(this, 0.0, 10 /*10 dec 2013*/)); // , aConstraints); |
---|
1756 | 2400 | textureSection.add(opacityPower); |
---|
1757 | 2401 | |
---|
1758 | | - panel.add(new JSeparator()); |
---|
| 2402 | + panel.add(GetSeparator()); |
---|
1759 | 2403 | |
---|
1760 | 2404 | panel.add(textureSection); |
---|
1761 | 2405 | |
---|
.. | .. |
---|
1820 | 2464 | // 3D models |
---|
1821 | 2465 | if (filename.endsWith(".3ds") || filename.endsWith(".3DS")) |
---|
1822 | 2466 | { |
---|
1823 | | - lastConverter = new com.jmex.model.converters.MaxToJme(); |
---|
1824 | | - LoadFile(filename, lastConverter); |
---|
| 2467 | + //lastConverter = new com.jmex.model.converters.MaxToJme(); |
---|
| 2468 | + //LoadFile(filename, lastConverter); |
---|
| 2469 | + LoadObjFile(filename); // New 3ds loader |
---|
1825 | 2470 | continue; |
---|
1826 | 2471 | } |
---|
1827 | 2472 | if (filename.endsWith(".dae") || filename.endsWith(".DAE")) |
---|
.. | .. |
---|
2547 | 3192 | LA.matXRotate(((Object3D) group.get(group.size() - 1)).toParent, -Math.PI / 2); |
---|
2548 | 3193 | LA.matXRotate(((Object3D) group.get(group.size() - 1)).fromParent, Math.PI / 2); |
---|
2549 | 3194 | } |
---|
| 3195 | + |
---|
2550 | 3196 | //cJME.count++; |
---|
2551 | 3197 | //cJME.count %= 12; |
---|
2552 | 3198 | if (gc) |
---|
.. | .. |
---|
2730 | 3376 | } |
---|
2731 | 3377 | } |
---|
2732 | 3378 | } |
---|
| 3379 | + |
---|
2733 | 3380 | cFileSystemPane FSPane; |
---|
2734 | 3381 | |
---|
2735 | 3382 | void SetMaterial(cMaterial mat, Object3D.cVector2[] others) |
---|
.. | .. |
---|
2739 | 3386 | |
---|
2740 | 3387 | freezematerial = true; |
---|
2741 | 3388 | colorField.setFloat(mat.color); |
---|
2742 | | - modulationField.setFloat(mat.modulation); |
---|
| 3389 | + saturationField.setFloat(mat.modulation); |
---|
2743 | 3390 | metalnessField.setFloat(mat.metalness); |
---|
2744 | 3391 | diffuseField.setFloat(mat.diffuse); |
---|
2745 | 3392 | specularField.setFloat(mat.specular); |
---|
.. | .. |
---|
2783 | 3430 | } |
---|
2784 | 3431 | } |
---|
2785 | 3432 | } |
---|
| 3433 | + |
---|
2786 | 3434 | freezematerial = false; |
---|
2787 | 3435 | } |
---|
2788 | 3436 | |
---|
2789 | 3437 | void SetMaterial(Object3D object) |
---|
2790 | 3438 | { |
---|
| 3439 | + latestObject = object; |
---|
| 3440 | + |
---|
2791 | 3441 | cMaterial mat = object.material; |
---|
2792 | 3442 | |
---|
2793 | 3443 | if (mat == null) |
---|
.. | .. |
---|
2899 | 3549 | // } |
---|
2900 | 3550 | |
---|
2901 | 3551 | /**/ |
---|
2902 | | - if (deselect) |
---|
| 3552 | + if (deselect || child == null) |
---|
2903 | 3553 | { |
---|
2904 | 3554 | //group.deselectAll(); |
---|
2905 | 3555 | //freeze = true; |
---|
2906 | 3556 | GetTree().clearSelection(); |
---|
2907 | 3557 | //freeze = false; |
---|
| 3558 | + |
---|
| 3559 | + if (child == null) |
---|
| 3560 | + { |
---|
| 3561 | + return; |
---|
| 3562 | + } |
---|
2908 | 3563 | } |
---|
2909 | 3564 | |
---|
2910 | 3565 | //group.addSelectee(child); |
---|
.. | .. |
---|
2938 | 3593 | public void itemStateChanged(ItemEvent event) |
---|
2939 | 3594 | { |
---|
2940 | 3595 | // System.out.println("Propagate = " + propagate); |
---|
| 3596 | + if (event.getSource() == pinButton) |
---|
| 3597 | + { |
---|
| 3598 | + copy.pinned ^= true; |
---|
| 3599 | + if (!copy.pinned && !copy.editWindow.copy.selection.contains(copy)) |
---|
| 3600 | + { |
---|
| 3601 | + ((GroupEditor)copy.editWindow).listUI.remove(copy); |
---|
| 3602 | + copy.CloseUI(); |
---|
| 3603 | + //copy.editWindow.refreshContents(); |
---|
| 3604 | + } |
---|
| 3605 | + } |
---|
| 3606 | + else |
---|
2941 | 3607 | if (event.getSource() == propagateToggle) |
---|
2942 | 3608 | { |
---|
2943 | 3609 | propagate ^= true; |
---|
.. | .. |
---|
2973 | 3639 | cameraView.ToggleDL(); |
---|
2974 | 3640 | cameraView.repaint(); |
---|
2975 | 3641 | return; |
---|
2976 | | - } else if (event.getSource() == toggleTextureItem) |
---|
| 3642 | + } else if (event.getSource() == toggleTextureItem || event.getSource() == toggleTextureCB) |
---|
2977 | 3643 | { |
---|
2978 | 3644 | cameraView.ToggleTexture(); |
---|
2979 | 3645 | // june 2013 copy.HardTouch(); |
---|
.. | .. |
---|
3012 | 3678 | frame.validate(); |
---|
3013 | 3679 | |
---|
3014 | 3680 | return; |
---|
3015 | | - } else if (event.getSource() == toggleSwitchItem) |
---|
| 3681 | + } else if (event.getSource() == toggleSwitchItem || event.getSource() == toggleSwitchCB) |
---|
3016 | 3682 | { |
---|
3017 | 3683 | cameraView.ToggleSwitch(); |
---|
3018 | 3684 | cameraView.repaint(); |
---|
.. | .. |
---|
3042 | 3708 | } else if (event.getSource() == liveCB) |
---|
3043 | 3709 | { |
---|
3044 | 3710 | copy.live ^= true; |
---|
| 3711 | + objEditor.refreshContents(true); // To show item colors |
---|
3045 | 3712 | return; |
---|
3046 | | - } else if (event.getSource() == selectCB) |
---|
| 3713 | + } else if (event.getSource() == selectableCB) |
---|
3047 | 3714 | { |
---|
3048 | 3715 | copy.dontselect ^= true; |
---|
3049 | 3716 | return; |
---|
.. | .. |
---|
3051 | 3718 | { |
---|
3052 | 3719 | copy.hide ^= true; |
---|
3053 | 3720 | copy.Touch(); // display list issue |
---|
3054 | | - objEditor.refreshContents(); |
---|
| 3721 | + objEditor.refreshContents(true); // To show item colors |
---|
3055 | 3722 | return; |
---|
3056 | 3723 | } else if (event.getSource() == link2masterCB) |
---|
3057 | 3724 | { |
---|
.. | .. |
---|
3228 | 3895 | { |
---|
3229 | 3896 | Close(); |
---|
3230 | 3897 | //return true; |
---|
3231 | | - } else if (source == loadItem) |
---|
| 3898 | + } else if (source == openItem) |
---|
3232 | 3899 | { |
---|
3233 | | - load(); |
---|
| 3900 | + Open(); |
---|
3234 | 3901 | //return true; |
---|
3235 | 3902 | } else if (source == newItem) |
---|
3236 | 3903 | { |
---|
.. | .. |
---|
3255 | 3922 | { |
---|
3256 | 3923 | generatePOV(); |
---|
3257 | 3924 | //return true; |
---|
| 3925 | + } else if (event.getSource() == archiveItem) |
---|
| 3926 | + { |
---|
| 3927 | + cTools.Archive(frame); |
---|
| 3928 | + return; |
---|
3258 | 3929 | } else if (source == zBufferItem) |
---|
3259 | 3930 | { |
---|
3260 | 3931 | try |
---|
.. | .. |
---|
3303 | 3974 | |
---|
3304 | 3975 | static public byte[] Compress(Object3D o) |
---|
3305 | 3976 | { |
---|
| 3977 | + // Slower to actually compress. |
---|
3306 | 3978 | try |
---|
3307 | 3979 | { |
---|
3308 | 3980 | ByteArrayOutputStream baos = new ByteArrayOutputStream(); |
---|
3309 | | - java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(baos); |
---|
3310 | | - ObjectOutputStream out = new ObjectOutputStream(zstream); |
---|
| 3981 | +// java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(baos); |
---|
| 3982 | + ObjectOutputStream out = new ObjectOutputStream(baos); //zstream); |
---|
3311 | 3983 | |
---|
3312 | 3984 | Object3D parent = o.parent; |
---|
3313 | 3985 | o.parent = null; |
---|
.. | .. |
---|
3318 | 3990 | |
---|
3319 | 3991 | out.flush(); |
---|
3320 | 3992 | |
---|
3321 | | - zstream.close(); |
---|
| 3993 | + baos //zstream |
---|
| 3994 | + .close(); |
---|
3322 | 3995 | out.close(); |
---|
3323 | 3996 | |
---|
3324 | | - return baos.toByteArray(); |
---|
| 3997 | + byte[] bytes = baos.toByteArray(); |
---|
| 3998 | + |
---|
| 3999 | + System.out.println("save #bytes = " + bytes.length); |
---|
| 4000 | + return bytes; |
---|
3325 | 4001 | } catch (Exception e) |
---|
3326 | 4002 | { |
---|
3327 | 4003 | System.err.println(e); |
---|
.. | .. |
---|
3331 | 4007 | |
---|
3332 | 4008 | static public Object Uncompress(byte[] bytes) |
---|
3333 | 4009 | { |
---|
3334 | | - System.out.println("#bytes = " + bytes.length); |
---|
| 4010 | + System.out.println("restore #bytes = " + bytes.length); |
---|
3335 | 4011 | try |
---|
3336 | 4012 | { |
---|
3337 | 4013 | ByteArrayInputStream bais = new ByteArrayInputStream(bytes); |
---|
3338 | | - java.util.zip.GZIPInputStream istream = new java.util.zip.GZIPInputStream(bais); |
---|
3339 | | - ObjectInputStream in = new ObjectInputStream(istream); |
---|
| 4014 | + //java.util.zip.GZIPInputStream istream = new java.util.zip.GZIPInputStream(bais); |
---|
| 4015 | + ObjectInputStream in = new ObjectInputStream(bais); // istream); |
---|
3340 | 4016 | Object obj = in.readObject(); |
---|
| 4017 | + |
---|
| 4018 | + bais //istream |
---|
| 4019 | + .close(); |
---|
3341 | 4020 | in.close(); |
---|
3342 | 4021 | |
---|
3343 | 4022 | return obj; |
---|
.. | .. |
---|
3392 | 4071 | return null; |
---|
3393 | 4072 | } |
---|
3394 | 4073 | |
---|
3395 | | - java.util.Hashtable<java.util.UUID, Object3D> hashtable = new java.util.Hashtable<java.util.UUID, Object3D>(); |
---|
3396 | 4074 | |
---|
3397 | 4075 | public void Save() |
---|
3398 | 4076 | { |
---|
| 4077 | + //Save(true); |
---|
| 4078 | + Replace(); |
---|
| 4079 | + SetUndoStates(); |
---|
| 4080 | + } |
---|
| 4081 | + |
---|
| 4082 | + private boolean Equal(byte[] compress, byte[] name) |
---|
| 4083 | + { |
---|
| 4084 | + if (compress.length != name.length) |
---|
| 4085 | + { |
---|
| 4086 | + return false; |
---|
| 4087 | + } |
---|
| 4088 | + |
---|
| 4089 | + for (int i=compress.length; --i>=0;) |
---|
| 4090 | + { |
---|
| 4091 | + if (compress[i] != name[i]) |
---|
| 4092 | + return false; |
---|
| 4093 | + } |
---|
| 4094 | + |
---|
| 4095 | + return true; |
---|
| 4096 | + } |
---|
| 4097 | + |
---|
| 4098 | + java.util.Hashtable<java.util.UUID, Object3D> versiontable = new java.util.Hashtable<java.util.UUID, Object3D>(); |
---|
| 4099 | + |
---|
| 4100 | + void DeleteVersion() |
---|
| 4101 | + { |
---|
| 4102 | + for (int i = copy.versionindex; i < copy.versionlist.length-1; i++) |
---|
| 4103 | + { |
---|
| 4104 | + copy.versionlist[i] = copy.versionlist[i+1]; |
---|
| 4105 | + } |
---|
| 4106 | + |
---|
| 4107 | + CopyChanged(); |
---|
| 4108 | + |
---|
| 4109 | + SetUndoStates(); |
---|
| 4110 | + } |
---|
| 4111 | + |
---|
| 4112 | + public boolean Save(boolean user) |
---|
| 4113 | + { |
---|
| 4114 | + System.err.println("Save"); |
---|
| 4115 | + //Replace(); |
---|
| 4116 | + |
---|
3399 | 4117 | cRadio tab = GetCurrentTab(); |
---|
3400 | 4118 | |
---|
3401 | | - boolean temp = CameraPane.SWITCH; |
---|
3402 | | - CameraPane.SWITCH = false; |
---|
| 4119 | + Object3D compress = CompressCopy(); // Saved version. No need for "Replace"? |
---|
3403 | 4120 | |
---|
3404 | | - copy.ExtractBigData(hashtable); |
---|
| 4121 | + boolean thesame = false; |
---|
| 4122 | + |
---|
| 4123 | +// if (copy.versionindex > 0 && copy.versions[copy.versionindex-1] != null && Equal(compress, copy.versions[copy.versionindex-1])) |
---|
| 4124 | +// { |
---|
| 4125 | +// thesame = true; |
---|
| 4126 | +// } |
---|
3405 | 4127 | |
---|
3406 | 4128 | //EditorFrame.m_MainFrame.requestFocusInWindow(); |
---|
3407 | | - tab.graphs[tab.undoindex++] = Compress(copy); |
---|
3408 | | - |
---|
3409 | | - copy.RestoreBigData(hashtable); |
---|
3410 | | - |
---|
3411 | | - CameraPane.SWITCH = temp; |
---|
3412 | | - |
---|
3413 | | - //assert(hashtable.isEmpty()); |
---|
3414 | | - |
---|
3415 | | - for (int i = tab.undoindex; i < tab.graphs.length; i++) |
---|
| 4129 | + if (!thesame) |
---|
3416 | 4130 | { |
---|
3417 | | - tab.graphs[i] = null; |
---|
| 4131 | + for (int i = copy.versionlist.length; --i > copy.versionindex+1;) |
---|
| 4132 | + { |
---|
| 4133 | + copy.versionlist[i] = copy.versionlist[i-1]; |
---|
| 4134 | + } |
---|
| 4135 | + |
---|
| 4136 | + //tab.user[tab.versionindex] = user; |
---|
| 4137 | + //boolean increment = true; // tab.graphs[tab.versionindex] == null; |
---|
| 4138 | + |
---|
| 4139 | + copy.versionlist[++copy.versionindex] = compress; |
---|
| 4140 | + |
---|
| 4141 | + // if (increment) |
---|
| 4142 | + // tab.versionindex++; |
---|
3418 | 4143 | } |
---|
3419 | 4144 | |
---|
| 4145 | + //copy.RestoreBigData(versiontable); |
---|
| 4146 | + |
---|
| 4147 | + //assert(hashtable.isEmpty()); |
---|
| 4148 | + |
---|
| 4149 | +// for (int i = copy.versionindex+1; i < copy.versionlist.length; i++) |
---|
| 4150 | +// { |
---|
| 4151 | +// //tab.user[i] = false; |
---|
| 4152 | +// copy.versionlist[i] = null; |
---|
| 4153 | +// } |
---|
| 4154 | + |
---|
| 4155 | + SetUndoStates(); |
---|
| 4156 | + |
---|
3420 | 4157 | // test save |
---|
3421 | 4158 | if (false) |
---|
3422 | 4159 | { |
---|
3423 | 4160 | try |
---|
3424 | 4161 | { |
---|
3425 | | - FileOutputStream ostream = new FileOutputStream("save" + tab.undoindex); |
---|
| 4162 | + FileOutputStream ostream = new FileOutputStream("save" + copy.versionindex); |
---|
3426 | 4163 | ObjectOutputStream p = new ObjectOutputStream(ostream); |
---|
3427 | 4164 | |
---|
3428 | 4165 | p.writeObject(copy); |
---|
.. | .. |
---|
3435 | 4172 | e.printStackTrace(); |
---|
3436 | 4173 | } |
---|
3437 | 4174 | } |
---|
| 4175 | + |
---|
| 4176 | + return !thesame; |
---|
| 4177 | + } |
---|
| 4178 | + |
---|
| 4179 | + boolean flashIt = true; |
---|
| 4180 | + |
---|
| 4181 | + void RefreshSelection() |
---|
| 4182 | + { |
---|
| 4183 | + Object3D selection = new Object3D(); |
---|
| 4184 | + |
---|
| 4185 | + for (int i = 0; i < copy.selection.size(); i++) |
---|
| 4186 | + { |
---|
| 4187 | + Object3D elem = copy.selection.elementAt(i); |
---|
| 4188 | + |
---|
| 4189 | + Object3D obj = copy.GetObject(elem.GetUUID()); |
---|
| 4190 | + |
---|
| 4191 | + if (obj == null) |
---|
| 4192 | + { |
---|
| 4193 | + copy.selection.remove(i--); |
---|
| 4194 | + } |
---|
| 4195 | + else |
---|
| 4196 | + { |
---|
| 4197 | + selection.add(obj); |
---|
| 4198 | + copy.selection.setElementAt(obj, i); |
---|
| 4199 | + } |
---|
| 4200 | + } |
---|
| 4201 | + |
---|
| 4202 | + flashIt = false; |
---|
| 4203 | + GetTree().clearSelection(); |
---|
| 4204 | + for (int i = 0; i < selection.size(); i++) |
---|
| 4205 | + GetTree().addSelectionPath(selection.elementAt(i).GetTreePath().GetTreePath()); |
---|
| 4206 | + flashIt = true; |
---|
| 4207 | + |
---|
| 4208 | + //refreshContents(false); |
---|
3438 | 4209 | } |
---|
3439 | 4210 | |
---|
3440 | | - void CopyChanged(Object3D obj) |
---|
| 4211 | + void CopyChanged() |
---|
3441 | 4212 | { |
---|
| 4213 | + Object3D obj = copy.versionlist[copy.versionindex]; |
---|
| 4214 | + |
---|
| 4215 | + SetUndoStates(); |
---|
| 4216 | + |
---|
3442 | 4217 | boolean temp = CameraPane.SWITCH; |
---|
3443 | 4218 | CameraPane.SWITCH = false; |
---|
3444 | 4219 | |
---|
3445 | | - copy.ExtractBigData(hashtable); |
---|
| 4220 | + copy.ExtractBigData(versiontable); |
---|
3446 | 4221 | |
---|
3447 | 4222 | copy.clear(); |
---|
3448 | 4223 | |
---|
| 4224 | + copy.skyboxname = obj.skyboxname; |
---|
| 4225 | + copy.skyboxext = obj.skyboxext; |
---|
| 4226 | + |
---|
3449 | 4227 | for (int i=0; i<obj.Size(); i++) |
---|
3450 | 4228 | { |
---|
3451 | 4229 | copy.add(obj.get(i)); |
---|
3452 | 4230 | } |
---|
3453 | 4231 | |
---|
3454 | | - copy.RestoreBigData(hashtable); |
---|
| 4232 | + copy.RestoreBigData(versiontable); |
---|
3455 | 4233 | |
---|
3456 | 4234 | CameraPane.SWITCH = temp; |
---|
3457 | 4235 | |
---|
| 4236 | + RefreshSelection(); |
---|
3458 | 4237 | //assert(hashtable.isEmpty()); |
---|
3459 | 4238 | |
---|
3460 | 4239 | copy.Touch(); |
---|
.. | .. |
---|
3475 | 4254 | } |
---|
3476 | 4255 | } |
---|
3477 | 4256 | |
---|
3478 | | - refreshContents(); |
---|
| 4257 | + refreshContents(true); |
---|
3479 | 4258 | } |
---|
3480 | 4259 | |
---|
3481 | | - public void Undo() |
---|
| 4260 | + cButton previousVersionButton; |
---|
| 4261 | + cButton restoreButton; |
---|
| 4262 | + cButton replaceButton; |
---|
| 4263 | + cButton nextVersionButton; |
---|
| 4264 | + cButton saveVersionButton; |
---|
| 4265 | + cButton deleteVersionButton; |
---|
| 4266 | + |
---|
| 4267 | + boolean muteSlider; |
---|
| 4268 | + |
---|
| 4269 | + int VersionCount() |
---|
| 4270 | + { |
---|
| 4271 | + int count = 0; |
---|
| 4272 | + |
---|
| 4273 | + for (int i = copy.versionlist.length; --i >= 0;) |
---|
| 4274 | + { |
---|
| 4275 | + if (copy.versionlist[i] != null) |
---|
| 4276 | + count++; |
---|
| 4277 | + } |
---|
| 4278 | + |
---|
| 4279 | + return count; |
---|
| 4280 | + } |
---|
| 4281 | + |
---|
| 4282 | + void SetUndoStates() |
---|
3482 | 4283 | { |
---|
3483 | 4284 | cRadio tab = GetCurrentTab(); |
---|
3484 | 4285 | |
---|
3485 | | - if (tab.undoindex == 0) |
---|
| 4286 | + restoreButton.setEnabled(true); // copy.versionindex != -1); |
---|
| 4287 | + replaceButton.setEnabled(true); // copy.versionindex != -1); |
---|
| 4288 | + |
---|
| 4289 | + previousVersionButton.setEnabled(copy.versionindex > 0); |
---|
| 4290 | + nextVersionButton.setEnabled(copy.versionlist[copy.versionindex + 1] != null); |
---|
| 4291 | + |
---|
| 4292 | + deleteVersionButton.setEnabled(//copy.versionindex > 0 && |
---|
| 4293 | + copy.versionlist[copy.versionindex + 1] != null); |
---|
| 4294 | + |
---|
| 4295 | + muteSlider = true; |
---|
| 4296 | + versionSlider.setMaximum(VersionCount() - 1); |
---|
| 4297 | + versionSlider.setInteger(copy.versionindex); |
---|
| 4298 | + muteSlider = false; |
---|
| 4299 | + } |
---|
| 4300 | + |
---|
| 4301 | + public boolean PreviousVersion() |
---|
| 4302 | + { |
---|
| 4303 | + // Option? |
---|
| 4304 | + Replace(); |
---|
| 4305 | + |
---|
| 4306 | + System.err.println("Undo"); |
---|
| 4307 | + |
---|
| 4308 | + cRadio tab = GetCurrentTab(); |
---|
| 4309 | + |
---|
| 4310 | + if (copy.versionindex == 0) |
---|
3486 | 4311 | { |
---|
3487 | 4312 | java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
3488 | | - return; |
---|
| 4313 | + return false; |
---|
3489 | 4314 | } |
---|
3490 | 4315 | |
---|
3491 | | - if (tab.graphs[tab.undoindex] == null) |
---|
3492 | | - { |
---|
3493 | | - Save(); |
---|
3494 | | - tab.undoindex -= 1; |
---|
3495 | | - } |
---|
| 4316 | +// if (tab.graphs[tab.versionindex] == null) // || !tab.user[tab.versionindex]) |
---|
| 4317 | +// { |
---|
| 4318 | +// if (Save(false)) |
---|
| 4319 | +// tab.versionindex -= 1; |
---|
| 4320 | +// else |
---|
| 4321 | +// { |
---|
| 4322 | +// if (tab.versionindex <= 0) |
---|
| 4323 | +// return false; |
---|
| 4324 | +// else |
---|
| 4325 | +// tab.versionindex -= 1; |
---|
| 4326 | +// } |
---|
| 4327 | +// } |
---|
3496 | 4328 | |
---|
3497 | | - tab.undoindex -= 1; |
---|
| 4329 | + copy.versionindex -= 1; |
---|
3498 | 4330 | |
---|
3499 | | - CopyChanged((Object3D)Uncompress(tab.graphs[tab.undoindex])); |
---|
| 4331 | + CopyChanged(); |
---|
| 4332 | + |
---|
| 4333 | + return true; |
---|
3500 | 4334 | } |
---|
3501 | 4335 | |
---|
3502 | | - public void Redo() |
---|
| 4336 | + public boolean Restore() |
---|
3503 | 4337 | { |
---|
| 4338 | + System.err.println("Restore"); |
---|
| 4339 | + |
---|
3504 | 4340 | cRadio tab = GetCurrentTab(); |
---|
3505 | 4341 | |
---|
3506 | | - if (tab.graphs[tab.undoindex + 1] == null) |
---|
| 4342 | + if (copy.versionindex == -1 || copy.versionlist[copy.versionindex] == null) |
---|
| 4343 | + { |
---|
| 4344 | + java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
| 4345 | + return false; |
---|
| 4346 | + } |
---|
| 4347 | + |
---|
| 4348 | + //CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex])); |
---|
| 4349 | + CopyChanged(); |
---|
| 4350 | + |
---|
| 4351 | + return true; |
---|
| 4352 | + } |
---|
| 4353 | + |
---|
| 4354 | + public boolean Replace() |
---|
| 4355 | + { |
---|
| 4356 | + System.err.println("Replace"); |
---|
| 4357 | + |
---|
| 4358 | + cRadio tab = GetCurrentTab(); |
---|
| 4359 | + |
---|
| 4360 | + if (copy.versionindex == -1 || copy.versionlist[copy.versionindex] == null) |
---|
| 4361 | + { |
---|
| 4362 | + // No version yet. OK. java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
| 4363 | + return false; |
---|
| 4364 | + } |
---|
| 4365 | + |
---|
| 4366 | + copy.versionlist[copy.versionindex] = CompressCopy(); |
---|
| 4367 | + |
---|
| 4368 | + return true; |
---|
| 4369 | + } |
---|
| 4370 | + |
---|
| 4371 | + public void NextVersion() |
---|
| 4372 | + { |
---|
| 4373 | + // Option? |
---|
| 4374 | + Replace(); |
---|
| 4375 | + |
---|
| 4376 | + cRadio tab = GetCurrentTab(); |
---|
| 4377 | + |
---|
| 4378 | + if (copy.versionlist[copy.versionindex + 1] == null) |
---|
3507 | 4379 | { |
---|
3508 | 4380 | java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
3509 | 4381 | return; |
---|
3510 | 4382 | } |
---|
3511 | 4383 | |
---|
3512 | | - tab.undoindex += 1; |
---|
| 4384 | + copy.versionindex += 1; |
---|
3513 | 4385 | |
---|
3514 | | - CopyChanged((Object3D)Uncompress(tab.graphs[tab.undoindex])); |
---|
| 4386 | + CopyChanged(); |
---|
| 4387 | + |
---|
| 4388 | + //if (!tab.user[tab.versionindex]) |
---|
| 4389 | + // tab.graphs[tab.versionindex] = null; |
---|
3515 | 4390 | } |
---|
3516 | 4391 | |
---|
3517 | 4392 | void ImportGFD() |
---|
.. | .. |
---|
3663 | 4538 | assert false; |
---|
3664 | 4539 | } |
---|
3665 | 4540 | |
---|
3666 | | - void EditSelection() |
---|
| 4541 | + void EditSelection(boolean newWindow) |
---|
3667 | 4542 | { |
---|
3668 | 4543 | } |
---|
3669 | 4544 | |
---|
.. | .. |
---|
3722 | 4597 | //copy.material = new cMaterial(copy.GetMaterial()); |
---|
3723 | 4598 | |
---|
3724 | 4599 | current.color = (float) colorField.getFloat(); |
---|
3725 | | - current.modulation = (float) modulationField.getFloat(); |
---|
| 4600 | + current.modulation = (float) saturationField.getFloat(); |
---|
3726 | 4601 | current.metalness = (float) metalnessField.getFloat(); |
---|
3727 | 4602 | current.diffuse = (float) diffuseField.getFloat(); |
---|
3728 | 4603 | current.specular = (float) specularField.getFloat(); |
---|
.. | .. |
---|
3755 | 4630 | cMaterial mat = copy.material; |
---|
3756 | 4631 | |
---|
3757 | 4632 | colorField.SetToolTipValue((mat.color)); |
---|
3758 | | - modulationField.SetToolTipValue((mat.modulation)); |
---|
| 4633 | + saturationField.SetToolTipValue((mat.modulation)); |
---|
3759 | 4634 | metalnessField.SetToolTipValue((mat.metalness)); |
---|
3760 | 4635 | diffuseField.SetToolTipValue((mat.diffuse)); |
---|
3761 | 4636 | specularField.SetToolTipValue((mat.specular)); |
---|
.. | .. |
---|
3807 | 4682 | //copy.Touch(); |
---|
3808 | 4683 | } |
---|
3809 | 4684 | |
---|
| 4685 | + cNumberSlider versionSlider; |
---|
| 4686 | + |
---|
3810 | 4687 | public void stateChanged(ChangeEvent e) |
---|
3811 | 4688 | { |
---|
3812 | 4689 | // assert(false); |
---|
| 4690 | + if (e.getSource() == versionSlider) |
---|
| 4691 | + { |
---|
| 4692 | + if (muteSlider) |
---|
| 4693 | + return; |
---|
| 4694 | + |
---|
| 4695 | + int version = versionSlider.getInteger(); |
---|
| 4696 | + |
---|
| 4697 | + if (copy.versionlist[version] != null) |
---|
| 4698 | + { |
---|
| 4699 | + copy.versionindex = version; |
---|
| 4700 | + CopyChanged(); |
---|
| 4701 | + } |
---|
| 4702 | + |
---|
| 4703 | + return; |
---|
| 4704 | + } |
---|
3813 | 4705 | |
---|
3814 | 4706 | if (freezematerial) |
---|
3815 | 4707 | { |
---|
.. | .. |
---|
3845 | 4737 | { |
---|
3846 | 4738 | //System.out.println("stateChanged = " + this); |
---|
3847 | 4739 | materialtouched = true; |
---|
| 4740 | + |
---|
| 4741 | + if (e.getSource() == colorField && saturationField.getFloat() == 0.001) |
---|
| 4742 | + { |
---|
| 4743 | + saturationField.setFloat(1); |
---|
| 4744 | + } |
---|
| 4745 | + |
---|
3848 | 4746 | applySelf(); |
---|
3849 | 4747 | //System.out.println("this = " + this); |
---|
3850 | 4748 | //System.out.println("PARENT = " + parent); |
---|
.. | .. |
---|
4144 | 5042 | { |
---|
4145 | 5043 | if (GetTree() != null) |
---|
4146 | 5044 | { |
---|
| 5045 | + GetTree().revalidate(); |
---|
4147 | 5046 | GetTree().repaint(); |
---|
4148 | 5047 | } |
---|
4149 | 5048 | |
---|
.. | .. |
---|
4152 | 5051 | ctrlPanel.validate(); // ? new |
---|
4153 | 5052 | ctrlPanel.repaint(); |
---|
4154 | 5053 | } |
---|
| 5054 | + |
---|
| 5055 | + if (previousVersionButton != null && copy.versionlist != null) |
---|
| 5056 | + SetUndoStates(); |
---|
4155 | 5057 | } |
---|
4156 | 5058 | |
---|
4157 | 5059 | static TweenManager tweenManager = new TweenManager(); |
---|
4158 | 5060 | |
---|
4159 | 5061 | void makeSomething(Object3D thing, boolean resetmodel) // deselect) |
---|
4160 | 5062 | { |
---|
4161 | | - Save(); |
---|
| 5063 | + if (Globals.REPLACEONMAKE) // && resetmodel) |
---|
| 5064 | + Save(); |
---|
4162 | 5065 | //Tween.set(thing, 0).target(1).start(tweenManager); |
---|
4163 | 5066 | //Tween.to(thing, 0, 0.5f).target(0).start(tweenManager); |
---|
4164 | 5067 | // if (thing instanceof GenericJointDemo) |
---|
.. | .. |
---|
4245 | 5148 | { |
---|
4246 | 5149 | ResetModel(); |
---|
4247 | 5150 | Select(thing.GetTreePath(), true, false); // unselect... false); |
---|
| 5151 | + |
---|
| 5152 | + if (thing.Size() == 0) |
---|
| 5153 | + { |
---|
| 5154 | + //EditSelection(false); |
---|
| 5155 | + } |
---|
| 5156 | + |
---|
4248 | 5157 | refreshContents(); |
---|
4249 | 5158 | } |
---|
4250 | 5159 | |
---|
.. | .. |
---|
4393 | 5302 | readobj.ResetDisplayList(); |
---|
4394 | 5303 | } catch (Exception e) |
---|
4395 | 5304 | { |
---|
4396 | | - //e.printStackTrace(); |
---|
| 5305 | + if (!e.toString().contains("GZIP")) |
---|
| 5306 | + e.printStackTrace(); |
---|
| 5307 | + |
---|
4397 | 5308 | try |
---|
4398 | 5309 | { |
---|
4399 | 5310 | java.io.FileInputStream istream = new java.io.FileInputStream(fullname); |
---|
.. | .. |
---|
4467 | 5378 | |
---|
4468 | 5379 | if (readobj != null) |
---|
4469 | 5380 | { |
---|
4470 | | - Save(); |
---|
| 5381 | + //if (Globals.SAVEONMAKE) // A new object cannot share meshes |
---|
| 5382 | + // Save(); |
---|
4471 | 5383 | try |
---|
4472 | 5384 | { |
---|
4473 | 5385 | //readobj.deepCopySelf(copy); |
---|
4474 | 5386 | copy.clear(); // june 2014 |
---|
| 5387 | + copy.skyboxname = readobj.skyboxname; |
---|
| 5388 | + copy.skyboxext = readobj.skyboxext; |
---|
4475 | 5389 | for (int i = 0; i < readobj.size(); i++) |
---|
4476 | 5390 | { |
---|
4477 | 5391 | Object3D child = readobj.get(i); // reserve(i); |
---|
.. | .. |
---|
4512 | 5426 | } |
---|
4513 | 5427 | } catch (ClassCastException e) |
---|
4514 | 5428 | { |
---|
| 5429 | + e.printStackTrace(); |
---|
4515 | 5430 | assert (false); |
---|
4516 | 5431 | Composite c = (Composite) copy; |
---|
4517 | 5432 | c.children.clear(); |
---|
.. | .. |
---|
4522 | 5437 | c.addChild(csg); |
---|
4523 | 5438 | } |
---|
4524 | 5439 | |
---|
| 5440 | + copy.versionlist = readobj.versionlist; |
---|
| 5441 | + copy.versionindex = readobj.versionindex; |
---|
| 5442 | + |
---|
| 5443 | + if (copy.versionlist == null) |
---|
| 5444 | + { |
---|
| 5445 | + copy.versionlist = new Object3D[100]; |
---|
| 5446 | + copy.versionindex = -1; |
---|
| 5447 | + } |
---|
| 5448 | + |
---|
| 5449 | + //? SetUndoStates(); |
---|
| 5450 | + |
---|
4525 | 5451 | ResetModel(); |
---|
4526 | 5452 | copy.HardTouch(); // recompile? |
---|
4527 | 5453 | refreshContents(); |
---|
4528 | 5454 | } |
---|
4529 | 5455 | } |
---|
4530 | 5456 | |
---|
4531 | | - void load() // throws ClassNotFoundException |
---|
| 5457 | + void Open() // throws ClassNotFoundException |
---|
4532 | 5458 | { |
---|
4533 | 5459 | if (Grafreed.standAlone) |
---|
4534 | 5460 | { |
---|
4535 | | - FileDialog browser = new FileDialog(frame, "Load", FileDialog.LOAD); |
---|
| 5461 | + FileDialog browser = new FileDialog(frame, "Open", FileDialog.LOAD); |
---|
4536 | 5462 | browser.show(); |
---|
4537 | 5463 | String filename = browser.getFile(); |
---|
4538 | 5464 | if (filename != null && filename.length() > 0) |
---|
.. | .. |
---|
4631 | 5557 | //ps.print(buffer.toString()); |
---|
4632 | 5558 | } catch (IOException e) |
---|
4633 | 5559 | { |
---|
| 5560 | + e.printStackTrace(); |
---|
4634 | 5561 | } |
---|
4635 | 5562 | } |
---|
4636 | 5563 | |
---|
.. | .. |
---|
4645 | 5572 | String filename = browser.getFile(); |
---|
4646 | 5573 | if (filename != null && filename.length() > 0) |
---|
4647 | 5574 | { |
---|
| 5575 | + if (!filename.endsWith(".gfd")) |
---|
| 5576 | + filename += ".gfd"; |
---|
4648 | 5577 | lastname = browser.getDirectory() + filename; |
---|
4649 | 5578 | save(); |
---|
4650 | 5579 | } |
---|
.. | .. |
---|
4811 | 5740 | MenuBar menuBar; |
---|
4812 | 5741 | Menu fileMenu; |
---|
4813 | 5742 | MenuItem newItem; |
---|
4814 | | - MenuItem loadItem; |
---|
| 5743 | + MenuItem openItem; |
---|
4815 | 5744 | MenuItem saveItem; |
---|
4816 | 5745 | MenuItem saveAsItem; |
---|
4817 | 5746 | MenuItem exportAsItem; |
---|
.. | .. |
---|
4834 | 5763 | CheckboxMenuItem toggleSwitchItem; |
---|
4835 | 5764 | CheckboxMenuItem toggleRootItem; |
---|
4836 | 5765 | CheckboxMenuItem animationItem; |
---|
| 5766 | + MenuItem archiveItem; |
---|
4837 | 5767 | CheckboxMenuItem toggleHandleItem; |
---|
4838 | 5768 | CheckboxMenuItem togglePaintItem; |
---|
4839 | 5769 | JSplitPane mainPanel; |
---|
4840 | 5770 | JScrollPane scrollpane; |
---|
| 5771 | + |
---|
4841 | 5772 | JPanel toolbarPanel; |
---|
| 5773 | + |
---|
4842 | 5774 | cGridBag treePanel; |
---|
| 5775 | + |
---|
4843 | 5776 | JPanel radioPanel; |
---|
4844 | 5777 | ButtonGroup buttonGroup; |
---|
4845 | | - cGridBag ctrlPanel; |
---|
| 5778 | + |
---|
| 5779 | + cGridBag toolboxPanel; |
---|
| 5780 | + cGridBag skyboxPanel; |
---|
4846 | 5781 | cGridBag materialPanel; |
---|
| 5782 | + cGridBag ctrlPanel; |
---|
| 5783 | + |
---|
4847 | 5784 | JScrollPane infoPanel; |
---|
| 5785 | + |
---|
4848 | 5786 | cGridBag optionsPanel; |
---|
| 5787 | + |
---|
4849 | 5788 | JTabbedPane objectPanel; |
---|
| 5789 | + boolean materialFlushed; |
---|
| 5790 | + Object3D latestObject; |
---|
| 5791 | + |
---|
4850 | 5792 | cGridBag XYZPanel; |
---|
| 5793 | + |
---|
4851 | 5794 | JSplitPane gridPanel; |
---|
4852 | 5795 | JSplitPane bigPanel; |
---|
| 5796 | + |
---|
4853 | 5797 | cGridBag bigThree; |
---|
4854 | 5798 | cGridBag scenePanel; |
---|
4855 | 5799 | cGridBag centralPanel; |
---|
.. | .. |
---|
4907 | 5851 | JLabel colorLabel; |
---|
4908 | 5852 | cNumberSlider colorField; |
---|
4909 | 5853 | JLabel modulationLabel; |
---|
4910 | | - cNumberSlider modulationField; |
---|
| 5854 | + cNumberSlider saturationField; |
---|
4911 | 5855 | JLabel metalnessLabel; |
---|
4912 | 5856 | cNumberSlider metalnessField; |
---|
4913 | 5857 | JLabel diffuseLabel; |
---|
.. | .. |
---|
4964 | 5908 | cNumberSlider fogField; |
---|
4965 | 5909 | JLabel opacityPowerLabel; |
---|
4966 | 5910 | cNumberSlider opacityPowerField; |
---|
4967 | | - JTree jTree; |
---|
| 5911 | + cTree jTree; |
---|
4968 | 5912 | //ObjectUI parent; |
---|
4969 | 5913 | |
---|
4970 | 5914 | cNumberSlider normalpushField; |
---|