.. | .. |
---|
4 | 4 | |
---|
5 | 5 | import java.awt.*; |
---|
6 | 6 | import java.awt.event.*; |
---|
| 7 | +import java.awt.image.BufferedImage; |
---|
7 | 8 | import javax.swing.*; |
---|
8 | 9 | import javax.swing.event.*; |
---|
9 | 10 | import javax.swing.text.*; |
---|
.. | .. |
---|
13 | 14 | import javax.swing.plaf.metal.MetalLookAndFeel; |
---|
14 | 15 | //import javax.swing.plaf.ColorUIResource; |
---|
15 | 16 | //import javax.swing.plaf.metal.DefaultMetalTheme; |
---|
| 17 | + |
---|
| 18 | +import javax.swing.plaf.basic.BasicSplitPaneDivider; |
---|
| 19 | +import javax.swing.plaf.basic.BasicSplitPaneUI; |
---|
16 | 20 | |
---|
17 | 21 | //import javax.media.opengl.GLCanvas; |
---|
18 | 22 | |
---|
.. | .. |
---|
35 | 39 | |
---|
36 | 40 | GroupEditor callee; |
---|
37 | 41 | JFrame frame; |
---|
| 42 | + |
---|
| 43 | + static ObjEditor theFrame; |
---|
| 44 | + |
---|
| 45 | + cButton GetButton(String name, boolean border) |
---|
| 46 | + { |
---|
| 47 | + 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 | + } |
---|
38 | 103 | |
---|
39 | 104 | // SCRIPT |
---|
40 | 105 | |
---|
.. | .. |
---|
145 | 210 | |
---|
146 | 211 | objEditor.ctrlPanel.remove(namePanel); |
---|
147 | 212 | |
---|
148 | | - if (!GroupEditor.allparams) |
---|
| 213 | + if (!allparams) |
---|
149 | 214 | return; |
---|
150 | 215 | |
---|
151 | 216 | // objEditor.ctrlPanel.remove(liveCB); |
---|
.. | .. |
---|
169 | 234 | |
---|
170 | 235 | objEditor.ctrlPanel.remove(setupPanel); |
---|
171 | 236 | objEditor.ctrlPanel.remove(setupPanel2); |
---|
172 | | - objEditor.ctrlPanel.remove(commandsPanel); |
---|
| 237 | + objEditor.ctrlPanel.remove(objectCommandsPanel); |
---|
173 | 238 | objEditor.ctrlPanel.remove(pushPanel); |
---|
174 | 239 | //objEditor.ctrlPanel.remove(fillPanel); |
---|
175 | 240 | |
---|
.. | .. |
---|
244 | 309 | //localCopy.parent = null; |
---|
245 | 310 | |
---|
246 | 311 | frame = new JFrame(); |
---|
| 312 | + frame.setUndecorated(true); |
---|
247 | 313 | objEditor = this; |
---|
248 | 314 | this.callee = callee; |
---|
249 | 315 | |
---|
.. | .. |
---|
273 | 339 | { |
---|
274 | 340 | return frame.action(event, obj); |
---|
275 | 341 | } |
---|
| 342 | + |
---|
| 343 | + // Cannot work without static |
---|
| 344 | + static boolean allparams = true; |
---|
| 345 | + |
---|
| 346 | + static java.util.Vector<Object3D> listUI = new java.util.Vector<Object3D>(); |
---|
276 | 347 | |
---|
277 | 348 | void SetupMenu() |
---|
278 | 349 | { |
---|
.. | .. |
---|
320 | 391 | closeItem.addActionListener(this); |
---|
321 | 392 | |
---|
322 | 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 | + |
---|
323 | 420 | toolbarPanel = new JPanel(); |
---|
324 | 421 | toolbarPanel.setName("Toolbar"); |
---|
325 | 422 | treePanel = new cGridBag(); |
---|
326 | 423 | treePanel.setName("Tree"); |
---|
| 424 | + |
---|
| 425 | + editPanel = new cGridBag().setVertical(true); |
---|
| 426 | + editPanel.setName("Edit"); |
---|
| 427 | + |
---|
327 | 428 | ctrlPanel = new cGridBag().setVertical(false); // new GridBagLayout()); |
---|
328 | | - 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 | + |
---|
329 | 437 | materialPanel = new cGridBag().setVertical(true); |
---|
330 | 438 | materialPanel.setName("Material"); |
---|
| 439 | + |
---|
331 | 440 | /*JTextPane*/ |
---|
332 | 441 | infoarea = createTextPane(); |
---|
333 | 442 | doc = infoarea.getStyledDocument(); |
---|
.. | .. |
---|
340 | 449 | // TEXTAREA infoarea.setLineWrap(true); |
---|
341 | 450 | // TEXTAREA infoarea.setWrapStyleWord(true); |
---|
342 | 451 | infoPanel = new JScrollPane(infoarea, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); //AS_NEEDED); |
---|
343 | | - infoPanel.setPreferredSize(new Dimension(50, 200)); |
---|
| 452 | + //infoPanel.setPreferredSize(new Dimension(50, 200)); |
---|
344 | 453 | infoPanel.setName("Info"); |
---|
345 | 454 | //infoPanel.setLayout(new BorderLayout()); |
---|
346 | 455 | //infoPanel.add(createTextPane()); |
---|
.. | .. |
---|
352 | 461 | mainPanel.setDividerSize(9); |
---|
353 | 462 | mainPanel.setDividerLocation(0.5); //1.0); |
---|
354 | 463 | mainPanel.setResizeWeight(0.5); |
---|
355 | | - |
---|
| 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 | + |
---|
356 | 472 | //ctrlPanel.setLayout(new GridLayout(4, 1, 5, 5)); |
---|
357 | 473 | //mainPanel.setLayout(new GridBagLayout()); |
---|
358 | 474 | toolbarPanel.setLayout(new FlowLayout(FlowLayout.LEFT)); |
---|
.. | .. |
---|
583 | 699 | } |
---|
584 | 700 | } |
---|
585 | 701 | |
---|
| 702 | +static GraphicsDevice device = GraphicsEnvironment |
---|
| 703 | + .getLocalGraphicsEnvironment().getScreenDevices()[0]; |
---|
| 704 | + |
---|
| 705 | + Rectangle keeprect; |
---|
| 706 | + cRadio radio; |
---|
| 707 | + |
---|
| 708 | +cButton keepButton; |
---|
| 709 | + cButton twoButton; // Full 3D |
---|
| 710 | + cButton sixButton; |
---|
| 711 | + cButton threeButton; |
---|
| 712 | + cButton sevenButton; |
---|
| 713 | + cButton fourButton; // full panel |
---|
| 714 | + cButton oneButton; // full XYZ |
---|
| 715 | + //cButton currentLayout; |
---|
| 716 | + |
---|
| 717 | + boolean maximized; |
---|
| 718 | + |
---|
| 719 | + cButton fullscreenLayout; |
---|
| 720 | + |
---|
| 721 | + void Minimize() |
---|
| 722 | + { |
---|
| 723 | + frame.setState(Frame.ICONIFIED); |
---|
| 724 | + frame.validate(); |
---|
| 725 | + } |
---|
| 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={} |
---|
| 730 | + void Maximize() |
---|
| 731 | + { |
---|
| 732 | + if (CameraPane.FULLSCREEN) |
---|
| 733 | + { |
---|
| 734 | + ToggleFullScreen(); |
---|
| 735 | + } |
---|
| 736 | + |
---|
| 737 | + if (maximized) |
---|
| 738 | + { |
---|
| 739 | + frame.setBounds(keeprect.x, keeprect.y, keeprect.width, keeprect.height); |
---|
| 740 | + } |
---|
| 741 | + else |
---|
| 742 | + { |
---|
| 743 | + keeprect = frame.getBounds(); |
---|
| 744 | + Rectangle rect = GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds(); |
---|
| 745 | + Dimension rect2 = frame.getToolkit().getScreenSize(); |
---|
| 746 | + frame.setBounds(0, rect2.height - rect.height, rect.width, rect.height); |
---|
| 747 | +// frame.setState(Frame.MAXIMIZED_BOTH); |
---|
| 748 | + } |
---|
| 749 | + |
---|
| 750 | + maximized ^= true; |
---|
| 751 | + |
---|
| 752 | + frame.validate(); |
---|
| 753 | + } |
---|
| 754 | + |
---|
| 755 | + cButton minButton; |
---|
| 756 | + cButton maxButton; |
---|
| 757 | + cButton fullButton; |
---|
| 758 | + |
---|
586 | 759 | void ToggleFullScreen() |
---|
587 | 760 | { |
---|
588 | | - if (CameraPane.FULLSCREEN) |
---|
| 761 | + cameraView.ToggleFullScreen(); |
---|
| 762 | + |
---|
| 763 | + if (!CameraPane.FULLSCREEN) |
---|
589 | 764 | { |
---|
590 | | - frame.getContentPane().remove(/*"Center",*/bigThree); |
---|
591 | | - framePanel.add(bigThree); |
---|
592 | | - frame.getContentPane().add(/*"Center",*/framePanel); |
---|
| 765 | + device.setFullScreenWindow(null); |
---|
| 766 | + frame.validate(); |
---|
| 767 | + |
---|
| 768 | + //frame.setVisible(false); |
---|
| 769 | +// frame.removeNotify(); |
---|
| 770 | +// frame.setUndecorated(false); |
---|
| 771 | +// frame.addNotify(); |
---|
| 772 | + //frame.setBounds(keeprect.x, keeprect.y, keeprect.width, keeprect.height); |
---|
| 773 | + |
---|
| 774 | +// X frame.getContentPane().remove(/*"Center",*/bigThree); |
---|
| 775 | +// X framePanel.add(bigThree); |
---|
| 776 | +// X frame.getContentPane().add(/*"Center",*/framePanel); |
---|
| 777 | + framePanel.setDividerLocation(1); |
---|
| 778 | + |
---|
| 779 | + //frame.setVisible(true); |
---|
| 780 | + radio.layout = keepButton; |
---|
| 781 | + //theFrame = null; |
---|
| 782 | + keepButton = null; |
---|
| 783 | + radio.layout.doClick(); |
---|
| 784 | + |
---|
593 | 785 | } else |
---|
594 | 786 | { |
---|
595 | | - frame.getContentPane().remove(/*"Center",*/framePanel); |
---|
596 | | - framePanel.remove(bigThree); |
---|
597 | | - frame.getContentPane().add(/*"Center",*/bigThree); |
---|
| 787 | + keepButton = radio.layout; |
---|
| 788 | + //keeprect = frame.getBounds(); |
---|
| 789 | +// frame.setBounds(0, 0, frame.getToolkit().getScreenSize().width, |
---|
| 790 | +// frame.getToolkit().getScreenSize().height); |
---|
| 791 | + //frame.setVisible(false); |
---|
| 792 | + device.setFullScreenWindow(frame); |
---|
| 793 | + frame.validate(); |
---|
| 794 | +// frame.removeNotify(); |
---|
| 795 | +// frame.setUndecorated(true); |
---|
| 796 | +// frame.addNotify(); |
---|
| 797 | +// X frame.getContentPane().remove(/*"Center",*/framePanel); |
---|
| 798 | +// X framePanel.remove(bigThree); |
---|
| 799 | +// X frame.getContentPane().add(/*"Center",*/bigThree); |
---|
| 800 | + framePanel.setDividerLocation(0); |
---|
| 801 | + |
---|
| 802 | + radio.layout = fullscreenLayout; |
---|
| 803 | + radio.layout.doClick(); |
---|
| 804 | + //frame.setVisible(true); |
---|
598 | 805 | } |
---|
599 | | - cameraView.ToggleFullScreen(); |
---|
| 806 | + frame.validate(); |
---|
600 | 807 | } |
---|
601 | 808 | |
---|
602 | 809 | private JTextPane createTextPane() |
---|
.. | .. |
---|
737 | 944 | JCheckBox speedupCB; |
---|
738 | 945 | JCheckBox rewindCB; |
---|
739 | 946 | JCheckBox flipVCB; |
---|
| 947 | + |
---|
| 948 | + cCheckBox toggleTextureCB; |
---|
| 949 | + cCheckBox toggleSwitchCB; |
---|
| 950 | + |
---|
740 | 951 | JComboBox texresMenu; |
---|
| 952 | + |
---|
741 | 953 | JButton resetButton; |
---|
742 | 954 | JButton stepButton; |
---|
743 | 955 | JButton stepAllButton; |
---|
.. | .. |
---|
746 | 958 | JButton fasterButton; |
---|
747 | 959 | JButton remarkButton; |
---|
748 | 960 | |
---|
| 961 | + cGridBag editPanel; |
---|
| 962 | + cGridBag editCommandsPanel; |
---|
| 963 | + |
---|
749 | 964 | cGridBag namePanel; |
---|
750 | 965 | cGridBag setupPanel; |
---|
751 | 966 | cGridBag setupPanel2; |
---|
752 | | - cGridBag commandsPanel; |
---|
| 967 | + cGridBag objectCommandsPanel; |
---|
753 | 968 | cGridBag pushPanel; |
---|
754 | 969 | cGridBag fillPanel; |
---|
755 | 970 | |
---|
.. | .. |
---|
921 | 1136 | namePanel = new cGridBag(); |
---|
922 | 1137 | |
---|
923 | 1138 | nameField = AddText(namePanel, copy.GetName()); |
---|
924 | | - namePanel.add(nameField); |
---|
| 1139 | + namePanel.add(new JScrollPane(nameField, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER)); |
---|
925 | 1140 | oe.ctrlPanel.add(namePanel); |
---|
926 | 1141 | |
---|
927 | 1142 | oe.ctrlPanel.Return(); |
---|
928 | 1143 | |
---|
929 | | - if (!GroupEditor.allparams) |
---|
| 1144 | + if (!allparams) |
---|
930 | 1145 | return; |
---|
931 | 1146 | |
---|
932 | 1147 | setupPanel = new cGridBag().setVertical(false); |
---|
.. | .. |
---|
939 | 1154 | hideCB = AddCheckBox(setupPanel, "Hide", copy.hide); |
---|
940 | 1155 | hideCB.setToolTipText("Hide object"); |
---|
941 | 1156 | markCB = AddCheckBox(setupPanel, "Mark", copy.marked); |
---|
942 | | - markCB.setToolTipText("Set the animation target transform"); |
---|
| 1157 | + markCB.setToolTipText("As animation target transform"); |
---|
943 | 1158 | |
---|
944 | 1159 | setupPanel2 = new cGridBag().setVertical(false); |
---|
945 | 1160 | |
---|
946 | 1161 | rewindCB = AddCheckBox(setupPanel2, "Rewind", copy.rewind); |
---|
947 | 1162 | rewindCB.setToolTipText("Rewind animation"); |
---|
948 | 1163 | |
---|
949 | | - randomCB = AddCheckBox(setupPanel2, "Rand", copy.random); |
---|
950 | | - randomCB.setToolTipText("Rewind or Go back and forth randomly"); |
---|
| 1164 | + randomCB = AddCheckBox(setupPanel2, "Random", copy.random); |
---|
| 1165 | + randomCB.setToolTipText("Randomly Rewind (or Go back and forth)"); |
---|
951 | 1166 | |
---|
952 | 1167 | if (Globals.ADVANCED) |
---|
953 | 1168 | { |
---|
.. | .. |
---|
962 | 1177 | oe.ctrlPanel.add(setupPanel2); |
---|
963 | 1178 | oe.ctrlPanel.Return(); |
---|
964 | 1179 | |
---|
965 | | - commandsPanel = new cGridBag().setVertical(false); |
---|
| 1180 | + objectCommandsPanel = new cGridBag().setVertical(false); |
---|
966 | 1181 | |
---|
967 | | - resetButton = AddButton(commandsPanel, "Reset"); |
---|
| 1182 | + resetButton = AddButton(objectCommandsPanel, "Reset"); |
---|
968 | 1183 | resetButton.setToolTipText("Jump to frame zero"); |
---|
969 | | - stepButton = AddButton(commandsPanel, "Step"); |
---|
| 1184 | + stepButton = AddButton(objectCommandsPanel, "Step"); |
---|
970 | 1185 | stepButton.setToolTipText("Step one frame"); |
---|
971 | 1186 | // resetAllButton = AddButton(oe, "Reset All"); |
---|
972 | 1187 | // stepAllButton = AddButton(oe, "Step All"); |
---|
973 | 1188 | // Return(); |
---|
974 | | - slowerButton = AddButton(commandsPanel, "Slow"); |
---|
| 1189 | + slowerButton = AddButton(objectCommandsPanel, "Slow"); |
---|
975 | 1190 | slowerButton.setToolTipText("Decrease animation speed"); |
---|
976 | | - fasterButton = AddButton(commandsPanel, "Fast"); |
---|
| 1191 | + fasterButton = AddButton(objectCommandsPanel, "Fast"); |
---|
977 | 1192 | fasterButton.setToolTipText("Increase animation speed"); |
---|
978 | | - remarkButton = AddButton(commandsPanel, "Remark"); |
---|
| 1193 | + remarkButton = AddButton(objectCommandsPanel, "Remark"); |
---|
979 | 1194 | remarkButton.setToolTipText("Set the current transform as the target"); |
---|
980 | 1195 | |
---|
981 | | - oe.ctrlPanel.add(commandsPanel); |
---|
| 1196 | + oe.ctrlPanel.add(objectCommandsPanel); |
---|
982 | 1197 | oe.ctrlPanel.Return(); |
---|
983 | 1198 | |
---|
984 | 1199 | pushPanel = AddSlider(oe.ctrlPanel, "Push", -1, 1, copy.NORMALPUSH, 1.1); // To have the buttons |
---|
.. | .. |
---|
1184 | 1399 | //worldPanel.setName("World"); |
---|
1185 | 1400 | centralPanel = new cGridBag(); |
---|
1186 | 1401 | centralPanel.preferredWidth = 20; |
---|
1187 | | - timelinePanel = new JPanel(new BorderLayout()); |
---|
1188 | | - timelineMenubar = new timeflow.app.TimeflowApp().TimeFlowWindow(timelinePanel); |
---|
| 1402 | + |
---|
| 1403 | + if (Globals.ADVANCED) |
---|
| 1404 | + { |
---|
| 1405 | + timelinePanel = new JPanel(new BorderLayout()); |
---|
| 1406 | + timelineMenubar = new timeflow.app.TimeflowApp().TimeFlowWindow(timelinePanel); |
---|
1189 | 1407 | |
---|
1190 | 1408 | cameraPanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, cameraView, timelinePanel); |
---|
1191 | 1409 | cameraPanel.setContinuousLayout(true); |
---|
.. | .. |
---|
1194 | 1412 | // cameraPanel.setDividerSize(9); |
---|
1195 | 1413 | cameraPanel.setResizeWeight(1.0); |
---|
1196 | 1414 | |
---|
| 1415 | + } |
---|
| 1416 | + |
---|
1197 | 1417 | centralPanel.add(cameraView); |
---|
| 1418 | + centralPanel.setFocusable(true); |
---|
1198 | 1419 | //frame.setJMenuBar(timelineMenubar); |
---|
1199 | 1420 | //centralPanel.add(timelinePanel); |
---|
1200 | 1421 | |
---|
.. | .. |
---|
1261 | 1482 | // north.setName("Edit"); |
---|
1262 | 1483 | // north.add(ctrlPanel, BorderLayout.NORTH); |
---|
1263 | 1484 | // objectPanel.add(north); |
---|
1264 | | - objectPanel.add(ctrlPanel); |
---|
| 1485 | + objectPanel.add(editPanel); |
---|
1265 | 1486 | objectPanel.add(infoPanel); |
---|
| 1487 | + objectPanel.add(toolboxPanel); |
---|
1266 | 1488 | |
---|
1267 | 1489 | /* |
---|
1268 | 1490 | aConstraints.gridx = 0; |
---|
.. | .. |
---|
1271 | 1493 | aConstraints.gridy += 1; |
---|
1272 | 1494 | aConstraints.gridwidth = 1; |
---|
1273 | 1495 | mainPanel.add(objectPanel, aConstraints); |
---|
1274 | | - */ |
---|
| 1496 | + */ |
---|
1275 | 1497 | |
---|
1276 | 1498 | scrollpane = new JScrollPane(mainPanel, ScrollPaneConstants.// VERTICAL_SCROLLBAR_ALWAYS, |
---|
1277 | 1499 | VERTICAL_SCROLLBAR_AS_NEEDED, |
---|
.. | .. |
---|
1288 | 1510 | JTabbedPane tabbedPane = new JTabbedPane(); |
---|
1289 | 1511 | tabbedPane.add(scrollpane); |
---|
1290 | 1512 | |
---|
1291 | | - tabbedPane.add(FSPane = new cFileSystemPane(this)); |
---|
1292 | | - |
---|
1293 | | - optionsPanel = new cGridBag().setVertical(true); |
---|
| 1513 | + optionsPanel = new cGridBag().setVertical(false); |
---|
1294 | 1514 | |
---|
1295 | 1515 | optionsPanel.setName("Options"); |
---|
1296 | 1516 | |
---|
.. | .. |
---|
1298 | 1518 | |
---|
1299 | 1519 | tabbedPane.add(optionsPanel); |
---|
1300 | 1520 | |
---|
| 1521 | + tabbedPane.add(FSPane = new cFileSystemPane(this)); |
---|
| 1522 | + |
---|
1301 | 1523 | scenePanel.add(tabbedPane); |
---|
1302 | 1524 | |
---|
1303 | 1525 | /* |
---|
.. | .. |
---|
1390 | 1612 | // aConstraints = gbc; // (GridBagConstraints) GrafreeD.clone(gbc); |
---|
1391 | 1613 | |
---|
1392 | 1614 | frame.setSize(1280, 860); |
---|
| 1615 | + |
---|
| 1616 | + frame.validate(); |
---|
1393 | 1617 | frame.setVisible(true); |
---|
1394 | 1618 | |
---|
| 1619 | + cameraView.requestFocusInWindow(); |
---|
| 1620 | + |
---|
1395 | 1621 | gridPanel.setDividerLocation(1.0); |
---|
1396 | 1622 | |
---|
1397 | 1623 | frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); |
---|
.. | .. |
---|
1479 | 1705 | texture.add(textureField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
1480 | 1706 | colorSection.add(texture); |
---|
1481 | 1707 | |
---|
1482 | | - cGridBag anisoU = new cGridBag(); |
---|
1483 | | - anisoU.add(anisoLabel = new JLabel("AnisoU")); // , aConstraints); |
---|
1484 | | - anisoLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1485 | | - anisoU.add(anisoField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
1486 | | - colorSection.add(anisoU); |
---|
1487 | | - |
---|
1488 | | - cGridBag anisoV = new cGridBag(); |
---|
1489 | | - anisoV.add(anisoVLabel = new JLabel("AnisoV")); // , aConstraints); |
---|
1490 | | - anisoVLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1491 | | - anisoV.add(anisoVField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
1492 | | - colorSection.add(anisoV); |
---|
1493 | | - |
---|
1494 | | - cGridBag shadowbias = new cGridBag(); |
---|
1495 | | - shadowbias.add(shadowbiasLabel = new JLabel("Shadowbias")); // , aConstraints); |
---|
1496 | | - shadowbiasLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1497 | | - shadowbias.add(shadowbiasField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
1498 | | - colorSection.add(shadowbias); |
---|
1499 | | - |
---|
1500 | 1708 | panel.add(new JSeparator()); |
---|
1501 | 1709 | |
---|
1502 | 1710 | panel.add(colorSection); |
---|
.. | .. |
---|
1546 | 1754 | fakedepthLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1547 | 1755 | fakedepth.add(fakedepthField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
1548 | 1756 | diffuseSection.add(fakedepth); |
---|
| 1757 | + |
---|
| 1758 | + cGridBag shadowbias = new cGridBag(); |
---|
| 1759 | + shadowbias.add(shadowbiasLabel = new JLabel("Shadowbias")); // , aConstraints); |
---|
| 1760 | + shadowbiasLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 1761 | + shadowbias.add(shadowbiasField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
| 1762 | + diffuseSection.add(shadowbias); |
---|
1549 | 1763 | |
---|
1550 | 1764 | panel.add(new JSeparator()); |
---|
1551 | 1765 | |
---|
.. | .. |
---|
1597 | 1811 | // aConstraints.gridy += 1; |
---|
1598 | 1812 | // aConstraints.gridwidth = 1; |
---|
1599 | 1813 | |
---|
| 1814 | + cGridBag anisoU = new cGridBag(); |
---|
| 1815 | + anisoU.add(anisoLabel = new JLabel("AnisoU")); // , aConstraints); |
---|
| 1816 | + anisoLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 1817 | + anisoU.add(anisoField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
| 1818 | + specularSection.add(anisoU); |
---|
| 1819 | + |
---|
| 1820 | + cGridBag anisoV = new cGridBag(); |
---|
| 1821 | + anisoV.add(anisoVLabel = new JLabel("AnisoV")); // , aConstraints); |
---|
| 1822 | + anisoVLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 1823 | + anisoV.add(anisoVField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
| 1824 | + specularSection.add(anisoV); |
---|
| 1825 | + |
---|
1600 | 1826 | |
---|
1601 | 1827 | panel.add(new JSeparator()); |
---|
1602 | 1828 | |
---|
.. | .. |
---|
1604 | 1830 | |
---|
1605 | 1831 | //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints); |
---|
1606 | 1832 | |
---|
1607 | | - cGridBag globalSection = new cGridBag().setVertical(true); |
---|
| 1833 | + //cGridBag globalSection = new cGridBag().setVertical(true); |
---|
1608 | 1834 | |
---|
1609 | 1835 | cGridBag camera = new cGridBag(); |
---|
1610 | 1836 | camera.add(cameraLabel = new JLabel("GlobalLight")); // , aConstraints); |
---|
1611 | 1837 | cameraLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1612 | 1838 | camera.add(cameraField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
1613 | | - globalSection.add(camera); |
---|
| 1839 | + colorSection.add(camera); |
---|
1614 | 1840 | |
---|
1615 | 1841 | cGridBag ambient = new cGridBag(); |
---|
1616 | 1842 | ambient.add(ambientLabel = new JLabel("Ambient")); // , aConstraints); |
---|
1617 | 1843 | ambientLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1618 | 1844 | ambient.add(ambientField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
1619 | | - globalSection.add(ambient); |
---|
| 1845 | + colorSection.add(ambient); |
---|
1620 | 1846 | |
---|
1621 | 1847 | cGridBag backlit = new cGridBag(); |
---|
1622 | 1848 | backlit.add(backlitLabel = new JLabel("Backlit")); // , aConstraints); |
---|
1623 | 1849 | backlitLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1624 | 1850 | backlit.add(backlitField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
1625 | | - globalSection.add(backlit); |
---|
| 1851 | + colorSection.add(backlit); |
---|
1626 | 1852 | |
---|
1627 | 1853 | cGridBag opacity = new cGridBag(); |
---|
1628 | 1854 | opacity.add(opacityLabel = new JLabel("Opacity")); // , aConstraints); |
---|
1629 | 1855 | opacityLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1630 | 1856 | opacity.add(opacityField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
1631 | | - globalSection.add(opacity); |
---|
| 1857 | + colorSection.add(opacity); |
---|
1632 | 1858 | |
---|
1633 | | - panel.add(new JSeparator()); |
---|
| 1859 | + //panel.add(new JSeparator()); |
---|
1634 | 1860 | |
---|
1635 | | - panel.add(globalSection); |
---|
| 1861 | + //panel.add(globalSection); |
---|
1636 | 1862 | |
---|
1637 | 1863 | //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints); |
---|
1638 | 1864 | |
---|
.. | .. |
---|
2707 | 2933 | |
---|
2708 | 2934 | void SetMaterial(Object3D object) |
---|
2709 | 2935 | { |
---|
| 2936 | + latestObject = object; |
---|
| 2937 | + |
---|
2710 | 2938 | cMaterial mat = object.material; |
---|
2711 | 2939 | |
---|
2712 | 2940 | if (mat == null) |
---|
.. | .. |
---|
2818 | 3046 | // } |
---|
2819 | 3047 | |
---|
2820 | 3048 | /**/ |
---|
2821 | | - if (deselect) |
---|
| 3049 | + if (deselect || child == null) |
---|
2822 | 3050 | { |
---|
2823 | 3051 | //group.deselectAll(); |
---|
2824 | 3052 | //freeze = true; |
---|
2825 | 3053 | GetTree().clearSelection(); |
---|
2826 | 3054 | //freeze = false; |
---|
| 3055 | + |
---|
| 3056 | + if (child == null) |
---|
| 3057 | + { |
---|
| 3058 | + return; |
---|
| 3059 | + } |
---|
2827 | 3060 | } |
---|
2828 | 3061 | |
---|
2829 | 3062 | //group.addSelectee(child); |
---|
.. | .. |
---|
2892 | 3125 | cameraView.ToggleDL(); |
---|
2893 | 3126 | cameraView.repaint(); |
---|
2894 | 3127 | return; |
---|
2895 | | - } else if (event.getSource() == toggleTextureItem) |
---|
| 3128 | + } else if (event.getSource() == toggleTextureItem || event.getSource() == toggleTextureCB) |
---|
2896 | 3129 | { |
---|
2897 | 3130 | cameraView.ToggleTexture(); |
---|
2898 | 3131 | // june 2013 copy.HardTouch(); |
---|
.. | .. |
---|
2931 | 3164 | frame.validate(); |
---|
2932 | 3165 | |
---|
2933 | 3166 | return; |
---|
2934 | | - } else if (event.getSource() == toggleSwitchItem) |
---|
| 3167 | + } else if (event.getSource() == toggleSwitchItem || event.getSource() == toggleSwitchCB) |
---|
2935 | 3168 | { |
---|
2936 | 3169 | cameraView.ToggleSwitch(); |
---|
2937 | 3170 | cameraView.repaint(); |
---|
.. | .. |
---|
3315 | 3548 | |
---|
3316 | 3549 | public void Save() |
---|
3317 | 3550 | { |
---|
| 3551 | + System.err.println("Save"); |
---|
| 3552 | + |
---|
3318 | 3553 | cRadio tab = GetCurrentTab(); |
---|
3319 | 3554 | |
---|
3320 | 3555 | boolean temp = CameraPane.SWITCH; |
---|
.. | .. |
---|
3322 | 3557 | |
---|
3323 | 3558 | copy.ExtractBigData(hashtable); |
---|
3324 | 3559 | |
---|
| 3560 | + byte[] compress = Compress(copy); |
---|
| 3561 | + |
---|
3325 | 3562 | //EditorFrame.m_MainFrame.requestFocusInWindow(); |
---|
3326 | | - tab.graphs[tab.undoindex++] = Compress(copy); |
---|
| 3563 | + tab.graphs[tab.undoindex++] = compress; |
---|
3327 | 3564 | |
---|
3328 | 3565 | copy.RestoreBigData(hashtable); |
---|
3329 | 3566 | |
---|
.. | .. |
---|
3336 | 3573 | tab.graphs[i] = null; |
---|
3337 | 3574 | } |
---|
3338 | 3575 | |
---|
| 3576 | + SetUndoStates(); |
---|
| 3577 | + |
---|
3339 | 3578 | // test save |
---|
3340 | 3579 | if (false) |
---|
3341 | 3580 | { |
---|
.. | .. |
---|
3358 | 3597 | |
---|
3359 | 3598 | void CopyChanged(Object3D obj) |
---|
3360 | 3599 | { |
---|
| 3600 | + SetUndoStates(); |
---|
| 3601 | + |
---|
3361 | 3602 | boolean temp = CameraPane.SWITCH; |
---|
3362 | 3603 | CameraPane.SWITCH = false; |
---|
3363 | 3604 | |
---|
.. | .. |
---|
3397 | 3638 | refreshContents(); |
---|
3398 | 3639 | } |
---|
3399 | 3640 | |
---|
| 3641 | + cButton undoButton; |
---|
| 3642 | + cButton redoButton; |
---|
| 3643 | + |
---|
| 3644 | + void SetUndoStates() |
---|
| 3645 | + { |
---|
| 3646 | + cRadio tab = GetCurrentTab(); |
---|
| 3647 | + |
---|
| 3648 | + undoButton.setEnabled(tab.undoindex > 0); |
---|
| 3649 | + redoButton.setEnabled(tab.graphs[tab.undoindex + 1] != null); |
---|
| 3650 | + } |
---|
| 3651 | + |
---|
3400 | 3652 | public void Undo() |
---|
3401 | 3653 | { |
---|
| 3654 | + System.err.println("Undo"); |
---|
| 3655 | + |
---|
3402 | 3656 | cRadio tab = GetCurrentTab(); |
---|
3403 | 3657 | |
---|
3404 | 3658 | if (tab.undoindex == 0) |
---|
.. | .. |
---|
3582 | 3836 | assert false; |
---|
3583 | 3837 | } |
---|
3584 | 3838 | |
---|
3585 | | - void EditSelection() |
---|
| 3839 | + void EditSelection(boolean newWindow) |
---|
3586 | 3840 | { |
---|
3587 | 3841 | } |
---|
3588 | 3842 | |
---|
.. | .. |
---|
4077 | 4331 | |
---|
4078 | 4332 | void makeSomething(Object3D thing, boolean resetmodel) // deselect) |
---|
4079 | 4333 | { |
---|
4080 | | - Save(); |
---|
| 4334 | + if (Globals.SAVEONMAKE) // && resetmodel) |
---|
| 4335 | + Save(); |
---|
4081 | 4336 | //Tween.set(thing, 0).target(1).start(tweenManager); |
---|
4082 | 4337 | //Tween.to(thing, 0, 0.5f).target(0).start(tweenManager); |
---|
4083 | 4338 | // if (thing instanceof GenericJointDemo) |
---|
.. | .. |
---|
4164 | 4419 | { |
---|
4165 | 4420 | ResetModel(); |
---|
4166 | 4421 | Select(thing.GetTreePath(), true, false); // unselect... false); |
---|
| 4422 | + |
---|
| 4423 | + if (thing.Size() == 0) |
---|
| 4424 | + { |
---|
| 4425 | + //EditSelection(false); |
---|
| 4426 | + } |
---|
| 4427 | + |
---|
4167 | 4428 | refreshContents(); |
---|
4168 | 4429 | } |
---|
4169 | 4430 | |
---|
.. | .. |
---|
4386 | 4647 | |
---|
4387 | 4648 | if (readobj != null) |
---|
4388 | 4649 | { |
---|
| 4650 | + if (Globals.SAVEONMAKE) |
---|
4389 | 4651 | Save(); |
---|
4390 | 4652 | try |
---|
4391 | 4653 | { |
---|
.. | .. |
---|
4564 | 4826 | String filename = browser.getFile(); |
---|
4565 | 4827 | if (filename != null && filename.length() > 0) |
---|
4566 | 4828 | { |
---|
| 4829 | + if (!filename.endsWith(".gfd")) |
---|
| 4830 | + filename += ".gfd"; |
---|
4567 | 4831 | lastname = browser.getDirectory() + filename; |
---|
4568 | 4832 | save(); |
---|
4569 | 4833 | } |
---|
.. | .. |
---|
4757 | 5021 | CheckboxMenuItem togglePaintItem; |
---|
4758 | 5022 | JSplitPane mainPanel; |
---|
4759 | 5023 | JScrollPane scrollpane; |
---|
| 5024 | + |
---|
4760 | 5025 | JPanel toolbarPanel; |
---|
| 5026 | + |
---|
4761 | 5027 | cGridBag treePanel; |
---|
| 5028 | + |
---|
4762 | 5029 | JPanel radioPanel; |
---|
4763 | 5030 | ButtonGroup buttonGroup; |
---|
4764 | | - cGridBag ctrlPanel; |
---|
| 5031 | + |
---|
| 5032 | + cGridBag toolboxPanel; |
---|
4765 | 5033 | cGridBag materialPanel; |
---|
| 5034 | + cGridBag ctrlPanel; |
---|
| 5035 | + |
---|
4766 | 5036 | JScrollPane infoPanel; |
---|
| 5037 | + |
---|
4767 | 5038 | cGridBag optionsPanel; |
---|
| 5039 | + |
---|
4768 | 5040 | JTabbedPane objectPanel; |
---|
| 5041 | + boolean materialFlushed; |
---|
| 5042 | + Object3D latestObject; |
---|
| 5043 | + |
---|
4769 | 5044 | cGridBag XYZPanel; |
---|
| 5045 | + |
---|
4770 | 5046 | JSplitPane gridPanel; |
---|
4771 | 5047 | JSplitPane bigPanel; |
---|
| 5048 | + |
---|
4772 | 5049 | cGridBag bigThree; |
---|
4773 | 5050 | cGridBag scenePanel; |
---|
4774 | 5051 | cGridBag centralPanel; |
---|
.. | .. |
---|
4883 | 5160 | cNumberSlider fogField; |
---|
4884 | 5161 | JLabel opacityPowerLabel; |
---|
4885 | 5162 | cNumberSlider opacityPowerField; |
---|
4886 | | - JTree jTree; |
---|
| 5163 | + cTree jTree; |
---|
4887 | 5164 | //ObjectUI parent; |
---|
4888 | 5165 | |
---|
4889 | 5166 | cNumberSlider normalpushField; |
---|