Normand Briere
2019-06-30 cfd7a643cb5a445016ddb15595158ecc59b184fd
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
....@@ -246,7 +309,7 @@
246309 //localCopy.parent = null;
247310
248311 frame = new JFrame();
249
- frame.setUndecorated(true);
312
+ frame.setUndecorated(false);
250313 objEditor = this;
251314 this.callee = callee;
252315
....@@ -276,6 +339,11 @@
276339 {
277340 return frame.action(event, obj);
278341 }
342
+
343
+ // Cannot work without static
344
+ static boolean allparams = true;
345
+
346
+ static java.util.Vector<Object3D> listUI = new java.util.Vector<Object3D>();
279347
280348 void SetupMenu()
281349 {
....@@ -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));
....@@ -586,8 +699,8 @@
586699 }
587700 }
588701
589
-static GraphicsDevice device = GraphicsEnvironment
590
- .getLocalGraphicsEnvironment().getScreenDevices()[0];
702
+//static GraphicsDevice device = GraphicsEnvironment
703
+// .getLocalGraphicsEnvironment().getScreenDevices()[0];
591704
592705 Rectangle keeprect;
593706 cRadio radio;
....@@ -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);
....@@ -617,20 +741,36 @@
617741 else
618742 {
619743 keeprect = frame.getBounds();
620
- Rectangle rect = GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds();
621
- Dimension rect2 = frame.getToolkit().getScreenSize();
622
- 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);
623747 // frame.setState(Frame.MAXIMIZED_BOTH);
748
+ frame.setBounds(frame.getGraphicsConfiguration().getBounds());
624749 }
625750
626751 maximized ^= true;
752
+
753
+ frame.validate();
627754 }
755
+
756
+ cButton minButton;
757
+ cButton maxButton;
758
+ cButton fullButton;
628759
629760 void ToggleFullScreen()
630761 {
631
- if (CameraPane.FULLSCREEN)
762
+GraphicsDevice device = frame.getGraphicsConfiguration().getDevice();
763
+
764
+ cameraView.ToggleFullScreen();
765
+
766
+ if (!CameraPane.FULLSCREEN)
632767 {
633768 device.setFullScreenWindow(null);
769
+ frame.dispose();
770
+ frame.setUndecorated(false);
771
+ frame.validate();
772
+ frame.setVisible(true);
773
+
634774 //frame.setVisible(false);
635775 // frame.removeNotify();
636776 // frame.setUndecorated(false);
....@@ -655,7 +795,12 @@
655795 // frame.setBounds(0, 0, frame.getToolkit().getScreenSize().width,
656796 // frame.getToolkit().getScreenSize().height);
657797 //frame.setVisible(false);
798
+
799
+ frame.dispose();
800
+ frame.setUndecorated(true);
658801 device.setFullScreenWindow(frame);
802
+ frame.validate();
803
+ frame.setVisible(true);
659804 // frame.removeNotify();
660805 // frame.setUndecorated(true);
661806 // frame.addNotify();
....@@ -664,12 +809,11 @@
664809 // X frame.getContentPane().add(/*"Center",*/bigThree);
665810 framePanel.setDividerLocation(0);
666811
667
- radio.layout = twoButton;
812
+ radio.layout = fullscreenLayout;
668813 radio.layout.doClick();
669814 //frame.setVisible(true);
670815 }
671
-
672
- cameraView.ToggleFullScreen();
816
+ frame.validate();
673817 }
674818
675819 private JTextPane createTextPane()
....@@ -810,7 +954,12 @@
810954 JCheckBox speedupCB;
811955 JCheckBox rewindCB;
812956 JCheckBox flipVCB;
957
+
958
+ cCheckBox toggleTextureCB;
959
+ cCheckBox toggleSwitchCB;
960
+
813961 JComboBox texresMenu;
962
+
814963 JButton resetButton;
815964 JButton stepButton;
816965 JButton stepAllButton;
....@@ -819,10 +968,13 @@
819968 JButton fasterButton;
820969 JButton remarkButton;
821970
971
+ cGridBag editPanel;
972
+ cGridBag editCommandsPanel;
973
+
822974 cGridBag namePanel;
823975 cGridBag setupPanel;
824976 cGridBag setupPanel2;
825
- cGridBag commandsPanel;
977
+ cGridBag objectCommandsPanel;
826978 cGridBag pushPanel;
827979 cGridBag fillPanel;
828980
....@@ -994,12 +1146,12 @@
9941146 namePanel = new cGridBag();
9951147
9961148 nameField = AddText(namePanel, copy.GetName());
997
- namePanel.add(nameField);
1149
+ namePanel.add(new JScrollPane(nameField, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER));
9981150 oe.ctrlPanel.add(namePanel);
9991151
10001152 oe.ctrlPanel.Return();
10011153
1002
- if (!GroupEditor.allparams)
1154
+ if (!allparams)
10031155 return;
10041156
10051157 setupPanel = new cGridBag().setVertical(false);
....@@ -1012,15 +1164,15 @@
10121164 hideCB = AddCheckBox(setupPanel, "Hide", copy.hide);
10131165 hideCB.setToolTipText("Hide object");
10141166 markCB = AddCheckBox(setupPanel, "Mark", copy.marked);
1015
- markCB.setToolTipText("Set the animation target transform");
1167
+ markCB.setToolTipText("As animation target transform");
10161168
10171169 setupPanel2 = new cGridBag().setVertical(false);
10181170
10191171 rewindCB = AddCheckBox(setupPanel2, "Rewind", copy.rewind);
10201172 rewindCB.setToolTipText("Rewind animation");
10211173
1022
- randomCB = AddCheckBox(setupPanel2, "Rand", copy.random);
1023
- randomCB.setToolTipText("Randomly Rewind or Go back and forth");
1174
+ randomCB = AddCheckBox(setupPanel2, "Random", copy.random);
1175
+ randomCB.setToolTipText("Randomly Rewind (or Go back and forth)");
10241176
10251177 if (Globals.ADVANCED)
10261178 {
....@@ -1035,23 +1187,23 @@
10351187 oe.ctrlPanel.add(setupPanel2);
10361188 oe.ctrlPanel.Return();
10371189
1038
- commandsPanel = new cGridBag().setVertical(false);
1190
+ objectCommandsPanel = new cGridBag().setVertical(false);
10391191
1040
- resetButton = AddButton(commandsPanel, "Reset");
1192
+ resetButton = AddButton(objectCommandsPanel, "Reset");
10411193 resetButton.setToolTipText("Jump to frame zero");
1042
- stepButton = AddButton(commandsPanel, "Step");
1194
+ stepButton = AddButton(objectCommandsPanel, "Step");
10431195 stepButton.setToolTipText("Step one frame");
10441196 // resetAllButton = AddButton(oe, "Reset All");
10451197 // stepAllButton = AddButton(oe, "Step All");
10461198 // Return();
1047
- slowerButton = AddButton(commandsPanel, "Slow");
1199
+ slowerButton = AddButton(objectCommandsPanel, "Slow");
10481200 slowerButton.setToolTipText("Decrease animation speed");
1049
- fasterButton = AddButton(commandsPanel, "Fast");
1201
+ fasterButton = AddButton(objectCommandsPanel, "Fast");
10501202 fasterButton.setToolTipText("Increase animation speed");
1051
- remarkButton = AddButton(commandsPanel, "Remark");
1203
+ remarkButton = AddButton(objectCommandsPanel, "Remark");
10521204 remarkButton.setToolTipText("Set the current transform as the target");
10531205
1054
- oe.ctrlPanel.add(commandsPanel);
1206
+ oe.ctrlPanel.add(objectCommandsPanel);
10551207 oe.ctrlPanel.Return();
10561208
10571209 pushPanel = AddSlider(oe.ctrlPanel, "Push", -1, 1, copy.NORMALPUSH, 1.1); // To have the buttons
....@@ -1340,8 +1492,9 @@
13401492 // north.setName("Edit");
13411493 // north.add(ctrlPanel, BorderLayout.NORTH);
13421494 // objectPanel.add(north);
1343
- objectPanel.add(ctrlPanel);
1495
+ objectPanel.add(editPanel);
13441496 objectPanel.add(infoPanel);
1497
+ objectPanel.add(toolboxPanel);
13451498
13461499 /*
13471500 aConstraints.gridx = 0;
....@@ -1350,7 +1503,7 @@
13501503 aConstraints.gridy += 1;
13511504 aConstraints.gridwidth = 1;
13521505 mainPanel.add(objectPanel, aConstraints);
1353
- */
1506
+ */
13541507
13551508 scrollpane = new JScrollPane(mainPanel, ScrollPaneConstants.// VERTICAL_SCROLLBAR_ALWAYS,
13561509 VERTICAL_SCROLLBAR_AS_NEEDED,
....@@ -1367,9 +1520,7 @@
13671520 JTabbedPane tabbedPane = new JTabbedPane();
13681521 tabbedPane.add(scrollpane);
13691522
1370
- tabbedPane.add(FSPane = new cFileSystemPane(this));
1371
-
1372
- optionsPanel = new cGridBag().setVertical(true);
1523
+ optionsPanel = new cGridBag().setVertical(false);
13731524
13741525 optionsPanel.setName("Options");
13751526
....@@ -1377,6 +1528,8 @@
13771528
13781529 tabbedPane.add(optionsPanel);
13791530
1531
+ tabbedPane.add(FSPane = new cFileSystemPane(this));
1532
+
13801533 scenePanel.add(tabbedPane);
13811534
13821535 /*
....@@ -1469,11 +1622,14 @@
14691622 // aConstraints = gbc; // (GridBagConstraints) GrafreeD.clone(gbc);
14701623
14711624 frame.setSize(1280, 860);
1472
- frame.setVisible(true);
1473
-
1625
+
14741626 cameraView.requestFocusInWindow();
14751627
14761628 gridPanel.setDividerLocation(1.0);
1629
+
1630
+ frame.validate();
1631
+
1632
+ frame.setVisible(true);
14771633
14781634 frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
14791635 frame.addWindowListener(new WindowAdapter()
....@@ -1560,24 +1716,6 @@
15601716 texture.add(textureField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
15611717 colorSection.add(texture);
15621718
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
-
15811719 panel.add(new JSeparator());
15821720
15831721 panel.add(colorSection);
....@@ -1627,6 +1765,12 @@
16271765 fakedepthLabel.setHorizontalAlignment(SwingConstants.TRAILING);
16281766 fakedepth.add(fakedepthField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
16291767 diffuseSection.add(fakedepth);
1768
+
1769
+ cGridBag shadowbias = new cGridBag();
1770
+ shadowbias.add(shadowbiasLabel = new JLabel("Shadowbias")); // , aConstraints);
1771
+ shadowbiasLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1772
+ shadowbias.add(shadowbiasField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1773
+ diffuseSection.add(shadowbias);
16301774
16311775 panel.add(new JSeparator());
16321776
....@@ -1678,6 +1822,18 @@
16781822 // aConstraints.gridy += 1;
16791823 // aConstraints.gridwidth = 1;
16801824
1825
+ cGridBag anisoU = new cGridBag();
1826
+ anisoU.add(anisoLabel = new JLabel("AnisoU")); // , aConstraints);
1827
+ anisoLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1828
+ anisoU.add(anisoField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1829
+ specularSection.add(anisoU);
1830
+
1831
+ cGridBag anisoV = new cGridBag();
1832
+ anisoV.add(anisoVLabel = new JLabel("AnisoV")); // , aConstraints);
1833
+ anisoVLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1834
+ anisoV.add(anisoVField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1835
+ specularSection.add(anisoV);
1836
+
16811837
16821838 panel.add(new JSeparator());
16831839
....@@ -1685,35 +1841,35 @@
16851841
16861842 //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
16871843
1688
- cGridBag globalSection = new cGridBag().setVertical(true);
1844
+ //cGridBag globalSection = new cGridBag().setVertical(true);
16891845
16901846 cGridBag camera = new cGridBag();
16911847 camera.add(cameraLabel = new JLabel("GlobalLight")); // , aConstraints);
16921848 cameraLabel.setHorizontalAlignment(SwingConstants.TRAILING);
16931849 camera.add(cameraField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1694
- globalSection.add(camera);
1850
+ colorSection.add(camera);
16951851
16961852 cGridBag ambient = new cGridBag();
16971853 ambient.add(ambientLabel = new JLabel("Ambient")); // , aConstraints);
16981854 ambientLabel.setHorizontalAlignment(SwingConstants.TRAILING);
16991855 ambient.add(ambientField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1700
- globalSection.add(ambient);
1856
+ colorSection.add(ambient);
17011857
17021858 cGridBag backlit = new cGridBag();
17031859 backlit.add(backlitLabel = new JLabel("Backlit")); // , aConstraints);
17041860 backlitLabel.setHorizontalAlignment(SwingConstants.TRAILING);
17051861 backlit.add(backlitField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1706
- globalSection.add(backlit);
1862
+ colorSection.add(backlit);
17071863
17081864 cGridBag opacity = new cGridBag();
17091865 opacity.add(opacityLabel = new JLabel("Opacity")); // , aConstraints);
17101866 opacityLabel.setHorizontalAlignment(SwingConstants.TRAILING);
17111867 opacity.add(opacityField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1712
- globalSection.add(opacity);
1868
+ colorSection.add(opacity);
17131869
1714
- panel.add(new JSeparator());
1870
+ //panel.add(new JSeparator());
17151871
1716
- panel.add(globalSection);
1872
+ //panel.add(globalSection);
17171873
17181874 //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
17191875
....@@ -2788,6 +2944,8 @@
27882944
27892945 void SetMaterial(Object3D object)
27902946 {
2947
+ latestObject = object;
2948
+
27912949 cMaterial mat = object.material;
27922950
27932951 if (mat == null)
....@@ -2899,12 +3057,17 @@
28993057 // }
29003058
29013059 /**/
2902
- if (deselect)
3060
+ if (deselect || child == null)
29033061 {
29043062 //group.deselectAll();
29053063 //freeze = true;
29063064 GetTree().clearSelection();
29073065 //freeze = false;
3066
+
3067
+ if (child == null)
3068
+ {
3069
+ return;
3070
+ }
29083071 }
29093072
29103073 //group.addSelectee(child);
....@@ -2973,7 +3136,7 @@
29733136 cameraView.ToggleDL();
29743137 cameraView.repaint();
29753138 return;
2976
- } else if (event.getSource() == toggleTextureItem)
3139
+ } else if (event.getSource() == toggleTextureItem || event.getSource() == toggleTextureCB)
29773140 {
29783141 cameraView.ToggleTexture();
29793142 // june 2013 copy.HardTouch();
....@@ -3012,7 +3175,7 @@
30123175 frame.validate();
30133176
30143177 return;
3015
- } else if (event.getSource() == toggleSwitchItem)
3178
+ } else if (event.getSource() == toggleSwitchItem || event.getSource() == toggleSwitchCB)
30163179 {
30173180 cameraView.ToggleSwitch();
30183181 cameraView.repaint();
....@@ -3396,6 +3559,8 @@
33963559
33973560 public void Save()
33983561 {
3562
+ System.err.println("Save");
3563
+
33993564 cRadio tab = GetCurrentTab();
34003565
34013566 boolean temp = CameraPane.SWITCH;
....@@ -3403,8 +3568,10 @@
34033568
34043569 copy.ExtractBigData(hashtable);
34053570
3571
+ byte[] compress = Compress(copy);
3572
+
34063573 //EditorFrame.m_MainFrame.requestFocusInWindow();
3407
- tab.graphs[tab.undoindex++] = Compress(copy);
3574
+ tab.graphs[tab.undoindex++] = compress;
34083575
34093576 copy.RestoreBigData(hashtable);
34103577
....@@ -3417,6 +3584,8 @@
34173584 tab.graphs[i] = null;
34183585 }
34193586
3587
+ SetUndoStates();
3588
+
34203589 // test save
34213590 if (false)
34223591 {
....@@ -3439,6 +3608,8 @@
34393608
34403609 void CopyChanged(Object3D obj)
34413610 {
3611
+ SetUndoStates();
3612
+
34423613 boolean temp = CameraPane.SWITCH;
34433614 CameraPane.SWITCH = false;
34443615
....@@ -3478,8 +3649,21 @@
34783649 refreshContents();
34793650 }
34803651
3652
+ cButton undoButton;
3653
+ cButton redoButton;
3654
+
3655
+ void SetUndoStates()
3656
+ {
3657
+ cRadio tab = GetCurrentTab();
3658
+
3659
+ undoButton.setEnabled(tab.undoindex > 0);
3660
+ redoButton.setEnabled(tab.graphs[tab.undoindex + 1] != null);
3661
+ }
3662
+
34813663 public void Undo()
34823664 {
3665
+ System.err.println("Undo");
3666
+
34833667 cRadio tab = GetCurrentTab();
34843668
34853669 if (tab.undoindex == 0)
....@@ -3663,7 +3847,7 @@
36633847 assert false;
36643848 }
36653849
3666
- void EditSelection()
3850
+ void EditSelection(boolean newWindow)
36673851 {
36683852 }
36693853
....@@ -4158,7 +4342,8 @@
41584342
41594343 void makeSomething(Object3D thing, boolean resetmodel) // deselect)
41604344 {
4161
- Save();
4345
+ if (Globals.SAVEONMAKE) // && resetmodel)
4346
+ Save();
41624347 //Tween.set(thing, 0).target(1).start(tweenManager);
41634348 //Tween.to(thing, 0, 0.5f).target(0).start(tweenManager);
41644349 // if (thing instanceof GenericJointDemo)
....@@ -4245,6 +4430,12 @@
42454430 {
42464431 ResetModel();
42474432 Select(thing.GetTreePath(), true, false); // unselect... false);
4433
+
4434
+ if (thing.Size() == 0)
4435
+ {
4436
+ //EditSelection(false);
4437
+ }
4438
+
42484439 refreshContents();
42494440 }
42504441
....@@ -4467,6 +4658,7 @@
44674658
44684659 if (readobj != null)
44694660 {
4661
+ if (Globals.SAVEONMAKE)
44704662 Save();
44714663 try
44724664 {
....@@ -4645,6 +4837,8 @@
46454837 String filename = browser.getFile();
46464838 if (filename != null && filename.length() > 0)
46474839 {
4840
+ if (!filename.endsWith(".gfd"))
4841
+ filename += ".gfd";
46484842 lastname = browser.getDirectory() + filename;
46494843 save();
46504844 }
....@@ -4838,18 +5032,31 @@
48385032 CheckboxMenuItem togglePaintItem;
48395033 JSplitPane mainPanel;
48405034 JScrollPane scrollpane;
5035
+
48415036 JPanel toolbarPanel;
5037
+
48425038 cGridBag treePanel;
5039
+
48435040 JPanel radioPanel;
48445041 ButtonGroup buttonGroup;
4845
- cGridBag ctrlPanel;
5042
+
5043
+ cGridBag toolboxPanel;
48465044 cGridBag materialPanel;
5045
+ cGridBag ctrlPanel;
5046
+
48475047 JScrollPane infoPanel;
5048
+
48485049 cGridBag optionsPanel;
5050
+
48495051 JTabbedPane objectPanel;
5052
+ boolean materialFlushed;
5053
+ Object3D latestObject;
5054
+
48505055 cGridBag XYZPanel;
5056
+
48515057 JSplitPane gridPanel;
48525058 JSplitPane bigPanel;
5059
+
48535060 cGridBag bigThree;
48545061 cGridBag scenePanel;
48555062 cGridBag centralPanel;
....@@ -4964,7 +5171,7 @@
49645171 cNumberSlider fogField;
49655172 JLabel opacityPowerLabel;
49665173 cNumberSlider opacityPowerField;
4967
- JTree jTree;
5174
+ cTree jTree;
49685175 //ObjectUI parent;
49695176
49705177 cNumberSlider normalpushField;