use of com.bladecoder.engineeditor.undo.UndoCreateSound in project bladecoder-adventure-engine by bladecoder.
the class EditSoundDialog method inputsToModel.
@Override
protected void inputsToModel(boolean create) {
if (create) {
e = new SoundDesc();
// UNDO OP
Ctx.project.getUndoStack().add(new UndoCreateSound(e));
} else {
HashMap<String, SoundDesc> sounds = parent.getSounds();
sounds.remove(e.getId());
}
String checkedId = parent.getSounds() == null ? id.getText() : ElementUtils.getCheckedId(id.getText(), parent.getSounds().keySet().toArray(new String[parent.getSounds().size()]));
e.setId(checkedId);
e.setFilename(filename.getText());
e.setLoop(Boolean.parseBoolean(loop.getText()));
e.setVolume(Float.parseFloat(volume.getText()));
e.setPan(Float.parseFloat(pan.getText()));
e.setPitch(Float.parseFloat(pitch.getText()));
e.setPreload(Boolean.parseBoolean(preload.getText()));
parent.getSounds().put(e.getId(), e);
Ctx.project.setModified();
}
Aggregations