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.versionlist == null)
360
- {
361
- copy.versionlist = new Object3D[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.versionlist == null)
387
- {
388
- copy.versionlist = new Object3D[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,62 +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(saveVersionButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1125
+ versionManagerPanel.add(saveVersionButton = GetButton("icons/down_arrow.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
9351126 saveVersionButton.setToolTipText("Duplicate current version");
9361127 saveVersionButton.addActionListener(this);
9371128
938
- copyOptionsPanel.add(deleteVersionButton = GetButton("icons/trash.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1129
+ versionManagerPanel.add(deleteVersionButton = GetButton("icons/trash.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
9391130 deleteVersionButton.setToolTipText("Delete current version");
9401131 deleteVersionButton.addActionListener(this);
1132
+ deleteVersionButton.setEnabled(false);
9411133
942
- copyOptionsPanel.add(previousVersionButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1134
+ versionManagerPanel.add(previousVersionButton = GetButton("icons/undo.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
9431135 previousVersionButton.setToolTipText("Previous version");
9441136 previousVersionButton.addActionListener(this);
9451137 previousVersionButton.setEnabled(false);
9461138
9471139 cGridBag updown = new cGridBag().setVertical(true);
948
- updown.add(restoreButton = GetButton("icons/restore.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1140
+ updown.add(restoreButton = GetButton("icons/restore.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
9491141 restoreButton.setToolTipText("Undo (restore current version)");
9501142 restoreButton.addActionListener(this);
9511143 restoreButton.setEnabled(false);
9521144
953
- updown.add(replaceButton = GetButton("icons/replace.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1145
+ updown.add(replaceButton = GetButton("icons/replace.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
9541146 replaceButton.setToolTipText("Save (replace current version)");
9551147 replaceButton.addActionListener(this);
9561148 replaceButton.setEnabled(false);
9571149
958
- copyOptionsPanel.add(updown);
1150
+ versionManagerPanel.add(updown);
9591151
960
- copyOptionsPanel.add(nextVersionButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1152
+ versionManagerPanel.add(nextVersionButton = GetButton("icons/redo.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
9611153 nextVersionButton.setToolTipText("Next version");
9621154 nextVersionButton.addActionListener(this);
9631155 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);
9641160
9651161 oe.toolbarPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
9661162 liveCB.setToolTipText("Enable animation");
9671163 liveCB.addItemListener(this);
9681164
969
- oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
970
- oneStepButton.setToolTipText("Animate one step forward");
971
- oneStepButton.addActionListener(this);
972
-
9731165 oe.toolbarPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
9741166 fastCB.setToolTipText("Fast mode");
9751167 fastCB.addItemListener(this);
....@@ -985,151 +1177,139 @@
9851177
9861178 if (Globals.ADVANCED)
9871179 {
988
- oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1180
+ oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Globals.NIMBUSLAF)); //, oe.aConstraints);
9891181 snapobjectButton.addActionListener(this);
9901182 snapobjectButton.setToolTipText("Snap Object");
9911183
992
- 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);
9931185 fourButton.addActionListener(this);
9941186 fourButton.setToolTipText("Show control panel only");
9951187 }
9961188
9971189 //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
9981190
999
- oe.toolbarPanel.add(twoButton = GetButton("icons/cube.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1000
- twoButton.setToolTipText("Show 3D view only");
1001
- twoButton.addActionListener(this);
1002
- this.fullscreenLayout = twoButton;
1003
-
1004
- oe.toolbarPanel.add(threeButton = GetButton("icons/controlsview.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1005
- threeButton.setToolTipText("Show controls and 3D view");
1006
- threeButton.addActionListener(this);
1007
- oe.toolbarPanel.add(sixButton = GetButton("icons/viewcontrols.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1008
- sixButton.setToolTipText("Show 3D view and controls");
1009
- sixButton.addActionListener(this);
1010
-// oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1011
-// sevenButton.setToolTipText("3-column layout");
1012
-// sevenButton.addActionListener(this);
1013
- //
10141191
1015
- 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);
10161193 rootButton.setToolTipText("Open selection in new tab");
10171194 rootButton.addActionListener(this);
10181195
1019
- 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);
10201197 closeButton.setToolTipText("Close tab");
10211198 closeButton.addActionListener(this);
10221199 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
10231200 //clearButton.addActionListener(this);
10241201
10251202 cGridBag row1 = new cGridBag();
1203
+ row1.preferredHeight = 8;
10261204
10271205 // INSERT
1028
- row1.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1029
- gridButton.setToolTipText("Create grid");
1206
+ row1.add(gridButton = GetButton("icons/grid.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1207
+ gridButton.setToolTipText("Create ground");
10301208 gridButton.addActionListener(this);
10311209
1032
- row1.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1210
+ row1.add(boxButton = GetButton("icons/box.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10331211 boxButton.setToolTipText("Create box");
10341212 boxButton.addActionListener(this);
10351213
1036
- row1.add(sphereButton = GetButton("icons/sphere.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1037
- sphereButton.setToolTipText("Create sphere");
1038
- sphereButton.addActionListener(this);
1039
-
1040
- row1.add(coneButton = GetButton("icons/cone.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1041
- coneButton.setToolTipText("Create cone");
1042
- coneButton.addActionListener(this);
1043
-
1044
- row1.add(torusButton = GetButton("icons/torus.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1045
- torusButton.setToolTipText("Create torus");
1046
- torusButton.addActionListener(this);
1047
-
1048
- row1.add(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1214
+ row1.add(superButton = GetButton("icons/super.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10491215 superButton.setToolTipText("Create superellipsoid");
10501216 superButton.addActionListener(this);
10511217
1052
- 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)
10531231 {
1054
- 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);
10551233 kleinButton.setToolTipText("Create Klein bottle");
10561234 kleinButton.addActionListener(this);
10571235 }
10581236
1059
- row1.add(particlesButton = GetButton("icons/particles.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1237
+ row1.add(particlesButton = GetButton("icons/particles.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10601238 particlesButton.setToolTipText("Create particle system");
10611239 particlesButton.addActionListener(this);
10621240
10631241 oe.toolboxPanel.add(row1);
10641242
10651243 cGridBag row2 = new cGridBag();
1244
+ row2.preferredHeight = 8;
10661245
1067
- row2.add(groupButton = GetButton("icons/group.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1246
+ row2.add(groupButton = GetButton("icons/group.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10681247 groupButton.setToolTipText("Create group");
10691248 groupButton.addActionListener(this);
10701249
1071
- row2.add(compositeButton = GetButton("icons/composite.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1250
+ row2.add(compositeButton = GetButton("icons/composite.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10721251 compositeButton.setToolTipText("Create composite");
10731252 compositeButton.addActionListener(this);
10741253
1075
- row2.add(switchButton = GetButton("icons/switch.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1254
+ row2.add(switchButton = GetButton("icons/switch.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10761255 switchButton.setToolTipText("Create item switcher");
10771256 switchButton.addActionListener(this);
10781257
1079
- row2.add(loopButton = GetButton("icons/loop.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1258
+ row2.add(loopButton = GetButton("icons/loop.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10801259 loopButton.setToolTipText("Create loop");
10811260 loopButton.addActionListener(this);
10821261
1083
- row2.add(textureButton = GetButton("icons/texture.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1262
+ row2.add(textureButton = GetButton("icons/texture.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10841263 textureButton.setToolTipText("Create texture");
10851264 textureButton.addActionListener(this);
10861265
1087
- row2.add(overlayButton = GetButton("icons/overlay.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1266
+ row2.add(overlayButton = GetButton("icons/overlay.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10881267 overlayButton.setToolTipText("Create overlay");
10891268 overlayButton.addActionListener(this);
10901269
1091
- 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);
10921271 lightButton.setToolTipText("Create light");
10931272 lightButton.addActionListener(this);
10941273
10951274 oe.toolboxPanel.add(row2);
10961275
1097
- // ENVYMAPS
1098
- cGridBag skyboxpane = new cGridBag();
1099
- skyboxpane.preferredHeight = 100;
1276
+ cGridBag textures = new cGridBag();
11001277
1101
- oe.toolboxPanel.add(skyboxpane);
1278
+ CreateTexturePanel(textures);
11021279
1103
- JTabbedPane skyboxpanel = new JTabbedPane();
1104
- skyboxpane.add(skyboxpanel);
1280
+ int tabCount = resourcecontainer.getTabCount();
11051281
1106
- AddSkyboxTab0(skyboxpanel);
1107
- AddSkyboxTab1(skyboxpanel);
1108
- AddSkyboxTab2(skyboxpanel);
1109
- 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);
11101290
11111291 // EDIT panel
1112
- editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1292
+ editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11131293 editButton.setToolTipText("Pin selection controls");
11141294 editButton.addActionListener(this);
11151295
1116
- editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1296
+ editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11171297 uneditButton.setToolTipText("Unpin and remove selection controls");
11181298 uneditButton.addActionListener(this);
11191299
11201300 editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
1121
- allParamsButton.setToolTipText("Show all controle");
1301
+ allParamsButton.setToolTipText("Show all controls");
11221302 allParamsButton.addActionListener(this);
11231303
1124
- editCommandsPanel.add(clearPanelButton = GetButton("icons/clear.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1125
- clearPanelButton.setToolTipText("Clear edit panel");
1304
+ editCommandsPanel.add(clearPanelButton = GetButton("icons/clear.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1305
+ clearPanelButton.setToolTipText("Clear all controls");
11261306 clearPanelButton.addActionListener(this);
11271307
1128
- editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1129
- unselectButton.setToolTipText("Unselect");
1130
- unselectButton.addActionListener(this);
1308
+ //editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1309
+ //unselectButton.setToolTipText("Unselect");
1310
+ //unselectButton.addActionListener(this);
11311311
1132
- 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);
11331313 flashSelectionButton.setToolTipText("Highlight selection");
11341314 flashSelectionButton.addActionListener(this);
11351315
....@@ -1152,6 +1332,8 @@
11521332
11531333 cGridBag jSPPanel = new cGridBag();
11541334
1335
+ jSPPanel.preferredHeight = 20;
1336
+
11551337 JScrollPane jSP;
11561338 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
11571339 jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
....@@ -1160,11 +1342,12 @@
11601342 oe.treePanel.add(jSPPanel);
11611343 oe.treePanel.Return();
11621344
1163
- oe.treePanel.add(copyOptionsPanel);
1345
+ oe.treePanel.add(versionManagerPanel);
11641346 oe.treePanel.Return();
1165
- cGridBag sliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
1166
- versionSlider = (cNumberSlider)sliderPane.getComponent(1);
1167
- sliderPane.preferredHeight = 1;
1347
+
1348
+ versionSliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
1349
+ versionSlider = (cNumberSlider)versionSliderPane.getComponent(1);
1350
+ versionSliderPane.preferredHeight = 3;
11681351
11691352 // mainPanel.setDividerLocation(0.1); //1.0);
11701353 mainPanel.setResizeWeight(0.4);
....@@ -1221,7 +1404,7 @@
12211404 // supportCB.setToolTipText("Enable rigging");
12221405 // supportCB.addItemListener(this);
12231406
1224
- panel.add(freezeCB = new cCheckBox("Freeze", Globals.FREEZEONMOVE)); //, constraints);
1407
+ panel.add(freezeCB = new cCheckBox("Fast cam", Globals.FREEZEONMOVE)); //, constraints);
12251408 freezeCB.setToolTipText("Fast moving camera");
12261409 freezeCB.addItemListener(this);
12271410
....@@ -1230,9 +1413,12 @@
12301413
12311414 panel.Return();
12321415
1416
+ if (Globals.ADVANCED)
1417
+ {
12331418 panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD)); //, constraints);
12341419 crowdCB.setToolTipText("Used for crowds");
12351420 crowdCB.addItemListener(this);
1421
+ }
12361422
12371423 panel.add(smoothCB = new cCheckBox("Inertia", CameraPane.INERTIA)); //, constraints);
12381424 smoothCB.setToolTipText("Snapping delay");
....@@ -1245,30 +1431,26 @@
12451431 minshaderCB.setToolTipText("Minimal fast shader");
12461432 minshaderCB.addItemListener(this);
12471433
1248
-// constraints.gridy += 1;
12491434 // panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
12501435 // speakerMocapCB.addItemListener(this);
12511436
1252
- panel.Return();
1253
-
12541437 if (false)
12551438 {
12561439 // handled in scripts
1257
- //constraints.gridy += 1;
12581440 panel.add(speakerCameraCB = new cCheckBox("Cam", CameraPane.SPEAKERCAMERA)); //, constraints);
12591441 speakerCameraCB.addItemListener(this);
12601442
1261
- //constraints.gridy += 1;
12621443 panel.add(speakerFocusCB = new cCheckBox("Focus", CameraPane.SPEAKERFOCUS)); //, constraints);
12631444 speakerFocusCB.addItemListener(this);
12641445
1265
- //constraints.gridy += 1;
1266
- panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints);
1267
- smoothfocusCB.addItemListener(this);
12681446 panel.Return();
12691447 }
12701448
1271
-//constraints.gridx += 1;
1449
+ panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints);
1450
+ smoothfocusCB.addItemListener(this);
1451
+
1452
+ panel.Return();
1453
+
12721454 //panel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), constraints);
12731455 // debugCB.addItemListener(this);
12741456
....@@ -1322,6 +1504,14 @@
13221504
13231505 void EditObject(Object3D obj)
13241506 {
1507
+ //assert(obj instanceof Composite);
1508
+
1509
+// if (obj.versionlist == null)
1510
+// {
1511
+// obj.versionlist = new Object3D[100];
1512
+// obj.versionindex = -1;
1513
+// }
1514
+
13251515 cRadio radioButton = new cRadio(obj.name);
13261516
13271517 // June 2019. Patch to avoid bug with transparency.
....@@ -1346,6 +1536,7 @@
13461536
13471537 oe.SetupViews();
13481538
1539
+ if (Globals.DEBUG)
13491540 System.out.println("SetupViews");
13501541 DragSource.getDefaultDragSource().createDefaultDragGestureRecognizer(
13511542 oe.cameraView, DnDConstants.ACTION_COPY_OR_MOVE, this); // ACTION_LINK ??
....@@ -1712,7 +1903,12 @@
17121903 TreePath path;
17131904
17141905 public TransferableTreePath(TreePath tp) {
1715
- 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);
17161912 }
17171913
17181914 public synchronized DataFlavor[] getTransferDataFlavors() {
....@@ -1893,7 +2089,7 @@
18932089 Object3D obj = (Object3D)group.selection.elementAt(0);
18942090 objEditor.ScreenFit(obj, false);
18952091
1896
- cameraView.pingthread.StepToTarget(true);
2092
+ cameraView.pingthread.StepToTarget(); //true);
18972093 refreshContents();
18982094 }
18992095
....@@ -1930,7 +2126,7 @@
19302126 obj.parent.TransformToWorld(maxima); //, maxima);
19312127 }
19322128
1933
- Object3D shadow = new Object3D("Shadow " + obj.name);
2129
+ Object3D shadow = new Object3D("Shadow" + obj.name);
19342130
19352131 shadow.toParent = LA.newMatrix();
19362132 shadow.fromParent = LA.newMatrix();
....@@ -1944,24 +2140,24 @@
19442140 switch(axis)
19452141 {
19462142 case 0 :
1947
- vert1.x = minima.x; vert1.y = minima.y; vert1.z = minima.z;
1948
- vert2.x = minima.x; vert2.y = maxima.y; vert2.z = minima.z;
1949
- vert3.x = minima.x; vert3.y = minima.y; vert3.z = maxima.z;
1950
- 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;
19512147 norm = cVector.X;
19522148 break;
19532149 case 1 :
1954
- vert1.x = minima.x; vert1.y = minima.y; vert1.z = minima.z;
1955
- vert2.x = maxima.x; vert2.y = minima.y; vert2.z = minima.z;
1956
- vert3.x = minima.x; vert3.y = minima.y; vert3.z = maxima.z;
1957
- 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;
19582154 norm = cVector.Y;
19592155 break;
19602156 case 2 :
1961
- vert1.x = minima.x; vert1.y = minima.y; vert1.z = minima.z;
1962
- vert2.x = maxima.x; vert2.y = minima.y; vert2.z = minima.z;
1963
- vert3.x = minima.x; vert3.y = maxima.y; vert3.z = minima.z;
1964
- 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;
19652161 norm = cVector.Z;
19662162 break;
19672163 }
....@@ -2002,7 +2198,11 @@
20022198 shadow.material = new cMaterial(obj.material);
20032199 shadow.material.diffuse = 0.0001f;
20042200 shadow.material.specular = 0.0001f;
2005
- //shadow.projectedVertices[1].x = 300;
2201
+ shadow.material.opacity = 0.75f;
2202
+
2203
+ AllocProjectedVertices(shadow);
2204
+
2205
+ shadow.projectedVertices[1].x = 300;
20062206
20072207 makeSomething(shadow);
20082208 }
....@@ -2523,27 +2723,35 @@
25232723 } else
25242724 if (source == loopItem || source == loopButton)
25252725 {
2726
+ if (!group.selection.isEmpty())
2727
+ {
25262728 Composite csg = new GroupLeaf();
2527
- csg.count = 5;
25282729 group(csg);
2730
+ csg.count = 5;
25292731 Composite child = new cGroup("Branch");
25302732 csg.addChild(child);
25312733 child.addChild(csg);
2734
+ }
25322735 } else
25332736 if (source == doubleItem)
25342737 {
2738
+ if (!group.selection.isEmpty())
2739
+ {
25352740 Composite csg = new GroupLeaf("Fork");
2536
- csg.count = 5;
25372741 group(csg);
2742
+ csg.count = 5;
25382743 Composite child = new cGroup("Branch A");
25392744 csg.addChild(child);
25402745 child.addChild(csg);
25412746 child = new cGroup("Branch B");
25422747 csg.addChild(child);
25432748 child.addChild(csg);
2749
+ }
25442750 } else
25452751 if (source == tripleItem)
25462752 {
2753
+ if (!group.selection.isEmpty())
2754
+ {
25472755 Composite csg = new GroupLeaf("Trident");
25482756 csg.count = 4;
25492757 group(csg);
....@@ -2556,6 +2764,7 @@
25562764 child = new cGroup();
25572765 csg.addChild(child);
25582766 child.addChild(csg);
2767
+ }
25592768 } else
25602769 if (source == computeAOItem)
25612770 {
....@@ -2602,10 +2811,22 @@
26022811 {
26032812 Maximize();
26042813 } else
2605
- if (source == fullButton)
2814
+ if (source == fullScreenButton)
26062815 {
26072816 ToggleFullScreen();
26082817 } 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
26092830 if (source == previousVersionButton)
26102831 {
26112832 // Go to previous version
....@@ -2617,13 +2838,13 @@
26172838 {
26182839 // Restore current version
26192840 Restore();
2620
- restoreButton.setEnabled(false);
2841
+ //restoreButton.setEnabled(false);
26212842 } else
26222843 if (source == replaceButton)
26232844 {
26242845 // Overwrite current version
26252846 Replace();
2626
- replaceButton.setEnabled(false);
2847
+ //replaceButton.setEnabled(false);
26272848 } else
26282849 if (source == nextVersionButton)
26292850 {
....@@ -2633,7 +2854,7 @@
26332854 if (source == saveVersionButton)
26342855 {
26352856 // Save a new version
2636
- if (!Save(true))
2857
+ if (!DuplicateVersion()) //true))
26372858 java.awt.Toolkit.getDefaultToolkit().beep();
26382859 } else
26392860 if (source == deleteVersionButton)
....@@ -3179,22 +3400,34 @@
31793400 } else
31803401 if (source == ungroupItem || source == ungroupButton)
31813402 {
3182
- boolean hasRoot = false;
3403
+ boolean canUngroup = true;
31833404
31843405 for (int i=0; i<group.selection.size(); i++)
31853406 {
3186
- if (group.selection.get(i) == group)
3407
+ Object3D selectedItem = group.selection.get(i);
3408
+
3409
+ if (selectedItem.Size() == 0)
31873410 {
3188
- 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;
31893420 break;
31903421 }
31913422 }
31923423
3193
- if (!hasRoot)
3424
+ if (canUngroup)
31943425 {
31953426 for (int i=0; i<group.selection.size(); i++)
31963427 {
3197
- Ungroup(group.selection.get(i));
3428
+ Object3D selectedItem = group.selection.get(i);
3429
+
3430
+ Ungroup(selectedItem);
31983431 }
31993432
32003433 ClearSelection(false);
....@@ -3245,6 +3478,10 @@
32453478 if (source == clearMaterialsItem)
32463479 {
32473480 ClearMaterials();
3481
+ } else
3482
+ if (source == clearVersionsItem)
3483
+ {
3484
+ ClearVersions();
32483485 } else
32493486 if (source == liveleavesItem)
32503487 {
....@@ -3385,6 +3622,18 @@
33853622 if (source == transformChildrenItem)
33863623 {
33873624 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);
33883637 } else
33893638 if (source == resetTransformItem)
33903639 {
....@@ -3557,38 +3806,7 @@
35573806 if (CameraPane.FULLSCREEN)
35583807 fullscreenLayout = radio.layout;
35593808
3560
- // bug
3561
- //gridPanel.setDividerLocation(1.0);
3562
- //bigPanel.setDividerLocation(0.0);
3563
-// bigThree.remove(scenePanel);
3564
-// bigThree.remove(centralPanel);
3565
-// bigThree.remove(XYZPanel);
3566
-// aWindowConstraints.gridx = 0;
3567
-// aWindowConstraints.gridy = 0;
3568
-// aWindowConstraints.gridwidth = 1;
3569
-// // aConstraints.gridheight = 3;
3570
-// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3571
-// aWindowConstraints.weightx = 0;
3572
-// aWindowConstraints.weighty = 1;
3573
-// //bigThree.add(jtp, aWindowConstraints);
3574
-// aWindowConstraints.weightx = 1;
3575
-// aWindowConstraints.gridwidth = 3;
3576
-// // aConstraints.gridheight = 3;
3577
-// aWindowConstraints.gridx = 1;
3578
-// aWindowConstraints.fill = GridBagConstraints.BOTH;
3579
-// bigThree.add(centralPanel, aWindowConstraints);
3580
-// aWindowConstraints.weightx = 0;
3581
-// aWindowConstraints.gridx = 4;
3582
-// aWindowConstraints.gridwidth = 1;
3583
-// // aConstraints.gridheight = 3;
3584
-// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3585
-// //bigThree.add(XYZPanel, aWindowConstraints);
3586
-// scenePanel.setVisible(false);
3587
-// centralPanel.setVisible(true);
3588
-// XYZPanel.setVisible(false);
3589
- bigThree.ClearUI();
3590
- bigThree.add(centralPanel);
3591
- bigThree.FlushUI();
3809
+ Show3DView();
35923810
35933811 cameraView.requestFocusInWindow();
35943812
....@@ -3774,6 +3992,7 @@
37743992 } else
37753993 if (source == rootButton)
37763994 {
3995
+ Replace();
37773996 Object3D obj;
37783997 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
37793998 {
....@@ -3788,6 +4007,9 @@
37884007 if (source == closeButton)
37894008 {
37904009 //System.out.println("CLOSE: " + buttonGroup.getSelection());
4010
+ if (copy.versionlist != null)
4011
+ Replace();
4012
+
37914013 cRadio ab;
37924014 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
37934015 {
....@@ -3886,6 +4108,9 @@
38864108 } else
38874109 if(source instanceof cRadio)
38884110 {
4111
+ if (copy.versionlist != null)
4112
+ Replace();
4113
+
38894114 group.parent = keepparent;
38904115 group.attributes = 0;
38914116 //group.editWindow = null;
....@@ -3910,8 +4135,6 @@
39104135
39114136 copy = group;
39124137
3913
- SetUndoStates();
3914
-
39154138 //Globals.theRenderer.object = group;
39164139 if(!useclient)
39174140 {
....@@ -3939,6 +4162,32 @@
39394162 */
39404163 radio.layout.doClick();
39414164
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
+
39424191 ClearUnpinned();
39434192
39444193 //Grafreed.Assert(group != null);
....@@ -4052,9 +4301,46 @@
40524301 refreshContents();
40534302 }
40544303
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
+
40554316 void ResetTransform()
40564317 {
40574318 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();
40584344 }
40594345
40604346 void ResetTransform(int mask)
....@@ -4067,42 +4353,8 @@
40674353 if (obj.toParent == null)
40684354 continue;
40694355
4070
- if (mask == -1)
4071
- {
4072
- if (obj instanceof Camera) // jan 2014
4073
- {
4074
- LA.matIdentity(obj.toParent);
4075
- LA.matIdentity(obj.fromParent);
4076
- }
4077
- else
4078
- {
4079
- obj.toParent = null; // jan 2014 LA.matIdentity(obj.toParent);
4080
- obj.fromParent = null; // LA.matIdentity(obj.fromParent);
4081
- }
4082
- TouchTransform(obj);
4083
- continue;
4084
- }
4085
- if ((mask&2) != 0) // Scale
4086
- {
4087
- obj.toParent[0][0] = obj.toParent[1][1] = obj.toParent[2][2] = 1;
4088
- obj.toParent[0][1] = obj.toParent[1][0] = obj.toParent[2][0] = 0;
4089
- obj.toParent[0][2] = obj.toParent[1][2] = obj.toParent[2][1] = 0;
4090
- obj.fromParent[0][0] = obj.fromParent[1][1] = obj.fromParent[2][2] = 1;
4091
- obj.fromParent[0][1] = obj.fromParent[1][0] = obj.fromParent[2][0] = 0;
4092
- obj.fromParent[0][2] = obj.fromParent[1][2] = obj.fromParent[2][1] = 0;
4093
- }
4094
- if ((mask&4) != 0) // Rotation
4095
- {
4096
- // ?
4097
- }
4098
- if ((mask&1) != 0) // Translation
4099
- {
4100
- if (obj.toParent != null)
4101
- {
4102
- obj.toParent[3][0] = obj.toParent[3][1] = obj.toParent[3][2] = 0;
4103
- obj.fromParent[3][0] = obj.fromParent[3][1] = obj.fromParent[3][2] = 0;
4104
- }
4105
- }
4356
+ obj.ResetTransform(mask);
4357
+
41064358 if (obj.parent == null)
41074359 {
41084360 System.out.println("NULL PARENT!");
....@@ -4611,10 +4863,17 @@
46114863 {
46124864 Object3D obj = group.selection.get(i);
46134865
4866
+ if (obj.toParent == null)
4867
+ {
4868
+ obj.toParent = LA.newMatrix();
4869
+ obj.fromParent = LA.newMatrix();
4870
+ }
4871
+
46144872 LA.matTranslate(obj.toParent, i * scale, 0, 0);
46154873 LA.matTranslateInv(obj.fromParent, -i * scale, 0, 0);
46164874 }
46174875
4876
+ Globals.lighttouched = true;
46184877 refreshContents();
46194878 }
46204879
....@@ -4902,6 +5161,12 @@
49025161 refreshContents();
49035162 }
49045163
5164
+ void ClearVersions()
5165
+ {
5166
+ group.selection.ClearVersions();
5167
+ refreshContents();
5168
+ }
5169
+
49055170 void FlipV(boolean flip)
49065171 {
49075172 group.selection.FlipV(flip);
....@@ -5140,10 +5405,10 @@
51405405 if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
51415406 // a camera
51425407 {
5143
- 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
51445409 {
51455410 CameraPane.camerachangeframe = 0; // don't refuse it
5146
- Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
5411
+ Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent(), true);
51475412 }
51485413 // Globals.theRenderer.renderCamera = Globals.theRenderer.manipCamera;
51495414 // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
....@@ -5169,15 +5434,31 @@
51695434 {
51705435 editButton.setEnabled(enabled);
51715436 uneditButton.setEnabled(enabled);
5172
- unselectButton.setEnabled(enabled);
5437
+ //unselectButton.setEnabled(enabled);
51735438 flashSelectionButton.setEnabled(enabled);
51745439
51755440 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);
51765456 }
51775457
51785458 void refreshContents(boolean cp)
51795459 {
5180
- if (objectPanel.getSelectedIndex() == 2) // objectPanel.indexOfTab("Info"))
5460
+ if (Globals.SHOWINFO)
5461
+ //if (objectPanel.getSelectedIndex() == 2) // objectPanel.indexOfTab("Info"))
51815462 if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
51825463 {
51835464 objEditor.ClearInfo(); // .GetMaterial());
....@@ -5187,7 +5468,7 @@
51875468 Object3D child = (Object3D) group.selection.get(i);
51885469
51895470 objEditor.AddInfo(child, this, true);
5190
- System.err.println("info : " + child.GetPath());
5471
+// System.err.println("info : " + child.GetPath());
51915472 }
51925473
51935474 objEditor.SetText(); // jan 2014
....@@ -6070,11 +6351,11 @@
60706351 private MenuItem lookAtItem;
60716352 private MenuItem lookFromItem;
60726353 private MenuItem switchViewItem;
6073
- private MenuItem cutItem;
6354
+ private JMenuItem cutItem;
60746355 private MenuItem undoItem;
60756356 private MenuItem redoItem;
60766357 private JMenuItem duplicateItem;
6077
- private MenuItem cloneItem;
6358
+ private JMenuItem cloneItem;
60786359 private MenuItem cloneSupportItem;
60796360 private MenuItem overwriteGeoItem;
60806361 private MenuItem overwriteMatItem;
....@@ -6095,13 +6376,13 @@
60956376 private MenuItem cloneGeometriesItem;
60966377 private MenuItem shareGeometriesItem;
60976378 private MenuItem mergeGeometriesItem;
6098
- private MenuItem copyItem;
6379
+ private JMenuItem copyItem;
60996380 private MenuItem pasteItem;
6100
- private MenuItem pasteIntoItem;
6101
- private MenuItem pasteLinkItem;
6102
- private MenuItem pasteCloneItem;
6103
- private MenuItem pasteExpandItem;
6104
- private MenuItem deleteItem;
6381
+ private JMenuItem pasteIntoItem;
6382
+ private JMenuItem pasteLinkItem;
6383
+ private JMenuItem pasteCloneItem;
6384
+ private JMenuItem pasteExpandItem;
6385
+ private JMenuItem deleteItem;
61056386 private MenuItem clearAllItem;
61066387 private MenuItem genUVItem;
61076388 private MenuItem genNormalsMESHItem;
....@@ -6127,6 +6408,7 @@
61276408 private MenuItem clipMeshItem;
61286409 private MenuItem smoothMeshItem;
61296410 private MenuItem clearMaterialsItem;
6411
+ private MenuItem clearVersionsItem;
61306412
61316413 private MenuItem liveleavesItem;
61326414 private MenuItem unliveleavesItem;
....@@ -6150,13 +6432,16 @@
61506432 private MenuItem maxTexturesItem;
61516433 private MenuItem panoTexturesItem;
61526434
6435
+ private MenuItem textureRatioRItem;
6436
+ private MenuItem textureRatioGItem;
6437
+ private MenuItem textureRatioBItem;
61536438 private MenuItem resetCentroidItem;
61546439 private MenuItem resetCentroidXZItem;
61556440 private MenuItem resetTransformItem;
61566441 private MenuItem transformGeometryItem;
61576442 private MenuItem transformChildrenItem;
61586443 private MenuItem hideItem;
6159
- private MenuItem grabItem;
6444
+ private JMenuItem grabItem;
61606445 private MenuItem backItem;
61616446 private MenuItem frontItem;
61626447 private MenuItem cameraItem;
....@@ -6169,7 +6454,7 @@
61696454 private MenuItem switchTransfoItem;
61706455 private MenuItem morphItem;
61716456 private MenuItem linkerItem;
6172
- private MenuItem ungroupItem;
6457
+ private JMenuItem ungroupItem;
61736458 private MenuItem editItem;
61746459 private MenuItem openWindowItem;
61756460 private MenuItem editLeafItem;