Normand Briere
2019-09-02 21ac57b36a9e3b909853c7d64ac29b7ad72490a3
GroupEditor.java
....@@ -29,7 +29,7 @@
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));
3434 skyboxButton.setToolTipText(s.equals("") ? "No background" : s);
3535 skyboxButton.addActionListener(new ActionListener()
....@@ -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 {
....@@ -347,7 +347,7 @@
347347
348348 public void CreateSkyboxPanel(cGridBag skyboxPanel)
349349 {
350
- JTabbedPane skyboxpane = new JTabbedPane();
350
+ JTabbedPane skyboxpane = new JTabbedPane(JTabbedPane.LEFT);
351351
352352 AddSkyboxTab0(skyboxpane);
353353 AddSkyboxTab1(skyboxpane);
....@@ -366,16 +366,6 @@
366366 }
367367
368368 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();
379369 }
380370
381371 //ObjEditor objEditor;
....@@ -415,13 +405,15 @@
415405 this.copy = this.group = group;
416406 //selectees = this.group.selectees;
417407
418
- if (copy.versionlist == null)
419
- {
420
- copy.versionlist = new Object3D[100];
421
- copy.versionindex = -1;
422
-
423
- Save(true);
424
- }
408
+ assert(false);
409
+
410
+// if (copy.versionlist == null)
411
+// {
412
+// copy.versionlist = new Object3D[100];
413
+// copy.versionindex = -1;
414
+//
415
+// //Save(true);
416
+// }
425417
426418 if(ui)
427419 SetupUI(objEditor);
....@@ -444,13 +436,13 @@
444436
445437 ((cRadio)radioPanel.getComponent(0)).SetCamera(cameraView.renderCamera, true);
446438
447
- if (copy.versionlist == null)
448
- {
449
- copy.versionlist = new Object3D[100];
450
- copy.versionindex = -1;
451
-
452
- Save(true);
453
- }
439
+// if (copy.versionlist == null)
440
+// {
441
+// copy.versionlist = new Object3D[100];
442
+// copy.versionindex = -1;
443
+//
444
+// //Save(true);
445
+// }
454446 }
455447
456448 void CloneSelection(boolean supports)
....@@ -569,9 +561,6 @@
569561 // pasteExpandItem.addActionListener(this);
570562 //menu.add("-");
571563 oe.jTree.popup.addSeparator();
572
-
573
- deleteItem = oe.jTree.popup.add(new JMenuItem("Delete"));
574
- deleteItem.addActionListener(this);
575564
576565 if (Globals.ADVANCED)
577566 {
....@@ -706,15 +695,17 @@
706695 setMasterItem.addActionListener(this);
707696 }
708697
709
- oe.menuBar.add(menu = new Menu("Group"));
710
-// grabItem = menu.add(new MenuItem("Grab"));
711
-// grabItem.addActionListener(this);
698
+ oe.menuBar.add(menu = new Menu("Order"));
699
+
712700 backItem = menu.add(new MenuItem("Back"));
713701 backItem.addActionListener(this);
714702 frontItem = menu.add(new MenuItem("Front"));
715703 frontItem.addActionListener(this);
716704 // compositeItem = menu.add(new MenuItem("Composite"));
717705 // compositeItem.addActionListener(this);
706
+
707
+ grabItem = oe.jTree.popup.add(new JMenuItem("Group"));
708
+ grabItem.addActionListener(this);
718709
719710 if (Globals.ADVANCED)
720711 {
....@@ -723,6 +714,11 @@
723714 }
724715 ungroupItem = oe.jTree.popup.add(new JMenuItem("Ungroup"));
725716 ungroupItem.addActionListener(this);
717
+
718
+ oe.jTree.popup.addSeparator();
719
+
720
+ deleteItem = oe.jTree.popup.add(new JMenuItem("Delete"));
721
+ deleteItem.addActionListener(this);
726722
727723 // menu.add("-");
728724 //
....@@ -759,9 +755,9 @@
759755 shadowYItem.addActionListener(this);
760756 shadowZItem = menu.add(new MenuItem("Shadow Blue"));
761757 shadowZItem.addActionListener(this);
758
+
762759 attributeItem = menu.add(new MenuItem("Attribute"));
763760 attributeItem.addActionListener(this);
764
-
765761 if (Globals.ADVANCED)
766762 {
767763 menu.add("-");
....@@ -773,11 +769,18 @@
773769 pointflowItem.addActionListener(this);
774770 }
775771 menu.add("-");
772
+ textureRatioRItem = menu.add(new MenuItem("Texture Ratio Red"));
773
+ textureRatioRItem.addActionListener(this);
774
+ textureRatioGItem = menu.add(new MenuItem("Texture Ratio Green"));
775
+ textureRatioGItem.addActionListener(this);
776
+ textureRatioBItem = menu.add(new MenuItem("Texture Ratio Blue"));
777
+ textureRatioBItem.addActionListener(this);
778
+ menu.add("-");
776779 resetTransformItem = menu.add(new MenuItem("Reset Transform"));
777780 resetTransformItem.addActionListener(this);
778781 resetCentroidItem = menu.add(new MenuItem("Reset Centroid"));
779782 resetCentroidItem.addActionListener(this);
780
- resetCentroidXZItem = menu.add(new MenuItem("Reset Centroid XY"));
783
+ resetCentroidXZItem = menu.add(new MenuItem("Reset Centroid XZ"));
781784 resetCentroidXZItem.addActionListener(this);
782785 transformGeometryItem = menu.add(new MenuItem("Transform Geometry"));
783786 transformGeometryItem.addActionListener(this);
....@@ -829,6 +832,8 @@
829832 }
830833
831834 oe.menuBar.add(menu = new Menu("Attributes"));
835
+ clearVersionsItem = menu.add(new MenuItem("Clear Versions"));
836
+ clearVersionsItem.addActionListener(this);
832837 clearMaterialsItem = menu.add(new MenuItem("Clear Materials"));
833838 clearMaterialsItem.addActionListener(this);
834839 resetAllItem = menu.add(new MenuItem("Reset All"));
....@@ -851,9 +856,9 @@
851856 hideleavesItem.addActionListener(this);
852857 showleavesItem = menu.add(new MenuItem("Show Leaves"));
853858 showleavesItem.addActionListener(this);
854
- markleavesItem = menu.add(new MenuItem("Mark Leaves"));
859
+ markleavesItem = menu.add(new MenuItem("Anim Leaves"));
855860 markleavesItem.addActionListener(this);
856
- unmarkleavesItem = menu.add(new MenuItem("Unmark Leaves"));
861
+ unmarkleavesItem = menu.add(new MenuItem("Unanim Leaves"));
857862 unmarkleavesItem.addActionListener(this);
858863 rewindleavesItem = menu.add(new MenuItem("Rewind Leaves"));
859864 rewindleavesItem.addActionListener(this);
....@@ -930,6 +935,8 @@
930935 cGridBag currenttab;
931936 //boolean added; // patch for jar
932937
938
+ int totalcount = 0;
939
+
933940 int tabcount = 0;
934941 int colcount = 0;
935942 int rowcount = 0;
....@@ -958,7 +965,7 @@
958965 texturecount = 0;
959966 }
960967
961
- if (path.length > 2 && path[2].toLowerCase().endsWith(".jpg"))
968
+ if (path.length > 2 && (path[2].toLowerCase().endsWith(".jpg") || path[2].toLowerCase().endsWith(".png")))
962969 {
963970 //if (!added)
964971 {
....@@ -967,7 +974,8 @@
967974 currenttab = (cGridBag)resourcecontainer.getComponentAt(resourcecontainer.indexOfTab(tabname));
968975 }
969976
970
- AddTextureButton(path[0], path[1], path[2], texturecount++, currenttab);
977
+ AddTextureButton(path[0], path[1], path[2], ++texturecount, currenttab);
978
+ totalcount++;
971979
972980 if (++colcount >= columns)
973981 {
....@@ -993,6 +1001,8 @@
9931001 container.add(resourcecontainer);
9941002
9951003 Grafreed.ParseResources("textures", this);
1004
+
1005
+ // 935. System.out.println("Total = " + totalcount);
9961006 }
9971007
9981008 void SetupUI2(ObjEditor oe)
....@@ -1032,9 +1042,9 @@
10321042 oe.radioPanel.add(dummyButton);
10331043 oe.buttonGroup.add(dummyButton);
10341044 */
1035
- cGridBag copyOptionsPanel = new cGridBag();
1045
+ cGridBag versionManagerPanel = new cGridBag();
10361046
1037
- copyOptionsPanel.preferredHeight = 2;
1047
+ versionManagerPanel.preferredHeight = 4;
10381048
10391049 //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
10401050
....@@ -1061,25 +1071,29 @@
10611071 // }
10621072 // });
10631073
1064
- oe.toolbarPanel.add(collapseButton = GetButton("icons/collapse.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1074
+ oe.toolbarPanel.add(fullScreenButton = GetButton("icons/fullscreen.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1075
+ fullScreenButton.setToolTipText("Full-screen window");
1076
+ fullScreenButton.addActionListener(this);
1077
+
1078
+ oe.toolbarPanel.add(collapseButton = GetButton("icons/collapse.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10651079 collapseButton.setToolTipText("Collapse toolbar");
10661080 collapseButton.addActionListener(this);
10671081
1068
- oe.toolbarPanel.add(maximize3DButton = GetButton("", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1069
- maximize3DButton.setToolTipText("Maximize 3D view");
1070
- maximize3DButton.addActionListener(this);
1082
+// oe.toolbarPanel.add(maximize3DButton = GetButton("icons/square.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1083
+// maximize3DButton.setToolTipText("Maximize 3D view");
1084
+// maximize3DButton.addActionListener(this);
10711085
1072
- oe.toolbarPanel.add(twoButton = GetButton("icons/cube.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1086
+ oe.toolbarPanel.add(twoButton = GetButton("icons/cube.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10731087 twoButton.setToolTipText("Show 3D view only");
10741088 twoButton.addActionListener(this);
10751089 this.fullscreenLayout = twoButton;
10761090
1077
- oe.toolbarPanel.add(threeButton = GetButton("icons/controlsview.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1091
+ oe.toolbarPanel.add(threeButton = GetButton("icons/controlsview.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10781092 threeButton.setToolTipText("Show controls and 3D view");
10791093 threeButton.addActionListener(this);
10801094 if (Globals.ADVANCED)
10811095 {
1082
- oe.toolbarPanel.add(sixButton = GetButton("icons/viewcontrols.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1096
+ oe.toolbarPanel.add(sixButton = GetButton("icons/viewcontrols.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10831097 sixButton.setToolTipText("Show 3D view and controls");
10841098 sixButton.addActionListener(this);
10851099 }
....@@ -1088,50 +1102,47 @@
10881102 // sevenButton.addActionListener(this);
10891103 //
10901104
1091
- oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1092
- fullButton.setToolTipText("Full-screen window");
1093
- fullButton.addActionListener(this);
1094
-
1095
- oe.toolbarPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1105
+ oe.toolbarPanel.add(screenfitButton = GetButton("icons/fit.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10961106 screenfitButton.setToolTipText("Screen fit");
10971107 screenfitButton.addActionListener(this);
10981108
1099
- oe.toolbarPanel.add(restoreCameraButton = GetButton("icons/eye.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1109
+ oe.toolbarPanel.add(restoreCameraButton = GetButton("icons/eye.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11001110 restoreCameraButton.setToolTipText("Restore viewpoint");
11011111 restoreCameraButton.addActionListener(this);
11021112
1103
- copyOptionsPanel.add(saveVersionButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1113
+ versionManagerPanel.add(saveVersionButton = GetButton("icons/down_arrow.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11041114 saveVersionButton.setToolTipText("Duplicate current version");
11051115 saveVersionButton.addActionListener(this);
11061116
1107
- copyOptionsPanel.add(deleteVersionButton = GetButton("icons/trash.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1117
+ versionManagerPanel.add(deleteVersionButton = GetButton("icons/trash.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11081118 deleteVersionButton.setToolTipText("Delete current version");
11091119 deleteVersionButton.addActionListener(this);
1120
+ deleteVersionButton.setEnabled(false);
11101121
1111
- copyOptionsPanel.add(previousVersionButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1122
+ versionManagerPanel.add(previousVersionButton = GetButton("icons/undo.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11121123 previousVersionButton.setToolTipText("Previous version");
11131124 previousVersionButton.addActionListener(this);
11141125 previousVersionButton.setEnabled(false);
11151126
11161127 cGridBag updown = new cGridBag().setVertical(true);
1117
- updown.add(restoreButton = GetButton("icons/restore.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1128
+ updown.add(restoreButton = GetButton("icons/restore.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11181129 restoreButton.setToolTipText("Undo (restore current version)");
11191130 restoreButton.addActionListener(this);
1120
- //restoreButton.setEnabled(false);
1131
+ restoreButton.setEnabled(false);
11211132
1122
- updown.add(replaceButton = GetButton("icons/replace.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1133
+ updown.add(replaceButton = GetButton("icons/replace.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11231134 replaceButton.setToolTipText("Save (replace current version)");
11241135 replaceButton.addActionListener(this);
1125
- //replaceButton.setEnabled(false);
1136
+ replaceButton.setEnabled(false);
11261137
1127
- copyOptionsPanel.add(updown);
1138
+ versionManagerPanel.add(updown);
11281139
1129
- copyOptionsPanel.add(nextVersionButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1140
+ versionManagerPanel.add(nextVersionButton = GetButton("icons/redo.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11301141 nextVersionButton.setToolTipText("Next version");
11311142 nextVersionButton.addActionListener(this);
11321143 nextVersionButton.setEnabled(false);
11331144
1134
- oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1145
+ oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11351146 oneStepButton.setToolTipText("Animate one step forward");
11361147 oneStepButton.addActionListener(this);
11371148
....@@ -1154,11 +1165,11 @@
11541165
11551166 if (Globals.ADVANCED)
11561167 {
1157
- oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1168
+ oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11581169 snapobjectButton.addActionListener(this);
11591170 snapobjectButton.setToolTipText("Snap Object");
11601171
1161
- oe.toolbarPanel.add(fourButton = GetButton("icons/controls-horizontal.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1172
+ oe.toolbarPanel.add(fourButton = GetButton("icons/controls-horizontal.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11621173 fourButton.addActionListener(this);
11631174 fourButton.setToolTipText("Show control panel only");
11641175 }
....@@ -1166,11 +1177,11 @@
11661177 //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
11671178
11681179
1169
- oe.toolbarPanel.add(rootButton = GetButton("icons/openwindow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1180
+ oe.toolbarPanel.add(rootButton = GetButton("icons/openwindow.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11701181 rootButton.setToolTipText("Open selection in new tab");
11711182 rootButton.addActionListener(this);
11721183
1173
- oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1184
+ oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11741185 closeButton.setToolTipText("Close tab");
11751186 closeButton.addActionListener(this);
11761187 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
....@@ -1179,38 +1190,38 @@
11791190 cGridBag row1 = new cGridBag();
11801191
11811192 // INSERT
1182
- row1.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1193
+ row1.add(gridButton = GetButton("icons/grid.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11831194 gridButton.setToolTipText("Create ground");
11841195 gridButton.addActionListener(this);
11851196
1186
- row1.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1197
+ row1.add(boxButton = GetButton("icons/box.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11871198 boxButton.setToolTipText("Create box");
11881199 boxButton.addActionListener(this);
11891200
1190
- row1.add(sphereButton = GetButton("icons/sphere.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1191
- sphereButton.setToolTipText("Create sphere");
1192
- sphereButton.addActionListener(this);
1193
-
1194
- row1.add(coneButton = GetButton("icons/cone.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1195
- coneButton.setToolTipText("Create cone");
1196
- coneButton.addActionListener(this);
1197
-
1198
- row1.add(torusButton = GetButton("icons/torus.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1199
- torusButton.setToolTipText("Create torus");
1200
- torusButton.addActionListener(this);
1201
-
1202
- row1.add(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1201
+ row1.add(superButton = GetButton("icons/super.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12031202 superButton.setToolTipText("Create superellipsoid");
12041203 superButton.addActionListener(this);
12051204
1206
- if (Globals.ADVANCED)
1205
+ row1.add(sphereButton = GetButton("icons/sphere.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1206
+ sphereButton.setToolTipText("Create sphere");
1207
+ sphereButton.addActionListener(this);
1208
+
1209
+ row1.add(coneButton = GetButton("icons/cone.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1210
+ coneButton.setToolTipText("Create cone");
1211
+ coneButton.addActionListener(this);
1212
+
1213
+ row1.add(torusButton = GetButton("icons/torus.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1214
+ torusButton.setToolTipText("Create torus");
1215
+ torusButton.addActionListener(this);
1216
+
1217
+ if (false) //Globals.ADVANCED)
12071218 {
1208
- oe.toolboxPanel.add(kleinButton = GetButton("icons/klein.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1219
+ oe.toolboxPanel.add(kleinButton = GetButton("icons/klein.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12091220 kleinButton.setToolTipText("Create Klein bottle");
12101221 kleinButton.addActionListener(this);
12111222 }
12121223
1213
- row1.add(particlesButton = GetButton("icons/particles.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1224
+ row1.add(particlesButton = GetButton("icons/particles.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12141225 particlesButton.setToolTipText("Create particle system");
12151226 particlesButton.addActionListener(this);
12161227
....@@ -1218,31 +1229,31 @@
12181229
12191230 cGridBag row2 = new cGridBag();
12201231
1221
- row2.add(groupButton = GetButton("icons/group.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1232
+ row2.add(groupButton = GetButton("icons/group.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12221233 groupButton.setToolTipText("Create group");
12231234 groupButton.addActionListener(this);
12241235
1225
- row2.add(compositeButton = GetButton("icons/composite.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1236
+ row2.add(compositeButton = GetButton("icons/composite.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12261237 compositeButton.setToolTipText("Create composite");
12271238 compositeButton.addActionListener(this);
12281239
1229
- row2.add(switchButton = GetButton("icons/switch.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1240
+ row2.add(switchButton = GetButton("icons/switch.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12301241 switchButton.setToolTipText("Create item switcher");
12311242 switchButton.addActionListener(this);
12321243
1233
- row2.add(loopButton = GetButton("icons/loop.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1244
+ row2.add(loopButton = GetButton("icons/loop.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12341245 loopButton.setToolTipText("Create loop");
12351246 loopButton.addActionListener(this);
12361247
1237
- row2.add(textureButton = GetButton("icons/texture.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1248
+ row2.add(textureButton = GetButton("icons/texture.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12381249 textureButton.setToolTipText("Create texture");
12391250 textureButton.addActionListener(this);
12401251
1241
- row2.add(overlayButton = GetButton("icons/overlay.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1252
+ row2.add(overlayButton = GetButton("icons/overlay.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12421253 overlayButton.setToolTipText("Create overlay");
12431254 overlayButton.addActionListener(this);
12441255
1245
- row2.add(lightButton = GetButton("icons/light-bulb.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1256
+ row2.add(lightButton = GetButton("icons/light-bulb.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12461257 lightButton.setToolTipText("Create light");
12471258 lightButton.addActionListener(this);
12481259
....@@ -1252,6 +1263,11 @@
12521263
12531264 CreateTexturePanel(textures);
12541265
1266
+ int tabCount = resourcecontainer.getTabCount();
1267
+
1268
+ if (tabCount > 0)
1269
+ resourcecontainer.setSelectedIndex((int)(Math.random() * tabCount));
1270
+
12551271 oe.toolboxPanel.add(textures);
12561272
12571273 textures.preferredHeight = 100;
....@@ -1259,11 +1275,11 @@
12591275 CreateSkyboxPanel(oe.skyboxPanel);
12601276
12611277 // EDIT panel
1262
- editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1278
+ editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12631279 editButton.setToolTipText("Pin selection controls");
12641280 editButton.addActionListener(this);
12651281
1266
- editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1282
+ editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12671283 uneditButton.setToolTipText("Unpin and remove selection controls");
12681284 uneditButton.addActionListener(this);
12691285
....@@ -1271,7 +1287,7 @@
12711287 allParamsButton.setToolTipText("Show all controls");
12721288 allParamsButton.addActionListener(this);
12731289
1274
- editCommandsPanel.add(clearPanelButton = GetButton("icons/clear.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1290
+ editCommandsPanel.add(clearPanelButton = GetButton("icons/clear.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12751291 clearPanelButton.setToolTipText("Clear all controls");
12761292 clearPanelButton.addActionListener(this);
12771293
....@@ -1279,7 +1295,7 @@
12791295 //unselectButton.setToolTipText("Unselect");
12801296 //unselectButton.addActionListener(this);
12811297
1282
- editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1298
+ editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12831299 flashSelectionButton.setToolTipText("Highlight selection");
12841300 flashSelectionButton.addActionListener(this);
12851301
....@@ -1302,6 +1318,8 @@
13021318
13031319 cGridBag jSPPanel = new cGridBag();
13041320
1321
+ jSPPanel.preferredHeight = 20;
1322
+
13051323 JScrollPane jSP;
13061324 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
13071325 jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
....@@ -1310,11 +1328,11 @@
13101328 oe.treePanel.add(jSPPanel);
13111329 oe.treePanel.Return();
13121330
1313
- oe.treePanel.add(copyOptionsPanel);
1331
+ oe.treePanel.add(versionManagerPanel);
13141332 oe.treePanel.Return();
1315
- cGridBag sliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
1316
- versionSlider = (cNumberSlider)sliderPane.getComponent(1);
1317
- sliderPane.preferredHeight = 1;
1333
+ versionSliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
1334
+ versionSlider = (cNumberSlider)versionSliderPane.getComponent(1);
1335
+ versionSliderPane.preferredHeight = 3;
13181336
13191337 // mainPanel.setDividerLocation(0.1); //1.0);
13201338 mainPanel.setResizeWeight(0.4);
....@@ -1472,7 +1490,7 @@
14721490
14731491 void EditObject(Object3D obj)
14741492 {
1475
- assert(obj instanceof Composite);
1493
+ //assert(obj instanceof Composite);
14761494
14771495 // if (obj.versionlist == null)
14781496 // {
....@@ -1504,6 +1522,7 @@
15041522
15051523 oe.SetupViews();
15061524
1525
+ if (Globals.DEBUG)
15071526 System.out.println("SetupViews");
15081527 DragSource.getDefaultDragSource().createDefaultDragGestureRecognizer(
15091528 oe.cameraView, DnDConstants.ACTION_COPY_OR_MOVE, this); // ACTION_LINK ??
....@@ -2107,24 +2126,24 @@
21072126 switch(axis)
21082127 {
21092128 case 0 :
2110
- vert1.x = minima.x; vert1.y = minima.y; vert1.z = minima.z;
2111
- vert2.x = minima.x; vert2.y = maxima.y; vert2.z = minima.z;
2112
- vert3.x = minima.x; vert3.y = minima.y; vert3.z = maxima.z;
2113
- vert4.x = minima.x; vert4.y = maxima.y; vert4.z = maxima.z;
2129
+ vert1.x = minima.x + 0.001f; vert1.y = minima.y; vert1.z = minima.z;
2130
+ vert2.x = minima.x + 0.001f; vert2.y = maxima.y; vert2.z = minima.z;
2131
+ vert3.x = minima.x + 0.001f; vert3.y = minima.y; vert3.z = maxima.z;
2132
+ vert4.x = minima.x + 0.001f; vert4.y = maxima.y; vert4.z = maxima.z;
21142133 norm = cVector.X;
21152134 break;
21162135 case 1 :
2117
- vert1.x = minima.x; vert1.y = minima.y; vert1.z = minima.z;
2118
- vert2.x = maxima.x; vert2.y = minima.y; vert2.z = minima.z;
2119
- vert3.x = minima.x; vert3.y = minima.y; vert3.z = maxima.z;
2120
- vert4.x = maxima.x; vert4.y = minima.y; vert4.z = maxima.z;
2136
+ vert1.x = minima.x; vert1.y = minima.y + 0.001f; vert1.z = minima.z;
2137
+ vert2.x = maxima.x; vert2.y = minima.y + 0.001f; vert2.z = minima.z;
2138
+ vert3.x = minima.x; vert3.y = minima.y + 0.001f; vert3.z = maxima.z;
2139
+ vert4.x = maxima.x; vert4.y = minima.y + 0.001f; vert4.z = maxima.z;
21212140 norm = cVector.Y;
21222141 break;
21232142 case 2 :
2124
- vert1.x = minima.x; vert1.y = minima.y; vert1.z = minima.z;
2125
- vert2.x = maxima.x; vert2.y = minima.y; vert2.z = minima.z;
2126
- vert3.x = minima.x; vert3.y = maxima.y; vert3.z = minima.z;
2127
- vert4.x = maxima.x; vert4.y = maxima.y; vert4.z = minima.z;
2143
+ vert1.x = minima.x; vert1.y = minima.y; vert1.z = minima.z + 0.001f;
2144
+ vert2.x = maxima.x; vert2.y = minima.y; vert2.z = minima.z + 0.001f;
2145
+ vert3.x = minima.x; vert3.y = maxima.y; vert3.z = minima.z + 0.001f;
2146
+ vert4.x = maxima.x; vert4.y = maxima.y; vert4.z = minima.z + 0.001f;
21282147 norm = cVector.Z;
21292148 break;
21302149 }
....@@ -2165,7 +2184,11 @@
21652184 shadow.material = new cMaterial(obj.material);
21662185 shadow.material.diffuse = 0.0001f;
21672186 shadow.material.specular = 0.0001f;
2168
- //shadow.projectedVertices[1].x = 300;
2187
+ shadow.material.opacity = 0.75f;
2188
+
2189
+ AllocProjectedVertices(shadow);
2190
+
2191
+ shadow.projectedVertices[1].x = 300;
21692192
21702193 makeSomething(shadow);
21712194 }
....@@ -2689,11 +2712,11 @@
26892712 if (!group.selection.isEmpty())
26902713 {
26912714 Composite csg = new GroupLeaf();
2715
+ group(csg);
26922716 csg.count = 5;
26932717 Composite child = new cGroup("Branch");
26942718 csg.addChild(child);
26952719 child.addChild(csg);
2696
- group(csg);
26972720 }
26982721 } else
26992722 if (source == doubleItem)
....@@ -2701,6 +2724,7 @@
27012724 if (!group.selection.isEmpty())
27022725 {
27032726 Composite csg = new GroupLeaf("Fork");
2727
+ group(csg);
27042728 csg.count = 5;
27052729 Composite child = new cGroup("Branch A");
27062730 csg.addChild(child);
....@@ -2708,7 +2732,6 @@
27082732 child = new cGroup("Branch B");
27092733 csg.addChild(child);
27102734 child.addChild(csg);
2711
- group(csg);
27122735 }
27132736 } else
27142737 if (source == tripleItem)
....@@ -2774,7 +2797,7 @@
27742797 {
27752798 Maximize();
27762799 } else
2777
- if (source == fullButton)
2800
+ if (source == fullScreenButton)
27782801 {
27792802 ToggleFullScreen();
27802803 } else
....@@ -2783,13 +2806,13 @@
27832806 this.expandedLayout = radio.layout;
27842807 CollapseToolbar();
27852808 } else
2786
- if (source == maximize3DButton)
2787
- {
2788
- this.expandedLayout = radio.layout;
2789
- radio.layout = twoButton;
2790
- Show3DView();
2791
- CollapseToolbar();
2792
- } else
2809
+// if (source == maximize3DButton)
2810
+// {
2811
+// this.expandedLayout = radio.layout;
2812
+// radio.layout = twoButton;
2813
+// CollapseToolbar();
2814
+// Show3DView();
2815
+// } else
27932816 if (source == previousVersionButton)
27942817 {
27952818 // Go to previous version
....@@ -3442,6 +3465,10 @@
34423465 {
34433466 ClearMaterials();
34443467 } else
3468
+ if (source == clearVersionsItem)
3469
+ {
3470
+ ClearVersions();
3471
+ } else
34453472 if (source == liveleavesItem)
34463473 {
34473474 LiveLeaves(true);
....@@ -3581,6 +3608,18 @@
35813608 if (source == transformChildrenItem)
35823609 {
35833610 TransformChildren();
3611
+ } else
3612
+ if (source == textureRatioRItem)
3613
+ {
3614
+ TextureRatio(0);
3615
+ } else
3616
+ if (source == textureRatioGItem)
3617
+ {
3618
+ TextureRatio(1);
3619
+ } else
3620
+ if (source == textureRatioBItem)
3621
+ {
3622
+ TextureRatio(2);
35843623 } else
35853624 if (source == resetTransformItem)
35863625 {
....@@ -3954,6 +3993,9 @@
39543993 if (source == closeButton)
39553994 {
39563995 //System.out.println("CLOSE: " + buttonGroup.getSelection());
3996
+ if (copy.versionlist != null)
3997
+ Replace();
3998
+
39573999 cRadio ab;
39584000 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
39594001 {
....@@ -4052,6 +4094,9 @@
40524094 } else
40534095 if(source instanceof cRadio)
40544096 {
4097
+ if (copy.versionlist != null)
4098
+ Replace();
4099
+
40554100 group.parent = keepparent;
40564101 group.attributes = 0;
40574102 //group.editWindow = null;
....@@ -4103,14 +4148,28 @@
41034148 */
41044149 radio.layout.doClick();
41054150
4106
- assert(copy instanceof Composite);
4151
+ //assert(copy instanceof Composite);
41074152
41084153 if (copy.versionlist == null)
41094154 {
4110
- copy.versionlist = new Object3D[100];
41114155 copy.versionindex = -1;
41124156
4113
- Save(true);
4157
+ // Cannot work with loops
4158
+ // To fix this issue, we first mark all nodes above the root,
4159
+ // and check if any of these nodes are reachable below the root.
4160
+ Grafreed.grafreed.universe.TagObjects(copy, true);
4161
+
4162
+ if (copy instanceof Composite && !copy.HasTags())
4163
+ {
4164
+ if (copy.versionlist == null)
4165
+ copy.versionlist = new Object3D[100];
4166
+
4167
+ //Save(true);
4168
+ }
4169
+ else
4170
+ copy.versionindex = -2;
4171
+
4172
+ Grafreed.grafreed.universe.TagObjects(copy, false);
41144173 }
41154174
41164175 SetVersionStates();
....@@ -4228,6 +4287,18 @@
42284287 refreshContents();
42294288 }
42304289
4290
+ void TextureRatio(int axis)
4291
+ {
4292
+ Object3D obj;
4293
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
4294
+ {
4295
+ obj = (Object3D)e.nextElement();
4296
+ obj.TextureRatio(axis);
4297
+ }
4298
+
4299
+ refreshContents();
4300
+ }
4301
+
42314302 void ResetTransform()
42324303 {
42334304 ResetTransform(-1);
....@@ -4243,42 +4314,8 @@
42434314 if (obj.toParent == null)
42444315 continue;
42454316
4246
- if (mask == -1)
4247
- {
4248
- if (obj instanceof Camera) // jan 2014
4249
- {
4250
- LA.matIdentity(obj.toParent);
4251
- LA.matIdentity(obj.fromParent);
4252
- }
4253
- else
4254
- {
4255
- obj.toParent = null; // jan 2014 LA.matIdentity(obj.toParent);
4256
- obj.fromParent = null; // LA.matIdentity(obj.fromParent);
4257
- }
4258
- TouchTransform(obj);
4259
- continue;
4260
- }
4261
- if ((mask&2) != 0) // Scale
4262
- {
4263
- obj.toParent[0][0] = obj.toParent[1][1] = obj.toParent[2][2] = 1;
4264
- obj.toParent[0][1] = obj.toParent[1][0] = obj.toParent[2][0] = 0;
4265
- obj.toParent[0][2] = obj.toParent[1][2] = obj.toParent[2][1] = 0;
4266
- obj.fromParent[0][0] = obj.fromParent[1][1] = obj.fromParent[2][2] = 1;
4267
- obj.fromParent[0][1] = obj.fromParent[1][0] = obj.fromParent[2][0] = 0;
4268
- obj.fromParent[0][2] = obj.fromParent[1][2] = obj.fromParent[2][1] = 0;
4269
- }
4270
- if ((mask&4) != 0) // Rotation
4271
- {
4272
- // ?
4273
- }
4274
- if ((mask&1) != 0) // Translation
4275
- {
4276
- if (obj.toParent != null)
4277
- {
4278
- obj.toParent[3][0] = obj.toParent[3][1] = obj.toParent[3][2] = 0;
4279
- obj.fromParent[3][0] = obj.fromParent[3][1] = obj.fromParent[3][2] = 0;
4280
- }
4281
- }
4317
+ obj.ResetTransform(mask);
4318
+
42824319 if (obj.parent == null)
42834320 {
42844321 System.out.println("NULL PARENT!");
....@@ -4787,6 +4824,12 @@
47874824 {
47884825 Object3D obj = group.selection.get(i);
47894826
4827
+ if (obj.toParent == null)
4828
+ {
4829
+ obj.toParent = LA.newMatrix();
4830
+ obj.fromParent = LA.newMatrix();
4831
+ }
4832
+
47904833 LA.matTranslate(obj.toParent, i * scale, 0, 0);
47914834 LA.matTranslateInv(obj.fromParent, -i * scale, 0, 0);
47924835 }
....@@ -5078,6 +5121,12 @@
50785121 refreshContents();
50795122 }
50805123
5124
+ void ClearVersions()
5125
+ {
5126
+ group.selection.ClearVersions();
5127
+ refreshContents();
5128
+ }
5129
+
50815130 void FlipV(boolean flip)
50825131 {
50835132 group.selection.FlipV(flip);
....@@ -5316,7 +5365,7 @@
53165365 if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
53175366 // a camera
53185367 {
5319
- if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera()) // Crash the camera because of invalid lightspace
5368
+ if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera()) // Crashes the camera because of invalid lightspace
53205369 {
53215370 CameraPane.camerachangeframe = 0; // don't refuse it
53225371 Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
....@@ -5355,18 +5404,20 @@
53555404 if (group.selection != null)
53565405 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
53575406 {
5358
- if (!(e.nextElement() instanceof Composite))
5407
+ Object next = e.nextElement();
5408
+ if (!(next instanceof Composite)) // || (next instanceof GroupLeaf))
53595409 {
53605410 allComposites = false;
53615411 break;
53625412 }
53635413 }
53645414
5365
- rootButton.setEnabled(allComposites);
5415
+ rootButton.setEnabled(true); // allComposites);
53665416 }
53675417
53685418 void refreshContents(boolean cp)
53695419 {
5420
+ if (Globals.SHOWINFO)
53705421 //if (objectPanel.getSelectedIndex() == 2) // objectPanel.indexOfTab("Info"))
53715422 if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
53725423 {
....@@ -6317,6 +6368,7 @@
63176368 private MenuItem clipMeshItem;
63186369 private MenuItem smoothMeshItem;
63196370 private MenuItem clearMaterialsItem;
6371
+ private MenuItem clearVersionsItem;
63206372
63216373 private MenuItem liveleavesItem;
63226374 private MenuItem unliveleavesItem;
....@@ -6340,13 +6392,16 @@
63406392 private MenuItem maxTexturesItem;
63416393 private MenuItem panoTexturesItem;
63426394
6395
+ private MenuItem textureRatioRItem;
6396
+ private MenuItem textureRatioGItem;
6397
+ private MenuItem textureRatioBItem;
63436398 private MenuItem resetCentroidItem;
63446399 private MenuItem resetCentroidXZItem;
63456400 private MenuItem resetTransformItem;
63466401 private MenuItem transformGeometryItem;
63476402 private MenuItem transformChildrenItem;
63486403 private MenuItem hideItem;
6349
- private MenuItem grabItem;
6404
+ private JMenuItem grabItem;
63506405 private MenuItem backItem;
63516406 private MenuItem frontItem;
63526407 private MenuItem cameraItem;