.. | .. |
---|
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 | + |
---|
335 | 362 | //ObjEditor objEditor; |
---|
336 | 363 | public void closeUI2() |
---|
337 | 364 | { |
---|
.. | .. |
---|
872 | 899 | buildToolsMenu(menu); |
---|
873 | 900 | } |
---|
874 | 901 | |
---|
| 902 | + JTabbedPane resourcecontainer; |
---|
| 903 | + cGridBag currenttab; |
---|
| 904 | + boolean added; // patch for jar |
---|
| 905 | + |
---|
| 906 | + int tabcount = 0; |
---|
| 907 | + int colcount = 0; |
---|
| 908 | + int rowcount = 0; |
---|
| 909 | + int texturecount = 0; |
---|
| 910 | + |
---|
| 911 | + int columns = 5; |
---|
| 912 | + int rows = 7; |
---|
| 913 | + |
---|
| 914 | + public void ResourceCallBack(String[] path) |
---|
| 915 | + { |
---|
| 916 | +// for (int i = 0; i < path.length; i++) |
---|
| 917 | +// System.out.print(path[i] + "/"); |
---|
| 918 | +// System.out.println(); |
---|
| 919 | + |
---|
| 920 | + if (//rowcount == 0 || |
---|
| 921 | + path.length == 1) |
---|
| 922 | + { |
---|
| 923 | + currenttab = new cGridBag(); |
---|
| 924 | + added = false; |
---|
| 925 | + String tabname = path[0]; // String.valueOf((char)('A'+tabcount)); |
---|
| 926 | + currenttab.setName(tabname); |
---|
| 927 | + rowcount = 1; |
---|
| 928 | + colcount = 0; |
---|
| 929 | + texturecount = 0; |
---|
| 930 | + } |
---|
| 931 | + |
---|
| 932 | + if (path.length > 2 && path[2].toLowerCase().endsWith(".jpg")) |
---|
| 933 | + { |
---|
| 934 | + if (!added) |
---|
| 935 | + { |
---|
| 936 | + added = true; |
---|
| 937 | + resourcecontainer.add(currenttab); |
---|
| 938 | + String tabname = path[0]; // String.valueOf((char)('A'+tabcount)); |
---|
| 939 | + resourcecontainer.setToolTipTextAt(tabcount++, "Texture Group " + tabname); |
---|
| 940 | + } |
---|
| 941 | + |
---|
| 942 | + AddTextureButton(path[0], path[1], path[2], texturecount++, currenttab); |
---|
| 943 | + |
---|
| 944 | + if (++colcount >= columns) |
---|
| 945 | + { |
---|
| 946 | + colcount = 0; |
---|
| 947 | + currenttab.Return(); |
---|
| 948 | + |
---|
| 949 | + if (rowcount++ >= rows) |
---|
| 950 | + { |
---|
| 951 | + rowcount = 0; |
---|
| 952 | + } |
---|
| 953 | + } |
---|
| 954 | + } |
---|
| 955 | + else |
---|
| 956 | + { |
---|
| 957 | +// if (!path[path.length-1].equals("icons")) |
---|
| 958 | +// resourcecontainer.Return(); |
---|
| 959 | + } |
---|
| 960 | + } |
---|
| 961 | + |
---|
| 962 | + void CreateTexturePanel(cGridBag container) |
---|
| 963 | + { |
---|
| 964 | + resourcecontainer = new JTabbedPane(JTabbedPane.LEFT); |
---|
| 965 | + container.add(resourcecontainer); |
---|
| 966 | + |
---|
| 967 | + Grafreed.ParseResources("textures", this); |
---|
| 968 | + } |
---|
875 | 969 | |
---|
876 | 970 | void SetupUI2(ObjEditor oe) |
---|
877 | 971 | { |
---|
.. | .. |
---|
1107 | 1201 | |
---|
1108 | 1202 | oe.toolboxPanel.add(row2); |
---|
1109 | 1203 | |
---|
1110 | | - // ENVYMAPS |
---|
1111 | | - cGridBag skyboxpane = new cGridBag(); |
---|
1112 | | - skyboxpane.preferredHeight = 100; |
---|
| 1204 | + cGridBag textures = new cGridBag(); |
---|
1113 | 1205 | |
---|
1114 | | - oe.skyboxPanel.add(skyboxpane); |
---|
| 1206 | + CreateTexturePanel(textures); |
---|
1115 | 1207 | |
---|
1116 | | - JTabbedPane skyboxpanel = new JTabbedPane(); |
---|
1117 | | - skyboxpane.add(skyboxpanel); |
---|
| 1208 | + oe.toolboxPanel.add(textures); |
---|
1118 | 1209 | |
---|
1119 | | - AddSkyboxTab0(skyboxpanel); |
---|
1120 | | - AddSkyboxTab1(skyboxpanel); |
---|
1121 | | - AddSkyboxTab2(skyboxpanel); |
---|
1122 | | - AddSkyboxTab3(skyboxpanel); |
---|
| 1210 | + textures.preferredHeight = 100; |
---|
| 1211 | + |
---|
| 1212 | + CreateSkyboxPanel(oe.skyboxPanel); |
---|
1123 | 1213 | |
---|
1124 | 1214 | // EDIT panel |
---|
1125 | 1215 | editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
.. | .. |
---|
1131 | 1221 | uneditButton.addActionListener(this); |
---|
1132 | 1222 | |
---|
1133 | 1223 | editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints); |
---|
1134 | | - allParamsButton.setToolTipText("Show all controle"); |
---|
| 1224 | + allParamsButton.setToolTipText("Show all controls"); |
---|
1135 | 1225 | allParamsButton.addActionListener(this); |
---|
1136 | 1226 | |
---|
1137 | 1227 | editCommandsPanel.add(clearPanelButton = GetButton("icons/clear.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
1138 | | - clearPanelButton.setToolTipText("Clear edit panel"); |
---|
| 1228 | + clearPanelButton.setToolTipText("Clear all controls"); |
---|
1139 | 1229 | clearPanelButton.addActionListener(this); |
---|
1140 | 1230 | |
---|
1141 | 1231 | //editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|