.. | .. |
---|
15 | 15 | //import javax.swing.plaf.ColorUIResource; |
---|
16 | 16 | //import javax.swing.plaf.metal.DefaultMetalTheme; |
---|
17 | 17 | |
---|
| 18 | +import javax.swing.plaf.basic.BasicSplitPaneDivider; |
---|
| 19 | +import javax.swing.plaf.basic.BasicSplitPaneUI; |
---|
| 20 | + |
---|
18 | 21 | //import javax.media.opengl.GLCanvas; |
---|
19 | 22 | |
---|
20 | 23 | import //weka.core. |
---|
.. | .. |
---|
49 | 52 | catch (Exception e) |
---|
50 | 53 | { |
---|
51 | 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); |
---|
52 | 68 | } |
---|
53 | 69 | } |
---|
54 | 70 | |
---|
.. | .. |
---|
194 | 210 | |
---|
195 | 211 | objEditor.ctrlPanel.remove(namePanel); |
---|
196 | 212 | |
---|
197 | | - if (!GroupEditor.allparams) |
---|
| 213 | + if (!allparams) |
---|
198 | 214 | return; |
---|
199 | 215 | |
---|
200 | 216 | // objEditor.ctrlPanel.remove(liveCB); |
---|
.. | .. |
---|
266 | 282 | client = inClient; |
---|
267 | 283 | copy = client; |
---|
268 | 284 | |
---|
| 285 | + if (copy.versions == null) |
---|
| 286 | + { |
---|
| 287 | + copy.versions = new byte[100][]; |
---|
| 288 | + copy.versionindex = -1; |
---|
| 289 | + } |
---|
| 290 | + |
---|
269 | 291 | // "this" is not called: SetupUI2(objEditor); |
---|
270 | 292 | } |
---|
271 | 293 | |
---|
.. | .. |
---|
279 | 301 | client = inClient; |
---|
280 | 302 | copy = client; |
---|
281 | 303 | |
---|
| 304 | + if (copy.versions == null) |
---|
| 305 | + { |
---|
| 306 | + copy.versions = new byte[100][]; |
---|
| 307 | + copy.versionindex = -1; |
---|
| 308 | + } |
---|
| 309 | + |
---|
282 | 310 | SetupUI2(callee.GetEditor()); |
---|
283 | 311 | } |
---|
284 | 312 | |
---|
.. | .. |
---|
293 | 321 | //localCopy.parent = null; |
---|
294 | 322 | |
---|
295 | 323 | frame = new JFrame(); |
---|
296 | | - frame.setUndecorated(true); |
---|
| 324 | + frame.setUndecorated(false); |
---|
297 | 325 | objEditor = this; |
---|
298 | 326 | this.callee = callee; |
---|
299 | 327 | |
---|
.. | .. |
---|
311 | 339 | copy = localCopy; |
---|
312 | 340 | copy.editWindow = this; |
---|
313 | 341 | |
---|
| 342 | + if (copy.versions == null) |
---|
| 343 | + { |
---|
| 344 | + copy.versions = new byte[100][]; |
---|
| 345 | + copy.versionindex = -1; |
---|
| 346 | + } |
---|
| 347 | + |
---|
314 | 348 | SetupMenu(); |
---|
315 | 349 | |
---|
316 | 350 | //SetupName(objEditor); // new |
---|
.. | .. |
---|
324 | 358 | return frame.action(event, obj); |
---|
325 | 359 | } |
---|
326 | 360 | |
---|
| 361 | + // Cannot work without static |
---|
| 362 | + static boolean allparams = true; |
---|
| 363 | + |
---|
| 364 | + static java.util.Vector<Object3D> listUI = new java.util.Vector<Object3D>(); |
---|
| 365 | + |
---|
327 | 366 | void SetupMenu() |
---|
328 | 367 | { |
---|
329 | 368 | frame.setMenuBar(menuBar = new MenuBar()); |
---|
330 | 369 | menuBar.add(fileMenu = new Menu("File")); |
---|
331 | 370 | fileMenu.add(newItem = new MenuItem("New")); |
---|
332 | | - fileMenu.add(loadItem = new MenuItem("Open...")); |
---|
| 371 | + fileMenu.add(openItem = new MenuItem("Open...")); |
---|
333 | 372 | |
---|
334 | 373 | //oe.menuBar.add(menu = new Menu("Include")); |
---|
335 | 374 | Menu menu = new Menu("Import"); |
---|
.. | .. |
---|
361 | 400 | } |
---|
362 | 401 | |
---|
363 | 402 | newItem.addActionListener(this); |
---|
364 | | - loadItem.addActionListener(this); |
---|
| 403 | + openItem.addActionListener(this); |
---|
365 | 404 | saveItem.addActionListener(this); |
---|
366 | 405 | saveAsItem.addActionListener(this); |
---|
367 | 406 | exportAsItem.addActionListener(this); |
---|
.. | .. |
---|
370 | 409 | closeItem.addActionListener(this); |
---|
371 | 410 | |
---|
372 | 411 | objectPanel = new JTabbedPane(); |
---|
| 412 | + |
---|
| 413 | + ChangeListener changeListener = new ChangeListener() |
---|
| 414 | + { |
---|
| 415 | + public void stateChanged(ChangeEvent changeEvent) |
---|
| 416 | + { |
---|
| 417 | +// if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Material") && !materialFlushed) |
---|
| 418 | +// { |
---|
| 419 | +// if (latestObject != null) |
---|
| 420 | +// { |
---|
| 421 | +// refreshContents(true); |
---|
| 422 | +// SetMaterial(latestObject); |
---|
| 423 | +// } |
---|
| 424 | +// |
---|
| 425 | +// materialFlushed = true; |
---|
| 426 | +// } |
---|
| 427 | +// if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Edit")) |
---|
| 428 | +// { |
---|
| 429 | +// if (listUI.size() == 0) |
---|
| 430 | +// EditSelection(false); |
---|
| 431 | +// } |
---|
| 432 | + |
---|
| 433 | + refreshContents(false); // To refresh Info tab |
---|
| 434 | + } |
---|
| 435 | + }; |
---|
| 436 | + objectPanel.addChangeListener(changeListener); |
---|
| 437 | + |
---|
373 | 438 | toolbarPanel = new JPanel(); |
---|
374 | 439 | toolbarPanel.setName("Toolbar"); |
---|
375 | 440 | treePanel = new cGridBag(); |
---|
.. | .. |
---|
384 | 449 | editPanel.add(editCommandsPanel); |
---|
385 | 450 | editPanel.add(ctrlPanel); |
---|
386 | 451 | |
---|
387 | | - materialPanel = new cGridBag().setVertical(true); |
---|
| 452 | + toolboxPanel = new cGridBag().setVertical(false); |
---|
| 453 | + toolboxPanel.setName("Toolbox"); |
---|
388 | 454 | |
---|
| 455 | + materialPanel = new cGridBag().setVertical(true); |
---|
389 | 456 | materialPanel.setName("Material"); |
---|
| 457 | + |
---|
390 | 458 | /*JTextPane*/ |
---|
391 | 459 | infoarea = createTextPane(); |
---|
392 | 460 | doc = infoarea.getStyledDocument(); |
---|
.. | .. |
---|
399 | 467 | // TEXTAREA infoarea.setLineWrap(true); |
---|
400 | 468 | // TEXTAREA infoarea.setWrapStyleWord(true); |
---|
401 | 469 | infoPanel = new JScrollPane(infoarea, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); //AS_NEEDED); |
---|
402 | | - infoPanel.setPreferredSize(new Dimension(50, 200)); |
---|
| 470 | + infoPanel.setPreferredSize(new Dimension(1, 1)); |
---|
403 | 471 | infoPanel.setName("Info"); |
---|
404 | 472 | //infoPanel.setLayout(new BorderLayout()); |
---|
405 | 473 | //infoPanel.add(createTextPane()); |
---|
.. | .. |
---|
411 | 479 | mainPanel.setDividerSize(9); |
---|
412 | 480 | mainPanel.setDividerLocation(0.5); //1.0); |
---|
413 | 481 | mainPanel.setResizeWeight(0.5); |
---|
414 | | - |
---|
| 482 | + |
---|
| 483 | +//mainPanel.setDividerSize((int) (mainPanel.getDividerSize() * 1.5)); |
---|
| 484 | + BasicSplitPaneDivider divider = ( (BasicSplitPaneUI) mainPanel.getUI()).getDivider(); |
---|
| 485 | + divider.setDividerSize(15); |
---|
| 486 | + divider.setBorder(BorderFactory.createTitledBorder(divider.getBorder(), "Custom border title -- gets rid of the one-touch arrows!")); |
---|
| 487 | + |
---|
| 488 | + mainPanel.setUI(new BasicSplitPaneUI()); |
---|
| 489 | + |
---|
415 | 490 | //ctrlPanel.setLayout(new GridLayout(4, 1, 5, 5)); |
---|
416 | 491 | //mainPanel.setLayout(new GridBagLayout()); |
---|
417 | 492 | toolbarPanel.setLayout(new FlowLayout(FlowLayout.LEFT)); |
---|
.. | .. |
---|
642 | 717 | } |
---|
643 | 718 | } |
---|
644 | 719 | |
---|
645 | | -static GraphicsDevice device = GraphicsEnvironment |
---|
646 | | - .getLocalGraphicsEnvironment().getScreenDevices()[0]; |
---|
| 720 | +//static GraphicsDevice device = GraphicsEnvironment |
---|
| 721 | +// .getLocalGraphicsEnvironment().getScreenDevices()[0]; |
---|
647 | 722 | |
---|
648 | 723 | Rectangle keeprect; |
---|
649 | 724 | cRadio radio; |
---|
.. | .. |
---|
659 | 734 | |
---|
660 | 735 | boolean maximized; |
---|
661 | 736 | |
---|
| 737 | + cButton fullscreenLayout; |
---|
| 738 | + |
---|
662 | 739 | void Minimize() |
---|
663 | 740 | { |
---|
664 | 741 | frame.setState(Frame.ICONIFIED); |
---|
| 742 | + frame.validate(); |
---|
665 | 743 | } |
---|
666 | 744 | |
---|
| 745 | +// artifactURI=null, type=0, property=${file.reference.jfxrt.jar}, object=org.netbeans.modules.java.api.common.classpath.ClassPathSupport$RelativePath@6767876f, broken=false, additional={} |
---|
| 746 | +// artifactURI=null, type=0, property=${file.reference.mac-ui.jar}, object=org.netbeans.modules.java.api.common.classpath.ClassPathSupport$RelativePath@16bdc817, broken=false, additional={} |
---|
| 747 | +// artifactURI=null, type=0, property=${file.reference.classes.jar}, object=org.netbeans.modules.java.api.common.classpath.ClassPathSupport$RelativePath@9daa9c17, broken=false, additional={} |
---|
667 | 748 | void Maximize() |
---|
668 | 749 | { |
---|
| 750 | + if (CameraPane.FULLSCREEN) |
---|
| 751 | + { |
---|
| 752 | + ToggleFullScreen(); |
---|
| 753 | + } |
---|
| 754 | + |
---|
669 | 755 | if (maximized) |
---|
670 | 756 | { |
---|
671 | 757 | frame.setBounds(keeprect.x, keeprect.y, keeprect.width, keeprect.height); |
---|
.. | .. |
---|
673 | 759 | else |
---|
674 | 760 | { |
---|
675 | 761 | keeprect = frame.getBounds(); |
---|
676 | | - Rectangle rect = GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds(); |
---|
677 | | - Dimension rect2 = frame.getToolkit().getScreenSize(); |
---|
678 | | - frame.setBounds(0, rect2.height - rect.height, rect.width, rect.height); |
---|
| 762 | +// Rectangle rect = GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds(); |
---|
| 763 | +// Dimension rect2 = frame.getToolkit().getScreenSize(); |
---|
| 764 | +// frame.setBounds(0, rect2.height - rect.height, rect.width, rect.height); |
---|
679 | 765 | // frame.setState(Frame.MAXIMIZED_BOTH); |
---|
| 766 | + frame.setBounds(frame.getGraphicsConfiguration().getBounds()); |
---|
680 | 767 | } |
---|
681 | 768 | |
---|
682 | 769 | maximized ^= true; |
---|
| 770 | + |
---|
| 771 | + frame.validate(); |
---|
683 | 772 | } |
---|
| 773 | + |
---|
| 774 | + cButton minButton; |
---|
| 775 | + cButton maxButton; |
---|
| 776 | + cButton fullButton; |
---|
684 | 777 | |
---|
685 | 778 | void ToggleFullScreen() |
---|
686 | 779 | { |
---|
687 | | - if (CameraPane.FULLSCREEN) |
---|
| 780 | +GraphicsDevice device = frame.getGraphicsConfiguration().getDevice(); |
---|
| 781 | + |
---|
| 782 | + cameraView.ToggleFullScreen(); |
---|
| 783 | + |
---|
| 784 | + if (!CameraPane.FULLSCREEN) |
---|
688 | 785 | { |
---|
689 | 786 | device.setFullScreenWindow(null); |
---|
| 787 | + frame.dispose(); |
---|
| 788 | + frame.setUndecorated(false); |
---|
| 789 | + frame.validate(); |
---|
| 790 | + frame.setVisible(true); |
---|
| 791 | + |
---|
690 | 792 | //frame.setVisible(false); |
---|
691 | 793 | // frame.removeNotify(); |
---|
692 | 794 | // frame.setUndecorated(false); |
---|
.. | .. |
---|
696 | 798 | // X frame.getContentPane().remove(/*"Center",*/bigThree); |
---|
697 | 799 | // X framePanel.add(bigThree); |
---|
698 | 800 | // X frame.getContentPane().add(/*"Center",*/framePanel); |
---|
699 | | - framePanel.setDividerLocation(1); |
---|
| 801 | + framePanel.setDividerLocation(46); |
---|
700 | 802 | |
---|
701 | 803 | //frame.setVisible(true); |
---|
702 | 804 | radio.layout = keepButton; |
---|
.. | .. |
---|
711 | 813 | // frame.setBounds(0, 0, frame.getToolkit().getScreenSize().width, |
---|
712 | 814 | // frame.getToolkit().getScreenSize().height); |
---|
713 | 815 | //frame.setVisible(false); |
---|
| 816 | + |
---|
| 817 | + frame.dispose(); |
---|
| 818 | + frame.setUndecorated(true); |
---|
714 | 819 | device.setFullScreenWindow(frame); |
---|
| 820 | + frame.validate(); |
---|
| 821 | + frame.setVisible(true); |
---|
715 | 822 | // frame.removeNotify(); |
---|
716 | 823 | // frame.setUndecorated(true); |
---|
717 | 824 | // frame.addNotify(); |
---|
.. | .. |
---|
720 | 827 | // X frame.getContentPane().add(/*"Center",*/bigThree); |
---|
721 | 828 | framePanel.setDividerLocation(0); |
---|
722 | 829 | |
---|
723 | | - radio.layout = twoButton; |
---|
| 830 | + radio.layout = fullscreenLayout; |
---|
724 | 831 | radio.layout.doClick(); |
---|
725 | 832 | //frame.setVisible(true); |
---|
726 | 833 | } |
---|
727 | | - |
---|
728 | | - cameraView.ToggleFullScreen(); |
---|
| 834 | + frame.validate(); |
---|
729 | 835 | } |
---|
| 836 | + |
---|
| 837 | + private byte[] CompressCopy() |
---|
| 838 | + { |
---|
| 839 | + boolean temp = CameraPane.SWITCH; |
---|
| 840 | + CameraPane.SWITCH = false; |
---|
| 841 | + |
---|
| 842 | + copy.ExtractBigData(versiontable); |
---|
| 843 | + // if (copy == client) |
---|
| 844 | + |
---|
| 845 | + byte[] versions[] = copy.versions; |
---|
| 846 | + copy.versions = null; |
---|
| 847 | + |
---|
| 848 | + byte[] compress = Compress(copy); |
---|
| 849 | + |
---|
| 850 | + copy.versions = versions; |
---|
| 851 | + |
---|
| 852 | + copy.RestoreBigData(versiontable); |
---|
| 853 | + |
---|
| 854 | + CameraPane.SWITCH = temp; |
---|
| 855 | + |
---|
| 856 | + return compress; |
---|
| 857 | + } |
---|
730 | 858 | |
---|
731 | 859 | private JTextPane createTextPane() |
---|
732 | 860 | { |
---|
.. | .. |
---|
866 | 994 | JCheckBox speedupCB; |
---|
867 | 995 | JCheckBox rewindCB; |
---|
868 | 996 | JCheckBox flipVCB; |
---|
| 997 | + |
---|
| 998 | + cCheckBox toggleTextureCB; |
---|
| 999 | + cCheckBox toggleSwitchCB; |
---|
| 1000 | + |
---|
869 | 1001 | JComboBox texresMenu; |
---|
| 1002 | + |
---|
870 | 1003 | JButton resetButton; |
---|
871 | 1004 | JButton stepButton; |
---|
872 | 1005 | JButton stepAllButton; |
---|
.. | .. |
---|
1053 | 1186 | namePanel = new cGridBag(); |
---|
1054 | 1187 | |
---|
1055 | 1188 | nameField = AddText(namePanel, copy.GetName()); |
---|
1056 | | - namePanel.add(nameField); |
---|
| 1189 | + namePanel.add(new JScrollPane(nameField, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER)); |
---|
1057 | 1190 | oe.ctrlPanel.add(namePanel); |
---|
1058 | 1191 | |
---|
1059 | 1192 | oe.ctrlPanel.Return(); |
---|
1060 | 1193 | |
---|
1061 | | - if (!GroupEditor.allparams) |
---|
| 1194 | + if (!allparams) |
---|
1062 | 1195 | return; |
---|
1063 | 1196 | |
---|
1064 | 1197 | setupPanel = new cGridBag().setVertical(false); |
---|
.. | .. |
---|
1071 | 1204 | hideCB = AddCheckBox(setupPanel, "Hide", copy.hide); |
---|
1072 | 1205 | hideCB.setToolTipText("Hide object"); |
---|
1073 | 1206 | markCB = AddCheckBox(setupPanel, "Mark", copy.marked); |
---|
1074 | | - markCB.setToolTipText("Set the animation target transform"); |
---|
| 1207 | + markCB.setToolTipText("As animation target transform"); |
---|
1075 | 1208 | |
---|
1076 | 1209 | setupPanel2 = new cGridBag().setVertical(false); |
---|
1077 | 1210 | |
---|
1078 | 1211 | rewindCB = AddCheckBox(setupPanel2, "Rewind", copy.rewind); |
---|
1079 | 1212 | rewindCB.setToolTipText("Rewind animation"); |
---|
1080 | 1213 | |
---|
1081 | | - randomCB = AddCheckBox(setupPanel2, "Rand", copy.random); |
---|
1082 | | - randomCB.setToolTipText("Randomly Rewind or Go back and forth"); |
---|
| 1214 | + randomCB = AddCheckBox(setupPanel2, "Random", copy.random); |
---|
| 1215 | + randomCB.setToolTipText("Randomly Rewind (or Go back and forth)"); |
---|
1083 | 1216 | |
---|
| 1217 | + link2masterCB = AddCheckBox(setupPanel2, "Support", copy.link2master); |
---|
| 1218 | + link2masterCB.setToolTipText("Attach to support"); |
---|
| 1219 | + |
---|
1084 | 1220 | if (Globals.ADVANCED) |
---|
1085 | 1221 | { |
---|
1086 | | - link2masterCB = AddCheckBox(setupPanel2, "Supp", copy.link2master); |
---|
1087 | | - link2masterCB.setToolTipText("Attach to support"); |
---|
1088 | 1222 | speedupCB = AddCheckBox(setupPanel2, "Speed", copy.speedup); |
---|
1089 | 1223 | speedupCB.setToolTipText("Option motion capture"); |
---|
1090 | 1224 | } |
---|
.. | .. |
---|
1400 | 1534 | // north.add(ctrlPanel, BorderLayout.NORTH); |
---|
1401 | 1535 | // objectPanel.add(north); |
---|
1402 | 1536 | objectPanel.add(editPanel); |
---|
1403 | | - objectPanel.add(infoPanel); |
---|
| 1537 | + |
---|
| 1538 | + //if (Globals.ADVANCED) |
---|
| 1539 | + objectPanel.add(infoPanel); |
---|
| 1540 | + |
---|
| 1541 | + objectPanel.add(toolboxPanel); |
---|
1404 | 1542 | |
---|
1405 | 1543 | /* |
---|
1406 | 1544 | aConstraints.gridx = 0; |
---|
.. | .. |
---|
1409 | 1547 | aConstraints.gridy += 1; |
---|
1410 | 1548 | aConstraints.gridwidth = 1; |
---|
1411 | 1549 | mainPanel.add(objectPanel, aConstraints); |
---|
1412 | | - */ |
---|
| 1550 | + */ |
---|
1413 | 1551 | |
---|
1414 | 1552 | scrollpane = new JScrollPane(mainPanel, ScrollPaneConstants.// VERTICAL_SCROLLBAR_ALWAYS, |
---|
1415 | 1553 | VERTICAL_SCROLLBAR_AS_NEEDED, |
---|
.. | .. |
---|
1426 | 1564 | JTabbedPane tabbedPane = new JTabbedPane(); |
---|
1427 | 1565 | tabbedPane.add(scrollpane); |
---|
1428 | 1566 | |
---|
1429 | | - tabbedPane.add(FSPane = new cFileSystemPane(this)); |
---|
1430 | | - |
---|
1431 | | - optionsPanel = new cGridBag().setVertical(true); |
---|
| 1567 | + optionsPanel = new cGridBag().setVertical(false); |
---|
1432 | 1568 | |
---|
1433 | 1569 | optionsPanel.setName("Options"); |
---|
1434 | 1570 | |
---|
.. | .. |
---|
1436 | 1572 | |
---|
1437 | 1573 | tabbedPane.add(optionsPanel); |
---|
1438 | 1574 | |
---|
| 1575 | + tabbedPane.add(FSPane = new cFileSystemPane(this)); |
---|
| 1576 | + |
---|
1439 | 1577 | scenePanel.add(tabbedPane); |
---|
1440 | 1578 | |
---|
1441 | 1579 | /* |
---|
.. | .. |
---|
1508 | 1646 | // aConstraints.gridheight = 1; |
---|
1509 | 1647 | |
---|
1510 | 1648 | framePanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, toolbarPanel, bigThree); |
---|
1511 | | - framePanel.setContinuousLayout(true); |
---|
1512 | | - framePanel.setOneTouchExpandable(true); |
---|
1513 | | - framePanel.setDividerLocation(0.8); |
---|
| 1649 | + framePanel.setContinuousLayout(false); |
---|
| 1650 | + framePanel.setOneTouchExpandable(false); |
---|
| 1651 | + //.setDividerLocation(0.8); |
---|
1514 | 1652 | //framePanel.setDividerSize(15); |
---|
1515 | 1653 | //framePanel.setResizeWeight(0.15); |
---|
1516 | 1654 | framePanel.setName("Frame"); |
---|
.. | .. |
---|
1528 | 1666 | // aConstraints = gbc; // (GridBagConstraints) GrafreeD.clone(gbc); |
---|
1529 | 1667 | |
---|
1530 | 1668 | frame.setSize(1280, 860); |
---|
1531 | | - frame.setVisible(true); |
---|
1532 | | - |
---|
| 1669 | + |
---|
1533 | 1670 | cameraView.requestFocusInWindow(); |
---|
1534 | 1671 | |
---|
1535 | 1672 | gridPanel.setDividerLocation(1.0); |
---|
| 1673 | + |
---|
| 1674 | + frame.validate(); |
---|
| 1675 | + |
---|
| 1676 | + frame.setVisible(true); |
---|
1536 | 1677 | |
---|
1537 | 1678 | frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); |
---|
1538 | 1679 | frame.addWindowListener(new WindowAdapter() |
---|
.. | .. |
---|
1619 | 1760 | texture.add(textureField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
1620 | 1761 | colorSection.add(texture); |
---|
1621 | 1762 | |
---|
1622 | | - cGridBag anisoU = new cGridBag(); |
---|
1623 | | - anisoU.add(anisoLabel = new JLabel("AnisoU")); // , aConstraints); |
---|
1624 | | - anisoLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1625 | | - anisoU.add(anisoField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
1626 | | - colorSection.add(anisoU); |
---|
1627 | | - |
---|
1628 | | - cGridBag anisoV = new cGridBag(); |
---|
1629 | | - anisoV.add(anisoVLabel = new JLabel("AnisoV")); // , aConstraints); |
---|
1630 | | - anisoVLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1631 | | - anisoV.add(anisoVField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
1632 | | - colorSection.add(anisoV); |
---|
1633 | | - |
---|
1634 | | - cGridBag shadowbias = new cGridBag(); |
---|
1635 | | - shadowbias.add(shadowbiasLabel = new JLabel("Shadowbias")); // , aConstraints); |
---|
1636 | | - shadowbiasLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1637 | | - shadowbias.add(shadowbiasField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
1638 | | - colorSection.add(shadowbias); |
---|
1639 | | - |
---|
1640 | 1763 | panel.add(new JSeparator()); |
---|
1641 | 1764 | |
---|
1642 | 1765 | panel.add(colorSection); |
---|
.. | .. |
---|
1686 | 1809 | fakedepthLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1687 | 1810 | fakedepth.add(fakedepthField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
1688 | 1811 | diffuseSection.add(fakedepth); |
---|
| 1812 | + |
---|
| 1813 | + cGridBag shadowbias = new cGridBag(); |
---|
| 1814 | + shadowbias.add(shadowbiasLabel = new JLabel("Shadowbias")); // , aConstraints); |
---|
| 1815 | + shadowbiasLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 1816 | + shadowbias.add(shadowbiasField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
| 1817 | + diffuseSection.add(shadowbias); |
---|
1689 | 1818 | |
---|
1690 | 1819 | panel.add(new JSeparator()); |
---|
1691 | 1820 | |
---|
.. | .. |
---|
1737 | 1866 | // aConstraints.gridy += 1; |
---|
1738 | 1867 | // aConstraints.gridwidth = 1; |
---|
1739 | 1868 | |
---|
| 1869 | + cGridBag anisoU = new cGridBag(); |
---|
| 1870 | + anisoU.add(anisoLabel = new JLabel("AnisoU")); // , aConstraints); |
---|
| 1871 | + anisoLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 1872 | + anisoU.add(anisoField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
| 1873 | + specularSection.add(anisoU); |
---|
| 1874 | + |
---|
| 1875 | + cGridBag anisoV = new cGridBag(); |
---|
| 1876 | + anisoV.add(anisoVLabel = new JLabel("AnisoV")); // , aConstraints); |
---|
| 1877 | + anisoVLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 1878 | + anisoV.add(anisoVField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
| 1879 | + specularSection.add(anisoV); |
---|
| 1880 | + |
---|
1740 | 1881 | |
---|
1741 | 1882 | panel.add(new JSeparator()); |
---|
1742 | 1883 | |
---|
.. | .. |
---|
1744 | 1885 | |
---|
1745 | 1886 | //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints); |
---|
1746 | 1887 | |
---|
1747 | | - cGridBag globalSection = new cGridBag().setVertical(true); |
---|
| 1888 | + //cGridBag globalSection = new cGridBag().setVertical(true); |
---|
1748 | 1889 | |
---|
1749 | 1890 | cGridBag camera = new cGridBag(); |
---|
1750 | 1891 | camera.add(cameraLabel = new JLabel("GlobalLight")); // , aConstraints); |
---|
1751 | 1892 | cameraLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1752 | 1893 | camera.add(cameraField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
1753 | | - globalSection.add(camera); |
---|
| 1894 | + colorSection.add(camera); |
---|
1754 | 1895 | |
---|
1755 | 1896 | cGridBag ambient = new cGridBag(); |
---|
1756 | 1897 | ambient.add(ambientLabel = new JLabel("Ambient")); // , aConstraints); |
---|
1757 | 1898 | ambientLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1758 | 1899 | ambient.add(ambientField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
1759 | | - globalSection.add(ambient); |
---|
| 1900 | + colorSection.add(ambient); |
---|
1760 | 1901 | |
---|
1761 | 1902 | cGridBag backlit = new cGridBag(); |
---|
1762 | 1903 | backlit.add(backlitLabel = new JLabel("Backlit")); // , aConstraints); |
---|
1763 | 1904 | backlitLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1764 | 1905 | backlit.add(backlitField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
1765 | | - globalSection.add(backlit); |
---|
| 1906 | + colorSection.add(backlit); |
---|
1766 | 1907 | |
---|
1767 | 1908 | cGridBag opacity = new cGridBag(); |
---|
1768 | 1909 | opacity.add(opacityLabel = new JLabel("Opacity")); // , aConstraints); |
---|
1769 | 1910 | opacityLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1770 | 1911 | opacity.add(opacityField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
1771 | | - globalSection.add(opacity); |
---|
| 1912 | + colorSection.add(opacity); |
---|
1772 | 1913 | |
---|
1773 | | - panel.add(new JSeparator()); |
---|
| 1914 | + //panel.add(new JSeparator()); |
---|
1774 | 1915 | |
---|
1775 | | - panel.add(globalSection); |
---|
| 1916 | + //panel.add(globalSection); |
---|
1776 | 1917 | |
---|
1777 | 1918 | //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints); |
---|
1778 | 1919 | |
---|
.. | .. |
---|
1879 | 2020 | // 3D models |
---|
1880 | 2021 | if (filename.endsWith(".3ds") || filename.endsWith(".3DS")) |
---|
1881 | 2022 | { |
---|
1882 | | - lastConverter = new com.jmex.model.converters.MaxToJme(); |
---|
1883 | | - LoadFile(filename, lastConverter); |
---|
| 2023 | + //lastConverter = new com.jmex.model.converters.MaxToJme(); |
---|
| 2024 | + //LoadFile(filename, lastConverter); |
---|
| 2025 | + LoadObjFile(filename); // New 3ds loader |
---|
1884 | 2026 | continue; |
---|
1885 | 2027 | } |
---|
1886 | 2028 | if (filename.endsWith(".dae") || filename.endsWith(".DAE")) |
---|
.. | .. |
---|
2606 | 2748 | LA.matXRotate(((Object3D) group.get(group.size() - 1)).toParent, -Math.PI / 2); |
---|
2607 | 2749 | LA.matXRotate(((Object3D) group.get(group.size() - 1)).fromParent, Math.PI / 2); |
---|
2608 | 2750 | } |
---|
| 2751 | + |
---|
2609 | 2752 | //cJME.count++; |
---|
2610 | 2753 | //cJME.count %= 12; |
---|
2611 | 2754 | if (gc) |
---|
.. | .. |
---|
2789 | 2932 | } |
---|
2790 | 2933 | } |
---|
2791 | 2934 | } |
---|
| 2935 | + |
---|
2792 | 2936 | cFileSystemPane FSPane; |
---|
2793 | 2937 | |
---|
2794 | 2938 | void SetMaterial(cMaterial mat, Object3D.cVector2[] others) |
---|
.. | .. |
---|
2842 | 2986 | } |
---|
2843 | 2987 | } |
---|
2844 | 2988 | } |
---|
| 2989 | + |
---|
2845 | 2990 | freezematerial = false; |
---|
2846 | 2991 | } |
---|
2847 | 2992 | |
---|
2848 | 2993 | void SetMaterial(Object3D object) |
---|
2849 | 2994 | { |
---|
| 2995 | + latestObject = object; |
---|
| 2996 | + |
---|
2850 | 2997 | cMaterial mat = object.material; |
---|
2851 | 2998 | |
---|
2852 | 2999 | if (mat == null) |
---|
.. | .. |
---|
2958 | 3105 | // } |
---|
2959 | 3106 | |
---|
2960 | 3107 | /**/ |
---|
2961 | | - if (deselect) |
---|
| 3108 | + if (deselect || child == null) |
---|
2962 | 3109 | { |
---|
2963 | 3110 | //group.deselectAll(); |
---|
2964 | 3111 | //freeze = true; |
---|
2965 | 3112 | GetTree().clearSelection(); |
---|
2966 | 3113 | //freeze = false; |
---|
| 3114 | + |
---|
| 3115 | + if (child == null) |
---|
| 3116 | + { |
---|
| 3117 | + return; |
---|
| 3118 | + } |
---|
2967 | 3119 | } |
---|
2968 | 3120 | |
---|
2969 | 3121 | //group.addSelectee(child); |
---|
.. | .. |
---|
3032 | 3184 | cameraView.ToggleDL(); |
---|
3033 | 3185 | cameraView.repaint(); |
---|
3034 | 3186 | return; |
---|
3035 | | - } else if (event.getSource() == toggleTextureItem) |
---|
| 3187 | + } else if (event.getSource() == toggleTextureItem || event.getSource() == toggleTextureCB) |
---|
3036 | 3188 | { |
---|
3037 | 3189 | cameraView.ToggleTexture(); |
---|
3038 | 3190 | // june 2013 copy.HardTouch(); |
---|
.. | .. |
---|
3071 | 3223 | frame.validate(); |
---|
3072 | 3224 | |
---|
3073 | 3225 | return; |
---|
3074 | | - } else if (event.getSource() == toggleSwitchItem) |
---|
| 3226 | + } else if (event.getSource() == toggleSwitchItem || event.getSource() == toggleSwitchCB) |
---|
3075 | 3227 | { |
---|
3076 | 3228 | cameraView.ToggleSwitch(); |
---|
3077 | 3229 | cameraView.repaint(); |
---|
.. | .. |
---|
3287 | 3439 | { |
---|
3288 | 3440 | Close(); |
---|
3289 | 3441 | //return true; |
---|
3290 | | - } else if (source == loadItem) |
---|
| 3442 | + } else if (source == openItem) |
---|
3291 | 3443 | { |
---|
3292 | | - load(); |
---|
| 3444 | + Open(); |
---|
3293 | 3445 | //return true; |
---|
3294 | 3446 | } else if (source == newItem) |
---|
3295 | 3447 | { |
---|
.. | .. |
---|
3314 | 3466 | { |
---|
3315 | 3467 | generatePOV(); |
---|
3316 | 3468 | //return true; |
---|
| 3469 | + } else if (event.getSource() == archiveItem) |
---|
| 3470 | + { |
---|
| 3471 | + cTools.Archive(frame); |
---|
| 3472 | + return; |
---|
3317 | 3473 | } else if (source == zBufferItem) |
---|
3318 | 3474 | { |
---|
3319 | 3475 | try |
---|
.. | .. |
---|
3365 | 3521 | try |
---|
3366 | 3522 | { |
---|
3367 | 3523 | ByteArrayOutputStream baos = new ByteArrayOutputStream(); |
---|
3368 | | - java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(baos); |
---|
3369 | | - ObjectOutputStream out = new ObjectOutputStream(zstream); |
---|
| 3524 | +// java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(baos); |
---|
| 3525 | + ObjectOutputStream out = new ObjectOutputStream(baos); //zstream); |
---|
3370 | 3526 | |
---|
3371 | 3527 | Object3D parent = o.parent; |
---|
3372 | 3528 | o.parent = null; |
---|
.. | .. |
---|
3377 | 3533 | |
---|
3378 | 3534 | out.flush(); |
---|
3379 | 3535 | |
---|
3380 | | - zstream.close(); |
---|
| 3536 | + baos //zstream |
---|
| 3537 | + .close(); |
---|
3381 | 3538 | out.close(); |
---|
3382 | 3539 | |
---|
3383 | | - return baos.toByteArray(); |
---|
| 3540 | + byte[] bytes = baos.toByteArray(); |
---|
| 3541 | + |
---|
| 3542 | + System.out.println("save #bytes = " + bytes.length); |
---|
| 3543 | + return bytes; |
---|
3384 | 3544 | } catch (Exception e) |
---|
3385 | 3545 | { |
---|
3386 | 3546 | System.err.println(e); |
---|
.. | .. |
---|
3390 | 3550 | |
---|
3391 | 3551 | static public Object Uncompress(byte[] bytes) |
---|
3392 | 3552 | { |
---|
3393 | | - System.out.println("#bytes = " + bytes.length); |
---|
| 3553 | + System.out.println("restore #bytes = " + bytes.length); |
---|
3394 | 3554 | try |
---|
3395 | 3555 | { |
---|
3396 | 3556 | ByteArrayInputStream bais = new ByteArrayInputStream(bytes); |
---|
3397 | | - java.util.zip.GZIPInputStream istream = new java.util.zip.GZIPInputStream(bais); |
---|
3398 | | - ObjectInputStream in = new ObjectInputStream(istream); |
---|
| 3557 | + //java.util.zip.GZIPInputStream istream = new java.util.zip.GZIPInputStream(bais); |
---|
| 3558 | + ObjectInputStream in = new ObjectInputStream(bais); // istream); |
---|
3399 | 3559 | Object obj = in.readObject(); |
---|
| 3560 | + |
---|
| 3561 | + bais //istream |
---|
| 3562 | + .close(); |
---|
3400 | 3563 | in.close(); |
---|
3401 | 3564 | |
---|
3402 | 3565 | return obj; |
---|
.. | .. |
---|
3451 | 3614 | return null; |
---|
3452 | 3615 | } |
---|
3453 | 3616 | |
---|
3454 | | - java.util.Hashtable<java.util.UUID, Object3D> hashtable = new java.util.Hashtable<java.util.UUID, Object3D>(); |
---|
3455 | 3617 | |
---|
3456 | 3618 | public void Save() |
---|
| 3619 | + { |
---|
| 3620 | + //Save(true); |
---|
| 3621 | + Replace(); |
---|
| 3622 | + } |
---|
| 3623 | + |
---|
| 3624 | + private boolean Equal(byte[] compress, byte[] name) |
---|
| 3625 | + { |
---|
| 3626 | + if (compress.length != name.length) |
---|
| 3627 | + { |
---|
| 3628 | + return false; |
---|
| 3629 | + } |
---|
| 3630 | + |
---|
| 3631 | + for (int i=compress.length; --i>=0;) |
---|
| 3632 | + { |
---|
| 3633 | + if (compress[i] != name[i]) |
---|
| 3634 | + return false; |
---|
| 3635 | + } |
---|
| 3636 | + |
---|
| 3637 | + return true; |
---|
| 3638 | + } |
---|
| 3639 | + |
---|
| 3640 | + java.util.Hashtable<java.util.UUID, Object3D> versiontable = new java.util.Hashtable<java.util.UUID, Object3D>(); |
---|
| 3641 | + |
---|
| 3642 | + public boolean Save(boolean user) |
---|
3457 | 3643 | { |
---|
3458 | 3644 | System.err.println("Save"); |
---|
3459 | 3645 | |
---|
3460 | 3646 | cRadio tab = GetCurrentTab(); |
---|
3461 | 3647 | |
---|
3462 | | - boolean temp = CameraPane.SWITCH; |
---|
3463 | | - CameraPane.SWITCH = false; |
---|
| 3648 | + byte[] compress = CompressCopy(); |
---|
3464 | 3649 | |
---|
3465 | | - copy.ExtractBigData(hashtable); |
---|
| 3650 | + boolean thesame = false; |
---|
| 3651 | + |
---|
| 3652 | + // Quick heuristic using length. Works only when stream is compressed. |
---|
| 3653 | + if (copy.versionindex > 0 && copy.versions[copy.versionindex-1] != null && Equal(compress, copy.versions[copy.versionindex-1])) |
---|
| 3654 | + { |
---|
| 3655 | + thesame = true; |
---|
| 3656 | + } |
---|
3466 | 3657 | |
---|
3467 | 3658 | //EditorFrame.m_MainFrame.requestFocusInWindow(); |
---|
3468 | | - tab.graphs[tab.undoindex++] = Compress(copy); |
---|
3469 | | - |
---|
3470 | | - copy.RestoreBigData(hashtable); |
---|
3471 | | - |
---|
3472 | | - CameraPane.SWITCH = temp; |
---|
3473 | | - |
---|
3474 | | - //assert(hashtable.isEmpty()); |
---|
3475 | | - |
---|
3476 | | - for (int i = tab.undoindex; i < tab.graphs.length; i++) |
---|
| 3659 | + if (!thesame) |
---|
3477 | 3660 | { |
---|
3478 | | - tab.graphs[i] = null; |
---|
| 3661 | + //tab.user[tab.versionindex] = user; |
---|
| 3662 | + //boolean increment = true; // tab.graphs[tab.versionindex] == null; |
---|
| 3663 | + |
---|
| 3664 | + copy.versions[++copy.versionindex] = compress; |
---|
| 3665 | + |
---|
| 3666 | + // if (increment) |
---|
| 3667 | + // tab.versionindex++; |
---|
3479 | 3668 | } |
---|
3480 | 3669 | |
---|
| 3670 | + //copy.RestoreBigData(versiontable); |
---|
| 3671 | + |
---|
| 3672 | + //assert(hashtable.isEmpty()); |
---|
| 3673 | + |
---|
| 3674 | + for (int i = copy.versionindex+1; i < copy.versions.length; i++) |
---|
| 3675 | + { |
---|
| 3676 | + //tab.user[i] = false; |
---|
| 3677 | + copy.versions[i] = null; |
---|
| 3678 | + } |
---|
| 3679 | + |
---|
| 3680 | + SetUndoStates(); |
---|
| 3681 | + |
---|
3481 | 3682 | // test save |
---|
3482 | 3683 | if (false) |
---|
3483 | 3684 | { |
---|
3484 | 3685 | try |
---|
3485 | 3686 | { |
---|
3486 | | - FileOutputStream ostream = new FileOutputStream("save" + tab.undoindex); |
---|
| 3687 | + FileOutputStream ostream = new FileOutputStream("save" + copy.versionindex); |
---|
3487 | 3688 | ObjectOutputStream p = new ObjectOutputStream(ostream); |
---|
3488 | 3689 | |
---|
3489 | 3690 | p.writeObject(copy); |
---|
.. | .. |
---|
3496 | 3697 | e.printStackTrace(); |
---|
3497 | 3698 | } |
---|
3498 | 3699 | } |
---|
| 3700 | + |
---|
| 3701 | + return !thesame; |
---|
3499 | 3702 | } |
---|
3500 | 3703 | |
---|
3501 | 3704 | void CopyChanged(Object3D obj) |
---|
3502 | 3705 | { |
---|
| 3706 | + SetUndoStates(); |
---|
| 3707 | + |
---|
3503 | 3708 | boolean temp = CameraPane.SWITCH; |
---|
3504 | 3709 | CameraPane.SWITCH = false; |
---|
3505 | 3710 | |
---|
3506 | | - copy.ExtractBigData(hashtable); |
---|
| 3711 | + copy.ExtractBigData(versiontable); |
---|
3507 | 3712 | |
---|
3508 | 3713 | copy.clear(); |
---|
3509 | 3714 | |
---|
.. | .. |
---|
3512 | 3717 | copy.add(obj.get(i)); |
---|
3513 | 3718 | } |
---|
3514 | 3719 | |
---|
3515 | | - copy.RestoreBigData(hashtable); |
---|
| 3720 | + copy.RestoreBigData(versiontable); |
---|
3516 | 3721 | |
---|
3517 | 3722 | CameraPane.SWITCH = temp; |
---|
3518 | 3723 | |
---|
.. | .. |
---|
3539 | 3744 | refreshContents(); |
---|
3540 | 3745 | } |
---|
3541 | 3746 | |
---|
3542 | | - public void Undo() |
---|
| 3747 | + cButton undoButton; |
---|
| 3748 | + cButton restoreButton; |
---|
| 3749 | + cButton replaceButton; |
---|
| 3750 | + cButton redoButton; |
---|
| 3751 | + |
---|
| 3752 | + boolean muteSlider; |
---|
| 3753 | + |
---|
| 3754 | + int VersionCount() |
---|
3543 | 3755 | { |
---|
| 3756 | + int count = 0; |
---|
| 3757 | + |
---|
| 3758 | + for (int i = copy.versions.length; --i >= 0;) |
---|
| 3759 | + { |
---|
| 3760 | + if (copy.versions[i] != null) |
---|
| 3761 | + count++; |
---|
| 3762 | + } |
---|
| 3763 | + |
---|
| 3764 | + return count; |
---|
| 3765 | + } |
---|
| 3766 | + |
---|
| 3767 | + void SetUndoStates() |
---|
| 3768 | + { |
---|
| 3769 | + cRadio tab = GetCurrentTab(); |
---|
| 3770 | + |
---|
| 3771 | + restoreButton.setEnabled(copy.versionindex != -1); |
---|
| 3772 | + replaceButton.setEnabled(copy.versionindex != -1); |
---|
| 3773 | + |
---|
| 3774 | + undoButton.setEnabled(copy.versionindex > 0); |
---|
| 3775 | + redoButton.setEnabled(copy.versions[copy.versionindex + 1] != null); |
---|
| 3776 | + |
---|
| 3777 | + muteSlider = true; |
---|
| 3778 | + versionSlider.setMaximum(VersionCount() - 1); |
---|
| 3779 | + versionSlider.setInteger(copy.versionindex); |
---|
| 3780 | + muteSlider = false; |
---|
| 3781 | + } |
---|
| 3782 | + |
---|
| 3783 | + public boolean Undo() |
---|
| 3784 | + { |
---|
| 3785 | + // Option? |
---|
| 3786 | + Replace(); |
---|
| 3787 | + |
---|
3544 | 3788 | System.err.println("Undo"); |
---|
3545 | 3789 | |
---|
3546 | 3790 | cRadio tab = GetCurrentTab(); |
---|
3547 | 3791 | |
---|
3548 | | - if (tab.undoindex == 0) |
---|
| 3792 | + if (copy.versionindex == 0) |
---|
3549 | 3793 | { |
---|
3550 | 3794 | java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
3551 | | - return; |
---|
| 3795 | + return false; |
---|
3552 | 3796 | } |
---|
3553 | 3797 | |
---|
3554 | | - if (tab.graphs[tab.undoindex] == null) |
---|
| 3798 | +// if (tab.graphs[tab.versionindex] == null) // || !tab.user[tab.versionindex]) |
---|
| 3799 | +// { |
---|
| 3800 | +// if (Save(false)) |
---|
| 3801 | +// tab.versionindex -= 1; |
---|
| 3802 | +// else |
---|
| 3803 | +// { |
---|
| 3804 | +// if (tab.versionindex <= 0) |
---|
| 3805 | +// return false; |
---|
| 3806 | +// else |
---|
| 3807 | +// tab.versionindex -= 1; |
---|
| 3808 | +// } |
---|
| 3809 | +// } |
---|
| 3810 | + |
---|
| 3811 | + copy.versionindex -= 1; |
---|
| 3812 | + |
---|
| 3813 | + CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex])); |
---|
| 3814 | + |
---|
| 3815 | + return true; |
---|
| 3816 | + } |
---|
| 3817 | + |
---|
| 3818 | + public boolean Restore() |
---|
| 3819 | + { |
---|
| 3820 | + System.err.println("Restore"); |
---|
| 3821 | + |
---|
| 3822 | + cRadio tab = GetCurrentTab(); |
---|
| 3823 | + |
---|
| 3824 | + if (copy.versionindex == -1 || copy.versions[copy.versionindex] == null) |
---|
3555 | 3825 | { |
---|
3556 | | - Save(); |
---|
3557 | | - tab.undoindex -= 1; |
---|
| 3826 | + java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
| 3827 | + return false; |
---|
3558 | 3828 | } |
---|
3559 | 3829 | |
---|
3560 | | - tab.undoindex -= 1; |
---|
| 3830 | + CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex])); |
---|
| 3831 | + |
---|
| 3832 | + return true; |
---|
| 3833 | + } |
---|
3561 | 3834 | |
---|
3562 | | - CopyChanged((Object3D)Uncompress(tab.graphs[tab.undoindex])); |
---|
| 3835 | + public boolean Replace() |
---|
| 3836 | + { |
---|
| 3837 | + System.err.println("Replace"); |
---|
| 3838 | + |
---|
| 3839 | + cRadio tab = GetCurrentTab(); |
---|
| 3840 | + |
---|
| 3841 | + if (copy.versionindex == -1 || copy.versions[copy.versionindex] == null) |
---|
| 3842 | + { |
---|
| 3843 | + // No version yet. OK. java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
| 3844 | + return false; |
---|
| 3845 | + } |
---|
| 3846 | + |
---|
| 3847 | + copy.versions[copy.versionindex] = CompressCopy(); |
---|
| 3848 | + |
---|
| 3849 | + return true; |
---|
3563 | 3850 | } |
---|
3564 | 3851 | |
---|
3565 | 3852 | public void Redo() |
---|
3566 | 3853 | { |
---|
| 3854 | + // Option? |
---|
| 3855 | + Replace(); |
---|
| 3856 | + |
---|
3567 | 3857 | cRadio tab = GetCurrentTab(); |
---|
3568 | 3858 | |
---|
3569 | | - if (tab.graphs[tab.undoindex + 1] == null) |
---|
| 3859 | + if (copy.versions[copy.versionindex + 1] == null) |
---|
3570 | 3860 | { |
---|
3571 | 3861 | java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
3572 | 3862 | return; |
---|
3573 | 3863 | } |
---|
3574 | 3864 | |
---|
3575 | | - tab.undoindex += 1; |
---|
| 3865 | + copy.versionindex += 1; |
---|
3576 | 3866 | |
---|
3577 | | - CopyChanged((Object3D)Uncompress(tab.graphs[tab.undoindex])); |
---|
| 3867 | + CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex])); |
---|
| 3868 | + |
---|
| 3869 | + //if (!tab.user[tab.versionindex]) |
---|
| 3870 | + // tab.graphs[tab.versionindex] = null; |
---|
3578 | 3871 | } |
---|
3579 | 3872 | |
---|
3580 | 3873 | void ImportGFD() |
---|
.. | .. |
---|
3726 | 4019 | assert false; |
---|
3727 | 4020 | } |
---|
3728 | 4021 | |
---|
3729 | | - void EditSelection() |
---|
| 4022 | + void EditSelection(boolean newWindow) |
---|
3730 | 4023 | { |
---|
3731 | 4024 | } |
---|
3732 | 4025 | |
---|
.. | .. |
---|
3870 | 4163 | //copy.Touch(); |
---|
3871 | 4164 | } |
---|
3872 | 4165 | |
---|
| 4166 | + cNumberSlider versionSlider; |
---|
| 4167 | + |
---|
3873 | 4168 | public void stateChanged(ChangeEvent e) |
---|
3874 | 4169 | { |
---|
3875 | 4170 | // assert(false); |
---|
| 4171 | + if (e.getSource() == versionSlider) |
---|
| 4172 | + { |
---|
| 4173 | + if (muteSlider) |
---|
| 4174 | + return; |
---|
| 4175 | + |
---|
| 4176 | + int version = versionSlider.getInteger(); |
---|
| 4177 | + |
---|
| 4178 | + if (copy.versions[version] != null) |
---|
| 4179 | + { |
---|
| 4180 | + CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex = version])); |
---|
| 4181 | + } |
---|
| 4182 | + |
---|
| 4183 | + return; |
---|
| 4184 | + } |
---|
3876 | 4185 | |
---|
3877 | 4186 | if (freezematerial) |
---|
3878 | 4187 | { |
---|
.. | .. |
---|
4221 | 4530 | |
---|
4222 | 4531 | void makeSomething(Object3D thing, boolean resetmodel) // deselect) |
---|
4223 | 4532 | { |
---|
4224 | | - if (Globals.SAVEONMAKE) |
---|
| 4533 | + if (Globals.REPLACEONMAKE) // && resetmodel) |
---|
4225 | 4534 | Save(); |
---|
4226 | 4535 | //Tween.set(thing, 0).target(1).start(tweenManager); |
---|
4227 | 4536 | //Tween.to(thing, 0, 0.5f).target(0).start(tweenManager); |
---|
.. | .. |
---|
4309 | 4618 | { |
---|
4310 | 4619 | ResetModel(); |
---|
4311 | 4620 | Select(thing.GetTreePath(), true, false); // unselect... false); |
---|
| 4621 | + |
---|
| 4622 | + if (thing.Size() == 0) |
---|
| 4623 | + { |
---|
| 4624 | + //EditSelection(false); |
---|
| 4625 | + } |
---|
| 4626 | + |
---|
4312 | 4627 | refreshContents(); |
---|
4313 | 4628 | } |
---|
4314 | 4629 | |
---|
.. | .. |
---|
4531 | 4846 | |
---|
4532 | 4847 | if (readobj != null) |
---|
4533 | 4848 | { |
---|
4534 | | - if (Globals.SAVEONMAKE) |
---|
4535 | | - Save(); |
---|
| 4849 | + //if (Globals.SAVEONMAKE) // A new object cannot share meshes |
---|
| 4850 | + // Save(); |
---|
4536 | 4851 | try |
---|
4537 | 4852 | { |
---|
4538 | 4853 | //readobj.deepCopySelf(copy); |
---|
.. | .. |
---|
4587 | 4902 | c.addChild(csg); |
---|
4588 | 4903 | } |
---|
4589 | 4904 | |
---|
| 4905 | + copy.versions = readobj.versions; |
---|
| 4906 | + copy.versionindex = readobj.versionindex; |
---|
| 4907 | + |
---|
| 4908 | + if (copy.versions == null) |
---|
| 4909 | + { |
---|
| 4910 | + copy.versions = new byte[100][]; |
---|
| 4911 | + copy.versionindex = -1; |
---|
| 4912 | + } |
---|
| 4913 | + |
---|
| 4914 | + //? SetUndoStates(); |
---|
| 4915 | + |
---|
4590 | 4916 | ResetModel(); |
---|
4591 | 4917 | copy.HardTouch(); // recompile? |
---|
4592 | 4918 | refreshContents(); |
---|
4593 | 4919 | } |
---|
4594 | 4920 | } |
---|
4595 | 4921 | |
---|
4596 | | - void load() // throws ClassNotFoundException |
---|
| 4922 | + void Open() // throws ClassNotFoundException |
---|
4597 | 4923 | { |
---|
4598 | 4924 | if (Grafreed.standAlone) |
---|
4599 | 4925 | { |
---|
.. | .. |
---|
4710 | 5036 | String filename = browser.getFile(); |
---|
4711 | 5037 | if (filename != null && filename.length() > 0) |
---|
4712 | 5038 | { |
---|
| 5039 | + if (!filename.endsWith(".gfd")) |
---|
| 5040 | + filename += ".gfd"; |
---|
4713 | 5041 | lastname = browser.getDirectory() + filename; |
---|
4714 | 5042 | save(); |
---|
4715 | 5043 | } |
---|
.. | .. |
---|
4876 | 5204 | MenuBar menuBar; |
---|
4877 | 5205 | Menu fileMenu; |
---|
4878 | 5206 | MenuItem newItem; |
---|
4879 | | - MenuItem loadItem; |
---|
| 5207 | + MenuItem openItem; |
---|
4880 | 5208 | MenuItem saveItem; |
---|
4881 | 5209 | MenuItem saveAsItem; |
---|
4882 | 5210 | MenuItem exportAsItem; |
---|
.. | .. |
---|
4899 | 5227 | CheckboxMenuItem toggleSwitchItem; |
---|
4900 | 5228 | CheckboxMenuItem toggleRootItem; |
---|
4901 | 5229 | CheckboxMenuItem animationItem; |
---|
| 5230 | + MenuItem archiveItem; |
---|
4902 | 5231 | CheckboxMenuItem toggleHandleItem; |
---|
4903 | 5232 | CheckboxMenuItem togglePaintItem; |
---|
4904 | 5233 | JSplitPane mainPanel; |
---|
4905 | 5234 | JScrollPane scrollpane; |
---|
| 5235 | + |
---|
4906 | 5236 | JPanel toolbarPanel; |
---|
| 5237 | + |
---|
4907 | 5238 | cGridBag treePanel; |
---|
| 5239 | + |
---|
4908 | 5240 | JPanel radioPanel; |
---|
4909 | 5241 | ButtonGroup buttonGroup; |
---|
4910 | | - cGridBag ctrlPanel; |
---|
| 5242 | + |
---|
| 5243 | + cGridBag toolboxPanel; |
---|
4911 | 5244 | cGridBag materialPanel; |
---|
| 5245 | + cGridBag ctrlPanel; |
---|
| 5246 | + |
---|
4912 | 5247 | JScrollPane infoPanel; |
---|
| 5248 | + |
---|
4913 | 5249 | cGridBag optionsPanel; |
---|
| 5250 | + |
---|
4914 | 5251 | JTabbedPane objectPanel; |
---|
| 5252 | + boolean materialFlushed; |
---|
| 5253 | + Object3D latestObject; |
---|
| 5254 | + |
---|
4915 | 5255 | cGridBag XYZPanel; |
---|
| 5256 | + |
---|
4916 | 5257 | JSplitPane gridPanel; |
---|
4917 | 5258 | JSplitPane bigPanel; |
---|
| 5259 | + |
---|
4918 | 5260 | cGridBag bigThree; |
---|
4919 | 5261 | cGridBag scenePanel; |
---|
4920 | 5262 | cGridBag centralPanel; |
---|
.. | .. |
---|
5029 | 5371 | cNumberSlider fogField; |
---|
5030 | 5372 | JLabel opacityPowerLabel; |
---|
5031 | 5373 | cNumberSlider opacityPowerField; |
---|
5032 | | - JTree jTree; |
---|
| 5374 | + cTree jTree; |
---|
5033 | 5375 | //ObjectUI parent; |
---|
5034 | 5376 | |
---|
5035 | 5377 | cNumberSlider normalpushField; |
---|