.. | .. |
---|
16 | 16 | //import buoy.widget.BFileChooser; |
---|
17 | 17 | |
---|
18 | 18 | class GroupEditor extends ObjEditor implements //iParse, //iCallBack, |
---|
| 19 | + Grafreed.iResourceCallBack, |
---|
19 | 20 | ObjectUI, |
---|
20 | 21 | Runnable, |
---|
21 | 22 | ActionListener, |
---|
.. | .. |
---|
30 | 31 | final String path = "cubemaps/" + f + "-skyboxes/" + s; |
---|
31 | 32 | row.add(skyboxButton = GetButton(path + "/preview.jpg", !Grafreed.NIMBUSLAF)); |
---|
32 | 33 | //row.add(skyboxButton = GetButton(path + "/negx.jpg", !Grafreed.NIMBUSLAF)); |
---|
33 | | - skyboxButton.setToolTipText(s); |
---|
| 34 | + skyboxButton.setToolTipText(s.equals("") ? "No background" : s); |
---|
34 | 35 | skyboxButton.addActionListener(new ActionListener() |
---|
35 | 36 | { |
---|
36 | 37 | @Override |
---|
.. | .. |
---|
41 | 42 | }); |
---|
42 | 43 | } |
---|
43 | 44 | |
---|
| 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, !Grafreed.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 | + |
---|
44 | 61 | public void AddSkyboxTab0(JTabbedPane skyboxpanel) |
---|
45 | 62 | { |
---|
46 | 63 | cGridBag tab0 = new cGridBag().setVertical(true); |
---|
.. | .. |
---|
56 | 73 | cGridBag row5 = new cGridBag(); |
---|
57 | 74 | cGridBag row6 = new cGridBag(); |
---|
58 | 75 | |
---|
59 | | - AddSkyboxButton("default", "rgb", row0); |
---|
| 76 | + AddSkyboxButton("default", "", row0); |
---|
60 | 77 | //AddSkyboxButton("default", "cornell", row0); |
---|
61 | 78 | AddSkyboxButton("penguins", "dust", row0); |
---|
62 | 79 | AddSkyboxButton("penguins", "tropic", row0); |
---|
.. | .. |
---|
311 | 328 | } |
---|
312 | 329 | } |
---|
313 | 330 | |
---|
314 | | - public void ChangeSkybox(String name) |
---|
| 331 | + public void ChangeSkybox(String skybox) |
---|
315 | 332 | { |
---|
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(); |
---|
| 351 | + |
---|
| 352 | + AddSkyboxTab0(skyboxpane); |
---|
| 353 | + AddSkyboxTab1(skyboxpane); |
---|
| 354 | + AddSkyboxTab2(skyboxpane); |
---|
| 355 | + AddSkyboxTab3(skyboxpane); |
---|
| 356 | + |
---|
| 357 | + skyboxPanel.add(skyboxpane); |
---|
320 | 358 | } |
---|
321 | 359 | |
---|
| 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 | + |
---|
322 | 381 | //ObjEditor objEditor; |
---|
323 | 382 | public void closeUI2() |
---|
324 | 383 | { |
---|
.. | .. |
---|
360 | 419 | { |
---|
361 | 420 | copy.versionlist = new Object3D[100]; |
---|
362 | 421 | copy.versionindex = -1; |
---|
| 422 | + |
---|
| 423 | + Save(true); |
---|
363 | 424 | } |
---|
364 | 425 | |
---|
365 | 426 | if(ui) |
---|
.. | .. |
---|
479 | 540 | // menu.add("-"); |
---|
480 | 541 | duplicateItem = oe.jTree.popup.add(new JMenuItem("Duplicate")); |
---|
481 | 542 | duplicateItem.addActionListener(this); |
---|
482 | | - cloneItem = menu.add(new MenuItem("Clone")); |
---|
| 543 | + |
---|
| 544 | + cloneItem = oe.jTree.popup.add(new JMenuItem("Clone")); |
---|
483 | 545 | cloneItem.addActionListener(this); |
---|
484 | | - if (Globals.ADVANCED) |
---|
| 546 | + //if (Globals.ADVANCED) |
---|
485 | 547 | { |
---|
486 | 548 | cloneSupportItem = menu.add(new MenuItem("Clone (+supports)")); |
---|
487 | 549 | cloneSupportItem.addActionListener(this); |
---|
488 | 550 | } |
---|
| 551 | + oe.jTree.popup.addSeparator(); |
---|
489 | 552 | menu.add("-"); |
---|
490 | | - cutItem = menu.add(new MenuItem("Cut")); |
---|
| 553 | + cutItem = oe.jTree.popup.add(new JMenuItem("Cut")); |
---|
491 | 554 | cutItem.addActionListener(this); |
---|
492 | | - copyItem = menu.add(new MenuItem("Copy")); |
---|
| 555 | + copyItem = oe.jTree.popup.add(new JMenuItem("Copy")); |
---|
493 | 556 | copyItem.addActionListener(this); |
---|
494 | 557 | pasteItem = menu.add(new MenuItem("Paste")); |
---|
495 | 558 | pasteItem.addActionListener(this); |
---|
496 | 559 | |
---|
497 | | - menu.add("-"); |
---|
498 | | - pasteIntoItem = menu.add(new MenuItem("Paste into")); |
---|
| 560 | + oe.jTree.popup.addSeparator(); |
---|
| 561 | + //menu.add("-"); |
---|
| 562 | + pasteIntoItem = oe.jTree.popup.add(new JMenuItem("Paste into")); |
---|
499 | 563 | pasteIntoItem.addActionListener(this); |
---|
500 | | - pasteLinkItem = menu.add(new MenuItem("Paste link")); |
---|
| 564 | + pasteLinkItem = oe.jTree.popup.add(new JMenuItem("Paste link")); |
---|
501 | 565 | pasteLinkItem.addActionListener(this); |
---|
502 | | - pasteCloneItem = menu.add(new MenuItem("Paste clone")); |
---|
| 566 | + pasteCloneItem = oe.jTree.popup.add(new JMenuItem("Paste clone")); |
---|
503 | 567 | pasteCloneItem.addActionListener(this); |
---|
504 | | -// pasteExpandItem = menu.add(new MenuItem("Paste expand")); |
---|
| 568 | +// CRASH pasteExpandItem = oe.jTree.popup.add(new JMenuItem("Paste expand")); |
---|
505 | 569 | // pasteExpandItem.addActionListener(this); |
---|
506 | | - menu.add("-"); |
---|
507 | | - deleteItem = menu.add(new MenuItem("Delete")); |
---|
| 570 | + //menu.add("-"); |
---|
| 571 | + oe.jTree.popup.addSeparator(); |
---|
| 572 | + |
---|
| 573 | + deleteItem = oe.jTree.popup.add(new JMenuItem("Delete")); |
---|
508 | 574 | deleteItem.addActionListener(this); |
---|
509 | 575 | |
---|
510 | 576 | if (Globals.ADVANCED) |
---|
.. | .. |
---|
591 | 657 | oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest")); |
---|
592 | 658 | //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection")); |
---|
593 | 659 | //cameraMenu.add(switchViewItem = new MenuItem("Reverse View")); |
---|
594 | | - editLeafItem = oe.cameraMenu.add(new MenuItem("Edit Leaf")); |
---|
595 | 660 | oe.cameraMenu.add("-"); |
---|
596 | 661 | openWindowItem = oe.cameraMenu.add(new MenuItem("Edit copy...")); |
---|
597 | 662 | openWindowItem.addActionListener(this); |
---|
598 | | - editLeafItem.addActionListener(this); |
---|
599 | 663 | lookAtItem.addActionListener(this); |
---|
600 | 664 | //lookFromItem.addActinoListener(this); |
---|
601 | 665 | //switchViewItem.addActionListener(this); |
---|
.. | .. |
---|
657 | 721 | hideItem = menu.add(new MenuItem("Hidden Group")); |
---|
658 | 722 | hideItem.addActionListener(this); |
---|
659 | 723 | } |
---|
660 | | - ungroupItem = menu.add(new MenuItem("Ungroup")); |
---|
| 724 | + ungroupItem = oe.jTree.popup.add(new JMenuItem("Ungroup")); |
---|
661 | 725 | ungroupItem.addActionListener(this); |
---|
662 | 726 | |
---|
663 | 727 | // menu.add("-"); |
---|
.. | .. |
---|
843 | 907 | shareGeometriesItem.addActionListener(this); |
---|
844 | 908 | mergeGeometriesItem = menu.add(new MenuItem("Merge Geometries")); |
---|
845 | 909 | mergeGeometriesItem.addActionListener(this); |
---|
| 910 | + menu.add("-"); |
---|
| 911 | + editLeafItem = menu.add(new MenuItem("Edit leaf...")); |
---|
| 912 | + editLeafItem.addActionListener(this); |
---|
846 | 913 | if (Globals.ADVANCED) |
---|
847 | 914 | { |
---|
848 | 915 | // Pretty much the same as duplicate and clone. |
---|
.. | .. |
---|
859 | 926 | buildToolsMenu(menu); |
---|
860 | 927 | } |
---|
861 | 928 | |
---|
| 929 | + JTabbedPane resourcecontainer; |
---|
| 930 | + cGridBag currenttab; |
---|
| 931 | + boolean added; // patch for jar |
---|
| 932 | + |
---|
| 933 | + int tabcount = 0; |
---|
| 934 | + int colcount = 0; |
---|
| 935 | + int rowcount = 0; |
---|
| 936 | + int texturecount = 0; |
---|
| 937 | + |
---|
| 938 | + int columns = 5; |
---|
| 939 | + int rows = 7; |
---|
| 940 | + |
---|
| 941 | + public void ResourceCallBack(String[] path) |
---|
| 942 | + { |
---|
| 943 | + for (int i = 0; i < path.length; i++) |
---|
| 944 | + System.out.print(path[i] + "/"); |
---|
| 945 | + System.out.println(); |
---|
| 946 | + |
---|
| 947 | + if (//rowcount == 0 || |
---|
| 948 | + path.length == 1) |
---|
| 949 | + { |
---|
| 950 | + currenttab = new cGridBag(); |
---|
| 951 | + added = false; |
---|
| 952 | + String tabname = path[0]; // String.valueOf((char)('A'+tabcount)); |
---|
| 953 | + currenttab.setName(tabname); |
---|
| 954 | + rowcount = 1; |
---|
| 955 | + colcount = 0; |
---|
| 956 | + texturecount = 0; |
---|
| 957 | + } |
---|
| 958 | + |
---|
| 959 | + if (path.length > 2 && path[2].toLowerCase().endsWith(".jpg")) |
---|
| 960 | + { |
---|
| 961 | + if (!added) |
---|
| 962 | + { |
---|
| 963 | + added = true; |
---|
| 964 | + resourcecontainer.add(currenttab); |
---|
| 965 | + String tabname = path[0]; // String.valueOf((char)('A'+tabcount)); |
---|
| 966 | + resourcecontainer.setToolTipTextAt(tabcount++, "Texture Group " + tabname); |
---|
| 967 | + } |
---|
| 968 | + |
---|
| 969 | + AddTextureButton(path[0], path[1], path[2], texturecount++, currenttab); |
---|
| 970 | + |
---|
| 971 | + if (++colcount >= columns) |
---|
| 972 | + { |
---|
| 973 | + colcount = 0; |
---|
| 974 | + currenttab.Return(); |
---|
| 975 | + |
---|
| 976 | + if (rowcount++ >= rows) |
---|
| 977 | + { |
---|
| 978 | + rowcount = 0; |
---|
| 979 | + } |
---|
| 980 | + } |
---|
| 981 | + } |
---|
| 982 | + else |
---|
| 983 | + { |
---|
| 984 | +// if (!path[path.length-1].equals("icons")) |
---|
| 985 | +// resourcecontainer.Return(); |
---|
| 986 | + } |
---|
| 987 | + } |
---|
| 988 | + |
---|
| 989 | + void CreateTexturePanel(cGridBag container) |
---|
| 990 | + { |
---|
| 991 | + resourcecontainer = new JTabbedPane(JTabbedPane.LEFT); |
---|
| 992 | + container.add(resourcecontainer); |
---|
| 993 | + |
---|
| 994 | + Grafreed.ParseResources("textures", this); |
---|
| 995 | + } |
---|
862 | 996 | |
---|
863 | 997 | void SetupUI2(ObjEditor oe) |
---|
864 | 998 | { |
---|
.. | .. |
---|
877 | 1011 | //new Exception().printStackTrace(); |
---|
878 | 1012 | |
---|
879 | 1013 | 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; |
---|
885 | 1014 | // oe.toolbarPanel.add(radioPanel); //, oe.aConstraints); |
---|
886 | 1015 | |
---|
887 | 1016 | oe.buttonGroup = new ButtonGroup(); |
---|
.. | .. |
---|
914 | 1043 | |
---|
915 | 1044 | if (Globals.ADVANCED) |
---|
916 | 1045 | { |
---|
917 | | - oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
918 | | - maxButton.setToolTipText("Maximize window"); |
---|
919 | | - maxButton.addActionListener(this); |
---|
| 1046 | +// oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 1047 | +// maxButton.setToolTipText("Maximize window"); |
---|
| 1048 | +// maxButton.addActionListener(this); |
---|
920 | 1049 | } |
---|
| 1050 | + |
---|
| 1051 | + cButton gcButton; |
---|
| 1052 | + |
---|
| 1053 | +// oe.toolbarPanel.add(gcButton = GetButton("icons/trash.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 1054 | +// gcButton.setToolTipText("Garbage collect"); |
---|
| 1055 | +// gcButton.addActionListener(new ActionListener() |
---|
| 1056 | +// { |
---|
| 1057 | +// public void actionPerformed(ActionEvent e) |
---|
| 1058 | +// { |
---|
| 1059 | +// System.gc(); |
---|
| 1060 | +// } |
---|
| 1061 | +// }); |
---|
| 1062 | + |
---|
| 1063 | + oe.toolbarPanel.add(collapseButton = GetButton("icons/collapse.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 1064 | + collapseButton.setToolTipText("Collapse toolbar"); |
---|
| 1065 | + collapseButton.addActionListener(this); |
---|
| 1066 | + |
---|
| 1067 | + oe.toolbarPanel.add(maximize3DButton = GetButton("", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 1068 | + maximize3DButton.setToolTipText("Maximize 3D view"); |
---|
| 1069 | + maximize3DButton.addActionListener(this); |
---|
| 1070 | + |
---|
| 1071 | + oe.toolbarPanel.add(twoButton = GetButton("icons/cube.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 1072 | + twoButton.setToolTipText("Show 3D view only"); |
---|
| 1073 | + twoButton.addActionListener(this); |
---|
| 1074 | + this.fullscreenLayout = twoButton; |
---|
| 1075 | + |
---|
| 1076 | + oe.toolbarPanel.add(threeButton = GetButton("icons/controlsview.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 1077 | + threeButton.setToolTipText("Show controls and 3D view"); |
---|
| 1078 | + threeButton.addActionListener(this); |
---|
| 1079 | + if (Globals.ADVANCED) |
---|
| 1080 | + { |
---|
| 1081 | + oe.toolbarPanel.add(sixButton = GetButton("icons/viewcontrols.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 1082 | + sixButton.setToolTipText("Show 3D view and controls"); |
---|
| 1083 | + sixButton.addActionListener(this); |
---|
| 1084 | + } |
---|
| 1085 | +// oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 1086 | +// sevenButton.setToolTipText("3-column layout"); |
---|
| 1087 | +// sevenButton.addActionListener(this); |
---|
| 1088 | + // |
---|
921 | 1089 | |
---|
922 | 1090 | oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
923 | 1091 | fullButton.setToolTipText("Full-screen window"); |
---|
.. | .. |
---|
948 | 1116 | updown.add(restoreButton = GetButton("icons/restore.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
949 | 1117 | restoreButton.setToolTipText("Undo (restore current version)"); |
---|
950 | 1118 | restoreButton.addActionListener(this); |
---|
951 | | - restoreButton.setEnabled(false); |
---|
| 1119 | + //restoreButton.setEnabled(false); |
---|
952 | 1120 | |
---|
953 | 1121 | updown.add(replaceButton = GetButton("icons/replace.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
954 | 1122 | replaceButton.setToolTipText("Save (replace current version)"); |
---|
955 | 1123 | replaceButton.addActionListener(this); |
---|
956 | | - replaceButton.setEnabled(false); |
---|
| 1124 | + //replaceButton.setEnabled(false); |
---|
957 | 1125 | |
---|
958 | 1126 | copyOptionsPanel.add(updown); |
---|
959 | 1127 | |
---|
.. | .. |
---|
962 | 1130 | nextVersionButton.addActionListener(this); |
---|
963 | 1131 | nextVersionButton.setEnabled(false); |
---|
964 | 1132 | |
---|
965 | | - oe.toolbarPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints); |
---|
966 | | - liveCB.setToolTipText("Enable animation"); |
---|
967 | | - liveCB.addItemListener(this); |
---|
968 | | - |
---|
969 | 1133 | oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
970 | 1134 | oneStepButton.setToolTipText("Animate one step forward"); |
---|
971 | 1135 | oneStepButton.addActionListener(this); |
---|
972 | 1136 | |
---|
| 1137 | + oe.toolbarPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints); |
---|
| 1138 | + liveCB.setToolTipText("Enable animation"); |
---|
| 1139 | + liveCB.addItemListener(this); |
---|
| 1140 | + |
---|
973 | 1141 | oe.toolbarPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints); |
---|
974 | 1142 | fastCB.setToolTipText("Fast mode"); |
---|
975 | 1143 | fastCB.addItemListener(this); |
---|
.. | .. |
---|
996 | 1164 | |
---|
997 | 1165 | //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL)); |
---|
998 | 1166 | |
---|
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 | | - // |
---|
1014 | 1167 | |
---|
1015 | 1168 | oe.toolbarPanel.add(rootButton = GetButton("icons/openwindow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
1016 | 1169 | rootButton.setToolTipText("Open selection in new tab"); |
---|
.. | .. |
---|
1026 | 1179 | |
---|
1027 | 1180 | // INSERT |
---|
1028 | 1181 | row1.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
1029 | | - gridButton.setToolTipText("Create grid"); |
---|
| 1182 | + gridButton.setToolTipText("Create ground"); |
---|
1030 | 1183 | gridButton.addActionListener(this); |
---|
1031 | 1184 | |
---|
1032 | 1185 | row1.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
.. | .. |
---|
1094 | 1247 | |
---|
1095 | 1248 | oe.toolboxPanel.add(row2); |
---|
1096 | 1249 | |
---|
1097 | | - // ENVYMAPS |
---|
1098 | | - cGridBag skyboxpane = new cGridBag(); |
---|
1099 | | - skyboxpane.preferredHeight = 100; |
---|
| 1250 | + cGridBag textures = new cGridBag(); |
---|
1100 | 1251 | |
---|
1101 | | - oe.toolboxPanel.add(skyboxpane); |
---|
| 1252 | + CreateTexturePanel(textures); |
---|
1102 | 1253 | |
---|
1103 | | - JTabbedPane skyboxpanel = new JTabbedPane(); |
---|
1104 | | - skyboxpane.add(skyboxpanel); |
---|
| 1254 | + oe.toolboxPanel.add(textures); |
---|
1105 | 1255 | |
---|
1106 | | - AddSkyboxTab0(skyboxpanel); |
---|
1107 | | - AddSkyboxTab1(skyboxpanel); |
---|
1108 | | - AddSkyboxTab2(skyboxpanel); |
---|
1109 | | - AddSkyboxTab3(skyboxpanel); |
---|
| 1256 | + textures.preferredHeight = 100; |
---|
| 1257 | + |
---|
| 1258 | + CreateSkyboxPanel(oe.skyboxPanel); |
---|
1110 | 1259 | |
---|
1111 | 1260 | // EDIT panel |
---|
1112 | 1261 | editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
.. | .. |
---|
1118 | 1267 | uneditButton.addActionListener(this); |
---|
1119 | 1268 | |
---|
1120 | 1269 | editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints); |
---|
1121 | | - allParamsButton.setToolTipText("Show all controle"); |
---|
| 1270 | + allParamsButton.setToolTipText("Show all controls"); |
---|
1122 | 1271 | allParamsButton.addActionListener(this); |
---|
1123 | 1272 | |
---|
1124 | 1273 | editCommandsPanel.add(clearPanelButton = GetButton("icons/clear.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
1125 | | - clearPanelButton.setToolTipText("Clear edit panel"); |
---|
| 1274 | + clearPanelButton.setToolTipText("Clear all controls"); |
---|
1126 | 1275 | clearPanelButton.addActionListener(this); |
---|
1127 | 1276 | |
---|
1128 | | - editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
1129 | | - unselectButton.setToolTipText("Unselect"); |
---|
1130 | | - unselectButton.addActionListener(this); |
---|
| 1277 | + //editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 1278 | + //unselectButton.setToolTipText("Unselect"); |
---|
| 1279 | + //unselectButton.addActionListener(this); |
---|
1131 | 1280 | |
---|
1132 | 1281 | editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
1133 | 1282 | flashSelectionButton.setToolTipText("Highlight selection"); |
---|
.. | .. |
---|
1322 | 1471 | |
---|
1323 | 1472 | void EditObject(Object3D obj) |
---|
1324 | 1473 | { |
---|
| 1474 | + assert(obj instanceof Composite); |
---|
| 1475 | + |
---|
| 1476 | +// if (obj.versionlist == null) |
---|
| 1477 | +// { |
---|
| 1478 | +// obj.versionlist = new Object3D[100]; |
---|
| 1479 | +// obj.versionindex = -1; |
---|
| 1480 | +// } |
---|
| 1481 | + |
---|
1325 | 1482 | cRadio radioButton = new cRadio(obj.name); |
---|
1326 | 1483 | |
---|
1327 | 1484 | // June 2019. Patch to avoid bug with transparency. |
---|
.. | .. |
---|
1712 | 1869 | TreePath path; |
---|
1713 | 1870 | |
---|
1714 | 1871 | public TransferableTreePath(TreePath tp) { |
---|
1715 | | - path = tp; |
---|
| 1872 | + Object[] objs = new Object[tp.getPathCount()]; |
---|
| 1873 | + for (int i=0; i<objs.length; i++) |
---|
| 1874 | + { |
---|
| 1875 | + objs[i] = ((Object3D)tp.getPathComponent(i)).GetUUID(); |
---|
| 1876 | + } |
---|
| 1877 | + path = new TreePath(objs); |
---|
1716 | 1878 | } |
---|
1717 | 1879 | |
---|
1718 | 1880 | public synchronized DataFlavor[] getTransferDataFlavors() { |
---|
.. | .. |
---|
2523 | 2685 | } else |
---|
2524 | 2686 | if (source == loopItem || source == loopButton) |
---|
2525 | 2687 | { |
---|
| 2688 | + if (!group.selection.isEmpty()) |
---|
| 2689 | + { |
---|
2526 | 2690 | Composite csg = new GroupLeaf(); |
---|
2527 | 2691 | csg.count = 5; |
---|
2528 | | - group(csg); |
---|
2529 | 2692 | Composite child = new cGroup("Branch"); |
---|
2530 | 2693 | csg.addChild(child); |
---|
2531 | 2694 | child.addChild(csg); |
---|
| 2695 | + group(csg); |
---|
| 2696 | + } |
---|
2532 | 2697 | } else |
---|
2533 | 2698 | if (source == doubleItem) |
---|
2534 | 2699 | { |
---|
| 2700 | + if (!group.selection.isEmpty()) |
---|
| 2701 | + { |
---|
2535 | 2702 | Composite csg = new GroupLeaf("Fork"); |
---|
2536 | 2703 | csg.count = 5; |
---|
2537 | | - group(csg); |
---|
2538 | 2704 | Composite child = new cGroup("Branch A"); |
---|
2539 | 2705 | csg.addChild(child); |
---|
2540 | 2706 | child.addChild(csg); |
---|
2541 | 2707 | child = new cGroup("Branch B"); |
---|
2542 | 2708 | csg.addChild(child); |
---|
2543 | 2709 | child.addChild(csg); |
---|
| 2710 | + group(csg); |
---|
| 2711 | + } |
---|
2544 | 2712 | } else |
---|
2545 | 2713 | if (source == tripleItem) |
---|
2546 | 2714 | { |
---|
| 2715 | + if (!group.selection.isEmpty()) |
---|
| 2716 | + { |
---|
2547 | 2717 | Composite csg = new GroupLeaf("Trident"); |
---|
2548 | 2718 | csg.count = 4; |
---|
2549 | 2719 | group(csg); |
---|
.. | .. |
---|
2556 | 2726 | child = new cGroup(); |
---|
2557 | 2727 | csg.addChild(child); |
---|
2558 | 2728 | child.addChild(csg); |
---|
| 2729 | + } |
---|
2559 | 2730 | } else |
---|
2560 | 2731 | if (source == computeAOItem) |
---|
2561 | 2732 | { |
---|
.. | .. |
---|
2606 | 2777 | { |
---|
2607 | 2778 | ToggleFullScreen(); |
---|
2608 | 2779 | } else |
---|
| 2780 | + if (source == collapseButton) |
---|
| 2781 | + { |
---|
| 2782 | + this.expandedLayout = radio.layout; |
---|
| 2783 | + CollapseToolbar(); |
---|
| 2784 | + } else |
---|
| 2785 | + if (source == maximize3DButton) |
---|
| 2786 | + { |
---|
| 2787 | + this.expandedLayout = radio.layout; |
---|
| 2788 | + radio.layout = twoButton; |
---|
| 2789 | + Show3DView(); |
---|
| 2790 | + CollapseToolbar(); |
---|
| 2791 | + } else |
---|
2609 | 2792 | if (source == previousVersionButton) |
---|
2610 | 2793 | { |
---|
2611 | 2794 | // Go to previous version |
---|
.. | .. |
---|
2617 | 2800 | { |
---|
2618 | 2801 | // Restore current version |
---|
2619 | 2802 | Restore(); |
---|
2620 | | - restoreButton.setEnabled(false); |
---|
| 2803 | + //restoreButton.setEnabled(false); |
---|
2621 | 2804 | } else |
---|
2622 | 2805 | if (source == replaceButton) |
---|
2623 | 2806 | { |
---|
2624 | 2807 | // Overwrite current version |
---|
2625 | 2808 | Replace(); |
---|
2626 | | - replaceButton.setEnabled(false); |
---|
| 2809 | + //replaceButton.setEnabled(false); |
---|
2627 | 2810 | } else |
---|
2628 | 2811 | if (source == nextVersionButton) |
---|
2629 | 2812 | { |
---|
.. | .. |
---|
3179 | 3362 | } else |
---|
3180 | 3363 | if (source == ungroupItem || source == ungroupButton) |
---|
3181 | 3364 | { |
---|
3182 | | - boolean hasRoot = false; |
---|
| 3365 | + boolean canUngroup = true; |
---|
3183 | 3366 | |
---|
3184 | 3367 | for (int i=0; i<group.selection.size(); i++) |
---|
3185 | 3368 | { |
---|
3186 | | - if (group.selection.get(i) == group) |
---|
| 3369 | + Object3D selectedItem = group.selection.get(i); |
---|
| 3370 | + |
---|
| 3371 | + if (selectedItem.Size() == 0) |
---|
3187 | 3372 | { |
---|
3188 | | - hasRoot = true; |
---|
| 3373 | + // Cannot ungroup leaves |
---|
| 3374 | + canUngroup = false; |
---|
| 3375 | + break; |
---|
| 3376 | + } |
---|
| 3377 | + |
---|
| 3378 | + if (selectedItem == group) |
---|
| 3379 | + { |
---|
| 3380 | + // Cannot ungroup root |
---|
| 3381 | + canUngroup = false; |
---|
3189 | 3382 | break; |
---|
3190 | 3383 | } |
---|
3191 | 3384 | } |
---|
3192 | 3385 | |
---|
3193 | | - if (!hasRoot) |
---|
| 3386 | + if (canUngroup) |
---|
3194 | 3387 | { |
---|
3195 | 3388 | for (int i=0; i<group.selection.size(); i++) |
---|
3196 | 3389 | { |
---|
3197 | | - Ungroup(group.selection.get(i)); |
---|
| 3390 | + Object3D selectedItem = group.selection.get(i); |
---|
| 3391 | + |
---|
| 3392 | + Ungroup(selectedItem); |
---|
3198 | 3393 | } |
---|
3199 | 3394 | |
---|
3200 | 3395 | ClearSelection(false); |
---|
.. | .. |
---|
3557 | 3752 | if (CameraPane.FULLSCREEN) |
---|
3558 | 3753 | fullscreenLayout = radio.layout; |
---|
3559 | 3754 | |
---|
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(); |
---|
| 3755 | + Show3DView(); |
---|
3592 | 3756 | |
---|
3593 | 3757 | cameraView.requestFocusInWindow(); |
---|
3594 | 3758 | |
---|
.. | .. |
---|
3774 | 3938 | } else |
---|
3775 | 3939 | if (source == rootButton) |
---|
3776 | 3940 | { |
---|
| 3941 | + Replace(); |
---|
3777 | 3942 | Object3D obj; |
---|
3778 | 3943 | for (Enumeration e = group.selection.elements(); e.hasMoreElements();) |
---|
3779 | 3944 | { |
---|
.. | .. |
---|
3910 | 4075 | |
---|
3911 | 4076 | copy = group; |
---|
3912 | 4077 | |
---|
3913 | | - SetUndoStates(); |
---|
3914 | | - |
---|
3915 | 4078 | //Globals.theRenderer.object = group; |
---|
3916 | 4079 | if(!useclient) |
---|
3917 | 4080 | { |
---|
.. | .. |
---|
3939 | 4102 | */ |
---|
3940 | 4103 | radio.layout.doClick(); |
---|
3941 | 4104 | |
---|
| 4105 | + assert(copy instanceof Composite); |
---|
| 4106 | + |
---|
| 4107 | + if (copy.versionlist == null) |
---|
| 4108 | + { |
---|
| 4109 | + copy.versionlist = new Object3D[100]; |
---|
| 4110 | + copy.versionindex = -1; |
---|
| 4111 | + |
---|
| 4112 | + Save(true); |
---|
| 4113 | + } |
---|
| 4114 | + |
---|
| 4115 | + SetVersionStates(); |
---|
| 4116 | + |
---|
3942 | 4117 | ClearUnpinned(); |
---|
3943 | 4118 | |
---|
3944 | 4119 | //Grafreed.Assert(group != null); |
---|
.. | .. |
---|
5169 | 5344 | { |
---|
5170 | 5345 | editButton.setEnabled(enabled); |
---|
5171 | 5346 | uneditButton.setEnabled(enabled); |
---|
5172 | | - unselectButton.setEnabled(enabled); |
---|
| 5347 | + //unselectButton.setEnabled(enabled); |
---|
5173 | 5348 | flashSelectionButton.setEnabled(enabled); |
---|
5174 | 5349 | |
---|
5175 | 5350 | clearPanelButton.setEnabled(!listUI.isEmpty()); |
---|
| 5351 | + |
---|
| 5352 | + boolean allComposites = true; |
---|
| 5353 | + |
---|
| 5354 | + if (group.selection != null) |
---|
| 5355 | + for (Enumeration e = group.selection.elements(); e.hasMoreElements();) |
---|
| 5356 | + { |
---|
| 5357 | + if (!(e.nextElement() instanceof Composite)) |
---|
| 5358 | + { |
---|
| 5359 | + allComposites = false; |
---|
| 5360 | + break; |
---|
| 5361 | + } |
---|
| 5362 | + } |
---|
| 5363 | + |
---|
| 5364 | + rootButton.setEnabled(allComposites); |
---|
5176 | 5365 | } |
---|
5177 | 5366 | |
---|
5178 | 5367 | void refreshContents(boolean cp) |
---|
5179 | 5368 | { |
---|
5180 | | - if (objectPanel.getSelectedIndex() == 2) // objectPanel.indexOfTab("Info")) |
---|
| 5369 | + //if (objectPanel.getSelectedIndex() == 2) // objectPanel.indexOfTab("Info")) |
---|
5181 | 5370 | if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING) |
---|
5182 | 5371 | { |
---|
5183 | 5372 | objEditor.ClearInfo(); // .GetMaterial()); |
---|
.. | .. |
---|
5187 | 5376 | Object3D child = (Object3D) group.selection.get(i); |
---|
5188 | 5377 | |
---|
5189 | 5378 | objEditor.AddInfo(child, this, true); |
---|
5190 | | - System.err.println("info : " + child.GetPath()); |
---|
| 5379 | +// System.err.println("info : " + child.GetPath()); |
---|
5191 | 5380 | } |
---|
5192 | 5381 | |
---|
5193 | 5382 | objEditor.SetText(); // jan 2014 |
---|
.. | .. |
---|
6070 | 6259 | private MenuItem lookAtItem; |
---|
6071 | 6260 | private MenuItem lookFromItem; |
---|
6072 | 6261 | private MenuItem switchViewItem; |
---|
6073 | | - private MenuItem cutItem; |
---|
| 6262 | + private JMenuItem cutItem; |
---|
6074 | 6263 | private MenuItem undoItem; |
---|
6075 | 6264 | private MenuItem redoItem; |
---|
6076 | 6265 | private JMenuItem duplicateItem; |
---|
6077 | | - private MenuItem cloneItem; |
---|
| 6266 | + private JMenuItem cloneItem; |
---|
6078 | 6267 | private MenuItem cloneSupportItem; |
---|
6079 | 6268 | private MenuItem overwriteGeoItem; |
---|
6080 | 6269 | private MenuItem overwriteMatItem; |
---|
.. | .. |
---|
6095 | 6284 | private MenuItem cloneGeometriesItem; |
---|
6096 | 6285 | private MenuItem shareGeometriesItem; |
---|
6097 | 6286 | private MenuItem mergeGeometriesItem; |
---|
6098 | | - private MenuItem copyItem; |
---|
| 6287 | + private JMenuItem copyItem; |
---|
6099 | 6288 | private MenuItem pasteItem; |
---|
6100 | | - private MenuItem pasteIntoItem; |
---|
6101 | | - private MenuItem pasteLinkItem; |
---|
6102 | | - private MenuItem pasteCloneItem; |
---|
6103 | | - private MenuItem pasteExpandItem; |
---|
6104 | | - private MenuItem deleteItem; |
---|
| 6289 | + private JMenuItem pasteIntoItem; |
---|
| 6290 | + private JMenuItem pasteLinkItem; |
---|
| 6291 | + private JMenuItem pasteCloneItem; |
---|
| 6292 | + private JMenuItem pasteExpandItem; |
---|
| 6293 | + private JMenuItem deleteItem; |
---|
6105 | 6294 | private MenuItem clearAllItem; |
---|
6106 | 6295 | private MenuItem genUVItem; |
---|
6107 | 6296 | private MenuItem genNormalsMESHItem; |
---|
.. | .. |
---|
6169 | 6358 | private MenuItem switchTransfoItem; |
---|
6170 | 6359 | private MenuItem morphItem; |
---|
6171 | 6360 | private MenuItem linkerItem; |
---|
6172 | | - private MenuItem ungroupItem; |
---|
| 6361 | + private JMenuItem ungroupItem; |
---|
6173 | 6362 | private MenuItem editItem; |
---|
6174 | 6363 | private MenuItem openWindowItem; |
---|
6175 | 6364 | private MenuItem editLeafItem; |
---|