Normand Briere
2019-08-17 d5d6485126da83b06645e90e3e4ce66659a56009
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;
....@@ -390,10 +415,14 @@
390415 this.copy = this.group = group;
391416 //selectees = this.group.selectees;
392417
418
+ assert(false);
419
+
393420 if (copy.versionlist == null)
394421 {
395422 copy.versionlist = new Object3D[100];
396423 copy.versionindex = -1;
424
+
425
+ //Save(true);
397426 }
398427
399428 if(ui)
....@@ -422,7 +451,7 @@
422451 copy.versionlist = new Object3D[100];
423452 copy.versionindex = -1;
424453
425
- Save(true);
454
+ //Save(true);
426455 }
427456 }
428457
....@@ -513,33 +542,35 @@
513542 // menu.add("-");
514543 duplicateItem = oe.jTree.popup.add(new JMenuItem("Duplicate"));
515544 duplicateItem.addActionListener(this);
516
- cloneItem = menu.add(new MenuItem("Clone"));
545
+
546
+ cloneItem = oe.jTree.popup.add(new JMenuItem("Clone"));
517547 cloneItem.addActionListener(this);
518
- if (Globals.ADVANCED)
548
+ //if (Globals.ADVANCED)
519549 {
520550 cloneSupportItem = menu.add(new MenuItem("Clone (+supports)"));
521551 cloneSupportItem.addActionListener(this);
522552 }
553
+ oe.jTree.popup.addSeparator();
523554 menu.add("-");
524
- cutItem = menu.add(new MenuItem("Cut"));
555
+ cutItem = oe.jTree.popup.add(new JMenuItem("Cut"));
525556 cutItem.addActionListener(this);
526
- copyItem = menu.add(new MenuItem("Copy"));
557
+ copyItem = oe.jTree.popup.add(new JMenuItem("Copy"));
527558 copyItem.addActionListener(this);
528559 pasteItem = menu.add(new MenuItem("Paste"));
529560 pasteItem.addActionListener(this);
530561
531
- menu.add("-");
532
- pasteIntoItem = menu.add(new MenuItem("Paste into"));
562
+ oe.jTree.popup.addSeparator();
563
+ //menu.add("-");
564
+ pasteIntoItem = oe.jTree.popup.add(new JMenuItem("Paste into"));
533565 pasteIntoItem.addActionListener(this);
534
- pasteLinkItem = menu.add(new MenuItem("Paste link"));
566
+ pasteLinkItem = oe.jTree.popup.add(new JMenuItem("Paste link"));
535567 pasteLinkItem.addActionListener(this);
536
- pasteCloneItem = menu.add(new MenuItem("Paste clone"));
568
+ pasteCloneItem = oe.jTree.popup.add(new JMenuItem("Paste clone"));
537569 pasteCloneItem.addActionListener(this);
538
-// pasteExpandItem = menu.add(new MenuItem("Paste expand"));
570
+// CRASH pasteExpandItem = oe.jTree.popup.add(new JMenuItem("Paste expand"));
539571 // pasteExpandItem.addActionListener(this);
540
- menu.add("-");
541
- deleteItem = menu.add(new MenuItem("Delete"));
542
- deleteItem.addActionListener(this);
572
+ //menu.add("-");
573
+ oe.jTree.popup.addSeparator();
543574
544575 if (Globals.ADVANCED)
545576 {
....@@ -625,11 +656,9 @@
625656 oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest"));
626657 //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection"));
627658 //cameraMenu.add(switchViewItem = new MenuItem("Reverse View"));
628
- editLeafItem = oe.cameraMenu.add(new MenuItem("Edit Leaf"));
629659 oe.cameraMenu.add("-");
630660 openWindowItem = oe.cameraMenu.add(new MenuItem("Edit copy..."));
631661 openWindowItem.addActionListener(this);
632
- editLeafItem.addActionListener(this);
633662 lookAtItem.addActionListener(this);
634663 //lookFromItem.addActinoListener(this);
635664 //switchViewItem.addActionListener(this);
....@@ -676,9 +705,8 @@
676705 setMasterItem.addActionListener(this);
677706 }
678707
679
- oe.menuBar.add(menu = new Menu("Group"));
680
-// grabItem = menu.add(new MenuItem("Grab"));
681
-// grabItem.addActionListener(this);
708
+ oe.menuBar.add(menu = new Menu("Order"));
709
+
682710 backItem = menu.add(new MenuItem("Back"));
683711 backItem.addActionListener(this);
684712 frontItem = menu.add(new MenuItem("Front"));
....@@ -686,13 +714,21 @@
686714 // compositeItem = menu.add(new MenuItem("Composite"));
687715 // compositeItem.addActionListener(this);
688716
717
+ grabItem = oe.jTree.popup.add(new JMenuItem("Group"));
718
+ grabItem.addActionListener(this);
719
+
689720 if (Globals.ADVANCED)
690721 {
691722 hideItem = menu.add(new MenuItem("Hidden Group"));
692723 hideItem.addActionListener(this);
693724 }
694
- ungroupItem = menu.add(new MenuItem("Ungroup"));
725
+ ungroupItem = oe.jTree.popup.add(new JMenuItem("Ungroup"));
695726 ungroupItem.addActionListener(this);
727
+
728
+ oe.jTree.popup.addSeparator();
729
+
730
+ deleteItem = oe.jTree.popup.add(new JMenuItem("Delete"));
731
+ deleteItem.addActionListener(this);
696732
697733 // menu.add("-");
698734 //
....@@ -877,6 +913,9 @@
877913 shareGeometriesItem.addActionListener(this);
878914 mergeGeometriesItem = menu.add(new MenuItem("Merge Geometries"));
879915 mergeGeometriesItem.addActionListener(this);
916
+ menu.add("-");
917
+ editLeafItem = menu.add(new MenuItem("Edit leaf..."));
918
+ editLeafItem.addActionListener(this);
880919 if (Globals.ADVANCED)
881920 {
882921 // Pretty much the same as duplicate and clone.
....@@ -895,40 +934,47 @@
895934
896935 JTabbedPane resourcecontainer;
897936 cGridBag currenttab;
898
- boolean added; // patch for jar
937
+ //boolean added; // patch for jar
899938
900939 int tabcount = 0;
901940 int colcount = 0;
902941 int rowcount = 0;
942
+ int texturecount = 0;
903943
904944 int columns = 5;
905945 int rows = 7;
906946
907947 public void ResourceCallBack(String[] path)
908948 {
909
- for (int i = 0; i < path.length; i++)
910
- System.out.print(path[i] + "/");
911
- System.out.println();
912
- if (rowcount == 0)
949
+// for (int i = 0; i < path.length; i++)
950
+// System.out.print(path[i] + "/");
951
+// System.out.println();
952
+
953
+ if (//rowcount == 0 ||
954
+ path.length == 1 && !path[0].equals("") && !path[0].equals(".DS_Store"))
913955 {
914956 currenttab = new cGridBag();
915
- added = false;
916
- String tabname = String.valueOf((char)('A'+tabcount));
957
+ String tabname = path[0]; // String.valueOf((char)('A'+tabcount));
917958 currenttab.setName(tabname);
959
+ //added = false;
960
+ resourcecontainer.add(currenttab);
961
+ resourcecontainer.setToolTipTextAt(tabcount++, "Texture Group " + tabname);
918962 rowcount = 1;
963
+ colcount = 0;
964
+ texturecount = 0;
919965 }
920966
921
- if (path.length > 1 && path[1].toLowerCase().endsWith(".jpg"))
967
+ if (path.length > 2 && path[2].toLowerCase().endsWith(".jpg"))
922968 {
923
- if (!added)
969
+ //if (!added)
924970 {
925
- added = true;
926
- resourcecontainer.add(currenttab);
927
- String tabname = String.valueOf((char)('A'+tabcount));
928
- resourcecontainer.setToolTipTextAt(tabcount++, "Texture Group " + tabname);
971
+ //added = true;
972
+ String tabname = path[0]; // String.valueOf((char)('A'+tabcount));
973
+ currenttab = (cGridBag)resourcecontainer.getComponentAt(resourcecontainer.indexOfTab(tabname));
929974 }
930975
931
- AddTextureButton(path[0], path[1], currenttab);
976
+ AddTextureButton(path[0], path[1], path[2], texturecount++, currenttab);
977
+
932978 if (++colcount >= columns)
933979 {
934980 colcount = 0;
....@@ -949,7 +995,7 @@
949995
950996 void CreateTexturePanel(cGridBag container)
951997 {
952
- resourcecontainer = new JTabbedPane();
998
+ resourcecontainer = new JTabbedPane(JTabbedPane.LEFT);
953999 container.add(resourcecontainer);
9541000
9551001 Grafreed.ParseResources("textures", this);
....@@ -972,11 +1018,6 @@
9721018 //new Exception().printStackTrace();
9731019
9741020 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;
9801021 // oe.toolbarPanel.add(radioPanel); //, oe.aConstraints);
9811022
9821023 oe.buttonGroup = new ButtonGroup();
....@@ -997,9 +1038,9 @@
9971038 oe.radioPanel.add(dummyButton);
9981039 oe.buttonGroup.add(dummyButton);
9991040 */
1000
- cGridBag copyOptionsPanel = new cGridBag();
1041
+ cGridBag versionManagerPanel = new cGridBag();
10011042
1002
- copyOptionsPanel.preferredHeight = 2;
1043
+ versionManagerPanel.preferredHeight = 4;
10031044
10041045 //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
10051046
....@@ -1009,10 +1050,49 @@
10091050
10101051 if (Globals.ADVANCED)
10111052 {
1012
- oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1013
- maxButton.setToolTipText("Maximize window");
1014
- maxButton.addActionListener(this);
1053
+// oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1054
+// maxButton.setToolTipText("Maximize window");
1055
+// maxButton.addActionListener(this);
10151056 }
1057
+
1058
+ cButton gcButton;
1059
+
1060
+// oe.toolbarPanel.add(gcButton = GetButton("icons/trash.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1061
+// gcButton.setToolTipText("Garbage collect");
1062
+// gcButton.addActionListener(new ActionListener()
1063
+// {
1064
+// public void actionPerformed(ActionEvent e)
1065
+// {
1066
+// System.gc();
1067
+// }
1068
+// });
1069
+
1070
+ oe.toolbarPanel.add(collapseButton = GetButton("icons/collapse.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1071
+ collapseButton.setToolTipText("Collapse toolbar");
1072
+ collapseButton.addActionListener(this);
1073
+
1074
+ oe.toolbarPanel.add(maximize3DButton = GetButton("icons/square.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1075
+ maximize3DButton.setToolTipText("Maximize 3D view");
1076
+ maximize3DButton.addActionListener(this);
1077
+
1078
+ oe.toolbarPanel.add(twoButton = GetButton("icons/cube.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1079
+ twoButton.setToolTipText("Show 3D view only");
1080
+ twoButton.addActionListener(this);
1081
+ this.fullscreenLayout = twoButton;
1082
+
1083
+ oe.toolbarPanel.add(threeButton = GetButton("icons/controlsview.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1084
+ threeButton.setToolTipText("Show controls and 3D view");
1085
+ threeButton.addActionListener(this);
1086
+ if (Globals.ADVANCED)
1087
+ {
1088
+ oe.toolbarPanel.add(sixButton = GetButton("icons/viewcontrols.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1089
+ sixButton.setToolTipText("Show 3D view and controls");
1090
+ sixButton.addActionListener(this);
1091
+ }
1092
+// oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1093
+// sevenButton.setToolTipText("3-column layout");
1094
+// sevenButton.addActionListener(this);
1095
+ //
10161096
10171097 oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
10181098 fullButton.setToolTipText("Full-screen window");
....@@ -1026,15 +1106,16 @@
10261106 restoreCameraButton.setToolTipText("Restore viewpoint");
10271107 restoreCameraButton.addActionListener(this);
10281108
1029
- copyOptionsPanel.add(saveVersionButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1109
+ versionManagerPanel.add(saveVersionButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
10301110 saveVersionButton.setToolTipText("Duplicate current version");
10311111 saveVersionButton.addActionListener(this);
10321112
1033
- copyOptionsPanel.add(deleteVersionButton = GetButton("icons/trash.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1113
+ versionManagerPanel.add(deleteVersionButton = GetButton("icons/trash.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
10341114 deleteVersionButton.setToolTipText("Delete current version");
10351115 deleteVersionButton.addActionListener(this);
1116
+ deleteVersionButton.setEnabled(false);
10361117
1037
- copyOptionsPanel.add(previousVersionButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1118
+ versionManagerPanel.add(previousVersionButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
10381119 previousVersionButton.setToolTipText("Previous version");
10391120 previousVersionButton.addActionListener(this);
10401121 previousVersionButton.setEnabled(false);
....@@ -1043,28 +1124,28 @@
10431124 updown.add(restoreButton = GetButton("icons/restore.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
10441125 restoreButton.setToolTipText("Undo (restore current version)");
10451126 restoreButton.addActionListener(this);
1046
- //restoreButton.setEnabled(false);
1127
+ restoreButton.setEnabled(false);
10471128
10481129 updown.add(replaceButton = GetButton("icons/replace.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
10491130 replaceButton.setToolTipText("Save (replace current version)");
10501131 replaceButton.addActionListener(this);
1051
- //replaceButton.setEnabled(false);
1132
+ replaceButton.setEnabled(false);
10521133
1053
- copyOptionsPanel.add(updown);
1134
+ versionManagerPanel.add(updown);
10541135
1055
- copyOptionsPanel.add(nextVersionButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1136
+ versionManagerPanel.add(nextVersionButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
10561137 nextVersionButton.setToolTipText("Next version");
10571138 nextVersionButton.addActionListener(this);
10581139 nextVersionButton.setEnabled(false);
1140
+
1141
+ oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1142
+ oneStepButton.setToolTipText("Animate one step forward");
1143
+ oneStepButton.addActionListener(this);
10591144
10601145 oe.toolbarPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
10611146 liveCB.setToolTipText("Enable animation");
10621147 liveCB.addItemListener(this);
10631148
1064
- oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1065
- oneStepButton.setToolTipText("Animate one step forward");
1066
- oneStepButton.addActionListener(this);
1067
-
10681149 oe.toolbarPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
10691150 fastCB.setToolTipText("Fast mode");
10701151 fastCB.addItemListener(this);
....@@ -1091,21 +1172,6 @@
10911172
10921173 //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
10931174
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
- //
11091175
11101176 oe.toolbarPanel.add(rootButton = GetButton("icons/openwindow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
11111177 rootButton.setToolTipText("Open selection in new tab");
....@@ -1121,12 +1187,16 @@
11211187
11221188 // INSERT
11231189 row1.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1124
- gridButton.setToolTipText("Create grid");
1190
+ gridButton.setToolTipText("Create ground");
11251191 gridButton.addActionListener(this);
11261192
11271193 row1.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
11281194 boxButton.setToolTipText("Create box");
11291195 boxButton.addActionListener(this);
1196
+
1197
+ row1.add(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1198
+ superButton.setToolTipText("Create superellipsoid");
1199
+ superButton.addActionListener(this);
11301200
11311201 row1.add(sphereButton = GetButton("icons/sphere.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
11321202 sphereButton.setToolTipText("Create sphere");
....@@ -1139,10 +1209,6 @@
11391209 row1.add(torusButton = GetButton("icons/torus.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
11401210 torusButton.setToolTipText("Create torus");
11411211 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);
11461212
11471213 if (Globals.ADVANCED)
11481214 {
....@@ -1192,6 +1258,8 @@
11921258 cGridBag textures = new cGridBag();
11931259
11941260 CreateTexturePanel(textures);
1261
+
1262
+ resourcecontainer.setSelectedIndex((int)(Math.random() * resourcecontainer.getTabCount()));
11951263
11961264 oe.toolboxPanel.add(textures);
11971265
....@@ -1243,6 +1311,8 @@
12431311
12441312 cGridBag jSPPanel = new cGridBag();
12451313
1314
+ jSPPanel.preferredHeight = 20;
1315
+
12461316 JScrollPane jSP;
12471317 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
12481318 jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
....@@ -1251,11 +1321,11 @@
12511321 oe.treePanel.add(jSPPanel);
12521322 oe.treePanel.Return();
12531323
1254
- oe.treePanel.add(copyOptionsPanel);
1324
+ oe.treePanel.add(versionManagerPanel);
12551325 oe.treePanel.Return();
1256
- cGridBag sliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
1257
- versionSlider = (cNumberSlider)sliderPane.getComponent(1);
1258
- sliderPane.preferredHeight = 1;
1326
+ versionSliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
1327
+ versionSlider = (cNumberSlider)versionSliderPane.getComponent(1);
1328
+ versionSliderPane.preferredHeight = 3;
12591329
12601330 // mainPanel.setDividerLocation(0.1); //1.0);
12611331 mainPanel.setResizeWeight(0.4);
....@@ -1413,6 +1483,14 @@
14131483
14141484 void EditObject(Object3D obj)
14151485 {
1486
+ assert(obj instanceof Composite);
1487
+
1488
+// if (obj.versionlist == null)
1489
+// {
1490
+// obj.versionlist = new Object3D[100];
1491
+// obj.versionindex = -1;
1492
+// }
1493
+
14161494 cRadio radioButton = new cRadio(obj.name);
14171495
14181496 // June 2019. Patch to avoid bug with transparency.
....@@ -1437,6 +1515,7 @@
14371515
14381516 oe.SetupViews();
14391517
1518
+ if (Globals.DEBUG)
14401519 System.out.println("SetupViews");
14411520 DragSource.getDefaultDragSource().createDefaultDragGestureRecognizer(
14421521 oe.cameraView, DnDConstants.ACTION_COPY_OR_MOVE, this); // ACTION_LINK ??
....@@ -1803,7 +1882,12 @@
18031882 TreePath path;
18041883
18051884 public TransferableTreePath(TreePath tp) {
1806
- path = tp;
1885
+ Object[] objs = new Object[tp.getPathCount()];
1886
+ for (int i=0; i<objs.length; i++)
1887
+ {
1888
+ objs[i] = ((Object3D)tp.getPathComponent(i)).GetUUID();
1889
+ }
1890
+ path = new TreePath(objs);
18071891 }
18081892
18091893 public synchronized DataFlavor[] getTransferDataFlavors() {
....@@ -2093,7 +2177,11 @@
20932177 shadow.material = new cMaterial(obj.material);
20942178 shadow.material.diffuse = 0.0001f;
20952179 shadow.material.specular = 0.0001f;
2096
- //shadow.projectedVertices[1].x = 300;
2180
+ shadow.material.opacity = 0.75f;
2181
+
2182
+ AllocProjectedVertices(shadow);
2183
+
2184
+ shadow.projectedVertices[1].x = 300;
20972185
20982186 makeSomething(shadow);
20992187 }
....@@ -2614,27 +2702,35 @@
26142702 } else
26152703 if (source == loopItem || source == loopButton)
26162704 {
2705
+ if (!group.selection.isEmpty())
2706
+ {
26172707 Composite csg = new GroupLeaf();
26182708 csg.count = 5;
2619
- group(csg);
26202709 Composite child = new cGroup("Branch");
26212710 csg.addChild(child);
26222711 child.addChild(csg);
2712
+ group(csg);
2713
+ }
26232714 } else
26242715 if (source == doubleItem)
26252716 {
2717
+ if (!group.selection.isEmpty())
2718
+ {
26262719 Composite csg = new GroupLeaf("Fork");
26272720 csg.count = 5;
2628
- group(csg);
26292721 Composite child = new cGroup("Branch A");
26302722 csg.addChild(child);
26312723 child.addChild(csg);
26322724 child = new cGroup("Branch B");
26332725 csg.addChild(child);
26342726 child.addChild(csg);
2727
+ group(csg);
2728
+ }
26352729 } else
26362730 if (source == tripleItem)
26372731 {
2732
+ if (!group.selection.isEmpty())
2733
+ {
26382734 Composite csg = new GroupLeaf("Trident");
26392735 csg.count = 4;
26402736 group(csg);
....@@ -2647,6 +2743,7 @@
26472743 child = new cGroup();
26482744 csg.addChild(child);
26492745 child.addChild(csg);
2746
+ }
26502747 } else
26512748 if (source == computeAOItem)
26522749 {
....@@ -2696,6 +2793,18 @@
26962793 if (source == fullButton)
26972794 {
26982795 ToggleFullScreen();
2796
+ } else
2797
+ if (source == collapseButton)
2798
+ {
2799
+ this.expandedLayout = radio.layout;
2800
+ CollapseToolbar();
2801
+ } else
2802
+ if (source == maximize3DButton)
2803
+ {
2804
+ this.expandedLayout = radio.layout;
2805
+ radio.layout = twoButton;
2806
+ Show3DView();
2807
+ CollapseToolbar();
26992808 } else
27002809 if (source == previousVersionButton)
27012810 {
....@@ -3270,22 +3379,34 @@
32703379 } else
32713380 if (source == ungroupItem || source == ungroupButton)
32723381 {
3273
- boolean hasRoot = false;
3382
+ boolean canUngroup = true;
32743383
32753384 for (int i=0; i<group.selection.size(); i++)
32763385 {
3277
- if (group.selection.get(i) == group)
3386
+ Object3D selectedItem = group.selection.get(i);
3387
+
3388
+ if (selectedItem.Size() == 0)
32783389 {
3279
- hasRoot = true;
3390
+ // Cannot ungroup leaves
3391
+ canUngroup = false;
3392
+ break;
3393
+ }
3394
+
3395
+ if (selectedItem == group)
3396
+ {
3397
+ // Cannot ungroup root
3398
+ canUngroup = false;
32803399 break;
32813400 }
32823401 }
32833402
3284
- if (!hasRoot)
3403
+ if (canUngroup)
32853404 {
32863405 for (int i=0; i<group.selection.size(); i++)
32873406 {
3288
- Ungroup(group.selection.get(i));
3407
+ Object3D selectedItem = group.selection.get(i);
3408
+
3409
+ Ungroup(selectedItem);
32893410 }
32903411
32913412 ClearSelection(false);
....@@ -3648,38 +3769,7 @@
36483769 if (CameraPane.FULLSCREEN)
36493770 fullscreenLayout = radio.layout;
36503771
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();
3772
+ Show3DView();
36833773
36843774 cameraView.requestFocusInWindow();
36853775
....@@ -3865,6 +3955,7 @@
38653955 } else
38663956 if (source == rootButton)
38673957 {
3958
+ Replace();
38683959 Object3D obj;
38693960 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
38703961 {
....@@ -3879,6 +3970,8 @@
38793970 if (source == closeButton)
38803971 {
38813972 //System.out.println("CLOSE: " + buttonGroup.getSelection());
3973
+ Replace();
3974
+
38823975 cRadio ab;
38833976 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
38843977 {
....@@ -3977,6 +4070,8 @@
39774070 } else
39784071 if(source instanceof cRadio)
39794072 {
4073
+ Replace();
4074
+
39804075 group.parent = keepparent;
39814076 group.attributes = 0;
39824077 //group.editWindow = null;
....@@ -4001,8 +4096,6 @@
40014096
40024097 copy = group;
40034098
4004
- SetUndoStates();
4005
-
40064099 //Globals.theRenderer.object = group;
40074100 if(!useclient)
40084101 {
....@@ -4030,6 +4123,29 @@
40304123 */
40314124 radio.layout.doClick();
40324125
4126
+ assert(copy instanceof Composite);
4127
+
4128
+ if (copy.versionlist == null)
4129
+ {
4130
+ copy.versionindex = -1;
4131
+
4132
+ // Cannot work with loops
4133
+ // To fix this issue, we first mark all nodes above the root,
4134
+ // and check if any of these nodes are reachable below the root.
4135
+ Grafreed.grafreed.universe.TagObjects(copy, true);
4136
+
4137
+ if (!copy.HasTags())
4138
+ {
4139
+ copy.versionlist = new Object3D[100];
4140
+
4141
+ Save(true);
4142
+ }
4143
+
4144
+ Grafreed.grafreed.universe.TagObjects(copy, false);
4145
+ }
4146
+
4147
+ SetVersionStates();
4148
+
40334149 ClearUnpinned();
40344150
40354151 //Grafreed.Assert(group != null);
....@@ -4173,7 +4289,7 @@
41734289 TouchTransform(obj);
41744290 continue;
41754291 }
4176
- if ((mask&2) != 0) // Scale
4292
+ if ((mask&2) != 0) // Scale/rotation
41774293 {
41784294 obj.toParent[0][0] = obj.toParent[1][1] = obj.toParent[2][2] = 1;
41794295 obj.toParent[0][1] = obj.toParent[1][0] = obj.toParent[2][0] = 0;
....@@ -4181,10 +4297,6 @@
41814297 obj.fromParent[0][0] = obj.fromParent[1][1] = obj.fromParent[2][2] = 1;
41824298 obj.fromParent[0][1] = obj.fromParent[1][0] = obj.fromParent[2][0] = 0;
41834299 obj.fromParent[0][2] = obj.fromParent[1][2] = obj.fromParent[2][1] = 0;
4184
- }
4185
- if ((mask&4) != 0) // Rotation
4186
- {
4187
- // ?
41884300 }
41894301 if ((mask&1) != 0) // Translation
41904302 {
....@@ -5264,10 +5376,26 @@
52645376 flashSelectionButton.setEnabled(enabled);
52655377
52665378 clearPanelButton.setEnabled(!listUI.isEmpty());
5379
+
5380
+ boolean allComposites = true;
5381
+
5382
+ if (group.selection != null)
5383
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
5384
+ {
5385
+ Object next = e.nextElement();
5386
+ if (!(next instanceof Composite)) // || (next instanceof GroupLeaf))
5387
+ {
5388
+ allComposites = false;
5389
+ break;
5390
+ }
5391
+ }
5392
+
5393
+ rootButton.setEnabled(allComposites);
52675394 }
52685395
52695396 void refreshContents(boolean cp)
52705397 {
5398
+ if (false)
52715399 //if (objectPanel.getSelectedIndex() == 2) // objectPanel.indexOfTab("Info"))
52725400 if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
52735401 {
....@@ -5278,7 +5406,7 @@
52785406 Object3D child = (Object3D) group.selection.get(i);
52795407
52805408 objEditor.AddInfo(child, this, true);
5281
- System.err.println("info : " + child.GetPath());
5409
+// System.err.println("info : " + child.GetPath());
52825410 }
52835411
52845412 objEditor.SetText(); // jan 2014
....@@ -6161,11 +6289,11 @@
61616289 private MenuItem lookAtItem;
61626290 private MenuItem lookFromItem;
61636291 private MenuItem switchViewItem;
6164
- private MenuItem cutItem;
6292
+ private JMenuItem cutItem;
61656293 private MenuItem undoItem;
61666294 private MenuItem redoItem;
61676295 private JMenuItem duplicateItem;
6168
- private MenuItem cloneItem;
6296
+ private JMenuItem cloneItem;
61696297 private MenuItem cloneSupportItem;
61706298 private MenuItem overwriteGeoItem;
61716299 private MenuItem overwriteMatItem;
....@@ -6186,13 +6314,13 @@
61866314 private MenuItem cloneGeometriesItem;
61876315 private MenuItem shareGeometriesItem;
61886316 private MenuItem mergeGeometriesItem;
6189
- private MenuItem copyItem;
6317
+ private JMenuItem copyItem;
61906318 private MenuItem pasteItem;
6191
- private MenuItem pasteIntoItem;
6192
- private MenuItem pasteLinkItem;
6193
- private MenuItem pasteCloneItem;
6194
- private MenuItem pasteExpandItem;
6195
- private MenuItem deleteItem;
6319
+ private JMenuItem pasteIntoItem;
6320
+ private JMenuItem pasteLinkItem;
6321
+ private JMenuItem pasteCloneItem;
6322
+ private JMenuItem pasteExpandItem;
6323
+ private JMenuItem deleteItem;
61966324 private MenuItem clearAllItem;
61976325 private MenuItem genUVItem;
61986326 private MenuItem genNormalsMESHItem;
....@@ -6247,7 +6375,7 @@
62476375 private MenuItem transformGeometryItem;
62486376 private MenuItem transformChildrenItem;
62496377 private MenuItem hideItem;
6250
- private MenuItem grabItem;
6378
+ private JMenuItem grabItem;
62516379 private MenuItem backItem;
62526380 private MenuItem frontItem;
62536381 private MenuItem cameraItem;
....@@ -6260,7 +6388,7 @@
62606388 private MenuItem switchTransfoItem;
62616389 private MenuItem morphItem;
62626390 private MenuItem linkerItem;
6263
- private MenuItem ungroupItem;
6391
+ private JMenuItem ungroupItem;
62646392 private MenuItem editItem;
62656393 private MenuItem openWindowItem;
62666394 private MenuItem editLeafItem;