Normand Briere
2019-09-20 cbe4e90105d07d7d3fecabffaa01342403aa2ae3
GroupEditor.java
....@@ -16,6 +16,7 @@
1616 //import buoy.widget.BFileChooser;
1717
1818 class GroupEditor extends ObjEditor implements //iParse, //iCallBack,
19
+ Grafreed.iResourceCallBack,
1920 ObjectUI,
2021 Runnable,
2122 ActionListener,
....@@ -28,9 +29,9 @@
2829 {
2930 cButton skyboxButton;
3031 final String path = "cubemaps/" + f + "-skyboxes/" + s;
31
- row.add(skyboxButton = GetButton(path + "/preview.jpg", !Grafreed.NIMBUSLAF));
32
+ row.add(skyboxButton = GetButton(path + "/preview.jpg", !Globals.NIMBUSLAF));
3233 //row.add(skyboxButton = GetButton(path + "/negx.jpg", !Grafreed.NIMBUSLAF));
33
- skyboxButton.setToolTipText(s);
34
+ skyboxButton.setToolTipText(s.equals("") ? "No background" : s);
3435 skyboxButton.addActionListener(new ActionListener()
3536 {
3637 @Override
....@@ -41,6 +42,22 @@
4142 });
4243 }
4344
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
+
4461 public void AddSkyboxTab0(JTabbedPane skyboxpanel)
4562 {
4663 cGridBag tab0 = new cGridBag().setVertical(true);
....@@ -56,7 +73,7 @@
5673 cGridBag row5 = new cGridBag();
5774 cGridBag row6 = new cGridBag();
5875
59
- AddSkyboxButton("default", "rgb", row0);
76
+ AddSkyboxButton("default", "", row0);
6077 //AddSkyboxButton("default", "cornell", row0);
6178 AddSkyboxButton("penguins", "dust", row0);
6279 AddSkyboxButton("penguins", "tropic", row0);
....@@ -311,14 +328,46 @@
311328 }
312329 }
313330
314
- public void ChangeSkybox(String name)
331
+ public void ChangeSkybox(String skybox)
315332 {
316
- //cameraView.envyoff = false;
317
- group.skyboxname = name;
318
- group.skyboxext = "jpg";
319
- 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
+ }
347
+
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);
320358 }
321359
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
+
322371 //ObjEditor objEditor;
323372 public void closeUI2()
324373 {
....@@ -356,11 +405,15 @@
356405 this.copy = this.group = group;
357406 //selectees = this.group.selectees;
358407
359
- if (copy.versions == null)
360
- {
361
- copy.versions = new byte[100][];
362
- copy.versionindex = -1;
363
- }
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
+// }
364417
365418 if(ui)
366419 SetupUI(objEditor);
....@@ -383,13 +436,13 @@
383436
384437 ((cRadio)radioPanel.getComponent(0)).SetCamera(cameraView.renderCamera, true);
385438
386
- if (copy.versions == null)
387
- {
388
- copy.versions = new byte[100][];
389
- copy.versionindex = -1;
390
-
391
- Save(true);
392
- }
439
+// if (copy.versionlist == null)
440
+// {
441
+// copy.versionlist = new Object3D[100];
442
+// copy.versionindex = -1;
443
+//
444
+// //Save(true);
445
+// }
393446 }
394447
395448 void CloneSelection(boolean supports)
....@@ -430,11 +483,16 @@
430483
431484 Object3D parent = obj.parent;
432485 obj.parent = null;
486
+
433487 // Object3D support = obj.support;
434488 // obj.support = null;
435489 if (!supports)
436490 obj.SaveSupports();
491
+
437492 Object3D clone = (Object3D)Grafreed.clone(obj);
493
+
494
+ clone.ResetUUIDs();
495
+
438496 obj.parent = parent;
439497 // obj.support = support;
440498 // clone.support = support; // aout 2013
....@@ -479,33 +537,37 @@
479537 // menu.add("-");
480538 duplicateItem = oe.jTree.popup.add(new JMenuItem("Duplicate"));
481539 duplicateItem.addActionListener(this);
482
- cloneItem = menu.add(new MenuItem("Clone"));
540
+
541
+ cloneItem = oe.jTree.popup.add(new JMenuItem("Clone"));
483542 cloneItem.addActionListener(this);
484
- if (Globals.ADVANCED)
543
+ //if (Globals.ADVANCED)
485544 {
486545 cloneSupportItem = menu.add(new MenuItem("Clone (+supports)"));
487546 cloneSupportItem.addActionListener(this);
488547 }
548
+ oe.jTree.popup.addSeparator();
489549 menu.add("-");
490
- cutItem = menu.add(new MenuItem("Cut"));
550
+ cutItem = oe.jTree.popup.add(new JMenuItem("Cut"));
491551 cutItem.addActionListener(this);
492
- copyItem = menu.add(new MenuItem("Copy"));
552
+ copyItem = oe.jTree.popup.add(new JMenuItem("Copy"));
493553 copyItem.addActionListener(this);
494554 pasteItem = menu.add(new MenuItem("Paste"));
495555 pasteItem.addActionListener(this);
496556
497
- menu.add("-");
498
- 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"));
499560 pasteIntoItem.addActionListener(this);
500
- pasteLinkItem = menu.add(new MenuItem("Paste link"));
561
+ pasteLinkItem = oe.jTree.popup.add(new JMenuItem("Paste link"));
501562 pasteLinkItem.addActionListener(this);
502
- pasteCloneItem = menu.add(new MenuItem("Paste clone"));
563
+ pasteCloneItem = oe.jTree.popup.add(new JMenuItem("Paste clone"));
503564 pasteCloneItem.addActionListener(this);
504
-// pasteExpandItem = menu.add(new MenuItem("Paste expand"));
505
-// pasteExpandItem.addActionListener(this);
506
- menu.add("-");
507
- deleteItem = menu.add(new MenuItem("Delete"));
508
- 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();
509571
510572 if (Globals.ADVANCED)
511573 {
....@@ -591,11 +653,9 @@
591653 oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest"));
592654 //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection"));
593655 //cameraMenu.add(switchViewItem = new MenuItem("Reverse View"));
594
- editLeafItem = oe.cameraMenu.add(new MenuItem("Edit Leaf"));
595656 oe.cameraMenu.add("-");
596657 openWindowItem = oe.cameraMenu.add(new MenuItem("Edit copy..."));
597658 openWindowItem.addActionListener(this);
598
- editLeafItem.addActionListener(this);
599659 lookAtItem.addActionListener(this);
600660 //lookFromItem.addActinoListener(this);
601661 //switchViewItem.addActionListener(this);
....@@ -642,9 +702,8 @@
642702 setMasterItem.addActionListener(this);
643703 }
644704
645
- oe.menuBar.add(menu = new Menu("Group"));
646
-// grabItem = menu.add(new MenuItem("Grab"));
647
-// grabItem.addActionListener(this);
705
+ oe.menuBar.add(menu = new Menu("Order"));
706
+
648707 backItem = menu.add(new MenuItem("Back"));
649708 backItem.addActionListener(this);
650709 frontItem = menu.add(new MenuItem("Front"));
....@@ -652,13 +711,21 @@
652711 // compositeItem = menu.add(new MenuItem("Composite"));
653712 // compositeItem.addActionListener(this);
654713
714
+ grabItem = oe.jTree.popup.add(new JMenuItem("Group"));
715
+ grabItem.addActionListener(this);
716
+
655717 if (Globals.ADVANCED)
656718 {
657719 hideItem = menu.add(new MenuItem("Hidden Group"));
658720 hideItem.addActionListener(this);
659721 }
660
- ungroupItem = menu.add(new MenuItem("Ungroup"));
722
+ ungroupItem = oe.jTree.popup.add(new JMenuItem("Ungroup"));
661723 ungroupItem.addActionListener(this);
724
+
725
+ oe.jTree.popup.addSeparator();
726
+
727
+ deleteItem = oe.jTree.popup.add(new JMenuItem("Delete"));
728
+ deleteItem.addActionListener(this);
662729
663730 // menu.add("-");
664731 //
....@@ -695,9 +762,9 @@
695762 shadowYItem.addActionListener(this);
696763 shadowZItem = menu.add(new MenuItem("Shadow Blue"));
697764 shadowZItem.addActionListener(this);
765
+
698766 attributeItem = menu.add(new MenuItem("Attribute"));
699767 attributeItem.addActionListener(this);
700
-
701768 if (Globals.ADVANCED)
702769 {
703770 menu.add("-");
....@@ -709,11 +776,18 @@
709776 pointflowItem.addActionListener(this);
710777 }
711778 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("-");
712786 resetTransformItem = menu.add(new MenuItem("Reset Transform"));
713787 resetTransformItem.addActionListener(this);
714788 resetCentroidItem = menu.add(new MenuItem("Reset Centroid"));
715789 resetCentroidItem.addActionListener(this);
716
- resetCentroidXZItem = menu.add(new MenuItem("Reset Centroid XY"));
790
+ resetCentroidXZItem = menu.add(new MenuItem("Reset Centroid XZ"));
717791 resetCentroidXZItem.addActionListener(this);
718792 transformGeometryItem = menu.add(new MenuItem("Transform Geometry"));
719793 transformGeometryItem.addActionListener(this);
....@@ -729,7 +803,7 @@
729803 genNormalsCADItem.addActionListener(this);
730804 genNormalsMESHItem = menu.add(new MenuItem("Mesh Normals"));
731805 genNormalsMESHItem.addActionListener(this);
732
- if (Globals.ADVANCED)
806
+ //if (Globals.ADVANCED)
733807 {
734808 genNormalsMINEItem = menu.add(new MenuItem("Stitch Normals"));
735809 genNormalsMINEItem.addActionListener(this);
....@@ -765,6 +839,8 @@
765839 }
766840
767841 oe.menuBar.add(menu = new Menu("Attributes"));
842
+ clearVersionsItem = menu.add(new MenuItem("Clear Versions"));
843
+ clearVersionsItem.addActionListener(this);
768844 clearMaterialsItem = menu.add(new MenuItem("Clear Materials"));
769845 clearMaterialsItem.addActionListener(this);
770846 resetAllItem = menu.add(new MenuItem("Reset All"));
....@@ -787,9 +863,9 @@
787863 hideleavesItem.addActionListener(this);
788864 showleavesItem = menu.add(new MenuItem("Show Leaves"));
789865 showleavesItem.addActionListener(this);
790
- markleavesItem = menu.add(new MenuItem("Mark Leaves"));
866
+ markleavesItem = menu.add(new MenuItem("Anim Leaves"));
791867 markleavesItem.addActionListener(this);
792
- unmarkleavesItem = menu.add(new MenuItem("Unmark Leaves"));
868
+ unmarkleavesItem = menu.add(new MenuItem("Unanim Leaves"));
793869 unmarkleavesItem.addActionListener(this);
794870 rewindleavesItem = menu.add(new MenuItem("Rewind Leaves"));
795871 rewindleavesItem.addActionListener(this);
....@@ -843,6 +919,9 @@
843919 shareGeometriesItem.addActionListener(this);
844920 mergeGeometriesItem = menu.add(new MenuItem("Merge Geometries"));
845921 mergeGeometriesItem.addActionListener(this);
922
+ menu.add("-");
923
+ editLeafItem = menu.add(new MenuItem("Edit leaf..."));
924
+ editLeafItem.addActionListener(this);
846925 if (Globals.ADVANCED)
847926 {
848927 // Pretty much the same as duplicate and clone.
....@@ -859,6 +938,84 @@
859938 buildToolsMenu(menu);
860939 }
861940
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
+ }
8621019
8631020 void SetupUI2(ObjEditor oe)
8641021 {
....@@ -877,11 +1034,6 @@
8771034 //new Exception().printStackTrace();
8781035
8791036 oe.radioPanel = new JPanel(new GridBagLayout());
880
- oe.aConstraints.weightx = 1;
881
- oe.aConstraints.weighty = 0;
882
- oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
883
- oe.aConstraints.gridwidth = 100;
884
- oe.aConstraints.gridheight = 1;
8851037 // oe.toolbarPanel.add(radioPanel); //, oe.aConstraints);
8861038
8871039 oe.buttonGroup = new ButtonGroup();
....@@ -902,9 +1054,9 @@
9021054 oe.radioPanel.add(dummyButton);
9031055 oe.buttonGroup.add(dummyButton);
9041056 */
905
- cGridBag copyOptionsPanel = new cGridBag();
1057
+ cGridBag versionManagerPanel = new cGridBag();
9061058
907
- copyOptionsPanel.preferredHeight = 2;
1059
+ versionManagerPanel.preferredHeight = 4;
9081060
9091061 //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
9101062
....@@ -914,58 +1066,102 @@
9141066
9151067 if (Globals.ADVANCED)
9161068 {
917
- oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
918
- maxButton.setToolTipText("Maximize window");
919
- 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);
9201072 }
9211073
922
- oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
923
- fullButton.setToolTipText("Full-screen window");
924
- fullButton.addActionListener(this);
1074
+ cButton gcButton;
9251075
926
- 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);
9271118 screenfitButton.setToolTipText("Screen fit");
9281119 screenfitButton.addActionListener(this);
9291120
930
- 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);
9311122 restoreCameraButton.setToolTipText("Restore viewpoint");
9321123 restoreCameraButton.addActionListener(this);
9331124
934
- copyOptionsPanel.add(saveButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
935
- saveButton.setToolTipText("New version");
936
- saveButton.addActionListener(this);
1125
+ versionManagerPanel.add(saveVersionButton = GetButton("icons/down_arrow.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1126
+ saveVersionButton.setToolTipText("Duplicate current version");
1127
+ saveVersionButton.addActionListener(this);
9371128
938
- copyOptionsPanel.add(undoButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
939
- undoButton.setToolTipText("Previous version");
940
- undoButton.addActionListener(this);
941
- undoButton.setEnabled(false);
1129
+ versionManagerPanel.add(deleteVersionButton = GetButton("icons/trash.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1130
+ deleteVersionButton.setToolTipText("Delete current version");
1131
+ deleteVersionButton.addActionListener(this);
1132
+ deleteVersionButton.setEnabled(false);
1133
+
1134
+ versionManagerPanel.add(previousVersionButton = GetButton("icons/undo.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1135
+ previousVersionButton.setToolTipText("Previous version");
1136
+ previousVersionButton.addActionListener(this);
1137
+ previousVersionButton.setEnabled(false);
9421138
9431139 cGridBag updown = new cGridBag().setVertical(true);
944
- updown.add(restoreButton = GetButton("icons/restore.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
945
- restoreButton.setToolTipText("Restore current");
1140
+ updown.add(restoreButton = GetButton("icons/restore.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1141
+ restoreButton.setToolTipText("Undo (restore current version)");
9461142 restoreButton.addActionListener(this);
9471143 restoreButton.setEnabled(false);
9481144
949
- updown.add(replaceButton = GetButton("icons/replace.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
950
- replaceButton.setToolTipText("Replace current");
1145
+ updown.add(replaceButton = GetButton("icons/replace.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1146
+ replaceButton.setToolTipText("Save (replace current version)");
9511147 replaceButton.addActionListener(this);
9521148 replaceButton.setEnabled(false);
9531149
954
- copyOptionsPanel.add(updown);
1150
+ versionManagerPanel.add(updown);
9551151
956
- copyOptionsPanel.add(redoButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
957
- redoButton.setToolTipText("Next version");
958
- redoButton.addActionListener(this);
959
- redoButton.setEnabled(false);
1152
+ versionManagerPanel.add(nextVersionButton = GetButton("icons/redo.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1153
+ nextVersionButton.setToolTipText("Next version");
1154
+ nextVersionButton.addActionListener(this);
1155
+ 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);
9601160
9611161 oe.toolbarPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
9621162 liveCB.setToolTipText("Enable animation");
9631163 liveCB.addItemListener(this);
9641164
965
- oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
966
- oneStepButton.setToolTipText("Animate one step forward");
967
- oneStepButton.addActionListener(this);
968
-
9691165 oe.toolbarPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
9701166 fastCB.setToolTipText("Fast mode");
9711167 fastCB.addItemListener(this);
....@@ -981,151 +1177,139 @@
9811177
9821178 if (Globals.ADVANCED)
9831179 {
984
- oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1180
+ oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Globals.NIMBUSLAF)); //, oe.aConstraints);
9851181 snapobjectButton.addActionListener(this);
9861182 snapobjectButton.setToolTipText("Snap Object");
9871183
988
- 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);
9891185 fourButton.addActionListener(this);
9901186 fourButton.setToolTipText("Show control panel only");
9911187 }
9921188
9931189 //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
9941190
995
- oe.toolbarPanel.add(twoButton = GetButton("icons/cube.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
996
- twoButton.setToolTipText("Show 3D view only");
997
- twoButton.addActionListener(this);
998
- this.fullscreenLayout = twoButton;
999
-
1000
- oe.toolbarPanel.add(threeButton = GetButton("icons/controlsview.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1001
- threeButton.setToolTipText("Show controls and 3D view");
1002
- threeButton.addActionListener(this);
1003
- oe.toolbarPanel.add(sixButton = GetButton("icons/viewcontrols.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1004
- sixButton.setToolTipText("Show 3D view and controls");
1005
- sixButton.addActionListener(this);
1006
-// oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1007
-// sevenButton.setToolTipText("3-column layout");
1008
-// sevenButton.addActionListener(this);
1009
- //
10101191
1011
- 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);
10121193 rootButton.setToolTipText("Open selection in new tab");
10131194 rootButton.addActionListener(this);
10141195
1015
- 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);
10161197 closeButton.setToolTipText("Close tab");
10171198 closeButton.addActionListener(this);
10181199 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
10191200 //clearButton.addActionListener(this);
10201201
10211202 cGridBag row1 = new cGridBag();
1203
+ row1.preferredHeight = 8;
10221204
10231205 // INSERT
1024
- row1.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1025
- gridButton.setToolTipText("Create grid");
1206
+ row1.add(gridButton = GetButton("icons/grid.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1207
+ gridButton.setToolTipText("Create ground");
10261208 gridButton.addActionListener(this);
10271209
1028
- row1.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1210
+ row1.add(boxButton = GetButton("icons/box.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10291211 boxButton.setToolTipText("Create box");
10301212 boxButton.addActionListener(this);
10311213
1032
- row1.add(sphereButton = GetButton("icons/sphere.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1033
- sphereButton.setToolTipText("Create sphere");
1034
- sphereButton.addActionListener(this);
1035
-
1036
- row1.add(coneButton = GetButton("icons/cone.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1037
- coneButton.setToolTipText("Create cone");
1038
- coneButton.addActionListener(this);
1039
-
1040
- row1.add(torusButton = GetButton("icons/torus.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1041
- torusButton.setToolTipText("Create torus");
1042
- torusButton.addActionListener(this);
1043
-
1044
- row1.add(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1214
+ row1.add(superButton = GetButton("icons/super.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10451215 superButton.setToolTipText("Create superellipsoid");
10461216 superButton.addActionListener(this);
10471217
1048
- 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)
10491231 {
1050
- 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);
10511233 kleinButton.setToolTipText("Create Klein bottle");
10521234 kleinButton.addActionListener(this);
10531235 }
10541236
1055
- row1.add(particlesButton = GetButton("icons/particles.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1237
+ row1.add(particlesButton = GetButton("icons/particles.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10561238 particlesButton.setToolTipText("Create particle system");
10571239 particlesButton.addActionListener(this);
10581240
10591241 oe.toolboxPanel.add(row1);
10601242
10611243 cGridBag row2 = new cGridBag();
1244
+ row2.preferredHeight = 8;
10621245
1063
- row2.add(groupButton = GetButton("icons/group.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1246
+ row2.add(groupButton = GetButton("icons/group.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10641247 groupButton.setToolTipText("Create group");
10651248 groupButton.addActionListener(this);
10661249
1067
- row2.add(compositeButton = GetButton("icons/composite.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1250
+ row2.add(compositeButton = GetButton("icons/composite.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10681251 compositeButton.setToolTipText("Create composite");
10691252 compositeButton.addActionListener(this);
10701253
1071
- row2.add(switchButton = GetButton("icons/switch.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1254
+ row2.add(switchButton = GetButton("icons/switch.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10721255 switchButton.setToolTipText("Create item switcher");
10731256 switchButton.addActionListener(this);
10741257
1075
- row2.add(loopButton = GetButton("icons/loop.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1258
+ row2.add(loopButton = GetButton("icons/loop.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10761259 loopButton.setToolTipText("Create loop");
10771260 loopButton.addActionListener(this);
10781261
1079
- row2.add(textureButton = GetButton("icons/texture.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1262
+ row2.add(textureButton = GetButton("icons/texture.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10801263 textureButton.setToolTipText("Create texture");
10811264 textureButton.addActionListener(this);
10821265
1083
- row2.add(overlayButton = GetButton("icons/overlay.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1266
+ row2.add(overlayButton = GetButton("icons/overlay.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10841267 overlayButton.setToolTipText("Create overlay");
10851268 overlayButton.addActionListener(this);
10861269
1087
- 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);
10881271 lightButton.setToolTipText("Create light");
10891272 lightButton.addActionListener(this);
10901273
10911274 oe.toolboxPanel.add(row2);
10921275
1093
- // ENVYMAPS
1094
- cGridBag skyboxpane = new cGridBag();
1095
- skyboxpane.preferredHeight = 100;
1276
+ cGridBag textures = new cGridBag();
10961277
1097
- oe.toolboxPanel.add(skyboxpane);
1278
+ CreateTexturePanel(textures);
10981279
1099
- JTabbedPane skyboxpanel = new JTabbedPane();
1100
- skyboxpane.add(skyboxpanel);
1280
+ int tabCount = resourcecontainer.getTabCount();
11011281
1102
- AddSkyboxTab0(skyboxpanel);
1103
- AddSkyboxTab1(skyboxpanel);
1104
- AddSkyboxTab2(skyboxpanel);
1105
- 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);
11061290
11071291 // EDIT panel
1108
- editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1292
+ editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11091293 editButton.setToolTipText("Pin selection controls");
11101294 editButton.addActionListener(this);
11111295
1112
- editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1113
- uneditButton.setToolTipText("Remove selection controls");
1296
+ editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1297
+ uneditButton.setToolTipText("Unpin and remove selection controls");
11141298 uneditButton.addActionListener(this);
11151299
11161300 editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
1117
- allParamsButton.setToolTipText("Show all controle");
1301
+ allParamsButton.setToolTipText("Show all controls");
11181302 allParamsButton.addActionListener(this);
11191303
1120
- editCommandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1121
- clearPanelButton.setToolTipText("Clear edit panel");
1304
+ editCommandsPanel.add(clearPanelButton = GetButton("icons/clear.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1305
+ clearPanelButton.setToolTipText("Clear all controls");
11221306 clearPanelButton.addActionListener(this);
11231307
1124
- editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1125
- unselectButton.setToolTipText("Unselect");
1126
- unselectButton.addActionListener(this);
1308
+ //editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1309
+ //unselectButton.setToolTipText("Unselect");
1310
+ //unselectButton.addActionListener(this);
11271311
1128
- 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);
11291313 flashSelectionButton.setToolTipText("Highlight selection");
11301314 flashSelectionButton.addActionListener(this);
11311315
....@@ -1148,6 +1332,8 @@
11481332
11491333 cGridBag jSPPanel = new cGridBag();
11501334
1335
+ jSPPanel.preferredHeight = 20;
1336
+
11511337 JScrollPane jSP;
11521338 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
11531339 jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
....@@ -1156,11 +1342,12 @@
11561342 oe.treePanel.add(jSPPanel);
11571343 oe.treePanel.Return();
11581344
1159
- oe.treePanel.add(copyOptionsPanel);
1345
+ oe.treePanel.add(versionManagerPanel);
11601346 oe.treePanel.Return();
1161
- cGridBag sliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
1162
- versionSlider = (cNumberSlider)sliderPane.getComponent(1);
1163
- sliderPane.preferredHeight = 1;
1347
+
1348
+ versionSliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
1349
+ versionSlider = (cNumberSlider)versionSliderPane.getComponent(1);
1350
+ versionSliderPane.preferredHeight = 3;
11641351
11651352 // mainPanel.setDividerLocation(0.1); //1.0);
11661353 mainPanel.setResizeWeight(0.4);
....@@ -1183,7 +1370,7 @@
11831370 dgr.addDragGestureListener(this);
11841371 }catch(Exception e) {}
11851372 */
1186
- radio.layout = sixButton; // sevenButton;
1373
+ radio.layout = threeButton; // sixButton;
11871374 oe.toolbarPanel.add(radioPanel); //, oe.aConstraints);
11881375 }
11891376
....@@ -1217,7 +1404,7 @@
12171404 // supportCB.setToolTipText("Enable rigging");
12181405 // supportCB.addItemListener(this);
12191406
1220
- panel.add(freezeCB = new cCheckBox("Freeze", Globals.FREEZEONMOVE)); //, constraints);
1407
+ panel.add(freezeCB = new cCheckBox("Fast cam", Globals.FREEZEONMOVE)); //, constraints);
12211408 freezeCB.setToolTipText("Fast moving camera");
12221409 freezeCB.addItemListener(this);
12231410
....@@ -1226,9 +1413,12 @@
12261413
12271414 panel.Return();
12281415
1416
+ if (Globals.ADVANCED)
1417
+ {
12291418 panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD)); //, constraints);
12301419 crowdCB.setToolTipText("Used for crowds");
12311420 crowdCB.addItemListener(this);
1421
+ }
12321422
12331423 panel.add(smoothCB = new cCheckBox("Inertia", CameraPane.INERTIA)); //, constraints);
12341424 smoothCB.setToolTipText("Snapping delay");
....@@ -1241,30 +1431,26 @@
12411431 minshaderCB.setToolTipText("Minimal fast shader");
12421432 minshaderCB.addItemListener(this);
12431433
1244
-// constraints.gridy += 1;
12451434 // panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
12461435 // speakerMocapCB.addItemListener(this);
12471436
1248
- panel.Return();
1249
-
12501437 if (false)
12511438 {
12521439 // handled in scripts
1253
- //constraints.gridy += 1;
12541440 panel.add(speakerCameraCB = new cCheckBox("Cam", CameraPane.SPEAKERCAMERA)); //, constraints);
12551441 speakerCameraCB.addItemListener(this);
12561442
1257
- //constraints.gridy += 1;
12581443 panel.add(speakerFocusCB = new cCheckBox("Focus", CameraPane.SPEAKERFOCUS)); //, constraints);
12591444 speakerFocusCB.addItemListener(this);
12601445
1261
- //constraints.gridy += 1;
1262
- panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints);
1263
- smoothfocusCB.addItemListener(this);
12641446 panel.Return();
12651447 }
12661448
1267
-//constraints.gridx += 1;
1449
+ panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints);
1450
+ smoothfocusCB.addItemListener(this);
1451
+
1452
+ panel.Return();
1453
+
12681454 //panel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), constraints);
12691455 // debugCB.addItemListener(this);
12701456
....@@ -1318,6 +1504,14 @@
13181504
13191505 void EditObject(Object3D obj)
13201506 {
1507
+ //assert(obj instanceof Composite);
1508
+
1509
+// if (obj.versionlist == null)
1510
+// {
1511
+// obj.versionlist = new Object3D[100];
1512
+// obj.versionindex = -1;
1513
+// }
1514
+
13211515 cRadio radioButton = new cRadio(obj.name);
13221516
13231517 // June 2019. Patch to avoid bug with transparency.
....@@ -1328,7 +1522,7 @@
13281522 }
13291523
13301524 radioButton.SetObject(obj);
1331
- radioButton.layout = sixButton; // sevenButton;
1525
+ radioButton.layout = threeButton; // sixButton;
13321526 radioButton.SetCamera(cameraView.renderCamera, false);
13331527 radioButton.addActionListener(this);
13341528 radioPanel.add(radioButton);
....@@ -1342,6 +1536,7 @@
13421536
13431537 oe.SetupViews();
13441538
1539
+ if (Globals.DEBUG)
13451540 System.out.println("SetupViews");
13461541 DragSource.getDefaultDragSource().createDefaultDragGestureRecognizer(
13471542 oe.cameraView, DnDConstants.ACTION_COPY_OR_MOVE, this); // ACTION_LINK ??
....@@ -1708,7 +1903,12 @@
17081903 TreePath path;
17091904
17101905 public TransferableTreePath(TreePath tp) {
1711
- 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);
17121912 }
17131913
17141914 public synchronized DataFlavor[] getTransferDataFlavors() {
....@@ -1889,7 +2089,7 @@
18892089 Object3D obj = (Object3D)group.selection.elementAt(0);
18902090 objEditor.ScreenFit(obj, false);
18912091
1892
- cameraView.pingthread.StepToTarget(true);
2092
+ cameraView.pingthread.StepToTarget(); //true);
18932093 refreshContents();
18942094 }
18952095
....@@ -1926,7 +2126,7 @@
19262126 obj.parent.TransformToWorld(maxima); //, maxima);
19272127 }
19282128
1929
- Object3D shadow = new Object3D("Shadow " + obj.name);
2129
+ Object3D shadow = new Object3D("Shadow" + obj.name);
19302130
19312131 shadow.toParent = LA.newMatrix();
19322132 shadow.fromParent = LA.newMatrix();
....@@ -1940,24 +2140,24 @@
19402140 switch(axis)
19412141 {
19422142 case 0 :
1943
- vert1.x = minima.x; vert1.y = minima.y; vert1.z = minima.z;
1944
- vert2.x = minima.x; vert2.y = maxima.y; vert2.z = minima.z;
1945
- vert3.x = minima.x; vert3.y = minima.y; vert3.z = maxima.z;
1946
- 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;
19472147 norm = cVector.X;
19482148 break;
19492149 case 1 :
1950
- vert1.x = minima.x; vert1.y = minima.y; vert1.z = minima.z;
1951
- vert2.x = maxima.x; vert2.y = minima.y; vert2.z = minima.z;
1952
- vert3.x = minima.x; vert3.y = minima.y; vert3.z = maxima.z;
1953
- 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;
19542154 norm = cVector.Y;
19552155 break;
19562156 case 2 :
1957
- vert1.x = minima.x; vert1.y = minima.y; vert1.z = minima.z;
1958
- vert2.x = maxima.x; vert2.y = minima.y; vert2.z = minima.z;
1959
- vert3.x = minima.x; vert3.y = maxima.y; vert3.z = minima.z;
1960
- 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;
19612161 norm = cVector.Z;
19622162 break;
19632163 }
....@@ -1998,7 +2198,11 @@
19982198 shadow.material = new cMaterial(obj.material);
19992199 shadow.material.diffuse = 0.0001f;
20002200 shadow.material.specular = 0.0001f;
2001
- //shadow.projectedVertices[1].x = 300;
2201
+ shadow.material.opacity = 0.75f;
2202
+
2203
+ AllocProjectedVertices(shadow);
2204
+
2205
+ shadow.projectedVertices[1].x = 300;
20022206
20032207 makeSomething(shadow);
20042208 }
....@@ -2519,27 +2723,35 @@
25192723 } else
25202724 if (source == loopItem || source == loopButton)
25212725 {
2726
+ if (!group.selection.isEmpty())
2727
+ {
25222728 Composite csg = new GroupLeaf();
2523
- csg.count = 5;
25242729 group(csg);
2730
+ csg.count = 5;
25252731 Composite child = new cGroup("Branch");
25262732 csg.addChild(child);
25272733 child.addChild(csg);
2734
+ }
25282735 } else
25292736 if (source == doubleItem)
25302737 {
2738
+ if (!group.selection.isEmpty())
2739
+ {
25312740 Composite csg = new GroupLeaf("Fork");
2532
- csg.count = 5;
25332741 group(csg);
2742
+ csg.count = 5;
25342743 Composite child = new cGroup("Branch A");
25352744 csg.addChild(child);
25362745 child.addChild(csg);
25372746 child = new cGroup("Branch B");
25382747 csg.addChild(child);
25392748 child.addChild(csg);
2749
+ }
25402750 } else
25412751 if (source == tripleItem)
25422752 {
2753
+ if (!group.selection.isEmpty())
2754
+ {
25432755 Composite csg = new GroupLeaf("Trident");
25442756 csg.count = 4;
25452757 group(csg);
....@@ -2552,6 +2764,7 @@
25522764 child = new cGroup();
25532765 csg.addChild(child);
25542766 child.addChild(csg);
2767
+ }
25552768 } else
25562769 if (source == computeAOItem)
25572770 {
....@@ -2571,7 +2784,7 @@
25712784 if (source == invariantsItem)
25722785 {
25732786 System.out.println("Invariants:");
2574
- Grafreed.grafreeD.universe.invariants();
2787
+ Grafreed.grafreed.universe.invariants();
25752788 } else
25762789 if (source == memoryItem)
25772790 {
....@@ -2598,37 +2811,56 @@
25982811 {
25992812 Maximize();
26002813 } else
2601
- if (source == fullButton)
2814
+ if (source == fullScreenButton)
26022815 {
26032816 ToggleFullScreen();
26042817 } else
2605
- if (source == undoButton)
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
2830
+ if (source == previousVersionButton)
26062831 {
26072832 // Go to previous version
26082833 //if (!Undo())
26092834 //java.awt.Toolkit.getDefaultToolkit().beep();
2610
- Undo();
2835
+ PreviousVersion();
26112836 } else
26122837 if (source == restoreButton)
26132838 {
26142839 // Restore current version
26152840 Restore();
2841
+ //restoreButton.setEnabled(false);
26162842 } else
26172843 if (source == replaceButton)
26182844 {
26192845 // Overwrite current version
26202846 Replace();
2847
+ //replaceButton.setEnabled(false);
26212848 } else
2622
- if (source == redoButton)
2849
+ if (source == nextVersionButton)
26232850 {
26242851 // Go to next version
2625
- Redo();
2852
+ NextVersion();
26262853 } else
2627
- if (source == saveButton)
2854
+ if (source == saveVersionButton)
26282855 {
26292856 // Save a new version
2630
- if (!Save(true))
2857
+ if (!DuplicateVersion()) //true))
26312858 java.awt.Toolkit.getDefaultToolkit().beep();
2859
+ } else
2860
+ if (source == deleteVersionButton)
2861
+ {
2862
+ // Delete a new version
2863
+ DeleteVersion();
26322864 } else
26332865 if (source == oneStepButton)
26342866 {
....@@ -2683,11 +2915,11 @@
26832915 } else
26842916 if (source == undoItem)
26852917 {
2686
- Undo();
2918
+ PreviousVersion();
26872919 } else
26882920 if (source == redoItem)
26892921 {
2690
- Redo();
2922
+ NextVersion();
26912923 } else
26922924 if (source == duplicateItem)
26932925 {
....@@ -3168,22 +3400,34 @@
31683400 } else
31693401 if (source == ungroupItem || source == ungroupButton)
31703402 {
3171
- boolean hasRoot = false;
3403
+ boolean canUngroup = true;
31723404
31733405 for (int i=0; i<group.selection.size(); i++)
31743406 {
3175
- if (group.selection.get(i) == group)
3407
+ Object3D selectedItem = group.selection.get(i);
3408
+
3409
+ if (selectedItem.Size() == 0)
31763410 {
3177
- 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;
31783420 break;
31793421 }
31803422 }
31813423
3182
- if (!hasRoot)
3424
+ if (canUngroup)
31833425 {
31843426 for (int i=0; i<group.selection.size(); i++)
31853427 {
3186
- Ungroup(group.selection.get(i));
3428
+ Object3D selectedItem = group.selection.get(i);
3429
+
3430
+ Ungroup(selectedItem);
31873431 }
31883432
31893433 ClearSelection(false);
....@@ -3234,6 +3478,10 @@
32343478 if (source == clearMaterialsItem)
32353479 {
32363480 ClearMaterials();
3481
+ } else
3482
+ if (source == clearVersionsItem)
3483
+ {
3484
+ ClearVersions();
32373485 } else
32383486 if (source == liveleavesItem)
32393487 {
....@@ -3374,6 +3622,18 @@
33743622 if (source == transformChildrenItem)
33753623 {
33763624 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);
33773637 } else
33783638 if (source == resetTransformItem)
33793639 {
....@@ -3546,38 +3806,7 @@
35463806 if (CameraPane.FULLSCREEN)
35473807 fullscreenLayout = radio.layout;
35483808
3549
- // bug
3550
- //gridPanel.setDividerLocation(1.0);
3551
- //bigPanel.setDividerLocation(0.0);
3552
-// bigThree.remove(scenePanel);
3553
-// bigThree.remove(centralPanel);
3554
-// bigThree.remove(XYZPanel);
3555
-// aWindowConstraints.gridx = 0;
3556
-// aWindowConstraints.gridy = 0;
3557
-// aWindowConstraints.gridwidth = 1;
3558
-// // aConstraints.gridheight = 3;
3559
-// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3560
-// aWindowConstraints.weightx = 0;
3561
-// aWindowConstraints.weighty = 1;
3562
-// //bigThree.add(jtp, aWindowConstraints);
3563
-// aWindowConstraints.weightx = 1;
3564
-// aWindowConstraints.gridwidth = 3;
3565
-// // aConstraints.gridheight = 3;
3566
-// aWindowConstraints.gridx = 1;
3567
-// aWindowConstraints.fill = GridBagConstraints.BOTH;
3568
-// bigThree.add(centralPanel, aWindowConstraints);
3569
-// aWindowConstraints.weightx = 0;
3570
-// aWindowConstraints.gridx = 4;
3571
-// aWindowConstraints.gridwidth = 1;
3572
-// // aConstraints.gridheight = 3;
3573
-// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3574
-// //bigThree.add(XYZPanel, aWindowConstraints);
3575
-// scenePanel.setVisible(false);
3576
-// centralPanel.setVisible(true);
3577
-// XYZPanel.setVisible(false);
3578
- bigThree.ClearUI();
3579
- bigThree.add(centralPanel);
3580
- bigThree.FlushUI();
3809
+ Show3DView();
35813810
35823811 cameraView.requestFocusInWindow();
35833812
....@@ -3763,6 +3992,7 @@
37633992 } else
37643993 if (source == rootButton)
37653994 {
3995
+ Replace();
37663996 Object3D obj;
37673997 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
37683998 {
....@@ -3777,6 +4007,9 @@
37774007 if (source == closeButton)
37784008 {
37794009 //System.out.println("CLOSE: " + buttonGroup.getSelection());
4010
+ if (copy.versionlist != null)
4011
+ Replace();
4012
+
37804013 cRadio ab;
37814014 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
37824015 {
....@@ -3820,10 +4053,10 @@
38204053 {
38214054 Object3D child = (Object3D)e.nextElement();
38224055 if(child.editWindow != null)
3823
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
38244056 child.pinned = false;
38254057 child.CloseUI();
38264058 listUI.remove(child);
4059
+// objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
38274060
38284061 //child.editWindow = null; // ???????????
38294062 }
....@@ -3842,6 +4075,7 @@
38424075 obj.CloseUI();
38434076 }
38444077 listUI.clear();
4078
+ SetPinStates(group.selection.size() > 0);
38454079 refreshContents(true);
38464080 } else
38474081 if (source == allParamsButton)
....@@ -3874,6 +4108,9 @@
38744108 } else
38754109 if(source instanceof cRadio)
38764110 {
4111
+ if (copy.versionlist != null)
4112
+ Replace();
4113
+
38774114 group.parent = keepparent;
38784115 group.attributes = 0;
38794116 //group.editWindow = null;
....@@ -3898,8 +4135,6 @@
38984135
38994136 copy = group;
39004137
3901
- SetUndoStates();
3902
-
39034138 //Globals.theRenderer.object = group;
39044139 if(!useclient)
39054140 {
....@@ -3927,7 +4162,34 @@
39274162 */
39284163 radio.layout.doClick();
39294164
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
+
39304191 ClearUnpinned();
4192
+
39314193 //Grafreed.Assert(group != null);
39324194 //Grafreed.Assert(group.selection != null);
39334195 SetPinStates(group.selection == null || group.selection.size() > 0);
....@@ -3944,11 +4206,13 @@
39444206 } else if (event.getSource() == editCameraItem)
39454207 {
39464208 cameraView.ProtectCamera();
4209
+ cameraView.requestFocusInWindow();
39474210 cameraView.repaint();
39484211 return;
39494212 } else if (event.getSource() == restoreCameraItem || event.getSource() == restoreCameraButton)
39504213 {
39514214 cameraView.RevertCamera();
4215
+ cameraView.requestFocusInWindow();
39524216 cameraView.repaint();
39534217 return;
39544218 // } else if (event.getSource() == textureButton)
....@@ -4037,9 +4301,46 @@
40374301 refreshContents();
40384302 }
40394303
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
+
40404316 void ResetTransform()
40414317 {
40424318 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();
40434344 }
40444345
40454346 void ResetTransform(int mask)
....@@ -4052,42 +4353,8 @@
40524353 if (obj.toParent == null)
40534354 continue;
40544355
4055
- if (mask == -1)
4056
- {
4057
- if (obj instanceof Camera) // jan 2014
4058
- {
4059
- LA.matIdentity(obj.toParent);
4060
- LA.matIdentity(obj.fromParent);
4061
- }
4062
- else
4063
- {
4064
- obj.toParent = null; // jan 2014 LA.matIdentity(obj.toParent);
4065
- obj.fromParent = null; // LA.matIdentity(obj.fromParent);
4066
- }
4067
- TouchTransform(obj);
4068
- continue;
4069
- }
4070
- if ((mask&2) != 0) // Scale
4071
- {
4072
- obj.toParent[0][0] = obj.toParent[1][1] = obj.toParent[2][2] = 1;
4073
- obj.toParent[0][1] = obj.toParent[1][0] = obj.toParent[2][0] = 0;
4074
- obj.toParent[0][2] = obj.toParent[1][2] = obj.toParent[2][1] = 0;
4075
- obj.fromParent[0][0] = obj.fromParent[1][1] = obj.fromParent[2][2] = 1;
4076
- obj.fromParent[0][1] = obj.fromParent[1][0] = obj.fromParent[2][0] = 0;
4077
- obj.fromParent[0][2] = obj.fromParent[1][2] = obj.fromParent[2][1] = 0;
4078
- }
4079
- if ((mask&4) != 0) // Rotation
4080
- {
4081
- // ?
4082
- }
4083
- if ((mask&1) != 0) // Translation
4084
- {
4085
- if (obj.toParent != null)
4086
- {
4087
- obj.toParent[3][0] = obj.toParent[3][1] = obj.toParent[3][2] = 0;
4088
- obj.fromParent[3][0] = obj.fromParent[3][1] = obj.fromParent[3][2] = 0;
4089
- }
4090
- }
4356
+ obj.ResetTransform(mask);
4357
+
40914358 if (obj.parent == null)
40924359 {
40934360 System.out.println("NULL PARENT!");
....@@ -4596,10 +4863,17 @@
45964863 {
45974864 Object3D obj = group.selection.get(i);
45984865
4866
+ if (obj.toParent == null)
4867
+ {
4868
+ obj.toParent = LA.newMatrix();
4869
+ obj.fromParent = LA.newMatrix();
4870
+ }
4871
+
45994872 LA.matTranslate(obj.toParent, i * scale, 0, 0);
46004873 LA.matTranslateInv(obj.fromParent, -i * scale, 0, 0);
46014874 }
46024875
4876
+ Globals.lighttouched = true;
46034877 refreshContents();
46044878 }
46054879
....@@ -4887,6 +5161,12 @@
48875161 refreshContents();
48885162 }
48895163
5164
+ void ClearVersions()
5165
+ {
5166
+ group.selection.ClearVersions();
5167
+ refreshContents();
5168
+ }
5169
+
48905170 void FlipV(boolean flip)
48915171 {
48925172 group.selection.FlipV(flip);
....@@ -5081,9 +5361,7 @@
50815361
50825362 freezemodel = false;
50835363 }
5084
-
5085
- boolean flashIt = true;
5086
-
5364
+
50875365 public void valueChanged(TreeSelectionEvent e)
50885366 //public boolean handleEvent(Event event)
50895367 {
....@@ -5127,10 +5405,10 @@
51275405 if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
51285406 // a camera
51295407 {
5130
- 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
51315409 {
51325410 CameraPane.camerachangeframe = 0; // don't refuse it
5133
- Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
5411
+ Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent(), true);
51345412 }
51355413 // Globals.theRenderer.renderCamera = Globals.theRenderer.manipCamera;
51365414 // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
....@@ -5156,13 +5434,31 @@
51565434 {
51575435 editButton.setEnabled(enabled);
51585436 uneditButton.setEnabled(enabled);
5159
- unselectButton.setEnabled(enabled);
5437
+ //unselectButton.setEnabled(enabled);
51605438 flashSelectionButton.setEnabled(enabled);
5439
+
5440
+ 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);
51615456 }
51625457
51635458 void refreshContents(boolean cp)
51645459 {
5165
- if (objectPanel.getSelectedIndex() == 2) // objectPanel.indexOfTab("Info"))
5460
+ if (Globals.SHOWINFO)
5461
+ //if (objectPanel.getSelectedIndex() == 2) // objectPanel.indexOfTab("Info"))
51665462 if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
51675463 {
51685464 objEditor.ClearInfo(); // .GetMaterial());
....@@ -5172,7 +5468,7 @@
51725468 Object3D child = (Object3D) group.selection.get(i);
51735469
51745470 objEditor.AddInfo(child, this, true);
5175
- System.err.println("info : " + child.GetPath());
5471
+// System.err.println("info : " + child.GetPath());
51765472 }
51775473
51785474 objEditor.SetText(); // jan 2014
....@@ -5998,7 +6294,6 @@
59986294
59996295 cButton restoreCameraButton;
60006296
6001
- cButton saveButton;
60026297 cButton oneStepButton;
60036298
60046299 cButton groupButton;
....@@ -6056,11 +6351,11 @@
60566351 private MenuItem lookAtItem;
60576352 private MenuItem lookFromItem;
60586353 private MenuItem switchViewItem;
6059
- private MenuItem cutItem;
6354
+ private JMenuItem cutItem;
60606355 private MenuItem undoItem;
60616356 private MenuItem redoItem;
60626357 private JMenuItem duplicateItem;
6063
- private MenuItem cloneItem;
6358
+ private JMenuItem cloneItem;
60646359 private MenuItem cloneSupportItem;
60656360 private MenuItem overwriteGeoItem;
60666361 private MenuItem overwriteMatItem;
....@@ -6081,13 +6376,13 @@
60816376 private MenuItem cloneGeometriesItem;
60826377 private MenuItem shareGeometriesItem;
60836378 private MenuItem mergeGeometriesItem;
6084
- private MenuItem copyItem;
6379
+ private JMenuItem copyItem;
60856380 private MenuItem pasteItem;
6086
- private MenuItem pasteIntoItem;
6087
- private MenuItem pasteLinkItem;
6088
- private MenuItem pasteCloneItem;
6089
- private MenuItem pasteExpandItem;
6090
- private MenuItem deleteItem;
6381
+ private JMenuItem pasteIntoItem;
6382
+ private JMenuItem pasteLinkItem;
6383
+ private JMenuItem pasteCloneItem;
6384
+ private JMenuItem pasteExpandItem;
6385
+ private JMenuItem deleteItem;
60916386 private MenuItem clearAllItem;
60926387 private MenuItem genUVItem;
60936388 private MenuItem genNormalsMESHItem;
....@@ -6113,6 +6408,7 @@
61136408 private MenuItem clipMeshItem;
61146409 private MenuItem smoothMeshItem;
61156410 private MenuItem clearMaterialsItem;
6411
+ private MenuItem clearVersionsItem;
61166412
61176413 private MenuItem liveleavesItem;
61186414 private MenuItem unliveleavesItem;
....@@ -6136,13 +6432,16 @@
61366432 private MenuItem maxTexturesItem;
61376433 private MenuItem panoTexturesItem;
61386434
6435
+ private MenuItem textureRatioRItem;
6436
+ private MenuItem textureRatioGItem;
6437
+ private MenuItem textureRatioBItem;
61396438 private MenuItem resetCentroidItem;
61406439 private MenuItem resetCentroidXZItem;
61416440 private MenuItem resetTransformItem;
61426441 private MenuItem transformGeometryItem;
61436442 private MenuItem transformChildrenItem;
61446443 private MenuItem hideItem;
6145
- private MenuItem grabItem;
6444
+ private JMenuItem grabItem;
61466445 private MenuItem backItem;
61476446 private MenuItem frontItem;
61486447 private MenuItem cameraItem;
....@@ -6155,7 +6454,7 @@
61556454 private MenuItem switchTransfoItem;
61566455 private MenuItem morphItem;
61576456 private MenuItem linkerItem;
6158
- private MenuItem ungroupItem;
6457
+ private JMenuItem ungroupItem;
61596458 private MenuItem editItem;
61606459 private MenuItem openWindowItem;
61616460 private MenuItem editLeafItem;