Normand Briere
2019-08-16 64e20f390e4b8e58bd0006dde8fa10fba1dac1d5
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;
....@@ -394,6 +419,8 @@
394419 {
395420 copy.versionlist = new Object3D[100];
396421 copy.versionindex = -1;
422
+
423
+ Save(true);
397424 }
398425
399426 if(ui)
....@@ -513,33 +540,35 @@
513540 // menu.add("-");
514541 duplicateItem = oe.jTree.popup.add(new JMenuItem("Duplicate"));
515542 duplicateItem.addActionListener(this);
516
- cloneItem = menu.add(new MenuItem("Clone"));
543
+
544
+ cloneItem = oe.jTree.popup.add(new JMenuItem("Clone"));
517545 cloneItem.addActionListener(this);
518
- if (Globals.ADVANCED)
546
+ //if (Globals.ADVANCED)
519547 {
520548 cloneSupportItem = menu.add(new MenuItem("Clone (+supports)"));
521549 cloneSupportItem.addActionListener(this);
522550 }
551
+ oe.jTree.popup.addSeparator();
523552 menu.add("-");
524
- cutItem = menu.add(new MenuItem("Cut"));
553
+ cutItem = oe.jTree.popup.add(new JMenuItem("Cut"));
525554 cutItem.addActionListener(this);
526
- copyItem = menu.add(new MenuItem("Copy"));
555
+ copyItem = oe.jTree.popup.add(new JMenuItem("Copy"));
527556 copyItem.addActionListener(this);
528557 pasteItem = menu.add(new MenuItem("Paste"));
529558 pasteItem.addActionListener(this);
530559
531
- menu.add("-");
532
- 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"));
533563 pasteIntoItem.addActionListener(this);
534
- pasteLinkItem = menu.add(new MenuItem("Paste link"));
564
+ pasteLinkItem = oe.jTree.popup.add(new JMenuItem("Paste link"));
535565 pasteLinkItem.addActionListener(this);
536
- pasteCloneItem = menu.add(new MenuItem("Paste clone"));
566
+ pasteCloneItem = oe.jTree.popup.add(new JMenuItem("Paste clone"));
537567 pasteCloneItem.addActionListener(this);
538
-// pasteExpandItem = menu.add(new MenuItem("Paste expand"));
568
+// CRASH pasteExpandItem = oe.jTree.popup.add(new JMenuItem("Paste expand"));
539569 // pasteExpandItem.addActionListener(this);
540
- menu.add("-");
541
- deleteItem = menu.add(new MenuItem("Delete"));
542
- deleteItem.addActionListener(this);
570
+ //menu.add("-");
571
+ oe.jTree.popup.addSeparator();
543572
544573 if (Globals.ADVANCED)
545574 {
....@@ -625,11 +654,9 @@
625654 oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest"));
626655 //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection"));
627656 //cameraMenu.add(switchViewItem = new MenuItem("Reverse View"));
628
- editLeafItem = oe.cameraMenu.add(new MenuItem("Edit Leaf"));
629657 oe.cameraMenu.add("-");
630658 openWindowItem = oe.cameraMenu.add(new MenuItem("Edit copy..."));
631659 openWindowItem.addActionListener(this);
632
- editLeafItem.addActionListener(this);
633660 lookAtItem.addActionListener(this);
634661 //lookFromItem.addActinoListener(this);
635662 //switchViewItem.addActionListener(this);
....@@ -676,9 +703,8 @@
676703 setMasterItem.addActionListener(this);
677704 }
678705
679
- oe.menuBar.add(menu = new Menu("Group"));
680
-// grabItem = menu.add(new MenuItem("Grab"));
681
-// grabItem.addActionListener(this);
706
+ oe.menuBar.add(menu = new Menu("Order"));
707
+
682708 backItem = menu.add(new MenuItem("Back"));
683709 backItem.addActionListener(this);
684710 frontItem = menu.add(new MenuItem("Front"));
....@@ -686,13 +712,21 @@
686712 // compositeItem = menu.add(new MenuItem("Composite"));
687713 // compositeItem.addActionListener(this);
688714
715
+ grabItem = oe.jTree.popup.add(new JMenuItem("Group"));
716
+ grabItem.addActionListener(this);
717
+
689718 if (Globals.ADVANCED)
690719 {
691720 hideItem = menu.add(new MenuItem("Hidden Group"));
692721 hideItem.addActionListener(this);
693722 }
694
- ungroupItem = menu.add(new MenuItem("Ungroup"));
723
+ ungroupItem = oe.jTree.popup.add(new JMenuItem("Ungroup"));
695724 ungroupItem.addActionListener(this);
725
+
726
+ oe.jTree.popup.addSeparator();
727
+
728
+ deleteItem = oe.jTree.popup.add(new JMenuItem("Delete"));
729
+ deleteItem.addActionListener(this);
696730
697731 // menu.add("-");
698732 //
....@@ -877,6 +911,9 @@
877911 shareGeometriesItem.addActionListener(this);
878912 mergeGeometriesItem = menu.add(new MenuItem("Merge Geometries"));
879913 mergeGeometriesItem.addActionListener(this);
914
+ menu.add("-");
915
+ editLeafItem = menu.add(new MenuItem("Edit leaf..."));
916
+ editLeafItem.addActionListener(this);
880917 if (Globals.ADVANCED)
881918 {
882919 // Pretty much the same as duplicate and clone.
....@@ -895,40 +932,47 @@
895932
896933 JTabbedPane resourcecontainer;
897934 cGridBag currenttab;
898
- boolean added; // patch for jar
935
+ //boolean added; // patch for jar
899936
900937 int tabcount = 0;
901938 int colcount = 0;
902939 int rowcount = 0;
940
+ int texturecount = 0;
903941
904942 int columns = 5;
905943 int rows = 7;
906944
907945 public void ResourceCallBack(String[] path)
908946 {
909
- for (int i = 0; i < path.length; i++)
910
- System.out.print(path[i] + "/");
911
- System.out.println();
912
- if (rowcount == 0)
947
+// for (int i = 0; i < path.length; i++)
948
+// System.out.print(path[i] + "/");
949
+// System.out.println();
950
+
951
+ if (//rowcount == 0 ||
952
+ path.length == 1 && !path[0].equals("") && !path[0].equals(".DS_Store"))
913953 {
914954 currenttab = new cGridBag();
915
- added = false;
916
- String tabname = String.valueOf((char)('A'+tabcount));
955
+ String tabname = path[0]; // String.valueOf((char)('A'+tabcount));
917956 currenttab.setName(tabname);
957
+ //added = false;
958
+ resourcecontainer.add(currenttab);
959
+ resourcecontainer.setToolTipTextAt(tabcount++, "Texture Group " + tabname);
918960 rowcount = 1;
961
+ colcount = 0;
962
+ texturecount = 0;
919963 }
920964
921
- if (path.length > 1 && path[1].toLowerCase().endsWith(".jpg"))
965
+ if (path.length > 2 && path[2].toLowerCase().endsWith(".jpg"))
922966 {
923
- if (!added)
967
+ //if (!added)
924968 {
925
- added = true;
926
- resourcecontainer.add(currenttab);
927
- String tabname = String.valueOf((char)('A'+tabcount));
928
- resourcecontainer.setToolTipTextAt(tabcount++, "Texture Group " + tabname);
969
+ //added = true;
970
+ String tabname = path[0]; // String.valueOf((char)('A'+tabcount));
971
+ currenttab = (cGridBag)resourcecontainer.getComponentAt(resourcecontainer.indexOfTab(tabname));
929972 }
930973
931
- AddTextureButton(path[0], path[1], currenttab);
974
+ AddTextureButton(path[0], path[1], path[2], texturecount++, currenttab);
975
+
932976 if (++colcount >= columns)
933977 {
934978 colcount = 0;
....@@ -949,7 +993,7 @@
949993
950994 void CreateTexturePanel(cGridBag container)
951995 {
952
- resourcecontainer = new JTabbedPane();
996
+ resourcecontainer = new JTabbedPane(JTabbedPane.LEFT);
953997 container.add(resourcecontainer);
954998
955999 Grafreed.ParseResources("textures", this);
....@@ -972,11 +1016,6 @@
9721016 //new Exception().printStackTrace();
9731017
9741018 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;
9801019 // oe.toolbarPanel.add(radioPanel); //, oe.aConstraints);
9811020
9821021 oe.buttonGroup = new ButtonGroup();
....@@ -1009,10 +1048,49 @@
10091048
10101049 if (Globals.ADVANCED)
10111050 {
1012
- oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1013
- maxButton.setToolTipText("Maximize window");
1014
- maxButton.addActionListener(this);
1051
+// oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1052
+// maxButton.setToolTipText("Maximize window");
1053
+// maxButton.addActionListener(this);
10151054 }
1055
+
1056
+ cButton gcButton;
1057
+
1058
+// oe.toolbarPanel.add(gcButton = GetButton("icons/trash.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1059
+// gcButton.setToolTipText("Garbage collect");
1060
+// gcButton.addActionListener(new ActionListener()
1061
+// {
1062
+// public void actionPerformed(ActionEvent e)
1063
+// {
1064
+// System.gc();
1065
+// }
1066
+// });
1067
+
1068
+ oe.toolbarPanel.add(collapseButton = GetButton("icons/collapse.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1069
+ collapseButton.setToolTipText("Collapse toolbar");
1070
+ collapseButton.addActionListener(this);
1071
+
1072
+ oe.toolbarPanel.add(maximize3DButton = GetButton("icons/empty.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1073
+ maximize3DButton.setToolTipText("Maximize 3D view");
1074
+ maximize3DButton.addActionListener(this);
1075
+
1076
+ oe.toolbarPanel.add(twoButton = GetButton("icons/cube.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1077
+ twoButton.setToolTipText("Show 3D view only");
1078
+ twoButton.addActionListener(this);
1079
+ this.fullscreenLayout = twoButton;
1080
+
1081
+ oe.toolbarPanel.add(threeButton = GetButton("icons/controlsview.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1082
+ threeButton.setToolTipText("Show controls and 3D view");
1083
+ threeButton.addActionListener(this);
1084
+ if (Globals.ADVANCED)
1085
+ {
1086
+ oe.toolbarPanel.add(sixButton = GetButton("icons/viewcontrols.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1087
+ sixButton.setToolTipText("Show 3D view and controls");
1088
+ sixButton.addActionListener(this);
1089
+ }
1090
+// oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1091
+// sevenButton.setToolTipText("3-column layout");
1092
+// sevenButton.addActionListener(this);
1093
+ //
10161094
10171095 oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
10181096 fullButton.setToolTipText("Full-screen window");
....@@ -1057,14 +1135,14 @@
10571135 nextVersionButton.addActionListener(this);
10581136 nextVersionButton.setEnabled(false);
10591137
1060
- oe.toolbarPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
1061
- liveCB.setToolTipText("Enable animation");
1062
- liveCB.addItemListener(this);
1063
-
10641138 oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
10651139 oneStepButton.setToolTipText("Animate one step forward");
10661140 oneStepButton.addActionListener(this);
10671141
1142
+ oe.toolbarPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
1143
+ liveCB.setToolTipText("Enable animation");
1144
+ liveCB.addItemListener(this);
1145
+
10681146 oe.toolbarPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
10691147 fastCB.setToolTipText("Fast mode");
10701148 fastCB.addItemListener(this);
....@@ -1091,21 +1169,6 @@
10911169
10921170 //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
10931171
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
- //
11091172
11101173 oe.toolbarPanel.add(rootButton = GetButton("icons/openwindow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
11111174 rootButton.setToolTipText("Open selection in new tab");
....@@ -1121,12 +1184,16 @@
11211184
11221185 // INSERT
11231186 row1.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1124
- gridButton.setToolTipText("Create grid");
1187
+ gridButton.setToolTipText("Create ground");
11251188 gridButton.addActionListener(this);
11261189
11271190 row1.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
11281191 boxButton.setToolTipText("Create box");
11291192 boxButton.addActionListener(this);
1193
+
1194
+ row1.add(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1195
+ superButton.setToolTipText("Create superellipsoid");
1196
+ superButton.addActionListener(this);
11301197
11311198 row1.add(sphereButton = GetButton("icons/sphere.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
11321199 sphereButton.setToolTipText("Create sphere");
....@@ -1139,10 +1206,6 @@
11391206 row1.add(torusButton = GetButton("icons/torus.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
11401207 torusButton.setToolTipText("Create torus");
11411208 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);
11461209
11471210 if (Globals.ADVANCED)
11481211 {
....@@ -1413,6 +1476,14 @@
14131476
14141477 void EditObject(Object3D obj)
14151478 {
1479
+ assert(obj instanceof Composite);
1480
+
1481
+// if (obj.versionlist == null)
1482
+// {
1483
+// obj.versionlist = new Object3D[100];
1484
+// obj.versionindex = -1;
1485
+// }
1486
+
14161487 cRadio radioButton = new cRadio(obj.name);
14171488
14181489 // June 2019. Patch to avoid bug with transparency.
....@@ -1437,6 +1508,7 @@
14371508
14381509 oe.SetupViews();
14391510
1511
+ if (Globals.DEBUG)
14401512 System.out.println("SetupViews");
14411513 DragSource.getDefaultDragSource().createDefaultDragGestureRecognizer(
14421514 oe.cameraView, DnDConstants.ACTION_COPY_OR_MOVE, this); // ACTION_LINK ??
....@@ -1803,7 +1875,12 @@
18031875 TreePath path;
18041876
18051877 public TransferableTreePath(TreePath tp) {
1806
- path = tp;
1878
+ Object[] objs = new Object[tp.getPathCount()];
1879
+ for (int i=0; i<objs.length; i++)
1880
+ {
1881
+ objs[i] = ((Object3D)tp.getPathComponent(i)).GetUUID();
1882
+ }
1883
+ path = new TreePath(objs);
18071884 }
18081885
18091886 public synchronized DataFlavor[] getTransferDataFlavors() {
....@@ -2093,7 +2170,11 @@
20932170 shadow.material = new cMaterial(obj.material);
20942171 shadow.material.diffuse = 0.0001f;
20952172 shadow.material.specular = 0.0001f;
2096
- //shadow.projectedVertices[1].x = 300;
2173
+ shadow.material.opacity = 0.75f;
2174
+
2175
+ AllocProjectedVertices(shadow);
2176
+
2177
+ shadow.projectedVertices[1].x = 300;
20972178
20982179 makeSomething(shadow);
20992180 }
....@@ -2614,27 +2695,35 @@
26142695 } else
26152696 if (source == loopItem || source == loopButton)
26162697 {
2698
+ if (!group.selection.isEmpty())
2699
+ {
26172700 Composite csg = new GroupLeaf();
26182701 csg.count = 5;
2619
- group(csg);
26202702 Composite child = new cGroup("Branch");
26212703 csg.addChild(child);
26222704 child.addChild(csg);
2705
+ group(csg);
2706
+ }
26232707 } else
26242708 if (source == doubleItem)
26252709 {
2710
+ if (!group.selection.isEmpty())
2711
+ {
26262712 Composite csg = new GroupLeaf("Fork");
26272713 csg.count = 5;
2628
- group(csg);
26292714 Composite child = new cGroup("Branch A");
26302715 csg.addChild(child);
26312716 child.addChild(csg);
26322717 child = new cGroup("Branch B");
26332718 csg.addChild(child);
26342719 child.addChild(csg);
2720
+ group(csg);
2721
+ }
26352722 } else
26362723 if (source == tripleItem)
26372724 {
2725
+ if (!group.selection.isEmpty())
2726
+ {
26382727 Composite csg = new GroupLeaf("Trident");
26392728 csg.count = 4;
26402729 group(csg);
....@@ -2647,6 +2736,7 @@
26472736 child = new cGroup();
26482737 csg.addChild(child);
26492738 child.addChild(csg);
2739
+ }
26502740 } else
26512741 if (source == computeAOItem)
26522742 {
....@@ -2696,6 +2786,18 @@
26962786 if (source == fullButton)
26972787 {
26982788 ToggleFullScreen();
2789
+ } else
2790
+ if (source == collapseButton)
2791
+ {
2792
+ this.expandedLayout = radio.layout;
2793
+ CollapseToolbar();
2794
+ } else
2795
+ if (source == maximize3DButton)
2796
+ {
2797
+ this.expandedLayout = radio.layout;
2798
+ radio.layout = twoButton;
2799
+ Show3DView();
2800
+ CollapseToolbar();
26992801 } else
27002802 if (source == previousVersionButton)
27012803 {
....@@ -3270,22 +3372,34 @@
32703372 } else
32713373 if (source == ungroupItem || source == ungroupButton)
32723374 {
3273
- boolean hasRoot = false;
3375
+ boolean canUngroup = true;
32743376
32753377 for (int i=0; i<group.selection.size(); i++)
32763378 {
3277
- if (group.selection.get(i) == group)
3379
+ Object3D selectedItem = group.selection.get(i);
3380
+
3381
+ if (selectedItem.Size() == 0)
32783382 {
3279
- hasRoot = true;
3383
+ // Cannot ungroup leaves
3384
+ canUngroup = false;
3385
+ break;
3386
+ }
3387
+
3388
+ if (selectedItem == group)
3389
+ {
3390
+ // Cannot ungroup root
3391
+ canUngroup = false;
32803392 break;
32813393 }
32823394 }
32833395
3284
- if (!hasRoot)
3396
+ if (canUngroup)
32853397 {
32863398 for (int i=0; i<group.selection.size(); i++)
32873399 {
3288
- Ungroup(group.selection.get(i));
3400
+ Object3D selectedItem = group.selection.get(i);
3401
+
3402
+ Ungroup(selectedItem);
32893403 }
32903404
32913405 ClearSelection(false);
....@@ -3648,38 +3762,7 @@
36483762 if (CameraPane.FULLSCREEN)
36493763 fullscreenLayout = radio.layout;
36503764
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();
3765
+ Show3DView();
36833766
36843767 cameraView.requestFocusInWindow();
36853768
....@@ -3865,6 +3948,7 @@
38653948 } else
38663949 if (source == rootButton)
38673950 {
3951
+ Replace();
38683952 Object3D obj;
38693953 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
38703954 {
....@@ -4001,8 +4085,6 @@
40014085
40024086 copy = group;
40034087
4004
- SetUndoStates();
4005
-
40064088 //Globals.theRenderer.object = group;
40074089 if(!useclient)
40084090 {
....@@ -4030,6 +4112,21 @@
40304112 */
40314113 radio.layout.doClick();
40324114
4115
+ assert(copy instanceof Composite);
4116
+
4117
+ if (copy.versionlist == null)
4118
+ {
4119
+ copy.versionlist = new Object3D[100];
4120
+ copy.versionindex = -1;
4121
+
4122
+ // Cannot work with loops
4123
+ // To fix this issue, first mark all nodes above the root,
4124
+ // and check if any of these nodes are reachable below the root.
4125
+ //Save(true);
4126
+ }
4127
+
4128
+ SetVersionStates();
4129
+
40334130 ClearUnpinned();
40344131
40354132 //Grafreed.Assert(group != null);
....@@ -5264,6 +5361,21 @@
52645361 flashSelectionButton.setEnabled(enabled);
52655362
52665363 clearPanelButton.setEnabled(!listUI.isEmpty());
5364
+
5365
+ boolean allComposites = true;
5366
+
5367
+ if (group.selection != null)
5368
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
5369
+ {
5370
+ Object next = e.nextElement();
5371
+ if (!(next instanceof Composite)) // || (next instanceof GroupLeaf))
5372
+ {
5373
+ allComposites = false;
5374
+ break;
5375
+ }
5376
+ }
5377
+
5378
+ rootButton.setEnabled(allComposites);
52675379 }
52685380
52695381 void refreshContents(boolean cp)
....@@ -5278,7 +5390,7 @@
52785390 Object3D child = (Object3D) group.selection.get(i);
52795391
52805392 objEditor.AddInfo(child, this, true);
5281
- System.err.println("info : " + child.GetPath());
5393
+// System.err.println("info : " + child.GetPath());
52825394 }
52835395
52845396 objEditor.SetText(); // jan 2014
....@@ -6161,11 +6273,11 @@
61616273 private MenuItem lookAtItem;
61626274 private MenuItem lookFromItem;
61636275 private MenuItem switchViewItem;
6164
- private MenuItem cutItem;
6276
+ private JMenuItem cutItem;
61656277 private MenuItem undoItem;
61666278 private MenuItem redoItem;
61676279 private JMenuItem duplicateItem;
6168
- private MenuItem cloneItem;
6280
+ private JMenuItem cloneItem;
61696281 private MenuItem cloneSupportItem;
61706282 private MenuItem overwriteGeoItem;
61716283 private MenuItem overwriteMatItem;
....@@ -6186,13 +6298,13 @@
61866298 private MenuItem cloneGeometriesItem;
61876299 private MenuItem shareGeometriesItem;
61886300 private MenuItem mergeGeometriesItem;
6189
- private MenuItem copyItem;
6301
+ private JMenuItem copyItem;
61906302 private MenuItem pasteItem;
6191
- private MenuItem pasteIntoItem;
6192
- private MenuItem pasteLinkItem;
6193
- private MenuItem pasteCloneItem;
6194
- private MenuItem pasteExpandItem;
6195
- private MenuItem deleteItem;
6303
+ private JMenuItem pasteIntoItem;
6304
+ private JMenuItem pasteLinkItem;
6305
+ private JMenuItem pasteCloneItem;
6306
+ private JMenuItem pasteExpandItem;
6307
+ private JMenuItem deleteItem;
61966308 private MenuItem clearAllItem;
61976309 private MenuItem genUVItem;
61986310 private MenuItem genNormalsMESHItem;
....@@ -6247,7 +6359,7 @@
62476359 private MenuItem transformGeometryItem;
62486360 private MenuItem transformChildrenItem;
62496361 private MenuItem hideItem;
6250
- private MenuItem grabItem;
6362
+ private JMenuItem grabItem;
62516363 private MenuItem backItem;
62526364 private MenuItem frontItem;
62536365 private MenuItem cameraItem;
....@@ -6260,7 +6372,7 @@
62606372 private MenuItem switchTransfoItem;
62616373 private MenuItem morphItem;
62626374 private MenuItem linkerItem;
6263
- private MenuItem ungroupItem;
6375
+ private JMenuItem ungroupItem;
62646376 private MenuItem editItem;
62656377 private MenuItem openWindowItem;
62666378 private MenuItem editLeafItem;