.. | .. |
---|
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, |
---|
.. | .. |
---|
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); |
---|
.. | .. |
---|
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 | 333 | //cameraView.envyoff = false; |
---|
328 | 334 | group.skyboxname = skybox; |
---|
329 | 335 | group.skyboxext = "jpg"; |
---|
330 | 336 | cameraView.repaint(); |
---|
| 337 | + } |
---|
331 | 338 | |
---|
332 | | - Grafreed.ParseResources("textures", this); |
---|
| 339 | + public void CreateSkyboxPanel(cGridBag skyboxPanel) |
---|
| 340 | + { |
---|
| 341 | + JTabbedPane skyboxpane = new JTabbedPane(); |
---|
| 342 | + |
---|
| 343 | + AddSkyboxTab0(skyboxpane); |
---|
| 344 | + AddSkyboxTab1(skyboxpane); |
---|
| 345 | + AddSkyboxTab2(skyboxpane); |
---|
| 346 | + AddSkyboxTab3(skyboxpane); |
---|
| 347 | + |
---|
| 348 | + skyboxPanel.add(skyboxpane); |
---|
333 | 349 | } |
---|
334 | 350 | |
---|
| 351 | + public void ChangeTexture(String texture) |
---|
| 352 | + { |
---|
| 353 | + for (int i=0; i<group.selection.size(); i++) |
---|
| 354 | + { |
---|
| 355 | + Object3D obj = group.selection.get(i); |
---|
| 356 | + obj.SetPigmentTexture("@" + texture); |
---|
| 357 | + } |
---|
| 358 | + |
---|
| 359 | + refreshContents(); |
---|
| 360 | + } |
---|
| 361 | + |
---|
| 362 | + public void Show3DView() |
---|
| 363 | + { |
---|
| 364 | + // bug |
---|
| 365 | + //gridPanel.setDividerLocation(1.0); |
---|
| 366 | + //bigPanel.setDividerLocation(0.0); |
---|
| 367 | + bigThree.ClearUI(); |
---|
| 368 | + bigThree.add(centralPanel); |
---|
| 369 | + bigThree.FlushUI(); |
---|
| 370 | + } |
---|
| 371 | + |
---|
335 | 372 | //ObjEditor objEditor; |
---|
336 | 373 | public void closeUI2() |
---|
337 | 374 | { |
---|
.. | .. |
---|
872 | 909 | buildToolsMenu(menu); |
---|
873 | 910 | } |
---|
874 | 911 | |
---|
| 912 | + JTabbedPane resourcecontainer; |
---|
| 913 | + cGridBag currenttab; |
---|
| 914 | + boolean added; // patch for jar |
---|
| 915 | + |
---|
| 916 | + int tabcount = 0; |
---|
| 917 | + int colcount = 0; |
---|
| 918 | + int rowcount = 0; |
---|
| 919 | + int texturecount = 0; |
---|
| 920 | + |
---|
| 921 | + int columns = 5; |
---|
| 922 | + int rows = 7; |
---|
| 923 | + |
---|
| 924 | + public void ResourceCallBack(String[] path) |
---|
| 925 | + { |
---|
| 926 | +// for (int i = 0; i < path.length; i++) |
---|
| 927 | +// System.out.print(path[i] + "/"); |
---|
| 928 | +// System.out.println(); |
---|
| 929 | + |
---|
| 930 | + if (//rowcount == 0 || |
---|
| 931 | + path.length == 1) |
---|
| 932 | + { |
---|
| 933 | + currenttab = new cGridBag(); |
---|
| 934 | + added = false; |
---|
| 935 | + String tabname = path[0]; // String.valueOf((char)('A'+tabcount)); |
---|
| 936 | + currenttab.setName(tabname); |
---|
| 937 | + rowcount = 1; |
---|
| 938 | + colcount = 0; |
---|
| 939 | + texturecount = 0; |
---|
| 940 | + } |
---|
| 941 | + |
---|
| 942 | + if (path.length > 2 && path[2].toLowerCase().endsWith(".jpg")) |
---|
| 943 | + { |
---|
| 944 | + if (!added) |
---|
| 945 | + { |
---|
| 946 | + added = true; |
---|
| 947 | + resourcecontainer.add(currenttab); |
---|
| 948 | + String tabname = path[0]; // String.valueOf((char)('A'+tabcount)); |
---|
| 949 | + resourcecontainer.setToolTipTextAt(tabcount++, "Texture Group " + tabname); |
---|
| 950 | + } |
---|
| 951 | + |
---|
| 952 | + AddTextureButton(path[0], path[1], path[2], texturecount++, currenttab); |
---|
| 953 | + |
---|
| 954 | + if (++colcount >= columns) |
---|
| 955 | + { |
---|
| 956 | + colcount = 0; |
---|
| 957 | + currenttab.Return(); |
---|
| 958 | + |
---|
| 959 | + if (rowcount++ >= rows) |
---|
| 960 | + { |
---|
| 961 | + rowcount = 0; |
---|
| 962 | + } |
---|
| 963 | + } |
---|
| 964 | + } |
---|
| 965 | + else |
---|
| 966 | + { |
---|
| 967 | +// if (!path[path.length-1].equals("icons")) |
---|
| 968 | +// resourcecontainer.Return(); |
---|
| 969 | + } |
---|
| 970 | + } |
---|
| 971 | + |
---|
| 972 | + void CreateTexturePanel(cGridBag container) |
---|
| 973 | + { |
---|
| 974 | + resourcecontainer = new JTabbedPane(JTabbedPane.LEFT); |
---|
| 975 | + container.add(resourcecontainer); |
---|
| 976 | + |
---|
| 977 | + Grafreed.ParseResources("textures", this); |
---|
| 978 | + } |
---|
875 | 979 | |
---|
876 | 980 | void SetupUI2(ObjEditor oe) |
---|
877 | 981 | { |
---|
.. | .. |
---|
890 | 994 | //new Exception().printStackTrace(); |
---|
891 | 995 | |
---|
892 | 996 | 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 | 997 | // oe.toolbarPanel.add(radioPanel); //, oe.aConstraints); |
---|
899 | 998 | |
---|
900 | 999 | oe.buttonGroup = new ButtonGroup(); |
---|
.. | .. |
---|
931 | 1030 | maxButton.setToolTipText("Maximize window"); |
---|
932 | 1031 | maxButton.addActionListener(this); |
---|
933 | 1032 | } |
---|
| 1033 | + |
---|
| 1034 | + cButton gcButton; |
---|
| 1035 | + |
---|
| 1036 | + oe.toolbarPanel.add(gcButton = GetButton("icons/trash.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 1037 | + gcButton.setToolTipText("Garbage collect"); |
---|
| 1038 | + gcButton.addActionListener(new ActionListener() |
---|
| 1039 | + { |
---|
| 1040 | + public void actionPerformed(ActionEvent e) |
---|
| 1041 | + { |
---|
| 1042 | + System.gc(); |
---|
| 1043 | + } |
---|
| 1044 | + }); |
---|
| 1045 | + |
---|
| 1046 | + oe.toolbarPanel.add(collapseButton = GetButton("icons/collapse.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 1047 | + collapseButton.setToolTipText("Collapse toolbar"); |
---|
| 1048 | + collapseButton.addActionListener(this); |
---|
| 1049 | + |
---|
| 1050 | + oe.toolbarPanel.add(maximize3DButton = GetButton("", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 1051 | + maximize3DButton.setToolTipText("Maximize 3D view"); |
---|
| 1052 | + maximize3DButton.addActionListener(this); |
---|
| 1053 | + |
---|
| 1054 | + oe.toolbarPanel.add(twoButton = GetButton("icons/cube.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 1055 | + twoButton.setToolTipText("Show 3D view only"); |
---|
| 1056 | + twoButton.addActionListener(this); |
---|
| 1057 | + this.fullscreenLayout = twoButton; |
---|
| 1058 | + |
---|
| 1059 | + oe.toolbarPanel.add(threeButton = GetButton("icons/controlsview.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 1060 | + threeButton.setToolTipText("Show controls and 3D view"); |
---|
| 1061 | + threeButton.addActionListener(this); |
---|
| 1062 | + if (Globals.ADVANCED) |
---|
| 1063 | + { |
---|
| 1064 | + oe.toolbarPanel.add(sixButton = GetButton("icons/viewcontrols.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 1065 | + sixButton.setToolTipText("Show 3D view and controls"); |
---|
| 1066 | + sixButton.addActionListener(this); |
---|
| 1067 | + } |
---|
| 1068 | +// oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 1069 | +// sevenButton.setToolTipText("3-column layout"); |
---|
| 1070 | +// sevenButton.addActionListener(this); |
---|
| 1071 | + // |
---|
934 | 1072 | |
---|
935 | 1073 | oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
936 | 1074 | fullButton.setToolTipText("Full-screen window"); |
---|
.. | .. |
---|
975 | 1113 | nextVersionButton.addActionListener(this); |
---|
976 | 1114 | nextVersionButton.setEnabled(false); |
---|
977 | 1115 | |
---|
978 | | - oe.toolbarPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints); |
---|
979 | | - liveCB.setToolTipText("Enable animation"); |
---|
980 | | - liveCB.addItemListener(this); |
---|
981 | | - |
---|
982 | 1116 | oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
983 | 1117 | oneStepButton.setToolTipText("Animate one step forward"); |
---|
984 | 1118 | oneStepButton.addActionListener(this); |
---|
985 | 1119 | |
---|
| 1120 | + oe.toolbarPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints); |
---|
| 1121 | + liveCB.setToolTipText("Enable animation"); |
---|
| 1122 | + liveCB.addItemListener(this); |
---|
| 1123 | + |
---|
986 | 1124 | oe.toolbarPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints); |
---|
987 | 1125 | fastCB.setToolTipText("Fast mode"); |
---|
988 | 1126 | fastCB.addItemListener(this); |
---|
.. | .. |
---|
1009 | 1147 | |
---|
1010 | 1148 | //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL)); |
---|
1011 | 1149 | |
---|
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 | 1150 | |
---|
1028 | 1151 | oe.toolbarPanel.add(rootButton = GetButton("icons/openwindow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
1029 | 1152 | rootButton.setToolTipText("Open selection in new tab"); |
---|
.. | .. |
---|
1107 | 1230 | |
---|
1108 | 1231 | oe.toolboxPanel.add(row2); |
---|
1109 | 1232 | |
---|
1110 | | - // ENVYMAPS |
---|
1111 | | - cGridBag skyboxpane = new cGridBag(); |
---|
1112 | | - skyboxpane.preferredHeight = 100; |
---|
| 1233 | + cGridBag textures = new cGridBag(); |
---|
1113 | 1234 | |
---|
1114 | | - oe.skyboxPanel.add(skyboxpane); |
---|
| 1235 | + CreateTexturePanel(textures); |
---|
1115 | 1236 | |
---|
1116 | | - JTabbedPane skyboxpanel = new JTabbedPane(); |
---|
1117 | | - skyboxpane.add(skyboxpanel); |
---|
| 1237 | + oe.toolboxPanel.add(textures); |
---|
1118 | 1238 | |
---|
1119 | | - AddSkyboxTab0(skyboxpanel); |
---|
1120 | | - AddSkyboxTab1(skyboxpanel); |
---|
1121 | | - AddSkyboxTab2(skyboxpanel); |
---|
1122 | | - AddSkyboxTab3(skyboxpanel); |
---|
| 1239 | + textures.preferredHeight = 100; |
---|
| 1240 | + |
---|
| 1241 | + CreateSkyboxPanel(oe.skyboxPanel); |
---|
1123 | 1242 | |
---|
1124 | 1243 | // EDIT panel |
---|
1125 | 1244 | editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
.. | .. |
---|
1131 | 1250 | uneditButton.addActionListener(this); |
---|
1132 | 1251 | |
---|
1133 | 1252 | editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints); |
---|
1134 | | - allParamsButton.setToolTipText("Show all controle"); |
---|
| 1253 | + allParamsButton.setToolTipText("Show all controls"); |
---|
1135 | 1254 | allParamsButton.addActionListener(this); |
---|
1136 | 1255 | |
---|
1137 | 1256 | editCommandsPanel.add(clearPanelButton = GetButton("icons/clear.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
1138 | | - clearPanelButton.setToolTipText("Clear edit panel"); |
---|
| 1257 | + clearPanelButton.setToolTipText("Clear all controls"); |
---|
1139 | 1258 | clearPanelButton.addActionListener(this); |
---|
1140 | 1259 | |
---|
1141 | 1260 | //editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
.. | .. |
---|
1725 | 1844 | TreePath path; |
---|
1726 | 1845 | |
---|
1727 | 1846 | public TransferableTreePath(TreePath tp) { |
---|
1728 | | - path = tp; |
---|
| 1847 | + Object[] objs = new Object[tp.getPathCount()]; |
---|
| 1848 | + for (int i=0; i<objs.length; i++) |
---|
| 1849 | + { |
---|
| 1850 | + objs[i] = ((Object3D)tp.getPathComponent(i)).GetUUID(); |
---|
| 1851 | + } |
---|
| 1852 | + path = new TreePath(objs); |
---|
1729 | 1853 | } |
---|
1730 | 1854 | |
---|
1731 | 1855 | public synchronized DataFlavor[] getTransferDataFlavors() { |
---|
.. | .. |
---|
2618 | 2742 | if (source == fullButton) |
---|
2619 | 2743 | { |
---|
2620 | 2744 | ToggleFullScreen(); |
---|
| 2745 | + } else |
---|
| 2746 | + if (source == collapseButton) |
---|
| 2747 | + { |
---|
| 2748 | + this.expandedLayout = radio.layout; |
---|
| 2749 | + CollapseToolbar(); |
---|
| 2750 | + } else |
---|
| 2751 | + if (source == maximize3DButton) |
---|
| 2752 | + { |
---|
| 2753 | + this.expandedLayout = radio.layout; |
---|
| 2754 | + radio.layout = twoButton; |
---|
| 2755 | + Show3DView(); |
---|
| 2756 | + CollapseToolbar(); |
---|
2621 | 2757 | } else |
---|
2622 | 2758 | if (source == previousVersionButton) |
---|
2623 | 2759 | { |
---|
.. | .. |
---|
3570 | 3706 | if (CameraPane.FULLSCREEN) |
---|
3571 | 3707 | fullscreenLayout = radio.layout; |
---|
3572 | 3708 | |
---|
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(); |
---|
| 3709 | + Show3DView(); |
---|
3605 | 3710 | |
---|
3606 | 3711 | cameraView.requestFocusInWindow(); |
---|
3607 | 3712 | |
---|
.. | .. |
---|
5200 | 5305 | Object3D child = (Object3D) group.selection.get(i); |
---|
5201 | 5306 | |
---|
5202 | 5307 | objEditor.AddInfo(child, this, true); |
---|
5203 | | - System.err.println("info : " + child.GetPath()); |
---|
| 5308 | +// System.err.println("info : " + child.GetPath()); |
---|
5204 | 5309 | } |
---|
5205 | 5310 | |
---|
5206 | 5311 | objEditor.SetText(); // jan 2014 |
---|