Normand Briere
2019-08-13 0cdf3fb57ddea3226f094ba45c836c7e9b123e3a
GroupEditor.java
....@@ -16,6 +16,7 @@
1616 //import buoy.widget.BFileChooser;
1717
1818 class GroupEditor extends ObjEditor implements //iParse, //iCallBack,
19
+ Grafreed.iResourceCallBack,
1920 ObjectUI,
2021 Runnable,
2122 ActionListener,
....@@ -30,7 +31,7 @@
3031 final String path = "cubemaps/" + f + "-skyboxes/" + s;
3132 row.add(skyboxButton = GetButton(path + "/preview.jpg", !Grafreed.NIMBUSLAF));
3233 //row.add(skyboxButton = GetButton(path + "/negx.jpg", !Grafreed.NIMBUSLAF));
33
- skyboxButton.setToolTipText(s);
34
+ skyboxButton.setToolTipText(s.equals("") ? "No background" : s);
3435 skyboxButton.addActionListener(new ActionListener()
3536 {
3637 @Override
....@@ -41,6 +42,22 @@
4142 });
4243 }
4344
45
+ public void AddTextureButton(String f, String c, final String t, int count, cGridBag row)
46
+ {
47
+ cButton textureButton;
48
+ final String path = "textures/" + f + "/" + c + "/"; // + t;
49
+ row.add(textureButton = GetButton(path + "icons/" + t, !Grafreed.NIMBUSLAF));
50
+ textureButton.setToolTipText(c + count);
51
+ textureButton.addActionListener(new ActionListener()
52
+ {
53
+ @Override
54
+ public void actionPerformed(ActionEvent e)
55
+ {
56
+ ChangeTexture(path + t);
57
+ }
58
+ });
59
+ }
60
+
4461 public void AddSkyboxTab0(JTabbedPane skyboxpanel)
4562 {
4663 cGridBag tab0 = new cGridBag().setVertical(true);
....@@ -56,7 +73,7 @@
5673 cGridBag row5 = new cGridBag();
5774 cGridBag row6 = new cGridBag();
5875
59
- AddSkyboxButton("default", "rgb", row0);
76
+ AddSkyboxButton("default", "", row0);
6077 //AddSkyboxButton("default", "cornell", row0);
6178 AddSkyboxButton("penguins", "dust", row0);
6279 AddSkyboxButton("penguins", "tropic", row0);
....@@ -311,14 +328,56 @@
311328 }
312329 }
313330
314
- public void ChangeSkybox(String name)
331
+ public void ChangeSkybox(String skybox)
315332 {
316
- //cameraView.envyoff = false;
317
- group.skyboxname = name;
318
- group.skyboxext = "jpg";
319
- 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
+ }
346
+ }
347
+
348
+ public void CreateSkyboxPanel(cGridBag skyboxPanel)
349
+ {
350
+ JTabbedPane skyboxpane = new JTabbedPane();
351
+
352
+ AddSkyboxTab0(skyboxpane);
353
+ AddSkyboxTab1(skyboxpane);
354
+ AddSkyboxTab2(skyboxpane);
355
+ AddSkyboxTab3(skyboxpane);
356
+
357
+ skyboxPanel.add(skyboxpane);
320358 }
321359
360
+ public void ChangeTexture(String texture)
361
+ {
362
+ for (int i=0; i<group.selection.size(); i++)
363
+ {
364
+ Object3D obj = group.selection.get(i);
365
+ obj.SetPigmentTexture("@" + texture);
366
+ }
367
+
368
+ 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();
379
+ }
380
+
322381 //ObjEditor objEditor;
323382 public void closeUI2()
324383 {
....@@ -356,10 +415,12 @@
356415 this.copy = this.group = group;
357416 //selectees = this.group.selectees;
358417
359
- if (copy.versions == null)
418
+ if (copy.versionlist == null)
360419 {
361
- copy.versions = new byte[100][];
420
+ copy.versionlist = new Object3D[100];
362421 copy.versionindex = -1;
422
+
423
+ Save(true);
363424 }
364425
365426 if(ui)
....@@ -383,9 +444,9 @@
383444
384445 ((cRadio)radioPanel.getComponent(0)).SetCamera(cameraView.renderCamera, true);
385446
386
- if (copy.versions == null)
447
+ if (copy.versionlist == null)
387448 {
388
- copy.versions = new byte[100][];
449
+ copy.versionlist = new Object3D[100];
389450 copy.versionindex = -1;
390451
391452 Save(true);
....@@ -591,11 +652,9 @@
591652 oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest"));
592653 //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection"));
593654 //cameraMenu.add(switchViewItem = new MenuItem("Reverse View"));
594
- editLeafItem = oe.cameraMenu.add(new MenuItem("Edit Leaf"));
595655 oe.cameraMenu.add("-");
596656 openWindowItem = oe.cameraMenu.add(new MenuItem("Edit copy..."));
597657 openWindowItem.addActionListener(this);
598
- editLeafItem.addActionListener(this);
599658 lookAtItem.addActionListener(this);
600659 //lookFromItem.addActinoListener(this);
601660 //switchViewItem.addActionListener(this);
....@@ -843,6 +902,9 @@
843902 shareGeometriesItem.addActionListener(this);
844903 mergeGeometriesItem = menu.add(new MenuItem("Merge Geometries"));
845904 mergeGeometriesItem.addActionListener(this);
905
+ menu.add("-");
906
+ editLeafItem = menu.add(new MenuItem("Edit leaf..."));
907
+ editLeafItem.addActionListener(this);
846908 if (Globals.ADVANCED)
847909 {
848910 // Pretty much the same as duplicate and clone.
....@@ -859,6 +921,73 @@
859921 buildToolsMenu(menu);
860922 }
861923
924
+ JTabbedPane resourcecontainer;
925
+ cGridBag currenttab;
926
+ boolean added; // patch for jar
927
+
928
+ int tabcount = 0;
929
+ int colcount = 0;
930
+ int rowcount = 0;
931
+ int texturecount = 0;
932
+
933
+ int columns = 5;
934
+ int rows = 7;
935
+
936
+ public void ResourceCallBack(String[] path)
937
+ {
938
+// for (int i = 0; i < path.length; i++)
939
+// System.out.print(path[i] + "/");
940
+// System.out.println();
941
+
942
+ if (//rowcount == 0 ||
943
+ path.length == 1)
944
+ {
945
+ currenttab = new cGridBag();
946
+ added = false;
947
+ String tabname = path[0]; // String.valueOf((char)('A'+tabcount));
948
+ currenttab.setName(tabname);
949
+ rowcount = 1;
950
+ colcount = 0;
951
+ texturecount = 0;
952
+ }
953
+
954
+ if (path.length > 2 && path[2].toLowerCase().endsWith(".jpg"))
955
+ {
956
+ if (!added)
957
+ {
958
+ added = true;
959
+ resourcecontainer.add(currenttab);
960
+ String tabname = path[0]; // String.valueOf((char)('A'+tabcount));
961
+ resourcecontainer.setToolTipTextAt(tabcount++, "Texture Group " + tabname);
962
+ }
963
+
964
+ AddTextureButton(path[0], path[1], path[2], texturecount++, currenttab);
965
+
966
+ if (++colcount >= columns)
967
+ {
968
+ colcount = 0;
969
+ currenttab.Return();
970
+
971
+ if (rowcount++ >= rows)
972
+ {
973
+ rowcount = 0;
974
+ }
975
+ }
976
+ }
977
+ else
978
+ {
979
+// if (!path[path.length-1].equals("icons"))
980
+// resourcecontainer.Return();
981
+ }
982
+ }
983
+
984
+ void CreateTexturePanel(cGridBag container)
985
+ {
986
+ resourcecontainer = new JTabbedPane(JTabbedPane.LEFT);
987
+ container.add(resourcecontainer);
988
+
989
+ Grafreed.ParseResources("textures", this);
990
+ }
862991
863992 void SetupUI2(ObjEditor oe)
864993 {
....@@ -877,11 +1006,6 @@
8771006 //new Exception().printStackTrace();
8781007
8791008 oe.radioPanel = new JPanel(new GridBagLayout());
880
- oe.aConstraints.weightx = 1;
881
- oe.aConstraints.weighty = 0;
882
- oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
883
- oe.aConstraints.gridwidth = 100;
884
- oe.aConstraints.gridheight = 1;
8851009 // oe.toolbarPanel.add(radioPanel); //, oe.aConstraints);
8861010
8871011 oe.buttonGroup = new ButtonGroup();
....@@ -914,10 +1038,49 @@
9141038
9151039 if (Globals.ADVANCED)
9161040 {
917
- oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
918
- maxButton.setToolTipText("Maximize window");
919
- 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);
9201044 }
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
+ //
9211084
9221085 oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
9231086 fullButton.setToolTipText("Full-screen window");
....@@ -931,41 +1094,45 @@
9311094 restoreCameraButton.setToolTipText("Restore viewpoint");
9321095 restoreCameraButton.addActionListener(this);
9331096
934
- copyOptionsPanel.add(saveButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
935
- saveButton.setToolTipText("New version");
936
- saveButton.addActionListener(this);
1097
+ copyOptionsPanel.add(saveVersionButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1098
+ saveVersionButton.setToolTipText("Duplicate current version");
1099
+ saveVersionButton.addActionListener(this);
9371100
938
- copyOptionsPanel.add(undoButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
939
- undoButton.setToolTipText("Previous version");
940
- undoButton.addActionListener(this);
941
- undoButton.setEnabled(false);
1101
+ copyOptionsPanel.add(deleteVersionButton = GetButton("icons/trash.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1102
+ deleteVersionButton.setToolTipText("Delete current version");
1103
+ deleteVersionButton.addActionListener(this);
1104
+
1105
+ copyOptionsPanel.add(previousVersionButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1106
+ previousVersionButton.setToolTipText("Previous version");
1107
+ previousVersionButton.addActionListener(this);
1108
+ previousVersionButton.setEnabled(false);
9421109
9431110 cGridBag updown = new cGridBag().setVertical(true);
9441111 updown.add(restoreButton = GetButton("icons/restore.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
945
- restoreButton.setToolTipText("Restore current");
1112
+ restoreButton.setToolTipText("Undo (restore current version)");
9461113 restoreButton.addActionListener(this);
947
- restoreButton.setEnabled(false);
1114
+ //restoreButton.setEnabled(false);
9481115
9491116 updown.add(replaceButton = GetButton("icons/replace.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
950
- replaceButton.setToolTipText("Replace current");
1117
+ replaceButton.setToolTipText("Save (replace current version)");
9511118 replaceButton.addActionListener(this);
952
- replaceButton.setEnabled(false);
1119
+ //replaceButton.setEnabled(false);
9531120
9541121 copyOptionsPanel.add(updown);
9551122
956
- copyOptionsPanel.add(redoButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
957
- redoButton.setToolTipText("Next version");
958
- redoButton.addActionListener(this);
959
- redoButton.setEnabled(false);
1123
+ copyOptionsPanel.add(nextVersionButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1124
+ nextVersionButton.setToolTipText("Next version");
1125
+ nextVersionButton.addActionListener(this);
1126
+ nextVersionButton.setEnabled(false);
1127
+
1128
+ oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1129
+ oneStepButton.setToolTipText("Animate one step forward");
1130
+ oneStepButton.addActionListener(this);
9601131
9611132 oe.toolbarPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
9621133 liveCB.setToolTipText("Enable animation");
9631134 liveCB.addItemListener(this);
9641135
965
- oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
966
- oneStepButton.setToolTipText("Animate one step forward");
967
- oneStepButton.addActionListener(this);
968
-
9691136 oe.toolbarPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
9701137 fastCB.setToolTipText("Fast mode");
9711138 fastCB.addItemListener(this);
....@@ -992,21 +1159,6 @@
9921159
9931160 //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
9941161
995
- oe.toolbarPanel.add(twoButton = GetButton("icons/cube.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
996
- twoButton.setToolTipText("Show 3D view only");
997
- twoButton.addActionListener(this);
998
- this.fullscreenLayout = twoButton;
999
-
1000
- oe.toolbarPanel.add(threeButton = GetButton("icons/controlsview.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1001
- threeButton.setToolTipText("Show controls and 3D view");
1002
- threeButton.addActionListener(this);
1003
- oe.toolbarPanel.add(sixButton = GetButton("icons/viewcontrols.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1004
- sixButton.setToolTipText("Show 3D view and controls");
1005
- sixButton.addActionListener(this);
1006
-// oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1007
-// sevenButton.setToolTipText("3-column layout");
1008
-// sevenButton.addActionListener(this);
1009
- //
10101162
10111163 oe.toolbarPanel.add(rootButton = GetButton("icons/openwindow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
10121164 rootButton.setToolTipText("Open selection in new tab");
....@@ -1022,7 +1174,7 @@
10221174
10231175 // INSERT
10241176 row1.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1025
- gridButton.setToolTipText("Create grid");
1177
+ gridButton.setToolTipText("Create ground");
10261178 gridButton.addActionListener(this);
10271179
10281180 row1.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
....@@ -1090,19 +1242,15 @@
10901242
10911243 oe.toolboxPanel.add(row2);
10921244
1093
- // ENVYMAPS
1094
- cGridBag skyboxpane = new cGridBag();
1095
- skyboxpane.preferredHeight = 100;
1245
+ cGridBag textures = new cGridBag();
10961246
1097
- oe.toolboxPanel.add(skyboxpane);
1247
+ CreateTexturePanel(textures);
10981248
1099
- JTabbedPane skyboxpanel = new JTabbedPane();
1100
- skyboxpane.add(skyboxpanel);
1249
+ oe.toolboxPanel.add(textures);
11011250
1102
- AddSkyboxTab0(skyboxpanel);
1103
- AddSkyboxTab1(skyboxpanel);
1104
- AddSkyboxTab2(skyboxpanel);
1105
- AddSkyboxTab3(skyboxpanel);
1251
+ textures.preferredHeight = 100;
1252
+
1253
+ CreateSkyboxPanel(oe.skyboxPanel);
11061254
11071255 // EDIT panel
11081256 editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
....@@ -1110,20 +1258,20 @@
11101258 editButton.addActionListener(this);
11111259
11121260 editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1113
- uneditButton.setToolTipText("Remove selection controls");
1261
+ uneditButton.setToolTipText("Unpin and remove selection controls");
11141262 uneditButton.addActionListener(this);
11151263
11161264 editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
1117
- allParamsButton.setToolTipText("Show all controle");
1265
+ allParamsButton.setToolTipText("Show all controls");
11181266 allParamsButton.addActionListener(this);
11191267
1120
- editCommandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1121
- clearPanelButton.setToolTipText("Clear edit panel");
1268
+ editCommandsPanel.add(clearPanelButton = GetButton("icons/clear.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1269
+ clearPanelButton.setToolTipText("Clear all controls");
11221270 clearPanelButton.addActionListener(this);
11231271
1124
- editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1125
- unselectButton.setToolTipText("Unselect");
1126
- unselectButton.addActionListener(this);
1272
+ //editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1273
+ //unselectButton.setToolTipText("Unselect");
1274
+ //unselectButton.addActionListener(this);
11271275
11281276 editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
11291277 flashSelectionButton.setToolTipText("Highlight selection");
....@@ -1183,7 +1331,7 @@
11831331 dgr.addDragGestureListener(this);
11841332 }catch(Exception e) {}
11851333 */
1186
- radio.layout = sixButton; // sevenButton;
1334
+ radio.layout = threeButton; // sixButton;
11871335 oe.toolbarPanel.add(radioPanel); //, oe.aConstraints);
11881336 }
11891337
....@@ -1234,9 +1382,12 @@
12341382 smoothCB.setToolTipText("Snapping delay");
12351383 smoothCB.addItemListener(this);
12361384
1237
- panel.add(slowCB = new cCheckBox("Slow", CameraPane.SLOWPOSE)); //, constraints);
1238
- slowCB.setToolTipText("Smooth interpolation");
1239
- slowCB.addItemListener(this);
1385
+// panel.add(slowCB = new cCheckBox("Slow", CameraPane.SLOWPOSE)); //, constraints);
1386
+// slowCB.setToolTipText("Smooth interpolation");
1387
+// slowCB.addItemListener(this);
1388
+ panel.add(minshaderCB = new cCheckBox("Min shader", Globals.MINSHADER)); //, constraints);
1389
+ minshaderCB.setToolTipText("Minimal fast shader");
1390
+ minshaderCB.addItemListener(this);
12401391
12411392 // constraints.gridy += 1;
12421393 // panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
....@@ -1315,6 +1466,14 @@
13151466
13161467 void EditObject(Object3D obj)
13171468 {
1469
+ assert(obj instanceof Composite);
1470
+
1471
+// if (obj.versionlist == null)
1472
+// {
1473
+// obj.versionlist = new Object3D[100];
1474
+// obj.versionindex = -1;
1475
+// }
1476
+
13181477 cRadio radioButton = new cRadio(obj.name);
13191478
13201479 // June 2019. Patch to avoid bug with transparency.
....@@ -1325,7 +1484,7 @@
13251484 }
13261485
13271486 radioButton.SetObject(obj);
1328
- radioButton.layout = sixButton; // sevenButton;
1487
+ radioButton.layout = threeButton; // sixButton;
13291488 radioButton.SetCamera(cameraView.renderCamera, false);
13301489 radioButton.addActionListener(this);
13311490 radioPanel.add(radioButton);
....@@ -1350,6 +1509,8 @@
13501509 cCheckBox localCB;
13511510 cCheckBox crowdCB;
13521511 cCheckBox smoothCB;
1512
+ cCheckBox minshaderCB;
1513
+
13531514 cToggleButton fastCB;
13541515 cCheckBox slowCB;
13551516 cCheckBox boxCB;
....@@ -1420,6 +1581,12 @@
14201581 {
14211582 cameraView.ToggleInertia();
14221583 cameraView.repaint();
1584
+ }
1585
+ else if(e.getSource() == minshaderCB)
1586
+ {
1587
+ Globals.MINSHADER ^= true;
1588
+ cameraView.programInitialized = false;
1589
+ cameraView.repaint();
14231590 }
14241591 else if(e.getSource() == localCB)
14251592 {
....@@ -1697,7 +1864,12 @@
16971864 TreePath path;
16981865
16991866 public TransferableTreePath(TreePath tp) {
1700
- 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);
17011873 }
17021874
17031875 public synchronized DataFlavor[] getTransferDataFlavors() {
....@@ -2560,7 +2732,7 @@
25602732 if (source == invariantsItem)
25612733 {
25622734 System.out.println("Invariants:");
2563
- Grafreed.grafreeD.universe.invariants();
2735
+ Grafreed.grafreed.universe.invariants();
25642736 } else
25652737 if (source == memoryItem)
25662738 {
....@@ -2591,33 +2763,52 @@
25912763 {
25922764 ToggleFullScreen();
25932765 } else
2594
- if (source == undoButton)
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();
2777
+ } else
2778
+ if (source == previousVersionButton)
25952779 {
25962780 // Go to previous version
25972781 //if (!Undo())
25982782 //java.awt.Toolkit.getDefaultToolkit().beep();
2599
- Undo();
2783
+ PreviousVersion();
26002784 } else
26012785 if (source == restoreButton)
26022786 {
26032787 // Restore current version
26042788 Restore();
2789
+ //restoreButton.setEnabled(false);
26052790 } else
26062791 if (source == replaceButton)
26072792 {
26082793 // Overwrite current version
26092794 Replace();
2795
+ //replaceButton.setEnabled(false);
26102796 } else
2611
- if (source == redoButton)
2797
+ if (source == nextVersionButton)
26122798 {
26132799 // Go to next version
2614
- Redo();
2800
+ NextVersion();
26152801 } else
2616
- if (source == saveButton)
2802
+ if (source == saveVersionButton)
26172803 {
26182804 // Save a new version
26192805 if (!Save(true))
26202806 java.awt.Toolkit.getDefaultToolkit().beep();
2807
+ } else
2808
+ if (source == deleteVersionButton)
2809
+ {
2810
+ // Delete a new version
2811
+ DeleteVersion();
26212812 } else
26222813 if (source == oneStepButton)
26232814 {
....@@ -2672,11 +2863,11 @@
26722863 } else
26732864 if (source == undoItem)
26742865 {
2675
- Undo();
2866
+ PreviousVersion();
26762867 } else
26772868 if (source == redoItem)
26782869 {
2679
- Redo();
2870
+ NextVersion();
26802871 } else
26812872 if (source == duplicateItem)
26822873 {
....@@ -3535,38 +3726,7 @@
35353726 if (CameraPane.FULLSCREEN)
35363727 fullscreenLayout = radio.layout;
35373728
3538
- // bug
3539
- //gridPanel.setDividerLocation(1.0);
3540
- //bigPanel.setDividerLocation(0.0);
3541
-// bigThree.remove(scenePanel);
3542
-// bigThree.remove(centralPanel);
3543
-// bigThree.remove(XYZPanel);
3544
-// aWindowConstraints.gridx = 0;
3545
-// aWindowConstraints.gridy = 0;
3546
-// aWindowConstraints.gridwidth = 1;
3547
-// // aConstraints.gridheight = 3;
3548
-// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3549
-// aWindowConstraints.weightx = 0;
3550
-// aWindowConstraints.weighty = 1;
3551
-// //bigThree.add(jtp, aWindowConstraints);
3552
-// aWindowConstraints.weightx = 1;
3553
-// aWindowConstraints.gridwidth = 3;
3554
-// // aConstraints.gridheight = 3;
3555
-// aWindowConstraints.gridx = 1;
3556
-// aWindowConstraints.fill = GridBagConstraints.BOTH;
3557
-// bigThree.add(centralPanel, aWindowConstraints);
3558
-// aWindowConstraints.weightx = 0;
3559
-// aWindowConstraints.gridx = 4;
3560
-// aWindowConstraints.gridwidth = 1;
3561
-// // aConstraints.gridheight = 3;
3562
-// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3563
-// //bigThree.add(XYZPanel, aWindowConstraints);
3564
-// scenePanel.setVisible(false);
3565
-// centralPanel.setVisible(true);
3566
-// XYZPanel.setVisible(false);
3567
- bigThree.ClearUI();
3568
- bigThree.add(centralPanel);
3569
- bigThree.FlushUI();
3729
+ Show3DView();
35703730
35713731 cameraView.requestFocusInWindow();
35723732
....@@ -3752,6 +3912,7 @@
37523912 } else
37533913 if (source == rootButton)
37543914 {
3915
+ Replace();
37553916 Object3D obj;
37563917 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
37573918 {
....@@ -3809,10 +3970,10 @@
38093970 {
38103971 Object3D child = (Object3D)e.nextElement();
38113972 if(child.editWindow != null)
3812
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
38133973 child.pinned = false;
38143974 child.CloseUI();
38153975 listUI.remove(child);
3976
+// objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
38163977
38173978 //child.editWindow = null; // ???????????
38183979 }
....@@ -3831,6 +3992,7 @@
38313992 obj.CloseUI();
38323993 }
38333994 listUI.clear();
3995
+ SetPinStates(group.selection.size() > 0);
38343996 refreshContents(true);
38353997 } else
38363998 if (source == allParamsButton)
....@@ -3887,8 +4049,6 @@
38874049
38884050 copy = group;
38894051
3890
- SetUndoStates();
3891
-
38924052 //Globals.theRenderer.object = group;
38934053 if(!useclient)
38944054 {
....@@ -3916,7 +4076,20 @@
39164076 */
39174077 radio.layout.doClick();
39184078
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
+
39194091 ClearUnpinned();
4092
+
39204093 //Grafreed.Assert(group != null);
39214094 //Grafreed.Assert(group.selection != null);
39224095 SetPinStates(group.selection == null || group.selection.size() > 0);
....@@ -3933,11 +4106,13 @@
39334106 } else if (event.getSource() == editCameraItem)
39344107 {
39354108 cameraView.ProtectCamera();
4109
+ cameraView.requestFocusInWindow();
39364110 cameraView.repaint();
39374111 return;
39384112 } else if (event.getSource() == restoreCameraItem || event.getSource() == restoreCameraButton)
39394113 {
39404114 cameraView.RevertCamera();
4115
+ cameraView.requestFocusInWindow();
39414116 cameraView.repaint();
39424117 return;
39434118 // } else if (event.getSource() == textureButton)
....@@ -5070,9 +5245,7 @@
50705245
50715246 freezemodel = false;
50725247 }
5073
-
5074
- boolean flashIt = true;
5075
-
5248
+
50765249 public void valueChanged(TreeSelectionEvent e)
50775250 //public boolean handleEvent(Event event)
50785251 {
....@@ -5145,13 +5318,28 @@
51455318 {
51465319 editButton.setEnabled(enabled);
51475320 uneditButton.setEnabled(enabled);
5148
- unselectButton.setEnabled(enabled);
5321
+ //unselectButton.setEnabled(enabled);
51495322 flashSelectionButton.setEnabled(enabled);
5323
+
5324
+ 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);
51505338 }
51515339
51525340 void refreshContents(boolean cp)
51535341 {
5154
- if (objectPanel.getSelectedIndex() == 2) // objectPanel.indexOfTab("Info"))
5342
+ //if (objectPanel.getSelectedIndex() == 2) // objectPanel.indexOfTab("Info"))
51555343 if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
51565344 {
51575345 objEditor.ClearInfo(); // .GetMaterial());
....@@ -5161,7 +5349,7 @@
51615349 Object3D child = (Object3D) group.selection.get(i);
51625350
51635351 objEditor.AddInfo(child, this, true);
5164
- System.err.println("info : " + child.GetPath());
5352
+// System.err.println("info : " + child.GetPath());
51655353 }
51665354
51675355 objEditor.SetText(); // jan 2014
....@@ -5987,7 +6175,6 @@
59876175
59886176 cButton restoreCameraButton;
59896177
5990
- cButton saveButton;
59916178 cButton oneStepButton;
59926179
59936180 cButton groupButton;