Normand Briere
2019-09-20 cbe4e90105d07d7d3fecabffaa01342403aa2ae3
GroupEditor.java
....@@ -16,7 +16,7 @@
1616 //import buoy.widget.BFileChooser;
1717
1818 class GroupEditor extends ObjEditor implements //iParse, //iCallBack,
19
- Grafreed.iResourceCallBack,
19
+ Grafreed.iResourceCallBack,
2020 ObjectUI,
2121 Runnable,
2222 ActionListener,
....@@ -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,6 +42,22 @@
4242 });
4343 }
4444
45
+ public void AddTextureButton(String f, String c, final String t, int count, cGridBag row)
46
+ {
47
+ cButton textureButton;
48
+ final String path = "textures/" + f + "/" + c + "/"; // + t;
49
+ row.add(textureButton = GetButton(path + "icons/" + t, !Globals.NIMBUSLAF));
50
+ textureButton.setToolTipText(c + count);
51
+ textureButton.addActionListener(new ActionListener()
52
+ {
53
+ @Override
54
+ public void actionPerformed(ActionEvent e)
55
+ {
56
+ ChangeTexture(path + t);
57
+ }
58
+ });
59
+ }
60
+
4561 public void AddSkyboxTab0(JTabbedPane skyboxpanel)
4662 {
4763 cGridBag tab0 = new cGridBag().setVertical(true);
....@@ -57,7 +73,7 @@
5773 cGridBag row5 = new cGridBag();
5874 cGridBag row6 = new cGridBag();
5975
60
- AddSkyboxButton("default", "rgb", row0);
76
+ AddSkyboxButton("default", "", row0);
6177 //AddSkyboxButton("default", "cornell", row0);
6278 AddSkyboxButton("penguins", "dust", row0);
6379 AddSkyboxButton("penguins", "tropic", row0);
....@@ -312,26 +328,46 @@
312328 }
313329 }
314330
315
- public void CallBack(String[] path)
316
- {
317
- for (int i = 0; i < path.length; i++)
318
- {
319
- System.out.print(path[i] + "/");
320
- }
321
-
322
- System.out.println();
323
- }
324
-
325331 public void ChangeSkybox(String skybox)
326332 {
327
- //cameraView.envyoff = false;
328
- group.skyboxname = skybox;
329
- group.skyboxext = "jpg";
330
- 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
+ }
346
+ }
331347
332
- Grafreed.ParseResources("textures", this);
348
+ public void CreateSkyboxPanel(cGridBag skyboxPanel)
349
+ {
350
+ JTabbedPane skyboxpane = new JTabbedPane(JTabbedPane.LEFT);
351
+
352
+ AddSkyboxTab0(skyboxpane);
353
+ AddSkyboxTab1(skyboxpane);
354
+ AddSkyboxTab2(skyboxpane);
355
+ AddSkyboxTab3(skyboxpane);
356
+
357
+ skyboxPanel.add(skyboxpane);
333358 }
334359
360
+ public void ChangeTexture(String texture)
361
+ {
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();
369
+ }
370
+
335371 //ObjEditor objEditor;
336372 public void closeUI2()
337373 {
....@@ -369,11 +405,15 @@
369405 this.copy = this.group = group;
370406 //selectees = this.group.selectees;
371407
372
- if (copy.versionlist == null)
373
- {
374
- copy.versionlist = new Object3D[100];
375
- copy.versionindex = -1;
376
- }
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
+// }
377417
378418 if(ui)
379419 SetupUI(objEditor);
....@@ -396,13 +436,13 @@
396436
397437 ((cRadio)radioPanel.getComponent(0)).SetCamera(cameraView.renderCamera, true);
398438
399
- if (copy.versionlist == null)
400
- {
401
- copy.versionlist = new Object3D[100];
402
- copy.versionindex = -1;
403
-
404
- Save(true);
405
- }
439
+// if (copy.versionlist == null)
440
+// {
441
+// copy.versionlist = new Object3D[100];
442
+// copy.versionindex = -1;
443
+//
444
+// //Save(true);
445
+// }
406446 }
407447
408448 void CloneSelection(boolean supports)
....@@ -443,11 +483,16 @@
443483
444484 Object3D parent = obj.parent;
445485 obj.parent = null;
486
+
446487 // Object3D support = obj.support;
447488 // obj.support = null;
448489 if (!supports)
449490 obj.SaveSupports();
491
+
450492 Object3D clone = (Object3D)Grafreed.clone(obj);
493
+
494
+ clone.ResetUUIDs();
495
+
451496 obj.parent = parent;
452497 // obj.support = support;
453498 // clone.support = support; // aout 2013
....@@ -492,33 +537,37 @@
492537 // menu.add("-");
493538 duplicateItem = oe.jTree.popup.add(new JMenuItem("Duplicate"));
494539 duplicateItem.addActionListener(this);
495
- cloneItem = menu.add(new MenuItem("Clone"));
540
+
541
+ cloneItem = oe.jTree.popup.add(new JMenuItem("Clone"));
496542 cloneItem.addActionListener(this);
497
- if (Globals.ADVANCED)
543
+ //if (Globals.ADVANCED)
498544 {
499545 cloneSupportItem = menu.add(new MenuItem("Clone (+supports)"));
500546 cloneSupportItem.addActionListener(this);
501547 }
548
+ oe.jTree.popup.addSeparator();
502549 menu.add("-");
503
- cutItem = menu.add(new MenuItem("Cut"));
550
+ cutItem = oe.jTree.popup.add(new JMenuItem("Cut"));
504551 cutItem.addActionListener(this);
505
- copyItem = menu.add(new MenuItem("Copy"));
552
+ copyItem = oe.jTree.popup.add(new JMenuItem("Copy"));
506553 copyItem.addActionListener(this);
507554 pasteItem = menu.add(new MenuItem("Paste"));
508555 pasteItem.addActionListener(this);
509556
510
- menu.add("-");
511
- 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"));
512560 pasteIntoItem.addActionListener(this);
513
- pasteLinkItem = menu.add(new MenuItem("Paste link"));
561
+ pasteLinkItem = oe.jTree.popup.add(new JMenuItem("Paste link"));
514562 pasteLinkItem.addActionListener(this);
515
- pasteCloneItem = menu.add(new MenuItem("Paste clone"));
563
+ pasteCloneItem = oe.jTree.popup.add(new JMenuItem("Paste clone"));
516564 pasteCloneItem.addActionListener(this);
517
-// pasteExpandItem = menu.add(new MenuItem("Paste expand"));
518
-// pasteExpandItem.addActionListener(this);
519
- menu.add("-");
520
- deleteItem = menu.add(new MenuItem("Delete"));
521
- 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();
522571
523572 if (Globals.ADVANCED)
524573 {
....@@ -604,11 +653,9 @@
604653 oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest"));
605654 //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection"));
606655 //cameraMenu.add(switchViewItem = new MenuItem("Reverse View"));
607
- editLeafItem = oe.cameraMenu.add(new MenuItem("Edit Leaf"));
608656 oe.cameraMenu.add("-");
609657 openWindowItem = oe.cameraMenu.add(new MenuItem("Edit copy..."));
610658 openWindowItem.addActionListener(this);
611
- editLeafItem.addActionListener(this);
612659 lookAtItem.addActionListener(this);
613660 //lookFromItem.addActinoListener(this);
614661 //switchViewItem.addActionListener(this);
....@@ -655,9 +702,8 @@
655702 setMasterItem.addActionListener(this);
656703 }
657704
658
- oe.menuBar.add(menu = new Menu("Group"));
659
-// grabItem = menu.add(new MenuItem("Grab"));
660
-// grabItem.addActionListener(this);
705
+ oe.menuBar.add(menu = new Menu("Order"));
706
+
661707 backItem = menu.add(new MenuItem("Back"));
662708 backItem.addActionListener(this);
663709 frontItem = menu.add(new MenuItem("Front"));
....@@ -665,13 +711,21 @@
665711 // compositeItem = menu.add(new MenuItem("Composite"));
666712 // compositeItem.addActionListener(this);
667713
714
+ grabItem = oe.jTree.popup.add(new JMenuItem("Group"));
715
+ grabItem.addActionListener(this);
716
+
668717 if (Globals.ADVANCED)
669718 {
670719 hideItem = menu.add(new MenuItem("Hidden Group"));
671720 hideItem.addActionListener(this);
672721 }
673
- ungroupItem = menu.add(new MenuItem("Ungroup"));
722
+ ungroupItem = oe.jTree.popup.add(new JMenuItem("Ungroup"));
674723 ungroupItem.addActionListener(this);
724
+
725
+ oe.jTree.popup.addSeparator();
726
+
727
+ deleteItem = oe.jTree.popup.add(new JMenuItem("Delete"));
728
+ deleteItem.addActionListener(this);
675729
676730 // menu.add("-");
677731 //
....@@ -708,9 +762,9 @@
708762 shadowYItem.addActionListener(this);
709763 shadowZItem = menu.add(new MenuItem("Shadow Blue"));
710764 shadowZItem.addActionListener(this);
765
+
711766 attributeItem = menu.add(new MenuItem("Attribute"));
712767 attributeItem.addActionListener(this);
713
-
714768 if (Globals.ADVANCED)
715769 {
716770 menu.add("-");
....@@ -722,11 +776,18 @@
722776 pointflowItem.addActionListener(this);
723777 }
724778 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("-");
725786 resetTransformItem = menu.add(new MenuItem("Reset Transform"));
726787 resetTransformItem.addActionListener(this);
727788 resetCentroidItem = menu.add(new MenuItem("Reset Centroid"));
728789 resetCentroidItem.addActionListener(this);
729
- resetCentroidXZItem = menu.add(new MenuItem("Reset Centroid XY"));
790
+ resetCentroidXZItem = menu.add(new MenuItem("Reset Centroid XZ"));
730791 resetCentroidXZItem.addActionListener(this);
731792 transformGeometryItem = menu.add(new MenuItem("Transform Geometry"));
732793 transformGeometryItem.addActionListener(this);
....@@ -742,7 +803,7 @@
742803 genNormalsCADItem.addActionListener(this);
743804 genNormalsMESHItem = menu.add(new MenuItem("Mesh Normals"));
744805 genNormalsMESHItem.addActionListener(this);
745
- if (Globals.ADVANCED)
806
+ //if (Globals.ADVANCED)
746807 {
747808 genNormalsMINEItem = menu.add(new MenuItem("Stitch Normals"));
748809 genNormalsMINEItem.addActionListener(this);
....@@ -778,6 +839,8 @@
778839 }
779840
780841 oe.menuBar.add(menu = new Menu("Attributes"));
842
+ clearVersionsItem = menu.add(new MenuItem("Clear Versions"));
843
+ clearVersionsItem.addActionListener(this);
781844 clearMaterialsItem = menu.add(new MenuItem("Clear Materials"));
782845 clearMaterialsItem.addActionListener(this);
783846 resetAllItem = menu.add(new MenuItem("Reset All"));
....@@ -800,9 +863,9 @@
800863 hideleavesItem.addActionListener(this);
801864 showleavesItem = menu.add(new MenuItem("Show Leaves"));
802865 showleavesItem.addActionListener(this);
803
- markleavesItem = menu.add(new MenuItem("Mark Leaves"));
866
+ markleavesItem = menu.add(new MenuItem("Anim Leaves"));
804867 markleavesItem.addActionListener(this);
805
- unmarkleavesItem = menu.add(new MenuItem("Unmark Leaves"));
868
+ unmarkleavesItem = menu.add(new MenuItem("Unanim Leaves"));
806869 unmarkleavesItem.addActionListener(this);
807870 rewindleavesItem = menu.add(new MenuItem("Rewind Leaves"));
808871 rewindleavesItem.addActionListener(this);
....@@ -856,6 +919,9 @@
856919 shareGeometriesItem.addActionListener(this);
857920 mergeGeometriesItem = menu.add(new MenuItem("Merge Geometries"));
858921 mergeGeometriesItem.addActionListener(this);
922
+ menu.add("-");
923
+ editLeafItem = menu.add(new MenuItem("Edit leaf..."));
924
+ editLeafItem.addActionListener(this);
859925 if (Globals.ADVANCED)
860926 {
861927 // Pretty much the same as duplicate and clone.
....@@ -872,6 +938,84 @@
872938 buildToolsMenu(menu);
873939 }
874940
941
+ JTabbedPane resourcecontainer;
942
+ cGridBag currenttab;
943
+ //boolean added; // patch for jar
944
+
945
+ int totalcount = 0;
946
+
947
+ int tabcount = 0;
948
+ int colcount = 0;
949
+ int rowcount = 0;
950
+ int texturecount = 0;
951
+
952
+ int columns = 5;
953
+ int rows = 7;
954
+
955
+ public void ResourceCallBack(String[] path)
956
+ {
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"))
963
+ {
964
+ currenttab = new cGridBag();
965
+ String tabname = path[0]; // String.valueOf((char)('A'+tabcount));
966
+ currenttab.setName(tabname);
967
+ //added = false;
968
+ resourcecontainer.add(currenttab);
969
+ resourcecontainer.setToolTipTextAt(tabcount++, "Texture " + tabname);
970
+ rowcount = 1;
971
+ colcount = 0;
972
+ texturecount = 0;
973
+ }
974
+
975
+ if (path.length > 2 && (path[2].toLowerCase().endsWith(".jpg") || path[2].toLowerCase().endsWith(".png")))
976
+ {
977
+ //if (!added)
978
+ {
979
+ //added = true;
980
+ String tabname = path[0]; // String.valueOf((char)('A'+tabcount));
981
+ currenttab = (cGridBag)resourcecontainer.getComponentAt(resourcecontainer.indexOfTab(tabname));
982
+ }
983
+
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
+
992
+ if (++colcount >= columns)
993
+ {
994
+ colcount = 0;
995
+ currenttab.Return();
996
+
997
+ if (rowcount++ >= rows)
998
+ {
999
+ rowcount = 0;
1000
+ }
1001
+ }
1002
+ }
1003
+ else
1004
+ {
1005
+// if (!path[path.length-1].equals("icons"))
1006
+// resourcecontainer.Return();
1007
+ }
1008
+ }
1009
+
1010
+ void CreateTexturePanel(cGridBag container)
1011
+ {
1012
+ resourcecontainer = new JTabbedPane(JTabbedPane.LEFT);
1013
+ container.add(resourcecontainer);
1014
+
1015
+ Grafreed.ParseResources("textures", this);
1016
+
1017
+ // 935. System.out.println("Total = " + totalcount);
1018
+ }
8751019
8761020 void SetupUI2(ObjEditor oe)
8771021 {
....@@ -890,11 +1034,6 @@
8901034 //new Exception().printStackTrace();
8911035
8921036 oe.radioPanel = new JPanel(new GridBagLayout());
893
- oe.aConstraints.weightx = 1;
894
- oe.aConstraints.weighty = 0;
895
- oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
896
- oe.aConstraints.gridwidth = 100;
897
- oe.aConstraints.gridheight = 1;
8981037 // oe.toolbarPanel.add(radioPanel); //, oe.aConstraints);
8991038
9001039 oe.buttonGroup = new ButtonGroup();
....@@ -915,9 +1054,9 @@
9151054 oe.radioPanel.add(dummyButton);
9161055 oe.buttonGroup.add(dummyButton);
9171056 */
918
- cGridBag copyOptionsPanel = new cGridBag();
1057
+ cGridBag versionManagerPanel = new cGridBag();
9191058
920
- copyOptionsPanel.preferredHeight = 2;
1059
+ versionManagerPanel.preferredHeight = 4;
9211060
9221061 //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
9231062
....@@ -927,62 +1066,102 @@
9271066
9281067 if (Globals.ADVANCED)
9291068 {
930
- oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
931
- maxButton.setToolTipText("Maximize window");
932
- 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);
9331072 }
9341073
935
- oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
936
- fullButton.setToolTipText("Full-screen window");
937
- fullButton.addActionListener(this);
1074
+ cButton gcButton;
9381075
939
- 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);
9401118 screenfitButton.setToolTipText("Screen fit");
9411119 screenfitButton.addActionListener(this);
9421120
943
- 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);
9441122 restoreCameraButton.setToolTipText("Restore viewpoint");
9451123 restoreCameraButton.addActionListener(this);
9461124
947
- 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);
9481126 saveVersionButton.setToolTipText("Duplicate current version");
9491127 saveVersionButton.addActionListener(this);
9501128
951
- copyOptionsPanel.add(deleteVersionButton = GetButton("icons/trash.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1129
+ versionManagerPanel.add(deleteVersionButton = GetButton("icons/trash.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
9521130 deleteVersionButton.setToolTipText("Delete current version");
9531131 deleteVersionButton.addActionListener(this);
1132
+ deleteVersionButton.setEnabled(false);
9541133
955
- copyOptionsPanel.add(previousVersionButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1134
+ versionManagerPanel.add(previousVersionButton = GetButton("icons/undo.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
9561135 previousVersionButton.setToolTipText("Previous version");
9571136 previousVersionButton.addActionListener(this);
9581137 previousVersionButton.setEnabled(false);
9591138
9601139 cGridBag updown = new cGridBag().setVertical(true);
961
- updown.add(restoreButton = GetButton("icons/restore.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1140
+ updown.add(restoreButton = GetButton("icons/restore.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
9621141 restoreButton.setToolTipText("Undo (restore current version)");
9631142 restoreButton.addActionListener(this);
964
- //restoreButton.setEnabled(false);
1143
+ restoreButton.setEnabled(false);
9651144
966
- updown.add(replaceButton = GetButton("icons/replace.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1145
+ updown.add(replaceButton = GetButton("icons/replace.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
9671146 replaceButton.setToolTipText("Save (replace current version)");
9681147 replaceButton.addActionListener(this);
969
- //replaceButton.setEnabled(false);
1148
+ replaceButton.setEnabled(false);
9701149
971
- copyOptionsPanel.add(updown);
1150
+ versionManagerPanel.add(updown);
9721151
973
- copyOptionsPanel.add(nextVersionButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1152
+ versionManagerPanel.add(nextVersionButton = GetButton("icons/redo.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
9741153 nextVersionButton.setToolTipText("Next version");
9751154 nextVersionButton.addActionListener(this);
9761155 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);
9771160
9781161 oe.toolbarPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
9791162 liveCB.setToolTipText("Enable animation");
9801163 liveCB.addItemListener(this);
9811164
982
- oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
983
- oneStepButton.setToolTipText("Animate one step forward");
984
- oneStepButton.addActionListener(this);
985
-
9861165 oe.toolbarPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
9871166 fastCB.setToolTipText("Fast mode");
9881167 fastCB.addItemListener(this);
....@@ -998,151 +1177,139 @@
9981177
9991178 if (Globals.ADVANCED)
10001179 {
1001
- oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1180
+ oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10021181 snapobjectButton.addActionListener(this);
10031182 snapobjectButton.setToolTipText("Snap Object");
10041183
1005
- 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);
10061185 fourButton.addActionListener(this);
10071186 fourButton.setToolTipText("Show control panel only");
10081187 }
10091188
10101189 //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
10111190
1012
- oe.toolbarPanel.add(twoButton = GetButton("icons/cube.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1013
- twoButton.setToolTipText("Show 3D view only");
1014
- twoButton.addActionListener(this);
1015
- this.fullscreenLayout = twoButton;
1016
-
1017
- oe.toolbarPanel.add(threeButton = GetButton("icons/controlsview.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1018
- threeButton.setToolTipText("Show controls and 3D view");
1019
- threeButton.addActionListener(this);
1020
- oe.toolbarPanel.add(sixButton = GetButton("icons/viewcontrols.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1021
- sixButton.setToolTipText("Show 3D view and controls");
1022
- sixButton.addActionListener(this);
1023
-// oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1024
-// sevenButton.setToolTipText("3-column layout");
1025
-// sevenButton.addActionListener(this);
1026
- //
10271191
1028
- 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);
10291193 rootButton.setToolTipText("Open selection in new tab");
10301194 rootButton.addActionListener(this);
10311195
1032
- 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);
10331197 closeButton.setToolTipText("Close tab");
10341198 closeButton.addActionListener(this);
10351199 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
10361200 //clearButton.addActionListener(this);
10371201
10381202 cGridBag row1 = new cGridBag();
1203
+ row1.preferredHeight = 8;
10391204
10401205 // INSERT
1041
- row1.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1042
- gridButton.setToolTipText("Create grid");
1206
+ row1.add(gridButton = GetButton("icons/grid.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1207
+ gridButton.setToolTipText("Create ground");
10431208 gridButton.addActionListener(this);
10441209
1045
- row1.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1210
+ row1.add(boxButton = GetButton("icons/box.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10461211 boxButton.setToolTipText("Create box");
10471212 boxButton.addActionListener(this);
10481213
1049
- row1.add(sphereButton = GetButton("icons/sphere.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1050
- sphereButton.setToolTipText("Create sphere");
1051
- sphereButton.addActionListener(this);
1052
-
1053
- row1.add(coneButton = GetButton("icons/cone.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1054
- coneButton.setToolTipText("Create cone");
1055
- coneButton.addActionListener(this);
1056
-
1057
- row1.add(torusButton = GetButton("icons/torus.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1058
- torusButton.setToolTipText("Create torus");
1059
- torusButton.addActionListener(this);
1060
-
1061
- row1.add(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1214
+ row1.add(superButton = GetButton("icons/super.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10621215 superButton.setToolTipText("Create superellipsoid");
10631216 superButton.addActionListener(this);
10641217
1065
- 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)
10661231 {
1067
- 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);
10681233 kleinButton.setToolTipText("Create Klein bottle");
10691234 kleinButton.addActionListener(this);
10701235 }
10711236
1072
- row1.add(particlesButton = GetButton("icons/particles.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1237
+ row1.add(particlesButton = GetButton("icons/particles.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10731238 particlesButton.setToolTipText("Create particle system");
10741239 particlesButton.addActionListener(this);
10751240
10761241 oe.toolboxPanel.add(row1);
10771242
10781243 cGridBag row2 = new cGridBag();
1244
+ row2.preferredHeight = 8;
10791245
1080
- row2.add(groupButton = GetButton("icons/group.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1246
+ row2.add(groupButton = GetButton("icons/group.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10811247 groupButton.setToolTipText("Create group");
10821248 groupButton.addActionListener(this);
10831249
1084
- row2.add(compositeButton = GetButton("icons/composite.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1250
+ row2.add(compositeButton = GetButton("icons/composite.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10851251 compositeButton.setToolTipText("Create composite");
10861252 compositeButton.addActionListener(this);
10871253
1088
- row2.add(switchButton = GetButton("icons/switch.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1254
+ row2.add(switchButton = GetButton("icons/switch.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10891255 switchButton.setToolTipText("Create item switcher");
10901256 switchButton.addActionListener(this);
10911257
1092
- row2.add(loopButton = GetButton("icons/loop.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1258
+ row2.add(loopButton = GetButton("icons/loop.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10931259 loopButton.setToolTipText("Create loop");
10941260 loopButton.addActionListener(this);
10951261
1096
- row2.add(textureButton = GetButton("icons/texture.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1262
+ row2.add(textureButton = GetButton("icons/texture.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10971263 textureButton.setToolTipText("Create texture");
10981264 textureButton.addActionListener(this);
10991265
1100
- row2.add(overlayButton = GetButton("icons/overlay.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1266
+ row2.add(overlayButton = GetButton("icons/overlay.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11011267 overlayButton.setToolTipText("Create overlay");
11021268 overlayButton.addActionListener(this);
11031269
1104
- 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);
11051271 lightButton.setToolTipText("Create light");
11061272 lightButton.addActionListener(this);
11071273
11081274 oe.toolboxPanel.add(row2);
11091275
1110
- // ENVYMAPS
1111
- cGridBag skyboxpane = new cGridBag();
1112
- skyboxpane.preferredHeight = 100;
1276
+ cGridBag textures = new cGridBag();
11131277
1114
- oe.skyboxPanel.add(skyboxpane);
1278
+ CreateTexturePanel(textures);
11151279
1116
- JTabbedPane skyboxpanel = new JTabbedPane();
1117
- skyboxpane.add(skyboxpanel);
1280
+ int tabCount = resourcecontainer.getTabCount();
11181281
1119
- AddSkyboxTab0(skyboxpanel);
1120
- AddSkyboxTab1(skyboxpanel);
1121
- AddSkyboxTab2(skyboxpanel);
1122
- AddSkyboxTab3(skyboxpanel);
1282
+ if (tabCount > 0)
1283
+ resourcecontainer.setSelectedIndex((int)(Math.random() * tabCount));
1284
+
1285
+ oe.toolboxPanel.add(textures);
1286
+
1287
+ textures.preferredHeight = 100;
1288
+
1289
+ CreateSkyboxPanel(oe.skyboxPanel);
11231290
11241291 // EDIT panel
1125
- editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1292
+ editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11261293 editButton.setToolTipText("Pin selection controls");
11271294 editButton.addActionListener(this);
11281295
1129
- editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1296
+ editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11301297 uneditButton.setToolTipText("Unpin and remove selection controls");
11311298 uneditButton.addActionListener(this);
11321299
11331300 editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
1134
- allParamsButton.setToolTipText("Show all controle");
1301
+ allParamsButton.setToolTipText("Show all controls");
11351302 allParamsButton.addActionListener(this);
11361303
1137
- editCommandsPanel.add(clearPanelButton = GetButton("icons/clear.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1138
- clearPanelButton.setToolTipText("Clear edit panel");
1304
+ editCommandsPanel.add(clearPanelButton = GetButton("icons/clear.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1305
+ clearPanelButton.setToolTipText("Clear all controls");
11391306 clearPanelButton.addActionListener(this);
11401307
11411308 //editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
11421309 //unselectButton.setToolTipText("Unselect");
11431310 //unselectButton.addActionListener(this);
11441311
1145
- 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);
11461313 flashSelectionButton.setToolTipText("Highlight selection");
11471314 flashSelectionButton.addActionListener(this);
11481315
....@@ -1165,6 +1332,8 @@
11651332
11661333 cGridBag jSPPanel = new cGridBag();
11671334
1335
+ jSPPanel.preferredHeight = 20;
1336
+
11681337 JScrollPane jSP;
11691338 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
11701339 jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
....@@ -1173,11 +1342,12 @@
11731342 oe.treePanel.add(jSPPanel);
11741343 oe.treePanel.Return();
11751344
1176
- oe.treePanel.add(copyOptionsPanel);
1345
+ oe.treePanel.add(versionManagerPanel);
11771346 oe.treePanel.Return();
1178
- cGridBag sliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
1179
- versionSlider = (cNumberSlider)sliderPane.getComponent(1);
1180
- sliderPane.preferredHeight = 1;
1347
+
1348
+ versionSliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
1349
+ versionSlider = (cNumberSlider)versionSliderPane.getComponent(1);
1350
+ versionSliderPane.preferredHeight = 3;
11811351
11821352 // mainPanel.setDividerLocation(0.1); //1.0);
11831353 mainPanel.setResizeWeight(0.4);
....@@ -1234,7 +1404,7 @@
12341404 // supportCB.setToolTipText("Enable rigging");
12351405 // supportCB.addItemListener(this);
12361406
1237
- panel.add(freezeCB = new cCheckBox("Freeze", Globals.FREEZEONMOVE)); //, constraints);
1407
+ panel.add(freezeCB = new cCheckBox("Fast cam", Globals.FREEZEONMOVE)); //, constraints);
12381408 freezeCB.setToolTipText("Fast moving camera");
12391409 freezeCB.addItemListener(this);
12401410
....@@ -1243,9 +1413,12 @@
12431413
12441414 panel.Return();
12451415
1416
+ if (Globals.ADVANCED)
1417
+ {
12461418 panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD)); //, constraints);
12471419 crowdCB.setToolTipText("Used for crowds");
12481420 crowdCB.addItemListener(this);
1421
+ }
12491422
12501423 panel.add(smoothCB = new cCheckBox("Inertia", CameraPane.INERTIA)); //, constraints);
12511424 smoothCB.setToolTipText("Snapping delay");
....@@ -1258,30 +1431,26 @@
12581431 minshaderCB.setToolTipText("Minimal fast shader");
12591432 minshaderCB.addItemListener(this);
12601433
1261
-// constraints.gridy += 1;
12621434 // panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
12631435 // speakerMocapCB.addItemListener(this);
12641436
1265
- panel.Return();
1266
-
12671437 if (false)
12681438 {
12691439 // handled in scripts
1270
- //constraints.gridy += 1;
12711440 panel.add(speakerCameraCB = new cCheckBox("Cam", CameraPane.SPEAKERCAMERA)); //, constraints);
12721441 speakerCameraCB.addItemListener(this);
12731442
1274
- //constraints.gridy += 1;
12751443 panel.add(speakerFocusCB = new cCheckBox("Focus", CameraPane.SPEAKERFOCUS)); //, constraints);
12761444 speakerFocusCB.addItemListener(this);
12771445
1278
- //constraints.gridy += 1;
1279
- panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints);
1280
- smoothfocusCB.addItemListener(this);
12811446 panel.Return();
12821447 }
12831448
1284
-//constraints.gridx += 1;
1449
+ panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints);
1450
+ smoothfocusCB.addItemListener(this);
1451
+
1452
+ panel.Return();
1453
+
12851454 //panel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), constraints);
12861455 // debugCB.addItemListener(this);
12871456
....@@ -1335,6 +1504,14 @@
13351504
13361505 void EditObject(Object3D obj)
13371506 {
1507
+ //assert(obj instanceof Composite);
1508
+
1509
+// if (obj.versionlist == null)
1510
+// {
1511
+// obj.versionlist = new Object3D[100];
1512
+// obj.versionindex = -1;
1513
+// }
1514
+
13381515 cRadio radioButton = new cRadio(obj.name);
13391516
13401517 // June 2019. Patch to avoid bug with transparency.
....@@ -1359,6 +1536,7 @@
13591536
13601537 oe.SetupViews();
13611538
1539
+ if (Globals.DEBUG)
13621540 System.out.println("SetupViews");
13631541 DragSource.getDefaultDragSource().createDefaultDragGestureRecognizer(
13641542 oe.cameraView, DnDConstants.ACTION_COPY_OR_MOVE, this); // ACTION_LINK ??
....@@ -1725,7 +1903,12 @@
17251903 TreePath path;
17261904
17271905 public TransferableTreePath(TreePath tp) {
1728
- 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);
17291912 }
17301913
17311914 public synchronized DataFlavor[] getTransferDataFlavors() {
....@@ -1906,7 +2089,7 @@
19062089 Object3D obj = (Object3D)group.selection.elementAt(0);
19072090 objEditor.ScreenFit(obj, false);
19082091
1909
- cameraView.pingthread.StepToTarget(true);
2092
+ cameraView.pingthread.StepToTarget(); //true);
19102093 refreshContents();
19112094 }
19122095
....@@ -1943,7 +2126,7 @@
19432126 obj.parent.TransformToWorld(maxima); //, maxima);
19442127 }
19452128
1946
- Object3D shadow = new Object3D("Shadow " + obj.name);
2129
+ Object3D shadow = new Object3D("Shadow" + obj.name);
19472130
19482131 shadow.toParent = LA.newMatrix();
19492132 shadow.fromParent = LA.newMatrix();
....@@ -1957,24 +2140,24 @@
19572140 switch(axis)
19582141 {
19592142 case 0 :
1960
- vert1.x = minima.x; vert1.y = minima.y; vert1.z = minima.z;
1961
- vert2.x = minima.x; vert2.y = maxima.y; vert2.z = minima.z;
1962
- vert3.x = minima.x; vert3.y = minima.y; vert3.z = maxima.z;
1963
- 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;
19642147 norm = cVector.X;
19652148 break;
19662149 case 1 :
1967
- vert1.x = minima.x; vert1.y = minima.y; vert1.z = minima.z;
1968
- vert2.x = maxima.x; vert2.y = minima.y; vert2.z = minima.z;
1969
- vert3.x = minima.x; vert3.y = minima.y; vert3.z = maxima.z;
1970
- 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;
19712154 norm = cVector.Y;
19722155 break;
19732156 case 2 :
1974
- vert1.x = minima.x; vert1.y = minima.y; vert1.z = minima.z;
1975
- vert2.x = maxima.x; vert2.y = minima.y; vert2.z = minima.z;
1976
- vert3.x = minima.x; vert3.y = maxima.y; vert3.z = minima.z;
1977
- 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;
19782161 norm = cVector.Z;
19792162 break;
19802163 }
....@@ -2015,7 +2198,11 @@
20152198 shadow.material = new cMaterial(obj.material);
20162199 shadow.material.diffuse = 0.0001f;
20172200 shadow.material.specular = 0.0001f;
2018
- //shadow.projectedVertices[1].x = 300;
2201
+ shadow.material.opacity = 0.75f;
2202
+
2203
+ AllocProjectedVertices(shadow);
2204
+
2205
+ shadow.projectedVertices[1].x = 300;
20192206
20202207 makeSomething(shadow);
20212208 }
....@@ -2536,27 +2723,35 @@
25362723 } else
25372724 if (source == loopItem || source == loopButton)
25382725 {
2726
+ if (!group.selection.isEmpty())
2727
+ {
25392728 Composite csg = new GroupLeaf();
2540
- csg.count = 5;
25412729 group(csg);
2730
+ csg.count = 5;
25422731 Composite child = new cGroup("Branch");
25432732 csg.addChild(child);
25442733 child.addChild(csg);
2734
+ }
25452735 } else
25462736 if (source == doubleItem)
25472737 {
2738
+ if (!group.selection.isEmpty())
2739
+ {
25482740 Composite csg = new GroupLeaf("Fork");
2549
- csg.count = 5;
25502741 group(csg);
2742
+ csg.count = 5;
25512743 Composite child = new cGroup("Branch A");
25522744 csg.addChild(child);
25532745 child.addChild(csg);
25542746 child = new cGroup("Branch B");
25552747 csg.addChild(child);
25562748 child.addChild(csg);
2749
+ }
25572750 } else
25582751 if (source == tripleItem)
25592752 {
2753
+ if (!group.selection.isEmpty())
2754
+ {
25602755 Composite csg = new GroupLeaf("Trident");
25612756 csg.count = 4;
25622757 group(csg);
....@@ -2569,6 +2764,7 @@
25692764 child = new cGroup();
25702765 csg.addChild(child);
25712766 child.addChild(csg);
2767
+ }
25722768 } else
25732769 if (source == computeAOItem)
25742770 {
....@@ -2615,10 +2811,22 @@
26152811 {
26162812 Maximize();
26172813 } else
2618
- if (source == fullButton)
2814
+ if (source == fullScreenButton)
26192815 {
26202816 ToggleFullScreen();
26212817 } 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
26222830 if (source == previousVersionButton)
26232831 {
26242832 // Go to previous version
....@@ -2646,7 +2854,7 @@
26462854 if (source == saveVersionButton)
26472855 {
26482856 // Save a new version
2649
- if (!Save(true))
2857
+ if (!DuplicateVersion()) //true))
26502858 java.awt.Toolkit.getDefaultToolkit().beep();
26512859 } else
26522860 if (source == deleteVersionButton)
....@@ -3192,22 +3400,34 @@
31923400 } else
31933401 if (source == ungroupItem || source == ungroupButton)
31943402 {
3195
- boolean hasRoot = false;
3403
+ boolean canUngroup = true;
31963404
31973405 for (int i=0; i<group.selection.size(); i++)
31983406 {
3199
- if (group.selection.get(i) == group)
3407
+ Object3D selectedItem = group.selection.get(i);
3408
+
3409
+ if (selectedItem.Size() == 0)
32003410 {
3201
- 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;
32023420 break;
32033421 }
32043422 }
32053423
3206
- if (!hasRoot)
3424
+ if (canUngroup)
32073425 {
32083426 for (int i=0; i<group.selection.size(); i++)
32093427 {
3210
- Ungroup(group.selection.get(i));
3428
+ Object3D selectedItem = group.selection.get(i);
3429
+
3430
+ Ungroup(selectedItem);
32113431 }
32123432
32133433 ClearSelection(false);
....@@ -3258,6 +3478,10 @@
32583478 if (source == clearMaterialsItem)
32593479 {
32603480 ClearMaterials();
3481
+ } else
3482
+ if (source == clearVersionsItem)
3483
+ {
3484
+ ClearVersions();
32613485 } else
32623486 if (source == liveleavesItem)
32633487 {
....@@ -3398,6 +3622,18 @@
33983622 if (source == transformChildrenItem)
33993623 {
34003624 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);
34013637 } else
34023638 if (source == resetTransformItem)
34033639 {
....@@ -3570,38 +3806,7 @@
35703806 if (CameraPane.FULLSCREEN)
35713807 fullscreenLayout = radio.layout;
35723808
3573
- // bug
3574
- //gridPanel.setDividerLocation(1.0);
3575
- //bigPanel.setDividerLocation(0.0);
3576
-// bigThree.remove(scenePanel);
3577
-// bigThree.remove(centralPanel);
3578
-// bigThree.remove(XYZPanel);
3579
-// aWindowConstraints.gridx = 0;
3580
-// aWindowConstraints.gridy = 0;
3581
-// aWindowConstraints.gridwidth = 1;
3582
-// // aConstraints.gridheight = 3;
3583
-// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3584
-// aWindowConstraints.weightx = 0;
3585
-// aWindowConstraints.weighty = 1;
3586
-// //bigThree.add(jtp, aWindowConstraints);
3587
-// aWindowConstraints.weightx = 1;
3588
-// aWindowConstraints.gridwidth = 3;
3589
-// // aConstraints.gridheight = 3;
3590
-// aWindowConstraints.gridx = 1;
3591
-// aWindowConstraints.fill = GridBagConstraints.BOTH;
3592
-// bigThree.add(centralPanel, aWindowConstraints);
3593
-// aWindowConstraints.weightx = 0;
3594
-// aWindowConstraints.gridx = 4;
3595
-// aWindowConstraints.gridwidth = 1;
3596
-// // aConstraints.gridheight = 3;
3597
-// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3598
-// //bigThree.add(XYZPanel, aWindowConstraints);
3599
-// scenePanel.setVisible(false);
3600
-// centralPanel.setVisible(true);
3601
-// XYZPanel.setVisible(false);
3602
- bigThree.ClearUI();
3603
- bigThree.add(centralPanel);
3604
- bigThree.FlushUI();
3809
+ Show3DView();
36053810
36063811 cameraView.requestFocusInWindow();
36073812
....@@ -3787,6 +3992,7 @@
37873992 } else
37883993 if (source == rootButton)
37893994 {
3995
+ Replace();
37903996 Object3D obj;
37913997 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
37923998 {
....@@ -3801,6 +4007,9 @@
38014007 if (source == closeButton)
38024008 {
38034009 //System.out.println("CLOSE: " + buttonGroup.getSelection());
4010
+ if (copy.versionlist != null)
4011
+ Replace();
4012
+
38044013 cRadio ab;
38054014 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
38064015 {
....@@ -3899,6 +4108,9 @@
38994108 } else
39004109 if(source instanceof cRadio)
39014110 {
4111
+ if (copy.versionlist != null)
4112
+ Replace();
4113
+
39024114 group.parent = keepparent;
39034115 group.attributes = 0;
39044116 //group.editWindow = null;
....@@ -3923,8 +4135,6 @@
39234135
39244136 copy = group;
39254137
3926
- SetUndoStates();
3927
-
39284138 //Globals.theRenderer.object = group;
39294139 if(!useclient)
39304140 {
....@@ -3952,6 +4162,32 @@
39524162 */
39534163 radio.layout.doClick();
39544164
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
+
39554191 ClearUnpinned();
39564192
39574193 //Grafreed.Assert(group != null);
....@@ -4065,9 +4301,46 @@
40654301 refreshContents();
40664302 }
40674303
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
+
40684316 void ResetTransform()
40694317 {
40704318 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();
40714344 }
40724345
40734346 void ResetTransform(int mask)
....@@ -4080,42 +4353,8 @@
40804353 if (obj.toParent == null)
40814354 continue;
40824355
4083
- if (mask == -1)
4084
- {
4085
- if (obj instanceof Camera) // jan 2014
4086
- {
4087
- LA.matIdentity(obj.toParent);
4088
- LA.matIdentity(obj.fromParent);
4089
- }
4090
- else
4091
- {
4092
- obj.toParent = null; // jan 2014 LA.matIdentity(obj.toParent);
4093
- obj.fromParent = null; // LA.matIdentity(obj.fromParent);
4094
- }
4095
- TouchTransform(obj);
4096
- continue;
4097
- }
4098
- if ((mask&2) != 0) // Scale
4099
- {
4100
- obj.toParent[0][0] = obj.toParent[1][1] = obj.toParent[2][2] = 1;
4101
- obj.toParent[0][1] = obj.toParent[1][0] = obj.toParent[2][0] = 0;
4102
- obj.toParent[0][2] = obj.toParent[1][2] = obj.toParent[2][1] = 0;
4103
- obj.fromParent[0][0] = obj.fromParent[1][1] = obj.fromParent[2][2] = 1;
4104
- obj.fromParent[0][1] = obj.fromParent[1][0] = obj.fromParent[2][0] = 0;
4105
- obj.fromParent[0][2] = obj.fromParent[1][2] = obj.fromParent[2][1] = 0;
4106
- }
4107
- if ((mask&4) != 0) // Rotation
4108
- {
4109
- // ?
4110
- }
4111
- if ((mask&1) != 0) // Translation
4112
- {
4113
- if (obj.toParent != null)
4114
- {
4115
- obj.toParent[3][0] = obj.toParent[3][1] = obj.toParent[3][2] = 0;
4116
- obj.fromParent[3][0] = obj.fromParent[3][1] = obj.fromParent[3][2] = 0;
4117
- }
4118
- }
4356
+ obj.ResetTransform(mask);
4357
+
41194358 if (obj.parent == null)
41204359 {
41214360 System.out.println("NULL PARENT!");
....@@ -4624,10 +4863,17 @@
46244863 {
46254864 Object3D obj = group.selection.get(i);
46264865
4866
+ if (obj.toParent == null)
4867
+ {
4868
+ obj.toParent = LA.newMatrix();
4869
+ obj.fromParent = LA.newMatrix();
4870
+ }
4871
+
46274872 LA.matTranslate(obj.toParent, i * scale, 0, 0);
46284873 LA.matTranslateInv(obj.fromParent, -i * scale, 0, 0);
46294874 }
46304875
4876
+ Globals.lighttouched = true;
46314877 refreshContents();
46324878 }
46334879
....@@ -4915,6 +5161,12 @@
49155161 refreshContents();
49165162 }
49175163
5164
+ void ClearVersions()
5165
+ {
5166
+ group.selection.ClearVersions();
5167
+ refreshContents();
5168
+ }
5169
+
49185170 void FlipV(boolean flip)
49195171 {
49205172 group.selection.FlipV(flip);
....@@ -5153,10 +5405,10 @@
51535405 if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
51545406 // a camera
51555407 {
5156
- 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
51575409 {
51585410 CameraPane.camerachangeframe = 0; // don't refuse it
5159
- Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
5411
+ Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent(), true);
51605412 }
51615413 // Globals.theRenderer.renderCamera = Globals.theRenderer.manipCamera;
51625414 // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
....@@ -5186,10 +5438,26 @@
51865438 flashSelectionButton.setEnabled(enabled);
51875439
51885440 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);
51895456 }
51905457
51915458 void refreshContents(boolean cp)
51925459 {
5460
+ if (Globals.SHOWINFO)
51935461 //if (objectPanel.getSelectedIndex() == 2) // objectPanel.indexOfTab("Info"))
51945462 if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
51955463 {
....@@ -5200,7 +5468,7 @@
52005468 Object3D child = (Object3D) group.selection.get(i);
52015469
52025470 objEditor.AddInfo(child, this, true);
5203
- System.err.println("info : " + child.GetPath());
5471
+// System.err.println("info : " + child.GetPath());
52045472 }
52055473
52065474 objEditor.SetText(); // jan 2014
....@@ -6083,11 +6351,11 @@
60836351 private MenuItem lookAtItem;
60846352 private MenuItem lookFromItem;
60856353 private MenuItem switchViewItem;
6086
- private MenuItem cutItem;
6354
+ private JMenuItem cutItem;
60876355 private MenuItem undoItem;
60886356 private MenuItem redoItem;
60896357 private JMenuItem duplicateItem;
6090
- private MenuItem cloneItem;
6358
+ private JMenuItem cloneItem;
60916359 private MenuItem cloneSupportItem;
60926360 private MenuItem overwriteGeoItem;
60936361 private MenuItem overwriteMatItem;
....@@ -6108,13 +6376,13 @@
61086376 private MenuItem cloneGeometriesItem;
61096377 private MenuItem shareGeometriesItem;
61106378 private MenuItem mergeGeometriesItem;
6111
- private MenuItem copyItem;
6379
+ private JMenuItem copyItem;
61126380 private MenuItem pasteItem;
6113
- private MenuItem pasteIntoItem;
6114
- private MenuItem pasteLinkItem;
6115
- private MenuItem pasteCloneItem;
6116
- private MenuItem pasteExpandItem;
6117
- private MenuItem deleteItem;
6381
+ private JMenuItem pasteIntoItem;
6382
+ private JMenuItem pasteLinkItem;
6383
+ private JMenuItem pasteCloneItem;
6384
+ private JMenuItem pasteExpandItem;
6385
+ private JMenuItem deleteItem;
61186386 private MenuItem clearAllItem;
61196387 private MenuItem genUVItem;
61206388 private MenuItem genNormalsMESHItem;
....@@ -6140,6 +6408,7 @@
61406408 private MenuItem clipMeshItem;
61416409 private MenuItem smoothMeshItem;
61426410 private MenuItem clearMaterialsItem;
6411
+ private MenuItem clearVersionsItem;
61436412
61446413 private MenuItem liveleavesItem;
61456414 private MenuItem unliveleavesItem;
....@@ -6163,13 +6432,16 @@
61636432 private MenuItem maxTexturesItem;
61646433 private MenuItem panoTexturesItem;
61656434
6435
+ private MenuItem textureRatioRItem;
6436
+ private MenuItem textureRatioGItem;
6437
+ private MenuItem textureRatioBItem;
61666438 private MenuItem resetCentroidItem;
61676439 private MenuItem resetCentroidXZItem;
61686440 private MenuItem resetTransformItem;
61696441 private MenuItem transformGeometryItem;
61706442 private MenuItem transformChildrenItem;
61716443 private MenuItem hideItem;
6172
- private MenuItem grabItem;
6444
+ private JMenuItem grabItem;
61736445 private MenuItem backItem;
61746446 private MenuItem frontItem;
61756447 private MenuItem cameraItem;
....@@ -6182,7 +6454,7 @@
61826454 private MenuItem switchTransfoItem;
61836455 private MenuItem morphItem;
61846456 private MenuItem linkerItem;
6185
- private MenuItem ungroupItem;
6457
+ private JMenuItem ungroupItem;
61866458 private MenuItem editItem;
61876459 private MenuItem openWindowItem;
61886460 private MenuItem editLeafItem;