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
....@@ -42,12 +42,12 @@
4242 });
4343 }
4444
45
- public void AddTextureButton(String f, final String t, cGridBag row)
45
+ public void AddTextureButton(String f, String c, final String t, int count, cGridBag row)
4646 {
4747 cButton textureButton;
48
- final String path = "textures/" + f + "/"; // + t;
49
- row.add(textureButton = GetButton(path + "icons/" + t, !Grafreed.NIMBUSLAF));
50
- textureButton.setToolTipText(f + "s");
48
+ final String path = "textures/" + f + "/" + c + "/"; // + t;
49
+ row.add(textureButton = GetButton(path + "icons/" + t, !Globals.NIMBUSLAF));
50
+ textureButton.setToolTipText(c + count);
5151 textureButton.addActionListener(new ActionListener()
5252 {
5353 @Override
....@@ -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);
....@@ -350,7 +359,13 @@
350359
351360 public void ChangeTexture(String texture)
352361 {
353
- cameraView.repaint();
362
+ for (int i=0; i<group.selection.size(); i++)
363
+ {
364
+ Object3D obj = group.selection.get(i);
365
+ obj.SetPigmentTexture("@" + texture);
366
+ }
367
+
368
+ refreshContents();
354369 }
355370
356371 //ObjEditor objEditor;
....@@ -390,11 +405,15 @@
390405 this.copy = this.group = group;
391406 //selectees = this.group.selectees;
392407
393
- if (copy.versionlist == null)
394
- {
395
- copy.versionlist = new Object3D[100];
396
- copy.versionindex = -1;
397
- }
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
+// }
398417
399418 if(ui)
400419 SetupUI(objEditor);
....@@ -417,13 +436,13 @@
417436
418437 ((cRadio)radioPanel.getComponent(0)).SetCamera(cameraView.renderCamera, true);
419438
420
- if (copy.versionlist == null)
421
- {
422
- copy.versionlist = new Object3D[100];
423
- copy.versionindex = -1;
424
-
425
- Save(true);
426
- }
439
+// if (copy.versionlist == null)
440
+// {
441
+// copy.versionlist = new Object3D[100];
442
+// copy.versionindex = -1;
443
+//
444
+// //Save(true);
445
+// }
427446 }
428447
429448 void CloneSelection(boolean supports)
....@@ -513,33 +532,35 @@
513532 // menu.add("-");
514533 duplicateItem = oe.jTree.popup.add(new JMenuItem("Duplicate"));
515534 duplicateItem.addActionListener(this);
516
- cloneItem = menu.add(new MenuItem("Clone"));
535
+
536
+ cloneItem = oe.jTree.popup.add(new JMenuItem("Clone"));
517537 cloneItem.addActionListener(this);
518
- if (Globals.ADVANCED)
538
+ //if (Globals.ADVANCED)
519539 {
520540 cloneSupportItem = menu.add(new MenuItem("Clone (+supports)"));
521541 cloneSupportItem.addActionListener(this);
522542 }
543
+ oe.jTree.popup.addSeparator();
523544 menu.add("-");
524
- cutItem = menu.add(new MenuItem("Cut"));
545
+ cutItem = oe.jTree.popup.add(new JMenuItem("Cut"));
525546 cutItem.addActionListener(this);
526
- copyItem = menu.add(new MenuItem("Copy"));
547
+ copyItem = oe.jTree.popup.add(new JMenuItem("Copy"));
527548 copyItem.addActionListener(this);
528549 pasteItem = menu.add(new MenuItem("Paste"));
529550 pasteItem.addActionListener(this);
530551
531
- menu.add("-");
532
- 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"));
533555 pasteIntoItem.addActionListener(this);
534
- pasteLinkItem = menu.add(new MenuItem("Paste link"));
556
+ pasteLinkItem = oe.jTree.popup.add(new JMenuItem("Paste link"));
535557 pasteLinkItem.addActionListener(this);
536
- pasteCloneItem = menu.add(new MenuItem("Paste clone"));
558
+ pasteCloneItem = oe.jTree.popup.add(new JMenuItem("Paste clone"));
537559 pasteCloneItem.addActionListener(this);
538
-// pasteExpandItem = menu.add(new MenuItem("Paste expand"));
560
+// CRASH pasteExpandItem = oe.jTree.popup.add(new JMenuItem("Paste expand"));
539561 // pasteExpandItem.addActionListener(this);
540
- menu.add("-");
541
- deleteItem = menu.add(new MenuItem("Delete"));
542
- deleteItem.addActionListener(this);
562
+ //menu.add("-");
563
+ oe.jTree.popup.addSeparator();
543564
544565 if (Globals.ADVANCED)
545566 {
....@@ -625,11 +646,9 @@
625646 oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest"));
626647 //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection"));
627648 //cameraMenu.add(switchViewItem = new MenuItem("Reverse View"));
628
- editLeafItem = oe.cameraMenu.add(new MenuItem("Edit Leaf"));
629649 oe.cameraMenu.add("-");
630650 openWindowItem = oe.cameraMenu.add(new MenuItem("Edit copy..."));
631651 openWindowItem.addActionListener(this);
632
- editLeafItem.addActionListener(this);
633652 lookAtItem.addActionListener(this);
634653 //lookFromItem.addActinoListener(this);
635654 //switchViewItem.addActionListener(this);
....@@ -676,9 +695,8 @@
676695 setMasterItem.addActionListener(this);
677696 }
678697
679
- oe.menuBar.add(menu = new Menu("Group"));
680
-// grabItem = menu.add(new MenuItem("Grab"));
681
-// grabItem.addActionListener(this);
698
+ oe.menuBar.add(menu = new Menu("Order"));
699
+
682700 backItem = menu.add(new MenuItem("Back"));
683701 backItem.addActionListener(this);
684702 frontItem = menu.add(new MenuItem("Front"));
....@@ -686,13 +704,21 @@
686704 // compositeItem = menu.add(new MenuItem("Composite"));
687705 // compositeItem.addActionListener(this);
688706
707
+ grabItem = oe.jTree.popup.add(new JMenuItem("Group"));
708
+ grabItem.addActionListener(this);
709
+
689710 if (Globals.ADVANCED)
690711 {
691712 hideItem = menu.add(new MenuItem("Hidden Group"));
692713 hideItem.addActionListener(this);
693714 }
694
- ungroupItem = menu.add(new MenuItem("Ungroup"));
715
+ ungroupItem = oe.jTree.popup.add(new JMenuItem("Ungroup"));
695716 ungroupItem.addActionListener(this);
717
+
718
+ oe.jTree.popup.addSeparator();
719
+
720
+ deleteItem = oe.jTree.popup.add(new JMenuItem("Delete"));
721
+ deleteItem.addActionListener(this);
696722
697723 // menu.add("-");
698724 //
....@@ -729,9 +755,9 @@
729755 shadowYItem.addActionListener(this);
730756 shadowZItem = menu.add(new MenuItem("Shadow Blue"));
731757 shadowZItem.addActionListener(this);
758
+
732759 attributeItem = menu.add(new MenuItem("Attribute"));
733760 attributeItem.addActionListener(this);
734
-
735761 if (Globals.ADVANCED)
736762 {
737763 menu.add("-");
....@@ -743,11 +769,18 @@
743769 pointflowItem.addActionListener(this);
744770 }
745771 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("-");
746779 resetTransformItem = menu.add(new MenuItem("Reset Transform"));
747780 resetTransformItem.addActionListener(this);
748781 resetCentroidItem = menu.add(new MenuItem("Reset Centroid"));
749782 resetCentroidItem.addActionListener(this);
750
- resetCentroidXZItem = menu.add(new MenuItem("Reset Centroid XY"));
783
+ resetCentroidXZItem = menu.add(new MenuItem("Reset Centroid XZ"));
751784 resetCentroidXZItem.addActionListener(this);
752785 transformGeometryItem = menu.add(new MenuItem("Transform Geometry"));
753786 transformGeometryItem.addActionListener(this);
....@@ -799,6 +832,8 @@
799832 }
800833
801834 oe.menuBar.add(menu = new Menu("Attributes"));
835
+ clearVersionsItem = menu.add(new MenuItem("Clear Versions"));
836
+ clearVersionsItem.addActionListener(this);
802837 clearMaterialsItem = menu.add(new MenuItem("Clear Materials"));
803838 clearMaterialsItem.addActionListener(this);
804839 resetAllItem = menu.add(new MenuItem("Reset All"));
....@@ -821,9 +856,9 @@
821856 hideleavesItem.addActionListener(this);
822857 showleavesItem = menu.add(new MenuItem("Show Leaves"));
823858 showleavesItem.addActionListener(this);
824
- markleavesItem = menu.add(new MenuItem("Mark Leaves"));
859
+ markleavesItem = menu.add(new MenuItem("Anim Leaves"));
825860 markleavesItem.addActionListener(this);
826
- unmarkleavesItem = menu.add(new MenuItem("Unmark Leaves"));
861
+ unmarkleavesItem = menu.add(new MenuItem("Unanim Leaves"));
827862 unmarkleavesItem.addActionListener(this);
828863 rewindleavesItem = menu.add(new MenuItem("Rewind Leaves"));
829864 rewindleavesItem.addActionListener(this);
....@@ -877,6 +912,9 @@
877912 shareGeometriesItem.addActionListener(this);
878913 mergeGeometriesItem = menu.add(new MenuItem("Merge Geometries"));
879914 mergeGeometriesItem.addActionListener(this);
915
+ menu.add("-");
916
+ editLeafItem = menu.add(new MenuItem("Edit leaf..."));
917
+ editLeafItem.addActionListener(this);
880918 if (Globals.ADVANCED)
881919 {
882920 // Pretty much the same as duplicate and clone.
....@@ -895,40 +933,50 @@
895933
896934 JTabbedPane resourcecontainer;
897935 cGridBag currenttab;
898
- boolean added; // patch for jar
936
+ //boolean added; // patch for jar
899937
938
+ int totalcount = 0;
939
+
900940 int tabcount = 0;
901941 int colcount = 0;
902942 int rowcount = 0;
943
+ int texturecount = 0;
903944
904945 int columns = 5;
905946 int rows = 7;
906947
907948 public void ResourceCallBack(String[] path)
908949 {
909
- for (int i = 0; i < path.length; i++)
910
- System.out.print(path[i] + "/");
911
- System.out.println();
912
- if (rowcount == 0)
950
+// for (int i = 0; i < path.length; i++)
951
+// System.out.print(path[i] + "/");
952
+// System.out.println();
953
+
954
+ if (//rowcount == 0 ||
955
+ path.length == 1 && !path[0].equals("") && !path[0].equals(".DS_Store"))
913956 {
914957 currenttab = new cGridBag();
915
- added = false;
916
- String tabname = String.valueOf((char)('A'+tabcount));
958
+ String tabname = path[0]; // String.valueOf((char)('A'+tabcount));
917959 currenttab.setName(tabname);
960
+ //added = false;
961
+ resourcecontainer.add(currenttab);
962
+ resourcecontainer.setToolTipTextAt(tabcount++, "Texture Group " + tabname);
918963 rowcount = 1;
964
+ colcount = 0;
965
+ texturecount = 0;
919966 }
920967
921
- if (path.length > 1 && path[1].toLowerCase().endsWith(".jpg"))
968
+ if (path.length > 2 && (path[2].toLowerCase().endsWith(".jpg") || path[2].toLowerCase().endsWith(".png")))
922969 {
923
- if (!added)
970
+ //if (!added)
924971 {
925
- added = true;
926
- resourcecontainer.add(currenttab);
927
- String tabname = String.valueOf((char)('A'+tabcount));
928
- resourcecontainer.setToolTipTextAt(tabcount++, "Texture Group " + tabname);
972
+ //added = true;
973
+ String tabname = path[0]; // String.valueOf((char)('A'+tabcount));
974
+ currenttab = (cGridBag)resourcecontainer.getComponentAt(resourcecontainer.indexOfTab(tabname));
929975 }
930976
931
- AddTextureButton(path[0], path[1], currenttab);
977
+ AddTextureButton(path[0], path[1], path[2], ++texturecount, currenttab);
978
+ totalcount++;
979
+
932980 if (++colcount >= columns)
933981 {
934982 colcount = 0;
....@@ -949,10 +997,12 @@
949997
950998 void CreateTexturePanel(cGridBag container)
951999 {
952
- resourcecontainer = new JTabbedPane();
1000
+ resourcecontainer = new JTabbedPane(JTabbedPane.LEFT);
9531001 container.add(resourcecontainer);
9541002
9551003 Grafreed.ParseResources("textures", this);
1004
+
1005
+ // 935. System.out.println("Total = " + totalcount);
9561006 }
9571007
9581008 void SetupUI2(ObjEditor oe)
....@@ -972,11 +1022,6 @@
9721022 //new Exception().printStackTrace();
9731023
9741024 oe.radioPanel = new JPanel(new GridBagLayout());
975
- oe.aConstraints.weightx = 1;
976
- oe.aConstraints.weighty = 0;
977
- oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
978
- oe.aConstraints.gridwidth = 100;
979
- oe.aConstraints.gridheight = 1;
9801025 // oe.toolbarPanel.add(radioPanel); //, oe.aConstraints);
9811026
9821027 oe.buttonGroup = new ButtonGroup();
....@@ -997,9 +1042,9 @@
9971042 oe.radioPanel.add(dummyButton);
9981043 oe.buttonGroup.add(dummyButton);
9991044 */
1000
- cGridBag copyOptionsPanel = new cGridBag();
1045
+ cGridBag versionManagerPanel = new cGridBag();
10011046
1002
- copyOptionsPanel.preferredHeight = 2;
1047
+ versionManagerPanel.preferredHeight = 4;
10031048
10041049 //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
10051050
....@@ -1009,62 +1054,102 @@
10091054
10101055 if (Globals.ADVANCED)
10111056 {
1012
- oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1013
- maxButton.setToolTipText("Maximize window");
1014
- 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);
10151060 }
10161061
1017
- oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1018
- fullButton.setToolTipText("Full-screen window");
1019
- fullButton.addActionListener(this);
1062
+ cButton gcButton;
10201063
1021
- oe.toolbarPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
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
+// });
1073
+
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);
1079
+ collapseButton.setToolTipText("Collapse toolbar");
1080
+ collapseButton.addActionListener(this);
1081
+
1082
+// oe.toolbarPanel.add(maximize3DButton = GetButton("icons/square.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1083
+// maximize3DButton.setToolTipText("Maximize 3D view");
1084
+// maximize3DButton.addActionListener(this);
1085
+
1086
+ oe.toolbarPanel.add(twoButton = GetButton("icons/cube.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1087
+ twoButton.setToolTipText("Show 3D view only");
1088
+ twoButton.addActionListener(this);
1089
+ this.fullscreenLayout = twoButton;
1090
+
1091
+ oe.toolbarPanel.add(threeButton = GetButton("icons/controlsview.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1092
+ threeButton.setToolTipText("Show controls and 3D view");
1093
+ threeButton.addActionListener(this);
1094
+ if (Globals.ADVANCED)
1095
+ {
1096
+ oe.toolbarPanel.add(sixButton = GetButton("icons/viewcontrols.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1097
+ sixButton.setToolTipText("Show 3D view and controls");
1098
+ sixButton.addActionListener(this);
1099
+ }
1100
+// oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1101
+// sevenButton.setToolTipText("3-column layout");
1102
+// sevenButton.addActionListener(this);
1103
+ //
1104
+
1105
+ oe.toolbarPanel.add(screenfitButton = GetButton("icons/fit.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10221106 screenfitButton.setToolTipText("Screen fit");
10231107 screenfitButton.addActionListener(this);
10241108
1025
- 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);
10261110 restoreCameraButton.setToolTipText("Restore viewpoint");
10271111 restoreCameraButton.addActionListener(this);
10281112
1029
- 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);
10301114 saveVersionButton.setToolTipText("Duplicate current version");
10311115 saveVersionButton.addActionListener(this);
10321116
1033
- copyOptionsPanel.add(deleteVersionButton = GetButton("icons/trash.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1117
+ versionManagerPanel.add(deleteVersionButton = GetButton("icons/trash.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10341118 deleteVersionButton.setToolTipText("Delete current version");
10351119 deleteVersionButton.addActionListener(this);
1120
+ deleteVersionButton.setEnabled(false);
10361121
1037
- copyOptionsPanel.add(previousVersionButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1122
+ versionManagerPanel.add(previousVersionButton = GetButton("icons/undo.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10381123 previousVersionButton.setToolTipText("Previous version");
10391124 previousVersionButton.addActionListener(this);
10401125 previousVersionButton.setEnabled(false);
10411126
10421127 cGridBag updown = new cGridBag().setVertical(true);
1043
- updown.add(restoreButton = GetButton("icons/restore.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1128
+ updown.add(restoreButton = GetButton("icons/restore.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10441129 restoreButton.setToolTipText("Undo (restore current version)");
10451130 restoreButton.addActionListener(this);
1046
- //restoreButton.setEnabled(false);
1131
+ restoreButton.setEnabled(false);
10471132
1048
- updown.add(replaceButton = GetButton("icons/replace.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1133
+ updown.add(replaceButton = GetButton("icons/replace.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10491134 replaceButton.setToolTipText("Save (replace current version)");
10501135 replaceButton.addActionListener(this);
1051
- //replaceButton.setEnabled(false);
1136
+ replaceButton.setEnabled(false);
10521137
1053
- copyOptionsPanel.add(updown);
1138
+ versionManagerPanel.add(updown);
10541139
1055
- copyOptionsPanel.add(nextVersionButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1140
+ versionManagerPanel.add(nextVersionButton = GetButton("icons/redo.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10561141 nextVersionButton.setToolTipText("Next version");
10571142 nextVersionButton.addActionListener(this);
10581143 nextVersionButton.setEnabled(false);
1144
+
1145
+ oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1146
+ oneStepButton.setToolTipText("Animate one step forward");
1147
+ oneStepButton.addActionListener(this);
10591148
10601149 oe.toolbarPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
10611150 liveCB.setToolTipText("Enable animation");
10621151 liveCB.addItemListener(this);
10631152
1064
- oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1065
- oneStepButton.setToolTipText("Animate one step forward");
1066
- oneStepButton.addActionListener(this);
1067
-
10681153 oe.toolbarPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
10691154 fastCB.setToolTipText("Fast mode");
10701155 fastCB.addItemListener(this);
....@@ -1080,38 +1165,23 @@
10801165
10811166 if (Globals.ADVANCED)
10821167 {
1083
- oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1168
+ oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10841169 snapobjectButton.addActionListener(this);
10851170 snapobjectButton.setToolTipText("Snap Object");
10861171
1087
- 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);
10881173 fourButton.addActionListener(this);
10891174 fourButton.setToolTipText("Show control panel only");
10901175 }
10911176
10921177 //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
10931178
1094
- oe.toolbarPanel.add(twoButton = GetButton("icons/cube.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1095
- twoButton.setToolTipText("Show 3D view only");
1096
- twoButton.addActionListener(this);
1097
- this.fullscreenLayout = twoButton;
1098
-
1099
- oe.toolbarPanel.add(threeButton = GetButton("icons/controlsview.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1100
- threeButton.setToolTipText("Show controls and 3D view");
1101
- threeButton.addActionListener(this);
1102
- oe.toolbarPanel.add(sixButton = GetButton("icons/viewcontrols.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1103
- sixButton.setToolTipText("Show 3D view and controls");
1104
- sixButton.addActionListener(this);
1105
-// oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1106
-// sevenButton.setToolTipText("3-column layout");
1107
-// sevenButton.addActionListener(this);
1108
- //
11091179
1110
- 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);
11111181 rootButton.setToolTipText("Open selection in new tab");
11121182 rootButton.addActionListener(this);
11131183
1114
- 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);
11151185 closeButton.setToolTipText("Close tab");
11161186 closeButton.addActionListener(this);
11171187 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
....@@ -1120,38 +1190,38 @@
11201190 cGridBag row1 = new cGridBag();
11211191
11221192 // INSERT
1123
- row1.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1124
- gridButton.setToolTipText("Create grid");
1193
+ row1.add(gridButton = GetButton("icons/grid.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1194
+ gridButton.setToolTipText("Create ground");
11251195 gridButton.addActionListener(this);
11261196
1127
- row1.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1197
+ row1.add(boxButton = GetButton("icons/box.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11281198 boxButton.setToolTipText("Create box");
11291199 boxButton.addActionListener(this);
11301200
1131
- row1.add(sphereButton = GetButton("icons/sphere.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1132
- sphereButton.setToolTipText("Create sphere");
1133
- sphereButton.addActionListener(this);
1134
-
1135
- row1.add(coneButton = GetButton("icons/cone.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1136
- coneButton.setToolTipText("Create cone");
1137
- coneButton.addActionListener(this);
1138
-
1139
- row1.add(torusButton = GetButton("icons/torus.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1140
- torusButton.setToolTipText("Create torus");
1141
- torusButton.addActionListener(this);
1142
-
1143
- row1.add(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1201
+ row1.add(superButton = GetButton("icons/super.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11441202 superButton.setToolTipText("Create superellipsoid");
11451203 superButton.addActionListener(this);
11461204
1147
- 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)
11481218 {
1149
- 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);
11501220 kleinButton.setToolTipText("Create Klein bottle");
11511221 kleinButton.addActionListener(this);
11521222 }
11531223
1154
- row1.add(particlesButton = GetButton("icons/particles.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1224
+ row1.add(particlesButton = GetButton("icons/particles.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11551225 particlesButton.setToolTipText("Create particle system");
11561226 particlesButton.addActionListener(this);
11571227
....@@ -1159,31 +1229,31 @@
11591229
11601230 cGridBag row2 = new cGridBag();
11611231
1162
- row2.add(groupButton = GetButton("icons/group.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1232
+ row2.add(groupButton = GetButton("icons/group.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11631233 groupButton.setToolTipText("Create group");
11641234 groupButton.addActionListener(this);
11651235
1166
- row2.add(compositeButton = GetButton("icons/composite.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1236
+ row2.add(compositeButton = GetButton("icons/composite.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11671237 compositeButton.setToolTipText("Create composite");
11681238 compositeButton.addActionListener(this);
11691239
1170
- row2.add(switchButton = GetButton("icons/switch.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1240
+ row2.add(switchButton = GetButton("icons/switch.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11711241 switchButton.setToolTipText("Create item switcher");
11721242 switchButton.addActionListener(this);
11731243
1174
- row2.add(loopButton = GetButton("icons/loop.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1244
+ row2.add(loopButton = GetButton("icons/loop.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11751245 loopButton.setToolTipText("Create loop");
11761246 loopButton.addActionListener(this);
11771247
1178
- row2.add(textureButton = GetButton("icons/texture.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1248
+ row2.add(textureButton = GetButton("icons/texture.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11791249 textureButton.setToolTipText("Create texture");
11801250 textureButton.addActionListener(this);
11811251
1182
- row2.add(overlayButton = GetButton("icons/overlay.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1252
+ row2.add(overlayButton = GetButton("icons/overlay.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11831253 overlayButton.setToolTipText("Create overlay");
11841254 overlayButton.addActionListener(this);
11851255
1186
- 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);
11871257 lightButton.setToolTipText("Create light");
11881258 lightButton.addActionListener(this);
11891259
....@@ -1193,6 +1263,11 @@
11931263
11941264 CreateTexturePanel(textures);
11951265
1266
+ int tabCount = resourcecontainer.getTabCount();
1267
+
1268
+ if (tabCount > 0)
1269
+ resourcecontainer.setSelectedIndex((int)(Math.random() * tabCount));
1270
+
11961271 oe.toolboxPanel.add(textures);
11971272
11981273 textures.preferredHeight = 100;
....@@ -1200,11 +1275,11 @@
12001275 CreateSkyboxPanel(oe.skyboxPanel);
12011276
12021277 // EDIT panel
1203
- editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1278
+ editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12041279 editButton.setToolTipText("Pin selection controls");
12051280 editButton.addActionListener(this);
12061281
1207
- editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1282
+ editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12081283 uneditButton.setToolTipText("Unpin and remove selection controls");
12091284 uneditButton.addActionListener(this);
12101285
....@@ -1212,7 +1287,7 @@
12121287 allParamsButton.setToolTipText("Show all controls");
12131288 allParamsButton.addActionListener(this);
12141289
1215
- editCommandsPanel.add(clearPanelButton = GetButton("icons/clear.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1290
+ editCommandsPanel.add(clearPanelButton = GetButton("icons/clear.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12161291 clearPanelButton.setToolTipText("Clear all controls");
12171292 clearPanelButton.addActionListener(this);
12181293
....@@ -1220,7 +1295,7 @@
12201295 //unselectButton.setToolTipText("Unselect");
12211296 //unselectButton.addActionListener(this);
12221297
1223
- 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);
12241299 flashSelectionButton.setToolTipText("Highlight selection");
12251300 flashSelectionButton.addActionListener(this);
12261301
....@@ -1243,6 +1318,8 @@
12431318
12441319 cGridBag jSPPanel = new cGridBag();
12451320
1321
+ jSPPanel.preferredHeight = 20;
1322
+
12461323 JScrollPane jSP;
12471324 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
12481325 jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
....@@ -1251,11 +1328,11 @@
12511328 oe.treePanel.add(jSPPanel);
12521329 oe.treePanel.Return();
12531330
1254
- oe.treePanel.add(copyOptionsPanel);
1331
+ oe.treePanel.add(versionManagerPanel);
12551332 oe.treePanel.Return();
1256
- cGridBag sliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
1257
- versionSlider = (cNumberSlider)sliderPane.getComponent(1);
1258
- sliderPane.preferredHeight = 1;
1333
+ versionSliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
1334
+ versionSlider = (cNumberSlider)versionSliderPane.getComponent(1);
1335
+ versionSliderPane.preferredHeight = 3;
12591336
12601337 // mainPanel.setDividerLocation(0.1); //1.0);
12611338 mainPanel.setResizeWeight(0.4);
....@@ -1413,6 +1490,14 @@
14131490
14141491 void EditObject(Object3D obj)
14151492 {
1493
+ //assert(obj instanceof Composite);
1494
+
1495
+// if (obj.versionlist == null)
1496
+// {
1497
+// obj.versionlist = new Object3D[100];
1498
+// obj.versionindex = -1;
1499
+// }
1500
+
14161501 cRadio radioButton = new cRadio(obj.name);
14171502
14181503 // June 2019. Patch to avoid bug with transparency.
....@@ -1437,6 +1522,7 @@
14371522
14381523 oe.SetupViews();
14391524
1525
+ if (Globals.DEBUG)
14401526 System.out.println("SetupViews");
14411527 DragSource.getDefaultDragSource().createDefaultDragGestureRecognizer(
14421528 oe.cameraView, DnDConstants.ACTION_COPY_OR_MOVE, this); // ACTION_LINK ??
....@@ -1803,7 +1889,12 @@
18031889 TreePath path;
18041890
18051891 public TransferableTreePath(TreePath tp) {
1806
- path = tp;
1892
+ Object[] objs = new Object[tp.getPathCount()];
1893
+ for (int i=0; i<objs.length; i++)
1894
+ {
1895
+ objs[i] = ((Object3D)tp.getPathComponent(i)).GetUUID();
1896
+ }
1897
+ path = new TreePath(objs);
18071898 }
18081899
18091900 public synchronized DataFlavor[] getTransferDataFlavors() {
....@@ -2035,24 +2126,24 @@
20352126 switch(axis)
20362127 {
20372128 case 0 :
2038
- vert1.x = minima.x; vert1.y = minima.y; vert1.z = minima.z;
2039
- vert2.x = minima.x; vert2.y = maxima.y; vert2.z = minima.z;
2040
- vert3.x = minima.x; vert3.y = minima.y; vert3.z = maxima.z;
2041
- 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;
20422133 norm = cVector.X;
20432134 break;
20442135 case 1 :
2045
- vert1.x = minima.x; vert1.y = minima.y; vert1.z = minima.z;
2046
- vert2.x = maxima.x; vert2.y = minima.y; vert2.z = minima.z;
2047
- vert3.x = minima.x; vert3.y = minima.y; vert3.z = maxima.z;
2048
- 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;
20492140 norm = cVector.Y;
20502141 break;
20512142 case 2 :
2052
- vert1.x = minima.x; vert1.y = minima.y; vert1.z = minima.z;
2053
- vert2.x = maxima.x; vert2.y = minima.y; vert2.z = minima.z;
2054
- vert3.x = minima.x; vert3.y = maxima.y; vert3.z = minima.z;
2055
- 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;
20562147 norm = cVector.Z;
20572148 break;
20582149 }
....@@ -2093,7 +2184,11 @@
20932184 shadow.material = new cMaterial(obj.material);
20942185 shadow.material.diffuse = 0.0001f;
20952186 shadow.material.specular = 0.0001f;
2096
- //shadow.projectedVertices[1].x = 300;
2187
+ shadow.material.opacity = 0.75f;
2188
+
2189
+ AllocProjectedVertices(shadow);
2190
+
2191
+ shadow.projectedVertices[1].x = 300;
20972192
20982193 makeSomething(shadow);
20992194 }
....@@ -2614,27 +2709,35 @@
26142709 } else
26152710 if (source == loopItem || source == loopButton)
26162711 {
2712
+ if (!group.selection.isEmpty())
2713
+ {
26172714 Composite csg = new GroupLeaf();
2618
- csg.count = 5;
26192715 group(csg);
2716
+ csg.count = 5;
26202717 Composite child = new cGroup("Branch");
26212718 csg.addChild(child);
26222719 child.addChild(csg);
2720
+ }
26232721 } else
26242722 if (source == doubleItem)
26252723 {
2724
+ if (!group.selection.isEmpty())
2725
+ {
26262726 Composite csg = new GroupLeaf("Fork");
2627
- csg.count = 5;
26282727 group(csg);
2728
+ csg.count = 5;
26292729 Composite child = new cGroup("Branch A");
26302730 csg.addChild(child);
26312731 child.addChild(csg);
26322732 child = new cGroup("Branch B");
26332733 csg.addChild(child);
26342734 child.addChild(csg);
2735
+ }
26352736 } else
26362737 if (source == tripleItem)
26372738 {
2739
+ if (!group.selection.isEmpty())
2740
+ {
26382741 Composite csg = new GroupLeaf("Trident");
26392742 csg.count = 4;
26402743 group(csg);
....@@ -2647,6 +2750,7 @@
26472750 child = new cGroup();
26482751 csg.addChild(child);
26492752 child.addChild(csg);
2753
+ }
26502754 } else
26512755 if (source == computeAOItem)
26522756 {
....@@ -2693,10 +2797,22 @@
26932797 {
26942798 Maximize();
26952799 } else
2696
- if (source == fullButton)
2800
+ if (source == fullScreenButton)
26972801 {
26982802 ToggleFullScreen();
26992803 } else
2804
+ if (source == collapseButton)
2805
+ {
2806
+ this.expandedLayout = radio.layout;
2807
+ CollapseToolbar();
2808
+ } else
2809
+// if (source == maximize3DButton)
2810
+// {
2811
+// this.expandedLayout = radio.layout;
2812
+// radio.layout = twoButton;
2813
+// CollapseToolbar();
2814
+// Show3DView();
2815
+// } else
27002816 if (source == previousVersionButton)
27012817 {
27022818 // Go to previous version
....@@ -3270,22 +3386,34 @@
32703386 } else
32713387 if (source == ungroupItem || source == ungroupButton)
32723388 {
3273
- boolean hasRoot = false;
3389
+ boolean canUngroup = true;
32743390
32753391 for (int i=0; i<group.selection.size(); i++)
32763392 {
3277
- if (group.selection.get(i) == group)
3393
+ Object3D selectedItem = group.selection.get(i);
3394
+
3395
+ if (selectedItem.Size() == 0)
32783396 {
3279
- 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;
32803406 break;
32813407 }
32823408 }
32833409
3284
- if (!hasRoot)
3410
+ if (canUngroup)
32853411 {
32863412 for (int i=0; i<group.selection.size(); i++)
32873413 {
3288
- Ungroup(group.selection.get(i));
3414
+ Object3D selectedItem = group.selection.get(i);
3415
+
3416
+ Ungroup(selectedItem);
32893417 }
32903418
32913419 ClearSelection(false);
....@@ -3336,6 +3464,10 @@
33363464 if (source == clearMaterialsItem)
33373465 {
33383466 ClearMaterials();
3467
+ } else
3468
+ if (source == clearVersionsItem)
3469
+ {
3470
+ ClearVersions();
33393471 } else
33403472 if (source == liveleavesItem)
33413473 {
....@@ -3476,6 +3608,18 @@
34763608 if (source == transformChildrenItem)
34773609 {
34783610 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);
34793623 } else
34803624 if (source == resetTransformItem)
34813625 {
....@@ -3648,38 +3792,7 @@
36483792 if (CameraPane.FULLSCREEN)
36493793 fullscreenLayout = radio.layout;
36503794
3651
- // bug
3652
- //gridPanel.setDividerLocation(1.0);
3653
- //bigPanel.setDividerLocation(0.0);
3654
-// bigThree.remove(scenePanel);
3655
-// bigThree.remove(centralPanel);
3656
-// bigThree.remove(XYZPanel);
3657
-// aWindowConstraints.gridx = 0;
3658
-// aWindowConstraints.gridy = 0;
3659
-// aWindowConstraints.gridwidth = 1;
3660
-// // aConstraints.gridheight = 3;
3661
-// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3662
-// aWindowConstraints.weightx = 0;
3663
-// aWindowConstraints.weighty = 1;
3664
-// //bigThree.add(jtp, aWindowConstraints);
3665
-// aWindowConstraints.weightx = 1;
3666
-// aWindowConstraints.gridwidth = 3;
3667
-// // aConstraints.gridheight = 3;
3668
-// aWindowConstraints.gridx = 1;
3669
-// aWindowConstraints.fill = GridBagConstraints.BOTH;
3670
-// bigThree.add(centralPanel, aWindowConstraints);
3671
-// aWindowConstraints.weightx = 0;
3672
-// aWindowConstraints.gridx = 4;
3673
-// aWindowConstraints.gridwidth = 1;
3674
-// // aConstraints.gridheight = 3;
3675
-// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3676
-// //bigThree.add(XYZPanel, aWindowConstraints);
3677
-// scenePanel.setVisible(false);
3678
-// centralPanel.setVisible(true);
3679
-// XYZPanel.setVisible(false);
3680
- bigThree.ClearUI();
3681
- bigThree.add(centralPanel);
3682
- bigThree.FlushUI();
3795
+ Show3DView();
36833796
36843797 cameraView.requestFocusInWindow();
36853798
....@@ -3865,6 +3978,7 @@
38653978 } else
38663979 if (source == rootButton)
38673980 {
3981
+ Replace();
38683982 Object3D obj;
38693983 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
38703984 {
....@@ -3879,6 +3993,9 @@
38793993 if (source == closeButton)
38803994 {
38813995 //System.out.println("CLOSE: " + buttonGroup.getSelection());
3996
+ if (copy.versionlist != null)
3997
+ Replace();
3998
+
38823999 cRadio ab;
38834000 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
38844001 {
....@@ -3977,6 +4094,9 @@
39774094 } else
39784095 if(source instanceof cRadio)
39794096 {
4097
+ if (copy.versionlist != null)
4098
+ Replace();
4099
+
39804100 group.parent = keepparent;
39814101 group.attributes = 0;
39824102 //group.editWindow = null;
....@@ -4001,8 +4121,6 @@
40014121
40024122 copy = group;
40034123
4004
- SetUndoStates();
4005
-
40064124 //Globals.theRenderer.object = group;
40074125 if(!useclient)
40084126 {
....@@ -4030,6 +4148,32 @@
40304148 */
40314149 radio.layout.doClick();
40324150
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
+
40334177 ClearUnpinned();
40344178
40354179 //Grafreed.Assert(group != null);
....@@ -4143,6 +4287,18 @@
41434287 refreshContents();
41444288 }
41454289
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
+
41464302 void ResetTransform()
41474303 {
41484304 ResetTransform(-1);
....@@ -4158,42 +4314,8 @@
41584314 if (obj.toParent == null)
41594315 continue;
41604316
4161
- if (mask == -1)
4162
- {
4163
- if (obj instanceof Camera) // jan 2014
4164
- {
4165
- LA.matIdentity(obj.toParent);
4166
- LA.matIdentity(obj.fromParent);
4167
- }
4168
- else
4169
- {
4170
- obj.toParent = null; // jan 2014 LA.matIdentity(obj.toParent);
4171
- obj.fromParent = null; // LA.matIdentity(obj.fromParent);
4172
- }
4173
- TouchTransform(obj);
4174
- continue;
4175
- }
4176
- if ((mask&2) != 0) // Scale
4177
- {
4178
- obj.toParent[0][0] = obj.toParent[1][1] = obj.toParent[2][2] = 1;
4179
- obj.toParent[0][1] = obj.toParent[1][0] = obj.toParent[2][0] = 0;
4180
- obj.toParent[0][2] = obj.toParent[1][2] = obj.toParent[2][1] = 0;
4181
- obj.fromParent[0][0] = obj.fromParent[1][1] = obj.fromParent[2][2] = 1;
4182
- obj.fromParent[0][1] = obj.fromParent[1][0] = obj.fromParent[2][0] = 0;
4183
- obj.fromParent[0][2] = obj.fromParent[1][2] = obj.fromParent[2][1] = 0;
4184
- }
4185
- if ((mask&4) != 0) // Rotation
4186
- {
4187
- // ?
4188
- }
4189
- if ((mask&1) != 0) // Translation
4190
- {
4191
- if (obj.toParent != null)
4192
- {
4193
- obj.toParent[3][0] = obj.toParent[3][1] = obj.toParent[3][2] = 0;
4194
- obj.fromParent[3][0] = obj.fromParent[3][1] = obj.fromParent[3][2] = 0;
4195
- }
4196
- }
4317
+ obj.ResetTransform(mask);
4318
+
41974319 if (obj.parent == null)
41984320 {
41994321 System.out.println("NULL PARENT!");
....@@ -4702,6 +4824,12 @@
47024824 {
47034825 Object3D obj = group.selection.get(i);
47044826
4827
+ if (obj.toParent == null)
4828
+ {
4829
+ obj.toParent = LA.newMatrix();
4830
+ obj.fromParent = LA.newMatrix();
4831
+ }
4832
+
47054833 LA.matTranslate(obj.toParent, i * scale, 0, 0);
47064834 LA.matTranslateInv(obj.fromParent, -i * scale, 0, 0);
47074835 }
....@@ -4993,6 +5121,12 @@
49935121 refreshContents();
49945122 }
49955123
5124
+ void ClearVersions()
5125
+ {
5126
+ group.selection.ClearVersions();
5127
+ refreshContents();
5128
+ }
5129
+
49965130 void FlipV(boolean flip)
49975131 {
49985132 group.selection.FlipV(flip);
....@@ -5231,7 +5365,7 @@
52315365 if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
52325366 // a camera
52335367 {
5234
- 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
52355369 {
52365370 CameraPane.camerachangeframe = 0; // don't refuse it
52375371 Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
....@@ -5264,10 +5398,26 @@
52645398 flashSelectionButton.setEnabled(enabled);
52655399
52665400 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);
52675416 }
52685417
52695418 void refreshContents(boolean cp)
52705419 {
5420
+ if (Globals.SHOWINFO)
52715421 //if (objectPanel.getSelectedIndex() == 2) // objectPanel.indexOfTab("Info"))
52725422 if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
52735423 {
....@@ -5278,7 +5428,7 @@
52785428 Object3D child = (Object3D) group.selection.get(i);
52795429
52805430 objEditor.AddInfo(child, this, true);
5281
- System.err.println("info : " + child.GetPath());
5431
+// System.err.println("info : " + child.GetPath());
52825432 }
52835433
52845434 objEditor.SetText(); // jan 2014
....@@ -6161,11 +6311,11 @@
61616311 private MenuItem lookAtItem;
61626312 private MenuItem lookFromItem;
61636313 private MenuItem switchViewItem;
6164
- private MenuItem cutItem;
6314
+ private JMenuItem cutItem;
61656315 private MenuItem undoItem;
61666316 private MenuItem redoItem;
61676317 private JMenuItem duplicateItem;
6168
- private MenuItem cloneItem;
6318
+ private JMenuItem cloneItem;
61696319 private MenuItem cloneSupportItem;
61706320 private MenuItem overwriteGeoItem;
61716321 private MenuItem overwriteMatItem;
....@@ -6186,13 +6336,13 @@
61866336 private MenuItem cloneGeometriesItem;
61876337 private MenuItem shareGeometriesItem;
61886338 private MenuItem mergeGeometriesItem;
6189
- private MenuItem copyItem;
6339
+ private JMenuItem copyItem;
61906340 private MenuItem pasteItem;
6191
- private MenuItem pasteIntoItem;
6192
- private MenuItem pasteLinkItem;
6193
- private MenuItem pasteCloneItem;
6194
- private MenuItem pasteExpandItem;
6195
- private MenuItem deleteItem;
6341
+ private JMenuItem pasteIntoItem;
6342
+ private JMenuItem pasteLinkItem;
6343
+ private JMenuItem pasteCloneItem;
6344
+ private JMenuItem pasteExpandItem;
6345
+ private JMenuItem deleteItem;
61966346 private MenuItem clearAllItem;
61976347 private MenuItem genUVItem;
61986348 private MenuItem genNormalsMESHItem;
....@@ -6218,6 +6368,7 @@
62186368 private MenuItem clipMeshItem;
62196369 private MenuItem smoothMeshItem;
62206370 private MenuItem clearMaterialsItem;
6371
+ private MenuItem clearVersionsItem;
62216372
62226373 private MenuItem liveleavesItem;
62236374 private MenuItem unliveleavesItem;
....@@ -6241,13 +6392,16 @@
62416392 private MenuItem maxTexturesItem;
62426393 private MenuItem panoTexturesItem;
62436394
6395
+ private MenuItem textureRatioRItem;
6396
+ private MenuItem textureRatioGItem;
6397
+ private MenuItem textureRatioBItem;
62446398 private MenuItem resetCentroidItem;
62456399 private MenuItem resetCentroidXZItem;
62466400 private MenuItem resetTransformItem;
62476401 private MenuItem transformGeometryItem;
62486402 private MenuItem transformChildrenItem;
62496403 private MenuItem hideItem;
6250
- private MenuItem grabItem;
6404
+ private JMenuItem grabItem;
62516405 private MenuItem backItem;
62526406 private MenuItem frontItem;
62536407 private MenuItem cameraItem;
....@@ -6260,7 +6414,7 @@
62606414 private MenuItem switchTransfoItem;
62616415 private MenuItem morphItem;
62626416 private MenuItem linkerItem;
6263
- private MenuItem ungroupItem;
6417
+ private JMenuItem ungroupItem;
62646418 private MenuItem editItem;
62656419 private MenuItem openWindowItem;
62666420 private MenuItem editLeafItem;