Search in sources :

Example 1 with UndoCreateSound

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();
}
Also used : UndoCreateSound(com.bladecoder.engineeditor.undo.UndoCreateSound) SoundDesc(com.bladecoder.engine.model.SoundDesc)

Aggregations

SoundDesc (com.bladecoder.engine.model.SoundDesc)1 UndoCreateSound (com.bladecoder.engineeditor.undo.UndoCreateSound)1