Normand Briere
2019-06-29 a69bb4474a3264a9a7a7f8b8d8154ea771f167c8
ObjEditor.java
....@@ -4,6 +4,7 @@
44
55 import java.awt.*;
66 import java.awt.event.*;
7
+import java.awt.image.BufferedImage;
78 import javax.swing.*;
89 import javax.swing.event.*;
910 import javax.swing.text.*;
....@@ -13,6 +14,9 @@
1314 import javax.swing.plaf.metal.MetalLookAndFeel;
1415 //import javax.swing.plaf.ColorUIResource;
1516 //import javax.swing.plaf.metal.DefaultMetalTheme;
17
+
18
+import javax.swing.plaf.basic.BasicSplitPaneDivider;
19
+import javax.swing.plaf.basic.BasicSplitPaneUI;
1620
1721 //import javax.media.opengl.GLCanvas;
1822
....@@ -37,6 +41,65 @@
3741 JFrame frame;
3842
3943 static ObjEditor theFrame;
44
+
45
+ cButton GetButton(String name, boolean border)
46
+ {
47
+ try
48
+ {
49
+ ImageIcon icon = GetIcon(name);
50
+ return new cButton(icon, border);
51
+ }
52
+ catch (Exception e)
53
+ {
54
+ return new cButton(name, border);
55
+ }
56
+ }
57
+
58
+ cToggleButton GetToggleButton(String name, boolean border)
59
+ {
60
+ try
61
+ {
62
+ ImageIcon icon = GetIcon(name);
63
+ return new cToggleButton(icon, border);
64
+ }
65
+ catch (Exception e)
66
+ {
67
+ return new cToggleButton(name, border);
68
+ }
69
+ }
70
+
71
+ cCheckBox GetCheckBox(String name, boolean border)
72
+ {
73
+ try
74
+ {
75
+ ImageIcon icon = GetIcon(name);
76
+ return new cCheckBox(icon, border);
77
+ }
78
+ catch (Exception e)
79
+ {
80
+ return new cCheckBox(name, border);
81
+ }
82
+ }
83
+
84
+ private ImageIcon GetIcon(String name) throws IOException
85
+ {
86
+ BufferedImage image = javax.imageio.ImageIO.read(getClass().getClassLoader().getResourceAsStream(name));
87
+
88
+ if (image.getWidth() != 24 && image.getHeight() != 24)
89
+ {
90
+ BufferedImage resized = new BufferedImage(24, 24, image.getType());
91
+ Graphics2D g = resized.createGraphics();
92
+ g.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR);
93
+ //g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
94
+ g.drawImage(image, 0, 0, 24, 24, 0, 0, image.getWidth(), image.getHeight(), null);
95
+ g.dispose();
96
+
97
+ image = resized;
98
+ }
99
+
100
+ javax.swing.ImageIcon icon = new javax.swing.ImageIcon(image);
101
+ return icon;
102
+ }
40103
41104 // SCRIPT
42105
....@@ -147,7 +210,7 @@
147210
148211 objEditor.ctrlPanel.remove(namePanel);
149212
150
- if (!GroupEditor.allparams)
213
+ if (!allparams)
151214 return;
152215
153216 // objEditor.ctrlPanel.remove(liveCB);
....@@ -171,7 +234,7 @@
171234
172235 objEditor.ctrlPanel.remove(setupPanel);
173236 objEditor.ctrlPanel.remove(setupPanel2);
174
- objEditor.ctrlPanel.remove(commandsPanel);
237
+ objEditor.ctrlPanel.remove(objectCommandsPanel);
175238 objEditor.ctrlPanel.remove(pushPanel);
176239 //objEditor.ctrlPanel.remove(fillPanel);
177240
....@@ -277,6 +340,11 @@
277340 return frame.action(event, obj);
278341 }
279342
343
+ // Cannot work without static
344
+ static boolean allparams = true;
345
+
346
+ static java.util.Vector<Object3D> listUI = new java.util.Vector<Object3D>();
347
+
280348 void SetupMenu()
281349 {
282350 frame.setMenuBar(menuBar = new MenuBar());
....@@ -323,14 +391,52 @@
323391 closeItem.addActionListener(this);
324392
325393 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
+
326420 toolbarPanel = new JPanel();
327421 toolbarPanel.setName("Toolbar");
328422 treePanel = new cGridBag();
329423 treePanel.setName("Tree");
424
+
425
+ editPanel = new cGridBag().setVertical(true);
426
+ editPanel.setName("Edit");
427
+
330428 ctrlPanel = new cGridBag().setVertical(false); // new GridBagLayout());
331
- ctrlPanel.setName("Edit");
429
+
430
+ editCommandsPanel = new cGridBag();
431
+ editPanel.add(editCommandsPanel);
432
+ editPanel.add(ctrlPanel);
433
+
434
+ toolboxPanel = new cGridBag().setVertical(false);
435
+ toolboxPanel.setName("Toolbox");
436
+
332437 materialPanel = new cGridBag().setVertical(true);
333438 materialPanel.setName("Material");
439
+
334440 /*JTextPane*/
335441 infoarea = createTextPane();
336442 doc = infoarea.getStyledDocument();
....@@ -343,7 +449,7 @@
343449 // TEXTAREA infoarea.setLineWrap(true);
344450 // TEXTAREA infoarea.setWrapStyleWord(true);
345451 infoPanel = new JScrollPane(infoarea, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); //AS_NEEDED);
346
- infoPanel.setPreferredSize(new Dimension(50, 200));
452
+ //infoPanel.setPreferredSize(new Dimension(50, 200));
347453 infoPanel.setName("Info");
348454 //infoPanel.setLayout(new BorderLayout());
349455 //infoPanel.add(createTextPane());
....@@ -355,7 +461,14 @@
355461 mainPanel.setDividerSize(9);
356462 mainPanel.setDividerLocation(0.5); //1.0);
357463 mainPanel.setResizeWeight(0.5);
358
-
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
+
359472 //ctrlPanel.setLayout(new GridLayout(4, 1, 5, 5));
360473 //mainPanel.setLayout(new GridBagLayout());
361474 toolbarPanel.setLayout(new FlowLayout(FlowLayout.LEFT));
....@@ -603,13 +716,24 @@
603716
604717 boolean maximized;
605718
719
+ cButton fullscreenLayout;
720
+
606721 void Minimize()
607722 {
608723 frame.setState(Frame.ICONIFIED);
724
+ frame.validate();
609725 }
610726
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={}
611730 void Maximize()
612731 {
732
+ if (CameraPane.FULLSCREEN)
733
+ {
734
+ ToggleFullScreen();
735
+ }
736
+
613737 if (maximized)
614738 {
615739 frame.setBounds(keeprect.x, keeprect.y, keeprect.width, keeprect.height);
....@@ -624,13 +748,23 @@
624748 }
625749
626750 maximized ^= true;
751
+
752
+ frame.validate();
627753 }
754
+
755
+ cButton minButton;
756
+ cButton maxButton;
757
+ cButton fullButton;
628758
629759 void ToggleFullScreen()
630760 {
631
- if (CameraPane.FULLSCREEN)
761
+ cameraView.ToggleFullScreen();
762
+
763
+ if (!CameraPane.FULLSCREEN)
632764 {
633765 device.setFullScreenWindow(null);
766
+ frame.validate();
767
+
634768 //frame.setVisible(false);
635769 // frame.removeNotify();
636770 // frame.setUndecorated(false);
....@@ -656,6 +790,7 @@
656790 // frame.getToolkit().getScreenSize().height);
657791 //frame.setVisible(false);
658792 device.setFullScreenWindow(frame);
793
+ frame.validate();
659794 // frame.removeNotify();
660795 // frame.setUndecorated(true);
661796 // frame.addNotify();
....@@ -664,12 +799,11 @@
664799 // X frame.getContentPane().add(/*"Center",*/bigThree);
665800 framePanel.setDividerLocation(0);
666801
667
- radio.layout = twoButton;
802
+ radio.layout = fullscreenLayout;
668803 radio.layout.doClick();
669804 //frame.setVisible(true);
670805 }
671
-
672
- cameraView.ToggleFullScreen();
806
+ frame.validate();
673807 }
674808
675809 private JTextPane createTextPane()
....@@ -810,7 +944,12 @@
810944 JCheckBox speedupCB;
811945 JCheckBox rewindCB;
812946 JCheckBox flipVCB;
947
+
948
+ cCheckBox toggleTextureCB;
949
+ cCheckBox toggleSwitchCB;
950
+
813951 JComboBox texresMenu;
952
+
814953 JButton resetButton;
815954 JButton stepButton;
816955 JButton stepAllButton;
....@@ -819,10 +958,13 @@
819958 JButton fasterButton;
820959 JButton remarkButton;
821960
961
+ cGridBag editPanel;
962
+ cGridBag editCommandsPanel;
963
+
822964 cGridBag namePanel;
823965 cGridBag setupPanel;
824966 cGridBag setupPanel2;
825
- cGridBag commandsPanel;
967
+ cGridBag objectCommandsPanel;
826968 cGridBag pushPanel;
827969 cGridBag fillPanel;
828970
....@@ -994,12 +1136,12 @@
9941136 namePanel = new cGridBag();
9951137
9961138 nameField = AddText(namePanel, copy.GetName());
997
- namePanel.add(nameField);
1139
+ namePanel.add(new JScrollPane(nameField, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER));
9981140 oe.ctrlPanel.add(namePanel);
9991141
10001142 oe.ctrlPanel.Return();
10011143
1002
- if (!GroupEditor.allparams)
1144
+ if (!allparams)
10031145 return;
10041146
10051147 setupPanel = new cGridBag().setVertical(false);
....@@ -1012,15 +1154,15 @@
10121154 hideCB = AddCheckBox(setupPanel, "Hide", copy.hide);
10131155 hideCB.setToolTipText("Hide object");
10141156 markCB = AddCheckBox(setupPanel, "Mark", copy.marked);
1015
- markCB.setToolTipText("Set the animation target transform");
1157
+ markCB.setToolTipText("As animation target transform");
10161158
10171159 setupPanel2 = new cGridBag().setVertical(false);
10181160
10191161 rewindCB = AddCheckBox(setupPanel2, "Rewind", copy.rewind);
10201162 rewindCB.setToolTipText("Rewind animation");
10211163
1022
- randomCB = AddCheckBox(setupPanel2, "Rand", copy.random);
1023
- randomCB.setToolTipText("Randomly Rewind or Go back and forth");
1164
+ randomCB = AddCheckBox(setupPanel2, "Random", copy.random);
1165
+ randomCB.setToolTipText("Randomly Rewind (or Go back and forth)");
10241166
10251167 if (Globals.ADVANCED)
10261168 {
....@@ -1035,23 +1177,23 @@
10351177 oe.ctrlPanel.add(setupPanel2);
10361178 oe.ctrlPanel.Return();
10371179
1038
- commandsPanel = new cGridBag().setVertical(false);
1180
+ objectCommandsPanel = new cGridBag().setVertical(false);
10391181
1040
- resetButton = AddButton(commandsPanel, "Reset");
1182
+ resetButton = AddButton(objectCommandsPanel, "Reset");
10411183 resetButton.setToolTipText("Jump to frame zero");
1042
- stepButton = AddButton(commandsPanel, "Step");
1184
+ stepButton = AddButton(objectCommandsPanel, "Step");
10431185 stepButton.setToolTipText("Step one frame");
10441186 // resetAllButton = AddButton(oe, "Reset All");
10451187 // stepAllButton = AddButton(oe, "Step All");
10461188 // Return();
1047
- slowerButton = AddButton(commandsPanel, "Slow");
1189
+ slowerButton = AddButton(objectCommandsPanel, "Slow");
10481190 slowerButton.setToolTipText("Decrease animation speed");
1049
- fasterButton = AddButton(commandsPanel, "Fast");
1191
+ fasterButton = AddButton(objectCommandsPanel, "Fast");
10501192 fasterButton.setToolTipText("Increase animation speed");
1051
- remarkButton = AddButton(commandsPanel, "Remark");
1193
+ remarkButton = AddButton(objectCommandsPanel, "Remark");
10521194 remarkButton.setToolTipText("Set the current transform as the target");
10531195
1054
- oe.ctrlPanel.add(commandsPanel);
1196
+ oe.ctrlPanel.add(objectCommandsPanel);
10551197 oe.ctrlPanel.Return();
10561198
10571199 pushPanel = AddSlider(oe.ctrlPanel, "Push", -1, 1, copy.NORMALPUSH, 1.1); // To have the buttons
....@@ -1340,8 +1482,9 @@
13401482 // north.setName("Edit");
13411483 // north.add(ctrlPanel, BorderLayout.NORTH);
13421484 // objectPanel.add(north);
1343
- objectPanel.add(ctrlPanel);
1485
+ objectPanel.add(editPanel);
13441486 objectPanel.add(infoPanel);
1487
+ objectPanel.add(toolboxPanel);
13451488
13461489 /*
13471490 aConstraints.gridx = 0;
....@@ -1350,7 +1493,7 @@
13501493 aConstraints.gridy += 1;
13511494 aConstraints.gridwidth = 1;
13521495 mainPanel.add(objectPanel, aConstraints);
1353
- */
1496
+ */
13541497
13551498 scrollpane = new JScrollPane(mainPanel, ScrollPaneConstants.// VERTICAL_SCROLLBAR_ALWAYS,
13561499 VERTICAL_SCROLLBAR_AS_NEEDED,
....@@ -1367,9 +1510,7 @@
13671510 JTabbedPane tabbedPane = new JTabbedPane();
13681511 tabbedPane.add(scrollpane);
13691512
1370
- tabbedPane.add(FSPane = new cFileSystemPane(this));
1371
-
1372
- optionsPanel = new cGridBag().setVertical(true);
1513
+ optionsPanel = new cGridBag().setVertical(false);
13731514
13741515 optionsPanel.setName("Options");
13751516
....@@ -1377,6 +1518,8 @@
13771518
13781519 tabbedPane.add(optionsPanel);
13791520
1521
+ tabbedPane.add(FSPane = new cFileSystemPane(this));
1522
+
13801523 scenePanel.add(tabbedPane);
13811524
13821525 /*
....@@ -1469,6 +1612,8 @@
14691612 // aConstraints = gbc; // (GridBagConstraints) GrafreeD.clone(gbc);
14701613
14711614 frame.setSize(1280, 860);
1615
+
1616
+ frame.validate();
14721617 frame.setVisible(true);
14731618
14741619 cameraView.requestFocusInWindow();
....@@ -1560,24 +1705,6 @@
15601705 texture.add(textureField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
15611706 colorSection.add(texture);
15621707
1563
- cGridBag anisoU = new cGridBag();
1564
- anisoU.add(anisoLabel = new JLabel("AnisoU")); // , aConstraints);
1565
- anisoLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1566
- anisoU.add(anisoField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1567
- colorSection.add(anisoU);
1568
-
1569
- cGridBag anisoV = new cGridBag();
1570
- anisoV.add(anisoVLabel = new JLabel("AnisoV")); // , aConstraints);
1571
- anisoVLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1572
- anisoV.add(anisoVField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1573
- colorSection.add(anisoV);
1574
-
1575
- cGridBag shadowbias = new cGridBag();
1576
- shadowbias.add(shadowbiasLabel = new JLabel("Shadowbias")); // , aConstraints);
1577
- shadowbiasLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1578
- shadowbias.add(shadowbiasField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1579
- colorSection.add(shadowbias);
1580
-
15811708 panel.add(new JSeparator());
15821709
15831710 panel.add(colorSection);
....@@ -1627,6 +1754,12 @@
16271754 fakedepthLabel.setHorizontalAlignment(SwingConstants.TRAILING);
16281755 fakedepth.add(fakedepthField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
16291756 diffuseSection.add(fakedepth);
1757
+
1758
+ cGridBag shadowbias = new cGridBag();
1759
+ shadowbias.add(shadowbiasLabel = new JLabel("Shadowbias")); // , aConstraints);
1760
+ shadowbiasLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1761
+ shadowbias.add(shadowbiasField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1762
+ diffuseSection.add(shadowbias);
16301763
16311764 panel.add(new JSeparator());
16321765
....@@ -1678,6 +1811,18 @@
16781811 // aConstraints.gridy += 1;
16791812 // aConstraints.gridwidth = 1;
16801813
1814
+ cGridBag anisoU = new cGridBag();
1815
+ anisoU.add(anisoLabel = new JLabel("AnisoU")); // , aConstraints);
1816
+ anisoLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1817
+ anisoU.add(anisoField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1818
+ specularSection.add(anisoU);
1819
+
1820
+ cGridBag anisoV = new cGridBag();
1821
+ anisoV.add(anisoVLabel = new JLabel("AnisoV")); // , aConstraints);
1822
+ anisoVLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1823
+ anisoV.add(anisoVField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1824
+ specularSection.add(anisoV);
1825
+
16811826
16821827 panel.add(new JSeparator());
16831828
....@@ -1685,35 +1830,35 @@
16851830
16861831 //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
16871832
1688
- cGridBag globalSection = new cGridBag().setVertical(true);
1833
+ //cGridBag globalSection = new cGridBag().setVertical(true);
16891834
16901835 cGridBag camera = new cGridBag();
16911836 camera.add(cameraLabel = new JLabel("GlobalLight")); // , aConstraints);
16921837 cameraLabel.setHorizontalAlignment(SwingConstants.TRAILING);
16931838 camera.add(cameraField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1694
- globalSection.add(camera);
1839
+ colorSection.add(camera);
16951840
16961841 cGridBag ambient = new cGridBag();
16971842 ambient.add(ambientLabel = new JLabel("Ambient")); // , aConstraints);
16981843 ambientLabel.setHorizontalAlignment(SwingConstants.TRAILING);
16991844 ambient.add(ambientField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1700
- globalSection.add(ambient);
1845
+ colorSection.add(ambient);
17011846
17021847 cGridBag backlit = new cGridBag();
17031848 backlit.add(backlitLabel = new JLabel("Backlit")); // , aConstraints);
17041849 backlitLabel.setHorizontalAlignment(SwingConstants.TRAILING);
17051850 backlit.add(backlitField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1706
- globalSection.add(backlit);
1851
+ colorSection.add(backlit);
17071852
17081853 cGridBag opacity = new cGridBag();
17091854 opacity.add(opacityLabel = new JLabel("Opacity")); // , aConstraints);
17101855 opacityLabel.setHorizontalAlignment(SwingConstants.TRAILING);
17111856 opacity.add(opacityField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1712
- globalSection.add(opacity);
1857
+ colorSection.add(opacity);
17131858
1714
- panel.add(new JSeparator());
1859
+ //panel.add(new JSeparator());
17151860
1716
- panel.add(globalSection);
1861
+ //panel.add(globalSection);
17171862
17181863 //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
17191864
....@@ -2788,6 +2933,8 @@
27882933
27892934 void SetMaterial(Object3D object)
27902935 {
2936
+ latestObject = object;
2937
+
27912938 cMaterial mat = object.material;
27922939
27932940 if (mat == null)
....@@ -2899,12 +3046,17 @@
28993046 // }
29003047
29013048 /**/
2902
- if (deselect)
3049
+ if (deselect || child == null)
29033050 {
29043051 //group.deselectAll();
29053052 //freeze = true;
29063053 GetTree().clearSelection();
29073054 //freeze = false;
3055
+
3056
+ if (child == null)
3057
+ {
3058
+ return;
3059
+ }
29083060 }
29093061
29103062 //group.addSelectee(child);
....@@ -2973,7 +3125,7 @@
29733125 cameraView.ToggleDL();
29743126 cameraView.repaint();
29753127 return;
2976
- } else if (event.getSource() == toggleTextureItem)
3128
+ } else if (event.getSource() == toggleTextureItem || event.getSource() == toggleTextureCB)
29773129 {
29783130 cameraView.ToggleTexture();
29793131 // june 2013 copy.HardTouch();
....@@ -3012,7 +3164,7 @@
30123164 frame.validate();
30133165
30143166 return;
3015
- } else if (event.getSource() == toggleSwitchItem)
3167
+ } else if (event.getSource() == toggleSwitchItem || event.getSource() == toggleSwitchCB)
30163168 {
30173169 cameraView.ToggleSwitch();
30183170 cameraView.repaint();
....@@ -3396,6 +3548,8 @@
33963548
33973549 public void Save()
33983550 {
3551
+ System.err.println("Save");
3552
+
33993553 cRadio tab = GetCurrentTab();
34003554
34013555 boolean temp = CameraPane.SWITCH;
....@@ -3403,8 +3557,10 @@
34033557
34043558 copy.ExtractBigData(hashtable);
34053559
3560
+ byte[] compress = Compress(copy);
3561
+
34063562 //EditorFrame.m_MainFrame.requestFocusInWindow();
3407
- tab.graphs[tab.undoindex++] = Compress(copy);
3563
+ tab.graphs[tab.undoindex++] = compress;
34083564
34093565 copy.RestoreBigData(hashtable);
34103566
....@@ -3417,6 +3573,8 @@
34173573 tab.graphs[i] = null;
34183574 }
34193575
3576
+ SetUndoStates();
3577
+
34203578 // test save
34213579 if (false)
34223580 {
....@@ -3439,6 +3597,8 @@
34393597
34403598 void CopyChanged(Object3D obj)
34413599 {
3600
+ SetUndoStates();
3601
+
34423602 boolean temp = CameraPane.SWITCH;
34433603 CameraPane.SWITCH = false;
34443604
....@@ -3478,8 +3638,21 @@
34783638 refreshContents();
34793639 }
34803640
3641
+ cButton undoButton;
3642
+ cButton redoButton;
3643
+
3644
+ void SetUndoStates()
3645
+ {
3646
+ cRadio tab = GetCurrentTab();
3647
+
3648
+ undoButton.setEnabled(tab.undoindex > 0);
3649
+ redoButton.setEnabled(tab.graphs[tab.undoindex + 1] != null);
3650
+ }
3651
+
34813652 public void Undo()
34823653 {
3654
+ System.err.println("Undo");
3655
+
34833656 cRadio tab = GetCurrentTab();
34843657
34853658 if (tab.undoindex == 0)
....@@ -3663,7 +3836,7 @@
36633836 assert false;
36643837 }
36653838
3666
- void EditSelection()
3839
+ void EditSelection(boolean newWindow)
36673840 {
36683841 }
36693842
....@@ -4158,7 +4331,8 @@
41584331
41594332 void makeSomething(Object3D thing, boolean resetmodel) // deselect)
41604333 {
4161
- Save();
4334
+ if (Globals.SAVEONMAKE) // && resetmodel)
4335
+ Save();
41624336 //Tween.set(thing, 0).target(1).start(tweenManager);
41634337 //Tween.to(thing, 0, 0.5f).target(0).start(tweenManager);
41644338 // if (thing instanceof GenericJointDemo)
....@@ -4245,6 +4419,12 @@
42454419 {
42464420 ResetModel();
42474421 Select(thing.GetTreePath(), true, false); // unselect... false);
4422
+
4423
+ if (thing.Size() == 0)
4424
+ {
4425
+ //EditSelection(false);
4426
+ }
4427
+
42484428 refreshContents();
42494429 }
42504430
....@@ -4467,6 +4647,7 @@
44674647
44684648 if (readobj != null)
44694649 {
4650
+ if (Globals.SAVEONMAKE)
44704651 Save();
44714652 try
44724653 {
....@@ -4645,6 +4826,8 @@
46454826 String filename = browser.getFile();
46464827 if (filename != null && filename.length() > 0)
46474828 {
4829
+ if (!filename.endsWith(".gfd"))
4830
+ filename += ".gfd";
46484831 lastname = browser.getDirectory() + filename;
46494832 save();
46504833 }
....@@ -4838,18 +5021,31 @@
48385021 CheckboxMenuItem togglePaintItem;
48395022 JSplitPane mainPanel;
48405023 JScrollPane scrollpane;
5024
+
48415025 JPanel toolbarPanel;
5026
+
48425027 cGridBag treePanel;
5028
+
48435029 JPanel radioPanel;
48445030 ButtonGroup buttonGroup;
4845
- cGridBag ctrlPanel;
5031
+
5032
+ cGridBag toolboxPanel;
48465033 cGridBag materialPanel;
5034
+ cGridBag ctrlPanel;
5035
+
48475036 JScrollPane infoPanel;
5037
+
48485038 cGridBag optionsPanel;
5039
+
48495040 JTabbedPane objectPanel;
5041
+ boolean materialFlushed;
5042
+ Object3D latestObject;
5043
+
48505044 cGridBag XYZPanel;
5045
+
48515046 JSplitPane gridPanel;
48525047 JSplitPane bigPanel;
5048
+
48535049 cGridBag bigThree;
48545050 cGridBag scenePanel;
48555051 cGridBag centralPanel;
....@@ -4964,7 +5160,7 @@
49645160 cNumberSlider fogField;
49655161 JLabel opacityPowerLabel;
49665162 cNumberSlider opacityPowerField;
4967
- JTree jTree;
5163
+ cTree jTree;
49685164 //ObjectUI parent;
49695165
49705166 cNumberSlider normalpushField;