.. | .. |
---|
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); |
---|
.. | .. |
---|
293 | 309 | //localCopy.parent = null; |
---|
294 | 310 | |
---|
295 | 311 | frame = new JFrame(); |
---|
296 | | - frame.setUndecorated(true); |
---|
| 312 | + frame.setUndecorated(false); |
---|
297 | 313 | objEditor = this; |
---|
298 | 314 | this.callee = callee; |
---|
299 | 315 | |
---|
.. | .. |
---|
324 | 340 | return frame.action(event, obj); |
---|
325 | 341 | } |
---|
326 | 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 | + |
---|
327 | 348 | void SetupMenu() |
---|
328 | 349 | { |
---|
329 | 350 | frame.setMenuBar(menuBar = new MenuBar()); |
---|
330 | 351 | menuBar.add(fileMenu = new Menu("File")); |
---|
331 | 352 | fileMenu.add(newItem = new MenuItem("New")); |
---|
332 | | - fileMenu.add(loadItem = new MenuItem("Open...")); |
---|
| 353 | + fileMenu.add(openItem = new MenuItem("Open...")); |
---|
333 | 354 | |
---|
334 | 355 | //oe.menuBar.add(menu = new Menu("Include")); |
---|
335 | 356 | Menu menu = new Menu("Import"); |
---|
.. | .. |
---|
361 | 382 | } |
---|
362 | 383 | |
---|
363 | 384 | newItem.addActionListener(this); |
---|
364 | | - loadItem.addActionListener(this); |
---|
| 385 | + openItem.addActionListener(this); |
---|
365 | 386 | saveItem.addActionListener(this); |
---|
366 | 387 | saveAsItem.addActionListener(this); |
---|
367 | 388 | exportAsItem.addActionListener(this); |
---|
.. | .. |
---|
370 | 391 | closeItem.addActionListener(this); |
---|
371 | 392 | |
---|
372 | 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 | + |
---|
373 | 420 | toolbarPanel = new JPanel(); |
---|
374 | 421 | toolbarPanel.setName("Toolbar"); |
---|
375 | 422 | treePanel = new cGridBag(); |
---|
.. | .. |
---|
384 | 431 | editPanel.add(editCommandsPanel); |
---|
385 | 432 | editPanel.add(ctrlPanel); |
---|
386 | 433 | |
---|
387 | | - materialPanel = new cGridBag().setVertical(true); |
---|
| 434 | + toolboxPanel = new cGridBag().setVertical(false); |
---|
| 435 | + toolboxPanel.setName("Toolbox"); |
---|
388 | 436 | |
---|
| 437 | + materialPanel = new cGridBag().setVertical(true); |
---|
389 | 438 | materialPanel.setName("Material"); |
---|
| 439 | + |
---|
390 | 440 | /*JTextPane*/ |
---|
391 | 441 | infoarea = createTextPane(); |
---|
392 | 442 | doc = infoarea.getStyledDocument(); |
---|
.. | .. |
---|
399 | 449 | // TEXTAREA infoarea.setLineWrap(true); |
---|
400 | 450 | // TEXTAREA infoarea.setWrapStyleWord(true); |
---|
401 | 451 | infoPanel = new JScrollPane(infoarea, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); //AS_NEEDED); |
---|
402 | | - infoPanel.setPreferredSize(new Dimension(50, 200)); |
---|
| 452 | + infoPanel.setPreferredSize(new Dimension(1, 1)); |
---|
403 | 453 | infoPanel.setName("Info"); |
---|
404 | 454 | //infoPanel.setLayout(new BorderLayout()); |
---|
405 | 455 | //infoPanel.add(createTextPane()); |
---|
.. | .. |
---|
411 | 461 | mainPanel.setDividerSize(9); |
---|
412 | 462 | mainPanel.setDividerLocation(0.5); //1.0); |
---|
413 | 463 | mainPanel.setResizeWeight(0.5); |
---|
414 | | - |
---|
| 464 | + |
---|
| 465 | +//mainPanel.setDividerSize((int) (mainPanel.getDividerSize() * 1.5)); |
---|
| 466 | + BasicSplitPaneDivider divider = ( (BasicSplitPaneUI) mainPanel.getUI()).getDivider(); |
---|
| 467 | + divider.setDividerSize(15); |
---|
| 468 | + divider.setBorder(BorderFactory.createTitledBorder(divider.getBorder(), "Custom border title -- gets rid of the one-touch arrows!")); |
---|
| 469 | + |
---|
| 470 | + mainPanel.setUI(new BasicSplitPaneUI()); |
---|
| 471 | + |
---|
415 | 472 | //ctrlPanel.setLayout(new GridLayout(4, 1, 5, 5)); |
---|
416 | 473 | //mainPanel.setLayout(new GridBagLayout()); |
---|
417 | 474 | toolbarPanel.setLayout(new FlowLayout(FlowLayout.LEFT)); |
---|
.. | .. |
---|
642 | 699 | } |
---|
643 | 700 | } |
---|
644 | 701 | |
---|
645 | | -static GraphicsDevice device = GraphicsEnvironment |
---|
646 | | - .getLocalGraphicsEnvironment().getScreenDevices()[0]; |
---|
| 702 | +//static GraphicsDevice device = GraphicsEnvironment |
---|
| 703 | +// .getLocalGraphicsEnvironment().getScreenDevices()[0]; |
---|
647 | 704 | |
---|
648 | 705 | Rectangle keeprect; |
---|
649 | 706 | cRadio radio; |
---|
.. | .. |
---|
659 | 716 | |
---|
660 | 717 | boolean maximized; |
---|
661 | 718 | |
---|
| 719 | + cButton fullscreenLayout; |
---|
| 720 | + |
---|
662 | 721 | void Minimize() |
---|
663 | 722 | { |
---|
664 | 723 | frame.setState(Frame.ICONIFIED); |
---|
| 724 | + frame.validate(); |
---|
665 | 725 | } |
---|
666 | 726 | |
---|
| 727 | +// artifactURI=null, type=0, property=${file.reference.jfxrt.jar}, object=org.netbeans.modules.java.api.common.classpath.ClassPathSupport$RelativePath@6767876f, broken=false, additional={} |
---|
| 728 | +// artifactURI=null, type=0, property=${file.reference.mac-ui.jar}, object=org.netbeans.modules.java.api.common.classpath.ClassPathSupport$RelativePath@16bdc817, broken=false, additional={} |
---|
| 729 | +// artifactURI=null, type=0, property=${file.reference.classes.jar}, object=org.netbeans.modules.java.api.common.classpath.ClassPathSupport$RelativePath@9daa9c17, broken=false, additional={} |
---|
667 | 730 | void Maximize() |
---|
668 | 731 | { |
---|
| 732 | + if (CameraPane.FULLSCREEN) |
---|
| 733 | + { |
---|
| 734 | + ToggleFullScreen(); |
---|
| 735 | + } |
---|
| 736 | + |
---|
669 | 737 | if (maximized) |
---|
670 | 738 | { |
---|
671 | 739 | frame.setBounds(keeprect.x, keeprect.y, keeprect.width, keeprect.height); |
---|
.. | .. |
---|
673 | 741 | else |
---|
674 | 742 | { |
---|
675 | 743 | 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); |
---|
| 744 | +// Rectangle rect = GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds(); |
---|
| 745 | +// Dimension rect2 = frame.getToolkit().getScreenSize(); |
---|
| 746 | +// frame.setBounds(0, rect2.height - rect.height, rect.width, rect.height); |
---|
679 | 747 | // frame.setState(Frame.MAXIMIZED_BOTH); |
---|
| 748 | + frame.setBounds(frame.getGraphicsConfiguration().getBounds()); |
---|
680 | 749 | } |
---|
681 | 750 | |
---|
682 | 751 | maximized ^= true; |
---|
| 752 | + |
---|
| 753 | + frame.validate(); |
---|
683 | 754 | } |
---|
| 755 | + |
---|
| 756 | + cButton minButton; |
---|
| 757 | + cButton maxButton; |
---|
| 758 | + cButton fullButton; |
---|
684 | 759 | |
---|
685 | 760 | void ToggleFullScreen() |
---|
686 | 761 | { |
---|
687 | | - if (CameraPane.FULLSCREEN) |
---|
| 762 | +GraphicsDevice device = frame.getGraphicsConfiguration().getDevice(); |
---|
| 763 | + |
---|
| 764 | + cameraView.ToggleFullScreen(); |
---|
| 765 | + |
---|
| 766 | + if (!CameraPane.FULLSCREEN) |
---|
688 | 767 | { |
---|
689 | 768 | device.setFullScreenWindow(null); |
---|
| 769 | + frame.dispose(); |
---|
| 770 | + frame.setUndecorated(false); |
---|
| 771 | + frame.validate(); |
---|
| 772 | + frame.setVisible(true); |
---|
| 773 | + |
---|
690 | 774 | //frame.setVisible(false); |
---|
691 | 775 | // frame.removeNotify(); |
---|
692 | 776 | // frame.setUndecorated(false); |
---|
.. | .. |
---|
696 | 780 | // X frame.getContentPane().remove(/*"Center",*/bigThree); |
---|
697 | 781 | // X framePanel.add(bigThree); |
---|
698 | 782 | // X frame.getContentPane().add(/*"Center",*/framePanel); |
---|
699 | | - framePanel.setDividerLocation(1); |
---|
| 783 | + framePanel.setDividerLocation(46); |
---|
700 | 784 | |
---|
701 | 785 | //frame.setVisible(true); |
---|
702 | 786 | radio.layout = keepButton; |
---|
.. | .. |
---|
711 | 795 | // frame.setBounds(0, 0, frame.getToolkit().getScreenSize().width, |
---|
712 | 796 | // frame.getToolkit().getScreenSize().height); |
---|
713 | 797 | //frame.setVisible(false); |
---|
| 798 | + |
---|
| 799 | + frame.dispose(); |
---|
| 800 | + frame.setUndecorated(true); |
---|
714 | 801 | device.setFullScreenWindow(frame); |
---|
| 802 | + frame.validate(); |
---|
| 803 | + frame.setVisible(true); |
---|
715 | 804 | // frame.removeNotify(); |
---|
716 | 805 | // frame.setUndecorated(true); |
---|
717 | 806 | // frame.addNotify(); |
---|
.. | .. |
---|
720 | 809 | // X frame.getContentPane().add(/*"Center",*/bigThree); |
---|
721 | 810 | framePanel.setDividerLocation(0); |
---|
722 | 811 | |
---|
723 | | - radio.layout = twoButton; |
---|
| 812 | + radio.layout = fullscreenLayout; |
---|
724 | 813 | radio.layout.doClick(); |
---|
725 | 814 | //frame.setVisible(true); |
---|
726 | 815 | } |
---|
727 | | - |
---|
728 | | - cameraView.ToggleFullScreen(); |
---|
| 816 | + frame.validate(); |
---|
729 | 817 | } |
---|
| 818 | + |
---|
| 819 | + private byte[] CompressCopy() |
---|
| 820 | + { |
---|
| 821 | + boolean temp = CameraPane.SWITCH; |
---|
| 822 | + CameraPane.SWITCH = false; |
---|
| 823 | + |
---|
| 824 | + copy.ExtractBigData(versiontable); |
---|
| 825 | + // if (copy == client) |
---|
| 826 | + |
---|
| 827 | + byte[] versions[] = copy.versions; |
---|
| 828 | + copy.versions = null; |
---|
| 829 | + |
---|
| 830 | + byte[] compress = Compress(copy); |
---|
| 831 | + |
---|
| 832 | + copy.versions = versions; |
---|
| 833 | + |
---|
| 834 | + copy.RestoreBigData(versiontable); |
---|
| 835 | + |
---|
| 836 | + CameraPane.SWITCH = temp; |
---|
| 837 | + |
---|
| 838 | + return compress; |
---|
| 839 | + } |
---|
730 | 840 | |
---|
731 | 841 | private JTextPane createTextPane() |
---|
732 | 842 | { |
---|
.. | .. |
---|
866 | 976 | JCheckBox speedupCB; |
---|
867 | 977 | JCheckBox rewindCB; |
---|
868 | 978 | JCheckBox flipVCB; |
---|
| 979 | + |
---|
| 980 | + cCheckBox toggleTextureCB; |
---|
| 981 | + cCheckBox toggleSwitchCB; |
---|
| 982 | + |
---|
869 | 983 | JComboBox texresMenu; |
---|
| 984 | + |
---|
870 | 985 | JButton resetButton; |
---|
871 | 986 | JButton stepButton; |
---|
872 | 987 | JButton stepAllButton; |
---|
.. | .. |
---|
1053 | 1168 | namePanel = new cGridBag(); |
---|
1054 | 1169 | |
---|
1055 | 1170 | nameField = AddText(namePanel, copy.GetName()); |
---|
1056 | | - namePanel.add(nameField); |
---|
| 1171 | + namePanel.add(new JScrollPane(nameField, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER)); |
---|
1057 | 1172 | oe.ctrlPanel.add(namePanel); |
---|
1058 | 1173 | |
---|
1059 | 1174 | oe.ctrlPanel.Return(); |
---|
1060 | 1175 | |
---|
1061 | | - if (!GroupEditor.allparams) |
---|
| 1176 | + if (!allparams) |
---|
1062 | 1177 | return; |
---|
1063 | 1178 | |
---|
1064 | 1179 | setupPanel = new cGridBag().setVertical(false); |
---|
.. | .. |
---|
1071 | 1186 | hideCB = AddCheckBox(setupPanel, "Hide", copy.hide); |
---|
1072 | 1187 | hideCB.setToolTipText("Hide object"); |
---|
1073 | 1188 | markCB = AddCheckBox(setupPanel, "Mark", copy.marked); |
---|
1074 | | - markCB.setToolTipText("Set the animation target transform"); |
---|
| 1189 | + markCB.setToolTipText("As animation target transform"); |
---|
1075 | 1190 | |
---|
1076 | 1191 | setupPanel2 = new cGridBag().setVertical(false); |
---|
1077 | 1192 | |
---|
1078 | 1193 | rewindCB = AddCheckBox(setupPanel2, "Rewind", copy.rewind); |
---|
1079 | 1194 | rewindCB.setToolTipText("Rewind animation"); |
---|
1080 | 1195 | |
---|
1081 | | - randomCB = AddCheckBox(setupPanel2, "Rand", copy.random); |
---|
1082 | | - randomCB.setToolTipText("Randomly Rewind or Go back and forth"); |
---|
| 1196 | + randomCB = AddCheckBox(setupPanel2, "Random", copy.random); |
---|
| 1197 | + randomCB.setToolTipText("Randomly Rewind (or Go back and forth)"); |
---|
1083 | 1198 | |
---|
| 1199 | + link2masterCB = AddCheckBox(setupPanel2, "Support", copy.link2master); |
---|
| 1200 | + link2masterCB.setToolTipText("Attach to support"); |
---|
| 1201 | + |
---|
1084 | 1202 | if (Globals.ADVANCED) |
---|
1085 | 1203 | { |
---|
1086 | | - link2masterCB = AddCheckBox(setupPanel2, "Supp", copy.link2master); |
---|
1087 | | - link2masterCB.setToolTipText("Attach to support"); |
---|
1088 | 1204 | speedupCB = AddCheckBox(setupPanel2, "Speed", copy.speedup); |
---|
1089 | 1205 | speedupCB.setToolTipText("Option motion capture"); |
---|
1090 | 1206 | } |
---|
.. | .. |
---|
1400 | 1516 | // north.add(ctrlPanel, BorderLayout.NORTH); |
---|
1401 | 1517 | // objectPanel.add(north); |
---|
1402 | 1518 | objectPanel.add(editPanel); |
---|
1403 | | - objectPanel.add(infoPanel); |
---|
| 1519 | + |
---|
| 1520 | + //if (Globals.ADVANCED) |
---|
| 1521 | + objectPanel.add(infoPanel); |
---|
| 1522 | + |
---|
| 1523 | + objectPanel.add(toolboxPanel); |
---|
1404 | 1524 | |
---|
1405 | 1525 | /* |
---|
1406 | 1526 | aConstraints.gridx = 0; |
---|
.. | .. |
---|
1409 | 1529 | aConstraints.gridy += 1; |
---|
1410 | 1530 | aConstraints.gridwidth = 1; |
---|
1411 | 1531 | mainPanel.add(objectPanel, aConstraints); |
---|
1412 | | - */ |
---|
| 1532 | + */ |
---|
1413 | 1533 | |
---|
1414 | 1534 | scrollpane = new JScrollPane(mainPanel, ScrollPaneConstants.// VERTICAL_SCROLLBAR_ALWAYS, |
---|
1415 | 1535 | VERTICAL_SCROLLBAR_AS_NEEDED, |
---|
.. | .. |
---|
1426 | 1546 | JTabbedPane tabbedPane = new JTabbedPane(); |
---|
1427 | 1547 | tabbedPane.add(scrollpane); |
---|
1428 | 1548 | |
---|
1429 | | - tabbedPane.add(FSPane = new cFileSystemPane(this)); |
---|
1430 | | - |
---|
1431 | | - optionsPanel = new cGridBag().setVertical(true); |
---|
| 1549 | + optionsPanel = new cGridBag().setVertical(false); |
---|
1432 | 1550 | |
---|
1433 | 1551 | optionsPanel.setName("Options"); |
---|
1434 | 1552 | |
---|
.. | .. |
---|
1436 | 1554 | |
---|
1437 | 1555 | tabbedPane.add(optionsPanel); |
---|
1438 | 1556 | |
---|
| 1557 | + tabbedPane.add(FSPane = new cFileSystemPane(this)); |
---|
| 1558 | + |
---|
1439 | 1559 | scenePanel.add(tabbedPane); |
---|
1440 | 1560 | |
---|
1441 | 1561 | /* |
---|
.. | .. |
---|
1508 | 1628 | // aConstraints.gridheight = 1; |
---|
1509 | 1629 | |
---|
1510 | 1630 | framePanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, toolbarPanel, bigThree); |
---|
1511 | | - framePanel.setContinuousLayout(true); |
---|
1512 | | - framePanel.setOneTouchExpandable(true); |
---|
1513 | | - framePanel.setDividerLocation(0.8); |
---|
| 1631 | + framePanel.setContinuousLayout(false); |
---|
| 1632 | + framePanel.setOneTouchExpandable(false); |
---|
| 1633 | + //.setDividerLocation(0.8); |
---|
1514 | 1634 | //framePanel.setDividerSize(15); |
---|
1515 | 1635 | //framePanel.setResizeWeight(0.15); |
---|
1516 | 1636 | framePanel.setName("Frame"); |
---|
.. | .. |
---|
1528 | 1648 | // aConstraints = gbc; // (GridBagConstraints) GrafreeD.clone(gbc); |
---|
1529 | 1649 | |
---|
1530 | 1650 | frame.setSize(1280, 860); |
---|
1531 | | - frame.setVisible(true); |
---|
1532 | | - |
---|
| 1651 | + |
---|
1533 | 1652 | cameraView.requestFocusInWindow(); |
---|
1534 | 1653 | |
---|
1535 | 1654 | gridPanel.setDividerLocation(1.0); |
---|
| 1655 | + |
---|
| 1656 | + frame.validate(); |
---|
| 1657 | + |
---|
| 1658 | + frame.setVisible(true); |
---|
1536 | 1659 | |
---|
1537 | 1660 | frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); |
---|
1538 | 1661 | frame.addWindowListener(new WindowAdapter() |
---|
.. | .. |
---|
1619 | 1742 | texture.add(textureField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
1620 | 1743 | colorSection.add(texture); |
---|
1621 | 1744 | |
---|
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 | 1745 | panel.add(new JSeparator()); |
---|
1641 | 1746 | |
---|
1642 | 1747 | panel.add(colorSection); |
---|
.. | .. |
---|
1686 | 1791 | fakedepthLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1687 | 1792 | fakedepth.add(fakedepthField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
1688 | 1793 | diffuseSection.add(fakedepth); |
---|
| 1794 | + |
---|
| 1795 | + cGridBag shadowbias = new cGridBag(); |
---|
| 1796 | + shadowbias.add(shadowbiasLabel = new JLabel("Shadowbias")); // , aConstraints); |
---|
| 1797 | + shadowbiasLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 1798 | + shadowbias.add(shadowbiasField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
| 1799 | + diffuseSection.add(shadowbias); |
---|
1689 | 1800 | |
---|
1690 | 1801 | panel.add(new JSeparator()); |
---|
1691 | 1802 | |
---|
.. | .. |
---|
1737 | 1848 | // aConstraints.gridy += 1; |
---|
1738 | 1849 | // aConstraints.gridwidth = 1; |
---|
1739 | 1850 | |
---|
| 1851 | + cGridBag anisoU = new cGridBag(); |
---|
| 1852 | + anisoU.add(anisoLabel = new JLabel("AnisoU")); // , aConstraints); |
---|
| 1853 | + anisoLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 1854 | + anisoU.add(anisoField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
| 1855 | + specularSection.add(anisoU); |
---|
| 1856 | + |
---|
| 1857 | + cGridBag anisoV = new cGridBag(); |
---|
| 1858 | + anisoV.add(anisoVLabel = new JLabel("AnisoV")); // , aConstraints); |
---|
| 1859 | + anisoVLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 1860 | + anisoV.add(anisoVField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
| 1861 | + specularSection.add(anisoV); |
---|
| 1862 | + |
---|
1740 | 1863 | |
---|
1741 | 1864 | panel.add(new JSeparator()); |
---|
1742 | 1865 | |
---|
.. | .. |
---|
1744 | 1867 | |
---|
1745 | 1868 | //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints); |
---|
1746 | 1869 | |
---|
1747 | | - cGridBag globalSection = new cGridBag().setVertical(true); |
---|
| 1870 | + //cGridBag globalSection = new cGridBag().setVertical(true); |
---|
1748 | 1871 | |
---|
1749 | 1872 | cGridBag camera = new cGridBag(); |
---|
1750 | 1873 | camera.add(cameraLabel = new JLabel("GlobalLight")); // , aConstraints); |
---|
1751 | 1874 | cameraLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1752 | 1875 | camera.add(cameraField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
1753 | | - globalSection.add(camera); |
---|
| 1876 | + colorSection.add(camera); |
---|
1754 | 1877 | |
---|
1755 | 1878 | cGridBag ambient = new cGridBag(); |
---|
1756 | 1879 | ambient.add(ambientLabel = new JLabel("Ambient")); // , aConstraints); |
---|
1757 | 1880 | ambientLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1758 | 1881 | ambient.add(ambientField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
1759 | | - globalSection.add(ambient); |
---|
| 1882 | + colorSection.add(ambient); |
---|
1760 | 1883 | |
---|
1761 | 1884 | cGridBag backlit = new cGridBag(); |
---|
1762 | 1885 | backlit.add(backlitLabel = new JLabel("Backlit")); // , aConstraints); |
---|
1763 | 1886 | backlitLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1764 | 1887 | backlit.add(backlitField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
1765 | | - globalSection.add(backlit); |
---|
| 1888 | + colorSection.add(backlit); |
---|
1766 | 1889 | |
---|
1767 | 1890 | cGridBag opacity = new cGridBag(); |
---|
1768 | 1891 | opacity.add(opacityLabel = new JLabel("Opacity")); // , aConstraints); |
---|
1769 | 1892 | opacityLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1770 | 1893 | opacity.add(opacityField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
1771 | | - globalSection.add(opacity); |
---|
| 1894 | + colorSection.add(opacity); |
---|
1772 | 1895 | |
---|
1773 | | - panel.add(new JSeparator()); |
---|
| 1896 | + //panel.add(new JSeparator()); |
---|
1774 | 1897 | |
---|
1775 | | - panel.add(globalSection); |
---|
| 1898 | + //panel.add(globalSection); |
---|
1776 | 1899 | |
---|
1777 | 1900 | //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints); |
---|
1778 | 1901 | |
---|
.. | .. |
---|
1879 | 2002 | // 3D models |
---|
1880 | 2003 | if (filename.endsWith(".3ds") || filename.endsWith(".3DS")) |
---|
1881 | 2004 | { |
---|
1882 | | - lastConverter = new com.jmex.model.converters.MaxToJme(); |
---|
1883 | | - LoadFile(filename, lastConverter); |
---|
| 2005 | + //lastConverter = new com.jmex.model.converters.MaxToJme(); |
---|
| 2006 | + //LoadFile(filename, lastConverter); |
---|
| 2007 | + LoadObjFile(filename); // New 3ds loader |
---|
1884 | 2008 | continue; |
---|
1885 | 2009 | } |
---|
1886 | 2010 | if (filename.endsWith(".dae") || filename.endsWith(".DAE")) |
---|
.. | .. |
---|
2606 | 2730 | LA.matXRotate(((Object3D) group.get(group.size() - 1)).toParent, -Math.PI / 2); |
---|
2607 | 2731 | LA.matXRotate(((Object3D) group.get(group.size() - 1)).fromParent, Math.PI / 2); |
---|
2608 | 2732 | } |
---|
| 2733 | + |
---|
2609 | 2734 | //cJME.count++; |
---|
2610 | 2735 | //cJME.count %= 12; |
---|
2611 | 2736 | if (gc) |
---|
.. | .. |
---|
2789 | 2914 | } |
---|
2790 | 2915 | } |
---|
2791 | 2916 | } |
---|
| 2917 | + |
---|
2792 | 2918 | cFileSystemPane FSPane; |
---|
2793 | 2919 | |
---|
2794 | 2920 | void SetMaterial(cMaterial mat, Object3D.cVector2[] others) |
---|
.. | .. |
---|
2842 | 2968 | } |
---|
2843 | 2969 | } |
---|
2844 | 2970 | } |
---|
| 2971 | + |
---|
2845 | 2972 | freezematerial = false; |
---|
2846 | 2973 | } |
---|
2847 | 2974 | |
---|
2848 | 2975 | void SetMaterial(Object3D object) |
---|
2849 | 2976 | { |
---|
| 2977 | + latestObject = object; |
---|
| 2978 | + |
---|
2850 | 2979 | cMaterial mat = object.material; |
---|
2851 | 2980 | |
---|
2852 | 2981 | if (mat == null) |
---|
.. | .. |
---|
2958 | 3087 | // } |
---|
2959 | 3088 | |
---|
2960 | 3089 | /**/ |
---|
2961 | | - if (deselect) |
---|
| 3090 | + if (deselect || child == null) |
---|
2962 | 3091 | { |
---|
2963 | 3092 | //group.deselectAll(); |
---|
2964 | 3093 | //freeze = true; |
---|
2965 | 3094 | GetTree().clearSelection(); |
---|
2966 | 3095 | //freeze = false; |
---|
| 3096 | + |
---|
| 3097 | + if (child == null) |
---|
| 3098 | + { |
---|
| 3099 | + return; |
---|
| 3100 | + } |
---|
2967 | 3101 | } |
---|
2968 | 3102 | |
---|
2969 | 3103 | //group.addSelectee(child); |
---|
.. | .. |
---|
3032 | 3166 | cameraView.ToggleDL(); |
---|
3033 | 3167 | cameraView.repaint(); |
---|
3034 | 3168 | return; |
---|
3035 | | - } else if (event.getSource() == toggleTextureItem) |
---|
| 3169 | + } else if (event.getSource() == toggleTextureItem || event.getSource() == toggleTextureCB) |
---|
3036 | 3170 | { |
---|
3037 | 3171 | cameraView.ToggleTexture(); |
---|
3038 | 3172 | // june 2013 copy.HardTouch(); |
---|
.. | .. |
---|
3071 | 3205 | frame.validate(); |
---|
3072 | 3206 | |
---|
3073 | 3207 | return; |
---|
3074 | | - } else if (event.getSource() == toggleSwitchItem) |
---|
| 3208 | + } else if (event.getSource() == toggleSwitchItem || event.getSource() == toggleSwitchCB) |
---|
3075 | 3209 | { |
---|
3076 | 3210 | cameraView.ToggleSwitch(); |
---|
3077 | 3211 | cameraView.repaint(); |
---|
.. | .. |
---|
3287 | 3421 | { |
---|
3288 | 3422 | Close(); |
---|
3289 | 3423 | //return true; |
---|
3290 | | - } else if (source == loadItem) |
---|
| 3424 | + } else if (source == openItem) |
---|
3291 | 3425 | { |
---|
3292 | | - load(); |
---|
| 3426 | + Open(); |
---|
3293 | 3427 | //return true; |
---|
3294 | 3428 | } else if (source == newItem) |
---|
3295 | 3429 | { |
---|
.. | .. |
---|
3314 | 3448 | { |
---|
3315 | 3449 | generatePOV(); |
---|
3316 | 3450 | //return true; |
---|
| 3451 | + } else if (event.getSource() == archiveItem) |
---|
| 3452 | + { |
---|
| 3453 | + cTools.Archive(frame); |
---|
| 3454 | + return; |
---|
3317 | 3455 | } else if (source == zBufferItem) |
---|
3318 | 3456 | { |
---|
3319 | 3457 | try |
---|
.. | .. |
---|
3365 | 3503 | try |
---|
3366 | 3504 | { |
---|
3367 | 3505 | ByteArrayOutputStream baos = new ByteArrayOutputStream(); |
---|
3368 | | - java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(baos); |
---|
3369 | | - ObjectOutputStream out = new ObjectOutputStream(zstream); |
---|
| 3506 | +// java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(baos); |
---|
| 3507 | + ObjectOutputStream out = new ObjectOutputStream(baos); //zstream); |
---|
3370 | 3508 | |
---|
3371 | 3509 | Object3D parent = o.parent; |
---|
3372 | 3510 | o.parent = null; |
---|
.. | .. |
---|
3377 | 3515 | |
---|
3378 | 3516 | out.flush(); |
---|
3379 | 3517 | |
---|
3380 | | - zstream.close(); |
---|
| 3518 | + baos //zstream |
---|
| 3519 | + .close(); |
---|
3381 | 3520 | out.close(); |
---|
3382 | 3521 | |
---|
3383 | | - return baos.toByteArray(); |
---|
| 3522 | + byte[] bytes = baos.toByteArray(); |
---|
| 3523 | + |
---|
| 3524 | + System.out.println("save #bytes = " + bytes.length); |
---|
| 3525 | + return bytes; |
---|
3384 | 3526 | } catch (Exception e) |
---|
3385 | 3527 | { |
---|
3386 | 3528 | System.err.println(e); |
---|
.. | .. |
---|
3390 | 3532 | |
---|
3391 | 3533 | static public Object Uncompress(byte[] bytes) |
---|
3392 | 3534 | { |
---|
3393 | | - System.out.println("#bytes = " + bytes.length); |
---|
| 3535 | + System.out.println("restore #bytes = " + bytes.length); |
---|
3394 | 3536 | try |
---|
3395 | 3537 | { |
---|
3396 | 3538 | ByteArrayInputStream bais = new ByteArrayInputStream(bytes); |
---|
3397 | | - java.util.zip.GZIPInputStream istream = new java.util.zip.GZIPInputStream(bais); |
---|
3398 | | - ObjectInputStream in = new ObjectInputStream(istream); |
---|
| 3539 | + //java.util.zip.GZIPInputStream istream = new java.util.zip.GZIPInputStream(bais); |
---|
| 3540 | + ObjectInputStream in = new ObjectInputStream(bais); // istream); |
---|
3399 | 3541 | Object obj = in.readObject(); |
---|
| 3542 | + |
---|
| 3543 | + bais //istream |
---|
| 3544 | + .close(); |
---|
3400 | 3545 | in.close(); |
---|
3401 | 3546 | |
---|
3402 | 3547 | return obj; |
---|
.. | .. |
---|
3451 | 3596 | return null; |
---|
3452 | 3597 | } |
---|
3453 | 3598 | |
---|
3454 | | - java.util.Hashtable<java.util.UUID, Object3D> hashtable = new java.util.Hashtable<java.util.UUID, Object3D>(); |
---|
3455 | 3599 | |
---|
3456 | 3600 | public void Save() |
---|
| 3601 | + { |
---|
| 3602 | + //Save(true); |
---|
| 3603 | + Replace(); |
---|
| 3604 | + } |
---|
| 3605 | + |
---|
| 3606 | + private boolean Equal(byte[] compress, byte[] name) |
---|
| 3607 | + { |
---|
| 3608 | + if (compress.length != name.length) |
---|
| 3609 | + { |
---|
| 3610 | + return false; |
---|
| 3611 | + } |
---|
| 3612 | + |
---|
| 3613 | + for (int i=compress.length; --i>=0;) |
---|
| 3614 | + { |
---|
| 3615 | + if (compress[i] != name[i]) |
---|
| 3616 | + return false; |
---|
| 3617 | + } |
---|
| 3618 | + |
---|
| 3619 | + return true; |
---|
| 3620 | + } |
---|
| 3621 | + |
---|
| 3622 | + java.util.Hashtable<java.util.UUID, Object3D> versiontable = new java.util.Hashtable<java.util.UUID, Object3D>(); |
---|
| 3623 | + |
---|
| 3624 | + public boolean Save(boolean user) |
---|
3457 | 3625 | { |
---|
3458 | 3626 | System.err.println("Save"); |
---|
3459 | 3627 | |
---|
3460 | 3628 | cRadio tab = GetCurrentTab(); |
---|
3461 | 3629 | |
---|
3462 | | - boolean temp = CameraPane.SWITCH; |
---|
3463 | | - CameraPane.SWITCH = false; |
---|
| 3630 | + byte[] compress = CompressCopy(); |
---|
3464 | 3631 | |
---|
3465 | | - copy.ExtractBigData(hashtable); |
---|
| 3632 | + boolean thesame = false; |
---|
| 3633 | + |
---|
| 3634 | + // Quick heuristic using length. Works only when stream is compressed. |
---|
| 3635 | + if (copy.versionindex > 0 && copy.versions[copy.versionindex-1] != null && Equal(compress, copy.versions[copy.versionindex-1])) |
---|
| 3636 | + { |
---|
| 3637 | + thesame = true; |
---|
| 3638 | + } |
---|
3466 | 3639 | |
---|
3467 | 3640 | //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++) |
---|
| 3641 | + if (!thesame) |
---|
3477 | 3642 | { |
---|
3478 | | - tab.graphs[i] = null; |
---|
| 3643 | + //tab.user[tab.versionindex] = user; |
---|
| 3644 | + //boolean increment = true; // tab.graphs[tab.versionindex] == null; |
---|
| 3645 | + |
---|
| 3646 | + copy.versions[++copy.versionindex] = compress; |
---|
| 3647 | + |
---|
| 3648 | + // if (increment) |
---|
| 3649 | + // tab.versionindex++; |
---|
3479 | 3650 | } |
---|
3480 | 3651 | |
---|
| 3652 | + //copy.RestoreBigData(versiontable); |
---|
| 3653 | + |
---|
| 3654 | + //assert(hashtable.isEmpty()); |
---|
| 3655 | + |
---|
| 3656 | + for (int i = copy.versionindex+1; i < copy.versions.length; i++) |
---|
| 3657 | + { |
---|
| 3658 | + //tab.user[i] = false; |
---|
| 3659 | + copy.versions[i] = null; |
---|
| 3660 | + } |
---|
| 3661 | + |
---|
| 3662 | + SetUndoStates(); |
---|
| 3663 | + |
---|
3481 | 3664 | // test save |
---|
3482 | 3665 | if (false) |
---|
3483 | 3666 | { |
---|
3484 | 3667 | try |
---|
3485 | 3668 | { |
---|
3486 | | - FileOutputStream ostream = new FileOutputStream("save" + tab.undoindex); |
---|
| 3669 | + FileOutputStream ostream = new FileOutputStream("save" + copy.versionindex); |
---|
3487 | 3670 | ObjectOutputStream p = new ObjectOutputStream(ostream); |
---|
3488 | 3671 | |
---|
3489 | 3672 | p.writeObject(copy); |
---|
.. | .. |
---|
3496 | 3679 | e.printStackTrace(); |
---|
3497 | 3680 | } |
---|
3498 | 3681 | } |
---|
| 3682 | + |
---|
| 3683 | + return !thesame; |
---|
3499 | 3684 | } |
---|
3500 | 3685 | |
---|
3501 | 3686 | void CopyChanged(Object3D obj) |
---|
3502 | 3687 | { |
---|
| 3688 | + SetUndoStates(); |
---|
| 3689 | + |
---|
3503 | 3690 | boolean temp = CameraPane.SWITCH; |
---|
3504 | 3691 | CameraPane.SWITCH = false; |
---|
3505 | 3692 | |
---|
3506 | | - copy.ExtractBigData(hashtable); |
---|
| 3693 | + copy.ExtractBigData(versiontable); |
---|
3507 | 3694 | |
---|
3508 | 3695 | copy.clear(); |
---|
3509 | 3696 | |
---|
.. | .. |
---|
3512 | 3699 | copy.add(obj.get(i)); |
---|
3513 | 3700 | } |
---|
3514 | 3701 | |
---|
3515 | | - copy.RestoreBigData(hashtable); |
---|
| 3702 | + copy.RestoreBigData(versiontable); |
---|
3516 | 3703 | |
---|
3517 | 3704 | CameraPane.SWITCH = temp; |
---|
3518 | 3705 | |
---|
.. | .. |
---|
3539 | 3726 | refreshContents(); |
---|
3540 | 3727 | } |
---|
3541 | 3728 | |
---|
3542 | | - public void Undo() |
---|
| 3729 | + cButton undoButton; |
---|
| 3730 | + cButton restoreButton; |
---|
| 3731 | + cButton replaceButton; |
---|
| 3732 | + cButton redoButton; |
---|
| 3733 | + |
---|
| 3734 | + void SetUndoStates() |
---|
| 3735 | + { |
---|
| 3736 | + cRadio tab = GetCurrentTab(); |
---|
| 3737 | + |
---|
| 3738 | + restoreButton.setEnabled(copy.versionindex != -1); |
---|
| 3739 | + replaceButton.setEnabled(copy.versionindex != -1); |
---|
| 3740 | + undoButton.setEnabled(copy.versionindex > 0); |
---|
| 3741 | + redoButton.setEnabled(copy.versions[copy.versionindex + 1] != null); |
---|
| 3742 | + } |
---|
| 3743 | + |
---|
| 3744 | + public boolean Undo() |
---|
3543 | 3745 | { |
---|
3544 | 3746 | System.err.println("Undo"); |
---|
3545 | 3747 | |
---|
3546 | 3748 | cRadio tab = GetCurrentTab(); |
---|
3547 | 3749 | |
---|
3548 | | - if (tab.undoindex == 0) |
---|
| 3750 | + if (copy.versionindex == 0) |
---|
3549 | 3751 | { |
---|
3550 | 3752 | java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
3551 | | - return; |
---|
| 3753 | + return false; |
---|
3552 | 3754 | } |
---|
3553 | 3755 | |
---|
3554 | | - if (tab.graphs[tab.undoindex] == null) |
---|
| 3756 | +// if (tab.graphs[tab.versionindex] == null) // || !tab.user[tab.versionindex]) |
---|
| 3757 | +// { |
---|
| 3758 | +// if (Save(false)) |
---|
| 3759 | +// tab.versionindex -= 1; |
---|
| 3760 | +// else |
---|
| 3761 | +// { |
---|
| 3762 | +// if (tab.versionindex <= 0) |
---|
| 3763 | +// return false; |
---|
| 3764 | +// else |
---|
| 3765 | +// tab.versionindex -= 1; |
---|
| 3766 | +// } |
---|
| 3767 | +// } |
---|
| 3768 | + |
---|
| 3769 | + copy.versionindex -= 1; |
---|
| 3770 | + |
---|
| 3771 | + CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex])); |
---|
| 3772 | + |
---|
| 3773 | + return true; |
---|
| 3774 | + } |
---|
| 3775 | + |
---|
| 3776 | + public boolean Restore() |
---|
| 3777 | + { |
---|
| 3778 | + System.err.println("Restore"); |
---|
| 3779 | + |
---|
| 3780 | + cRadio tab = GetCurrentTab(); |
---|
| 3781 | + |
---|
| 3782 | + if (copy.versionindex == -1 || copy.versions[copy.versionindex] == null) |
---|
3555 | 3783 | { |
---|
3556 | | - Save(); |
---|
3557 | | - tab.undoindex -= 1; |
---|
| 3784 | + java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
| 3785 | + return false; |
---|
3558 | 3786 | } |
---|
3559 | 3787 | |
---|
3560 | | - tab.undoindex -= 1; |
---|
| 3788 | + CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex])); |
---|
| 3789 | + |
---|
| 3790 | + return true; |
---|
| 3791 | + } |
---|
3561 | 3792 | |
---|
3562 | | - CopyChanged((Object3D)Uncompress(tab.graphs[tab.undoindex])); |
---|
| 3793 | + public boolean Replace() |
---|
| 3794 | + { |
---|
| 3795 | + System.err.println("Replace"); |
---|
| 3796 | + |
---|
| 3797 | + cRadio tab = GetCurrentTab(); |
---|
| 3798 | + |
---|
| 3799 | + if (copy.versionindex == -1 || copy.versions[copy.versionindex] == null) |
---|
| 3800 | + { |
---|
| 3801 | + // No version yet. OK. java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
| 3802 | + return false; |
---|
| 3803 | + } |
---|
| 3804 | + |
---|
| 3805 | + copy.versions[copy.versionindex] = CompressCopy(); |
---|
| 3806 | + |
---|
| 3807 | + return true; |
---|
3563 | 3808 | } |
---|
3564 | 3809 | |
---|
3565 | 3810 | public void Redo() |
---|
3566 | 3811 | { |
---|
3567 | 3812 | cRadio tab = GetCurrentTab(); |
---|
3568 | 3813 | |
---|
3569 | | - if (tab.graphs[tab.undoindex + 1] == null) |
---|
| 3814 | + if (copy.versions[copy.versionindex + 1] == null) |
---|
3570 | 3815 | { |
---|
3571 | 3816 | java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
3572 | 3817 | return; |
---|
3573 | 3818 | } |
---|
3574 | 3819 | |
---|
3575 | | - tab.undoindex += 1; |
---|
| 3820 | + copy.versionindex += 1; |
---|
3576 | 3821 | |
---|
3577 | | - CopyChanged((Object3D)Uncompress(tab.graphs[tab.undoindex])); |
---|
| 3822 | + CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex])); |
---|
| 3823 | + |
---|
| 3824 | + //if (!tab.user[tab.versionindex]) |
---|
| 3825 | + // tab.graphs[tab.versionindex] = null; |
---|
3578 | 3826 | } |
---|
3579 | 3827 | |
---|
3580 | 3828 | void ImportGFD() |
---|
.. | .. |
---|
3726 | 3974 | assert false; |
---|
3727 | 3975 | } |
---|
3728 | 3976 | |
---|
3729 | | - void EditSelection() |
---|
| 3977 | + void EditSelection(boolean newWindow) |
---|
3730 | 3978 | { |
---|
3731 | 3979 | } |
---|
3732 | 3980 | |
---|
.. | .. |
---|
3870 | 4118 | //copy.Touch(); |
---|
3871 | 4119 | } |
---|
3872 | 4120 | |
---|
| 4121 | + cNumberSlider versionField; |
---|
| 4122 | + |
---|
3873 | 4123 | public void stateChanged(ChangeEvent e) |
---|
3874 | 4124 | { |
---|
3875 | 4125 | // assert(false); |
---|
| 4126 | + if (e.getSource() == versionField) |
---|
| 4127 | + { |
---|
| 4128 | + int version = versionField.getInteger(); |
---|
| 4129 | + |
---|
| 4130 | + if (copy.versions[version] != null) |
---|
| 4131 | + { |
---|
| 4132 | + CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex = version])); |
---|
| 4133 | + } |
---|
| 4134 | + |
---|
| 4135 | + return; |
---|
| 4136 | + } |
---|
3876 | 4137 | |
---|
3877 | 4138 | if (freezematerial) |
---|
3878 | 4139 | { |
---|
.. | .. |
---|
4221 | 4482 | |
---|
4222 | 4483 | void makeSomething(Object3D thing, boolean resetmodel) // deselect) |
---|
4223 | 4484 | { |
---|
4224 | | - if (Globals.SAVEONMAKE) |
---|
| 4485 | + if (Globals.REPLACEONMAKE) // && resetmodel) |
---|
4225 | 4486 | Save(); |
---|
4226 | 4487 | //Tween.set(thing, 0).target(1).start(tweenManager); |
---|
4227 | 4488 | //Tween.to(thing, 0, 0.5f).target(0).start(tweenManager); |
---|
.. | .. |
---|
4309 | 4570 | { |
---|
4310 | 4571 | ResetModel(); |
---|
4311 | 4572 | Select(thing.GetTreePath(), true, false); // unselect... false); |
---|
| 4573 | + |
---|
| 4574 | + if (thing.Size() == 0) |
---|
| 4575 | + { |
---|
| 4576 | + //EditSelection(false); |
---|
| 4577 | + } |
---|
| 4578 | + |
---|
4312 | 4579 | refreshContents(); |
---|
4313 | 4580 | } |
---|
4314 | 4581 | |
---|
.. | .. |
---|
4531 | 4798 | |
---|
4532 | 4799 | if (readobj != null) |
---|
4533 | 4800 | { |
---|
4534 | | - if (Globals.SAVEONMAKE) |
---|
4535 | | - Save(); |
---|
| 4801 | + //if (Globals.SAVEONMAKE) // A new object cannot share meshes |
---|
| 4802 | + // Save(); |
---|
4536 | 4803 | try |
---|
4537 | 4804 | { |
---|
4538 | 4805 | //readobj.deepCopySelf(copy); |
---|
.. | .. |
---|
4587 | 4854 | c.addChild(csg); |
---|
4588 | 4855 | } |
---|
4589 | 4856 | |
---|
| 4857 | + copy.versions = readobj.versions; |
---|
| 4858 | + copy.versionindex = readobj.versionindex; |
---|
| 4859 | + |
---|
| 4860 | + SetUndoStates(); |
---|
| 4861 | + |
---|
4590 | 4862 | ResetModel(); |
---|
4591 | 4863 | copy.HardTouch(); // recompile? |
---|
4592 | 4864 | refreshContents(); |
---|
4593 | 4865 | } |
---|
4594 | 4866 | } |
---|
4595 | 4867 | |
---|
4596 | | - void load() // throws ClassNotFoundException |
---|
| 4868 | + void Open() // throws ClassNotFoundException |
---|
4597 | 4869 | { |
---|
4598 | 4870 | if (Grafreed.standAlone) |
---|
4599 | 4871 | { |
---|
.. | .. |
---|
4710 | 4982 | String filename = browser.getFile(); |
---|
4711 | 4983 | if (filename != null && filename.length() > 0) |
---|
4712 | 4984 | { |
---|
| 4985 | + if (!filename.endsWith(".gfd")) |
---|
| 4986 | + filename += ".gfd"; |
---|
4713 | 4987 | lastname = browser.getDirectory() + filename; |
---|
4714 | 4988 | save(); |
---|
4715 | 4989 | } |
---|
.. | .. |
---|
4876 | 5150 | MenuBar menuBar; |
---|
4877 | 5151 | Menu fileMenu; |
---|
4878 | 5152 | MenuItem newItem; |
---|
4879 | | - MenuItem loadItem; |
---|
| 5153 | + MenuItem openItem; |
---|
4880 | 5154 | MenuItem saveItem; |
---|
4881 | 5155 | MenuItem saveAsItem; |
---|
4882 | 5156 | MenuItem exportAsItem; |
---|
.. | .. |
---|
4899 | 5173 | CheckboxMenuItem toggleSwitchItem; |
---|
4900 | 5174 | CheckboxMenuItem toggleRootItem; |
---|
4901 | 5175 | CheckboxMenuItem animationItem; |
---|
| 5176 | + MenuItem archiveItem; |
---|
4902 | 5177 | CheckboxMenuItem toggleHandleItem; |
---|
4903 | 5178 | CheckboxMenuItem togglePaintItem; |
---|
4904 | 5179 | JSplitPane mainPanel; |
---|
4905 | 5180 | JScrollPane scrollpane; |
---|
| 5181 | + |
---|
4906 | 5182 | JPanel toolbarPanel; |
---|
| 5183 | + |
---|
4907 | 5184 | cGridBag treePanel; |
---|
| 5185 | + |
---|
4908 | 5186 | JPanel radioPanel; |
---|
4909 | 5187 | ButtonGroup buttonGroup; |
---|
4910 | | - cGridBag ctrlPanel; |
---|
| 5188 | + |
---|
| 5189 | + cGridBag toolboxPanel; |
---|
4911 | 5190 | cGridBag materialPanel; |
---|
| 5191 | + cGridBag ctrlPanel; |
---|
| 5192 | + |
---|
4912 | 5193 | JScrollPane infoPanel; |
---|
| 5194 | + |
---|
4913 | 5195 | cGridBag optionsPanel; |
---|
| 5196 | + |
---|
4914 | 5197 | JTabbedPane objectPanel; |
---|
| 5198 | + boolean materialFlushed; |
---|
| 5199 | + Object3D latestObject; |
---|
| 5200 | + |
---|
4915 | 5201 | cGridBag XYZPanel; |
---|
| 5202 | + |
---|
4916 | 5203 | JSplitPane gridPanel; |
---|
4917 | 5204 | JSplitPane bigPanel; |
---|
| 5205 | + |
---|
4918 | 5206 | cGridBag bigThree; |
---|
4919 | 5207 | cGridBag scenePanel; |
---|
4920 | 5208 | cGridBag centralPanel; |
---|
.. | .. |
---|
5029 | 5317 | cNumberSlider fogField; |
---|
5030 | 5318 | JLabel opacityPowerLabel; |
---|
5031 | 5319 | cNumberSlider opacityPowerField; |
---|
5032 | | - JTree jTree; |
---|
| 5320 | + cTree jTree; |
---|
5033 | 5321 | //ObjectUI parent; |
---|
5034 | 5322 | |
---|
5035 | 5323 | cNumberSlider normalpushField; |
---|