Skip to content

Commit abed282

Browse files
committed
Finished missing features, ready for public beta
1 parent 1224442 commit abed282

19 files changed

Lines changed: 2175 additions & 411 deletions

File tree

src/main/java/firemerald/mcms/Main.java

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public class Main
6565
{
6666
//public static final String VERSION = "0.0.0.0";
6767
public static final String ID = "mcms";
68-
public static final String VERSION = "Alpha 20";
68+
public static final String VERSION = "0.1";
6969
public static final String BUILD_DATE = "06/24/2020 18:08";
7070
public static final Logger LOGGER = LogManager.getLogger("MCMS"); //the main logger;
7171
public static Main instance;
@@ -140,9 +140,14 @@ public void setBlendMode(BlendMode mode)
140140
public ITool tool = null;
141141
public final EventBus EVENT_BUS = new EventBus("mcms_event_bus");
142142

143-
public void doAction(Action action)
143+
public boolean doAction(Action action)
144144
{
145-
if (action.canRun.getAsBoolean() && !getGui().onHotkey(action)) action.action.run();
145+
if (action.canRun.getAsBoolean() && !getGui().onHotkey(action))
146+
{
147+
action.action.run();
148+
return true;
149+
}
150+
else return false;
146151
}
147152

148153
public void openGui(@NonNull GuiScreen gui)

src/main/java/firemerald/mcms/Project.java

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,11 +143,15 @@ public void setName(String name)
143143
{
144144
this.name = name;
145145
}
146-
146+
147147
public int getTextureWidth()
148148
{
149149
return viewTextureWidth;
150150
}
151+
public int getProjectTextureWidth()
152+
{
153+
return textureWidth;
154+
}
151155

152156
public void setTextureWidth(int textureWidth)
153157
{
@@ -204,12 +208,17 @@ public void removeModelTextureWidth(String modelName)
204208
Main.instance.onGuiUpdate(GuiUpdate.TEXTURE);
205209
}
206210
}
207-
211+
208212
public int getTextureHeight()
209213
{
210214
return viewTextureHeight;
211215
}
212216

217+
public int getProjectTextureHeight()
218+
{
219+
return textureHeight;
220+
}
221+
213222
public void setTextureHeight(int textureHeight)
214223
{
215224
if (!overrideTextureHeight.containsKey(modelName)) viewTextureHeight = textureHeight;
@@ -310,6 +319,29 @@ public boolean useBackingSkeleton()
310319
return useBackingSkeleton;
311320
}
312321

322+
public void setBackingSkeleton(boolean use)
323+
{
324+
if (!use)
325+
{
326+
this.useBackingSkeleton = false;
327+
this.skeleton = null;
328+
this.rebuildBoneView();
329+
}
330+
else
331+
{
332+
this.useBackingSkeleton = true;
333+
this.skeleton = new Skeleton();
334+
this.models.values().forEach(model -> {
335+
skeleton.applySkeletonTransforms(model.getSkeleton());
336+
model.applySkeletonTransforms(skeleton = model.getSkeleton().applySkeleton(skeleton));
337+
model.getRootBones().forEach(bone -> addBoneView(bone, boneView));
338+
});
339+
this.models.values().forEach(model -> model.applySkeletonTransforms(skeleton));
340+
this.rebuildBoneView();
341+
}
342+
Main.instance.onGuiUpdate(GuiUpdate.PROJECT);
343+
}
344+
313345
public IRigged<?, ?> getRig()
314346
{
315347
return model == null ? useBackingSkeleton ? skeleton : null : model;

src/main/java/firemerald/mcms/gui/GuiPopup.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public boolean onHotkey(Action action)
6868
Main.instance.project.popUndoStack();
6969
return true;
7070
}
71-
else return super.onHotkey(action);
71+
else return true; //no actions while in a popup menu
7272
}
7373

7474
@Override

src/main/java/firemerald/mcms/gui/main/components/ComponentTitleBar.java

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
import firemerald.mcms.gui.plugins.GuiPopupPlugins;
1212
import firemerald.mcms.gui.popups.GuiPopupMenu;
1313
import firemerald.mcms.gui.popups.GuiPopupMessageOK;
14+
import firemerald.mcms.gui.popups.hotkeys.GuiPopupHotkeys;
1415
import firemerald.mcms.gui.themes.GuiThemes;
1516
import firemerald.mcms.plugin.PluginLoader;
1617
import firemerald.mcms.texture.Color;
@@ -45,7 +46,7 @@ public ComponentTitleBar(int x1, int y1, int x2, int y2, GuiMain gui)
4546
PopupMenu menu = new PopupMenu();
4647
addAction(menu, "New project", Action.NEW_PROJECT);
4748
addAction(menu, "Open project...", Action.LOAD_PROJECT);
48-
//addAction(menu, "Edit Project", Action.ED);
49+
addAction(menu, "Edit Project", Action.EDIT_PROJECT);
4950
addAction(menu, "Save project", Action.SAVE_PROJECT);
5051
addAction(menu, "Save project as...", Action.SAVE_PROJECT_AS);
5152
addAction(menu, "Export project", Action.EXPORT_PROJECT);
@@ -101,41 +102,46 @@ public ComponentTitleBar(int x1, int y1, int x2, int y2, GuiMain gui)
101102
PopupMenu menu = new PopupMenu();
102103
if (!Main.instance.state.showNodes())
103104
{
104-
MenuItem showNodes = new MenuItem("Show Nodes");
105+
MenuItem showNodes = new MenuItem("Show nodes");
105106
showNodes.addActionListener(action -> {
106107
Main.instance.state.setShowNodes(true);
107108
});
108109
menu.add(showNodes);
109110
}
110111
else
111112
{
112-
MenuItem hideNodes = new MenuItem("Hide Nodes");
113+
MenuItem hideNodes = new MenuItem("Hide nodes");
113114
hideNodes.addActionListener(action -> {
114115
Main.instance.state.setShowNodes(false);
115116
});
116117
menu.add(hideNodes);
117118
}
118119
if (!Main.instance.state.showBones())
119120
{
120-
MenuItem showBones = new MenuItem("Show Bones");
121+
MenuItem showBones = new MenuItem("Show bones");
121122
showBones.addActionListener(action -> {
122123
Main.instance.state.setShowBones(true);
123124
});
124125
menu.add(showBones);
125126
}
126127
else
127128
{
128-
MenuItem hideBones = new MenuItem("Hide Bones");
129+
MenuItem hideBones = new MenuItem("Hide bones");
129130
hideBones.addActionListener(action -> {
130131
Main.instance.state.setShowBones(false);
131132
});
132133
menu.add(hideBones);
133134
}
134-
MenuItem theme = new MenuItem("Change Theme");
135+
MenuItem theme = new MenuItem("Change theme");
135136
theme.addActionListener(action -> {
136137
new GuiThemes().activate();
137138
});
138139
menu.add(theme);
140+
MenuItem hotkeys = new MenuItem("Hotkeys");
141+
hotkeys.addActionListener(action -> {
142+
new GuiPopupHotkeys().activate();
143+
});
144+
menu.add(hotkeys);
139145
return menu;
140146
}));
141147
this.addElement(helpMenu = new TitleButton(x, 0, x += w, 16, 1, 0, "Help", () -> {

0 commit comments

Comments
 (0)