Normand Briere
2019-08-08 8294241adc5fe698b70e13ebd6780af46ab83f7e
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,
....@@ -41,6 +42,22 @@
4142 });
4243 }
4344
45
+ public void AddTextureButton(String f, final String t, cGridBag row)
46
+ {
47
+ cButton textureButton;
48
+ final String path = "textures/" + f + "/"; // + t;
49
+ row.add(textureButton = GetButton(path + "icons/" + t, !Grafreed.NIMBUSLAF));
50
+ textureButton.setToolTipText(f + "s");
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);
....@@ -311,14 +328,31 @@
311328 }
312329 }
313330
314
- public void ChangeSkybox(String name)
331
+ public void ChangeSkybox(String skybox)
315332 {
316333 //cameraView.envyoff = false;
317
- group.skyboxname = name;
334
+ group.skyboxname = skybox;
318335 group.skyboxext = "jpg";
319336 cameraView.repaint();
320337 }
338
+
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);
349
+ }
321350
351
+ public void ChangeTexture(String texture)
352
+ {
353
+ cameraView.repaint();
354
+ }
355
+
322356 //ObjEditor objEditor;
323357 public void closeUI2()
324358 {
....@@ -859,6 +893,67 @@
859893 buildToolsMenu(menu);
860894 }
861895
896
+ JTabbedPane resourcecontainer;
897
+ cGridBag currenttab;
898
+ boolean added; // patch for jar
899
+
900
+ int tabcount = 0;
901
+ int colcount = 0;
902
+ int rowcount = 0;
903
+
904
+ int columns = 5;
905
+ int rows = 7;
906
+
907
+ public void ResourceCallBack(String[] path)
908
+ {
909
+ for (int i = 0; i < path.length; i++)
910
+ System.out.print(path[i] + "/");
911
+ System.out.println();
912
+ if (rowcount == 0)
913
+ {
914
+ currenttab = new cGridBag();
915
+ added = false;
916
+ String tabname = String.valueOf((char)('A'+tabcount));
917
+ currenttab.setName(tabname);
918
+ rowcount = 1;
919
+ }
920
+
921
+ if (path.length > 1 && path[1].toLowerCase().endsWith(".jpg"))
922
+ {
923
+ if (!added)
924
+ {
925
+ added = true;
926
+ resourcecontainer.add(currenttab);
927
+ String tabname = String.valueOf((char)('A'+tabcount));
928
+ resourcecontainer.setToolTipTextAt(tabcount++, "Texture Group " + tabname);
929
+ }
930
+
931
+ AddTextureButton(path[0], path[1], currenttab);
932
+ if (++colcount >= columns)
933
+ {
934
+ colcount = 0;
935
+ currenttab.Return();
936
+
937
+ if (rowcount++ >= rows)
938
+ {
939
+ rowcount = 0;
940
+ }
941
+ }
942
+ }
943
+ else
944
+ {
945
+// if (!path[path.length-1].equals("icons"))
946
+// resourcecontainer.Return();
947
+ }
948
+ }
949
+
950
+ void CreateTexturePanel(cGridBag container)
951
+ {
952
+ resourcecontainer = new JTabbedPane();
953
+ container.add(resourcecontainer);
954
+
955
+ Grafreed.ParseResources("textures", this);
956
+ }
862957
863958 void SetupUI2(ObjEditor oe)
864959 {
....@@ -1094,19 +1189,15 @@
10941189
10951190 oe.toolboxPanel.add(row2);
10961191
1097
- // ENVYMAPS
1098
- cGridBag skyboxpane = new cGridBag();
1099
- skyboxpane.preferredHeight = 100;
1192
+ cGridBag textures = new cGridBag();
11001193
1101
- oe.toolboxPanel.add(skyboxpane);
1194
+ CreateTexturePanel(textures);
11021195
1103
- JTabbedPane skyboxpanel = new JTabbedPane();
1104
- skyboxpane.add(skyboxpanel);
1196
+ oe.toolboxPanel.add(textures);
11051197
1106
- AddSkyboxTab0(skyboxpanel);
1107
- AddSkyboxTab1(skyboxpanel);
1108
- AddSkyboxTab2(skyboxpanel);
1109
- AddSkyboxTab3(skyboxpanel);
1198
+ textures.preferredHeight = 100;
1199
+
1200
+ CreateSkyboxPanel(oe.skyboxPanel);
11101201
11111202 // EDIT panel
11121203 editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
....@@ -1118,16 +1209,16 @@
11181209 uneditButton.addActionListener(this);
11191210
11201211 editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
1121
- allParamsButton.setToolTipText("Show all controle");
1212
+ allParamsButton.setToolTipText("Show all controls");
11221213 allParamsButton.addActionListener(this);
11231214
11241215 editCommandsPanel.add(clearPanelButton = GetButton("icons/clear.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1125
- clearPanelButton.setToolTipText("Clear edit panel");
1216
+ clearPanelButton.setToolTipText("Clear all controls");
11261217 clearPanelButton.addActionListener(this);
11271218
1128
- editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1129
- unselectButton.setToolTipText("Unselect");
1130
- unselectButton.addActionListener(this);
1219
+ //editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1220
+ //unselectButton.setToolTipText("Unselect");
1221
+ //unselectButton.addActionListener(this);
11311222
11321223 editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
11331224 flashSelectionButton.setToolTipText("Highlight selection");
....@@ -5169,7 +5260,7 @@
51695260 {
51705261 editButton.setEnabled(enabled);
51715262 uneditButton.setEnabled(enabled);
5172
- unselectButton.setEnabled(enabled);
5263
+ //unselectButton.setEnabled(enabled);
51735264 flashSelectionButton.setEnabled(enabled);
51745265
51755266 clearPanelButton.setEnabled(!listUI.isEmpty());
....@@ -5177,7 +5268,7 @@
51775268
51785269 void refreshContents(boolean cp)
51795270 {
5180
- if (objectPanel.getSelectedIndex() == 2) // objectPanel.indexOfTab("Info"))
5271
+ //if (objectPanel.getSelectedIndex() == 2) // objectPanel.indexOfTab("Info"))
51815272 if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
51825273 {
51835274 objEditor.ClearInfo(); // .GetMaterial());