Normand Briere
2019-09-20 cbe4e90105d07d7d3fecabffaa01342403aa2ae3
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)
....@@ -491,11 +483,16 @@
491483
492484 Object3D parent = obj.parent;
493485 obj.parent = null;
486
+
494487 // Object3D support = obj.support;
495488 // obj.support = null;
496489 if (!supports)
497490 obj.SaveSupports();
491
+
498492 Object3D clone = (Object3D)Grafreed.clone(obj);
493
+
494
+ clone.ResetUUIDs();
495
+
499496 obj.parent = parent;
500497 // obj.support = support;
501498 // clone.support = support; // aout 2013
....@@ -540,33 +537,37 @@
540537 // menu.add("-");
541538 duplicateItem = oe.jTree.popup.add(new JMenuItem("Duplicate"));
542539 duplicateItem.addActionListener(this);
543
- cloneItem = menu.add(new MenuItem("Clone"));
540
+
541
+ cloneItem = oe.jTree.popup.add(new JMenuItem("Clone"));
544542 cloneItem.addActionListener(this);
545
- if (Globals.ADVANCED)
543
+ //if (Globals.ADVANCED)
546544 {
547545 cloneSupportItem = menu.add(new MenuItem("Clone (+supports)"));
548546 cloneSupportItem.addActionListener(this);
549547 }
548
+ oe.jTree.popup.addSeparator();
550549 menu.add("-");
551
- cutItem = menu.add(new MenuItem("Cut"));
550
+ cutItem = oe.jTree.popup.add(new JMenuItem("Cut"));
552551 cutItem.addActionListener(this);
553
- copyItem = menu.add(new MenuItem("Copy"));
552
+ copyItem = oe.jTree.popup.add(new JMenuItem("Copy"));
554553 copyItem.addActionListener(this);
555554 pasteItem = menu.add(new MenuItem("Paste"));
556555 pasteItem.addActionListener(this);
557556
558
- menu.add("-");
559
- pasteIntoItem = menu.add(new MenuItem("Paste into"));
557
+ oe.jTree.popup.addSeparator();
558
+ //menu.add("-");
559
+ pasteIntoItem = oe.jTree.popup.add(new JMenuItem("Paste into"));
560560 pasteIntoItem.addActionListener(this);
561
- pasteLinkItem = menu.add(new MenuItem("Paste link"));
561
+ pasteLinkItem = oe.jTree.popup.add(new JMenuItem("Paste link"));
562562 pasteLinkItem.addActionListener(this);
563
- pasteCloneItem = menu.add(new MenuItem("Paste clone"));
563
+ pasteCloneItem = oe.jTree.popup.add(new JMenuItem("Paste clone"));
564564 pasteCloneItem.addActionListener(this);
565
-// pasteExpandItem = menu.add(new MenuItem("Paste expand"));
566
-// pasteExpandItem.addActionListener(this);
567
- menu.add("-");
568
- deleteItem = menu.add(new MenuItem("Delete"));
569
- deleteItem.addActionListener(this);
565
+// CRASH
566
+ pasteExpandItem = oe.jTree.popup.add(new JMenuItem("Paste expand"));
567
+//
568
+ pasteExpandItem.addActionListener(this);
569
+ //menu.add("-");
570
+ oe.jTree.popup.addSeparator();
570571
571572 if (Globals.ADVANCED)
572573 {
....@@ -701,9 +702,8 @@
701702 setMasterItem.addActionListener(this);
702703 }
703704
704
- oe.menuBar.add(menu = new Menu("Group"));
705
-// grabItem = menu.add(new MenuItem("Grab"));
706
-// grabItem.addActionListener(this);
705
+ oe.menuBar.add(menu = new Menu("Order"));
706
+
707707 backItem = menu.add(new MenuItem("Back"));
708708 backItem.addActionListener(this);
709709 frontItem = menu.add(new MenuItem("Front"));
....@@ -711,13 +711,21 @@
711711 // compositeItem = menu.add(new MenuItem("Composite"));
712712 // compositeItem.addActionListener(this);
713713
714
+ grabItem = oe.jTree.popup.add(new JMenuItem("Group"));
715
+ grabItem.addActionListener(this);
716
+
714717 if (Globals.ADVANCED)
715718 {
716719 hideItem = menu.add(new MenuItem("Hidden Group"));
717720 hideItem.addActionListener(this);
718721 }
719
- ungroupItem = menu.add(new MenuItem("Ungroup"));
722
+ ungroupItem = oe.jTree.popup.add(new JMenuItem("Ungroup"));
720723 ungroupItem.addActionListener(this);
724
+
725
+ oe.jTree.popup.addSeparator();
726
+
727
+ deleteItem = oe.jTree.popup.add(new JMenuItem("Delete"));
728
+ deleteItem.addActionListener(this);
721729
722730 // menu.add("-");
723731 //
....@@ -754,9 +762,9 @@
754762 shadowYItem.addActionListener(this);
755763 shadowZItem = menu.add(new MenuItem("Shadow Blue"));
756764 shadowZItem.addActionListener(this);
765
+
757766 attributeItem = menu.add(new MenuItem("Attribute"));
758767 attributeItem.addActionListener(this);
759
-
760768 if (Globals.ADVANCED)
761769 {
762770 menu.add("-");
....@@ -768,11 +776,18 @@
768776 pointflowItem.addActionListener(this);
769777 }
770778 menu.add("-");
779
+ textureRatioRItem = menu.add(new MenuItem("Texture Ratio Red"));
780
+ textureRatioRItem.addActionListener(this);
781
+ textureRatioGItem = menu.add(new MenuItem("Texture Ratio Green"));
782
+ textureRatioGItem.addActionListener(this);
783
+ textureRatioBItem = menu.add(new MenuItem("Texture Ratio Blue"));
784
+ textureRatioBItem.addActionListener(this);
785
+ menu.add("-");
771786 resetTransformItem = menu.add(new MenuItem("Reset Transform"));
772787 resetTransformItem.addActionListener(this);
773788 resetCentroidItem = menu.add(new MenuItem("Reset Centroid"));
774789 resetCentroidItem.addActionListener(this);
775
- resetCentroidXZItem = menu.add(new MenuItem("Reset Centroid XY"));
790
+ resetCentroidXZItem = menu.add(new MenuItem("Reset Centroid XZ"));
776791 resetCentroidXZItem.addActionListener(this);
777792 transformGeometryItem = menu.add(new MenuItem("Transform Geometry"));
778793 transformGeometryItem.addActionListener(this);
....@@ -788,7 +803,7 @@
788803 genNormalsCADItem.addActionListener(this);
789804 genNormalsMESHItem = menu.add(new MenuItem("Mesh Normals"));
790805 genNormalsMESHItem.addActionListener(this);
791
- if (Globals.ADVANCED)
806
+ //if (Globals.ADVANCED)
792807 {
793808 genNormalsMINEItem = menu.add(new MenuItem("Stitch Normals"));
794809 genNormalsMINEItem.addActionListener(this);
....@@ -824,6 +839,8 @@
824839 }
825840
826841 oe.menuBar.add(menu = new Menu("Attributes"));
842
+ clearVersionsItem = menu.add(new MenuItem("Clear Versions"));
843
+ clearVersionsItem.addActionListener(this);
827844 clearMaterialsItem = menu.add(new MenuItem("Clear Materials"));
828845 clearMaterialsItem.addActionListener(this);
829846 resetAllItem = menu.add(new MenuItem("Reset All"));
....@@ -846,9 +863,9 @@
846863 hideleavesItem.addActionListener(this);
847864 showleavesItem = menu.add(new MenuItem("Show Leaves"));
848865 showleavesItem.addActionListener(this);
849
- markleavesItem = menu.add(new MenuItem("Mark Leaves"));
866
+ markleavesItem = menu.add(new MenuItem("Anim Leaves"));
850867 markleavesItem.addActionListener(this);
851
- unmarkleavesItem = menu.add(new MenuItem("Unmark Leaves"));
868
+ unmarkleavesItem = menu.add(new MenuItem("Unanim Leaves"));
852869 unmarkleavesItem.addActionListener(this);
853870 rewindleavesItem = menu.add(new MenuItem("Rewind Leaves"));
854871 rewindleavesItem.addActionListener(this);
....@@ -923,8 +940,10 @@
923940
924941 JTabbedPane resourcecontainer;
925942 cGridBag currenttab;
926
- boolean added; // patch for jar
943
+ //boolean added; // patch for jar
927944
945
+ int totalcount = 0;
946
+
928947 int tabcount = 0;
929948 int colcount = 0;
930949 int rowcount = 0;
....@@ -940,28 +959,35 @@
940959 // System.out.println();
941960
942961 if (//rowcount == 0 ||
943
- path.length == 1)
962
+ path.length == 1 && !path[0].equals("") && !path[0].equals(".DS_Store"))
944963 {
945964 currenttab = new cGridBag();
946
- added = false;
947965 String tabname = path[0]; // String.valueOf((char)('A'+tabcount));
948966 currenttab.setName(tabname);
967
+ //added = false;
968
+ resourcecontainer.add(currenttab);
969
+ resourcecontainer.setToolTipTextAt(tabcount++, "Texture " + tabname);
949970 rowcount = 1;
950971 colcount = 0;
951972 texturecount = 0;
952973 }
953974
954
- if (path.length > 2 && path[2].toLowerCase().endsWith(".jpg"))
975
+ if (path.length > 2 && (path[2].toLowerCase().endsWith(".jpg") || path[2].toLowerCase().endsWith(".png")))
955976 {
956
- if (!added)
977
+ //if (!added)
957978 {
958
- added = true;
959
- resourcecontainer.add(currenttab);
979
+ //added = true;
960980 String tabname = path[0]; // String.valueOf((char)('A'+tabcount));
961
- resourcecontainer.setToolTipTextAt(tabcount++, "Texture Group " + tabname);
981
+ currenttab = (cGridBag)resourcecontainer.getComponentAt(resourcecontainer.indexOfTab(tabname));
962982 }
963983
964
- AddTextureButton(path[0], path[1], path[2], texturecount++, currenttab);
984
+ columns = 5;
985
+
986
+ if (path[0].contains("D&R") || path[0].contains("Paint"))
987
+ columns = 4;
988
+
989
+ AddTextureButton(path[0], path[1], path[2], ++texturecount, currenttab);
990
+ totalcount++;
965991
966992 if (++colcount >= columns)
967993 {
....@@ -987,6 +1013,8 @@
9871013 container.add(resourcecontainer);
9881014
9891015 Grafreed.ParseResources("textures", this);
1016
+
1017
+ // 935. System.out.println("Total = " + totalcount);
9901018 }
9911019
9921020 void SetupUI2(ObjEditor oe)
....@@ -1026,9 +1054,9 @@
10261054 oe.radioPanel.add(dummyButton);
10271055 oe.buttonGroup.add(dummyButton);
10281056 */
1029
- cGridBag copyOptionsPanel = new cGridBag();
1057
+ cGridBag versionManagerPanel = new cGridBag();
10301058
1031
- copyOptionsPanel.preferredHeight = 2;
1059
+ versionManagerPanel.preferredHeight = 4;
10321060
10331061 //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
10341062
....@@ -1055,25 +1083,29 @@
10551083 // }
10561084 // });
10571085
1058
- oe.toolbarPanel.add(collapseButton = GetButton("icons/collapse.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1086
+ oe.toolbarPanel.add(fullScreenButton = GetButton("icons/fullscreen.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1087
+ fullScreenButton.setToolTipText("Full-screen window");
1088
+ fullScreenButton.addActionListener(this);
1089
+
1090
+ oe.toolbarPanel.add(collapseButton = GetButton("icons/collapse.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10591091 collapseButton.setToolTipText("Collapse toolbar");
10601092 collapseButton.addActionListener(this);
10611093
1062
- oe.toolbarPanel.add(maximize3DButton = GetButton("", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1063
- maximize3DButton.setToolTipText("Maximize 3D view");
1064
- maximize3DButton.addActionListener(this);
1094
+// oe.toolbarPanel.add(maximize3DButton = GetButton("icons/square.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1095
+// maximize3DButton.setToolTipText("Maximize 3D view");
1096
+// maximize3DButton.addActionListener(this);
10651097
1066
- oe.toolbarPanel.add(twoButton = GetButton("icons/cube.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1098
+ oe.toolbarPanel.add(twoButton = GetButton("icons/cube.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10671099 twoButton.setToolTipText("Show 3D view only");
10681100 twoButton.addActionListener(this);
10691101 this.fullscreenLayout = twoButton;
10701102
1071
- oe.toolbarPanel.add(threeButton = GetButton("icons/controlsview.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1103
+ oe.toolbarPanel.add(threeButton = GetButton("icons/controlsview.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10721104 threeButton.setToolTipText("Show controls and 3D view");
10731105 threeButton.addActionListener(this);
10741106 if (Globals.ADVANCED)
10751107 {
1076
- oe.toolbarPanel.add(sixButton = GetButton("icons/viewcontrols.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1108
+ oe.toolbarPanel.add(sixButton = GetButton("icons/viewcontrols.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10771109 sixButton.setToolTipText("Show 3D view and controls");
10781110 sixButton.addActionListener(this);
10791111 }
....@@ -1082,50 +1114,47 @@
10821114 // sevenButton.addActionListener(this);
10831115 //
10841116
1085
- oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1086
- fullButton.setToolTipText("Full-screen window");
1087
- fullButton.addActionListener(this);
1088
-
1089
- oe.toolbarPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1117
+ oe.toolbarPanel.add(screenfitButton = GetButton("icons/fit.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10901118 screenfitButton.setToolTipText("Screen fit");
10911119 screenfitButton.addActionListener(this);
10921120
1093
- oe.toolbarPanel.add(restoreCameraButton = GetButton("icons/eye.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1121
+ oe.toolbarPanel.add(restoreCameraButton = GetButton("icons/eye.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10941122 restoreCameraButton.setToolTipText("Restore viewpoint");
10951123 restoreCameraButton.addActionListener(this);
10961124
1097
- copyOptionsPanel.add(saveVersionButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1125
+ versionManagerPanel.add(saveVersionButton = GetButton("icons/down_arrow.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10981126 saveVersionButton.setToolTipText("Duplicate current version");
10991127 saveVersionButton.addActionListener(this);
11001128
1101
- copyOptionsPanel.add(deleteVersionButton = GetButton("icons/trash.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1129
+ versionManagerPanel.add(deleteVersionButton = GetButton("icons/trash.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11021130 deleteVersionButton.setToolTipText("Delete current version");
11031131 deleteVersionButton.addActionListener(this);
1132
+ deleteVersionButton.setEnabled(false);
11041133
1105
- copyOptionsPanel.add(previousVersionButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1134
+ versionManagerPanel.add(previousVersionButton = GetButton("icons/undo.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11061135 previousVersionButton.setToolTipText("Previous version");
11071136 previousVersionButton.addActionListener(this);
11081137 previousVersionButton.setEnabled(false);
11091138
11101139 cGridBag updown = new cGridBag().setVertical(true);
1111
- updown.add(restoreButton = GetButton("icons/restore.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1140
+ updown.add(restoreButton = GetButton("icons/restore.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11121141 restoreButton.setToolTipText("Undo (restore current version)");
11131142 restoreButton.addActionListener(this);
1114
- //restoreButton.setEnabled(false);
1143
+ restoreButton.setEnabled(false);
11151144
1116
- updown.add(replaceButton = GetButton("icons/replace.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1145
+ updown.add(replaceButton = GetButton("icons/replace.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11171146 replaceButton.setToolTipText("Save (replace current version)");
11181147 replaceButton.addActionListener(this);
1119
- //replaceButton.setEnabled(false);
1148
+ replaceButton.setEnabled(false);
11201149
1121
- copyOptionsPanel.add(updown);
1150
+ versionManagerPanel.add(updown);
11221151
1123
- copyOptionsPanel.add(nextVersionButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1152
+ versionManagerPanel.add(nextVersionButton = GetButton("icons/redo.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11241153 nextVersionButton.setToolTipText("Next version");
11251154 nextVersionButton.addActionListener(this);
11261155 nextVersionButton.setEnabled(false);
11271156
1128
- oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1157
+ oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11291158 oneStepButton.setToolTipText("Animate one step forward");
11301159 oneStepButton.addActionListener(this);
11311160
....@@ -1148,11 +1177,11 @@
11481177
11491178 if (Globals.ADVANCED)
11501179 {
1151
- oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1180
+ oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11521181 snapobjectButton.addActionListener(this);
11531182 snapobjectButton.setToolTipText("Snap Object");
11541183
1155
- oe.toolbarPanel.add(fourButton = GetButton("icons/controls-horizontal.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1184
+ oe.toolbarPanel.add(fourButton = GetButton("icons/controls-horizontal.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11561185 fourButton.addActionListener(this);
11571186 fourButton.setToolTipText("Show control panel only");
11581187 }
....@@ -1160,83 +1189,85 @@
11601189 //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
11611190
11621191
1163
- oe.toolbarPanel.add(rootButton = GetButton("icons/openwindow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1192
+ oe.toolbarPanel.add(rootButton = GetButton("icons/openwindow.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11641193 rootButton.setToolTipText("Open selection in new tab");
11651194 rootButton.addActionListener(this);
11661195
1167
- oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1196
+ oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11681197 closeButton.setToolTipText("Close tab");
11691198 closeButton.addActionListener(this);
11701199 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
11711200 //clearButton.addActionListener(this);
11721201
11731202 cGridBag row1 = new cGridBag();
1203
+ row1.preferredHeight = 8;
11741204
11751205 // INSERT
1176
- row1.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1206
+ row1.add(gridButton = GetButton("icons/grid.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11771207 gridButton.setToolTipText("Create ground");
11781208 gridButton.addActionListener(this);
11791209
1180
- row1.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1210
+ row1.add(boxButton = GetButton("icons/box.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11811211 boxButton.setToolTipText("Create box");
11821212 boxButton.addActionListener(this);
11831213
1184
- row1.add(sphereButton = GetButton("icons/sphere.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1185
- sphereButton.setToolTipText("Create sphere");
1186
- sphereButton.addActionListener(this);
1187
-
1188
- row1.add(coneButton = GetButton("icons/cone.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1189
- coneButton.setToolTipText("Create cone");
1190
- coneButton.addActionListener(this);
1191
-
1192
- row1.add(torusButton = GetButton("icons/torus.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1193
- torusButton.setToolTipText("Create torus");
1194
- torusButton.addActionListener(this);
1195
-
1196
- row1.add(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1214
+ row1.add(superButton = GetButton("icons/super.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11971215 superButton.setToolTipText("Create superellipsoid");
11981216 superButton.addActionListener(this);
11991217
1200
- if (Globals.ADVANCED)
1218
+ row1.add(sphereButton = GetButton("icons/sphere.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1219
+ sphereButton.setToolTipText("Create sphere");
1220
+ sphereButton.addActionListener(this);
1221
+
1222
+ row1.add(coneButton = GetButton("icons/cone.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1223
+ coneButton.setToolTipText("Create cone");
1224
+ coneButton.addActionListener(this);
1225
+
1226
+ row1.add(torusButton = GetButton("icons/torus.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1227
+ torusButton.setToolTipText("Create torus");
1228
+ torusButton.addActionListener(this);
1229
+
1230
+ if (false) //Globals.ADVANCED)
12011231 {
1202
- oe.toolboxPanel.add(kleinButton = GetButton("icons/klein.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1232
+ oe.toolboxPanel.add(kleinButton = GetButton("icons/klein.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12031233 kleinButton.setToolTipText("Create Klein bottle");
12041234 kleinButton.addActionListener(this);
12051235 }
12061236
1207
- row1.add(particlesButton = GetButton("icons/particles.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1237
+ row1.add(particlesButton = GetButton("icons/particles.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12081238 particlesButton.setToolTipText("Create particle system");
12091239 particlesButton.addActionListener(this);
12101240
12111241 oe.toolboxPanel.add(row1);
12121242
12131243 cGridBag row2 = new cGridBag();
1244
+ row2.preferredHeight = 8;
12141245
1215
- row2.add(groupButton = GetButton("icons/group.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1246
+ row2.add(groupButton = GetButton("icons/group.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12161247 groupButton.setToolTipText("Create group");
12171248 groupButton.addActionListener(this);
12181249
1219
- row2.add(compositeButton = GetButton("icons/composite.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1250
+ row2.add(compositeButton = GetButton("icons/composite.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12201251 compositeButton.setToolTipText("Create composite");
12211252 compositeButton.addActionListener(this);
12221253
1223
- row2.add(switchButton = GetButton("icons/switch.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1254
+ row2.add(switchButton = GetButton("icons/switch.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12241255 switchButton.setToolTipText("Create item switcher");
12251256 switchButton.addActionListener(this);
12261257
1227
- row2.add(loopButton = GetButton("icons/loop.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1258
+ row2.add(loopButton = GetButton("icons/loop.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12281259 loopButton.setToolTipText("Create loop");
12291260 loopButton.addActionListener(this);
12301261
1231
- row2.add(textureButton = GetButton("icons/texture.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1262
+ row2.add(textureButton = GetButton("icons/texture.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12321263 textureButton.setToolTipText("Create texture");
12331264 textureButton.addActionListener(this);
12341265
1235
- row2.add(overlayButton = GetButton("icons/overlay.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1266
+ row2.add(overlayButton = GetButton("icons/overlay.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12361267 overlayButton.setToolTipText("Create overlay");
12371268 overlayButton.addActionListener(this);
12381269
1239
- row2.add(lightButton = GetButton("icons/light-bulb.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1270
+ row2.add(lightButton = GetButton("icons/light-bulb.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12401271 lightButton.setToolTipText("Create light");
12411272 lightButton.addActionListener(this);
12421273
....@@ -1246,6 +1277,11 @@
12461277
12471278 CreateTexturePanel(textures);
12481279
1280
+ int tabCount = resourcecontainer.getTabCount();
1281
+
1282
+ if (tabCount > 0)
1283
+ resourcecontainer.setSelectedIndex((int)(Math.random() * tabCount));
1284
+
12491285 oe.toolboxPanel.add(textures);
12501286
12511287 textures.preferredHeight = 100;
....@@ -1253,11 +1289,11 @@
12531289 CreateSkyboxPanel(oe.skyboxPanel);
12541290
12551291 // EDIT panel
1256
- editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1292
+ editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12571293 editButton.setToolTipText("Pin selection controls");
12581294 editButton.addActionListener(this);
12591295
1260
- editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1296
+ editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12611297 uneditButton.setToolTipText("Unpin and remove selection controls");
12621298 uneditButton.addActionListener(this);
12631299
....@@ -1265,7 +1301,7 @@
12651301 allParamsButton.setToolTipText("Show all controls");
12661302 allParamsButton.addActionListener(this);
12671303
1268
- editCommandsPanel.add(clearPanelButton = GetButton("icons/clear.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1304
+ editCommandsPanel.add(clearPanelButton = GetButton("icons/clear.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12691305 clearPanelButton.setToolTipText("Clear all controls");
12701306 clearPanelButton.addActionListener(this);
12711307
....@@ -1273,7 +1309,7 @@
12731309 //unselectButton.setToolTipText("Unselect");
12741310 //unselectButton.addActionListener(this);
12751311
1276
- editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1312
+ editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12771313 flashSelectionButton.setToolTipText("Highlight selection");
12781314 flashSelectionButton.addActionListener(this);
12791315
....@@ -1296,6 +1332,8 @@
12961332
12971333 cGridBag jSPPanel = new cGridBag();
12981334
1335
+ jSPPanel.preferredHeight = 20;
1336
+
12991337 JScrollPane jSP;
13001338 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
13011339 jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
....@@ -1304,11 +1342,12 @@
13041342 oe.treePanel.add(jSPPanel);
13051343 oe.treePanel.Return();
13061344
1307
- oe.treePanel.add(copyOptionsPanel);
1345
+ oe.treePanel.add(versionManagerPanel);
13081346 oe.treePanel.Return();
1309
- cGridBag sliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
1310
- versionSlider = (cNumberSlider)sliderPane.getComponent(1);
1311
- sliderPane.preferredHeight = 1;
1347
+
1348
+ versionSliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
1349
+ versionSlider = (cNumberSlider)versionSliderPane.getComponent(1);
1350
+ versionSliderPane.preferredHeight = 3;
13121351
13131352 // mainPanel.setDividerLocation(0.1); //1.0);
13141353 mainPanel.setResizeWeight(0.4);
....@@ -1365,7 +1404,7 @@
13651404 // supportCB.setToolTipText("Enable rigging");
13661405 // supportCB.addItemListener(this);
13671406
1368
- panel.add(freezeCB = new cCheckBox("Freeze", Globals.FREEZEONMOVE)); //, constraints);
1407
+ panel.add(freezeCB = new cCheckBox("Fast cam", Globals.FREEZEONMOVE)); //, constraints);
13691408 freezeCB.setToolTipText("Fast moving camera");
13701409 freezeCB.addItemListener(this);
13711410
....@@ -1374,9 +1413,12 @@
13741413
13751414 panel.Return();
13761415
1416
+ if (Globals.ADVANCED)
1417
+ {
13771418 panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD)); //, constraints);
13781419 crowdCB.setToolTipText("Used for crowds");
13791420 crowdCB.addItemListener(this);
1421
+ }
13801422
13811423 panel.add(smoothCB = new cCheckBox("Inertia", CameraPane.INERTIA)); //, constraints);
13821424 smoothCB.setToolTipText("Snapping delay");
....@@ -1389,30 +1431,26 @@
13891431 minshaderCB.setToolTipText("Minimal fast shader");
13901432 minshaderCB.addItemListener(this);
13911433
1392
-// constraints.gridy += 1;
13931434 // panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
13941435 // speakerMocapCB.addItemListener(this);
13951436
1396
- panel.Return();
1397
-
13981437 if (false)
13991438 {
14001439 // handled in scripts
1401
- //constraints.gridy += 1;
14021440 panel.add(speakerCameraCB = new cCheckBox("Cam", CameraPane.SPEAKERCAMERA)); //, constraints);
14031441 speakerCameraCB.addItemListener(this);
14041442
1405
- //constraints.gridy += 1;
14061443 panel.add(speakerFocusCB = new cCheckBox("Focus", CameraPane.SPEAKERFOCUS)); //, constraints);
14071444 speakerFocusCB.addItemListener(this);
14081445
1409
- //constraints.gridy += 1;
1410
- panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints);
1411
- smoothfocusCB.addItemListener(this);
14121446 panel.Return();
14131447 }
14141448
1415
-//constraints.gridx += 1;
1449
+ panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints);
1450
+ smoothfocusCB.addItemListener(this);
1451
+
1452
+ panel.Return();
1453
+
14161454 //panel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), constraints);
14171455 // debugCB.addItemListener(this);
14181456
....@@ -1466,7 +1504,7 @@
14661504
14671505 void EditObject(Object3D obj)
14681506 {
1469
- assert(obj instanceof Composite);
1507
+ //assert(obj instanceof Composite);
14701508
14711509 // if (obj.versionlist == null)
14721510 // {
....@@ -1498,6 +1536,7 @@
14981536
14991537 oe.SetupViews();
15001538
1539
+ if (Globals.DEBUG)
15011540 System.out.println("SetupViews");
15021541 DragSource.getDefaultDragSource().createDefaultDragGestureRecognizer(
15031542 oe.cameraView, DnDConstants.ACTION_COPY_OR_MOVE, this); // ACTION_LINK ??
....@@ -2050,7 +2089,7 @@
20502089 Object3D obj = (Object3D)group.selection.elementAt(0);
20512090 objEditor.ScreenFit(obj, false);
20522091
2053
- cameraView.pingthread.StepToTarget(true);
2092
+ cameraView.pingthread.StepToTarget(); //true);
20542093 refreshContents();
20552094 }
20562095
....@@ -2087,7 +2126,7 @@
20872126 obj.parent.TransformToWorld(maxima); //, maxima);
20882127 }
20892128
2090
- Object3D shadow = new Object3D("Shadow " + obj.name);
2129
+ Object3D shadow = new Object3D("Shadow" + obj.name);
20912130
20922131 shadow.toParent = LA.newMatrix();
20932132 shadow.fromParent = LA.newMatrix();
....@@ -2101,24 +2140,24 @@
21012140 switch(axis)
21022141 {
21032142 case 0 :
2104
- vert1.x = minima.x; vert1.y = minima.y; vert1.z = minima.z;
2105
- vert2.x = minima.x; vert2.y = maxima.y; vert2.z = minima.z;
2106
- vert3.x = minima.x; vert3.y = minima.y; vert3.z = maxima.z;
2107
- vert4.x = minima.x; vert4.y = maxima.y; vert4.z = maxima.z;
2143
+ vert1.x = minima.x + 0.001f; vert1.y = minima.y; vert1.z = minima.z;
2144
+ vert2.x = minima.x + 0.001f; vert2.y = maxima.y; vert2.z = minima.z;
2145
+ vert3.x = minima.x + 0.001f; vert3.y = minima.y; vert3.z = maxima.z;
2146
+ vert4.x = minima.x + 0.001f; vert4.y = maxima.y; vert4.z = maxima.z;
21082147 norm = cVector.X;
21092148 break;
21102149 case 1 :
2111
- vert1.x = minima.x; vert1.y = minima.y; vert1.z = minima.z;
2112
- vert2.x = maxima.x; vert2.y = minima.y; vert2.z = minima.z;
2113
- vert3.x = minima.x; vert3.y = minima.y; vert3.z = maxima.z;
2114
- vert4.x = maxima.x; vert4.y = minima.y; vert4.z = maxima.z;
2150
+ vert1.x = minima.x; vert1.y = minima.y + 0.001f; vert1.z = minima.z;
2151
+ vert2.x = maxima.x; vert2.y = minima.y + 0.001f; vert2.z = minima.z;
2152
+ vert3.x = minima.x; vert3.y = minima.y + 0.001f; vert3.z = maxima.z;
2153
+ vert4.x = maxima.x; vert4.y = minima.y + 0.001f; vert4.z = maxima.z;
21152154 norm = cVector.Y;
21162155 break;
21172156 case 2 :
2118
- vert1.x = minima.x; vert1.y = minima.y; vert1.z = minima.z;
2119
- vert2.x = maxima.x; vert2.y = minima.y; vert2.z = minima.z;
2120
- vert3.x = minima.x; vert3.y = maxima.y; vert3.z = minima.z;
2121
- vert4.x = maxima.x; vert4.y = maxima.y; vert4.z = minima.z;
2157
+ vert1.x = minima.x; vert1.y = minima.y; vert1.z = minima.z + 0.001f;
2158
+ vert2.x = maxima.x; vert2.y = minima.y; vert2.z = minima.z + 0.001f;
2159
+ vert3.x = minima.x; vert3.y = maxima.y; vert3.z = minima.z + 0.001f;
2160
+ vert4.x = maxima.x; vert4.y = maxima.y; vert4.z = minima.z + 0.001f;
21222161 norm = cVector.Z;
21232162 break;
21242163 }
....@@ -2159,7 +2198,11 @@
21592198 shadow.material = new cMaterial(obj.material);
21602199 shadow.material.diffuse = 0.0001f;
21612200 shadow.material.specular = 0.0001f;
2162
- //shadow.projectedVertices[1].x = 300;
2201
+ shadow.material.opacity = 0.75f;
2202
+
2203
+ AllocProjectedVertices(shadow);
2204
+
2205
+ shadow.projectedVertices[1].x = 300;
21632206
21642207 makeSomething(shadow);
21652208 }
....@@ -2680,27 +2723,35 @@
26802723 } else
26812724 if (source == loopItem || source == loopButton)
26822725 {
2726
+ if (!group.selection.isEmpty())
2727
+ {
26832728 Composite csg = new GroupLeaf();
2684
- csg.count = 5;
26852729 group(csg);
2730
+ csg.count = 5;
26862731 Composite child = new cGroup("Branch");
26872732 csg.addChild(child);
26882733 child.addChild(csg);
2734
+ }
26892735 } else
26902736 if (source == doubleItem)
26912737 {
2738
+ if (!group.selection.isEmpty())
2739
+ {
26922740 Composite csg = new GroupLeaf("Fork");
2693
- csg.count = 5;
26942741 group(csg);
2742
+ csg.count = 5;
26952743 Composite child = new cGroup("Branch A");
26962744 csg.addChild(child);
26972745 child.addChild(csg);
26982746 child = new cGroup("Branch B");
26992747 csg.addChild(child);
27002748 child.addChild(csg);
2749
+ }
27012750 } else
27022751 if (source == tripleItem)
27032752 {
2753
+ if (!group.selection.isEmpty())
2754
+ {
27042755 Composite csg = new GroupLeaf("Trident");
27052756 csg.count = 4;
27062757 group(csg);
....@@ -2713,6 +2764,7 @@
27132764 child = new cGroup();
27142765 csg.addChild(child);
27152766 child.addChild(csg);
2767
+ }
27162768 } else
27172769 if (source == computeAOItem)
27182770 {
....@@ -2759,7 +2811,7 @@
27592811 {
27602812 Maximize();
27612813 } else
2762
- if (source == fullButton)
2814
+ if (source == fullScreenButton)
27632815 {
27642816 ToggleFullScreen();
27652817 } else
....@@ -2768,13 +2820,13 @@
27682820 this.expandedLayout = radio.layout;
27692821 CollapseToolbar();
27702822 } else
2771
- if (source == maximize3DButton)
2772
- {
2773
- this.expandedLayout = radio.layout;
2774
- radio.layout = twoButton;
2775
- Show3DView();
2776
- CollapseToolbar();
2777
- } else
2823
+// if (source == maximize3DButton)
2824
+// {
2825
+// this.expandedLayout = radio.layout;
2826
+// radio.layout = twoButton;
2827
+// CollapseToolbar();
2828
+// Show3DView();
2829
+// } else
27782830 if (source == previousVersionButton)
27792831 {
27802832 // Go to previous version
....@@ -2802,7 +2854,7 @@
28022854 if (source == saveVersionButton)
28032855 {
28042856 // Save a new version
2805
- if (!Save(true))
2857
+ if (!DuplicateVersion()) //true))
28062858 java.awt.Toolkit.getDefaultToolkit().beep();
28072859 } else
28082860 if (source == deleteVersionButton)
....@@ -3348,22 +3400,34 @@
33483400 } else
33493401 if (source == ungroupItem || source == ungroupButton)
33503402 {
3351
- boolean hasRoot = false;
3403
+ boolean canUngroup = true;
33523404
33533405 for (int i=0; i<group.selection.size(); i++)
33543406 {
3355
- if (group.selection.get(i) == group)
3407
+ Object3D selectedItem = group.selection.get(i);
3408
+
3409
+ if (selectedItem.Size() == 0)
33563410 {
3357
- hasRoot = true;
3411
+ // Cannot ungroup leaves
3412
+ canUngroup = false;
3413
+ break;
3414
+ }
3415
+
3416
+ if (selectedItem == group)
3417
+ {
3418
+ // Cannot ungroup root
3419
+ canUngroup = false;
33583420 break;
33593421 }
33603422 }
33613423
3362
- if (!hasRoot)
3424
+ if (canUngroup)
33633425 {
33643426 for (int i=0; i<group.selection.size(); i++)
33653427 {
3366
- Ungroup(group.selection.get(i));
3428
+ Object3D selectedItem = group.selection.get(i);
3429
+
3430
+ Ungroup(selectedItem);
33673431 }
33683432
33693433 ClearSelection(false);
....@@ -3414,6 +3478,10 @@
34143478 if (source == clearMaterialsItem)
34153479 {
34163480 ClearMaterials();
3481
+ } else
3482
+ if (source == clearVersionsItem)
3483
+ {
3484
+ ClearVersions();
34173485 } else
34183486 if (source == liveleavesItem)
34193487 {
....@@ -3554,6 +3622,18 @@
35543622 if (source == transformChildrenItem)
35553623 {
35563624 TransformChildren();
3625
+ } else
3626
+ if (source == textureRatioRItem)
3627
+ {
3628
+ TextureRatio(0);
3629
+ } else
3630
+ if (source == textureRatioGItem)
3631
+ {
3632
+ TextureRatio(1);
3633
+ } else
3634
+ if (source == textureRatioBItem)
3635
+ {
3636
+ TextureRatio(2);
35573637 } else
35583638 if (source == resetTransformItem)
35593639 {
....@@ -3927,6 +4007,9 @@
39274007 if (source == closeButton)
39284008 {
39294009 //System.out.println("CLOSE: " + buttonGroup.getSelection());
4010
+ if (copy.versionlist != null)
4011
+ Replace();
4012
+
39304013 cRadio ab;
39314014 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
39324015 {
....@@ -4025,6 +4108,9 @@
40254108 } else
40264109 if(source instanceof cRadio)
40274110 {
4111
+ if (copy.versionlist != null)
4112
+ Replace();
4113
+
40284114 group.parent = keepparent;
40294115 group.attributes = 0;
40304116 //group.editWindow = null;
....@@ -4076,14 +4162,28 @@
40764162 */
40774163 radio.layout.doClick();
40784164
4079
- assert(copy instanceof Composite);
4165
+ //assert(copy instanceof Composite);
40804166
40814167 if (copy.versionlist == null)
40824168 {
4083
- copy.versionlist = new Object3D[100];
40844169 copy.versionindex = -1;
40854170
4086
- Save(true);
4171
+ // Cannot work with loops
4172
+ // To fix this issue, we first mark all nodes above the root,
4173
+ // and check if any of these nodes are reachable below the root.
4174
+ Grafreed.grafreed.universe.TagObjects(copy, true);
4175
+
4176
+ if (copy instanceof Composite && !copy.HasTags())
4177
+ {
4178
+ if (copy.versionlist == null)
4179
+ copy.versionlist = new Object3D[100];
4180
+
4181
+ //Save(true);
4182
+ }
4183
+ else
4184
+ copy.versionindex = -2;
4185
+
4186
+ Grafreed.grafreed.universe.TagObjects(copy, false);
40874187 }
40884188
40894189 SetVersionStates();
....@@ -4201,9 +4301,46 @@
42014301 refreshContents();
42024302 }
42034303
4304
+ void TextureRatio(int axis)
4305
+ {
4306
+ Object3D obj;
4307
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
4308
+ {
4309
+ obj = (Object3D)e.nextElement();
4310
+ obj.TextureRatio(axis);
4311
+ }
4312
+
4313
+ refreshContents();
4314
+ }
4315
+
42044316 void ResetTransform()
42054317 {
42064318 ResetTransform(-1);
4319
+ }
4320
+
4321
+ void ScaleSelection(int scale)
4322
+ {
4323
+ Object3D obj;
4324
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
4325
+ {
4326
+ obj = (Object3D)e.nextElement();
4327
+
4328
+ if (obj.toParent == null)
4329
+ continue;
4330
+
4331
+ obj.Scale(scale);
4332
+
4333
+ if (obj.parent == null)
4334
+ {
4335
+ System.out.println("NULL PARENT!");
4336
+ // new Exception().printStackTrace();
4337
+ }
4338
+ else
4339
+ TouchTransform(obj);
4340
+ //obj.parent.Touch();
4341
+ }
4342
+
4343
+ refreshContents();
42074344 }
42084345
42094346 void ResetTransform(int mask)
....@@ -4216,42 +4353,8 @@
42164353 if (obj.toParent == null)
42174354 continue;
42184355
4219
- if (mask == -1)
4220
- {
4221
- if (obj instanceof Camera) // jan 2014
4222
- {
4223
- LA.matIdentity(obj.toParent);
4224
- LA.matIdentity(obj.fromParent);
4225
- }
4226
- else
4227
- {
4228
- obj.toParent = null; // jan 2014 LA.matIdentity(obj.toParent);
4229
- obj.fromParent = null; // LA.matIdentity(obj.fromParent);
4230
- }
4231
- TouchTransform(obj);
4232
- continue;
4233
- }
4234
- if ((mask&2) != 0) // Scale
4235
- {
4236
- obj.toParent[0][0] = obj.toParent[1][1] = obj.toParent[2][2] = 1;
4237
- obj.toParent[0][1] = obj.toParent[1][0] = obj.toParent[2][0] = 0;
4238
- obj.toParent[0][2] = obj.toParent[1][2] = obj.toParent[2][1] = 0;
4239
- obj.fromParent[0][0] = obj.fromParent[1][1] = obj.fromParent[2][2] = 1;
4240
- obj.fromParent[0][1] = obj.fromParent[1][0] = obj.fromParent[2][0] = 0;
4241
- obj.fromParent[0][2] = obj.fromParent[1][2] = obj.fromParent[2][1] = 0;
4242
- }
4243
- if ((mask&4) != 0) // Rotation
4244
- {
4245
- // ?
4246
- }
4247
- if ((mask&1) != 0) // Translation
4248
- {
4249
- if (obj.toParent != null)
4250
- {
4251
- obj.toParent[3][0] = obj.toParent[3][1] = obj.toParent[3][2] = 0;
4252
- obj.fromParent[3][0] = obj.fromParent[3][1] = obj.fromParent[3][2] = 0;
4253
- }
4254
- }
4356
+ obj.ResetTransform(mask);
4357
+
42554358 if (obj.parent == null)
42564359 {
42574360 System.out.println("NULL PARENT!");
....@@ -4760,10 +4863,17 @@
47604863 {
47614864 Object3D obj = group.selection.get(i);
47624865
4866
+ if (obj.toParent == null)
4867
+ {
4868
+ obj.toParent = LA.newMatrix();
4869
+ obj.fromParent = LA.newMatrix();
4870
+ }
4871
+
47634872 LA.matTranslate(obj.toParent, i * scale, 0, 0);
47644873 LA.matTranslateInv(obj.fromParent, -i * scale, 0, 0);
47654874 }
47664875
4876
+ Globals.lighttouched = true;
47674877 refreshContents();
47684878 }
47694879
....@@ -5051,6 +5161,12 @@
50515161 refreshContents();
50525162 }
50535163
5164
+ void ClearVersions()
5165
+ {
5166
+ group.selection.ClearVersions();
5167
+ refreshContents();
5168
+ }
5169
+
50545170 void FlipV(boolean flip)
50555171 {
50565172 group.selection.FlipV(flip);
....@@ -5289,10 +5405,10 @@
52895405 if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
52905406 // a camera
52915407 {
5292
- if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera()) // Crash the camera because of invalid lightspace
5408
+ if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera()) // Crashes the camera because of invalid lightspace
52935409 {
52945410 CameraPane.camerachangeframe = 0; // don't refuse it
5295
- Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
5411
+ Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent(), true);
52965412 }
52975413 // Globals.theRenderer.renderCamera = Globals.theRenderer.manipCamera;
52985414 // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
....@@ -5328,18 +5444,20 @@
53285444 if (group.selection != null)
53295445 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
53305446 {
5331
- if (!(e.nextElement() instanceof Composite))
5447
+ Object next = e.nextElement();
5448
+ if (!(next instanceof Composite)) // || (next instanceof GroupLeaf))
53325449 {
53335450 allComposites = false;
53345451 break;
53355452 }
53365453 }
53375454
5338
- rootButton.setEnabled(allComposites);
5455
+ rootButton.setEnabled(true); // allComposites);
53395456 }
53405457
53415458 void refreshContents(boolean cp)
53425459 {
5460
+ if (Globals.SHOWINFO)
53435461 //if (objectPanel.getSelectedIndex() == 2) // objectPanel.indexOfTab("Info"))
53445462 if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
53455463 {
....@@ -6233,11 +6351,11 @@
62336351 private MenuItem lookAtItem;
62346352 private MenuItem lookFromItem;
62356353 private MenuItem switchViewItem;
6236
- private MenuItem cutItem;
6354
+ private JMenuItem cutItem;
62376355 private MenuItem undoItem;
62386356 private MenuItem redoItem;
62396357 private JMenuItem duplicateItem;
6240
- private MenuItem cloneItem;
6358
+ private JMenuItem cloneItem;
62416359 private MenuItem cloneSupportItem;
62426360 private MenuItem overwriteGeoItem;
62436361 private MenuItem overwriteMatItem;
....@@ -6258,13 +6376,13 @@
62586376 private MenuItem cloneGeometriesItem;
62596377 private MenuItem shareGeometriesItem;
62606378 private MenuItem mergeGeometriesItem;
6261
- private MenuItem copyItem;
6379
+ private JMenuItem copyItem;
62626380 private MenuItem pasteItem;
6263
- private MenuItem pasteIntoItem;
6264
- private MenuItem pasteLinkItem;
6265
- private MenuItem pasteCloneItem;
6266
- private MenuItem pasteExpandItem;
6267
- private MenuItem deleteItem;
6381
+ private JMenuItem pasteIntoItem;
6382
+ private JMenuItem pasteLinkItem;
6383
+ private JMenuItem pasteCloneItem;
6384
+ private JMenuItem pasteExpandItem;
6385
+ private JMenuItem deleteItem;
62686386 private MenuItem clearAllItem;
62696387 private MenuItem genUVItem;
62706388 private MenuItem genNormalsMESHItem;
....@@ -6290,6 +6408,7 @@
62906408 private MenuItem clipMeshItem;
62916409 private MenuItem smoothMeshItem;
62926410 private MenuItem clearMaterialsItem;
6411
+ private MenuItem clearVersionsItem;
62936412
62946413 private MenuItem liveleavesItem;
62956414 private MenuItem unliveleavesItem;
....@@ -6313,13 +6432,16 @@
63136432 private MenuItem maxTexturesItem;
63146433 private MenuItem panoTexturesItem;
63156434
6435
+ private MenuItem textureRatioRItem;
6436
+ private MenuItem textureRatioGItem;
6437
+ private MenuItem textureRatioBItem;
63166438 private MenuItem resetCentroidItem;
63176439 private MenuItem resetCentroidXZItem;
63186440 private MenuItem resetTransformItem;
63196441 private MenuItem transformGeometryItem;
63206442 private MenuItem transformChildrenItem;
63216443 private MenuItem hideItem;
6322
- private MenuItem grabItem;
6444
+ private JMenuItem grabItem;
63236445 private MenuItem backItem;
63246446 private MenuItem frontItem;
63256447 private MenuItem cameraItem;
....@@ -6332,7 +6454,7 @@
63326454 private MenuItem switchTransfoItem;
63336455 private MenuItem morphItem;
63346456 private MenuItem linkerItem;
6335
- private MenuItem ungroupItem;
6457
+ private JMenuItem ungroupItem;
63366458 private MenuItem editItem;
63376459 private MenuItem openWindowItem;
63386460 private MenuItem editLeafItem;