|
6 | 6 | import net.fexcraft.app.fmt.FMTB; |
7 | 7 | import net.fexcraft.app.fmt.ui.UserInterface; |
8 | 8 | import net.fexcraft.app.fmt.ui.general.Button; |
| 9 | +import net.fexcraft.app.fmt.ui.general.DialogBox; |
9 | 10 | import net.fexcraft.app.fmt.ui.general.NFC.AfterTask; |
10 | 11 | import net.fexcraft.app.fmt.ui.general.NFC.ChooserMode; |
11 | 12 | import net.fexcraft.app.fmt.ui.general.TextField; |
| 13 | +import net.fexcraft.app.fmt.utils.Animator; |
| 14 | +import net.fexcraft.app.fmt.utils.Animator.Animation; |
12 | 15 | import net.fexcraft.app.fmt.utils.TextureManager; |
13 | 16 | import net.fexcraft.app.fmt.utils.TextureUpdate; |
14 | 17 | import net.fexcraft.app.fmt.wrappers.GroupCompound; |
|
19 | 22 | public class ModelGroupEditor extends Editor { |
20 | 23 |
|
21 | 24 | private static final int[] accepted_texsiz = new int[]{ 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096 };//, 8192 }; |
22 | | - private ContainerButton group, model; |
| 25 | + private ContainerButton group, model, animations; |
23 | 26 |
|
24 | 27 | public ModelGroupEditor(){ |
25 | 28 | super("model_group_editor"); |
26 | 29 | } |
27 | 30 |
|
28 | 31 | @Override |
29 | 32 | protected ContainerButton[] setupSubElements(){ |
30 | | - group = new ContainerButton(this, "group", 300, 28, 4, y, new int[]{ 1, 3, 1, 1, 1, 3, 1, 1 }){ |
| 33 | + group = new ContainerButton(this, "group", 300, 28, 4, y, new int[]{ 1, 3, 1, 1, 1, 3, 1, 1, 1, 1 }){ |
31 | 34 | @Override |
32 | 35 | public void addSubElements(){ |
33 | 36 | this.elements.add(new Button(this, "text0", 290, 20, 0, 0, RGB.WHITE).setText("Group Preview Color/Overlay", false).setRowCol(0, 0)); |
@@ -106,6 +109,39 @@ public void run(){ |
106 | 109 | }, ChooserMode.PNG); return true; |
107 | 110 | } |
108 | 111 | }.setText("null", true).setRowCol(7, 0)); |
| 112 | + // |
| 113 | + this.elements.add(new Button(this, "text3", 290, 20, 0, 0, RGB.WHITE).setText("Add Animator", false).setRowCol(8, 0)); |
| 114 | + this.elements.add(new TextField(this, "group_animator", 0, 0, 0){ |
| 115 | + @Override |
| 116 | + protected boolean processButtonClick(int x, int y, boolean left){ |
| 117 | + if(FMTB.MODEL.getSelected().isEmpty()) return true; |
| 118 | + if(!left){ |
| 119 | + FMTB.showDialogbox(this.getText(), "test", null, DialogBox.NOTHING, null); |
| 120 | + this.setText("", true); |
| 121 | + return true; |
| 122 | + } |
| 123 | + else return super.processButtonClick(x, y, left); |
| 124 | + } |
| 125 | + @Override |
| 126 | + public void updateTextField(){ |
| 127 | + this.deselect(); if(FMTB.MODEL.getSelected().isEmpty()) return; |
| 128 | + Animation anim = Animator.get(this.getTextValue()); |
| 129 | + if(anim == null){ |
| 130 | + FMTB.showDialogbox("Animation not found!", "ok", null, DialogBox.NOTHING, null); |
| 131 | + return; |
| 132 | + } anim.copy(); |
| 133 | + ArrayList<TurboList> lists = FMTB.MODEL.getDirectlySelectedGroups(); |
| 134 | + AfterTask task = new AfterTask(){ |
| 135 | + @Override |
| 136 | + public void run(){ |
| 137 | + for(TurboList list : lists){ |
| 138 | + list.animations.add(anim.copy()); |
| 139 | + } FMTB.MODEL.updateFields(); |
| 140 | + } |
| 141 | + }; task.settings = anim.settings; |
| 142 | + UserInterface.SETTINGSBOX.show("Animator Settings", task); |
| 143 | + } |
| 144 | + }.setText("null", true).setRowCol(9, 0)); |
109 | 145 | } |
110 | 146 | }; |
111 | 147 | group.setText("Group Settings", false); |
@@ -159,7 +195,37 @@ public void run(){ |
159 | 195 | } |
160 | 196 | }; |
161 | 197 | model.setText("Model Settings", false); |
162 | | - return new ContainerButton[]{ model, group }; |
| 198 | + animations = new ContainerButton(this, "animations", 300, 28, 4, y, null){ |
| 199 | + @Override |
| 200 | + public void addSubElements(){ |
| 201 | + this.elements.clear(); TurboList list = FMTB.MODEL.getFirstSelectedGroup(); |
| 202 | + int[] rows = new int[list == null ? 1 : list.animations.size() + 1]; |
| 203 | + for(int i = 0; i < rows.length; i++) rows[i] = 1; this.initRowData(rows); |
| 204 | + if(list == null){ return; } |
| 205 | + for(int i = 0; i < rows.length - 1; i++){ int j = i; |
| 206 | + this.elements.add(new TextField(this, "group_animation_" + i, 0, 0, 0) { |
| 207 | + @Override |
| 208 | + protected boolean processButtonClick(int x, int y, boolean left){ |
| 209 | + if(left){ |
| 210 | + Animation anim = list.animations.get(j); this.deselect(); |
| 211 | + FMTB.MODEL.updateFields(); if(anim == null) return true; |
| 212 | + AfterTask task = new AfterTask(){ |
| 213 | + @Override public void run(){ FMTB.MODEL.updateFields(); } |
| 214 | + }; task.settings = anim.settings; UserInterface.SETTINGSBOX.reset(); |
| 215 | + UserInterface.SETTINGSBOX.show("[" + anim.id + "] Settings", task); |
| 216 | + } |
| 217 | + else{ |
| 218 | + list.animations.remove(j); this.deselect(); FMTB.MODEL.updateFields(); |
| 219 | + } |
| 220 | + return true; |
| 221 | + } |
| 222 | + }.setText("[" + i + "] " + list.animations.get(i).id, true).setRowCol(i + 1, 0)); |
| 223 | + } |
| 224 | + this.initHeight(); return; |
| 225 | + } |
| 226 | + }; |
| 227 | + animations.setText("Group Animations", false); |
| 228 | + return new ContainerButton[]{ model, group, animations }; |
163 | 229 | } |
164 | 230 |
|
165 | 231 | protected boolean updateRGB(Boolean apply, int j){ |
|
0 commit comments