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,11 +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
- }
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
+// }
414417
415418 if(ui)
416419 SetupUI(objEditor);
....@@ -433,13 +436,13 @@
433436
434437 ((cRadio)radioPanel.getComponent(0)).SetCamera(cameraView.renderCamera, true);
435438
436
- if (copy.versionlist == null)
437
- {
438
- copy.versionlist = new Object3D[100];
439
- copy.versionindex = -1;
440
-
441
- Save(true);
442
- }
439
+// if (copy.versionlist == null)
440
+// {
441
+// copy.versionlist = new Object3D[100];
442
+// copy.versionindex = -1;
443
+//
444
+// //Save(true);
445
+// }
443446 }
444447
445448 void CloneSelection(boolean supports)
....@@ -480,11 +483,16 @@
480483
481484 Object3D parent = obj.parent;
482485 obj.parent = null;
486
+
483487 // Object3D support = obj.support;
484488 // obj.support = null;
485489 if (!supports)
486490 obj.SaveSupports();
491
+
487492 Object3D clone = (Object3D)Grafreed.clone(obj);
493
+
494
+ clone.ResetUUIDs();
495
+
488496 obj.parent = parent;
489497 // obj.support = support;
490498 // clone.support = support; // aout 2013
....@@ -529,33 +537,37 @@
529537 // menu.add("-");
530538 duplicateItem = oe.jTree.popup.add(new JMenuItem("Duplicate"));
531539 duplicateItem.addActionListener(this);
532
- cloneItem = menu.add(new MenuItem("Clone"));
540
+
541
+ cloneItem = oe.jTree.popup.add(new JMenuItem("Clone"));
533542 cloneItem.addActionListener(this);
534
- if (Globals.ADVANCED)
543
+ //if (Globals.ADVANCED)
535544 {
536545 cloneSupportItem = menu.add(new MenuItem("Clone (+supports)"));
537546 cloneSupportItem.addActionListener(this);
538547 }
548
+ oe.jTree.popup.addSeparator();
539549 menu.add("-");
540
- cutItem = menu.add(new MenuItem("Cut"));
550
+ cutItem = oe.jTree.popup.add(new JMenuItem("Cut"));
541551 cutItem.addActionListener(this);
542
- copyItem = menu.add(new MenuItem("Copy"));
552
+ copyItem = oe.jTree.popup.add(new JMenuItem("Copy"));
543553 copyItem.addActionListener(this);
544554 pasteItem = menu.add(new MenuItem("Paste"));
545555 pasteItem.addActionListener(this);
546556
547
- menu.add("-");
548
- 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"));
549560 pasteIntoItem.addActionListener(this);
550
- pasteLinkItem = menu.add(new MenuItem("Paste link"));
561
+ pasteLinkItem = oe.jTree.popup.add(new JMenuItem("Paste link"));
551562 pasteLinkItem.addActionListener(this);
552
- pasteCloneItem = menu.add(new MenuItem("Paste clone"));
563
+ pasteCloneItem = oe.jTree.popup.add(new JMenuItem("Paste clone"));
553564 pasteCloneItem.addActionListener(this);
554
-// pasteExpandItem = menu.add(new MenuItem("Paste expand"));
555
-// pasteExpandItem.addActionListener(this);
556
- menu.add("-");
557
- deleteItem = menu.add(new MenuItem("Delete"));
558
- 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();
559571
560572 if (Globals.ADVANCED)
561573 {
....@@ -641,11 +653,9 @@
641653 oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest"));
642654 //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection"));
643655 //cameraMenu.add(switchViewItem = new MenuItem("Reverse View"));
644
- editLeafItem = oe.cameraMenu.add(new MenuItem("Edit Leaf"));
645656 oe.cameraMenu.add("-");
646657 openWindowItem = oe.cameraMenu.add(new MenuItem("Edit copy..."));
647658 openWindowItem.addActionListener(this);
648
- editLeafItem.addActionListener(this);
649659 lookAtItem.addActionListener(this);
650660 //lookFromItem.addActinoListener(this);
651661 //switchViewItem.addActionListener(this);
....@@ -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);
....@@ -893,6 +919,9 @@
893919 shareGeometriesItem.addActionListener(this);
894920 mergeGeometriesItem = menu.add(new MenuItem("Merge Geometries"));
895921 mergeGeometriesItem.addActionListener(this);
922
+ menu.add("-");
923
+ editLeafItem = menu.add(new MenuItem("Edit leaf..."));
924
+ editLeafItem.addActionListener(this);
896925 if (Globals.ADVANCED)
897926 {
898927 // Pretty much the same as duplicate and clone.
....@@ -911,8 +940,10 @@
911940
912941 JTabbedPane resourcecontainer;
913942 cGridBag currenttab;
914
- boolean added; // patch for jar
943
+ //boolean added; // patch for jar
915944
945
+ int totalcount = 0;
946
+
916947 int tabcount = 0;
917948 int colcount = 0;
918949 int rowcount = 0;
....@@ -928,28 +959,35 @@
928959 // System.out.println();
929960
930961 if (//rowcount == 0 ||
931
- path.length == 1)
962
+ path.length == 1 && !path[0].equals("") && !path[0].equals(".DS_Store"))
932963 {
933964 currenttab = new cGridBag();
934
- added = false;
935965 String tabname = path[0]; // String.valueOf((char)('A'+tabcount));
936966 currenttab.setName(tabname);
967
+ //added = false;
968
+ resourcecontainer.add(currenttab);
969
+ resourcecontainer.setToolTipTextAt(tabcount++, "Texture " + tabname);
937970 rowcount = 1;
938971 colcount = 0;
939972 texturecount = 0;
940973 }
941974
942
- if (path.length > 2 && path[2].toLowerCase().endsWith(".jpg"))
975
+ if (path.length > 2 && (path[2].toLowerCase().endsWith(".jpg") || path[2].toLowerCase().endsWith(".png")))
943976 {
944
- if (!added)
977
+ //if (!added)
945978 {
946
- added = true;
947
- resourcecontainer.add(currenttab);
979
+ //added = true;
948980 String tabname = path[0]; // String.valueOf((char)('A'+tabcount));
949
- resourcecontainer.setToolTipTextAt(tabcount++, "Texture Group " + tabname);
981
+ currenttab = (cGridBag)resourcecontainer.getComponentAt(resourcecontainer.indexOfTab(tabname));
950982 }
951983
952
- 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++;
953991
954992 if (++colcount >= columns)
955993 {
....@@ -975,6 +1013,8 @@
9751013 container.add(resourcecontainer);
9761014
9771015 Grafreed.ParseResources("textures", this);
1016
+
1017
+ // 935. System.out.println("Total = " + totalcount);
9781018 }
9791019
9801020 void SetupUI2(ObjEditor oe)
....@@ -1014,9 +1054,9 @@
10141054 oe.radioPanel.add(dummyButton);
10151055 oe.buttonGroup.add(dummyButton);
10161056 */
1017
- cGridBag copyOptionsPanel = new cGridBag();
1057
+ cGridBag versionManagerPanel = new cGridBag();
10181058
1019
- copyOptionsPanel.preferredHeight = 2;
1059
+ versionManagerPanel.preferredHeight = 4;
10201060
10211061 //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
10221062
....@@ -1026,42 +1066,46 @@
10261066
10271067 if (Globals.ADVANCED)
10281068 {
1029
- oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1030
- maxButton.setToolTipText("Maximize window");
1031
- maxButton.addActionListener(this);
1069
+// oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1070
+// maxButton.setToolTipText("Maximize window");
1071
+// maxButton.addActionListener(this);
10321072 }
10331073
10341074 cButton gcButton;
10351075
1036
- oe.toolbarPanel.add(gcButton = GetButton("icons/trash.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1037
- gcButton.setToolTipText("Garbage collect");
1038
- gcButton.addActionListener(new ActionListener()
1039
- {
1040
- public void actionPerformed(ActionEvent e)
1041
- {
1042
- System.gc();
1043
- }
1044
- });
1076
+// oe.toolbarPanel.add(gcButton = GetButton("icons/trash.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1077
+// gcButton.setToolTipText("Garbage collect");
1078
+// gcButton.addActionListener(new ActionListener()
1079
+// {
1080
+// public void actionPerformed(ActionEvent e)
1081
+// {
1082
+// System.gc();
1083
+// }
1084
+// });
10451085
1046
- 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);
10471091 collapseButton.setToolTipText("Collapse toolbar");
10481092 collapseButton.addActionListener(this);
10491093
1050
- oe.toolbarPanel.add(maximize3DButton = GetButton("", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1051
- maximize3DButton.setToolTipText("Maximize 3D view");
1052
- 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);
10531097
1054
- 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);
10551099 twoButton.setToolTipText("Show 3D view only");
10561100 twoButton.addActionListener(this);
10571101 this.fullscreenLayout = twoButton;
10581102
1059
- 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);
10601104 threeButton.setToolTipText("Show controls and 3D view");
10611105 threeButton.addActionListener(this);
10621106 if (Globals.ADVANCED)
10631107 {
1064
- 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);
10651109 sixButton.setToolTipText("Show 3D view and controls");
10661110 sixButton.addActionListener(this);
10671111 }
....@@ -1070,50 +1114,47 @@
10701114 // sevenButton.addActionListener(this);
10711115 //
10721116
1073
- oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1074
- fullButton.setToolTipText("Full-screen window");
1075
- fullButton.addActionListener(this);
1076
-
1077
- 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);
10781118 screenfitButton.setToolTipText("Screen fit");
10791119 screenfitButton.addActionListener(this);
10801120
1081
- 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);
10821122 restoreCameraButton.setToolTipText("Restore viewpoint");
10831123 restoreCameraButton.addActionListener(this);
10841124
1085
- 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);
10861126 saveVersionButton.setToolTipText("Duplicate current version");
10871127 saveVersionButton.addActionListener(this);
10881128
1089
- copyOptionsPanel.add(deleteVersionButton = GetButton("icons/trash.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1129
+ versionManagerPanel.add(deleteVersionButton = GetButton("icons/trash.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10901130 deleteVersionButton.setToolTipText("Delete current version");
10911131 deleteVersionButton.addActionListener(this);
1132
+ deleteVersionButton.setEnabled(false);
10921133
1093
- copyOptionsPanel.add(previousVersionButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1134
+ versionManagerPanel.add(previousVersionButton = GetButton("icons/undo.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10941135 previousVersionButton.setToolTipText("Previous version");
10951136 previousVersionButton.addActionListener(this);
10961137 previousVersionButton.setEnabled(false);
10971138
10981139 cGridBag updown = new cGridBag().setVertical(true);
1099
- updown.add(restoreButton = GetButton("icons/restore.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1140
+ updown.add(restoreButton = GetButton("icons/restore.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11001141 restoreButton.setToolTipText("Undo (restore current version)");
11011142 restoreButton.addActionListener(this);
1102
- //restoreButton.setEnabled(false);
1143
+ restoreButton.setEnabled(false);
11031144
1104
- updown.add(replaceButton = GetButton("icons/replace.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1145
+ updown.add(replaceButton = GetButton("icons/replace.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11051146 replaceButton.setToolTipText("Save (replace current version)");
11061147 replaceButton.addActionListener(this);
1107
- //replaceButton.setEnabled(false);
1148
+ replaceButton.setEnabled(false);
11081149
1109
- copyOptionsPanel.add(updown);
1150
+ versionManagerPanel.add(updown);
11101151
1111
- copyOptionsPanel.add(nextVersionButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1152
+ versionManagerPanel.add(nextVersionButton = GetButton("icons/redo.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11121153 nextVersionButton.setToolTipText("Next version");
11131154 nextVersionButton.addActionListener(this);
11141155 nextVersionButton.setEnabled(false);
11151156
1116
- 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);
11171158 oneStepButton.setToolTipText("Animate one step forward");
11181159 oneStepButton.addActionListener(this);
11191160
....@@ -1136,11 +1177,11 @@
11361177
11371178 if (Globals.ADVANCED)
11381179 {
1139
- oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1180
+ oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11401181 snapobjectButton.addActionListener(this);
11411182 snapobjectButton.setToolTipText("Snap Object");
11421183
1143
- 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);
11441185 fourButton.addActionListener(this);
11451186 fourButton.setToolTipText("Show control panel only");
11461187 }
....@@ -1148,83 +1189,85 @@
11481189 //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
11491190
11501191
1151
- 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);
11521193 rootButton.setToolTipText("Open selection in new tab");
11531194 rootButton.addActionListener(this);
11541195
1155
- 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);
11561197 closeButton.setToolTipText("Close tab");
11571198 closeButton.addActionListener(this);
11581199 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
11591200 //clearButton.addActionListener(this);
11601201
11611202 cGridBag row1 = new cGridBag();
1203
+ row1.preferredHeight = 8;
11621204
11631205 // INSERT
1164
- row1.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1165
- gridButton.setToolTipText("Create grid");
1206
+ row1.add(gridButton = GetButton("icons/grid.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1207
+ gridButton.setToolTipText("Create ground");
11661208 gridButton.addActionListener(this);
11671209
1168
- row1.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1210
+ row1.add(boxButton = GetButton("icons/box.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11691211 boxButton.setToolTipText("Create box");
11701212 boxButton.addActionListener(this);
11711213
1172
- row1.add(sphereButton = GetButton("icons/sphere.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1173
- sphereButton.setToolTipText("Create sphere");
1174
- sphereButton.addActionListener(this);
1175
-
1176
- row1.add(coneButton = GetButton("icons/cone.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1177
- coneButton.setToolTipText("Create cone");
1178
- coneButton.addActionListener(this);
1179
-
1180
- row1.add(torusButton = GetButton("icons/torus.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1181
- torusButton.setToolTipText("Create torus");
1182
- torusButton.addActionListener(this);
1183
-
1184
- row1.add(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1214
+ row1.add(superButton = GetButton("icons/super.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11851215 superButton.setToolTipText("Create superellipsoid");
11861216 superButton.addActionListener(this);
11871217
1188
- 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)
11891231 {
1190
- 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);
11911233 kleinButton.setToolTipText("Create Klein bottle");
11921234 kleinButton.addActionListener(this);
11931235 }
11941236
1195
- row1.add(particlesButton = GetButton("icons/particles.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1237
+ row1.add(particlesButton = GetButton("icons/particles.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11961238 particlesButton.setToolTipText("Create particle system");
11971239 particlesButton.addActionListener(this);
11981240
11991241 oe.toolboxPanel.add(row1);
12001242
12011243 cGridBag row2 = new cGridBag();
1244
+ row2.preferredHeight = 8;
12021245
1203
- row2.add(groupButton = GetButton("icons/group.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1246
+ row2.add(groupButton = GetButton("icons/group.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12041247 groupButton.setToolTipText("Create group");
12051248 groupButton.addActionListener(this);
12061249
1207
- row2.add(compositeButton = GetButton("icons/composite.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1250
+ row2.add(compositeButton = GetButton("icons/composite.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12081251 compositeButton.setToolTipText("Create composite");
12091252 compositeButton.addActionListener(this);
12101253
1211
- row2.add(switchButton = GetButton("icons/switch.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1254
+ row2.add(switchButton = GetButton("icons/switch.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12121255 switchButton.setToolTipText("Create item switcher");
12131256 switchButton.addActionListener(this);
12141257
1215
- row2.add(loopButton = GetButton("icons/loop.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1258
+ row2.add(loopButton = GetButton("icons/loop.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12161259 loopButton.setToolTipText("Create loop");
12171260 loopButton.addActionListener(this);
12181261
1219
- row2.add(textureButton = GetButton("icons/texture.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1262
+ row2.add(textureButton = GetButton("icons/texture.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12201263 textureButton.setToolTipText("Create texture");
12211264 textureButton.addActionListener(this);
12221265
1223
- row2.add(overlayButton = GetButton("icons/overlay.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1266
+ row2.add(overlayButton = GetButton("icons/overlay.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12241267 overlayButton.setToolTipText("Create overlay");
12251268 overlayButton.addActionListener(this);
12261269
1227
- 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);
12281271 lightButton.setToolTipText("Create light");
12291272 lightButton.addActionListener(this);
12301273
....@@ -1234,6 +1277,11 @@
12341277
12351278 CreateTexturePanel(textures);
12361279
1280
+ int tabCount = resourcecontainer.getTabCount();
1281
+
1282
+ if (tabCount > 0)
1283
+ resourcecontainer.setSelectedIndex((int)(Math.random() * tabCount));
1284
+
12371285 oe.toolboxPanel.add(textures);
12381286
12391287 textures.preferredHeight = 100;
....@@ -1241,11 +1289,11 @@
12411289 CreateSkyboxPanel(oe.skyboxPanel);
12421290
12431291 // EDIT panel
1244
- editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1292
+ editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12451293 editButton.setToolTipText("Pin selection controls");
12461294 editButton.addActionListener(this);
12471295
1248
- editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1296
+ editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12491297 uneditButton.setToolTipText("Unpin and remove selection controls");
12501298 uneditButton.addActionListener(this);
12511299
....@@ -1253,7 +1301,7 @@
12531301 allParamsButton.setToolTipText("Show all controls");
12541302 allParamsButton.addActionListener(this);
12551303
1256
- editCommandsPanel.add(clearPanelButton = GetButton("icons/clear.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1304
+ editCommandsPanel.add(clearPanelButton = GetButton("icons/clear.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12571305 clearPanelButton.setToolTipText("Clear all controls");
12581306 clearPanelButton.addActionListener(this);
12591307
....@@ -1261,7 +1309,7 @@
12611309 //unselectButton.setToolTipText("Unselect");
12621310 //unselectButton.addActionListener(this);
12631311
1264
- 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);
12651313 flashSelectionButton.setToolTipText("Highlight selection");
12661314 flashSelectionButton.addActionListener(this);
12671315
....@@ -1284,6 +1332,8 @@
12841332
12851333 cGridBag jSPPanel = new cGridBag();
12861334
1335
+ jSPPanel.preferredHeight = 20;
1336
+
12871337 JScrollPane jSP;
12881338 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
12891339 jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
....@@ -1292,11 +1342,12 @@
12921342 oe.treePanel.add(jSPPanel);
12931343 oe.treePanel.Return();
12941344
1295
- oe.treePanel.add(copyOptionsPanel);
1345
+ oe.treePanel.add(versionManagerPanel);
12961346 oe.treePanel.Return();
1297
- cGridBag sliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
1298
- versionSlider = (cNumberSlider)sliderPane.getComponent(1);
1299
- sliderPane.preferredHeight = 1;
1347
+
1348
+ versionSliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
1349
+ versionSlider = (cNumberSlider)versionSliderPane.getComponent(1);
1350
+ versionSliderPane.preferredHeight = 3;
13001351
13011352 // mainPanel.setDividerLocation(0.1); //1.0);
13021353 mainPanel.setResizeWeight(0.4);
....@@ -1353,7 +1404,7 @@
13531404 // supportCB.setToolTipText("Enable rigging");
13541405 // supportCB.addItemListener(this);
13551406
1356
- panel.add(freezeCB = new cCheckBox("Freeze", Globals.FREEZEONMOVE)); //, constraints);
1407
+ panel.add(freezeCB = new cCheckBox("Fast cam", Globals.FREEZEONMOVE)); //, constraints);
13571408 freezeCB.setToolTipText("Fast moving camera");
13581409 freezeCB.addItemListener(this);
13591410
....@@ -1362,9 +1413,12 @@
13621413
13631414 panel.Return();
13641415
1416
+ if (Globals.ADVANCED)
1417
+ {
13651418 panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD)); //, constraints);
13661419 crowdCB.setToolTipText("Used for crowds");
13671420 crowdCB.addItemListener(this);
1421
+ }
13681422
13691423 panel.add(smoothCB = new cCheckBox("Inertia", CameraPane.INERTIA)); //, constraints);
13701424 smoothCB.setToolTipText("Snapping delay");
....@@ -1377,30 +1431,26 @@
13771431 minshaderCB.setToolTipText("Minimal fast shader");
13781432 minshaderCB.addItemListener(this);
13791433
1380
-// constraints.gridy += 1;
13811434 // panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
13821435 // speakerMocapCB.addItemListener(this);
13831436
1384
- panel.Return();
1385
-
13861437 if (false)
13871438 {
13881439 // handled in scripts
1389
- //constraints.gridy += 1;
13901440 panel.add(speakerCameraCB = new cCheckBox("Cam", CameraPane.SPEAKERCAMERA)); //, constraints);
13911441 speakerCameraCB.addItemListener(this);
13921442
1393
- //constraints.gridy += 1;
13941443 panel.add(speakerFocusCB = new cCheckBox("Focus", CameraPane.SPEAKERFOCUS)); //, constraints);
13951444 speakerFocusCB.addItemListener(this);
13961445
1397
- //constraints.gridy += 1;
1398
- panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints);
1399
- smoothfocusCB.addItemListener(this);
14001446 panel.Return();
14011447 }
14021448
1403
-//constraints.gridx += 1;
1449
+ panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints);
1450
+ smoothfocusCB.addItemListener(this);
1451
+
1452
+ panel.Return();
1453
+
14041454 //panel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), constraints);
14051455 // debugCB.addItemListener(this);
14061456
....@@ -1454,6 +1504,14 @@
14541504
14551505 void EditObject(Object3D obj)
14561506 {
1507
+ //assert(obj instanceof Composite);
1508
+
1509
+// if (obj.versionlist == null)
1510
+// {
1511
+// obj.versionlist = new Object3D[100];
1512
+// obj.versionindex = -1;
1513
+// }
1514
+
14571515 cRadio radioButton = new cRadio(obj.name);
14581516
14591517 // June 2019. Patch to avoid bug with transparency.
....@@ -1478,6 +1536,7 @@
14781536
14791537 oe.SetupViews();
14801538
1539
+ if (Globals.DEBUG)
14811540 System.out.println("SetupViews");
14821541 DragSource.getDefaultDragSource().createDefaultDragGestureRecognizer(
14831542 oe.cameraView, DnDConstants.ACTION_COPY_OR_MOVE, this); // ACTION_LINK ??
....@@ -2030,7 +2089,7 @@
20302089 Object3D obj = (Object3D)group.selection.elementAt(0);
20312090 objEditor.ScreenFit(obj, false);
20322091
2033
- cameraView.pingthread.StepToTarget(true);
2092
+ cameraView.pingthread.StepToTarget(); //true);
20342093 refreshContents();
20352094 }
20362095
....@@ -2067,7 +2126,7 @@
20672126 obj.parent.TransformToWorld(maxima); //, maxima);
20682127 }
20692128
2070
- Object3D shadow = new Object3D("Shadow " + obj.name);
2129
+ Object3D shadow = new Object3D("Shadow" + obj.name);
20712130
20722131 shadow.toParent = LA.newMatrix();
20732132 shadow.fromParent = LA.newMatrix();
....@@ -2081,24 +2140,24 @@
20812140 switch(axis)
20822141 {
20832142 case 0 :
2084
- vert1.x = minima.x; vert1.y = minima.y; vert1.z = minima.z;
2085
- vert2.x = minima.x; vert2.y = maxima.y; vert2.z = minima.z;
2086
- vert3.x = minima.x; vert3.y = minima.y; vert3.z = maxima.z;
2087
- 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;
20882147 norm = cVector.X;
20892148 break;
20902149 case 1 :
2091
- vert1.x = minima.x; vert1.y = minima.y; vert1.z = minima.z;
2092
- vert2.x = maxima.x; vert2.y = minima.y; vert2.z = minima.z;
2093
- vert3.x = minima.x; vert3.y = minima.y; vert3.z = maxima.z;
2094
- 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;
20952154 norm = cVector.Y;
20962155 break;
20972156 case 2 :
2098
- vert1.x = minima.x; vert1.y = minima.y; vert1.z = minima.z;
2099
- vert2.x = maxima.x; vert2.y = minima.y; vert2.z = minima.z;
2100
- vert3.x = minima.x; vert3.y = maxima.y; vert3.z = minima.z;
2101
- 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;
21022161 norm = cVector.Z;
21032162 break;
21042163 }
....@@ -2139,7 +2198,11 @@
21392198 shadow.material = new cMaterial(obj.material);
21402199 shadow.material.diffuse = 0.0001f;
21412200 shadow.material.specular = 0.0001f;
2142
- //shadow.projectedVertices[1].x = 300;
2201
+ shadow.material.opacity = 0.75f;
2202
+
2203
+ AllocProjectedVertices(shadow);
2204
+
2205
+ shadow.projectedVertices[1].x = 300;
21432206
21442207 makeSomething(shadow);
21452208 }
....@@ -2660,27 +2723,35 @@
26602723 } else
26612724 if (source == loopItem || source == loopButton)
26622725 {
2726
+ if (!group.selection.isEmpty())
2727
+ {
26632728 Composite csg = new GroupLeaf();
2664
- csg.count = 5;
26652729 group(csg);
2730
+ csg.count = 5;
26662731 Composite child = new cGroup("Branch");
26672732 csg.addChild(child);
26682733 child.addChild(csg);
2734
+ }
26692735 } else
26702736 if (source == doubleItem)
26712737 {
2738
+ if (!group.selection.isEmpty())
2739
+ {
26722740 Composite csg = new GroupLeaf("Fork");
2673
- csg.count = 5;
26742741 group(csg);
2742
+ csg.count = 5;
26752743 Composite child = new cGroup("Branch A");
26762744 csg.addChild(child);
26772745 child.addChild(csg);
26782746 child = new cGroup("Branch B");
26792747 csg.addChild(child);
26802748 child.addChild(csg);
2749
+ }
26812750 } else
26822751 if (source == tripleItem)
26832752 {
2753
+ if (!group.selection.isEmpty())
2754
+ {
26842755 Composite csg = new GroupLeaf("Trident");
26852756 csg.count = 4;
26862757 group(csg);
....@@ -2693,6 +2764,7 @@
26932764 child = new cGroup();
26942765 csg.addChild(child);
26952766 child.addChild(csg);
2767
+ }
26962768 } else
26972769 if (source == computeAOItem)
26982770 {
....@@ -2739,7 +2811,7 @@
27392811 {
27402812 Maximize();
27412813 } else
2742
- if (source == fullButton)
2814
+ if (source == fullScreenButton)
27432815 {
27442816 ToggleFullScreen();
27452817 } else
....@@ -2748,13 +2820,13 @@
27482820 this.expandedLayout = radio.layout;
27492821 CollapseToolbar();
27502822 } else
2751
- if (source == maximize3DButton)
2752
- {
2753
- this.expandedLayout = radio.layout;
2754
- radio.layout = twoButton;
2755
- Show3DView();
2756
- CollapseToolbar();
2757
- } else
2823
+// if (source == maximize3DButton)
2824
+// {
2825
+// this.expandedLayout = radio.layout;
2826
+// radio.layout = twoButton;
2827
+// CollapseToolbar();
2828
+// Show3DView();
2829
+// } else
27582830 if (source == previousVersionButton)
27592831 {
27602832 // Go to previous version
....@@ -2782,7 +2854,7 @@
27822854 if (source == saveVersionButton)
27832855 {
27842856 // Save a new version
2785
- if (!Save(true))
2857
+ if (!DuplicateVersion()) //true))
27862858 java.awt.Toolkit.getDefaultToolkit().beep();
27872859 } else
27882860 if (source == deleteVersionButton)
....@@ -3328,22 +3400,34 @@
33283400 } else
33293401 if (source == ungroupItem || source == ungroupButton)
33303402 {
3331
- boolean hasRoot = false;
3403
+ boolean canUngroup = true;
33323404
33333405 for (int i=0; i<group.selection.size(); i++)
33343406 {
3335
- if (group.selection.get(i) == group)
3407
+ Object3D selectedItem = group.selection.get(i);
3408
+
3409
+ if (selectedItem.Size() == 0)
33363410 {
3337
- 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;
33383420 break;
33393421 }
33403422 }
33413423
3342
- if (!hasRoot)
3424
+ if (canUngroup)
33433425 {
33443426 for (int i=0; i<group.selection.size(); i++)
33453427 {
3346
- Ungroup(group.selection.get(i));
3428
+ Object3D selectedItem = group.selection.get(i);
3429
+
3430
+ Ungroup(selectedItem);
33473431 }
33483432
33493433 ClearSelection(false);
....@@ -3394,6 +3478,10 @@
33943478 if (source == clearMaterialsItem)
33953479 {
33963480 ClearMaterials();
3481
+ } else
3482
+ if (source == clearVersionsItem)
3483
+ {
3484
+ ClearVersions();
33973485 } else
33983486 if (source == liveleavesItem)
33993487 {
....@@ -3534,6 +3622,18 @@
35343622 if (source == transformChildrenItem)
35353623 {
35363624 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);
35373637 } else
35383638 if (source == resetTransformItem)
35393639 {
....@@ -3892,6 +3992,7 @@
38923992 } else
38933993 if (source == rootButton)
38943994 {
3995
+ Replace();
38953996 Object3D obj;
38963997 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
38973998 {
....@@ -3906,6 +4007,9 @@
39064007 if (source == closeButton)
39074008 {
39084009 //System.out.println("CLOSE: " + buttonGroup.getSelection());
4010
+ if (copy.versionlist != null)
4011
+ Replace();
4012
+
39094013 cRadio ab;
39104014 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
39114015 {
....@@ -4004,6 +4108,9 @@
40044108 } else
40054109 if(source instanceof cRadio)
40064110 {
4111
+ if (copy.versionlist != null)
4112
+ Replace();
4113
+
40074114 group.parent = keepparent;
40084115 group.attributes = 0;
40094116 //group.editWindow = null;
....@@ -4028,8 +4135,6 @@
40284135
40294136 copy = group;
40304137
4031
- SetUndoStates();
4032
-
40334138 //Globals.theRenderer.object = group;
40344139 if(!useclient)
40354140 {
....@@ -4057,6 +4162,32 @@
40574162 */
40584163 radio.layout.doClick();
40594164
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();
4190
+
40604191 ClearUnpinned();
40614192
40624193 //Grafreed.Assert(group != null);
....@@ -4170,9 +4301,46 @@
41704301 refreshContents();
41714302 }
41724303
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
+
41734316 void ResetTransform()
41744317 {
41754318 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();
41764344 }
41774345
41784346 void ResetTransform(int mask)
....@@ -4185,42 +4353,8 @@
41854353 if (obj.toParent == null)
41864354 continue;
41874355
4188
- if (mask == -1)
4189
- {
4190
- if (obj instanceof Camera) // jan 2014
4191
- {
4192
- LA.matIdentity(obj.toParent);
4193
- LA.matIdentity(obj.fromParent);
4194
- }
4195
- else
4196
- {
4197
- obj.toParent = null; // jan 2014 LA.matIdentity(obj.toParent);
4198
- obj.fromParent = null; // LA.matIdentity(obj.fromParent);
4199
- }
4200
- TouchTransform(obj);
4201
- continue;
4202
- }
4203
- if ((mask&2) != 0) // Scale
4204
- {
4205
- obj.toParent[0][0] = obj.toParent[1][1] = obj.toParent[2][2] = 1;
4206
- obj.toParent[0][1] = obj.toParent[1][0] = obj.toParent[2][0] = 0;
4207
- obj.toParent[0][2] = obj.toParent[1][2] = obj.toParent[2][1] = 0;
4208
- obj.fromParent[0][0] = obj.fromParent[1][1] = obj.fromParent[2][2] = 1;
4209
- obj.fromParent[0][1] = obj.fromParent[1][0] = obj.fromParent[2][0] = 0;
4210
- obj.fromParent[0][2] = obj.fromParent[1][2] = obj.fromParent[2][1] = 0;
4211
- }
4212
- if ((mask&4) != 0) // Rotation
4213
- {
4214
- // ?
4215
- }
4216
- if ((mask&1) != 0) // Translation
4217
- {
4218
- if (obj.toParent != null)
4219
- {
4220
- obj.toParent[3][0] = obj.toParent[3][1] = obj.toParent[3][2] = 0;
4221
- obj.fromParent[3][0] = obj.fromParent[3][1] = obj.fromParent[3][2] = 0;
4222
- }
4223
- }
4356
+ obj.ResetTransform(mask);
4357
+
42244358 if (obj.parent == null)
42254359 {
42264360 System.out.println("NULL PARENT!");
....@@ -4729,10 +4863,17 @@
47294863 {
47304864 Object3D obj = group.selection.get(i);
47314865
4866
+ if (obj.toParent == null)
4867
+ {
4868
+ obj.toParent = LA.newMatrix();
4869
+ obj.fromParent = LA.newMatrix();
4870
+ }
4871
+
47324872 LA.matTranslate(obj.toParent, i * scale, 0, 0);
47334873 LA.matTranslateInv(obj.fromParent, -i * scale, 0, 0);
47344874 }
47354875
4876
+ Globals.lighttouched = true;
47364877 refreshContents();
47374878 }
47384879
....@@ -5020,6 +5161,12 @@
50205161 refreshContents();
50215162 }
50225163
5164
+ void ClearVersions()
5165
+ {
5166
+ group.selection.ClearVersions();
5167
+ refreshContents();
5168
+ }
5169
+
50235170 void FlipV(boolean flip)
50245171 {
50255172 group.selection.FlipV(flip);
....@@ -5258,10 +5405,10 @@
52585405 if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
52595406 // a camera
52605407 {
5261
- 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
52625409 {
52635410 CameraPane.camerachangeframe = 0; // don't refuse it
5264
- Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
5411
+ Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent(), true);
52655412 }
52665413 // Globals.theRenderer.renderCamera = Globals.theRenderer.manipCamera;
52675414 // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
....@@ -5291,10 +5438,26 @@
52915438 flashSelectionButton.setEnabled(enabled);
52925439
52935440 clearPanelButton.setEnabled(!listUI.isEmpty());
5441
+
5442
+ boolean allComposites = true;
5443
+
5444
+ if (group.selection != null)
5445
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
5446
+ {
5447
+ Object next = e.nextElement();
5448
+ if (!(next instanceof Composite)) // || (next instanceof GroupLeaf))
5449
+ {
5450
+ allComposites = false;
5451
+ break;
5452
+ }
5453
+ }
5454
+
5455
+ rootButton.setEnabled(true); // allComposites);
52945456 }
52955457
52965458 void refreshContents(boolean cp)
52975459 {
5460
+ if (Globals.SHOWINFO)
52985461 //if (objectPanel.getSelectedIndex() == 2) // objectPanel.indexOfTab("Info"))
52995462 if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
53005463 {
....@@ -6188,11 +6351,11 @@
61886351 private MenuItem lookAtItem;
61896352 private MenuItem lookFromItem;
61906353 private MenuItem switchViewItem;
6191
- private MenuItem cutItem;
6354
+ private JMenuItem cutItem;
61926355 private MenuItem undoItem;
61936356 private MenuItem redoItem;
61946357 private JMenuItem duplicateItem;
6195
- private MenuItem cloneItem;
6358
+ private JMenuItem cloneItem;
61966359 private MenuItem cloneSupportItem;
61976360 private MenuItem overwriteGeoItem;
61986361 private MenuItem overwriteMatItem;
....@@ -6213,13 +6376,13 @@
62136376 private MenuItem cloneGeometriesItem;
62146377 private MenuItem shareGeometriesItem;
62156378 private MenuItem mergeGeometriesItem;
6216
- private MenuItem copyItem;
6379
+ private JMenuItem copyItem;
62176380 private MenuItem pasteItem;
6218
- private MenuItem pasteIntoItem;
6219
- private MenuItem pasteLinkItem;
6220
- private MenuItem pasteCloneItem;
6221
- private MenuItem pasteExpandItem;
6222
- private MenuItem deleteItem;
6381
+ private JMenuItem pasteIntoItem;
6382
+ private JMenuItem pasteLinkItem;
6383
+ private JMenuItem pasteCloneItem;
6384
+ private JMenuItem pasteExpandItem;
6385
+ private JMenuItem deleteItem;
62236386 private MenuItem clearAllItem;
62246387 private MenuItem genUVItem;
62256388 private MenuItem genNormalsMESHItem;
....@@ -6245,6 +6408,7 @@
62456408 private MenuItem clipMeshItem;
62466409 private MenuItem smoothMeshItem;
62476410 private MenuItem clearMaterialsItem;
6411
+ private MenuItem clearVersionsItem;
62486412
62496413 private MenuItem liveleavesItem;
62506414 private MenuItem unliveleavesItem;
....@@ -6268,13 +6432,16 @@
62686432 private MenuItem maxTexturesItem;
62696433 private MenuItem panoTexturesItem;
62706434
6435
+ private MenuItem textureRatioRItem;
6436
+ private MenuItem textureRatioGItem;
6437
+ private MenuItem textureRatioBItem;
62716438 private MenuItem resetCentroidItem;
62726439 private MenuItem resetCentroidXZItem;
62736440 private MenuItem resetTransformItem;
62746441 private MenuItem transformGeometryItem;
62756442 private MenuItem transformChildrenItem;
62766443 private MenuItem hideItem;
6277
- private MenuItem grabItem;
6444
+ private JMenuItem grabItem;
62786445 private MenuItem backItem;
62796446 private MenuItem frontItem;
62806447 private MenuItem cameraItem;
....@@ -6287,7 +6454,7 @@
62876454 private MenuItem switchTransfoItem;
62886455 private MenuItem morphItem;
62896456 private MenuItem linkerItem;
6290
- private MenuItem ungroupItem;
6457
+ private JMenuItem ungroupItem;
62916458 private MenuItem editItem;
62926459 private MenuItem openWindowItem;
62936460 private MenuItem editLeafItem;