Normand Briere
2019-08-15 24a2a946b35279605e645349bd6b82e9e60aac88
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 {
....@@ -360,6 +419,8 @@
360419 {
361420 copy.versionlist = new Object3D[100];
362421 copy.versionindex = -1;
422
+
423
+ Save(true);
363424 }
364425
365426 if(ui)
....@@ -479,32 +540,37 @@
479540 // menu.add("-");
480541 duplicateItem = oe.jTree.popup.add(new JMenuItem("Duplicate"));
481542 duplicateItem.addActionListener(this);
482
- cloneItem = menu.add(new MenuItem("Clone"));
543
+
544
+ cloneItem = oe.jTree.popup.add(new JMenuItem("Clone"));
483545 cloneItem.addActionListener(this);
484
- if (Globals.ADVANCED)
546
+ //if (Globals.ADVANCED)
485547 {
486548 cloneSupportItem = menu.add(new MenuItem("Clone (+supports)"));
487549 cloneSupportItem.addActionListener(this);
488550 }
551
+ oe.jTree.popup.addSeparator();
489552 menu.add("-");
490
- cutItem = menu.add(new MenuItem("Cut"));
553
+ cutItem = oe.jTree.popup.add(new JMenuItem("Cut"));
491554 cutItem.addActionListener(this);
492
- copyItem = menu.add(new MenuItem("Copy"));
555
+ copyItem = oe.jTree.popup.add(new JMenuItem("Copy"));
493556 copyItem.addActionListener(this);
494557 pasteItem = menu.add(new MenuItem("Paste"));
495558 pasteItem.addActionListener(this);
496559
497
- menu.add("-");
498
- pasteIntoItem = menu.add(new MenuItem("Paste into"));
560
+ oe.jTree.popup.addSeparator();
561
+ //menu.add("-");
562
+ pasteIntoItem = oe.jTree.popup.add(new JMenuItem("Paste into"));
499563 pasteIntoItem.addActionListener(this);
500
- pasteLinkItem = menu.add(new MenuItem("Paste link"));
564
+ pasteLinkItem = oe.jTree.popup.add(new JMenuItem("Paste link"));
501565 pasteLinkItem.addActionListener(this);
502
- pasteCloneItem = menu.add(new MenuItem("Paste clone"));
566
+ pasteCloneItem = oe.jTree.popup.add(new JMenuItem("Paste clone"));
503567 pasteCloneItem.addActionListener(this);
504
-// pasteExpandItem = menu.add(new MenuItem("Paste expand"));
568
+// CRASH pasteExpandItem = oe.jTree.popup.add(new JMenuItem("Paste expand"));
505569 // pasteExpandItem.addActionListener(this);
506
- menu.add("-");
507
- deleteItem = menu.add(new MenuItem("Delete"));
570
+ //menu.add("-");
571
+ oe.jTree.popup.addSeparator();
572
+
573
+ deleteItem = oe.jTree.popup.add(new JMenuItem("Delete"));
508574 deleteItem.addActionListener(this);
509575
510576 if (Globals.ADVANCED)
....@@ -591,11 +657,9 @@
591657 oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest"));
592658 //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection"));
593659 //cameraMenu.add(switchViewItem = new MenuItem("Reverse View"));
594
- editLeafItem = oe.cameraMenu.add(new MenuItem("Edit Leaf"));
595660 oe.cameraMenu.add("-");
596661 openWindowItem = oe.cameraMenu.add(new MenuItem("Edit copy..."));
597662 openWindowItem.addActionListener(this);
598
- editLeafItem.addActionListener(this);
599663 lookAtItem.addActionListener(this);
600664 //lookFromItem.addActinoListener(this);
601665 //switchViewItem.addActionListener(this);
....@@ -657,7 +721,7 @@
657721 hideItem = menu.add(new MenuItem("Hidden Group"));
658722 hideItem.addActionListener(this);
659723 }
660
- ungroupItem = menu.add(new MenuItem("Ungroup"));
724
+ ungroupItem = oe.jTree.popup.add(new JMenuItem("Ungroup"));
661725 ungroupItem.addActionListener(this);
662726
663727 // menu.add("-");
....@@ -843,6 +907,9 @@
843907 shareGeometriesItem.addActionListener(this);
844908 mergeGeometriesItem = menu.add(new MenuItem("Merge Geometries"));
845909 mergeGeometriesItem.addActionListener(this);
910
+ menu.add("-");
911
+ editLeafItem = menu.add(new MenuItem("Edit leaf..."));
912
+ editLeafItem.addActionListener(this);
846913 if (Globals.ADVANCED)
847914 {
848915 // Pretty much the same as duplicate and clone.
....@@ -859,6 +926,74 @@
859926 buildToolsMenu(menu);
860927 }
861928
929
+ JTabbedPane resourcecontainer;
930
+ cGridBag currenttab;
931
+ //boolean added; // patch for jar
932
+
933
+ int tabcount = 0;
934
+ int colcount = 0;
935
+ int rowcount = 0;
936
+ int texturecount = 0;
937
+
938
+ int columns = 5;
939
+ int rows = 7;
940
+
941
+ public void ResourceCallBack(String[] path)
942
+ {
943
+// for (int i = 0; i < path.length; i++)
944
+// System.out.print(path[i] + "/");
945
+// System.out.println();
946
+
947
+ if (//rowcount == 0 ||
948
+ path.length == 1 && !path[0].equals("") && !path[0].equals(".DS_Store"))
949
+ {
950
+ currenttab = new cGridBag();
951
+ String tabname = path[0]; // String.valueOf((char)('A'+tabcount));
952
+ currenttab.setName(tabname);
953
+ //added = false;
954
+ resourcecontainer.add(currenttab);
955
+ resourcecontainer.setToolTipTextAt(tabcount++, "Texture Group " + tabname);
956
+ rowcount = 1;
957
+ colcount = 0;
958
+ texturecount = 0;
959
+ }
960
+
961
+ if (path.length > 2 && path[2].toLowerCase().endsWith(".jpg"))
962
+ {
963
+ //if (!added)
964
+ {
965
+ //added = true;
966
+ String tabname = path[0]; // String.valueOf((char)('A'+tabcount));
967
+ currenttab = (cGridBag)resourcecontainer.getComponentAt(resourcecontainer.indexOfTab(tabname));
968
+ }
969
+
970
+ AddTextureButton(path[0], path[1], path[2], texturecount++, currenttab);
971
+
972
+ if (++colcount >= columns)
973
+ {
974
+ colcount = 0;
975
+ currenttab.Return();
976
+
977
+ if (rowcount++ >= rows)
978
+ {
979
+ rowcount = 0;
980
+ }
981
+ }
982
+ }
983
+ else
984
+ {
985
+// if (!path[path.length-1].equals("icons"))
986
+// resourcecontainer.Return();
987
+ }
988
+ }
989
+
990
+ void CreateTexturePanel(cGridBag container)
991
+ {
992
+ resourcecontainer = new JTabbedPane(JTabbedPane.LEFT);
993
+ container.add(resourcecontainer);
994
+
995
+ Grafreed.ParseResources("textures", this);
996
+ }
862997
863998 void SetupUI2(ObjEditor oe)
864999 {
....@@ -877,11 +1012,6 @@
8771012 //new Exception().printStackTrace();
8781013
8791014 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;
8851015 // oe.toolbarPanel.add(radioPanel); //, oe.aConstraints);
8861016
8871017 oe.buttonGroup = new ButtonGroup();
....@@ -914,10 +1044,49 @@
9141044
9151045 if (Globals.ADVANCED)
9161046 {
917
- oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
918
- maxButton.setToolTipText("Maximize window");
919
- maxButton.addActionListener(this);
1047
+// oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1048
+// maxButton.setToolTipText("Maximize window");
1049
+// maxButton.addActionListener(this);
9201050 }
1051
+
1052
+ cButton gcButton;
1053
+
1054
+// oe.toolbarPanel.add(gcButton = GetButton("icons/trash.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1055
+// gcButton.setToolTipText("Garbage collect");
1056
+// gcButton.addActionListener(new ActionListener()
1057
+// {
1058
+// public void actionPerformed(ActionEvent e)
1059
+// {
1060
+// System.gc();
1061
+// }
1062
+// });
1063
+
1064
+ oe.toolbarPanel.add(collapseButton = GetButton("icons/collapse.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1065
+ collapseButton.setToolTipText("Collapse toolbar");
1066
+ collapseButton.addActionListener(this);
1067
+
1068
+ oe.toolbarPanel.add(maximize3DButton = GetButton("", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1069
+ maximize3DButton.setToolTipText("Maximize 3D view");
1070
+ maximize3DButton.addActionListener(this);
1071
+
1072
+ oe.toolbarPanel.add(twoButton = GetButton("icons/cube.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1073
+ twoButton.setToolTipText("Show 3D view only");
1074
+ twoButton.addActionListener(this);
1075
+ this.fullscreenLayout = twoButton;
1076
+
1077
+ oe.toolbarPanel.add(threeButton = GetButton("icons/controlsview.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1078
+ threeButton.setToolTipText("Show controls and 3D view");
1079
+ threeButton.addActionListener(this);
1080
+ if (Globals.ADVANCED)
1081
+ {
1082
+ oe.toolbarPanel.add(sixButton = GetButton("icons/viewcontrols.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1083
+ sixButton.setToolTipText("Show 3D view and controls");
1084
+ sixButton.addActionListener(this);
1085
+ }
1086
+// oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1087
+// sevenButton.setToolTipText("3-column layout");
1088
+// sevenButton.addActionListener(this);
1089
+ //
9211090
9221091 oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
9231092 fullButton.setToolTipText("Full-screen window");
....@@ -962,14 +1131,14 @@
9621131 nextVersionButton.addActionListener(this);
9631132 nextVersionButton.setEnabled(false);
9641133
965
- oe.toolbarPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
966
- liveCB.setToolTipText("Enable animation");
967
- liveCB.addItemListener(this);
968
-
9691134 oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
9701135 oneStepButton.setToolTipText("Animate one step forward");
9711136 oneStepButton.addActionListener(this);
9721137
1138
+ oe.toolbarPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
1139
+ liveCB.setToolTipText("Enable animation");
1140
+ liveCB.addItemListener(this);
1141
+
9731142 oe.toolbarPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
9741143 fastCB.setToolTipText("Fast mode");
9751144 fastCB.addItemListener(this);
....@@ -996,21 +1165,6 @@
9961165
9971166 //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
9981167
999
- oe.toolbarPanel.add(twoButton = GetButton("icons/cube.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1000
- twoButton.setToolTipText("Show 3D view only");
1001
- twoButton.addActionListener(this);
1002
- this.fullscreenLayout = twoButton;
1003
-
1004
- oe.toolbarPanel.add(threeButton = GetButton("icons/controlsview.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1005
- threeButton.setToolTipText("Show controls and 3D view");
1006
- threeButton.addActionListener(this);
1007
- oe.toolbarPanel.add(sixButton = GetButton("icons/viewcontrols.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1008
- sixButton.setToolTipText("Show 3D view and controls");
1009
- sixButton.addActionListener(this);
1010
-// oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1011
-// sevenButton.setToolTipText("3-column layout");
1012
-// sevenButton.addActionListener(this);
1013
- //
10141168
10151169 oe.toolbarPanel.add(rootButton = GetButton("icons/openwindow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
10161170 rootButton.setToolTipText("Open selection in new tab");
....@@ -1026,7 +1180,7 @@
10261180
10271181 // INSERT
10281182 row1.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1029
- gridButton.setToolTipText("Create grid");
1183
+ gridButton.setToolTipText("Create ground");
10301184 gridButton.addActionListener(this);
10311185
10321186 row1.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
....@@ -1094,19 +1248,15 @@
10941248
10951249 oe.toolboxPanel.add(row2);
10961250
1097
- // ENVYMAPS
1098
- cGridBag skyboxpane = new cGridBag();
1099
- skyboxpane.preferredHeight = 100;
1251
+ cGridBag textures = new cGridBag();
11001252
1101
- oe.toolboxPanel.add(skyboxpane);
1253
+ CreateTexturePanel(textures);
11021254
1103
- JTabbedPane skyboxpanel = new JTabbedPane();
1104
- skyboxpane.add(skyboxpanel);
1255
+ oe.toolboxPanel.add(textures);
11051256
1106
- AddSkyboxTab0(skyboxpanel);
1107
- AddSkyboxTab1(skyboxpanel);
1108
- AddSkyboxTab2(skyboxpanel);
1109
- AddSkyboxTab3(skyboxpanel);
1257
+ textures.preferredHeight = 100;
1258
+
1259
+ CreateSkyboxPanel(oe.skyboxPanel);
11101260
11111261 // EDIT panel
11121262 editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
....@@ -1118,16 +1268,16 @@
11181268 uneditButton.addActionListener(this);
11191269
11201270 editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
1121
- allParamsButton.setToolTipText("Show all controle");
1271
+ allParamsButton.setToolTipText("Show all controls");
11221272 allParamsButton.addActionListener(this);
11231273
11241274 editCommandsPanel.add(clearPanelButton = GetButton("icons/clear.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1125
- clearPanelButton.setToolTipText("Clear edit panel");
1275
+ clearPanelButton.setToolTipText("Clear all controls");
11261276 clearPanelButton.addActionListener(this);
11271277
1128
- editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1129
- unselectButton.setToolTipText("Unselect");
1130
- unselectButton.addActionListener(this);
1278
+ //editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1279
+ //unselectButton.setToolTipText("Unselect");
1280
+ //unselectButton.addActionListener(this);
11311281
11321282 editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
11331283 flashSelectionButton.setToolTipText("Highlight selection");
....@@ -1322,6 +1472,14 @@
13221472
13231473 void EditObject(Object3D obj)
13241474 {
1475
+ assert(obj instanceof Composite);
1476
+
1477
+// if (obj.versionlist == null)
1478
+// {
1479
+// obj.versionlist = new Object3D[100];
1480
+// obj.versionindex = -1;
1481
+// }
1482
+
13251483 cRadio radioButton = new cRadio(obj.name);
13261484
13271485 // June 2019. Patch to avoid bug with transparency.
....@@ -1712,7 +1870,12 @@
17121870 TreePath path;
17131871
17141872 public TransferableTreePath(TreePath tp) {
1715
- path = tp;
1873
+ Object[] objs = new Object[tp.getPathCount()];
1874
+ for (int i=0; i<objs.length; i++)
1875
+ {
1876
+ objs[i] = ((Object3D)tp.getPathComponent(i)).GetUUID();
1877
+ }
1878
+ path = new TreePath(objs);
17161879 }
17171880
17181881 public synchronized DataFlavor[] getTransferDataFlavors() {
....@@ -2523,27 +2686,35 @@
25232686 } else
25242687 if (source == loopItem || source == loopButton)
25252688 {
2689
+ if (!group.selection.isEmpty())
2690
+ {
25262691 Composite csg = new GroupLeaf();
25272692 csg.count = 5;
2528
- group(csg);
25292693 Composite child = new cGroup("Branch");
25302694 csg.addChild(child);
25312695 child.addChild(csg);
2696
+ group(csg);
2697
+ }
25322698 } else
25332699 if (source == doubleItem)
25342700 {
2701
+ if (!group.selection.isEmpty())
2702
+ {
25352703 Composite csg = new GroupLeaf("Fork");
25362704 csg.count = 5;
2537
- group(csg);
25382705 Composite child = new cGroup("Branch A");
25392706 csg.addChild(child);
25402707 child.addChild(csg);
25412708 child = new cGroup("Branch B");
25422709 csg.addChild(child);
25432710 child.addChild(csg);
2711
+ group(csg);
2712
+ }
25442713 } else
25452714 if (source == tripleItem)
25462715 {
2716
+ if (!group.selection.isEmpty())
2717
+ {
25472718 Composite csg = new GroupLeaf("Trident");
25482719 csg.count = 4;
25492720 group(csg);
....@@ -2556,6 +2727,7 @@
25562727 child = new cGroup();
25572728 csg.addChild(child);
25582729 child.addChild(csg);
2730
+ }
25592731 } else
25602732 if (source == computeAOItem)
25612733 {
....@@ -2605,6 +2777,18 @@
26052777 if (source == fullButton)
26062778 {
26072779 ToggleFullScreen();
2780
+ } else
2781
+ if (source == collapseButton)
2782
+ {
2783
+ this.expandedLayout = radio.layout;
2784
+ CollapseToolbar();
2785
+ } else
2786
+ if (source == maximize3DButton)
2787
+ {
2788
+ this.expandedLayout = radio.layout;
2789
+ radio.layout = twoButton;
2790
+ Show3DView();
2791
+ CollapseToolbar();
26082792 } else
26092793 if (source == previousVersionButton)
26102794 {
....@@ -3179,22 +3363,34 @@
31793363 } else
31803364 if (source == ungroupItem || source == ungroupButton)
31813365 {
3182
- boolean hasRoot = false;
3366
+ boolean canUngroup = true;
31833367
31843368 for (int i=0; i<group.selection.size(); i++)
31853369 {
3186
- if (group.selection.get(i) == group)
3370
+ Object3D selectedItem = group.selection.get(i);
3371
+
3372
+ if (selectedItem.Size() == 0)
31873373 {
3188
- hasRoot = true;
3374
+ // Cannot ungroup leaves
3375
+ canUngroup = false;
3376
+ break;
3377
+ }
3378
+
3379
+ if (selectedItem == group)
3380
+ {
3381
+ // Cannot ungroup root
3382
+ canUngroup = false;
31893383 break;
31903384 }
31913385 }
31923386
3193
- if (!hasRoot)
3387
+ if (canUngroup)
31943388 {
31953389 for (int i=0; i<group.selection.size(); i++)
31963390 {
3197
- Ungroup(group.selection.get(i));
3391
+ Object3D selectedItem = group.selection.get(i);
3392
+
3393
+ Ungroup(selectedItem);
31983394 }
31993395
32003396 ClearSelection(false);
....@@ -3557,38 +3753,7 @@
35573753 if (CameraPane.FULLSCREEN)
35583754 fullscreenLayout = radio.layout;
35593755
3560
- // bug
3561
- //gridPanel.setDividerLocation(1.0);
3562
- //bigPanel.setDividerLocation(0.0);
3563
-// bigThree.remove(scenePanel);
3564
-// bigThree.remove(centralPanel);
3565
-// bigThree.remove(XYZPanel);
3566
-// aWindowConstraints.gridx = 0;
3567
-// aWindowConstraints.gridy = 0;
3568
-// aWindowConstraints.gridwidth = 1;
3569
-// // aConstraints.gridheight = 3;
3570
-// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3571
-// aWindowConstraints.weightx = 0;
3572
-// aWindowConstraints.weighty = 1;
3573
-// //bigThree.add(jtp, aWindowConstraints);
3574
-// aWindowConstraints.weightx = 1;
3575
-// aWindowConstraints.gridwidth = 3;
3576
-// // aConstraints.gridheight = 3;
3577
-// aWindowConstraints.gridx = 1;
3578
-// aWindowConstraints.fill = GridBagConstraints.BOTH;
3579
-// bigThree.add(centralPanel, aWindowConstraints);
3580
-// aWindowConstraints.weightx = 0;
3581
-// aWindowConstraints.gridx = 4;
3582
-// aWindowConstraints.gridwidth = 1;
3583
-// // aConstraints.gridheight = 3;
3584
-// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3585
-// //bigThree.add(XYZPanel, aWindowConstraints);
3586
-// scenePanel.setVisible(false);
3587
-// centralPanel.setVisible(true);
3588
-// XYZPanel.setVisible(false);
3589
- bigThree.ClearUI();
3590
- bigThree.add(centralPanel);
3591
- bigThree.FlushUI();
3756
+ Show3DView();
35923757
35933758 cameraView.requestFocusInWindow();
35943759
....@@ -3774,6 +3939,7 @@
37743939 } else
37753940 if (source == rootButton)
37763941 {
3942
+ Replace();
37773943 Object3D obj;
37783944 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
37793945 {
....@@ -3910,8 +4076,6 @@
39104076
39114077 copy = group;
39124078
3913
- SetUndoStates();
3914
-
39154079 //Globals.theRenderer.object = group;
39164080 if(!useclient)
39174081 {
....@@ -3939,6 +4103,18 @@
39394103 */
39404104 radio.layout.doClick();
39414105
4106
+ assert(copy instanceof Composite);
4107
+
4108
+ if (copy.versionlist == null)
4109
+ {
4110
+ copy.versionlist = new Object3D[100];
4111
+ copy.versionindex = -1;
4112
+
4113
+ Save(true);
4114
+ }
4115
+
4116
+ SetVersionStates();
4117
+
39424118 ClearUnpinned();
39434119
39444120 //Grafreed.Assert(group != null);
....@@ -5169,15 +5345,29 @@
51695345 {
51705346 editButton.setEnabled(enabled);
51715347 uneditButton.setEnabled(enabled);
5172
- unselectButton.setEnabled(enabled);
5348
+ //unselectButton.setEnabled(enabled);
51735349 flashSelectionButton.setEnabled(enabled);
51745350
51755351 clearPanelButton.setEnabled(!listUI.isEmpty());
5352
+
5353
+ boolean allComposites = true;
5354
+
5355
+ if (group.selection != null)
5356
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
5357
+ {
5358
+ if (!(e.nextElement() instanceof Composite))
5359
+ {
5360
+ allComposites = false;
5361
+ break;
5362
+ }
5363
+ }
5364
+
5365
+ rootButton.setEnabled(allComposites);
51765366 }
51775367
51785368 void refreshContents(boolean cp)
51795369 {
5180
- if (objectPanel.getSelectedIndex() == 2) // objectPanel.indexOfTab("Info"))
5370
+ //if (objectPanel.getSelectedIndex() == 2) // objectPanel.indexOfTab("Info"))
51815371 if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
51825372 {
51835373 objEditor.ClearInfo(); // .GetMaterial());
....@@ -5187,7 +5377,7 @@
51875377 Object3D child = (Object3D) group.selection.get(i);
51885378
51895379 objEditor.AddInfo(child, this, true);
5190
- System.err.println("info : " + child.GetPath());
5380
+// System.err.println("info : " + child.GetPath());
51915381 }
51925382
51935383 objEditor.SetText(); // jan 2014
....@@ -6070,11 +6260,11 @@
60706260 private MenuItem lookAtItem;
60716261 private MenuItem lookFromItem;
60726262 private MenuItem switchViewItem;
6073
- private MenuItem cutItem;
6263
+ private JMenuItem cutItem;
60746264 private MenuItem undoItem;
60756265 private MenuItem redoItem;
60766266 private JMenuItem duplicateItem;
6077
- private MenuItem cloneItem;
6267
+ private JMenuItem cloneItem;
60786268 private MenuItem cloneSupportItem;
60796269 private MenuItem overwriteGeoItem;
60806270 private MenuItem overwriteMatItem;
....@@ -6095,13 +6285,13 @@
60956285 private MenuItem cloneGeometriesItem;
60966286 private MenuItem shareGeometriesItem;
60976287 private MenuItem mergeGeometriesItem;
6098
- private MenuItem copyItem;
6288
+ private JMenuItem copyItem;
60996289 private MenuItem pasteItem;
6100
- private MenuItem pasteIntoItem;
6101
- private MenuItem pasteLinkItem;
6102
- private MenuItem pasteCloneItem;
6103
- private MenuItem pasteExpandItem;
6104
- private MenuItem deleteItem;
6290
+ private JMenuItem pasteIntoItem;
6291
+ private JMenuItem pasteLinkItem;
6292
+ private JMenuItem pasteCloneItem;
6293
+ private JMenuItem pasteExpandItem;
6294
+ private JMenuItem deleteItem;
61056295 private MenuItem clearAllItem;
61066296 private MenuItem genUVItem;
61076297 private MenuItem genNormalsMESHItem;
....@@ -6169,7 +6359,7 @@
61696359 private MenuItem switchTransfoItem;
61706360 private MenuItem morphItem;
61716361 private MenuItem linkerItem;
6172
- private MenuItem ungroupItem;
6362
+ private JMenuItem ungroupItem;
61736363 private MenuItem editItem;
61746364 private MenuItem openWindowItem;
61756365 private MenuItem editLeafItem;