mirror of
https://github.com/JannisX11/blockbench.git
synced 2025-02-17 16:20:13 +08:00
Fix hold_on_last_frame animation only playing once
Add additional event hooks
This commit is contained in:
parent
437c1cd782
commit
cc25a0e637
@ -1265,7 +1265,7 @@ const Animator = {
|
||||
Blockbench.dispatchEvent('display_animation_frame')
|
||||
},
|
||||
loadFile(file) {
|
||||
var json = autoParseJSON(file.content)
|
||||
var json = file.json || autoParseJSON(file.content);
|
||||
if (json && typeof json.animations === 'object') {
|
||||
for (var ani_name in json.animations) {
|
||||
//Animation
|
||||
@ -1910,6 +1910,9 @@ const Timeline = {
|
||||
Timeline.playing = true
|
||||
BarItems.play_animation.setIcon('pause')
|
||||
Timeline.interval = setInterval(Timeline.loop, 100/6)
|
||||
if (Animator.selected.loop == 'hold' && Timeline.time >= (Animator.selected.length||1e3)) {
|
||||
Timeline.setTime(0)
|
||||
}
|
||||
Timeline.loop()
|
||||
},
|
||||
loop() {
|
||||
@ -1920,8 +1923,8 @@ const Timeline = {
|
||||
} else {
|
||||
if (Animator.selected.loop == 'once') {
|
||||
Timeline.setTime(0)
|
||||
Timeline.pause()
|
||||
Animator.preview()
|
||||
Timeline.pause()
|
||||
} else if (Animator.selected.loop == 'hold') {
|
||||
Timeline.pause()
|
||||
} else {
|
||||
|
@ -245,10 +245,13 @@ BARS.defineActions(function() {
|
||||
Undo.finishEdit('change global UV')
|
||||
}
|
||||
|
||||
Blockbench.dispatchEvent('update_project_settings', formResult);
|
||||
|
||||
BARS.updateConditions()
|
||||
if (EditSession.active) {
|
||||
EditSession.sendAll('change_project_meta', JSON.stringify(Project));
|
||||
}
|
||||
|
||||
dialog.hide()
|
||||
}
|
||||
})
|
||||
|
@ -20,6 +20,7 @@ class Mode extends KeybindItem {
|
||||
Modes.previous_id = Modes.selected.id;
|
||||
}
|
||||
if (typeof Modes.selected.onUnselect === 'function') {
|
||||
Blockbench.dispatchEvent('unselect_mode', {mode: Modes.selected})
|
||||
Modes.selected.onUnselect()
|
||||
}
|
||||
if (Modes.selected.selected) {
|
||||
@ -27,6 +28,7 @@ class Mode extends KeybindItem {
|
||||
}
|
||||
this.selected = true;
|
||||
Modes.id = this.id
|
||||
Mode.selected = this;
|
||||
Modes.selected = this;
|
||||
Modes[Modes.selected.id] = true;
|
||||
|
||||
@ -54,6 +56,7 @@ class Mode extends KeybindItem {
|
||||
BarItems.move_tool.select()
|
||||
}
|
||||
TickUpdates.selection = true;
|
||||
Blockbench.dispatchEvent('select_mode', {mode: this})
|
||||
}
|
||||
trigger() {
|
||||
if (Condition(this.condition)) {
|
||||
|
Loading…
Reference in New Issue
Block a user