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:
- Create a clip from objects
- Break apart the clip
- 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);
});
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:
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.
Candlestick/engine/src/base/Clip.js
Lines 414 to 419 in cd59ad0
To fix this, we could clone the objects and add the clones to the main timeline: