Normand Briere
2019-08-15 33504fc9a180903aace77613264550754fba5706
GroupEditor.java
....@@ -16,7 +16,7 @@
1616 //import buoy.widget.BFileChooser;
1717
1818 class GroupEditor extends ObjEditor implements //iParse, //iCallBack,
19
- Grafreed.iResourceCallBack,
19
+ Grafreed.iResourceCallBack,
2020 ObjectUI,
2121 Runnable,
2222 ActionListener,
....@@ -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
....@@ -42,6 +42,22 @@
4242 });
4343 }
4444
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
+
4561 public void AddSkyboxTab0(JTabbedPane skyboxpanel)
4662 {
4763 cGridBag tab0 = new cGridBag().setVertical(true);
....@@ -57,7 +73,7 @@
5773 cGridBag row5 = new cGridBag();
5874 cGridBag row6 = new cGridBag();
5975
60
- AddSkyboxButton("default", "rgb", row0);
76
+ AddSkyboxButton("default", "", row0);
6177 //AddSkyboxButton("default", "cornell", row0);
6278 AddSkyboxButton("penguins", "dust", row0);
6379 AddSkyboxButton("penguins", "tropic", row0);
....@@ -312,26 +328,56 @@
312328 }
313329 }
314330
315
- public void CallBack(String[] path)
316
- {
317
- for (int i = 0; i < path.length; i++)
318
- {
319
- System.out.print(path[i] + "/");
320
- }
321
-
322
- System.out.println();
323
- }
324
-
325331 public void ChangeSkybox(String skybox)
326332 {
327
- //cameraView.envyoff = false;
328
- group.skyboxname = skybox;
329
- group.skyboxext = "jpg";
330
- 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
+ }
331347
332
- Grafreed.ParseResources("textures", this);
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);
333358 }
334359
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
+
335381 //ObjEditor objEditor;
336382 public void closeUI2()
337383 {
....@@ -373,6 +419,8 @@
373419 {
374420 copy.versionlist = new Object3D[100];
375421 copy.versionindex = -1;
422
+
423
+ Save(true);
376424 }
377425
378426 if(ui)
....@@ -492,32 +540,37 @@
492540 // menu.add("-");
493541 duplicateItem = oe.jTree.popup.add(new JMenuItem("Duplicate"));
494542 duplicateItem.addActionListener(this);
495
- cloneItem = menu.add(new MenuItem("Clone"));
543
+
544
+ cloneItem = oe.jTree.popup.add(new JMenuItem("Clone"));
496545 cloneItem.addActionListener(this);
497
- if (Globals.ADVANCED)
546
+ //if (Globals.ADVANCED)
498547 {
499548 cloneSupportItem = menu.add(new MenuItem("Clone (+supports)"));
500549 cloneSupportItem.addActionListener(this);
501550 }
551
+ oe.jTree.popup.addSeparator();
502552 menu.add("-");
503
- cutItem = menu.add(new MenuItem("Cut"));
553
+ cutItem = oe.jTree.popup.add(new JMenuItem("Cut"));
504554 cutItem.addActionListener(this);
505
- copyItem = menu.add(new MenuItem("Copy"));
555
+ copyItem = oe.jTree.popup.add(new JMenuItem("Copy"));
506556 copyItem.addActionListener(this);
507557 pasteItem = menu.add(new MenuItem("Paste"));
508558 pasteItem.addActionListener(this);
509559
510
- menu.add("-");
511
- 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"));
512563 pasteIntoItem.addActionListener(this);
513
- pasteLinkItem = menu.add(new MenuItem("Paste link"));
564
+ pasteLinkItem = oe.jTree.popup.add(new JMenuItem("Paste link"));
514565 pasteLinkItem.addActionListener(this);
515
- pasteCloneItem = menu.add(new MenuItem("Paste clone"));
566
+ pasteCloneItem = oe.jTree.popup.add(new JMenuItem("Paste clone"));
516567 pasteCloneItem.addActionListener(this);
517
-// pasteExpandItem = menu.add(new MenuItem("Paste expand"));
568
+// CRASH pasteExpandItem = oe.jTree.popup.add(new JMenuItem("Paste expand"));
518569 // pasteExpandItem.addActionListener(this);
519
- menu.add("-");
520
- deleteItem = menu.add(new MenuItem("Delete"));
570
+ //menu.add("-");
571
+ oe.jTree.popup.addSeparator();
572
+
573
+ deleteItem = oe.jTree.popup.add(new JMenuItem("Delete"));
521574 deleteItem.addActionListener(this);
522575
523576 if (Globals.ADVANCED)
....@@ -604,11 +657,9 @@
604657 oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest"));
605658 //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection"));
606659 //cameraMenu.add(switchViewItem = new MenuItem("Reverse View"));
607
- editLeafItem = oe.cameraMenu.add(new MenuItem("Edit Leaf"));
608660 oe.cameraMenu.add("-");
609661 openWindowItem = oe.cameraMenu.add(new MenuItem("Edit copy..."));
610662 openWindowItem.addActionListener(this);
611
- editLeafItem.addActionListener(this);
612663 lookAtItem.addActionListener(this);
613664 //lookFromItem.addActinoListener(this);
614665 //switchViewItem.addActionListener(this);
....@@ -670,7 +721,7 @@
670721 hideItem = menu.add(new MenuItem("Hidden Group"));
671722 hideItem.addActionListener(this);
672723 }
673
- ungroupItem = menu.add(new MenuItem("Ungroup"));
724
+ ungroupItem = oe.jTree.popup.add(new JMenuItem("Ungroup"));
674725 ungroupItem.addActionListener(this);
675726
676727 // menu.add("-");
....@@ -856,6 +907,9 @@
856907 shareGeometriesItem.addActionListener(this);
857908 mergeGeometriesItem = menu.add(new MenuItem("Merge Geometries"));
858909 mergeGeometriesItem.addActionListener(this);
910
+ menu.add("-");
911
+ editLeafItem = menu.add(new MenuItem("Edit leaf..."));
912
+ editLeafItem.addActionListener(this);
859913 if (Globals.ADVANCED)
860914 {
861915 // Pretty much the same as duplicate and clone.
....@@ -872,6 +926,74 @@
872926 buildToolsMenu(menu);
873927 }
874928
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
+ }
875997
876998 void SetupUI2(ObjEditor oe)
877999 {
....@@ -890,11 +1012,6 @@
8901012 //new Exception().printStackTrace();
8911013
8921014 oe.radioPanel = new JPanel(new GridBagLayout());
893
- oe.aConstraints.weightx = 1;
894
- oe.aConstraints.weighty = 0;
895
- oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
896
- oe.aConstraints.gridwidth = 100;
897
- oe.aConstraints.gridheight = 1;
8981015 // oe.toolbarPanel.add(radioPanel); //, oe.aConstraints);
8991016
9001017 oe.buttonGroup = new ButtonGroup();
....@@ -927,10 +1044,49 @@
9271044
9281045 if (Globals.ADVANCED)
9291046 {
930
- oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
931
- maxButton.setToolTipText("Maximize window");
932
- 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);
9331050 }
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
+ //
9341090
9351091 oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
9361092 fullButton.setToolTipText("Full-screen window");
....@@ -975,14 +1131,14 @@
9751131 nextVersionButton.addActionListener(this);
9761132 nextVersionButton.setEnabled(false);
9771133
978
- oe.toolbarPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
979
- liveCB.setToolTipText("Enable animation");
980
- liveCB.addItemListener(this);
981
-
9821134 oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
9831135 oneStepButton.setToolTipText("Animate one step forward");
9841136 oneStepButton.addActionListener(this);
9851137
1138
+ oe.toolbarPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
1139
+ liveCB.setToolTipText("Enable animation");
1140
+ liveCB.addItemListener(this);
1141
+
9861142 oe.toolbarPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
9871143 fastCB.setToolTipText("Fast mode");
9881144 fastCB.addItemListener(this);
....@@ -1009,21 +1165,6 @@
10091165
10101166 //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
10111167
1012
- oe.toolbarPanel.add(twoButton = GetButton("icons/cube.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1013
- twoButton.setToolTipText("Show 3D view only");
1014
- twoButton.addActionListener(this);
1015
- this.fullscreenLayout = twoButton;
1016
-
1017
- oe.toolbarPanel.add(threeButton = GetButton("icons/controlsview.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1018
- threeButton.setToolTipText("Show controls and 3D view");
1019
- threeButton.addActionListener(this);
1020
- oe.toolbarPanel.add(sixButton = GetButton("icons/viewcontrols.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1021
- sixButton.setToolTipText("Show 3D view and controls");
1022
- sixButton.addActionListener(this);
1023
-// oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1024
-// sevenButton.setToolTipText("3-column layout");
1025
-// sevenButton.addActionListener(this);
1026
- //
10271168
10281169 oe.toolbarPanel.add(rootButton = GetButton("icons/openwindow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
10291170 rootButton.setToolTipText("Open selection in new tab");
....@@ -1039,12 +1180,16 @@
10391180
10401181 // INSERT
10411182 row1.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1042
- gridButton.setToolTipText("Create grid");
1183
+ gridButton.setToolTipText("Create ground");
10431184 gridButton.addActionListener(this);
10441185
10451186 row1.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
10461187 boxButton.setToolTipText("Create box");
10471188 boxButton.addActionListener(this);
1189
+
1190
+ row1.add(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1191
+ superButton.setToolTipText("Create superellipsoid");
1192
+ superButton.addActionListener(this);
10481193
10491194 row1.add(sphereButton = GetButton("icons/sphere.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
10501195 sphereButton.setToolTipText("Create sphere");
....@@ -1057,10 +1202,6 @@
10571202 row1.add(torusButton = GetButton("icons/torus.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
10581203 torusButton.setToolTipText("Create torus");
10591204 torusButton.addActionListener(this);
1060
-
1061
- row1.add(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1062
- superButton.setToolTipText("Create superellipsoid");
1063
- superButton.addActionListener(this);
10641205
10651206 if (Globals.ADVANCED)
10661207 {
....@@ -1107,19 +1248,15 @@
11071248
11081249 oe.toolboxPanel.add(row2);
11091250
1110
- // ENVYMAPS
1111
- cGridBag skyboxpane = new cGridBag();
1112
- skyboxpane.preferredHeight = 100;
1251
+ cGridBag textures = new cGridBag();
11131252
1114
- oe.skyboxPanel.add(skyboxpane);
1253
+ CreateTexturePanel(textures);
11151254
1116
- JTabbedPane skyboxpanel = new JTabbedPane();
1117
- skyboxpane.add(skyboxpanel);
1255
+ oe.toolboxPanel.add(textures);
11181256
1119
- AddSkyboxTab0(skyboxpanel);
1120
- AddSkyboxTab1(skyboxpanel);
1121
- AddSkyboxTab2(skyboxpanel);
1122
- AddSkyboxTab3(skyboxpanel);
1257
+ textures.preferredHeight = 100;
1258
+
1259
+ CreateSkyboxPanel(oe.skyboxPanel);
11231260
11241261 // EDIT panel
11251262 editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
....@@ -1131,11 +1268,11 @@
11311268 uneditButton.addActionListener(this);
11321269
11331270 editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
1134
- allParamsButton.setToolTipText("Show all controle");
1271
+ allParamsButton.setToolTipText("Show all controls");
11351272 allParamsButton.addActionListener(this);
11361273
11371274 editCommandsPanel.add(clearPanelButton = GetButton("icons/clear.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1138
- clearPanelButton.setToolTipText("Clear edit panel");
1275
+ clearPanelButton.setToolTipText("Clear all controls");
11391276 clearPanelButton.addActionListener(this);
11401277
11411278 //editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
....@@ -1335,6 +1472,14 @@
13351472
13361473 void EditObject(Object3D obj)
13371474 {
1475
+ assert(obj instanceof Composite);
1476
+
1477
+// if (obj.versionlist == null)
1478
+// {
1479
+// obj.versionlist = new Object3D[100];
1480
+// obj.versionindex = -1;
1481
+// }
1482
+
13381483 cRadio radioButton = new cRadio(obj.name);
13391484
13401485 // June 2019. Patch to avoid bug with transparency.
....@@ -1725,7 +1870,12 @@
17251870 TreePath path;
17261871
17271872 public TransferableTreePath(TreePath tp) {
1728
- 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);
17291879 }
17301880
17311881 public synchronized DataFlavor[] getTransferDataFlavors() {
....@@ -2015,7 +2165,11 @@
20152165 shadow.material = new cMaterial(obj.material);
20162166 shadow.material.diffuse = 0.0001f;
20172167 shadow.material.specular = 0.0001f;
2018
- //shadow.projectedVertices[1].x = 300;
2168
+ shadow.material.opacity = 0.75f;
2169
+
2170
+ AllocProjectedVertices(shadow);
2171
+
2172
+ shadow.projectedVertices[1].x = 300;
20192173
20202174 makeSomething(shadow);
20212175 }
....@@ -2536,27 +2690,35 @@
25362690 } else
25372691 if (source == loopItem || source == loopButton)
25382692 {
2693
+ if (!group.selection.isEmpty())
2694
+ {
25392695 Composite csg = new GroupLeaf();
25402696 csg.count = 5;
2541
- group(csg);
25422697 Composite child = new cGroup("Branch");
25432698 csg.addChild(child);
25442699 child.addChild(csg);
2700
+ group(csg);
2701
+ }
25452702 } else
25462703 if (source == doubleItem)
25472704 {
2705
+ if (!group.selection.isEmpty())
2706
+ {
25482707 Composite csg = new GroupLeaf("Fork");
25492708 csg.count = 5;
2550
- group(csg);
25512709 Composite child = new cGroup("Branch A");
25522710 csg.addChild(child);
25532711 child.addChild(csg);
25542712 child = new cGroup("Branch B");
25552713 csg.addChild(child);
25562714 child.addChild(csg);
2715
+ group(csg);
2716
+ }
25572717 } else
25582718 if (source == tripleItem)
25592719 {
2720
+ if (!group.selection.isEmpty())
2721
+ {
25602722 Composite csg = new GroupLeaf("Trident");
25612723 csg.count = 4;
25622724 group(csg);
....@@ -2569,6 +2731,7 @@
25692731 child = new cGroup();
25702732 csg.addChild(child);
25712733 child.addChild(csg);
2734
+ }
25722735 } else
25732736 if (source == computeAOItem)
25742737 {
....@@ -2618,6 +2781,18 @@
26182781 if (source == fullButton)
26192782 {
26202783 ToggleFullScreen();
2784
+ } else
2785
+ if (source == collapseButton)
2786
+ {
2787
+ this.expandedLayout = radio.layout;
2788
+ CollapseToolbar();
2789
+ } else
2790
+ if (source == maximize3DButton)
2791
+ {
2792
+ this.expandedLayout = radio.layout;
2793
+ radio.layout = twoButton;
2794
+ Show3DView();
2795
+ CollapseToolbar();
26212796 } else
26222797 if (source == previousVersionButton)
26232798 {
....@@ -3192,22 +3367,34 @@
31923367 } else
31933368 if (source == ungroupItem || source == ungroupButton)
31943369 {
3195
- boolean hasRoot = false;
3370
+ boolean canUngroup = true;
31963371
31973372 for (int i=0; i<group.selection.size(); i++)
31983373 {
3199
- if (group.selection.get(i) == group)
3374
+ Object3D selectedItem = group.selection.get(i);
3375
+
3376
+ if (selectedItem.Size() == 0)
32003377 {
3201
- hasRoot = true;
3378
+ // Cannot ungroup leaves
3379
+ canUngroup = false;
3380
+ break;
3381
+ }
3382
+
3383
+ if (selectedItem == group)
3384
+ {
3385
+ // Cannot ungroup root
3386
+ canUngroup = false;
32023387 break;
32033388 }
32043389 }
32053390
3206
- if (!hasRoot)
3391
+ if (canUngroup)
32073392 {
32083393 for (int i=0; i<group.selection.size(); i++)
32093394 {
3210
- Ungroup(group.selection.get(i));
3395
+ Object3D selectedItem = group.selection.get(i);
3396
+
3397
+ Ungroup(selectedItem);
32113398 }
32123399
32133400 ClearSelection(false);
....@@ -3570,38 +3757,7 @@
35703757 if (CameraPane.FULLSCREEN)
35713758 fullscreenLayout = radio.layout;
35723759
3573
- // bug
3574
- //gridPanel.setDividerLocation(1.0);
3575
- //bigPanel.setDividerLocation(0.0);
3576
-// bigThree.remove(scenePanel);
3577
-// bigThree.remove(centralPanel);
3578
-// bigThree.remove(XYZPanel);
3579
-// aWindowConstraints.gridx = 0;
3580
-// aWindowConstraints.gridy = 0;
3581
-// aWindowConstraints.gridwidth = 1;
3582
-// // aConstraints.gridheight = 3;
3583
-// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3584
-// aWindowConstraints.weightx = 0;
3585
-// aWindowConstraints.weighty = 1;
3586
-// //bigThree.add(jtp, aWindowConstraints);
3587
-// aWindowConstraints.weightx = 1;
3588
-// aWindowConstraints.gridwidth = 3;
3589
-// // aConstraints.gridheight = 3;
3590
-// aWindowConstraints.gridx = 1;
3591
-// aWindowConstraints.fill = GridBagConstraints.BOTH;
3592
-// bigThree.add(centralPanel, aWindowConstraints);
3593
-// aWindowConstraints.weightx = 0;
3594
-// aWindowConstraints.gridx = 4;
3595
-// aWindowConstraints.gridwidth = 1;
3596
-// // aConstraints.gridheight = 3;
3597
-// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3598
-// //bigThree.add(XYZPanel, aWindowConstraints);
3599
-// scenePanel.setVisible(false);
3600
-// centralPanel.setVisible(true);
3601
-// XYZPanel.setVisible(false);
3602
- bigThree.ClearUI();
3603
- bigThree.add(centralPanel);
3604
- bigThree.FlushUI();
3760
+ Show3DView();
36053761
36063762 cameraView.requestFocusInWindow();
36073763
....@@ -3787,6 +3943,7 @@
37873943 } else
37883944 if (source == rootButton)
37893945 {
3946
+ Replace();
37903947 Object3D obj;
37913948 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
37923949 {
....@@ -3923,8 +4080,6 @@
39234080
39244081 copy = group;
39254082
3926
- SetUndoStates();
3927
-
39284083 //Globals.theRenderer.object = group;
39294084 if(!useclient)
39304085 {
....@@ -3952,6 +4107,18 @@
39524107 */
39534108 radio.layout.doClick();
39544109
4110
+ assert(copy instanceof Composite);
4111
+
4112
+ if (copy.versionlist == null)
4113
+ {
4114
+ copy.versionlist = new Object3D[100];
4115
+ copy.versionindex = -1;
4116
+
4117
+ Save(true);
4118
+ }
4119
+
4120
+ SetVersionStates();
4121
+
39554122 ClearUnpinned();
39564123
39574124 //Grafreed.Assert(group != null);
....@@ -5186,6 +5353,20 @@
51865353 flashSelectionButton.setEnabled(enabled);
51875354
51885355 clearPanelButton.setEnabled(!listUI.isEmpty());
5356
+
5357
+ boolean allComposites = true;
5358
+
5359
+ if (group.selection != null)
5360
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
5361
+ {
5362
+ if (!(e.nextElement() instanceof Composite))
5363
+ {
5364
+ allComposites = false;
5365
+ break;
5366
+ }
5367
+ }
5368
+
5369
+ rootButton.setEnabled(allComposites);
51895370 }
51905371
51915372 void refreshContents(boolean cp)
....@@ -5200,7 +5381,7 @@
52005381 Object3D child = (Object3D) group.selection.get(i);
52015382
52025383 objEditor.AddInfo(child, this, true);
5203
- System.err.println("info : " + child.GetPath());
5384
+// System.err.println("info : " + child.GetPath());
52045385 }
52055386
52065387 objEditor.SetText(); // jan 2014
....@@ -6083,11 +6264,11 @@
60836264 private MenuItem lookAtItem;
60846265 private MenuItem lookFromItem;
60856266 private MenuItem switchViewItem;
6086
- private MenuItem cutItem;
6267
+ private JMenuItem cutItem;
60876268 private MenuItem undoItem;
60886269 private MenuItem redoItem;
60896270 private JMenuItem duplicateItem;
6090
- private MenuItem cloneItem;
6271
+ private JMenuItem cloneItem;
60916272 private MenuItem cloneSupportItem;
60926273 private MenuItem overwriteGeoItem;
60936274 private MenuItem overwriteMatItem;
....@@ -6108,13 +6289,13 @@
61086289 private MenuItem cloneGeometriesItem;
61096290 private MenuItem shareGeometriesItem;
61106291 private MenuItem mergeGeometriesItem;
6111
- private MenuItem copyItem;
6292
+ private JMenuItem copyItem;
61126293 private MenuItem pasteItem;
6113
- private MenuItem pasteIntoItem;
6114
- private MenuItem pasteLinkItem;
6115
- private MenuItem pasteCloneItem;
6116
- private MenuItem pasteExpandItem;
6117
- private MenuItem deleteItem;
6294
+ private JMenuItem pasteIntoItem;
6295
+ private JMenuItem pasteLinkItem;
6296
+ private JMenuItem pasteCloneItem;
6297
+ private JMenuItem pasteExpandItem;
6298
+ private JMenuItem deleteItem;
61186299 private MenuItem clearAllItem;
61196300 private MenuItem genUVItem;
61206301 private MenuItem genNormalsMESHItem;
....@@ -6182,7 +6363,7 @@
61826363 private MenuItem switchTransfoItem;
61836364 private MenuItem morphItem;
61846365 private MenuItem linkerItem;
6185
- private MenuItem ungroupItem;
6366
+ private JMenuItem ungroupItem;
61866367 private MenuItem editItem;
61876368 private MenuItem openWindowItem;
61886369 private MenuItem editLeafItem;