Skip to content

[BUG] Clips lose broken-apart contents on undo #196

Description

@StickmanRed

Describe the bug
If you break apart a clip and then undo, the objects that were added to the main timeline disappear from the clip.

To reproduce
Steps to reproduce the behavior:

  1. Create a clip from objects
  2. Break apart the clip
  3. Undo once

Expected behavior
The broken-apart contents get added back to the clip

Editor version
This bug has been reproducible since Wick Editor: Wicklets/wick-editor#199

Do you have a suggested solution to this issue? (ex. has another program fixed this bug a certain way? Are you familiar with where in the code base someone would need to fix this issue?)
The drawable objects are removed from clip's frame and added to the active frame. So when the clip and its frames are added back, the frame doesn't have its contents anymore.

frame.clips.forEach(clip => {
clip.transformation.x += this.transformation.x;
clip.transformation.y += this.transformation.y;
this.parentTimeline.activeFrame.addClip(clip);
leftovers.push(clip);
});

To fix this, we could clone the objects and add the clones to the main timeline:

frame.clips.forEach(originalClip => {
    const clip = originalClip.clone(); // Keep parent of original object
    clip.transformation.x += this.transformation.x;
    clip.transformation.y += this.transformation.y;
    this.parentTimeline.activeFrame.addClip(clip);
    leftovers.push(clip);
});

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions