Normand Briere
2019-09-20 cbe4e90105d07d7d3fecabffaa01342403aa2ae3
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,16 +366,6 @@
357366 }
358367
359368 refreshContents();
360
- }
361
-
362
- public void Show3DView()
363
- {
364
- // bug
365
- //gridPanel.setDividerLocation(1.0);
366
- //bigPanel.setDividerLocation(0.0);
367
- bigThree.ClearUI();
368
- bigThree.add(centralPanel);
369
- bigThree.FlushUI();
370369 }
371370
372371 //ObjEditor objEditor;
....@@ -406,13 +405,15 @@
406405 this.copy = this.group = group;
407406 //selectees = this.group.selectees;
408407
409
- if (copy.versionlist == null)
410
- {
411
- copy.versionlist = new Object3D[100];
412
- copy.versionindex = -1;
413
-
414
- Save(true);
415
- }
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
+// }
416417
417418 if(ui)
418419 SetupUI(objEditor);
....@@ -435,13 +436,13 @@
435436
436437 ((cRadio)radioPanel.getComponent(0)).SetCamera(cameraView.renderCamera, true);
437438
438
- if (copy.versionlist == null)
439
- {
440
- copy.versionlist = new Object3D[100];
441
- copy.versionindex = -1;
442
-
443
- Save(true);
444
- }
439
+// if (copy.versionlist == null)
440
+// {
441
+// copy.versionlist = new Object3D[100];
442
+// copy.versionindex = -1;
443
+//
444
+// //Save(true);
445
+// }
445446 }
446447
447448 void CloneSelection(boolean supports)
....@@ -482,11 +483,16 @@
482483
483484 Object3D parent = obj.parent;
484485 obj.parent = null;
486
+
485487 // Object3D support = obj.support;
486488 // obj.support = null;
487489 if (!supports)
488490 obj.SaveSupports();
491
+
489492 Object3D clone = (Object3D)Grafreed.clone(obj);
493
+
494
+ clone.ResetUUIDs();
495
+
490496 obj.parent = parent;
491497 // obj.support = support;
492498 // clone.support = support; // aout 2013
....@@ -531,33 +537,37 @@
531537 // menu.add("-");
532538 duplicateItem = oe.jTree.popup.add(new JMenuItem("Duplicate"));
533539 duplicateItem.addActionListener(this);
534
- cloneItem = menu.add(new MenuItem("Clone"));
540
+
541
+ cloneItem = oe.jTree.popup.add(new JMenuItem("Clone"));
535542 cloneItem.addActionListener(this);
536
- if (Globals.ADVANCED)
543
+ //if (Globals.ADVANCED)
537544 {
538545 cloneSupportItem = menu.add(new MenuItem("Clone (+supports)"));
539546 cloneSupportItem.addActionListener(this);
540547 }
548
+ oe.jTree.popup.addSeparator();
541549 menu.add("-");
542
- cutItem = menu.add(new MenuItem("Cut"));
550
+ cutItem = oe.jTree.popup.add(new JMenuItem("Cut"));
543551 cutItem.addActionListener(this);
544
- copyItem = menu.add(new MenuItem("Copy"));
552
+ copyItem = oe.jTree.popup.add(new JMenuItem("Copy"));
545553 copyItem.addActionListener(this);
546554 pasteItem = menu.add(new MenuItem("Paste"));
547555 pasteItem.addActionListener(this);
548556
549
- menu.add("-");
550
- 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"));
551560 pasteIntoItem.addActionListener(this);
552
- pasteLinkItem = menu.add(new MenuItem("Paste link"));
561
+ pasteLinkItem = oe.jTree.popup.add(new JMenuItem("Paste link"));
553562 pasteLinkItem.addActionListener(this);
554
- pasteCloneItem = menu.add(new MenuItem("Paste clone"));
563
+ pasteCloneItem = oe.jTree.popup.add(new JMenuItem("Paste clone"));
555564 pasteCloneItem.addActionListener(this);
556
-// pasteExpandItem = menu.add(new MenuItem("Paste expand"));
557
-// pasteExpandItem.addActionListener(this);
558
- menu.add("-");
559
- deleteItem = menu.add(new MenuItem("Delete"));
560
- 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();
561571
562572 if (Globals.ADVANCED)
563573 {
....@@ -692,9 +702,8 @@
692702 setMasterItem.addActionListener(this);
693703 }
694704
695
- oe.menuBar.add(menu = new Menu("Group"));
696
-// grabItem = menu.add(new MenuItem("Grab"));
697
-// grabItem.addActionListener(this);
705
+ oe.menuBar.add(menu = new Menu("Order"));
706
+
698707 backItem = menu.add(new MenuItem("Back"));
699708 backItem.addActionListener(this);
700709 frontItem = menu.add(new MenuItem("Front"));
....@@ -702,13 +711,21 @@
702711 // compositeItem = menu.add(new MenuItem("Composite"));
703712 // compositeItem.addActionListener(this);
704713
714
+ grabItem = oe.jTree.popup.add(new JMenuItem("Group"));
715
+ grabItem.addActionListener(this);
716
+
705717 if (Globals.ADVANCED)
706718 {
707719 hideItem = menu.add(new MenuItem("Hidden Group"));
708720 hideItem.addActionListener(this);
709721 }
710
- ungroupItem = menu.add(new MenuItem("Ungroup"));
722
+ ungroupItem = oe.jTree.popup.add(new JMenuItem("Ungroup"));
711723 ungroupItem.addActionListener(this);
724
+
725
+ oe.jTree.popup.addSeparator();
726
+
727
+ deleteItem = oe.jTree.popup.add(new JMenuItem("Delete"));
728
+ deleteItem.addActionListener(this);
712729
713730 // menu.add("-");
714731 //
....@@ -745,9 +762,9 @@
745762 shadowYItem.addActionListener(this);
746763 shadowZItem = menu.add(new MenuItem("Shadow Blue"));
747764 shadowZItem.addActionListener(this);
765
+
748766 attributeItem = menu.add(new MenuItem("Attribute"));
749767 attributeItem.addActionListener(this);
750
-
751768 if (Globals.ADVANCED)
752769 {
753770 menu.add("-");
....@@ -759,11 +776,18 @@
759776 pointflowItem.addActionListener(this);
760777 }
761778 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("-");
762786 resetTransformItem = menu.add(new MenuItem("Reset Transform"));
763787 resetTransformItem.addActionListener(this);
764788 resetCentroidItem = menu.add(new MenuItem("Reset Centroid"));
765789 resetCentroidItem.addActionListener(this);
766
- resetCentroidXZItem = menu.add(new MenuItem("Reset Centroid XY"));
790
+ resetCentroidXZItem = menu.add(new MenuItem("Reset Centroid XZ"));
767791 resetCentroidXZItem.addActionListener(this);
768792 transformGeometryItem = menu.add(new MenuItem("Transform Geometry"));
769793 transformGeometryItem.addActionListener(this);
....@@ -779,7 +803,7 @@
779803 genNormalsCADItem.addActionListener(this);
780804 genNormalsMESHItem = menu.add(new MenuItem("Mesh Normals"));
781805 genNormalsMESHItem.addActionListener(this);
782
- if (Globals.ADVANCED)
806
+ //if (Globals.ADVANCED)
783807 {
784808 genNormalsMINEItem = menu.add(new MenuItem("Stitch Normals"));
785809 genNormalsMINEItem.addActionListener(this);
....@@ -815,6 +839,8 @@
815839 }
816840
817841 oe.menuBar.add(menu = new Menu("Attributes"));
842
+ clearVersionsItem = menu.add(new MenuItem("Clear Versions"));
843
+ clearVersionsItem.addActionListener(this);
818844 clearMaterialsItem = menu.add(new MenuItem("Clear Materials"));
819845 clearMaterialsItem.addActionListener(this);
820846 resetAllItem = menu.add(new MenuItem("Reset All"));
....@@ -837,9 +863,9 @@
837863 hideleavesItem.addActionListener(this);
838864 showleavesItem = menu.add(new MenuItem("Show Leaves"));
839865 showleavesItem.addActionListener(this);
840
- markleavesItem = menu.add(new MenuItem("Mark Leaves"));
866
+ markleavesItem = menu.add(new MenuItem("Anim Leaves"));
841867 markleavesItem.addActionListener(this);
842
- unmarkleavesItem = menu.add(new MenuItem("Unmark Leaves"));
868
+ unmarkleavesItem = menu.add(new MenuItem("Unanim Leaves"));
843869 unmarkleavesItem.addActionListener(this);
844870 rewindleavesItem = menu.add(new MenuItem("Rewind Leaves"));
845871 rewindleavesItem.addActionListener(this);
....@@ -914,8 +940,10 @@
914940
915941 JTabbedPane resourcecontainer;
916942 cGridBag currenttab;
917
- boolean added; // patch for jar
943
+ //boolean added; // patch for jar
918944
945
+ int totalcount = 0;
946
+
919947 int tabcount = 0;
920948 int colcount = 0;
921949 int rowcount = 0;
....@@ -931,28 +959,35 @@
931959 // System.out.println();
932960
933961 if (//rowcount == 0 ||
934
- path.length == 1)
962
+ path.length == 1 && !path[0].equals("") && !path[0].equals(".DS_Store"))
935963 {
936964 currenttab = new cGridBag();
937
- added = false;
938965 String tabname = path[0]; // String.valueOf((char)('A'+tabcount));
939966 currenttab.setName(tabname);
967
+ //added = false;
968
+ resourcecontainer.add(currenttab);
969
+ resourcecontainer.setToolTipTextAt(tabcount++, "Texture " + tabname);
940970 rowcount = 1;
941971 colcount = 0;
942972 texturecount = 0;
943973 }
944974
945
- if (path.length > 2 && path[2].toLowerCase().endsWith(".jpg"))
975
+ if (path.length > 2 && (path[2].toLowerCase().endsWith(".jpg") || path[2].toLowerCase().endsWith(".png")))
946976 {
947
- if (!added)
977
+ //if (!added)
948978 {
949
- added = true;
950
- resourcecontainer.add(currenttab);
979
+ //added = true;
951980 String tabname = path[0]; // String.valueOf((char)('A'+tabcount));
952
- resourcecontainer.setToolTipTextAt(tabcount++, "Texture Group " + tabname);
981
+ currenttab = (cGridBag)resourcecontainer.getComponentAt(resourcecontainer.indexOfTab(tabname));
953982 }
954983
955
- 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++;
956991
957992 if (++colcount >= columns)
958993 {
....@@ -978,6 +1013,8 @@
9781013 container.add(resourcecontainer);
9791014
9801015 Grafreed.ParseResources("textures", this);
1016
+
1017
+ // 935. System.out.println("Total = " + totalcount);
9811018 }
9821019
9831020 void SetupUI2(ObjEditor oe)
....@@ -1017,9 +1054,9 @@
10171054 oe.radioPanel.add(dummyButton);
10181055 oe.buttonGroup.add(dummyButton);
10191056 */
1020
- cGridBag copyOptionsPanel = new cGridBag();
1057
+ cGridBag versionManagerPanel = new cGridBag();
10211058
1022
- copyOptionsPanel.preferredHeight = 2;
1059
+ versionManagerPanel.preferredHeight = 4;
10231060
10241061 //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
10251062
....@@ -1034,8 +1071,8 @@
10341071 // maxButton.addActionListener(this);
10351072 }
10361073
1037
-// cButton gcButton;
1038
-//
1074
+ cButton gcButton;
1075
+
10391076 // oe.toolbarPanel.add(gcButton = GetButton("icons/trash.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
10401077 // gcButton.setToolTipText("Garbage collect");
10411078 // gcButton.addActionListener(new ActionListener()
....@@ -1046,25 +1083,29 @@
10461083 // }
10471084 // });
10481085
1049
- 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);
10501091 collapseButton.setToolTipText("Collapse toolbar");
10511092 collapseButton.addActionListener(this);
10521093
1053
- oe.toolbarPanel.add(maximize3DButton = GetButton("", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1054
- maximize3DButton.setToolTipText("Maximize 3D view");
1055
- 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);
10561097
1057
- 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);
10581099 twoButton.setToolTipText("Show 3D view only");
10591100 twoButton.addActionListener(this);
10601101 this.fullscreenLayout = twoButton;
10611102
1062
- 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);
10631104 threeButton.setToolTipText("Show controls and 3D view");
10641105 threeButton.addActionListener(this);
10651106 if (Globals.ADVANCED)
10661107 {
1067
- 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);
10681109 sixButton.setToolTipText("Show 3D view and controls");
10691110 sixButton.addActionListener(this);
10701111 }
....@@ -1073,50 +1114,47 @@
10731114 // sevenButton.addActionListener(this);
10741115 //
10751116
1076
- oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1077
- fullButton.setToolTipText("Full-screen window");
1078
- fullButton.addActionListener(this);
1079
-
1080
- 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);
10811118 screenfitButton.setToolTipText("Screen fit");
10821119 screenfitButton.addActionListener(this);
10831120
1084
- 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);
10851122 restoreCameraButton.setToolTipText("Restore viewpoint");
10861123 restoreCameraButton.addActionListener(this);
10871124
1088
- 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);
10891126 saveVersionButton.setToolTipText("Duplicate current version");
10901127 saveVersionButton.addActionListener(this);
10911128
1092
- copyOptionsPanel.add(deleteVersionButton = GetButton("icons/trash.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1129
+ versionManagerPanel.add(deleteVersionButton = GetButton("icons/trash.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10931130 deleteVersionButton.setToolTipText("Delete current version");
10941131 deleteVersionButton.addActionListener(this);
1132
+ deleteVersionButton.setEnabled(false);
10951133
1096
- copyOptionsPanel.add(previousVersionButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1134
+ versionManagerPanel.add(previousVersionButton = GetButton("icons/undo.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10971135 previousVersionButton.setToolTipText("Previous version");
10981136 previousVersionButton.addActionListener(this);
10991137 previousVersionButton.setEnabled(false);
11001138
11011139 cGridBag updown = new cGridBag().setVertical(true);
1102
- updown.add(restoreButton = GetButton("icons/restore.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1140
+ updown.add(restoreButton = GetButton("icons/restore.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11031141 restoreButton.setToolTipText("Undo (restore current version)");
11041142 restoreButton.addActionListener(this);
1105
- //restoreButton.setEnabled(false);
1143
+ restoreButton.setEnabled(false);
11061144
1107
- updown.add(replaceButton = GetButton("icons/replace.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1145
+ updown.add(replaceButton = GetButton("icons/replace.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11081146 replaceButton.setToolTipText("Save (replace current version)");
11091147 replaceButton.addActionListener(this);
1110
- //replaceButton.setEnabled(false);
1148
+ replaceButton.setEnabled(false);
11111149
1112
- copyOptionsPanel.add(updown);
1150
+ versionManagerPanel.add(updown);
11131151
1114
- copyOptionsPanel.add(nextVersionButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1152
+ versionManagerPanel.add(nextVersionButton = GetButton("icons/redo.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11151153 nextVersionButton.setToolTipText("Next version");
11161154 nextVersionButton.addActionListener(this);
11171155 nextVersionButton.setEnabled(false);
11181156
1119
- 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);
11201158 oneStepButton.setToolTipText("Animate one step forward");
11211159 oneStepButton.addActionListener(this);
11221160
....@@ -1139,11 +1177,11 @@
11391177
11401178 if (Globals.ADVANCED)
11411179 {
1142
- oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1180
+ oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11431181 snapobjectButton.addActionListener(this);
11441182 snapobjectButton.setToolTipText("Snap Object");
11451183
1146
- 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);
11471185 fourButton.addActionListener(this);
11481186 fourButton.setToolTipText("Show control panel only");
11491187 }
....@@ -1151,83 +1189,85 @@
11511189 //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
11521190
11531191
1154
- 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);
11551193 rootButton.setToolTipText("Open selection in new tab");
11561194 rootButton.addActionListener(this);
11571195
1158
- 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);
11591197 closeButton.setToolTipText("Close tab");
11601198 closeButton.addActionListener(this);
11611199 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
11621200 //clearButton.addActionListener(this);
11631201
11641202 cGridBag row1 = new cGridBag();
1203
+ row1.preferredHeight = 8;
11651204
11661205 // INSERT
1167
- row1.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1206
+ row1.add(gridButton = GetButton("icons/grid.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11681207 gridButton.setToolTipText("Create ground");
11691208 gridButton.addActionListener(this);
11701209
1171
- row1.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1210
+ row1.add(boxButton = GetButton("icons/box.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11721211 boxButton.setToolTipText("Create box");
11731212 boxButton.addActionListener(this);
11741213
1175
- row1.add(sphereButton = GetButton("icons/sphere.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1176
- sphereButton.setToolTipText("Create sphere");
1177
- sphereButton.addActionListener(this);
1178
-
1179
- row1.add(coneButton = GetButton("icons/cone.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1180
- coneButton.setToolTipText("Create cone");
1181
- coneButton.addActionListener(this);
1182
-
1183
- row1.add(torusButton = GetButton("icons/torus.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1184
- torusButton.setToolTipText("Create torus");
1185
- torusButton.addActionListener(this);
1186
-
1187
- row1.add(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1214
+ row1.add(superButton = GetButton("icons/super.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11881215 superButton.setToolTipText("Create superellipsoid");
11891216 superButton.addActionListener(this);
11901217
1191
- 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)
11921231 {
1193
- 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);
11941233 kleinButton.setToolTipText("Create Klein bottle");
11951234 kleinButton.addActionListener(this);
11961235 }
11971236
1198
- row1.add(particlesButton = GetButton("icons/particles.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1237
+ row1.add(particlesButton = GetButton("icons/particles.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11991238 particlesButton.setToolTipText("Create particle system");
12001239 particlesButton.addActionListener(this);
12011240
12021241 oe.toolboxPanel.add(row1);
12031242
12041243 cGridBag row2 = new cGridBag();
1244
+ row2.preferredHeight = 8;
12051245
1206
- row2.add(groupButton = GetButton("icons/group.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1246
+ row2.add(groupButton = GetButton("icons/group.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12071247 groupButton.setToolTipText("Create group");
12081248 groupButton.addActionListener(this);
12091249
1210
- row2.add(compositeButton = GetButton("icons/composite.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1250
+ row2.add(compositeButton = GetButton("icons/composite.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12111251 compositeButton.setToolTipText("Create composite");
12121252 compositeButton.addActionListener(this);
12131253
1214
- row2.add(switchButton = GetButton("icons/switch.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1254
+ row2.add(switchButton = GetButton("icons/switch.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12151255 switchButton.setToolTipText("Create item switcher");
12161256 switchButton.addActionListener(this);
12171257
1218
- row2.add(loopButton = GetButton("icons/loop.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1258
+ row2.add(loopButton = GetButton("icons/loop.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12191259 loopButton.setToolTipText("Create loop");
12201260 loopButton.addActionListener(this);
12211261
1222
- row2.add(textureButton = GetButton("icons/texture.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1262
+ row2.add(textureButton = GetButton("icons/texture.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12231263 textureButton.setToolTipText("Create texture");
12241264 textureButton.addActionListener(this);
12251265
1226
- row2.add(overlayButton = GetButton("icons/overlay.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1266
+ row2.add(overlayButton = GetButton("icons/overlay.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12271267 overlayButton.setToolTipText("Create overlay");
12281268 overlayButton.addActionListener(this);
12291269
1230
- 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);
12311271 lightButton.setToolTipText("Create light");
12321272 lightButton.addActionListener(this);
12331273
....@@ -1237,6 +1277,11 @@
12371277
12381278 CreateTexturePanel(textures);
12391279
1280
+ int tabCount = resourcecontainer.getTabCount();
1281
+
1282
+ if (tabCount > 0)
1283
+ resourcecontainer.setSelectedIndex((int)(Math.random() * tabCount));
1284
+
12401285 oe.toolboxPanel.add(textures);
12411286
12421287 textures.preferredHeight = 100;
....@@ -1244,11 +1289,11 @@
12441289 CreateSkyboxPanel(oe.skyboxPanel);
12451290
12461291 // EDIT panel
1247
- editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1292
+ editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12481293 editButton.setToolTipText("Pin selection controls");
12491294 editButton.addActionListener(this);
12501295
1251
- editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1296
+ editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12521297 uneditButton.setToolTipText("Unpin and remove selection controls");
12531298 uneditButton.addActionListener(this);
12541299
....@@ -1256,7 +1301,7 @@
12561301 allParamsButton.setToolTipText("Show all controls");
12571302 allParamsButton.addActionListener(this);
12581303
1259
- editCommandsPanel.add(clearPanelButton = GetButton("icons/clear.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1304
+ editCommandsPanel.add(clearPanelButton = GetButton("icons/clear.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12601305 clearPanelButton.setToolTipText("Clear all controls");
12611306 clearPanelButton.addActionListener(this);
12621307
....@@ -1264,7 +1309,7 @@
12641309 //unselectButton.setToolTipText("Unselect");
12651310 //unselectButton.addActionListener(this);
12661311
1267
- 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);
12681313 flashSelectionButton.setToolTipText("Highlight selection");
12691314 flashSelectionButton.addActionListener(this);
12701315
....@@ -1287,6 +1332,8 @@
12871332
12881333 cGridBag jSPPanel = new cGridBag();
12891334
1335
+ jSPPanel.preferredHeight = 20;
1336
+
12901337 JScrollPane jSP;
12911338 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
12921339 jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
....@@ -1295,11 +1342,12 @@
12951342 oe.treePanel.add(jSPPanel);
12961343 oe.treePanel.Return();
12971344
1298
- oe.treePanel.add(copyOptionsPanel);
1345
+ oe.treePanel.add(versionManagerPanel);
12991346 oe.treePanel.Return();
1300
- cGridBag sliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
1301
- versionSlider = (cNumberSlider)sliderPane.getComponent(1);
1302
- sliderPane.preferredHeight = 1;
1347
+
1348
+ versionSliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
1349
+ versionSlider = (cNumberSlider)versionSliderPane.getComponent(1);
1350
+ versionSliderPane.preferredHeight = 3;
13031351
13041352 // mainPanel.setDividerLocation(0.1); //1.0);
13051353 mainPanel.setResizeWeight(0.4);
....@@ -1356,7 +1404,7 @@
13561404 // supportCB.setToolTipText("Enable rigging");
13571405 // supportCB.addItemListener(this);
13581406
1359
- panel.add(freezeCB = new cCheckBox("Freeze", Globals.FREEZEONMOVE)); //, constraints);
1407
+ panel.add(freezeCB = new cCheckBox("Fast cam", Globals.FREEZEONMOVE)); //, constraints);
13601408 freezeCB.setToolTipText("Fast moving camera");
13611409 freezeCB.addItemListener(this);
13621410
....@@ -1365,9 +1413,12 @@
13651413
13661414 panel.Return();
13671415
1416
+ if (Globals.ADVANCED)
1417
+ {
13681418 panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD)); //, constraints);
13691419 crowdCB.setToolTipText("Used for crowds");
13701420 crowdCB.addItemListener(this);
1421
+ }
13711422
13721423 panel.add(smoothCB = new cCheckBox("Inertia", CameraPane.INERTIA)); //, constraints);
13731424 smoothCB.setToolTipText("Snapping delay");
....@@ -1380,30 +1431,26 @@
13801431 minshaderCB.setToolTipText("Minimal fast shader");
13811432 minshaderCB.addItemListener(this);
13821433
1383
-// constraints.gridy += 1;
13841434 // panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
13851435 // speakerMocapCB.addItemListener(this);
13861436
1387
- panel.Return();
1388
-
13891437 if (false)
13901438 {
13911439 // handled in scripts
1392
- //constraints.gridy += 1;
13931440 panel.add(speakerCameraCB = new cCheckBox("Cam", CameraPane.SPEAKERCAMERA)); //, constraints);
13941441 speakerCameraCB.addItemListener(this);
13951442
1396
- //constraints.gridy += 1;
13971443 panel.add(speakerFocusCB = new cCheckBox("Focus", CameraPane.SPEAKERFOCUS)); //, constraints);
13981444 speakerFocusCB.addItemListener(this);
13991445
1400
- //constraints.gridy += 1;
1401
- panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints);
1402
- smoothfocusCB.addItemListener(this);
14031446 panel.Return();
14041447 }
14051448
1406
-//constraints.gridx += 1;
1449
+ panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints);
1450
+ smoothfocusCB.addItemListener(this);
1451
+
1452
+ panel.Return();
1453
+
14071454 //panel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), constraints);
14081455 // debugCB.addItemListener(this);
14091456
....@@ -1457,13 +1504,13 @@
14571504
14581505 void EditObject(Object3D obj)
14591506 {
1460
- assert(obj instanceof Composite);
1507
+ //assert(obj instanceof Composite);
14611508
1462
- if (obj.versionlist == null)
1463
- {
1464
- obj.versionlist = new Object3D[100];
1465
- obj.versionindex = -1;
1466
- }
1509
+// if (obj.versionlist == null)
1510
+// {
1511
+// obj.versionlist = new Object3D[100];
1512
+// obj.versionindex = -1;
1513
+// }
14671514
14681515 cRadio radioButton = new cRadio(obj.name);
14691516
....@@ -1489,6 +1536,7 @@
14891536
14901537 oe.SetupViews();
14911538
1539
+ if (Globals.DEBUG)
14921540 System.out.println("SetupViews");
14931541 DragSource.getDefaultDragSource().createDefaultDragGestureRecognizer(
14941542 oe.cameraView, DnDConstants.ACTION_COPY_OR_MOVE, this); // ACTION_LINK ??
....@@ -2041,7 +2089,7 @@
20412089 Object3D obj = (Object3D)group.selection.elementAt(0);
20422090 objEditor.ScreenFit(obj, false);
20432091
2044
- cameraView.pingthread.StepToTarget(true);
2092
+ cameraView.pingthread.StepToTarget(); //true);
20452093 refreshContents();
20462094 }
20472095
....@@ -2078,7 +2126,7 @@
20782126 obj.parent.TransformToWorld(maxima); //, maxima);
20792127 }
20802128
2081
- Object3D shadow = new Object3D("Shadow " + obj.name);
2129
+ Object3D shadow = new Object3D("Shadow" + obj.name);
20822130
20832131 shadow.toParent = LA.newMatrix();
20842132 shadow.fromParent = LA.newMatrix();
....@@ -2092,24 +2140,24 @@
20922140 switch(axis)
20932141 {
20942142 case 0 :
2095
- vert1.x = minima.x; vert1.y = minima.y; vert1.z = minima.z;
2096
- vert2.x = minima.x; vert2.y = maxima.y; vert2.z = minima.z;
2097
- vert3.x = minima.x; vert3.y = minima.y; vert3.z = maxima.z;
2098
- 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;
20992147 norm = cVector.X;
21002148 break;
21012149 case 1 :
2102
- vert1.x = minima.x; vert1.y = minima.y; vert1.z = minima.z;
2103
- vert2.x = maxima.x; vert2.y = minima.y; vert2.z = minima.z;
2104
- vert3.x = minima.x; vert3.y = minima.y; vert3.z = maxima.z;
2105
- 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;
21062154 norm = cVector.Y;
21072155 break;
21082156 case 2 :
2109
- vert1.x = minima.x; vert1.y = minima.y; vert1.z = minima.z;
2110
- vert2.x = maxima.x; vert2.y = minima.y; vert2.z = minima.z;
2111
- vert3.x = minima.x; vert3.y = maxima.y; vert3.z = minima.z;
2112
- 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;
21132161 norm = cVector.Z;
21142162 break;
21152163 }
....@@ -2150,7 +2198,11 @@
21502198 shadow.material = new cMaterial(obj.material);
21512199 shadow.material.diffuse = 0.0001f;
21522200 shadow.material.specular = 0.0001f;
2153
- //shadow.projectedVertices[1].x = 300;
2201
+ shadow.material.opacity = 0.75f;
2202
+
2203
+ AllocProjectedVertices(shadow);
2204
+
2205
+ shadow.projectedVertices[1].x = 300;
21542206
21552207 makeSomething(shadow);
21562208 }
....@@ -2671,27 +2723,35 @@
26712723 } else
26722724 if (source == loopItem || source == loopButton)
26732725 {
2726
+ if (!group.selection.isEmpty())
2727
+ {
26742728 Composite csg = new GroupLeaf();
2675
- csg.count = 5;
26762729 group(csg);
2730
+ csg.count = 5;
26772731 Composite child = new cGroup("Branch");
26782732 csg.addChild(child);
26792733 child.addChild(csg);
2734
+ }
26802735 } else
26812736 if (source == doubleItem)
26822737 {
2738
+ if (!group.selection.isEmpty())
2739
+ {
26832740 Composite csg = new GroupLeaf("Fork");
2684
- csg.count = 5;
26852741 group(csg);
2742
+ csg.count = 5;
26862743 Composite child = new cGroup("Branch A");
26872744 csg.addChild(child);
26882745 child.addChild(csg);
26892746 child = new cGroup("Branch B");
26902747 csg.addChild(child);
26912748 child.addChild(csg);
2749
+ }
26922750 } else
26932751 if (source == tripleItem)
26942752 {
2753
+ if (!group.selection.isEmpty())
2754
+ {
26952755 Composite csg = new GroupLeaf("Trident");
26962756 csg.count = 4;
26972757 group(csg);
....@@ -2704,6 +2764,7 @@
27042764 child = new cGroup();
27052765 csg.addChild(child);
27062766 child.addChild(csg);
2767
+ }
27072768 } else
27082769 if (source == computeAOItem)
27092770 {
....@@ -2750,7 +2811,7 @@
27502811 {
27512812 Maximize();
27522813 } else
2753
- if (source == fullButton)
2814
+ if (source == fullScreenButton)
27542815 {
27552816 ToggleFullScreen();
27562817 } else
....@@ -2759,13 +2820,13 @@
27592820 this.expandedLayout = radio.layout;
27602821 CollapseToolbar();
27612822 } else
2762
- if (source == maximize3DButton)
2763
- {
2764
- this.expandedLayout = radio.layout;
2765
- radio.layout = twoButton;
2766
- Show3DView();
2767
- CollapseToolbar();
2768
- } else
2823
+// if (source == maximize3DButton)
2824
+// {
2825
+// this.expandedLayout = radio.layout;
2826
+// radio.layout = twoButton;
2827
+// CollapseToolbar();
2828
+// Show3DView();
2829
+// } else
27692830 if (source == previousVersionButton)
27702831 {
27712832 // Go to previous version
....@@ -2793,7 +2854,7 @@
27932854 if (source == saveVersionButton)
27942855 {
27952856 // Save a new version
2796
- if (!Save(true))
2857
+ if (!DuplicateVersion()) //true))
27972858 java.awt.Toolkit.getDefaultToolkit().beep();
27982859 } else
27992860 if (source == deleteVersionButton)
....@@ -3339,22 +3400,34 @@
33393400 } else
33403401 if (source == ungroupItem || source == ungroupButton)
33413402 {
3342
- boolean hasRoot = false;
3403
+ boolean canUngroup = true;
33433404
33443405 for (int i=0; i<group.selection.size(); i++)
33453406 {
3346
- if (group.selection.get(i) == group)
3407
+ Object3D selectedItem = group.selection.get(i);
3408
+
3409
+ if (selectedItem.Size() == 0)
33473410 {
3348
- 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;
33493420 break;
33503421 }
33513422 }
33523423
3353
- if (!hasRoot)
3424
+ if (canUngroup)
33543425 {
33553426 for (int i=0; i<group.selection.size(); i++)
33563427 {
3357
- Ungroup(group.selection.get(i));
3428
+ Object3D selectedItem = group.selection.get(i);
3429
+
3430
+ Ungroup(selectedItem);
33583431 }
33593432
33603433 ClearSelection(false);
....@@ -3405,6 +3478,10 @@
34053478 if (source == clearMaterialsItem)
34063479 {
34073480 ClearMaterials();
3481
+ } else
3482
+ if (source == clearVersionsItem)
3483
+ {
3484
+ ClearVersions();
34083485 } else
34093486 if (source == liveleavesItem)
34103487 {
....@@ -3545,6 +3622,18 @@
35453622 if (source == transformChildrenItem)
35463623 {
35473624 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);
35483637 } else
35493638 if (source == resetTransformItem)
35503639 {
....@@ -3918,6 +4007,9 @@
39184007 if (source == closeButton)
39194008 {
39204009 //System.out.println("CLOSE: " + buttonGroup.getSelection());
4010
+ if (copy.versionlist != null)
4011
+ Replace();
4012
+
39214013 cRadio ab;
39224014 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
39234015 {
....@@ -4016,6 +4108,9 @@
40164108 } else
40174109 if(source instanceof cRadio)
40184110 {
4111
+ if (copy.versionlist != null)
4112
+ Replace();
4113
+
40194114 group.parent = keepparent;
40204115 group.attributes = 0;
40214116 //group.editWindow = null;
....@@ -4067,7 +4162,31 @@
40674162 */
40684163 radio.layout.doClick();
40694164
4070
- SetUndoStates();
4165
+ //assert(copy instanceof Composite);
4166
+
4167
+ if (copy.versionlist == null)
4168
+ {
4169
+ copy.versionindex = -1;
4170
+
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);
4187
+ }
4188
+
4189
+ SetVersionStates();
40714190
40724191 ClearUnpinned();
40734192
....@@ -4182,9 +4301,46 @@
41824301 refreshContents();
41834302 }
41844303
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
+
41854316 void ResetTransform()
41864317 {
41874318 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();
41884344 }
41894345
41904346 void ResetTransform(int mask)
....@@ -4197,42 +4353,8 @@
41974353 if (obj.toParent == null)
41984354 continue;
41994355
4200
- if (mask == -1)
4201
- {
4202
- if (obj instanceof Camera) // jan 2014
4203
- {
4204
- LA.matIdentity(obj.toParent);
4205
- LA.matIdentity(obj.fromParent);
4206
- }
4207
- else
4208
- {
4209
- obj.toParent = null; // jan 2014 LA.matIdentity(obj.toParent);
4210
- obj.fromParent = null; // LA.matIdentity(obj.fromParent);
4211
- }
4212
- TouchTransform(obj);
4213
- continue;
4214
- }
4215
- if ((mask&2) != 0) // Scale
4216
- {
4217
- obj.toParent[0][0] = obj.toParent[1][1] = obj.toParent[2][2] = 1;
4218
- obj.toParent[0][1] = obj.toParent[1][0] = obj.toParent[2][0] = 0;
4219
- obj.toParent[0][2] = obj.toParent[1][2] = obj.toParent[2][1] = 0;
4220
- obj.fromParent[0][0] = obj.fromParent[1][1] = obj.fromParent[2][2] = 1;
4221
- obj.fromParent[0][1] = obj.fromParent[1][0] = obj.fromParent[2][0] = 0;
4222
- obj.fromParent[0][2] = obj.fromParent[1][2] = obj.fromParent[2][1] = 0;
4223
- }
4224
- if ((mask&4) != 0) // Rotation
4225
- {
4226
- // ?
4227
- }
4228
- if ((mask&1) != 0) // Translation
4229
- {
4230
- if (obj.toParent != null)
4231
- {
4232
- obj.toParent[3][0] = obj.toParent[3][1] = obj.toParent[3][2] = 0;
4233
- obj.fromParent[3][0] = obj.fromParent[3][1] = obj.fromParent[3][2] = 0;
4234
- }
4235
- }
4356
+ obj.ResetTransform(mask);
4357
+
42364358 if (obj.parent == null)
42374359 {
42384360 System.out.println("NULL PARENT!");
....@@ -4741,10 +4863,17 @@
47414863 {
47424864 Object3D obj = group.selection.get(i);
47434865
4866
+ if (obj.toParent == null)
4867
+ {
4868
+ obj.toParent = LA.newMatrix();
4869
+ obj.fromParent = LA.newMatrix();
4870
+ }
4871
+
47444872 LA.matTranslate(obj.toParent, i * scale, 0, 0);
47454873 LA.matTranslateInv(obj.fromParent, -i * scale, 0, 0);
47464874 }
47474875
4876
+ Globals.lighttouched = true;
47484877 refreshContents();
47494878 }
47504879
....@@ -5032,6 +5161,12 @@
50325161 refreshContents();
50335162 }
50345163
5164
+ void ClearVersions()
5165
+ {
5166
+ group.selection.ClearVersions();
5167
+ refreshContents();
5168
+ }
5169
+
50355170 void FlipV(boolean flip)
50365171 {
50375172 group.selection.FlipV(flip);
....@@ -5270,10 +5405,10 @@
52705405 if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
52715406 // a camera
52725407 {
5273
- 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
52745409 {
52755410 CameraPane.camerachangeframe = 0; // don't refuse it
5276
- Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
5411
+ Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent(), true);
52775412 }
52785413 // Globals.theRenderer.renderCamera = Globals.theRenderer.manipCamera;
52795414 // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
....@@ -5306,20 +5441,23 @@
53065441
53075442 boolean allComposites = true;
53085443
5444
+ if (group.selection != null)
53095445 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
53105446 {
5311
- if (!(e.nextElement() instanceof Composite))
5447
+ Object next = e.nextElement();
5448
+ if (!(next instanceof Composite)) // || (next instanceof GroupLeaf))
53125449 {
53135450 allComposites = false;
53145451 break;
53155452 }
53165453 }
53175454
5318
- rootButton.setEnabled(allComposites);
5455
+ rootButton.setEnabled(true); // allComposites);
53195456 }
53205457
53215458 void refreshContents(boolean cp)
53225459 {
5460
+ if (Globals.SHOWINFO)
53235461 //if (objectPanel.getSelectedIndex() == 2) // objectPanel.indexOfTab("Info"))
53245462 if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
53255463 {
....@@ -6213,11 +6351,11 @@
62136351 private MenuItem lookAtItem;
62146352 private MenuItem lookFromItem;
62156353 private MenuItem switchViewItem;
6216
- private MenuItem cutItem;
6354
+ private JMenuItem cutItem;
62176355 private MenuItem undoItem;
62186356 private MenuItem redoItem;
62196357 private JMenuItem duplicateItem;
6220
- private MenuItem cloneItem;
6358
+ private JMenuItem cloneItem;
62216359 private MenuItem cloneSupportItem;
62226360 private MenuItem overwriteGeoItem;
62236361 private MenuItem overwriteMatItem;
....@@ -6238,13 +6376,13 @@
62386376 private MenuItem cloneGeometriesItem;
62396377 private MenuItem shareGeometriesItem;
62406378 private MenuItem mergeGeometriesItem;
6241
- private MenuItem copyItem;
6379
+ private JMenuItem copyItem;
62426380 private MenuItem pasteItem;
6243
- private MenuItem pasteIntoItem;
6244
- private MenuItem pasteLinkItem;
6245
- private MenuItem pasteCloneItem;
6246
- private MenuItem pasteExpandItem;
6247
- private MenuItem deleteItem;
6381
+ private JMenuItem pasteIntoItem;
6382
+ private JMenuItem pasteLinkItem;
6383
+ private JMenuItem pasteCloneItem;
6384
+ private JMenuItem pasteExpandItem;
6385
+ private JMenuItem deleteItem;
62486386 private MenuItem clearAllItem;
62496387 private MenuItem genUVItem;
62506388 private MenuItem genNormalsMESHItem;
....@@ -6270,6 +6408,7 @@
62706408 private MenuItem clipMeshItem;
62716409 private MenuItem smoothMeshItem;
62726410 private MenuItem clearMaterialsItem;
6411
+ private MenuItem clearVersionsItem;
62736412
62746413 private MenuItem liveleavesItem;
62756414 private MenuItem unliveleavesItem;
....@@ -6293,13 +6432,16 @@
62936432 private MenuItem maxTexturesItem;
62946433 private MenuItem panoTexturesItem;
62956434
6435
+ private MenuItem textureRatioRItem;
6436
+ private MenuItem textureRatioGItem;
6437
+ private MenuItem textureRatioBItem;
62966438 private MenuItem resetCentroidItem;
62976439 private MenuItem resetCentroidXZItem;
62986440 private MenuItem resetTransformItem;
62996441 private MenuItem transformGeometryItem;
63006442 private MenuItem transformChildrenItem;
63016443 private MenuItem hideItem;
6302
- private MenuItem grabItem;
6444
+ private JMenuItem grabItem;
63036445 private MenuItem backItem;
63046446 private MenuItem frontItem;
63056447 private MenuItem cameraItem;
....@@ -6312,7 +6454,7 @@
63126454 private MenuItem switchTransfoItem;
63136455 private MenuItem morphItem;
63146456 private MenuItem linkerItem;
6315
- private MenuItem ungroupItem;
6457
+ private JMenuItem ungroupItem;
63166458 private MenuItem editItem;
63176459 private MenuItem openWindowItem;
63186460 private MenuItem editLeafItem;