fix recording and playback bugs
This commit is contained in:
parent
e1215c17b6
commit
8a6c19732a
2 changed files with 11 additions and 16 deletions
|
@ -5,8 +5,7 @@ var recording : bool = false
|
|||
var index : int = 0
|
||||
var playback_rate : int = 1
|
||||
|
||||
signal step_forward()
|
||||
signal step_backward()
|
||||
signal step(amount: int)
|
||||
signal start_recording()
|
||||
signal end_recording()
|
||||
signal return_to_zero()
|
||||
|
@ -29,8 +28,9 @@ func _input(event: InputEvent) -> void:
|
|||
|
||||
func _physics_process(_delta: float) -> void:
|
||||
if (playing || recording):
|
||||
step_forward.emit()
|
||||
index += 1
|
||||
step.emit(playback_rate)
|
||||
index += playback_rate
|
||||
if (index <= 0): _on_stop_button_pressed()
|
||||
update_time_label()
|
||||
|
||||
func _on_size_changed() -> void:
|
||||
|
@ -79,7 +79,7 @@ func _on_step_backwards_button_pressed() -> void:
|
|||
playing = false
|
||||
recording = false
|
||||
end_recording.emit()
|
||||
step_backward.emit()
|
||||
step.emit(-1)
|
||||
if (index != 0): index -= 1
|
||||
update_time_label()
|
||||
|
||||
|
@ -93,7 +93,7 @@ func _on_step_forward_button_pressed() -> void:
|
|||
playing = false
|
||||
recording = false
|
||||
end_recording.emit()
|
||||
step_forward.emit()
|
||||
step.emit(1)
|
||||
index += 1
|
||||
update_time_label()
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@ func check_at_current() -> bool:
|
|||
if (out == null): return false
|
||||
return out
|
||||
|
||||
func _step_forward():
|
||||
func _step(amount: int):
|
||||
if (recording && etching): set_at_current()
|
||||
elif (recording && !etching): unset_at_current()
|
||||
if (playing):
|
||||
|
@ -55,17 +55,13 @@ func _step_forward():
|
|||
if (playback_held_on_previous_frame):
|
||||
movement_out.emit(movement_name, out_flow)
|
||||
playback_held_on_previous_frame = false;
|
||||
current_index += 1
|
||||
$MovementsBG/InvisibleMask/MovementsHandle.position.x -= 2
|
||||
|
||||
func _step_backward():
|
||||
if (current_index == 0): return
|
||||
current_index -= 1
|
||||
$MovementsBG/InvisibleMask/MovementsHandle.position.x += 2
|
||||
current_index += amount
|
||||
$MovementsBG/InvisibleMask/MovementsHandle.position.x += -2*amount
|
||||
|
||||
func _return_to_zero():
|
||||
current_index = 0
|
||||
$MovementsBG/InvisibleMask/MovementsHandle.position.x = 120
|
||||
movement_out.emit(movement_name, out_flow)
|
||||
|
||||
func _start_recording():
|
||||
recording = true
|
||||
|
@ -102,8 +98,7 @@ func _ready() -> void:
|
|||
movement_in.connect(self._movement_in)
|
||||
movement_out.connect(self._movement_out)
|
||||
var editor = get_node("../../../../../../")
|
||||
editor.step_forward.connect(_step_forward)
|
||||
editor.step_backward.connect(_step_backward)
|
||||
editor.step.connect(_step)
|
||||
editor.start_recording.connect(_start_recording)
|
||||
editor.end_recording.connect(_end_recording)
|
||||
editor.return_to_zero.connect(_return_to_zero)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue