mirror of
https://github.com/JannisX11/blockbench.git
synced 2025-02-05 15:50:21 +08:00
Fix delete not working on animation controllers
This commit is contained in:
parent
4467fcad1c
commit
8f1524a555
@ -748,7 +748,7 @@ class AnimationController extends AnimationItem {
|
|||||||
}
|
}
|
||||||
AnimationController.all.remove(this)
|
AnimationController.all.remove(this)
|
||||||
if (undo) {
|
if (undo) {
|
||||||
Undo.finishEdit('Remove animation', {animation_controllers: []})
|
Undo.finishEdit('Remove animation controller', {animation_controllers: []})
|
||||||
|
|
||||||
if (isApp && remove_from_file && this.path && fs.existsSync(this.path)) {
|
if (isApp && remove_from_file && this.path && fs.existsSync(this.path)) {
|
||||||
Blockbench.showMessageBox({
|
Blockbench.showMessageBox({
|
||||||
@ -761,10 +761,10 @@ class AnimationController extends AnimationItem {
|
|||||||
if (result == 0) {
|
if (result == 0) {
|
||||||
let content = fs.readFileSync(this.path, 'utf-8');
|
let content = fs.readFileSync(this.path, 'utf-8');
|
||||||
let json = autoParseJSON(content, false);
|
let json = autoParseJSON(content, false);
|
||||||
if (json && json.animations && json.animations[this.name]) {
|
if (json && json.animation_controllers && json.animation_controllers[this.name]) {
|
||||||
delete json.animations[this.name];
|
delete json.animation_controllers[this.name];
|
||||||
Blockbench.writeFile(this.path, {content: compileJSON(json)});
|
Blockbench.writeFile(this.path, {content: compileJSON(json)});
|
||||||
Undo.history.last().before.animations[this.uuid].saved = false
|
Undo.history.last().before.animation_controllers[this.uuid].saved = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -1822,8 +1822,8 @@ const BARS = {
|
|||||||
TickUpdates.selection = true;
|
TickUpdates.selection = true;
|
||||||
Undo.finishEdit('Delete elements')
|
Undo.finishEdit('Delete elements')
|
||||||
|
|
||||||
} else if (Prop.active_panel == 'animations' && Animation.selected) {
|
} else if (Prop.active_panel == 'animations' && AnimationItem.selected) {
|
||||||
Animation.selected.remove(true)
|
AnimationItem.selected.remove(true)
|
||||||
|
|
||||||
} else if (Prop.active_panel == 'animation_controllers' && AnimationController.selected?.selected_state) {
|
} else if (Prop.active_panel == 'animation_controllers' && AnimationController.selected?.selected_state) {
|
||||||
AnimationController.selected?.selected_state.remove(true);
|
AnimationController.selected?.selected_state.remove(true);
|
||||||
|
Loading…
Reference in New Issue
Block a user