Normand Briere
2019-08-16 64e20f390e4b8e58bd0006dde8fa10fba1dac1d5
GroupEditor.java
....@@ -16,6 +16,7 @@
1616 //import buoy.widget.BFileChooser;
1717
1818 class GroupEditor extends ObjEditor implements //iParse, //iCallBack,
19
+ Grafreed.iResourceCallBack,
1920 ObjectUI,
2021 Runnable,
2122 ActionListener,
....@@ -30,7 +31,7 @@
3031 final String path = "cubemaps/" + f + "-skyboxes/" + s;
3132 row.add(skyboxButton = GetButton(path + "/preview.jpg", !Grafreed.NIMBUSLAF));
3233 //row.add(skyboxButton = GetButton(path + "/negx.jpg", !Grafreed.NIMBUSLAF));
33
- skyboxButton.setToolTipText(s);
34
+ skyboxButton.setToolTipText(s.equals("") ? "No background" : s);
3435 skyboxButton.addActionListener(new ActionListener()
3536 {
3637 @Override
....@@ -41,6 +42,22 @@
4142 });
4243 }
4344
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
+
4461 public void AddSkyboxTab0(JTabbedPane skyboxpanel)
4562 {
4663 cGridBag tab0 = new cGridBag().setVertical(true);
....@@ -56,7 +73,7 @@
5673 cGridBag row5 = new cGridBag();
5774 cGridBag row6 = new cGridBag();
5875
59
- AddSkyboxButton("default", "rgb", row0);
76
+ AddSkyboxButton("default", "", row0);
6077 //AddSkyboxButton("default", "cornell", row0);
6178 AddSkyboxButton("penguins", "dust", row0);
6279 AddSkyboxButton("penguins", "tropic", row0);
....@@ -311,14 +328,56 @@
311328 }
312329 }
313330
314
- public void ChangeSkybox(String name)
331
+ public void ChangeSkybox(String skybox)
315332 {
316
- //cameraView.envyoff = false;
317
- group.skyboxname = name;
318
- group.skyboxext = "jpg";
319
- 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
+ }
347
+
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);
320358 }
321359
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
+
322381 //ObjEditor objEditor;
323382 public void closeUI2()
324383 {
....@@ -360,6 +419,8 @@
360419 {
361420 copy.versionlist = new Object3D[100];
362421 copy.versionindex = -1;
422
+
423
+ Save(true);
363424 }
364425
365426 if(ui)
....@@ -479,33 +540,35 @@
479540 // menu.add("-");
480541 duplicateItem = oe.jTree.popup.add(new JMenuItem("Duplicate"));
481542 duplicateItem.addActionListener(this);
482
- cloneItem = menu.add(new MenuItem("Clone"));
543
+
544
+ cloneItem = oe.jTree.popup.add(new JMenuItem("Clone"));
483545 cloneItem.addActionListener(this);
484
- if (Globals.ADVANCED)
546
+ //if (Globals.ADVANCED)
485547 {
486548 cloneSupportItem = menu.add(new MenuItem("Clone (+supports)"));
487549 cloneSupportItem.addActionListener(this);
488550 }
551
+ oe.jTree.popup.addSeparator();
489552 menu.add("-");
490
- cutItem = menu.add(new MenuItem("Cut"));
553
+ cutItem = oe.jTree.popup.add(new JMenuItem("Cut"));
491554 cutItem.addActionListener(this);
492
- copyItem = menu.add(new MenuItem("Copy"));
555
+ copyItem = oe.jTree.popup.add(new JMenuItem("Copy"));
493556 copyItem.addActionListener(this);
494557 pasteItem = menu.add(new MenuItem("Paste"));
495558 pasteItem.addActionListener(this);
496559
497
- menu.add("-");
498
- 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"));
499563 pasteIntoItem.addActionListener(this);
500
- pasteLinkItem = menu.add(new MenuItem("Paste link"));
564
+ pasteLinkItem = oe.jTree.popup.add(new JMenuItem("Paste link"));
501565 pasteLinkItem.addActionListener(this);
502
- pasteCloneItem = menu.add(new MenuItem("Paste clone"));
566
+ pasteCloneItem = oe.jTree.popup.add(new JMenuItem("Paste clone"));
503567 pasteCloneItem.addActionListener(this);
504
-// pasteExpandItem = menu.add(new MenuItem("Paste expand"));
568
+// CRASH pasteExpandItem = oe.jTree.popup.add(new JMenuItem("Paste expand"));
505569 // pasteExpandItem.addActionListener(this);
506
- menu.add("-");
507
- deleteItem = menu.add(new MenuItem("Delete"));
508
- deleteItem.addActionListener(this);
570
+ //menu.add("-");
571
+ oe.jTree.popup.addSeparator();
509572
510573 if (Globals.ADVANCED)
511574 {
....@@ -591,11 +654,9 @@
591654 oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest"));
592655 //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection"));
593656 //cameraMenu.add(switchViewItem = new MenuItem("Reverse View"));
594
- editLeafItem = oe.cameraMenu.add(new MenuItem("Edit Leaf"));
595657 oe.cameraMenu.add("-");
596658 openWindowItem = oe.cameraMenu.add(new MenuItem("Edit copy..."));
597659 openWindowItem.addActionListener(this);
598
- editLeafItem.addActionListener(this);
599660 lookAtItem.addActionListener(this);
600661 //lookFromItem.addActinoListener(this);
601662 //switchViewItem.addActionListener(this);
....@@ -642,9 +703,8 @@
642703 setMasterItem.addActionListener(this);
643704 }
644705
645
- oe.menuBar.add(menu = new Menu("Group"));
646
-// grabItem = menu.add(new MenuItem("Grab"));
647
-// grabItem.addActionListener(this);
706
+ oe.menuBar.add(menu = new Menu("Order"));
707
+
648708 backItem = menu.add(new MenuItem("Back"));
649709 backItem.addActionListener(this);
650710 frontItem = menu.add(new MenuItem("Front"));
....@@ -652,13 +712,21 @@
652712 // compositeItem = menu.add(new MenuItem("Composite"));
653713 // compositeItem.addActionListener(this);
654714
715
+ grabItem = oe.jTree.popup.add(new JMenuItem("Group"));
716
+ grabItem.addActionListener(this);
717
+
655718 if (Globals.ADVANCED)
656719 {
657720 hideItem = menu.add(new MenuItem("Hidden Group"));
658721 hideItem.addActionListener(this);
659722 }
660
- ungroupItem = menu.add(new MenuItem("Ungroup"));
723
+ ungroupItem = oe.jTree.popup.add(new JMenuItem("Ungroup"));
661724 ungroupItem.addActionListener(this);
725
+
726
+ oe.jTree.popup.addSeparator();
727
+
728
+ deleteItem = oe.jTree.popup.add(new JMenuItem("Delete"));
729
+ deleteItem.addActionListener(this);
662730
663731 // menu.add("-");
664732 //
....@@ -843,6 +911,9 @@
843911 shareGeometriesItem.addActionListener(this);
844912 mergeGeometriesItem = menu.add(new MenuItem("Merge Geometries"));
845913 mergeGeometriesItem.addActionListener(this);
914
+ menu.add("-");
915
+ editLeafItem = menu.add(new MenuItem("Edit leaf..."));
916
+ editLeafItem.addActionListener(this);
846917 if (Globals.ADVANCED)
847918 {
848919 // Pretty much the same as duplicate and clone.
....@@ -859,6 +930,74 @@
859930 buildToolsMenu(menu);
860931 }
861932
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
+ }
8621001
8631002 void SetupUI2(ObjEditor oe)
8641003 {
....@@ -877,11 +1016,6 @@
8771016 //new Exception().printStackTrace();
8781017
8791018 oe.radioPanel = new JPanel(new GridBagLayout());
880
- oe.aConstraints.weightx = 1;
881
- oe.aConstraints.weighty = 0;
882
- oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
883
- oe.aConstraints.gridwidth = 100;
884
- oe.aConstraints.gridheight = 1;
8851019 // oe.toolbarPanel.add(radioPanel); //, oe.aConstraints);
8861020
8871021 oe.buttonGroup = new ButtonGroup();
....@@ -914,10 +1048,49 @@
9141048
9151049 if (Globals.ADVANCED)
9161050 {
917
- oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
918
- maxButton.setToolTipText("Maximize window");
919
- 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);
9201054 }
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
+ //
9211094
9221095 oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
9231096 fullButton.setToolTipText("Full-screen window");
....@@ -962,14 +1135,14 @@
9621135 nextVersionButton.addActionListener(this);
9631136 nextVersionButton.setEnabled(false);
9641137
965
- oe.toolbarPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
966
- liveCB.setToolTipText("Enable animation");
967
- liveCB.addItemListener(this);
968
-
9691138 oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
9701139 oneStepButton.setToolTipText("Animate one step forward");
9711140 oneStepButton.addActionListener(this);
9721141
1142
+ oe.toolbarPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
1143
+ liveCB.setToolTipText("Enable animation");
1144
+ liveCB.addItemListener(this);
1145
+
9731146 oe.toolbarPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
9741147 fastCB.setToolTipText("Fast mode");
9751148 fastCB.addItemListener(this);
....@@ -996,21 +1169,6 @@
9961169
9971170 //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
9981171
999
- oe.toolbarPanel.add(twoButton = GetButton("icons/cube.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1000
- twoButton.setToolTipText("Show 3D view only");
1001
- twoButton.addActionListener(this);
1002
- this.fullscreenLayout = twoButton;
1003
-
1004
- oe.toolbarPanel.add(threeButton = GetButton("icons/controlsview.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1005
- threeButton.setToolTipText("Show controls and 3D view");
1006
- threeButton.addActionListener(this);
1007
- oe.toolbarPanel.add(sixButton = GetButton("icons/viewcontrols.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1008
- sixButton.setToolTipText("Show 3D view and controls");
1009
- sixButton.addActionListener(this);
1010
-// oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1011
-// sevenButton.setToolTipText("3-column layout");
1012
-// sevenButton.addActionListener(this);
1013
- //
10141172
10151173 oe.toolbarPanel.add(rootButton = GetButton("icons/openwindow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
10161174 rootButton.setToolTipText("Open selection in new tab");
....@@ -1026,12 +1184,16 @@
10261184
10271185 // INSERT
10281186 row1.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1029
- gridButton.setToolTipText("Create grid");
1187
+ gridButton.setToolTipText("Create ground");
10301188 gridButton.addActionListener(this);
10311189
10321190 row1.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
10331191 boxButton.setToolTipText("Create box");
10341192 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);
10351197
10361198 row1.add(sphereButton = GetButton("icons/sphere.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
10371199 sphereButton.setToolTipText("Create sphere");
....@@ -1044,10 +1206,6 @@
10441206 row1.add(torusButton = GetButton("icons/torus.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
10451207 torusButton.setToolTipText("Create torus");
10461208 torusButton.addActionListener(this);
1047
-
1048
- row1.add(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1049
- superButton.setToolTipText("Create superellipsoid");
1050
- superButton.addActionListener(this);
10511209
10521210 if (Globals.ADVANCED)
10531211 {
....@@ -1094,19 +1252,15 @@
10941252
10951253 oe.toolboxPanel.add(row2);
10961254
1097
- // ENVYMAPS
1098
- cGridBag skyboxpane = new cGridBag();
1099
- skyboxpane.preferredHeight = 100;
1255
+ cGridBag textures = new cGridBag();
11001256
1101
- oe.toolboxPanel.add(skyboxpane);
1257
+ CreateTexturePanel(textures);
11021258
1103
- JTabbedPane skyboxpanel = new JTabbedPane();
1104
- skyboxpane.add(skyboxpanel);
1259
+ oe.toolboxPanel.add(textures);
11051260
1106
- AddSkyboxTab0(skyboxpanel);
1107
- AddSkyboxTab1(skyboxpanel);
1108
- AddSkyboxTab2(skyboxpanel);
1109
- AddSkyboxTab3(skyboxpanel);
1261
+ textures.preferredHeight = 100;
1262
+
1263
+ CreateSkyboxPanel(oe.skyboxPanel);
11101264
11111265 // EDIT panel
11121266 editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
....@@ -1118,16 +1272,16 @@
11181272 uneditButton.addActionListener(this);
11191273
11201274 editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
1121
- allParamsButton.setToolTipText("Show all controle");
1275
+ allParamsButton.setToolTipText("Show all controls");
11221276 allParamsButton.addActionListener(this);
11231277
11241278 editCommandsPanel.add(clearPanelButton = GetButton("icons/clear.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1125
- clearPanelButton.setToolTipText("Clear edit panel");
1279
+ clearPanelButton.setToolTipText("Clear all controls");
11261280 clearPanelButton.addActionListener(this);
11271281
1128
- editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1129
- unselectButton.setToolTipText("Unselect");
1130
- unselectButton.addActionListener(this);
1282
+ //editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1283
+ //unselectButton.setToolTipText("Unselect");
1284
+ //unselectButton.addActionListener(this);
11311285
11321286 editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
11331287 flashSelectionButton.setToolTipText("Highlight selection");
....@@ -1322,6 +1476,14 @@
13221476
13231477 void EditObject(Object3D obj)
13241478 {
1479
+ assert(obj instanceof Composite);
1480
+
1481
+// if (obj.versionlist == null)
1482
+// {
1483
+// obj.versionlist = new Object3D[100];
1484
+// obj.versionindex = -1;
1485
+// }
1486
+
13251487 cRadio radioButton = new cRadio(obj.name);
13261488
13271489 // June 2019. Patch to avoid bug with transparency.
....@@ -1346,6 +1508,7 @@
13461508
13471509 oe.SetupViews();
13481510
1511
+ if (Globals.DEBUG)
13491512 System.out.println("SetupViews");
13501513 DragSource.getDefaultDragSource().createDefaultDragGestureRecognizer(
13511514 oe.cameraView, DnDConstants.ACTION_COPY_OR_MOVE, this); // ACTION_LINK ??
....@@ -1712,7 +1875,12 @@
17121875 TreePath path;
17131876
17141877 public TransferableTreePath(TreePath tp) {
1715
- 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);
17161884 }
17171885
17181886 public synchronized DataFlavor[] getTransferDataFlavors() {
....@@ -2002,7 +2170,11 @@
20022170 shadow.material = new cMaterial(obj.material);
20032171 shadow.material.diffuse = 0.0001f;
20042172 shadow.material.specular = 0.0001f;
2005
- //shadow.projectedVertices[1].x = 300;
2173
+ shadow.material.opacity = 0.75f;
2174
+
2175
+ AllocProjectedVertices(shadow);
2176
+
2177
+ shadow.projectedVertices[1].x = 300;
20062178
20072179 makeSomething(shadow);
20082180 }
....@@ -2523,27 +2695,35 @@
25232695 } else
25242696 if (source == loopItem || source == loopButton)
25252697 {
2698
+ if (!group.selection.isEmpty())
2699
+ {
25262700 Composite csg = new GroupLeaf();
25272701 csg.count = 5;
2528
- group(csg);
25292702 Composite child = new cGroup("Branch");
25302703 csg.addChild(child);
25312704 child.addChild(csg);
2705
+ group(csg);
2706
+ }
25322707 } else
25332708 if (source == doubleItem)
25342709 {
2710
+ if (!group.selection.isEmpty())
2711
+ {
25352712 Composite csg = new GroupLeaf("Fork");
25362713 csg.count = 5;
2537
- group(csg);
25382714 Composite child = new cGroup("Branch A");
25392715 csg.addChild(child);
25402716 child.addChild(csg);
25412717 child = new cGroup("Branch B");
25422718 csg.addChild(child);
25432719 child.addChild(csg);
2720
+ group(csg);
2721
+ }
25442722 } else
25452723 if (source == tripleItem)
25462724 {
2725
+ if (!group.selection.isEmpty())
2726
+ {
25472727 Composite csg = new GroupLeaf("Trident");
25482728 csg.count = 4;
25492729 group(csg);
....@@ -2556,6 +2736,7 @@
25562736 child = new cGroup();
25572737 csg.addChild(child);
25582738 child.addChild(csg);
2739
+ }
25592740 } else
25602741 if (source == computeAOItem)
25612742 {
....@@ -2605,6 +2786,18 @@
26052786 if (source == fullButton)
26062787 {
26072788 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();
26082801 } else
26092802 if (source == previousVersionButton)
26102803 {
....@@ -3179,22 +3372,34 @@
31793372 } else
31803373 if (source == ungroupItem || source == ungroupButton)
31813374 {
3182
- boolean hasRoot = false;
3375
+ boolean canUngroup = true;
31833376
31843377 for (int i=0; i<group.selection.size(); i++)
31853378 {
3186
- if (group.selection.get(i) == group)
3379
+ Object3D selectedItem = group.selection.get(i);
3380
+
3381
+ if (selectedItem.Size() == 0)
31873382 {
3188
- 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;
31893392 break;
31903393 }
31913394 }
31923395
3193
- if (!hasRoot)
3396
+ if (canUngroup)
31943397 {
31953398 for (int i=0; i<group.selection.size(); i++)
31963399 {
3197
- Ungroup(group.selection.get(i));
3400
+ Object3D selectedItem = group.selection.get(i);
3401
+
3402
+ Ungroup(selectedItem);
31983403 }
31993404
32003405 ClearSelection(false);
....@@ -3557,38 +3762,7 @@
35573762 if (CameraPane.FULLSCREEN)
35583763 fullscreenLayout = radio.layout;
35593764
3560
- // bug
3561
- //gridPanel.setDividerLocation(1.0);
3562
- //bigPanel.setDividerLocation(0.0);
3563
-// bigThree.remove(scenePanel);
3564
-// bigThree.remove(centralPanel);
3565
-// bigThree.remove(XYZPanel);
3566
-// aWindowConstraints.gridx = 0;
3567
-// aWindowConstraints.gridy = 0;
3568
-// aWindowConstraints.gridwidth = 1;
3569
-// // aConstraints.gridheight = 3;
3570
-// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3571
-// aWindowConstraints.weightx = 0;
3572
-// aWindowConstraints.weighty = 1;
3573
-// //bigThree.add(jtp, aWindowConstraints);
3574
-// aWindowConstraints.weightx = 1;
3575
-// aWindowConstraints.gridwidth = 3;
3576
-// // aConstraints.gridheight = 3;
3577
-// aWindowConstraints.gridx = 1;
3578
-// aWindowConstraints.fill = GridBagConstraints.BOTH;
3579
-// bigThree.add(centralPanel, aWindowConstraints);
3580
-// aWindowConstraints.weightx = 0;
3581
-// aWindowConstraints.gridx = 4;
3582
-// aWindowConstraints.gridwidth = 1;
3583
-// // aConstraints.gridheight = 3;
3584
-// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3585
-// //bigThree.add(XYZPanel, aWindowConstraints);
3586
-// scenePanel.setVisible(false);
3587
-// centralPanel.setVisible(true);
3588
-// XYZPanel.setVisible(false);
3589
- bigThree.ClearUI();
3590
- bigThree.add(centralPanel);
3591
- bigThree.FlushUI();
3765
+ Show3DView();
35923766
35933767 cameraView.requestFocusInWindow();
35943768
....@@ -3774,6 +3948,7 @@
37743948 } else
37753949 if (source == rootButton)
37763950 {
3951
+ Replace();
37773952 Object3D obj;
37783953 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
37793954 {
....@@ -3910,8 +4085,6 @@
39104085
39114086 copy = group;
39124087
3913
- SetUndoStates();
3914
-
39154088 //Globals.theRenderer.object = group;
39164089 if(!useclient)
39174090 {
....@@ -3939,6 +4112,21 @@
39394112 */
39404113 radio.layout.doClick();
39414114
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
+
39424130 ClearUnpinned();
39434131
39444132 //Grafreed.Assert(group != null);
....@@ -5169,15 +5357,30 @@
51695357 {
51705358 editButton.setEnabled(enabled);
51715359 uneditButton.setEnabled(enabled);
5172
- unselectButton.setEnabled(enabled);
5360
+ //unselectButton.setEnabled(enabled);
51735361 flashSelectionButton.setEnabled(enabled);
51745362
51755363 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);
51765379 }
51775380
51785381 void refreshContents(boolean cp)
51795382 {
5180
- if (objectPanel.getSelectedIndex() == 2) // objectPanel.indexOfTab("Info"))
5383
+ //if (objectPanel.getSelectedIndex() == 2) // objectPanel.indexOfTab("Info"))
51815384 if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
51825385 {
51835386 objEditor.ClearInfo(); // .GetMaterial());
....@@ -5187,7 +5390,7 @@
51875390 Object3D child = (Object3D) group.selection.get(i);
51885391
51895392 objEditor.AddInfo(child, this, true);
5190
- System.err.println("info : " + child.GetPath());
5393
+// System.err.println("info : " + child.GetPath());
51915394 }
51925395
51935396 objEditor.SetText(); // jan 2014
....@@ -6070,11 +6273,11 @@
60706273 private MenuItem lookAtItem;
60716274 private MenuItem lookFromItem;
60726275 private MenuItem switchViewItem;
6073
- private MenuItem cutItem;
6276
+ private JMenuItem cutItem;
60746277 private MenuItem undoItem;
60756278 private MenuItem redoItem;
60766279 private JMenuItem duplicateItem;
6077
- private MenuItem cloneItem;
6280
+ private JMenuItem cloneItem;
60786281 private MenuItem cloneSupportItem;
60796282 private MenuItem overwriteGeoItem;
60806283 private MenuItem overwriteMatItem;
....@@ -6095,13 +6298,13 @@
60956298 private MenuItem cloneGeometriesItem;
60966299 private MenuItem shareGeometriesItem;
60976300 private MenuItem mergeGeometriesItem;
6098
- private MenuItem copyItem;
6301
+ private JMenuItem copyItem;
60996302 private MenuItem pasteItem;
6100
- private MenuItem pasteIntoItem;
6101
- private MenuItem pasteLinkItem;
6102
- private MenuItem pasteCloneItem;
6103
- private MenuItem pasteExpandItem;
6104
- private MenuItem deleteItem;
6303
+ private JMenuItem pasteIntoItem;
6304
+ private JMenuItem pasteLinkItem;
6305
+ private JMenuItem pasteCloneItem;
6306
+ private JMenuItem pasteExpandItem;
6307
+ private JMenuItem deleteItem;
61056308 private MenuItem clearAllItem;
61066309 private MenuItem genUVItem;
61076310 private MenuItem genNormalsMESHItem;
....@@ -6156,7 +6359,7 @@
61566359 private MenuItem transformGeometryItem;
61576360 private MenuItem transformChildrenItem;
61586361 private MenuItem hideItem;
6159
- private MenuItem grabItem;
6362
+ private JMenuItem grabItem;
61606363 private MenuItem backItem;
61616364 private MenuItem frontItem;
61626365 private MenuItem cameraItem;
....@@ -6169,7 +6372,7 @@
61696372 private MenuItem switchTransfoItem;
61706373 private MenuItem morphItem;
61716374 private MenuItem linkerItem;
6172
- private MenuItem ungroupItem;
6375
+ private JMenuItem ungroupItem;
61736376 private MenuItem editItem;
61746377 private MenuItem openWindowItem;
61756378 private MenuItem editLeafItem;