Normand Briere
2019-08-20 537f4ac57ae2b34f0a04fa63874c8ca6534c9a6d
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,56 @@
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
+
371
+ public void Show3DView()
372
+ {
373
+ // bug
374
+ //gridPanel.setDividerLocation(1.0);
375
+ //bigPanel.setDividerLocation(0.0);
376
+ bigThree.ClearUI();
377
+ bigThree.add(centralPanel);
378
+ bigThree.FlushUI();
379
+ }
380
+
322381 //ObjEditor objEditor;
323382 public void closeUI2()
324383 {
....@@ -356,10 +415,14 @@
356415 this.copy = this.group = group;
357416 //selectees = this.group.selectees;
358417
359
- if (copy.versions == null)
418
+ assert(false);
419
+
420
+ if (copy.versionlist == null)
360421 {
361
- copy.versions = new byte[100][];
422
+ copy.versionlist = new Object3D[100];
362423 copy.versionindex = -1;
424
+
425
+ //Save(true);
363426 }
364427
365428 if(ui)
....@@ -383,12 +446,12 @@
383446
384447 ((cRadio)radioPanel.getComponent(0)).SetCamera(cameraView.renderCamera, true);
385448
386
- if (copy.versions == null)
449
+ if (copy.versionlist == null)
387450 {
388
- copy.versions = new byte[100][];
451
+ copy.versionlist = new Object3D[100];
389452 copy.versionindex = -1;
390453
391
- Save(true);
454
+ //Save(true);
392455 }
393456 }
394457
....@@ -479,33 +542,35 @@
479542 // menu.add("-");
480543 duplicateItem = oe.jTree.popup.add(new JMenuItem("Duplicate"));
481544 duplicateItem.addActionListener(this);
482
- cloneItem = menu.add(new MenuItem("Clone"));
545
+
546
+ cloneItem = oe.jTree.popup.add(new JMenuItem("Clone"));
483547 cloneItem.addActionListener(this);
484
- if (Globals.ADVANCED)
548
+ //if (Globals.ADVANCED)
485549 {
486550 cloneSupportItem = menu.add(new MenuItem("Clone (+supports)"));
487551 cloneSupportItem.addActionListener(this);
488552 }
553
+ oe.jTree.popup.addSeparator();
489554 menu.add("-");
490
- cutItem = menu.add(new MenuItem("Cut"));
555
+ cutItem = oe.jTree.popup.add(new JMenuItem("Cut"));
491556 cutItem.addActionListener(this);
492
- copyItem = menu.add(new MenuItem("Copy"));
557
+ copyItem = oe.jTree.popup.add(new JMenuItem("Copy"));
493558 copyItem.addActionListener(this);
494559 pasteItem = menu.add(new MenuItem("Paste"));
495560 pasteItem.addActionListener(this);
496561
497
- menu.add("-");
498
- pasteIntoItem = menu.add(new MenuItem("Paste into"));
562
+ oe.jTree.popup.addSeparator();
563
+ //menu.add("-");
564
+ pasteIntoItem = oe.jTree.popup.add(new JMenuItem("Paste into"));
499565 pasteIntoItem.addActionListener(this);
500
- pasteLinkItem = menu.add(new MenuItem("Paste link"));
566
+ pasteLinkItem = oe.jTree.popup.add(new JMenuItem("Paste link"));
501567 pasteLinkItem.addActionListener(this);
502
- pasteCloneItem = menu.add(new MenuItem("Paste clone"));
568
+ pasteCloneItem = oe.jTree.popup.add(new JMenuItem("Paste clone"));
503569 pasteCloneItem.addActionListener(this);
504
-// pasteExpandItem = menu.add(new MenuItem("Paste expand"));
570
+// CRASH pasteExpandItem = oe.jTree.popup.add(new JMenuItem("Paste expand"));
505571 // pasteExpandItem.addActionListener(this);
506
- menu.add("-");
507
- deleteItem = menu.add(new MenuItem("Delete"));
508
- deleteItem.addActionListener(this);
572
+ //menu.add("-");
573
+ oe.jTree.popup.addSeparator();
509574
510575 if (Globals.ADVANCED)
511576 {
....@@ -591,11 +656,9 @@
591656 oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest"));
592657 //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection"));
593658 //cameraMenu.add(switchViewItem = new MenuItem("Reverse View"));
594
- editLeafItem = oe.cameraMenu.add(new MenuItem("Edit Leaf"));
595659 oe.cameraMenu.add("-");
596660 openWindowItem = oe.cameraMenu.add(new MenuItem("Edit copy..."));
597661 openWindowItem.addActionListener(this);
598
- editLeafItem.addActionListener(this);
599662 lookAtItem.addActionListener(this);
600663 //lookFromItem.addActinoListener(this);
601664 //switchViewItem.addActionListener(this);
....@@ -642,9 +705,8 @@
642705 setMasterItem.addActionListener(this);
643706 }
644707
645
- oe.menuBar.add(menu = new Menu("Group"));
646
-// grabItem = menu.add(new MenuItem("Grab"));
647
-// grabItem.addActionListener(this);
708
+ oe.menuBar.add(menu = new Menu("Order"));
709
+
648710 backItem = menu.add(new MenuItem("Back"));
649711 backItem.addActionListener(this);
650712 frontItem = menu.add(new MenuItem("Front"));
....@@ -652,13 +714,21 @@
652714 // compositeItem = menu.add(new MenuItem("Composite"));
653715 // compositeItem.addActionListener(this);
654716
717
+ grabItem = oe.jTree.popup.add(new JMenuItem("Group"));
718
+ grabItem.addActionListener(this);
719
+
655720 if (Globals.ADVANCED)
656721 {
657722 hideItem = menu.add(new MenuItem("Hidden Group"));
658723 hideItem.addActionListener(this);
659724 }
660
- ungroupItem = menu.add(new MenuItem("Ungroup"));
725
+ ungroupItem = oe.jTree.popup.add(new JMenuItem("Ungroup"));
661726 ungroupItem.addActionListener(this);
727
+
728
+ oe.jTree.popup.addSeparator();
729
+
730
+ deleteItem = oe.jTree.popup.add(new JMenuItem("Delete"));
731
+ deleteItem.addActionListener(this);
662732
663733 // menu.add("-");
664734 //
....@@ -787,9 +857,9 @@
787857 hideleavesItem.addActionListener(this);
788858 showleavesItem = menu.add(new MenuItem("Show Leaves"));
789859 showleavesItem.addActionListener(this);
790
- markleavesItem = menu.add(new MenuItem("Mark Leaves"));
860
+ markleavesItem = menu.add(new MenuItem("Anim Leaves"));
791861 markleavesItem.addActionListener(this);
792
- unmarkleavesItem = menu.add(new MenuItem("Unmark Leaves"));
862
+ unmarkleavesItem = menu.add(new MenuItem("Unanim Leaves"));
793863 unmarkleavesItem.addActionListener(this);
794864 rewindleavesItem = menu.add(new MenuItem("Rewind Leaves"));
795865 rewindleavesItem.addActionListener(this);
....@@ -843,6 +913,9 @@
843913 shareGeometriesItem.addActionListener(this);
844914 mergeGeometriesItem = menu.add(new MenuItem("Merge Geometries"));
845915 mergeGeometriesItem.addActionListener(this);
916
+ menu.add("-");
917
+ editLeafItem = menu.add(new MenuItem("Edit leaf..."));
918
+ editLeafItem.addActionListener(this);
846919 if (Globals.ADVANCED)
847920 {
848921 // Pretty much the same as duplicate and clone.
....@@ -859,6 +932,74 @@
859932 buildToolsMenu(menu);
860933 }
861934
935
+ JTabbedPane resourcecontainer;
936
+ cGridBag currenttab;
937
+ //boolean added; // patch for jar
938
+
939
+ int tabcount = 0;
940
+ int colcount = 0;
941
+ int rowcount = 0;
942
+ int texturecount = 0;
943
+
944
+ int columns = 5;
945
+ int rows = 7;
946
+
947
+ public void ResourceCallBack(String[] path)
948
+ {
949
+// for (int i = 0; i < path.length; i++)
950
+// System.out.print(path[i] + "/");
951
+// System.out.println();
952
+
953
+ if (//rowcount == 0 ||
954
+ path.length == 1 && !path[0].equals("") && !path[0].equals(".DS_Store"))
955
+ {
956
+ currenttab = new cGridBag();
957
+ String tabname = path[0]; // String.valueOf((char)('A'+tabcount));
958
+ currenttab.setName(tabname);
959
+ //added = false;
960
+ resourcecontainer.add(currenttab);
961
+ resourcecontainer.setToolTipTextAt(tabcount++, "Texture Group " + tabname);
962
+ rowcount = 1;
963
+ colcount = 0;
964
+ texturecount = 0;
965
+ }
966
+
967
+ if (path.length > 2 && (path[2].toLowerCase().endsWith(".jpg") || path[2].toLowerCase().endsWith(".png")))
968
+ {
969
+ //if (!added)
970
+ {
971
+ //added = true;
972
+ String tabname = path[0]; // String.valueOf((char)('A'+tabcount));
973
+ currenttab = (cGridBag)resourcecontainer.getComponentAt(resourcecontainer.indexOfTab(tabname));
974
+ }
975
+
976
+ AddTextureButton(path[0], path[1], path[2], ++texturecount, currenttab);
977
+
978
+ if (++colcount >= columns)
979
+ {
980
+ colcount = 0;
981
+ currenttab.Return();
982
+
983
+ if (rowcount++ >= rows)
984
+ {
985
+ rowcount = 0;
986
+ }
987
+ }
988
+ }
989
+ else
990
+ {
991
+// if (!path[path.length-1].equals("icons"))
992
+// resourcecontainer.Return();
993
+ }
994
+ }
995
+
996
+ void CreateTexturePanel(cGridBag container)
997
+ {
998
+ resourcecontainer = new JTabbedPane(JTabbedPane.LEFT);
999
+ container.add(resourcecontainer);
1000
+
1001
+ Grafreed.ParseResources("textures", this);
1002
+ }
8621003
8631004 void SetupUI2(ObjEditor oe)
8641005 {
....@@ -877,11 +1018,6 @@
8771018 //new Exception().printStackTrace();
8781019
8791020 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;
8851021 // oe.toolbarPanel.add(radioPanel); //, oe.aConstraints);
8861022
8871023 oe.buttonGroup = new ButtonGroup();
....@@ -902,9 +1038,9 @@
9021038 oe.radioPanel.add(dummyButton);
9031039 oe.buttonGroup.add(dummyButton);
9041040 */
905
- cGridBag copyOptionsPanel = new cGridBag();
1041
+ cGridBag versionManagerPanel = new cGridBag();
9061042
907
- copyOptionsPanel.preferredHeight = 2;
1043
+ versionManagerPanel.preferredHeight = 4;
9081044
9091045 //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
9101046
....@@ -914,58 +1050,102 @@
9141050
9151051 if (Globals.ADVANCED)
9161052 {
917
- oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
918
- maxButton.setToolTipText("Maximize window");
919
- maxButton.addActionListener(this);
1053
+// oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1054
+// maxButton.setToolTipText("Maximize window");
1055
+// maxButton.addActionListener(this);
9201056 }
9211057
922
- oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1058
+ cButton gcButton;
1059
+
1060
+// oe.toolbarPanel.add(gcButton = GetButton("icons/trash.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1061
+// gcButton.setToolTipText("Garbage collect");
1062
+// gcButton.addActionListener(new ActionListener()
1063
+// {
1064
+// public void actionPerformed(ActionEvent e)
1065
+// {
1066
+// System.gc();
1067
+// }
1068
+// });
1069
+
1070
+ oe.toolbarPanel.add(collapseButton = GetButton("icons/collapse.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1071
+ collapseButton.setToolTipText("Collapse toolbar");
1072
+ collapseButton.addActionListener(this);
1073
+
1074
+ oe.toolbarPanel.add(maximize3DButton = GetButton("icons/square.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1075
+ maximize3DButton.setToolTipText("Maximize 3D view");
1076
+ maximize3DButton.addActionListener(this);
1077
+
1078
+ oe.toolbarPanel.add(twoButton = GetButton("icons/cube.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1079
+ twoButton.setToolTipText("Show 3D view only");
1080
+ twoButton.addActionListener(this);
1081
+ this.fullscreenLayout = twoButton;
1082
+
1083
+ oe.toolbarPanel.add(threeButton = GetButton("icons/controlsview.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1084
+ threeButton.setToolTipText("Show controls and 3D view");
1085
+ threeButton.addActionListener(this);
1086
+ if (Globals.ADVANCED)
1087
+ {
1088
+ oe.toolbarPanel.add(sixButton = GetButton("icons/viewcontrols.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1089
+ sixButton.setToolTipText("Show 3D view and controls");
1090
+ sixButton.addActionListener(this);
1091
+ }
1092
+// oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1093
+// sevenButton.setToolTipText("3-column layout");
1094
+// sevenButton.addActionListener(this);
1095
+ //
1096
+
1097
+ oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
9231098 fullButton.setToolTipText("Full-screen window");
9241099 fullButton.addActionListener(this);
9251100
926
- oe.toolbarPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1101
+ oe.toolbarPanel.add(screenfitButton = GetButton("icons/fit.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
9271102 screenfitButton.setToolTipText("Screen fit");
9281103 screenfitButton.addActionListener(this);
9291104
930
- oe.toolbarPanel.add(restoreCameraButton = GetButton("icons/eye.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1105
+ oe.toolbarPanel.add(restoreCameraButton = GetButton("icons/eye.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
9311106 restoreCameraButton.setToolTipText("Restore viewpoint");
9321107 restoreCameraButton.addActionListener(this);
9331108
934
- copyOptionsPanel.add(saveButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
935
- saveButton.setToolTipText("New version");
936
- saveButton.addActionListener(this);
1109
+ versionManagerPanel.add(saveVersionButton = GetButton("icons/down_arrow.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1110
+ saveVersionButton.setToolTipText("Duplicate current version");
1111
+ saveVersionButton.addActionListener(this);
9371112
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);
1113
+ versionManagerPanel.add(deleteVersionButton = GetButton("icons/trash.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1114
+ deleteVersionButton.setToolTipText("Delete current version");
1115
+ deleteVersionButton.addActionListener(this);
1116
+ deleteVersionButton.setEnabled(false);
1117
+
1118
+ versionManagerPanel.add(previousVersionButton = GetButton("icons/undo.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1119
+ previousVersionButton.setToolTipText("Previous version");
1120
+ previousVersionButton.addActionListener(this);
1121
+ previousVersionButton.setEnabled(false);
9421122
9431123 cGridBag updown = new cGridBag().setVertical(true);
944
- updown.add(restoreButton = GetButton("icons/restore.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
945
- restoreButton.setToolTipText("Restore current");
1124
+ updown.add(restoreButton = GetButton("icons/restore.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1125
+ restoreButton.setToolTipText("Undo (restore current version)");
9461126 restoreButton.addActionListener(this);
9471127 restoreButton.setEnabled(false);
9481128
949
- updown.add(replaceButton = GetButton("icons/replace.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
950
- replaceButton.setToolTipText("Replace current");
1129
+ updown.add(replaceButton = GetButton("icons/replace.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1130
+ replaceButton.setToolTipText("Save (replace current version)");
9511131 replaceButton.addActionListener(this);
9521132 replaceButton.setEnabled(false);
9531133
954
- copyOptionsPanel.add(updown);
1134
+ versionManagerPanel.add(updown);
9551135
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);
1136
+ versionManagerPanel.add(nextVersionButton = GetButton("icons/redo.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1137
+ nextVersionButton.setToolTipText("Next version");
1138
+ nextVersionButton.addActionListener(this);
1139
+ nextVersionButton.setEnabled(false);
1140
+
1141
+ oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1142
+ oneStepButton.setToolTipText("Animate one step forward");
1143
+ oneStepButton.addActionListener(this);
9601144
9611145 oe.toolbarPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
9621146 liveCB.setToolTipText("Enable animation");
9631147 liveCB.addItemListener(this);
9641148
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
-
9691149 oe.toolbarPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
9701150 fastCB.setToolTipText("Fast mode");
9711151 fastCB.addItemListener(this);
....@@ -981,38 +1161,23 @@
9811161
9821162 if (Globals.ADVANCED)
9831163 {
984
- oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1164
+ oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Globals.NIMBUSLAF)); //, oe.aConstraints);
9851165 snapobjectButton.addActionListener(this);
9861166 snapobjectButton.setToolTipText("Snap Object");
9871167
988
- oe.toolbarPanel.add(fourButton = GetButton("icons/controls-horizontal.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1168
+ oe.toolbarPanel.add(fourButton = GetButton("icons/controls-horizontal.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
9891169 fourButton.addActionListener(this);
9901170 fourButton.setToolTipText("Show control panel only");
9911171 }
9921172
9931173 //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
9941174
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
- //
10101175
1011
- oe.toolbarPanel.add(rootButton = GetButton("icons/openwindow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1176
+ oe.toolbarPanel.add(rootButton = GetButton("icons/openwindow.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10121177 rootButton.setToolTipText("Open selection in new tab");
10131178 rootButton.addActionListener(this);
10141179
1015
- oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1180
+ oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10161181 closeButton.setToolTipText("Close tab");
10171182 closeButton.addActionListener(this);
10181183 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
....@@ -1021,38 +1186,38 @@
10211186 cGridBag row1 = new cGridBag();
10221187
10231188 // INSERT
1024
- row1.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1025
- gridButton.setToolTipText("Create grid");
1189
+ row1.add(gridButton = GetButton("icons/grid.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1190
+ gridButton.setToolTipText("Create ground");
10261191 gridButton.addActionListener(this);
10271192
1028
- row1.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1193
+ row1.add(boxButton = GetButton("icons/box.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10291194 boxButton.setToolTipText("Create box");
10301195 boxButton.addActionListener(this);
10311196
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);
1197
+ row1.add(superButton = GetButton("icons/super.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10451198 superButton.setToolTipText("Create superellipsoid");
10461199 superButton.addActionListener(this);
10471200
1201
+ row1.add(sphereButton = GetButton("icons/sphere.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1202
+ sphereButton.setToolTipText("Create sphere");
1203
+ sphereButton.addActionListener(this);
1204
+
1205
+ row1.add(coneButton = GetButton("icons/cone.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1206
+ coneButton.setToolTipText("Create cone");
1207
+ coneButton.addActionListener(this);
1208
+
1209
+ row1.add(torusButton = GetButton("icons/torus.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1210
+ torusButton.setToolTipText("Create torus");
1211
+ torusButton.addActionListener(this);
1212
+
10481213 if (Globals.ADVANCED)
10491214 {
1050
- oe.toolboxPanel.add(kleinButton = GetButton("icons/klein.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1215
+ oe.toolboxPanel.add(kleinButton = GetButton("icons/klein.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10511216 kleinButton.setToolTipText("Create Klein bottle");
10521217 kleinButton.addActionListener(this);
10531218 }
10541219
1055
- row1.add(particlesButton = GetButton("icons/particles.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1220
+ row1.add(particlesButton = GetButton("icons/particles.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10561221 particlesButton.setToolTipText("Create particle system");
10571222 particlesButton.addActionListener(this);
10581223
....@@ -1060,72 +1225,73 @@
10601225
10611226 cGridBag row2 = new cGridBag();
10621227
1063
- row2.add(groupButton = GetButton("icons/group.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1228
+ row2.add(groupButton = GetButton("icons/group.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10641229 groupButton.setToolTipText("Create group");
10651230 groupButton.addActionListener(this);
10661231
1067
- row2.add(compositeButton = GetButton("icons/composite.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1232
+ row2.add(compositeButton = GetButton("icons/composite.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10681233 compositeButton.setToolTipText("Create composite");
10691234 compositeButton.addActionListener(this);
10701235
1071
- row2.add(switchButton = GetButton("icons/switch.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1236
+ row2.add(switchButton = GetButton("icons/switch.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10721237 switchButton.setToolTipText("Create item switcher");
10731238 switchButton.addActionListener(this);
10741239
1075
- row2.add(loopButton = GetButton("icons/loop.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1240
+ row2.add(loopButton = GetButton("icons/loop.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10761241 loopButton.setToolTipText("Create loop");
10771242 loopButton.addActionListener(this);
10781243
1079
- row2.add(textureButton = GetButton("icons/texture.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1244
+ row2.add(textureButton = GetButton("icons/texture.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10801245 textureButton.setToolTipText("Create texture");
10811246 textureButton.addActionListener(this);
10821247
1083
- row2.add(overlayButton = GetButton("icons/overlay.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1248
+ row2.add(overlayButton = GetButton("icons/overlay.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10841249 overlayButton.setToolTipText("Create overlay");
10851250 overlayButton.addActionListener(this);
10861251
1087
- row2.add(lightButton = GetButton("icons/light-bulb.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1252
+ row2.add(lightButton = GetButton("icons/light-bulb.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10881253 lightButton.setToolTipText("Create light");
10891254 lightButton.addActionListener(this);
10901255
10911256 oe.toolboxPanel.add(row2);
10921257
1093
- // ENVYMAPS
1094
- cGridBag skyboxpane = new cGridBag();
1095
- skyboxpane.preferredHeight = 100;
1258
+ cGridBag textures = new cGridBag();
10961259
1097
- oe.toolboxPanel.add(skyboxpane);
1260
+ CreateTexturePanel(textures);
10981261
1099
- JTabbedPane skyboxpanel = new JTabbedPane();
1100
- skyboxpane.add(skyboxpanel);
1262
+ int tabCount = resourcecontainer.getTabCount();
11011263
1102
- AddSkyboxTab0(skyboxpanel);
1103
- AddSkyboxTab1(skyboxpanel);
1104
- AddSkyboxTab2(skyboxpanel);
1105
- AddSkyboxTab3(skyboxpanel);
1264
+ if (tabCount > 0)
1265
+ resourcecontainer.setSelectedIndex((int)(Math.random() * tabCount));
1266
+
1267
+ oe.toolboxPanel.add(textures);
1268
+
1269
+ textures.preferredHeight = 100;
1270
+
1271
+ CreateSkyboxPanel(oe.skyboxPanel);
11061272
11071273 // EDIT panel
1108
- editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1274
+ editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11091275 editButton.setToolTipText("Pin selection controls");
11101276 editButton.addActionListener(this);
11111277
1112
- editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1113
- uneditButton.setToolTipText("Remove selection controls");
1278
+ editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1279
+ uneditButton.setToolTipText("Unpin and remove selection controls");
11141280 uneditButton.addActionListener(this);
11151281
11161282 editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
1117
- allParamsButton.setToolTipText("Show all controle");
1283
+ allParamsButton.setToolTipText("Show all controls");
11181284 allParamsButton.addActionListener(this);
11191285
1120
- editCommandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1121
- clearPanelButton.setToolTipText("Clear edit panel");
1286
+ editCommandsPanel.add(clearPanelButton = GetButton("icons/clear.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1287
+ clearPanelButton.setToolTipText("Clear all controls");
11221288 clearPanelButton.addActionListener(this);
11231289
1124
- editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1125
- unselectButton.setToolTipText("Unselect");
1126
- unselectButton.addActionListener(this);
1290
+ //editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1291
+ //unselectButton.setToolTipText("Unselect");
1292
+ //unselectButton.addActionListener(this);
11271293
1128
- editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1294
+ editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11291295 flashSelectionButton.setToolTipText("Highlight selection");
11301296 flashSelectionButton.addActionListener(this);
11311297
....@@ -1148,6 +1314,8 @@
11481314
11491315 cGridBag jSPPanel = new cGridBag();
11501316
1317
+ jSPPanel.preferredHeight = 20;
1318
+
11511319 JScrollPane jSP;
11521320 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
11531321 jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
....@@ -1156,11 +1324,11 @@
11561324 oe.treePanel.add(jSPPanel);
11571325 oe.treePanel.Return();
11581326
1159
- oe.treePanel.add(copyOptionsPanel);
1327
+ oe.treePanel.add(versionManagerPanel);
11601328 oe.treePanel.Return();
1161
- cGridBag sliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
1162
- versionSlider = (cNumberSlider)sliderPane.getComponent(1);
1163
- sliderPane.preferredHeight = 1;
1329
+ versionSliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
1330
+ versionSlider = (cNumberSlider)versionSliderPane.getComponent(1);
1331
+ versionSliderPane.preferredHeight = 3;
11641332
11651333 // mainPanel.setDividerLocation(0.1); //1.0);
11661334 mainPanel.setResizeWeight(0.4);
....@@ -1183,7 +1351,7 @@
11831351 dgr.addDragGestureListener(this);
11841352 }catch(Exception e) {}
11851353 */
1186
- radio.layout = sixButton; // sevenButton;
1354
+ radio.layout = threeButton; // sixButton;
11871355 oe.toolbarPanel.add(radioPanel); //, oe.aConstraints);
11881356 }
11891357
....@@ -1234,9 +1402,12 @@
12341402 smoothCB.setToolTipText("Snapping delay");
12351403 smoothCB.addItemListener(this);
12361404
1237
- panel.add(slowCB = new cCheckBox("Slow", CameraPane.SLOWPOSE)); //, constraints);
1238
- slowCB.setToolTipText("Smooth interpolation");
1239
- slowCB.addItemListener(this);
1405
+// panel.add(slowCB = new cCheckBox("Slow", CameraPane.SLOWPOSE)); //, constraints);
1406
+// slowCB.setToolTipText("Smooth interpolation");
1407
+// slowCB.addItemListener(this);
1408
+ panel.add(minshaderCB = new cCheckBox("Min shader", Globals.MINSHADER)); //, constraints);
1409
+ minshaderCB.setToolTipText("Minimal fast shader");
1410
+ minshaderCB.addItemListener(this);
12401411
12411412 // constraints.gridy += 1;
12421413 // panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
....@@ -1315,6 +1486,14 @@
13151486
13161487 void EditObject(Object3D obj)
13171488 {
1489
+ assert(obj instanceof Composite);
1490
+
1491
+// if (obj.versionlist == null)
1492
+// {
1493
+// obj.versionlist = new Object3D[100];
1494
+// obj.versionindex = -1;
1495
+// }
1496
+
13181497 cRadio radioButton = new cRadio(obj.name);
13191498
13201499 // June 2019. Patch to avoid bug with transparency.
....@@ -1325,7 +1504,7 @@
13251504 }
13261505
13271506 radioButton.SetObject(obj);
1328
- radioButton.layout = sixButton; // sevenButton;
1507
+ radioButton.layout = threeButton; // sixButton;
13291508 radioButton.SetCamera(cameraView.renderCamera, false);
13301509 radioButton.addActionListener(this);
13311510 radioPanel.add(radioButton);
....@@ -1339,6 +1518,7 @@
13391518
13401519 oe.SetupViews();
13411520
1521
+ if (Globals.DEBUG)
13421522 System.out.println("SetupViews");
13431523 DragSource.getDefaultDragSource().createDefaultDragGestureRecognizer(
13441524 oe.cameraView, DnDConstants.ACTION_COPY_OR_MOVE, this); // ACTION_LINK ??
....@@ -1350,6 +1530,8 @@
13501530 cCheckBox localCB;
13511531 cCheckBox crowdCB;
13521532 cCheckBox smoothCB;
1533
+ cCheckBox minshaderCB;
1534
+
13531535 cToggleButton fastCB;
13541536 cCheckBox slowCB;
13551537 cCheckBox boxCB;
....@@ -1420,6 +1602,12 @@
14201602 {
14211603 cameraView.ToggleInertia();
14221604 cameraView.repaint();
1605
+ }
1606
+ else if(e.getSource() == minshaderCB)
1607
+ {
1608
+ Globals.MINSHADER ^= true;
1609
+ cameraView.programInitialized = false;
1610
+ cameraView.repaint();
14231611 }
14241612 else if(e.getSource() == localCB)
14251613 {
....@@ -1697,7 +1885,12 @@
16971885 TreePath path;
16981886
16991887 public TransferableTreePath(TreePath tp) {
1700
- path = tp;
1888
+ Object[] objs = new Object[tp.getPathCount()];
1889
+ for (int i=0; i<objs.length; i++)
1890
+ {
1891
+ objs[i] = ((Object3D)tp.getPathComponent(i)).GetUUID();
1892
+ }
1893
+ path = new TreePath(objs);
17011894 }
17021895
17031896 public synchronized DataFlavor[] getTransferDataFlavors() {
....@@ -1987,7 +2180,11 @@
19872180 shadow.material = new cMaterial(obj.material);
19882181 shadow.material.diffuse = 0.0001f;
19892182 shadow.material.specular = 0.0001f;
1990
- //shadow.projectedVertices[1].x = 300;
2183
+ shadow.material.opacity = 0.75f;
2184
+
2185
+ AllocProjectedVertices(shadow);
2186
+
2187
+ shadow.projectedVertices[1].x = 300;
19912188
19922189 makeSomething(shadow);
19932190 }
....@@ -2508,27 +2705,35 @@
25082705 } else
25092706 if (source == loopItem || source == loopButton)
25102707 {
2708
+ if (!group.selection.isEmpty())
2709
+ {
25112710 Composite csg = new GroupLeaf();
25122711 csg.count = 5;
2513
- group(csg);
25142712 Composite child = new cGroup("Branch");
25152713 csg.addChild(child);
25162714 child.addChild(csg);
2715
+ group(csg);
2716
+ }
25172717 } else
25182718 if (source == doubleItem)
25192719 {
2720
+ if (!group.selection.isEmpty())
2721
+ {
25202722 Composite csg = new GroupLeaf("Fork");
25212723 csg.count = 5;
2522
- group(csg);
25232724 Composite child = new cGroup("Branch A");
25242725 csg.addChild(child);
25252726 child.addChild(csg);
25262727 child = new cGroup("Branch B");
25272728 csg.addChild(child);
25282729 child.addChild(csg);
2730
+ group(csg);
2731
+ }
25292732 } else
25302733 if (source == tripleItem)
25312734 {
2735
+ if (!group.selection.isEmpty())
2736
+ {
25322737 Composite csg = new GroupLeaf("Trident");
25332738 csg.count = 4;
25342739 group(csg);
....@@ -2541,6 +2746,7 @@
25412746 child = new cGroup();
25422747 csg.addChild(child);
25432748 child.addChild(csg);
2749
+ }
25442750 } else
25452751 if (source == computeAOItem)
25462752 {
....@@ -2560,7 +2766,7 @@
25602766 if (source == invariantsItem)
25612767 {
25622768 System.out.println("Invariants:");
2563
- Grafreed.grafreeD.universe.invariants();
2769
+ Grafreed.grafreed.universe.invariants();
25642770 } else
25652771 if (source == memoryItem)
25662772 {
....@@ -2591,33 +2797,52 @@
25912797 {
25922798 ToggleFullScreen();
25932799 } else
2594
- if (source == undoButton)
2800
+ if (source == collapseButton)
2801
+ {
2802
+ this.expandedLayout = radio.layout;
2803
+ CollapseToolbar();
2804
+ } else
2805
+ if (source == maximize3DButton)
2806
+ {
2807
+ this.expandedLayout = radio.layout;
2808
+ radio.layout = twoButton;
2809
+ Show3DView();
2810
+ CollapseToolbar();
2811
+ } else
2812
+ if (source == previousVersionButton)
25952813 {
25962814 // Go to previous version
25972815 //if (!Undo())
25982816 //java.awt.Toolkit.getDefaultToolkit().beep();
2599
- Undo();
2817
+ PreviousVersion();
26002818 } else
26012819 if (source == restoreButton)
26022820 {
26032821 // Restore current version
26042822 Restore();
2823
+ //restoreButton.setEnabled(false);
26052824 } else
26062825 if (source == replaceButton)
26072826 {
26082827 // Overwrite current version
26092828 Replace();
2829
+ //replaceButton.setEnabled(false);
26102830 } else
2611
- if (source == redoButton)
2831
+ if (source == nextVersionButton)
26122832 {
26132833 // Go to next version
2614
- Redo();
2834
+ NextVersion();
26152835 } else
2616
- if (source == saveButton)
2836
+ if (source == saveVersionButton)
26172837 {
26182838 // Save a new version
26192839 if (!Save(true))
26202840 java.awt.Toolkit.getDefaultToolkit().beep();
2841
+ } else
2842
+ if (source == deleteVersionButton)
2843
+ {
2844
+ // Delete a new version
2845
+ DeleteVersion();
26212846 } else
26222847 if (source == oneStepButton)
26232848 {
....@@ -2672,11 +2897,11 @@
26722897 } else
26732898 if (source == undoItem)
26742899 {
2675
- Undo();
2900
+ PreviousVersion();
26762901 } else
26772902 if (source == redoItem)
26782903 {
2679
- Redo();
2904
+ NextVersion();
26802905 } else
26812906 if (source == duplicateItem)
26822907 {
....@@ -3157,22 +3382,34 @@
31573382 } else
31583383 if (source == ungroupItem || source == ungroupButton)
31593384 {
3160
- boolean hasRoot = false;
3385
+ boolean canUngroup = true;
31613386
31623387 for (int i=0; i<group.selection.size(); i++)
31633388 {
3164
- if (group.selection.get(i) == group)
3389
+ Object3D selectedItem = group.selection.get(i);
3390
+
3391
+ if (selectedItem.Size() == 0)
31653392 {
3166
- hasRoot = true;
3393
+ // Cannot ungroup leaves
3394
+ canUngroup = false;
3395
+ break;
3396
+ }
3397
+
3398
+ if (selectedItem == group)
3399
+ {
3400
+ // Cannot ungroup root
3401
+ canUngroup = false;
31673402 break;
31683403 }
31693404 }
31703405
3171
- if (!hasRoot)
3406
+ if (canUngroup)
31723407 {
31733408 for (int i=0; i<group.selection.size(); i++)
31743409 {
3175
- Ungroup(group.selection.get(i));
3410
+ Object3D selectedItem = group.selection.get(i);
3411
+
3412
+ Ungroup(selectedItem);
31763413 }
31773414
31783415 ClearSelection(false);
....@@ -3535,38 +3772,7 @@
35353772 if (CameraPane.FULLSCREEN)
35363773 fullscreenLayout = radio.layout;
35373774
3538
- // bug
3539
- //gridPanel.setDividerLocation(1.0);
3540
- //bigPanel.setDividerLocation(0.0);
3541
-// bigThree.remove(scenePanel);
3542
-// bigThree.remove(centralPanel);
3543
-// bigThree.remove(XYZPanel);
3544
-// aWindowConstraints.gridx = 0;
3545
-// aWindowConstraints.gridy = 0;
3546
-// aWindowConstraints.gridwidth = 1;
3547
-// // aConstraints.gridheight = 3;
3548
-// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3549
-// aWindowConstraints.weightx = 0;
3550
-// aWindowConstraints.weighty = 1;
3551
-// //bigThree.add(jtp, aWindowConstraints);
3552
-// aWindowConstraints.weightx = 1;
3553
-// aWindowConstraints.gridwidth = 3;
3554
-// // aConstraints.gridheight = 3;
3555
-// aWindowConstraints.gridx = 1;
3556
-// aWindowConstraints.fill = GridBagConstraints.BOTH;
3557
-// bigThree.add(centralPanel, aWindowConstraints);
3558
-// aWindowConstraints.weightx = 0;
3559
-// aWindowConstraints.gridx = 4;
3560
-// aWindowConstraints.gridwidth = 1;
3561
-// // aConstraints.gridheight = 3;
3562
-// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3563
-// //bigThree.add(XYZPanel, aWindowConstraints);
3564
-// scenePanel.setVisible(false);
3565
-// centralPanel.setVisible(true);
3566
-// XYZPanel.setVisible(false);
3567
- bigThree.ClearUI();
3568
- bigThree.add(centralPanel);
3569
- bigThree.FlushUI();
3775
+ Show3DView();
35703776
35713777 cameraView.requestFocusInWindow();
35723778
....@@ -3752,6 +3958,7 @@
37523958 } else
37533959 if (source == rootButton)
37543960 {
3961
+ Replace();
37553962 Object3D obj;
37563963 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
37573964 {
....@@ -3766,6 +3973,8 @@
37663973 if (source == closeButton)
37673974 {
37683975 //System.out.println("CLOSE: " + buttonGroup.getSelection());
3976
+ Replace();
3977
+
37693978 cRadio ab;
37703979 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
37713980 {
....@@ -3809,10 +4018,10 @@
38094018 {
38104019 Object3D child = (Object3D)e.nextElement();
38114020 if(child.editWindow != null)
3812
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
38134021 child.pinned = false;
38144022 child.CloseUI();
38154023 listUI.remove(child);
4024
+// objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
38164025
38174026 //child.editWindow = null; // ???????????
38184027 }
....@@ -3831,6 +4040,7 @@
38314040 obj.CloseUI();
38324041 }
38334042 listUI.clear();
4043
+ SetPinStates(group.selection.size() > 0);
38344044 refreshContents(true);
38354045 } else
38364046 if (source == allParamsButton)
....@@ -3863,6 +4073,8 @@
38634073 } else
38644074 if(source instanceof cRadio)
38654075 {
4076
+ Replace();
4077
+
38664078 group.parent = keepparent;
38674079 group.attributes = 0;
38684080 //group.editWindow = null;
....@@ -3887,8 +4099,6 @@
38874099
38884100 copy = group;
38894101
3890
- SetUndoStates();
3891
-
38924102 //Globals.theRenderer.object = group;
38934103 if(!useclient)
38944104 {
....@@ -3916,7 +4126,31 @@
39164126 */
39174127 radio.layout.doClick();
39184128
4129
+ assert(copy instanceof Composite);
4130
+
4131
+ if (copy.versionlist == null)
4132
+ {
4133
+ copy.versionindex = -1;
4134
+
4135
+ // Cannot work with loops
4136
+ // To fix this issue, we first mark all nodes above the root,
4137
+ // and check if any of these nodes are reachable below the root.
4138
+ Grafreed.grafreed.universe.TagObjects(copy, true);
4139
+
4140
+ if (!copy.HasTags())
4141
+ {
4142
+ copy.versionlist = new Object3D[100];
4143
+
4144
+ Save(true);
4145
+ }
4146
+
4147
+ Grafreed.grafreed.universe.TagObjects(copy, false);
4148
+ }
4149
+
4150
+ SetVersionStates();
4151
+
39194152 ClearUnpinned();
4153
+
39204154 //Grafreed.Assert(group != null);
39214155 //Grafreed.Assert(group.selection != null);
39224156 SetPinStates(group.selection == null || group.selection.size() > 0);
....@@ -3933,11 +4167,13 @@
39334167 } else if (event.getSource() == editCameraItem)
39344168 {
39354169 cameraView.ProtectCamera();
4170
+ cameraView.requestFocusInWindow();
39364171 cameraView.repaint();
39374172 return;
39384173 } else if (event.getSource() == restoreCameraItem || event.getSource() == restoreCameraButton)
39394174 {
39404175 cameraView.RevertCamera();
4176
+ cameraView.requestFocusInWindow();
39414177 cameraView.repaint();
39424178 return;
39434179 // } else if (event.getSource() == textureButton)
....@@ -4056,7 +4292,7 @@
40564292 TouchTransform(obj);
40574293 continue;
40584294 }
4059
- if ((mask&2) != 0) // Scale
4295
+ if ((mask&2) != 0) // Scale/rotation
40604296 {
40614297 obj.toParent[0][0] = obj.toParent[1][1] = obj.toParent[2][2] = 1;
40624298 obj.toParent[0][1] = obj.toParent[1][0] = obj.toParent[2][0] = 0;
....@@ -4064,10 +4300,6 @@
40644300 obj.fromParent[0][0] = obj.fromParent[1][1] = obj.fromParent[2][2] = 1;
40654301 obj.fromParent[0][1] = obj.fromParent[1][0] = obj.fromParent[2][0] = 0;
40664302 obj.fromParent[0][2] = obj.fromParent[1][2] = obj.fromParent[2][1] = 0;
4067
- }
4068
- if ((mask&4) != 0) // Rotation
4069
- {
4070
- // ?
40714303 }
40724304 if ((mask&1) != 0) // Translation
40734305 {
....@@ -5070,9 +5302,7 @@
50705302
50715303 freezemodel = false;
50725304 }
5073
-
5074
- boolean flashIt = true;
5075
-
5305
+
50765306 public void valueChanged(TreeSelectionEvent e)
50775307 //public boolean handleEvent(Event event)
50785308 {
....@@ -5145,13 +5375,31 @@
51455375 {
51465376 editButton.setEnabled(enabled);
51475377 uneditButton.setEnabled(enabled);
5148
- unselectButton.setEnabled(enabled);
5378
+ //unselectButton.setEnabled(enabled);
51495379 flashSelectionButton.setEnabled(enabled);
5380
+
5381
+ clearPanelButton.setEnabled(!listUI.isEmpty());
5382
+
5383
+ boolean allComposites = true;
5384
+
5385
+ if (group.selection != null)
5386
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
5387
+ {
5388
+ Object next = e.nextElement();
5389
+ if (!(next instanceof Composite)) // || (next instanceof GroupLeaf))
5390
+ {
5391
+ allComposites = false;
5392
+ break;
5393
+ }
5394
+ }
5395
+
5396
+ rootButton.setEnabled(allComposites);
51505397 }
51515398
51525399 void refreshContents(boolean cp)
51535400 {
5154
- if (objectPanel.getSelectedIndex() == 2) // objectPanel.indexOfTab("Info"))
5401
+ if (Globals.ADVANCED)
5402
+ //if (objectPanel.getSelectedIndex() == 2) // objectPanel.indexOfTab("Info"))
51555403 if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
51565404 {
51575405 objEditor.ClearInfo(); // .GetMaterial());
....@@ -5161,7 +5409,7 @@
51615409 Object3D child = (Object3D) group.selection.get(i);
51625410
51635411 objEditor.AddInfo(child, this, true);
5164
- System.err.println("info : " + child.GetPath());
5412
+// System.err.println("info : " + child.GetPath());
51655413 }
51665414
51675415 objEditor.SetText(); // jan 2014
....@@ -5987,7 +6235,6 @@
59876235
59886236 cButton restoreCameraButton;
59896237
5990
- cButton saveButton;
59916238 cButton oneStepButton;
59926239
59936240 cButton groupButton;
....@@ -6045,11 +6292,11 @@
60456292 private MenuItem lookAtItem;
60466293 private MenuItem lookFromItem;
60476294 private MenuItem switchViewItem;
6048
- private MenuItem cutItem;
6295
+ private JMenuItem cutItem;
60496296 private MenuItem undoItem;
60506297 private MenuItem redoItem;
60516298 private JMenuItem duplicateItem;
6052
- private MenuItem cloneItem;
6299
+ private JMenuItem cloneItem;
60536300 private MenuItem cloneSupportItem;
60546301 private MenuItem overwriteGeoItem;
60556302 private MenuItem overwriteMatItem;
....@@ -6070,13 +6317,13 @@
60706317 private MenuItem cloneGeometriesItem;
60716318 private MenuItem shareGeometriesItem;
60726319 private MenuItem mergeGeometriesItem;
6073
- private MenuItem copyItem;
6320
+ private JMenuItem copyItem;
60746321 private MenuItem pasteItem;
6075
- private MenuItem pasteIntoItem;
6076
- private MenuItem pasteLinkItem;
6077
- private MenuItem pasteCloneItem;
6078
- private MenuItem pasteExpandItem;
6079
- private MenuItem deleteItem;
6322
+ private JMenuItem pasteIntoItem;
6323
+ private JMenuItem pasteLinkItem;
6324
+ private JMenuItem pasteCloneItem;
6325
+ private JMenuItem pasteExpandItem;
6326
+ private JMenuItem deleteItem;
60806327 private MenuItem clearAllItem;
60816328 private MenuItem genUVItem;
60826329 private MenuItem genNormalsMESHItem;
....@@ -6131,7 +6378,7 @@
61316378 private MenuItem transformGeometryItem;
61326379 private MenuItem transformChildrenItem;
61336380 private MenuItem hideItem;
6134
- private MenuItem grabItem;
6381
+ private JMenuItem grabItem;
61356382 private MenuItem backItem;
61366383 private MenuItem frontItem;
61376384 private MenuItem cameraItem;
....@@ -6144,7 +6391,7 @@
61446391 private MenuItem switchTransfoItem;
61456392 private MenuItem morphItem;
61466393 private MenuItem linkerItem;
6147
- private MenuItem ungroupItem;
6394
+ private JMenuItem ungroupItem;
61486395 private MenuItem editItem;
61496396 private MenuItem openWindowItem;
61506397 private MenuItem editLeafItem;