.. | .. |
---|
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.*; |
---|
.. | .. |
---|
35 | 36 | |
---|
36 | 37 | GroupEditor callee; |
---|
37 | 38 | JFrame frame; |
---|
| 39 | + |
---|
| 40 | + static ObjEditor theFrame; |
---|
| 41 | + |
---|
| 42 | + cButton GetButton(String name, boolean border) |
---|
| 43 | + { |
---|
| 44 | + try |
---|
| 45 | + { |
---|
| 46 | + ImageIcon icon = GetIcon(name); |
---|
| 47 | + return new cButton(icon, border); |
---|
| 48 | + } |
---|
| 49 | + catch (Exception e) |
---|
| 50 | + { |
---|
| 51 | + return new cButton(name, border); |
---|
| 52 | + } |
---|
| 53 | + } |
---|
| 54 | + |
---|
| 55 | + cToggleButton GetToggleButton(String name, boolean border) |
---|
| 56 | + { |
---|
| 57 | + try |
---|
| 58 | + { |
---|
| 59 | + ImageIcon icon = GetIcon(name); |
---|
| 60 | + return new cToggleButton(icon, border); |
---|
| 61 | + } |
---|
| 62 | + catch (Exception e) |
---|
| 63 | + { |
---|
| 64 | + return new cToggleButton(name, border); |
---|
| 65 | + } |
---|
| 66 | + } |
---|
| 67 | + |
---|
| 68 | + cCheckBox GetCheckBox(String name, boolean border) |
---|
| 69 | + { |
---|
| 70 | + try |
---|
| 71 | + { |
---|
| 72 | + ImageIcon icon = GetIcon(name); |
---|
| 73 | + return new cCheckBox(icon, border); |
---|
| 74 | + } |
---|
| 75 | + catch (Exception e) |
---|
| 76 | + { |
---|
| 77 | + return new cCheckBox(name, border); |
---|
| 78 | + } |
---|
| 79 | + } |
---|
| 80 | + |
---|
| 81 | + private ImageIcon GetIcon(String name) throws IOException |
---|
| 82 | + { |
---|
| 83 | + BufferedImage image = javax.imageio.ImageIO.read(getClass().getClassLoader().getResourceAsStream(name)); |
---|
| 84 | + |
---|
| 85 | + if (image.getWidth() != 24 && image.getHeight() != 24) |
---|
| 86 | + { |
---|
| 87 | + BufferedImage resized = new BufferedImage(24, 24, image.getType()); |
---|
| 88 | + Graphics2D g = resized.createGraphics(); |
---|
| 89 | + g.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR); |
---|
| 90 | + //g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); |
---|
| 91 | + g.drawImage(image, 0, 0, 24, 24, 0, 0, image.getWidth(), image.getHeight(), null); |
---|
| 92 | + g.dispose(); |
---|
| 93 | + |
---|
| 94 | + image = resized; |
---|
| 95 | + } |
---|
| 96 | + |
---|
| 97 | + javax.swing.ImageIcon icon = new javax.swing.ImageIcon(image); |
---|
| 98 | + return icon; |
---|
| 99 | + } |
---|
38 | 100 | |
---|
39 | 101 | // SCRIPT |
---|
40 | 102 | |
---|
.. | .. |
---|
168 | 230 | // objEditor.ctrlPanel.remove(remarkButton); |
---|
169 | 231 | |
---|
170 | 232 | objEditor.ctrlPanel.remove(setupPanel); |
---|
171 | | - objEditor.ctrlPanel.remove(commandsPanel); |
---|
| 233 | + objEditor.ctrlPanel.remove(setupPanel2); |
---|
| 234 | + objEditor.ctrlPanel.remove(objectCommandsPanel); |
---|
172 | 235 | objEditor.ctrlPanel.remove(pushPanel); |
---|
173 | 236 | //objEditor.ctrlPanel.remove(fillPanel); |
---|
174 | 237 | |
---|
.. | .. |
---|
243 | 306 | //localCopy.parent = null; |
---|
244 | 307 | |
---|
245 | 308 | frame = new JFrame(); |
---|
| 309 | + frame.setUndecorated(true); |
---|
246 | 310 | objEditor = this; |
---|
247 | 311 | this.callee = callee; |
---|
248 | 312 | |
---|
.. | .. |
---|
278 | 342 | frame.setMenuBar(menuBar = new MenuBar()); |
---|
279 | 343 | menuBar.add(fileMenu = new Menu("File")); |
---|
280 | 344 | fileMenu.add(newItem = new MenuItem("New")); |
---|
281 | | - fileMenu.add(loadItem = new MenuItem("Load...")); |
---|
| 345 | + fileMenu.add(loadItem = new MenuItem("Open...")); |
---|
282 | 346 | |
---|
283 | 347 | //oe.menuBar.add(menu = new Menu("Include")); |
---|
284 | 348 | Menu menu = new Menu("Import"); |
---|
.. | .. |
---|
319 | 383 | closeItem.addActionListener(this); |
---|
320 | 384 | |
---|
321 | 385 | objectPanel = new JTabbedPane(); |
---|
| 386 | + |
---|
| 387 | + ChangeListener changeListener = new ChangeListener() |
---|
| 388 | + { |
---|
| 389 | + public void stateChanged(ChangeEvent changeEvent) |
---|
| 390 | + { |
---|
| 391 | +// if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Material") && !materialFlushed) |
---|
| 392 | +// { |
---|
| 393 | +// if (latestObject != null) |
---|
| 394 | +// { |
---|
| 395 | +// refreshContents(true); |
---|
| 396 | +// SetMaterial(latestObject); |
---|
| 397 | +// } |
---|
| 398 | +// |
---|
| 399 | +// materialFlushed = true; |
---|
| 400 | +// } |
---|
| 401 | + |
---|
| 402 | + refreshContents(false); // To refresh Info tab |
---|
| 403 | + } |
---|
| 404 | + }; |
---|
| 405 | + objectPanel.addChangeListener(changeListener); |
---|
| 406 | + |
---|
322 | 407 | toolbarPanel = new JPanel(); |
---|
323 | 408 | toolbarPanel.setName("Toolbar"); |
---|
324 | 409 | treePanel = new cGridBag(); |
---|
325 | 410 | treePanel.setName("Tree"); |
---|
| 411 | + |
---|
| 412 | + editPanel = new cGridBag().setVertical(true); |
---|
| 413 | + editPanel.setName("Edit"); |
---|
| 414 | + |
---|
326 | 415 | ctrlPanel = new cGridBag().setVertical(false); // new GridBagLayout()); |
---|
327 | | - ctrlPanel.setName("Edit"); |
---|
| 416 | + |
---|
| 417 | + editCommandsPanel = new cGridBag(); |
---|
| 418 | + editPanel.add(editCommandsPanel); |
---|
| 419 | + editPanel.add(ctrlPanel); |
---|
| 420 | + |
---|
| 421 | + toolboxPanel = new cGridBag().setVertical(false); |
---|
| 422 | + toolboxPanel.setName("Toolbox"); |
---|
| 423 | + |
---|
328 | 424 | materialPanel = new cGridBag().setVertical(true); |
---|
329 | 425 | materialPanel.setName("Material"); |
---|
| 426 | + |
---|
330 | 427 | /*JTextPane*/ |
---|
331 | 428 | infoarea = createTextPane(); |
---|
332 | 429 | doc = infoarea.getStyledDocument(); |
---|
.. | .. |
---|
419 | 516 | e.printStackTrace(); |
---|
420 | 517 | } |
---|
421 | 518 | |
---|
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(); |
---|
| 519 | +// String selection = infoarea.getText(); |
---|
| 520 | +// java.awt.datatransfer.StringSelection data = new java.awt.datatransfer.StringSelection(selection); |
---|
| 521 | +// java.awt.datatransfer.Clipboard clipboard = |
---|
| 522 | +// Toolkit.getDefaultToolkit().getSystemClipboard(); |
---|
426 | 523 | //clipboard.setContents(data, data); |
---|
427 | 524 | } |
---|
428 | 525 | |
---|
.. | .. |
---|
582 | 679 | } |
---|
583 | 680 | } |
---|
584 | 681 | |
---|
| 682 | +static GraphicsDevice device = GraphicsEnvironment |
---|
| 683 | + .getLocalGraphicsEnvironment().getScreenDevices()[0]; |
---|
| 684 | + |
---|
| 685 | + Rectangle keeprect; |
---|
| 686 | + cRadio radio; |
---|
| 687 | + |
---|
| 688 | +cButton keepButton; |
---|
| 689 | + cButton twoButton; // Full 3D |
---|
| 690 | + cButton sixButton; |
---|
| 691 | + cButton threeButton; |
---|
| 692 | + cButton sevenButton; |
---|
| 693 | + cButton fourButton; // full panel |
---|
| 694 | + cButton oneButton; // full XYZ |
---|
| 695 | + //cButton currentLayout; |
---|
| 696 | + |
---|
| 697 | + boolean maximized; |
---|
| 698 | + |
---|
| 699 | + cButton fullscreenLayout; |
---|
| 700 | + |
---|
| 701 | + void Minimize() |
---|
| 702 | + { |
---|
| 703 | + frame.setState(Frame.ICONIFIED); |
---|
| 704 | + } |
---|
| 705 | + |
---|
| 706 | + void Maximize() |
---|
| 707 | + { |
---|
| 708 | + if (maximized) |
---|
| 709 | + { |
---|
| 710 | + frame.setBounds(keeprect.x, keeprect.y, keeprect.width, keeprect.height); |
---|
| 711 | + } |
---|
| 712 | + else |
---|
| 713 | + { |
---|
| 714 | + keeprect = frame.getBounds(); |
---|
| 715 | + Rectangle rect = GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds(); |
---|
| 716 | + Dimension rect2 = frame.getToolkit().getScreenSize(); |
---|
| 717 | + frame.setBounds(0, rect2.height - rect.height, rect.width, rect.height); |
---|
| 718 | +// frame.setState(Frame.MAXIMIZED_BOTH); |
---|
| 719 | + } |
---|
| 720 | + |
---|
| 721 | + maximized ^= true; |
---|
| 722 | + } |
---|
| 723 | + |
---|
585 | 724 | void ToggleFullScreen() |
---|
586 | 725 | { |
---|
587 | 726 | if (CameraPane.FULLSCREEN) |
---|
588 | 727 | { |
---|
589 | | - frame.getContentPane().remove(/*"Center",*/bigThree); |
---|
590 | | - framePanel.add(bigThree); |
---|
591 | | - frame.getContentPane().add(/*"Center",*/framePanel); |
---|
| 728 | + device.setFullScreenWindow(null); |
---|
| 729 | + //frame.setVisible(false); |
---|
| 730 | +// frame.removeNotify(); |
---|
| 731 | +// frame.setUndecorated(false); |
---|
| 732 | +// frame.addNotify(); |
---|
| 733 | + //frame.setBounds(keeprect.x, keeprect.y, keeprect.width, keeprect.height); |
---|
| 734 | + |
---|
| 735 | +// X frame.getContentPane().remove(/*"Center",*/bigThree); |
---|
| 736 | +// X framePanel.add(bigThree); |
---|
| 737 | +// X frame.getContentPane().add(/*"Center",*/framePanel); |
---|
| 738 | + framePanel.setDividerLocation(1); |
---|
| 739 | + |
---|
| 740 | + //frame.setVisible(true); |
---|
| 741 | + radio.layout = keepButton; |
---|
| 742 | + //theFrame = null; |
---|
| 743 | + keepButton = null; |
---|
| 744 | + radio.layout.doClick(); |
---|
| 745 | + |
---|
592 | 746 | } else |
---|
593 | 747 | { |
---|
594 | | - frame.getContentPane().remove(/*"Center",*/framePanel); |
---|
595 | | - framePanel.remove(bigThree); |
---|
596 | | - frame.getContentPane().add(/*"Center",*/bigThree); |
---|
| 748 | + keepButton = radio.layout; |
---|
| 749 | + //keeprect = frame.getBounds(); |
---|
| 750 | +// frame.setBounds(0, 0, frame.getToolkit().getScreenSize().width, |
---|
| 751 | +// frame.getToolkit().getScreenSize().height); |
---|
| 752 | + //frame.setVisible(false); |
---|
| 753 | + device.setFullScreenWindow(frame); |
---|
| 754 | +// frame.removeNotify(); |
---|
| 755 | +// frame.setUndecorated(true); |
---|
| 756 | +// frame.addNotify(); |
---|
| 757 | +// X frame.getContentPane().remove(/*"Center",*/framePanel); |
---|
| 758 | +// X framePanel.remove(bigThree); |
---|
| 759 | +// X frame.getContentPane().add(/*"Center",*/bigThree); |
---|
| 760 | + framePanel.setDividerLocation(0); |
---|
| 761 | + |
---|
| 762 | + radio.layout = fullscreenLayout; |
---|
| 763 | + radio.layout.doClick(); |
---|
| 764 | + //frame.setVisible(true); |
---|
597 | 765 | } |
---|
| 766 | + |
---|
598 | 767 | cameraView.ToggleFullScreen(); |
---|
599 | 768 | } |
---|
600 | 769 | |
---|
.. | .. |
---|
736 | 905 | JCheckBox speedupCB; |
---|
737 | 906 | JCheckBox rewindCB; |
---|
738 | 907 | JCheckBox flipVCB; |
---|
| 908 | + |
---|
| 909 | + cCheckBox toggleTextureCB; |
---|
| 910 | + cCheckBox toggleSwitchCB; |
---|
| 911 | + |
---|
739 | 912 | JComboBox texresMenu; |
---|
| 913 | + |
---|
740 | 914 | JButton resetButton; |
---|
741 | 915 | JButton stepButton; |
---|
742 | 916 | JButton stepAllButton; |
---|
.. | .. |
---|
745 | 919 | JButton fasterButton; |
---|
746 | 920 | JButton remarkButton; |
---|
747 | 921 | |
---|
| 922 | + cGridBag editPanel; |
---|
| 923 | + cGridBag editCommandsPanel; |
---|
| 924 | + |
---|
748 | 925 | cGridBag namePanel; |
---|
749 | 926 | cGridBag setupPanel; |
---|
750 | | - cGridBag commandsPanel; |
---|
| 927 | + cGridBag setupPanel2; |
---|
| 928 | + cGridBag objectCommandsPanel; |
---|
751 | 929 | cGridBag pushPanel; |
---|
752 | 930 | cGridBag fillPanel; |
---|
753 | 931 | |
---|
.. | .. |
---|
939 | 1117 | markCB = AddCheckBox(setupPanel, "Mark", copy.marked); |
---|
940 | 1118 | markCB.setToolTipText("Set the animation target transform"); |
---|
941 | 1119 | |
---|
942 | | - rewindCB = AddCheckBox(setupPanel, "Rewind", copy.rewind); |
---|
| 1120 | + setupPanel2 = new cGridBag().setVertical(false); |
---|
| 1121 | + |
---|
| 1122 | + rewindCB = AddCheckBox(setupPanel2, "Rewind", copy.rewind); |
---|
943 | 1123 | rewindCB.setToolTipText("Rewind animation"); |
---|
944 | 1124 | |
---|
945 | | - randomCB = AddCheckBox(setupPanel, "Random", copy.random); |
---|
946 | | - randomCB.setToolTipText("Option for switch node"); |
---|
| 1125 | + randomCB = AddCheckBox(setupPanel2, "Rand", copy.random); |
---|
| 1126 | + randomCB.setToolTipText("Randomly Rewind or Go back and forth"); |
---|
947 | 1127 | |
---|
948 | 1128 | if (Globals.ADVANCED) |
---|
949 | 1129 | { |
---|
950 | | - link2masterCB = AddCheckBox(setupPanel, "Support", copy.link2master); |
---|
| 1130 | + link2masterCB = AddCheckBox(setupPanel2, "Supp", copy.link2master); |
---|
951 | 1131 | link2masterCB.setToolTipText("Attach to support"); |
---|
952 | | - speedupCB = AddCheckBox(setupPanel, "Speed", copy.speedup); |
---|
| 1132 | + speedupCB = AddCheckBox(setupPanel2, "Speed", copy.speedup); |
---|
953 | 1133 | speedupCB.setToolTipText("Option motion capture"); |
---|
954 | 1134 | } |
---|
955 | 1135 | |
---|
956 | 1136 | oe.ctrlPanel.add(setupPanel); |
---|
957 | 1137 | oe.ctrlPanel.Return(); |
---|
| 1138 | + oe.ctrlPanel.add(setupPanel2); |
---|
| 1139 | + oe.ctrlPanel.Return(); |
---|
958 | 1140 | |
---|
959 | | - commandsPanel = new cGridBag().setVertical(false); |
---|
| 1141 | + objectCommandsPanel = new cGridBag().setVertical(false); |
---|
960 | 1142 | |
---|
961 | | - resetButton = AddButton(commandsPanel, "Reset"); |
---|
| 1143 | + resetButton = AddButton(objectCommandsPanel, "Reset"); |
---|
962 | 1144 | resetButton.setToolTipText("Jump to frame zero"); |
---|
963 | | - stepButton = AddButton(commandsPanel, "Step"); |
---|
| 1145 | + stepButton = AddButton(objectCommandsPanel, "Step"); |
---|
964 | 1146 | stepButton.setToolTipText("Step one frame"); |
---|
965 | 1147 | // resetAllButton = AddButton(oe, "Reset All"); |
---|
966 | 1148 | // stepAllButton = AddButton(oe, "Step All"); |
---|
967 | 1149 | // Return(); |
---|
968 | | - slowerButton = AddButton(commandsPanel, "Slow"); |
---|
| 1150 | + slowerButton = AddButton(objectCommandsPanel, "Slow"); |
---|
969 | 1151 | slowerButton.setToolTipText("Decrease animation speed"); |
---|
970 | | - fasterButton = AddButton(commandsPanel, "Fast"); |
---|
| 1152 | + fasterButton = AddButton(objectCommandsPanel, "Fast"); |
---|
971 | 1153 | fasterButton.setToolTipText("Increase animation speed"); |
---|
972 | | - remarkButton = AddButton(commandsPanel, "Remark"); |
---|
| 1154 | + remarkButton = AddButton(objectCommandsPanel, "Remark"); |
---|
973 | 1155 | remarkButton.setToolTipText("Set the current transform as the target"); |
---|
974 | 1156 | |
---|
975 | | - oe.ctrlPanel.add(commandsPanel); |
---|
| 1157 | + oe.ctrlPanel.add(objectCommandsPanel); |
---|
976 | 1158 | oe.ctrlPanel.Return(); |
---|
977 | 1159 | |
---|
978 | 1160 | pushPanel = AddSlider(oe.ctrlPanel, "Push", -1, 1, copy.NORMALPUSH, 1.1); // To have the buttons |
---|
.. | .. |
---|
1178 | 1360 | //worldPanel.setName("World"); |
---|
1179 | 1361 | centralPanel = new cGridBag(); |
---|
1180 | 1362 | centralPanel.preferredWidth = 20; |
---|
1181 | | - timelinePanel = new JPanel(new BorderLayout()); |
---|
1182 | | - timelineMenubar = new timeflow.app.TimeflowApp().TimeFlowWindow(timelinePanel); |
---|
| 1363 | + |
---|
| 1364 | + if (Globals.ADVANCED) |
---|
| 1365 | + { |
---|
| 1366 | + timelinePanel = new JPanel(new BorderLayout()); |
---|
| 1367 | + timelineMenubar = new timeflow.app.TimeflowApp().TimeFlowWindow(timelinePanel); |
---|
1183 | 1368 | |
---|
1184 | 1369 | cameraPanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, cameraView, timelinePanel); |
---|
1185 | 1370 | cameraPanel.setContinuousLayout(true); |
---|
.. | .. |
---|
1188 | 1373 | // cameraPanel.setDividerSize(9); |
---|
1189 | 1374 | cameraPanel.setResizeWeight(1.0); |
---|
1190 | 1375 | |
---|
| 1376 | + } |
---|
| 1377 | + |
---|
1191 | 1378 | centralPanel.add(cameraView); |
---|
| 1379 | + centralPanel.setFocusable(true); |
---|
1192 | 1380 | //frame.setJMenuBar(timelineMenubar); |
---|
1193 | 1381 | //centralPanel.add(timelinePanel); |
---|
1194 | 1382 | |
---|
.. | .. |
---|
1251 | 1439 | //JScrollPane tmp = new JScrollPane(ctrlPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); |
---|
1252 | 1440 | //tmp.setName("Edit"); |
---|
1253 | 1441 | objectPanel.add(materialPanel); |
---|
| 1442 | + objectPanel.add(toolboxPanel); |
---|
1254 | 1443 | // JPanel north = new JPanel(new BorderLayout()); |
---|
1255 | 1444 | // north.setName("Edit"); |
---|
1256 | 1445 | // north.add(ctrlPanel, BorderLayout.NORTH); |
---|
1257 | 1446 | // objectPanel.add(north); |
---|
1258 | | - objectPanel.add(ctrlPanel); |
---|
| 1447 | + objectPanel.add(editPanel); |
---|
1259 | 1448 | objectPanel.add(infoPanel); |
---|
1260 | 1449 | |
---|
1261 | 1450 | /* |
---|
.. | .. |
---|
1282 | 1471 | JTabbedPane tabbedPane = new JTabbedPane(); |
---|
1283 | 1472 | tabbedPane.add(scrollpane); |
---|
1284 | 1473 | |
---|
1285 | | - tabbedPane.add(FSPane = new cFileSystemPane(this)); |
---|
1286 | | - |
---|
1287 | | - optionsPanel = new cGridBag().setVertical(true); |
---|
| 1474 | + optionsPanel = new cGridBag().setVertical(false); |
---|
1288 | 1475 | |
---|
1289 | 1476 | optionsPanel.setName("Options"); |
---|
1290 | 1477 | |
---|
.. | .. |
---|
1292 | 1479 | |
---|
1293 | 1480 | tabbedPane.add(optionsPanel); |
---|
1294 | 1481 | |
---|
| 1482 | + tabbedPane.add(FSPane = new cFileSystemPane(this)); |
---|
| 1483 | + |
---|
1295 | 1484 | scenePanel.add(tabbedPane); |
---|
1296 | 1485 | |
---|
1297 | 1486 | /* |
---|
.. | .. |
---|
1384 | 1573 | // aConstraints = gbc; // (GridBagConstraints) GrafreeD.clone(gbc); |
---|
1385 | 1574 | |
---|
1386 | 1575 | frame.setSize(1280, 860); |
---|
| 1576 | + |
---|
| 1577 | + frame.validate(); |
---|
1387 | 1578 | frame.setVisible(true); |
---|
1388 | 1579 | |
---|
| 1580 | + cameraView.requestFocusInWindow(); |
---|
| 1581 | + |
---|
1389 | 1582 | gridPanel.setDividerLocation(1.0); |
---|
1390 | 1583 | |
---|
1391 | 1584 | frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); |
---|
.. | .. |
---|
2072 | 2265 | |
---|
2073 | 2266 | void LoadObjFile(String fullname) |
---|
2074 | 2267 | { |
---|
2075 | | - /* |
---|
| 2268 | + System.out.println("Loading " + fullname); |
---|
| 2269 | + /**/ |
---|
2076 | 2270 | //lastFilename = fullname; |
---|
2077 | 2271 | if(loadObjThread == null) |
---|
2078 | 2272 | { |
---|
2079 | | - loadObjThread = new LoadOBJThread(); |
---|
2080 | | - loadObjThread.start(); |
---|
| 2273 | + loadObjThread = new LoadOBJThread(); |
---|
| 2274 | + loadObjThread.start(); |
---|
2081 | 2275 | } |
---|
2082 | 2276 | |
---|
2083 | 2277 | loadObjThread.add(fullname); |
---|
2084 | | - */ |
---|
| 2278 | + /**/ |
---|
2085 | 2279 | |
---|
2086 | | - System.out.println("Loading " + fullname); |
---|
2087 | | - makeSomething(new FileObject(fullname, true), true); |
---|
| 2280 | + //makeSomething(new FileObject(fullname, true), true); |
---|
2088 | 2281 | } |
---|
2089 | 2282 | |
---|
2090 | 2283 | void LoadGFDFile(String fullname) |
---|
.. | .. |
---|
2701 | 2894 | |
---|
2702 | 2895 | void SetMaterial(Object3D object) |
---|
2703 | 2896 | { |
---|
| 2897 | + latestObject = object; |
---|
| 2898 | + |
---|
2704 | 2899 | cMaterial mat = object.material; |
---|
2705 | 2900 | |
---|
2706 | 2901 | if (mat == null) |
---|
.. | .. |
---|
2886 | 3081 | cameraView.ToggleDL(); |
---|
2887 | 3082 | cameraView.repaint(); |
---|
2888 | 3083 | return; |
---|
2889 | | - } else if (event.getSource() == toggleTextureItem) |
---|
| 3084 | + } else if (event.getSource() == toggleTextureItem || event.getSource() == toggleTextureCB) |
---|
2890 | 3085 | { |
---|
2891 | 3086 | cameraView.ToggleTexture(); |
---|
2892 | 3087 | // june 2013 copy.HardTouch(); |
---|
.. | .. |
---|
2925 | 3120 | frame.validate(); |
---|
2926 | 3121 | |
---|
2927 | 3122 | return; |
---|
2928 | | - } else if (event.getSource() == toggleSwitchItem) |
---|
| 3123 | + } else if (event.getSource() == toggleSwitchItem || event.getSource() == toggleSwitchCB) |
---|
2929 | 3124 | { |
---|
2930 | 3125 | cameraView.ToggleSwitch(); |
---|
2931 | 3126 | cameraView.repaint(); |
---|
.. | .. |
---|
3214 | 3409 | objEditor.refreshContents(); |
---|
3215 | 3410 | } |
---|
3216 | 3411 | |
---|
3217 | | - static public byte[] Compress(Object o) |
---|
| 3412 | + static public byte[] Compress(Object3D o) |
---|
3218 | 3413 | { |
---|
3219 | 3414 | try |
---|
3220 | 3415 | { |
---|
.. | .. |
---|
3222 | 3417 | java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(baos); |
---|
3223 | 3418 | ObjectOutputStream out = new ObjectOutputStream(zstream); |
---|
3224 | 3419 | |
---|
| 3420 | + Object3D parent = o.parent; |
---|
| 3421 | + o.parent = null; |
---|
| 3422 | + |
---|
3225 | 3423 | out.writeObject(o); |
---|
3226 | 3424 | |
---|
| 3425 | + o.parent = parent; |
---|
| 3426 | + |
---|
3227 | 3427 | out.flush(); |
---|
3228 | 3428 | |
---|
3229 | 3429 | zstream.close(); |
---|
.. | .. |
---|
3304 | 3504 | |
---|
3305 | 3505 | public void Save() |
---|
3306 | 3506 | { |
---|
| 3507 | + System.err.println("Save"); |
---|
| 3508 | + |
---|
3307 | 3509 | cRadio tab = GetCurrentTab(); |
---|
| 3510 | + |
---|
| 3511 | + boolean temp = CameraPane.SWITCH; |
---|
| 3512 | + CameraPane.SWITCH = false; |
---|
3308 | 3513 | |
---|
3309 | 3514 | copy.ExtractBigData(hashtable); |
---|
3310 | 3515 | |
---|
.. | .. |
---|
3312 | 3517 | tab.graphs[tab.undoindex++] = Compress(copy); |
---|
3313 | 3518 | |
---|
3314 | 3519 | copy.RestoreBigData(hashtable); |
---|
| 3520 | + |
---|
| 3521 | + CameraPane.SWITCH = temp; |
---|
3315 | 3522 | |
---|
3316 | 3523 | //assert(hashtable.isEmpty()); |
---|
3317 | 3524 | |
---|
.. | .. |
---|
3342 | 3549 | |
---|
3343 | 3550 | void CopyChanged(Object3D obj) |
---|
3344 | 3551 | { |
---|
| 3552 | + boolean temp = CameraPane.SWITCH; |
---|
| 3553 | + CameraPane.SWITCH = false; |
---|
| 3554 | + |
---|
3345 | 3555 | copy.ExtractBigData(hashtable); |
---|
3346 | 3556 | |
---|
3347 | 3557 | copy.clear(); |
---|
.. | .. |
---|
3352 | 3562 | } |
---|
3353 | 3563 | |
---|
3354 | 3564 | copy.RestoreBigData(hashtable); |
---|
| 3565 | + |
---|
| 3566 | + CameraPane.SWITCH = temp; |
---|
3355 | 3567 | |
---|
3356 | 3568 | //assert(hashtable.isEmpty()); |
---|
3357 | 3569 | |
---|
.. | .. |
---|
3378 | 3590 | |
---|
3379 | 3591 | public void Undo() |
---|
3380 | 3592 | { |
---|
| 3593 | + System.err.println("Undo"); |
---|
| 3594 | + |
---|
3381 | 3595 | cRadio tab = GetCurrentTab(); |
---|
3382 | 3596 | |
---|
3383 | 3597 | if (tab.undoindex == 0) |
---|
.. | .. |
---|
3561 | 3775 | assert false; |
---|
3562 | 3776 | } |
---|
3563 | 3777 | |
---|
3564 | | - void EditSelection() |
---|
| 3778 | + void EditSelection(boolean newWindow) |
---|
3565 | 3779 | { |
---|
3566 | 3780 | } |
---|
3567 | 3781 | |
---|
.. | .. |
---|
4056 | 4270 | |
---|
4057 | 4271 | void makeSomething(Object3D thing, boolean resetmodel) // deselect) |
---|
4058 | 4272 | { |
---|
4059 | | - Save(); |
---|
| 4273 | + if (Globals.SAVEONMAKE) // && resetmodel) |
---|
| 4274 | + Save(); |
---|
4060 | 4275 | //Tween.set(thing, 0).target(1).start(tweenManager); |
---|
4061 | 4276 | //Tween.to(thing, 0, 0.5f).target(0).start(tweenManager); |
---|
4062 | 4277 | // if (thing instanceof GenericJointDemo) |
---|
.. | .. |
---|
4143 | 4358 | { |
---|
4144 | 4359 | ResetModel(); |
---|
4145 | 4360 | Select(thing.GetTreePath(), true, false); // unselect... false); |
---|
| 4361 | + |
---|
| 4362 | + if (thing.Size() == 0) |
---|
| 4363 | + { |
---|
| 4364 | + //EditSelection(false); |
---|
| 4365 | + } |
---|
| 4366 | + |
---|
4146 | 4367 | refreshContents(); |
---|
4147 | 4368 | } |
---|
4148 | 4369 | |
---|
.. | .. |
---|
4280 | 4501 | |
---|
4281 | 4502 | try |
---|
4282 | 4503 | { |
---|
| 4504 | + // Try compressed version first. |
---|
4283 | 4505 | java.io.FileInputStream istream = new java.io.FileInputStream(fullname); |
---|
4284 | 4506 | java.util.zip.GZIPInputStream zstream = new java.util.zip.GZIPInputStream(istream); |
---|
4285 | 4507 | java.io.ObjectInputStream p = new java.io.ObjectInputStream(zstream); |
---|
.. | .. |
---|
4349 | 4571 | |
---|
4350 | 4572 | void LoadIt(Object obj) |
---|
4351 | 4573 | { |
---|
| 4574 | + if (obj == null) |
---|
| 4575 | + { |
---|
| 4576 | + // Invalid file |
---|
| 4577 | + return; |
---|
| 4578 | + } |
---|
| 4579 | + |
---|
4352 | 4580 | System.out.println("Loaded " + obj); |
---|
4353 | 4581 | //new Exception().printStackTrace(); |
---|
4354 | 4582 | Object3D readobj = (Object3D) obj; |
---|
.. | .. |
---|
4358 | 4586 | |
---|
4359 | 4587 | if (readobj != null) |
---|
4360 | 4588 | { |
---|
| 4589 | + if (Globals.SAVEONMAKE) |
---|
4361 | 4590 | Save(); |
---|
4362 | 4591 | try |
---|
4363 | 4592 | { |
---|
.. | .. |
---|
4729 | 4958 | CheckboxMenuItem togglePaintItem; |
---|
4730 | 4959 | JSplitPane mainPanel; |
---|
4731 | 4960 | JScrollPane scrollpane; |
---|
| 4961 | + |
---|
4732 | 4962 | JPanel toolbarPanel; |
---|
| 4963 | + |
---|
4733 | 4964 | cGridBag treePanel; |
---|
| 4965 | + |
---|
4734 | 4966 | JPanel radioPanel; |
---|
4735 | 4967 | ButtonGroup buttonGroup; |
---|
4736 | | - cGridBag ctrlPanel; |
---|
| 4968 | + |
---|
| 4969 | + cGridBag toolboxPanel; |
---|
4737 | 4970 | cGridBag materialPanel; |
---|
| 4971 | + cGridBag ctrlPanel; |
---|
| 4972 | + |
---|
4738 | 4973 | JScrollPane infoPanel; |
---|
| 4974 | + |
---|
4739 | 4975 | cGridBag optionsPanel; |
---|
| 4976 | + |
---|
4740 | 4977 | JTabbedPane objectPanel; |
---|
| 4978 | + boolean materialFlushed; |
---|
| 4979 | + Object3D latestObject; |
---|
| 4980 | + |
---|
4741 | 4981 | cGridBag XYZPanel; |
---|
| 4982 | + |
---|
4742 | 4983 | JSplitPane gridPanel; |
---|
4743 | 4984 | JSplitPane bigPanel; |
---|
| 4985 | + |
---|
4744 | 4986 | cGridBag bigThree; |
---|
4745 | 4987 | cGridBag scenePanel; |
---|
4746 | 4988 | cGridBag centralPanel; |
---|
.. | .. |
---|
4855 | 5097 | cNumberSlider fogField; |
---|
4856 | 5098 | JLabel opacityPowerLabel; |
---|
4857 | 5099 | cNumberSlider opacityPowerField; |
---|
4858 | | - JTree jTree; |
---|
| 5100 | + cTree jTree; |
---|
4859 | 5101 | //ObjectUI parent; |
---|
4860 | 5102 | |
---|
4861 | 5103 | cNumberSlider normalpushField; |
---|