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
....@@ -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)
....@@ -357,6 +366,16 @@
357366 }
358367
359368 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();
360379 }
361380
362381 //ObjEditor objEditor;
....@@ -396,10 +415,14 @@
396415 this.copy = this.group = group;
397416 //selectees = this.group.selectees;
398417
418
+ assert(false);
419
+
399420 if (copy.versionlist == null)
400421 {
401422 copy.versionlist = new Object3D[100];
402423 copy.versionindex = -1;
424
+
425
+ //Save(true);
403426 }
404427
405428 if(ui)
....@@ -428,7 +451,7 @@
428451 copy.versionlist = new Object3D[100];
429452 copy.versionindex = -1;
430453
431
- Save(true);
454
+ //Save(true);
432455 }
433456 }
434457
....@@ -519,33 +542,35 @@
519542 // menu.add("-");
520543 duplicateItem = oe.jTree.popup.add(new JMenuItem("Duplicate"));
521544 duplicateItem.addActionListener(this);
522
- cloneItem = menu.add(new MenuItem("Clone"));
545
+
546
+ cloneItem = oe.jTree.popup.add(new JMenuItem("Clone"));
523547 cloneItem.addActionListener(this);
524
- if (Globals.ADVANCED)
548
+ //if (Globals.ADVANCED)
525549 {
526550 cloneSupportItem = menu.add(new MenuItem("Clone (+supports)"));
527551 cloneSupportItem.addActionListener(this);
528552 }
553
+ oe.jTree.popup.addSeparator();
529554 menu.add("-");
530
- cutItem = menu.add(new MenuItem("Cut"));
555
+ cutItem = oe.jTree.popup.add(new JMenuItem("Cut"));
531556 cutItem.addActionListener(this);
532
- copyItem = menu.add(new MenuItem("Copy"));
557
+ copyItem = oe.jTree.popup.add(new JMenuItem("Copy"));
533558 copyItem.addActionListener(this);
534559 pasteItem = menu.add(new MenuItem("Paste"));
535560 pasteItem.addActionListener(this);
536561
537
- menu.add("-");
538
- 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"));
539565 pasteIntoItem.addActionListener(this);
540
- pasteLinkItem = menu.add(new MenuItem("Paste link"));
566
+ pasteLinkItem = oe.jTree.popup.add(new JMenuItem("Paste link"));
541567 pasteLinkItem.addActionListener(this);
542
- pasteCloneItem = menu.add(new MenuItem("Paste clone"));
568
+ pasteCloneItem = oe.jTree.popup.add(new JMenuItem("Paste clone"));
543569 pasteCloneItem.addActionListener(this);
544
-// pasteExpandItem = menu.add(new MenuItem("Paste expand"));
570
+// CRASH pasteExpandItem = oe.jTree.popup.add(new JMenuItem("Paste expand"));
545571 // pasteExpandItem.addActionListener(this);
546
- menu.add("-");
547
- deleteItem = menu.add(new MenuItem("Delete"));
548
- deleteItem.addActionListener(this);
572
+ //menu.add("-");
573
+ oe.jTree.popup.addSeparator();
549574
550575 if (Globals.ADVANCED)
551576 {
....@@ -631,11 +656,9 @@
631656 oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest"));
632657 //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection"));
633658 //cameraMenu.add(switchViewItem = new MenuItem("Reverse View"));
634
- editLeafItem = oe.cameraMenu.add(new MenuItem("Edit Leaf"));
635659 oe.cameraMenu.add("-");
636660 openWindowItem = oe.cameraMenu.add(new MenuItem("Edit copy..."));
637661 openWindowItem.addActionListener(this);
638
- editLeafItem.addActionListener(this);
639662 lookAtItem.addActionListener(this);
640663 //lookFromItem.addActinoListener(this);
641664 //switchViewItem.addActionListener(this);
....@@ -682,9 +705,8 @@
682705 setMasterItem.addActionListener(this);
683706 }
684707
685
- oe.menuBar.add(menu = new Menu("Group"));
686
-// grabItem = menu.add(new MenuItem("Grab"));
687
-// grabItem.addActionListener(this);
708
+ oe.menuBar.add(menu = new Menu("Order"));
709
+
688710 backItem = menu.add(new MenuItem("Back"));
689711 backItem.addActionListener(this);
690712 frontItem = menu.add(new MenuItem("Front"));
....@@ -692,13 +714,21 @@
692714 // compositeItem = menu.add(new MenuItem("Composite"));
693715 // compositeItem.addActionListener(this);
694716
717
+ grabItem = oe.jTree.popup.add(new JMenuItem("Group"));
718
+ grabItem.addActionListener(this);
719
+
695720 if (Globals.ADVANCED)
696721 {
697722 hideItem = menu.add(new MenuItem("Hidden Group"));
698723 hideItem.addActionListener(this);
699724 }
700
- ungroupItem = menu.add(new MenuItem("Ungroup"));
725
+ ungroupItem = oe.jTree.popup.add(new JMenuItem("Ungroup"));
701726 ungroupItem.addActionListener(this);
727
+
728
+ oe.jTree.popup.addSeparator();
729
+
730
+ deleteItem = oe.jTree.popup.add(new JMenuItem("Delete"));
731
+ deleteItem.addActionListener(this);
702732
703733 // menu.add("-");
704734 //
....@@ -883,6 +913,9 @@
883913 shareGeometriesItem.addActionListener(this);
884914 mergeGeometriesItem = menu.add(new MenuItem("Merge Geometries"));
885915 mergeGeometriesItem.addActionListener(this);
916
+ menu.add("-");
917
+ editLeafItem = menu.add(new MenuItem("Edit leaf..."));
918
+ editLeafItem.addActionListener(this);
886919 if (Globals.ADVANCED)
887920 {
888921 // Pretty much the same as duplicate and clone.
....@@ -901,7 +934,7 @@
901934
902935 JTabbedPane resourcecontainer;
903936 cGridBag currenttab;
904
- boolean added; // patch for jar
937
+ //boolean added; // patch for jar
905938
906939 int tabcount = 0;
907940 int colcount = 0;
....@@ -918,12 +951,14 @@
918951 // System.out.println();
919952
920953 if (//rowcount == 0 ||
921
- path.length == 1)
954
+ path.length == 1 && !path[0].equals("") && !path[0].equals(".DS_Store"))
922955 {
923956 currenttab = new cGridBag();
924
- added = false;
925957 String tabname = path[0]; // String.valueOf((char)('A'+tabcount));
926958 currenttab.setName(tabname);
959
+ //added = false;
960
+ resourcecontainer.add(currenttab);
961
+ resourcecontainer.setToolTipTextAt(tabcount++, "Texture Group " + tabname);
927962 rowcount = 1;
928963 colcount = 0;
929964 texturecount = 0;
....@@ -931,12 +966,11 @@
931966
932967 if (path.length > 2 && path[2].toLowerCase().endsWith(".jpg"))
933968 {
934
- if (!added)
969
+ //if (!added)
935970 {
936
- added = true;
937
- resourcecontainer.add(currenttab);
971
+ //added = true;
938972 String tabname = path[0]; // String.valueOf((char)('A'+tabcount));
939
- resourcecontainer.setToolTipTextAt(tabcount++, "Texture Group " + tabname);
973
+ currenttab = (cGridBag)resourcecontainer.getComponentAt(resourcecontainer.indexOfTab(tabname));
940974 }
941975
942976 AddTextureButton(path[0], path[1], path[2], texturecount++, currenttab);
....@@ -984,11 +1018,6 @@
9841018 //new Exception().printStackTrace();
9851019
9861020 oe.radioPanel = new JPanel(new GridBagLayout());
987
- oe.aConstraints.weightx = 1;
988
- oe.aConstraints.weighty = 0;
989
- oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
990
- oe.aConstraints.gridwidth = 100;
991
- oe.aConstraints.gridheight = 1;
9921021 // oe.toolbarPanel.add(radioPanel); //, oe.aConstraints);
9931022
9941023 oe.buttonGroup = new ButtonGroup();
....@@ -1021,10 +1050,49 @@
10211050
10221051 if (Globals.ADVANCED)
10231052 {
1024
- oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1025
- maxButton.setToolTipText("Maximize window");
1026
- 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);
10271056 }
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
+ //
10281096
10291097 oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
10301098 fullButton.setToolTipText("Full-screen window");
....@@ -1045,6 +1113,7 @@
10451113 copyOptionsPanel.add(deleteVersionButton = GetButton("icons/trash.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
10461114 deleteVersionButton.setToolTipText("Delete current version");
10471115 deleteVersionButton.addActionListener(this);
1116
+ deleteVersionButton.setEnabled(false);
10481117
10491118 copyOptionsPanel.add(previousVersionButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
10501119 previousVersionButton.setToolTipText("Previous version");
....@@ -1055,12 +1124,12 @@
10551124 updown.add(restoreButton = GetButton("icons/restore.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
10561125 restoreButton.setToolTipText("Undo (restore current version)");
10571126 restoreButton.addActionListener(this);
1058
- //restoreButton.setEnabled(false);
1127
+ restoreButton.setEnabled(false);
10591128
10601129 updown.add(replaceButton = GetButton("icons/replace.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
10611130 replaceButton.setToolTipText("Save (replace current version)");
10621131 replaceButton.addActionListener(this);
1063
- //replaceButton.setEnabled(false);
1132
+ replaceButton.setEnabled(false);
10641133
10651134 copyOptionsPanel.add(updown);
10661135
....@@ -1069,14 +1138,14 @@
10691138 nextVersionButton.addActionListener(this);
10701139 nextVersionButton.setEnabled(false);
10711140
1072
- oe.toolbarPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
1073
- liveCB.setToolTipText("Enable animation");
1074
- liveCB.addItemListener(this);
1075
-
10761141 oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
10771142 oneStepButton.setToolTipText("Animate one step forward");
10781143 oneStepButton.addActionListener(this);
10791144
1145
+ oe.toolbarPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
1146
+ liveCB.setToolTipText("Enable animation");
1147
+ liveCB.addItemListener(this);
1148
+
10801149 oe.toolbarPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
10811150 fastCB.setToolTipText("Fast mode");
10821151 fastCB.addItemListener(this);
....@@ -1103,21 +1172,6 @@
11031172
11041173 //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
11051174
1106
- oe.toolbarPanel.add(twoButton = GetButton("icons/cube.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1107
- twoButton.setToolTipText("Show 3D view only");
1108
- twoButton.addActionListener(this);
1109
- this.fullscreenLayout = twoButton;
1110
-
1111
- oe.toolbarPanel.add(threeButton = GetButton("icons/controlsview.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1112
- threeButton.setToolTipText("Show controls and 3D view");
1113
- threeButton.addActionListener(this);
1114
- oe.toolbarPanel.add(sixButton = GetButton("icons/viewcontrols.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1115
- sixButton.setToolTipText("Show 3D view and controls");
1116
- sixButton.addActionListener(this);
1117
-// oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1118
-// sevenButton.setToolTipText("3-column layout");
1119
-// sevenButton.addActionListener(this);
1120
- //
11211175
11221176 oe.toolbarPanel.add(rootButton = GetButton("icons/openwindow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
11231177 rootButton.setToolTipText("Open selection in new tab");
....@@ -1133,12 +1187,16 @@
11331187
11341188 // INSERT
11351189 row1.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1136
- gridButton.setToolTipText("Create grid");
1190
+ gridButton.setToolTipText("Create ground");
11371191 gridButton.addActionListener(this);
11381192
11391193 row1.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
11401194 boxButton.setToolTipText("Create box");
11411195 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);
11421200
11431201 row1.add(sphereButton = GetButton("icons/sphere.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
11441202 sphereButton.setToolTipText("Create sphere");
....@@ -1151,10 +1209,6 @@
11511209 row1.add(torusButton = GetButton("icons/torus.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
11521210 torusButton.setToolTipText("Create torus");
11531211 torusButton.addActionListener(this);
1154
-
1155
- row1.add(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1156
- superButton.setToolTipText("Create superellipsoid");
1157
- superButton.addActionListener(this);
11581212
11591213 if (Globals.ADVANCED)
11601214 {
....@@ -1204,6 +1258,8 @@
12041258 cGridBag textures = new cGridBag();
12051259
12061260 CreateTexturePanel(textures);
1261
+
1262
+ resourcecontainer.setSelectedIndex((int)(Math.random() * resourcecontainer.getTabCount()));
12071263
12081264 oe.toolboxPanel.add(textures);
12091265
....@@ -1425,6 +1481,14 @@
14251481
14261482 void EditObject(Object3D obj)
14271483 {
1484
+ assert(obj instanceof Composite);
1485
+
1486
+// if (obj.versionlist == null)
1487
+// {
1488
+// obj.versionlist = new Object3D[100];
1489
+// obj.versionindex = -1;
1490
+// }
1491
+
14281492 cRadio radioButton = new cRadio(obj.name);
14291493
14301494 // June 2019. Patch to avoid bug with transparency.
....@@ -1449,6 +1513,7 @@
14491513
14501514 oe.SetupViews();
14511515
1516
+ if (Globals.DEBUG)
14521517 System.out.println("SetupViews");
14531518 DragSource.getDefaultDragSource().createDefaultDragGestureRecognizer(
14541519 oe.cameraView, DnDConstants.ACTION_COPY_OR_MOVE, this); // ACTION_LINK ??
....@@ -1815,7 +1880,12 @@
18151880 TreePath path;
18161881
18171882 public TransferableTreePath(TreePath tp) {
1818
- 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);
18191889 }
18201890
18211891 public synchronized DataFlavor[] getTransferDataFlavors() {
....@@ -2105,7 +2175,11 @@
21052175 shadow.material = new cMaterial(obj.material);
21062176 shadow.material.diffuse = 0.0001f;
21072177 shadow.material.specular = 0.0001f;
2108
- //shadow.projectedVertices[1].x = 300;
2178
+ shadow.material.opacity = 0.75f;
2179
+
2180
+ AllocProjectedVertices(shadow);
2181
+
2182
+ shadow.projectedVertices[1].x = 300;
21092183
21102184 makeSomething(shadow);
21112185 }
....@@ -2626,27 +2700,35 @@
26262700 } else
26272701 if (source == loopItem || source == loopButton)
26282702 {
2703
+ if (!group.selection.isEmpty())
2704
+ {
26292705 Composite csg = new GroupLeaf();
26302706 csg.count = 5;
2631
- group(csg);
26322707 Composite child = new cGroup("Branch");
26332708 csg.addChild(child);
26342709 child.addChild(csg);
2710
+ group(csg);
2711
+ }
26352712 } else
26362713 if (source == doubleItem)
26372714 {
2715
+ if (!group.selection.isEmpty())
2716
+ {
26382717 Composite csg = new GroupLeaf("Fork");
26392718 csg.count = 5;
2640
- group(csg);
26412719 Composite child = new cGroup("Branch A");
26422720 csg.addChild(child);
26432721 child.addChild(csg);
26442722 child = new cGroup("Branch B");
26452723 csg.addChild(child);
26462724 child.addChild(csg);
2725
+ group(csg);
2726
+ }
26472727 } else
26482728 if (source == tripleItem)
26492729 {
2730
+ if (!group.selection.isEmpty())
2731
+ {
26502732 Composite csg = new GroupLeaf("Trident");
26512733 csg.count = 4;
26522734 group(csg);
....@@ -2659,6 +2741,7 @@
26592741 child = new cGroup();
26602742 csg.addChild(child);
26612743 child.addChild(csg);
2744
+ }
26622745 } else
26632746 if (source == computeAOItem)
26642747 {
....@@ -2708,6 +2791,18 @@
27082791 if (source == fullButton)
27092792 {
27102793 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();
27112806 } else
27122807 if (source == previousVersionButton)
27132808 {
....@@ -3282,22 +3377,34 @@
32823377 } else
32833378 if (source == ungroupItem || source == ungroupButton)
32843379 {
3285
- boolean hasRoot = false;
3380
+ boolean canUngroup = true;
32863381
32873382 for (int i=0; i<group.selection.size(); i++)
32883383 {
3289
- if (group.selection.get(i) == group)
3384
+ Object3D selectedItem = group.selection.get(i);
3385
+
3386
+ if (selectedItem.Size() == 0)
32903387 {
3291
- 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;
32923397 break;
32933398 }
32943399 }
32953400
3296
- if (!hasRoot)
3401
+ if (canUngroup)
32973402 {
32983403 for (int i=0; i<group.selection.size(); i++)
32993404 {
3300
- Ungroup(group.selection.get(i));
3405
+ Object3D selectedItem = group.selection.get(i);
3406
+
3407
+ Ungroup(selectedItem);
33013408 }
33023409
33033410 ClearSelection(false);
....@@ -3660,38 +3767,7 @@
36603767 if (CameraPane.FULLSCREEN)
36613768 fullscreenLayout = radio.layout;
36623769
3663
- // bug
3664
- //gridPanel.setDividerLocation(1.0);
3665
- //bigPanel.setDividerLocation(0.0);
3666
-// bigThree.remove(scenePanel);
3667
-// bigThree.remove(centralPanel);
3668
-// bigThree.remove(XYZPanel);
3669
-// aWindowConstraints.gridx = 0;
3670
-// aWindowConstraints.gridy = 0;
3671
-// aWindowConstraints.gridwidth = 1;
3672
-// // aConstraints.gridheight = 3;
3673
-// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3674
-// aWindowConstraints.weightx = 0;
3675
-// aWindowConstraints.weighty = 1;
3676
-// //bigThree.add(jtp, aWindowConstraints);
3677
-// aWindowConstraints.weightx = 1;
3678
-// aWindowConstraints.gridwidth = 3;
3679
-// // aConstraints.gridheight = 3;
3680
-// aWindowConstraints.gridx = 1;
3681
-// aWindowConstraints.fill = GridBagConstraints.BOTH;
3682
-// bigThree.add(centralPanel, aWindowConstraints);
3683
-// aWindowConstraints.weightx = 0;
3684
-// aWindowConstraints.gridx = 4;
3685
-// aWindowConstraints.gridwidth = 1;
3686
-// // aConstraints.gridheight = 3;
3687
-// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3688
-// //bigThree.add(XYZPanel, aWindowConstraints);
3689
-// scenePanel.setVisible(false);
3690
-// centralPanel.setVisible(true);
3691
-// XYZPanel.setVisible(false);
3692
- bigThree.ClearUI();
3693
- bigThree.add(centralPanel);
3694
- bigThree.FlushUI();
3770
+ Show3DView();
36953771
36963772 cameraView.requestFocusInWindow();
36973773
....@@ -3877,6 +3953,7 @@
38773953 } else
38783954 if (source == rootButton)
38793955 {
3956
+ Replace();
38803957 Object3D obj;
38813958 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
38823959 {
....@@ -4013,8 +4090,6 @@
40134090
40144091 copy = group;
40154092
4016
- SetUndoStates();
4017
-
40184093 //Globals.theRenderer.object = group;
40194094 if(!useclient)
40204095 {
....@@ -4042,6 +4117,21 @@
40424117 */
40434118 radio.layout.doClick();
40444119
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
+
40454135 ClearUnpinned();
40464136
40474137 //Grafreed.Assert(group != null);
....@@ -5276,6 +5366,21 @@
52765366 flashSelectionButton.setEnabled(enabled);
52775367
52785368 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);
52795384 }
52805385
52815386 void refreshContents(boolean cp)
....@@ -5290,7 +5395,7 @@
52905395 Object3D child = (Object3D) group.selection.get(i);
52915396
52925397 objEditor.AddInfo(child, this, true);
5293
- System.err.println("info : " + child.GetPath());
5398
+// System.err.println("info : " + child.GetPath());
52945399 }
52955400
52965401 objEditor.SetText(); // jan 2014
....@@ -6173,11 +6278,11 @@
61736278 private MenuItem lookAtItem;
61746279 private MenuItem lookFromItem;
61756280 private MenuItem switchViewItem;
6176
- private MenuItem cutItem;
6281
+ private JMenuItem cutItem;
61776282 private MenuItem undoItem;
61786283 private MenuItem redoItem;
61796284 private JMenuItem duplicateItem;
6180
- private MenuItem cloneItem;
6285
+ private JMenuItem cloneItem;
61816286 private MenuItem cloneSupportItem;
61826287 private MenuItem overwriteGeoItem;
61836288 private MenuItem overwriteMatItem;
....@@ -6198,13 +6303,13 @@
61986303 private MenuItem cloneGeometriesItem;
61996304 private MenuItem shareGeometriesItem;
62006305 private MenuItem mergeGeometriesItem;
6201
- private MenuItem copyItem;
6306
+ private JMenuItem copyItem;
62026307 private MenuItem pasteItem;
6203
- private MenuItem pasteIntoItem;
6204
- private MenuItem pasteLinkItem;
6205
- private MenuItem pasteCloneItem;
6206
- private MenuItem pasteExpandItem;
6207
- private MenuItem deleteItem;
6308
+ private JMenuItem pasteIntoItem;
6309
+ private JMenuItem pasteLinkItem;
6310
+ private JMenuItem pasteCloneItem;
6311
+ private JMenuItem pasteExpandItem;
6312
+ private JMenuItem deleteItem;
62086313 private MenuItem clearAllItem;
62096314 private MenuItem genUVItem;
62106315 private MenuItem genNormalsMESHItem;
....@@ -6259,7 +6364,7 @@
62596364 private MenuItem transformGeometryItem;
62606365 private MenuItem transformChildrenItem;
62616366 private MenuItem hideItem;
6262
- private MenuItem grabItem;
6367
+ private JMenuItem grabItem;
62636368 private MenuItem backItem;
62646369 private MenuItem frontItem;
62656370 private MenuItem cameraItem;
....@@ -6272,7 +6377,7 @@
62726377 private MenuItem switchTransfoItem;
62736378 private MenuItem morphItem;
62746379 private MenuItem linkerItem;
6275
- private MenuItem ungroupItem;
6380
+ private JMenuItem ungroupItem;
62766381 private MenuItem editItem;
62776382 private MenuItem openWindowItem;
62786383 private MenuItem editLeafItem;