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
....@@ -35,6 +39,67 @@
3539
3640 GroupEditor callee;
3741 JFrame frame;
42
+
43
+ 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
+ }
38103
39104 // SCRIPT
40105
....@@ -145,7 +210,7 @@
145210
146211 objEditor.ctrlPanel.remove(namePanel);
147212
148
- if (!GroupEditor.allparams)
213
+ if (!allparams)
149214 return;
150215
151216 // objEditor.ctrlPanel.remove(liveCB);
....@@ -169,7 +234,7 @@
169234
170235 objEditor.ctrlPanel.remove(setupPanel);
171236 objEditor.ctrlPanel.remove(setupPanel2);
172
- objEditor.ctrlPanel.remove(commandsPanel);
237
+ objEditor.ctrlPanel.remove(objectCommandsPanel);
173238 objEditor.ctrlPanel.remove(pushPanel);
174239 //objEditor.ctrlPanel.remove(fillPanel);
175240
....@@ -244,6 +309,7 @@
244309 //localCopy.parent = null;
245310
246311 frame = new JFrame();
312
+ frame.setUndecorated(true);
247313 objEditor = this;
248314 this.callee = callee;
249315
....@@ -273,6 +339,11 @@
273339 {
274340 return frame.action(event, obj);
275341 }
342
+
343
+ // Cannot work without static
344
+ static boolean allparams = true;
345
+
346
+ static java.util.Vector<Object3D> listUI = new java.util.Vector<Object3D>();
276347
277348 void SetupMenu()
278349 {
....@@ -320,14 +391,52 @@
320391 closeItem.addActionListener(this);
321392
322393 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
+
323420 toolbarPanel = new JPanel();
324421 toolbarPanel.setName("Toolbar");
325422 treePanel = new cGridBag();
326423 treePanel.setName("Tree");
424
+
425
+ editPanel = new cGridBag().setVertical(true);
426
+ editPanel.setName("Edit");
427
+
327428 ctrlPanel = new cGridBag().setVertical(false); // new GridBagLayout());
328
- 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
+
329437 materialPanel = new cGridBag().setVertical(true);
330438 materialPanel.setName("Material");
439
+
331440 /*JTextPane*/
332441 infoarea = createTextPane();
333442 doc = infoarea.getStyledDocument();
....@@ -340,7 +449,7 @@
340449 // TEXTAREA infoarea.setLineWrap(true);
341450 // TEXTAREA infoarea.setWrapStyleWord(true);
342451 infoPanel = new JScrollPane(infoarea, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); //AS_NEEDED);
343
- infoPanel.setPreferredSize(new Dimension(50, 200));
452
+ //infoPanel.setPreferredSize(new Dimension(50, 200));
344453 infoPanel.setName("Info");
345454 //infoPanel.setLayout(new BorderLayout());
346455 //infoPanel.add(createTextPane());
....@@ -352,7 +461,14 @@
352461 mainPanel.setDividerSize(9);
353462 mainPanel.setDividerLocation(0.5); //1.0);
354463 mainPanel.setResizeWeight(0.5);
355
-
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
+
356472 //ctrlPanel.setLayout(new GridLayout(4, 1, 5, 5));
357473 //mainPanel.setLayout(new GridBagLayout());
358474 toolbarPanel.setLayout(new FlowLayout(FlowLayout.LEFT));
....@@ -583,20 +699,111 @@
583699 }
584700 }
585701
702
+static GraphicsDevice device = GraphicsEnvironment
703
+ .getLocalGraphicsEnvironment().getScreenDevices()[0];
704
+
705
+ Rectangle keeprect;
706
+ cRadio radio;
707
+
708
+cButton keepButton;
709
+ cButton twoButton; // Full 3D
710
+ cButton sixButton;
711
+ cButton threeButton;
712
+ cButton sevenButton;
713
+ cButton fourButton; // full panel
714
+ cButton oneButton; // full XYZ
715
+ //cButton currentLayout;
716
+
717
+ boolean maximized;
718
+
719
+ cButton fullscreenLayout;
720
+
721
+ void Minimize()
722
+ {
723
+ frame.setState(Frame.ICONIFIED);
724
+ frame.validate();
725
+ }
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={}
730
+ void Maximize()
731
+ {
732
+ if (CameraPane.FULLSCREEN)
733
+ {
734
+ ToggleFullScreen();
735
+ }
736
+
737
+ if (maximized)
738
+ {
739
+ frame.setBounds(keeprect.x, keeprect.y, keeprect.width, keeprect.height);
740
+ }
741
+ else
742
+ {
743
+ keeprect = frame.getBounds();
744
+ Rectangle rect = GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds();
745
+ Dimension rect2 = frame.getToolkit().getScreenSize();
746
+ frame.setBounds(0, rect2.height - rect.height, rect.width, rect.height);
747
+// frame.setState(Frame.MAXIMIZED_BOTH);
748
+ }
749
+
750
+ maximized ^= true;
751
+
752
+ frame.validate();
753
+ }
754
+
755
+ cButton minButton;
756
+ cButton maxButton;
757
+ cButton fullButton;
758
+
586759 void ToggleFullScreen()
587760 {
588
- if (CameraPane.FULLSCREEN)
761
+ cameraView.ToggleFullScreen();
762
+
763
+ if (!CameraPane.FULLSCREEN)
589764 {
590
- frame.getContentPane().remove(/*"Center",*/bigThree);
591
- framePanel.add(bigThree);
592
- frame.getContentPane().add(/*"Center",*/framePanel);
765
+ device.setFullScreenWindow(null);
766
+ frame.validate();
767
+
768
+ //frame.setVisible(false);
769
+// frame.removeNotify();
770
+// frame.setUndecorated(false);
771
+// frame.addNotify();
772
+ //frame.setBounds(keeprect.x, keeprect.y, keeprect.width, keeprect.height);
773
+
774
+// X frame.getContentPane().remove(/*"Center",*/bigThree);
775
+// X framePanel.add(bigThree);
776
+// X frame.getContentPane().add(/*"Center",*/framePanel);
777
+ framePanel.setDividerLocation(1);
778
+
779
+ //frame.setVisible(true);
780
+ radio.layout = keepButton;
781
+ //theFrame = null;
782
+ keepButton = null;
783
+ radio.layout.doClick();
784
+
593785 } else
594786 {
595
- frame.getContentPane().remove(/*"Center",*/framePanel);
596
- framePanel.remove(bigThree);
597
- frame.getContentPane().add(/*"Center",*/bigThree);
787
+ keepButton = radio.layout;
788
+ //keeprect = frame.getBounds();
789
+// frame.setBounds(0, 0, frame.getToolkit().getScreenSize().width,
790
+// frame.getToolkit().getScreenSize().height);
791
+ //frame.setVisible(false);
792
+ device.setFullScreenWindow(frame);
793
+ frame.validate();
794
+// frame.removeNotify();
795
+// frame.setUndecorated(true);
796
+// frame.addNotify();
797
+// X frame.getContentPane().remove(/*"Center",*/framePanel);
798
+// X framePanel.remove(bigThree);
799
+// X frame.getContentPane().add(/*"Center",*/bigThree);
800
+ framePanel.setDividerLocation(0);
801
+
802
+ radio.layout = fullscreenLayout;
803
+ radio.layout.doClick();
804
+ //frame.setVisible(true);
598805 }
599
- cameraView.ToggleFullScreen();
806
+ frame.validate();
600807 }
601808
602809 private JTextPane createTextPane()
....@@ -737,7 +944,12 @@
737944 JCheckBox speedupCB;
738945 JCheckBox rewindCB;
739946 JCheckBox flipVCB;
947
+
948
+ cCheckBox toggleTextureCB;
949
+ cCheckBox toggleSwitchCB;
950
+
740951 JComboBox texresMenu;
952
+
741953 JButton resetButton;
742954 JButton stepButton;
743955 JButton stepAllButton;
....@@ -746,10 +958,13 @@
746958 JButton fasterButton;
747959 JButton remarkButton;
748960
961
+ cGridBag editPanel;
962
+ cGridBag editCommandsPanel;
963
+
749964 cGridBag namePanel;
750965 cGridBag setupPanel;
751966 cGridBag setupPanel2;
752
- cGridBag commandsPanel;
967
+ cGridBag objectCommandsPanel;
753968 cGridBag pushPanel;
754969 cGridBag fillPanel;
755970
....@@ -921,12 +1136,12 @@
9211136 namePanel = new cGridBag();
9221137
9231138 nameField = AddText(namePanel, copy.GetName());
924
- namePanel.add(nameField);
1139
+ namePanel.add(new JScrollPane(nameField, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER));
9251140 oe.ctrlPanel.add(namePanel);
9261141
9271142 oe.ctrlPanel.Return();
9281143
929
- if (!GroupEditor.allparams)
1144
+ if (!allparams)
9301145 return;
9311146
9321147 setupPanel = new cGridBag().setVertical(false);
....@@ -939,15 +1154,15 @@
9391154 hideCB = AddCheckBox(setupPanel, "Hide", copy.hide);
9401155 hideCB.setToolTipText("Hide object");
9411156 markCB = AddCheckBox(setupPanel, "Mark", copy.marked);
942
- markCB.setToolTipText("Set the animation target transform");
1157
+ markCB.setToolTipText("As animation target transform");
9431158
9441159 setupPanel2 = new cGridBag().setVertical(false);
9451160
9461161 rewindCB = AddCheckBox(setupPanel2, "Rewind", copy.rewind);
9471162 rewindCB.setToolTipText("Rewind animation");
9481163
949
- randomCB = AddCheckBox(setupPanel2, "Rand", copy.random);
950
- randomCB.setToolTipText("Rewind or Go back and forth randomly");
1164
+ randomCB = AddCheckBox(setupPanel2, "Random", copy.random);
1165
+ randomCB.setToolTipText("Randomly Rewind (or Go back and forth)");
9511166
9521167 if (Globals.ADVANCED)
9531168 {
....@@ -962,23 +1177,23 @@
9621177 oe.ctrlPanel.add(setupPanel2);
9631178 oe.ctrlPanel.Return();
9641179
965
- commandsPanel = new cGridBag().setVertical(false);
1180
+ objectCommandsPanel = new cGridBag().setVertical(false);
9661181
967
- resetButton = AddButton(commandsPanel, "Reset");
1182
+ resetButton = AddButton(objectCommandsPanel, "Reset");
9681183 resetButton.setToolTipText("Jump to frame zero");
969
- stepButton = AddButton(commandsPanel, "Step");
1184
+ stepButton = AddButton(objectCommandsPanel, "Step");
9701185 stepButton.setToolTipText("Step one frame");
9711186 // resetAllButton = AddButton(oe, "Reset All");
9721187 // stepAllButton = AddButton(oe, "Step All");
9731188 // Return();
974
- slowerButton = AddButton(commandsPanel, "Slow");
1189
+ slowerButton = AddButton(objectCommandsPanel, "Slow");
9751190 slowerButton.setToolTipText("Decrease animation speed");
976
- fasterButton = AddButton(commandsPanel, "Fast");
1191
+ fasterButton = AddButton(objectCommandsPanel, "Fast");
9771192 fasterButton.setToolTipText("Increase animation speed");
978
- remarkButton = AddButton(commandsPanel, "Remark");
1193
+ remarkButton = AddButton(objectCommandsPanel, "Remark");
9791194 remarkButton.setToolTipText("Set the current transform as the target");
9801195
981
- oe.ctrlPanel.add(commandsPanel);
1196
+ oe.ctrlPanel.add(objectCommandsPanel);
9821197 oe.ctrlPanel.Return();
9831198
9841199 pushPanel = AddSlider(oe.ctrlPanel, "Push", -1, 1, copy.NORMALPUSH, 1.1); // To have the buttons
....@@ -1184,8 +1399,11 @@
11841399 //worldPanel.setName("World");
11851400 centralPanel = new cGridBag();
11861401 centralPanel.preferredWidth = 20;
1187
- timelinePanel = new JPanel(new BorderLayout());
1188
- timelineMenubar = new timeflow.app.TimeflowApp().TimeFlowWindow(timelinePanel);
1402
+
1403
+ if (Globals.ADVANCED)
1404
+ {
1405
+ timelinePanel = new JPanel(new BorderLayout());
1406
+ timelineMenubar = new timeflow.app.TimeflowApp().TimeFlowWindow(timelinePanel);
11891407
11901408 cameraPanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, cameraView, timelinePanel);
11911409 cameraPanel.setContinuousLayout(true);
....@@ -1194,7 +1412,10 @@
11941412 // cameraPanel.setDividerSize(9);
11951413 cameraPanel.setResizeWeight(1.0);
11961414
1415
+ }
1416
+
11971417 centralPanel.add(cameraView);
1418
+ centralPanel.setFocusable(true);
11981419 //frame.setJMenuBar(timelineMenubar);
11991420 //centralPanel.add(timelinePanel);
12001421
....@@ -1261,8 +1482,9 @@
12611482 // north.setName("Edit");
12621483 // north.add(ctrlPanel, BorderLayout.NORTH);
12631484 // objectPanel.add(north);
1264
- objectPanel.add(ctrlPanel);
1485
+ objectPanel.add(editPanel);
12651486 objectPanel.add(infoPanel);
1487
+ objectPanel.add(toolboxPanel);
12661488
12671489 /*
12681490 aConstraints.gridx = 0;
....@@ -1271,7 +1493,7 @@
12711493 aConstraints.gridy += 1;
12721494 aConstraints.gridwidth = 1;
12731495 mainPanel.add(objectPanel, aConstraints);
1274
- */
1496
+ */
12751497
12761498 scrollpane = new JScrollPane(mainPanel, ScrollPaneConstants.// VERTICAL_SCROLLBAR_ALWAYS,
12771499 VERTICAL_SCROLLBAR_AS_NEEDED,
....@@ -1288,9 +1510,7 @@
12881510 JTabbedPane tabbedPane = new JTabbedPane();
12891511 tabbedPane.add(scrollpane);
12901512
1291
- tabbedPane.add(FSPane = new cFileSystemPane(this));
1292
-
1293
- optionsPanel = new cGridBag().setVertical(true);
1513
+ optionsPanel = new cGridBag().setVertical(false);
12941514
12951515 optionsPanel.setName("Options");
12961516
....@@ -1298,6 +1518,8 @@
12981518
12991519 tabbedPane.add(optionsPanel);
13001520
1521
+ tabbedPane.add(FSPane = new cFileSystemPane(this));
1522
+
13011523 scenePanel.add(tabbedPane);
13021524
13031525 /*
....@@ -1390,8 +1612,12 @@
13901612 // aConstraints = gbc; // (GridBagConstraints) GrafreeD.clone(gbc);
13911613
13921614 frame.setSize(1280, 860);
1615
+
1616
+ frame.validate();
13931617 frame.setVisible(true);
13941618
1619
+ cameraView.requestFocusInWindow();
1620
+
13951621 gridPanel.setDividerLocation(1.0);
13961622
13971623 frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
....@@ -1479,24 +1705,6 @@
14791705 texture.add(textureField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
14801706 colorSection.add(texture);
14811707
1482
- cGridBag anisoU = new cGridBag();
1483
- anisoU.add(anisoLabel = new JLabel("AnisoU")); // , aConstraints);
1484
- anisoLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1485
- anisoU.add(anisoField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1486
- colorSection.add(anisoU);
1487
-
1488
- cGridBag anisoV = new cGridBag();
1489
- anisoV.add(anisoVLabel = new JLabel("AnisoV")); // , aConstraints);
1490
- anisoVLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1491
- anisoV.add(anisoVField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1492
- colorSection.add(anisoV);
1493
-
1494
- cGridBag shadowbias = new cGridBag();
1495
- shadowbias.add(shadowbiasLabel = new JLabel("Shadowbias")); // , aConstraints);
1496
- shadowbiasLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1497
- shadowbias.add(shadowbiasField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1498
- colorSection.add(shadowbias);
1499
-
15001708 panel.add(new JSeparator());
15011709
15021710 panel.add(colorSection);
....@@ -1546,6 +1754,12 @@
15461754 fakedepthLabel.setHorizontalAlignment(SwingConstants.TRAILING);
15471755 fakedepth.add(fakedepthField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
15481756 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);
15491763
15501764 panel.add(new JSeparator());
15511765
....@@ -1597,6 +1811,18 @@
15971811 // aConstraints.gridy += 1;
15981812 // aConstraints.gridwidth = 1;
15991813
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
+
16001826
16011827 panel.add(new JSeparator());
16021828
....@@ -1604,35 +1830,35 @@
16041830
16051831 //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
16061832
1607
- cGridBag globalSection = new cGridBag().setVertical(true);
1833
+ //cGridBag globalSection = new cGridBag().setVertical(true);
16081834
16091835 cGridBag camera = new cGridBag();
16101836 camera.add(cameraLabel = new JLabel("GlobalLight")); // , aConstraints);
16111837 cameraLabel.setHorizontalAlignment(SwingConstants.TRAILING);
16121838 camera.add(cameraField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1613
- globalSection.add(camera);
1839
+ colorSection.add(camera);
16141840
16151841 cGridBag ambient = new cGridBag();
16161842 ambient.add(ambientLabel = new JLabel("Ambient")); // , aConstraints);
16171843 ambientLabel.setHorizontalAlignment(SwingConstants.TRAILING);
16181844 ambient.add(ambientField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1619
- globalSection.add(ambient);
1845
+ colorSection.add(ambient);
16201846
16211847 cGridBag backlit = new cGridBag();
16221848 backlit.add(backlitLabel = new JLabel("Backlit")); // , aConstraints);
16231849 backlitLabel.setHorizontalAlignment(SwingConstants.TRAILING);
16241850 backlit.add(backlitField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1625
- globalSection.add(backlit);
1851
+ colorSection.add(backlit);
16261852
16271853 cGridBag opacity = new cGridBag();
16281854 opacity.add(opacityLabel = new JLabel("Opacity")); // , aConstraints);
16291855 opacityLabel.setHorizontalAlignment(SwingConstants.TRAILING);
16301856 opacity.add(opacityField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1631
- globalSection.add(opacity);
1857
+ colorSection.add(opacity);
16321858
1633
- panel.add(new JSeparator());
1859
+ //panel.add(new JSeparator());
16341860
1635
- panel.add(globalSection);
1861
+ //panel.add(globalSection);
16361862
16371863 //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
16381864
....@@ -2707,6 +2933,8 @@
27072933
27082934 void SetMaterial(Object3D object)
27092935 {
2936
+ latestObject = object;
2937
+
27102938 cMaterial mat = object.material;
27112939
27122940 if (mat == null)
....@@ -2818,12 +3046,17 @@
28183046 // }
28193047
28203048 /**/
2821
- if (deselect)
3049
+ if (deselect || child == null)
28223050 {
28233051 //group.deselectAll();
28243052 //freeze = true;
28253053 GetTree().clearSelection();
28263054 //freeze = false;
3055
+
3056
+ if (child == null)
3057
+ {
3058
+ return;
3059
+ }
28273060 }
28283061
28293062 //group.addSelectee(child);
....@@ -2892,7 +3125,7 @@
28923125 cameraView.ToggleDL();
28933126 cameraView.repaint();
28943127 return;
2895
- } else if (event.getSource() == toggleTextureItem)
3128
+ } else if (event.getSource() == toggleTextureItem || event.getSource() == toggleTextureCB)
28963129 {
28973130 cameraView.ToggleTexture();
28983131 // june 2013 copy.HardTouch();
....@@ -2931,7 +3164,7 @@
29313164 frame.validate();
29323165
29333166 return;
2934
- } else if (event.getSource() == toggleSwitchItem)
3167
+ } else if (event.getSource() == toggleSwitchItem || event.getSource() == toggleSwitchCB)
29353168 {
29363169 cameraView.ToggleSwitch();
29373170 cameraView.repaint();
....@@ -3315,6 +3548,8 @@
33153548
33163549 public void Save()
33173550 {
3551
+ System.err.println("Save");
3552
+
33183553 cRadio tab = GetCurrentTab();
33193554
33203555 boolean temp = CameraPane.SWITCH;
....@@ -3322,8 +3557,10 @@
33223557
33233558 copy.ExtractBigData(hashtable);
33243559
3560
+ byte[] compress = Compress(copy);
3561
+
33253562 //EditorFrame.m_MainFrame.requestFocusInWindow();
3326
- tab.graphs[tab.undoindex++] = Compress(copy);
3563
+ tab.graphs[tab.undoindex++] = compress;
33273564
33283565 copy.RestoreBigData(hashtable);
33293566
....@@ -3336,6 +3573,8 @@
33363573 tab.graphs[i] = null;
33373574 }
33383575
3576
+ SetUndoStates();
3577
+
33393578 // test save
33403579 if (false)
33413580 {
....@@ -3358,6 +3597,8 @@
33583597
33593598 void CopyChanged(Object3D obj)
33603599 {
3600
+ SetUndoStates();
3601
+
33613602 boolean temp = CameraPane.SWITCH;
33623603 CameraPane.SWITCH = false;
33633604
....@@ -3397,8 +3638,21 @@
33973638 refreshContents();
33983639 }
33993640
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
+
34003652 public void Undo()
34013653 {
3654
+ System.err.println("Undo");
3655
+
34023656 cRadio tab = GetCurrentTab();
34033657
34043658 if (tab.undoindex == 0)
....@@ -3582,7 +3836,7 @@
35823836 assert false;
35833837 }
35843838
3585
- void EditSelection()
3839
+ void EditSelection(boolean newWindow)
35863840 {
35873841 }
35883842
....@@ -4077,7 +4331,8 @@
40774331
40784332 void makeSomething(Object3D thing, boolean resetmodel) // deselect)
40794333 {
4080
- Save();
4334
+ if (Globals.SAVEONMAKE) // && resetmodel)
4335
+ Save();
40814336 //Tween.set(thing, 0).target(1).start(tweenManager);
40824337 //Tween.to(thing, 0, 0.5f).target(0).start(tweenManager);
40834338 // if (thing instanceof GenericJointDemo)
....@@ -4164,6 +4419,12 @@
41644419 {
41654420 ResetModel();
41664421 Select(thing.GetTreePath(), true, false); // unselect... false);
4422
+
4423
+ if (thing.Size() == 0)
4424
+ {
4425
+ //EditSelection(false);
4426
+ }
4427
+
41674428 refreshContents();
41684429 }
41694430
....@@ -4386,6 +4647,7 @@
43864647
43874648 if (readobj != null)
43884649 {
4650
+ if (Globals.SAVEONMAKE)
43894651 Save();
43904652 try
43914653 {
....@@ -4564,6 +4826,8 @@
45644826 String filename = browser.getFile();
45654827 if (filename != null && filename.length() > 0)
45664828 {
4829
+ if (!filename.endsWith(".gfd"))
4830
+ filename += ".gfd";
45674831 lastname = browser.getDirectory() + filename;
45684832 save();
45694833 }
....@@ -4757,18 +5021,31 @@
47575021 CheckboxMenuItem togglePaintItem;
47585022 JSplitPane mainPanel;
47595023 JScrollPane scrollpane;
5024
+
47605025 JPanel toolbarPanel;
5026
+
47615027 cGridBag treePanel;
5028
+
47625029 JPanel radioPanel;
47635030 ButtonGroup buttonGroup;
4764
- cGridBag ctrlPanel;
5031
+
5032
+ cGridBag toolboxPanel;
47655033 cGridBag materialPanel;
5034
+ cGridBag ctrlPanel;
5035
+
47665036 JScrollPane infoPanel;
5037
+
47675038 cGridBag optionsPanel;
5039
+
47685040 JTabbedPane objectPanel;
5041
+ boolean materialFlushed;
5042
+ Object3D latestObject;
5043
+
47695044 cGridBag XYZPanel;
5045
+
47705046 JSplitPane gridPanel;
47715047 JSplitPane bigPanel;
5048
+
47725049 cGridBag bigThree;
47735050 cGridBag scenePanel;
47745051 cGridBag centralPanel;
....@@ -4883,7 +5160,7 @@
48835160 cNumberSlider fogField;
48845161 JLabel opacityPowerLabel;
48855162 cNumberSlider opacityPowerField;
4886
- JTree jTree;
5163
+ cTree jTree;
48875164 //ObjectUI parent;
48885165
48895166 cNumberSlider normalpushField;