Normand Briere
2019-08-13 0cdf3fb57ddea3226f094ba45c836c7e9b123e3a
GroupEditor.java
....@@ -31,7 +31,7 @@
3131 final String path = "cubemaps/" + f + "-skyboxes/" + s;
3232 row.add(skyboxButton = GetButton(path + "/preview.jpg", !Grafreed.NIMBUSLAF));
3333 //row.add(skyboxButton = GetButton(path + "/negx.jpg", !Grafreed.NIMBUSLAF));
34
- skyboxButton.setToolTipText(s);
34
+ skyboxButton.setToolTipText(s.equals("") ? "No background" : s);
3535 skyboxButton.addActionListener(new ActionListener()
3636 {
3737 @Override
....@@ -73,7 +73,7 @@
7373 cGridBag row5 = new cGridBag();
7474 cGridBag row6 = new cGridBag();
7575
76
- AddSkyboxButton("default", "rgb", row0);
76
+ AddSkyboxButton("default", "", row0);
7777 //AddSkyboxButton("default", "cornell", row0);
7878 AddSkyboxButton("penguins", "dust", row0);
7979 AddSkyboxButton("penguins", "tropic", row0);
....@@ -330,10 +330,19 @@
330330
331331 public void ChangeSkybox(String skybox)
332332 {
333
- //cameraView.envyoff = false;
334
- group.skyboxname = skybox;
335
- group.skyboxext = "jpg";
336
- cameraView.repaint();
333
+ if (skybox.endsWith("/"))
334
+ {
335
+ group.skyboxname = null;
336
+ group.skyboxext = null;
337
+ cameraView.repaint();
338
+ }
339
+ else
340
+ {
341
+ //cameraView.envyoff = false;
342
+ group.skyboxname = skybox;
343
+ group.skyboxext = "jpg";
344
+ cameraView.repaint();
345
+ }
337346 }
338347
339348 public void CreateSkyboxPanel(cGridBag skyboxPanel)
....@@ -357,6 +366,16 @@
357366 }
358367
359368 refreshContents();
369
+ }
370
+
371
+ public void Show3DView()
372
+ {
373
+ // bug
374
+ //gridPanel.setDividerLocation(1.0);
375
+ //bigPanel.setDividerLocation(0.0);
376
+ bigThree.ClearUI();
377
+ bigThree.add(centralPanel);
378
+ bigThree.FlushUI();
360379 }
361380
362381 //ObjEditor objEditor;
....@@ -400,6 +419,8 @@
400419 {
401420 copy.versionlist = new Object3D[100];
402421 copy.versionindex = -1;
422
+
423
+ Save(true);
403424 }
404425
405426 if(ui)
....@@ -631,11 +652,9 @@
631652 oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest"));
632653 //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection"));
633654 //cameraMenu.add(switchViewItem = new MenuItem("Reverse View"));
634
- editLeafItem = oe.cameraMenu.add(new MenuItem("Edit Leaf"));
635655 oe.cameraMenu.add("-");
636656 openWindowItem = oe.cameraMenu.add(new MenuItem("Edit copy..."));
637657 openWindowItem.addActionListener(this);
638
- editLeafItem.addActionListener(this);
639658 lookAtItem.addActionListener(this);
640659 //lookFromItem.addActinoListener(this);
641660 //switchViewItem.addActionListener(this);
....@@ -883,6 +902,9 @@
883902 shareGeometriesItem.addActionListener(this);
884903 mergeGeometriesItem = menu.add(new MenuItem("Merge Geometries"));
885904 mergeGeometriesItem.addActionListener(this);
905
+ menu.add("-");
906
+ editLeafItem = menu.add(new MenuItem("Edit leaf..."));
907
+ editLeafItem.addActionListener(this);
886908 if (Globals.ADVANCED)
887909 {
888910 // Pretty much the same as duplicate and clone.
....@@ -984,11 +1006,6 @@
9841006 //new Exception().printStackTrace();
9851007
9861008 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;
9921009 // oe.toolbarPanel.add(radioPanel); //, oe.aConstraints);
9931010
9941011 oe.buttonGroup = new ButtonGroup();
....@@ -1021,10 +1038,49 @@
10211038
10221039 if (Globals.ADVANCED)
10231040 {
1024
- oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1025
- maxButton.setToolTipText("Maximize window");
1026
- maxButton.addActionListener(this);
1041
+// oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1042
+// maxButton.setToolTipText("Maximize window");
1043
+// maxButton.addActionListener(this);
10271044 }
1045
+
1046
+// cButton gcButton;
1047
+//
1048
+// oe.toolbarPanel.add(gcButton = GetButton("icons/trash.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1049
+// gcButton.setToolTipText("Garbage collect");
1050
+// gcButton.addActionListener(new ActionListener()
1051
+// {
1052
+// public void actionPerformed(ActionEvent e)
1053
+// {
1054
+// System.gc();
1055
+// }
1056
+// });
1057
+
1058
+ oe.toolbarPanel.add(collapseButton = GetButton("icons/collapse.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1059
+ collapseButton.setToolTipText("Collapse toolbar");
1060
+ collapseButton.addActionListener(this);
1061
+
1062
+ oe.toolbarPanel.add(maximize3DButton = GetButton("", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1063
+ maximize3DButton.setToolTipText("Maximize 3D view");
1064
+ maximize3DButton.addActionListener(this);
1065
+
1066
+ oe.toolbarPanel.add(twoButton = GetButton("icons/cube.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1067
+ twoButton.setToolTipText("Show 3D view only");
1068
+ twoButton.addActionListener(this);
1069
+ this.fullscreenLayout = twoButton;
1070
+
1071
+ oe.toolbarPanel.add(threeButton = GetButton("icons/controlsview.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1072
+ threeButton.setToolTipText("Show controls and 3D view");
1073
+ threeButton.addActionListener(this);
1074
+ if (Globals.ADVANCED)
1075
+ {
1076
+ oe.toolbarPanel.add(sixButton = GetButton("icons/viewcontrols.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1077
+ sixButton.setToolTipText("Show 3D view and controls");
1078
+ sixButton.addActionListener(this);
1079
+ }
1080
+// oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1081
+// sevenButton.setToolTipText("3-column layout");
1082
+// sevenButton.addActionListener(this);
1083
+ //
10281084
10291085 oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
10301086 fullButton.setToolTipText("Full-screen window");
....@@ -1069,14 +1125,14 @@
10691125 nextVersionButton.addActionListener(this);
10701126 nextVersionButton.setEnabled(false);
10711127
1072
- oe.toolbarPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
1073
- liveCB.setToolTipText("Enable animation");
1074
- liveCB.addItemListener(this);
1075
-
10761128 oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
10771129 oneStepButton.setToolTipText("Animate one step forward");
10781130 oneStepButton.addActionListener(this);
10791131
1132
+ oe.toolbarPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
1133
+ liveCB.setToolTipText("Enable animation");
1134
+ liveCB.addItemListener(this);
1135
+
10801136 oe.toolbarPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
10811137 fastCB.setToolTipText("Fast mode");
10821138 fastCB.addItemListener(this);
....@@ -1103,21 +1159,6 @@
11031159
11041160 //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
11051161
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
- //
11211162
11221163 oe.toolbarPanel.add(rootButton = GetButton("icons/openwindow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
11231164 rootButton.setToolTipText("Open selection in new tab");
....@@ -1133,7 +1174,7 @@
11331174
11341175 // INSERT
11351176 row1.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1136
- gridButton.setToolTipText("Create grid");
1177
+ gridButton.setToolTipText("Create ground");
11371178 gridButton.addActionListener(this);
11381179
11391180 row1.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
....@@ -1425,6 +1466,14 @@
14251466
14261467 void EditObject(Object3D obj)
14271468 {
1469
+ assert(obj instanceof Composite);
1470
+
1471
+// if (obj.versionlist == null)
1472
+// {
1473
+// obj.versionlist = new Object3D[100];
1474
+// obj.versionindex = -1;
1475
+// }
1476
+
14281477 cRadio radioButton = new cRadio(obj.name);
14291478
14301479 // June 2019. Patch to avoid bug with transparency.
....@@ -1815,7 +1864,12 @@
18151864 TreePath path;
18161865
18171866 public TransferableTreePath(TreePath tp) {
1818
- path = tp;
1867
+ Object[] objs = new Object[tp.getPathCount()];
1868
+ for (int i=0; i<objs.length; i++)
1869
+ {
1870
+ objs[i] = ((Object3D)tp.getPathComponent(i)).GetUUID();
1871
+ }
1872
+ path = new TreePath(objs);
18191873 }
18201874
18211875 public synchronized DataFlavor[] getTransferDataFlavors() {
....@@ -2708,6 +2762,18 @@
27082762 if (source == fullButton)
27092763 {
27102764 ToggleFullScreen();
2765
+ } else
2766
+ if (source == collapseButton)
2767
+ {
2768
+ this.expandedLayout = radio.layout;
2769
+ CollapseToolbar();
2770
+ } else
2771
+ if (source == maximize3DButton)
2772
+ {
2773
+ this.expandedLayout = radio.layout;
2774
+ radio.layout = twoButton;
2775
+ Show3DView();
2776
+ CollapseToolbar();
27112777 } else
27122778 if (source == previousVersionButton)
27132779 {
....@@ -3660,38 +3726,7 @@
36603726 if (CameraPane.FULLSCREEN)
36613727 fullscreenLayout = radio.layout;
36623728
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();
3729
+ Show3DView();
36953730
36963731 cameraView.requestFocusInWindow();
36973732
....@@ -3877,6 +3912,7 @@
38773912 } else
38783913 if (source == rootButton)
38793914 {
3915
+ Replace();
38803916 Object3D obj;
38813917 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
38823918 {
....@@ -4013,8 +4049,6 @@
40134049
40144050 copy = group;
40154051
4016
- SetUndoStates();
4017
-
40184052 //Globals.theRenderer.object = group;
40194053 if(!useclient)
40204054 {
....@@ -4042,6 +4076,18 @@
40424076 */
40434077 radio.layout.doClick();
40444078
4079
+ assert(copy instanceof Composite);
4080
+
4081
+ if (copy.versionlist == null)
4082
+ {
4083
+ copy.versionlist = new Object3D[100];
4084
+ copy.versionindex = -1;
4085
+
4086
+ Save(true);
4087
+ }
4088
+
4089
+ SetVersionStates();
4090
+
40454091 ClearUnpinned();
40464092
40474093 //Grafreed.Assert(group != null);
....@@ -5276,6 +5322,19 @@
52765322 flashSelectionButton.setEnabled(enabled);
52775323
52785324 clearPanelButton.setEnabled(!listUI.isEmpty());
5325
+
5326
+ boolean allComposites = true;
5327
+
5328
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
5329
+ {
5330
+ if (!(e.nextElement() instanceof Composite))
5331
+ {
5332
+ allComposites = false;
5333
+ break;
5334
+ }
5335
+ }
5336
+
5337
+ rootButton.setEnabled(allComposites);
52795338 }
52805339
52815340 void refreshContents(boolean cp)
....@@ -5290,7 +5349,7 @@
52905349 Object3D child = (Object3D) group.selection.get(i);
52915350
52925351 objEditor.AddInfo(child, this, true);
5293
- System.err.println("info : " + child.GetPath());
5352
+// System.err.println("info : " + child.GetPath());
52945353 }
52955354
52965355 objEditor.SetText(); // jan 2014