.. | .. |
---|
16 | 16 | //import buoy.widget.BFileChooser; |
---|
17 | 17 | |
---|
18 | 18 | class GroupEditor extends ObjEditor implements //iParse, //iCallBack, |
---|
19 | | - Grafreed.iResourceCallBack, |
---|
| 19 | + Grafreed.iResourceCallBack, |
---|
20 | 20 | ObjectUI, |
---|
21 | 21 | Runnable, |
---|
22 | 22 | ActionListener, |
---|
.. | .. |
---|
31 | 31 | final String path = "cubemaps/" + f + "-skyboxes/" + s; |
---|
32 | 32 | row.add(skyboxButton = GetButton(path + "/preview.jpg", !Grafreed.NIMBUSLAF)); |
---|
33 | 33 | //row.add(skyboxButton = GetButton(path + "/negx.jpg", !Grafreed.NIMBUSLAF)); |
---|
34 | | - skyboxButton.setToolTipText(s); |
---|
| 34 | + skyboxButton.setToolTipText(s.equals("") ? "No background" : s); |
---|
35 | 35 | skyboxButton.addActionListener(new ActionListener() |
---|
36 | 36 | { |
---|
37 | 37 | @Override |
---|
.. | .. |
---|
42 | 42 | }); |
---|
43 | 43 | } |
---|
44 | 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 | + |
---|
45 | 61 | public void AddSkyboxTab0(JTabbedPane skyboxpanel) |
---|
46 | 62 | { |
---|
47 | 63 | cGridBag tab0 = new cGridBag().setVertical(true); |
---|
.. | .. |
---|
57 | 73 | cGridBag row5 = new cGridBag(); |
---|
58 | 74 | cGridBag row6 = new cGridBag(); |
---|
59 | 75 | |
---|
60 | | - AddSkyboxButton("default", "rgb", row0); |
---|
| 76 | + AddSkyboxButton("default", "", row0); |
---|
61 | 77 | //AddSkyboxButton("default", "cornell", row0); |
---|
62 | 78 | AddSkyboxButton("penguins", "dust", row0); |
---|
63 | 79 | AddSkyboxButton("penguins", "tropic", row0); |
---|
.. | .. |
---|
312 | 328 | } |
---|
313 | 329 | } |
---|
314 | 330 | |
---|
315 | | - public void CallBack(String[] path) |
---|
316 | | - { |
---|
317 | | - for (int i = 0; i < path.length; i++) |
---|
318 | | - { |
---|
319 | | - System.out.print(path[i] + "/"); |
---|
320 | | - } |
---|
321 | | - |
---|
322 | | - System.out.println(); |
---|
323 | | - } |
---|
324 | | - |
---|
325 | 331 | public void ChangeSkybox(String skybox) |
---|
326 | 332 | { |
---|
327 | | - //cameraView.envyoff = false; |
---|
328 | | - group.skyboxname = skybox; |
---|
329 | | - group.skyboxext = "jpg"; |
---|
330 | | - 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 | + } |
---|
331 | 347 | |
---|
332 | | - Grafreed.ParseResources("textures", this); |
---|
| 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); |
---|
333 | 358 | } |
---|
334 | 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 | + |
---|
335 | 381 | //ObjEditor objEditor; |
---|
336 | 382 | public void closeUI2() |
---|
337 | 383 | { |
---|
.. | .. |
---|
373 | 419 | { |
---|
374 | 420 | copy.versionlist = new Object3D[100]; |
---|
375 | 421 | copy.versionindex = -1; |
---|
| 422 | + |
---|
| 423 | + Save(true); |
---|
376 | 424 | } |
---|
377 | 425 | |
---|
378 | 426 | if(ui) |
---|
.. | .. |
---|
492 | 540 | // menu.add("-"); |
---|
493 | 541 | duplicateItem = oe.jTree.popup.add(new JMenuItem("Duplicate")); |
---|
494 | 542 | duplicateItem.addActionListener(this); |
---|
495 | | - cloneItem = menu.add(new MenuItem("Clone")); |
---|
| 543 | + |
---|
| 544 | + cloneItem = oe.jTree.popup.add(new JMenuItem("Clone")); |
---|
496 | 545 | cloneItem.addActionListener(this); |
---|
497 | | - if (Globals.ADVANCED) |
---|
| 546 | + //if (Globals.ADVANCED) |
---|
498 | 547 | { |
---|
499 | 548 | cloneSupportItem = menu.add(new MenuItem("Clone (+supports)")); |
---|
500 | 549 | cloneSupportItem.addActionListener(this); |
---|
501 | 550 | } |
---|
| 551 | + oe.jTree.popup.addSeparator(); |
---|
502 | 552 | menu.add("-"); |
---|
503 | | - cutItem = menu.add(new MenuItem("Cut")); |
---|
| 553 | + cutItem = oe.jTree.popup.add(new JMenuItem("Cut")); |
---|
504 | 554 | cutItem.addActionListener(this); |
---|
505 | | - copyItem = menu.add(new MenuItem("Copy")); |
---|
| 555 | + copyItem = oe.jTree.popup.add(new JMenuItem("Copy")); |
---|
506 | 556 | copyItem.addActionListener(this); |
---|
507 | 557 | pasteItem = menu.add(new MenuItem("Paste")); |
---|
508 | 558 | pasteItem.addActionListener(this); |
---|
509 | 559 | |
---|
510 | | - menu.add("-"); |
---|
511 | | - 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")); |
---|
512 | 563 | pasteIntoItem.addActionListener(this); |
---|
513 | | - pasteLinkItem = menu.add(new MenuItem("Paste link")); |
---|
| 564 | + pasteLinkItem = oe.jTree.popup.add(new JMenuItem("Paste link")); |
---|
514 | 565 | pasteLinkItem.addActionListener(this); |
---|
515 | | - pasteCloneItem = menu.add(new MenuItem("Paste clone")); |
---|
| 566 | + pasteCloneItem = oe.jTree.popup.add(new JMenuItem("Paste clone")); |
---|
516 | 567 | pasteCloneItem.addActionListener(this); |
---|
517 | | -// pasteExpandItem = menu.add(new MenuItem("Paste expand")); |
---|
| 568 | +// CRASH pasteExpandItem = oe.jTree.popup.add(new JMenuItem("Paste expand")); |
---|
518 | 569 | // pasteExpandItem.addActionListener(this); |
---|
519 | | - menu.add("-"); |
---|
520 | | - deleteItem = menu.add(new MenuItem("Delete")); |
---|
| 570 | + //menu.add("-"); |
---|
| 571 | + oe.jTree.popup.addSeparator(); |
---|
| 572 | + |
---|
| 573 | + deleteItem = oe.jTree.popup.add(new JMenuItem("Delete")); |
---|
521 | 574 | deleteItem.addActionListener(this); |
---|
522 | 575 | |
---|
523 | 576 | if (Globals.ADVANCED) |
---|
.. | .. |
---|
604 | 657 | oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest")); |
---|
605 | 658 | //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection")); |
---|
606 | 659 | //cameraMenu.add(switchViewItem = new MenuItem("Reverse View")); |
---|
607 | | - editLeafItem = oe.cameraMenu.add(new MenuItem("Edit Leaf")); |
---|
608 | 660 | oe.cameraMenu.add("-"); |
---|
609 | 661 | openWindowItem = oe.cameraMenu.add(new MenuItem("Edit copy...")); |
---|
610 | 662 | openWindowItem.addActionListener(this); |
---|
611 | | - editLeafItem.addActionListener(this); |
---|
612 | 663 | lookAtItem.addActionListener(this); |
---|
613 | 664 | //lookFromItem.addActinoListener(this); |
---|
614 | 665 | //switchViewItem.addActionListener(this); |
---|
.. | .. |
---|
670 | 721 | hideItem = menu.add(new MenuItem("Hidden Group")); |
---|
671 | 722 | hideItem.addActionListener(this); |
---|
672 | 723 | } |
---|
673 | | - ungroupItem = menu.add(new MenuItem("Ungroup")); |
---|
| 724 | + ungroupItem = oe.jTree.popup.add(new JMenuItem("Ungroup")); |
---|
674 | 725 | ungroupItem.addActionListener(this); |
---|
675 | 726 | |
---|
676 | 727 | // menu.add("-"); |
---|
.. | .. |
---|
856 | 907 | shareGeometriesItem.addActionListener(this); |
---|
857 | 908 | mergeGeometriesItem = menu.add(new MenuItem("Merge Geometries")); |
---|
858 | 909 | mergeGeometriesItem.addActionListener(this); |
---|
| 910 | + menu.add("-"); |
---|
| 911 | + editLeafItem = menu.add(new MenuItem("Edit leaf...")); |
---|
| 912 | + editLeafItem.addActionListener(this); |
---|
859 | 913 | if (Globals.ADVANCED) |
---|
860 | 914 | { |
---|
861 | 915 | // Pretty much the same as duplicate and clone. |
---|
.. | .. |
---|
872 | 926 | buildToolsMenu(menu); |
---|
873 | 927 | } |
---|
874 | 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 | + } |
---|
875 | 996 | |
---|
876 | 997 | void SetupUI2(ObjEditor oe) |
---|
877 | 998 | { |
---|
.. | .. |
---|
890 | 1011 | //new Exception().printStackTrace(); |
---|
891 | 1012 | |
---|
892 | 1013 | oe.radioPanel = new JPanel(new GridBagLayout()); |
---|
893 | | - oe.aConstraints.weightx = 1; |
---|
894 | | - oe.aConstraints.weighty = 0; |
---|
895 | | - oe.aConstraints.fill = GridBagConstraints.HORIZONTAL; |
---|
896 | | - oe.aConstraints.gridwidth = 100; |
---|
897 | | - oe.aConstraints.gridheight = 1; |
---|
898 | 1014 | // oe.toolbarPanel.add(radioPanel); //, oe.aConstraints); |
---|
899 | 1015 | |
---|
900 | 1016 | oe.buttonGroup = new ButtonGroup(); |
---|
.. | .. |
---|
927 | 1043 | |
---|
928 | 1044 | if (Globals.ADVANCED) |
---|
929 | 1045 | { |
---|
930 | | - oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
931 | | - maxButton.setToolTipText("Maximize window"); |
---|
932 | | - 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); |
---|
933 | 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 | + // |
---|
934 | 1089 | |
---|
935 | 1090 | oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
936 | 1091 | fullButton.setToolTipText("Full-screen window"); |
---|
.. | .. |
---|
975 | 1130 | nextVersionButton.addActionListener(this); |
---|
976 | 1131 | nextVersionButton.setEnabled(false); |
---|
977 | 1132 | |
---|
978 | | - oe.toolbarPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints); |
---|
979 | | - liveCB.setToolTipText("Enable animation"); |
---|
980 | | - liveCB.addItemListener(this); |
---|
981 | | - |
---|
982 | 1133 | oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
983 | 1134 | oneStepButton.setToolTipText("Animate one step forward"); |
---|
984 | 1135 | oneStepButton.addActionListener(this); |
---|
985 | 1136 | |
---|
| 1137 | + oe.toolbarPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints); |
---|
| 1138 | + liveCB.setToolTipText("Enable animation"); |
---|
| 1139 | + liveCB.addItemListener(this); |
---|
| 1140 | + |
---|
986 | 1141 | oe.toolbarPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints); |
---|
987 | 1142 | fastCB.setToolTipText("Fast mode"); |
---|
988 | 1143 | fastCB.addItemListener(this); |
---|
.. | .. |
---|
1009 | 1164 | |
---|
1010 | 1165 | //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL)); |
---|
1011 | 1166 | |
---|
1012 | | - oe.toolbarPanel.add(twoButton = GetButton("icons/cube.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
1013 | | - twoButton.setToolTipText("Show 3D view only"); |
---|
1014 | | - twoButton.addActionListener(this); |
---|
1015 | | - this.fullscreenLayout = twoButton; |
---|
1016 | | - |
---|
1017 | | - oe.toolbarPanel.add(threeButton = GetButton("icons/controlsview.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
1018 | | - threeButton.setToolTipText("Show controls and 3D view"); |
---|
1019 | | - threeButton.addActionListener(this); |
---|
1020 | | - oe.toolbarPanel.add(sixButton = GetButton("icons/viewcontrols.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
1021 | | - sixButton.setToolTipText("Show 3D view and controls"); |
---|
1022 | | - sixButton.addActionListener(this); |
---|
1023 | | -// oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
1024 | | -// sevenButton.setToolTipText("3-column layout"); |
---|
1025 | | -// sevenButton.addActionListener(this); |
---|
1026 | | - // |
---|
1027 | 1167 | |
---|
1028 | 1168 | oe.toolbarPanel.add(rootButton = GetButton("icons/openwindow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
1029 | 1169 | rootButton.setToolTipText("Open selection in new tab"); |
---|
.. | .. |
---|
1039 | 1179 | |
---|
1040 | 1180 | // INSERT |
---|
1041 | 1181 | row1.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
1042 | | - gridButton.setToolTipText("Create grid"); |
---|
| 1182 | + gridButton.setToolTipText("Create ground"); |
---|
1043 | 1183 | gridButton.addActionListener(this); |
---|
1044 | 1184 | |
---|
1045 | 1185 | row1.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
.. | .. |
---|
1107 | 1247 | |
---|
1108 | 1248 | oe.toolboxPanel.add(row2); |
---|
1109 | 1249 | |
---|
1110 | | - // ENVYMAPS |
---|
1111 | | - cGridBag skyboxpane = new cGridBag(); |
---|
1112 | | - skyboxpane.preferredHeight = 100; |
---|
| 1250 | + cGridBag textures = new cGridBag(); |
---|
1113 | 1251 | |
---|
1114 | | - oe.skyboxPanel.add(skyboxpane); |
---|
| 1252 | + CreateTexturePanel(textures); |
---|
1115 | 1253 | |
---|
1116 | | - JTabbedPane skyboxpanel = new JTabbedPane(); |
---|
1117 | | - skyboxpane.add(skyboxpanel); |
---|
| 1254 | + oe.toolboxPanel.add(textures); |
---|
1118 | 1255 | |
---|
1119 | | - AddSkyboxTab0(skyboxpanel); |
---|
1120 | | - AddSkyboxTab1(skyboxpanel); |
---|
1121 | | - AddSkyboxTab2(skyboxpanel); |
---|
1122 | | - AddSkyboxTab3(skyboxpanel); |
---|
| 1256 | + textures.preferredHeight = 100; |
---|
| 1257 | + |
---|
| 1258 | + CreateSkyboxPanel(oe.skyboxPanel); |
---|
1123 | 1259 | |
---|
1124 | 1260 | // EDIT panel |
---|
1125 | 1261 | editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
.. | .. |
---|
1131 | 1267 | uneditButton.addActionListener(this); |
---|
1132 | 1268 | |
---|
1133 | 1269 | editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints); |
---|
1134 | | - allParamsButton.setToolTipText("Show all controle"); |
---|
| 1270 | + allParamsButton.setToolTipText("Show all controls"); |
---|
1135 | 1271 | allParamsButton.addActionListener(this); |
---|
1136 | 1272 | |
---|
1137 | 1273 | editCommandsPanel.add(clearPanelButton = GetButton("icons/clear.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
1138 | | - clearPanelButton.setToolTipText("Clear edit panel"); |
---|
| 1274 | + clearPanelButton.setToolTipText("Clear all controls"); |
---|
1139 | 1275 | clearPanelButton.addActionListener(this); |
---|
1140 | 1276 | |
---|
1141 | 1277 | //editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
.. | .. |
---|
1335 | 1471 | |
---|
1336 | 1472 | void EditObject(Object3D obj) |
---|
1337 | 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 | + |
---|
1338 | 1482 | cRadio radioButton = new cRadio(obj.name); |
---|
1339 | 1483 | |
---|
1340 | 1484 | // June 2019. Patch to avoid bug with transparency. |
---|
.. | .. |
---|
1725 | 1869 | TreePath path; |
---|
1726 | 1870 | |
---|
1727 | 1871 | public TransferableTreePath(TreePath tp) { |
---|
1728 | | - 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); |
---|
1729 | 1878 | } |
---|
1730 | 1879 | |
---|
1731 | 1880 | public synchronized DataFlavor[] getTransferDataFlavors() { |
---|
.. | .. |
---|
2536 | 2685 | } else |
---|
2537 | 2686 | if (source == loopItem || source == loopButton) |
---|
2538 | 2687 | { |
---|
| 2688 | + if (!group.selection.isEmpty()) |
---|
| 2689 | + { |
---|
2539 | 2690 | Composite csg = new GroupLeaf(); |
---|
2540 | 2691 | csg.count = 5; |
---|
2541 | | - group(csg); |
---|
2542 | 2692 | Composite child = new cGroup("Branch"); |
---|
2543 | 2693 | csg.addChild(child); |
---|
2544 | 2694 | child.addChild(csg); |
---|
| 2695 | + group(csg); |
---|
| 2696 | + } |
---|
2545 | 2697 | } else |
---|
2546 | 2698 | if (source == doubleItem) |
---|
2547 | 2699 | { |
---|
| 2700 | + if (!group.selection.isEmpty()) |
---|
| 2701 | + { |
---|
2548 | 2702 | Composite csg = new GroupLeaf("Fork"); |
---|
2549 | 2703 | csg.count = 5; |
---|
2550 | | - group(csg); |
---|
2551 | 2704 | Composite child = new cGroup("Branch A"); |
---|
2552 | 2705 | csg.addChild(child); |
---|
2553 | 2706 | child.addChild(csg); |
---|
2554 | 2707 | child = new cGroup("Branch B"); |
---|
2555 | 2708 | csg.addChild(child); |
---|
2556 | 2709 | child.addChild(csg); |
---|
| 2710 | + group(csg); |
---|
| 2711 | + } |
---|
2557 | 2712 | } else |
---|
2558 | 2713 | if (source == tripleItem) |
---|
2559 | 2714 | { |
---|
| 2715 | + if (!group.selection.isEmpty()) |
---|
| 2716 | + { |
---|
2560 | 2717 | Composite csg = new GroupLeaf("Trident"); |
---|
2561 | 2718 | csg.count = 4; |
---|
2562 | 2719 | group(csg); |
---|
.. | .. |
---|
2569 | 2726 | child = new cGroup(); |
---|
2570 | 2727 | csg.addChild(child); |
---|
2571 | 2728 | child.addChild(csg); |
---|
| 2729 | + } |
---|
2572 | 2730 | } else |
---|
2573 | 2731 | if (source == computeAOItem) |
---|
2574 | 2732 | { |
---|
.. | .. |
---|
2618 | 2776 | if (source == fullButton) |
---|
2619 | 2777 | { |
---|
2620 | 2778 | ToggleFullScreen(); |
---|
| 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(); |
---|
2621 | 2791 | } else |
---|
2622 | 2792 | if (source == previousVersionButton) |
---|
2623 | 2793 | { |
---|
.. | .. |
---|
3192 | 3362 | } else |
---|
3193 | 3363 | if (source == ungroupItem || source == ungroupButton) |
---|
3194 | 3364 | { |
---|
3195 | | - boolean hasRoot = false; |
---|
| 3365 | + boolean canUngroup = true; |
---|
3196 | 3366 | |
---|
3197 | 3367 | for (int i=0; i<group.selection.size(); i++) |
---|
3198 | 3368 | { |
---|
3199 | | - if (group.selection.get(i) == group) |
---|
| 3369 | + Object3D selectedItem = group.selection.get(i); |
---|
| 3370 | + |
---|
| 3371 | + if (selectedItem.Size() == 0) |
---|
3200 | 3372 | { |
---|
3201 | | - 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; |
---|
3202 | 3382 | break; |
---|
3203 | 3383 | } |
---|
3204 | 3384 | } |
---|
3205 | 3385 | |
---|
3206 | | - if (!hasRoot) |
---|
| 3386 | + if (canUngroup) |
---|
3207 | 3387 | { |
---|
3208 | 3388 | for (int i=0; i<group.selection.size(); i++) |
---|
3209 | 3389 | { |
---|
3210 | | - Ungroup(group.selection.get(i)); |
---|
| 3390 | + Object3D selectedItem = group.selection.get(i); |
---|
| 3391 | + |
---|
| 3392 | + Ungroup(selectedItem); |
---|
3211 | 3393 | } |
---|
3212 | 3394 | |
---|
3213 | 3395 | ClearSelection(false); |
---|
.. | .. |
---|
3570 | 3752 | if (CameraPane.FULLSCREEN) |
---|
3571 | 3753 | fullscreenLayout = radio.layout; |
---|
3572 | 3754 | |
---|
3573 | | - // bug |
---|
3574 | | - //gridPanel.setDividerLocation(1.0); |
---|
3575 | | - //bigPanel.setDividerLocation(0.0); |
---|
3576 | | -// bigThree.remove(scenePanel); |
---|
3577 | | -// bigThree.remove(centralPanel); |
---|
3578 | | -// bigThree.remove(XYZPanel); |
---|
3579 | | -// aWindowConstraints.gridx = 0; |
---|
3580 | | -// aWindowConstraints.gridy = 0; |
---|
3581 | | -// aWindowConstraints.gridwidth = 1; |
---|
3582 | | -// // aConstraints.gridheight = 3; |
---|
3583 | | -// aWindowConstraints.fill = GridBagConstraints.VERTICAL; |
---|
3584 | | -// aWindowConstraints.weightx = 0; |
---|
3585 | | -// aWindowConstraints.weighty = 1; |
---|
3586 | | -// //bigThree.add(jtp, aWindowConstraints); |
---|
3587 | | -// aWindowConstraints.weightx = 1; |
---|
3588 | | -// aWindowConstraints.gridwidth = 3; |
---|
3589 | | -// // aConstraints.gridheight = 3; |
---|
3590 | | -// aWindowConstraints.gridx = 1; |
---|
3591 | | -// aWindowConstraints.fill = GridBagConstraints.BOTH; |
---|
3592 | | -// bigThree.add(centralPanel, aWindowConstraints); |
---|
3593 | | -// aWindowConstraints.weightx = 0; |
---|
3594 | | -// aWindowConstraints.gridx = 4; |
---|
3595 | | -// aWindowConstraints.gridwidth = 1; |
---|
3596 | | -// // aConstraints.gridheight = 3; |
---|
3597 | | -// aWindowConstraints.fill = GridBagConstraints.VERTICAL; |
---|
3598 | | -// //bigThree.add(XYZPanel, aWindowConstraints); |
---|
3599 | | -// scenePanel.setVisible(false); |
---|
3600 | | -// centralPanel.setVisible(true); |
---|
3601 | | -// XYZPanel.setVisible(false); |
---|
3602 | | - bigThree.ClearUI(); |
---|
3603 | | - bigThree.add(centralPanel); |
---|
3604 | | - bigThree.FlushUI(); |
---|
| 3755 | + Show3DView(); |
---|
3605 | 3756 | |
---|
3606 | 3757 | cameraView.requestFocusInWindow(); |
---|
3607 | 3758 | |
---|
.. | .. |
---|
3787 | 3938 | } else |
---|
3788 | 3939 | if (source == rootButton) |
---|
3789 | 3940 | { |
---|
| 3941 | + Replace(); |
---|
3790 | 3942 | Object3D obj; |
---|
3791 | 3943 | for (Enumeration e = group.selection.elements(); e.hasMoreElements();) |
---|
3792 | 3944 | { |
---|
.. | .. |
---|
3923 | 4075 | |
---|
3924 | 4076 | copy = group; |
---|
3925 | 4077 | |
---|
3926 | | - SetUndoStates(); |
---|
3927 | | - |
---|
3928 | 4078 | //Globals.theRenderer.object = group; |
---|
3929 | 4079 | if(!useclient) |
---|
3930 | 4080 | { |
---|
.. | .. |
---|
3952 | 4102 | */ |
---|
3953 | 4103 | radio.layout.doClick(); |
---|
3954 | 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 | + |
---|
3955 | 4117 | ClearUnpinned(); |
---|
3956 | 4118 | |
---|
3957 | 4119 | //Grafreed.Assert(group != null); |
---|
.. | .. |
---|
5186 | 5348 | flashSelectionButton.setEnabled(enabled); |
---|
5187 | 5349 | |
---|
5188 | 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); |
---|
5189 | 5365 | } |
---|
5190 | 5366 | |
---|
5191 | 5367 | void refreshContents(boolean cp) |
---|
.. | .. |
---|
5200 | 5376 | Object3D child = (Object3D) group.selection.get(i); |
---|
5201 | 5377 | |
---|
5202 | 5378 | objEditor.AddInfo(child, this, true); |
---|
5203 | | - System.err.println("info : " + child.GetPath()); |
---|
| 5379 | +// System.err.println("info : " + child.GetPath()); |
---|
5204 | 5380 | } |
---|
5205 | 5381 | |
---|
5206 | 5382 | objEditor.SetText(); // jan 2014 |
---|
.. | .. |
---|
6083 | 6259 | private MenuItem lookAtItem; |
---|
6084 | 6260 | private MenuItem lookFromItem; |
---|
6085 | 6261 | private MenuItem switchViewItem; |
---|
6086 | | - private MenuItem cutItem; |
---|
| 6262 | + private JMenuItem cutItem; |
---|
6087 | 6263 | private MenuItem undoItem; |
---|
6088 | 6264 | private MenuItem redoItem; |
---|
6089 | 6265 | private JMenuItem duplicateItem; |
---|
6090 | | - private MenuItem cloneItem; |
---|
| 6266 | + private JMenuItem cloneItem; |
---|
6091 | 6267 | private MenuItem cloneSupportItem; |
---|
6092 | 6268 | private MenuItem overwriteGeoItem; |
---|
6093 | 6269 | private MenuItem overwriteMatItem; |
---|
.. | .. |
---|
6108 | 6284 | private MenuItem cloneGeometriesItem; |
---|
6109 | 6285 | private MenuItem shareGeometriesItem; |
---|
6110 | 6286 | private MenuItem mergeGeometriesItem; |
---|
6111 | | - private MenuItem copyItem; |
---|
| 6287 | + private JMenuItem copyItem; |
---|
6112 | 6288 | private MenuItem pasteItem; |
---|
6113 | | - private MenuItem pasteIntoItem; |
---|
6114 | | - private MenuItem pasteLinkItem; |
---|
6115 | | - private MenuItem pasteCloneItem; |
---|
6116 | | - private MenuItem pasteExpandItem; |
---|
6117 | | - private MenuItem deleteItem; |
---|
| 6289 | + private JMenuItem pasteIntoItem; |
---|
| 6290 | + private JMenuItem pasteLinkItem; |
---|
| 6291 | + private JMenuItem pasteCloneItem; |
---|
| 6292 | + private JMenuItem pasteExpandItem; |
---|
| 6293 | + private JMenuItem deleteItem; |
---|
6118 | 6294 | private MenuItem clearAllItem; |
---|
6119 | 6295 | private MenuItem genUVItem; |
---|
6120 | 6296 | private MenuItem genNormalsMESHItem; |
---|
.. | .. |
---|
6182 | 6358 | private MenuItem switchTransfoItem; |
---|
6183 | 6359 | private MenuItem morphItem; |
---|
6184 | 6360 | private MenuItem linkerItem; |
---|
6185 | | - private MenuItem ungroupItem; |
---|
| 6361 | + private JMenuItem ungroupItem; |
---|
6186 | 6362 | private MenuItem editItem; |
---|
6187 | 6363 | private MenuItem openWindowItem; |
---|
6188 | 6364 | private MenuItem editLeafItem; |
---|