Normand Briere
2019-08-18 480ad70047e54b2b92f974e6c2ac5a6c0bdc5a5c
GroupEditor.java
....@@ -29,9 +29,9 @@
2929 {
3030 cButton skyboxButton;
3131 final String path = "cubemaps/" + f + "-skyboxes/" + s;
32
- row.add(skyboxButton = GetButton(path + "/preview.jpg", !Grafreed.NIMBUSLAF));
32
+ row.add(skyboxButton = GetButton(path + "/preview.jpg", !Globals.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
....@@ -46,7 +46,7 @@
4646 {
4747 cButton textureButton;
4848 final String path = "textures/" + f + "/" + c + "/"; // + t;
49
- row.add(textureButton = GetButton(path + "icons/" + t, !Grafreed.NIMBUSLAF));
49
+ row.add(textureButton = GetButton(path + "icons/" + t, !Globals.NIMBUSLAF));
5050 textureButton.setToolTipText(c + count);
5151 textureButton.addActionListener(new ActionListener()
5252 {
....@@ -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,15 +330,24 @@
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)
340349 {
341
- JTabbedPane skyboxpane = new JTabbedPane();
350
+ JTabbedPane skyboxpane = new JTabbedPane(JTabbedPane.LEFT);
342351
343352 AddSkyboxTab0(skyboxpane);
344353 AddSkyboxTab1(skyboxpane);
....@@ -357,6 +366,16 @@
357366 }
358367
359368 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();
360379 }
361380
362381 //ObjEditor objEditor;
....@@ -396,10 +415,14 @@
396415 this.copy = this.group = group;
397416 //selectees = this.group.selectees;
398417
418
+ assert(false);
419
+
399420 if (copy.versionlist == null)
400421 {
401422 copy.versionlist = new Object3D[100];
402423 copy.versionindex = -1;
424
+
425
+ //Save(true);
403426 }
404427
405428 if(ui)
....@@ -428,7 +451,7 @@
428451 copy.versionlist = new Object3D[100];
429452 copy.versionindex = -1;
430453
431
- Save(true);
454
+ //Save(true);
432455 }
433456 }
434457
....@@ -519,33 +542,35 @@
519542 // menu.add("-");
520543 duplicateItem = oe.jTree.popup.add(new JMenuItem("Duplicate"));
521544 duplicateItem.addActionListener(this);
522
- cloneItem = menu.add(new MenuItem("Clone"));
545
+
546
+ cloneItem = oe.jTree.popup.add(new JMenuItem("Clone"));
523547 cloneItem.addActionListener(this);
524
- if (Globals.ADVANCED)
548
+ //if (Globals.ADVANCED)
525549 {
526550 cloneSupportItem = menu.add(new MenuItem("Clone (+supports)"));
527551 cloneSupportItem.addActionListener(this);
528552 }
553
+ oe.jTree.popup.addSeparator();
529554 menu.add("-");
530
- cutItem = menu.add(new MenuItem("Cut"));
555
+ cutItem = oe.jTree.popup.add(new JMenuItem("Cut"));
531556 cutItem.addActionListener(this);
532
- copyItem = menu.add(new MenuItem("Copy"));
557
+ copyItem = oe.jTree.popup.add(new JMenuItem("Copy"));
533558 copyItem.addActionListener(this);
534559 pasteItem = menu.add(new MenuItem("Paste"));
535560 pasteItem.addActionListener(this);
536561
537
- menu.add("-");
538
- 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"));
539565 pasteIntoItem.addActionListener(this);
540
- pasteLinkItem = menu.add(new MenuItem("Paste link"));
566
+ pasteLinkItem = oe.jTree.popup.add(new JMenuItem("Paste link"));
541567 pasteLinkItem.addActionListener(this);
542
- pasteCloneItem = menu.add(new MenuItem("Paste clone"));
568
+ pasteCloneItem = oe.jTree.popup.add(new JMenuItem("Paste clone"));
543569 pasteCloneItem.addActionListener(this);
544
-// pasteExpandItem = menu.add(new MenuItem("Paste expand"));
570
+// CRASH pasteExpandItem = oe.jTree.popup.add(new JMenuItem("Paste expand"));
545571 // pasteExpandItem.addActionListener(this);
546
- menu.add("-");
547
- deleteItem = menu.add(new MenuItem("Delete"));
548
- deleteItem.addActionListener(this);
572
+ //menu.add("-");
573
+ oe.jTree.popup.addSeparator();
549574
550575 if (Globals.ADVANCED)
551576 {
....@@ -631,11 +656,9 @@
631656 oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest"));
632657 //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection"));
633658 //cameraMenu.add(switchViewItem = new MenuItem("Reverse View"));
634
- editLeafItem = oe.cameraMenu.add(new MenuItem("Edit Leaf"));
635659 oe.cameraMenu.add("-");
636660 openWindowItem = oe.cameraMenu.add(new MenuItem("Edit copy..."));
637661 openWindowItem.addActionListener(this);
638
- editLeafItem.addActionListener(this);
639662 lookAtItem.addActionListener(this);
640663 //lookFromItem.addActinoListener(this);
641664 //switchViewItem.addActionListener(this);
....@@ -682,9 +705,8 @@
682705 setMasterItem.addActionListener(this);
683706 }
684707
685
- oe.menuBar.add(menu = new Menu("Group"));
686
-// grabItem = menu.add(new MenuItem("Grab"));
687
-// grabItem.addActionListener(this);
708
+ oe.menuBar.add(menu = new Menu("Order"));
709
+
688710 backItem = menu.add(new MenuItem("Back"));
689711 backItem.addActionListener(this);
690712 frontItem = menu.add(new MenuItem("Front"));
....@@ -692,13 +714,21 @@
692714 // compositeItem = menu.add(new MenuItem("Composite"));
693715 // compositeItem.addActionListener(this);
694716
717
+ grabItem = oe.jTree.popup.add(new JMenuItem("Group"));
718
+ grabItem.addActionListener(this);
719
+
695720 if (Globals.ADVANCED)
696721 {
697722 hideItem = menu.add(new MenuItem("Hidden Group"));
698723 hideItem.addActionListener(this);
699724 }
700
- ungroupItem = menu.add(new MenuItem("Ungroup"));
725
+ ungroupItem = oe.jTree.popup.add(new JMenuItem("Ungroup"));
701726 ungroupItem.addActionListener(this);
727
+
728
+ oe.jTree.popup.addSeparator();
729
+
730
+ deleteItem = oe.jTree.popup.add(new JMenuItem("Delete"));
731
+ deleteItem.addActionListener(this);
702732
703733 // menu.add("-");
704734 //
....@@ -827,9 +857,9 @@
827857 hideleavesItem.addActionListener(this);
828858 showleavesItem = menu.add(new MenuItem("Show Leaves"));
829859 showleavesItem.addActionListener(this);
830
- markleavesItem = menu.add(new MenuItem("Mark Leaves"));
860
+ markleavesItem = menu.add(new MenuItem("Anim Leaves"));
831861 markleavesItem.addActionListener(this);
832
- unmarkleavesItem = menu.add(new MenuItem("Unmark Leaves"));
862
+ unmarkleavesItem = menu.add(new MenuItem("Unanim Leaves"));
833863 unmarkleavesItem.addActionListener(this);
834864 rewindleavesItem = menu.add(new MenuItem("Rewind Leaves"));
835865 rewindleavesItem.addActionListener(this);
....@@ -883,6 +913,9 @@
883913 shareGeometriesItem.addActionListener(this);
884914 mergeGeometriesItem = menu.add(new MenuItem("Merge Geometries"));
885915 mergeGeometriesItem.addActionListener(this);
916
+ menu.add("-");
917
+ editLeafItem = menu.add(new MenuItem("Edit leaf..."));
918
+ editLeafItem.addActionListener(this);
886919 if (Globals.ADVANCED)
887920 {
888921 // Pretty much the same as duplicate and clone.
....@@ -901,7 +934,7 @@
901934
902935 JTabbedPane resourcecontainer;
903936 cGridBag currenttab;
904
- boolean added; // patch for jar
937
+ //boolean added; // patch for jar
905938
906939 int tabcount = 0;
907940 int colcount = 0;
....@@ -918,12 +951,14 @@
918951 // System.out.println();
919952
920953 if (//rowcount == 0 ||
921
- path.length == 1)
954
+ path.length == 1 && !path[0].equals("") && !path[0].equals(".DS_Store"))
922955 {
923956 currenttab = new cGridBag();
924
- added = false;
925957 String tabname = path[0]; // String.valueOf((char)('A'+tabcount));
926958 currenttab.setName(tabname);
959
+ //added = false;
960
+ resourcecontainer.add(currenttab);
961
+ resourcecontainer.setToolTipTextAt(tabcount++, "Texture Group " + tabname);
927962 rowcount = 1;
928963 colcount = 0;
929964 texturecount = 0;
....@@ -931,12 +966,11 @@
931966
932967 if (path.length > 2 && path[2].toLowerCase().endsWith(".jpg"))
933968 {
934
- if (!added)
969
+ //if (!added)
935970 {
936
- added = true;
937
- resourcecontainer.add(currenttab);
971
+ //added = true;
938972 String tabname = path[0]; // String.valueOf((char)('A'+tabcount));
939
- resourcecontainer.setToolTipTextAt(tabcount++, "Texture Group " + tabname);
973
+ currenttab = (cGridBag)resourcecontainer.getComponentAt(resourcecontainer.indexOfTab(tabname));
940974 }
941975
942976 AddTextureButton(path[0], path[1], path[2], texturecount++, currenttab);
....@@ -984,11 +1018,6 @@
9841018 //new Exception().printStackTrace();
9851019
9861020 oe.radioPanel = new JPanel(new GridBagLayout());
987
- oe.aConstraints.weightx = 1;
988
- oe.aConstraints.weighty = 0;
989
- oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
990
- oe.aConstraints.gridwidth = 100;
991
- oe.aConstraints.gridheight = 1;
9921021 // oe.toolbarPanel.add(radioPanel); //, oe.aConstraints);
9931022
9941023 oe.buttonGroup = new ButtonGroup();
....@@ -1009,9 +1038,9 @@
10091038 oe.radioPanel.add(dummyButton);
10101039 oe.buttonGroup.add(dummyButton);
10111040 */
1012
- cGridBag copyOptionsPanel = new cGridBag();
1041
+ cGridBag versionManagerPanel = new cGridBag();
10131042
1014
- copyOptionsPanel.preferredHeight = 2;
1043
+ versionManagerPanel.preferredHeight = 4;
10151044
10161045 //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
10171046
....@@ -1021,62 +1050,102 @@
10211050
10221051 if (Globals.ADVANCED)
10231052 {
1024
- oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1025
- maxButton.setToolTipText("Maximize window");
1026
- 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);
10271056 }
10281057
1029
- oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
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", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1071
+ collapseButton.setToolTipText("Collapse toolbar");
1072
+ collapseButton.addActionListener(this);
1073
+
1074
+ oe.toolbarPanel.add(maximize3DButton = GetButton("icons/square.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1075
+ maximize3DButton.setToolTipText("Maximize 3D view");
1076
+ maximize3DButton.addActionListener(this);
1077
+
1078
+ oe.toolbarPanel.add(twoButton = GetButton("icons/cube.png", !Globals.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", !Globals.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", !Globals.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
+ //
1096
+
1097
+ oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10301098 fullButton.setToolTipText("Full-screen window");
10311099 fullButton.addActionListener(this);
10321100
1033
- oe.toolbarPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1101
+ oe.toolbarPanel.add(screenfitButton = GetButton("icons/fit.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10341102 screenfitButton.setToolTipText("Screen fit");
10351103 screenfitButton.addActionListener(this);
10361104
1037
- oe.toolbarPanel.add(restoreCameraButton = GetButton("icons/eye.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1105
+ oe.toolbarPanel.add(restoreCameraButton = GetButton("icons/eye.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10381106 restoreCameraButton.setToolTipText("Restore viewpoint");
10391107 restoreCameraButton.addActionListener(this);
10401108
1041
- copyOptionsPanel.add(saveVersionButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1109
+ versionManagerPanel.add(saveVersionButton = GetButton("icons/down_arrow.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10421110 saveVersionButton.setToolTipText("Duplicate current version");
10431111 saveVersionButton.addActionListener(this);
10441112
1045
- copyOptionsPanel.add(deleteVersionButton = GetButton("icons/trash.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1113
+ versionManagerPanel.add(deleteVersionButton = GetButton("icons/trash.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10461114 deleteVersionButton.setToolTipText("Delete current version");
10471115 deleteVersionButton.addActionListener(this);
1116
+ deleteVersionButton.setEnabled(false);
10481117
1049
- copyOptionsPanel.add(previousVersionButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1118
+ versionManagerPanel.add(previousVersionButton = GetButton("icons/undo.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10501119 previousVersionButton.setToolTipText("Previous version");
10511120 previousVersionButton.addActionListener(this);
10521121 previousVersionButton.setEnabled(false);
10531122
10541123 cGridBag updown = new cGridBag().setVertical(true);
1055
- updown.add(restoreButton = GetButton("icons/restore.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1124
+ updown.add(restoreButton = GetButton("icons/restore.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10561125 restoreButton.setToolTipText("Undo (restore current version)");
10571126 restoreButton.addActionListener(this);
1058
- //restoreButton.setEnabled(false);
1127
+ restoreButton.setEnabled(false);
10591128
1060
- updown.add(replaceButton = GetButton("icons/replace.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1129
+ updown.add(replaceButton = GetButton("icons/replace.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10611130 replaceButton.setToolTipText("Save (replace current version)");
10621131 replaceButton.addActionListener(this);
1063
- //replaceButton.setEnabled(false);
1132
+ replaceButton.setEnabled(false);
10641133
1065
- copyOptionsPanel.add(updown);
1134
+ versionManagerPanel.add(updown);
10661135
1067
- copyOptionsPanel.add(nextVersionButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1136
+ versionManagerPanel.add(nextVersionButton = GetButton("icons/redo.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10681137 nextVersionButton.setToolTipText("Next version");
10691138 nextVersionButton.addActionListener(this);
10701139 nextVersionButton.setEnabled(false);
1140
+
1141
+ oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1142
+ oneStepButton.setToolTipText("Animate one step forward");
1143
+ oneStepButton.addActionListener(this);
10711144
10721145 oe.toolbarPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
10731146 liveCB.setToolTipText("Enable animation");
10741147 liveCB.addItemListener(this);
10751148
1076
- oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1077
- oneStepButton.setToolTipText("Animate one step forward");
1078
- oneStepButton.addActionListener(this);
1079
-
10801149 oe.toolbarPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
10811150 fastCB.setToolTipText("Fast mode");
10821151 fastCB.addItemListener(this);
....@@ -1092,38 +1161,23 @@
10921161
10931162 if (Globals.ADVANCED)
10941163 {
1095
- oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1164
+ oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10961165 snapobjectButton.addActionListener(this);
10971166 snapobjectButton.setToolTipText("Snap Object");
10981167
1099
- oe.toolbarPanel.add(fourButton = GetButton("icons/controls-horizontal.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1168
+ oe.toolbarPanel.add(fourButton = GetButton("icons/controls-horizontal.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11001169 fourButton.addActionListener(this);
11011170 fourButton.setToolTipText("Show control panel only");
11021171 }
11031172
11041173 //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
11051174
1106
- oe.toolbarPanel.add(twoButton = GetButton("icons/cube.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1107
- twoButton.setToolTipText("Show 3D view only");
1108
- twoButton.addActionListener(this);
1109
- this.fullscreenLayout = twoButton;
1110
-
1111
- oe.toolbarPanel.add(threeButton = GetButton("icons/controlsview.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1112
- threeButton.setToolTipText("Show controls and 3D view");
1113
- threeButton.addActionListener(this);
1114
- oe.toolbarPanel.add(sixButton = GetButton("icons/viewcontrols.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1115
- sixButton.setToolTipText("Show 3D view and controls");
1116
- sixButton.addActionListener(this);
1117
-// oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1118
-// sevenButton.setToolTipText("3-column layout");
1119
-// sevenButton.addActionListener(this);
1120
- //
11211175
1122
- oe.toolbarPanel.add(rootButton = GetButton("icons/openwindow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1176
+ oe.toolbarPanel.add(rootButton = GetButton("icons/openwindow.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11231177 rootButton.setToolTipText("Open selection in new tab");
11241178 rootButton.addActionListener(this);
11251179
1126
- oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1180
+ oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11271181 closeButton.setToolTipText("Close tab");
11281182 closeButton.addActionListener(this);
11291183 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
....@@ -1132,38 +1186,38 @@
11321186 cGridBag row1 = new cGridBag();
11331187
11341188 // INSERT
1135
- row1.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1136
- gridButton.setToolTipText("Create grid");
1189
+ row1.add(gridButton = GetButton("icons/grid.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1190
+ gridButton.setToolTipText("Create ground");
11371191 gridButton.addActionListener(this);
11381192
1139
- row1.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1193
+ row1.add(boxButton = GetButton("icons/box.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11401194 boxButton.setToolTipText("Create box");
11411195 boxButton.addActionListener(this);
11421196
1143
- row1.add(sphereButton = GetButton("icons/sphere.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1144
- sphereButton.setToolTipText("Create sphere");
1145
- sphereButton.addActionListener(this);
1146
-
1147
- row1.add(coneButton = GetButton("icons/cone.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1148
- coneButton.setToolTipText("Create cone");
1149
- coneButton.addActionListener(this);
1150
-
1151
- row1.add(torusButton = GetButton("icons/torus.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1152
- torusButton.setToolTipText("Create torus");
1153
- torusButton.addActionListener(this);
1154
-
1155
- row1.add(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1197
+ row1.add(superButton = GetButton("icons/super.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11561198 superButton.setToolTipText("Create superellipsoid");
11571199 superButton.addActionListener(this);
11581200
1201
+ row1.add(sphereButton = GetButton("icons/sphere.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1202
+ sphereButton.setToolTipText("Create sphere");
1203
+ sphereButton.addActionListener(this);
1204
+
1205
+ row1.add(coneButton = GetButton("icons/cone.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1206
+ coneButton.setToolTipText("Create cone");
1207
+ coneButton.addActionListener(this);
1208
+
1209
+ row1.add(torusButton = GetButton("icons/torus.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1210
+ torusButton.setToolTipText("Create torus");
1211
+ torusButton.addActionListener(this);
1212
+
11591213 if (Globals.ADVANCED)
11601214 {
1161
- oe.toolboxPanel.add(kleinButton = GetButton("icons/klein.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1215
+ oe.toolboxPanel.add(kleinButton = GetButton("icons/klein.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11621216 kleinButton.setToolTipText("Create Klein bottle");
11631217 kleinButton.addActionListener(this);
11641218 }
11651219
1166
- row1.add(particlesButton = GetButton("icons/particles.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1220
+ row1.add(particlesButton = GetButton("icons/particles.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11671221 particlesButton.setToolTipText("Create particle system");
11681222 particlesButton.addActionListener(this);
11691223
....@@ -1171,31 +1225,31 @@
11711225
11721226 cGridBag row2 = new cGridBag();
11731227
1174
- row2.add(groupButton = GetButton("icons/group.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1228
+ row2.add(groupButton = GetButton("icons/group.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11751229 groupButton.setToolTipText("Create group");
11761230 groupButton.addActionListener(this);
11771231
1178
- row2.add(compositeButton = GetButton("icons/composite.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1232
+ row2.add(compositeButton = GetButton("icons/composite.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11791233 compositeButton.setToolTipText("Create composite");
11801234 compositeButton.addActionListener(this);
11811235
1182
- row2.add(switchButton = GetButton("icons/switch.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1236
+ row2.add(switchButton = GetButton("icons/switch.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11831237 switchButton.setToolTipText("Create item switcher");
11841238 switchButton.addActionListener(this);
11851239
1186
- row2.add(loopButton = GetButton("icons/loop.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1240
+ row2.add(loopButton = GetButton("icons/loop.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11871241 loopButton.setToolTipText("Create loop");
11881242 loopButton.addActionListener(this);
11891243
1190
- row2.add(textureButton = GetButton("icons/texture.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1244
+ row2.add(textureButton = GetButton("icons/texture.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11911245 textureButton.setToolTipText("Create texture");
11921246 textureButton.addActionListener(this);
11931247
1194
- row2.add(overlayButton = GetButton("icons/overlay.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1248
+ row2.add(overlayButton = GetButton("icons/overlay.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11951249 overlayButton.setToolTipText("Create overlay");
11961250 overlayButton.addActionListener(this);
11971251
1198
- row2.add(lightButton = GetButton("icons/light-bulb.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1252
+ row2.add(lightButton = GetButton("icons/light-bulb.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11991253 lightButton.setToolTipText("Create light");
12001254 lightButton.addActionListener(this);
12011255
....@@ -1205,6 +1259,8 @@
12051259
12061260 CreateTexturePanel(textures);
12071261
1262
+ resourcecontainer.setSelectedIndex((int)(Math.random() * resourcecontainer.getTabCount()));
1263
+
12081264 oe.toolboxPanel.add(textures);
12091265
12101266 textures.preferredHeight = 100;
....@@ -1212,11 +1268,11 @@
12121268 CreateSkyboxPanel(oe.skyboxPanel);
12131269
12141270 // EDIT panel
1215
- editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1271
+ editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12161272 editButton.setToolTipText("Pin selection controls");
12171273 editButton.addActionListener(this);
12181274
1219
- editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1275
+ editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12201276 uneditButton.setToolTipText("Unpin and remove selection controls");
12211277 uneditButton.addActionListener(this);
12221278
....@@ -1224,7 +1280,7 @@
12241280 allParamsButton.setToolTipText("Show all controls");
12251281 allParamsButton.addActionListener(this);
12261282
1227
- editCommandsPanel.add(clearPanelButton = GetButton("icons/clear.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1283
+ editCommandsPanel.add(clearPanelButton = GetButton("icons/clear.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12281284 clearPanelButton.setToolTipText("Clear all controls");
12291285 clearPanelButton.addActionListener(this);
12301286
....@@ -1232,7 +1288,7 @@
12321288 //unselectButton.setToolTipText("Unselect");
12331289 //unselectButton.addActionListener(this);
12341290
1235
- editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1291
+ editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12361292 flashSelectionButton.setToolTipText("Highlight selection");
12371293 flashSelectionButton.addActionListener(this);
12381294
....@@ -1255,6 +1311,8 @@
12551311
12561312 cGridBag jSPPanel = new cGridBag();
12571313
1314
+ jSPPanel.preferredHeight = 20;
1315
+
12581316 JScrollPane jSP;
12591317 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
12601318 jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
....@@ -1263,11 +1321,11 @@
12631321 oe.treePanel.add(jSPPanel);
12641322 oe.treePanel.Return();
12651323
1266
- oe.treePanel.add(copyOptionsPanel);
1324
+ oe.treePanel.add(versionManagerPanel);
12671325 oe.treePanel.Return();
1268
- cGridBag sliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
1269
- versionSlider = (cNumberSlider)sliderPane.getComponent(1);
1270
- sliderPane.preferredHeight = 1;
1326
+ versionSliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
1327
+ versionSlider = (cNumberSlider)versionSliderPane.getComponent(1);
1328
+ versionSliderPane.preferredHeight = 3;
12711329
12721330 // mainPanel.setDividerLocation(0.1); //1.0);
12731331 mainPanel.setResizeWeight(0.4);
....@@ -1425,6 +1483,14 @@
14251483
14261484 void EditObject(Object3D obj)
14271485 {
1486
+ assert(obj instanceof Composite);
1487
+
1488
+// if (obj.versionlist == null)
1489
+// {
1490
+// obj.versionlist = new Object3D[100];
1491
+// obj.versionindex = -1;
1492
+// }
1493
+
14281494 cRadio radioButton = new cRadio(obj.name);
14291495
14301496 // June 2019. Patch to avoid bug with transparency.
....@@ -1449,6 +1515,7 @@
14491515
14501516 oe.SetupViews();
14511517
1518
+ if (Globals.DEBUG)
14521519 System.out.println("SetupViews");
14531520 DragSource.getDefaultDragSource().createDefaultDragGestureRecognizer(
14541521 oe.cameraView, DnDConstants.ACTION_COPY_OR_MOVE, this); // ACTION_LINK ??
....@@ -1815,7 +1882,12 @@
18151882 TreePath path;
18161883
18171884 public TransferableTreePath(TreePath tp) {
1818
- 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);
18191891 }
18201892
18211893 public synchronized DataFlavor[] getTransferDataFlavors() {
....@@ -2105,7 +2177,11 @@
21052177 shadow.material = new cMaterial(obj.material);
21062178 shadow.material.diffuse = 0.0001f;
21072179 shadow.material.specular = 0.0001f;
2108
- //shadow.projectedVertices[1].x = 300;
2180
+ shadow.material.opacity = 0.75f;
2181
+
2182
+ AllocProjectedVertices(shadow);
2183
+
2184
+ shadow.projectedVertices[1].x = 300;
21092185
21102186 makeSomething(shadow);
21112187 }
....@@ -2626,27 +2702,35 @@
26262702 } else
26272703 if (source == loopItem || source == loopButton)
26282704 {
2705
+ if (!group.selection.isEmpty())
2706
+ {
26292707 Composite csg = new GroupLeaf();
26302708 csg.count = 5;
2631
- group(csg);
26322709 Composite child = new cGroup("Branch");
26332710 csg.addChild(child);
26342711 child.addChild(csg);
2712
+ group(csg);
2713
+ }
26352714 } else
26362715 if (source == doubleItem)
26372716 {
2717
+ if (!group.selection.isEmpty())
2718
+ {
26382719 Composite csg = new GroupLeaf("Fork");
26392720 csg.count = 5;
2640
- group(csg);
26412721 Composite child = new cGroup("Branch A");
26422722 csg.addChild(child);
26432723 child.addChild(csg);
26442724 child = new cGroup("Branch B");
26452725 csg.addChild(child);
26462726 child.addChild(csg);
2727
+ group(csg);
2728
+ }
26472729 } else
26482730 if (source == tripleItem)
26492731 {
2732
+ if (!group.selection.isEmpty())
2733
+ {
26502734 Composite csg = new GroupLeaf("Trident");
26512735 csg.count = 4;
26522736 group(csg);
....@@ -2659,6 +2743,7 @@
26592743 child = new cGroup();
26602744 csg.addChild(child);
26612745 child.addChild(csg);
2746
+ }
26622747 } else
26632748 if (source == computeAOItem)
26642749 {
....@@ -2708,6 +2793,18 @@
27082793 if (source == fullButton)
27092794 {
27102795 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();
27112808 } else
27122809 if (source == previousVersionButton)
27132810 {
....@@ -3282,22 +3379,34 @@
32823379 } else
32833380 if (source == ungroupItem || source == ungroupButton)
32843381 {
3285
- boolean hasRoot = false;
3382
+ boolean canUngroup = true;
32863383
32873384 for (int i=0; i<group.selection.size(); i++)
32883385 {
3289
- if (group.selection.get(i) == group)
3386
+ Object3D selectedItem = group.selection.get(i);
3387
+
3388
+ if (selectedItem.Size() == 0)
32903389 {
3291
- 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;
32923399 break;
32933400 }
32943401 }
32953402
3296
- if (!hasRoot)
3403
+ if (canUngroup)
32973404 {
32983405 for (int i=0; i<group.selection.size(); i++)
32993406 {
3300
- Ungroup(group.selection.get(i));
3407
+ Object3D selectedItem = group.selection.get(i);
3408
+
3409
+ Ungroup(selectedItem);
33013410 }
33023411
33033412 ClearSelection(false);
....@@ -3660,38 +3769,7 @@
36603769 if (CameraPane.FULLSCREEN)
36613770 fullscreenLayout = radio.layout;
36623771
3663
- // bug
3664
- //gridPanel.setDividerLocation(1.0);
3665
- //bigPanel.setDividerLocation(0.0);
3666
-// bigThree.remove(scenePanel);
3667
-// bigThree.remove(centralPanel);
3668
-// bigThree.remove(XYZPanel);
3669
-// aWindowConstraints.gridx = 0;
3670
-// aWindowConstraints.gridy = 0;
3671
-// aWindowConstraints.gridwidth = 1;
3672
-// // aConstraints.gridheight = 3;
3673
-// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3674
-// aWindowConstraints.weightx = 0;
3675
-// aWindowConstraints.weighty = 1;
3676
-// //bigThree.add(jtp, aWindowConstraints);
3677
-// aWindowConstraints.weightx = 1;
3678
-// aWindowConstraints.gridwidth = 3;
3679
-// // aConstraints.gridheight = 3;
3680
-// aWindowConstraints.gridx = 1;
3681
-// aWindowConstraints.fill = GridBagConstraints.BOTH;
3682
-// bigThree.add(centralPanel, aWindowConstraints);
3683
-// aWindowConstraints.weightx = 0;
3684
-// aWindowConstraints.gridx = 4;
3685
-// aWindowConstraints.gridwidth = 1;
3686
-// // aConstraints.gridheight = 3;
3687
-// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3688
-// //bigThree.add(XYZPanel, aWindowConstraints);
3689
-// scenePanel.setVisible(false);
3690
-// centralPanel.setVisible(true);
3691
-// XYZPanel.setVisible(false);
3692
- bigThree.ClearUI();
3693
- bigThree.add(centralPanel);
3694
- bigThree.FlushUI();
3772
+ Show3DView();
36953773
36963774 cameraView.requestFocusInWindow();
36973775
....@@ -3877,6 +3955,7 @@
38773955 } else
38783956 if (source == rootButton)
38793957 {
3958
+ Replace();
38803959 Object3D obj;
38813960 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
38823961 {
....@@ -3891,6 +3970,8 @@
38913970 if (source == closeButton)
38923971 {
38933972 //System.out.println("CLOSE: " + buttonGroup.getSelection());
3973
+ Replace();
3974
+
38943975 cRadio ab;
38953976 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
38963977 {
....@@ -3989,6 +4070,8 @@
39894070 } else
39904071 if(source instanceof cRadio)
39914072 {
4073
+ Replace();
4074
+
39924075 group.parent = keepparent;
39934076 group.attributes = 0;
39944077 //group.editWindow = null;
....@@ -4013,8 +4096,6 @@
40134096
40144097 copy = group;
40154098
4016
- SetUndoStates();
4017
-
40184099 //Globals.theRenderer.object = group;
40194100 if(!useclient)
40204101 {
....@@ -4042,6 +4123,29 @@
40424123 */
40434124 radio.layout.doClick();
40444125
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
+
40454149 ClearUnpinned();
40464150
40474151 //Grafreed.Assert(group != null);
....@@ -4185,7 +4289,7 @@
41854289 TouchTransform(obj);
41864290 continue;
41874291 }
4188
- if ((mask&2) != 0) // Scale
4292
+ if ((mask&2) != 0) // Scale/rotation
41894293 {
41904294 obj.toParent[0][0] = obj.toParent[1][1] = obj.toParent[2][2] = 1;
41914295 obj.toParent[0][1] = obj.toParent[1][0] = obj.toParent[2][0] = 0;
....@@ -4193,10 +4297,6 @@
41934297 obj.fromParent[0][0] = obj.fromParent[1][1] = obj.fromParent[2][2] = 1;
41944298 obj.fromParent[0][1] = obj.fromParent[1][0] = obj.fromParent[2][0] = 0;
41954299 obj.fromParent[0][2] = obj.fromParent[1][2] = obj.fromParent[2][1] = 0;
4196
- }
4197
- if ((mask&4) != 0) // Rotation
4198
- {
4199
- // ?
42004300 }
42014301 if ((mask&1) != 0) // Translation
42024302 {
....@@ -5276,10 +5376,26 @@
52765376 flashSelectionButton.setEnabled(enabled);
52775377
52785378 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);
52795394 }
52805395
52815396 void refreshContents(boolean cp)
52825397 {
5398
+ if (Globals.ADVANCED)
52835399 //if (objectPanel.getSelectedIndex() == 2) // objectPanel.indexOfTab("Info"))
52845400 if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
52855401 {
....@@ -5290,7 +5406,7 @@
52905406 Object3D child = (Object3D) group.selection.get(i);
52915407
52925408 objEditor.AddInfo(child, this, true);
5293
- System.err.println("info : " + child.GetPath());
5409
+// System.err.println("info : " + child.GetPath());
52945410 }
52955411
52965412 objEditor.SetText(); // jan 2014
....@@ -6173,11 +6289,11 @@
61736289 private MenuItem lookAtItem;
61746290 private MenuItem lookFromItem;
61756291 private MenuItem switchViewItem;
6176
- private MenuItem cutItem;
6292
+ private JMenuItem cutItem;
61776293 private MenuItem undoItem;
61786294 private MenuItem redoItem;
61796295 private JMenuItem duplicateItem;
6180
- private MenuItem cloneItem;
6296
+ private JMenuItem cloneItem;
61816297 private MenuItem cloneSupportItem;
61826298 private MenuItem overwriteGeoItem;
61836299 private MenuItem overwriteMatItem;
....@@ -6198,13 +6314,13 @@
61986314 private MenuItem cloneGeometriesItem;
61996315 private MenuItem shareGeometriesItem;
62006316 private MenuItem mergeGeometriesItem;
6201
- private MenuItem copyItem;
6317
+ private JMenuItem copyItem;
62026318 private MenuItem pasteItem;
6203
- private MenuItem pasteIntoItem;
6204
- private MenuItem pasteLinkItem;
6205
- private MenuItem pasteCloneItem;
6206
- private MenuItem pasteExpandItem;
6207
- private MenuItem deleteItem;
6319
+ private JMenuItem pasteIntoItem;
6320
+ private JMenuItem pasteLinkItem;
6321
+ private JMenuItem pasteCloneItem;
6322
+ private JMenuItem pasteExpandItem;
6323
+ private JMenuItem deleteItem;
62086324 private MenuItem clearAllItem;
62096325 private MenuItem genUVItem;
62106326 private MenuItem genNormalsMESHItem;
....@@ -6259,7 +6375,7 @@
62596375 private MenuItem transformGeometryItem;
62606376 private MenuItem transformChildrenItem;
62616377 private MenuItem hideItem;
6262
- private MenuItem grabItem;
6378
+ private JMenuItem grabItem;
62636379 private MenuItem backItem;
62646380 private MenuItem frontItem;
62656381 private MenuItem cameraItem;
....@@ -6272,7 +6388,7 @@
62726388 private MenuItem switchTransfoItem;
62736389 private MenuItem morphItem;
62746390 private MenuItem linkerItem;
6275
- private MenuItem ungroupItem;
6391
+ private JMenuItem ungroupItem;
62766392 private MenuItem editItem;
62776393 private MenuItem openWindowItem;
62786394 private MenuItem editLeafItem;