modular everything

This commit is contained in:
Persephone Bubblegum-Holidy 2025-05-28 14:49:59 -07:00
parent e4bb42cf6a
commit 297b5e53b6
29 changed files with 660 additions and 1697 deletions

View file

@ -4,27 +4,7 @@ var animation_player : AnimationPlayer
var animation_tree : AnimationTree
var blend_tree : AnimationNodeBlendTree
var movement_states = {
"Mouth": [false, 0.0, 0.0, 0.0],
"Left Ear": [false, 0.0, 0.0, 0.0],
"Right Ear": [false, 0.0, 0.0, 0.0],
"Left Eyelid": [false, 0.0, 0.0, 0.0],
"Right Eyelid": [false, 0.0, 0.0, 0.0],
"Eyes Left": [false, 0.0, 0.0, 0.0],
"Eyes Right": [false, 0.0, 0.0, 0.0],
"Head Left": [false, 0.0, 0.0, 0.0],
"Head Right": [false, 0.0, 0.0, 0.0],
"Head Up": [false, 0.0, 0.0, 0.0],
"Left Arm Up": [false, 0.0, 0.0, 0.0],
"Left Arm Twist": [false, 0.0, 0.0, 0.0],
"Left Elbow": [false, 0.0, 0.0, 0.0],
"Right Arm Up": [false, 0.0, 0.0, 0.0],
"Right Arm Twist": [false, 0.0, 0.0, 0.0],
"Right Elbow": [false, 0.0, 0.0, 0.0],
"Body Left": [false, 0.0, 0.0, 0.0],
"Body Right": [false, 0.0, 0.0, 0.0],
"Body Lean": [false, 0.0, 0.0, 0.0],
}
var movement_states : Dictionary
func _ready():
animation_player = $AnimationPlayer
@ -37,10 +17,13 @@ func _ready():
animation_tree.active = true
blend_tree = animation_tree.tree_root as AnimationNodeBlendTree
#animation_player.speed_scale = 0
animation_player.speed_scale = 0
var animations = animation_player.get_animation_list()
for animation in animations:
movement_states[animation] = [false, 0.0, 0.0, 0.0]
var prev_name = "Anim_" + animations[0]
var old_time_name = "Time_" + animations[0]
var old_seek_name = "Seek_" + animations[0]
@ -78,8 +61,8 @@ func _ready():
var add_node := AnimationNodeAdd2.new()
blend_tree.add_node(add_name, add_node)
blend_tree.connect_node(time_name,0,anim_name)
blend_tree.connect_node(seek_name,0,time_name)
blend_tree.connect_node(time_name, 0, anim_name)
blend_tree.connect_node(seek_name, 0, time_name)
blend_tree.connect_node(add_name, 0, prev_name)
blend_tree.connect_node(add_name, 1, seek_name)
prev_name = add_name

10
Scripts/CameraButton.gd Normal file
View file

@ -0,0 +1,10 @@
extends Control
@export var camera : String
@export var base_scene_path : String
func _ready() -> void:
$Button.text = camera
func _on_button_pressed() -> void:
get_node(base_scene_path + camera).current = true;

View file

@ -0,0 +1 @@
uid://dfoog0y2bh7tk

View file

@ -6,15 +6,66 @@ var index : int = 0
var playback_rate : int = 1
var transport_enabled : bool = false
var erase_validated : bool = false
var cam_index : int = 0
var showtape_loaded : bool = false
var show_name : String
var current_stage : String = "Helen House"
var current_stage : String
var stages_info = {
# stage name, custom (bool), bits, flyout path, movement row table path, base scene path, ust character flag, ust stage flag
"Helen House": [true, 32, "res://Scenes/Stages/Helen House/HelenHouseFlyout.tscn", "res://Scenes/Stages/Helen House/HelenHouseMovementRows.tscn", "res://Scenes/Stages/Helen House/HelenHouse.tscn", "Mitzi/Helen", "Rockafire Explosion/3-Stage (Single Character)"]
"Helen House":
{
"bits": 32,
"scene": "res://Scenes/Stages/HelenHouse.tscn",
"scene_ref_base": "SubViewport/HelenHouse/",
"camera_count": 2,
"ust_character": "Mitzi/Helen",
"ust_stage": "Rockafire Explosion/3-Stage (Single Character)",
"bit_mapping":
{
"Helen":
{
"Mouth": [3.0, 2.0],
"Left Ear": [3.5, 1.5],
"Right Ear": [3.5, 1.5],
"Left Eyelid": [1.5, 2.0],
"Right Eyelid": [1.5, 2.0],
"Eyes Left": [3.5, 1.5],
"Eyes Right": [3.5, 1.5],
"Head Left": [1.5, 1.5],
"Head Right": [1.5, 1.5],
"Head Up": [1.0, 1.0],
"Left Arm Up": [0.8, 0.6],
"Left Arm Twist": [0.8, 0.8],
"Left Elbow": [1.0, 1.0],
"Right Arm Up": [0.8, 0.6],
"Right Arm Twist": [0.8, 0.8],
"Right Elbow": [1.0, 1.0],
"Body Left": [0.7, 0.7],
"Body Right": [0.7, 0.7],
"Body Lean": [1.0, 0.8],
},
"None":
{
"Unused 20": ["None"],
"Unused 21": ["None"],
"Unused 22": ["None"],
"Unused 23": ["None"],
"Unused 24": ["None"],
"Unused 25": ["None"],
"Unused 26": ["None"],
"Unused 27": ["None"],
"Unused 28": ["None"],
"Unused 29": ["None"],
"Unused 30": ["None"],
"Unused 31": ["None"],
"Unused 32": ["None"],
}
}
}
}
signal step(amount: int)
@ -23,13 +74,74 @@ signal end_recording()
signal return_to_zero()
signal erase_all()
func reload_stage(stage_previously_loaded: bool) -> void:
$SequencerPanel/TimelinePanel/VScrollBar.value = 0
if (stage_previously_loaded):
$CameraPreview.visible = false
for row in $SequencerPanel/TimelinePanel/InvisibleMask/MovementRowsContainer.get_children():
row.queue_free()
for row in $FlyoutPanel/FlowControls/InvisibleMask.get_children():
row.queue_free()
$SubViewport.get_child(0).queue_free()
var stage = load(stages_info[current_stage]["scene"]).instantiate()
$SubViewport.add_child(stage)
var cam_offset = 4
for i in range(1, stages_info[current_stage]["camera_count"]+1):
var camera_button = load("res://Scenes/GUI/Controls/CameraButton.tscn").instantiate()
camera_button.camera = "Angle " + str(i)
camera_button.base_scene_path = "../../../" + stages_info[current_stage]["scene_ref_base"]
camera_button.position.y = cam_offset
cam_offset += 36
$FlyoutPanel/Camera.add_child(camera_button)
$FlyoutPanel/Camera.size.y = cam_offset
var rows_offset = 0
var flows_offset = 0
var bit_idx = 1
var flow_count = 0
for bot in stages_info[current_stage]["bit_mapping"]:
for movement in stages_info[current_stage]["bit_mapping"][bot]:
var movement_flows = stages_info[current_stage]["bit_mapping"][bot][movement]
if (movement_flows[0] is not String):
var flow_control = load("res://Scenes/GUI/Controls/FlowControl.tscn").instantiate()
flow_control.position.y = flows_offset
flow_control.name = bot + " " + movement
flow_control.in_value = movement_flows[0]
flow_control.out_value = movement_flows[1]
$FlyoutPanel/FlowControls/InvisibleMask/FlowHandle.add_child(flow_control)
flows_offset += 44
flow_count += 1
var row = load("res://Scenes/GUI/Controls/MovementRow.tscn").instantiate()
row.position.y = rows_offset
row.base_scene_path = "../../../../../" + stages_info[current_stage]["scene_ref_base"]
row.animatronic = bot
if (movement_flows[0] is String): row.flow_path = "None"
row.movement_bit = bit_idx
row.movement_name = movement
$SequencerPanel/TimelinePanel/InvisibleMask/MovementRowsContainer.add_child(row)
var movement_button = load("res://Scenes/GUI/Controls/MovementButton.tscn").instantiate()
movement_button.position.y = rows_offset
movement_button.base_scene_path = "../../../../../" + stages_info[current_stage]["scene_ref_base"]
movement_button.animatronic = bot
if (movement_flows[0] is String): movement_button.flow_path = "None"
movement_button.movement_name = movement
$FlyoutPanel/Movements/InvisibleMask/MovementHandle.add_child(movement_button)
rows_offset += 44
bit_idx += 1
$SequencerPanel/TimelinePanel/VScrollBar.max_value = stages_info[current_stage]["bits"] - 1
$FlyoutPanel/Movements/VScrollBar.max_value = stages_info[current_stage]["bits"] - 1
$FlyoutPanel/FlowControls/VScrollBar.max_value = flow_count - 1
$CameraPreview.visible = true
func update_time_label() -> void:
var frames = index % 60
var seconds = floori(index/60) % 60
var minutes = floori(index/3600) % 60
var hours = floori(index/216000)
$SequencerPanel/TransportControls/TimeLabel.text = "%d:%02d:%02d:%02d" % [hours, minutes, seconds, frames]
#$SequencerPanel/TransportControls/TimeLabel.text = str(index)
func set_transport_enabled(enabled: bool):
$SequencerPanel/TransportControls/Centered/StepBackwardsButton.disabled = !enabled
@ -48,6 +160,12 @@ func _ready() -> void:
erase_all.connect(_erase_all)
$MenuBar/MenuButton.get_popup().id_pressed.connect(_showtape_menu_button_pressed)
OS.request_permissions()
current_stage = $MenuBar/StageSelector.get_item_text($MenuBar/StageSelector.selected)
reload_stage(false)
func _on_stage_selector_item_selected(_index: int) -> void:
current_stage = $MenuBar/StageSelector.get_item_text($MenuBar/StageSelector.selected)
reload_stage(true)
func _showtape_menu_button_pressed(id: int) -> void:
match (id):
@ -110,7 +228,7 @@ func _on_showtape_load_open_button_pressed() -> void:
var file = FileAccess.open($ShowtapeLoadScreen/DialogPanel/InFilePath.text.strip_edges(), FileAccess.READ)
var content = file.get_as_text()
var header = content.split(";")[0].split(",")
if ((int(header[3]) != stages_info[current_stage][1]) || (header[4] != stages_info[current_stage][6])|| (header[5] != stages_info[current_stage][5])):
if ((int(header[3]) != stages_info[current_stage]["bits"]) || (header[4] != stages_info[current_stage]["ust_stage"])|| (header[5] != stages_info[current_stage]["ust_character"])):
$IncorrectShowtapeDialog.dialog_text = "This showtape is not compatible with the currently selected stage.\nShowtape stage type: %s\nShowtape character(s): %s" % [header[4], header[5]]
$IncorrectShowtapeDialog.show()
return
@ -151,6 +269,9 @@ func _input(event: InputEvent) -> void:
if event.is_action_pressed("toggle_editor_screen"):
$CameraPreview.visible = !$CameraPreview.visible;
$CameraFullScreen.visible = !$CameraFullScreen.visible;
if (event.is_action_pressed("cycle_camera_angle")):
cam_index += 1
get_node("SubViewport/HelenHouse/Angle " + str((cam_index % stages_info[current_stage]["camera_count"])+1)).current = true
if (transport_enabled):
if event.is_action_pressed("sequencer_play_pause"):
if (playing): _on_pause_button_pressed()
@ -214,7 +335,13 @@ func _on_input_eater_pressed() -> void:
$ShowtapeSaveScreen.visible = false
func _on_v_scroll_bar_value_changed(value: float) -> void:
$SequencerPanel/TimelinePanel/InvisibleMask/RowsHandle.position.y = value * -44
$SequencerPanel/TimelinePanel/InvisibleMask/MovementRowsContainer.position.y = value * -44
func _on_flow_v_scroll_bar_value_changed(value: float) -> void:
$FlyoutPanel/FlowControls/InvisibleMask/FlowHandle.position.y = value * -44
func _on_movement_v_scroll_bar_value_changed(value: float) -> void:
$FlyoutPanel/Movements/InvisibleMask/MovementHandle.position.y = value * -44
func _erase_all() -> void:
playing = false
@ -229,6 +356,21 @@ func _erase_all() -> void:
showtape_loaded = false
$MenuBar/EditingLabel.text = "No showtape loaded."
func _on_movements_flyout_button_toggled(toggled_on: bool) -> void:
$FlyoutPanel/Movements.visible = toggled_on
func _on_flows_flyout_button_toggled(toggled_on: bool) -> void:
$FlyoutPanel/FlowControls.visible = toggled_on
func _on_camera_flyout_button_toggled(toggled_on: bool) -> void:
$FlyoutPanel/Camera.visible = toggled_on
func _on_cosmetics_flyout_button_toggled(toggled_on: bool) -> void:
$FlyoutPanel/Cosmetics.visible = toggled_on
func _on_stage_flyout_button_toggled(toggled_on: bool) -> void:
$FlyoutPanel/Stage.visible = toggled_on
func _on_play_button_pressed() -> void:
playback_rate = 1
@ -294,14 +436,14 @@ func save_data() -> String:
var write_out : String = ""
var temp_data = []
var longest_channel = 0
for movement_row in $SequencerPanel/TimelinePanel/InvisibleMask/RowsHandle.get_child(0).get_children():
for movement_row in $SequencerPanel/TimelinePanel/InvisibleMask/MovementRowsContainer.get_children():
temp_data.append(movement_row.movements)
if (movement_row.movements.size() > longest_channel): longest_channel = movement_row.movements.size()
for i in range(longest_channel+1):
var frame_byte = 0
for j in range(stages_info[current_stage][1]):
for j in range(stages_info[current_stage]["bits"]):
if (index_get_safe(i, temp_data[j])): frame_byte += 1 << j;
write_out += ("%0"+str(stages_info[current_stage][1]/4)+"X,") % frame_byte
write_out += ("%0"+str(stages_info[current_stage]["bits"]/4)+"X,") % frame_byte
return write_out
func plot_data(data: String):
@ -309,13 +451,13 @@ func plot_data(data: String):
for frame_string in data.split(","):
if (frame_string == ""): continue
var frame_byte = frame_string.hex_to_int()
for i in range(stages_info[current_stage][1]):
for i in range(stages_info[current_stage]["bits"]):
var er = false
if ((frame_byte & int(pow(2, i))) >> i == 1):
er = true
$SequencerPanel/TimelinePanel/InvisibleMask/RowsHandle.get_child(0).get_child(i).etching = er
$SequencerPanel/TimelinePanel/InvisibleMask/MovementRowsContainer.get_child(i).etching = er
step.emit(1)
for movement_row in $SequencerPanel/TimelinePanel/InvisibleMask/RowsHandle.get_child(0).get_children():
for movement_row in $SequencerPanel/TimelinePanel/InvisibleMask/MovementRowsContainer.get_children():
movement_row.etching = false
end_recording.emit()
return_to_zero.emit()

34
Scripts/FlowControl.gd Normal file
View file

@ -0,0 +1,34 @@
extends Control
@export var in_value : float = 1.0
@export var out_value : float = 1.0
signal in_value_updated(new_value: float)
signal out_value_updated(new_value: float)
func _ready() -> void:
$Panel/Label.text = self.name
$Panel/InSlider.value = self.in_value
$Panel/InStepper.value = self.in_value
$Panel/OutSlider.value = self.out_value
$Panel/OutStepper.value = self.out_value
func _on_in_slider_value_changed(value: float) -> void:
self.in_value = $Panel/InSlider.value
$Panel/InStepper.value = value
in_value_updated.emit(value)
func _on_in_stepper_value_changed(value: float) -> void:
self.in_value = $Panel/InStepper.value
$Panel/InSlider.value = value
in_value_updated.emit(value)
func _on_out_slider_value_changed(value: float) -> void:
self.out_value = $Panel/OutSlider.value
$Panel/OutStepper.value = value
out_value_updated.emit(value)
func _on_out_stepper_value_changed(value: float) -> void:
self.out_value = $Panel/OutStepper.value
$Panel/OutSlider.value = value
out_value_updated.emit(value)

View file

@ -1,13 +0,0 @@
extends Control
@export var value : float = 1.0
signal value_updated(new_value: float)
func _ready() -> void:
$Panel/Slider.value = self.value
func _on_slider_value_changed(value: float) -> void:
self.value = $Panel/Slider.value
$Panel/ValueLabel.text = str(self.value)
value_updated.emit(value)

View file

@ -3,12 +3,12 @@ extends Control
signal movement_in(movement, rate)
signal movement_out(movement, rate)
var cam_index : int = 0
func _ready() -> void:
var animatronic = get_node("../SubViewport/HelenHouse/3stHelen")
movement_in.connect(animatronic._movement_in)
movement_out.connect(animatronic._movement_out)
#var animatronic = get_node("../SubViewport/HelenHouse/Helen")
#movement_in.connect(animatronic._movement_in)
#movement_out.connect(animatronic._movement_out)
movement_in.connect(self._movement_in)
movement_out.connect(self._movement_out)
@ -23,156 +23,8 @@ func _movement_in(movement, _rate):
func _movement_out(movement, _rate):
get_node("Movements/IndicatorLights/" + movement).turn_off();
func _on_movements_flyout_button_toggled(toggled_on: bool) -> void:
$Movements.visible = toggled_on
func _on_flows_flyout_button_toggled(toggled_on: bool) -> void:
$FlowControls.visible = toggled_on
func _on_camera_flyout_button_toggled(toggled_on: bool) -> void:
$Camera.visible = toggled_on
func _on_cosmetics_flyout_button_toggled(toggled_on: bool) -> void:
$Cosmetics.visible = toggled_on
func _on_stage_flyout_button_toggled(toggled_on: bool) -> void:
$Stage.visible = toggled_on
func _on_angle_1_button_pressed() -> void:
get_node("../SubViewport/HelenHouse/Camera 1").current = true
func _on_angle_2_button_pressed() -> void:
get_node("../SubViewport/HelenHouse/Camera 2").current = true
func _on_mouth_button_down() -> void:
movement_in.emit("Mouth", $FlowControls/InFlows/MouthFlow.value)
func _on_mouth_button_up() -> void:
movement_out.emit("Mouth", $FlowControls/OutFlows/MouthFlow.value)
func _on_left_ear_button_down() -> void:
movement_in.emit("Left Ear", $FlowControls/InFlows/LeftEarFlow.value)
func _on_left_ear_button_up() -> void:
movement_out.emit("Left Ear", $FlowControls/OutFlows/LeftEarFlow.value)
func _on_right_ear_button_down() -> void:
movement_in.emit("Right Ear", $FlowControls/InFlows/RightEarFlow.value)
func _on_right_ear_button_up() -> void:
movement_out.emit("Right Ear", $FlowControls/OutFlows/RightEarFlow.value)
func _on_left_eyelid_button_down() -> void:
movement_in.emit("Left Eyelid", $FlowControls/InFlows/LeftEyelidFlow.value)
func _on_left_eyelid_button_up() -> void:
movement_out.emit("Left Eyelid", $FlowControls/OutFlows/LeftEyelidFlow.value)
func _on_right_eyelid_button_down() -> void:
movement_in.emit("Right Eyelid", $FlowControls/InFlows/RightEyelidFlow.value)
func _on_right_eyelid_button_up() -> void:
movement_out.emit("Right Eyelid", $FlowControls/OutFlows/RightEyelidFlow.value)
func _on_eyes_left_button_down() -> void:
movement_in.emit("Eyes Left", $FlowControls/InFlows/EyesLeftFlow.value)
func _on_eyes_left_button_up() -> void:
movement_out.emit("Eyes Left", $FlowControls/OutFlows/EyesLeftFlow.value)
func _on_eyes_right_button_down() -> void:
movement_in.emit("Eyes Right", $FlowControls/InFlows/EyesRightFlow.value)
func _on_eyes_right_button_up() -> void:
movement_out.emit("Eyes Right", $FlowControls/OutFlows/EyesRightFlow.value)
func _on_head_left_button_down() -> void:
movement_in.emit("Head Left", $FlowControls/InFlows/HeadLeftFlow.value)
func _on_head_left_button_up() -> void:
movement_out.emit("Head Left", $FlowControls/OutFlows/HeadLeftFlow.value)
func _on_head_right_button_down() -> void:
movement_in.emit("Head Right", $FlowControls/InFlows/HeadRightFlow.value)
func _on_head_right_button_up() -> void:
movement_out.emit("Head Right", $FlowControls/OutFlows/HeadRightFlow.value)
func _on_head_up_button_down() -> void:
movement_in.emit("Head Up", $FlowControls/InFlows/HeadUpFlow.value)
func _on_head_up_button_up() -> void:
movement_out.emit("Head Up", $FlowControls/OutFlows/HeadUpFlow.value)
func _on_left_arm_up_button_down() -> void:
movement_in.emit("Left Arm Up", $FlowControls/InFlows/LeftArmUpFlow.value)
func _on_left_arm_up_button_up() -> void:
movement_out.emit("Left Arm Up", $FlowControls/OutFlows/LeftArmUpFlow.value)
func _on_left_arm_twist_button_down() -> void:
movement_in.emit("Left Arm Twist", $FlowControls/InFlows/LeftArmTwistFlow.value)
func _on_left_arm_twist_button_up() -> void:
movement_out.emit("Left Arm Twist", $FlowControls/OutFlows/LeftArmTwistFlow.value)
func _on_left_elbow_button_down() -> void:
movement_in.emit("Left Elbow", $FlowControls/InFlows/LeftElbowFlow.value)
func _on_left_elbow_button_up() -> void:
movement_out.emit("Left Elbow", $FlowControls/OutFlows/LeftElbowFlow.value)
func _on_right_arm_up_button_down() -> void:
movement_in.emit("Right Arm Up", $FlowControls/InFlows/RightArmUpFlow.value)
func _on_right_arm_up_button_up() -> void:
movement_out.emit("Right Arm Up", $FlowControls/OutFlows/RightArmUpFlow.value)
func _on_right_arm_twist_button_down() -> void:
movement_in.emit("Right Arm Twist", $FlowControls/InFlows/RightArmTwistFlow.value)
func _on_right_arm_twist_button_up() -> void:
movement_out.emit("Right Arm Twist", $FlowControls/OutFlows/RightArmTwistFlow.value)
func _on_right_elbow_button_down() -> void:
movement_in.emit("Right Elbow", $FlowControls/InFlows/RightElbowFlow.value)
func _on_right_elbow_button_up() -> void:
movement_out.emit("Right Elbow", $FlowControls/OutFlows/RightElbowFlow.value)
func _on_body_left_button_down() -> void:
movement_in.emit("Body Left", $FlowControls/InFlows/BodyLeftFlow.value)
func _on_body_left_button_up() -> void:
movement_out.emit("Body Left", $FlowControls/OutFlows/BodyLeftFlow.value)
func _on_body_right_button_down() -> void:
movement_in.emit("Body Right", $FlowControls/InFlows/BodyRightFlow.value)
func _on_body_right_button_up() -> void:
movement_out.emit("Body Right", $FlowControls/OutFlows/BodyRightFlow.value)
func _on_body_lean_button_down() -> void:
movement_in.emit("Body Lean", $FlowControls/InFlows/BodyLeanFlow.value)
func _on_body_lean_button_up() -> void:
movement_out.emit("Body Lean", $FlowControls/OutFlows/BodyLeanFlow.value)

View file

@ -1,22 +0,0 @@
extends Control
@export var on: bool = false
func _ready() -> void:
$Green.visible = self.on
func turn_on() -> void:
self.on = true
$Green.visible = self.on
func turn_off() -> void:
self.on = false
$Green.visible = self.on
func toggle() -> void:
self.on = !self.on
$Green.visible = self.on
func set_state(value: bool) -> void:
self.on = value
$Green.visible = self.on

39
Scripts/MovementButton.gd Normal file
View file

@ -0,0 +1,39 @@
extends Control
signal movement_in(movement, rate)
signal movement_out(movement, rate)
@export var animatronic : String
@export var base_scene_path : String
@export var flow_path : String = "../../../../../FlyoutPanel/FlowControls/InvisibleMask/FlowHandle/"
@export var movement_name : String
var in_flow : float = 1.0
var out_flow : float = 1.0
func _ready() -> void:
$Panel/Button.text = animatronic + " " + movement_name
if (animatronic != "None"):
var animatronic_node = get_node(base_scene_path + animatronic)
movement_in.connect(animatronic_node._movement_in)
movement_out.connect(animatronic_node._movement_out)
if (flow_path != "None"):
var flow_control = get_node(flow_path + animatronic + " " + movement_name)
flow_control.in_value_updated.connect(self._update_in_flow)
flow_control.out_value_updated.connect(self._update_out_flow)
in_flow = flow_control.in_value
out_flow = flow_control.out_value
func _update_in_flow(new_value: float) -> void:
in_flow = new_value
func _update_out_flow(new_value: float) -> void:
out_flow = new_value
func _on_button_button_down() -> void:
movement_in.emit(movement_name, in_flow)
$Panel/IndicatorPanel/Green.visible = true
func _on_button_button_up() -> void:
movement_out.emit(movement_name, out_flow)
$Panel/IndicatorPanel/Green.visible = false

View file

@ -2,8 +2,9 @@ extends Panel
@export var movement_bit : int = 0
@export var movement_name : String = "Name"
@export var flow_path : String = "../../../../../../HelenHouseFlyout/FlowControls/"
@export var animatronic_path : String = "../../../../../../SubViewport/HelenHouse/3stHelen"
@export var flow_path : String = "../../../../../FlyoutPanel/FlowControls/InvisibleMask/FlowHandle/"
@export var base_scene_path : String
@export var animatronic : String
@export var movements : Array[bool]
@export var etching: bool = false
@ -54,7 +55,7 @@ func check_at_index(cindex: int) -> bool:
return out
func _step(amount: int):
if (recording):
if (recording && !$LockButton.button_pressed):
if (etching): set_at_current()
else: unset_at_current()
if (playing):
@ -91,7 +92,8 @@ func _end_playback():
playing = false
func update_text() -> void:
$Button.text = "%d - %s (%s)" % [movement_bit, movement_name, key_binding.as_text() if key_binding.keycode != 0 else "Unbound"]
if (animatronic == "None"): $Button.text = "%d - Unused (%s)" % [movement_bit, key_binding.as_text() if key_binding.keycode != 0 else "Unbound"]
else: $Button.text = "%d - %s %s (%s)" % [movement_bit, animatronic, movement_name, key_binding.as_text() if key_binding.keycode != 0 else "Unbound"]
func _update_in_flow(new_value: float) -> void:
in_flow = new_value
@ -101,19 +103,18 @@ func _update_out_flow(new_value: float) -> void:
func _ready() -> void:
if (flow_path != "None"):
var if_node = get_node(flow_path + "InFlows/" + movement_name.replace(" ", "") + "Flow")
var of_node = get_node(flow_path + "OutFlows/" + movement_name.replace(" ", "") + "Flow")
if_node.value_updated.connect(self._update_in_flow)
of_node.value_updated.connect(self._update_out_flow)
in_flow = if_node.value
out_flow = of_node.value
if (animatronic_path != "None"):
var animatronic = get_node(animatronic_path)
movement_in.connect(animatronic._movement_in)
movement_out.connect(animatronic._movement_out)
var flow_control = get_node(flow_path + animatronic + " " + movement_name)
flow_control.in_value_updated.connect(self._update_in_flow)
flow_control.out_value_updated.connect(self._update_out_flow)
in_flow = flow_control.in_value
out_flow = flow_control.out_value
if (animatronic != "None"):
var animatronic_node = get_node(base_scene_path + animatronic)
movement_in.connect(animatronic_node._movement_in)
movement_out.connect(animatronic_node._movement_out)
movement_in.connect(self._movement_in)
movement_out.connect(self._movement_out)
var editor = get_node("../../../../../../")
var editor = get_node("../../../../../")
editor.step.connect(_step)
editor.start_recording.connect(_start_recording)
editor.end_recording.connect(_end_recording)