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
....@@ -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)
....@@ -464,11 +483,16 @@
464483
465484 Object3D parent = obj.parent;
466485 obj.parent = null;
486
+
467487 // Object3D support = obj.support;
468488 // obj.support = null;
469489 if (!supports)
470490 obj.SaveSupports();
491
+
471492 Object3D clone = (Object3D)Grafreed.clone(obj);
493
+
494
+ clone.ResetUUIDs();
495
+
472496 obj.parent = parent;
473497 // obj.support = support;
474498 // clone.support = support; // aout 2013
....@@ -513,33 +537,37 @@
513537 // menu.add("-");
514538 duplicateItem = oe.jTree.popup.add(new JMenuItem("Duplicate"));
515539 duplicateItem.addActionListener(this);
516
- cloneItem = menu.add(new MenuItem("Clone"));
540
+
541
+ cloneItem = oe.jTree.popup.add(new JMenuItem("Clone"));
517542 cloneItem.addActionListener(this);
518
- if (Globals.ADVANCED)
543
+ //if (Globals.ADVANCED)
519544 {
520545 cloneSupportItem = menu.add(new MenuItem("Clone (+supports)"));
521546 cloneSupportItem.addActionListener(this);
522547 }
548
+ oe.jTree.popup.addSeparator();
523549 menu.add("-");
524
- cutItem = menu.add(new MenuItem("Cut"));
550
+ cutItem = oe.jTree.popup.add(new JMenuItem("Cut"));
525551 cutItem.addActionListener(this);
526
- copyItem = menu.add(new MenuItem("Copy"));
552
+ copyItem = oe.jTree.popup.add(new JMenuItem("Copy"));
527553 copyItem.addActionListener(this);
528554 pasteItem = menu.add(new MenuItem("Paste"));
529555 pasteItem.addActionListener(this);
530556
531
- menu.add("-");
532
- 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"));
533560 pasteIntoItem.addActionListener(this);
534
- pasteLinkItem = menu.add(new MenuItem("Paste link"));
561
+ pasteLinkItem = oe.jTree.popup.add(new JMenuItem("Paste link"));
535562 pasteLinkItem.addActionListener(this);
536
- pasteCloneItem = menu.add(new MenuItem("Paste clone"));
563
+ pasteCloneItem = oe.jTree.popup.add(new JMenuItem("Paste clone"));
537564 pasteCloneItem.addActionListener(this);
538
-// pasteExpandItem = menu.add(new MenuItem("Paste expand"));
539
-// pasteExpandItem.addActionListener(this);
540
- menu.add("-");
541
- deleteItem = menu.add(new MenuItem("Delete"));
542
- 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();
543571
544572 if (Globals.ADVANCED)
545573 {
....@@ -625,11 +653,9 @@
625653 oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest"));
626654 //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection"));
627655 //cameraMenu.add(switchViewItem = new MenuItem("Reverse View"));
628
- editLeafItem = oe.cameraMenu.add(new MenuItem("Edit Leaf"));
629656 oe.cameraMenu.add("-");
630657 openWindowItem = oe.cameraMenu.add(new MenuItem("Edit copy..."));
631658 openWindowItem.addActionListener(this);
632
- editLeafItem.addActionListener(this);
633659 lookAtItem.addActionListener(this);
634660 //lookFromItem.addActinoListener(this);
635661 //switchViewItem.addActionListener(this);
....@@ -676,9 +702,8 @@
676702 setMasterItem.addActionListener(this);
677703 }
678704
679
- oe.menuBar.add(menu = new Menu("Group"));
680
-// grabItem = menu.add(new MenuItem("Grab"));
681
-// grabItem.addActionListener(this);
705
+ oe.menuBar.add(menu = new Menu("Order"));
706
+
682707 backItem = menu.add(new MenuItem("Back"));
683708 backItem.addActionListener(this);
684709 frontItem = menu.add(new MenuItem("Front"));
....@@ -686,13 +711,21 @@
686711 // compositeItem = menu.add(new MenuItem("Composite"));
687712 // compositeItem.addActionListener(this);
688713
714
+ grabItem = oe.jTree.popup.add(new JMenuItem("Group"));
715
+ grabItem.addActionListener(this);
716
+
689717 if (Globals.ADVANCED)
690718 {
691719 hideItem = menu.add(new MenuItem("Hidden Group"));
692720 hideItem.addActionListener(this);
693721 }
694
- ungroupItem = menu.add(new MenuItem("Ungroup"));
722
+ ungroupItem = oe.jTree.popup.add(new JMenuItem("Ungroup"));
695723 ungroupItem.addActionListener(this);
724
+
725
+ oe.jTree.popup.addSeparator();
726
+
727
+ deleteItem = oe.jTree.popup.add(new JMenuItem("Delete"));
728
+ deleteItem.addActionListener(this);
696729
697730 // menu.add("-");
698731 //
....@@ -729,9 +762,9 @@
729762 shadowYItem.addActionListener(this);
730763 shadowZItem = menu.add(new MenuItem("Shadow Blue"));
731764 shadowZItem.addActionListener(this);
765
+
732766 attributeItem = menu.add(new MenuItem("Attribute"));
733767 attributeItem.addActionListener(this);
734
-
735768 if (Globals.ADVANCED)
736769 {
737770 menu.add("-");
....@@ -743,11 +776,18 @@
743776 pointflowItem.addActionListener(this);
744777 }
745778 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("-");
746786 resetTransformItem = menu.add(new MenuItem("Reset Transform"));
747787 resetTransformItem.addActionListener(this);
748788 resetCentroidItem = menu.add(new MenuItem("Reset Centroid"));
749789 resetCentroidItem.addActionListener(this);
750
- resetCentroidXZItem = menu.add(new MenuItem("Reset Centroid XY"));
790
+ resetCentroidXZItem = menu.add(new MenuItem("Reset Centroid XZ"));
751791 resetCentroidXZItem.addActionListener(this);
752792 transformGeometryItem = menu.add(new MenuItem("Transform Geometry"));
753793 transformGeometryItem.addActionListener(this);
....@@ -763,7 +803,7 @@
763803 genNormalsCADItem.addActionListener(this);
764804 genNormalsMESHItem = menu.add(new MenuItem("Mesh Normals"));
765805 genNormalsMESHItem.addActionListener(this);
766
- if (Globals.ADVANCED)
806
+ //if (Globals.ADVANCED)
767807 {
768808 genNormalsMINEItem = menu.add(new MenuItem("Stitch Normals"));
769809 genNormalsMINEItem.addActionListener(this);
....@@ -799,6 +839,8 @@
799839 }
800840
801841 oe.menuBar.add(menu = new Menu("Attributes"));
842
+ clearVersionsItem = menu.add(new MenuItem("Clear Versions"));
843
+ clearVersionsItem.addActionListener(this);
802844 clearMaterialsItem = menu.add(new MenuItem("Clear Materials"));
803845 clearMaterialsItem.addActionListener(this);
804846 resetAllItem = menu.add(new MenuItem("Reset All"));
....@@ -821,9 +863,9 @@
821863 hideleavesItem.addActionListener(this);
822864 showleavesItem = menu.add(new MenuItem("Show Leaves"));
823865 showleavesItem.addActionListener(this);
824
- markleavesItem = menu.add(new MenuItem("Mark Leaves"));
866
+ markleavesItem = menu.add(new MenuItem("Anim Leaves"));
825867 markleavesItem.addActionListener(this);
826
- unmarkleavesItem = menu.add(new MenuItem("Unmark Leaves"));
868
+ unmarkleavesItem = menu.add(new MenuItem("Unanim Leaves"));
827869 unmarkleavesItem.addActionListener(this);
828870 rewindleavesItem = menu.add(new MenuItem("Rewind Leaves"));
829871 rewindleavesItem.addActionListener(this);
....@@ -877,6 +919,9 @@
877919 shareGeometriesItem.addActionListener(this);
878920 mergeGeometriesItem = menu.add(new MenuItem("Merge Geometries"));
879921 mergeGeometriesItem.addActionListener(this);
922
+ menu.add("-");
923
+ editLeafItem = menu.add(new MenuItem("Edit leaf..."));
924
+ editLeafItem.addActionListener(this);
880925 if (Globals.ADVANCED)
881926 {
882927 // Pretty much the same as duplicate and clone.
....@@ -895,40 +940,55 @@
895940
896941 JTabbedPane resourcecontainer;
897942 cGridBag currenttab;
898
- boolean added; // patch for jar
943
+ //boolean added; // patch for jar
899944
945
+ int totalcount = 0;
946
+
900947 int tabcount = 0;
901948 int colcount = 0;
902949 int rowcount = 0;
950
+ int texturecount = 0;
903951
904952 int columns = 5;
905953 int rows = 7;
906954
907955 public void ResourceCallBack(String[] path)
908956 {
909
- for (int i = 0; i < path.length; i++)
910
- System.out.print(path[i] + "/");
911
- System.out.println();
912
- if (rowcount == 0)
957
+// for (int i = 0; i < path.length; i++)
958
+// System.out.print(path[i] + "/");
959
+// System.out.println();
960
+
961
+ if (//rowcount == 0 ||
962
+ path.length == 1 && !path[0].equals("") && !path[0].equals(".DS_Store"))
913963 {
914964 currenttab = new cGridBag();
915
- added = false;
916
- String tabname = String.valueOf((char)('A'+tabcount));
965
+ String tabname = path[0]; // String.valueOf((char)('A'+tabcount));
917966 currenttab.setName(tabname);
967
+ //added = false;
968
+ resourcecontainer.add(currenttab);
969
+ resourcecontainer.setToolTipTextAt(tabcount++, "Texture " + tabname);
918970 rowcount = 1;
971
+ colcount = 0;
972
+ texturecount = 0;
919973 }
920974
921
- if (path.length > 1 && path[1].toLowerCase().endsWith(".jpg"))
975
+ if (path.length > 2 && (path[2].toLowerCase().endsWith(".jpg") || path[2].toLowerCase().endsWith(".png")))
922976 {
923
- if (!added)
977
+ //if (!added)
924978 {
925
- added = true;
926
- resourcecontainer.add(currenttab);
927
- String tabname = String.valueOf((char)('A'+tabcount));
928
- resourcecontainer.setToolTipTextAt(tabcount++, "Texture Group " + tabname);
979
+ //added = true;
980
+ String tabname = path[0]; // String.valueOf((char)('A'+tabcount));
981
+ currenttab = (cGridBag)resourcecontainer.getComponentAt(resourcecontainer.indexOfTab(tabname));
929982 }
930983
931
- AddTextureButton(path[0], path[1], 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++;
991
+
932992 if (++colcount >= columns)
933993 {
934994 colcount = 0;
....@@ -949,10 +1009,12 @@
9491009
9501010 void CreateTexturePanel(cGridBag container)
9511011 {
952
- resourcecontainer = new JTabbedPane();
1012
+ resourcecontainer = new JTabbedPane(JTabbedPane.LEFT);
9531013 container.add(resourcecontainer);
9541014
9551015 Grafreed.ParseResources("textures", this);
1016
+
1017
+ // 935. System.out.println("Total = " + totalcount);
9561018 }
9571019
9581020 void SetupUI2(ObjEditor oe)
....@@ -972,11 +1034,6 @@
9721034 //new Exception().printStackTrace();
9731035
9741036 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;
9801037 // oe.toolbarPanel.add(radioPanel); //, oe.aConstraints);
9811038
9821039 oe.buttonGroup = new ButtonGroup();
....@@ -997,9 +1054,9 @@
9971054 oe.radioPanel.add(dummyButton);
9981055 oe.buttonGroup.add(dummyButton);
9991056 */
1000
- cGridBag copyOptionsPanel = new cGridBag();
1057
+ cGridBag versionManagerPanel = new cGridBag();
10011058
1002
- copyOptionsPanel.preferredHeight = 2;
1059
+ versionManagerPanel.preferredHeight = 4;
10031060
10041061 //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
10051062
....@@ -1009,62 +1066,102 @@
10091066
10101067 if (Globals.ADVANCED)
10111068 {
1012
- oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1013
- maxButton.setToolTipText("Maximize window");
1014
- 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);
10151072 }
10161073
1017
- oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1018
- fullButton.setToolTipText("Full-screen window");
1019
- fullButton.addActionListener(this);
1074
+ cButton gcButton;
10201075
1021
- 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);
10221118 screenfitButton.setToolTipText("Screen fit");
10231119 screenfitButton.addActionListener(this);
10241120
1025
- 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);
10261122 restoreCameraButton.setToolTipText("Restore viewpoint");
10271123 restoreCameraButton.addActionListener(this);
10281124
1029
- 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);
10301126 saveVersionButton.setToolTipText("Duplicate current version");
10311127 saveVersionButton.addActionListener(this);
10321128
1033
- copyOptionsPanel.add(deleteVersionButton = GetButton("icons/trash.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1129
+ versionManagerPanel.add(deleteVersionButton = GetButton("icons/trash.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10341130 deleteVersionButton.setToolTipText("Delete current version");
10351131 deleteVersionButton.addActionListener(this);
1132
+ deleteVersionButton.setEnabled(false);
10361133
1037
- copyOptionsPanel.add(previousVersionButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1134
+ versionManagerPanel.add(previousVersionButton = GetButton("icons/undo.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10381135 previousVersionButton.setToolTipText("Previous version");
10391136 previousVersionButton.addActionListener(this);
10401137 previousVersionButton.setEnabled(false);
10411138
10421139 cGridBag updown = new cGridBag().setVertical(true);
1043
- updown.add(restoreButton = GetButton("icons/restore.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1140
+ updown.add(restoreButton = GetButton("icons/restore.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10441141 restoreButton.setToolTipText("Undo (restore current version)");
10451142 restoreButton.addActionListener(this);
1046
- //restoreButton.setEnabled(false);
1143
+ restoreButton.setEnabled(false);
10471144
1048
- updown.add(replaceButton = GetButton("icons/replace.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1145
+ updown.add(replaceButton = GetButton("icons/replace.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10491146 replaceButton.setToolTipText("Save (replace current version)");
10501147 replaceButton.addActionListener(this);
1051
- //replaceButton.setEnabled(false);
1148
+ replaceButton.setEnabled(false);
10521149
1053
- copyOptionsPanel.add(updown);
1150
+ versionManagerPanel.add(updown);
10541151
1055
- copyOptionsPanel.add(nextVersionButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1152
+ versionManagerPanel.add(nextVersionButton = GetButton("icons/redo.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10561153 nextVersionButton.setToolTipText("Next version");
10571154 nextVersionButton.addActionListener(this);
10581155 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);
10591160
10601161 oe.toolbarPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
10611162 liveCB.setToolTipText("Enable animation");
10621163 liveCB.addItemListener(this);
10631164
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
-
10681165 oe.toolbarPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
10691166 fastCB.setToolTipText("Fast mode");
10701167 fastCB.addItemListener(this);
....@@ -1080,110 +1177,97 @@
10801177
10811178 if (Globals.ADVANCED)
10821179 {
1083
- oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1180
+ oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10841181 snapobjectButton.addActionListener(this);
10851182 snapobjectButton.setToolTipText("Snap Object");
10861183
1087
- 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);
10881185 fourButton.addActionListener(this);
10891186 fourButton.setToolTipText("Show control panel only");
10901187 }
10911188
10921189 //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
10931190
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
- //
11091191
1110
- 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);
11111193 rootButton.setToolTipText("Open selection in new tab");
11121194 rootButton.addActionListener(this);
11131195
1114
- 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);
11151197 closeButton.setToolTipText("Close tab");
11161198 closeButton.addActionListener(this);
11171199 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
11181200 //clearButton.addActionListener(this);
11191201
11201202 cGridBag row1 = new cGridBag();
1203
+ row1.preferredHeight = 8;
11211204
11221205 // INSERT
1123
- row1.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1124
- gridButton.setToolTipText("Create grid");
1206
+ row1.add(gridButton = GetButton("icons/grid.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1207
+ gridButton.setToolTipText("Create ground");
11251208 gridButton.addActionListener(this);
11261209
1127
- row1.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1210
+ row1.add(boxButton = GetButton("icons/box.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11281211 boxButton.setToolTipText("Create box");
11291212 boxButton.addActionListener(this);
11301213
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);
1214
+ row1.add(superButton = GetButton("icons/super.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11441215 superButton.setToolTipText("Create superellipsoid");
11451216 superButton.addActionListener(this);
11461217
1147
- 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)
11481231 {
1149
- 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);
11501233 kleinButton.setToolTipText("Create Klein bottle");
11511234 kleinButton.addActionListener(this);
11521235 }
11531236
1154
- row1.add(particlesButton = GetButton("icons/particles.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1237
+ row1.add(particlesButton = GetButton("icons/particles.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11551238 particlesButton.setToolTipText("Create particle system");
11561239 particlesButton.addActionListener(this);
11571240
11581241 oe.toolboxPanel.add(row1);
11591242
11601243 cGridBag row2 = new cGridBag();
1244
+ row2.preferredHeight = 8;
11611245
1162
- row2.add(groupButton = GetButton("icons/group.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1246
+ row2.add(groupButton = GetButton("icons/group.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11631247 groupButton.setToolTipText("Create group");
11641248 groupButton.addActionListener(this);
11651249
1166
- row2.add(compositeButton = GetButton("icons/composite.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1250
+ row2.add(compositeButton = GetButton("icons/composite.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11671251 compositeButton.setToolTipText("Create composite");
11681252 compositeButton.addActionListener(this);
11691253
1170
- row2.add(switchButton = GetButton("icons/switch.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1254
+ row2.add(switchButton = GetButton("icons/switch.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11711255 switchButton.setToolTipText("Create item switcher");
11721256 switchButton.addActionListener(this);
11731257
1174
- row2.add(loopButton = GetButton("icons/loop.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1258
+ row2.add(loopButton = GetButton("icons/loop.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11751259 loopButton.setToolTipText("Create loop");
11761260 loopButton.addActionListener(this);
11771261
1178
- row2.add(textureButton = GetButton("icons/texture.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1262
+ row2.add(textureButton = GetButton("icons/texture.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11791263 textureButton.setToolTipText("Create texture");
11801264 textureButton.addActionListener(this);
11811265
1182
- row2.add(overlayButton = GetButton("icons/overlay.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1266
+ row2.add(overlayButton = GetButton("icons/overlay.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11831267 overlayButton.setToolTipText("Create overlay");
11841268 overlayButton.addActionListener(this);
11851269
1186
- 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);
11871271 lightButton.setToolTipText("Create light");
11881272 lightButton.addActionListener(this);
11891273
....@@ -1193,6 +1277,11 @@
11931277
11941278 CreateTexturePanel(textures);
11951279
1280
+ int tabCount = resourcecontainer.getTabCount();
1281
+
1282
+ if (tabCount > 0)
1283
+ resourcecontainer.setSelectedIndex((int)(Math.random() * tabCount));
1284
+
11961285 oe.toolboxPanel.add(textures);
11971286
11981287 textures.preferredHeight = 100;
....@@ -1200,11 +1289,11 @@
12001289 CreateSkyboxPanel(oe.skyboxPanel);
12011290
12021291 // EDIT panel
1203
- editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1292
+ editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12041293 editButton.setToolTipText("Pin selection controls");
12051294 editButton.addActionListener(this);
12061295
1207
- editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1296
+ editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12081297 uneditButton.setToolTipText("Unpin and remove selection controls");
12091298 uneditButton.addActionListener(this);
12101299
....@@ -1212,7 +1301,7 @@
12121301 allParamsButton.setToolTipText("Show all controls");
12131302 allParamsButton.addActionListener(this);
12141303
1215
- editCommandsPanel.add(clearPanelButton = GetButton("icons/clear.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1304
+ editCommandsPanel.add(clearPanelButton = GetButton("icons/clear.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12161305 clearPanelButton.setToolTipText("Clear all controls");
12171306 clearPanelButton.addActionListener(this);
12181307
....@@ -1220,7 +1309,7 @@
12201309 //unselectButton.setToolTipText("Unselect");
12211310 //unselectButton.addActionListener(this);
12221311
1223
- 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);
12241313 flashSelectionButton.setToolTipText("Highlight selection");
12251314 flashSelectionButton.addActionListener(this);
12261315
....@@ -1243,6 +1332,8 @@
12431332
12441333 cGridBag jSPPanel = new cGridBag();
12451334
1335
+ jSPPanel.preferredHeight = 20;
1336
+
12461337 JScrollPane jSP;
12471338 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
12481339 jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
....@@ -1251,11 +1342,12 @@
12511342 oe.treePanel.add(jSPPanel);
12521343 oe.treePanel.Return();
12531344
1254
- oe.treePanel.add(copyOptionsPanel);
1345
+ oe.treePanel.add(versionManagerPanel);
12551346 oe.treePanel.Return();
1256
- cGridBag sliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
1257
- versionSlider = (cNumberSlider)sliderPane.getComponent(1);
1258
- sliderPane.preferredHeight = 1;
1347
+
1348
+ versionSliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
1349
+ versionSlider = (cNumberSlider)versionSliderPane.getComponent(1);
1350
+ versionSliderPane.preferredHeight = 3;
12591351
12601352 // mainPanel.setDividerLocation(0.1); //1.0);
12611353 mainPanel.setResizeWeight(0.4);
....@@ -1312,7 +1404,7 @@
13121404 // supportCB.setToolTipText("Enable rigging");
13131405 // supportCB.addItemListener(this);
13141406
1315
- panel.add(freezeCB = new cCheckBox("Freeze", Globals.FREEZEONMOVE)); //, constraints);
1407
+ panel.add(freezeCB = new cCheckBox("Fast cam", Globals.FREEZEONMOVE)); //, constraints);
13161408 freezeCB.setToolTipText("Fast moving camera");
13171409 freezeCB.addItemListener(this);
13181410
....@@ -1321,9 +1413,12 @@
13211413
13221414 panel.Return();
13231415
1416
+ if (Globals.ADVANCED)
1417
+ {
13241418 panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD)); //, constraints);
13251419 crowdCB.setToolTipText("Used for crowds");
13261420 crowdCB.addItemListener(this);
1421
+ }
13271422
13281423 panel.add(smoothCB = new cCheckBox("Inertia", CameraPane.INERTIA)); //, constraints);
13291424 smoothCB.setToolTipText("Snapping delay");
....@@ -1336,30 +1431,26 @@
13361431 minshaderCB.setToolTipText("Minimal fast shader");
13371432 minshaderCB.addItemListener(this);
13381433
1339
-// constraints.gridy += 1;
13401434 // panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
13411435 // speakerMocapCB.addItemListener(this);
13421436
1343
- panel.Return();
1344
-
13451437 if (false)
13461438 {
13471439 // handled in scripts
1348
- //constraints.gridy += 1;
13491440 panel.add(speakerCameraCB = new cCheckBox("Cam", CameraPane.SPEAKERCAMERA)); //, constraints);
13501441 speakerCameraCB.addItemListener(this);
13511442
1352
- //constraints.gridy += 1;
13531443 panel.add(speakerFocusCB = new cCheckBox("Focus", CameraPane.SPEAKERFOCUS)); //, constraints);
13541444 speakerFocusCB.addItemListener(this);
13551445
1356
- //constraints.gridy += 1;
1357
- panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints);
1358
- smoothfocusCB.addItemListener(this);
13591446 panel.Return();
13601447 }
13611448
1362
-//constraints.gridx += 1;
1449
+ panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints);
1450
+ smoothfocusCB.addItemListener(this);
1451
+
1452
+ panel.Return();
1453
+
13631454 //panel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), constraints);
13641455 // debugCB.addItemListener(this);
13651456
....@@ -1413,6 +1504,14 @@
14131504
14141505 void EditObject(Object3D obj)
14151506 {
1507
+ //assert(obj instanceof Composite);
1508
+
1509
+// if (obj.versionlist == null)
1510
+// {
1511
+// obj.versionlist = new Object3D[100];
1512
+// obj.versionindex = -1;
1513
+// }
1514
+
14161515 cRadio radioButton = new cRadio(obj.name);
14171516
14181517 // June 2019. Patch to avoid bug with transparency.
....@@ -1437,6 +1536,7 @@
14371536
14381537 oe.SetupViews();
14391538
1539
+ if (Globals.DEBUG)
14401540 System.out.println("SetupViews");
14411541 DragSource.getDefaultDragSource().createDefaultDragGestureRecognizer(
14421542 oe.cameraView, DnDConstants.ACTION_COPY_OR_MOVE, this); // ACTION_LINK ??
....@@ -1803,7 +1903,12 @@
18031903 TreePath path;
18041904
18051905 public TransferableTreePath(TreePath tp) {
1806
- 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);
18071912 }
18081913
18091914 public synchronized DataFlavor[] getTransferDataFlavors() {
....@@ -1984,7 +2089,7 @@
19842089 Object3D obj = (Object3D)group.selection.elementAt(0);
19852090 objEditor.ScreenFit(obj, false);
19862091
1987
- cameraView.pingthread.StepToTarget(true);
2092
+ cameraView.pingthread.StepToTarget(); //true);
19882093 refreshContents();
19892094 }
19902095
....@@ -2021,7 +2126,7 @@
20212126 obj.parent.TransformToWorld(maxima); //, maxima);
20222127 }
20232128
2024
- Object3D shadow = new Object3D("Shadow " + obj.name);
2129
+ Object3D shadow = new Object3D("Shadow" + obj.name);
20252130
20262131 shadow.toParent = LA.newMatrix();
20272132 shadow.fromParent = LA.newMatrix();
....@@ -2035,24 +2140,24 @@
20352140 switch(axis)
20362141 {
20372142 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;
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;
20422147 norm = cVector.X;
20432148 break;
20442149 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;
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;
20492154 norm = cVector.Y;
20502155 break;
20512156 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;
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;
20562161 norm = cVector.Z;
20572162 break;
20582163 }
....@@ -2093,7 +2198,11 @@
20932198 shadow.material = new cMaterial(obj.material);
20942199 shadow.material.diffuse = 0.0001f;
20952200 shadow.material.specular = 0.0001f;
2096
- //shadow.projectedVertices[1].x = 300;
2201
+ shadow.material.opacity = 0.75f;
2202
+
2203
+ AllocProjectedVertices(shadow);
2204
+
2205
+ shadow.projectedVertices[1].x = 300;
20972206
20982207 makeSomething(shadow);
20992208 }
....@@ -2614,27 +2723,35 @@
26142723 } else
26152724 if (source == loopItem || source == loopButton)
26162725 {
2726
+ if (!group.selection.isEmpty())
2727
+ {
26172728 Composite csg = new GroupLeaf();
2618
- csg.count = 5;
26192729 group(csg);
2730
+ csg.count = 5;
26202731 Composite child = new cGroup("Branch");
26212732 csg.addChild(child);
26222733 child.addChild(csg);
2734
+ }
26232735 } else
26242736 if (source == doubleItem)
26252737 {
2738
+ if (!group.selection.isEmpty())
2739
+ {
26262740 Composite csg = new GroupLeaf("Fork");
2627
- csg.count = 5;
26282741 group(csg);
2742
+ csg.count = 5;
26292743 Composite child = new cGroup("Branch A");
26302744 csg.addChild(child);
26312745 child.addChild(csg);
26322746 child = new cGroup("Branch B");
26332747 csg.addChild(child);
26342748 child.addChild(csg);
2749
+ }
26352750 } else
26362751 if (source == tripleItem)
26372752 {
2753
+ if (!group.selection.isEmpty())
2754
+ {
26382755 Composite csg = new GroupLeaf("Trident");
26392756 csg.count = 4;
26402757 group(csg);
....@@ -2647,6 +2764,7 @@
26472764 child = new cGroup();
26482765 csg.addChild(child);
26492766 child.addChild(csg);
2767
+ }
26502768 } else
26512769 if (source == computeAOItem)
26522770 {
....@@ -2693,10 +2811,22 @@
26932811 {
26942812 Maximize();
26952813 } else
2696
- if (source == fullButton)
2814
+ if (source == fullScreenButton)
26972815 {
26982816 ToggleFullScreen();
26992817 } 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
27002830 if (source == previousVersionButton)
27012831 {
27022832 // Go to previous version
....@@ -2724,7 +2854,7 @@
27242854 if (source == saveVersionButton)
27252855 {
27262856 // Save a new version
2727
- if (!Save(true))
2857
+ if (!DuplicateVersion()) //true))
27282858 java.awt.Toolkit.getDefaultToolkit().beep();
27292859 } else
27302860 if (source == deleteVersionButton)
....@@ -3270,22 +3400,34 @@
32703400 } else
32713401 if (source == ungroupItem || source == ungroupButton)
32723402 {
3273
- boolean hasRoot = false;
3403
+ boolean canUngroup = true;
32743404
32753405 for (int i=0; i<group.selection.size(); i++)
32763406 {
3277
- if (group.selection.get(i) == group)
3407
+ Object3D selectedItem = group.selection.get(i);
3408
+
3409
+ if (selectedItem.Size() == 0)
32783410 {
3279
- 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;
32803420 break;
32813421 }
32823422 }
32833423
3284
- if (!hasRoot)
3424
+ if (canUngroup)
32853425 {
32863426 for (int i=0; i<group.selection.size(); i++)
32873427 {
3288
- Ungroup(group.selection.get(i));
3428
+ Object3D selectedItem = group.selection.get(i);
3429
+
3430
+ Ungroup(selectedItem);
32893431 }
32903432
32913433 ClearSelection(false);
....@@ -3336,6 +3478,10 @@
33363478 if (source == clearMaterialsItem)
33373479 {
33383480 ClearMaterials();
3481
+ } else
3482
+ if (source == clearVersionsItem)
3483
+ {
3484
+ ClearVersions();
33393485 } else
33403486 if (source == liveleavesItem)
33413487 {
....@@ -3476,6 +3622,18 @@
34763622 if (source == transformChildrenItem)
34773623 {
34783624 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);
34793637 } else
34803638 if (source == resetTransformItem)
34813639 {
....@@ -3648,38 +3806,7 @@
36483806 if (CameraPane.FULLSCREEN)
36493807 fullscreenLayout = radio.layout;
36503808
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();
3809
+ Show3DView();
36833810
36843811 cameraView.requestFocusInWindow();
36853812
....@@ -3865,6 +3992,7 @@
38653992 } else
38663993 if (source == rootButton)
38673994 {
3995
+ Replace();
38683996 Object3D obj;
38693997 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
38703998 {
....@@ -3879,6 +4007,9 @@
38794007 if (source == closeButton)
38804008 {
38814009 //System.out.println("CLOSE: " + buttonGroup.getSelection());
4010
+ if (copy.versionlist != null)
4011
+ Replace();
4012
+
38824013 cRadio ab;
38834014 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
38844015 {
....@@ -3977,6 +4108,9 @@
39774108 } else
39784109 if(source instanceof cRadio)
39794110 {
4111
+ if (copy.versionlist != null)
4112
+ Replace();
4113
+
39804114 group.parent = keepparent;
39814115 group.attributes = 0;
39824116 //group.editWindow = null;
....@@ -4001,8 +4135,6 @@
40014135
40024136 copy = group;
40034137
4004
- SetUndoStates();
4005
-
40064138 //Globals.theRenderer.object = group;
40074139 if(!useclient)
40084140 {
....@@ -4030,6 +4162,32 @@
40304162 */
40314163 radio.layout.doClick();
40324164
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
+
40334191 ClearUnpinned();
40344192
40354193 //Grafreed.Assert(group != null);
....@@ -4143,9 +4301,46 @@
41434301 refreshContents();
41444302 }
41454303
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
+
41464316 void ResetTransform()
41474317 {
41484318 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();
41494344 }
41504345
41514346 void ResetTransform(int mask)
....@@ -4158,42 +4353,8 @@
41584353 if (obj.toParent == null)
41594354 continue;
41604355
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
- }
4356
+ obj.ResetTransform(mask);
4357
+
41974358 if (obj.parent == null)
41984359 {
41994360 System.out.println("NULL PARENT!");
....@@ -4702,10 +4863,17 @@
47024863 {
47034864 Object3D obj = group.selection.get(i);
47044865
4866
+ if (obj.toParent == null)
4867
+ {
4868
+ obj.toParent = LA.newMatrix();
4869
+ obj.fromParent = LA.newMatrix();
4870
+ }
4871
+
47054872 LA.matTranslate(obj.toParent, i * scale, 0, 0);
47064873 LA.matTranslateInv(obj.fromParent, -i * scale, 0, 0);
47074874 }
47084875
4876
+ Globals.lighttouched = true;
47094877 refreshContents();
47104878 }
47114879
....@@ -4993,6 +5161,12 @@
49935161 refreshContents();
49945162 }
49955163
5164
+ void ClearVersions()
5165
+ {
5166
+ group.selection.ClearVersions();
5167
+ refreshContents();
5168
+ }
5169
+
49965170 void FlipV(boolean flip)
49975171 {
49985172 group.selection.FlipV(flip);
....@@ -5231,10 +5405,10 @@
52315405 if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
52325406 // a camera
52335407 {
5234
- 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
52355409 {
52365410 CameraPane.camerachangeframe = 0; // don't refuse it
5237
- Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
5411
+ Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent(), true);
52385412 }
52395413 // Globals.theRenderer.renderCamera = Globals.theRenderer.manipCamera;
52405414 // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
....@@ -5264,10 +5438,26 @@
52645438 flashSelectionButton.setEnabled(enabled);
52655439
52665440 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);
52675456 }
52685457
52695458 void refreshContents(boolean cp)
52705459 {
5460
+ if (Globals.SHOWINFO)
52715461 //if (objectPanel.getSelectedIndex() == 2) // objectPanel.indexOfTab("Info"))
52725462 if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
52735463 {
....@@ -5278,7 +5468,7 @@
52785468 Object3D child = (Object3D) group.selection.get(i);
52795469
52805470 objEditor.AddInfo(child, this, true);
5281
- System.err.println("info : " + child.GetPath());
5471
+// System.err.println("info : " + child.GetPath());
52825472 }
52835473
52845474 objEditor.SetText(); // jan 2014
....@@ -6161,11 +6351,11 @@
61616351 private MenuItem lookAtItem;
61626352 private MenuItem lookFromItem;
61636353 private MenuItem switchViewItem;
6164
- private MenuItem cutItem;
6354
+ private JMenuItem cutItem;
61656355 private MenuItem undoItem;
61666356 private MenuItem redoItem;
61676357 private JMenuItem duplicateItem;
6168
- private MenuItem cloneItem;
6358
+ private JMenuItem cloneItem;
61696359 private MenuItem cloneSupportItem;
61706360 private MenuItem overwriteGeoItem;
61716361 private MenuItem overwriteMatItem;
....@@ -6186,13 +6376,13 @@
61866376 private MenuItem cloneGeometriesItem;
61876377 private MenuItem shareGeometriesItem;
61886378 private MenuItem mergeGeometriesItem;
6189
- private MenuItem copyItem;
6379
+ private JMenuItem copyItem;
61906380 private MenuItem pasteItem;
6191
- private MenuItem pasteIntoItem;
6192
- private MenuItem pasteLinkItem;
6193
- private MenuItem pasteCloneItem;
6194
- private MenuItem pasteExpandItem;
6195
- private MenuItem deleteItem;
6381
+ private JMenuItem pasteIntoItem;
6382
+ private JMenuItem pasteLinkItem;
6383
+ private JMenuItem pasteCloneItem;
6384
+ private JMenuItem pasteExpandItem;
6385
+ private JMenuItem deleteItem;
61966386 private MenuItem clearAllItem;
61976387 private MenuItem genUVItem;
61986388 private MenuItem genNormalsMESHItem;
....@@ -6218,6 +6408,7 @@
62186408 private MenuItem clipMeshItem;
62196409 private MenuItem smoothMeshItem;
62206410 private MenuItem clearMaterialsItem;
6411
+ private MenuItem clearVersionsItem;
62216412
62226413 private MenuItem liveleavesItem;
62236414 private MenuItem unliveleavesItem;
....@@ -6241,13 +6432,16 @@
62416432 private MenuItem maxTexturesItem;
62426433 private MenuItem panoTexturesItem;
62436434
6435
+ private MenuItem textureRatioRItem;
6436
+ private MenuItem textureRatioGItem;
6437
+ private MenuItem textureRatioBItem;
62446438 private MenuItem resetCentroidItem;
62456439 private MenuItem resetCentroidXZItem;
62466440 private MenuItem resetTransformItem;
62476441 private MenuItem transformGeometryItem;
62486442 private MenuItem transformChildrenItem;
62496443 private MenuItem hideItem;
6250
- private MenuItem grabItem;
6444
+ private JMenuItem grabItem;
62516445 private MenuItem backItem;
62526446 private MenuItem frontItem;
62536447 private MenuItem cameraItem;
....@@ -6260,7 +6454,7 @@
62606454 private MenuItem switchTransfoItem;
62616455 private MenuItem morphItem;
62626456 private MenuItem linkerItem;
6263
- private MenuItem ungroupItem;
6457
+ private JMenuItem ungroupItem;
62646458 private MenuItem editItem;
62656459 private MenuItem openWindowItem;
62666460 private MenuItem editLeafItem;