Normand Briere
2019-08-22 0c7b833be7d86598a6813cd1c6db0ca9e1b17966
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,11 +415,15 @@
356415 this.copy = this.group = group;
357416 //selectees = this.group.selectees;
358417
359
- if (copy.versionlist == null)
360
- {
361
- copy.versionlist = new Object3D[100];
362
- copy.versionindex = -1;
363
- }
418
+ assert(false);
419
+
420
+// if (copy.versionlist == null)
421
+// {
422
+// copy.versionlist = new Object3D[100];
423
+// copy.versionindex = -1;
424
+//
425
+// //Save(true);
426
+// }
364427
365428 if(ui)
366429 SetupUI(objEditor);
....@@ -383,13 +446,13 @@
383446
384447 ((cRadio)radioPanel.getComponent(0)).SetCamera(cameraView.renderCamera, true);
385448
386
- if (copy.versionlist == null)
387
- {
388
- copy.versionlist = new Object3D[100];
389
- copy.versionindex = -1;
390
-
391
- Save(true);
392
- }
449
+// if (copy.versionlist == null)
450
+// {
451
+// copy.versionlist = new Object3D[100];
452
+// copy.versionindex = -1;
453
+//
454
+// //Save(true);
455
+// }
393456 }
394457
395458 void CloneSelection(boolean supports)
....@@ -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 //
....@@ -765,6 +835,8 @@
765835 }
766836
767837 oe.menuBar.add(menu = new Menu("Attributes"));
838
+ clearVersionsItem = menu.add(new MenuItem("Clear Versions"));
839
+ clearVersionsItem.addActionListener(this);
768840 clearMaterialsItem = menu.add(new MenuItem("Clear Materials"));
769841 clearMaterialsItem.addActionListener(this);
770842 resetAllItem = menu.add(new MenuItem("Reset All"));
....@@ -787,9 +859,9 @@
787859 hideleavesItem.addActionListener(this);
788860 showleavesItem = menu.add(new MenuItem("Show Leaves"));
789861 showleavesItem.addActionListener(this);
790
- markleavesItem = menu.add(new MenuItem("Mark Leaves"));
862
+ markleavesItem = menu.add(new MenuItem("Anim Leaves"));
791863 markleavesItem.addActionListener(this);
792
- unmarkleavesItem = menu.add(new MenuItem("Unmark Leaves"));
864
+ unmarkleavesItem = menu.add(new MenuItem("Unanim Leaves"));
793865 unmarkleavesItem.addActionListener(this);
794866 rewindleavesItem = menu.add(new MenuItem("Rewind Leaves"));
795867 rewindleavesItem.addActionListener(this);
....@@ -843,6 +915,9 @@
843915 shareGeometriesItem.addActionListener(this);
844916 mergeGeometriesItem = menu.add(new MenuItem("Merge Geometries"));
845917 mergeGeometriesItem.addActionListener(this);
918
+ menu.add("-");
919
+ editLeafItem = menu.add(new MenuItem("Edit leaf..."));
920
+ editLeafItem.addActionListener(this);
846921 if (Globals.ADVANCED)
847922 {
848923 // Pretty much the same as duplicate and clone.
....@@ -859,6 +934,79 @@
859934 buildToolsMenu(menu);
860935 }
861936
937
+ JTabbedPane resourcecontainer;
938
+ cGridBag currenttab;
939
+ //boolean added; // patch for jar
940
+
941
+ int totalcount = 0;
942
+
943
+ int tabcount = 0;
944
+ int colcount = 0;
945
+ int rowcount = 0;
946
+ int texturecount = 0;
947
+
948
+ int columns = 5;
949
+ int rows = 7;
950
+
951
+ public void ResourceCallBack(String[] path)
952
+ {
953
+// for (int i = 0; i < path.length; i++)
954
+// System.out.print(path[i] + "/");
955
+// System.out.println();
956
+
957
+ if (//rowcount == 0 ||
958
+ path.length == 1 && !path[0].equals("") && !path[0].equals(".DS_Store"))
959
+ {
960
+ currenttab = new cGridBag();
961
+ String tabname = path[0]; // String.valueOf((char)('A'+tabcount));
962
+ currenttab.setName(tabname);
963
+ //added = false;
964
+ resourcecontainer.add(currenttab);
965
+ resourcecontainer.setToolTipTextAt(tabcount++, "Texture Group " + tabname);
966
+ rowcount = 1;
967
+ colcount = 0;
968
+ texturecount = 0;
969
+ }
970
+
971
+ if (path.length > 2 && (path[2].toLowerCase().endsWith(".jpg") || path[2].toLowerCase().endsWith(".png")))
972
+ {
973
+ //if (!added)
974
+ {
975
+ //added = true;
976
+ String tabname = path[0]; // String.valueOf((char)('A'+tabcount));
977
+ currenttab = (cGridBag)resourcecontainer.getComponentAt(resourcecontainer.indexOfTab(tabname));
978
+ }
979
+
980
+ AddTextureButton(path[0], path[1], path[2], ++texturecount, currenttab);
981
+ totalcount++;
982
+
983
+ if (++colcount >= columns)
984
+ {
985
+ colcount = 0;
986
+ currenttab.Return();
987
+
988
+ if (rowcount++ >= rows)
989
+ {
990
+ rowcount = 0;
991
+ }
992
+ }
993
+ }
994
+ else
995
+ {
996
+// if (!path[path.length-1].equals("icons"))
997
+// resourcecontainer.Return();
998
+ }
999
+ }
1000
+
1001
+ void CreateTexturePanel(cGridBag container)
1002
+ {
1003
+ resourcecontainer = new JTabbedPane(JTabbedPane.LEFT);
1004
+ container.add(resourcecontainer);
1005
+
1006
+ Grafreed.ParseResources("textures", this);
1007
+
1008
+ // 935. System.out.println("Total = " + totalcount);
1009
+ }
8621010
8631011 void SetupUI2(ObjEditor oe)
8641012 {
....@@ -877,11 +1025,6 @@
8771025 //new Exception().printStackTrace();
8781026
8791027 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;
8851028 // oe.toolbarPanel.add(radioPanel); //, oe.aConstraints);
8861029
8871030 oe.buttonGroup = new ButtonGroup();
....@@ -902,9 +1045,9 @@
9021045 oe.radioPanel.add(dummyButton);
9031046 oe.buttonGroup.add(dummyButton);
9041047 */
905
- cGridBag copyOptionsPanel = new cGridBag();
1048
+ cGridBag versionManagerPanel = new cGridBag();
9061049
907
- copyOptionsPanel.preferredHeight = 2;
1050
+ versionManagerPanel.preferredHeight = 4;
9081051
9091052 //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
9101053
....@@ -914,62 +1057,102 @@
9141057
9151058 if (Globals.ADVANCED)
9161059 {
917
- oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
918
- maxButton.setToolTipText("Maximize window");
919
- maxButton.addActionListener(this);
1060
+// oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1061
+// maxButton.setToolTipText("Maximize window");
1062
+// maxButton.addActionListener(this);
9201063 }
9211064
922
- oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1065
+ cButton gcButton;
1066
+
1067
+// oe.toolbarPanel.add(gcButton = GetButton("icons/trash.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1068
+// gcButton.setToolTipText("Garbage collect");
1069
+// gcButton.addActionListener(new ActionListener()
1070
+// {
1071
+// public void actionPerformed(ActionEvent e)
1072
+// {
1073
+// System.gc();
1074
+// }
1075
+// });
1076
+
1077
+ oe.toolbarPanel.add(collapseButton = GetButton("icons/collapse.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1078
+ collapseButton.setToolTipText("Collapse toolbar");
1079
+ collapseButton.addActionListener(this);
1080
+
1081
+ oe.toolbarPanel.add(maximize3DButton = GetButton("icons/square.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1082
+ maximize3DButton.setToolTipText("Maximize 3D view");
1083
+ maximize3DButton.addActionListener(this);
1084
+
1085
+ oe.toolbarPanel.add(twoButton = GetButton("icons/cube.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1086
+ twoButton.setToolTipText("Show 3D view only");
1087
+ twoButton.addActionListener(this);
1088
+ this.fullscreenLayout = twoButton;
1089
+
1090
+ oe.toolbarPanel.add(threeButton = GetButton("icons/controlsview.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1091
+ threeButton.setToolTipText("Show controls and 3D view");
1092
+ threeButton.addActionListener(this);
1093
+ if (Globals.ADVANCED)
1094
+ {
1095
+ oe.toolbarPanel.add(sixButton = GetButton("icons/viewcontrols.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1096
+ sixButton.setToolTipText("Show 3D view and controls");
1097
+ sixButton.addActionListener(this);
1098
+ }
1099
+// oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1100
+// sevenButton.setToolTipText("3-column layout");
1101
+// sevenButton.addActionListener(this);
1102
+ //
1103
+
1104
+ oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
9231105 fullButton.setToolTipText("Full-screen window");
9241106 fullButton.addActionListener(this);
9251107
926
- oe.toolbarPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1108
+ oe.toolbarPanel.add(screenfitButton = GetButton("icons/fit.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
9271109 screenfitButton.setToolTipText("Screen fit");
9281110 screenfitButton.addActionListener(this);
9291111
930
- oe.toolbarPanel.add(restoreCameraButton = GetButton("icons/eye.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1112
+ oe.toolbarPanel.add(restoreCameraButton = GetButton("icons/eye.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
9311113 restoreCameraButton.setToolTipText("Restore viewpoint");
9321114 restoreCameraButton.addActionListener(this);
9331115
934
- copyOptionsPanel.add(saveVersionButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1116
+ versionManagerPanel.add(saveVersionButton = GetButton("icons/down_arrow.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
9351117 saveVersionButton.setToolTipText("Duplicate current version");
9361118 saveVersionButton.addActionListener(this);
9371119
938
- copyOptionsPanel.add(deleteVersionButton = GetButton("icons/trash.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1120
+ versionManagerPanel.add(deleteVersionButton = GetButton("icons/trash.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
9391121 deleteVersionButton.setToolTipText("Delete current version");
9401122 deleteVersionButton.addActionListener(this);
1123
+ deleteVersionButton.setEnabled(false);
9411124
942
- copyOptionsPanel.add(previousVersionButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1125
+ versionManagerPanel.add(previousVersionButton = GetButton("icons/undo.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
9431126 previousVersionButton.setToolTipText("Previous version");
9441127 previousVersionButton.addActionListener(this);
9451128 previousVersionButton.setEnabled(false);
9461129
9471130 cGridBag updown = new cGridBag().setVertical(true);
948
- updown.add(restoreButton = GetButton("icons/restore.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1131
+ updown.add(restoreButton = GetButton("icons/restore.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
9491132 restoreButton.setToolTipText("Undo (restore current version)");
9501133 restoreButton.addActionListener(this);
951
- //restoreButton.setEnabled(false);
1134
+ restoreButton.setEnabled(false);
9521135
953
- updown.add(replaceButton = GetButton("icons/replace.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1136
+ updown.add(replaceButton = GetButton("icons/replace.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
9541137 replaceButton.setToolTipText("Save (replace current version)");
9551138 replaceButton.addActionListener(this);
956
- //replaceButton.setEnabled(false);
1139
+ replaceButton.setEnabled(false);
9571140
958
- copyOptionsPanel.add(updown);
1141
+ versionManagerPanel.add(updown);
9591142
960
- copyOptionsPanel.add(nextVersionButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1143
+ versionManagerPanel.add(nextVersionButton = GetButton("icons/redo.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
9611144 nextVersionButton.setToolTipText("Next version");
9621145 nextVersionButton.addActionListener(this);
9631146 nextVersionButton.setEnabled(false);
1147
+
1148
+ oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1149
+ oneStepButton.setToolTipText("Animate one step forward");
1150
+ oneStepButton.addActionListener(this);
9641151
9651152 oe.toolbarPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
9661153 liveCB.setToolTipText("Enable animation");
9671154 liveCB.addItemListener(this);
9681155
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
-
9731156 oe.toolbarPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
9741157 fastCB.setToolTipText("Fast mode");
9751158 fastCB.addItemListener(this);
....@@ -985,38 +1168,23 @@
9851168
9861169 if (Globals.ADVANCED)
9871170 {
988
- oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1171
+ oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Globals.NIMBUSLAF)); //, oe.aConstraints);
9891172 snapobjectButton.addActionListener(this);
9901173 snapobjectButton.setToolTipText("Snap Object");
9911174
992
- oe.toolbarPanel.add(fourButton = GetButton("icons/controls-horizontal.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1175
+ oe.toolbarPanel.add(fourButton = GetButton("icons/controls-horizontal.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
9931176 fourButton.addActionListener(this);
9941177 fourButton.setToolTipText("Show control panel only");
9951178 }
9961179
9971180 //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
9981181
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
- //
10141182
1015
- oe.toolbarPanel.add(rootButton = GetButton("icons/openwindow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1183
+ oe.toolbarPanel.add(rootButton = GetButton("icons/openwindow.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10161184 rootButton.setToolTipText("Open selection in new tab");
10171185 rootButton.addActionListener(this);
10181186
1019
- oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1187
+ oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10201188 closeButton.setToolTipText("Close tab");
10211189 closeButton.addActionListener(this);
10221190 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
....@@ -1025,38 +1193,38 @@
10251193 cGridBag row1 = new cGridBag();
10261194
10271195 // INSERT
1028
- row1.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1029
- gridButton.setToolTipText("Create grid");
1196
+ row1.add(gridButton = GetButton("icons/grid.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1197
+ gridButton.setToolTipText("Create ground");
10301198 gridButton.addActionListener(this);
10311199
1032
- row1.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1200
+ row1.add(boxButton = GetButton("icons/box.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10331201 boxButton.setToolTipText("Create box");
10341202 boxButton.addActionListener(this);
10351203
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);
1204
+ row1.add(superButton = GetButton("icons/super.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10491205 superButton.setToolTipText("Create superellipsoid");
10501206 superButton.addActionListener(this);
10511207
1208
+ row1.add(sphereButton = GetButton("icons/sphere.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1209
+ sphereButton.setToolTipText("Create sphere");
1210
+ sphereButton.addActionListener(this);
1211
+
1212
+ row1.add(coneButton = GetButton("icons/cone.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1213
+ coneButton.setToolTipText("Create cone");
1214
+ coneButton.addActionListener(this);
1215
+
1216
+ row1.add(torusButton = GetButton("icons/torus.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1217
+ torusButton.setToolTipText("Create torus");
1218
+ torusButton.addActionListener(this);
1219
+
10521220 if (Globals.ADVANCED)
10531221 {
1054
- oe.toolboxPanel.add(kleinButton = GetButton("icons/klein.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1222
+ oe.toolboxPanel.add(kleinButton = GetButton("icons/klein.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10551223 kleinButton.setToolTipText("Create Klein bottle");
10561224 kleinButton.addActionListener(this);
10571225 }
10581226
1059
- row1.add(particlesButton = GetButton("icons/particles.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1227
+ row1.add(particlesButton = GetButton("icons/particles.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10601228 particlesButton.setToolTipText("Create particle system");
10611229 particlesButton.addActionListener(this);
10621230
....@@ -1064,72 +1232,73 @@
10641232
10651233 cGridBag row2 = new cGridBag();
10661234
1067
- row2.add(groupButton = GetButton("icons/group.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1235
+ row2.add(groupButton = GetButton("icons/group.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10681236 groupButton.setToolTipText("Create group");
10691237 groupButton.addActionListener(this);
10701238
1071
- row2.add(compositeButton = GetButton("icons/composite.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1239
+ row2.add(compositeButton = GetButton("icons/composite.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10721240 compositeButton.setToolTipText("Create composite");
10731241 compositeButton.addActionListener(this);
10741242
1075
- row2.add(switchButton = GetButton("icons/switch.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1243
+ row2.add(switchButton = GetButton("icons/switch.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10761244 switchButton.setToolTipText("Create item switcher");
10771245 switchButton.addActionListener(this);
10781246
1079
- row2.add(loopButton = GetButton("icons/loop.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1247
+ row2.add(loopButton = GetButton("icons/loop.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10801248 loopButton.setToolTipText("Create loop");
10811249 loopButton.addActionListener(this);
10821250
1083
- row2.add(textureButton = GetButton("icons/texture.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1251
+ row2.add(textureButton = GetButton("icons/texture.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10841252 textureButton.setToolTipText("Create texture");
10851253 textureButton.addActionListener(this);
10861254
1087
- row2.add(overlayButton = GetButton("icons/overlay.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1255
+ row2.add(overlayButton = GetButton("icons/overlay.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10881256 overlayButton.setToolTipText("Create overlay");
10891257 overlayButton.addActionListener(this);
10901258
1091
- row2.add(lightButton = GetButton("icons/light-bulb.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1259
+ row2.add(lightButton = GetButton("icons/light-bulb.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10921260 lightButton.setToolTipText("Create light");
10931261 lightButton.addActionListener(this);
10941262
10951263 oe.toolboxPanel.add(row2);
10961264
1097
- // ENVYMAPS
1098
- cGridBag skyboxpane = new cGridBag();
1099
- skyboxpane.preferredHeight = 100;
1265
+ cGridBag textures = new cGridBag();
11001266
1101
- oe.toolboxPanel.add(skyboxpane);
1267
+ CreateTexturePanel(textures);
11021268
1103
- JTabbedPane skyboxpanel = new JTabbedPane();
1104
- skyboxpane.add(skyboxpanel);
1269
+ int tabCount = resourcecontainer.getTabCount();
11051270
1106
- AddSkyboxTab0(skyboxpanel);
1107
- AddSkyboxTab1(skyboxpanel);
1108
- AddSkyboxTab2(skyboxpanel);
1109
- AddSkyboxTab3(skyboxpanel);
1271
+ if (tabCount > 0)
1272
+ resourcecontainer.setSelectedIndex((int)(Math.random() * tabCount));
1273
+
1274
+ oe.toolboxPanel.add(textures);
1275
+
1276
+ textures.preferredHeight = 100;
1277
+
1278
+ CreateSkyboxPanel(oe.skyboxPanel);
11101279
11111280 // EDIT panel
1112
- editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1281
+ editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11131282 editButton.setToolTipText("Pin selection controls");
11141283 editButton.addActionListener(this);
11151284
1116
- editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1285
+ editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11171286 uneditButton.setToolTipText("Unpin and remove selection controls");
11181287 uneditButton.addActionListener(this);
11191288
11201289 editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
1121
- allParamsButton.setToolTipText("Show all controle");
1290
+ allParamsButton.setToolTipText("Show all controls");
11221291 allParamsButton.addActionListener(this);
11231292
1124
- editCommandsPanel.add(clearPanelButton = GetButton("icons/clear.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1125
- clearPanelButton.setToolTipText("Clear edit panel");
1293
+ editCommandsPanel.add(clearPanelButton = GetButton("icons/clear.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1294
+ clearPanelButton.setToolTipText("Clear all controls");
11261295 clearPanelButton.addActionListener(this);
11271296
1128
- editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1129
- unselectButton.setToolTipText("Unselect");
1130
- unselectButton.addActionListener(this);
1297
+ //editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1298
+ //unselectButton.setToolTipText("Unselect");
1299
+ //unselectButton.addActionListener(this);
11311300
1132
- editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1301
+ editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11331302 flashSelectionButton.setToolTipText("Highlight selection");
11341303 flashSelectionButton.addActionListener(this);
11351304
....@@ -1152,6 +1321,8 @@
11521321
11531322 cGridBag jSPPanel = new cGridBag();
11541323
1324
+ jSPPanel.preferredHeight = 20;
1325
+
11551326 JScrollPane jSP;
11561327 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
11571328 jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
....@@ -1160,11 +1331,11 @@
11601331 oe.treePanel.add(jSPPanel);
11611332 oe.treePanel.Return();
11621333
1163
- oe.treePanel.add(copyOptionsPanel);
1334
+ oe.treePanel.add(versionManagerPanel);
11641335 oe.treePanel.Return();
1165
- cGridBag sliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
1166
- versionSlider = (cNumberSlider)sliderPane.getComponent(1);
1167
- sliderPane.preferredHeight = 1;
1336
+ versionSliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
1337
+ versionSlider = (cNumberSlider)versionSliderPane.getComponent(1);
1338
+ versionSliderPane.preferredHeight = 3;
11681339
11691340 // mainPanel.setDividerLocation(0.1); //1.0);
11701341 mainPanel.setResizeWeight(0.4);
....@@ -1322,6 +1493,14 @@
13221493
13231494 void EditObject(Object3D obj)
13241495 {
1496
+ assert(obj instanceof Composite);
1497
+
1498
+// if (obj.versionlist == null)
1499
+// {
1500
+// obj.versionlist = new Object3D[100];
1501
+// obj.versionindex = -1;
1502
+// }
1503
+
13251504 cRadio radioButton = new cRadio(obj.name);
13261505
13271506 // June 2019. Patch to avoid bug with transparency.
....@@ -1346,6 +1525,7 @@
13461525
13471526 oe.SetupViews();
13481527
1528
+ if (Globals.DEBUG)
13491529 System.out.println("SetupViews");
13501530 DragSource.getDefaultDragSource().createDefaultDragGestureRecognizer(
13511531 oe.cameraView, DnDConstants.ACTION_COPY_OR_MOVE, this); // ACTION_LINK ??
....@@ -1712,7 +1892,12 @@
17121892 TreePath path;
17131893
17141894 public TransferableTreePath(TreePath tp) {
1715
- path = tp;
1895
+ Object[] objs = new Object[tp.getPathCount()];
1896
+ for (int i=0; i<objs.length; i++)
1897
+ {
1898
+ objs[i] = ((Object3D)tp.getPathComponent(i)).GetUUID();
1899
+ }
1900
+ path = new TreePath(objs);
17161901 }
17171902
17181903 public synchronized DataFlavor[] getTransferDataFlavors() {
....@@ -2002,7 +2187,11 @@
20022187 shadow.material = new cMaterial(obj.material);
20032188 shadow.material.diffuse = 0.0001f;
20042189 shadow.material.specular = 0.0001f;
2005
- //shadow.projectedVertices[1].x = 300;
2190
+ shadow.material.opacity = 0.75f;
2191
+
2192
+ AllocProjectedVertices(shadow);
2193
+
2194
+ shadow.projectedVertices[1].x = 300;
20062195
20072196 makeSomething(shadow);
20082197 }
....@@ -2523,27 +2712,35 @@
25232712 } else
25242713 if (source == loopItem || source == loopButton)
25252714 {
2715
+ if (!group.selection.isEmpty())
2716
+ {
25262717 Composite csg = new GroupLeaf();
25272718 csg.count = 5;
2528
- group(csg);
25292719 Composite child = new cGroup("Branch");
25302720 csg.addChild(child);
25312721 child.addChild(csg);
2722
+ group(csg);
2723
+ }
25322724 } else
25332725 if (source == doubleItem)
25342726 {
2727
+ if (!group.selection.isEmpty())
2728
+ {
25352729 Composite csg = new GroupLeaf("Fork");
25362730 csg.count = 5;
2537
- group(csg);
25382731 Composite child = new cGroup("Branch A");
25392732 csg.addChild(child);
25402733 child.addChild(csg);
25412734 child = new cGroup("Branch B");
25422735 csg.addChild(child);
25432736 child.addChild(csg);
2737
+ group(csg);
2738
+ }
25442739 } else
25452740 if (source == tripleItem)
25462741 {
2742
+ if (!group.selection.isEmpty())
2743
+ {
25472744 Composite csg = new GroupLeaf("Trident");
25482745 csg.count = 4;
25492746 group(csg);
....@@ -2556,6 +2753,7 @@
25562753 child = new cGroup();
25572754 csg.addChild(child);
25582755 child.addChild(csg);
2756
+ }
25592757 } else
25602758 if (source == computeAOItem)
25612759 {
....@@ -2605,6 +2803,18 @@
26052803 if (source == fullButton)
26062804 {
26072805 ToggleFullScreen();
2806
+ } else
2807
+ if (source == collapseButton)
2808
+ {
2809
+ this.expandedLayout = radio.layout;
2810
+ CollapseToolbar();
2811
+ } else
2812
+ if (source == maximize3DButton)
2813
+ {
2814
+ this.expandedLayout = radio.layout;
2815
+ radio.layout = twoButton;
2816
+ Show3DView();
2817
+ CollapseToolbar();
26082818 } else
26092819 if (source == previousVersionButton)
26102820 {
....@@ -3179,22 +3389,34 @@
31793389 } else
31803390 if (source == ungroupItem || source == ungroupButton)
31813391 {
3182
- boolean hasRoot = false;
3392
+ boolean canUngroup = true;
31833393
31843394 for (int i=0; i<group.selection.size(); i++)
31853395 {
3186
- if (group.selection.get(i) == group)
3396
+ Object3D selectedItem = group.selection.get(i);
3397
+
3398
+ if (selectedItem.Size() == 0)
31873399 {
3188
- hasRoot = true;
3400
+ // Cannot ungroup leaves
3401
+ canUngroup = false;
3402
+ break;
3403
+ }
3404
+
3405
+ if (selectedItem == group)
3406
+ {
3407
+ // Cannot ungroup root
3408
+ canUngroup = false;
31893409 break;
31903410 }
31913411 }
31923412
3193
- if (!hasRoot)
3413
+ if (canUngroup)
31943414 {
31953415 for (int i=0; i<group.selection.size(); i++)
31963416 {
3197
- Ungroup(group.selection.get(i));
3417
+ Object3D selectedItem = group.selection.get(i);
3418
+
3419
+ Ungroup(selectedItem);
31983420 }
31993421
32003422 ClearSelection(false);
....@@ -3245,6 +3467,10 @@
32453467 if (source == clearMaterialsItem)
32463468 {
32473469 ClearMaterials();
3470
+ } else
3471
+ if (source == clearVersionsItem)
3472
+ {
3473
+ ClearVersions();
32483474 } else
32493475 if (source == liveleavesItem)
32503476 {
....@@ -3557,38 +3783,7 @@
35573783 if (CameraPane.FULLSCREEN)
35583784 fullscreenLayout = radio.layout;
35593785
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();
3786
+ Show3DView();
35923787
35933788 cameraView.requestFocusInWindow();
35943789
....@@ -3774,6 +3969,7 @@
37743969 } else
37753970 if (source == rootButton)
37763971 {
3972
+ Replace();
37773973 Object3D obj;
37783974 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
37793975 {
....@@ -3788,6 +3984,8 @@
37883984 if (source == closeButton)
37893985 {
37903986 //System.out.println("CLOSE: " + buttonGroup.getSelection());
3987
+ Replace();
3988
+
37913989 cRadio ab;
37923990 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
37933991 {
....@@ -3886,6 +4084,8 @@
38864084 } else
38874085 if(source instanceof cRadio)
38884086 {
4087
+ Replace();
4088
+
38894089 group.parent = keepparent;
38904090 group.attributes = 0;
38914091 //group.editWindow = null;
....@@ -3910,8 +4110,6 @@
39104110
39114111 copy = group;
39124112
3913
- SetUndoStates();
3914
-
39154113 //Globals.theRenderer.object = group;
39164114 if(!useclient)
39174115 {
....@@ -3939,6 +4137,31 @@
39394137 */
39404138 radio.layout.doClick();
39414139
4140
+ assert(copy instanceof Composite);
4141
+
4142
+ if (copy.versionlist == null)
4143
+ {
4144
+ copy.versionindex = -1;
4145
+
4146
+ // Cannot work with loops
4147
+ // To fix this issue, we first mark all nodes above the root,
4148
+ // and check if any of these nodes are reachable below the root.
4149
+ Grafreed.grafreed.universe.TagObjects(copy, true);
4150
+
4151
+ if (copy.versionlist == null && !copy.HasTags())
4152
+ {
4153
+ copy.versionlist = new Object3D[100];
4154
+
4155
+ //Save(true);
4156
+ }
4157
+ else
4158
+ copy.versionindex = -2;
4159
+
4160
+ Grafreed.grafreed.universe.TagObjects(copy, false);
4161
+ }
4162
+
4163
+ SetVersionStates();
4164
+
39424165 ClearUnpinned();
39434166
39444167 //Grafreed.Assert(group != null);
....@@ -4082,7 +4305,7 @@
40824305 TouchTransform(obj);
40834306 continue;
40844307 }
4085
- if ((mask&2) != 0) // Scale
4308
+ if ((mask&2) != 0) // Scale/rotation
40864309 {
40874310 obj.toParent[0][0] = obj.toParent[1][1] = obj.toParent[2][2] = 1;
40884311 obj.toParent[0][1] = obj.toParent[1][0] = obj.toParent[2][0] = 0;
....@@ -4090,10 +4313,6 @@
40904313 obj.fromParent[0][0] = obj.fromParent[1][1] = obj.fromParent[2][2] = 1;
40914314 obj.fromParent[0][1] = obj.fromParent[1][0] = obj.fromParent[2][0] = 0;
40924315 obj.fromParent[0][2] = obj.fromParent[1][2] = obj.fromParent[2][1] = 0;
4093
- }
4094
- if ((mask&4) != 0) // Rotation
4095
- {
4096
- // ?
40974316 }
40984317 if ((mask&1) != 0) // Translation
40994318 {
....@@ -4902,6 +5121,12 @@
49025121 refreshContents();
49035122 }
49045123
5124
+ void ClearVersions()
5125
+ {
5126
+ group.selection.ClearVersions();
5127
+ refreshContents();
5128
+ }
5129
+
49055130 void FlipV(boolean flip)
49065131 {
49075132 group.selection.FlipV(flip);
....@@ -5169,15 +5394,31 @@
51695394 {
51705395 editButton.setEnabled(enabled);
51715396 uneditButton.setEnabled(enabled);
5172
- unselectButton.setEnabled(enabled);
5397
+ //unselectButton.setEnabled(enabled);
51735398 flashSelectionButton.setEnabled(enabled);
51745399
51755400 clearPanelButton.setEnabled(!listUI.isEmpty());
5401
+
5402
+ boolean allComposites = true;
5403
+
5404
+ if (group.selection != null)
5405
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
5406
+ {
5407
+ Object next = e.nextElement();
5408
+ if (!(next instanceof Composite)) // || (next instanceof GroupLeaf))
5409
+ {
5410
+ allComposites = false;
5411
+ break;
5412
+ }
5413
+ }
5414
+
5415
+ rootButton.setEnabled(allComposites);
51765416 }
51775417
51785418 void refreshContents(boolean cp)
51795419 {
5180
- if (objectPanel.getSelectedIndex() == 2) // objectPanel.indexOfTab("Info"))
5420
+ if (Globals.ADVANCED)
5421
+ //if (objectPanel.getSelectedIndex() == 2) // objectPanel.indexOfTab("Info"))
51815422 if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
51825423 {
51835424 objEditor.ClearInfo(); // .GetMaterial());
....@@ -5187,7 +5428,7 @@
51875428 Object3D child = (Object3D) group.selection.get(i);
51885429
51895430 objEditor.AddInfo(child, this, true);
5190
- System.err.println("info : " + child.GetPath());
5431
+// System.err.println("info : " + child.GetPath());
51915432 }
51925433
51935434 objEditor.SetText(); // jan 2014
....@@ -6070,11 +6311,11 @@
60706311 private MenuItem lookAtItem;
60716312 private MenuItem lookFromItem;
60726313 private MenuItem switchViewItem;
6073
- private MenuItem cutItem;
6314
+ private JMenuItem cutItem;
60746315 private MenuItem undoItem;
60756316 private MenuItem redoItem;
60766317 private JMenuItem duplicateItem;
6077
- private MenuItem cloneItem;
6318
+ private JMenuItem cloneItem;
60786319 private MenuItem cloneSupportItem;
60796320 private MenuItem overwriteGeoItem;
60806321 private MenuItem overwriteMatItem;
....@@ -6095,13 +6336,13 @@
60956336 private MenuItem cloneGeometriesItem;
60966337 private MenuItem shareGeometriesItem;
60976338 private MenuItem mergeGeometriesItem;
6098
- private MenuItem copyItem;
6339
+ private JMenuItem copyItem;
60996340 private MenuItem pasteItem;
6100
- private MenuItem pasteIntoItem;
6101
- private MenuItem pasteLinkItem;
6102
- private MenuItem pasteCloneItem;
6103
- private MenuItem pasteExpandItem;
6104
- private MenuItem deleteItem;
6341
+ private JMenuItem pasteIntoItem;
6342
+ private JMenuItem pasteLinkItem;
6343
+ private JMenuItem pasteCloneItem;
6344
+ private JMenuItem pasteExpandItem;
6345
+ private JMenuItem deleteItem;
61056346 private MenuItem clearAllItem;
61066347 private MenuItem genUVItem;
61076348 private MenuItem genNormalsMESHItem;
....@@ -6127,6 +6368,7 @@
61276368 private MenuItem clipMeshItem;
61286369 private MenuItem smoothMeshItem;
61296370 private MenuItem clearMaterialsItem;
6371
+ private MenuItem clearVersionsItem;
61306372
61316373 private MenuItem liveleavesItem;
61326374 private MenuItem unliveleavesItem;
....@@ -6156,7 +6398,7 @@
61566398 private MenuItem transformGeometryItem;
61576399 private MenuItem transformChildrenItem;
61586400 private MenuItem hideItem;
6159
- private MenuItem grabItem;
6401
+ private JMenuItem grabItem;
61606402 private MenuItem backItem;
61616403 private MenuItem frontItem;
61626404 private MenuItem cameraItem;
....@@ -6169,7 +6411,7 @@
61696411 private MenuItem switchTransfoItem;
61706412 private MenuItem morphItem;
61716413 private MenuItem linkerItem;
6172
- private MenuItem ungroupItem;
6414
+ private JMenuItem ungroupItem;
61736415 private MenuItem editItem;
61746416 private MenuItem openWindowItem;
61756417 private MenuItem editLeafItem;