Search in sources :

Example 1 with UndoDeleteAnimation

use of com.bladecoder.engineeditor.undo.UndoDeleteAnimation in project bladecoder-adventure-engine by bladecoder.

the class SpriteList method delete.

@Override
protected void delete() {
    AnimationDesc d = removeSelected();
    AnimationRenderer renderer = (AnimationRenderer) parent.getRenderer();
    renderer.getAnimations().remove(d.id);
    // UNDO
    Ctx.project.getUndoStack().add(new UndoDeleteAnimation(parent, d));
    // init_animation
    if (renderer.getInitAnimation().equals(d.id)) {
        HashMap<String, AnimationDesc> animations = renderer.getAnimations();
        String newValue = null;
        if (animations.size() > 0)
            newValue = animations.keySet().iterator().next();
        renderer.setInitAnimation(newValue);
        Ctx.project.setModified(this, "init_animation", d.id, newValue);
    }
    Ctx.project.setModified();
}
Also used : AnimationDesc(com.bladecoder.engine.anim.AnimationDesc) UndoDeleteAnimation(com.bladecoder.engineeditor.undo.UndoDeleteAnimation) AnimationRenderer(com.bladecoder.engine.model.AnimationRenderer)

Aggregations

AnimationDesc (com.bladecoder.engine.anim.AnimationDesc)1 AnimationRenderer (com.bladecoder.engine.model.AnimationRenderer)1 UndoDeleteAnimation (com.bladecoder.engineeditor.undo.UndoDeleteAnimation)1