Normand Briere
2019-09-02 21ac57b36a9e3b909853c7d64ac29b7ad72490a3
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)
....@@ -529,33 +532,35 @@
529532 // menu.add("-");
530533 duplicateItem = oe.jTree.popup.add(new JMenuItem("Duplicate"));
531534 duplicateItem.addActionListener(this);
532
- cloneItem = menu.add(new MenuItem("Clone"));
535
+
536
+ cloneItem = oe.jTree.popup.add(new JMenuItem("Clone"));
533537 cloneItem.addActionListener(this);
534
- if (Globals.ADVANCED)
538
+ //if (Globals.ADVANCED)
535539 {
536540 cloneSupportItem = menu.add(new MenuItem("Clone (+supports)"));
537541 cloneSupportItem.addActionListener(this);
538542 }
543
+ oe.jTree.popup.addSeparator();
539544 menu.add("-");
540
- cutItem = menu.add(new MenuItem("Cut"));
545
+ cutItem = oe.jTree.popup.add(new JMenuItem("Cut"));
541546 cutItem.addActionListener(this);
542
- copyItem = menu.add(new MenuItem("Copy"));
547
+ copyItem = oe.jTree.popup.add(new JMenuItem("Copy"));
543548 copyItem.addActionListener(this);
544549 pasteItem = menu.add(new MenuItem("Paste"));
545550 pasteItem.addActionListener(this);
546551
547
- menu.add("-");
548
- pasteIntoItem = menu.add(new MenuItem("Paste into"));
552
+ oe.jTree.popup.addSeparator();
553
+ //menu.add("-");
554
+ pasteIntoItem = oe.jTree.popup.add(new JMenuItem("Paste into"));
549555 pasteIntoItem.addActionListener(this);
550
- pasteLinkItem = menu.add(new MenuItem("Paste link"));
556
+ pasteLinkItem = oe.jTree.popup.add(new JMenuItem("Paste link"));
551557 pasteLinkItem.addActionListener(this);
552
- pasteCloneItem = menu.add(new MenuItem("Paste clone"));
558
+ pasteCloneItem = oe.jTree.popup.add(new JMenuItem("Paste clone"));
553559 pasteCloneItem.addActionListener(this);
554
-// pasteExpandItem = menu.add(new MenuItem("Paste expand"));
560
+// CRASH pasteExpandItem = oe.jTree.popup.add(new JMenuItem("Paste expand"));
555561 // pasteExpandItem.addActionListener(this);
556
- menu.add("-");
557
- deleteItem = menu.add(new MenuItem("Delete"));
558
- deleteItem.addActionListener(this);
562
+ //menu.add("-");
563
+ oe.jTree.popup.addSeparator();
559564
560565 if (Globals.ADVANCED)
561566 {
....@@ -641,11 +646,9 @@
641646 oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest"));
642647 //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection"));
643648 //cameraMenu.add(switchViewItem = new MenuItem("Reverse View"));
644
- editLeafItem = oe.cameraMenu.add(new MenuItem("Edit Leaf"));
645649 oe.cameraMenu.add("-");
646650 openWindowItem = oe.cameraMenu.add(new MenuItem("Edit copy..."));
647651 openWindowItem.addActionListener(this);
648
- editLeafItem.addActionListener(this);
649652 lookAtItem.addActionListener(this);
650653 //lookFromItem.addActinoListener(this);
651654 //switchViewItem.addActionListener(this);
....@@ -692,9 +695,8 @@
692695 setMasterItem.addActionListener(this);
693696 }
694697
695
- oe.menuBar.add(menu = new Menu("Group"));
696
-// grabItem = menu.add(new MenuItem("Grab"));
697
-// grabItem.addActionListener(this);
698
+ oe.menuBar.add(menu = new Menu("Order"));
699
+
698700 backItem = menu.add(new MenuItem("Back"));
699701 backItem.addActionListener(this);
700702 frontItem = menu.add(new MenuItem("Front"));
....@@ -702,13 +704,21 @@
702704 // compositeItem = menu.add(new MenuItem("Composite"));
703705 // compositeItem.addActionListener(this);
704706
707
+ grabItem = oe.jTree.popup.add(new JMenuItem("Group"));
708
+ grabItem.addActionListener(this);
709
+
705710 if (Globals.ADVANCED)
706711 {
707712 hideItem = menu.add(new MenuItem("Hidden Group"));
708713 hideItem.addActionListener(this);
709714 }
710
- ungroupItem = menu.add(new MenuItem("Ungroup"));
715
+ ungroupItem = oe.jTree.popup.add(new JMenuItem("Ungroup"));
711716 ungroupItem.addActionListener(this);
717
+
718
+ oe.jTree.popup.addSeparator();
719
+
720
+ deleteItem = oe.jTree.popup.add(new JMenuItem("Delete"));
721
+ deleteItem.addActionListener(this);
712722
713723 // menu.add("-");
714724 //
....@@ -745,9 +755,9 @@
745755 shadowYItem.addActionListener(this);
746756 shadowZItem = menu.add(new MenuItem("Shadow Blue"));
747757 shadowZItem.addActionListener(this);
758
+
748759 attributeItem = menu.add(new MenuItem("Attribute"));
749760 attributeItem.addActionListener(this);
750
-
751761 if (Globals.ADVANCED)
752762 {
753763 menu.add("-");
....@@ -759,11 +769,18 @@
759769 pointflowItem.addActionListener(this);
760770 }
761771 menu.add("-");
772
+ textureRatioRItem = menu.add(new MenuItem("Texture Ratio Red"));
773
+ textureRatioRItem.addActionListener(this);
774
+ textureRatioGItem = menu.add(new MenuItem("Texture Ratio Green"));
775
+ textureRatioGItem.addActionListener(this);
776
+ textureRatioBItem = menu.add(new MenuItem("Texture Ratio Blue"));
777
+ textureRatioBItem.addActionListener(this);
778
+ menu.add("-");
762779 resetTransformItem = menu.add(new MenuItem("Reset Transform"));
763780 resetTransformItem.addActionListener(this);
764781 resetCentroidItem = menu.add(new MenuItem("Reset Centroid"));
765782 resetCentroidItem.addActionListener(this);
766
- resetCentroidXZItem = menu.add(new MenuItem("Reset Centroid XY"));
783
+ resetCentroidXZItem = menu.add(new MenuItem("Reset Centroid XZ"));
767784 resetCentroidXZItem.addActionListener(this);
768785 transformGeometryItem = menu.add(new MenuItem("Transform Geometry"));
769786 transformGeometryItem.addActionListener(this);
....@@ -815,6 +832,8 @@
815832 }
816833
817834 oe.menuBar.add(menu = new Menu("Attributes"));
835
+ clearVersionsItem = menu.add(new MenuItem("Clear Versions"));
836
+ clearVersionsItem.addActionListener(this);
818837 clearMaterialsItem = menu.add(new MenuItem("Clear Materials"));
819838 clearMaterialsItem.addActionListener(this);
820839 resetAllItem = menu.add(new MenuItem("Reset All"));
....@@ -837,9 +856,9 @@
837856 hideleavesItem.addActionListener(this);
838857 showleavesItem = menu.add(new MenuItem("Show Leaves"));
839858 showleavesItem.addActionListener(this);
840
- markleavesItem = menu.add(new MenuItem("Mark Leaves"));
859
+ markleavesItem = menu.add(new MenuItem("Anim Leaves"));
841860 markleavesItem.addActionListener(this);
842
- unmarkleavesItem = menu.add(new MenuItem("Unmark Leaves"));
861
+ unmarkleavesItem = menu.add(new MenuItem("Unanim Leaves"));
843862 unmarkleavesItem.addActionListener(this);
844863 rewindleavesItem = menu.add(new MenuItem("Rewind Leaves"));
845864 rewindleavesItem.addActionListener(this);
....@@ -893,6 +912,9 @@
893912 shareGeometriesItem.addActionListener(this);
894913 mergeGeometriesItem = menu.add(new MenuItem("Merge Geometries"));
895914 mergeGeometriesItem.addActionListener(this);
915
+ menu.add("-");
916
+ editLeafItem = menu.add(new MenuItem("Edit leaf..."));
917
+ editLeafItem.addActionListener(this);
896918 if (Globals.ADVANCED)
897919 {
898920 // Pretty much the same as duplicate and clone.
....@@ -911,8 +933,10 @@
911933
912934 JTabbedPane resourcecontainer;
913935 cGridBag currenttab;
914
- boolean added; // patch for jar
936
+ //boolean added; // patch for jar
915937
938
+ int totalcount = 0;
939
+
916940 int tabcount = 0;
917941 int colcount = 0;
918942 int rowcount = 0;
....@@ -928,28 +952,30 @@
928952 // System.out.println();
929953
930954 if (//rowcount == 0 ||
931
- path.length == 1)
955
+ path.length == 1 && !path[0].equals("") && !path[0].equals(".DS_Store"))
932956 {
933957 currenttab = new cGridBag();
934
- added = false;
935958 String tabname = path[0]; // String.valueOf((char)('A'+tabcount));
936959 currenttab.setName(tabname);
960
+ //added = false;
961
+ resourcecontainer.add(currenttab);
962
+ resourcecontainer.setToolTipTextAt(tabcount++, "Texture Group " + tabname);
937963 rowcount = 1;
938964 colcount = 0;
939965 texturecount = 0;
940966 }
941967
942
- if (path.length > 2 && path[2].toLowerCase().endsWith(".jpg"))
968
+ if (path.length > 2 && (path[2].toLowerCase().endsWith(".jpg") || path[2].toLowerCase().endsWith(".png")))
943969 {
944
- if (!added)
970
+ //if (!added)
945971 {
946
- added = true;
947
- resourcecontainer.add(currenttab);
972
+ //added = true;
948973 String tabname = path[0]; // String.valueOf((char)('A'+tabcount));
949
- resourcecontainer.setToolTipTextAt(tabcount++, "Texture Group " + tabname);
974
+ currenttab = (cGridBag)resourcecontainer.getComponentAt(resourcecontainer.indexOfTab(tabname));
950975 }
951976
952
- AddTextureButton(path[0], path[1], path[2], texturecount++, currenttab);
977
+ AddTextureButton(path[0], path[1], path[2], ++texturecount, currenttab);
978
+ totalcount++;
953979
954980 if (++colcount >= columns)
955981 {
....@@ -975,6 +1001,8 @@
9751001 container.add(resourcecontainer);
9761002
9771003 Grafreed.ParseResources("textures", this);
1004
+
1005
+ // 935. System.out.println("Total = " + totalcount);
9781006 }
9791007
9801008 void SetupUI2(ObjEditor oe)
....@@ -1014,9 +1042,9 @@
10141042 oe.radioPanel.add(dummyButton);
10151043 oe.buttonGroup.add(dummyButton);
10161044 */
1017
- cGridBag copyOptionsPanel = new cGridBag();
1045
+ cGridBag versionManagerPanel = new cGridBag();
10181046
1019
- copyOptionsPanel.preferredHeight = 2;
1047
+ versionManagerPanel.preferredHeight = 4;
10201048
10211049 //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
10221050
....@@ -1026,42 +1054,46 @@
10261054
10271055 if (Globals.ADVANCED)
10281056 {
1029
- oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1030
- maxButton.setToolTipText("Maximize window");
1031
- maxButton.addActionListener(this);
1057
+// oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1058
+// maxButton.setToolTipText("Maximize window");
1059
+// maxButton.addActionListener(this);
10321060 }
10331061
10341062 cButton gcButton;
10351063
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
- });
1064
+// oe.toolbarPanel.add(gcButton = GetButton("icons/trash.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1065
+// gcButton.setToolTipText("Garbage collect");
1066
+// gcButton.addActionListener(new ActionListener()
1067
+// {
1068
+// public void actionPerformed(ActionEvent e)
1069
+// {
1070
+// System.gc();
1071
+// }
1072
+// });
10451073
1046
- oe.toolbarPanel.add(collapseButton = GetButton("icons/collapse.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1074
+ oe.toolbarPanel.add(fullScreenButton = GetButton("icons/fullscreen.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1075
+ fullScreenButton.setToolTipText("Full-screen window");
1076
+ fullScreenButton.addActionListener(this);
1077
+
1078
+ oe.toolbarPanel.add(collapseButton = GetButton("icons/collapse.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10471079 collapseButton.setToolTipText("Collapse toolbar");
10481080 collapseButton.addActionListener(this);
10491081
1050
- oe.toolbarPanel.add(maximize3DButton = GetButton("", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1051
- maximize3DButton.setToolTipText("Maximize 3D view");
1052
- maximize3DButton.addActionListener(this);
1082
+// oe.toolbarPanel.add(maximize3DButton = GetButton("icons/square.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1083
+// maximize3DButton.setToolTipText("Maximize 3D view");
1084
+// maximize3DButton.addActionListener(this);
10531085
1054
- oe.toolbarPanel.add(twoButton = GetButton("icons/cube.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1086
+ oe.toolbarPanel.add(twoButton = GetButton("icons/cube.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10551087 twoButton.setToolTipText("Show 3D view only");
10561088 twoButton.addActionListener(this);
10571089 this.fullscreenLayout = twoButton;
10581090
1059
- oe.toolbarPanel.add(threeButton = GetButton("icons/controlsview.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1091
+ oe.toolbarPanel.add(threeButton = GetButton("icons/controlsview.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10601092 threeButton.setToolTipText("Show controls and 3D view");
10611093 threeButton.addActionListener(this);
10621094 if (Globals.ADVANCED)
10631095 {
1064
- oe.toolbarPanel.add(sixButton = GetButton("icons/viewcontrols.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1096
+ oe.toolbarPanel.add(sixButton = GetButton("icons/viewcontrols.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10651097 sixButton.setToolTipText("Show 3D view and controls");
10661098 sixButton.addActionListener(this);
10671099 }
....@@ -1070,50 +1102,47 @@
10701102 // sevenButton.addActionListener(this);
10711103 //
10721104
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);
1105
+ oe.toolbarPanel.add(screenfitButton = GetButton("icons/fit.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10781106 screenfitButton.setToolTipText("Screen fit");
10791107 screenfitButton.addActionListener(this);
10801108
1081
- oe.toolbarPanel.add(restoreCameraButton = GetButton("icons/eye.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1109
+ oe.toolbarPanel.add(restoreCameraButton = GetButton("icons/eye.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10821110 restoreCameraButton.setToolTipText("Restore viewpoint");
10831111 restoreCameraButton.addActionListener(this);
10841112
1085
- copyOptionsPanel.add(saveVersionButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1113
+ versionManagerPanel.add(saveVersionButton = GetButton("icons/down_arrow.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10861114 saveVersionButton.setToolTipText("Duplicate current version");
10871115 saveVersionButton.addActionListener(this);
10881116
1089
- copyOptionsPanel.add(deleteVersionButton = GetButton("icons/trash.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1117
+ versionManagerPanel.add(deleteVersionButton = GetButton("icons/trash.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10901118 deleteVersionButton.setToolTipText("Delete current version");
10911119 deleteVersionButton.addActionListener(this);
1120
+ deleteVersionButton.setEnabled(false);
10921121
1093
- copyOptionsPanel.add(previousVersionButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1122
+ versionManagerPanel.add(previousVersionButton = GetButton("icons/undo.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10941123 previousVersionButton.setToolTipText("Previous version");
10951124 previousVersionButton.addActionListener(this);
10961125 previousVersionButton.setEnabled(false);
10971126
10981127 cGridBag updown = new cGridBag().setVertical(true);
1099
- updown.add(restoreButton = GetButton("icons/restore.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1128
+ updown.add(restoreButton = GetButton("icons/restore.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11001129 restoreButton.setToolTipText("Undo (restore current version)");
11011130 restoreButton.addActionListener(this);
1102
- //restoreButton.setEnabled(false);
1131
+ restoreButton.setEnabled(false);
11031132
1104
- updown.add(replaceButton = GetButton("icons/replace.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1133
+ updown.add(replaceButton = GetButton("icons/replace.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11051134 replaceButton.setToolTipText("Save (replace current version)");
11061135 replaceButton.addActionListener(this);
1107
- //replaceButton.setEnabled(false);
1136
+ replaceButton.setEnabled(false);
11081137
1109
- copyOptionsPanel.add(updown);
1138
+ versionManagerPanel.add(updown);
11101139
1111
- copyOptionsPanel.add(nextVersionButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1140
+ versionManagerPanel.add(nextVersionButton = GetButton("icons/redo.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11121141 nextVersionButton.setToolTipText("Next version");
11131142 nextVersionButton.addActionListener(this);
11141143 nextVersionButton.setEnabled(false);
11151144
1116
- oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1145
+ oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11171146 oneStepButton.setToolTipText("Animate one step forward");
11181147 oneStepButton.addActionListener(this);
11191148
....@@ -1136,11 +1165,11 @@
11361165
11371166 if (Globals.ADVANCED)
11381167 {
1139
- oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1168
+ oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11401169 snapobjectButton.addActionListener(this);
11411170 snapobjectButton.setToolTipText("Snap Object");
11421171
1143
- oe.toolbarPanel.add(fourButton = GetButton("icons/controls-horizontal.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1172
+ oe.toolbarPanel.add(fourButton = GetButton("icons/controls-horizontal.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11441173 fourButton.addActionListener(this);
11451174 fourButton.setToolTipText("Show control panel only");
11461175 }
....@@ -1148,11 +1177,11 @@
11481177 //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
11491178
11501179
1151
- oe.toolbarPanel.add(rootButton = GetButton("icons/openwindow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1180
+ oe.toolbarPanel.add(rootButton = GetButton("icons/openwindow.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11521181 rootButton.setToolTipText("Open selection in new tab");
11531182 rootButton.addActionListener(this);
11541183
1155
- oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1184
+ oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11561185 closeButton.setToolTipText("Close tab");
11571186 closeButton.addActionListener(this);
11581187 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
....@@ -1161,38 +1190,38 @@
11611190 cGridBag row1 = new cGridBag();
11621191
11631192 // INSERT
1164
- row1.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1165
- gridButton.setToolTipText("Create grid");
1193
+ row1.add(gridButton = GetButton("icons/grid.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1194
+ gridButton.setToolTipText("Create ground");
11661195 gridButton.addActionListener(this);
11671196
1168
- row1.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1197
+ row1.add(boxButton = GetButton("icons/box.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11691198 boxButton.setToolTipText("Create box");
11701199 boxButton.addActionListener(this);
11711200
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);
1201
+ row1.add(superButton = GetButton("icons/super.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11851202 superButton.setToolTipText("Create superellipsoid");
11861203 superButton.addActionListener(this);
11871204
1188
- if (Globals.ADVANCED)
1205
+ row1.add(sphereButton = GetButton("icons/sphere.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1206
+ sphereButton.setToolTipText("Create sphere");
1207
+ sphereButton.addActionListener(this);
1208
+
1209
+ row1.add(coneButton = GetButton("icons/cone.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1210
+ coneButton.setToolTipText("Create cone");
1211
+ coneButton.addActionListener(this);
1212
+
1213
+ row1.add(torusButton = GetButton("icons/torus.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1214
+ torusButton.setToolTipText("Create torus");
1215
+ torusButton.addActionListener(this);
1216
+
1217
+ if (false) //Globals.ADVANCED)
11891218 {
1190
- oe.toolboxPanel.add(kleinButton = GetButton("icons/klein.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1219
+ oe.toolboxPanel.add(kleinButton = GetButton("icons/klein.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11911220 kleinButton.setToolTipText("Create Klein bottle");
11921221 kleinButton.addActionListener(this);
11931222 }
11941223
1195
- row1.add(particlesButton = GetButton("icons/particles.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1224
+ row1.add(particlesButton = GetButton("icons/particles.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11961225 particlesButton.setToolTipText("Create particle system");
11971226 particlesButton.addActionListener(this);
11981227
....@@ -1200,31 +1229,31 @@
12001229
12011230 cGridBag row2 = new cGridBag();
12021231
1203
- row2.add(groupButton = GetButton("icons/group.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1232
+ row2.add(groupButton = GetButton("icons/group.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12041233 groupButton.setToolTipText("Create group");
12051234 groupButton.addActionListener(this);
12061235
1207
- row2.add(compositeButton = GetButton("icons/composite.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1236
+ row2.add(compositeButton = GetButton("icons/composite.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12081237 compositeButton.setToolTipText("Create composite");
12091238 compositeButton.addActionListener(this);
12101239
1211
- row2.add(switchButton = GetButton("icons/switch.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1240
+ row2.add(switchButton = GetButton("icons/switch.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12121241 switchButton.setToolTipText("Create item switcher");
12131242 switchButton.addActionListener(this);
12141243
1215
- row2.add(loopButton = GetButton("icons/loop.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1244
+ row2.add(loopButton = GetButton("icons/loop.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12161245 loopButton.setToolTipText("Create loop");
12171246 loopButton.addActionListener(this);
12181247
1219
- row2.add(textureButton = GetButton("icons/texture.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1248
+ row2.add(textureButton = GetButton("icons/texture.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12201249 textureButton.setToolTipText("Create texture");
12211250 textureButton.addActionListener(this);
12221251
1223
- row2.add(overlayButton = GetButton("icons/overlay.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1252
+ row2.add(overlayButton = GetButton("icons/overlay.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12241253 overlayButton.setToolTipText("Create overlay");
12251254 overlayButton.addActionListener(this);
12261255
1227
- row2.add(lightButton = GetButton("icons/light-bulb.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1256
+ row2.add(lightButton = GetButton("icons/light-bulb.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12281257 lightButton.setToolTipText("Create light");
12291258 lightButton.addActionListener(this);
12301259
....@@ -1234,6 +1263,11 @@
12341263
12351264 CreateTexturePanel(textures);
12361265
1266
+ int tabCount = resourcecontainer.getTabCount();
1267
+
1268
+ if (tabCount > 0)
1269
+ resourcecontainer.setSelectedIndex((int)(Math.random() * tabCount));
1270
+
12371271 oe.toolboxPanel.add(textures);
12381272
12391273 textures.preferredHeight = 100;
....@@ -1241,11 +1275,11 @@
12411275 CreateSkyboxPanel(oe.skyboxPanel);
12421276
12431277 // EDIT panel
1244
- editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1278
+ editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12451279 editButton.setToolTipText("Pin selection controls");
12461280 editButton.addActionListener(this);
12471281
1248
- editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1282
+ editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12491283 uneditButton.setToolTipText("Unpin and remove selection controls");
12501284 uneditButton.addActionListener(this);
12511285
....@@ -1253,7 +1287,7 @@
12531287 allParamsButton.setToolTipText("Show all controls");
12541288 allParamsButton.addActionListener(this);
12551289
1256
- editCommandsPanel.add(clearPanelButton = GetButton("icons/clear.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1290
+ editCommandsPanel.add(clearPanelButton = GetButton("icons/clear.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12571291 clearPanelButton.setToolTipText("Clear all controls");
12581292 clearPanelButton.addActionListener(this);
12591293
....@@ -1261,7 +1295,7 @@
12611295 //unselectButton.setToolTipText("Unselect");
12621296 //unselectButton.addActionListener(this);
12631297
1264
- editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1298
+ editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12651299 flashSelectionButton.setToolTipText("Highlight selection");
12661300 flashSelectionButton.addActionListener(this);
12671301
....@@ -1284,6 +1318,8 @@
12841318
12851319 cGridBag jSPPanel = new cGridBag();
12861320
1321
+ jSPPanel.preferredHeight = 20;
1322
+
12871323 JScrollPane jSP;
12881324 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
12891325 jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
....@@ -1292,11 +1328,11 @@
12921328 oe.treePanel.add(jSPPanel);
12931329 oe.treePanel.Return();
12941330
1295
- oe.treePanel.add(copyOptionsPanel);
1331
+ oe.treePanel.add(versionManagerPanel);
12961332 oe.treePanel.Return();
1297
- cGridBag sliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
1298
- versionSlider = (cNumberSlider)sliderPane.getComponent(1);
1299
- sliderPane.preferredHeight = 1;
1333
+ versionSliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
1334
+ versionSlider = (cNumberSlider)versionSliderPane.getComponent(1);
1335
+ versionSliderPane.preferredHeight = 3;
13001336
13011337 // mainPanel.setDividerLocation(0.1); //1.0);
13021338 mainPanel.setResizeWeight(0.4);
....@@ -1454,6 +1490,14 @@
14541490
14551491 void EditObject(Object3D obj)
14561492 {
1493
+ //assert(obj instanceof Composite);
1494
+
1495
+// if (obj.versionlist == null)
1496
+// {
1497
+// obj.versionlist = new Object3D[100];
1498
+// obj.versionindex = -1;
1499
+// }
1500
+
14571501 cRadio radioButton = new cRadio(obj.name);
14581502
14591503 // June 2019. Patch to avoid bug with transparency.
....@@ -1478,6 +1522,7 @@
14781522
14791523 oe.SetupViews();
14801524
1525
+ if (Globals.DEBUG)
14811526 System.out.println("SetupViews");
14821527 DragSource.getDefaultDragSource().createDefaultDragGestureRecognizer(
14831528 oe.cameraView, DnDConstants.ACTION_COPY_OR_MOVE, this); // ACTION_LINK ??
....@@ -2081,24 +2126,24 @@
20812126 switch(axis)
20822127 {
20832128 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;
2129
+ vert1.x = minima.x + 0.001f; vert1.y = minima.y; vert1.z = minima.z;
2130
+ vert2.x = minima.x + 0.001f; vert2.y = maxima.y; vert2.z = minima.z;
2131
+ vert3.x = minima.x + 0.001f; vert3.y = minima.y; vert3.z = maxima.z;
2132
+ vert4.x = minima.x + 0.001f; vert4.y = maxima.y; vert4.z = maxima.z;
20882133 norm = cVector.X;
20892134 break;
20902135 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;
2136
+ vert1.x = minima.x; vert1.y = minima.y + 0.001f; vert1.z = minima.z;
2137
+ vert2.x = maxima.x; vert2.y = minima.y + 0.001f; vert2.z = minima.z;
2138
+ vert3.x = minima.x; vert3.y = minima.y + 0.001f; vert3.z = maxima.z;
2139
+ vert4.x = maxima.x; vert4.y = minima.y + 0.001f; vert4.z = maxima.z;
20952140 norm = cVector.Y;
20962141 break;
20972142 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;
2143
+ vert1.x = minima.x; vert1.y = minima.y; vert1.z = minima.z + 0.001f;
2144
+ vert2.x = maxima.x; vert2.y = minima.y; vert2.z = minima.z + 0.001f;
2145
+ vert3.x = minima.x; vert3.y = maxima.y; vert3.z = minima.z + 0.001f;
2146
+ vert4.x = maxima.x; vert4.y = maxima.y; vert4.z = minima.z + 0.001f;
21022147 norm = cVector.Z;
21032148 break;
21042149 }
....@@ -2139,7 +2184,11 @@
21392184 shadow.material = new cMaterial(obj.material);
21402185 shadow.material.diffuse = 0.0001f;
21412186 shadow.material.specular = 0.0001f;
2142
- //shadow.projectedVertices[1].x = 300;
2187
+ shadow.material.opacity = 0.75f;
2188
+
2189
+ AllocProjectedVertices(shadow);
2190
+
2191
+ shadow.projectedVertices[1].x = 300;
21432192
21442193 makeSomething(shadow);
21452194 }
....@@ -2660,27 +2709,35 @@
26602709 } else
26612710 if (source == loopItem || source == loopButton)
26622711 {
2712
+ if (!group.selection.isEmpty())
2713
+ {
26632714 Composite csg = new GroupLeaf();
2664
- csg.count = 5;
26652715 group(csg);
2716
+ csg.count = 5;
26662717 Composite child = new cGroup("Branch");
26672718 csg.addChild(child);
26682719 child.addChild(csg);
2720
+ }
26692721 } else
26702722 if (source == doubleItem)
26712723 {
2724
+ if (!group.selection.isEmpty())
2725
+ {
26722726 Composite csg = new GroupLeaf("Fork");
2673
- csg.count = 5;
26742727 group(csg);
2728
+ csg.count = 5;
26752729 Composite child = new cGroup("Branch A");
26762730 csg.addChild(child);
26772731 child.addChild(csg);
26782732 child = new cGroup("Branch B");
26792733 csg.addChild(child);
26802734 child.addChild(csg);
2735
+ }
26812736 } else
26822737 if (source == tripleItem)
26832738 {
2739
+ if (!group.selection.isEmpty())
2740
+ {
26842741 Composite csg = new GroupLeaf("Trident");
26852742 csg.count = 4;
26862743 group(csg);
....@@ -2693,6 +2750,7 @@
26932750 child = new cGroup();
26942751 csg.addChild(child);
26952752 child.addChild(csg);
2753
+ }
26962754 } else
26972755 if (source == computeAOItem)
26982756 {
....@@ -2739,7 +2797,7 @@
27392797 {
27402798 Maximize();
27412799 } else
2742
- if (source == fullButton)
2800
+ if (source == fullScreenButton)
27432801 {
27442802 ToggleFullScreen();
27452803 } else
....@@ -2748,13 +2806,13 @@
27482806 this.expandedLayout = radio.layout;
27492807 CollapseToolbar();
27502808 } else
2751
- if (source == maximize3DButton)
2752
- {
2753
- this.expandedLayout = radio.layout;
2754
- radio.layout = twoButton;
2755
- Show3DView();
2756
- CollapseToolbar();
2757
- } else
2809
+// if (source == maximize3DButton)
2810
+// {
2811
+// this.expandedLayout = radio.layout;
2812
+// radio.layout = twoButton;
2813
+// CollapseToolbar();
2814
+// Show3DView();
2815
+// } else
27582816 if (source == previousVersionButton)
27592817 {
27602818 // Go to previous version
....@@ -3328,22 +3386,34 @@
33283386 } else
33293387 if (source == ungroupItem || source == ungroupButton)
33303388 {
3331
- boolean hasRoot = false;
3389
+ boolean canUngroup = true;
33323390
33333391 for (int i=0; i<group.selection.size(); i++)
33343392 {
3335
- if (group.selection.get(i) == group)
3393
+ Object3D selectedItem = group.selection.get(i);
3394
+
3395
+ if (selectedItem.Size() == 0)
33363396 {
3337
- hasRoot = true;
3397
+ // Cannot ungroup leaves
3398
+ canUngroup = false;
3399
+ break;
3400
+ }
3401
+
3402
+ if (selectedItem == group)
3403
+ {
3404
+ // Cannot ungroup root
3405
+ canUngroup = false;
33383406 break;
33393407 }
33403408 }
33413409
3342
- if (!hasRoot)
3410
+ if (canUngroup)
33433411 {
33443412 for (int i=0; i<group.selection.size(); i++)
33453413 {
3346
- Ungroup(group.selection.get(i));
3414
+ Object3D selectedItem = group.selection.get(i);
3415
+
3416
+ Ungroup(selectedItem);
33473417 }
33483418
33493419 ClearSelection(false);
....@@ -3394,6 +3464,10 @@
33943464 if (source == clearMaterialsItem)
33953465 {
33963466 ClearMaterials();
3467
+ } else
3468
+ if (source == clearVersionsItem)
3469
+ {
3470
+ ClearVersions();
33973471 } else
33983472 if (source == liveleavesItem)
33993473 {
....@@ -3534,6 +3608,18 @@
35343608 if (source == transformChildrenItem)
35353609 {
35363610 TransformChildren();
3611
+ } else
3612
+ if (source == textureRatioRItem)
3613
+ {
3614
+ TextureRatio(0);
3615
+ } else
3616
+ if (source == textureRatioGItem)
3617
+ {
3618
+ TextureRatio(1);
3619
+ } else
3620
+ if (source == textureRatioBItem)
3621
+ {
3622
+ TextureRatio(2);
35373623 } else
35383624 if (source == resetTransformItem)
35393625 {
....@@ -3892,6 +3978,7 @@
38923978 } else
38933979 if (source == rootButton)
38943980 {
3981
+ Replace();
38953982 Object3D obj;
38963983 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
38973984 {
....@@ -3906,6 +3993,9 @@
39063993 if (source == closeButton)
39073994 {
39083995 //System.out.println("CLOSE: " + buttonGroup.getSelection());
3996
+ if (copy.versionlist != null)
3997
+ Replace();
3998
+
39093999 cRadio ab;
39104000 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
39114001 {
....@@ -4004,6 +4094,9 @@
40044094 } else
40054095 if(source instanceof cRadio)
40064096 {
4097
+ if (copy.versionlist != null)
4098
+ Replace();
4099
+
40074100 group.parent = keepparent;
40084101 group.attributes = 0;
40094102 //group.editWindow = null;
....@@ -4028,8 +4121,6 @@
40284121
40294122 copy = group;
40304123
4031
- SetUndoStates();
4032
-
40334124 //Globals.theRenderer.object = group;
40344125 if(!useclient)
40354126 {
....@@ -4057,6 +4148,32 @@
40574148 */
40584149 radio.layout.doClick();
40594150
4151
+ //assert(copy instanceof Composite);
4152
+
4153
+ if (copy.versionlist == null)
4154
+ {
4155
+ copy.versionindex = -1;
4156
+
4157
+ // Cannot work with loops
4158
+ // To fix this issue, we first mark all nodes above the root,
4159
+ // and check if any of these nodes are reachable below the root.
4160
+ Grafreed.grafreed.universe.TagObjects(copy, true);
4161
+
4162
+ if (copy instanceof Composite && !copy.HasTags())
4163
+ {
4164
+ if (copy.versionlist == null)
4165
+ copy.versionlist = new Object3D[100];
4166
+
4167
+ //Save(true);
4168
+ }
4169
+ else
4170
+ copy.versionindex = -2;
4171
+
4172
+ Grafreed.grafreed.universe.TagObjects(copy, false);
4173
+ }
4174
+
4175
+ SetVersionStates();
4176
+
40604177 ClearUnpinned();
40614178
40624179 //Grafreed.Assert(group != null);
....@@ -4170,6 +4287,18 @@
41704287 refreshContents();
41714288 }
41724289
4290
+ void TextureRatio(int axis)
4291
+ {
4292
+ Object3D obj;
4293
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
4294
+ {
4295
+ obj = (Object3D)e.nextElement();
4296
+ obj.TextureRatio(axis);
4297
+ }
4298
+
4299
+ refreshContents();
4300
+ }
4301
+
41734302 void ResetTransform()
41744303 {
41754304 ResetTransform(-1);
....@@ -4185,42 +4314,8 @@
41854314 if (obj.toParent == null)
41864315 continue;
41874316
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
- }
4317
+ obj.ResetTransform(mask);
4318
+
42244319 if (obj.parent == null)
42254320 {
42264321 System.out.println("NULL PARENT!");
....@@ -4729,6 +4824,12 @@
47294824 {
47304825 Object3D obj = group.selection.get(i);
47314826
4827
+ if (obj.toParent == null)
4828
+ {
4829
+ obj.toParent = LA.newMatrix();
4830
+ obj.fromParent = LA.newMatrix();
4831
+ }
4832
+
47324833 LA.matTranslate(obj.toParent, i * scale, 0, 0);
47334834 LA.matTranslateInv(obj.fromParent, -i * scale, 0, 0);
47344835 }
....@@ -5020,6 +5121,12 @@
50205121 refreshContents();
50215122 }
50225123
5124
+ void ClearVersions()
5125
+ {
5126
+ group.selection.ClearVersions();
5127
+ refreshContents();
5128
+ }
5129
+
50235130 void FlipV(boolean flip)
50245131 {
50255132 group.selection.FlipV(flip);
....@@ -5258,7 +5365,7 @@
52585365 if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
52595366 // a camera
52605367 {
5261
- if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera()) // Crash the camera because of invalid lightspace
5368
+ if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera()) // Crashes the camera because of invalid lightspace
52625369 {
52635370 CameraPane.camerachangeframe = 0; // don't refuse it
52645371 Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
....@@ -5291,10 +5398,26 @@
52915398 flashSelectionButton.setEnabled(enabled);
52925399
52935400 clearPanelButton.setEnabled(!listUI.isEmpty());
5401
+
5402
+ boolean allComposites = true;
5403
+
5404
+ if (group.selection != null)
5405
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
5406
+ {
5407
+ Object next = e.nextElement();
5408
+ if (!(next instanceof Composite)) // || (next instanceof GroupLeaf))
5409
+ {
5410
+ allComposites = false;
5411
+ break;
5412
+ }
5413
+ }
5414
+
5415
+ rootButton.setEnabled(true); // allComposites);
52945416 }
52955417
52965418 void refreshContents(boolean cp)
52975419 {
5420
+ if (Globals.SHOWINFO)
52985421 //if (objectPanel.getSelectedIndex() == 2) // objectPanel.indexOfTab("Info"))
52995422 if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
53005423 {
....@@ -6188,11 +6311,11 @@
61886311 private MenuItem lookAtItem;
61896312 private MenuItem lookFromItem;
61906313 private MenuItem switchViewItem;
6191
- private MenuItem cutItem;
6314
+ private JMenuItem cutItem;
61926315 private MenuItem undoItem;
61936316 private MenuItem redoItem;
61946317 private JMenuItem duplicateItem;
6195
- private MenuItem cloneItem;
6318
+ private JMenuItem cloneItem;
61966319 private MenuItem cloneSupportItem;
61976320 private MenuItem overwriteGeoItem;
61986321 private MenuItem overwriteMatItem;
....@@ -6213,13 +6336,13 @@
62136336 private MenuItem cloneGeometriesItem;
62146337 private MenuItem shareGeometriesItem;
62156338 private MenuItem mergeGeometriesItem;
6216
- private MenuItem copyItem;
6339
+ private JMenuItem copyItem;
62176340 private MenuItem pasteItem;
6218
- private MenuItem pasteIntoItem;
6219
- private MenuItem pasteLinkItem;
6220
- private MenuItem pasteCloneItem;
6221
- private MenuItem pasteExpandItem;
6222
- private MenuItem deleteItem;
6341
+ private JMenuItem pasteIntoItem;
6342
+ private JMenuItem pasteLinkItem;
6343
+ private JMenuItem pasteCloneItem;
6344
+ private JMenuItem pasteExpandItem;
6345
+ private JMenuItem deleteItem;
62236346 private MenuItem clearAllItem;
62246347 private MenuItem genUVItem;
62256348 private MenuItem genNormalsMESHItem;
....@@ -6245,6 +6368,7 @@
62456368 private MenuItem clipMeshItem;
62466369 private MenuItem smoothMeshItem;
62476370 private MenuItem clearMaterialsItem;
6371
+ private MenuItem clearVersionsItem;
62486372
62496373 private MenuItem liveleavesItem;
62506374 private MenuItem unliveleavesItem;
....@@ -6268,13 +6392,16 @@
62686392 private MenuItem maxTexturesItem;
62696393 private MenuItem panoTexturesItem;
62706394
6395
+ private MenuItem textureRatioRItem;
6396
+ private MenuItem textureRatioGItem;
6397
+ private MenuItem textureRatioBItem;
62716398 private MenuItem resetCentroidItem;
62726399 private MenuItem resetCentroidXZItem;
62736400 private MenuItem resetTransformItem;
62746401 private MenuItem transformGeometryItem;
62756402 private MenuItem transformChildrenItem;
62766403 private MenuItem hideItem;
6277
- private MenuItem grabItem;
6404
+ private JMenuItem grabItem;
62786405 private MenuItem backItem;
62796406 private MenuItem frontItem;
62806407 private MenuItem cameraItem;
....@@ -6287,7 +6414,7 @@
62876414 private MenuItem switchTransfoItem;
62886415 private MenuItem morphItem;
62896416 private MenuItem linkerItem;
6290
- private MenuItem ungroupItem;
6417
+ private JMenuItem ungroupItem;
62916418 private MenuItem editItem;
62926419 private MenuItem openWindowItem;
62936420 private MenuItem editLeafItem;