.. | .. |
---|
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 | |
---|
.. | .. |
---|
37 | 41 | JFrame frame; |
---|
38 | 42 | |
---|
39 | 43 | static ObjEditor theFrame; |
---|
| 44 | + |
---|
| 45 | + cButton GetButton(String name, boolean border) |
---|
| 46 | + { |
---|
| 47 | + try |
---|
| 48 | + { |
---|
| 49 | + ImageIcon icon = GetIcon(name); |
---|
| 50 | + return new cButton(icon, border); |
---|
| 51 | + } |
---|
| 52 | + catch (Exception e) |
---|
| 53 | + { |
---|
| 54 | + return new cButton(name, border); |
---|
| 55 | + } |
---|
| 56 | + } |
---|
| 57 | + |
---|
| 58 | + cToggleButton GetToggleButton(String name, boolean border) |
---|
| 59 | + { |
---|
| 60 | + try |
---|
| 61 | + { |
---|
| 62 | + ImageIcon icon = GetIcon(name); |
---|
| 63 | + return new cToggleButton(icon, border); |
---|
| 64 | + } |
---|
| 65 | + catch (Exception e) |
---|
| 66 | + { |
---|
| 67 | + return new cToggleButton(name, border); |
---|
| 68 | + } |
---|
| 69 | + } |
---|
| 70 | + |
---|
| 71 | + cCheckBox GetCheckBox(String name, boolean border) |
---|
| 72 | + { |
---|
| 73 | + try |
---|
| 74 | + { |
---|
| 75 | + ImageIcon icon = GetIcon(name); |
---|
| 76 | + return new cCheckBox(icon, border); |
---|
| 77 | + } |
---|
| 78 | + catch (Exception e) |
---|
| 79 | + { |
---|
| 80 | + return new cCheckBox(name, border); |
---|
| 81 | + } |
---|
| 82 | + } |
---|
| 83 | + |
---|
| 84 | + private ImageIcon GetIcon(String name) throws IOException |
---|
| 85 | + { |
---|
| 86 | + BufferedImage image = javax.imageio.ImageIO.read(getClass().getClassLoader().getResourceAsStream(name)); |
---|
| 87 | + |
---|
| 88 | + if (image.getWidth() != 24 && image.getHeight() != 24) |
---|
| 89 | + { |
---|
| 90 | + BufferedImage resized = new BufferedImage(24, 24, image.getType()); |
---|
| 91 | + Graphics2D g = resized.createGraphics(); |
---|
| 92 | + g.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR); |
---|
| 93 | + //g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); |
---|
| 94 | + g.drawImage(image, 0, 0, 24, 24, 0, 0, image.getWidth(), image.getHeight(), null); |
---|
| 95 | + g.dispose(); |
---|
| 96 | + |
---|
| 97 | + image = resized; |
---|
| 98 | + } |
---|
| 99 | + |
---|
| 100 | + javax.swing.ImageIcon icon = new javax.swing.ImageIcon(image); |
---|
| 101 | + return icon; |
---|
| 102 | + } |
---|
40 | 103 | |
---|
41 | 104 | // SCRIPT |
---|
42 | 105 | |
---|
.. | .. |
---|
147 | 210 | |
---|
148 | 211 | objEditor.ctrlPanel.remove(namePanel); |
---|
149 | 212 | |
---|
150 | | - if (!GroupEditor.allparams) |
---|
| 213 | + if (!allparams) |
---|
151 | 214 | return; |
---|
152 | 215 | |
---|
153 | 216 | // objEditor.ctrlPanel.remove(liveCB); |
---|
.. | .. |
---|
171 | 234 | |
---|
172 | 235 | objEditor.ctrlPanel.remove(setupPanel); |
---|
173 | 236 | objEditor.ctrlPanel.remove(setupPanel2); |
---|
174 | | - objEditor.ctrlPanel.remove(commandsPanel); |
---|
| 237 | + objEditor.ctrlPanel.remove(objectCommandsPanel); |
---|
175 | 238 | objEditor.ctrlPanel.remove(pushPanel); |
---|
176 | 239 | //objEditor.ctrlPanel.remove(fillPanel); |
---|
177 | 240 | |
---|
.. | .. |
---|
246 | 309 | //localCopy.parent = null; |
---|
247 | 310 | |
---|
248 | 311 | frame = new JFrame(); |
---|
249 | | - frame.setUndecorated(true); |
---|
| 312 | + frame.setUndecorated(false); |
---|
250 | 313 | objEditor = this; |
---|
251 | 314 | this.callee = callee; |
---|
252 | 315 | |
---|
.. | .. |
---|
277 | 340 | return frame.action(event, obj); |
---|
278 | 341 | } |
---|
279 | 342 | |
---|
| 343 | + // Cannot work without static |
---|
| 344 | + static boolean allparams = true; |
---|
| 345 | + |
---|
| 346 | + static java.util.Vector<Object3D> listUI = new java.util.Vector<Object3D>(); |
---|
| 347 | + |
---|
280 | 348 | void SetupMenu() |
---|
281 | 349 | { |
---|
282 | 350 | frame.setMenuBar(menuBar = new MenuBar()); |
---|
283 | 351 | menuBar.add(fileMenu = new Menu("File")); |
---|
284 | 352 | fileMenu.add(newItem = new MenuItem("New")); |
---|
285 | | - fileMenu.add(loadItem = new MenuItem("Open...")); |
---|
| 353 | + fileMenu.add(openItem = new MenuItem("Open...")); |
---|
286 | 354 | |
---|
287 | 355 | //oe.menuBar.add(menu = new Menu("Include")); |
---|
288 | 356 | Menu menu = new Menu("Import"); |
---|
.. | .. |
---|
314 | 382 | } |
---|
315 | 383 | |
---|
316 | 384 | newItem.addActionListener(this); |
---|
317 | | - loadItem.addActionListener(this); |
---|
| 385 | + openItem.addActionListener(this); |
---|
318 | 386 | saveItem.addActionListener(this); |
---|
319 | 387 | saveAsItem.addActionListener(this); |
---|
320 | 388 | exportAsItem.addActionListener(this); |
---|
.. | .. |
---|
323 | 391 | closeItem.addActionListener(this); |
---|
324 | 392 | |
---|
325 | 393 | objectPanel = new JTabbedPane(); |
---|
| 394 | + |
---|
| 395 | + ChangeListener changeListener = new ChangeListener() |
---|
| 396 | + { |
---|
| 397 | + public void stateChanged(ChangeEvent changeEvent) |
---|
| 398 | + { |
---|
| 399 | +// if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Material") && !materialFlushed) |
---|
| 400 | +// { |
---|
| 401 | +// if (latestObject != null) |
---|
| 402 | +// { |
---|
| 403 | +// refreshContents(true); |
---|
| 404 | +// SetMaterial(latestObject); |
---|
| 405 | +// } |
---|
| 406 | +// |
---|
| 407 | +// materialFlushed = true; |
---|
| 408 | +// } |
---|
| 409 | +// if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Edit")) |
---|
| 410 | +// { |
---|
| 411 | +// if (listUI.size() == 0) |
---|
| 412 | +// EditSelection(false); |
---|
| 413 | +// } |
---|
| 414 | + |
---|
| 415 | + refreshContents(false); // To refresh Info tab |
---|
| 416 | + } |
---|
| 417 | + }; |
---|
| 418 | + objectPanel.addChangeListener(changeListener); |
---|
| 419 | + |
---|
326 | 420 | toolbarPanel = new JPanel(); |
---|
327 | 421 | toolbarPanel.setName("Toolbar"); |
---|
328 | 422 | treePanel = new cGridBag(); |
---|
329 | 423 | treePanel.setName("Tree"); |
---|
| 424 | + |
---|
| 425 | + editPanel = new cGridBag().setVertical(true); |
---|
| 426 | + editPanel.setName("Edit"); |
---|
| 427 | + |
---|
330 | 428 | ctrlPanel = new cGridBag().setVertical(false); // new GridBagLayout()); |
---|
331 | | - ctrlPanel.setName("Edit"); |
---|
| 429 | + |
---|
| 430 | + editCommandsPanel = new cGridBag(); |
---|
| 431 | + editPanel.add(editCommandsPanel); |
---|
| 432 | + editPanel.add(ctrlPanel); |
---|
| 433 | + |
---|
| 434 | + toolboxPanel = new cGridBag().setVertical(false); |
---|
| 435 | + toolboxPanel.setName("Toolbox"); |
---|
| 436 | + |
---|
332 | 437 | materialPanel = new cGridBag().setVertical(true); |
---|
333 | 438 | materialPanel.setName("Material"); |
---|
| 439 | + |
---|
334 | 440 | /*JTextPane*/ |
---|
335 | 441 | infoarea = createTextPane(); |
---|
336 | 442 | doc = infoarea.getStyledDocument(); |
---|
.. | .. |
---|
343 | 449 | // TEXTAREA infoarea.setLineWrap(true); |
---|
344 | 450 | // TEXTAREA infoarea.setWrapStyleWord(true); |
---|
345 | 451 | infoPanel = new JScrollPane(infoarea, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); //AS_NEEDED); |
---|
346 | | - infoPanel.setPreferredSize(new Dimension(50, 200)); |
---|
| 452 | + infoPanel.setPreferredSize(new Dimension(1, 1)); |
---|
347 | 453 | infoPanel.setName("Info"); |
---|
348 | 454 | //infoPanel.setLayout(new BorderLayout()); |
---|
349 | 455 | //infoPanel.add(createTextPane()); |
---|
.. | .. |
---|
355 | 461 | mainPanel.setDividerSize(9); |
---|
356 | 462 | mainPanel.setDividerLocation(0.5); //1.0); |
---|
357 | 463 | mainPanel.setResizeWeight(0.5); |
---|
358 | | - |
---|
| 464 | + |
---|
| 465 | +//mainPanel.setDividerSize((int) (mainPanel.getDividerSize() * 1.5)); |
---|
| 466 | + BasicSplitPaneDivider divider = ( (BasicSplitPaneUI) mainPanel.getUI()).getDivider(); |
---|
| 467 | + divider.setDividerSize(15); |
---|
| 468 | + divider.setBorder(BorderFactory.createTitledBorder(divider.getBorder(), "Custom border title -- gets rid of the one-touch arrows!")); |
---|
| 469 | + |
---|
| 470 | + mainPanel.setUI(new BasicSplitPaneUI()); |
---|
| 471 | + |
---|
359 | 472 | //ctrlPanel.setLayout(new GridLayout(4, 1, 5, 5)); |
---|
360 | 473 | //mainPanel.setLayout(new GridBagLayout()); |
---|
361 | 474 | toolbarPanel.setLayout(new FlowLayout(FlowLayout.LEFT)); |
---|
.. | .. |
---|
586 | 699 | } |
---|
587 | 700 | } |
---|
588 | 701 | |
---|
589 | | -static GraphicsDevice device = GraphicsEnvironment |
---|
590 | | - .getLocalGraphicsEnvironment().getScreenDevices()[0]; |
---|
| 702 | +//static GraphicsDevice device = GraphicsEnvironment |
---|
| 703 | +// .getLocalGraphicsEnvironment().getScreenDevices()[0]; |
---|
591 | 704 | |
---|
592 | 705 | Rectangle keeprect; |
---|
593 | 706 | cRadio radio; |
---|
.. | .. |
---|
603 | 716 | |
---|
604 | 717 | boolean maximized; |
---|
605 | 718 | |
---|
| 719 | + cButton fullscreenLayout; |
---|
| 720 | + |
---|
606 | 721 | void Minimize() |
---|
607 | 722 | { |
---|
608 | 723 | frame.setState(Frame.ICONIFIED); |
---|
| 724 | + frame.validate(); |
---|
609 | 725 | } |
---|
610 | 726 | |
---|
| 727 | +// artifactURI=null, type=0, property=${file.reference.jfxrt.jar}, object=org.netbeans.modules.java.api.common.classpath.ClassPathSupport$RelativePath@6767876f, broken=false, additional={} |
---|
| 728 | +// artifactURI=null, type=0, property=${file.reference.mac-ui.jar}, object=org.netbeans.modules.java.api.common.classpath.ClassPathSupport$RelativePath@16bdc817, broken=false, additional={} |
---|
| 729 | +// artifactURI=null, type=0, property=${file.reference.classes.jar}, object=org.netbeans.modules.java.api.common.classpath.ClassPathSupport$RelativePath@9daa9c17, broken=false, additional={} |
---|
611 | 730 | void Maximize() |
---|
612 | 731 | { |
---|
| 732 | + if (CameraPane.FULLSCREEN) |
---|
| 733 | + { |
---|
| 734 | + ToggleFullScreen(); |
---|
| 735 | + } |
---|
| 736 | + |
---|
613 | 737 | if (maximized) |
---|
614 | 738 | { |
---|
615 | 739 | frame.setBounds(keeprect.x, keeprect.y, keeprect.width, keeprect.height); |
---|
.. | .. |
---|
617 | 741 | else |
---|
618 | 742 | { |
---|
619 | 743 | 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); |
---|
| 744 | +// Rectangle rect = GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds(); |
---|
| 745 | +// Dimension rect2 = frame.getToolkit().getScreenSize(); |
---|
| 746 | +// frame.setBounds(0, rect2.height - rect.height, rect.width, rect.height); |
---|
623 | 747 | // frame.setState(Frame.MAXIMIZED_BOTH); |
---|
| 748 | + frame.setBounds(frame.getGraphicsConfiguration().getBounds()); |
---|
624 | 749 | } |
---|
625 | 750 | |
---|
626 | 751 | maximized ^= true; |
---|
| 752 | + |
---|
| 753 | + frame.validate(); |
---|
627 | 754 | } |
---|
| 755 | + |
---|
| 756 | + cButton minButton; |
---|
| 757 | + cButton maxButton; |
---|
| 758 | + cButton fullButton; |
---|
628 | 759 | |
---|
629 | 760 | void ToggleFullScreen() |
---|
630 | 761 | { |
---|
631 | | - if (CameraPane.FULLSCREEN) |
---|
| 762 | +GraphicsDevice device = frame.getGraphicsConfiguration().getDevice(); |
---|
| 763 | + |
---|
| 764 | + cameraView.ToggleFullScreen(); |
---|
| 765 | + |
---|
| 766 | + if (!CameraPane.FULLSCREEN) |
---|
632 | 767 | { |
---|
633 | 768 | device.setFullScreenWindow(null); |
---|
| 769 | + frame.dispose(); |
---|
| 770 | + frame.setUndecorated(false); |
---|
| 771 | + frame.validate(); |
---|
| 772 | + frame.setVisible(true); |
---|
| 773 | + |
---|
634 | 774 | //frame.setVisible(false); |
---|
635 | 775 | // frame.removeNotify(); |
---|
636 | 776 | // frame.setUndecorated(false); |
---|
.. | .. |
---|
640 | 780 | // X frame.getContentPane().remove(/*"Center",*/bigThree); |
---|
641 | 781 | // X framePanel.add(bigThree); |
---|
642 | 782 | // X frame.getContentPane().add(/*"Center",*/framePanel); |
---|
643 | | - framePanel.setDividerLocation(1); |
---|
| 783 | + framePanel.setDividerLocation(46); |
---|
644 | 784 | |
---|
645 | 785 | //frame.setVisible(true); |
---|
646 | 786 | radio.layout = keepButton; |
---|
.. | .. |
---|
655 | 795 | // frame.setBounds(0, 0, frame.getToolkit().getScreenSize().width, |
---|
656 | 796 | // frame.getToolkit().getScreenSize().height); |
---|
657 | 797 | //frame.setVisible(false); |
---|
| 798 | + |
---|
| 799 | + frame.dispose(); |
---|
| 800 | + frame.setUndecorated(true); |
---|
658 | 801 | device.setFullScreenWindow(frame); |
---|
| 802 | + frame.validate(); |
---|
| 803 | + frame.setVisible(true); |
---|
659 | 804 | // frame.removeNotify(); |
---|
660 | 805 | // frame.setUndecorated(true); |
---|
661 | 806 | // frame.addNotify(); |
---|
.. | .. |
---|
664 | 809 | // X frame.getContentPane().add(/*"Center",*/bigThree); |
---|
665 | 810 | framePanel.setDividerLocation(0); |
---|
666 | 811 | |
---|
667 | | - radio.layout = twoButton; |
---|
| 812 | + radio.layout = fullscreenLayout; |
---|
668 | 813 | radio.layout.doClick(); |
---|
669 | 814 | //frame.setVisible(true); |
---|
670 | 815 | } |
---|
671 | | - |
---|
672 | | - cameraView.ToggleFullScreen(); |
---|
| 816 | + frame.validate(); |
---|
673 | 817 | } |
---|
674 | 818 | |
---|
675 | 819 | private JTextPane createTextPane() |
---|
.. | .. |
---|
810 | 954 | JCheckBox speedupCB; |
---|
811 | 955 | JCheckBox rewindCB; |
---|
812 | 956 | JCheckBox flipVCB; |
---|
| 957 | + |
---|
| 958 | + cCheckBox toggleTextureCB; |
---|
| 959 | + cCheckBox toggleSwitchCB; |
---|
| 960 | + |
---|
813 | 961 | JComboBox texresMenu; |
---|
| 962 | + |
---|
814 | 963 | JButton resetButton; |
---|
815 | 964 | JButton stepButton; |
---|
816 | 965 | JButton stepAllButton; |
---|
.. | .. |
---|
819 | 968 | JButton fasterButton; |
---|
820 | 969 | JButton remarkButton; |
---|
821 | 970 | |
---|
| 971 | + cGridBag editPanel; |
---|
| 972 | + cGridBag editCommandsPanel; |
---|
| 973 | + |
---|
822 | 974 | cGridBag namePanel; |
---|
823 | 975 | cGridBag setupPanel; |
---|
824 | 976 | cGridBag setupPanel2; |
---|
825 | | - cGridBag commandsPanel; |
---|
| 977 | + cGridBag objectCommandsPanel; |
---|
826 | 978 | cGridBag pushPanel; |
---|
827 | 979 | cGridBag fillPanel; |
---|
828 | 980 | |
---|
.. | .. |
---|
994 | 1146 | namePanel = new cGridBag(); |
---|
995 | 1147 | |
---|
996 | 1148 | nameField = AddText(namePanel, copy.GetName()); |
---|
997 | | - namePanel.add(nameField); |
---|
| 1149 | + namePanel.add(new JScrollPane(nameField, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER)); |
---|
998 | 1150 | oe.ctrlPanel.add(namePanel); |
---|
999 | 1151 | |
---|
1000 | 1152 | oe.ctrlPanel.Return(); |
---|
1001 | 1153 | |
---|
1002 | | - if (!GroupEditor.allparams) |
---|
| 1154 | + if (!allparams) |
---|
1003 | 1155 | return; |
---|
1004 | 1156 | |
---|
1005 | 1157 | setupPanel = new cGridBag().setVertical(false); |
---|
.. | .. |
---|
1012 | 1164 | hideCB = AddCheckBox(setupPanel, "Hide", copy.hide); |
---|
1013 | 1165 | hideCB.setToolTipText("Hide object"); |
---|
1014 | 1166 | markCB = AddCheckBox(setupPanel, "Mark", copy.marked); |
---|
1015 | | - markCB.setToolTipText("Set the animation target transform"); |
---|
| 1167 | + markCB.setToolTipText("As animation target transform"); |
---|
1016 | 1168 | |
---|
1017 | 1169 | setupPanel2 = new cGridBag().setVertical(false); |
---|
1018 | 1170 | |
---|
1019 | 1171 | rewindCB = AddCheckBox(setupPanel2, "Rewind", copy.rewind); |
---|
1020 | 1172 | rewindCB.setToolTipText("Rewind animation"); |
---|
1021 | 1173 | |
---|
1022 | | - randomCB = AddCheckBox(setupPanel2, "Rand", copy.random); |
---|
1023 | | - randomCB.setToolTipText("Randomly Rewind or Go back and forth"); |
---|
| 1174 | + randomCB = AddCheckBox(setupPanel2, "Random", copy.random); |
---|
| 1175 | + randomCB.setToolTipText("Randomly Rewind (or Go back and forth)"); |
---|
1024 | 1176 | |
---|
| 1177 | + link2masterCB = AddCheckBox(setupPanel2, "Support", copy.link2master); |
---|
| 1178 | + link2masterCB.setToolTipText("Attach to support"); |
---|
| 1179 | + |
---|
1025 | 1180 | if (Globals.ADVANCED) |
---|
1026 | 1181 | { |
---|
1027 | | - link2masterCB = AddCheckBox(setupPanel2, "Supp", copy.link2master); |
---|
1028 | | - link2masterCB.setToolTipText("Attach to support"); |
---|
1029 | 1182 | speedupCB = AddCheckBox(setupPanel2, "Speed", copy.speedup); |
---|
1030 | 1183 | speedupCB.setToolTipText("Option motion capture"); |
---|
1031 | 1184 | } |
---|
.. | .. |
---|
1035 | 1188 | oe.ctrlPanel.add(setupPanel2); |
---|
1036 | 1189 | oe.ctrlPanel.Return(); |
---|
1037 | 1190 | |
---|
1038 | | - commandsPanel = new cGridBag().setVertical(false); |
---|
| 1191 | + objectCommandsPanel = new cGridBag().setVertical(false); |
---|
1039 | 1192 | |
---|
1040 | | - resetButton = AddButton(commandsPanel, "Reset"); |
---|
| 1193 | + resetButton = AddButton(objectCommandsPanel, "Reset"); |
---|
1041 | 1194 | resetButton.setToolTipText("Jump to frame zero"); |
---|
1042 | | - stepButton = AddButton(commandsPanel, "Step"); |
---|
| 1195 | + stepButton = AddButton(objectCommandsPanel, "Step"); |
---|
1043 | 1196 | stepButton.setToolTipText("Step one frame"); |
---|
1044 | 1197 | // resetAllButton = AddButton(oe, "Reset All"); |
---|
1045 | 1198 | // stepAllButton = AddButton(oe, "Step All"); |
---|
1046 | 1199 | // Return(); |
---|
1047 | | - slowerButton = AddButton(commandsPanel, "Slow"); |
---|
| 1200 | + slowerButton = AddButton(objectCommandsPanel, "Slow"); |
---|
1048 | 1201 | slowerButton.setToolTipText("Decrease animation speed"); |
---|
1049 | | - fasterButton = AddButton(commandsPanel, "Fast"); |
---|
| 1202 | + fasterButton = AddButton(objectCommandsPanel, "Fast"); |
---|
1050 | 1203 | fasterButton.setToolTipText("Increase animation speed"); |
---|
1051 | | - remarkButton = AddButton(commandsPanel, "Remark"); |
---|
| 1204 | + remarkButton = AddButton(objectCommandsPanel, "Remark"); |
---|
1052 | 1205 | remarkButton.setToolTipText("Set the current transform as the target"); |
---|
1053 | 1206 | |
---|
1054 | | - oe.ctrlPanel.add(commandsPanel); |
---|
| 1207 | + oe.ctrlPanel.add(objectCommandsPanel); |
---|
1055 | 1208 | oe.ctrlPanel.Return(); |
---|
1056 | 1209 | |
---|
1057 | 1210 | pushPanel = AddSlider(oe.ctrlPanel, "Push", -1, 1, copy.NORMALPUSH, 1.1); // To have the buttons |
---|
.. | .. |
---|
1340 | 1493 | // north.setName("Edit"); |
---|
1341 | 1494 | // north.add(ctrlPanel, BorderLayout.NORTH); |
---|
1342 | 1495 | // objectPanel.add(north); |
---|
1343 | | - objectPanel.add(ctrlPanel); |
---|
1344 | | - objectPanel.add(infoPanel); |
---|
| 1496 | + objectPanel.add(editPanel); |
---|
| 1497 | + |
---|
| 1498 | + //if (Globals.ADVANCED) |
---|
| 1499 | + objectPanel.add(infoPanel); |
---|
| 1500 | + |
---|
| 1501 | + objectPanel.add(toolboxPanel); |
---|
1345 | 1502 | |
---|
1346 | 1503 | /* |
---|
1347 | 1504 | aConstraints.gridx = 0; |
---|
.. | .. |
---|
1350 | 1507 | aConstraints.gridy += 1; |
---|
1351 | 1508 | aConstraints.gridwidth = 1; |
---|
1352 | 1509 | mainPanel.add(objectPanel, aConstraints); |
---|
1353 | | - */ |
---|
| 1510 | + */ |
---|
1354 | 1511 | |
---|
1355 | 1512 | scrollpane = new JScrollPane(mainPanel, ScrollPaneConstants.// VERTICAL_SCROLLBAR_ALWAYS, |
---|
1356 | 1513 | VERTICAL_SCROLLBAR_AS_NEEDED, |
---|
.. | .. |
---|
1367 | 1524 | JTabbedPane tabbedPane = new JTabbedPane(); |
---|
1368 | 1525 | tabbedPane.add(scrollpane); |
---|
1369 | 1526 | |
---|
1370 | | - tabbedPane.add(FSPane = new cFileSystemPane(this)); |
---|
1371 | | - |
---|
1372 | | - optionsPanel = new cGridBag().setVertical(true); |
---|
| 1527 | + optionsPanel = new cGridBag().setVertical(false); |
---|
1373 | 1528 | |
---|
1374 | 1529 | optionsPanel.setName("Options"); |
---|
1375 | 1530 | |
---|
.. | .. |
---|
1377 | 1532 | |
---|
1378 | 1533 | tabbedPane.add(optionsPanel); |
---|
1379 | 1534 | |
---|
| 1535 | + tabbedPane.add(FSPane = new cFileSystemPane(this)); |
---|
| 1536 | + |
---|
1380 | 1537 | scenePanel.add(tabbedPane); |
---|
1381 | 1538 | |
---|
1382 | 1539 | /* |
---|
.. | .. |
---|
1449 | 1606 | // aConstraints.gridheight = 1; |
---|
1450 | 1607 | |
---|
1451 | 1608 | framePanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, toolbarPanel, bigThree); |
---|
1452 | | - framePanel.setContinuousLayout(true); |
---|
1453 | | - framePanel.setOneTouchExpandable(true); |
---|
1454 | | - framePanel.setDividerLocation(0.8); |
---|
| 1609 | + framePanel.setContinuousLayout(false); |
---|
| 1610 | + framePanel.setOneTouchExpandable(false); |
---|
| 1611 | + //.setDividerLocation(0.8); |
---|
1455 | 1612 | //framePanel.setDividerSize(15); |
---|
1456 | 1613 | //framePanel.setResizeWeight(0.15); |
---|
1457 | 1614 | framePanel.setName("Frame"); |
---|
.. | .. |
---|
1469 | 1626 | // aConstraints = gbc; // (GridBagConstraints) GrafreeD.clone(gbc); |
---|
1470 | 1627 | |
---|
1471 | 1628 | frame.setSize(1280, 860); |
---|
1472 | | - frame.setVisible(true); |
---|
1473 | | - |
---|
| 1629 | + |
---|
1474 | 1630 | cameraView.requestFocusInWindow(); |
---|
1475 | 1631 | |
---|
1476 | 1632 | gridPanel.setDividerLocation(1.0); |
---|
| 1633 | + |
---|
| 1634 | + frame.validate(); |
---|
| 1635 | + |
---|
| 1636 | + frame.setVisible(true); |
---|
1477 | 1637 | |
---|
1478 | 1638 | frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); |
---|
1479 | 1639 | frame.addWindowListener(new WindowAdapter() |
---|
.. | .. |
---|
1560 | 1720 | texture.add(textureField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
1561 | 1721 | colorSection.add(texture); |
---|
1562 | 1722 | |
---|
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 | 1723 | panel.add(new JSeparator()); |
---|
1582 | 1724 | |
---|
1583 | 1725 | panel.add(colorSection); |
---|
.. | .. |
---|
1627 | 1769 | fakedepthLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1628 | 1770 | fakedepth.add(fakedepthField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
1629 | 1771 | diffuseSection.add(fakedepth); |
---|
| 1772 | + |
---|
| 1773 | + cGridBag shadowbias = new cGridBag(); |
---|
| 1774 | + shadowbias.add(shadowbiasLabel = new JLabel("Shadowbias")); // , aConstraints); |
---|
| 1775 | + shadowbiasLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 1776 | + shadowbias.add(shadowbiasField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
| 1777 | + diffuseSection.add(shadowbias); |
---|
1630 | 1778 | |
---|
1631 | 1779 | panel.add(new JSeparator()); |
---|
1632 | 1780 | |
---|
.. | .. |
---|
1678 | 1826 | // aConstraints.gridy += 1; |
---|
1679 | 1827 | // aConstraints.gridwidth = 1; |
---|
1680 | 1828 | |
---|
| 1829 | + cGridBag anisoU = new cGridBag(); |
---|
| 1830 | + anisoU.add(anisoLabel = new JLabel("AnisoU")); // , aConstraints); |
---|
| 1831 | + anisoLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 1832 | + anisoU.add(anisoField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
| 1833 | + specularSection.add(anisoU); |
---|
| 1834 | + |
---|
| 1835 | + cGridBag anisoV = new cGridBag(); |
---|
| 1836 | + anisoV.add(anisoVLabel = new JLabel("AnisoV")); // , aConstraints); |
---|
| 1837 | + anisoVLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 1838 | + anisoV.add(anisoVField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
| 1839 | + specularSection.add(anisoV); |
---|
| 1840 | + |
---|
1681 | 1841 | |
---|
1682 | 1842 | panel.add(new JSeparator()); |
---|
1683 | 1843 | |
---|
.. | .. |
---|
1685 | 1845 | |
---|
1686 | 1846 | //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints); |
---|
1687 | 1847 | |
---|
1688 | | - cGridBag globalSection = new cGridBag().setVertical(true); |
---|
| 1848 | + //cGridBag globalSection = new cGridBag().setVertical(true); |
---|
1689 | 1849 | |
---|
1690 | 1850 | cGridBag camera = new cGridBag(); |
---|
1691 | 1851 | camera.add(cameraLabel = new JLabel("GlobalLight")); // , aConstraints); |
---|
1692 | 1852 | cameraLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1693 | 1853 | camera.add(cameraField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
1694 | | - globalSection.add(camera); |
---|
| 1854 | + colorSection.add(camera); |
---|
1695 | 1855 | |
---|
1696 | 1856 | cGridBag ambient = new cGridBag(); |
---|
1697 | 1857 | ambient.add(ambientLabel = new JLabel("Ambient")); // , aConstraints); |
---|
1698 | 1858 | ambientLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1699 | 1859 | ambient.add(ambientField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
1700 | | - globalSection.add(ambient); |
---|
| 1860 | + colorSection.add(ambient); |
---|
1701 | 1861 | |
---|
1702 | 1862 | cGridBag backlit = new cGridBag(); |
---|
1703 | 1863 | backlit.add(backlitLabel = new JLabel("Backlit")); // , aConstraints); |
---|
1704 | 1864 | backlitLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1705 | 1865 | backlit.add(backlitField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
1706 | | - globalSection.add(backlit); |
---|
| 1866 | + colorSection.add(backlit); |
---|
1707 | 1867 | |
---|
1708 | 1868 | cGridBag opacity = new cGridBag(); |
---|
1709 | 1869 | opacity.add(opacityLabel = new JLabel("Opacity")); // , aConstraints); |
---|
1710 | 1870 | opacityLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1711 | 1871 | opacity.add(opacityField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
1712 | | - globalSection.add(opacity); |
---|
| 1872 | + colorSection.add(opacity); |
---|
1713 | 1873 | |
---|
1714 | | - panel.add(new JSeparator()); |
---|
| 1874 | + //panel.add(new JSeparator()); |
---|
1715 | 1875 | |
---|
1716 | | - panel.add(globalSection); |
---|
| 1876 | + //panel.add(globalSection); |
---|
1717 | 1877 | |
---|
1718 | 1878 | //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints); |
---|
1719 | 1879 | |
---|
.. | .. |
---|
1820 | 1980 | // 3D models |
---|
1821 | 1981 | if (filename.endsWith(".3ds") || filename.endsWith(".3DS")) |
---|
1822 | 1982 | { |
---|
1823 | | - lastConverter = new com.jmex.model.converters.MaxToJme(); |
---|
1824 | | - LoadFile(filename, lastConverter); |
---|
| 1983 | + //lastConverter = new com.jmex.model.converters.MaxToJme(); |
---|
| 1984 | + //LoadFile(filename, lastConverter); |
---|
| 1985 | + LoadObjFile(filename); // New 3ds loader |
---|
1825 | 1986 | continue; |
---|
1826 | 1987 | } |
---|
1827 | 1988 | if (filename.endsWith(".dae") || filename.endsWith(".DAE")) |
---|
.. | .. |
---|
2547 | 2708 | LA.matXRotate(((Object3D) group.get(group.size() - 1)).toParent, -Math.PI / 2); |
---|
2548 | 2709 | LA.matXRotate(((Object3D) group.get(group.size() - 1)).fromParent, Math.PI / 2); |
---|
2549 | 2710 | } |
---|
| 2711 | + |
---|
2550 | 2712 | //cJME.count++; |
---|
2551 | 2713 | //cJME.count %= 12; |
---|
2552 | 2714 | if (gc) |
---|
.. | .. |
---|
2730 | 2892 | } |
---|
2731 | 2893 | } |
---|
2732 | 2894 | } |
---|
| 2895 | + |
---|
2733 | 2896 | cFileSystemPane FSPane; |
---|
2734 | 2897 | |
---|
2735 | 2898 | void SetMaterial(cMaterial mat, Object3D.cVector2[] others) |
---|
.. | .. |
---|
2783 | 2946 | } |
---|
2784 | 2947 | } |
---|
2785 | 2948 | } |
---|
| 2949 | + |
---|
2786 | 2950 | freezematerial = false; |
---|
2787 | 2951 | } |
---|
2788 | 2952 | |
---|
2789 | 2953 | void SetMaterial(Object3D object) |
---|
2790 | 2954 | { |
---|
| 2955 | + latestObject = object; |
---|
| 2956 | + |
---|
2791 | 2957 | cMaterial mat = object.material; |
---|
2792 | 2958 | |
---|
2793 | 2959 | if (mat == null) |
---|
.. | .. |
---|
2899 | 3065 | // } |
---|
2900 | 3066 | |
---|
2901 | 3067 | /**/ |
---|
2902 | | - if (deselect) |
---|
| 3068 | + if (deselect || child == null) |
---|
2903 | 3069 | { |
---|
2904 | 3070 | //group.deselectAll(); |
---|
2905 | 3071 | //freeze = true; |
---|
2906 | 3072 | GetTree().clearSelection(); |
---|
2907 | 3073 | //freeze = false; |
---|
| 3074 | + |
---|
| 3075 | + if (child == null) |
---|
| 3076 | + { |
---|
| 3077 | + return; |
---|
| 3078 | + } |
---|
2908 | 3079 | } |
---|
2909 | 3080 | |
---|
2910 | 3081 | //group.addSelectee(child); |
---|
.. | .. |
---|
2973 | 3144 | cameraView.ToggleDL(); |
---|
2974 | 3145 | cameraView.repaint(); |
---|
2975 | 3146 | return; |
---|
2976 | | - } else if (event.getSource() == toggleTextureItem) |
---|
| 3147 | + } else if (event.getSource() == toggleTextureItem || event.getSource() == toggleTextureCB) |
---|
2977 | 3148 | { |
---|
2978 | 3149 | cameraView.ToggleTexture(); |
---|
2979 | 3150 | // june 2013 copy.HardTouch(); |
---|
.. | .. |
---|
3012 | 3183 | frame.validate(); |
---|
3013 | 3184 | |
---|
3014 | 3185 | return; |
---|
3015 | | - } else if (event.getSource() == toggleSwitchItem) |
---|
| 3186 | + } else if (event.getSource() == toggleSwitchItem || event.getSource() == toggleSwitchCB) |
---|
3016 | 3187 | { |
---|
3017 | 3188 | cameraView.ToggleSwitch(); |
---|
3018 | 3189 | cameraView.repaint(); |
---|
.. | .. |
---|
3228 | 3399 | { |
---|
3229 | 3400 | Close(); |
---|
3230 | 3401 | //return true; |
---|
3231 | | - } else if (source == loadItem) |
---|
| 3402 | + } else if (source == openItem) |
---|
3232 | 3403 | { |
---|
3233 | | - load(); |
---|
| 3404 | + Open(); |
---|
3234 | 3405 | //return true; |
---|
3235 | 3406 | } else if (source == newItem) |
---|
3236 | 3407 | { |
---|
.. | .. |
---|
3255 | 3426 | { |
---|
3256 | 3427 | generatePOV(); |
---|
3257 | 3428 | //return true; |
---|
| 3429 | + } else if (event.getSource() == archiveItem) |
---|
| 3430 | + { |
---|
| 3431 | + cTools.Archive(frame); |
---|
| 3432 | + return; |
---|
3258 | 3433 | } else if (source == zBufferItem) |
---|
3259 | 3434 | { |
---|
3260 | 3435 | try |
---|
.. | .. |
---|
3306 | 3481 | try |
---|
3307 | 3482 | { |
---|
3308 | 3483 | ByteArrayOutputStream baos = new ByteArrayOutputStream(); |
---|
3309 | | - java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(baos); |
---|
3310 | | - ObjectOutputStream out = new ObjectOutputStream(zstream); |
---|
| 3484 | +// java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(baos); |
---|
| 3485 | + ObjectOutputStream out = new ObjectOutputStream(baos); //zstream); |
---|
3311 | 3486 | |
---|
3312 | 3487 | Object3D parent = o.parent; |
---|
3313 | 3488 | o.parent = null; |
---|
.. | .. |
---|
3318 | 3493 | |
---|
3319 | 3494 | out.flush(); |
---|
3320 | 3495 | |
---|
3321 | | - zstream.close(); |
---|
| 3496 | + baos //zstream |
---|
| 3497 | + .close(); |
---|
3322 | 3498 | out.close(); |
---|
3323 | 3499 | |
---|
3324 | | - return baos.toByteArray(); |
---|
| 3500 | + byte[] bytes = baos.toByteArray(); |
---|
| 3501 | + |
---|
| 3502 | + System.out.println("save #bytes = " + bytes.length); |
---|
| 3503 | + return bytes; |
---|
3325 | 3504 | } catch (Exception e) |
---|
3326 | 3505 | { |
---|
3327 | 3506 | System.err.println(e); |
---|
.. | .. |
---|
3331 | 3510 | |
---|
3332 | 3511 | static public Object Uncompress(byte[] bytes) |
---|
3333 | 3512 | { |
---|
3334 | | - System.out.println("#bytes = " + bytes.length); |
---|
| 3513 | + System.out.println("restore #bytes = " + bytes.length); |
---|
3335 | 3514 | try |
---|
3336 | 3515 | { |
---|
3337 | 3516 | ByteArrayInputStream bais = new ByteArrayInputStream(bytes); |
---|
3338 | | - java.util.zip.GZIPInputStream istream = new java.util.zip.GZIPInputStream(bais); |
---|
3339 | | - ObjectInputStream in = new ObjectInputStream(istream); |
---|
| 3517 | + //java.util.zip.GZIPInputStream istream = new java.util.zip.GZIPInputStream(bais); |
---|
| 3518 | + ObjectInputStream in = new ObjectInputStream(bais); // istream); |
---|
3340 | 3519 | Object obj = in.readObject(); |
---|
| 3520 | + |
---|
| 3521 | + bais //istream |
---|
| 3522 | + .close(); |
---|
3341 | 3523 | in.close(); |
---|
3342 | 3524 | |
---|
3343 | 3525 | return obj; |
---|
.. | .. |
---|
3396 | 3578 | |
---|
3397 | 3579 | public void Save() |
---|
3398 | 3580 | { |
---|
| 3581 | + Save(true); |
---|
| 3582 | + } |
---|
| 3583 | + |
---|
| 3584 | + private boolean Equal(byte[] compress, byte[] name) |
---|
| 3585 | + { |
---|
| 3586 | + if (compress.length != name.length) |
---|
| 3587 | + { |
---|
| 3588 | + return false; |
---|
| 3589 | + } |
---|
| 3590 | + |
---|
| 3591 | + for (int i=compress.length; --i>=0;) |
---|
| 3592 | + { |
---|
| 3593 | + if (compress[i] != name[i]) |
---|
| 3594 | + return false; |
---|
| 3595 | + } |
---|
| 3596 | + |
---|
| 3597 | + return true; |
---|
| 3598 | + } |
---|
| 3599 | + |
---|
| 3600 | + public boolean Save(boolean user) |
---|
| 3601 | + { |
---|
| 3602 | + System.err.println("Save"); |
---|
| 3603 | + |
---|
3399 | 3604 | cRadio tab = GetCurrentTab(); |
---|
3400 | 3605 | |
---|
3401 | 3606 | boolean temp = CameraPane.SWITCH; |
---|
.. | .. |
---|
3403 | 3608 | |
---|
3404 | 3609 | copy.ExtractBigData(hashtable); |
---|
3405 | 3610 | |
---|
3406 | | - //EditorFrame.m_MainFrame.requestFocusInWindow(); |
---|
3407 | | - tab.graphs[tab.undoindex++] = Compress(copy); |
---|
3408 | | - |
---|
3409 | | - copy.RestoreBigData(hashtable); |
---|
| 3611 | + byte[] compress = Compress(copy); |
---|
3410 | 3612 | |
---|
3411 | 3613 | CameraPane.SWITCH = temp; |
---|
3412 | 3614 | |
---|
| 3615 | + boolean thesame = false; |
---|
| 3616 | + |
---|
| 3617 | + // Quick heuristic using length. Works only when stream is compressed. |
---|
| 3618 | + if (tab.undoindex > 0 && tab.graphs[tab.undoindex-1] != null && Equal(compress, tab.graphs[tab.undoindex-1])) |
---|
| 3619 | + { |
---|
| 3620 | + thesame = true; |
---|
| 3621 | + } |
---|
| 3622 | + |
---|
| 3623 | + //EditorFrame.m_MainFrame.requestFocusInWindow(); |
---|
| 3624 | + if (!thesame) |
---|
| 3625 | + { |
---|
| 3626 | + //tab.user[tab.undoindex] = user; |
---|
| 3627 | + boolean increment = tab.graphs[tab.undoindex] == null; |
---|
| 3628 | + |
---|
| 3629 | + tab.graphs[tab.undoindex] = compress; |
---|
| 3630 | + |
---|
| 3631 | + if (increment) |
---|
| 3632 | + tab.undoindex++; |
---|
| 3633 | + } |
---|
| 3634 | + |
---|
| 3635 | + copy.RestoreBigData(hashtable); |
---|
| 3636 | + |
---|
3413 | 3637 | //assert(hashtable.isEmpty()); |
---|
3414 | 3638 | |
---|
3415 | 3639 | for (int i = tab.undoindex; i < tab.graphs.length; i++) |
---|
3416 | 3640 | { |
---|
3417 | | - tab.graphs[i] = null; |
---|
| 3641 | + //tab.user[i] = false; |
---|
| 3642 | + // tab.graphs[i] = null; |
---|
3418 | 3643 | } |
---|
3419 | 3644 | |
---|
| 3645 | + SetUndoStates(); |
---|
| 3646 | + |
---|
3420 | 3647 | // test save |
---|
3421 | 3648 | if (false) |
---|
3422 | 3649 | { |
---|
.. | .. |
---|
3435 | 3662 | e.printStackTrace(); |
---|
3436 | 3663 | } |
---|
3437 | 3664 | } |
---|
| 3665 | + |
---|
| 3666 | + return !thesame; |
---|
3438 | 3667 | } |
---|
3439 | 3668 | |
---|
3440 | 3669 | void CopyChanged(Object3D obj) |
---|
3441 | 3670 | { |
---|
| 3671 | + SetUndoStates(); |
---|
| 3672 | + |
---|
3442 | 3673 | boolean temp = CameraPane.SWITCH; |
---|
3443 | 3674 | CameraPane.SWITCH = false; |
---|
3444 | 3675 | |
---|
.. | .. |
---|
3478 | 3709 | refreshContents(); |
---|
3479 | 3710 | } |
---|
3480 | 3711 | |
---|
3481 | | - public void Undo() |
---|
| 3712 | + cButton undoButton; |
---|
| 3713 | + cButton redoButton; |
---|
| 3714 | + |
---|
| 3715 | + void SetUndoStates() |
---|
3482 | 3716 | { |
---|
| 3717 | + cRadio tab = GetCurrentTab(); |
---|
| 3718 | + |
---|
| 3719 | + undoButton.setEnabled(tab.undoindex > 0); |
---|
| 3720 | + redoButton.setEnabled(tab.graphs[tab.undoindex + 1] != null); |
---|
| 3721 | + } |
---|
| 3722 | + |
---|
| 3723 | + public boolean Undo() |
---|
| 3724 | + { |
---|
| 3725 | + System.err.println("Undo"); |
---|
| 3726 | + |
---|
3483 | 3727 | cRadio tab = GetCurrentTab(); |
---|
3484 | 3728 | |
---|
3485 | 3729 | if (tab.undoindex == 0) |
---|
3486 | 3730 | { |
---|
3487 | 3731 | java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
3488 | | - return; |
---|
| 3732 | + return false; |
---|
3489 | 3733 | } |
---|
3490 | 3734 | |
---|
3491 | | - if (tab.graphs[tab.undoindex] == null) |
---|
| 3735 | + if (tab.graphs[tab.undoindex] == null) // || !tab.user[tab.undoindex]) |
---|
3492 | 3736 | { |
---|
3493 | | - Save(); |
---|
3494 | | - tab.undoindex -= 1; |
---|
| 3737 | + if (Save(false)) |
---|
| 3738 | + tab.undoindex -= 1; |
---|
| 3739 | + else |
---|
| 3740 | + { |
---|
| 3741 | + if (tab.undoindex <= 0) |
---|
| 3742 | + return false; |
---|
| 3743 | + else |
---|
| 3744 | + tab.undoindex -= 1; |
---|
| 3745 | + } |
---|
3495 | 3746 | } |
---|
3496 | 3747 | |
---|
3497 | 3748 | tab.undoindex -= 1; |
---|
3498 | 3749 | |
---|
3499 | 3750 | CopyChanged((Object3D)Uncompress(tab.graphs[tab.undoindex])); |
---|
| 3751 | + |
---|
| 3752 | + return true; |
---|
3500 | 3753 | } |
---|
3501 | 3754 | |
---|
3502 | 3755 | public void Redo() |
---|
.. | .. |
---|
3512 | 3765 | tab.undoindex += 1; |
---|
3513 | 3766 | |
---|
3514 | 3767 | CopyChanged((Object3D)Uncompress(tab.graphs[tab.undoindex])); |
---|
| 3768 | + |
---|
| 3769 | + //if (!tab.user[tab.undoindex]) |
---|
| 3770 | + // tab.graphs[tab.undoindex] = null; |
---|
3515 | 3771 | } |
---|
3516 | 3772 | |
---|
3517 | 3773 | void ImportGFD() |
---|
.. | .. |
---|
3663 | 3919 | assert false; |
---|
3664 | 3920 | } |
---|
3665 | 3921 | |
---|
3666 | | - void EditSelection() |
---|
| 3922 | + void EditSelection(boolean newWindow) |
---|
3667 | 3923 | { |
---|
3668 | 3924 | } |
---|
3669 | 3925 | |
---|
.. | .. |
---|
4158 | 4414 | |
---|
4159 | 4415 | void makeSomething(Object3D thing, boolean resetmodel) // deselect) |
---|
4160 | 4416 | { |
---|
4161 | | - Save(); |
---|
| 4417 | + if (Globals.SAVEONMAKE) // && resetmodel) |
---|
| 4418 | + Save(); |
---|
4162 | 4419 | //Tween.set(thing, 0).target(1).start(tweenManager); |
---|
4163 | 4420 | //Tween.to(thing, 0, 0.5f).target(0).start(tweenManager); |
---|
4164 | 4421 | // if (thing instanceof GenericJointDemo) |
---|
.. | .. |
---|
4245 | 4502 | { |
---|
4246 | 4503 | ResetModel(); |
---|
4247 | 4504 | Select(thing.GetTreePath(), true, false); // unselect... false); |
---|
| 4505 | + |
---|
| 4506 | + if (thing.Size() == 0) |
---|
| 4507 | + { |
---|
| 4508 | + //EditSelection(false); |
---|
| 4509 | + } |
---|
| 4510 | + |
---|
4248 | 4511 | refreshContents(); |
---|
4249 | 4512 | } |
---|
4250 | 4513 | |
---|
.. | .. |
---|
4467 | 4730 | |
---|
4468 | 4731 | if (readobj != null) |
---|
4469 | 4732 | { |
---|
4470 | | - Save(); |
---|
| 4733 | + //if (Globals.SAVEONMAKE) // A new object cannot share meshes |
---|
| 4734 | + // Save(); |
---|
4471 | 4735 | try |
---|
4472 | 4736 | { |
---|
4473 | 4737 | //readobj.deepCopySelf(copy); |
---|
.. | .. |
---|
4528 | 4792 | } |
---|
4529 | 4793 | } |
---|
4530 | 4794 | |
---|
4531 | | - void load() // throws ClassNotFoundException |
---|
| 4795 | + void Open() // throws ClassNotFoundException |
---|
4532 | 4796 | { |
---|
4533 | 4797 | if (Grafreed.standAlone) |
---|
4534 | 4798 | { |
---|
.. | .. |
---|
4645 | 4909 | String filename = browser.getFile(); |
---|
4646 | 4910 | if (filename != null && filename.length() > 0) |
---|
4647 | 4911 | { |
---|
| 4912 | + if (!filename.endsWith(".gfd")) |
---|
| 4913 | + filename += ".gfd"; |
---|
4648 | 4914 | lastname = browser.getDirectory() + filename; |
---|
4649 | 4915 | save(); |
---|
4650 | 4916 | } |
---|
.. | .. |
---|
4811 | 5077 | MenuBar menuBar; |
---|
4812 | 5078 | Menu fileMenu; |
---|
4813 | 5079 | MenuItem newItem; |
---|
4814 | | - MenuItem loadItem; |
---|
| 5080 | + MenuItem openItem; |
---|
4815 | 5081 | MenuItem saveItem; |
---|
4816 | 5082 | MenuItem saveAsItem; |
---|
4817 | 5083 | MenuItem exportAsItem; |
---|
.. | .. |
---|
4834 | 5100 | CheckboxMenuItem toggleSwitchItem; |
---|
4835 | 5101 | CheckboxMenuItem toggleRootItem; |
---|
4836 | 5102 | CheckboxMenuItem animationItem; |
---|
| 5103 | + MenuItem archiveItem; |
---|
4837 | 5104 | CheckboxMenuItem toggleHandleItem; |
---|
4838 | 5105 | CheckboxMenuItem togglePaintItem; |
---|
4839 | 5106 | JSplitPane mainPanel; |
---|
4840 | 5107 | JScrollPane scrollpane; |
---|
| 5108 | + |
---|
4841 | 5109 | JPanel toolbarPanel; |
---|
| 5110 | + |
---|
4842 | 5111 | cGridBag treePanel; |
---|
| 5112 | + |
---|
4843 | 5113 | JPanel radioPanel; |
---|
4844 | 5114 | ButtonGroup buttonGroup; |
---|
4845 | | - cGridBag ctrlPanel; |
---|
| 5115 | + |
---|
| 5116 | + cGridBag toolboxPanel; |
---|
4846 | 5117 | cGridBag materialPanel; |
---|
| 5118 | + cGridBag ctrlPanel; |
---|
| 5119 | + |
---|
4847 | 5120 | JScrollPane infoPanel; |
---|
| 5121 | + |
---|
4848 | 5122 | cGridBag optionsPanel; |
---|
| 5123 | + |
---|
4849 | 5124 | JTabbedPane objectPanel; |
---|
| 5125 | + boolean materialFlushed; |
---|
| 5126 | + Object3D latestObject; |
---|
| 5127 | + |
---|
4850 | 5128 | cGridBag XYZPanel; |
---|
| 5129 | + |
---|
4851 | 5130 | JSplitPane gridPanel; |
---|
4852 | 5131 | JSplitPane bigPanel; |
---|
| 5132 | + |
---|
4853 | 5133 | cGridBag bigThree; |
---|
4854 | 5134 | cGridBag scenePanel; |
---|
4855 | 5135 | cGridBag centralPanel; |
---|
.. | .. |
---|
4964 | 5244 | cNumberSlider fogField; |
---|
4965 | 5245 | JLabel opacityPowerLabel; |
---|
4966 | 5246 | cNumberSlider opacityPowerField; |
---|
4967 | | - JTree jTree; |
---|
| 5247 | + cTree jTree; |
---|
4968 | 5248 | //ObjectUI parent; |
---|
4969 | 5249 | |
---|
4970 | 5250 | cNumberSlider normalpushField; |
---|