Normand Briere
2019-08-16 64e20f390e4b8e58bd0006dde8fa10fba1dac1d5
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,33 +540,35 @@
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"));
521
- deleteItem.addActionListener(this);
570
+ //menu.add("-");
571
+ oe.jTree.popup.addSeparator();
522572
523573 if (Globals.ADVANCED)
524574 {
....@@ -604,11 +654,9 @@
604654 oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest"));
605655 //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection"));
606656 //cameraMenu.add(switchViewItem = new MenuItem("Reverse View"));
607
- editLeafItem = oe.cameraMenu.add(new MenuItem("Edit Leaf"));
608657 oe.cameraMenu.add("-");
609658 openWindowItem = oe.cameraMenu.add(new MenuItem("Edit copy..."));
610659 openWindowItem.addActionListener(this);
611
- editLeafItem.addActionListener(this);
612660 lookAtItem.addActionListener(this);
613661 //lookFromItem.addActinoListener(this);
614662 //switchViewItem.addActionListener(this);
....@@ -655,9 +703,8 @@
655703 setMasterItem.addActionListener(this);
656704 }
657705
658
- oe.menuBar.add(menu = new Menu("Group"));
659
-// grabItem = menu.add(new MenuItem("Grab"));
660
-// grabItem.addActionListener(this);
706
+ oe.menuBar.add(menu = new Menu("Order"));
707
+
661708 backItem = menu.add(new MenuItem("Back"));
662709 backItem.addActionListener(this);
663710 frontItem = menu.add(new MenuItem("Front"));
....@@ -665,13 +712,21 @@
665712 // compositeItem = menu.add(new MenuItem("Composite"));
666713 // compositeItem.addActionListener(this);
667714
715
+ grabItem = oe.jTree.popup.add(new JMenuItem("Group"));
716
+ grabItem.addActionListener(this);
717
+
668718 if (Globals.ADVANCED)
669719 {
670720 hideItem = menu.add(new MenuItem("Hidden Group"));
671721 hideItem.addActionListener(this);
672722 }
673
- ungroupItem = menu.add(new MenuItem("Ungroup"));
723
+ ungroupItem = oe.jTree.popup.add(new JMenuItem("Ungroup"));
674724 ungroupItem.addActionListener(this);
725
+
726
+ oe.jTree.popup.addSeparator();
727
+
728
+ deleteItem = oe.jTree.popup.add(new JMenuItem("Delete"));
729
+ deleteItem.addActionListener(this);
675730
676731 // menu.add("-");
677732 //
....@@ -856,6 +911,9 @@
856911 shareGeometriesItem.addActionListener(this);
857912 mergeGeometriesItem = menu.add(new MenuItem("Merge Geometries"));
858913 mergeGeometriesItem.addActionListener(this);
914
+ menu.add("-");
915
+ editLeafItem = menu.add(new MenuItem("Edit leaf..."));
916
+ editLeafItem.addActionListener(this);
859917 if (Globals.ADVANCED)
860918 {
861919 // Pretty much the same as duplicate and clone.
....@@ -872,6 +930,74 @@
872930 buildToolsMenu(menu);
873931 }
874932
933
+ JTabbedPane resourcecontainer;
934
+ cGridBag currenttab;
935
+ //boolean added; // patch for jar
936
+
937
+ int tabcount = 0;
938
+ int colcount = 0;
939
+ int rowcount = 0;
940
+ int texturecount = 0;
941
+
942
+ int columns = 5;
943
+ int rows = 7;
944
+
945
+ public void ResourceCallBack(String[] path)
946
+ {
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"))
953
+ {
954
+ currenttab = new cGridBag();
955
+ String tabname = path[0]; // String.valueOf((char)('A'+tabcount));
956
+ currenttab.setName(tabname);
957
+ //added = false;
958
+ resourcecontainer.add(currenttab);
959
+ resourcecontainer.setToolTipTextAt(tabcount++, "Texture Group " + tabname);
960
+ rowcount = 1;
961
+ colcount = 0;
962
+ texturecount = 0;
963
+ }
964
+
965
+ if (path.length > 2 && path[2].toLowerCase().endsWith(".jpg"))
966
+ {
967
+ //if (!added)
968
+ {
969
+ //added = true;
970
+ String tabname = path[0]; // String.valueOf((char)('A'+tabcount));
971
+ currenttab = (cGridBag)resourcecontainer.getComponentAt(resourcecontainer.indexOfTab(tabname));
972
+ }
973
+
974
+ AddTextureButton(path[0], path[1], path[2], texturecount++, currenttab);
975
+
976
+ if (++colcount >= columns)
977
+ {
978
+ colcount = 0;
979
+ currenttab.Return();
980
+
981
+ if (rowcount++ >= rows)
982
+ {
983
+ rowcount = 0;
984
+ }
985
+ }
986
+ }
987
+ else
988
+ {
989
+// if (!path[path.length-1].equals("icons"))
990
+// resourcecontainer.Return();
991
+ }
992
+ }
993
+
994
+ void CreateTexturePanel(cGridBag container)
995
+ {
996
+ resourcecontainer = new JTabbedPane(JTabbedPane.LEFT);
997
+ container.add(resourcecontainer);
998
+
999
+ Grafreed.ParseResources("textures", this);
1000
+ }
8751001
8761002 void SetupUI2(ObjEditor oe)
8771003 {
....@@ -890,11 +1016,6 @@
8901016 //new Exception().printStackTrace();
8911017
8921018 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;
8981019 // oe.toolbarPanel.add(radioPanel); //, oe.aConstraints);
8991020
9001021 oe.buttonGroup = new ButtonGroup();
....@@ -927,10 +1048,49 @@
9271048
9281049 if (Globals.ADVANCED)
9291050 {
930
- oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
931
- maxButton.setToolTipText("Maximize window");
932
- 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);
9331054 }
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
+ //
9341094
9351095 oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
9361096 fullButton.setToolTipText("Full-screen window");
....@@ -975,14 +1135,14 @@
9751135 nextVersionButton.addActionListener(this);
9761136 nextVersionButton.setEnabled(false);
9771137
978
- oe.toolbarPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
979
- liveCB.setToolTipText("Enable animation");
980
- liveCB.addItemListener(this);
981
-
9821138 oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
9831139 oneStepButton.setToolTipText("Animate one step forward");
9841140 oneStepButton.addActionListener(this);
9851141
1142
+ oe.toolbarPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
1143
+ liveCB.setToolTipText("Enable animation");
1144
+ liveCB.addItemListener(this);
1145
+
9861146 oe.toolbarPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
9871147 fastCB.setToolTipText("Fast mode");
9881148 fastCB.addItemListener(this);
....@@ -1009,21 +1169,6 @@
10091169
10101170 //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
10111171
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
- //
10271172
10281173 oe.toolbarPanel.add(rootButton = GetButton("icons/openwindow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
10291174 rootButton.setToolTipText("Open selection in new tab");
....@@ -1039,12 +1184,16 @@
10391184
10401185 // INSERT
10411186 row1.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1042
- gridButton.setToolTipText("Create grid");
1187
+ gridButton.setToolTipText("Create ground");
10431188 gridButton.addActionListener(this);
10441189
10451190 row1.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
10461191 boxButton.setToolTipText("Create box");
10471192 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);
10481197
10491198 row1.add(sphereButton = GetButton("icons/sphere.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
10501199 sphereButton.setToolTipText("Create sphere");
....@@ -1057,10 +1206,6 @@
10571206 row1.add(torusButton = GetButton("icons/torus.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
10581207 torusButton.setToolTipText("Create torus");
10591208 torusButton.addActionListener(this);
1060
-
1061
- row1.add(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1062
- superButton.setToolTipText("Create superellipsoid");
1063
- superButton.addActionListener(this);
10641209
10651210 if (Globals.ADVANCED)
10661211 {
....@@ -1107,19 +1252,15 @@
11071252
11081253 oe.toolboxPanel.add(row2);
11091254
1110
- // ENVYMAPS
1111
- cGridBag skyboxpane = new cGridBag();
1112
- skyboxpane.preferredHeight = 100;
1255
+ cGridBag textures = new cGridBag();
11131256
1114
- oe.toolboxPanel.add(skyboxpane);
1257
+ CreateTexturePanel(textures);
11151258
1116
- JTabbedPane skyboxpanel = new JTabbedPane();
1117
- skyboxpane.add(skyboxpanel);
1259
+ oe.toolboxPanel.add(textures);
11181260
1119
- AddSkyboxTab0(skyboxpanel);
1120
- AddSkyboxTab1(skyboxpanel);
1121
- AddSkyboxTab2(skyboxpanel);
1122
- AddSkyboxTab3(skyboxpanel);
1261
+ textures.preferredHeight = 100;
1262
+
1263
+ CreateSkyboxPanel(oe.skyboxPanel);
11231264
11241265 // EDIT panel
11251266 editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
....@@ -1131,16 +1272,16 @@
11311272 uneditButton.addActionListener(this);
11321273
11331274 editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
1134
- allParamsButton.setToolTipText("Show all controle");
1275
+ allParamsButton.setToolTipText("Show all controls");
11351276 allParamsButton.addActionListener(this);
11361277
11371278 editCommandsPanel.add(clearPanelButton = GetButton("icons/clear.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1138
- clearPanelButton.setToolTipText("Clear edit panel");
1279
+ clearPanelButton.setToolTipText("Clear all controls");
11391280 clearPanelButton.addActionListener(this);
11401281
1141
- editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1142
- unselectButton.setToolTipText("Unselect");
1143
- unselectButton.addActionListener(this);
1282
+ //editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1283
+ //unselectButton.setToolTipText("Unselect");
1284
+ //unselectButton.addActionListener(this);
11441285
11451286 editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
11461287 flashSelectionButton.setToolTipText("Highlight selection");
....@@ -1335,6 +1476,14 @@
13351476
13361477 void EditObject(Object3D obj)
13371478 {
1479
+ assert(obj instanceof Composite);
1480
+
1481
+// if (obj.versionlist == null)
1482
+// {
1483
+// obj.versionlist = new Object3D[100];
1484
+// obj.versionindex = -1;
1485
+// }
1486
+
13381487 cRadio radioButton = new cRadio(obj.name);
13391488
13401489 // June 2019. Patch to avoid bug with transparency.
....@@ -1359,6 +1508,7 @@
13591508
13601509 oe.SetupViews();
13611510
1511
+ if (Globals.DEBUG)
13621512 System.out.println("SetupViews");
13631513 DragSource.getDefaultDragSource().createDefaultDragGestureRecognizer(
13641514 oe.cameraView, DnDConstants.ACTION_COPY_OR_MOVE, this); // ACTION_LINK ??
....@@ -1725,7 +1875,12 @@
17251875 TreePath path;
17261876
17271877 public TransferableTreePath(TreePath tp) {
1728
- 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);
17291884 }
17301885
17311886 public synchronized DataFlavor[] getTransferDataFlavors() {
....@@ -2015,7 +2170,11 @@
20152170 shadow.material = new cMaterial(obj.material);
20162171 shadow.material.diffuse = 0.0001f;
20172172 shadow.material.specular = 0.0001f;
2018
- //shadow.projectedVertices[1].x = 300;
2173
+ shadow.material.opacity = 0.75f;
2174
+
2175
+ AllocProjectedVertices(shadow);
2176
+
2177
+ shadow.projectedVertices[1].x = 300;
20192178
20202179 makeSomething(shadow);
20212180 }
....@@ -2536,27 +2695,35 @@
25362695 } else
25372696 if (source == loopItem || source == loopButton)
25382697 {
2698
+ if (!group.selection.isEmpty())
2699
+ {
25392700 Composite csg = new GroupLeaf();
25402701 csg.count = 5;
2541
- group(csg);
25422702 Composite child = new cGroup("Branch");
25432703 csg.addChild(child);
25442704 child.addChild(csg);
2705
+ group(csg);
2706
+ }
25452707 } else
25462708 if (source == doubleItem)
25472709 {
2710
+ if (!group.selection.isEmpty())
2711
+ {
25482712 Composite csg = new GroupLeaf("Fork");
25492713 csg.count = 5;
2550
- group(csg);
25512714 Composite child = new cGroup("Branch A");
25522715 csg.addChild(child);
25532716 child.addChild(csg);
25542717 child = new cGroup("Branch B");
25552718 csg.addChild(child);
25562719 child.addChild(csg);
2720
+ group(csg);
2721
+ }
25572722 } else
25582723 if (source == tripleItem)
25592724 {
2725
+ if (!group.selection.isEmpty())
2726
+ {
25602727 Composite csg = new GroupLeaf("Trident");
25612728 csg.count = 4;
25622729 group(csg);
....@@ -2569,6 +2736,7 @@
25692736 child = new cGroup();
25702737 csg.addChild(child);
25712738 child.addChild(csg);
2739
+ }
25722740 } else
25732741 if (source == computeAOItem)
25742742 {
....@@ -2618,6 +2786,18 @@
26182786 if (source == fullButton)
26192787 {
26202788 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();
26212801 } else
26222802 if (source == previousVersionButton)
26232803 {
....@@ -3192,22 +3372,34 @@
31923372 } else
31933373 if (source == ungroupItem || source == ungroupButton)
31943374 {
3195
- boolean hasRoot = false;
3375
+ boolean canUngroup = true;
31963376
31973377 for (int i=0; i<group.selection.size(); i++)
31983378 {
3199
- if (group.selection.get(i) == group)
3379
+ Object3D selectedItem = group.selection.get(i);
3380
+
3381
+ if (selectedItem.Size() == 0)
32003382 {
3201
- 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;
32023392 break;
32033393 }
32043394 }
32053395
3206
- if (!hasRoot)
3396
+ if (canUngroup)
32073397 {
32083398 for (int i=0; i<group.selection.size(); i++)
32093399 {
3210
- Ungroup(group.selection.get(i));
3400
+ Object3D selectedItem = group.selection.get(i);
3401
+
3402
+ Ungroup(selectedItem);
32113403 }
32123404
32133405 ClearSelection(false);
....@@ -3570,38 +3762,7 @@
35703762 if (CameraPane.FULLSCREEN)
35713763 fullscreenLayout = radio.layout;
35723764
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();
3765
+ Show3DView();
36053766
36063767 cameraView.requestFocusInWindow();
36073768
....@@ -3787,6 +3948,7 @@
37873948 } else
37883949 if (source == rootButton)
37893950 {
3951
+ Replace();
37903952 Object3D obj;
37913953 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
37923954 {
....@@ -3923,8 +4085,6 @@
39234085
39244086 copy = group;
39254087
3926
- SetUndoStates();
3927
-
39284088 //Globals.theRenderer.object = group;
39294089 if(!useclient)
39304090 {
....@@ -3952,6 +4112,21 @@
39524112 */
39534113 radio.layout.doClick();
39544114
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
+
39554130 ClearUnpinned();
39564131
39574132 //Grafreed.Assert(group != null);
....@@ -5182,15 +5357,30 @@
51825357 {
51835358 editButton.setEnabled(enabled);
51845359 uneditButton.setEnabled(enabled);
5185
- unselectButton.setEnabled(enabled);
5360
+ //unselectButton.setEnabled(enabled);
51865361 flashSelectionButton.setEnabled(enabled);
51875362
51885363 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);
51895379 }
51905380
51915381 void refreshContents(boolean cp)
51925382 {
5193
- if (objectPanel.getSelectedIndex() == 2) // objectPanel.indexOfTab("Info"))
5383
+ //if (objectPanel.getSelectedIndex() == 2) // objectPanel.indexOfTab("Info"))
51945384 if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
51955385 {
51965386 objEditor.ClearInfo(); // .GetMaterial());
....@@ -5200,7 +5390,7 @@
52005390 Object3D child = (Object3D) group.selection.get(i);
52015391
52025392 objEditor.AddInfo(child, this, true);
5203
- System.err.println("info : " + child.GetPath());
5393
+// System.err.println("info : " + child.GetPath());
52045394 }
52055395
52065396 objEditor.SetText(); // jan 2014
....@@ -6083,11 +6273,11 @@
60836273 private MenuItem lookAtItem;
60846274 private MenuItem lookFromItem;
60856275 private MenuItem switchViewItem;
6086
- private MenuItem cutItem;
6276
+ private JMenuItem cutItem;
60876277 private MenuItem undoItem;
60886278 private MenuItem redoItem;
60896279 private JMenuItem duplicateItem;
6090
- private MenuItem cloneItem;
6280
+ private JMenuItem cloneItem;
60916281 private MenuItem cloneSupportItem;
60926282 private MenuItem overwriteGeoItem;
60936283 private MenuItem overwriteMatItem;
....@@ -6108,13 +6298,13 @@
61086298 private MenuItem cloneGeometriesItem;
61096299 private MenuItem shareGeometriesItem;
61106300 private MenuItem mergeGeometriesItem;
6111
- private MenuItem copyItem;
6301
+ private JMenuItem copyItem;
61126302 private MenuItem pasteItem;
6113
- private MenuItem pasteIntoItem;
6114
- private MenuItem pasteLinkItem;
6115
- private MenuItem pasteCloneItem;
6116
- private MenuItem pasteExpandItem;
6117
- private MenuItem deleteItem;
6303
+ private JMenuItem pasteIntoItem;
6304
+ private JMenuItem pasteLinkItem;
6305
+ private JMenuItem pasteCloneItem;
6306
+ private JMenuItem pasteExpandItem;
6307
+ private JMenuItem deleteItem;
61186308 private MenuItem clearAllItem;
61196309 private MenuItem genUVItem;
61206310 private MenuItem genNormalsMESHItem;
....@@ -6169,7 +6359,7 @@
61696359 private MenuItem transformGeometryItem;
61706360 private MenuItem transformChildrenItem;
61716361 private MenuItem hideItem;
6172
- private MenuItem grabItem;
6362
+ private JMenuItem grabItem;
61736363 private MenuItem backItem;
61746364 private MenuItem frontItem;
61756365 private MenuItem cameraItem;
....@@ -6182,7 +6372,7 @@
61826372 private MenuItem switchTransfoItem;
61836373 private MenuItem morphItem;
61846374 private MenuItem linkerItem;
6185
- private MenuItem ungroupItem;
6375
+ private JMenuItem ungroupItem;
61866376 private MenuItem editItem;
61876377 private MenuItem openWindowItem;
61886378 private MenuItem editLeafItem;