Normand Briere
2019-08-17 ecc1309a04b527c62ffe97e814daf050dbd025cd
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
....@@ -42,12 +42,12 @@
4242 });
4343 }
4444
45
- public void AddTextureButton(String f, final String t, cGridBag row)
45
+ public void AddTextureButton(String f, String c, final String t, int count, cGridBag row)
4646 {
4747 cButton textureButton;
48
- final String path = "textures/" + f + "/"; // + t;
48
+ final String path = "textures/" + f + "/" + c + "/"; // + t;
4949 row.add(textureButton = GetButton(path + "icons/" + t, !Grafreed.NIMBUSLAF));
50
- textureButton.setToolTipText(f + "s");
50
+ textureButton.setToolTipText(c + count);
5151 textureButton.addActionListener(new ActionListener()
5252 {
5353 @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)
....@@ -350,7 +359,23 @@
350359
351360 public void ChangeTexture(String texture)
352361 {
353
- cameraView.repaint();
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();
354379 }
355380
356381 //ObjEditor objEditor;
....@@ -390,10 +415,14 @@
390415 this.copy = this.group = group;
391416 //selectees = this.group.selectees;
392417
418
+ assert(false);
419
+
393420 if (copy.versionlist == null)
394421 {
395422 copy.versionlist = new Object3D[100];
396423 copy.versionindex = -1;
424
+
425
+ //Save(true);
397426 }
398427
399428 if(ui)
....@@ -422,7 +451,7 @@
422451 copy.versionlist = new Object3D[100];
423452 copy.versionindex = -1;
424453
425
- Save(true);
454
+ //Save(true);
426455 }
427456 }
428457
....@@ -513,33 +542,35 @@
513542 // menu.add("-");
514543 duplicateItem = oe.jTree.popup.add(new JMenuItem("Duplicate"));
515544 duplicateItem.addActionListener(this);
516
- cloneItem = menu.add(new MenuItem("Clone"));
545
+
546
+ cloneItem = oe.jTree.popup.add(new JMenuItem("Clone"));
517547 cloneItem.addActionListener(this);
518
- if (Globals.ADVANCED)
548
+ //if (Globals.ADVANCED)
519549 {
520550 cloneSupportItem = menu.add(new MenuItem("Clone (+supports)"));
521551 cloneSupportItem.addActionListener(this);
522552 }
553
+ oe.jTree.popup.addSeparator();
523554 menu.add("-");
524
- cutItem = menu.add(new MenuItem("Cut"));
555
+ cutItem = oe.jTree.popup.add(new JMenuItem("Cut"));
525556 cutItem.addActionListener(this);
526
- copyItem = menu.add(new MenuItem("Copy"));
557
+ copyItem = oe.jTree.popup.add(new JMenuItem("Copy"));
527558 copyItem.addActionListener(this);
528559 pasteItem = menu.add(new MenuItem("Paste"));
529560 pasteItem.addActionListener(this);
530561
531
- menu.add("-");
532
- pasteIntoItem = menu.add(new MenuItem("Paste into"));
562
+ oe.jTree.popup.addSeparator();
563
+ //menu.add("-");
564
+ pasteIntoItem = oe.jTree.popup.add(new JMenuItem("Paste into"));
533565 pasteIntoItem.addActionListener(this);
534
- pasteLinkItem = menu.add(new MenuItem("Paste link"));
566
+ pasteLinkItem = oe.jTree.popup.add(new JMenuItem("Paste link"));
535567 pasteLinkItem.addActionListener(this);
536
- pasteCloneItem = menu.add(new MenuItem("Paste clone"));
568
+ pasteCloneItem = oe.jTree.popup.add(new JMenuItem("Paste clone"));
537569 pasteCloneItem.addActionListener(this);
538
-// pasteExpandItem = menu.add(new MenuItem("Paste expand"));
570
+// CRASH pasteExpandItem = oe.jTree.popup.add(new JMenuItem("Paste expand"));
539571 // pasteExpandItem.addActionListener(this);
540
- menu.add("-");
541
- deleteItem = menu.add(new MenuItem("Delete"));
542
- deleteItem.addActionListener(this);
572
+ //menu.add("-");
573
+ oe.jTree.popup.addSeparator();
543574
544575 if (Globals.ADVANCED)
545576 {
....@@ -625,11 +656,9 @@
625656 oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest"));
626657 //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection"));
627658 //cameraMenu.add(switchViewItem = new MenuItem("Reverse View"));
628
- editLeafItem = oe.cameraMenu.add(new MenuItem("Edit Leaf"));
629659 oe.cameraMenu.add("-");
630660 openWindowItem = oe.cameraMenu.add(new MenuItem("Edit copy..."));
631661 openWindowItem.addActionListener(this);
632
- editLeafItem.addActionListener(this);
633662 lookAtItem.addActionListener(this);
634663 //lookFromItem.addActinoListener(this);
635664 //switchViewItem.addActionListener(this);
....@@ -676,9 +705,8 @@
676705 setMasterItem.addActionListener(this);
677706 }
678707
679
- oe.menuBar.add(menu = new Menu("Group"));
680
-// grabItem = menu.add(new MenuItem("Grab"));
681
-// grabItem.addActionListener(this);
708
+ oe.menuBar.add(menu = new Menu("Order"));
709
+
682710 backItem = menu.add(new MenuItem("Back"));
683711 backItem.addActionListener(this);
684712 frontItem = menu.add(new MenuItem("Front"));
....@@ -686,13 +714,21 @@
686714 // compositeItem = menu.add(new MenuItem("Composite"));
687715 // compositeItem.addActionListener(this);
688716
717
+ grabItem = oe.jTree.popup.add(new JMenuItem("Group"));
718
+ grabItem.addActionListener(this);
719
+
689720 if (Globals.ADVANCED)
690721 {
691722 hideItem = menu.add(new MenuItem("Hidden Group"));
692723 hideItem.addActionListener(this);
693724 }
694
- ungroupItem = menu.add(new MenuItem("Ungroup"));
725
+ ungroupItem = oe.jTree.popup.add(new JMenuItem("Ungroup"));
695726 ungroupItem.addActionListener(this);
727
+
728
+ oe.jTree.popup.addSeparator();
729
+
730
+ deleteItem = oe.jTree.popup.add(new JMenuItem("Delete"));
731
+ deleteItem.addActionListener(this);
696732
697733 // menu.add("-");
698734 //
....@@ -877,6 +913,9 @@
877913 shareGeometriesItem.addActionListener(this);
878914 mergeGeometriesItem = menu.add(new MenuItem("Merge Geometries"));
879915 mergeGeometriesItem.addActionListener(this);
916
+ menu.add("-");
917
+ editLeafItem = menu.add(new MenuItem("Edit leaf..."));
918
+ editLeafItem.addActionListener(this);
880919 if (Globals.ADVANCED)
881920 {
882921 // Pretty much the same as duplicate and clone.
....@@ -895,40 +934,47 @@
895934
896935 JTabbedPane resourcecontainer;
897936 cGridBag currenttab;
898
- boolean added; // patch for jar
937
+ //boolean added; // patch for jar
899938
900939 int tabcount = 0;
901940 int colcount = 0;
902941 int rowcount = 0;
942
+ int texturecount = 0;
903943
904944 int columns = 5;
905945 int rows = 7;
906946
907947 public void ResourceCallBack(String[] path)
908948 {
909
- for (int i = 0; i < path.length; i++)
910
- System.out.print(path[i] + "/");
911
- System.out.println();
912
- if (rowcount == 0)
949
+// for (int i = 0; i < path.length; i++)
950
+// System.out.print(path[i] + "/");
951
+// System.out.println();
952
+
953
+ if (//rowcount == 0 ||
954
+ path.length == 1 && !path[0].equals("") && !path[0].equals(".DS_Store"))
913955 {
914956 currenttab = new cGridBag();
915
- added = false;
916
- String tabname = String.valueOf((char)('A'+tabcount));
957
+ String tabname = path[0]; // String.valueOf((char)('A'+tabcount));
917958 currenttab.setName(tabname);
959
+ //added = false;
960
+ resourcecontainer.add(currenttab);
961
+ resourcecontainer.setToolTipTextAt(tabcount++, "Texture Group " + tabname);
918962 rowcount = 1;
963
+ colcount = 0;
964
+ texturecount = 0;
919965 }
920966
921
- if (path.length > 1 && path[1].toLowerCase().endsWith(".jpg"))
967
+ if (path.length > 2 && path[2].toLowerCase().endsWith(".jpg"))
922968 {
923
- if (!added)
969
+ //if (!added)
924970 {
925
- added = true;
926
- resourcecontainer.add(currenttab);
927
- String tabname = String.valueOf((char)('A'+tabcount));
928
- resourcecontainer.setToolTipTextAt(tabcount++, "Texture Group " + tabname);
971
+ //added = true;
972
+ String tabname = path[0]; // String.valueOf((char)('A'+tabcount));
973
+ currenttab = (cGridBag)resourcecontainer.getComponentAt(resourcecontainer.indexOfTab(tabname));
929974 }
930975
931
- AddTextureButton(path[0], path[1], currenttab);
976
+ AddTextureButton(path[0], path[1], path[2], texturecount++, currenttab);
977
+
932978 if (++colcount >= columns)
933979 {
934980 colcount = 0;
....@@ -949,7 +995,7 @@
949995
950996 void CreateTexturePanel(cGridBag container)
951997 {
952
- resourcecontainer = new JTabbedPane();
998
+ resourcecontainer = new JTabbedPane(JTabbedPane.LEFT);
953999 container.add(resourcecontainer);
9541000
9551001 Grafreed.ParseResources("textures", this);
....@@ -972,11 +1018,6 @@
9721018 //new Exception().printStackTrace();
9731019
9741020 oe.radioPanel = new JPanel(new GridBagLayout());
975
- oe.aConstraints.weightx = 1;
976
- oe.aConstraints.weighty = 0;
977
- oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
978
- oe.aConstraints.gridwidth = 100;
979
- oe.aConstraints.gridheight = 1;
9801021 // oe.toolbarPanel.add(radioPanel); //, oe.aConstraints);
9811022
9821023 oe.buttonGroup = new ButtonGroup();
....@@ -1009,10 +1050,49 @@
10091050
10101051 if (Globals.ADVANCED)
10111052 {
1012
- oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1013
- maxButton.setToolTipText("Maximize window");
1014
- maxButton.addActionListener(this);
1053
+// oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1054
+// maxButton.setToolTipText("Maximize window");
1055
+// maxButton.addActionListener(this);
10151056 }
1057
+
1058
+ cButton gcButton;
1059
+
1060
+// oe.toolbarPanel.add(gcButton = GetButton("icons/trash.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1061
+// gcButton.setToolTipText("Garbage collect");
1062
+// gcButton.addActionListener(new ActionListener()
1063
+// {
1064
+// public void actionPerformed(ActionEvent e)
1065
+// {
1066
+// System.gc();
1067
+// }
1068
+// });
1069
+
1070
+ oe.toolbarPanel.add(collapseButton = GetButton("icons/collapse.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1071
+ collapseButton.setToolTipText("Collapse toolbar");
1072
+ collapseButton.addActionListener(this);
1073
+
1074
+ oe.toolbarPanel.add(maximize3DButton = GetButton("icons/empty.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1075
+ maximize3DButton.setToolTipText("Maximize 3D view");
1076
+ maximize3DButton.addActionListener(this);
1077
+
1078
+ oe.toolbarPanel.add(twoButton = GetButton("icons/cube.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1079
+ twoButton.setToolTipText("Show 3D view only");
1080
+ twoButton.addActionListener(this);
1081
+ this.fullscreenLayout = twoButton;
1082
+
1083
+ oe.toolbarPanel.add(threeButton = GetButton("icons/controlsview.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1084
+ threeButton.setToolTipText("Show controls and 3D view");
1085
+ threeButton.addActionListener(this);
1086
+ if (Globals.ADVANCED)
1087
+ {
1088
+ oe.toolbarPanel.add(sixButton = GetButton("icons/viewcontrols.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1089
+ sixButton.setToolTipText("Show 3D view and controls");
1090
+ sixButton.addActionListener(this);
1091
+ }
1092
+// oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1093
+// sevenButton.setToolTipText("3-column layout");
1094
+// sevenButton.addActionListener(this);
1095
+ //
10161096
10171097 oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
10181098 fullButton.setToolTipText("Full-screen window");
....@@ -1033,6 +1113,7 @@
10331113 copyOptionsPanel.add(deleteVersionButton = GetButton("icons/trash.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
10341114 deleteVersionButton.setToolTipText("Delete current version");
10351115 deleteVersionButton.addActionListener(this);
1116
+ deleteVersionButton.setEnabled(false);
10361117
10371118 copyOptionsPanel.add(previousVersionButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
10381119 previousVersionButton.setToolTipText("Previous version");
....@@ -1043,12 +1124,12 @@
10431124 updown.add(restoreButton = GetButton("icons/restore.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
10441125 restoreButton.setToolTipText("Undo (restore current version)");
10451126 restoreButton.addActionListener(this);
1046
- //restoreButton.setEnabled(false);
1127
+ restoreButton.setEnabled(false);
10471128
10481129 updown.add(replaceButton = GetButton("icons/replace.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
10491130 replaceButton.setToolTipText("Save (replace current version)");
10501131 replaceButton.addActionListener(this);
1051
- //replaceButton.setEnabled(false);
1132
+ replaceButton.setEnabled(false);
10521133
10531134 copyOptionsPanel.add(updown);
10541135
....@@ -1057,14 +1138,14 @@
10571138 nextVersionButton.addActionListener(this);
10581139 nextVersionButton.setEnabled(false);
10591140
1060
- oe.toolbarPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
1061
- liveCB.setToolTipText("Enable animation");
1062
- liveCB.addItemListener(this);
1063
-
10641141 oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
10651142 oneStepButton.setToolTipText("Animate one step forward");
10661143 oneStepButton.addActionListener(this);
10671144
1145
+ oe.toolbarPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
1146
+ liveCB.setToolTipText("Enable animation");
1147
+ liveCB.addItemListener(this);
1148
+
10681149 oe.toolbarPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
10691150 fastCB.setToolTipText("Fast mode");
10701151 fastCB.addItemListener(this);
....@@ -1091,21 +1172,6 @@
10911172
10921173 //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
10931174
1094
- oe.toolbarPanel.add(twoButton = GetButton("icons/cube.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1095
- twoButton.setToolTipText("Show 3D view only");
1096
- twoButton.addActionListener(this);
1097
- this.fullscreenLayout = twoButton;
1098
-
1099
- oe.toolbarPanel.add(threeButton = GetButton("icons/controlsview.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1100
- threeButton.setToolTipText("Show controls and 3D view");
1101
- threeButton.addActionListener(this);
1102
- oe.toolbarPanel.add(sixButton = GetButton("icons/viewcontrols.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1103
- sixButton.setToolTipText("Show 3D view and controls");
1104
- sixButton.addActionListener(this);
1105
-// oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1106
-// sevenButton.setToolTipText("3-column layout");
1107
-// sevenButton.addActionListener(this);
1108
- //
11091175
11101176 oe.toolbarPanel.add(rootButton = GetButton("icons/openwindow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
11111177 rootButton.setToolTipText("Open selection in new tab");
....@@ -1121,12 +1187,16 @@
11211187
11221188 // INSERT
11231189 row1.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1124
- gridButton.setToolTipText("Create grid");
1190
+ gridButton.setToolTipText("Create ground");
11251191 gridButton.addActionListener(this);
11261192
11271193 row1.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
11281194 boxButton.setToolTipText("Create box");
11291195 boxButton.addActionListener(this);
1196
+
1197
+ row1.add(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1198
+ superButton.setToolTipText("Create superellipsoid");
1199
+ superButton.addActionListener(this);
11301200
11311201 row1.add(sphereButton = GetButton("icons/sphere.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
11321202 sphereButton.setToolTipText("Create sphere");
....@@ -1139,10 +1209,6 @@
11391209 row1.add(torusButton = GetButton("icons/torus.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
11401210 torusButton.setToolTipText("Create torus");
11411211 torusButton.addActionListener(this);
1142
-
1143
- row1.add(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1144
- superButton.setToolTipText("Create superellipsoid");
1145
- superButton.addActionListener(this);
11461212
11471213 if (Globals.ADVANCED)
11481214 {
....@@ -1192,6 +1258,8 @@
11921258 cGridBag textures = new cGridBag();
11931259
11941260 CreateTexturePanel(textures);
1261
+
1262
+ resourcecontainer.setSelectedIndex((int)(Math.random() * resourcecontainer.getTabCount()));
11951263
11961264 oe.toolboxPanel.add(textures);
11971265
....@@ -1413,6 +1481,14 @@
14131481
14141482 void EditObject(Object3D obj)
14151483 {
1484
+ assert(obj instanceof Composite);
1485
+
1486
+// if (obj.versionlist == null)
1487
+// {
1488
+// obj.versionlist = new Object3D[100];
1489
+// obj.versionindex = -1;
1490
+// }
1491
+
14161492 cRadio radioButton = new cRadio(obj.name);
14171493
14181494 // June 2019. Patch to avoid bug with transparency.
....@@ -1437,6 +1513,7 @@
14371513
14381514 oe.SetupViews();
14391515
1516
+ if (Globals.DEBUG)
14401517 System.out.println("SetupViews");
14411518 DragSource.getDefaultDragSource().createDefaultDragGestureRecognizer(
14421519 oe.cameraView, DnDConstants.ACTION_COPY_OR_MOVE, this); // ACTION_LINK ??
....@@ -1803,7 +1880,12 @@
18031880 TreePath path;
18041881
18051882 public TransferableTreePath(TreePath tp) {
1806
- path = tp;
1883
+ Object[] objs = new Object[tp.getPathCount()];
1884
+ for (int i=0; i<objs.length; i++)
1885
+ {
1886
+ objs[i] = ((Object3D)tp.getPathComponent(i)).GetUUID();
1887
+ }
1888
+ path = new TreePath(objs);
18071889 }
18081890
18091891 public synchronized DataFlavor[] getTransferDataFlavors() {
....@@ -2093,7 +2175,11 @@
20932175 shadow.material = new cMaterial(obj.material);
20942176 shadow.material.diffuse = 0.0001f;
20952177 shadow.material.specular = 0.0001f;
2096
- //shadow.projectedVertices[1].x = 300;
2178
+ shadow.material.opacity = 0.75f;
2179
+
2180
+ AllocProjectedVertices(shadow);
2181
+
2182
+ shadow.projectedVertices[1].x = 300;
20972183
20982184 makeSomething(shadow);
20992185 }
....@@ -2614,27 +2700,35 @@
26142700 } else
26152701 if (source == loopItem || source == loopButton)
26162702 {
2703
+ if (!group.selection.isEmpty())
2704
+ {
26172705 Composite csg = new GroupLeaf();
26182706 csg.count = 5;
2619
- group(csg);
26202707 Composite child = new cGroup("Branch");
26212708 csg.addChild(child);
26222709 child.addChild(csg);
2710
+ group(csg);
2711
+ }
26232712 } else
26242713 if (source == doubleItem)
26252714 {
2715
+ if (!group.selection.isEmpty())
2716
+ {
26262717 Composite csg = new GroupLeaf("Fork");
26272718 csg.count = 5;
2628
- group(csg);
26292719 Composite child = new cGroup("Branch A");
26302720 csg.addChild(child);
26312721 child.addChild(csg);
26322722 child = new cGroup("Branch B");
26332723 csg.addChild(child);
26342724 child.addChild(csg);
2725
+ group(csg);
2726
+ }
26352727 } else
26362728 if (source == tripleItem)
26372729 {
2730
+ if (!group.selection.isEmpty())
2731
+ {
26382732 Composite csg = new GroupLeaf("Trident");
26392733 csg.count = 4;
26402734 group(csg);
....@@ -2647,6 +2741,7 @@
26472741 child = new cGroup();
26482742 csg.addChild(child);
26492743 child.addChild(csg);
2744
+ }
26502745 } else
26512746 if (source == computeAOItem)
26522747 {
....@@ -2696,6 +2791,18 @@
26962791 if (source == fullButton)
26972792 {
26982793 ToggleFullScreen();
2794
+ } else
2795
+ if (source == collapseButton)
2796
+ {
2797
+ this.expandedLayout = radio.layout;
2798
+ CollapseToolbar();
2799
+ } else
2800
+ if (source == maximize3DButton)
2801
+ {
2802
+ this.expandedLayout = radio.layout;
2803
+ radio.layout = twoButton;
2804
+ Show3DView();
2805
+ CollapseToolbar();
26992806 } else
27002807 if (source == previousVersionButton)
27012808 {
....@@ -3270,22 +3377,34 @@
32703377 } else
32713378 if (source == ungroupItem || source == ungroupButton)
32723379 {
3273
- boolean hasRoot = false;
3380
+ boolean canUngroup = true;
32743381
32753382 for (int i=0; i<group.selection.size(); i++)
32763383 {
3277
- if (group.selection.get(i) == group)
3384
+ Object3D selectedItem = group.selection.get(i);
3385
+
3386
+ if (selectedItem.Size() == 0)
32783387 {
3279
- hasRoot = true;
3388
+ // Cannot ungroup leaves
3389
+ canUngroup = false;
3390
+ break;
3391
+ }
3392
+
3393
+ if (selectedItem == group)
3394
+ {
3395
+ // Cannot ungroup root
3396
+ canUngroup = false;
32803397 break;
32813398 }
32823399 }
32833400
3284
- if (!hasRoot)
3401
+ if (canUngroup)
32853402 {
32863403 for (int i=0; i<group.selection.size(); i++)
32873404 {
3288
- Ungroup(group.selection.get(i));
3405
+ Object3D selectedItem = group.selection.get(i);
3406
+
3407
+ Ungroup(selectedItem);
32893408 }
32903409
32913410 ClearSelection(false);
....@@ -3648,38 +3767,7 @@
36483767 if (CameraPane.FULLSCREEN)
36493768 fullscreenLayout = radio.layout;
36503769
3651
- // bug
3652
- //gridPanel.setDividerLocation(1.0);
3653
- //bigPanel.setDividerLocation(0.0);
3654
-// bigThree.remove(scenePanel);
3655
-// bigThree.remove(centralPanel);
3656
-// bigThree.remove(XYZPanel);
3657
-// aWindowConstraints.gridx = 0;
3658
-// aWindowConstraints.gridy = 0;
3659
-// aWindowConstraints.gridwidth = 1;
3660
-// // aConstraints.gridheight = 3;
3661
-// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3662
-// aWindowConstraints.weightx = 0;
3663
-// aWindowConstraints.weighty = 1;
3664
-// //bigThree.add(jtp, aWindowConstraints);
3665
-// aWindowConstraints.weightx = 1;
3666
-// aWindowConstraints.gridwidth = 3;
3667
-// // aConstraints.gridheight = 3;
3668
-// aWindowConstraints.gridx = 1;
3669
-// aWindowConstraints.fill = GridBagConstraints.BOTH;
3670
-// bigThree.add(centralPanel, aWindowConstraints);
3671
-// aWindowConstraints.weightx = 0;
3672
-// aWindowConstraints.gridx = 4;
3673
-// aWindowConstraints.gridwidth = 1;
3674
-// // aConstraints.gridheight = 3;
3675
-// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3676
-// //bigThree.add(XYZPanel, aWindowConstraints);
3677
-// scenePanel.setVisible(false);
3678
-// centralPanel.setVisible(true);
3679
-// XYZPanel.setVisible(false);
3680
- bigThree.ClearUI();
3681
- bigThree.add(centralPanel);
3682
- bigThree.FlushUI();
3770
+ Show3DView();
36833771
36843772 cameraView.requestFocusInWindow();
36853773
....@@ -3865,6 +3953,7 @@
38653953 } else
38663954 if (source == rootButton)
38673955 {
3956
+ Replace();
38683957 Object3D obj;
38693958 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
38703959 {
....@@ -4001,8 +4090,6 @@
40014090
40024091 copy = group;
40034092
4004
- SetUndoStates();
4005
-
40064093 //Globals.theRenderer.object = group;
40074094 if(!useclient)
40084095 {
....@@ -4030,6 +4117,21 @@
40304117 */
40314118 radio.layout.doClick();
40324119
4120
+ assert(copy instanceof Composite);
4121
+
4122
+ if (copy.versionlist == null)
4123
+ {
4124
+ copy.versionlist = new Object3D[100];
4125
+ copy.versionindex = -1;
4126
+
4127
+ // Cannot work with loops
4128
+ // To fix this issue, first mark all nodes above the root,
4129
+ // and check if any of these nodes are reachable below the root.
4130
+ //Save(true);
4131
+ }
4132
+
4133
+ SetVersionStates();
4134
+
40334135 ClearUnpinned();
40344136
40354137 //Grafreed.Assert(group != null);
....@@ -5264,6 +5366,21 @@
52645366 flashSelectionButton.setEnabled(enabled);
52655367
52665368 clearPanelButton.setEnabled(!listUI.isEmpty());
5369
+
5370
+ boolean allComposites = true;
5371
+
5372
+ if (group.selection != null)
5373
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
5374
+ {
5375
+ Object next = e.nextElement();
5376
+ if (!(next instanceof Composite)) // || (next instanceof GroupLeaf))
5377
+ {
5378
+ allComposites = false;
5379
+ break;
5380
+ }
5381
+ }
5382
+
5383
+ rootButton.setEnabled(allComposites);
52675384 }
52685385
52695386 void refreshContents(boolean cp)
....@@ -5278,7 +5395,7 @@
52785395 Object3D child = (Object3D) group.selection.get(i);
52795396
52805397 objEditor.AddInfo(child, this, true);
5281
- System.err.println("info : " + child.GetPath());
5398
+// System.err.println("info : " + child.GetPath());
52825399 }
52835400
52845401 objEditor.SetText(); // jan 2014
....@@ -6161,11 +6278,11 @@
61616278 private MenuItem lookAtItem;
61626279 private MenuItem lookFromItem;
61636280 private MenuItem switchViewItem;
6164
- private MenuItem cutItem;
6281
+ private JMenuItem cutItem;
61656282 private MenuItem undoItem;
61666283 private MenuItem redoItem;
61676284 private JMenuItem duplicateItem;
6168
- private MenuItem cloneItem;
6285
+ private JMenuItem cloneItem;
61696286 private MenuItem cloneSupportItem;
61706287 private MenuItem overwriteGeoItem;
61716288 private MenuItem overwriteMatItem;
....@@ -6186,13 +6303,13 @@
61866303 private MenuItem cloneGeometriesItem;
61876304 private MenuItem shareGeometriesItem;
61886305 private MenuItem mergeGeometriesItem;
6189
- private MenuItem copyItem;
6306
+ private JMenuItem copyItem;
61906307 private MenuItem pasteItem;
6191
- private MenuItem pasteIntoItem;
6192
- private MenuItem pasteLinkItem;
6193
- private MenuItem pasteCloneItem;
6194
- private MenuItem pasteExpandItem;
6195
- private MenuItem deleteItem;
6308
+ private JMenuItem pasteIntoItem;
6309
+ private JMenuItem pasteLinkItem;
6310
+ private JMenuItem pasteCloneItem;
6311
+ private JMenuItem pasteExpandItem;
6312
+ private JMenuItem deleteItem;
61966313 private MenuItem clearAllItem;
61976314 private MenuItem genUVItem;
61986315 private MenuItem genNormalsMESHItem;
....@@ -6247,7 +6364,7 @@
62476364 private MenuItem transformGeometryItem;
62486365 private MenuItem transformChildrenItem;
62496366 private MenuItem hideItem;
6250
- private MenuItem grabItem;
6367
+ private JMenuItem grabItem;
62516368 private MenuItem backItem;
62526369 private MenuItem frontItem;
62536370 private MenuItem cameraItem;
....@@ -6260,7 +6377,7 @@
62606377 private MenuItem switchTransfoItem;
62616378 private MenuItem morphItem;
62626379 private MenuItem linkerItem;
6263
- private MenuItem ungroupItem;
6380
+ private JMenuItem ungroupItem;
62646381 private MenuItem editItem;
62656382 private MenuItem openWindowItem;
62666383 private MenuItem editLeafItem;