Normand Briere
2019-08-12 8f1afe25ea8fc8801aab66331c32a50859a758c2
GroupEditor.java
....@@ -359,6 +359,16 @@
359359 refreshContents();
360360 }
361361
362
+ public void Show3DView()
363
+ {
364
+ // bug
365
+ //gridPanel.setDividerLocation(1.0);
366
+ //bigPanel.setDividerLocation(0.0);
367
+ bigThree.ClearUI();
368
+ bigThree.add(centralPanel);
369
+ bigThree.FlushUI();
370
+ }
371
+
362372 //ObjEditor objEditor;
363373 public void closeUI2()
364374 {
....@@ -400,6 +410,8 @@
400410 {
401411 copy.versionlist = new Object3D[100];
402412 copy.versionindex = -1;
413
+
414
+ Save(true);
403415 }
404416
405417 if(ui)
....@@ -631,11 +643,9 @@
631643 oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest"));
632644 //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection"));
633645 //cameraMenu.add(switchViewItem = new MenuItem("Reverse View"));
634
- editLeafItem = oe.cameraMenu.add(new MenuItem("Edit Leaf"));
635646 oe.cameraMenu.add("-");
636647 openWindowItem = oe.cameraMenu.add(new MenuItem("Edit copy..."));
637648 openWindowItem.addActionListener(this);
638
- editLeafItem.addActionListener(this);
639649 lookAtItem.addActionListener(this);
640650 //lookFromItem.addActinoListener(this);
641651 //switchViewItem.addActionListener(this);
....@@ -883,6 +893,9 @@
883893 shareGeometriesItem.addActionListener(this);
884894 mergeGeometriesItem = menu.add(new MenuItem("Merge Geometries"));
885895 mergeGeometriesItem.addActionListener(this);
896
+ menu.add("-");
897
+ editLeafItem = menu.add(new MenuItem("Edit leaf..."));
898
+ editLeafItem.addActionListener(this);
886899 if (Globals.ADVANCED)
887900 {
888901 // Pretty much the same as duplicate and clone.
....@@ -984,11 +997,6 @@
984997 //new Exception().printStackTrace();
985998
986999 oe.radioPanel = new JPanel(new GridBagLayout());
987
- oe.aConstraints.weightx = 1;
988
- oe.aConstraints.weighty = 0;
989
- oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
990
- oe.aConstraints.gridwidth = 100;
991
- oe.aConstraints.gridheight = 1;
9921000 // oe.toolbarPanel.add(radioPanel); //, oe.aConstraints);
9931001
9941002 oe.buttonGroup = new ButtonGroup();
....@@ -1021,10 +1029,49 @@
10211029
10221030 if (Globals.ADVANCED)
10231031 {
1024
- oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1025
- maxButton.setToolTipText("Maximize window");
1026
- maxButton.addActionListener(this);
1032
+// oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1033
+// maxButton.setToolTipText("Maximize window");
1034
+// maxButton.addActionListener(this);
10271035 }
1036
+
1037
+// cButton gcButton;
1038
+//
1039
+// oe.toolbarPanel.add(gcButton = GetButton("icons/trash.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1040
+// gcButton.setToolTipText("Garbage collect");
1041
+// gcButton.addActionListener(new ActionListener()
1042
+// {
1043
+// public void actionPerformed(ActionEvent e)
1044
+// {
1045
+// System.gc();
1046
+// }
1047
+// });
1048
+
1049
+ oe.toolbarPanel.add(collapseButton = GetButton("icons/collapse.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1050
+ collapseButton.setToolTipText("Collapse toolbar");
1051
+ collapseButton.addActionListener(this);
1052
+
1053
+ oe.toolbarPanel.add(maximize3DButton = GetButton("", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1054
+ maximize3DButton.setToolTipText("Maximize 3D view");
1055
+ maximize3DButton.addActionListener(this);
1056
+
1057
+ oe.toolbarPanel.add(twoButton = GetButton("icons/cube.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1058
+ twoButton.setToolTipText("Show 3D view only");
1059
+ twoButton.addActionListener(this);
1060
+ this.fullscreenLayout = twoButton;
1061
+
1062
+ oe.toolbarPanel.add(threeButton = GetButton("icons/controlsview.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1063
+ threeButton.setToolTipText("Show controls and 3D view");
1064
+ threeButton.addActionListener(this);
1065
+ if (Globals.ADVANCED)
1066
+ {
1067
+ oe.toolbarPanel.add(sixButton = GetButton("icons/viewcontrols.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1068
+ sixButton.setToolTipText("Show 3D view and controls");
1069
+ sixButton.addActionListener(this);
1070
+ }
1071
+// oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1072
+// sevenButton.setToolTipText("3-column layout");
1073
+// sevenButton.addActionListener(this);
1074
+ //
10281075
10291076 oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
10301077 fullButton.setToolTipText("Full-screen window");
....@@ -1069,14 +1116,14 @@
10691116 nextVersionButton.addActionListener(this);
10701117 nextVersionButton.setEnabled(false);
10711118
1072
- oe.toolbarPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
1073
- liveCB.setToolTipText("Enable animation");
1074
- liveCB.addItemListener(this);
1075
-
10761119 oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
10771120 oneStepButton.setToolTipText("Animate one step forward");
10781121 oneStepButton.addActionListener(this);
10791122
1123
+ oe.toolbarPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
1124
+ liveCB.setToolTipText("Enable animation");
1125
+ liveCB.addItemListener(this);
1126
+
10801127 oe.toolbarPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
10811128 fastCB.setToolTipText("Fast mode");
10821129 fastCB.addItemListener(this);
....@@ -1103,21 +1150,6 @@
11031150
11041151 //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
11051152
1106
- oe.toolbarPanel.add(twoButton = GetButton("icons/cube.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1107
- twoButton.setToolTipText("Show 3D view only");
1108
- twoButton.addActionListener(this);
1109
- this.fullscreenLayout = twoButton;
1110
-
1111
- oe.toolbarPanel.add(threeButton = GetButton("icons/controlsview.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1112
- threeButton.setToolTipText("Show controls and 3D view");
1113
- threeButton.addActionListener(this);
1114
- oe.toolbarPanel.add(sixButton = GetButton("icons/viewcontrols.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1115
- sixButton.setToolTipText("Show 3D view and controls");
1116
- sixButton.addActionListener(this);
1117
-// oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1118
-// sevenButton.setToolTipText("3-column layout");
1119
-// sevenButton.addActionListener(this);
1120
- //
11211153
11221154 oe.toolbarPanel.add(rootButton = GetButton("icons/openwindow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
11231155 rootButton.setToolTipText("Open selection in new tab");
....@@ -1133,7 +1165,7 @@
11331165
11341166 // INSERT
11351167 row1.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1136
- gridButton.setToolTipText("Create grid");
1168
+ gridButton.setToolTipText("Create ground");
11371169 gridButton.addActionListener(this);
11381170
11391171 row1.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
....@@ -1425,6 +1457,14 @@
14251457
14261458 void EditObject(Object3D obj)
14271459 {
1460
+ assert(obj instanceof Composite);
1461
+
1462
+ if (obj.versionlist == null)
1463
+ {
1464
+ obj.versionlist = new Object3D[100];
1465
+ obj.versionindex = -1;
1466
+ }
1467
+
14281468 cRadio radioButton = new cRadio(obj.name);
14291469
14301470 // June 2019. Patch to avoid bug with transparency.
....@@ -1815,7 +1855,12 @@
18151855 TreePath path;
18161856
18171857 public TransferableTreePath(TreePath tp) {
1818
- path = tp;
1858
+ Object[] objs = new Object[tp.getPathCount()];
1859
+ for (int i=0; i<objs.length; i++)
1860
+ {
1861
+ objs[i] = ((Object3D)tp.getPathComponent(i)).GetUUID();
1862
+ }
1863
+ path = new TreePath(objs);
18191864 }
18201865
18211866 public synchronized DataFlavor[] getTransferDataFlavors() {
....@@ -2708,6 +2753,18 @@
27082753 if (source == fullButton)
27092754 {
27102755 ToggleFullScreen();
2756
+ } else
2757
+ if (source == collapseButton)
2758
+ {
2759
+ this.expandedLayout = radio.layout;
2760
+ CollapseToolbar();
2761
+ } else
2762
+ if (source == maximize3DButton)
2763
+ {
2764
+ this.expandedLayout = radio.layout;
2765
+ radio.layout = twoButton;
2766
+ Show3DView();
2767
+ CollapseToolbar();
27112768 } else
27122769 if (source == previousVersionButton)
27132770 {
....@@ -3660,38 +3717,7 @@
36603717 if (CameraPane.FULLSCREEN)
36613718 fullscreenLayout = radio.layout;
36623719
3663
- // bug
3664
- //gridPanel.setDividerLocation(1.0);
3665
- //bigPanel.setDividerLocation(0.0);
3666
-// bigThree.remove(scenePanel);
3667
-// bigThree.remove(centralPanel);
3668
-// bigThree.remove(XYZPanel);
3669
-// aWindowConstraints.gridx = 0;
3670
-// aWindowConstraints.gridy = 0;
3671
-// aWindowConstraints.gridwidth = 1;
3672
-// // aConstraints.gridheight = 3;
3673
-// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3674
-// aWindowConstraints.weightx = 0;
3675
-// aWindowConstraints.weighty = 1;
3676
-// //bigThree.add(jtp, aWindowConstraints);
3677
-// aWindowConstraints.weightx = 1;
3678
-// aWindowConstraints.gridwidth = 3;
3679
-// // aConstraints.gridheight = 3;
3680
-// aWindowConstraints.gridx = 1;
3681
-// aWindowConstraints.fill = GridBagConstraints.BOTH;
3682
-// bigThree.add(centralPanel, aWindowConstraints);
3683
-// aWindowConstraints.weightx = 0;
3684
-// aWindowConstraints.gridx = 4;
3685
-// aWindowConstraints.gridwidth = 1;
3686
-// // aConstraints.gridheight = 3;
3687
-// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3688
-// //bigThree.add(XYZPanel, aWindowConstraints);
3689
-// scenePanel.setVisible(false);
3690
-// centralPanel.setVisible(true);
3691
-// XYZPanel.setVisible(false);
3692
- bigThree.ClearUI();
3693
- bigThree.add(centralPanel);
3694
- bigThree.FlushUI();
3720
+ Show3DView();
36953721
36963722 cameraView.requestFocusInWindow();
36973723
....@@ -3877,6 +3903,7 @@
38773903 } else
38783904 if (source == rootButton)
38793905 {
3906
+ Replace();
38803907 Object3D obj;
38813908 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
38823909 {
....@@ -4013,8 +4040,6 @@
40134040
40144041 copy = group;
40154042
4016
- SetUndoStates();
4017
-
40184043 //Globals.theRenderer.object = group;
40194044 if(!useclient)
40204045 {
....@@ -4042,6 +4067,8 @@
40424067 */
40434068 radio.layout.doClick();
40444069
4070
+ SetUndoStates();
4071
+
40454072 ClearUnpinned();
40464073
40474074 //Grafreed.Assert(group != null);
....@@ -5276,6 +5303,19 @@
52765303 flashSelectionButton.setEnabled(enabled);
52775304
52785305 clearPanelButton.setEnabled(!listUI.isEmpty());
5306
+
5307
+ boolean allComposites = true;
5308
+
5309
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
5310
+ {
5311
+ if (!(e.nextElement() instanceof Composite))
5312
+ {
5313
+ allComposites = false;
5314
+ break;
5315
+ }
5316
+ }
5317
+
5318
+ rootButton.setEnabled(allComposites);
52795319 }
52805320
52815321 void refreshContents(boolean cp)
....@@ -5290,7 +5330,7 @@
52905330 Object3D child = (Object3D) group.selection.get(i);
52915331
52925332 objEditor.AddInfo(child, this, true);
5293
- System.err.println("info : " + child.GetPath());
5333
+// System.err.println("info : " + child.GetPath());
52945334 }
52955335
52965336 objEditor.SetText(); // jan 2014