Normand Briere
2019-08-15 24a2a946b35279605e645349bd6b82e9e60aac88
GroupEditor.java
....@@ -16,7 +16,7 @@
1616 //import buoy.widget.BFileChooser;
1717
1818 class GroupEditor extends ObjEditor implements //iParse, //iCallBack,
19
- Grafreed.iResourceCallBack,
19
+ Grafreed.iResourceCallBack,
2020 ObjectUI,
2121 Runnable,
2222 ActionListener,
....@@ -31,7 +31,7 @@
3131 final String path = "cubemaps/" + f + "-skyboxes/" + s;
3232 row.add(skyboxButton = GetButton(path + "/preview.jpg", !Grafreed.NIMBUSLAF));
3333 //row.add(skyboxButton = GetButton(path + "/negx.jpg", !Grafreed.NIMBUSLAF));
34
- skyboxButton.setToolTipText(s);
34
+ skyboxButton.setToolTipText(s.equals("") ? "No background" : s);
3535 skyboxButton.addActionListener(new ActionListener()
3636 {
3737 @Override
....@@ -42,6 +42,22 @@
4242 });
4343 }
4444
45
+ public void AddTextureButton(String f, String c, final String t, int count, cGridBag row)
46
+ {
47
+ cButton textureButton;
48
+ final String path = "textures/" + f + "/" + c + "/"; // + t;
49
+ row.add(textureButton = GetButton(path + "icons/" + t, !Grafreed.NIMBUSLAF));
50
+ textureButton.setToolTipText(c + count);
51
+ textureButton.addActionListener(new ActionListener()
52
+ {
53
+ @Override
54
+ public void actionPerformed(ActionEvent e)
55
+ {
56
+ ChangeTexture(path + t);
57
+ }
58
+ });
59
+ }
60
+
4561 public void AddSkyboxTab0(JTabbedPane skyboxpanel)
4662 {
4763 cGridBag tab0 = new cGridBag().setVertical(true);
....@@ -57,7 +73,7 @@
5773 cGridBag row5 = new cGridBag();
5874 cGridBag row6 = new cGridBag();
5975
60
- AddSkyboxButton("default", "rgb", row0);
76
+ AddSkyboxButton("default", "", row0);
6177 //AddSkyboxButton("default", "cornell", row0);
6278 AddSkyboxButton("penguins", "dust", row0);
6379 AddSkyboxButton("penguins", "tropic", row0);
....@@ -312,26 +328,56 @@
312328 }
313329 }
314330
315
- public void CallBack(String[] path)
316
- {
317
- for (int i = 0; i < path.length; i++)
318
- {
319
- System.out.print(path[i] + "/");
320
- }
321
-
322
- System.out.println();
323
- }
324
-
325331 public void ChangeSkybox(String skybox)
326332 {
327
- //cameraView.envyoff = false;
328
- group.skyboxname = skybox;
329
- group.skyboxext = "jpg";
330
- cameraView.repaint();
333
+ if (skybox.endsWith("/"))
334
+ {
335
+ group.skyboxname = null;
336
+ group.skyboxext = null;
337
+ cameraView.repaint();
338
+ }
339
+ else
340
+ {
341
+ //cameraView.envyoff = false;
342
+ group.skyboxname = skybox;
343
+ group.skyboxext = "jpg";
344
+ cameraView.repaint();
345
+ }
346
+ }
331347
332
- Grafreed.ParseResources("textures", this);
348
+ public void CreateSkyboxPanel(cGridBag skyboxPanel)
349
+ {
350
+ JTabbedPane skyboxpane = new JTabbedPane();
351
+
352
+ AddSkyboxTab0(skyboxpane);
353
+ AddSkyboxTab1(skyboxpane);
354
+ AddSkyboxTab2(skyboxpane);
355
+ AddSkyboxTab3(skyboxpane);
356
+
357
+ skyboxPanel.add(skyboxpane);
333358 }
334359
360
+ public void ChangeTexture(String texture)
361
+ {
362
+ for (int i=0; i<group.selection.size(); i++)
363
+ {
364
+ Object3D obj = group.selection.get(i);
365
+ obj.SetPigmentTexture("@" + texture);
366
+ }
367
+
368
+ refreshContents();
369
+ }
370
+
371
+ public void Show3DView()
372
+ {
373
+ // bug
374
+ //gridPanel.setDividerLocation(1.0);
375
+ //bigPanel.setDividerLocation(0.0);
376
+ bigThree.ClearUI();
377
+ bigThree.add(centralPanel);
378
+ bigThree.FlushUI();
379
+ }
380
+
335381 //ObjEditor objEditor;
336382 public void closeUI2()
337383 {
....@@ -373,6 +419,8 @@
373419 {
374420 copy.versionlist = new Object3D[100];
375421 copy.versionindex = -1;
422
+
423
+ Save(true);
376424 }
377425
378426 if(ui)
....@@ -492,32 +540,37 @@
492540 // menu.add("-");
493541 duplicateItem = oe.jTree.popup.add(new JMenuItem("Duplicate"));
494542 duplicateItem.addActionListener(this);
495
- cloneItem = menu.add(new MenuItem("Clone"));
543
+
544
+ cloneItem = oe.jTree.popup.add(new JMenuItem("Clone"));
496545 cloneItem.addActionListener(this);
497
- if (Globals.ADVANCED)
546
+ //if (Globals.ADVANCED)
498547 {
499548 cloneSupportItem = menu.add(new MenuItem("Clone (+supports)"));
500549 cloneSupportItem.addActionListener(this);
501550 }
551
+ oe.jTree.popup.addSeparator();
502552 menu.add("-");
503
- cutItem = menu.add(new MenuItem("Cut"));
553
+ cutItem = oe.jTree.popup.add(new JMenuItem("Cut"));
504554 cutItem.addActionListener(this);
505
- copyItem = menu.add(new MenuItem("Copy"));
555
+ copyItem = oe.jTree.popup.add(new JMenuItem("Copy"));
506556 copyItem.addActionListener(this);
507557 pasteItem = menu.add(new MenuItem("Paste"));
508558 pasteItem.addActionListener(this);
509559
510
- menu.add("-");
511
- pasteIntoItem = menu.add(new MenuItem("Paste into"));
560
+ oe.jTree.popup.addSeparator();
561
+ //menu.add("-");
562
+ pasteIntoItem = oe.jTree.popup.add(new JMenuItem("Paste into"));
512563 pasteIntoItem.addActionListener(this);
513
- pasteLinkItem = menu.add(new MenuItem("Paste link"));
564
+ pasteLinkItem = oe.jTree.popup.add(new JMenuItem("Paste link"));
514565 pasteLinkItem.addActionListener(this);
515
- pasteCloneItem = menu.add(new MenuItem("Paste clone"));
566
+ pasteCloneItem = oe.jTree.popup.add(new JMenuItem("Paste clone"));
516567 pasteCloneItem.addActionListener(this);
517
-// pasteExpandItem = menu.add(new MenuItem("Paste expand"));
568
+// CRASH pasteExpandItem = oe.jTree.popup.add(new JMenuItem("Paste expand"));
518569 // pasteExpandItem.addActionListener(this);
519
- menu.add("-");
520
- deleteItem = menu.add(new MenuItem("Delete"));
570
+ //menu.add("-");
571
+ oe.jTree.popup.addSeparator();
572
+
573
+ deleteItem = oe.jTree.popup.add(new JMenuItem("Delete"));
521574 deleteItem.addActionListener(this);
522575
523576 if (Globals.ADVANCED)
....@@ -604,11 +657,9 @@
604657 oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest"));
605658 //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection"));
606659 //cameraMenu.add(switchViewItem = new MenuItem("Reverse View"));
607
- editLeafItem = oe.cameraMenu.add(new MenuItem("Edit Leaf"));
608660 oe.cameraMenu.add("-");
609661 openWindowItem = oe.cameraMenu.add(new MenuItem("Edit copy..."));
610662 openWindowItem.addActionListener(this);
611
- editLeafItem.addActionListener(this);
612663 lookAtItem.addActionListener(this);
613664 //lookFromItem.addActinoListener(this);
614665 //switchViewItem.addActionListener(this);
....@@ -670,7 +721,7 @@
670721 hideItem = menu.add(new MenuItem("Hidden Group"));
671722 hideItem.addActionListener(this);
672723 }
673
- ungroupItem = menu.add(new MenuItem("Ungroup"));
724
+ ungroupItem = oe.jTree.popup.add(new JMenuItem("Ungroup"));
674725 ungroupItem.addActionListener(this);
675726
676727 // menu.add("-");
....@@ -856,6 +907,9 @@
856907 shareGeometriesItem.addActionListener(this);
857908 mergeGeometriesItem = menu.add(new MenuItem("Merge Geometries"));
858909 mergeGeometriesItem.addActionListener(this);
910
+ menu.add("-");
911
+ editLeafItem = menu.add(new MenuItem("Edit leaf..."));
912
+ editLeafItem.addActionListener(this);
859913 if (Globals.ADVANCED)
860914 {
861915 // Pretty much the same as duplicate and clone.
....@@ -872,6 +926,74 @@
872926 buildToolsMenu(menu);
873927 }
874928
929
+ JTabbedPane resourcecontainer;
930
+ cGridBag currenttab;
931
+ //boolean added; // patch for jar
932
+
933
+ int tabcount = 0;
934
+ int colcount = 0;
935
+ int rowcount = 0;
936
+ int texturecount = 0;
937
+
938
+ int columns = 5;
939
+ int rows = 7;
940
+
941
+ public void ResourceCallBack(String[] path)
942
+ {
943
+// for (int i = 0; i < path.length; i++)
944
+// System.out.print(path[i] + "/");
945
+// System.out.println();
946
+
947
+ if (//rowcount == 0 ||
948
+ path.length == 1 && !path[0].equals("") && !path[0].equals(".DS_Store"))
949
+ {
950
+ currenttab = new cGridBag();
951
+ String tabname = path[0]; // String.valueOf((char)('A'+tabcount));
952
+ currenttab.setName(tabname);
953
+ //added = false;
954
+ resourcecontainer.add(currenttab);
955
+ resourcecontainer.setToolTipTextAt(tabcount++, "Texture Group " + tabname);
956
+ rowcount = 1;
957
+ colcount = 0;
958
+ texturecount = 0;
959
+ }
960
+
961
+ if (path.length > 2 && path[2].toLowerCase().endsWith(".jpg"))
962
+ {
963
+ //if (!added)
964
+ {
965
+ //added = true;
966
+ String tabname = path[0]; // String.valueOf((char)('A'+tabcount));
967
+ currenttab = (cGridBag)resourcecontainer.getComponentAt(resourcecontainer.indexOfTab(tabname));
968
+ }
969
+
970
+ AddTextureButton(path[0], path[1], path[2], texturecount++, currenttab);
971
+
972
+ if (++colcount >= columns)
973
+ {
974
+ colcount = 0;
975
+ currenttab.Return();
976
+
977
+ if (rowcount++ >= rows)
978
+ {
979
+ rowcount = 0;
980
+ }
981
+ }
982
+ }
983
+ else
984
+ {
985
+// if (!path[path.length-1].equals("icons"))
986
+// resourcecontainer.Return();
987
+ }
988
+ }
989
+
990
+ void CreateTexturePanel(cGridBag container)
991
+ {
992
+ resourcecontainer = new JTabbedPane(JTabbedPane.LEFT);
993
+ container.add(resourcecontainer);
994
+
995
+ Grafreed.ParseResources("textures", this);
996
+ }
875997
876998 void SetupUI2(ObjEditor oe)
877999 {
....@@ -890,11 +1012,6 @@
8901012 //new Exception().printStackTrace();
8911013
8921014 oe.radioPanel = new JPanel(new GridBagLayout());
893
- oe.aConstraints.weightx = 1;
894
- oe.aConstraints.weighty = 0;
895
- oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
896
- oe.aConstraints.gridwidth = 100;
897
- oe.aConstraints.gridheight = 1;
8981015 // oe.toolbarPanel.add(radioPanel); //, oe.aConstraints);
8991016
9001017 oe.buttonGroup = new ButtonGroup();
....@@ -927,10 +1044,49 @@
9271044
9281045 if (Globals.ADVANCED)
9291046 {
930
- oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
931
- maxButton.setToolTipText("Maximize window");
932
- maxButton.addActionListener(this);
1047
+// oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1048
+// maxButton.setToolTipText("Maximize window");
1049
+// maxButton.addActionListener(this);
9331050 }
1051
+
1052
+ cButton gcButton;
1053
+
1054
+// oe.toolbarPanel.add(gcButton = GetButton("icons/trash.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1055
+// gcButton.setToolTipText("Garbage collect");
1056
+// gcButton.addActionListener(new ActionListener()
1057
+// {
1058
+// public void actionPerformed(ActionEvent e)
1059
+// {
1060
+// System.gc();
1061
+// }
1062
+// });
1063
+
1064
+ oe.toolbarPanel.add(collapseButton = GetButton("icons/collapse.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1065
+ collapseButton.setToolTipText("Collapse toolbar");
1066
+ collapseButton.addActionListener(this);
1067
+
1068
+ oe.toolbarPanel.add(maximize3DButton = GetButton("", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1069
+ maximize3DButton.setToolTipText("Maximize 3D view");
1070
+ maximize3DButton.addActionListener(this);
1071
+
1072
+ oe.toolbarPanel.add(twoButton = GetButton("icons/cube.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1073
+ twoButton.setToolTipText("Show 3D view only");
1074
+ twoButton.addActionListener(this);
1075
+ this.fullscreenLayout = twoButton;
1076
+
1077
+ oe.toolbarPanel.add(threeButton = GetButton("icons/controlsview.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1078
+ threeButton.setToolTipText("Show controls and 3D view");
1079
+ threeButton.addActionListener(this);
1080
+ if (Globals.ADVANCED)
1081
+ {
1082
+ oe.toolbarPanel.add(sixButton = GetButton("icons/viewcontrols.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1083
+ sixButton.setToolTipText("Show 3D view and controls");
1084
+ sixButton.addActionListener(this);
1085
+ }
1086
+// oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1087
+// sevenButton.setToolTipText("3-column layout");
1088
+// sevenButton.addActionListener(this);
1089
+ //
9341090
9351091 oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
9361092 fullButton.setToolTipText("Full-screen window");
....@@ -975,14 +1131,14 @@
9751131 nextVersionButton.addActionListener(this);
9761132 nextVersionButton.setEnabled(false);
9771133
978
- oe.toolbarPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
979
- liveCB.setToolTipText("Enable animation");
980
- liveCB.addItemListener(this);
981
-
9821134 oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
9831135 oneStepButton.setToolTipText("Animate one step forward");
9841136 oneStepButton.addActionListener(this);
9851137
1138
+ oe.toolbarPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
1139
+ liveCB.setToolTipText("Enable animation");
1140
+ liveCB.addItemListener(this);
1141
+
9861142 oe.toolbarPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
9871143 fastCB.setToolTipText("Fast mode");
9881144 fastCB.addItemListener(this);
....@@ -1009,21 +1165,6 @@
10091165
10101166 //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
10111167
1012
- oe.toolbarPanel.add(twoButton = GetButton("icons/cube.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1013
- twoButton.setToolTipText("Show 3D view only");
1014
- twoButton.addActionListener(this);
1015
- this.fullscreenLayout = twoButton;
1016
-
1017
- oe.toolbarPanel.add(threeButton = GetButton("icons/controlsview.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1018
- threeButton.setToolTipText("Show controls and 3D view");
1019
- threeButton.addActionListener(this);
1020
- oe.toolbarPanel.add(sixButton = GetButton("icons/viewcontrols.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1021
- sixButton.setToolTipText("Show 3D view and controls");
1022
- sixButton.addActionListener(this);
1023
-// oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1024
-// sevenButton.setToolTipText("3-column layout");
1025
-// sevenButton.addActionListener(this);
1026
- //
10271168
10281169 oe.toolbarPanel.add(rootButton = GetButton("icons/openwindow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
10291170 rootButton.setToolTipText("Open selection in new tab");
....@@ -1039,7 +1180,7 @@
10391180
10401181 // INSERT
10411182 row1.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1042
- gridButton.setToolTipText("Create grid");
1183
+ gridButton.setToolTipText("Create ground");
10431184 gridButton.addActionListener(this);
10441185
10451186 row1.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
....@@ -1107,19 +1248,15 @@
11071248
11081249 oe.toolboxPanel.add(row2);
11091250
1110
- // ENVYMAPS
1111
- cGridBag skyboxpane = new cGridBag();
1112
- skyboxpane.preferredHeight = 100;
1251
+ cGridBag textures = new cGridBag();
11131252
1114
- oe.skyboxPanel.add(skyboxpane);
1253
+ CreateTexturePanel(textures);
11151254
1116
- JTabbedPane skyboxpanel = new JTabbedPane();
1117
- skyboxpane.add(skyboxpanel);
1255
+ oe.toolboxPanel.add(textures);
11181256
1119
- AddSkyboxTab0(skyboxpanel);
1120
- AddSkyboxTab1(skyboxpanel);
1121
- AddSkyboxTab2(skyboxpanel);
1122
- AddSkyboxTab3(skyboxpanel);
1257
+ textures.preferredHeight = 100;
1258
+
1259
+ CreateSkyboxPanel(oe.skyboxPanel);
11231260
11241261 // EDIT panel
11251262 editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
....@@ -1131,11 +1268,11 @@
11311268 uneditButton.addActionListener(this);
11321269
11331270 editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
1134
- allParamsButton.setToolTipText("Show all controle");
1271
+ allParamsButton.setToolTipText("Show all controls");
11351272 allParamsButton.addActionListener(this);
11361273
11371274 editCommandsPanel.add(clearPanelButton = GetButton("icons/clear.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1138
- clearPanelButton.setToolTipText("Clear edit panel");
1275
+ clearPanelButton.setToolTipText("Clear all controls");
11391276 clearPanelButton.addActionListener(this);
11401277
11411278 //editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
....@@ -1335,6 +1472,14 @@
13351472
13361473 void EditObject(Object3D obj)
13371474 {
1475
+ assert(obj instanceof Composite);
1476
+
1477
+// if (obj.versionlist == null)
1478
+// {
1479
+// obj.versionlist = new Object3D[100];
1480
+// obj.versionindex = -1;
1481
+// }
1482
+
13381483 cRadio radioButton = new cRadio(obj.name);
13391484
13401485 // June 2019. Patch to avoid bug with transparency.
....@@ -1725,7 +1870,12 @@
17251870 TreePath path;
17261871
17271872 public TransferableTreePath(TreePath tp) {
1728
- path = tp;
1873
+ Object[] objs = new Object[tp.getPathCount()];
1874
+ for (int i=0; i<objs.length; i++)
1875
+ {
1876
+ objs[i] = ((Object3D)tp.getPathComponent(i)).GetUUID();
1877
+ }
1878
+ path = new TreePath(objs);
17291879 }
17301880
17311881 public synchronized DataFlavor[] getTransferDataFlavors() {
....@@ -2536,27 +2686,35 @@
25362686 } else
25372687 if (source == loopItem || source == loopButton)
25382688 {
2689
+ if (!group.selection.isEmpty())
2690
+ {
25392691 Composite csg = new GroupLeaf();
25402692 csg.count = 5;
2541
- group(csg);
25422693 Composite child = new cGroup("Branch");
25432694 csg.addChild(child);
25442695 child.addChild(csg);
2696
+ group(csg);
2697
+ }
25452698 } else
25462699 if (source == doubleItem)
25472700 {
2701
+ if (!group.selection.isEmpty())
2702
+ {
25482703 Composite csg = new GroupLeaf("Fork");
25492704 csg.count = 5;
2550
- group(csg);
25512705 Composite child = new cGroup("Branch A");
25522706 csg.addChild(child);
25532707 child.addChild(csg);
25542708 child = new cGroup("Branch B");
25552709 csg.addChild(child);
25562710 child.addChild(csg);
2711
+ group(csg);
2712
+ }
25572713 } else
25582714 if (source == tripleItem)
25592715 {
2716
+ if (!group.selection.isEmpty())
2717
+ {
25602718 Composite csg = new GroupLeaf("Trident");
25612719 csg.count = 4;
25622720 group(csg);
....@@ -2569,6 +2727,7 @@
25692727 child = new cGroup();
25702728 csg.addChild(child);
25712729 child.addChild(csg);
2730
+ }
25722731 } else
25732732 if (source == computeAOItem)
25742733 {
....@@ -2618,6 +2777,18 @@
26182777 if (source == fullButton)
26192778 {
26202779 ToggleFullScreen();
2780
+ } else
2781
+ if (source == collapseButton)
2782
+ {
2783
+ this.expandedLayout = radio.layout;
2784
+ CollapseToolbar();
2785
+ } else
2786
+ if (source == maximize3DButton)
2787
+ {
2788
+ this.expandedLayout = radio.layout;
2789
+ radio.layout = twoButton;
2790
+ Show3DView();
2791
+ CollapseToolbar();
26212792 } else
26222793 if (source == previousVersionButton)
26232794 {
....@@ -3192,22 +3363,34 @@
31923363 } else
31933364 if (source == ungroupItem || source == ungroupButton)
31943365 {
3195
- boolean hasRoot = false;
3366
+ boolean canUngroup = true;
31963367
31973368 for (int i=0; i<group.selection.size(); i++)
31983369 {
3199
- if (group.selection.get(i) == group)
3370
+ Object3D selectedItem = group.selection.get(i);
3371
+
3372
+ if (selectedItem.Size() == 0)
32003373 {
3201
- hasRoot = true;
3374
+ // Cannot ungroup leaves
3375
+ canUngroup = false;
3376
+ break;
3377
+ }
3378
+
3379
+ if (selectedItem == group)
3380
+ {
3381
+ // Cannot ungroup root
3382
+ canUngroup = false;
32023383 break;
32033384 }
32043385 }
32053386
3206
- if (!hasRoot)
3387
+ if (canUngroup)
32073388 {
32083389 for (int i=0; i<group.selection.size(); i++)
32093390 {
3210
- Ungroup(group.selection.get(i));
3391
+ Object3D selectedItem = group.selection.get(i);
3392
+
3393
+ Ungroup(selectedItem);
32113394 }
32123395
32133396 ClearSelection(false);
....@@ -3570,38 +3753,7 @@
35703753 if (CameraPane.FULLSCREEN)
35713754 fullscreenLayout = radio.layout;
35723755
3573
- // bug
3574
- //gridPanel.setDividerLocation(1.0);
3575
- //bigPanel.setDividerLocation(0.0);
3576
-// bigThree.remove(scenePanel);
3577
-// bigThree.remove(centralPanel);
3578
-// bigThree.remove(XYZPanel);
3579
-// aWindowConstraints.gridx = 0;
3580
-// aWindowConstraints.gridy = 0;
3581
-// aWindowConstraints.gridwidth = 1;
3582
-// // aConstraints.gridheight = 3;
3583
-// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3584
-// aWindowConstraints.weightx = 0;
3585
-// aWindowConstraints.weighty = 1;
3586
-// //bigThree.add(jtp, aWindowConstraints);
3587
-// aWindowConstraints.weightx = 1;
3588
-// aWindowConstraints.gridwidth = 3;
3589
-// // aConstraints.gridheight = 3;
3590
-// aWindowConstraints.gridx = 1;
3591
-// aWindowConstraints.fill = GridBagConstraints.BOTH;
3592
-// bigThree.add(centralPanel, aWindowConstraints);
3593
-// aWindowConstraints.weightx = 0;
3594
-// aWindowConstraints.gridx = 4;
3595
-// aWindowConstraints.gridwidth = 1;
3596
-// // aConstraints.gridheight = 3;
3597
-// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3598
-// //bigThree.add(XYZPanel, aWindowConstraints);
3599
-// scenePanel.setVisible(false);
3600
-// centralPanel.setVisible(true);
3601
-// XYZPanel.setVisible(false);
3602
- bigThree.ClearUI();
3603
- bigThree.add(centralPanel);
3604
- bigThree.FlushUI();
3756
+ Show3DView();
36053757
36063758 cameraView.requestFocusInWindow();
36073759
....@@ -3787,6 +3939,7 @@
37873939 } else
37883940 if (source == rootButton)
37893941 {
3942
+ Replace();
37903943 Object3D obj;
37913944 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
37923945 {
....@@ -3923,8 +4076,6 @@
39234076
39244077 copy = group;
39254078
3926
- SetUndoStates();
3927
-
39284079 //Globals.theRenderer.object = group;
39294080 if(!useclient)
39304081 {
....@@ -3952,6 +4103,18 @@
39524103 */
39534104 radio.layout.doClick();
39544105
4106
+ assert(copy instanceof Composite);
4107
+
4108
+ if (copy.versionlist == null)
4109
+ {
4110
+ copy.versionlist = new Object3D[100];
4111
+ copy.versionindex = -1;
4112
+
4113
+ Save(true);
4114
+ }
4115
+
4116
+ SetVersionStates();
4117
+
39554118 ClearUnpinned();
39564119
39574120 //Grafreed.Assert(group != null);
....@@ -5186,6 +5349,20 @@
51865349 flashSelectionButton.setEnabled(enabled);
51875350
51885351 clearPanelButton.setEnabled(!listUI.isEmpty());
5352
+
5353
+ boolean allComposites = true;
5354
+
5355
+ if (group.selection != null)
5356
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
5357
+ {
5358
+ if (!(e.nextElement() instanceof Composite))
5359
+ {
5360
+ allComposites = false;
5361
+ break;
5362
+ }
5363
+ }
5364
+
5365
+ rootButton.setEnabled(allComposites);
51895366 }
51905367
51915368 void refreshContents(boolean cp)
....@@ -5200,7 +5377,7 @@
52005377 Object3D child = (Object3D) group.selection.get(i);
52015378
52025379 objEditor.AddInfo(child, this, true);
5203
- System.err.println("info : " + child.GetPath());
5380
+// System.err.println("info : " + child.GetPath());
52045381 }
52055382
52065383 objEditor.SetText(); // jan 2014
....@@ -6083,11 +6260,11 @@
60836260 private MenuItem lookAtItem;
60846261 private MenuItem lookFromItem;
60856262 private MenuItem switchViewItem;
6086
- private MenuItem cutItem;
6263
+ private JMenuItem cutItem;
60876264 private MenuItem undoItem;
60886265 private MenuItem redoItem;
60896266 private JMenuItem duplicateItem;
6090
- private MenuItem cloneItem;
6267
+ private JMenuItem cloneItem;
60916268 private MenuItem cloneSupportItem;
60926269 private MenuItem overwriteGeoItem;
60936270 private MenuItem overwriteMatItem;
....@@ -6108,13 +6285,13 @@
61086285 private MenuItem cloneGeometriesItem;
61096286 private MenuItem shareGeometriesItem;
61106287 private MenuItem mergeGeometriesItem;
6111
- private MenuItem copyItem;
6288
+ private JMenuItem copyItem;
61126289 private MenuItem pasteItem;
6113
- private MenuItem pasteIntoItem;
6114
- private MenuItem pasteLinkItem;
6115
- private MenuItem pasteCloneItem;
6116
- private MenuItem pasteExpandItem;
6117
- private MenuItem deleteItem;
6290
+ private JMenuItem pasteIntoItem;
6291
+ private JMenuItem pasteLinkItem;
6292
+ private JMenuItem pasteCloneItem;
6293
+ private JMenuItem pasteExpandItem;
6294
+ private JMenuItem deleteItem;
61186295 private MenuItem clearAllItem;
61196296 private MenuItem genUVItem;
61206297 private MenuItem genNormalsMESHItem;
....@@ -6182,7 +6359,7 @@
61826359 private MenuItem switchTransfoItem;
61836360 private MenuItem morphItem;
61846361 private MenuItem linkerItem;
6185
- private MenuItem ungroupItem;
6362
+ private JMenuItem ungroupItem;
61866363 private MenuItem editItem;
61876364 private MenuItem openWindowItem;
61886365 private MenuItem editLeafItem;