Normand Briere
2019-09-20 cbe4e90105d07d7d3fecabffaa01342403aa2ae3
GroupEditor.java
....@@ -29,9 +29,9 @@
2929 {
3030 cButton skyboxButton;
3131 final String path = "cubemaps/" + f + "-skyboxes/" + s;
32
- row.add(skyboxButton = GetButton(path + "/preview.jpg", !Grafreed.NIMBUSLAF));
32
+ row.add(skyboxButton = GetButton(path + "/preview.jpg", !Globals.NIMBUSLAF));
3333 //row.add(skyboxButton = GetButton(path + "/negx.jpg", !Grafreed.NIMBUSLAF));
34
- skyboxButton.setToolTipText(s);
34
+ skyboxButton.setToolTipText(s.equals("") ? "No background" : s);
3535 skyboxButton.addActionListener(new ActionListener()
3636 {
3737 @Override
....@@ -46,7 +46,7 @@
4646 {
4747 cButton textureButton;
4848 final String path = "textures/" + f + "/" + c + "/"; // + t;
49
- row.add(textureButton = GetButton(path + "icons/" + t, !Grafreed.NIMBUSLAF));
49
+ row.add(textureButton = GetButton(path + "icons/" + t, !Globals.NIMBUSLAF));
5050 textureButton.setToolTipText(c + count);
5151 textureButton.addActionListener(new ActionListener()
5252 {
....@@ -73,7 +73,7 @@
7373 cGridBag row5 = new cGridBag();
7474 cGridBag row6 = new cGridBag();
7575
76
- AddSkyboxButton("default", "rgb", row0);
76
+ AddSkyboxButton("default", "", row0);
7777 //AddSkyboxButton("default", "cornell", row0);
7878 AddSkyboxButton("penguins", "dust", row0);
7979 AddSkyboxButton("penguins", "tropic", row0);
....@@ -330,15 +330,24 @@
330330
331331 public void ChangeSkybox(String skybox)
332332 {
333
- //cameraView.envyoff = false;
334
- group.skyboxname = skybox;
335
- group.skyboxext = "jpg";
336
- cameraView.repaint();
333
+ if (skybox.endsWith("/"))
334
+ {
335
+ group.skyboxname = null;
336
+ group.skyboxext = null;
337
+ cameraView.repaint();
338
+ }
339
+ else
340
+ {
341
+ //cameraView.envyoff = false;
342
+ group.skyboxname = skybox;
343
+ group.skyboxext = "jpg";
344
+ cameraView.repaint();
345
+ }
337346 }
338347
339348 public void CreateSkyboxPanel(cGridBag skyboxPanel)
340349 {
341
- JTabbedPane skyboxpane = new JTabbedPane();
350
+ JTabbedPane skyboxpane = new JTabbedPane(JTabbedPane.LEFT);
342351
343352 AddSkyboxTab0(skyboxpane);
344353 AddSkyboxTab1(skyboxpane);
....@@ -396,11 +405,15 @@
396405 this.copy = this.group = group;
397406 //selectees = this.group.selectees;
398407
399
- if (copy.versionlist == null)
400
- {
401
- copy.versionlist = new Object3D[100];
402
- copy.versionindex = -1;
403
- }
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
+// }
404417
405418 if(ui)
406419 SetupUI(objEditor);
....@@ -423,13 +436,13 @@
423436
424437 ((cRadio)radioPanel.getComponent(0)).SetCamera(cameraView.renderCamera, true);
425438
426
- if (copy.versionlist == null)
427
- {
428
- copy.versionlist = new Object3D[100];
429
- copy.versionindex = -1;
430
-
431
- Save(true);
432
- }
439
+// if (copy.versionlist == null)
440
+// {
441
+// copy.versionlist = new Object3D[100];
442
+// copy.versionindex = -1;
443
+//
444
+// //Save(true);
445
+// }
433446 }
434447
435448 void CloneSelection(boolean supports)
....@@ -470,11 +483,16 @@
470483
471484 Object3D parent = obj.parent;
472485 obj.parent = null;
486
+
473487 // Object3D support = obj.support;
474488 // obj.support = null;
475489 if (!supports)
476490 obj.SaveSupports();
491
+
477492 Object3D clone = (Object3D)Grafreed.clone(obj);
493
+
494
+ clone.ResetUUIDs();
495
+
478496 obj.parent = parent;
479497 // obj.support = support;
480498 // clone.support = support; // aout 2013
....@@ -519,33 +537,37 @@
519537 // menu.add("-");
520538 duplicateItem = oe.jTree.popup.add(new JMenuItem("Duplicate"));
521539 duplicateItem.addActionListener(this);
522
- cloneItem = menu.add(new MenuItem("Clone"));
540
+
541
+ cloneItem = oe.jTree.popup.add(new JMenuItem("Clone"));
523542 cloneItem.addActionListener(this);
524
- if (Globals.ADVANCED)
543
+ //if (Globals.ADVANCED)
525544 {
526545 cloneSupportItem = menu.add(new MenuItem("Clone (+supports)"));
527546 cloneSupportItem.addActionListener(this);
528547 }
548
+ oe.jTree.popup.addSeparator();
529549 menu.add("-");
530
- cutItem = menu.add(new MenuItem("Cut"));
550
+ cutItem = oe.jTree.popup.add(new JMenuItem("Cut"));
531551 cutItem.addActionListener(this);
532
- copyItem = menu.add(new MenuItem("Copy"));
552
+ copyItem = oe.jTree.popup.add(new JMenuItem("Copy"));
533553 copyItem.addActionListener(this);
534554 pasteItem = menu.add(new MenuItem("Paste"));
535555 pasteItem.addActionListener(this);
536556
537
- menu.add("-");
538
- pasteIntoItem = menu.add(new MenuItem("Paste into"));
557
+ oe.jTree.popup.addSeparator();
558
+ //menu.add("-");
559
+ pasteIntoItem = oe.jTree.popup.add(new JMenuItem("Paste into"));
539560 pasteIntoItem.addActionListener(this);
540
- pasteLinkItem = menu.add(new MenuItem("Paste link"));
561
+ pasteLinkItem = oe.jTree.popup.add(new JMenuItem("Paste link"));
541562 pasteLinkItem.addActionListener(this);
542
- pasteCloneItem = menu.add(new MenuItem("Paste clone"));
563
+ pasteCloneItem = oe.jTree.popup.add(new JMenuItem("Paste clone"));
543564 pasteCloneItem.addActionListener(this);
544
-// pasteExpandItem = menu.add(new MenuItem("Paste expand"));
545
-// pasteExpandItem.addActionListener(this);
546
- menu.add("-");
547
- deleteItem = menu.add(new MenuItem("Delete"));
548
- deleteItem.addActionListener(this);
565
+// CRASH
566
+ pasteExpandItem = oe.jTree.popup.add(new JMenuItem("Paste expand"));
567
+//
568
+ pasteExpandItem.addActionListener(this);
569
+ //menu.add("-");
570
+ oe.jTree.popup.addSeparator();
549571
550572 if (Globals.ADVANCED)
551573 {
....@@ -631,11 +653,9 @@
631653 oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest"));
632654 //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection"));
633655 //cameraMenu.add(switchViewItem = new MenuItem("Reverse View"));
634
- editLeafItem = oe.cameraMenu.add(new MenuItem("Edit Leaf"));
635656 oe.cameraMenu.add("-");
636657 openWindowItem = oe.cameraMenu.add(new MenuItem("Edit copy..."));
637658 openWindowItem.addActionListener(this);
638
- editLeafItem.addActionListener(this);
639659 lookAtItem.addActionListener(this);
640660 //lookFromItem.addActinoListener(this);
641661 //switchViewItem.addActionListener(this);
....@@ -682,9 +702,8 @@
682702 setMasterItem.addActionListener(this);
683703 }
684704
685
- oe.menuBar.add(menu = new Menu("Group"));
686
-// grabItem = menu.add(new MenuItem("Grab"));
687
-// grabItem.addActionListener(this);
705
+ oe.menuBar.add(menu = new Menu("Order"));
706
+
688707 backItem = menu.add(new MenuItem("Back"));
689708 backItem.addActionListener(this);
690709 frontItem = menu.add(new MenuItem("Front"));
....@@ -692,13 +711,21 @@
692711 // compositeItem = menu.add(new MenuItem("Composite"));
693712 // compositeItem.addActionListener(this);
694713
714
+ grabItem = oe.jTree.popup.add(new JMenuItem("Group"));
715
+ grabItem.addActionListener(this);
716
+
695717 if (Globals.ADVANCED)
696718 {
697719 hideItem = menu.add(new MenuItem("Hidden Group"));
698720 hideItem.addActionListener(this);
699721 }
700
- ungroupItem = menu.add(new MenuItem("Ungroup"));
722
+ ungroupItem = oe.jTree.popup.add(new JMenuItem("Ungroup"));
701723 ungroupItem.addActionListener(this);
724
+
725
+ oe.jTree.popup.addSeparator();
726
+
727
+ deleteItem = oe.jTree.popup.add(new JMenuItem("Delete"));
728
+ deleteItem.addActionListener(this);
702729
703730 // menu.add("-");
704731 //
....@@ -735,9 +762,9 @@
735762 shadowYItem.addActionListener(this);
736763 shadowZItem = menu.add(new MenuItem("Shadow Blue"));
737764 shadowZItem.addActionListener(this);
765
+
738766 attributeItem = menu.add(new MenuItem("Attribute"));
739767 attributeItem.addActionListener(this);
740
-
741768 if (Globals.ADVANCED)
742769 {
743770 menu.add("-");
....@@ -749,11 +776,18 @@
749776 pointflowItem.addActionListener(this);
750777 }
751778 menu.add("-");
779
+ textureRatioRItem = menu.add(new MenuItem("Texture Ratio Red"));
780
+ textureRatioRItem.addActionListener(this);
781
+ textureRatioGItem = menu.add(new MenuItem("Texture Ratio Green"));
782
+ textureRatioGItem.addActionListener(this);
783
+ textureRatioBItem = menu.add(new MenuItem("Texture Ratio Blue"));
784
+ textureRatioBItem.addActionListener(this);
785
+ menu.add("-");
752786 resetTransformItem = menu.add(new MenuItem("Reset Transform"));
753787 resetTransformItem.addActionListener(this);
754788 resetCentroidItem = menu.add(new MenuItem("Reset Centroid"));
755789 resetCentroidItem.addActionListener(this);
756
- resetCentroidXZItem = menu.add(new MenuItem("Reset Centroid XY"));
790
+ resetCentroidXZItem = menu.add(new MenuItem("Reset Centroid XZ"));
757791 resetCentroidXZItem.addActionListener(this);
758792 transformGeometryItem = menu.add(new MenuItem("Transform Geometry"));
759793 transformGeometryItem.addActionListener(this);
....@@ -769,7 +803,7 @@
769803 genNormalsCADItem.addActionListener(this);
770804 genNormalsMESHItem = menu.add(new MenuItem("Mesh Normals"));
771805 genNormalsMESHItem.addActionListener(this);
772
- if (Globals.ADVANCED)
806
+ //if (Globals.ADVANCED)
773807 {
774808 genNormalsMINEItem = menu.add(new MenuItem("Stitch Normals"));
775809 genNormalsMINEItem.addActionListener(this);
....@@ -805,6 +839,8 @@
805839 }
806840
807841 oe.menuBar.add(menu = new Menu("Attributes"));
842
+ clearVersionsItem = menu.add(new MenuItem("Clear Versions"));
843
+ clearVersionsItem.addActionListener(this);
808844 clearMaterialsItem = menu.add(new MenuItem("Clear Materials"));
809845 clearMaterialsItem.addActionListener(this);
810846 resetAllItem = menu.add(new MenuItem("Reset All"));
....@@ -827,9 +863,9 @@
827863 hideleavesItem.addActionListener(this);
828864 showleavesItem = menu.add(new MenuItem("Show Leaves"));
829865 showleavesItem.addActionListener(this);
830
- markleavesItem = menu.add(new MenuItem("Mark Leaves"));
866
+ markleavesItem = menu.add(new MenuItem("Anim Leaves"));
831867 markleavesItem.addActionListener(this);
832
- unmarkleavesItem = menu.add(new MenuItem("Unmark Leaves"));
868
+ unmarkleavesItem = menu.add(new MenuItem("Unanim Leaves"));
833869 unmarkleavesItem.addActionListener(this);
834870 rewindleavesItem = menu.add(new MenuItem("Rewind Leaves"));
835871 rewindleavesItem.addActionListener(this);
....@@ -883,6 +919,9 @@
883919 shareGeometriesItem.addActionListener(this);
884920 mergeGeometriesItem = menu.add(new MenuItem("Merge Geometries"));
885921 mergeGeometriesItem.addActionListener(this);
922
+ menu.add("-");
923
+ editLeafItem = menu.add(new MenuItem("Edit leaf..."));
924
+ editLeafItem.addActionListener(this);
886925 if (Globals.ADVANCED)
887926 {
888927 // Pretty much the same as duplicate and clone.
....@@ -901,8 +940,10 @@
901940
902941 JTabbedPane resourcecontainer;
903942 cGridBag currenttab;
904
- boolean added; // patch for jar
943
+ //boolean added; // patch for jar
905944
945
+ int totalcount = 0;
946
+
906947 int tabcount = 0;
907948 int colcount = 0;
908949 int rowcount = 0;
....@@ -918,28 +959,35 @@
918959 // System.out.println();
919960
920961 if (//rowcount == 0 ||
921
- path.length == 1)
962
+ path.length == 1 && !path[0].equals("") && !path[0].equals(".DS_Store"))
922963 {
923964 currenttab = new cGridBag();
924
- added = false;
925965 String tabname = path[0]; // String.valueOf((char)('A'+tabcount));
926966 currenttab.setName(tabname);
967
+ //added = false;
968
+ resourcecontainer.add(currenttab);
969
+ resourcecontainer.setToolTipTextAt(tabcount++, "Texture " + tabname);
927970 rowcount = 1;
928971 colcount = 0;
929972 texturecount = 0;
930973 }
931974
932
- if (path.length > 2 && path[2].toLowerCase().endsWith(".jpg"))
975
+ if (path.length > 2 && (path[2].toLowerCase().endsWith(".jpg") || path[2].toLowerCase().endsWith(".png")))
933976 {
934
- if (!added)
977
+ //if (!added)
935978 {
936
- added = true;
937
- resourcecontainer.add(currenttab);
979
+ //added = true;
938980 String tabname = path[0]; // String.valueOf((char)('A'+tabcount));
939
- resourcecontainer.setToolTipTextAt(tabcount++, "Texture Group " + tabname);
981
+ currenttab = (cGridBag)resourcecontainer.getComponentAt(resourcecontainer.indexOfTab(tabname));
940982 }
941983
942
- AddTextureButton(path[0], path[1], path[2], texturecount++, currenttab);
984
+ columns = 5;
985
+
986
+ if (path[0].contains("D&R") || path[0].contains("Paint"))
987
+ columns = 4;
988
+
989
+ AddTextureButton(path[0], path[1], path[2], ++texturecount, currenttab);
990
+ totalcount++;
943991
944992 if (++colcount >= columns)
945993 {
....@@ -965,6 +1013,8 @@
9651013 container.add(resourcecontainer);
9661014
9671015 Grafreed.ParseResources("textures", this);
1016
+
1017
+ // 935. System.out.println("Total = " + totalcount);
9681018 }
9691019
9701020 void SetupUI2(ObjEditor oe)
....@@ -984,11 +1034,6 @@
9841034 //new Exception().printStackTrace();
9851035
9861036 oe.radioPanel = new JPanel(new GridBagLayout());
987
- oe.aConstraints.weightx = 1;
988
- oe.aConstraints.weighty = 0;
989
- oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
990
- oe.aConstraints.gridwidth = 100;
991
- oe.aConstraints.gridheight = 1;
9921037 // oe.toolbarPanel.add(radioPanel); //, oe.aConstraints);
9931038
9941039 oe.buttonGroup = new ButtonGroup();
....@@ -1009,9 +1054,9 @@
10091054 oe.radioPanel.add(dummyButton);
10101055 oe.buttonGroup.add(dummyButton);
10111056 */
1012
- cGridBag copyOptionsPanel = new cGridBag();
1057
+ cGridBag versionManagerPanel = new cGridBag();
10131058
1014
- copyOptionsPanel.preferredHeight = 2;
1059
+ versionManagerPanel.preferredHeight = 4;
10151060
10161061 //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
10171062
....@@ -1021,62 +1066,102 @@
10211066
10221067 if (Globals.ADVANCED)
10231068 {
1024
- oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1025
- maxButton.setToolTipText("Maximize window");
1026
- maxButton.addActionListener(this);
1069
+// oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1070
+// maxButton.setToolTipText("Maximize window");
1071
+// maxButton.addActionListener(this);
10271072 }
10281073
1029
- oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1030
- fullButton.setToolTipText("Full-screen window");
1031
- fullButton.addActionListener(this);
1074
+ cButton gcButton;
10321075
1033
- oe.toolbarPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1076
+// oe.toolbarPanel.add(gcButton = GetButton("icons/trash.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1077
+// gcButton.setToolTipText("Garbage collect");
1078
+// gcButton.addActionListener(new ActionListener()
1079
+// {
1080
+// public void actionPerformed(ActionEvent e)
1081
+// {
1082
+// System.gc();
1083
+// }
1084
+// });
1085
+
1086
+ oe.toolbarPanel.add(fullScreenButton = GetButton("icons/fullscreen.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1087
+ fullScreenButton.setToolTipText("Full-screen window");
1088
+ fullScreenButton.addActionListener(this);
1089
+
1090
+ oe.toolbarPanel.add(collapseButton = GetButton("icons/collapse.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1091
+ collapseButton.setToolTipText("Collapse toolbar");
1092
+ collapseButton.addActionListener(this);
1093
+
1094
+// oe.toolbarPanel.add(maximize3DButton = GetButton("icons/square.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1095
+// maximize3DButton.setToolTipText("Maximize 3D view");
1096
+// maximize3DButton.addActionListener(this);
1097
+
1098
+ oe.toolbarPanel.add(twoButton = GetButton("icons/cube.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1099
+ twoButton.setToolTipText("Show 3D view only");
1100
+ twoButton.addActionListener(this);
1101
+ this.fullscreenLayout = twoButton;
1102
+
1103
+ oe.toolbarPanel.add(threeButton = GetButton("icons/controlsview.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1104
+ threeButton.setToolTipText("Show controls and 3D view");
1105
+ threeButton.addActionListener(this);
1106
+ if (Globals.ADVANCED)
1107
+ {
1108
+ oe.toolbarPanel.add(sixButton = GetButton("icons/viewcontrols.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1109
+ sixButton.setToolTipText("Show 3D view and controls");
1110
+ sixButton.addActionListener(this);
1111
+ }
1112
+// oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1113
+// sevenButton.setToolTipText("3-column layout");
1114
+// sevenButton.addActionListener(this);
1115
+ //
1116
+
1117
+ oe.toolbarPanel.add(screenfitButton = GetButton("icons/fit.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10341118 screenfitButton.setToolTipText("Screen fit");
10351119 screenfitButton.addActionListener(this);
10361120
1037
- oe.toolbarPanel.add(restoreCameraButton = GetButton("icons/eye.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1121
+ oe.toolbarPanel.add(restoreCameraButton = GetButton("icons/eye.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10381122 restoreCameraButton.setToolTipText("Restore viewpoint");
10391123 restoreCameraButton.addActionListener(this);
10401124
1041
- copyOptionsPanel.add(saveVersionButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1125
+ versionManagerPanel.add(saveVersionButton = GetButton("icons/down_arrow.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10421126 saveVersionButton.setToolTipText("Duplicate current version");
10431127 saveVersionButton.addActionListener(this);
10441128
1045
- copyOptionsPanel.add(deleteVersionButton = GetButton("icons/trash.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1129
+ versionManagerPanel.add(deleteVersionButton = GetButton("icons/trash.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10461130 deleteVersionButton.setToolTipText("Delete current version");
10471131 deleteVersionButton.addActionListener(this);
1132
+ deleteVersionButton.setEnabled(false);
10481133
1049
- copyOptionsPanel.add(previousVersionButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1134
+ versionManagerPanel.add(previousVersionButton = GetButton("icons/undo.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10501135 previousVersionButton.setToolTipText("Previous version");
10511136 previousVersionButton.addActionListener(this);
10521137 previousVersionButton.setEnabled(false);
10531138
10541139 cGridBag updown = new cGridBag().setVertical(true);
1055
- updown.add(restoreButton = GetButton("icons/restore.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1140
+ updown.add(restoreButton = GetButton("icons/restore.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10561141 restoreButton.setToolTipText("Undo (restore current version)");
10571142 restoreButton.addActionListener(this);
1058
- //restoreButton.setEnabled(false);
1143
+ restoreButton.setEnabled(false);
10591144
1060
- updown.add(replaceButton = GetButton("icons/replace.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1145
+ updown.add(replaceButton = GetButton("icons/replace.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10611146 replaceButton.setToolTipText("Save (replace current version)");
10621147 replaceButton.addActionListener(this);
1063
- //replaceButton.setEnabled(false);
1148
+ replaceButton.setEnabled(false);
10641149
1065
- copyOptionsPanel.add(updown);
1150
+ versionManagerPanel.add(updown);
10661151
1067
- copyOptionsPanel.add(nextVersionButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1152
+ versionManagerPanel.add(nextVersionButton = GetButton("icons/redo.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10681153 nextVersionButton.setToolTipText("Next version");
10691154 nextVersionButton.addActionListener(this);
10701155 nextVersionButton.setEnabled(false);
1156
+
1157
+ oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1158
+ oneStepButton.setToolTipText("Animate one step forward");
1159
+ oneStepButton.addActionListener(this);
10711160
10721161 oe.toolbarPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
10731162 liveCB.setToolTipText("Enable animation");
10741163 liveCB.addItemListener(this);
10751164
1076
- oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1077
- oneStepButton.setToolTipText("Animate one step forward");
1078
- oneStepButton.addActionListener(this);
1079
-
10801165 oe.toolbarPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
10811166 fastCB.setToolTipText("Fast mode");
10821167 fastCB.addItemListener(this);
....@@ -1092,110 +1177,97 @@
10921177
10931178 if (Globals.ADVANCED)
10941179 {
1095
- oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1180
+ oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10961181 snapobjectButton.addActionListener(this);
10971182 snapobjectButton.setToolTipText("Snap Object");
10981183
1099
- oe.toolbarPanel.add(fourButton = GetButton("icons/controls-horizontal.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1184
+ oe.toolbarPanel.add(fourButton = GetButton("icons/controls-horizontal.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11001185 fourButton.addActionListener(this);
11011186 fourButton.setToolTipText("Show control panel only");
11021187 }
11031188
11041189 //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
11051190
1106
- oe.toolbarPanel.add(twoButton = GetButton("icons/cube.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1107
- twoButton.setToolTipText("Show 3D view only");
1108
- twoButton.addActionListener(this);
1109
- this.fullscreenLayout = twoButton;
1110
-
1111
- oe.toolbarPanel.add(threeButton = GetButton("icons/controlsview.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1112
- threeButton.setToolTipText("Show controls and 3D view");
1113
- threeButton.addActionListener(this);
1114
- oe.toolbarPanel.add(sixButton = GetButton("icons/viewcontrols.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1115
- sixButton.setToolTipText("Show 3D view and controls");
1116
- sixButton.addActionListener(this);
1117
-// oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1118
-// sevenButton.setToolTipText("3-column layout");
1119
-// sevenButton.addActionListener(this);
1120
- //
11211191
1122
- oe.toolbarPanel.add(rootButton = GetButton("icons/openwindow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1192
+ oe.toolbarPanel.add(rootButton = GetButton("icons/openwindow.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11231193 rootButton.setToolTipText("Open selection in new tab");
11241194 rootButton.addActionListener(this);
11251195
1126
- oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1196
+ oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11271197 closeButton.setToolTipText("Close tab");
11281198 closeButton.addActionListener(this);
11291199 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
11301200 //clearButton.addActionListener(this);
11311201
11321202 cGridBag row1 = new cGridBag();
1203
+ row1.preferredHeight = 8;
11331204
11341205 // INSERT
1135
- row1.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1136
- gridButton.setToolTipText("Create grid");
1206
+ row1.add(gridButton = GetButton("icons/grid.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1207
+ gridButton.setToolTipText("Create ground");
11371208 gridButton.addActionListener(this);
11381209
1139
- row1.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1210
+ row1.add(boxButton = GetButton("icons/box.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11401211 boxButton.setToolTipText("Create box");
11411212 boxButton.addActionListener(this);
11421213
1143
- row1.add(sphereButton = GetButton("icons/sphere.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1144
- sphereButton.setToolTipText("Create sphere");
1145
- sphereButton.addActionListener(this);
1146
-
1147
- row1.add(coneButton = GetButton("icons/cone.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1148
- coneButton.setToolTipText("Create cone");
1149
- coneButton.addActionListener(this);
1150
-
1151
- row1.add(torusButton = GetButton("icons/torus.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1152
- torusButton.setToolTipText("Create torus");
1153
- torusButton.addActionListener(this);
1154
-
1155
- row1.add(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1214
+ row1.add(superButton = GetButton("icons/super.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11561215 superButton.setToolTipText("Create superellipsoid");
11571216 superButton.addActionListener(this);
11581217
1159
- if (Globals.ADVANCED)
1218
+ row1.add(sphereButton = GetButton("icons/sphere.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1219
+ sphereButton.setToolTipText("Create sphere");
1220
+ sphereButton.addActionListener(this);
1221
+
1222
+ row1.add(coneButton = GetButton("icons/cone.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1223
+ coneButton.setToolTipText("Create cone");
1224
+ coneButton.addActionListener(this);
1225
+
1226
+ row1.add(torusButton = GetButton("icons/torus.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1227
+ torusButton.setToolTipText("Create torus");
1228
+ torusButton.addActionListener(this);
1229
+
1230
+ if (false) //Globals.ADVANCED)
11601231 {
1161
- oe.toolboxPanel.add(kleinButton = GetButton("icons/klein.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1232
+ oe.toolboxPanel.add(kleinButton = GetButton("icons/klein.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11621233 kleinButton.setToolTipText("Create Klein bottle");
11631234 kleinButton.addActionListener(this);
11641235 }
11651236
1166
- row1.add(particlesButton = GetButton("icons/particles.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1237
+ row1.add(particlesButton = GetButton("icons/particles.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11671238 particlesButton.setToolTipText("Create particle system");
11681239 particlesButton.addActionListener(this);
11691240
11701241 oe.toolboxPanel.add(row1);
11711242
11721243 cGridBag row2 = new cGridBag();
1244
+ row2.preferredHeight = 8;
11731245
1174
- row2.add(groupButton = GetButton("icons/group.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1246
+ row2.add(groupButton = GetButton("icons/group.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11751247 groupButton.setToolTipText("Create group");
11761248 groupButton.addActionListener(this);
11771249
1178
- row2.add(compositeButton = GetButton("icons/composite.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1250
+ row2.add(compositeButton = GetButton("icons/composite.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11791251 compositeButton.setToolTipText("Create composite");
11801252 compositeButton.addActionListener(this);
11811253
1182
- row2.add(switchButton = GetButton("icons/switch.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1254
+ row2.add(switchButton = GetButton("icons/switch.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11831255 switchButton.setToolTipText("Create item switcher");
11841256 switchButton.addActionListener(this);
11851257
1186
- row2.add(loopButton = GetButton("icons/loop.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1258
+ row2.add(loopButton = GetButton("icons/loop.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11871259 loopButton.setToolTipText("Create loop");
11881260 loopButton.addActionListener(this);
11891261
1190
- row2.add(textureButton = GetButton("icons/texture.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1262
+ row2.add(textureButton = GetButton("icons/texture.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11911263 textureButton.setToolTipText("Create texture");
11921264 textureButton.addActionListener(this);
11931265
1194
- row2.add(overlayButton = GetButton("icons/overlay.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1266
+ row2.add(overlayButton = GetButton("icons/overlay.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11951267 overlayButton.setToolTipText("Create overlay");
11961268 overlayButton.addActionListener(this);
11971269
1198
- row2.add(lightButton = GetButton("icons/light-bulb.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1270
+ row2.add(lightButton = GetButton("icons/light-bulb.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11991271 lightButton.setToolTipText("Create light");
12001272 lightButton.addActionListener(this);
12011273
....@@ -1205,6 +1277,11 @@
12051277
12061278 CreateTexturePanel(textures);
12071279
1280
+ int tabCount = resourcecontainer.getTabCount();
1281
+
1282
+ if (tabCount > 0)
1283
+ resourcecontainer.setSelectedIndex((int)(Math.random() * tabCount));
1284
+
12081285 oe.toolboxPanel.add(textures);
12091286
12101287 textures.preferredHeight = 100;
....@@ -1212,11 +1289,11 @@
12121289 CreateSkyboxPanel(oe.skyboxPanel);
12131290
12141291 // EDIT panel
1215
- editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1292
+ editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12161293 editButton.setToolTipText("Pin selection controls");
12171294 editButton.addActionListener(this);
12181295
1219
- editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1296
+ editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12201297 uneditButton.setToolTipText("Unpin and remove selection controls");
12211298 uneditButton.addActionListener(this);
12221299
....@@ -1224,7 +1301,7 @@
12241301 allParamsButton.setToolTipText("Show all controls");
12251302 allParamsButton.addActionListener(this);
12261303
1227
- editCommandsPanel.add(clearPanelButton = GetButton("icons/clear.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1304
+ editCommandsPanel.add(clearPanelButton = GetButton("icons/clear.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12281305 clearPanelButton.setToolTipText("Clear all controls");
12291306 clearPanelButton.addActionListener(this);
12301307
....@@ -1232,7 +1309,7 @@
12321309 //unselectButton.setToolTipText("Unselect");
12331310 //unselectButton.addActionListener(this);
12341311
1235
- editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1312
+ editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12361313 flashSelectionButton.setToolTipText("Highlight selection");
12371314 flashSelectionButton.addActionListener(this);
12381315
....@@ -1255,6 +1332,8 @@
12551332
12561333 cGridBag jSPPanel = new cGridBag();
12571334
1335
+ jSPPanel.preferredHeight = 20;
1336
+
12581337 JScrollPane jSP;
12591338 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
12601339 jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
....@@ -1263,11 +1342,12 @@
12631342 oe.treePanel.add(jSPPanel);
12641343 oe.treePanel.Return();
12651344
1266
- oe.treePanel.add(copyOptionsPanel);
1345
+ oe.treePanel.add(versionManagerPanel);
12671346 oe.treePanel.Return();
1268
- cGridBag sliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
1269
- versionSlider = (cNumberSlider)sliderPane.getComponent(1);
1270
- sliderPane.preferredHeight = 1;
1347
+
1348
+ versionSliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
1349
+ versionSlider = (cNumberSlider)versionSliderPane.getComponent(1);
1350
+ versionSliderPane.preferredHeight = 3;
12711351
12721352 // mainPanel.setDividerLocation(0.1); //1.0);
12731353 mainPanel.setResizeWeight(0.4);
....@@ -1324,7 +1404,7 @@
13241404 // supportCB.setToolTipText("Enable rigging");
13251405 // supportCB.addItemListener(this);
13261406
1327
- panel.add(freezeCB = new cCheckBox("Freeze", Globals.FREEZEONMOVE)); //, constraints);
1407
+ panel.add(freezeCB = new cCheckBox("Fast cam", Globals.FREEZEONMOVE)); //, constraints);
13281408 freezeCB.setToolTipText("Fast moving camera");
13291409 freezeCB.addItemListener(this);
13301410
....@@ -1333,9 +1413,12 @@
13331413
13341414 panel.Return();
13351415
1416
+ if (Globals.ADVANCED)
1417
+ {
13361418 panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD)); //, constraints);
13371419 crowdCB.setToolTipText("Used for crowds");
13381420 crowdCB.addItemListener(this);
1421
+ }
13391422
13401423 panel.add(smoothCB = new cCheckBox("Inertia", CameraPane.INERTIA)); //, constraints);
13411424 smoothCB.setToolTipText("Snapping delay");
....@@ -1348,30 +1431,26 @@
13481431 minshaderCB.setToolTipText("Minimal fast shader");
13491432 minshaderCB.addItemListener(this);
13501433
1351
-// constraints.gridy += 1;
13521434 // panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
13531435 // speakerMocapCB.addItemListener(this);
13541436
1355
- panel.Return();
1356
-
13571437 if (false)
13581438 {
13591439 // handled in scripts
1360
- //constraints.gridy += 1;
13611440 panel.add(speakerCameraCB = new cCheckBox("Cam", CameraPane.SPEAKERCAMERA)); //, constraints);
13621441 speakerCameraCB.addItemListener(this);
13631442
1364
- //constraints.gridy += 1;
13651443 panel.add(speakerFocusCB = new cCheckBox("Focus", CameraPane.SPEAKERFOCUS)); //, constraints);
13661444 speakerFocusCB.addItemListener(this);
13671445
1368
- //constraints.gridy += 1;
1369
- panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints);
1370
- smoothfocusCB.addItemListener(this);
13711446 panel.Return();
13721447 }
13731448
1374
-//constraints.gridx += 1;
1449
+ panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints);
1450
+ smoothfocusCB.addItemListener(this);
1451
+
1452
+ panel.Return();
1453
+
13751454 //panel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), constraints);
13761455 // debugCB.addItemListener(this);
13771456
....@@ -1425,6 +1504,14 @@
14251504
14261505 void EditObject(Object3D obj)
14271506 {
1507
+ //assert(obj instanceof Composite);
1508
+
1509
+// if (obj.versionlist == null)
1510
+// {
1511
+// obj.versionlist = new Object3D[100];
1512
+// obj.versionindex = -1;
1513
+// }
1514
+
14281515 cRadio radioButton = new cRadio(obj.name);
14291516
14301517 // June 2019. Patch to avoid bug with transparency.
....@@ -1449,6 +1536,7 @@
14491536
14501537 oe.SetupViews();
14511538
1539
+ if (Globals.DEBUG)
14521540 System.out.println("SetupViews");
14531541 DragSource.getDefaultDragSource().createDefaultDragGestureRecognizer(
14541542 oe.cameraView, DnDConstants.ACTION_COPY_OR_MOVE, this); // ACTION_LINK ??
....@@ -1815,7 +1903,12 @@
18151903 TreePath path;
18161904
18171905 public TransferableTreePath(TreePath tp) {
1818
- path = tp;
1906
+ Object[] objs = new Object[tp.getPathCount()];
1907
+ for (int i=0; i<objs.length; i++)
1908
+ {
1909
+ objs[i] = ((Object3D)tp.getPathComponent(i)).GetUUID();
1910
+ }
1911
+ path = new TreePath(objs);
18191912 }
18201913
18211914 public synchronized DataFlavor[] getTransferDataFlavors() {
....@@ -1996,7 +2089,7 @@
19962089 Object3D obj = (Object3D)group.selection.elementAt(0);
19972090 objEditor.ScreenFit(obj, false);
19982091
1999
- cameraView.pingthread.StepToTarget(true);
2092
+ cameraView.pingthread.StepToTarget(); //true);
20002093 refreshContents();
20012094 }
20022095
....@@ -2033,7 +2126,7 @@
20332126 obj.parent.TransformToWorld(maxima); //, maxima);
20342127 }
20352128
2036
- Object3D shadow = new Object3D("Shadow " + obj.name);
2129
+ Object3D shadow = new Object3D("Shadow" + obj.name);
20372130
20382131 shadow.toParent = LA.newMatrix();
20392132 shadow.fromParent = LA.newMatrix();
....@@ -2047,24 +2140,24 @@
20472140 switch(axis)
20482141 {
20492142 case 0 :
2050
- vert1.x = minima.x; vert1.y = minima.y; vert1.z = minima.z;
2051
- vert2.x = minima.x; vert2.y = maxima.y; vert2.z = minima.z;
2052
- vert3.x = minima.x; vert3.y = minima.y; vert3.z = maxima.z;
2053
- vert4.x = minima.x; vert4.y = maxima.y; vert4.z = maxima.z;
2143
+ vert1.x = minima.x + 0.001f; vert1.y = minima.y; vert1.z = minima.z;
2144
+ vert2.x = minima.x + 0.001f; vert2.y = maxima.y; vert2.z = minima.z;
2145
+ vert3.x = minima.x + 0.001f; vert3.y = minima.y; vert3.z = maxima.z;
2146
+ vert4.x = minima.x + 0.001f; vert4.y = maxima.y; vert4.z = maxima.z;
20542147 norm = cVector.X;
20552148 break;
20562149 case 1 :
2057
- vert1.x = minima.x; vert1.y = minima.y; vert1.z = minima.z;
2058
- vert2.x = maxima.x; vert2.y = minima.y; vert2.z = minima.z;
2059
- vert3.x = minima.x; vert3.y = minima.y; vert3.z = maxima.z;
2060
- vert4.x = maxima.x; vert4.y = minima.y; vert4.z = maxima.z;
2150
+ vert1.x = minima.x; vert1.y = minima.y + 0.001f; vert1.z = minima.z;
2151
+ vert2.x = maxima.x; vert2.y = minima.y + 0.001f; vert2.z = minima.z;
2152
+ vert3.x = minima.x; vert3.y = minima.y + 0.001f; vert3.z = maxima.z;
2153
+ vert4.x = maxima.x; vert4.y = minima.y + 0.001f; vert4.z = maxima.z;
20612154 norm = cVector.Y;
20622155 break;
20632156 case 2 :
2064
- vert1.x = minima.x; vert1.y = minima.y; vert1.z = minima.z;
2065
- vert2.x = maxima.x; vert2.y = minima.y; vert2.z = minima.z;
2066
- vert3.x = minima.x; vert3.y = maxima.y; vert3.z = minima.z;
2067
- vert4.x = maxima.x; vert4.y = maxima.y; vert4.z = minima.z;
2157
+ vert1.x = minima.x; vert1.y = minima.y; vert1.z = minima.z + 0.001f;
2158
+ vert2.x = maxima.x; vert2.y = minima.y; vert2.z = minima.z + 0.001f;
2159
+ vert3.x = minima.x; vert3.y = maxima.y; vert3.z = minima.z + 0.001f;
2160
+ vert4.x = maxima.x; vert4.y = maxima.y; vert4.z = minima.z + 0.001f;
20682161 norm = cVector.Z;
20692162 break;
20702163 }
....@@ -2105,7 +2198,11 @@
21052198 shadow.material = new cMaterial(obj.material);
21062199 shadow.material.diffuse = 0.0001f;
21072200 shadow.material.specular = 0.0001f;
2108
- //shadow.projectedVertices[1].x = 300;
2201
+ shadow.material.opacity = 0.75f;
2202
+
2203
+ AllocProjectedVertices(shadow);
2204
+
2205
+ shadow.projectedVertices[1].x = 300;
21092206
21102207 makeSomething(shadow);
21112208 }
....@@ -2626,27 +2723,35 @@
26262723 } else
26272724 if (source == loopItem || source == loopButton)
26282725 {
2726
+ if (!group.selection.isEmpty())
2727
+ {
26292728 Composite csg = new GroupLeaf();
2630
- csg.count = 5;
26312729 group(csg);
2730
+ csg.count = 5;
26322731 Composite child = new cGroup("Branch");
26332732 csg.addChild(child);
26342733 child.addChild(csg);
2734
+ }
26352735 } else
26362736 if (source == doubleItem)
26372737 {
2738
+ if (!group.selection.isEmpty())
2739
+ {
26382740 Composite csg = new GroupLeaf("Fork");
2639
- csg.count = 5;
26402741 group(csg);
2742
+ csg.count = 5;
26412743 Composite child = new cGroup("Branch A");
26422744 csg.addChild(child);
26432745 child.addChild(csg);
26442746 child = new cGroup("Branch B");
26452747 csg.addChild(child);
26462748 child.addChild(csg);
2749
+ }
26472750 } else
26482751 if (source == tripleItem)
26492752 {
2753
+ if (!group.selection.isEmpty())
2754
+ {
26502755 Composite csg = new GroupLeaf("Trident");
26512756 csg.count = 4;
26522757 group(csg);
....@@ -2659,6 +2764,7 @@
26592764 child = new cGroup();
26602765 csg.addChild(child);
26612766 child.addChild(csg);
2767
+ }
26622768 } else
26632769 if (source == computeAOItem)
26642770 {
....@@ -2705,10 +2811,22 @@
27052811 {
27062812 Maximize();
27072813 } else
2708
- if (source == fullButton)
2814
+ if (source == fullScreenButton)
27092815 {
27102816 ToggleFullScreen();
27112817 } else
2818
+ if (source == collapseButton)
2819
+ {
2820
+ this.expandedLayout = radio.layout;
2821
+ CollapseToolbar();
2822
+ } else
2823
+// if (source == maximize3DButton)
2824
+// {
2825
+// this.expandedLayout = radio.layout;
2826
+// radio.layout = twoButton;
2827
+// CollapseToolbar();
2828
+// Show3DView();
2829
+// } else
27122830 if (source == previousVersionButton)
27132831 {
27142832 // Go to previous version
....@@ -2736,7 +2854,7 @@
27362854 if (source == saveVersionButton)
27372855 {
27382856 // Save a new version
2739
- if (!Save(true))
2857
+ if (!DuplicateVersion()) //true))
27402858 java.awt.Toolkit.getDefaultToolkit().beep();
27412859 } else
27422860 if (source == deleteVersionButton)
....@@ -3282,22 +3400,34 @@
32823400 } else
32833401 if (source == ungroupItem || source == ungroupButton)
32843402 {
3285
- boolean hasRoot = false;
3403
+ boolean canUngroup = true;
32863404
32873405 for (int i=0; i<group.selection.size(); i++)
32883406 {
3289
- if (group.selection.get(i) == group)
3407
+ Object3D selectedItem = group.selection.get(i);
3408
+
3409
+ if (selectedItem.Size() == 0)
32903410 {
3291
- hasRoot = true;
3411
+ // Cannot ungroup leaves
3412
+ canUngroup = false;
3413
+ break;
3414
+ }
3415
+
3416
+ if (selectedItem == group)
3417
+ {
3418
+ // Cannot ungroup root
3419
+ canUngroup = false;
32923420 break;
32933421 }
32943422 }
32953423
3296
- if (!hasRoot)
3424
+ if (canUngroup)
32973425 {
32983426 for (int i=0; i<group.selection.size(); i++)
32993427 {
3300
- Ungroup(group.selection.get(i));
3428
+ Object3D selectedItem = group.selection.get(i);
3429
+
3430
+ Ungroup(selectedItem);
33013431 }
33023432
33033433 ClearSelection(false);
....@@ -3348,6 +3478,10 @@
33483478 if (source == clearMaterialsItem)
33493479 {
33503480 ClearMaterials();
3481
+ } else
3482
+ if (source == clearVersionsItem)
3483
+ {
3484
+ ClearVersions();
33513485 } else
33523486 if (source == liveleavesItem)
33533487 {
....@@ -3488,6 +3622,18 @@
34883622 if (source == transformChildrenItem)
34893623 {
34903624 TransformChildren();
3625
+ } else
3626
+ if (source == textureRatioRItem)
3627
+ {
3628
+ TextureRatio(0);
3629
+ } else
3630
+ if (source == textureRatioGItem)
3631
+ {
3632
+ TextureRatio(1);
3633
+ } else
3634
+ if (source == textureRatioBItem)
3635
+ {
3636
+ TextureRatio(2);
34913637 } else
34923638 if (source == resetTransformItem)
34933639 {
....@@ -3660,38 +3806,7 @@
36603806 if (CameraPane.FULLSCREEN)
36613807 fullscreenLayout = radio.layout;
36623808
3663
- // bug
3664
- //gridPanel.setDividerLocation(1.0);
3665
- //bigPanel.setDividerLocation(0.0);
3666
-// bigThree.remove(scenePanel);
3667
-// bigThree.remove(centralPanel);
3668
-// bigThree.remove(XYZPanel);
3669
-// aWindowConstraints.gridx = 0;
3670
-// aWindowConstraints.gridy = 0;
3671
-// aWindowConstraints.gridwidth = 1;
3672
-// // aConstraints.gridheight = 3;
3673
-// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3674
-// aWindowConstraints.weightx = 0;
3675
-// aWindowConstraints.weighty = 1;
3676
-// //bigThree.add(jtp, aWindowConstraints);
3677
-// aWindowConstraints.weightx = 1;
3678
-// aWindowConstraints.gridwidth = 3;
3679
-// // aConstraints.gridheight = 3;
3680
-// aWindowConstraints.gridx = 1;
3681
-// aWindowConstraints.fill = GridBagConstraints.BOTH;
3682
-// bigThree.add(centralPanel, aWindowConstraints);
3683
-// aWindowConstraints.weightx = 0;
3684
-// aWindowConstraints.gridx = 4;
3685
-// aWindowConstraints.gridwidth = 1;
3686
-// // aConstraints.gridheight = 3;
3687
-// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3688
-// //bigThree.add(XYZPanel, aWindowConstraints);
3689
-// scenePanel.setVisible(false);
3690
-// centralPanel.setVisible(true);
3691
-// XYZPanel.setVisible(false);
3692
- bigThree.ClearUI();
3693
- bigThree.add(centralPanel);
3694
- bigThree.FlushUI();
3809
+ Show3DView();
36953810
36963811 cameraView.requestFocusInWindow();
36973812
....@@ -3877,6 +3992,7 @@
38773992 } else
38783993 if (source == rootButton)
38793994 {
3995
+ Replace();
38803996 Object3D obj;
38813997 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
38823998 {
....@@ -3891,6 +4007,9 @@
38914007 if (source == closeButton)
38924008 {
38934009 //System.out.println("CLOSE: " + buttonGroup.getSelection());
4010
+ if (copy.versionlist != null)
4011
+ Replace();
4012
+
38944013 cRadio ab;
38954014 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
38964015 {
....@@ -3989,6 +4108,9 @@
39894108 } else
39904109 if(source instanceof cRadio)
39914110 {
4111
+ if (copy.versionlist != null)
4112
+ Replace();
4113
+
39924114 group.parent = keepparent;
39934115 group.attributes = 0;
39944116 //group.editWindow = null;
....@@ -4013,8 +4135,6 @@
40134135
40144136 copy = group;
40154137
4016
- SetUndoStates();
4017
-
40184138 //Globals.theRenderer.object = group;
40194139 if(!useclient)
40204140 {
....@@ -4042,6 +4162,32 @@
40424162 */
40434163 radio.layout.doClick();
40444164
4165
+ //assert(copy instanceof Composite);
4166
+
4167
+ if (copy.versionlist == null)
4168
+ {
4169
+ copy.versionindex = -1;
4170
+
4171
+ // Cannot work with loops
4172
+ // To fix this issue, we first mark all nodes above the root,
4173
+ // and check if any of these nodes are reachable below the root.
4174
+ Grafreed.grafreed.universe.TagObjects(copy, true);
4175
+
4176
+ if (copy instanceof Composite && !copy.HasTags())
4177
+ {
4178
+ if (copy.versionlist == null)
4179
+ copy.versionlist = new Object3D[100];
4180
+
4181
+ //Save(true);
4182
+ }
4183
+ else
4184
+ copy.versionindex = -2;
4185
+
4186
+ Grafreed.grafreed.universe.TagObjects(copy, false);
4187
+ }
4188
+
4189
+ SetVersionStates();
4190
+
40454191 ClearUnpinned();
40464192
40474193 //Grafreed.Assert(group != null);
....@@ -4155,9 +4301,46 @@
41554301 refreshContents();
41564302 }
41574303
4304
+ void TextureRatio(int axis)
4305
+ {
4306
+ Object3D obj;
4307
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
4308
+ {
4309
+ obj = (Object3D)e.nextElement();
4310
+ obj.TextureRatio(axis);
4311
+ }
4312
+
4313
+ refreshContents();
4314
+ }
4315
+
41584316 void ResetTransform()
41594317 {
41604318 ResetTransform(-1);
4319
+ }
4320
+
4321
+ void ScaleSelection(int scale)
4322
+ {
4323
+ Object3D obj;
4324
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
4325
+ {
4326
+ obj = (Object3D)e.nextElement();
4327
+
4328
+ if (obj.toParent == null)
4329
+ continue;
4330
+
4331
+ obj.Scale(scale);
4332
+
4333
+ if (obj.parent == null)
4334
+ {
4335
+ System.out.println("NULL PARENT!");
4336
+ // new Exception().printStackTrace();
4337
+ }
4338
+ else
4339
+ TouchTransform(obj);
4340
+ //obj.parent.Touch();
4341
+ }
4342
+
4343
+ refreshContents();
41614344 }
41624345
41634346 void ResetTransform(int mask)
....@@ -4170,42 +4353,8 @@
41704353 if (obj.toParent == null)
41714354 continue;
41724355
4173
- if (mask == -1)
4174
- {
4175
- if (obj instanceof Camera) // jan 2014
4176
- {
4177
- LA.matIdentity(obj.toParent);
4178
- LA.matIdentity(obj.fromParent);
4179
- }
4180
- else
4181
- {
4182
- obj.toParent = null; // jan 2014 LA.matIdentity(obj.toParent);
4183
- obj.fromParent = null; // LA.matIdentity(obj.fromParent);
4184
- }
4185
- TouchTransform(obj);
4186
- continue;
4187
- }
4188
- if ((mask&2) != 0) // Scale
4189
- {
4190
- obj.toParent[0][0] = obj.toParent[1][1] = obj.toParent[2][2] = 1;
4191
- obj.toParent[0][1] = obj.toParent[1][0] = obj.toParent[2][0] = 0;
4192
- obj.toParent[0][2] = obj.toParent[1][2] = obj.toParent[2][1] = 0;
4193
- obj.fromParent[0][0] = obj.fromParent[1][1] = obj.fromParent[2][2] = 1;
4194
- obj.fromParent[0][1] = obj.fromParent[1][0] = obj.fromParent[2][0] = 0;
4195
- obj.fromParent[0][2] = obj.fromParent[1][2] = obj.fromParent[2][1] = 0;
4196
- }
4197
- if ((mask&4) != 0) // Rotation
4198
- {
4199
- // ?
4200
- }
4201
- if ((mask&1) != 0) // Translation
4202
- {
4203
- if (obj.toParent != null)
4204
- {
4205
- obj.toParent[3][0] = obj.toParent[3][1] = obj.toParent[3][2] = 0;
4206
- obj.fromParent[3][0] = obj.fromParent[3][1] = obj.fromParent[3][2] = 0;
4207
- }
4208
- }
4356
+ obj.ResetTransform(mask);
4357
+
42094358 if (obj.parent == null)
42104359 {
42114360 System.out.println("NULL PARENT!");
....@@ -4714,10 +4863,17 @@
47144863 {
47154864 Object3D obj = group.selection.get(i);
47164865
4866
+ if (obj.toParent == null)
4867
+ {
4868
+ obj.toParent = LA.newMatrix();
4869
+ obj.fromParent = LA.newMatrix();
4870
+ }
4871
+
47174872 LA.matTranslate(obj.toParent, i * scale, 0, 0);
47184873 LA.matTranslateInv(obj.fromParent, -i * scale, 0, 0);
47194874 }
47204875
4876
+ Globals.lighttouched = true;
47214877 refreshContents();
47224878 }
47234879
....@@ -5005,6 +5161,12 @@
50055161 refreshContents();
50065162 }
50075163
5164
+ void ClearVersions()
5165
+ {
5166
+ group.selection.ClearVersions();
5167
+ refreshContents();
5168
+ }
5169
+
50085170 void FlipV(boolean flip)
50095171 {
50105172 group.selection.FlipV(flip);
....@@ -5243,10 +5405,10 @@
52435405 if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
52445406 // a camera
52455407 {
5246
- if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera()) // Crash the camera because of invalid lightspace
5408
+ if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera()) // Crashes the camera because of invalid lightspace
52475409 {
52485410 CameraPane.camerachangeframe = 0; // don't refuse it
5249
- Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
5411
+ Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent(), true);
52505412 }
52515413 // Globals.theRenderer.renderCamera = Globals.theRenderer.manipCamera;
52525414 // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
....@@ -5276,10 +5438,26 @@
52765438 flashSelectionButton.setEnabled(enabled);
52775439
52785440 clearPanelButton.setEnabled(!listUI.isEmpty());
5441
+
5442
+ boolean allComposites = true;
5443
+
5444
+ if (group.selection != null)
5445
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
5446
+ {
5447
+ Object next = e.nextElement();
5448
+ if (!(next instanceof Composite)) // || (next instanceof GroupLeaf))
5449
+ {
5450
+ allComposites = false;
5451
+ break;
5452
+ }
5453
+ }
5454
+
5455
+ rootButton.setEnabled(true); // allComposites);
52795456 }
52805457
52815458 void refreshContents(boolean cp)
52825459 {
5460
+ if (Globals.SHOWINFO)
52835461 //if (objectPanel.getSelectedIndex() == 2) // objectPanel.indexOfTab("Info"))
52845462 if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
52855463 {
....@@ -5290,7 +5468,7 @@
52905468 Object3D child = (Object3D) group.selection.get(i);
52915469
52925470 objEditor.AddInfo(child, this, true);
5293
- System.err.println("info : " + child.GetPath());
5471
+// System.err.println("info : " + child.GetPath());
52945472 }
52955473
52965474 objEditor.SetText(); // jan 2014
....@@ -6173,11 +6351,11 @@
61736351 private MenuItem lookAtItem;
61746352 private MenuItem lookFromItem;
61756353 private MenuItem switchViewItem;
6176
- private MenuItem cutItem;
6354
+ private JMenuItem cutItem;
61776355 private MenuItem undoItem;
61786356 private MenuItem redoItem;
61796357 private JMenuItem duplicateItem;
6180
- private MenuItem cloneItem;
6358
+ private JMenuItem cloneItem;
61816359 private MenuItem cloneSupportItem;
61826360 private MenuItem overwriteGeoItem;
61836361 private MenuItem overwriteMatItem;
....@@ -6198,13 +6376,13 @@
61986376 private MenuItem cloneGeometriesItem;
61996377 private MenuItem shareGeometriesItem;
62006378 private MenuItem mergeGeometriesItem;
6201
- private MenuItem copyItem;
6379
+ private JMenuItem copyItem;
62026380 private MenuItem pasteItem;
6203
- private MenuItem pasteIntoItem;
6204
- private MenuItem pasteLinkItem;
6205
- private MenuItem pasteCloneItem;
6206
- private MenuItem pasteExpandItem;
6207
- private MenuItem deleteItem;
6381
+ private JMenuItem pasteIntoItem;
6382
+ private JMenuItem pasteLinkItem;
6383
+ private JMenuItem pasteCloneItem;
6384
+ private JMenuItem pasteExpandItem;
6385
+ private JMenuItem deleteItem;
62086386 private MenuItem clearAllItem;
62096387 private MenuItem genUVItem;
62106388 private MenuItem genNormalsMESHItem;
....@@ -6230,6 +6408,7 @@
62306408 private MenuItem clipMeshItem;
62316409 private MenuItem smoothMeshItem;
62326410 private MenuItem clearMaterialsItem;
6411
+ private MenuItem clearVersionsItem;
62336412
62346413 private MenuItem liveleavesItem;
62356414 private MenuItem unliveleavesItem;
....@@ -6253,13 +6432,16 @@
62536432 private MenuItem maxTexturesItem;
62546433 private MenuItem panoTexturesItem;
62556434
6435
+ private MenuItem textureRatioRItem;
6436
+ private MenuItem textureRatioGItem;
6437
+ private MenuItem textureRatioBItem;
62566438 private MenuItem resetCentroidItem;
62576439 private MenuItem resetCentroidXZItem;
62586440 private MenuItem resetTransformItem;
62596441 private MenuItem transformGeometryItem;
62606442 private MenuItem transformChildrenItem;
62616443 private MenuItem hideItem;
6262
- private MenuItem grabItem;
6444
+ private JMenuItem grabItem;
62636445 private MenuItem backItem;
62646446 private MenuItem frontItem;
62656447 private MenuItem cameraItem;
....@@ -6272,7 +6454,7 @@
62726454 private MenuItem switchTransfoItem;
62736455 private MenuItem morphItem;
62746456 private MenuItem linkerItem;
6275
- private MenuItem ungroupItem;
6457
+ private JMenuItem ungroupItem;
62766458 private MenuItem editItem;
62776459 private MenuItem openWindowItem;
62786460 private MenuItem editLeafItem;