Normand Briere
2019-06-29 a69bb4474a3264a9a7a7f8b8d8154ea771f167c8
ObjEditor.java
....@@ -15,6 +15,9 @@
1515 //import javax.swing.plaf.ColorUIResource;
1616 //import javax.swing.plaf.metal.DefaultMetalTheme;
1717
18
+import javax.swing.plaf.basic.BasicSplitPaneDivider;
19
+import javax.swing.plaf.basic.BasicSplitPaneUI;
20
+
1821 //import javax.media.opengl.GLCanvas;
1922
2023 import //weka.core.
....@@ -207,7 +210,7 @@
207210
208211 objEditor.ctrlPanel.remove(namePanel);
209212
210
- if (!GroupEditor.allparams)
213
+ if (!allparams)
211214 return;
212215
213216 // objEditor.ctrlPanel.remove(liveCB);
....@@ -337,6 +340,11 @@
337340 return frame.action(event, obj);
338341 }
339342
343
+ // Cannot work without static
344
+ static boolean allparams = true;
345
+
346
+ static java.util.Vector<Object3D> listUI = new java.util.Vector<Object3D>();
347
+
340348 void SetupMenu()
341349 {
342350 frame.setMenuBar(menuBar = new MenuBar());
....@@ -398,6 +406,11 @@
398406 //
399407 // materialFlushed = true;
400408 // }
409
+// if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Edit"))
410
+// {
411
+// if (listUI.size() == 0)
412
+// EditSelection(false);
413
+// }
401414
402415 refreshContents(false); // To refresh Info tab
403416 }
....@@ -436,7 +449,7 @@
436449 // TEXTAREA infoarea.setLineWrap(true);
437450 // TEXTAREA infoarea.setWrapStyleWord(true);
438451 infoPanel = new JScrollPane(infoarea, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); //AS_NEEDED);
439
- infoPanel.setPreferredSize(new Dimension(50, 200));
452
+ //infoPanel.setPreferredSize(new Dimension(50, 200));
440453 infoPanel.setName("Info");
441454 //infoPanel.setLayout(new BorderLayout());
442455 //infoPanel.add(createTextPane());
....@@ -448,7 +461,14 @@
448461 mainPanel.setDividerSize(9);
449462 mainPanel.setDividerLocation(0.5); //1.0);
450463 mainPanel.setResizeWeight(0.5);
451
-
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
+
452472 //ctrlPanel.setLayout(new GridLayout(4, 1, 5, 5));
453473 //mainPanel.setLayout(new GridBagLayout());
454474 toolbarPanel.setLayout(new FlowLayout(FlowLayout.LEFT));
....@@ -701,10 +721,19 @@
701721 void Minimize()
702722 {
703723 frame.setState(Frame.ICONIFIED);
724
+ frame.validate();
704725 }
705726
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={}
706730 void Maximize()
707731 {
732
+ if (CameraPane.FULLSCREEN)
733
+ {
734
+ ToggleFullScreen();
735
+ }
736
+
708737 if (maximized)
709738 {
710739 frame.setBounds(keeprect.x, keeprect.y, keeprect.width, keeprect.height);
....@@ -719,13 +748,23 @@
719748 }
720749
721750 maximized ^= true;
751
+
752
+ frame.validate();
722753 }
754
+
755
+ cButton minButton;
756
+ cButton maxButton;
757
+ cButton fullButton;
723758
724759 void ToggleFullScreen()
725760 {
726
- if (CameraPane.FULLSCREEN)
761
+ cameraView.ToggleFullScreen();
762
+
763
+ if (!CameraPane.FULLSCREEN)
727764 {
728765 device.setFullScreenWindow(null);
766
+ frame.validate();
767
+
729768 //frame.setVisible(false);
730769 // frame.removeNotify();
731770 // frame.setUndecorated(false);
....@@ -751,6 +790,7 @@
751790 // frame.getToolkit().getScreenSize().height);
752791 //frame.setVisible(false);
753792 device.setFullScreenWindow(frame);
793
+ frame.validate();
754794 // frame.removeNotify();
755795 // frame.setUndecorated(true);
756796 // frame.addNotify();
....@@ -763,8 +803,7 @@
763803 radio.layout.doClick();
764804 //frame.setVisible(true);
765805 }
766
-
767
- cameraView.ToggleFullScreen();
806
+ frame.validate();
768807 }
769808
770809 private JTextPane createTextPane()
....@@ -1097,12 +1136,12 @@
10971136 namePanel = new cGridBag();
10981137
10991138 nameField = AddText(namePanel, copy.GetName());
1100
- namePanel.add(nameField);
1139
+ namePanel.add(new JScrollPane(nameField, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER));
11011140 oe.ctrlPanel.add(namePanel);
11021141
11031142 oe.ctrlPanel.Return();
11041143
1105
- if (!GroupEditor.allparams)
1144
+ if (!allparams)
11061145 return;
11071146
11081147 setupPanel = new cGridBag().setVertical(false);
....@@ -1115,15 +1154,15 @@
11151154 hideCB = AddCheckBox(setupPanel, "Hide", copy.hide);
11161155 hideCB.setToolTipText("Hide object");
11171156 markCB = AddCheckBox(setupPanel, "Mark", copy.marked);
1118
- markCB.setToolTipText("Set the animation target transform");
1157
+ markCB.setToolTipText("As animation target transform");
11191158
11201159 setupPanel2 = new cGridBag().setVertical(false);
11211160
11221161 rewindCB = AddCheckBox(setupPanel2, "Rewind", copy.rewind);
11231162 rewindCB.setToolTipText("Rewind animation");
11241163
1125
- randomCB = AddCheckBox(setupPanel2, "Rand", copy.random);
1126
- 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)");
11271166
11281167 if (Globals.ADVANCED)
11291168 {
....@@ -1439,13 +1478,13 @@
14391478 //JScrollPane tmp = new JScrollPane(ctrlPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
14401479 //tmp.setName("Edit");
14411480 objectPanel.add(materialPanel);
1442
- objectPanel.add(toolboxPanel);
14431481 // JPanel north = new JPanel(new BorderLayout());
14441482 // north.setName("Edit");
14451483 // north.add(ctrlPanel, BorderLayout.NORTH);
14461484 // objectPanel.add(north);
14471485 objectPanel.add(editPanel);
14481486 objectPanel.add(infoPanel);
1487
+ objectPanel.add(toolboxPanel);
14491488
14501489 /*
14511490 aConstraints.gridx = 0;
....@@ -1454,7 +1493,7 @@
14541493 aConstraints.gridy += 1;
14551494 aConstraints.gridwidth = 1;
14561495 mainPanel.add(objectPanel, aConstraints);
1457
- */
1496
+ */
14581497
14591498 scrollpane = new JScrollPane(mainPanel, ScrollPaneConstants.// VERTICAL_SCROLLBAR_ALWAYS,
14601499 VERTICAL_SCROLLBAR_AS_NEEDED,
....@@ -1666,24 +1705,6 @@
16661705 texture.add(textureField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
16671706 colorSection.add(texture);
16681707
1669
- cGridBag anisoU = new cGridBag();
1670
- anisoU.add(anisoLabel = new JLabel("AnisoU")); // , aConstraints);
1671
- anisoLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1672
- anisoU.add(anisoField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1673
- colorSection.add(anisoU);
1674
-
1675
- cGridBag anisoV = new cGridBag();
1676
- anisoV.add(anisoVLabel = new JLabel("AnisoV")); // , aConstraints);
1677
- anisoVLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1678
- anisoV.add(anisoVField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1679
- colorSection.add(anisoV);
1680
-
1681
- cGridBag shadowbias = new cGridBag();
1682
- shadowbias.add(shadowbiasLabel = new JLabel("Shadowbias")); // , aConstraints);
1683
- shadowbiasLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1684
- shadowbias.add(shadowbiasField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1685
- colorSection.add(shadowbias);
1686
-
16871708 panel.add(new JSeparator());
16881709
16891710 panel.add(colorSection);
....@@ -1733,6 +1754,12 @@
17331754 fakedepthLabel.setHorizontalAlignment(SwingConstants.TRAILING);
17341755 fakedepth.add(fakedepthField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
17351756 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);
17361763
17371764 panel.add(new JSeparator());
17381765
....@@ -1784,6 +1811,18 @@
17841811 // aConstraints.gridy += 1;
17851812 // aConstraints.gridwidth = 1;
17861813
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
+
17871826
17881827 panel.add(new JSeparator());
17891828
....@@ -1791,35 +1830,35 @@
17911830
17921831 //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
17931832
1794
- cGridBag globalSection = new cGridBag().setVertical(true);
1833
+ //cGridBag globalSection = new cGridBag().setVertical(true);
17951834
17961835 cGridBag camera = new cGridBag();
17971836 camera.add(cameraLabel = new JLabel("GlobalLight")); // , aConstraints);
17981837 cameraLabel.setHorizontalAlignment(SwingConstants.TRAILING);
17991838 camera.add(cameraField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1800
- globalSection.add(camera);
1839
+ colorSection.add(camera);
18011840
18021841 cGridBag ambient = new cGridBag();
18031842 ambient.add(ambientLabel = new JLabel("Ambient")); // , aConstraints);
18041843 ambientLabel.setHorizontalAlignment(SwingConstants.TRAILING);
18051844 ambient.add(ambientField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1806
- globalSection.add(ambient);
1845
+ colorSection.add(ambient);
18071846
18081847 cGridBag backlit = new cGridBag();
18091848 backlit.add(backlitLabel = new JLabel("Backlit")); // , aConstraints);
18101849 backlitLabel.setHorizontalAlignment(SwingConstants.TRAILING);
18111850 backlit.add(backlitField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1812
- globalSection.add(backlit);
1851
+ colorSection.add(backlit);
18131852
18141853 cGridBag opacity = new cGridBag();
18151854 opacity.add(opacityLabel = new JLabel("Opacity")); // , aConstraints);
18161855 opacityLabel.setHorizontalAlignment(SwingConstants.TRAILING);
18171856 opacity.add(opacityField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1818
- globalSection.add(opacity);
1857
+ colorSection.add(opacity);
18191858
1820
- panel.add(new JSeparator());
1859
+ //panel.add(new JSeparator());
18211860
1822
- panel.add(globalSection);
1861
+ //panel.add(globalSection);
18231862
18241863 //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
18251864
....@@ -3007,12 +3046,17 @@
30073046 // }
30083047
30093048 /**/
3010
- if (deselect)
3049
+ if (deselect || child == null)
30113050 {
30123051 //group.deselectAll();
30133052 //freeze = true;
30143053 GetTree().clearSelection();
30153054 //freeze = false;
3055
+
3056
+ if (child == null)
3057
+ {
3058
+ return;
3059
+ }
30163060 }
30173061
30183062 //group.addSelectee(child);
....@@ -3513,8 +3557,10 @@
35133557
35143558 copy.ExtractBigData(hashtable);
35153559
3560
+ byte[] compress = Compress(copy);
3561
+
35163562 //EditorFrame.m_MainFrame.requestFocusInWindow();
3517
- tab.graphs[tab.undoindex++] = Compress(copy);
3563
+ tab.graphs[tab.undoindex++] = compress;
35183564
35193565 copy.RestoreBigData(hashtable);
35203566
....@@ -3527,6 +3573,8 @@
35273573 tab.graphs[i] = null;
35283574 }
35293575
3576
+ SetUndoStates();
3577
+
35303578 // test save
35313579 if (false)
35323580 {
....@@ -3549,6 +3597,8 @@
35493597
35503598 void CopyChanged(Object3D obj)
35513599 {
3600
+ SetUndoStates();
3601
+
35523602 boolean temp = CameraPane.SWITCH;
35533603 CameraPane.SWITCH = false;
35543604
....@@ -3586,6 +3636,17 @@
35863636 }
35873637
35883638 refreshContents();
3639
+ }
3640
+
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);
35893650 }
35903651
35913652 public void Undo()
....@@ -4765,6 +4826,8 @@
47654826 String filename = browser.getFile();
47664827 if (filename != null && filename.length() > 0)
47674828 {
4829
+ if (!filename.endsWith(".gfd"))
4830
+ filename += ".gfd";
47684831 lastname = browser.getDirectory() + filename;
47694832 save();
47704833 }