.. | .. |
---|
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); |
---|
.. | .. |
---|
168 | 233 | // objEditor.ctrlPanel.remove(remarkButton); |
---|
169 | 234 | |
---|
170 | 235 | objEditor.ctrlPanel.remove(setupPanel); |
---|
171 | | - objEditor.ctrlPanel.remove(commandsPanel); |
---|
| 236 | + objEditor.ctrlPanel.remove(setupPanel2); |
---|
| 237 | + objEditor.ctrlPanel.remove(objectCommandsPanel); |
---|
172 | 238 | objEditor.ctrlPanel.remove(pushPanel); |
---|
173 | 239 | //objEditor.ctrlPanel.remove(fillPanel); |
---|
174 | 240 | |
---|
.. | .. |
---|
243 | 309 | //localCopy.parent = null; |
---|
244 | 310 | |
---|
245 | 311 | frame = new JFrame(); |
---|
| 312 | + frame.setUndecorated(true); |
---|
246 | 313 | objEditor = this; |
---|
247 | 314 | this.callee = callee; |
---|
248 | 315 | |
---|
.. | .. |
---|
273 | 340 | return frame.action(event, obj); |
---|
274 | 341 | } |
---|
275 | 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 | + |
---|
276 | 348 | void SetupMenu() |
---|
277 | 349 | { |
---|
278 | 350 | frame.setMenuBar(menuBar = new MenuBar()); |
---|
279 | 351 | menuBar.add(fileMenu = new Menu("File")); |
---|
280 | 352 | fileMenu.add(newItem = new MenuItem("New")); |
---|
281 | | - fileMenu.add(loadItem = new MenuItem("Load...")); |
---|
| 353 | + fileMenu.add(loadItem = new MenuItem("Open...")); |
---|
282 | 354 | |
---|
283 | 355 | //oe.menuBar.add(menu = new Menu("Include")); |
---|
284 | 356 | Menu menu = new Menu("Import"); |
---|
.. | .. |
---|
319 | 391 | closeItem.addActionListener(this); |
---|
320 | 392 | |
---|
321 | 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 | + |
---|
322 | 420 | toolbarPanel = new JPanel(); |
---|
323 | 421 | toolbarPanel.setName("Toolbar"); |
---|
324 | 422 | treePanel = new cGridBag(); |
---|
325 | 423 | treePanel.setName("Tree"); |
---|
| 424 | + |
---|
| 425 | + editPanel = new cGridBag().setVertical(true); |
---|
| 426 | + editPanel.setName("Edit"); |
---|
| 427 | + |
---|
326 | 428 | ctrlPanel = new cGridBag().setVertical(false); // new GridBagLayout()); |
---|
327 | | - 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 | + |
---|
328 | 437 | materialPanel = new cGridBag().setVertical(true); |
---|
329 | 438 | materialPanel.setName("Material"); |
---|
| 439 | + |
---|
330 | 440 | /*JTextPane*/ |
---|
331 | 441 | infoarea = createTextPane(); |
---|
332 | 442 | doc = infoarea.getStyledDocument(); |
---|
.. | .. |
---|
351 | 461 | mainPanel.setDividerSize(9); |
---|
352 | 462 | mainPanel.setDividerLocation(0.5); //1.0); |
---|
353 | 463 | mainPanel.setResizeWeight(0.5); |
---|
354 | | - |
---|
| 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 | + |
---|
355 | 471 | //ctrlPanel.setLayout(new GridLayout(4, 1, 5, 5)); |
---|
356 | 472 | //mainPanel.setLayout(new GridBagLayout()); |
---|
357 | 473 | toolbarPanel.setLayout(new FlowLayout(FlowLayout.LEFT)); |
---|
.. | .. |
---|
419 | 535 | e.printStackTrace(); |
---|
420 | 536 | } |
---|
421 | 537 | |
---|
422 | | - String selection = infoarea.getText(); |
---|
423 | | - java.awt.datatransfer.StringSelection data = new java.awt.datatransfer.StringSelection(selection); |
---|
424 | | - java.awt.datatransfer.Clipboard clipboard = |
---|
425 | | - Toolkit.getDefaultToolkit().getSystemClipboard(); |
---|
| 538 | +// String selection = infoarea.getText(); |
---|
| 539 | +// java.awt.datatransfer.StringSelection data = new java.awt.datatransfer.StringSelection(selection); |
---|
| 540 | +// java.awt.datatransfer.Clipboard clipboard = |
---|
| 541 | +// Toolkit.getDefaultToolkit().getSystemClipboard(); |
---|
426 | 542 | //clipboard.setContents(data, data); |
---|
427 | 543 | } |
---|
428 | 544 | |
---|
.. | .. |
---|
582 | 698 | } |
---|
583 | 699 | } |
---|
584 | 700 | |
---|
| 701 | +static GraphicsDevice device = GraphicsEnvironment |
---|
| 702 | + .getLocalGraphicsEnvironment().getScreenDevices()[0]; |
---|
| 703 | + |
---|
| 704 | + Rectangle keeprect; |
---|
| 705 | + cRadio radio; |
---|
| 706 | + |
---|
| 707 | +cButton keepButton; |
---|
| 708 | + cButton twoButton; // Full 3D |
---|
| 709 | + cButton sixButton; |
---|
| 710 | + cButton threeButton; |
---|
| 711 | + cButton sevenButton; |
---|
| 712 | + cButton fourButton; // full panel |
---|
| 713 | + cButton oneButton; // full XYZ |
---|
| 714 | + //cButton currentLayout; |
---|
| 715 | + |
---|
| 716 | + boolean maximized; |
---|
| 717 | + |
---|
| 718 | + cButton fullscreenLayout; |
---|
| 719 | + |
---|
| 720 | + void Minimize() |
---|
| 721 | + { |
---|
| 722 | + frame.setState(Frame.ICONIFIED); |
---|
| 723 | + } |
---|
| 724 | + |
---|
| 725 | + void Maximize() |
---|
| 726 | + { |
---|
| 727 | + if (maximized) |
---|
| 728 | + { |
---|
| 729 | + frame.setBounds(keeprect.x, keeprect.y, keeprect.width, keeprect.height); |
---|
| 730 | + } |
---|
| 731 | + else |
---|
| 732 | + { |
---|
| 733 | + keeprect = frame.getBounds(); |
---|
| 734 | + Rectangle rect = GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds(); |
---|
| 735 | + Dimension rect2 = frame.getToolkit().getScreenSize(); |
---|
| 736 | + frame.setBounds(0, rect2.height - rect.height, rect.width, rect.height); |
---|
| 737 | +// frame.setState(Frame.MAXIMIZED_BOTH); |
---|
| 738 | + } |
---|
| 739 | + |
---|
| 740 | + maximized ^= true; |
---|
| 741 | + } |
---|
| 742 | + |
---|
585 | 743 | void ToggleFullScreen() |
---|
586 | 744 | { |
---|
587 | | - if (CameraPane.FULLSCREEN) |
---|
| 745 | + cameraView.ToggleFullScreen(); |
---|
| 746 | + |
---|
| 747 | + if (!CameraPane.FULLSCREEN) |
---|
588 | 748 | { |
---|
589 | | - frame.getContentPane().remove(/*"Center",*/bigThree); |
---|
590 | | - framePanel.add(bigThree); |
---|
591 | | - frame.getContentPane().add(/*"Center",*/framePanel); |
---|
| 749 | + device.setFullScreenWindow(null); |
---|
| 750 | + //frame.setVisible(false); |
---|
| 751 | +// frame.removeNotify(); |
---|
| 752 | +// frame.setUndecorated(false); |
---|
| 753 | +// frame.addNotify(); |
---|
| 754 | + //frame.setBounds(keeprect.x, keeprect.y, keeprect.width, keeprect.height); |
---|
| 755 | + |
---|
| 756 | +// X frame.getContentPane().remove(/*"Center",*/bigThree); |
---|
| 757 | +// X framePanel.add(bigThree); |
---|
| 758 | +// X frame.getContentPane().add(/*"Center",*/framePanel); |
---|
| 759 | + framePanel.setDividerLocation(1); |
---|
| 760 | + |
---|
| 761 | + //frame.setVisible(true); |
---|
| 762 | + radio.layout = keepButton; |
---|
| 763 | + //theFrame = null; |
---|
| 764 | + keepButton = null; |
---|
| 765 | + radio.layout.doClick(); |
---|
| 766 | + |
---|
592 | 767 | } else |
---|
593 | 768 | { |
---|
594 | | - frame.getContentPane().remove(/*"Center",*/framePanel); |
---|
595 | | - framePanel.remove(bigThree); |
---|
596 | | - frame.getContentPane().add(/*"Center",*/bigThree); |
---|
| 769 | + keepButton = radio.layout; |
---|
| 770 | + //keeprect = frame.getBounds(); |
---|
| 771 | +// frame.setBounds(0, 0, frame.getToolkit().getScreenSize().width, |
---|
| 772 | +// frame.getToolkit().getScreenSize().height); |
---|
| 773 | + //frame.setVisible(false); |
---|
| 774 | + device.setFullScreenWindow(frame); |
---|
| 775 | +// frame.removeNotify(); |
---|
| 776 | +// frame.setUndecorated(true); |
---|
| 777 | +// frame.addNotify(); |
---|
| 778 | +// X frame.getContentPane().remove(/*"Center",*/framePanel); |
---|
| 779 | +// X framePanel.remove(bigThree); |
---|
| 780 | +// X frame.getContentPane().add(/*"Center",*/bigThree); |
---|
| 781 | + framePanel.setDividerLocation(0); |
---|
| 782 | + |
---|
| 783 | + radio.layout = fullscreenLayout; |
---|
| 784 | + radio.layout.doClick(); |
---|
| 785 | + //frame.setVisible(true); |
---|
597 | 786 | } |
---|
598 | | - cameraView.ToggleFullScreen(); |
---|
599 | 787 | } |
---|
600 | 788 | |
---|
601 | 789 | private JTextPane createTextPane() |
---|
.. | .. |
---|
736 | 924 | JCheckBox speedupCB; |
---|
737 | 925 | JCheckBox rewindCB; |
---|
738 | 926 | JCheckBox flipVCB; |
---|
| 927 | + |
---|
| 928 | + cCheckBox toggleTextureCB; |
---|
| 929 | + cCheckBox toggleSwitchCB; |
---|
| 930 | + |
---|
739 | 931 | JComboBox texresMenu; |
---|
| 932 | + |
---|
740 | 933 | JButton resetButton; |
---|
741 | 934 | JButton stepButton; |
---|
742 | 935 | JButton stepAllButton; |
---|
.. | .. |
---|
745 | 938 | JButton fasterButton; |
---|
746 | 939 | JButton remarkButton; |
---|
747 | 940 | |
---|
| 941 | + cGridBag editPanel; |
---|
| 942 | + cGridBag editCommandsPanel; |
---|
| 943 | + |
---|
748 | 944 | cGridBag namePanel; |
---|
749 | 945 | cGridBag setupPanel; |
---|
750 | | - cGridBag commandsPanel; |
---|
| 946 | + cGridBag setupPanel2; |
---|
| 947 | + cGridBag objectCommandsPanel; |
---|
751 | 948 | cGridBag pushPanel; |
---|
752 | 949 | cGridBag fillPanel; |
---|
753 | 950 | |
---|
.. | .. |
---|
924 | 1121 | |
---|
925 | 1122 | oe.ctrlPanel.Return(); |
---|
926 | 1123 | |
---|
927 | | - if (!GroupEditor.allparams) |
---|
| 1124 | + if (!allparams) |
---|
928 | 1125 | return; |
---|
929 | 1126 | |
---|
930 | 1127 | setupPanel = new cGridBag().setVertical(false); |
---|
.. | .. |
---|
937 | 1134 | hideCB = AddCheckBox(setupPanel, "Hide", copy.hide); |
---|
938 | 1135 | hideCB.setToolTipText("Hide object"); |
---|
939 | 1136 | markCB = AddCheckBox(setupPanel, "Mark", copy.marked); |
---|
940 | | - markCB.setToolTipText("Set the animation target transform"); |
---|
| 1137 | + markCB.setToolTipText("As animation target transform"); |
---|
941 | 1138 | |
---|
942 | | - rewindCB = AddCheckBox(setupPanel, "Rewind", copy.rewind); |
---|
| 1139 | + setupPanel2 = new cGridBag().setVertical(false); |
---|
| 1140 | + |
---|
| 1141 | + rewindCB = AddCheckBox(setupPanel2, "Rewind", copy.rewind); |
---|
943 | 1142 | rewindCB.setToolTipText("Rewind animation"); |
---|
944 | 1143 | |
---|
945 | | - randomCB = AddCheckBox(setupPanel, "Random", copy.random); |
---|
946 | | - randomCB.setToolTipText("Option for switch node"); |
---|
| 1144 | + randomCB = AddCheckBox(setupPanel2, "Rand", copy.random); |
---|
| 1145 | + randomCB.setToolTipText("Randomly Rewind (or Go back and forth)"); |
---|
947 | 1146 | |
---|
948 | 1147 | if (Globals.ADVANCED) |
---|
949 | 1148 | { |
---|
950 | | - link2masterCB = AddCheckBox(setupPanel, "Support", copy.link2master); |
---|
| 1149 | + link2masterCB = AddCheckBox(setupPanel2, "Supp", copy.link2master); |
---|
951 | 1150 | link2masterCB.setToolTipText("Attach to support"); |
---|
952 | | - speedupCB = AddCheckBox(setupPanel, "Speed", copy.speedup); |
---|
| 1151 | + speedupCB = AddCheckBox(setupPanel2, "Speed", copy.speedup); |
---|
953 | 1152 | speedupCB.setToolTipText("Option motion capture"); |
---|
954 | 1153 | } |
---|
955 | 1154 | |
---|
956 | 1155 | oe.ctrlPanel.add(setupPanel); |
---|
957 | 1156 | oe.ctrlPanel.Return(); |
---|
| 1157 | + oe.ctrlPanel.add(setupPanel2); |
---|
| 1158 | + oe.ctrlPanel.Return(); |
---|
958 | 1159 | |
---|
959 | | - commandsPanel = new cGridBag().setVertical(false); |
---|
| 1160 | + objectCommandsPanel = new cGridBag().setVertical(false); |
---|
960 | 1161 | |
---|
961 | | - resetButton = AddButton(commandsPanel, "Reset"); |
---|
| 1162 | + resetButton = AddButton(objectCommandsPanel, "Reset"); |
---|
962 | 1163 | resetButton.setToolTipText("Jump to frame zero"); |
---|
963 | | - stepButton = AddButton(commandsPanel, "Step"); |
---|
| 1164 | + stepButton = AddButton(objectCommandsPanel, "Step"); |
---|
964 | 1165 | stepButton.setToolTipText("Step one frame"); |
---|
965 | 1166 | // resetAllButton = AddButton(oe, "Reset All"); |
---|
966 | 1167 | // stepAllButton = AddButton(oe, "Step All"); |
---|
967 | 1168 | // Return(); |
---|
968 | | - slowerButton = AddButton(commandsPanel, "Slow"); |
---|
| 1169 | + slowerButton = AddButton(objectCommandsPanel, "Slow"); |
---|
969 | 1170 | slowerButton.setToolTipText("Decrease animation speed"); |
---|
970 | | - fasterButton = AddButton(commandsPanel, "Fast"); |
---|
| 1171 | + fasterButton = AddButton(objectCommandsPanel, "Fast"); |
---|
971 | 1172 | fasterButton.setToolTipText("Increase animation speed"); |
---|
972 | | - remarkButton = AddButton(commandsPanel, "Remark"); |
---|
| 1173 | + remarkButton = AddButton(objectCommandsPanel, "Remark"); |
---|
973 | 1174 | remarkButton.setToolTipText("Set the current transform as the target"); |
---|
974 | 1175 | |
---|
975 | | - oe.ctrlPanel.add(commandsPanel); |
---|
| 1176 | + oe.ctrlPanel.add(objectCommandsPanel); |
---|
976 | 1177 | oe.ctrlPanel.Return(); |
---|
977 | 1178 | |
---|
978 | 1179 | pushPanel = AddSlider(oe.ctrlPanel, "Push", -1, 1, copy.NORMALPUSH, 1.1); // To have the buttons |
---|
.. | .. |
---|
1178 | 1379 | //worldPanel.setName("World"); |
---|
1179 | 1380 | centralPanel = new cGridBag(); |
---|
1180 | 1381 | centralPanel.preferredWidth = 20; |
---|
1181 | | - timelinePanel = new JPanel(new BorderLayout()); |
---|
1182 | | - timelineMenubar = new timeflow.app.TimeflowApp().TimeFlowWindow(timelinePanel); |
---|
| 1382 | + |
---|
| 1383 | + if (Globals.ADVANCED) |
---|
| 1384 | + { |
---|
| 1385 | + timelinePanel = new JPanel(new BorderLayout()); |
---|
| 1386 | + timelineMenubar = new timeflow.app.TimeflowApp().TimeFlowWindow(timelinePanel); |
---|
1183 | 1387 | |
---|
1184 | 1388 | cameraPanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, cameraView, timelinePanel); |
---|
1185 | 1389 | cameraPanel.setContinuousLayout(true); |
---|
.. | .. |
---|
1188 | 1392 | // cameraPanel.setDividerSize(9); |
---|
1189 | 1393 | cameraPanel.setResizeWeight(1.0); |
---|
1190 | 1394 | |
---|
| 1395 | + } |
---|
| 1396 | + |
---|
1191 | 1397 | centralPanel.add(cameraView); |
---|
| 1398 | + centralPanel.setFocusable(true); |
---|
1192 | 1399 | //frame.setJMenuBar(timelineMenubar); |
---|
1193 | 1400 | //centralPanel.add(timelinePanel); |
---|
1194 | 1401 | |
---|
.. | .. |
---|
1255 | 1462 | // north.setName("Edit"); |
---|
1256 | 1463 | // north.add(ctrlPanel, BorderLayout.NORTH); |
---|
1257 | 1464 | // objectPanel.add(north); |
---|
1258 | | - objectPanel.add(ctrlPanel); |
---|
| 1465 | + objectPanel.add(editPanel); |
---|
1259 | 1466 | objectPanel.add(infoPanel); |
---|
| 1467 | + objectPanel.add(toolboxPanel); |
---|
1260 | 1468 | |
---|
1261 | 1469 | /* |
---|
1262 | 1470 | aConstraints.gridx = 0; |
---|
.. | .. |
---|
1265 | 1473 | aConstraints.gridy += 1; |
---|
1266 | 1474 | aConstraints.gridwidth = 1; |
---|
1267 | 1475 | mainPanel.add(objectPanel, aConstraints); |
---|
1268 | | - */ |
---|
| 1476 | + */ |
---|
1269 | 1477 | |
---|
1270 | 1478 | scrollpane = new JScrollPane(mainPanel, ScrollPaneConstants.// VERTICAL_SCROLLBAR_ALWAYS, |
---|
1271 | 1479 | VERTICAL_SCROLLBAR_AS_NEEDED, |
---|
.. | .. |
---|
1282 | 1490 | JTabbedPane tabbedPane = new JTabbedPane(); |
---|
1283 | 1491 | tabbedPane.add(scrollpane); |
---|
1284 | 1492 | |
---|
1285 | | - tabbedPane.add(FSPane = new cFileSystemPane(this)); |
---|
1286 | | - |
---|
1287 | | - optionsPanel = new cGridBag().setVertical(true); |
---|
| 1493 | + optionsPanel = new cGridBag().setVertical(false); |
---|
1288 | 1494 | |
---|
1289 | 1495 | optionsPanel.setName("Options"); |
---|
1290 | 1496 | |
---|
.. | .. |
---|
1292 | 1498 | |
---|
1293 | 1499 | tabbedPane.add(optionsPanel); |
---|
1294 | 1500 | |
---|
| 1501 | + tabbedPane.add(FSPane = new cFileSystemPane(this)); |
---|
| 1502 | + |
---|
1295 | 1503 | scenePanel.add(tabbedPane); |
---|
1296 | 1504 | |
---|
1297 | 1505 | /* |
---|
.. | .. |
---|
1384 | 1592 | // aConstraints = gbc; // (GridBagConstraints) GrafreeD.clone(gbc); |
---|
1385 | 1593 | |
---|
1386 | 1594 | frame.setSize(1280, 860); |
---|
| 1595 | + |
---|
| 1596 | + frame.validate(); |
---|
1387 | 1597 | frame.setVisible(true); |
---|
1388 | 1598 | |
---|
| 1599 | + cameraView.requestFocusInWindow(); |
---|
| 1600 | + |
---|
1389 | 1601 | gridPanel.setDividerLocation(1.0); |
---|
1390 | 1602 | |
---|
1391 | 1603 | frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); |
---|
.. | .. |
---|
2072 | 2284 | |
---|
2073 | 2285 | void LoadObjFile(String fullname) |
---|
2074 | 2286 | { |
---|
2075 | | - /* |
---|
| 2287 | + System.out.println("Loading " + fullname); |
---|
| 2288 | + /**/ |
---|
2076 | 2289 | //lastFilename = fullname; |
---|
2077 | 2290 | if(loadObjThread == null) |
---|
2078 | 2291 | { |
---|
2079 | | - loadObjThread = new LoadOBJThread(); |
---|
2080 | | - loadObjThread.start(); |
---|
| 2292 | + loadObjThread = new LoadOBJThread(); |
---|
| 2293 | + loadObjThread.start(); |
---|
2081 | 2294 | } |
---|
2082 | 2295 | |
---|
2083 | 2296 | loadObjThread.add(fullname); |
---|
2084 | | - */ |
---|
| 2297 | + /**/ |
---|
2085 | 2298 | |
---|
2086 | | - System.out.println("Loading " + fullname); |
---|
2087 | | - makeSomething(new FileObject(fullname, true), true); |
---|
| 2299 | + //makeSomething(new FileObject(fullname, true), true); |
---|
2088 | 2300 | } |
---|
2089 | 2301 | |
---|
2090 | 2302 | void LoadGFDFile(String fullname) |
---|
.. | .. |
---|
2701 | 2913 | |
---|
2702 | 2914 | void SetMaterial(Object3D object) |
---|
2703 | 2915 | { |
---|
| 2916 | + latestObject = object; |
---|
| 2917 | + |
---|
2704 | 2918 | cMaterial mat = object.material; |
---|
2705 | 2919 | |
---|
2706 | 2920 | if (mat == null) |
---|
.. | .. |
---|
2812 | 3026 | // } |
---|
2813 | 3027 | |
---|
2814 | 3028 | /**/ |
---|
2815 | | - if (deselect) |
---|
| 3029 | + if (deselect || child == null) |
---|
2816 | 3030 | { |
---|
2817 | 3031 | //group.deselectAll(); |
---|
2818 | 3032 | //freeze = true; |
---|
2819 | 3033 | GetTree().clearSelection(); |
---|
2820 | 3034 | //freeze = false; |
---|
| 3035 | + |
---|
| 3036 | + if (child == null) |
---|
| 3037 | + { |
---|
| 3038 | + return; |
---|
| 3039 | + } |
---|
2821 | 3040 | } |
---|
2822 | 3041 | |
---|
2823 | 3042 | //group.addSelectee(child); |
---|
.. | .. |
---|
2886 | 3105 | cameraView.ToggleDL(); |
---|
2887 | 3106 | cameraView.repaint(); |
---|
2888 | 3107 | return; |
---|
2889 | | - } else if (event.getSource() == toggleTextureItem) |
---|
| 3108 | + } else if (event.getSource() == toggleTextureItem || event.getSource() == toggleTextureCB) |
---|
2890 | 3109 | { |
---|
2891 | 3110 | cameraView.ToggleTexture(); |
---|
2892 | 3111 | // june 2013 copy.HardTouch(); |
---|
.. | .. |
---|
2925 | 3144 | frame.validate(); |
---|
2926 | 3145 | |
---|
2927 | 3146 | return; |
---|
2928 | | - } else if (event.getSource() == toggleSwitchItem) |
---|
| 3147 | + } else if (event.getSource() == toggleSwitchItem || event.getSource() == toggleSwitchCB) |
---|
2929 | 3148 | { |
---|
2930 | 3149 | cameraView.ToggleSwitch(); |
---|
2931 | 3150 | cameraView.repaint(); |
---|
.. | .. |
---|
3214 | 3433 | objEditor.refreshContents(); |
---|
3215 | 3434 | } |
---|
3216 | 3435 | |
---|
3217 | | - static public byte[] Compress(Object o) |
---|
| 3436 | + static public byte[] Compress(Object3D o) |
---|
3218 | 3437 | { |
---|
3219 | 3438 | try |
---|
3220 | 3439 | { |
---|
.. | .. |
---|
3222 | 3441 | java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(baos); |
---|
3223 | 3442 | ObjectOutputStream out = new ObjectOutputStream(zstream); |
---|
3224 | 3443 | |
---|
| 3444 | + Object3D parent = o.parent; |
---|
| 3445 | + o.parent = null; |
---|
| 3446 | + |
---|
3225 | 3447 | out.writeObject(o); |
---|
3226 | 3448 | |
---|
| 3449 | + o.parent = parent; |
---|
| 3450 | + |
---|
3227 | 3451 | out.flush(); |
---|
3228 | 3452 | |
---|
3229 | 3453 | zstream.close(); |
---|
.. | .. |
---|
3304 | 3528 | |
---|
3305 | 3529 | public void Save() |
---|
3306 | 3530 | { |
---|
| 3531 | + System.err.println("Save"); |
---|
| 3532 | + |
---|
3307 | 3533 | cRadio tab = GetCurrentTab(); |
---|
3308 | 3534 | |
---|
3309 | 3535 | boolean temp = CameraPane.SWITCH; |
---|
.. | .. |
---|
3325 | 3551 | tab.graphs[i] = null; |
---|
3326 | 3552 | } |
---|
3327 | 3553 | |
---|
| 3554 | + SetUndoStates(); |
---|
| 3555 | + |
---|
3328 | 3556 | // test save |
---|
3329 | 3557 | if (false) |
---|
3330 | 3558 | { |
---|
.. | .. |
---|
3347 | 3575 | |
---|
3348 | 3576 | void CopyChanged(Object3D obj) |
---|
3349 | 3577 | { |
---|
| 3578 | + SetUndoStates(); |
---|
| 3579 | + |
---|
3350 | 3580 | boolean temp = CameraPane.SWITCH; |
---|
3351 | 3581 | CameraPane.SWITCH = false; |
---|
3352 | 3582 | |
---|
.. | .. |
---|
3386 | 3616 | refreshContents(); |
---|
3387 | 3617 | } |
---|
3388 | 3618 | |
---|
| 3619 | + cButton undoButton; |
---|
| 3620 | + cButton redoButton; |
---|
| 3621 | + |
---|
| 3622 | + void SetUndoStates() |
---|
| 3623 | + { |
---|
| 3624 | + cRadio tab = GetCurrentTab(); |
---|
| 3625 | + |
---|
| 3626 | + undoButton.setEnabled(tab.undoindex > 0); |
---|
| 3627 | + redoButton.setEnabled(tab.graphs[tab.undoindex + 1] != null); |
---|
| 3628 | + } |
---|
| 3629 | + |
---|
3389 | 3630 | public void Undo() |
---|
3390 | 3631 | { |
---|
| 3632 | + System.err.println("Undo"); |
---|
| 3633 | + |
---|
3391 | 3634 | cRadio tab = GetCurrentTab(); |
---|
3392 | 3635 | |
---|
3393 | 3636 | if (tab.undoindex == 0) |
---|
.. | .. |
---|
3571 | 3814 | assert false; |
---|
3572 | 3815 | } |
---|
3573 | 3816 | |
---|
3574 | | - void EditSelection() |
---|
| 3817 | + void EditSelection(boolean newWindow) |
---|
3575 | 3818 | { |
---|
3576 | 3819 | } |
---|
3577 | 3820 | |
---|
.. | .. |
---|
4066 | 4309 | |
---|
4067 | 4310 | void makeSomething(Object3D thing, boolean resetmodel) // deselect) |
---|
4068 | 4311 | { |
---|
4069 | | - Save(); |
---|
| 4312 | + if (Globals.SAVEONMAKE) // && resetmodel) |
---|
| 4313 | + Save(); |
---|
4070 | 4314 | //Tween.set(thing, 0).target(1).start(tweenManager); |
---|
4071 | 4315 | //Tween.to(thing, 0, 0.5f).target(0).start(tweenManager); |
---|
4072 | 4316 | // if (thing instanceof GenericJointDemo) |
---|
.. | .. |
---|
4153 | 4397 | { |
---|
4154 | 4398 | ResetModel(); |
---|
4155 | 4399 | Select(thing.GetTreePath(), true, false); // unselect... false); |
---|
| 4400 | + |
---|
| 4401 | + if (thing.Size() == 0) |
---|
| 4402 | + { |
---|
| 4403 | + //EditSelection(false); |
---|
| 4404 | + } |
---|
| 4405 | + |
---|
4156 | 4406 | refreshContents(); |
---|
4157 | 4407 | } |
---|
4158 | 4408 | |
---|
.. | .. |
---|
4290 | 4540 | |
---|
4291 | 4541 | try |
---|
4292 | 4542 | { |
---|
| 4543 | + // Try compressed version first. |
---|
4293 | 4544 | java.io.FileInputStream istream = new java.io.FileInputStream(fullname); |
---|
4294 | 4545 | java.util.zip.GZIPInputStream zstream = new java.util.zip.GZIPInputStream(istream); |
---|
4295 | 4546 | java.io.ObjectInputStream p = new java.io.ObjectInputStream(zstream); |
---|
.. | .. |
---|
4359 | 4610 | |
---|
4360 | 4611 | void LoadIt(Object obj) |
---|
4361 | 4612 | { |
---|
| 4613 | + if (obj == null) |
---|
| 4614 | + { |
---|
| 4615 | + // Invalid file |
---|
| 4616 | + return; |
---|
| 4617 | + } |
---|
| 4618 | + |
---|
4362 | 4619 | System.out.println("Loaded " + obj); |
---|
4363 | 4620 | //new Exception().printStackTrace(); |
---|
4364 | 4621 | Object3D readobj = (Object3D) obj; |
---|
.. | .. |
---|
4368 | 4625 | |
---|
4369 | 4626 | if (readobj != null) |
---|
4370 | 4627 | { |
---|
| 4628 | + if (Globals.SAVEONMAKE) |
---|
4371 | 4629 | Save(); |
---|
4372 | 4630 | try |
---|
4373 | 4631 | { |
---|
.. | .. |
---|
4546 | 4804 | String filename = browser.getFile(); |
---|
4547 | 4805 | if (filename != null && filename.length() > 0) |
---|
4548 | 4806 | { |
---|
| 4807 | + if (!filename.endsWith(".gfd")) |
---|
| 4808 | + filename += ".gfd"; |
---|
4549 | 4809 | lastname = browser.getDirectory() + filename; |
---|
4550 | 4810 | save(); |
---|
4551 | 4811 | } |
---|
.. | .. |
---|
4739 | 4999 | CheckboxMenuItem togglePaintItem; |
---|
4740 | 5000 | JSplitPane mainPanel; |
---|
4741 | 5001 | JScrollPane scrollpane; |
---|
| 5002 | + |
---|
4742 | 5003 | JPanel toolbarPanel; |
---|
| 5004 | + |
---|
4743 | 5005 | cGridBag treePanel; |
---|
| 5006 | + |
---|
4744 | 5007 | JPanel radioPanel; |
---|
4745 | 5008 | ButtonGroup buttonGroup; |
---|
4746 | | - cGridBag ctrlPanel; |
---|
| 5009 | + |
---|
| 5010 | + cGridBag toolboxPanel; |
---|
4747 | 5011 | cGridBag materialPanel; |
---|
| 5012 | + cGridBag ctrlPanel; |
---|
| 5013 | + |
---|
4748 | 5014 | JScrollPane infoPanel; |
---|
| 5015 | + |
---|
4749 | 5016 | cGridBag optionsPanel; |
---|
| 5017 | + |
---|
4750 | 5018 | JTabbedPane objectPanel; |
---|
| 5019 | + boolean materialFlushed; |
---|
| 5020 | + Object3D latestObject; |
---|
| 5021 | + |
---|
4751 | 5022 | cGridBag XYZPanel; |
---|
| 5023 | + |
---|
4752 | 5024 | JSplitPane gridPanel; |
---|
4753 | 5025 | JSplitPane bigPanel; |
---|
| 5026 | + |
---|
4754 | 5027 | cGridBag bigThree; |
---|
4755 | 5028 | cGridBag scenePanel; |
---|
4756 | 5029 | cGridBag centralPanel; |
---|
.. | .. |
---|
4865 | 5138 | cNumberSlider fogField; |
---|
4866 | 5139 | JLabel opacityPowerLabel; |
---|
4867 | 5140 | cNumberSlider opacityPowerField; |
---|
4868 | | - JTree jTree; |
---|
| 5141 | + cTree jTree; |
---|
4869 | 5142 | //ObjectUI parent; |
---|
4870 | 5143 | |
---|
4871 | 5144 | cNumberSlider normalpushField; |
---|