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