Normand Briere
2019-08-20 537f4ac57ae2b34f0a04fa63874c8ca6534c9a6d
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,28 +951,29 @@
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;
930965 }
931966
932
- if (path.length > 2 && path[2].toLowerCase().endsWith(".jpg"))
967
+ if (path.length > 2 && (path[2].toLowerCase().endsWith(".jpg") || path[2].toLowerCase().endsWith(".png")))
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
942
- AddTextureButton(path[0], path[1], path[2], texturecount++, currenttab);
976
+ AddTextureButton(path[0], path[1], path[2], ++texturecount, currenttab);
943977
944978 if (++colcount >= columns)
945979 {
....@@ -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,11 @@
12051259
12061260 CreateTexturePanel(textures);
12071261
1262
+ int tabCount = resourcecontainer.getTabCount();
1263
+
1264
+ if (tabCount > 0)
1265
+ resourcecontainer.setSelectedIndex((int)(Math.random() * tabCount));
1266
+
12081267 oe.toolboxPanel.add(textures);
12091268
12101269 textures.preferredHeight = 100;
....@@ -1212,11 +1271,11 @@
12121271 CreateSkyboxPanel(oe.skyboxPanel);
12131272
12141273 // EDIT panel
1215
- editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1274
+ editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12161275 editButton.setToolTipText("Pin selection controls");
12171276 editButton.addActionListener(this);
12181277
1219
- editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1278
+ editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12201279 uneditButton.setToolTipText("Unpin and remove selection controls");
12211280 uneditButton.addActionListener(this);
12221281
....@@ -1224,7 +1283,7 @@
12241283 allParamsButton.setToolTipText("Show all controls");
12251284 allParamsButton.addActionListener(this);
12261285
1227
- editCommandsPanel.add(clearPanelButton = GetButton("icons/clear.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1286
+ editCommandsPanel.add(clearPanelButton = GetButton("icons/clear.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12281287 clearPanelButton.setToolTipText("Clear all controls");
12291288 clearPanelButton.addActionListener(this);
12301289
....@@ -1232,7 +1291,7 @@
12321291 //unselectButton.setToolTipText("Unselect");
12331292 //unselectButton.addActionListener(this);
12341293
1235
- editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1294
+ editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12361295 flashSelectionButton.setToolTipText("Highlight selection");
12371296 flashSelectionButton.addActionListener(this);
12381297
....@@ -1255,6 +1314,8 @@
12551314
12561315 cGridBag jSPPanel = new cGridBag();
12571316
1317
+ jSPPanel.preferredHeight = 20;
1318
+
12581319 JScrollPane jSP;
12591320 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
12601321 jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
....@@ -1263,11 +1324,11 @@
12631324 oe.treePanel.add(jSPPanel);
12641325 oe.treePanel.Return();
12651326
1266
- oe.treePanel.add(copyOptionsPanel);
1327
+ oe.treePanel.add(versionManagerPanel);
12671328 oe.treePanel.Return();
1268
- cGridBag sliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
1269
- versionSlider = (cNumberSlider)sliderPane.getComponent(1);
1270
- sliderPane.preferredHeight = 1;
1329
+ versionSliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
1330
+ versionSlider = (cNumberSlider)versionSliderPane.getComponent(1);
1331
+ versionSliderPane.preferredHeight = 3;
12711332
12721333 // mainPanel.setDividerLocation(0.1); //1.0);
12731334 mainPanel.setResizeWeight(0.4);
....@@ -1425,6 +1486,14 @@
14251486
14261487 void EditObject(Object3D obj)
14271488 {
1489
+ assert(obj instanceof Composite);
1490
+
1491
+// if (obj.versionlist == null)
1492
+// {
1493
+// obj.versionlist = new Object3D[100];
1494
+// obj.versionindex = -1;
1495
+// }
1496
+
14281497 cRadio radioButton = new cRadio(obj.name);
14291498
14301499 // June 2019. Patch to avoid bug with transparency.
....@@ -1449,6 +1518,7 @@
14491518
14501519 oe.SetupViews();
14511520
1521
+ if (Globals.DEBUG)
14521522 System.out.println("SetupViews");
14531523 DragSource.getDefaultDragSource().createDefaultDragGestureRecognizer(
14541524 oe.cameraView, DnDConstants.ACTION_COPY_OR_MOVE, this); // ACTION_LINK ??
....@@ -1815,7 +1885,12 @@
18151885 TreePath path;
18161886
18171887 public TransferableTreePath(TreePath tp) {
1818
- path = tp;
1888
+ Object[] objs = new Object[tp.getPathCount()];
1889
+ for (int i=0; i<objs.length; i++)
1890
+ {
1891
+ objs[i] = ((Object3D)tp.getPathComponent(i)).GetUUID();
1892
+ }
1893
+ path = new TreePath(objs);
18191894 }
18201895
18211896 public synchronized DataFlavor[] getTransferDataFlavors() {
....@@ -2105,7 +2180,11 @@
21052180 shadow.material = new cMaterial(obj.material);
21062181 shadow.material.diffuse = 0.0001f;
21072182 shadow.material.specular = 0.0001f;
2108
- //shadow.projectedVertices[1].x = 300;
2183
+ shadow.material.opacity = 0.75f;
2184
+
2185
+ AllocProjectedVertices(shadow);
2186
+
2187
+ shadow.projectedVertices[1].x = 300;
21092188
21102189 makeSomething(shadow);
21112190 }
....@@ -2626,27 +2705,35 @@
26262705 } else
26272706 if (source == loopItem || source == loopButton)
26282707 {
2708
+ if (!group.selection.isEmpty())
2709
+ {
26292710 Composite csg = new GroupLeaf();
26302711 csg.count = 5;
2631
- group(csg);
26322712 Composite child = new cGroup("Branch");
26332713 csg.addChild(child);
26342714 child.addChild(csg);
2715
+ group(csg);
2716
+ }
26352717 } else
26362718 if (source == doubleItem)
26372719 {
2720
+ if (!group.selection.isEmpty())
2721
+ {
26382722 Composite csg = new GroupLeaf("Fork");
26392723 csg.count = 5;
2640
- group(csg);
26412724 Composite child = new cGroup("Branch A");
26422725 csg.addChild(child);
26432726 child.addChild(csg);
26442727 child = new cGroup("Branch B");
26452728 csg.addChild(child);
26462729 child.addChild(csg);
2730
+ group(csg);
2731
+ }
26472732 } else
26482733 if (source == tripleItem)
26492734 {
2735
+ if (!group.selection.isEmpty())
2736
+ {
26502737 Composite csg = new GroupLeaf("Trident");
26512738 csg.count = 4;
26522739 group(csg);
....@@ -2659,6 +2746,7 @@
26592746 child = new cGroup();
26602747 csg.addChild(child);
26612748 child.addChild(csg);
2749
+ }
26622750 } else
26632751 if (source == computeAOItem)
26642752 {
....@@ -2708,6 +2796,18 @@
27082796 if (source == fullButton)
27092797 {
27102798 ToggleFullScreen();
2799
+ } else
2800
+ if (source == collapseButton)
2801
+ {
2802
+ this.expandedLayout = radio.layout;
2803
+ CollapseToolbar();
2804
+ } else
2805
+ if (source == maximize3DButton)
2806
+ {
2807
+ this.expandedLayout = radio.layout;
2808
+ radio.layout = twoButton;
2809
+ Show3DView();
2810
+ CollapseToolbar();
27112811 } else
27122812 if (source == previousVersionButton)
27132813 {
....@@ -3282,22 +3382,34 @@
32823382 } else
32833383 if (source == ungroupItem || source == ungroupButton)
32843384 {
3285
- boolean hasRoot = false;
3385
+ boolean canUngroup = true;
32863386
32873387 for (int i=0; i<group.selection.size(); i++)
32883388 {
3289
- if (group.selection.get(i) == group)
3389
+ Object3D selectedItem = group.selection.get(i);
3390
+
3391
+ if (selectedItem.Size() == 0)
32903392 {
3291
- hasRoot = true;
3393
+ // Cannot ungroup leaves
3394
+ canUngroup = false;
3395
+ break;
3396
+ }
3397
+
3398
+ if (selectedItem == group)
3399
+ {
3400
+ // Cannot ungroup root
3401
+ canUngroup = false;
32923402 break;
32933403 }
32943404 }
32953405
3296
- if (!hasRoot)
3406
+ if (canUngroup)
32973407 {
32983408 for (int i=0; i<group.selection.size(); i++)
32993409 {
3300
- Ungroup(group.selection.get(i));
3410
+ Object3D selectedItem = group.selection.get(i);
3411
+
3412
+ Ungroup(selectedItem);
33013413 }
33023414
33033415 ClearSelection(false);
....@@ -3660,38 +3772,7 @@
36603772 if (CameraPane.FULLSCREEN)
36613773 fullscreenLayout = radio.layout;
36623774
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();
3775
+ Show3DView();
36953776
36963777 cameraView.requestFocusInWindow();
36973778
....@@ -3877,6 +3958,7 @@
38773958 } else
38783959 if (source == rootButton)
38793960 {
3961
+ Replace();
38803962 Object3D obj;
38813963 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
38823964 {
....@@ -3891,6 +3973,8 @@
38913973 if (source == closeButton)
38923974 {
38933975 //System.out.println("CLOSE: " + buttonGroup.getSelection());
3976
+ Replace();
3977
+
38943978 cRadio ab;
38953979 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
38963980 {
....@@ -3989,6 +4073,8 @@
39894073 } else
39904074 if(source instanceof cRadio)
39914075 {
4076
+ Replace();
4077
+
39924078 group.parent = keepparent;
39934079 group.attributes = 0;
39944080 //group.editWindow = null;
....@@ -4013,8 +4099,6 @@
40134099
40144100 copy = group;
40154101
4016
- SetUndoStates();
4017
-
40184102 //Globals.theRenderer.object = group;
40194103 if(!useclient)
40204104 {
....@@ -4042,6 +4126,29 @@
40424126 */
40434127 radio.layout.doClick();
40444128
4129
+ assert(copy instanceof Composite);
4130
+
4131
+ if (copy.versionlist == null)
4132
+ {
4133
+ copy.versionindex = -1;
4134
+
4135
+ // Cannot work with loops
4136
+ // To fix this issue, we first mark all nodes above the root,
4137
+ // and check if any of these nodes are reachable below the root.
4138
+ Grafreed.grafreed.universe.TagObjects(copy, true);
4139
+
4140
+ if (!copy.HasTags())
4141
+ {
4142
+ copy.versionlist = new Object3D[100];
4143
+
4144
+ Save(true);
4145
+ }
4146
+
4147
+ Grafreed.grafreed.universe.TagObjects(copy, false);
4148
+ }
4149
+
4150
+ SetVersionStates();
4151
+
40454152 ClearUnpinned();
40464153
40474154 //Grafreed.Assert(group != null);
....@@ -4185,7 +4292,7 @@
41854292 TouchTransform(obj);
41864293 continue;
41874294 }
4188
- if ((mask&2) != 0) // Scale
4295
+ if ((mask&2) != 0) // Scale/rotation
41894296 {
41904297 obj.toParent[0][0] = obj.toParent[1][1] = obj.toParent[2][2] = 1;
41914298 obj.toParent[0][1] = obj.toParent[1][0] = obj.toParent[2][0] = 0;
....@@ -4193,10 +4300,6 @@
41934300 obj.fromParent[0][0] = obj.fromParent[1][1] = obj.fromParent[2][2] = 1;
41944301 obj.fromParent[0][1] = obj.fromParent[1][0] = obj.fromParent[2][0] = 0;
41954302 obj.fromParent[0][2] = obj.fromParent[1][2] = obj.fromParent[2][1] = 0;
4196
- }
4197
- if ((mask&4) != 0) // Rotation
4198
- {
4199
- // ?
42004303 }
42014304 if ((mask&1) != 0) // Translation
42024305 {
....@@ -5276,10 +5379,26 @@
52765379 flashSelectionButton.setEnabled(enabled);
52775380
52785381 clearPanelButton.setEnabled(!listUI.isEmpty());
5382
+
5383
+ boolean allComposites = true;
5384
+
5385
+ if (group.selection != null)
5386
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
5387
+ {
5388
+ Object next = e.nextElement();
5389
+ if (!(next instanceof Composite)) // || (next instanceof GroupLeaf))
5390
+ {
5391
+ allComposites = false;
5392
+ break;
5393
+ }
5394
+ }
5395
+
5396
+ rootButton.setEnabled(allComposites);
52795397 }
52805398
52815399 void refreshContents(boolean cp)
52825400 {
5401
+ if (Globals.ADVANCED)
52835402 //if (objectPanel.getSelectedIndex() == 2) // objectPanel.indexOfTab("Info"))
52845403 if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
52855404 {
....@@ -5290,7 +5409,7 @@
52905409 Object3D child = (Object3D) group.selection.get(i);
52915410
52925411 objEditor.AddInfo(child, this, true);
5293
- System.err.println("info : " + child.GetPath());
5412
+// System.err.println("info : " + child.GetPath());
52945413 }
52955414
52965415 objEditor.SetText(); // jan 2014
....@@ -6173,11 +6292,11 @@
61736292 private MenuItem lookAtItem;
61746293 private MenuItem lookFromItem;
61756294 private MenuItem switchViewItem;
6176
- private MenuItem cutItem;
6295
+ private JMenuItem cutItem;
61776296 private MenuItem undoItem;
61786297 private MenuItem redoItem;
61796298 private JMenuItem duplicateItem;
6180
- private MenuItem cloneItem;
6299
+ private JMenuItem cloneItem;
61816300 private MenuItem cloneSupportItem;
61826301 private MenuItem overwriteGeoItem;
61836302 private MenuItem overwriteMatItem;
....@@ -6198,13 +6317,13 @@
61986317 private MenuItem cloneGeometriesItem;
61996318 private MenuItem shareGeometriesItem;
62006319 private MenuItem mergeGeometriesItem;
6201
- private MenuItem copyItem;
6320
+ private JMenuItem copyItem;
62026321 private MenuItem pasteItem;
6203
- private MenuItem pasteIntoItem;
6204
- private MenuItem pasteLinkItem;
6205
- private MenuItem pasteCloneItem;
6206
- private MenuItem pasteExpandItem;
6207
- private MenuItem deleteItem;
6322
+ private JMenuItem pasteIntoItem;
6323
+ private JMenuItem pasteLinkItem;
6324
+ private JMenuItem pasteCloneItem;
6325
+ private JMenuItem pasteExpandItem;
6326
+ private JMenuItem deleteItem;
62086327 private MenuItem clearAllItem;
62096328 private MenuItem genUVItem;
62106329 private MenuItem genNormalsMESHItem;
....@@ -6259,7 +6378,7 @@
62596378 private MenuItem transformGeometryItem;
62606379 private MenuItem transformChildrenItem;
62616380 private MenuItem hideItem;
6262
- private MenuItem grabItem;
6381
+ private JMenuItem grabItem;
62636382 private MenuItem backItem;
62646383 private MenuItem frontItem;
62656384 private MenuItem cameraItem;
....@@ -6272,7 +6391,7 @@
62726391 private MenuItem switchTransfoItem;
62736392 private MenuItem morphItem;
62746393 private MenuItem linkerItem;
6275
- private MenuItem ungroupItem;
6394
+ private JMenuItem ungroupItem;
62766395 private MenuItem editItem;
62776396 private MenuItem openWindowItem;
62786397 private MenuItem editLeafItem;