Normand Briere
2019-08-16 83d0c2fa0bd2e96448f776144e1a89cdb1bb6998
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 {
....@@ -1413,6 +1479,14 @@
14131479
14141480 void EditObject(Object3D obj)
14151481 {
1482
+ assert(obj instanceof Composite);
1483
+
1484
+// if (obj.versionlist == null)
1485
+// {
1486
+// obj.versionlist = new Object3D[100];
1487
+// obj.versionindex = -1;
1488
+// }
1489
+
14161490 cRadio radioButton = new cRadio(obj.name);
14171491
14181492 // June 2019. Patch to avoid bug with transparency.
....@@ -1437,6 +1511,7 @@
14371511
14381512 oe.SetupViews();
14391513
1514
+ if (Globals.DEBUG)
14401515 System.out.println("SetupViews");
14411516 DragSource.getDefaultDragSource().createDefaultDragGestureRecognizer(
14421517 oe.cameraView, DnDConstants.ACTION_COPY_OR_MOVE, this); // ACTION_LINK ??
....@@ -1803,7 +1878,12 @@
18031878 TreePath path;
18041879
18051880 public TransferableTreePath(TreePath tp) {
1806
- path = tp;
1881
+ Object[] objs = new Object[tp.getPathCount()];
1882
+ for (int i=0; i<objs.length; i++)
1883
+ {
1884
+ objs[i] = ((Object3D)tp.getPathComponent(i)).GetUUID();
1885
+ }
1886
+ path = new TreePath(objs);
18071887 }
18081888
18091889 public synchronized DataFlavor[] getTransferDataFlavors() {
....@@ -2093,7 +2173,11 @@
20932173 shadow.material = new cMaterial(obj.material);
20942174 shadow.material.diffuse = 0.0001f;
20952175 shadow.material.specular = 0.0001f;
2096
- //shadow.projectedVertices[1].x = 300;
2176
+ shadow.material.opacity = 0.75f;
2177
+
2178
+ AllocProjectedVertices(shadow);
2179
+
2180
+ shadow.projectedVertices[1].x = 300;
20972181
20982182 makeSomething(shadow);
20992183 }
....@@ -2614,27 +2698,35 @@
26142698 } else
26152699 if (source == loopItem || source == loopButton)
26162700 {
2701
+ if (!group.selection.isEmpty())
2702
+ {
26172703 Composite csg = new GroupLeaf();
26182704 csg.count = 5;
2619
- group(csg);
26202705 Composite child = new cGroup("Branch");
26212706 csg.addChild(child);
26222707 child.addChild(csg);
2708
+ group(csg);
2709
+ }
26232710 } else
26242711 if (source == doubleItem)
26252712 {
2713
+ if (!group.selection.isEmpty())
2714
+ {
26262715 Composite csg = new GroupLeaf("Fork");
26272716 csg.count = 5;
2628
- group(csg);
26292717 Composite child = new cGroup("Branch A");
26302718 csg.addChild(child);
26312719 child.addChild(csg);
26322720 child = new cGroup("Branch B");
26332721 csg.addChild(child);
26342722 child.addChild(csg);
2723
+ group(csg);
2724
+ }
26352725 } else
26362726 if (source == tripleItem)
26372727 {
2728
+ if (!group.selection.isEmpty())
2729
+ {
26382730 Composite csg = new GroupLeaf("Trident");
26392731 csg.count = 4;
26402732 group(csg);
....@@ -2647,6 +2739,7 @@
26472739 child = new cGroup();
26482740 csg.addChild(child);
26492741 child.addChild(csg);
2742
+ }
26502743 } else
26512744 if (source == computeAOItem)
26522745 {
....@@ -2696,6 +2789,18 @@
26962789 if (source == fullButton)
26972790 {
26982791 ToggleFullScreen();
2792
+ } else
2793
+ if (source == collapseButton)
2794
+ {
2795
+ this.expandedLayout = radio.layout;
2796
+ CollapseToolbar();
2797
+ } else
2798
+ if (source == maximize3DButton)
2799
+ {
2800
+ this.expandedLayout = radio.layout;
2801
+ radio.layout = twoButton;
2802
+ Show3DView();
2803
+ CollapseToolbar();
26992804 } else
27002805 if (source == previousVersionButton)
27012806 {
....@@ -3270,22 +3375,34 @@
32703375 } else
32713376 if (source == ungroupItem || source == ungroupButton)
32723377 {
3273
- boolean hasRoot = false;
3378
+ boolean canUngroup = true;
32743379
32753380 for (int i=0; i<group.selection.size(); i++)
32763381 {
3277
- if (group.selection.get(i) == group)
3382
+ Object3D selectedItem = group.selection.get(i);
3383
+
3384
+ if (selectedItem.Size() == 0)
32783385 {
3279
- hasRoot = true;
3386
+ // Cannot ungroup leaves
3387
+ canUngroup = false;
3388
+ break;
3389
+ }
3390
+
3391
+ if (selectedItem == group)
3392
+ {
3393
+ // Cannot ungroup root
3394
+ canUngroup = false;
32803395 break;
32813396 }
32823397 }
32833398
3284
- if (!hasRoot)
3399
+ if (canUngroup)
32853400 {
32863401 for (int i=0; i<group.selection.size(); i++)
32873402 {
3288
- Ungroup(group.selection.get(i));
3403
+ Object3D selectedItem = group.selection.get(i);
3404
+
3405
+ Ungroup(selectedItem);
32893406 }
32903407
32913408 ClearSelection(false);
....@@ -3648,38 +3765,7 @@
36483765 if (CameraPane.FULLSCREEN)
36493766 fullscreenLayout = radio.layout;
36503767
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();
3768
+ Show3DView();
36833769
36843770 cameraView.requestFocusInWindow();
36853771
....@@ -3865,6 +3951,7 @@
38653951 } else
38663952 if (source == rootButton)
38673953 {
3954
+ Replace();
38683955 Object3D obj;
38693956 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
38703957 {
....@@ -4001,8 +4088,6 @@
40014088
40024089 copy = group;
40034090
4004
- SetUndoStates();
4005
-
40064091 //Globals.theRenderer.object = group;
40074092 if(!useclient)
40084093 {
....@@ -4030,6 +4115,21 @@
40304115 */
40314116 radio.layout.doClick();
40324117
4118
+ assert(copy instanceof Composite);
4119
+
4120
+ if (copy.versionlist == null)
4121
+ {
4122
+ copy.versionlist = new Object3D[100];
4123
+ copy.versionindex = -1;
4124
+
4125
+ // Cannot work with loops
4126
+ // To fix this issue, first mark all nodes above the root,
4127
+ // and check if any of these nodes are reachable below the root.
4128
+ //Save(true);
4129
+ }
4130
+
4131
+ SetVersionStates();
4132
+
40334133 ClearUnpinned();
40344134
40354135 //Grafreed.Assert(group != null);
....@@ -5264,6 +5364,21 @@
52645364 flashSelectionButton.setEnabled(enabled);
52655365
52665366 clearPanelButton.setEnabled(!listUI.isEmpty());
5367
+
5368
+ boolean allComposites = true;
5369
+
5370
+ if (group.selection != null)
5371
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
5372
+ {
5373
+ Object next = e.nextElement();
5374
+ if (!(next instanceof Composite)) // || (next instanceof GroupLeaf))
5375
+ {
5376
+ allComposites = false;
5377
+ break;
5378
+ }
5379
+ }
5380
+
5381
+ rootButton.setEnabled(allComposites);
52675382 }
52685383
52695384 void refreshContents(boolean cp)
....@@ -5278,7 +5393,7 @@
52785393 Object3D child = (Object3D) group.selection.get(i);
52795394
52805395 objEditor.AddInfo(child, this, true);
5281
- System.err.println("info : " + child.GetPath());
5396
+// System.err.println("info : " + child.GetPath());
52825397 }
52835398
52845399 objEditor.SetText(); // jan 2014
....@@ -6161,11 +6276,11 @@
61616276 private MenuItem lookAtItem;
61626277 private MenuItem lookFromItem;
61636278 private MenuItem switchViewItem;
6164
- private MenuItem cutItem;
6279
+ private JMenuItem cutItem;
61656280 private MenuItem undoItem;
61666281 private MenuItem redoItem;
61676282 private JMenuItem duplicateItem;
6168
- private MenuItem cloneItem;
6283
+ private JMenuItem cloneItem;
61696284 private MenuItem cloneSupportItem;
61706285 private MenuItem overwriteGeoItem;
61716286 private MenuItem overwriteMatItem;
....@@ -6186,13 +6301,13 @@
61866301 private MenuItem cloneGeometriesItem;
61876302 private MenuItem shareGeometriesItem;
61886303 private MenuItem mergeGeometriesItem;
6189
- private MenuItem copyItem;
6304
+ private JMenuItem copyItem;
61906305 private MenuItem pasteItem;
6191
- private MenuItem pasteIntoItem;
6192
- private MenuItem pasteLinkItem;
6193
- private MenuItem pasteCloneItem;
6194
- private MenuItem pasteExpandItem;
6195
- private MenuItem deleteItem;
6306
+ private JMenuItem pasteIntoItem;
6307
+ private JMenuItem pasteLinkItem;
6308
+ private JMenuItem pasteCloneItem;
6309
+ private JMenuItem pasteExpandItem;
6310
+ private JMenuItem deleteItem;
61966311 private MenuItem clearAllItem;
61976312 private MenuItem genUVItem;
61986313 private MenuItem genNormalsMESHItem;
....@@ -6247,7 +6362,7 @@
62476362 private MenuItem transformGeometryItem;
62486363 private MenuItem transformChildrenItem;
62496364 private MenuItem hideItem;
6250
- private MenuItem grabItem;
6365
+ private JMenuItem grabItem;
62516366 private MenuItem backItem;
62526367 private MenuItem frontItem;
62536368 private MenuItem cameraItem;
....@@ -6260,7 +6375,7 @@
62606375 private MenuItem switchTransfoItem;
62616376 private MenuItem morphItem;
62626377 private MenuItem linkerItem;
6263
- private MenuItem ungroupItem;
6378
+ private JMenuItem ungroupItem;
62646379 private MenuItem editItem;
62656380 private MenuItem openWindowItem;
62666381 private MenuItem editLeafItem;